@emailmaker/emailmaker 1.1.39 → 1.1.40

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.
@@ -1 +1 @@
1
- __emailmaker__.define(`static/core/7e6432e5.js`,[`require`,`exports`,`module`,`static/core/63a369c8.js`],function(e,t,n){let r=e("./63a369c8.js");var i=r.ui({invalidateBlockId:null,isCodeMode:!1,codeModeDirection:`right`,editorThemeColor:`light`,isSettingsDisabled:!1,settings:{width:``},elementSettings:{},searchFilters:{},block:{id:void 0,isNew:!1,subject:``,description:``,html:``,project:void 0,project_title:``,project_author:void 0,tags:[],type:`Other`,title:null,isAmp:!1},monacoDidMount:!1}),a=`blockSlice`,o=r.Li({name:a,initialState:i,reducers:{switchCodeMode:e=>{e.isCodeMode=!e.isCodeMode},setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setBlockSettings:(e,t)=>{Object.assign(e,{...e,settings:t.payload,isSettingsDisabled:!1})},setBlockSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,t)=>{e.elementSettings=t.payload},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},setBlockHtml:(e,t)=>{e.block.html=t.payload},resetBlockSlice:()=>i,setBlockIsAmp:(e,t)=>{e.block.isAmp=t.payload}},extraReducers:e=>{e.addMatcher(e=>e.type===`blocksApi/queries/queryResultPatched`,(e,t)=>{let n=t.payload.queryCacheKey.match(/\(([0-9]+)\)/),r=t.payload?.patches[0];if(r?.path?.[0]&&(e.block[r?.path[0]]=r.value),n?.[1]&&(e.invalidateBlockId=n[1]),t.payload.queryCacheKey.startsWith(`getBlock`)){let n=t.payload?.patches[0];n?.path?.[0]&&(e.block[n?.path[0]]=n.value)}}),e.addMatcher(e=>e.type===`blocksApi/invalidateTags`,(e,t)=>{if(t.payload[0].id===+e.invalidateBlockId)return{...i,isCodeMode:e?.isCodeMode,codeModeDirection:e.codeModeDirection}}),e.addMatcher(r.Kn.endpoints.editBlock.matchFulfilled,(e,{payload:t})=>{e.invalidateBlockId=null,e.block={...e.block,...t,renderGuid:e.block.renderGuid}}),e.addMatcher(r.Kn.endpoints.autoSaveBlock.matchFulfilled,(e,t)=>{e?.block.id?.toString()===t.payload.id?.toString()&&(e.block.html=t.payload.html)}),e.addMatcher(r.Kn.endpoints.getBlock.matchFulfilled,(e,{payload:t})=>{e.block={...i.block,...t}})}}),{switchCodeMode:s,setEditorThemeColor:c,setBlockSettings:l,setElementSettings:u,setBlockSettingsDisable:d,setSearchFilters:f,setBlockHtml:p,resetBlockSlice:m,setBlockIsAmp:h}=o.actions,g=e=>e[a].block,_=e=>e[a].isCodeMode,v=e=>e[a].settings,y=e=>e[a].searchFilters,b=e=>e[a].elementSettings,x=e=>e[a].editorThemeColor,S=e=>e[a].isSettingsDisabled,C=r.ui({isCollapsed:!0,isMonacoFocusing:!1}),w=`defaultModePanesSlice`,T=r.Li({name:w,initialState:C,reducers:{setMonacoFocusing:(e,t)=>{e.isMonacoFocusing=t.payload},resetPanes:()=>C}}),{resetPanes:E,setMonacoFocusing:D}=T.actions,O=e=>e[w].isMonacoFocusing;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u}}),Object.defineProperty(t,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(t,"c",{enumerable:!0,get:function(){return y}}),Object.defineProperty(t,"d",{enumerable:!0,get:function(){return b}}),Object.defineProperty(t,"f",{enumerable:!0,get:function(){return _}}),Object.defineProperty(t,"g",{enumerable:!0,get:function(){return c}}),Object.defineProperty(t,"h",{enumerable:!0,get:function(){return d}}),Object.defineProperty(t,"i",{enumerable:!0,get:function(){return D}}),Object.defineProperty(t,"l",{enumerable:!0,get:function(){return v}}),Object.defineProperty(t,"m",{enumerable:!0,get:function(){return l}}),Object.defineProperty(t,"n",{enumerable:!0,get:function(){return E}}),Object.defineProperty(t,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(t,"p",{enumerable:!0,get:function(){return S}}),Object.defineProperty(t,"r",{enumerable:!0,get:function(){return O}}),Object.defineProperty(t,"s",{enumerable:!0,get:function(){return g}}),Object.defineProperty(t,"t",{enumerable:!0,get:function(){return T}}),Object.defineProperty(t,"u",{enumerable:!0,get:function(){return x}}),Object.defineProperty(t,"v",{enumerable:!0,get:function(){return f}})});
1
+ __emailmaker__.define(`static/core/51eb8680.js`,[`require`,`exports`,`module`,`static/core/1fe0a005.js`],function(e,t,n){let r=e("./1fe0a005.js");var i=r._i({invalidateBlockId:null,isCodeMode:!1,codeModeDirection:`right`,editorThemeColor:`light`,isSettingsDisabled:!1,settings:{width:``},elementSettings:{},searchFilters:{},block:{id:void 0,isNew:!1,subject:``,description:``,html:``,project:void 0,project_title:``,project_author:void 0,tags:[],type:`Other`,title:null,isAmp:!1},monacoDidMount:!1}),a=`blockSlice`,o=r.Hi({name:a,initialState:i,reducers:{switchCodeMode:e=>{e.isCodeMode=!e.isCodeMode},setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setBlockSettings:(e,t)=>{Object.assign(e,{...e,settings:t.payload,isSettingsDisabled:!1})},setBlockSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,t)=>{e.elementSettings=t.payload},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},setBlockHtml:(e,t)=>{e.block.html=t.payload},resetBlockSlice:()=>i,setBlockIsAmp:(e,t)=>{e.block.isAmp=t.payload}},extraReducers:e=>{e.addMatcher(e=>e.type===`blocksApi/queries/queryResultPatched`,(e,t)=>{let n=t.payload.queryCacheKey.match(/\(([0-9]+)\)/),r=t.payload?.patches[0];if(r?.path?.[0]&&(e.block[r?.path[0]]=r.value),n?.[1]&&(e.invalidateBlockId=n[1]),t.payload.queryCacheKey.startsWith(`getBlock`)){let n=t.payload?.patches[0];n?.path?.[0]&&(e.block[n?.path[0]]=n.value)}}),e.addMatcher(e=>e.type===`blocksApi/invalidateTags`,(e,t)=>{if(t.payload[0].id===+e.invalidateBlockId)return{...i,isCodeMode:e?.isCodeMode,codeModeDirection:e.codeModeDirection}}),e.addMatcher(r.Qn.endpoints.editBlock.matchFulfilled,(e,{payload:t})=>{e.invalidateBlockId=null,e.block={...e.block,...t,renderGuid:e.block.renderGuid}}),e.addMatcher(r.Qn.endpoints.autoSaveBlock.matchFulfilled,(e,t)=>{e?.block.id?.toString()===t.payload.id?.toString()&&(e.block.html=t.payload.html)}),e.addMatcher(r.Qn.endpoints.getBlock.matchFulfilled,(e,{payload:t})=>{e.block={...i.block,...t}})}}),{switchCodeMode:s,setEditorThemeColor:c,setBlockSettings:l,setElementSettings:u,setBlockSettingsDisable:d,setSearchFilters:f,setBlockHtml:p,resetBlockSlice:m,setBlockIsAmp:h}=o.actions,g=e=>e[a].block,_=e=>e[a].isCodeMode,v=e=>e[a].settings,y=e=>e[a].searchFilters,b=e=>e[a].elementSettings,x=e=>e[a].editorThemeColor,S=e=>e[a].isSettingsDisabled,C=r._i({isCollapsed:!0,isMonacoFocusing:!1}),w=`defaultModePanesSlice`,T=r.Hi({name:w,initialState:C,reducers:{setMonacoFocusing:(e,t)=>{e.isMonacoFocusing=t.payload},resetPanes:()=>C}}),{resetPanes:E,setMonacoFocusing:D}=T.actions,O=e=>e[w].isMonacoFocusing;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u}}),Object.defineProperty(t,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(t,"c",{enumerable:!0,get:function(){return y}}),Object.defineProperty(t,"d",{enumerable:!0,get:function(){return b}}),Object.defineProperty(t,"f",{enumerable:!0,get:function(){return _}}),Object.defineProperty(t,"g",{enumerable:!0,get:function(){return c}}),Object.defineProperty(t,"h",{enumerable:!0,get:function(){return d}}),Object.defineProperty(t,"i",{enumerable:!0,get:function(){return D}}),Object.defineProperty(t,"l",{enumerable:!0,get:function(){return v}}),Object.defineProperty(t,"m",{enumerable:!0,get:function(){return l}}),Object.defineProperty(t,"n",{enumerable:!0,get:function(){return E}}),Object.defineProperty(t,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(t,"p",{enumerable:!0,get:function(){return S}}),Object.defineProperty(t,"r",{enumerable:!0,get:function(){return O}}),Object.defineProperty(t,"s",{enumerable:!0,get:function(){return g}}),Object.defineProperty(t,"t",{enumerable:!0,get:function(){return T}}),Object.defineProperty(t,"u",{enumerable:!0,get:function(){return x}}),Object.defineProperty(t,"v",{enumerable:!0,get:function(){return f}})});
@@ -0,0 +1 @@
1
+ __emailmaker__.define(`static/core/53240269.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/9b203bc9.js`],function(e,t,n){e("./354bf8a9.js"),t.default=e("./9b203bc9.js").t});
@@ -1 +1 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.setAttribute(`data-emailmaker`,`true`),e.appendChild(document.createTextNode(`@import "https://fonts.googleapis.com/css2?family=Geologica:wght@300;600&display=swap";.blocks-app .ant-modal.premium-features-modal .ant-modal-container{border-radius:calc(var(--borderRadiusXL) * 2px);padding:20px 19px}.blocks-app .premium-features-modal .modal-title{text-align:center;margin-bottom:0;font-size:32px}.blocks-app .premium-features-modal .ant-carousel .slick-dots li button{opacity:.5;background:#fff}.blocks-app .premium-features-modal .ant-carousel .slick-dots li.slick-active button{opacity:1}.blocks-app .premium-features-modal .modal-subtitle{text-align:center;margin-bottom:20px;font-size:18px}.blocks-app .premium-features-modal .carousel-slider{margin-bottom:20px}.blocks-app .premium-features-modal .slick-list{border-radius:calc(var(--borderRadiusXL) * 1.5px)}.blocks-app .premium-features-modal .slick-slide{padding:0 5px}.blocks-app .premium-features-modal .carousel-slide{border-radius:calc(var(--borderRadiusXL) * 1.5px);justify-content:flex-end;align-items:center;height:480px;display:flex}.blocks-app .premium-features-modal .slide-item-image{width:50%;padding:24px 0 24px 32px}.blocks-app .premium-features-modal .slide-item-image img{border-radius:calc(var(--borderRadiusXL) * 1.3px);width:100%}.blocks-app .premium-features-modal .slide-item-content{width:50%;padding:48px}.blocks-app .premium-features-modal .slide-title{margin-bottom:48px;font-size:50px;font-weight:700;line-height:1}.blocks-app .premium-features-modal .slide-description{font-size:22px}.blocks-app .premium-features-modal .modal-buttons{justify-content:center;gap:10px;display:flex}.blocks-app .premium-features-modal .modal-buttons button{padding:0 30px}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{box-sizing:border-box;flex-direction:row;justify-content:flex-end;align-items:center;width:100%;min-height:34px;padding:8px 8px 0;display:flex}.blocks-app .limit-upgrade-modal__close{background:var(--colorBgContainer);width:34px;height:34px;color:var(--colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--colorFillTertiary);color:var(--colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:0 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--colorText);width:34px;height:34px;color:var(--colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--colorBorder);min-width:147px;height:32px;color:var(--colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();__emailmaker__.define(`static/core/a5b58fe12.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/63a369c8.js`,`static/core/7865066d.js`,`static/core/83390cf7.js`,`static/core/5a6dd152.js`,`react`,`react-dom`,`react-router-dom`,`react/jsx-runtime`,`antd`,`react-dom/client`,`@ant-design/icons`,`@ant-design/cssinjs`],function(e,t,n){let r=e("./354bf8a9.js"),i=e("./63a369c8.js"),a=e("./5a6dd152.js"),o=e("./83390cf7.js");e("./7865066d.js");let s=e("react");s=r.l(s),e("react-dom");let c=e("react-router-dom"),l=e("react/jsx-runtime");e("antd"),e("react-dom/client"),e("@ant-design/icons"),e("@ant-design/cssinjs");var u=({open:e,sideOnOk:t,onCancel:n,initialSlide:r=0})=>{let{__:a}=o.h(),u=(0,c.useNavigate)(),[d,f]=(0,s.useState)(r),p=(0,s.useRef)(null),m=i.wt(),h=()=>{t&&t(),u(`/billing`),n(!1)};(0,s.useEffect)(()=>{e&&p.current&&(p.current.goTo(r,!0),f(r))},[e,r]);let g=(0,s.useMemo)(()=>[{image:a(`https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png`),backgroundColor:`var(--blue-2)`,title:a(`More editing features`),description:a(`Use our visual editor to customize every element to your needs: change borders and their radius, box shadows, paddings, background, and much more.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png`),backgroundColor:`var(--purple-2)`,title:a(`Work with the HTML code`),description:a(`Edit the HTML version of your email template in the Code mode and see the changes in real time. Builder has no code restrictions — you can create templates of any complexity!`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png`),backgroundColor:`var(--cyan-2)`,title:a(`AI image generation`),description:a(`Generate stunning visuals for your emails with ease. We have trained our AI model to ensure the highest quality images.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png`),backgroundColor:`var(--green-2)`,title:a(`Stock photos and GIFs`),description:a(`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:a(`https://cdn.useblocks.io/1351/241017_18_NDYloAO.png`),backgroundColor:`var(--magenta-2)`,title:a(`Version history`),description:a(`Check who and when made changes to the email template and, if necessary, restore one of the previous versions.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png`),backgroundColor:`var(--red-2)`,title:a(`Image editor`),description:a(`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:a(`https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png`),backgroundColor:`var(--orange-2)`,title:a(`Email optimization`),description:a(`Check your email against broken links, missing alt texts, large images, and other issues that might prevent your emails from hitting inboxes.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png`),backgroundColor:`var(--volcano-2)`,title:a(`Team collaboration`),description:a(`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:a(`https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png`),backgroundColor:`var(--geekblue-2)`,title:a(`Email testing`),description:a(`Check how your email appears across various devices and email clients.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png`),backgroundColor:`var(--geekblue-2)`,title:a(`AI assistant`),description:a(`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!`)}],[a]);return(0,s.useEffect)(()=>{if(e&&p.current){p.current.goTo(r,!0),f(r);let e=g[r];m({event:`open_modal`,action:`open_premium-features_modal`,modal_id:`premium-features`,offer_id:e.title})}},[e,g,r,m]),(0,l.jsxs)(o.Y,{open:e,footer:null,onCancel:n,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%`},children:[(0,l.jsx)(o.V,{dots:!0,slidesToShow:1,slidesToScroll:1,autoplay:!0,className:`carousel-slider`,draggable:!0,autoplaySpeed:5e3,initialSlide:d,ref:p,children:g.map((e,t)=>(0,l.jsx)(`div`,{children:(0,l.jsxs)(`div`,{className:`carousel-slide`,style:{background:`${e.backgroundColor}`},children:[(0,l.jsx)(`div`,{className:`slide-item-image`,children:(0,l.jsx)(`img`,{src:e.image,alt:`slide-${t}`})}),(0,l.jsxs)(`div`,{className:`slide-item-content`,children:[(0,l.jsx)(`h3`,{className:`slide-title`,children:e.title}),(0,l.jsx)(`p`,{className:`slide-description`,children:e.description})]})]})},t))}),(0,l.jsx)(`div`,{className:`modal-subtitle`,children:a(`This and other features are available for you on any paid plan.`)}),(0,l.jsxs)(`div`,{className:`modal-buttons`,children:[(0,l.jsx)(o.Rt,{size:`large`,onClick:()=>n(!1),children:a(`Cancel`)}),(0,l.jsx)(o.Rt,{type:`primary`,size:`large`,onClick:h,style:{padding:`0 30px`},children:a(`Select plan`)})]})]})};function d(e){return e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,``),e=e.replace(/<\/?(?:script|embed|object|frameset|frame|iframe|applet|meta)[^>]*>/gi,``),e=e.replace(/ on\w+="[^"]*"/g,``),e=e.replace(/ on\w+='[^']*'/g,``),e}var f=s.default.forwardRef(({icon:e,...t},n)=>{let r=i.cn();return(0,l.jsx)(o.Lt,{ref:n,icon:e,configIcons:(0,s.useMemo)(()=>{if(!r?.icons)return;let e={};for(let[t,n]of Object.entries(r.icons))typeof n==`string`&&(e[t]=d(n));return Object.keys(e).length>0?e:void 0},[r?.icons]),strokeWidth:r?.iconStrokeWidth,...t})});f.displayName=`EmIcons`;var p={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`};function m(e,t){if(e==null)return null;if(typeof e==`number`||typeof e==`string`){let n=e===`∞`||e===`∞`||e===`infinity`||typeof e==`string`&&e.toLowerCase()===`infinity`;return(0,l.jsx)(`span`,{className:t===`old`?`limit-upgrade-modal__limit-old`:`limit-upgrade-modal__limit-new${n?` limit-upgrade-modal__limit-new--infinity`:``}`,children:n?`∞`:e})}return e}var h=({open:e,onClose:t,title:n,subtitle:r,usageResource:i,icon:a,previousDisplay:s,nextDisplay:c,onChangePlan:u,secondaryAction:d,changePlanLabel:h})=>{let{__:g}=o.h(),_=h??g(`Change plan`),v=!!d,y=i==null?a??null:(0,l.jsx)(f,{icon:p[i]});return(0,l.jsx)(o.Y,{open:e,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:`limit-upgrade-modal`,destroyOnHidden:!0,mask:{closable:!0},children:(0,l.jsxs)(`div`,{className:`limit-upgrade-modal__wrap`,children:[(0,l.jsx)(`div`,{className:`limit-upgrade-modal__header`,children:(0,l.jsx)(`button`,{type:`button`,className:`limit-upgrade-modal__close`,onClick:t,"aria-label":g(`Close`),children:(0,l.jsx)(f,{icon:`CloseOutlined`})})}),(0,l.jsxs)(`div`,{className:`limit-upgrade-modal__body`,children:[(0,l.jsx)(`h1`,{className:`limit-upgrade-modal__title`,children:n}),(0,l.jsx)(`p`,{className:`limit-upgrade-modal__subtitle`,children:r}),(0,l.jsxs)(`div`,{className:`limit-upgrade-modal__limits-row`,children:[(0,l.jsx)(`div`,{className:`limit-upgrade-modal__icon-circle`,"aria-hidden":!0,children:y}),m(s,`old`),(0,l.jsx)(`div`,{className:`limit-upgrade-modal__arrow-btn`,"aria-hidden":!0,children:(0,l.jsx)(f,{icon:`ArrowUpOutlined`,className:`limit-upgrade-modal__arrow-icon`})}),m(c,`new`)]})]}),(0,l.jsx)(`hr`,{className:`limit-upgrade-modal__divider`}),(0,l.jsx)(`div`,{className:v?`limit-upgrade-modal__footer limit-upgrade-modal__footer--dual`:`limit-upgrade-modal__footer`,children:d?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.Rt,{className:`limit-upgrade-modal__cta-secondary`,onClick:d.onClick,children:d.label}),(0,l.jsx)(o.Rt,{type:`primary`,className:`limit-upgrade-modal__cta`,onClick:u,children:_})]}):(0,l.jsx)(o.Rt,{type:`primary`,className:`limit-upgrade-modal__cta`,onClick:u,children:_})})]})})},g={email_10_30:{id:`email_10_30`,titleKey:`You have used up the number of emails you can create on your current plan`,subtitleKey:`You can increase the number of emails right now.`,usageResource:`email_generate`,previous:10,next:30,showSecondaryBuy:!1,debugLabelKey:`Limit modal: emails 10→30`},email_30_300:{id:`email_30_300`,titleKey:`You have used up the number of emails you can create on your current plan`,subtitleKey:`You can increase the number of emails right now.`,usageResource:`email_generate`,previous:30,next:300,showSecondaryBuy:!1,debugLabelKey:`Limit modal: emails 30→300`},email_300_inf:{id:`email_300_inf`,titleKey:`You have used up the number of emails you can create on your current plan`,subtitleKey:`You can increase the number of emails right now.`,usageResource:`email_generate`,previous:300,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: emails 300→∞`},ai_10_50:{id:`ai_10_50`,titleKey:`You have used up your AI generations`,subtitleKey:`You can add more generations right now; they are billed separately from the generations included in your plan.`,usageResource:`ai`,previous:10,next:50,showSecondaryBuy:!1,debugLabelKey:`Limit modal: AI 10→50`},ai_30_150:{id:`ai_30_150`,titleKey:`You have used up your AI generations`,subtitleKey:`You can add more generations right now; they are billed separately from the generations included in your plan.`,usageResource:`ai`,previous:30,next:150,showSecondaryBuy:!1,debugLabelKey:`Limit modal: AI 30→150`},ai_150_inf:{id:`ai_150_inf`,titleKey:`You have used up your AI generations`,subtitleKey:`You can add more generations right now; they are billed separately from the generations included in your plan.`,usageResource:`ai`,previous:150,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: AI 150→∞`},optimization_exceeded:{id:`optimization_exceeded`,titleKey:`You have used up your optimisation limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`optimization`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: optimization exhausted`},image_generate_exceeded:{id:`image_generate_exceeded`,titleKey:`You have used up your image generation limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`image_generate`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: image_generate exhausted`},preview_exceeded:{id:`preview_exceeded`,titleKey:`You have used up your preview (test send) limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`preview`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: preview exhausted`},link_check_exceeded:{id:`link_check_exceeded`,titleKey:`You have used up your link check limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`link_check`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: link_check exhausted`},image_check_exceeded:{id:`image_check_exceeded`,titleKey:`You have used up your image check limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`image_check`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: image_check exhausted`},spam_check_exceeded:{id:`spam_check_exceeded`,titleKey:`You have used up your spam check limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`spam_check`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: spam_check exhausted`}};function _(e){return g[e]}function v(e){return e===`infinity`?`∞`:e}var y={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 b(e){return!e||e.is_unlimited||e.total_limit<=0?!1:e.remaining<=0||e.used>=e.total_limit}function x(e,t){return b(t)?{presetId:y[e],previousLimit:t?.total_limit??0,nextLimit:`infinity`}:null}function S(e,t){return x(e,t)}function C(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(typeof n==`string`&&n)return n}}function w(e){for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof Blob)return n}}function T(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(typeof r==`string`&&r&&r!==t)return r}}var E=(0,s.createContext)(null),D=e=>e.includes(`UPLOAD_IMAGE_`)||e.includes(`UPLOAD_BACKGROUND_`),O=({children:e})=>{let t=i.ki(),n=i.Oi(a.s),[r,o]=(0,s.useState)(null),c=(0,s.useRef)(null),u=(0,s.useCallback)(e=>{c.current?.(e),c.current=null},[]),d=(0,s.useCallback)(e=>(u(null),o(e),t(a.r(e.entryModal)),new Promise(e=>{c.current=e})),[t,u]);(0,s.useEffect)(()=>{D(n)||(o(null),c.current&&u(null))},[n,u]);let f=(0,s.useMemo)(()=>({request:r,openImagePicker:d,resolveImagePicker:u}),[r,d,u]);return(0,l.jsx)(E.Provider,{value:f,children:e})},k=()=>{let e=(0,s.useContext)(E);if(!e)throw Error(`useImagePicker must be used within ImagePickerProvider`);return e};function A(e){if(!e)return!1;try{return i.Ci.getInstance(e,i.bo)!==void 0}catch{return!1}}function j(){let e=i.Ai();return(0,s.useMemo)(()=>A(e),[e])}Object.defineProperty(t,"a",{enumerable:!0,get:function(){return T}}),Object.defineProperty(t,"c",{enumerable:!0,get:function(){return x}}),Object.defineProperty(t,"d",{enumerable:!0,get:function(){return v}}),Object.defineProperty(t,"f",{enumerable:!0,get:function(){return h}}),Object.defineProperty(t,"g",{enumerable:!0,get:function(){return u}}),Object.defineProperty(t,"h",{enumerable:!0,get:function(){return d}}),Object.defineProperty(t,"i",{enumerable:!0,get:function(){return w}}),Object.defineProperty(t,"l",{enumerable:!0,get:function(){return S}}),Object.defineProperty(t,"m",{enumerable:!0,get:function(){return f}}),Object.defineProperty(t,"n",{enumerable:!0,get:function(){return O}}),Object.defineProperty(t,"o",{enumerable:!0,get:function(){return C}}),Object.defineProperty(t,"p",{enumerable:!0,get:function(){return p}}),Object.defineProperty(t,"r",{enumerable:!0,get:function(){return k}}),Object.defineProperty(t,"s",{enumerable:!0,get:function(){return b}}),Object.defineProperty(t,"t",{enumerable:!0,get:function(){return j}}),Object.defineProperty(t,"u",{enumerable:!0,get:function(){return _}})});
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.setAttribute(`data-emailmaker`,`true`),e.appendChild(document.createTextNode(`@import "https://fonts.googleapis.com/css2?family=Geologica:wght@300;600&display=swap";.blocks-app .ant-modal.premium-features-modal .ant-modal-container{border-radius:calc(var(--borderRadiusXL) * 2px);padding:20px 19px}.blocks-app .premium-features-modal .modal-title{text-align:center;margin-bottom:0;font-size:32px}.blocks-app .premium-features-modal .ant-carousel .slick-dots li button{opacity:.5;background:#fff}.blocks-app .premium-features-modal .ant-carousel .slick-dots li.slick-active button{opacity:1}.blocks-app .premium-features-modal .modal-subtitle{text-align:center;margin-bottom:20px;font-size:18px}.blocks-app .premium-features-modal .carousel-slider{margin-bottom:20px}.blocks-app .premium-features-modal .slick-list{border-radius:calc(var(--borderRadiusXL) * 1.5px)}.blocks-app .premium-features-modal .slick-slide{padding:0 5px}.blocks-app .premium-features-modal .carousel-slide{border-radius:calc(var(--borderRadiusXL) * 1.5px);justify-content:flex-end;align-items:center;height:480px;display:flex}.blocks-app .premium-features-modal .slide-item-image{width:50%;padding:24px 0 24px 32px}.blocks-app .premium-features-modal .slide-item-image img{border-radius:calc(var(--borderRadiusXL) * 1.3px);width:100%}.blocks-app .premium-features-modal .slide-item-content{width:50%;padding:48px}.blocks-app .premium-features-modal .slide-title{margin-bottom:48px;font-size:50px;font-weight:700;line-height:1}.blocks-app .premium-features-modal .slide-description{font-size:22px}.blocks-app .premium-features-modal .modal-buttons{justify-content:center;gap:10px;display:flex}.blocks-app .premium-features-modal .modal-buttons button{padding:0 30px}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{box-sizing:border-box;flex-direction:row;justify-content:flex-end;align-items:center;width:100%;min-height:34px;padding:8px 8px 0;display:flex}.blocks-app .limit-upgrade-modal__close{background:var(--colorBgContainer);width:34px;height:34px;color:var(--colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--colorFillTertiary);color:var(--colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:0 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--colorText);width:34px;height:34px;color:var(--colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--colorBorder);min-width:147px;height:32px;color:var(--colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();__emailmaker__.define(`static/core/610887002.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/1fe0a005.js`,`static/core/7865066d.js`,`static/core/3cd4ce00.js`,`static/core/b350de37.js`,`react`,`react-dom`,`react-router-dom`,`react/jsx-runtime`,`antd`,`react-dom/client`,`@ant-design/icons`,`@ant-design/cssinjs`],function(e,t,n){let r=e("./354bf8a9.js"),i=e("./1fe0a005.js"),a=e("./b350de37.js"),o=e("./3cd4ce00.js");e("./7865066d.js");let s=e("react");s=r.l(s),e("react-dom");let c=e("react-router-dom"),l=e("react/jsx-runtime");e("antd"),e("react-dom/client"),e("@ant-design/icons"),e("@ant-design/cssinjs");var u=({open:e,sideOnOk:t,onCancel:n,initialSlide:r=0})=>{let{__:a}=o.h(),u=(0,c.useNavigate)(),[d,f]=(0,s.useState)(r),p=(0,s.useRef)(null),m=i._t(),h=()=>{t&&t(),u(`/billing`),n(!1)};(0,s.useEffect)(()=>{e&&p.current&&(p.current.goTo(r,!0),f(r))},[e,r]);let g=(0,s.useMemo)(()=>[{image:a(`https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png`),backgroundColor:`var(--blue-2)`,title:a(`More editing features`),description:a(`Use our visual editor to customize every element to your needs: change borders and their radius, box shadows, paddings, background, and much more.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png`),backgroundColor:`var(--purple-2)`,title:a(`Work with the HTML code`),description:a(`Edit the HTML version of your email template in the Code mode and see the changes in real time. Builder has no code restrictions — you can create templates of any complexity!`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png`),backgroundColor:`var(--cyan-2)`,title:a(`AI image generation`),description:a(`Generate stunning visuals for your emails with ease. We have trained our AI model to ensure the highest quality images.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png`),backgroundColor:`var(--green-2)`,title:a(`Stock photos and GIFs`),description:a(`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:a(`https://cdn.useblocks.io/1351/241017_18_NDYloAO.png`),backgroundColor:`var(--magenta-2)`,title:a(`Version history`),description:a(`Check who and when made changes to the email template and, if necessary, restore one of the previous versions.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png`),backgroundColor:`var(--red-2)`,title:a(`Image editor`),description:a(`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:a(`https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png`),backgroundColor:`var(--orange-2)`,title:a(`Email optimization`),description:a(`Check your email against broken links, missing alt texts, large images, and other issues that might prevent your emails from hitting inboxes.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png`),backgroundColor:`var(--volcano-2)`,title:a(`Team collaboration`),description:a(`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:a(`https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png`),backgroundColor:`var(--geekblue-2)`,title:a(`Email testing`),description:a(`Check how your email appears across various devices and email clients.`)},{image:a(`https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png`),backgroundColor:`var(--geekblue-2)`,title:a(`AI assistant`),description:a(`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!`)}],[a]);return(0,s.useEffect)(()=>{if(e&&p.current){p.current.goTo(r,!0),f(r);let e=g[r];m({event:`open_modal`,action:`open_premium-features_modal`,modal_id:`premium-features`,offer_id:e.title})}},[e,g,r,m]),(0,l.jsxs)(o.Y,{open:e,footer:null,onCancel:n,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%`},children:[(0,l.jsx)(o.V,{dots:!0,slidesToShow:1,slidesToScroll:1,autoplay:!0,className:`carousel-slider`,draggable:!0,autoplaySpeed:5e3,initialSlide:d,ref:p,children:g.map((e,t)=>(0,l.jsx)(`div`,{children:(0,l.jsxs)(`div`,{className:`carousel-slide`,style:{background:`${e.backgroundColor}`},children:[(0,l.jsx)(`div`,{className:`slide-item-image`,children:(0,l.jsx)(`img`,{src:e.image,alt:`slide-${t}`})}),(0,l.jsxs)(`div`,{className:`slide-item-content`,children:[(0,l.jsx)(`h3`,{className:`slide-title`,children:e.title}),(0,l.jsx)(`p`,{className:`slide-description`,children:e.description})]})]})},t))}),(0,l.jsx)(`div`,{className:`modal-subtitle`,children:a(`This and other features are available for you on any paid plan.`)}),(0,l.jsxs)(`div`,{className:`modal-buttons`,children:[(0,l.jsx)(o.Rt,{size:`large`,onClick:()=>n(!1),children:a(`Cancel`)}),(0,l.jsx)(o.Rt,{type:`primary`,size:`large`,onClick:h,style:{padding:`0 30px`},children:a(`Select plan`)})]})]})};function d(e){return e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,``),e=e.replace(/<\/?(?:script|embed|object|frameset|frame|iframe|applet|meta)[^>]*>/gi,``),e=e.replace(/ on\w+="[^"]*"/g,``),e=e.replace(/ on\w+='[^']*'/g,``),e}var f=s.default.forwardRef(({icon:e,...t},n)=>{let r=i.pn();return(0,l.jsx)(o.Lt,{ref:n,icon:e,configIcons:(0,s.useMemo)(()=>{if(!r?.icons)return;let e={};for(let[t,n]of Object.entries(r.icons))typeof n==`string`&&(e[t]=d(n));return Object.keys(e).length>0?e:void 0},[r?.icons]),strokeWidth:r?.iconStrokeWidth,...t})});f.displayName=`EmIcons`;var p={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`};function m(e,t){if(e==null)return null;if(typeof e==`number`||typeof e==`string`){let n=e===`∞`||e===`∞`||e===`infinity`||typeof e==`string`&&e.toLowerCase()===`infinity`;return(0,l.jsx)(`span`,{className:t===`old`?`limit-upgrade-modal__limit-old`:`limit-upgrade-modal__limit-new${n?` limit-upgrade-modal__limit-new--infinity`:``}`,children:n?`∞`:e})}return e}var h=({open:e,onClose:t,title:n,subtitle:r,usageResource:i,icon:a,previousDisplay:s,nextDisplay:c,onChangePlan:u,secondaryAction:d,changePlanLabel:h})=>{let{__:g}=o.h(),_=h??g(`Change plan`),v=!!d,y=i==null?a??null:(0,l.jsx)(f,{icon:p[i]});return(0,l.jsx)(o.Y,{open:e,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:`limit-upgrade-modal`,destroyOnHidden:!0,mask:{closable:!0},children:(0,l.jsxs)(`div`,{className:`limit-upgrade-modal__wrap`,children:[(0,l.jsx)(`div`,{className:`limit-upgrade-modal__header`,children:(0,l.jsx)(`button`,{type:`button`,className:`limit-upgrade-modal__close`,onClick:t,"aria-label":g(`Close`),children:(0,l.jsx)(f,{icon:`CloseOutlined`})})}),(0,l.jsxs)(`div`,{className:`limit-upgrade-modal__body`,children:[(0,l.jsx)(`h1`,{className:`limit-upgrade-modal__title`,children:n}),(0,l.jsx)(`p`,{className:`limit-upgrade-modal__subtitle`,children:r}),(0,l.jsxs)(`div`,{className:`limit-upgrade-modal__limits-row`,children:[(0,l.jsx)(`div`,{className:`limit-upgrade-modal__icon-circle`,"aria-hidden":!0,children:y}),m(s,`old`),(0,l.jsx)(`div`,{className:`limit-upgrade-modal__arrow-btn`,"aria-hidden":!0,children:(0,l.jsx)(f,{icon:`ArrowUpOutlined`,className:`limit-upgrade-modal__arrow-icon`})}),m(c,`new`)]})]}),(0,l.jsx)(`hr`,{className:`limit-upgrade-modal__divider`}),(0,l.jsx)(`div`,{className:v?`limit-upgrade-modal__footer limit-upgrade-modal__footer--dual`:`limit-upgrade-modal__footer`,children:d?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.Rt,{className:`limit-upgrade-modal__cta-secondary`,onClick:d.onClick,children:d.label}),(0,l.jsx)(o.Rt,{type:`primary`,className:`limit-upgrade-modal__cta`,onClick:u,children:_})]}):(0,l.jsx)(o.Rt,{type:`primary`,className:`limit-upgrade-modal__cta`,onClick:u,children:_})})]})})},g={email_10_30:{id:`email_10_30`,titleKey:`You have used up the number of emails you can create on your current plan`,subtitleKey:`You can increase the number of emails right now.`,usageResource:`email_generate`,previous:10,next:30,showSecondaryBuy:!1,debugLabelKey:`Limit modal: emails 10→30`},email_30_300:{id:`email_30_300`,titleKey:`You have used up the number of emails you can create on your current plan`,subtitleKey:`You can increase the number of emails right now.`,usageResource:`email_generate`,previous:30,next:300,showSecondaryBuy:!1,debugLabelKey:`Limit modal: emails 30→300`},email_300_inf:{id:`email_300_inf`,titleKey:`You have used up the number of emails you can create on your current plan`,subtitleKey:`You can increase the number of emails right now.`,usageResource:`email_generate`,previous:300,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: emails 300→∞`},ai_10_50:{id:`ai_10_50`,titleKey:`You have used up your AI generations`,subtitleKey:`You can add more generations right now; they are billed separately from the generations included in your plan.`,usageResource:`ai`,previous:10,next:50,showSecondaryBuy:!1,debugLabelKey:`Limit modal: AI 10→50`},ai_30_150:{id:`ai_30_150`,titleKey:`You have used up your AI generations`,subtitleKey:`You can add more generations right now; they are billed separately from the generations included in your plan.`,usageResource:`ai`,previous:30,next:150,showSecondaryBuy:!1,debugLabelKey:`Limit modal: AI 30→150`},ai_150_inf:{id:`ai_150_inf`,titleKey:`You have used up your AI generations`,subtitleKey:`You can add more generations right now; they are billed separately from the generations included in your plan.`,usageResource:`ai`,previous:150,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: AI 150→∞`},optimization_exceeded:{id:`optimization_exceeded`,titleKey:`You have used up your optimisation limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`optimization`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: optimization exhausted`},image_generate_exceeded:{id:`image_generate_exceeded`,titleKey:`You have used up your image generation limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`image_generate`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: image_generate exhausted`},preview_exceeded:{id:`preview_exceeded`,titleKey:`You have used up your preview (test send) limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`preview`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: preview exhausted`},link_check_exceeded:{id:`link_check_exceeded`,titleKey:`You have used up your link check limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`link_check`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: link_check exhausted`},image_check_exceeded:{id:`image_check_exceeded`,titleKey:`You have used up your image check limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`image_check`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: image_check exhausted`},spam_check_exceeded:{id:`spam_check_exceeded`,titleKey:`You have used up your spam check limit`,subtitleKey:`You can increase the limit by changing your plan or buying an extra package.`,usageResource:`spam_check`,previous:0,next:`infinity`,showSecondaryBuy:!1,debugLabelKey:`Limit modal: spam_check exhausted`}};function _(e){return g[e]}function v(e){return e===`infinity`?`∞`:e}var y={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 b(e){return!e||e.is_unlimited||e.total_limit<=0?!1:e.remaining<=0||e.used>=e.total_limit}function x(e,t){return b(t)?{presetId:y[e],previousLimit:t?.total_limit??0,nextLimit:`infinity`}:null}function S(e,t){return x(e,t)}function C(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(typeof n==`string`&&n)return n}}function w(e){for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof Blob)return n}}function T(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(typeof r==`string`&&r&&r!==t)return r}}var E=(0,s.createContext)(null),D=e=>e.includes(`UPLOAD_IMAGE_`)||e.includes(`UPLOAD_BACKGROUND_`),O=({children:e})=>{let t=i.Pi(),n=i.Ni(a.s),[r,o]=(0,s.useState)(null),c=(0,s.useRef)(null),u=(0,s.useCallback)(e=>{c.current?.(e),c.current=null},[]),d=(0,s.useCallback)(e=>(u(null),o(e),t(a.r(e.entryModal)),new Promise(e=>{c.current=e})),[t,u]);(0,s.useEffect)(()=>{D(n)||(o(null),c.current&&u(null))},[n,u]);let f=(0,s.useMemo)(()=>({request:r,openImagePicker:d,resolveImagePicker:u}),[r,d,u]);return(0,l.jsx)(E.Provider,{value:f,children:e})},k=()=>{let e=(0,s.useContext)(E);if(!e)throw Error(`useImagePicker must be used within ImagePickerProvider`);return e};Object.defineProperty(t,"a",{enumerable:!0,get:function(){return C}}),Object.defineProperty(t,"c",{enumerable:!0,get:function(){return S}}),Object.defineProperty(t,"d",{enumerable:!0,get:function(){return h}}),Object.defineProperty(t,"f",{enumerable:!0,get:function(){return p}}),Object.defineProperty(t,"h",{enumerable:!0,get:function(){return u}}),Object.defineProperty(t,"i",{enumerable:!0,get:function(){return T}}),Object.defineProperty(t,"l",{enumerable:!0,get:function(){return _}}),Object.defineProperty(t,"m",{enumerable:!0,get:function(){return d}}),Object.defineProperty(t,"n",{enumerable:!0,get:function(){return k}}),Object.defineProperty(t,"o",{enumerable:!0,get:function(){return b}}),Object.defineProperty(t,"p",{enumerable:!0,get:function(){return f}}),Object.defineProperty(t,"r",{enumerable:!0,get:function(){return w}}),Object.defineProperty(t,"s",{enumerable:!0,get:function(){return x}}),Object.defineProperty(t,"t",{enumerable:!0,get:function(){return O}}),Object.defineProperty(t,"u",{enumerable:!0,get:function(){return v}})});
@@ -1,4 +1,4 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.setAttribute(`data-emailmaker`,`true`),e.appendChild(document.createTextNode(`.blocks-app .image-preview{text-align:center;min-height:100px;position:relative}.blocks-app .image-preview .image-editor-modal{border:1px solid red}.blocks-app .image-preview__edit-button{position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-preview img{border:1px solid var(--colorBorder);border-radius:6px;max-width:100%;max-height:500px}.blocks-app .image-editor-modal .ant-modal-container{flex-direction:column;min-height:100vh;display:flex;border-radius:0!important}.blocks-app .image-editor-modal .ant-modal-body{flex-grow:1;display:flex}.blocks-app .image-editor-modal .ant-modal-body #pixie-editor{flex-grow:1;height:calc(100vh - 70px);min-height:calc(100vh - 70px);overflow:hidden}.blocks-app .image-editor-modal .pi .text-on-primary{background:var(--colorPrimary);border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary:hover{background:var(--colorPrimaryHover);border-color:var(--colorPrimaryHover)}.blocks-app .image-editor-modal .pi .text-on-primary.rounded-full{border-radius:calc(var(--borderRadius) * 1px)}.blocks-app .image-editor-modal .pi .shadow-xl{box-shadow:none}.blocks-app .image-editor-modal .w-\\[4ch\\].text-sm.text-center{width:5ch}.blocks-app .image-editor-modal .pi .border-white{border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .bg-white\\/50{background-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary{color:var(--colorWhite)}.blocks-app .serach-results .ant-row{align-items:center}.blocks-app .serach-results .blocks-search__divider-wrapper{margin-top:12px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{border-top:1px solid var(--colorBorderSecondary);background:0 0;width:100%;height:1px;min-height:0;margin:0;position:static}.blocks-app .slideshow-container{width:524px;height:350px;margin:auto;position:relative;overflow:hidden}.blocks-app .slideshow-image{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .image-ai .slideshow-image{width:auto;height:auto}.blocks-app .image-ai__image-item{text-align:center;border-radius:6px;justify-content:center;align-items:center;min-height:100px;display:flex;position:relative}.blocks-app .image-ai__image-item .buttons{justify-content:space-between;display:flex;position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-ai .text-area-input-hybrid{border:none;outline:none;min-height:0;padding:0 0 0 1px}.blocks-app .image-ai .text-area-input-hybrid textarea{height:32px;min-height:32px;padding:3px 11px;line-height:26px}.blocks-app .image-ai__loading{justify-content:center;align-items:center;min-height:150px;display:flex}.blocks-app .image-ai__loading .spin{flex-direction:column;justify-content:center;align-items:center;height:150px;display:flex}.blocks-app .image-ai__loading .status{margin:3px 0 0}.blocks-app .image-ai__preview{border-radius:6px;margin-top:24px;overflow:hidden}.blocks-app .image-ai__preview .image-ai__image-item img{border-radius:calc(var(--borderRadius) * 1px);object-fit:contain;max-height:100%;transition:height 1s;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}.blocks-app .image-ai .small{width:302px;height:202px}.blocks-app .image-ai .large{width:524px;height:350px}.blocks-app .image-ai .image-ai__row{padding:0 2px}.blocks-app .image-ai .image-ai__input-affix-wrapper{border-style:solid;border-width:calc(var(--borderWidth) * 1px);border-color:var(--colorFillSecondaryDarken);border-radius:calc(var(--borderRadius) * 1px);width:100%;padding-left:0;display:inline-flex}.blocks-app .image-ai .image-ai__input-affix-wrapper:hover{border-color:var(--borderColorHover)}.blocks-app .image-ai .image-ai__input-affix-wrapper.ant-input-affix-wrapper-focused{border-color:var(--colorPrimaryBorder)}.blocks-app .image-ai .image-ai__textarea{font-size:16px}.blocks-app .image-ai .image-ai__input-icon{font-size:16px;top:0;right:0}.dark .blocks-app .image-ai .image-ai__preview .image-ai__image-item img{background:#2b2b2b;border:1px solid #434343}.dark .blocks-app .image-ai .ant-btn{background:#1f1f1f}.dark .blocks-app .image-ai .ant-btn:hover{color:var(--colorPrimary)}.blocks-app .stock-tab img{border-radius:0;max-width:none;max-height:none}.blocks-app .stock-tab .stock-search-input{padding:0 2px}.blocks-app .stock-tab .my-masonry-grid{text-align:center;width:auto;display:flex}.blocks-app .stock-tab .my-masonry-grid_column{background-clip:padding-box}.blocks-app .stock-tab .list-item{cursor:pointer;background:#f0f2f5;border:1px solid #f0f2f5;border-radius:6px;min-height:100px;max-height:100px;margin-bottom:20px;transition:all .3s;display:inline-block;position:relative;overflow:hidden}.blocks-app .stock-tab .list-item .overlay-image{opacity:0;background-size:cover;width:110px;height:40px;transition:opacity .5s;position:absolute;bottom:10px;right:10px}.blocks-app .stock-tab .list-item .ant-spin{color:#f0f2f5;font-size:20px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.blocks-app .stock-tab .list-item img{object-fit:cover;opacity:0;border-radius:6px;height:auto;transition:opacity .5s ease-in-out;display:block}.blocks-app .stock-tab .list-item.loaded{border:1px solid #d9d9d9;max-height:1000px}.blocks-app .stock-tab .list-item.loaded img{opacity:1;height:100%}.blocks-app .stock-tab .list-item.loaded .loaded-image{opacity:.5}.blocks-app .stock-tab .list-item:hover{box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.blocks-app .stock-tab .list-item:hover p.creator-info,.blocks-app .stock-tab .list-item:hover .overlay-image{opacity:1}.blocks-app .stock-tab .list-item p.creator-info{color:#fff;opacity:0;background-color:#00000080;border-radius:0 0 6px;margin:0;padding:5px;font-size:10px;line-height:1.2;position:absolute;bottom:0;right:0}.blocks-app .stock-tab .list-item p.creator-info:hover a{color:#fff;text-decoration:underline}.blocks-app .stock-tab .list-item p.creator-info a{color:#fff;text-decoration:none}.blocks-app .stock-color-filter{display:flex}.blocks-app .stock-color-filter label{border-width:1px;width:24px;height:24px;margin:4px;padding:0;font-size:0;border-radius:6px!important}.blocks-app .stock-color-filter label.all-colors{background-image:linear-gradient(135deg,red,#ff7f00,#ff0,#0f0,#00f,#8b00ff)}.blocks-app .stock-color-filter label.black-color{background:#222}.blocks-app .stock-color-filter label.bw-color{background-image:linear-gradient(135deg,#222 50%,#fff 50%)}.blocks-app .stock-color-filter label.white-color{background:#fff}.blocks-app .stock-color-filter label.orange-color{background:#fa8c16}.blocks-app .stock-color-filter label.red-color{background:#f5222d}.blocks-app .stock-color-filter label.purple-color{background:#722ed1}.blocks-app .stock-color-filter label.magenta-color{background:#eb2f96}.blocks-app .stock-color-filter label.green-color{background:#52c41a}.blocks-app .stock-color-filter label.teal-color{background:#43c3c3}.blocks-app .stock-color-filter label.blue-color{background:#1677ff}.blocks-app .stock-color-filter .ant-radio-button-wrapper:not(:first-child):before{display:none}.blocks-app .serach-results{padding-top:6px}.blocks-app .serach-results .stock-search-input{width:322px;padding:0 2px}.blocks-app .serach-results .blocks-search__divider-wrapper{width:calc(100% + 48px);margin-top:12px;margin-left:-24px;margin-right:-24px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{pointer-events:none;border-top:1px solid var(--colorBorderSecondary);background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);border-bottom:none;width:100%;height:20px;min-height:20px;margin:0;position:relative;bottom:auto;left:auto;right:auto}.dark .blocks-app .image-center .stock-tab .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.dark .blocks-app .stock-tab .list-item{background:#2b2b2b;border:1px solid #2b2b2b}.dark .blocks-app .stock-tab .list-item.loaded{border:1px solid #434343}.blocks-app .image-center .image-center-image-preview{justify-content:center;align-items:center;display:flex}.blocks-app .image-center .ant-divider-horizontal{pointer-events:none;z-index:1;background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);width:calc(100% + 48px);height:20px;margin:24px -24px 0;position:absolute;bottom:-19px}.dark .blocks-app .image-center .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.blocks-app .image-center .ant-divider-horizontal.ant-divider-with-text{background:0 0;width:calc(100% + 38px);margin:0 -24px 20px;position:relative;top:0}.blocks-app .image-center img{border-radius:4px;max-width:524px;max-height:352px}.blocks-app .image-center .image-size{justify-content:center;margin-top:6px;font-size:14px;line-height:22px;display:flex}.blocks-app .image-center .ant-upload.ant-upload-drag{border-radius:6px}.blocks-app .image-center .ant-modal-body .stock-search-input{margin-bottom:0}.blocks-app .image-center .ant-modal-body .serach-results .stock-search-input{margin-bottom:10px}.blocks-app .image-center .ant-modal-body .ant-form:not(.serach-results) .ant-form-item:last-child{margin-bottom:0}.blocks-app .image-center .ant-modal-body .ant-tabs{transition:all .7s cubic-bezier(.075,.82,.165,1)}.blocks-app .image-center .ant-modal-body .ant-tabs .ant-tabs-content-holder{overflow-y:clip}.blocks-app .ant-modal{transition:width .7s ease-in-out}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();__emailmaker__.define(`static/core/148a45c1.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/63a369c8.js`,`static/core/7865066d.js`,`static/core/a5b58fe12.js`,`static/core/83390cf7.js`,`static/core/76c2567d.js`,`static/core/5a6dd152.js`,`react`,`prop-types`,`react-router-dom`,`react/jsx-runtime`],function(e,t,n){let r=e("./354bf8a9.js"),i=e("./63a369c8.js"),a=e("./5a6dd152.js"),o=e("./83390cf7.js"),s=e("./7865066d.js"),c=e("./a5b58fe12.js"),l=e("./76c2567d.js"),u=e("react");u=r.l(u);let d=e("prop-types");d=r.l(d);let f=e("react-router-dom"),p=e("react/jsx-runtime");function m(e,t){return{[e]:{Filter:t(`Filter`),filter:t(`filter`),Resize:t(`Resize`),resize:t(`resize`),Crop:t(`Crop`),Width:t(`Width`),width:t(`width`),Height:t(`Height`),height:t(`height`),"Background color":t(`Background color`),Cancel:t(`Cancel`),Create:t(`Create`),Objects:t(`Objects`),Quality:t(`Quality`),Save:t(`Save`),"Loading Canvas":t(`Loading Canvas`),"Loading Image":t(`Loading Image`),"Loading State":t(`Loading State`),"Processing Image":t(`Processing Image`),Close:t(`Close`),Apply:t(`Apply`),Font:t(`Font`),Color:t(`Color`),Background:t(`Background`),Image:t(`Image`),Opacity:t(`Opacity`),Outline:t(`Outline`),Shadow:t(`Shadow`),Gradient:t(`Gradient`),Texture:t(`Texture`),"Replace Image":t(`Replace Image`),"Outline Color":t(`Outline Color`),"Shadow Color":t(`Shadow Color`),"Font Size":t(`Font Size`),Radius:t(`Radius`),"Brush Color":t(`Brush Color`),"Brush Type":t(`Brush Type`),"Brush Size":t(`Brush Size`),History:t(`History`),"Maintain aspect ratio":t(`Maintain aspect ratio`),"New Text":t(`New Text`),Size:t(`Size`),Draw:t(`Draw`),Text:t(`Text`),Stickers:t(`Stickers`),Frame:t(`Frame`),Shapes:t(`Shapes`),Corners:t(`Corners`),corners:t(`corners`),Done:t(`Done`),"Applied Filters":t(`Applied Filters`),"Resized Image":t(`Resized Image`),"Cropped Image":t(`Cropped Image`),"Added Drawing":t(`Added Drawing`),"Added Text":t(`Added Text`),"Added Shape":t(`Added Shape`),"Added Sticker":t(`Added Sticker`),"Added Frame":t(`Added Frame`),"Merged Objects":t(`Merged Objects`),"Rounded Corner":t(`Rounded Corner`),"Replaced Background Image":t(`Replaced Background Image`),"Added Image":t(`Added Image`),Initial:t(`Initial`),"Loaded State":t(`Loaded State`),"Changed Style":t(`Changed Style`),"Deleted object":t(`Deleted object`),Merge:t(`Merge`),Emoticons:t(`Emoticons`),Doodles:t(`Doodles`),Landmarks:t(`Landmarks`),Bubbles:t(`Bubbles`),Transportation:t(`Transportation`),Beach:t(`Beach`),PencilBrush:t(`PencilBrush`),SprayBrush:t(`SprayBrush`),CircleBrush:t(`CircleBrush`),DiamondBrush:t(`DiamondBrush`),VLineBrush:t(`VLineBrush`),HLineBrush:t(`HLineBrush`),SquareBrush:t(`SquareBrush`),Square:t(`Square`),square:t(`square`)}}}var h={text:{replaceDefault:!0,defaultCategory:`handwriting`,items:[{family:`Montserrat Light`,src:`customFonts/Montserrat-Light.woff2`},{family:`Montserrat Regular`,src:`customFonts/Montserrat-Regular.woff2`},{family:`Montserrat Bold`,src:`customFonts/Montserrat-Bold.woff2`},{family:`Montserrat Black`,src:`customFonts/Montserrat-Black.woff2`},{family:`Roboto Light`,src:`customFonts/Roboto-Light.woff2`},{family:`Roboto Regular`,src:`customFonts/Roboto-Regular.woff2`},{family:`Roboto Bold`,src:`customFonts/Roboto-Bold.woff2`},{family:`Roboto Black`,src:`customFonts/Roboto-Black.woff2`},{family:`Lato Light`,src:`customFonts/Lato-Light.woff2`},{family:`Lato Regular`,src:`customFonts/Lato-Regular.woff2`},{family:`Lato Bold`,src:`customFonts/Lato-Bold.woff2`},{family:`Lato Black`,src:`customFonts/Lato-Black.woff2`},{family:`Rubik Light`,src:`customFonts/Rubik-Light.woff2`},{family:`Rubik Regular`,src:`customFonts/Rubik-Regular.woff2`},{family:`Rubik Bold`,src:`customFonts/Rubik-Bold.woff2`},{family:`Rubik Black`,src:`customFonts/Rubik-Black.woff2`},{family:`Bebas Neue Light`,src:`customFonts/BebasNeueLight.woff2`},{family:`Bebas Neue Regular`,src:`customFonts/BebasNeueRegular.woff2`},{family:`Bebas Neue Book`,src:`customFonts/BebasNeueBook.woff2`},{family:`Bebas Neue Bold`,src:`customFonts/BebasNeueBold.woff2`},{family:`Arial`,src:`customFonts/ArialMT.woff2`},{family:`Arial Bold`,src:`customFonts/Arial-BoldMT.woff2`}]}},g=(e,t=`application/octet-stream`)=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function _(e,t){if(e===`json`)return new Blob([t],{type:`application/json`});if(e===`svg`)return new Blob([t],{type:`image/svg+xml`});let n=`image/${e}`;return t=t.replace(/data:image\/([a-z]*)?;base64,/,``),g(t,n)}var v=({currentImageLink:e,prefetchedBlobUrl:t,newLink:n,onSave:r,uploadImageResultIsLoading:d})=>{let f=l.h(),[g,v]=(0,u.useState)(),[y,b]=(0,u.useState)(),{__:x}=o.h(),S=i.ki(),C=i.Ai(),w=i.cn(),T=i.Oi(i.n),E=i.Oi(a.u),D=i.Oi(i.ct),O=(0,u.useMemo)(()=>{if(!w?.icons)return;let e={};for(let[t,n]of Object.entries(w.icons))typeof n==`string`&&(e[t]=c.h(n));return Object.keys(e).length>0?e:void 0},[w?.icons]),k=(0,u.useRef)(!1),[A,j]=(0,u.useState)(),M=i.q(i.wo.FILE_PROXY_EVENT_ID);(0,u.useEffect)(()=>{(async()=>{let n=e;if(!n&&!t)return;let r;if(t)try{let e=await fetch(t);e.ok&&(r=await e.blob())}catch{r=void 0}if(!r&&n)try{r=await(await fetch(n)).blob()}catch{if(r=await M.fire({url:n,project:D}).filter(e=>e instanceof Blob)[0],!r){let e=f.get(i.Hi.em_token)||await i.Ci.getInstance(C,a.E);r=await(await fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(n)}`,{headers:{authorization:`Bearer ${e}`}})).blob()}}if(r){let e=new FileReader;e.onload=()=>{A?.tools.import.openBackgroundImage(g),e.result!==g&&(v(e.result),b(r.type))},e.readAsDataURL(r)}})().catch(e=>void 0)},[e,t,n,v,f,g,A,M,D,C]);let N=(0,u.useCallback)(()=>{v(null),b(null),S(a.n()),S(a.t(i.xa.UPLOAD_IMAGE_MODAL))},[S]),P=(0,u.useRef)();P.current=async function(e,t,n){let i=await _(n,e);r&&r(new File([i],t,{lastModified:new Date().getTime(),type:i.type}))};let F=(0,u.useCallback)(e=>{if(e&&!(k.current&&A)){k.current=!0;let e=T.locale?T.locale.replace(`_`,`-`):`ru-RU`,t=T.theme===`system`?matchMedia(`(prefers-color-scheme: dark)`).matches?i.Qi:i.ha:T.theme;s.O.init({selector:`#pixie-editor`,baseUrl:o.t(`assets/pixie`),image:g,activeLanguage:e,languages:m(e,x),tools:h,ui:{menubar:{replaceDefaultItems:!0,items:[{type:`undoWidget`,align:`left`},{type:`zoomWidget`,align:`center`,desktopOnly:!0},{type:`button`,icon:(0,p.jsx)(o.Lt,{icon:`HistoryOutlined`,configIcons:O,style:{fontSize:20}}),align:`right`,desktopOnly:!0,action:e=>{e.togglePanel(`history`)}},{type:`button`,icon:(0,p.jsx)(o.Lt,{icon:`CloseOutlined`,configIcons:O,style:{fontSize:20}}),align:`right`,desktopOnly:!0,action:()=>N()}]},nav:{position:`top`},activeTheme:t,mode:`inline`,forceOverlayModeOnMobile:!1},onSave:async function(e,t,n){P.current(e,t,n)}}).then(e=>{j(e)}).catch(e=>void 0)}},[T.theme,g,A,j,T.locale,x,N,O]),I=(0,u.useCallback)(()=>{A?.tools.export.save(e?.split(`/`).pop().split(`.`)[0],y?.split(`/`)[1])},[A,e,y]);return(0,p.jsxs)(o.Y,{afterOpenChange:F,width:`100%`,style:{maxWidth:`100%`,minHeight:`100vh`},className:`image-editor-modal`,centered:!0,closable:!1,zIndex:1100,mask:!1,open:E,footer:[(0,p.jsx)(o.Rt,{className:`em-analytics__profile-cancel`,onClick:N,children:x(`Cancel`)},`Cancel`),(0,p.jsx)(o.Rt,{className:`em-analytics__profile-updapixiete`,id:`save`,type:`primary`,onClick:I,children:x(`Update`)},`Ok`)],children:[d&&(0,p.jsx)(`div`,{style:{position:`absolute`,height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--colorBgLayout)`,zIndex:10,opacity:.7},children:(0,p.jsx)(o.K,{size:`large`})}),(0,p.jsx)(`div`,{id:`pixie-editor`})]})},y=({currentImageLink:e,newLink:t,previewDisplayUrl:n,resolvedPreviewObjectUrl:r,onSave:i,uploadImageResultIsLoading:a})=>{let s=n||r;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{children:(0,p.jsxs)(`div`,{className:`image-preview`,children:[a&&(0,p.jsx)(`div`,{style:{position:`absolute`,height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--colorBgLayout)`,zIndex:10,opacity:.7},children:(0,p.jsx)(o.K,{size:`large`})}),s&&(0,p.jsx)(`img`,{alt:`uploadedImage`,src:s})]})}),(0,p.jsx)(v,{currentImageLink:e,prefetchedBlobUrl:r,newLink:t,onSave:i,uploadImageResultIsLoading:a})]})},b=function(e,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},b(e,t)};function x(e,t){b(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},S.apply(this,arguments)};function C(e,t,n,r){var i,a=!1,o=0;function s(){i&&clearTimeout(i)}function c(){s(),a=!0}typeof t!=`boolean`&&(r=n,n=t,t=void 0);function l(){var c=this,l=Date.now()-o,u=arguments;if(a)return;function d(){o=Date.now(),n.apply(c,u)}function f(){i=void 0}r&&!i&&d(),s(),r===void 0&&l>e?d():t!==!0&&(i=setTimeout(r?f:d,r===void 0?e-l:e))}return l.cancel=c,l}var w={Pixel:`Pixel`,Percent:`Percent`},T={unit:w.Percent,value:.8};function E(e){return typeof e==`number`?{unit:w.Percent,value:e*100}:typeof e==`string`?e.match(/^(\d*(\.\d+)?)px$/)?{unit:w.Pixel,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:w.Percent,value:parseFloat(e)}:T:T}var D=function(e){x(t,e);function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:typeof n.props.scrollableTarget==`string`?document.getElementById(n.props.scrollableTarget):(n.props.scrollableTarget,null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange=`transform`,n._infScroll.style.transition=`transform 0.2s cubic-bezier(0,0,0.31,1)`))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),!(n.currentY<n.startY)&&(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),!(n.currentY-n.startY>n.maxPullDownDistance*1.5)&&n._infScroll&&(n._infScroll.style.overflow=`visible`,n._infScroll.style.transform=`translate3d(0px, `+(n.currentY-n.startY)+`px, 0px)`)))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow=`auto`,n._infScroll.style.transform=`none`,n._infScroll.style.willChange=`unset`)})},n.onScrollListener=function(e){typeof n.props.onScroll==`function`&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=C(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return t.prototype.componentDidMount=function(){if(this.props.dataLength===void 0)throw Error(`mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage`);if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener(`scroll`,this.throttledOnScrollListener),typeof this.props.initialScrollY==`number`&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener(`touchstart`,this.onStart),this.el.addEventListener(`touchmove`,this.onMove),this.el.addEventListener(`touchend`,this.onEnd),this.el.addEventListener(`mousedown`,this.onStart),this.el.addEventListener(`mousemove`,this.onMove),this.el.addEventListener(`mouseup`,this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),typeof this.props.refreshFunction!=`function`))throw Error(`Mandatory prop "refreshFunction" missing.
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.setAttribute(`data-emailmaker`,`true`),e.appendChild(document.createTextNode(`.blocks-app .image-preview{text-align:center;min-height:100px;position:relative}.blocks-app .image-preview .image-editor-modal{border:1px solid red}.blocks-app .image-preview__edit-button{position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-preview img{border:1px solid var(--colorBorder);border-radius:6px;max-width:100%;max-height:500px}.blocks-app .image-editor-modal .ant-modal-container{flex-direction:column;min-height:100vh;display:flex;border-radius:0!important}.blocks-app .image-editor-modal .ant-modal-body{flex-grow:1;display:flex}.blocks-app .image-editor-modal .ant-modal-body #pixie-editor{flex-grow:1;height:calc(100vh - 70px);min-height:calc(100vh - 70px);overflow:hidden}.blocks-app .image-editor-modal .pi .text-on-primary{background:var(--colorPrimary);border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary:hover{background:var(--colorPrimaryHover);border-color:var(--colorPrimaryHover)}.blocks-app .image-editor-modal .pi .text-on-primary.rounded-full{border-radius:calc(var(--borderRadius) * 1px)}.blocks-app .image-editor-modal .pi .shadow-xl{box-shadow:none}.blocks-app .image-editor-modal .w-\\[4ch\\].text-sm.text-center{width:5ch}.blocks-app .image-editor-modal .pi .border-white{border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .bg-white\\/50{background-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary{color:var(--colorWhite)}.blocks-app .serach-results .ant-row{align-items:center}.blocks-app .serach-results .blocks-search__divider-wrapper{margin-top:12px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{border-top:1px solid var(--colorBorderSecondary);background:0 0;width:100%;height:1px;min-height:0;margin:0;position:static}.blocks-app .slideshow-container{width:524px;height:350px;margin:auto;position:relative;overflow:hidden}.blocks-app .slideshow-image{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .image-ai .slideshow-image{width:auto;height:auto}.blocks-app .image-ai__image-item{text-align:center;border-radius:6px;justify-content:center;align-items:center;min-height:100px;display:flex;position:relative}.blocks-app .image-ai__image-item .buttons{justify-content:space-between;display:flex;position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-ai .text-area-input-hybrid{border:none;outline:none;min-height:0;padding:0 0 0 1px}.blocks-app .image-ai .text-area-input-hybrid textarea{height:32px;min-height:32px;padding:3px 11px;line-height:26px}.blocks-app .image-ai__loading{justify-content:center;align-items:center;min-height:150px;display:flex}.blocks-app .image-ai__loading .spin{flex-direction:column;justify-content:center;align-items:center;height:150px;display:flex}.blocks-app .image-ai__loading .status{margin:3px 0 0}.blocks-app .image-ai__preview{border-radius:6px;margin-top:24px;overflow:hidden}.blocks-app .image-ai__preview .image-ai__image-item img{border-radius:calc(var(--borderRadius) * 1px);object-fit:contain;max-height:100%;transition:height 1s;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}.blocks-app .image-ai .small{width:302px;height:202px}.blocks-app .image-ai .large{width:524px;height:350px}.blocks-app .image-ai .image-ai__row{padding:0 2px}.blocks-app .image-ai .image-ai__input-affix-wrapper{border-style:solid;border-width:calc(var(--borderWidth) * 1px);border-color:var(--colorFillSecondaryDarken);border-radius:calc(var(--borderRadius) * 1px);width:100%;padding-left:0;display:inline-flex}.blocks-app .image-ai .image-ai__input-affix-wrapper:hover{border-color:var(--borderColorHover)}.blocks-app .image-ai .image-ai__input-affix-wrapper.ant-input-affix-wrapper-focused{border-color:var(--colorPrimaryBorder)}.blocks-app .image-ai .image-ai__textarea{font-size:16px}.blocks-app .image-ai .image-ai__input-icon{font-size:16px;top:0;right:0}.dark .blocks-app .image-ai .image-ai__preview .image-ai__image-item img{background:#2b2b2b;border:1px solid #434343}.dark .blocks-app .image-ai .ant-btn{background:#1f1f1f}.dark .blocks-app .image-ai .ant-btn:hover{color:var(--colorPrimary)}.blocks-app .stock-tab img{border-radius:0;max-width:none;max-height:none}.blocks-app .stock-tab .stock-search-input{padding:0 2px}.blocks-app .stock-tab .my-masonry-grid{text-align:center;width:auto;display:flex}.blocks-app .stock-tab .my-masonry-grid_column{background-clip:padding-box}.blocks-app .stock-tab .list-item{cursor:pointer;background:#f0f2f5;border:1px solid #f0f2f5;border-radius:6px;min-height:100px;max-height:100px;margin-bottom:20px;transition:all .3s;display:inline-block;position:relative;overflow:hidden}.blocks-app .stock-tab .list-item .overlay-image{opacity:0;background-size:cover;width:110px;height:40px;transition:opacity .5s;position:absolute;bottom:10px;right:10px}.blocks-app .stock-tab .list-item .ant-spin{color:#f0f2f5;font-size:20px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.blocks-app .stock-tab .list-item img{object-fit:cover;opacity:0;border-radius:6px;height:auto;transition:opacity .5s ease-in-out;display:block}.blocks-app .stock-tab .list-item.loaded{border:1px solid #d9d9d9;max-height:1000px}.blocks-app .stock-tab .list-item.loaded img{opacity:1;height:100%}.blocks-app .stock-tab .list-item.loaded .loaded-image{opacity:.5}.blocks-app .stock-tab .list-item:hover{box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.blocks-app .stock-tab .list-item:hover p.creator-info,.blocks-app .stock-tab .list-item:hover .overlay-image{opacity:1}.blocks-app .stock-tab .list-item p.creator-info{color:#fff;opacity:0;background-color:#00000080;border-radius:0 0 6px;margin:0;padding:5px;font-size:10px;line-height:1.2;position:absolute;bottom:0;right:0}.blocks-app .stock-tab .list-item p.creator-info:hover a{color:#fff;text-decoration:underline}.blocks-app .stock-tab .list-item p.creator-info a{color:#fff;text-decoration:none}.blocks-app .stock-color-filter{display:flex}.blocks-app .stock-color-filter label{border-width:1px;width:24px;height:24px;margin:4px;padding:0;font-size:0;border-radius:6px!important}.blocks-app .stock-color-filter label.all-colors{background-image:linear-gradient(135deg,red,#ff7f00,#ff0,#0f0,#00f,#8b00ff)}.blocks-app .stock-color-filter label.black-color{background:#222}.blocks-app .stock-color-filter label.bw-color{background-image:linear-gradient(135deg,#222 50%,#fff 50%)}.blocks-app .stock-color-filter label.white-color{background:#fff}.blocks-app .stock-color-filter label.orange-color{background:#fa8c16}.blocks-app .stock-color-filter label.red-color{background:#f5222d}.blocks-app .stock-color-filter label.purple-color{background:#722ed1}.blocks-app .stock-color-filter label.magenta-color{background:#eb2f96}.blocks-app .stock-color-filter label.green-color{background:#52c41a}.blocks-app .stock-color-filter label.teal-color{background:#43c3c3}.blocks-app .stock-color-filter label.blue-color{background:#1677ff}.blocks-app .stock-color-filter .ant-radio-button-wrapper:not(:first-child):before{display:none}.blocks-app .serach-results{padding-top:6px}.blocks-app .serach-results .stock-search-input{width:322px;padding:0 2px}.blocks-app .serach-results .blocks-search__divider-wrapper{width:calc(100% + 48px);margin-top:12px;margin-left:-24px;margin-right:-24px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{pointer-events:none;border-top:1px solid var(--colorBorderSecondary);background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);border-bottom:none;width:100%;height:20px;min-height:20px;margin:0;position:relative;bottom:auto;left:auto;right:auto}.dark .blocks-app .image-center .stock-tab .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.dark .blocks-app .stock-tab .list-item{background:#2b2b2b;border:1px solid #2b2b2b}.dark .blocks-app .stock-tab .list-item.loaded{border:1px solid #434343}.blocks-app .image-center .image-center-image-preview{justify-content:center;align-items:center;display:flex}.blocks-app .image-center .ant-divider-horizontal{pointer-events:none;z-index:1;background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);width:calc(100% + 48px);height:20px;margin:24px -24px 0;position:absolute;bottom:-19px}.dark .blocks-app .image-center .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.blocks-app .image-center .ant-divider-horizontal.ant-divider-with-text{background:0 0;width:calc(100% + 38px);margin:0 -24px 20px;position:relative;top:0}.blocks-app .image-center img{border-radius:4px;max-width:524px;max-height:352px}.blocks-app .image-center .image-size{justify-content:center;margin-top:6px;font-size:14px;line-height:22px;display:flex}.blocks-app .image-center .ant-upload.ant-upload-drag{border-radius:6px}.blocks-app .image-center .ant-modal-body .stock-search-input{margin-bottom:0}.blocks-app .image-center .ant-modal-body .serach-results .stock-search-input{margin-bottom:10px}.blocks-app .image-center .ant-modal-body .ant-form:not(.serach-results) .ant-form-item:last-child{margin-bottom:0}.blocks-app .image-center .ant-modal-body .ant-tabs{transition:all .7s cubic-bezier(.075,.82,.165,1)}.blocks-app .image-center .ant-modal-body .ant-tabs .ant-tabs-content-holder{overflow-y:clip}.blocks-app .ant-modal{transition:width .7s ease-in-out}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();__emailmaker__.define(`static/core/7f0dc85a.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/1fe0a005.js`,`static/core/7865066d.js`,`static/core/610887002.js`,`static/core/3cd4ce00.js`,`static/core/2a11ec49.js`,`static/core/b350de37.js`,`react`,`prop-types`,`react-router-dom`,`react/jsx-runtime`],function(e,t,n){let r=e("./354bf8a9.js"),i=e("./1fe0a005.js"),a=e("./b350de37.js"),o=e("./3cd4ce00.js"),s=e("./7865066d.js"),c=e("./610887002.js"),l=e("./2a11ec49.js"),u=e("react");u=r.l(u);let d=e("prop-types");d=r.l(d);let f=e("react-router-dom"),p=e("react/jsx-runtime");function m(e,t){return{[e]:{Filter:t(`Filter`),filter:t(`filter`),Resize:t(`Resize`),resize:t(`resize`),Crop:t(`Crop`),Width:t(`Width`),width:t(`width`),Height:t(`Height`),height:t(`height`),"Background color":t(`Background color`),Cancel:t(`Cancel`),Create:t(`Create`),Objects:t(`Objects`),Quality:t(`Quality`),Save:t(`Save`),"Loading Canvas":t(`Loading Canvas`),"Loading Image":t(`Loading Image`),"Loading State":t(`Loading State`),"Processing Image":t(`Processing Image`),Close:t(`Close`),Apply:t(`Apply`),Font:t(`Font`),Color:t(`Color`),Background:t(`Background`),Image:t(`Image`),Opacity:t(`Opacity`),Outline:t(`Outline`),Shadow:t(`Shadow`),Gradient:t(`Gradient`),Texture:t(`Texture`),"Replace Image":t(`Replace Image`),"Outline Color":t(`Outline Color`),"Shadow Color":t(`Shadow Color`),"Font Size":t(`Font Size`),Radius:t(`Radius`),"Brush Color":t(`Brush Color`),"Brush Type":t(`Brush Type`),"Brush Size":t(`Brush Size`),History:t(`History`),"Maintain aspect ratio":t(`Maintain aspect ratio`),"New Text":t(`New Text`),Size:t(`Size`),Draw:t(`Draw`),Text:t(`Text`),Stickers:t(`Stickers`),Frame:t(`Frame`),Shapes:t(`Shapes`),Corners:t(`Corners`),corners:t(`corners`),Done:t(`Done`),"Applied Filters":t(`Applied Filters`),"Resized Image":t(`Resized Image`),"Cropped Image":t(`Cropped Image`),"Added Drawing":t(`Added Drawing`),"Added Text":t(`Added Text`),"Added Shape":t(`Added Shape`),"Added Sticker":t(`Added Sticker`),"Added Frame":t(`Added Frame`),"Merged Objects":t(`Merged Objects`),"Rounded Corner":t(`Rounded Corner`),"Replaced Background Image":t(`Replaced Background Image`),"Added Image":t(`Added Image`),Initial:t(`Initial`),"Loaded State":t(`Loaded State`),"Changed Style":t(`Changed Style`),"Deleted object":t(`Deleted object`),Merge:t(`Merge`),Emoticons:t(`Emoticons`),Doodles:t(`Doodles`),Landmarks:t(`Landmarks`),Bubbles:t(`Bubbles`),Transportation:t(`Transportation`),Beach:t(`Beach`),PencilBrush:t(`PencilBrush`),SprayBrush:t(`SprayBrush`),CircleBrush:t(`CircleBrush`),DiamondBrush:t(`DiamondBrush`),VLineBrush:t(`VLineBrush`),HLineBrush:t(`HLineBrush`),SquareBrush:t(`SquareBrush`),Square:t(`Square`),square:t(`square`)}}}var h={text:{replaceDefault:!0,defaultCategory:`handwriting`,items:[{family:`Montserrat Light`,src:`customFonts/Montserrat-Light.woff2`},{family:`Montserrat Regular`,src:`customFonts/Montserrat-Regular.woff2`},{family:`Montserrat Bold`,src:`customFonts/Montserrat-Bold.woff2`},{family:`Montserrat Black`,src:`customFonts/Montserrat-Black.woff2`},{family:`Roboto Light`,src:`customFonts/Roboto-Light.woff2`},{family:`Roboto Regular`,src:`customFonts/Roboto-Regular.woff2`},{family:`Roboto Bold`,src:`customFonts/Roboto-Bold.woff2`},{family:`Roboto Black`,src:`customFonts/Roboto-Black.woff2`},{family:`Lato Light`,src:`customFonts/Lato-Light.woff2`},{family:`Lato Regular`,src:`customFonts/Lato-Regular.woff2`},{family:`Lato Bold`,src:`customFonts/Lato-Bold.woff2`},{family:`Lato Black`,src:`customFonts/Lato-Black.woff2`},{family:`Rubik Light`,src:`customFonts/Rubik-Light.woff2`},{family:`Rubik Regular`,src:`customFonts/Rubik-Regular.woff2`},{family:`Rubik Bold`,src:`customFonts/Rubik-Bold.woff2`},{family:`Rubik Black`,src:`customFonts/Rubik-Black.woff2`},{family:`Bebas Neue Light`,src:`customFonts/BebasNeueLight.woff2`},{family:`Bebas Neue Regular`,src:`customFonts/BebasNeueRegular.woff2`},{family:`Bebas Neue Book`,src:`customFonts/BebasNeueBook.woff2`},{family:`Bebas Neue Bold`,src:`customFonts/BebasNeueBold.woff2`},{family:`Arial`,src:`customFonts/ArialMT.woff2`},{family:`Arial Bold`,src:`customFonts/Arial-BoldMT.woff2`}]}},g=(e,t=`application/octet-stream`)=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function _(e,t){if(e===`json`)return new Blob([t],{type:`application/json`});if(e===`svg`)return new Blob([t],{type:`image/svg+xml`});let n=`image/${e}`;return t=t.replace(/data:image\/([a-z]*)?;base64,/,``),g(t,n)}var v=({currentImageLink:e,prefetchedBlobUrl:t,newLink:n,onSave:r,uploadImageResultIsLoading:d})=>{let f=l.h(),[g,v]=(0,u.useState)(),[y,b]=(0,u.useState)(),{__:x}=o.h(),S=i.Pi(),C=i.Fi(),w=i.pn(),T=i.Ni(i.n),E=i.Ni(a.u),D=i.Ni(i.Mt),O=(0,u.useMemo)(()=>{if(!w?.icons)return;let e={};for(let[t,n]of Object.entries(w.icons))typeof n==`string`&&(e[t]=c.m(n));return Object.keys(e).length>0?e:void 0},[w?.icons]),k=(0,u.useRef)(!1),[A,j]=(0,u.useState)(),M=i.J(i.ko.FILE_PROXY_EVENT_ID);(0,u.useEffect)(()=>{(async()=>{let n=e;if(!n&&!t)return;let r;if(t)try{let e=await fetch(t);e.ok&&(r=await e.blob())}catch{r=void 0}if(!r&&n)try{r=await(await fetch(n)).blob()}catch{if(r=await M.fire({url:n,project:D}).filter(e=>e instanceof Blob)[0],!r){let e=f.get(i.qi.em_token)||await i.Oi.getInstance(C,a.E);r=await(await fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(n)}`,{headers:{authorization:`Bearer ${e}`}})).blob()}}if(r){let e=new FileReader;e.onload=()=>{A?.tools.import.openBackgroundImage(g),e.result!==g&&(v(e.result),b(r.type))},e.readAsDataURL(r)}})().catch(e=>void 0)},[e,t,n,v,f,g,A,M,D,C]);let N=(0,u.useCallback)(()=>{v(null),b(null),S(a.n()),S(a.t(i.Ea.UPLOAD_IMAGE_MODAL))},[S]),P=(0,u.useRef)();P.current=async function(e,t,n){let i=await _(n,e);r&&r(new File([i],t,{lastModified:new Date().getTime(),type:i.type}))};let F=(0,u.useCallback)(e=>{if(e&&!(k.current&&A)){k.current=!0;let e=T.locale?T.locale.replace(`_`,`-`):`ru-RU`,t=T.theme===`system`?matchMedia(`(prefers-color-scheme: dark)`).matches?i.ra:i.ba:T.theme;s.O.init({selector:`#pixie-editor`,baseUrl:o.t(`assets/pixie`),image:g,activeLanguage:e,languages:m(e,x),tools:h,ui:{menubar:{replaceDefaultItems:!0,items:[{type:`undoWidget`,align:`left`},{type:`zoomWidget`,align:`center`,desktopOnly:!0},{type:`button`,icon:(0,p.jsx)(o.Lt,{icon:`HistoryOutlined`,configIcons:O,style:{fontSize:20}}),align:`right`,desktopOnly:!0,action:e=>{e.togglePanel(`history`)}},{type:`button`,icon:(0,p.jsx)(o.Lt,{icon:`CloseOutlined`,configIcons:O,style:{fontSize:20}}),align:`right`,desktopOnly:!0,action:()=>N()}]},nav:{position:`top`},activeTheme:t,mode:`inline`,forceOverlayModeOnMobile:!1},onSave:async function(e,t,n){P.current(e,t,n)}}).then(e=>{j(e)}).catch(e=>void 0)}},[T.theme,g,A,j,T.locale,x,N,O]),I=(0,u.useCallback)(()=>{A?.tools.export.save(e?.split(`/`).pop().split(`.`)[0],y?.split(`/`)[1])},[A,e,y]);return(0,p.jsxs)(o.Y,{afterOpenChange:F,width:`100%`,style:{maxWidth:`100%`,minHeight:`100vh`},className:`image-editor-modal`,centered:!0,closable:!1,zIndex:1100,mask:!1,open:E,footer:[(0,p.jsx)(o.Rt,{className:`em-analytics__profile-cancel`,onClick:N,children:x(`Cancel`)},`Cancel`),(0,p.jsx)(o.Rt,{className:`em-analytics__profile-updapixiete`,id:`save`,type:`primary`,onClick:I,children:x(`Update`)},`Ok`)],children:[d&&(0,p.jsx)(`div`,{style:{position:`absolute`,height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--colorBgLayout)`,zIndex:10,opacity:.7},children:(0,p.jsx)(o.K,{size:`large`})}),(0,p.jsx)(`div`,{id:`pixie-editor`})]})},y=({currentImageLink:e,newLink:t,previewDisplayUrl:n,resolvedPreviewObjectUrl:r,onSave:i,uploadImageResultIsLoading:a})=>{let s=n||r;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{children:(0,p.jsxs)(`div`,{className:`image-preview`,children:[a&&(0,p.jsx)(`div`,{style:{position:`absolute`,height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--colorBgLayout)`,zIndex:10,opacity:.7},children:(0,p.jsx)(o.K,{size:`large`})}),s&&(0,p.jsx)(`img`,{alt:`uploadedImage`,src:s})]})}),(0,p.jsx)(v,{currentImageLink:e,prefetchedBlobUrl:r,newLink:t,onSave:i,uploadImageResultIsLoading:a})]})},b=function(e,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},b(e,t)};function x(e,t){b(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},S.apply(this,arguments)};function C(e,t,n,r){var i,a=!1,o=0;function s(){i&&clearTimeout(i)}function c(){s(),a=!0}typeof t!=`boolean`&&(r=n,n=t,t=void 0);function l(){var c=this,l=Date.now()-o,u=arguments;if(a)return;function d(){o=Date.now(),n.apply(c,u)}function f(){i=void 0}r&&!i&&d(),s(),r===void 0&&l>e?d():t!==!0&&(i=setTimeout(r?f:d,r===void 0?e-l:e))}return l.cancel=c,l}var w={Pixel:`Pixel`,Percent:`Percent`},T={unit:w.Percent,value:.8};function E(e){return typeof e==`number`?{unit:w.Percent,value:e*100}:typeof e==`string`?e.match(/^(\d*(\.\d+)?)px$/)?{unit:w.Pixel,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:w.Percent,value:parseFloat(e)}:T:T}var D=function(e){x(t,e);function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:typeof n.props.scrollableTarget==`string`?document.getElementById(n.props.scrollableTarget):(n.props.scrollableTarget,null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange=`transform`,n._infScroll.style.transition=`transform 0.2s cubic-bezier(0,0,0.31,1)`))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),!(n.currentY<n.startY)&&(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),!(n.currentY-n.startY>n.maxPullDownDistance*1.5)&&n._infScroll&&(n._infScroll.style.overflow=`visible`,n._infScroll.style.transform=`translate3d(0px, `+(n.currentY-n.startY)+`px, 0px)`)))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow=`auto`,n._infScroll.style.transform=`none`,n._infScroll.style.willChange=`unset`)})},n.onScrollListener=function(e){typeof n.props.onScroll==`function`&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=C(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return t.prototype.componentDidMount=function(){if(this.props.dataLength===void 0)throw Error(`mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage`);if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener(`scroll`,this.throttledOnScrollListener),typeof this.props.initialScrollY==`number`&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener(`touchstart`,this.onStart),this.el.addEventListener(`touchmove`,this.onMove),this.el.addEventListener(`touchend`,this.onEnd),this.el.addEventListener(`mousedown`,this.onStart),this.el.addEventListener(`mousemove`,this.onMove),this.el.addEventListener(`mouseup`,this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),typeof this.props.refreshFunction!=`function`))throw Error(`Mandatory prop "refreshFunction" missing.
2
2
  Pull Down To Refresh functionality will not work
3
- as expected. Check README.md for usage'`)},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener(`scroll`,this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener(`touchstart`,this.onStart),this.el.removeEventListener(`touchmove`,this.onMove),this.el.removeEventListener(`touchend`,this.onEnd),this.el.removeEventListener(`mousedown`,this.onStart),this.el.removeEventListener(`mousemove`,this.onMove),this.el.removeEventListener(`mouseup`,this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength===t.prevDataLength?null:S(S({},t),{prevDataLength:e.dataLength})},t.prototype.isElementAtTop=function(e,t){t===void 0&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=E(t);return r.unit===w.Pixel?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){t===void 0&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=E(t);return r.unit===w.Pixel?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=S({height:this.props.height||`auto`,overflow:`auto`,WebkitOverflowScrolling:`touch`},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:`auto`}:{};return u.default.createElement(`div`,{style:r,className:`infinite-scroll-component__outerdiv`},u.default.createElement(`div`,{className:`infinite-scroll-component `+(this.props.className||``),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&u.default.createElement(`div`,{style:{position:`relative`},ref:function(t){return e._pullDown=t}},u.default.createElement(`div`,{style:{position:`absolute`,left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(u.Component);function O(e,t){if(e==null)return{};var n=k(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function k(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0},F=2,I=class extends u.default.Component{constructor(e){super(e),this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this);let t;t=this.props.breakpointCols&&this.props.breakpointCols.default?this.props.breakpointCols.default:parseInt(this.props.breakpointCols)||F,this.state={columnCount:t}}componentDidMount(){this.reCalculateColumnCount(),window&&window.addEventListener(`resize`,this.reCalculateColumnCountDebounce)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){window&&window.removeEventListener(`resize`,this.reCalculateColumnCountDebounce)}reCalculateColumnCountDebounce(){if(!window||!window.requestAnimationFrame){this.reCalculateColumnCount();return}window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})}reCalculateColumnCount(){let e=window&&window.innerWidth||1/0,t=this.props.breakpointCols;typeof t!=`object`&&(t={default:parseInt(t)||F});let n=1/0,r=t.default||F;for(let i in t){let a=parseInt(i);a>0&&e<=a&&a<n&&(n=a,r=t[i])}r=Math.max(1,parseInt(r)||1),this.state.columnCount!==r&&this.setState({columnCount:r})}itemsInColumns(){let e=this.state.columnCount,t=Array(e),n=u.default.Children.toArray(this.props.children);for(let r=0;r<n.length;r++){let i=r%e;t[i]||(t[i]=[]),t[i].push(n[r])}return t}renderColumns(){let{column:e,columnAttrs:t={},columnClassName:n}=this.props,r=this.itemsInColumns(),i=`${100/r.length}%`,a=n;a&&typeof a!=`string`&&(this.logDeprecated(`The property "columnClassName" requires a string`),a===void 0&&(a=`my-masonry-grid_column`));let o=M(M(M({},e),t),{},{style:M(M({},t.style),{},{width:i}),className:a});return r.map((e,t)=>u.default.createElement(`div`,A({},o,{key:t}),e))}logDeprecated(e){}render(){let e=this.props,{children:t,breakpointCols:n,columnClassName:r,columnAttrs:i,column:a,className:o}=e,s=O(e,[`children`,`breakpointCols`,`columnClassName`,`columnAttrs`,`column`,`className`]),c=o;return typeof o!=`string`&&(this.logDeprecated(`The property "className" requires a string`),o===void 0&&(c=`my-masonry-grid`)),u.default.createElement(`div`,A({},s,{className:c}),this.renderColumns())}};I.defaultProps=P;function L(e,t){return e?e.exhausted?{...e,src:null}:{...e,src:e.src||t||null}:null}function R({items:e,getItemId:t,getRequestUrl:n,createController:r}){let[i,a]=(0,u.useState)({}),o=(0,u.useRef)(new Map),s=(0,u.useCallback)(e=>{let i=t(e),a=n(e),s=`${i}:${a}`;if(o.current.has(s))return{itemId:i,requestUrl:a,cacheKey:s,controller:o.current.get(s)};let c=r(a);return o.current.set(s,c),{itemId:i,requestUrl:a,cacheKey:s,controller:c}},[r,t,n]);return(0,u.useEffect)(()=>{let t=new Set,n={},r=e.map(e=>{let{itemId:r,cacheKey:i,controller:o}=s(e);t.add(i),n[r]=o.src;let c=L(o.handleChangeSrc?.(),o.src);return c?.changed&&c.src&&(n[r]=c.src),o.subscribeToSrcChange?.(e=>{let t=L(e,o.src);!t?.changed||!t.src||a(e=>e[r]===t.src?e:{...e,[r]:t.src})})}).filter(Boolean);return o.current.forEach((e,n)=>{t.has(n)||o.current.delete(n)}),a(n),()=>{r.forEach(e=>e?.())}},[s,e]),{getDisplaySrc:(0,u.useCallback)(e=>{let{itemId:t,requestUrl:n,controller:r}=s(e);return i[t]||r.src||n},[i,s]),handleLoad:(0,u.useCallback)(e=>{s(e).controller.handleSuccess()},[s]),handleError:(0,u.useCallback)(e=>{let{itemId:t,controller:n}=s(e),r=L(n.handleError(),n.src);r?.changed&&r.src&&a(e=>({...e,[t]:r.src}))},[s])}}var z=`blocks`,B=({setCurrentImageLink:e,setModalHeight:t,setModalWidth:n,setImageStockList:r,imageStockList:s,currentReq:l,setCurrentReq:d,inputRef:f,setStockLink:m,customRequest:h})=>{let g=i.cn(),_=c.t(),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(2),{__:S}=o.h(),C=o.o(),[w]=a.S(),[T]=a.x(),E=(0,u.useCallback)(e=>e instanceof Error||typeof e?.message==`string`&&e.message?e.message:typeof e?.error?.message==`string`&&e.error.message?e.error.message:S(`Failed to load stock images through the configured proxy chain.`),[S]),O=(0,u.useCallback)(e=>{C.error({id:`STOCK_IMAGES_SEARCH_FAILED`,title:S(`Failed to load stock images`),description:E(e)})},[S,E,C]),k=async()=>{v||(y(!0),T({query:l,page:b}).then(e=>{if(e?.error){O(e.error),y(!1);return}let t=e?.data?.results||[];r(e=>[...e,...t]),y(!1),x(e=>e+1)}).catch(()=>{y(!1)}))};(0,u.useEffect)(()=>{l.keywords!==``&&A()},[l.color,l.orientation]);let A=async()=>{let e=await T({query:l,page:1});if(e?.error){O(e.error),r([]);return}let i=e?.data?.results||[];i.length>0?(r(i),setTimeout(()=>{n(1060),t(`84vh`)},0)):r([])},[j,M]=(0,u.useState)(null),N=(0,u.useCallback)((e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}w=${t}&q=${n}`,[]),P=(0,u.useCallback)(e=>i.ro(e,{config:g,standalone:_,resourceType:`stockImages`,intent:`display`}),[g,_]),{getDisplaySrc:F,handleLoad:L,handleError:B}=R({items:s,getItemId:(0,u.useCallback)(e=>e.id,[]),getRequestUrl:(0,u.useCallback)(e=>N(e.urls.raw,644,96),[N]),createController:P}),V=e=>t=>{L(e),t.target.parentNode.classList.add(`loaded`)},ee=e=>()=>{B(e)},te=(t,n,r)=>{w(n.download_location),M(r),setTimeout(()=>M(null),2e3),m(`${t.raw}&w=1200&q=96`),e(`${t.raw}&w=1200&q=96`),h(`${t.raw}&w=1200&q=96`)};return(0,p.jsxs)(`div`,{className:`stock-tab`,children:[(0,p.jsxs)(o.Ft,{onValuesChange:A,className:s.length>0?`serach-results`:``,children:[(0,p.jsxs)(o.Ot,{gutter:24,children:[(0,p.jsx)(o.Dt,{span:s.length>0?``:24,children:(0,p.jsx)(o.Ft.Item,{className:`stock-search-input`,children:(0,p.jsx)(o.St,{onSearch:A,allowClear:!0,size:s.length>0?`medium`:`large`,placeholder:S(`Search image`),value:l.keywords,onChange:e=>d(t=>({...t,keywords:e.target.value})),ref:f,spellCheck:`false`,enterButton:!1})})}),s.length>0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.Dt,{children:(0,p.jsxs)(o._t.Group,{defaultValue:``,onChange:e=>d(t=>({...t,orientation:e.target.value})),children:[(0,p.jsx)(o.U,{title:S(`All`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:``,children:(0,p.jsx)(c.m,{icon:`MixedView`})})}),(0,p.jsx)(o.U,{title:S(`Landscape`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:`landscape`,children:(0,p.jsx)(c.m,{icon:`LandscapeView`})})}),(0,p.jsx)(o.U,{title:S(`Portrait`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:`portrait`,children:(0,p.jsx)(c.m,{icon:`PortraitView`})})}),(0,p.jsx)(o.U,{title:S(`Squarish`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:`squarish`,children:(0,p.jsx)(c.m,{icon:`SquareView`})})})]})}),(0,p.jsx)(o.Dt,{children:(0,p.jsx)(o.A,{defaultValue:``,onChange:e=>d(t=>({...t,color:e.target.value})),options:[{value:``,colorClass:`all-colors`,label:S(`All`)},{value:`black`,colorClass:`black-color`,label:S(`Black`)},{value:`black_and_white`,colorClass:`bw-color`,label:S(`Black and White`)},{value:`white`,colorClass:`white-color`,label:S(`White`)},{value:`orange`,colorClass:`orange-color`,label:S(`Orange`)},{value:`red`,colorClass:`red-color`,label:S(`Red`)},{value:`purple`,colorClass:`purple-color`,label:S(`Purple`)},{value:`magenta`,colorClass:`magenta-color`,label:S(`Magenta`)},{value:`green`,colorClass:`green-color`,label:S(`Green`)},{value:`teal`,colorClass:`teal-color`,label:S(`Teal`)},{value:`blue`,colorClass:`blue-color`,label:S(`Blue`)}],tooltipPlacement:`top`})})]})]}),s.length>0&&(0,p.jsx)(`div`,{className:`blocks-search__divider-wrapper`,children:(0,p.jsx)(`div`,{className:`ant-divider ant-divider-horizontal`,role:`separator`})})]}),(0,p.jsx)(`div`,{className:`serach-output-wrapper`,style:{marginRight:-10},children:s.length>0&&(0,p.jsx)(`div`,{id:`scrollableDiv`,style:{width:`100%`,height:`calc(84vh - 148px)`,overflow:`auto`,paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:`0`,boxSizing:`unset`},children:(0,p.jsx)(D,{dataLength:s&&s.length,next:k,hasMore:s,endMessage:(0,p.jsxs)(o.jt,{plain:!0,children:[S("That`s all we could find."),` 🤐`]}),scrollableTarget:`scrollableDiv`,style:{overflow:`visible`},loader:null,children:(0,p.jsx)(I,{breakpointCols:{default:3},className:`my-masonry-grid`,columnClassName:`my-masonry-grid_column`,children:s.map(e=>(0,p.jsxs)(`div`,{className:`list-item`,onClick:()=>te(e.urls,e.links,e.id),children:[(0,p.jsx)(`img`,{className:j===e.id?`loaded-image`:``,width:`322px`,src:F(e),alt:e.description,onLoad:V(e),onError:ee(e)}),(0,p.jsxs)(`p`,{className:`creator-info`,onClick:e=>e.stopPropagation(),children:[`Photo by`,` `,(0,p.jsx)(`a`,{target:`_blank`,href:`${e.user.links.html}?utm_source=${z}&utm_medium=referral`,rel:`noreferrer`,children:e.user.name}),` `,`on`,` `,(0,p.jsx)(`a`,{target:`_blank`,href:`https://unsplash.com/?utm_source=${z}&utm_medium=referral`,rel:`noreferrer`,children:`Unsplash`})]}),j===e.id&&(0,p.jsx)(o.K,{className:`ant-spin`,size:`small`})]},e.id))})})})})]})},V=({images:e,transitionDuration:t=1e3})=>{let[n,r]=(0,u.useState)([]);return(0,u.useEffect)(()=>{if(e.length>0){let t=e[e.length-1];r(e=>[...e,{src:t,opacity:0}]),setTimeout(()=>{r(e=>e.map((t,n)=>n===e.length-1?{...t,opacity:1}:t))},1e3)}},[e]),(0,p.jsx)(`div`,{className:`slideshow-container`,children:n.map((e,n)=>(0,p.jsx)(`img`,{src:`data:image/jpeg;base64, ${e.src}`,alt:`Slide ${n+1}`,className:`slideshow-image`,style:{opacity:e.opacity,transition:`opacity ${t}ms linear`}},n))})};function ee({setModalHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:r,setIsImageUploaded:s,aiImageRequest:l,imageAiList:d,setImageAiList:p,isLoadingAi:m,setIsLoadingAi:h,onPluginAiImageLimitExceeded:g,onImageGenerateLimitExceeded:_}){let{__:v}=o.h(),y=i.cn(),b=o.o(),x=i.wt(),{emailId:S,blockId:C,projectId:w}=(0,f.useParams)(),[T]=a.C(),[E,{data:D=[]}]=a.v(),[O]=a.g(),k=y?.sendAIImageRequest||T,A=y?.trigger||E,j=y?.handleLimitUsageEmitter||i.q(i.wo.ON_LIMIT_ID),[M,N]=(0,u.useState)(0),[P,F]=(0,u.useState)(null),[I,L]=(0,u.useState)(!1),[R,z]=(0,u.useState)(v(`Evaluating the task`)),[B,V]=(0,u.useState)(!1),ee=S||C,{limits:te}=y?.limits?y:{limits:{ai_img_limit:0}},{ai_img_limit:H}=te,U=H>0&&M>=H,W=!!(y.limits&&y.counters)&&i.Ea.isPlugin,G=(0,u.useCallback)(()=>{j.fire({name:`AiImgCount`,count:M+1})},[j,M]),K=(0,u.useMemo)(()=>!U&&(!W||H===0||M<H),[U,W,M,H]),ne=(0,u.useCallback)(async()=>{z(v(`Evaluating the task`)),l!==``&&!m&&(h(!0),V(!0),p([]),x({event:`submit_form`,action:`ai_image_generation`,entity_id:S,project_id:w}),k({body:{project_id:w,request:`create-image`,connection:`midjourney`,message:l}}).then(({data:e,error:t})=>{if(t)throw t;if(e.data.status===401)throw Error(i.ua);e?.data.status===200?(e?.data.task.id&&(z(e.data.task.message),F(e.data.task.id)),e.message&&b.success({id:`AI_IMAGE_SEND_SUCCESS`,title:e.message,placement:`bottomRight`,data:l}),A({task_id:e?.data.task.id,entity_id:ee})):(h(!1),V(!1),b.error({id:`AI_IMAGE_SEND_ERROR`,title:e?.message||v(`Something went wrong, please try again`),placement:`bottomRight`,data:l,innerException:e}))}).catch(e=>{h(!1),V(!1),(e?.error||e?.data)&&b.fromError(`AI_IMAGE_SEND_ERROR`,l,e.error||e)}))},[l,m,h,V,p,x,S,w,k,b,A,ee,v]),re=(0,u.useCallback)(async()=>{if(K){if(!W){let e=c.l(`image_generate`,(await O(`image_generate`)).data?.stats);if(e){_?.(e);return}}W&&(N(e=>e+1),G()),ne()}else W&&(g?g():b.error({title:v(`The usage limit has been exceeded`),description:v(`The maximum number of requests for the current subscription period has been reached.
4
- Select the appropriate plan to fulfil more requests`),placement:`bottomRight`}))},[K,W,O,_,N,G,ne,b,v,g]);(0,u.useEffect)(()=>{W&&N(y?.counters?.ai_img_counter||0)},[y,W]);let ie=(0,u.useCallback)(e=>{if(!r){s(!0);let n=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!n)return;let r=n[1],i=n[2],a=atob(i),o=Array(a.length);for(let e=0;e<a.length;e++)o[e]=a.charCodeAt(e);let c=new Uint8Array(o),l=new Blob([c],{type:`image/${r}`});t({file:new File([l],`image.jpeg`,{type:l.type})})}},[r,s,t]),ae=(0,u.useCallback)(e=>{e.status!==`error`&&e.status!==`Canceled`?e.images?(z(e.status),e.progress===100&&(p(e.images),z(v(`Evaluating the task`)),F(null),V(!1))):(p([e.data]),h(!1)):(h(!1),V(!1),b.error({id:`AI_IMAGE_GET_ERROR`,title:v(`Something went wrong, please try again`),placement:`bottomRight`,data:P}))},[p,z,v,h,e,P,b,V]);return(0,u.useEffect)(()=>{D.length>1&&ae(D[D.length-1])},[D,ae]),(0,u.useEffect)(()=>{(m||d.length>0)&&setTimeout(()=>{let t=550;n.current&&(t=n.current.offsetHeight+68),e(t)},0)},[n,D,d.length,m,e]),{aiImageCounter:M,setAiImageCounter:N,currentAiImgLimits:H,isFieldsDisabled:U,canGenerateImage:K,aiImageRequest:l,imageAiList:d,setImageAiList:p,isLoadingAi:m,setIsLoadingAi:h,loadingDuringGeneration:B,setLoadingDuringGeneration:V,requestStatus:R,setRequestStatus:z,handleGenerate:re,handleLimitAiImgCount:G,convertBase64ToFile:ie,isShiftPressed:I,setIsShiftPressed:L,currentReqId:P,setCurrentReqId:F,limitsInPlugin:W}}var te=({setModalHeight:e,customRequest:t,aiTabRef:n,inputAiRef:r,isImageUploaded:s,setIsImageUploaded:d,aiImageRequest:m,setAiImageRequest:h,imageAiList:g,setImageAiList:_,isLoadingAi:v,setIsLoadingAi:y})=>{let b=(0,f.useNavigate)(),x=i.ki(),{__:S,_n:C}=o.h(),w=i.cn(),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),{aiImageCounter:k,currentAiImgLimits:A,loadingDuringGeneration:j,requestStatus:M,handleGenerate:N,convertBase64ToFile:P,isShiftPressed:F,setIsShiftPressed:I,limitsInPlugin:L}=ee({setModalHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:s,setIsImageUploaded:d,aiImageRequest:m,imageAiList:g,setImageAiList:_,isLoadingAi:v,setIsLoadingAi:y,onPluginAiImageLimitExceeded:()=>E(!0),onImageGenerateLimitExceeded:O}),R=T&&A>0?l.p(A):null,z=R?c.u(R.presetId):null,B=D?c.u(D.presetId):null,[te,H]=(0,u.useState)(!1),U=(0,u.useCallback)(()=>H(!0),[]),W=(0,u.useCallback)(()=>H(!1),[]),G=(0,u.useCallback)(e=>h(e.target.value),[h]),K=(0,u.useCallback)(e=>{e.key===`Shift`?I(!0):e.key===`Enter`&&!F&&(e.preventDefault(),N())},[F,N,I]),ne=(0,u.useCallback)(e=>{e.key===`Shift`&&I(!1)},[I]),re=g[g.length-1];return(0,p.jsxs)(`div`,{className:`image-ai`,children:[z&&R?(0,p.jsx)(c.f,{open:!0,onClose:()=>E(!1),title:S(z.titleKey),subtitle:S(z.subtitleKey),usageResource:z.usageResource,previousDisplay:c.d(R.previousLimit),nextDisplay:c.d(R.nextLimit),onChangePlan:()=>{E(!1),document.body.classList.remove(`editor`),b(`/billing`),x(a.r(i.xa.SWITCH_TO_PLAN_MODAL))}}):null,B&&D?(0,p.jsx)(c.f,{open:!0,onClose:()=>O(null),title:S(B.titleKey),subtitle:S(B.subtitleKey),usageResource:B.usageResource,previousDisplay:c.d(D.previousLimit),nextDisplay:c.d(D.nextLimit),onChangePlan:()=>{O(null),document.body.classList.remove(`editor`),b(`/billing`),x(a.r(i.xa.SWITCH_TO_PLAN_MODAL))}}):null,L&&(0,p.jsx)(o.P,{text:`${k} ${S(`of`)} ${A>0?A:`∞`} images ${C(`was used`,`were used`,k)}`,exceeded:A>0&&k>=A,style:{marginTop:-25},extra:(0,p.jsx)(`span`,{style:{textDecoration:`underline`,cursor:`pointer`},onClick:()=>b(w.billingPageUrl||i.Ui.billing),children:S(`Need more?`)})}),(0,p.jsx)(o.Ot,{gutter:24,className:`image-ai__row`,children:(0,p.jsx)(o.Dt,{span:24,children:(0,p.jsx)(o.Ft.Item,{style:{margin:0},children:(0,p.jsxs)(`span`,{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${te?` ant-input-affix-wrapper-focused`:``}`,children:[(0,p.jsx)(o.xt,{ref:r,onKeyDown:K,onKeyUp:ne,onFocus:U,onBlur:W,autoSize:!0,allowClear:!0,className:`text-area-input-hybrid image-ai__textarea`,placeholder:S(`Generate image`),value:m,onChange:G,spellCheck:`false`}),(0,p.jsx)(`span`,{className:`ant-input-suffix image-ai__input-suffix`,children:v||j?(0,p.jsx)(c.m,{icon:`LoadingOutlined`,className:`input-icon image-ai__input-icon`,spin:!0}):(0,p.jsx)(c.m,{icon:`AI`,className:`input-icon image-ai__input-icon`,onClick:N})})]})})})}),(v||g.length>0)&&(0,p.jsxs)(`div`,{className:`image-ai__preview`,children:[v&&g.length===0&&(0,p.jsx)(`div`,{className:`image-ai__loading`,children:(0,p.jsxs)(`div`,{className:`spin`,children:[(0,p.jsx)(c.m,{icon:`LoadingOutlined`,style:{fontSize:48},spin:!0}),(0,p.jsx)(`p`,{className:`status`,children:M})]})}),g.length>0&&(0,p.jsxs)(`div`,{className:`image-ai__image-item`,children:[(0,p.jsx)(V,{images:g}),(0,p.jsx)(`div`,{className:`buttons`,children:(0,p.jsx)(o.Rt,{onClick:()=>P(`data:image/jpeg;base64, ${re}`),icon:(0,p.jsx)(c.m,{icon:`CheckOutlined`}),children:S(`Use this one`)})})]})]})]})},H=({setNewLink:e,setCurrentImageLink:t,setModalHeight:n,setModalWidth:r,setImageGifList:s,imageGifList:l,currentReqGif:d,setCurrentReqGif:f,inputRef:m,setStockLink:h,customRequest:g})=>{let{__:_}=o.h(),v=i.cn(),y=c.t(),b=o.o(),[x,S]=(0,u.useState)(null),[C,w]=(0,u.useState)(!1),[T,E]=(0,u.useState)(25),[O]=a.b(),k=(0,u.useCallback)(e=>e instanceof Error||typeof e?.message==`string`&&e.message?e.message:typeof e?.error?.message==`string`&&e.error.message?e.error.message:_(`Failed to load GIFs through the configured proxy chain.`),[_]),A=(0,u.useCallback)(e=>{b.error({id:`STOCK_GIFS_SEARCH_FAILED`,title:_(`Failed to load GIFs`),description:k(e)})},[_,k,b]),j=async()=>{C||(w(!0),O({query:d,page:T}).then(e=>{if(e?.error){A(e.error),w(!1);return}s(t=>[...t,...e.data.data]),w(!1),E(e=>e+25)}).catch(()=>{w(!1)}))},M=async()=>{let e=await O({query:d,page:0});if(e?.error){A(e.error),s([]);return}e?.data?.data?.length>0&&(s(e.data.data),setTimeout(()=>{n(`84vh`),r(1060)},0))},N=(e,n)=>{S(n),setTimeout(()=>{S(null)},2e3),h(`${e}`),t(`${e}`),g(`${e}`)},P={default:3},F=(0,u.useCallback)(e=>i.ro(e,{config:v,standalone:y,resourceType:`generic`,intent:`display`}),[v,y]),{getDisplaySrc:L,handleLoad:z,handleError:B}=R({items:l,getItemId:(0,u.useCallback)(e=>e.id,[]),getRequestUrl:(0,u.useCallback)(e=>e.images.downsized.url,[]),createController:F}),V=e=>t=>{z(e),t.target.parentNode.classList.add(`loaded`)},ee=e=>()=>{B(e)};return(0,p.jsxs)(`div`,{className:`stock-tab`,children:[(0,p.jsxs)(o.Ft,{onValuesChange:M,className:l.length>0?`serach-results`:``,children:[(0,p.jsx)(o.Ot,{gutter:24,children:(0,p.jsx)(o.Dt,{span:l.length>0?``:24,children:(0,p.jsx)(o.Ft.Item,{className:`stock-search-input`,children:(0,p.jsx)(o.St,{onSearch:M,allowClear:!0,size:l.length>0?`medium`:`large`,placeholder:_(`Search GIFs`),value:d.keywords,onChange:e=>f(t=>({...t,keywords:e.target.value})),ref:m,spellCheck:`false`,enterButton:!1})})})}),l.length>0&&(0,p.jsx)(`div`,{className:`blocks-search__divider-wrapper`,children:(0,p.jsx)(`div`,{className:`ant-divider ant-divider-horizontal`,role:`separator`})})]}),(0,p.jsx)(`div`,{className:`serach-output-wrapper`,style:{marginRight:-10},children:l.length>0&&(0,p.jsx)(`div`,{id:`scrollableDiv`,style:{width:`100%`,height:`calc(84vh - 148px)`,overflow:`auto`,paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:`0`,boxSizing:`unset`},children:(0,p.jsx)(D,{dataLength:l&&l.length,next:j,hasMore:l,endMessage:(0,p.jsxs)(o.jt,{plain:!0,children:[_("That`s all we could find."),` 🤐`]}),scrollableTarget:`scrollableDiv`,style:{overflow:`visible`},loader:(0,p.jsx)(o.K,{size:`small`}),children:(0,p.jsx)(I,{breakpointCols:P,className:`my-masonry-grid`,columnClassName:`my-masonry-grid_column`,children:l.map((e,t)=>(0,p.jsxs)(`div`,{className:`list-item`,onClick:()=>N(e.images.downsized.url,e.id),children:[(0,p.jsx)(`img`,{className:x===e.id?`loaded-image`:``,width:`322px`,src:L(e),alt:e.title,onLoad:V(e),onError:ee(e)}),(0,p.jsx)(`a`,{rel:`noreferrer`,href:`https://giphy.com/`,target:`_blank`,onClick:e=>e.stopPropagation(),children:(0,p.jsx)(`div`,{className:`overlay-image`,style:{backgroundImage:`url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=)`}})}),x===e.id&&(0,p.jsx)(o.K,{className:`ant-spin`,size:`small`})]},e.id+t))})})})})]})};function U(e){if(!(e==null||e===``))return e}async function W(e,t){if(e){if(e.url)return e.url;if(typeof t.getFileById==`function`&&e.id){let n=await t.getFileById(e.id);if(n?.url)return n.url;if(n?.thumbnailUrl)return n.thumbnailUrl;if(n?.thumbnail)return n.thumbnail}if(typeof t.getFileUrl==`function`&&e.folderId!==void 0&&e.name){let n=await t.getFileUrl(e.folderId||``,e.name);if(n)return n}if(typeof t.getUrl==`function`&&e.name){let n=await t.getUrl(e);if(n)return n}return e.thumbnail||e.thumbnailUrl}}function G(e){if(!(!e?.success||!Array.isArray(e.detailed)))return e.detailed.find(e=>e?.success&&e.data)?.data}function K(e,t,n){if(e)return{id:e.id,name:e.name||t.name,size:e.size??t.size,type:e.type||t.type,folderId:e.folderId??n??``,url:e.url,thumbnail:e.thumbnail,thumbnailUrl:e.thumbnailUrl,date:e.date,dimensions:e.dimensions,aspectRatio:e.aspectRatio,extension:e.extension,selected:e.selected,isFolder:e.isFolder,lastEdited:e.lastEdited,childrenCount:e.childrenCount}}async function ne(e,t,n){if(!t)return;let r=U(n??t.rootId),i;typeof t.uploadFiles==`function`?i=G(await t.uploadFiles({folderId:r,items:[{name:e.name,size:e.size,type:e.type,folderId:r,data:e}]})):typeof t.uploadFile==`function`&&(i=K(await t.uploadFile({name:e.name,size:e.size,type:e.type,folderId:r,data:e}),e,r));let a=await W(i,t);return a?{item:i,url:a}:void 0}var re=`IMG`,ie=`BACKGROUND`,ae=`GALLERY`,oe=`EDITOR`,q=`UPLOAD`,se=`STOCK`,ce=`GIF`,le=`AI`,{Dragger:ue}=o.gt,de=(e,t=`image`)=>{try{let n=new URL(e).pathname.split(`/`).pop();return n&&decodeURIComponent(n)||t}catch{return t}},fe=l.f,pe=(e,t)=>{let n=fe(t);return!n||e.includes(`.`)?e:`${e}.${n}`},me=(e,t)=>new File([e],pe(de(t),e.type),{type:e.type||`application/octet-stream`}),he=({dataProvider:e})=>{let t=i.cn(),n=c.t(),{__:r}=o.h(),s=i.ki(),{projectId:d}=(0,f.useParams)(),[m]=a.y(),{modal:h}=o.Wt.useApp(),g=o.o(),_=i.Oi(i.r),v=i.Oi(i.n),b=i.Oi(a.s),{request:x,resolveImagePicker:S}=c.r(),[C,w]=(0,u.useState)(``),[T,E]=(0,u.useState)(``),[D,O]=(0,u.useState)(``),[k,A]=(0,u.useState)(``),[j,M]=(0,u.useState)(q),[N,P]=(0,u.useState)({width:``,height:``,size:``,format:``}),[F,I]=(0,u.useState)(`success`),[L,R]=(0,u.useState)(!1),z=u.default.useRef(null),V=u.default.useRef(null),ee=u.default.useRef(null),U=u.default.useRef(null),W=u.default.useRef(null),G=u.default.useRef(null),K=u.default.useRef(null),de=u.default.useRef(null),pe=u.default.useRef(null),[he,J]=(0,u.useState)(`auto`),[ge,Y]=(0,u.useState)(572),[_e,ve]=(0,u.useState)(!1),[ye,be]=(0,u.useState)({keywords:``,color:``,orientation:``}),[xe,Se]=(0,u.useState)({keywords:``}),[Ce,we]=(0,u.useState)([]),[Te,Ee]=(0,u.useState)([]),[De,Oe]=(0,u.useState)([]),[ke,Ae]=(0,u.useState)(!1),[je,Me]=(0,u.useState)(``),[Ne,Pe]=(0,u.useState)(!1),[Fe,Ie]=(0,u.useState)(0),Le=i.Oi(i.ct),Re=Le?.id===void 0?d||``:String(Le.id),ze=i.q(i.wo.UPLOAD_EVENT_ID),Be=u.default.useRef(l.u()),Ve=u.default.useRef(``),He=u.default.useRef(0),X=u.default.useRef(``),[Ue,We]=(0,u.useState)(``),[Ge,Ke]=(0,u.useState)(``),Z=(0,u.useCallback)(()=>{X.current&&=(URL.revokeObjectURL(X.current),``),We(``)},[]),Q=(0,u.useCallback)(()=>{Ke(``)},[]),$=!(_||v.id?.toString()!==Le?.members?.owner.ID),qe=e=>{E(e.target.value)},Je=(0,u.useCallback)((e,t,n=r(`The image could not be uploaded.`))=>{let i=t instanceof Error?t.message:n;g.error({id:`IMAGE_UPLOAD_ERROR`,data:e,title:r(`Upload failed`),description:i})},[r,g]),Ye=(0,u.useCallback)(async e=>c.o(await ze.fire({file:e,project:Re})),[Re,ze]),Xe=l.t(),Ze=async e=>{if(e)try{let t=await $e(e);t&&it(t)?await at({file:t}):t||Je({url:e},null,r(`Failed to download image from URL.`))}catch(t){Je({url:e},t,r(`Failed to process image URL.`))}},Qe=u.default.useRef(Ze);Qe.current=Ze,u.default.useEffect(()=>{if(j!==q||!k)return;let e=T.trim();if(!e||!e.toLowerCase().startsWith(`http`))return;let t=setTimeout(()=>{Qe.current(e)},1e3);return()=>{clearTimeout(t)}},[T,j,k]);let $e=async e=>{try{let t=l.l(e);return me(await Be.current.resolve(t,void 0,Xe),t)}catch{}};document.onpaste=function(e){let n=e.clipboardData?.items?.[0];if(j===q&&k){if(n?.type?.indexOf(`image`)===0&&t.imageCenterLocalUploadEnabled!==!1){let e=n.getAsFile();it(e);let t={file:e};E(``),at(t);return}let r=e.clipboardData?.getData(`text/plain`);if(r&&r.trim().toLowerCase().startsWith(`http`)){e.preventDefault(),e.stopPropagation(),E(r.trim());return}n?.type?.indexOf(`text`)===0&&n.getAsString(e=>{if(e.trim().toLowerCase().startsWith(`http`))E(e.trim());else if(e.toString().slice(1,5)===`meta`){let t=e.toString().split(`"`)[1];t&&E(t)}})}},(0,u.useEffect)(()=>{let e=e=>{let t=null;x?.kind===`background`?(t=ie,A(ie)):x?.kind===`img`&&(A(re),t=re),x?.currentUrl&&t&&(w(x.currentUrl),M(e))};b===i.xa.UPLOAD_IMAGE_MODAL||b===i.xa.UPLOAD_BACKGROUND_MODAL?e(oe):b===i.xa.UPLOAD_IMAGE_MODAL_AI||b===i.xa.UPLOAD_BACKGROUND_MODAL_AI?($?(Pe(!0),Ie(2)):e(le),setTimeout(()=>pe.current?.focus({cursor:`start`}),100)):b===i.xa.UPLOAD_IMAGE_MODAL_UPLOAD||b===i.xa.UPLOAD_BACKGROUND_MODAL_UPLOAD?(e(q),setTimeout(()=>G.current?.focus({cursor:`start`}),100)):b===i.xa.UPLOAD_IMAGE_MODAL_STOCK||b===i.xa.UPLOAD_BACKGROUND_MODAL_STOCK?($?(Pe(!0),Ie(3)):e(se),setTimeout(()=>de.current?.focus({cursor:`start`}),100)):b===i.xa.UPLOAD_IMAGE_MODAL_GIF||b===i.xa.UPLOAD_BACKGROUND_MODAL_GIF?($?(Pe(!0),Ie(3)):e(ce),setTimeout(()=>K.current?.focus({cursor:`start`}),100)):b===i.xa.UPLOAD_IMAGE_MODAL_EDIT||b===i.xa.UPLOAD_BACKGROUND_MODAL_EDIT?($?(Pe(!0),Ie(5)):e(oe),s(a.i(i.xa.IMAGE_EDITOR_MODAL))):A(``)},[b,s,$,x]);let et=(0,u.useCallback)(({url:e=C||``})=>{w(e),S({url:e,meta:{mode:`select`}}),setTimeout(()=>{Q(),Z(),be({keywords:``,color:``,orientation:``}),Se({keywords:``}),Ee([]),we([]),A(``),Me(``),Ae(!1),O(``),E(``),M(q)},200),s(a.t()),s(a.n())},[C,Q,s,S,Z]),tt=(0,u.useCallback)((e,t)=>(J(`auto`),R(!1),et({url:e}),g.success({id:`IMAGE_UPLOAD_SUCCESS`,data:t,title:r(`The image was successfully uploaded.`)}),e),[r,et,g]);(0,u.useEffect)(()=>{let t=T||D,r=l.l(t);if(!t||!r){I(``),Ve.current=``,Q(),Z(),Be.current.invalidateAll();return}let i=Ve.current;i&&i!==r&&(Be.current.abandonKey(i),Q(),Z()),Ve.current=r;let a=new AbortController,o=T?800:0,s=++He.current,c=setTimeout(async()=>{try{let i=async()=>{let e=await Be.current.resolve(r,a.signal,Xe);if(s!==He.current)return;let{width:t,height:n}=await l.d(e);if(s!==He.current)return;P({width:t,height:n,size:(e.size/1024).toFixed(2),format:fe(e.type)}),Q(),X.current&&URL.revokeObjectURL(X.current);let i=URL.createObjectURL(e);X.current=i,We(i)};if(n)await i();else{let t=await l.n(e,r);if(t?.previewUrl&&s===He.current){Ke(t.previewUrl),Z();try{let{data:e}=await m(r);if(s!==He.current)return;e?P({width:e?.width,height:e?.height,size:e?.fileSize==null?``:(e.fileSize/1024).toFixed(2),format:fe(e?.format)}):await i()}catch{await i()}}else await i()}if(s!==He.current)return;I(`success`),w(t),Y(572),setTimeout(()=>{let e=0;V.current&&(e=V.current.offsetHeight+62),J(e)},0)}catch(e){if(e?.name===`AbortError`||a.signal.aborted||s!==He.current)return;Q(),Z(),I(`error`)}},o);return()=>{clearTimeout(c),a.abort()}},[T,D,n,Q,Xe,m,Z,e]),(0,u.useEffect)(()=>{if(!C||T||D)return;let t=l.l(C),r=new AbortController,i=!1,a=async()=>{let e=await Be.current.resolve(t,r.signal,Xe);if(i)return;let{width:n,height:a}=await l.d(e);if(i)return;Q(),X.current&&URL.revokeObjectURL(X.current);let o=URL.createObjectURL(e);X.current=o,We(o),P({width:n,height:a,size:(e.size/1024).toFixed(2),format:fe(e.type)})};return(async()=>{try{if(!n){let n=await l.n(e,t);if(n?.previewUrl&&!i){Ke(n.previewUrl),Z();try{let{data:e}=await m(t);if(i)return;e?P({width:e?.width,height:e?.height,size:e?.fileSize==null?``:(e.fileSize/1024).toFixed(2),format:fe(e?.format)}):await a();return}catch{await a()}}}await a()}catch{i||Q()}})(),()=>{i=!0,r.abort()}},[n,Q,C,Xe,m,e,T,D]);let nt=()=>{s(a.t()),setTimeout(()=>{Q(),Z(),w(``),E(``),Ee([]),Ee([]),be({keywords:``,color:``,orientation:``}),Se({keywords:``}),J(`auto`),!ke&&Me(``),Y(572),M(q)},200)},rt=e=>{e===ae?h.success({mask:{closable:!0},centered:!0,title:r(`Coming soon`),content:r(`The feature is under development.`),okText:r(`Ok. I'll be waiting`),onOk:()=>{}}):e===oe&&C===``?h.warning({mask:{closable:!0},centered:!0,title:r(``),content:r(`To preview and edit the uploaded image`),okText:r(`Upload Image`),onOk:()=>{M(q)}}):(setTimeout(()=>{let t=0,n=0;e===q&&z.current?(ye.keywords===``&&G.current?.focus({cursor:`start`}),t=300,n=572):e===oe&&V.current?(t=V.current.offsetHeight+62,n=572):e===se&&ee.current?(ye.keywords===``&&de.current?.focus({cursor:`start`}),t=130,n=572,Te.length>0&&(n=1060,t=`84vh`)):e===ce&&U.current?(ye.keywords===``&&K.current?.focus({cursor:`start`}),t=130,n=572,Ce.length>0&&(n=1060,t=`84vh`)):e===le&&W.current&&(je===``&&De.length===0?(pe.current?.focus({cursor:`start`}),t=130):t=W.current.offsetHeight+82,n=572),J(t),Y(n)},0),M(e))};(0,u.useEffect)(()=>{ye.keywords===``&&(G?.current?.focus({cursor:`start`}),Ee([]),setTimeout(()=>{J(`auto`),Y(572)},0))},[ye,Ee,J,Y]);let it=e=>{let t=e.type===`image/jpeg`||e.type===`image/png`||e.type===`image/jpg`||e.type===`image/webp`||e.type===`image/gif`||e.type===`image/svg+xml`;return t||g.error({id:`IMAGE_UPLOAD_WRONG_FORMAT`,data:e,title:`Upload`,description:`You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!`}),t},at=async({file:n})=>{try{ve(!0);let r=await l.i(n,t),i=await Ye(r);if(i)return tt(i,r),i;let a=await ne(r,e);if(a?.url)return tt(a.url,r),a.url;Je(r,null);return}catch(e){Je(n,e);return}finally{ve(!1)}},ot=e=>at({file:e}),st=[{label:r(`Upload`),key:q,children:(0,p.jsxs)(`div`,{ref:z,style:{paddingBottom:24},children:[t.imageCenterLocalUploadEnabled!==!1&&(0,p.jsxs)(ue,{showUploadList:!1,name:`Image`,beforeUpload:it,customRequest:at,style:{marginBottom:10},multiple:!1,accept:`image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml`,children:[(0,p.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,p.jsx)(c.m,{icon:`InboxOutlined`})}),(0,p.jsx)(`p`,{className:`ant-upload-text`,children:r(`Click to select, paste from the clipboard, or drag and drop`)}),(0,p.jsx)(`p`,{className:`ant-upload-hint`,children:r(`Accepted formats: PNG, JPG, WEBP, SVG or GIF.`)})]}),(0,p.jsx)(o.Ft,{style:{padding:`0 2px 0 2px`},children:(0,p.jsx)(o.Ft.Item,{validateStatus:F,children:(0,p.jsx)(o.kt,{ref:G,allowClear:!0,size:`large`,placeholder:r(`Paste image URL here`),value:T,onChange:qe,spellCheck:`false`})})})]})}];return t.imageCenterStockEnabled&&!$&&st.push({label:r(`Stock`),key:se,children:(0,p.jsx)(`div`,{ref:ee,style:{paddingBottom:24},children:(0,p.jsx)(B,{currentReq:ye,setCurrentReq:be,imageStockList:Te,setImageStockList:Ee,setModalWidth:Y,setModalHeight:J,setStockLink:O,setCurrentImageLink:w,inputRef:de,customRequest:Ze})})}),t.imageCenterGifEnabled&&!$&&st.push({label:r(`GIF`),key:ce,children:(0,p.jsx)(`div`,{ref:U,style:{paddingBottom:24},children:(0,p.jsx)(H,{currentReqGif:xe,setCurrentReqGif:Se,imageGifList:Ce,setImageGifList:we,setModalWidth:Y,setModalHeight:J,setStockLink:O,setCurrentImageLink:w,inputRef:K,customRequest:Ze})})}),t.elementAIimageEnabled&&!$&&st.push({label:r(`AI`),key:le,children:(0,p.jsx)(`div`,{ref:W,style:{paddingBottom:24},children:(0,p.jsx)(te,{setModalHeight:J,customRequest:at,aiImageRequest:je,setAiImageRequest:Me,imageAiList:De,setImageAiList:Oe,isLoadingAi:ke,setIsLoadingAi:Ae,aiTabRef:W,inputAiRef:pe,isImageUploaded:L,setIsImageUploaded:R})})}),t.imageCenterEditorEnabled&&st.push({label:``,key:oe,children:(0,p.jsx)(`div`,{ref:V,children:(0,p.jsx)(y,{currentImageLink:C,newLink:T,previewDisplayUrl:Ge,resolvedPreviewObjectUrl:Ue,imageSize:N,onSave:ot,uploadImageResultIsLoading:_e||!1})})}),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.Y,{width:ge,className:`image-center`,title:r(`Image Center`),style:{minHeight:390},open:!!k,onOk:et,onCancel:nt,footer:j===oe?(0,p.jsx)(p.Fragment,{}):null,children:(0,p.jsx)(o.K,{spinning:_e,children:(0,p.jsx)(o.Z,{activeKey:j,onChange:rt,items:st,className:`modal-tabs`,style:{height:he,minHeight:130}})})}),(0,p.jsx)(c.g,{open:Ne,onCancel:()=>Pe(!1),initialSlide:Fe})]})};he.propTypes={dataProvider:d.default.object},t.default=he});
3
+ as expected. Check README.md for usage'`)},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener(`scroll`,this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener(`touchstart`,this.onStart),this.el.removeEventListener(`touchmove`,this.onMove),this.el.removeEventListener(`touchend`,this.onEnd),this.el.removeEventListener(`mousedown`,this.onStart),this.el.removeEventListener(`mousemove`,this.onMove),this.el.removeEventListener(`mouseup`,this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength===t.prevDataLength?null:S(S({},t),{prevDataLength:e.dataLength})},t.prototype.isElementAtTop=function(e,t){t===void 0&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=E(t);return r.unit===w.Pixel?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){t===void 0&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=E(t);return r.unit===w.Pixel?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=S({height:this.props.height||`auto`,overflow:`auto`,WebkitOverflowScrolling:`touch`},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:`auto`}:{};return u.default.createElement(`div`,{style:r,className:`infinite-scroll-component__outerdiv`},u.default.createElement(`div`,{className:`infinite-scroll-component `+(this.props.className||``),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&u.default.createElement(`div`,{style:{position:`relative`},ref:function(t){return e._pullDown=t}},u.default.createElement(`div`,{style:{position:`absolute`,left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(u.Component);function O(e,t){if(e==null)return{};var n=k(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function k(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0},F=2,I=class extends u.default.Component{constructor(e){super(e),this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this);let t;t=this.props.breakpointCols&&this.props.breakpointCols.default?this.props.breakpointCols.default:parseInt(this.props.breakpointCols)||F,this.state={columnCount:t}}componentDidMount(){this.reCalculateColumnCount(),window&&window.addEventListener(`resize`,this.reCalculateColumnCountDebounce)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){window&&window.removeEventListener(`resize`,this.reCalculateColumnCountDebounce)}reCalculateColumnCountDebounce(){if(!window||!window.requestAnimationFrame){this.reCalculateColumnCount();return}window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})}reCalculateColumnCount(){let e=window&&window.innerWidth||1/0,t=this.props.breakpointCols;typeof t!=`object`&&(t={default:parseInt(t)||F});let n=1/0,r=t.default||F;for(let i in t){let a=parseInt(i);a>0&&e<=a&&a<n&&(n=a,r=t[i])}r=Math.max(1,parseInt(r)||1),this.state.columnCount!==r&&this.setState({columnCount:r})}itemsInColumns(){let e=this.state.columnCount,t=Array(e),n=u.default.Children.toArray(this.props.children);for(let r=0;r<n.length;r++){let i=r%e;t[i]||(t[i]=[]),t[i].push(n[r])}return t}renderColumns(){let{column:e,columnAttrs:t={},columnClassName:n}=this.props,r=this.itemsInColumns(),i=`${100/r.length}%`,a=n;a&&typeof a!=`string`&&(this.logDeprecated(`The property "columnClassName" requires a string`),a===void 0&&(a=`my-masonry-grid_column`));let o=M(M(M({},e),t),{},{style:M(M({},t.style),{},{width:i}),className:a});return r.map((e,t)=>u.default.createElement(`div`,A({},o,{key:t}),e))}logDeprecated(e){}render(){let e=this.props,{children:t,breakpointCols:n,columnClassName:r,columnAttrs:i,column:a,className:o}=e,s=O(e,[`children`,`breakpointCols`,`columnClassName`,`columnAttrs`,`column`,`className`]),c=o;return typeof o!=`string`&&(this.logDeprecated(`The property "className" requires a string`),o===void 0&&(c=`my-masonry-grid`)),u.default.createElement(`div`,A({},s,{className:c}),this.renderColumns())}};I.defaultProps=P;function L(e,t){return e?e.exhausted?{...e,src:null}:{...e,src:e.src||t||null}:null}function R({items:e,getItemId:t,getRequestUrl:n,createController:r}){let[i,a]=(0,u.useState)({}),o=(0,u.useRef)(new Map),s=(0,u.useCallback)(e=>{let i=t(e),a=n(e),s=`${i}:${a}`;if(o.current.has(s))return{itemId:i,requestUrl:a,cacheKey:s,controller:o.current.get(s)};let c=r(a);return o.current.set(s,c),{itemId:i,requestUrl:a,cacheKey:s,controller:c}},[r,t,n]);return(0,u.useEffect)(()=>{let t=new Set,n={},r=e.map(e=>{let{itemId:r,cacheKey:i,controller:o}=s(e);t.add(i),n[r]=o.src;let c=L(o.handleChangeSrc?.(),o.src);return c?.changed&&c.src&&(n[r]=c.src),o.subscribeToSrcChange?.(e=>{let t=L(e,o.src);!t?.changed||!t.src||a(e=>e[r]===t.src?e:{...e,[r]:t.src})})}).filter(Boolean);return o.current.forEach((e,n)=>{t.has(n)||o.current.delete(n)}),a(n),()=>{r.forEach(e=>e?.())}},[s,e]),{getDisplaySrc:(0,u.useCallback)(e=>{let{itemId:t,requestUrl:n,controller:r}=s(e);return i[t]||r.src||n},[i,s]),handleLoad:(0,u.useCallback)(e=>{s(e).controller.handleSuccess()},[s]),handleError:(0,u.useCallback)(e=>{let{itemId:t,controller:n}=s(e),r=L(n.handleError(),n.src);r?.changed&&r.src&&a(e=>({...e,[t]:r.src}))},[s])}}var z=`blocks`,B=({setCurrentImageLink:e,setModalHeight:t,setModalWidth:n,setImageStockList:r,imageStockList:s,currentReq:l,setCurrentReq:d,inputRef:f,setStockLink:m,customRequest:h})=>{let g=i.pn(),_=i.at(),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(2),{__:S}=o.h(),C=o.o(),[w]=a.S(),[T]=a.x(),E=(0,u.useCallback)(e=>e instanceof Error||typeof e?.message==`string`&&e.message?e.message:typeof e?.error?.message==`string`&&e.error.message?e.error.message:S(`Failed to load stock images through the configured proxy chain.`),[S]),O=(0,u.useCallback)(e=>{C.error({id:`STOCK_IMAGES_SEARCH_FAILED`,title:S(`Failed to load stock images`),description:E(e)})},[S,E,C]),k=async()=>{v||(y(!0),T({query:l,page:b}).then(e=>{if(e?.error){O(e.error),y(!1);return}let t=e?.data?.results||[];r(e=>[...e,...t]),y(!1),x(e=>e+1)}).catch(()=>{y(!1)}))};(0,u.useEffect)(()=>{l.keywords!==``&&A()},[l.color,l.orientation]);let A=async()=>{let e=await T({query:l,page:1});if(e?.error){O(e.error),r([]);return}let i=e?.data?.results||[];i.length>0?(r(i),setTimeout(()=>{n(1060),t(`84vh`)},0)):r([])},[j,M]=(0,u.useState)(null),N=(0,u.useCallback)((e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}w=${t}&q=${n}`,[]),P=(0,u.useCallback)(e=>i.co(e,{config:g,standalone:_,resourceType:`stockImages`,intent:`display`}),[g,_]),{getDisplaySrc:F,handleLoad:L,handleError:B}=R({items:s,getItemId:(0,u.useCallback)(e=>e.id,[]),getRequestUrl:(0,u.useCallback)(e=>N(e.urls.raw,644,96),[N]),createController:P}),V=e=>t=>{L(e),t.target.parentNode.classList.add(`loaded`)},ee=e=>()=>{B(e)},te=(t,n,r)=>{w(n.download_location),M(r),setTimeout(()=>M(null),2e3),m(`${t.raw}&w=1200&q=96`),e(`${t.raw}&w=1200&q=96`),h(`${t.raw}&w=1200&q=96`)};return(0,p.jsxs)(`div`,{className:`stock-tab`,children:[(0,p.jsxs)(o.Ft,{onValuesChange:A,className:s.length>0?`serach-results`:``,children:[(0,p.jsxs)(o.Ot,{gutter:24,children:[(0,p.jsx)(o.Dt,{span:s.length>0?``:24,children:(0,p.jsx)(o.Ft.Item,{className:`stock-search-input`,children:(0,p.jsx)(o.St,{onSearch:A,allowClear:!0,size:s.length>0?`medium`:`large`,placeholder:S(`Search image`),value:l.keywords,onChange:e=>d(t=>({...t,keywords:e.target.value})),ref:f,spellCheck:`false`,enterButton:!1})})}),s.length>0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.Dt,{children:(0,p.jsxs)(o._t.Group,{defaultValue:``,onChange:e=>d(t=>({...t,orientation:e.target.value})),children:[(0,p.jsx)(o.U,{title:S(`All`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:``,children:(0,p.jsx)(c.p,{icon:`MixedView`})})}),(0,p.jsx)(o.U,{title:S(`Landscape`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:`landscape`,children:(0,p.jsx)(c.p,{icon:`LandscapeView`})})}),(0,p.jsx)(o.U,{title:S(`Portrait`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:`portrait`,children:(0,p.jsx)(c.p,{icon:`PortraitView`})})}),(0,p.jsx)(o.U,{title:S(`Squarish`),placement:`top`,children:(0,p.jsx)(o._t.Button,{value:`squarish`,children:(0,p.jsx)(c.p,{icon:`SquareView`})})})]})}),(0,p.jsx)(o.Dt,{children:(0,p.jsx)(o.A,{defaultValue:``,onChange:e=>d(t=>({...t,color:e.target.value})),options:[{value:``,colorClass:`all-colors`,label:S(`All`)},{value:`black`,colorClass:`black-color`,label:S(`Black`)},{value:`black_and_white`,colorClass:`bw-color`,label:S(`Black and White`)},{value:`white`,colorClass:`white-color`,label:S(`White`)},{value:`orange`,colorClass:`orange-color`,label:S(`Orange`)},{value:`red`,colorClass:`red-color`,label:S(`Red`)},{value:`purple`,colorClass:`purple-color`,label:S(`Purple`)},{value:`magenta`,colorClass:`magenta-color`,label:S(`Magenta`)},{value:`green`,colorClass:`green-color`,label:S(`Green`)},{value:`teal`,colorClass:`teal-color`,label:S(`Teal`)},{value:`blue`,colorClass:`blue-color`,label:S(`Blue`)}],tooltipPlacement:`top`})})]})]}),s.length>0&&(0,p.jsx)(`div`,{className:`blocks-search__divider-wrapper`,children:(0,p.jsx)(`div`,{className:`ant-divider ant-divider-horizontal`,role:`separator`})})]}),(0,p.jsx)(`div`,{className:`serach-output-wrapper`,style:{marginRight:-10},children:s.length>0&&(0,p.jsx)(`div`,{id:`scrollableDiv`,style:{width:`100%`,height:`calc(84vh - 148px)`,overflow:`auto`,paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:`0`,boxSizing:`unset`},children:(0,p.jsx)(D,{dataLength:s&&s.length,next:k,hasMore:s,endMessage:(0,p.jsxs)(o.jt,{plain:!0,children:[S("That`s all we could find."),` 🤐`]}),scrollableTarget:`scrollableDiv`,style:{overflow:`visible`},loader:null,children:(0,p.jsx)(I,{breakpointCols:{default:3},className:`my-masonry-grid`,columnClassName:`my-masonry-grid_column`,children:s.map(e=>(0,p.jsxs)(`div`,{className:`list-item`,onClick:()=>te(e.urls,e.links,e.id),children:[(0,p.jsx)(`img`,{className:j===e.id?`loaded-image`:``,width:`322px`,src:F(e),alt:e.description,onLoad:V(e),onError:ee(e)}),(0,p.jsxs)(`p`,{className:`creator-info`,onClick:e=>e.stopPropagation(),children:[`Photo by`,` `,(0,p.jsx)(`a`,{target:`_blank`,href:`${e.user.links.html}?utm_source=${z}&utm_medium=referral`,rel:`noreferrer`,children:e.user.name}),` `,`on`,` `,(0,p.jsx)(`a`,{target:`_blank`,href:`https://unsplash.com/?utm_source=${z}&utm_medium=referral`,rel:`noreferrer`,children:`Unsplash`})]}),j===e.id&&(0,p.jsx)(o.K,{className:`ant-spin`,size:`small`})]},e.id))})})})})]})},V=({images:e,transitionDuration:t=1e3})=>{let[n,r]=(0,u.useState)([]);return(0,u.useEffect)(()=>{if(e.length>0){let t=e[e.length-1];r(e=>[...e,{src:t,opacity:0}]),setTimeout(()=>{r(e=>e.map((t,n)=>n===e.length-1?{...t,opacity:1}:t))},1e3)}},[e]),(0,p.jsx)(`div`,{className:`slideshow-container`,children:n.map((e,n)=>(0,p.jsx)(`img`,{src:`data:image/jpeg;base64, ${e.src}`,alt:`Slide ${n+1}`,className:`slideshow-image`,style:{opacity:e.opacity,transition:`opacity ${t}ms linear`}},n))})};function ee({setModalHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:r,setIsImageUploaded:s,aiImageRequest:l,imageAiList:d,setImageAiList:p,isLoadingAi:m,setIsLoadingAi:h,onPluginAiImageLimitExceeded:g,onImageGenerateLimitExceeded:_}){let{__:v}=o.h(),y=i.pn(),b=o.o(),x=i._t(),{emailId:S,blockId:C,projectId:w}=(0,f.useParams)(),[T]=a.C(),[E,{data:D=[]}]=a.v(),[O]=a.g(),k=y?.sendAIImageRequest||T,A=y?.trigger||E,j=y?.handleLimitUsageEmitter||i.J(i.ko.ON_LIMIT_ID),[M,N]=(0,u.useState)(0),[P,F]=(0,u.useState)(null),[I,L]=(0,u.useState)(!1),[R,z]=(0,u.useState)(v(`Evaluating the task`)),[B,V]=(0,u.useState)(!1),ee=S||C,{limits:te}=y?.limits?y:{limits:{ai_img_limit:0}},{ai_img_limit:H}=te,U=H>0&&M>=H,W=!!(y.limits&&y.counters)&&i.ja.isPlugin,G=(0,u.useCallback)(()=>{j.fire({name:`AiImgCount`,count:M+1})},[j,M]),K=(0,u.useMemo)(()=>!U&&(!W||H===0||M<H),[U,W,M,H]),ne=(0,u.useCallback)(async()=>{z(v(`Evaluating the task`)),l!==``&&!m&&(h(!0),V(!0),p([]),x({event:`submit_form`,action:`ai_image_generation`,entity_id:S,project_id:w}),k({body:{project_id:w,request:`create-image`,connection:`midjourney`,message:l}}).then(({data:e,error:t})=>{if(t)throw t;if(e.data.status===401)throw Error(i.ha);e?.data.status===200?(e?.data.task.id&&(z(e.data.task.message),F(e.data.task.id)),e.message&&b.success({id:`AI_IMAGE_SEND_SUCCESS`,title:e.message,placement:`bottomRight`,data:l}),A({task_id:e?.data.task.id,entity_id:ee})):(h(!1),V(!1),b.error({id:`AI_IMAGE_SEND_ERROR`,title:e?.message||v(`Something went wrong, please try again`),placement:`bottomRight`,data:l,innerException:e}))}).catch(e=>{h(!1),V(!1),(e?.error||e?.data)&&b.fromError(`AI_IMAGE_SEND_ERROR`,l,e.error||e)}))},[l,m,h,V,p,x,S,w,k,b,A,ee,v]),re=(0,u.useCallback)(async()=>{if(K){if(!W){let e=c.c(`image_generate`,(await O(`image_generate`)).data?.stats);if(e){_?.(e);return}}W&&(N(e=>e+1),G()),ne()}else W&&(g?g():b.error({title:v(`The usage limit has been exceeded`),description:v(`The maximum number of requests for the current subscription period has been reached.
4
+ Select the appropriate plan to fulfil more requests`),placement:`bottomRight`}))},[K,W,O,_,N,G,ne,b,v,g]);(0,u.useEffect)(()=>{W&&N(y?.counters?.ai_img_counter||0)},[y,W]);let ie=(0,u.useCallback)(e=>{if(!r){s(!0);let n=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!n)return;let r=n[1],i=n[2],a=atob(i),o=Array(a.length);for(let e=0;e<a.length;e++)o[e]=a.charCodeAt(e);let c=new Uint8Array(o),l=new Blob([c],{type:`image/${r}`});t({file:new File([l],`image.jpeg`,{type:l.type})})}},[r,s,t]),ae=(0,u.useCallback)(e=>{e.status!==`error`&&e.status!==`Canceled`?e.images?(z(e.status),e.progress===100&&(p(e.images),z(v(`Evaluating the task`)),F(null),V(!1))):(p([e.data]),h(!1)):(h(!1),V(!1),b.error({id:`AI_IMAGE_GET_ERROR`,title:v(`Something went wrong, please try again`),placement:`bottomRight`,data:P}))},[p,z,v,h,e,P,b,V]);return(0,u.useEffect)(()=>{D.length>1&&ae(D[D.length-1])},[D,ae]),(0,u.useEffect)(()=>{(m||d.length>0)&&setTimeout(()=>{let t=550;n.current&&(t=n.current.offsetHeight+68),e(t)},0)},[n,D,d.length,m,e]),{aiImageCounter:M,setAiImageCounter:N,currentAiImgLimits:H,isFieldsDisabled:U,canGenerateImage:K,aiImageRequest:l,imageAiList:d,setImageAiList:p,isLoadingAi:m,setIsLoadingAi:h,loadingDuringGeneration:B,setLoadingDuringGeneration:V,requestStatus:R,setRequestStatus:z,handleGenerate:re,handleLimitAiImgCount:G,convertBase64ToFile:ie,isShiftPressed:I,setIsShiftPressed:L,currentReqId:P,setCurrentReqId:F,limitsInPlugin:W}}var te=({setModalHeight:e,customRequest:t,aiTabRef:n,inputAiRef:r,isImageUploaded:s,setIsImageUploaded:d,aiImageRequest:m,setAiImageRequest:h,imageAiList:g,setImageAiList:_,isLoadingAi:v,setIsLoadingAi:y})=>{let b=(0,f.useNavigate)(),x=i.Pi(),{__:S,_n:C}=o.h(),w=i.pn(),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),{aiImageCounter:k,currentAiImgLimits:A,loadingDuringGeneration:j,requestStatus:M,handleGenerate:N,convertBase64ToFile:P,isShiftPressed:F,setIsShiftPressed:I,limitsInPlugin:L}=ee({setModalHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:s,setIsImageUploaded:d,aiImageRequest:m,imageAiList:g,setImageAiList:_,isLoadingAi:v,setIsLoadingAi:y,onPluginAiImageLimitExceeded:()=>E(!0),onImageGenerateLimitExceeded:O}),R=T&&A>0?l.p(A):null,z=R?c.l(R.presetId):null,B=D?c.l(D.presetId):null,[te,H]=(0,u.useState)(!1),U=(0,u.useCallback)(()=>H(!0),[]),W=(0,u.useCallback)(()=>H(!1),[]),G=(0,u.useCallback)(e=>h(e.target.value),[h]),K=(0,u.useCallback)(e=>{e.key===`Shift`?I(!0):e.key===`Enter`&&!F&&(e.preventDefault(),N())},[F,N,I]),ne=(0,u.useCallback)(e=>{e.key===`Shift`&&I(!1)},[I]),re=g[g.length-1];return(0,p.jsxs)(`div`,{className:`image-ai`,children:[z&&R?(0,p.jsx)(c.d,{open:!0,onClose:()=>E(!1),title:S(z.titleKey),subtitle:S(z.subtitleKey),usageResource:z.usageResource,previousDisplay:c.u(R.previousLimit),nextDisplay:c.u(R.nextLimit),onChangePlan:()=>{E(!1),document.body.classList.remove(`editor`),b(`/billing`),x(a.r(i.Ea.SWITCH_TO_PLAN_MODAL))}}):null,B&&D?(0,p.jsx)(c.d,{open:!0,onClose:()=>O(null),title:S(B.titleKey),subtitle:S(B.subtitleKey),usageResource:B.usageResource,previousDisplay:c.u(D.previousLimit),nextDisplay:c.u(D.nextLimit),onChangePlan:()=>{O(null),document.body.classList.remove(`editor`),b(`/billing`),x(a.r(i.Ea.SWITCH_TO_PLAN_MODAL))}}):null,L&&(0,p.jsx)(o.P,{text:`${k} ${S(`of`)} ${A>0?A:`∞`} images ${C(`was used`,`were used`,k)}`,exceeded:A>0&&k>=A,style:{marginTop:-25},extra:(0,p.jsx)(`span`,{style:{textDecoration:`underline`,cursor:`pointer`},onClick:()=>b(w.billingPageUrl||i.Ji.billing),children:S(`Need more?`)})}),(0,p.jsx)(o.Ot,{gutter:24,className:`image-ai__row`,children:(0,p.jsx)(o.Dt,{span:24,children:(0,p.jsx)(o.Ft.Item,{style:{margin:0},children:(0,p.jsxs)(`span`,{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${te?` ant-input-affix-wrapper-focused`:``}`,children:[(0,p.jsx)(o.xt,{ref:r,onKeyDown:K,onKeyUp:ne,onFocus:U,onBlur:W,autoSize:!0,allowClear:!0,className:`text-area-input-hybrid image-ai__textarea`,placeholder:S(`Generate image`),value:m,onChange:G,spellCheck:`false`}),(0,p.jsx)(`span`,{className:`ant-input-suffix image-ai__input-suffix`,children:v||j?(0,p.jsx)(c.p,{icon:`LoadingOutlined`,className:`input-icon image-ai__input-icon`,spin:!0}):(0,p.jsx)(c.p,{icon:`AI`,className:`input-icon image-ai__input-icon`,onClick:N})})]})})})}),(v||g.length>0)&&(0,p.jsxs)(`div`,{className:`image-ai__preview`,children:[v&&g.length===0&&(0,p.jsx)(`div`,{className:`image-ai__loading`,children:(0,p.jsxs)(`div`,{className:`spin`,children:[(0,p.jsx)(c.p,{icon:`LoadingOutlined`,style:{fontSize:48},spin:!0}),(0,p.jsx)(`p`,{className:`status`,children:M})]})}),g.length>0&&(0,p.jsxs)(`div`,{className:`image-ai__image-item`,children:[(0,p.jsx)(V,{images:g}),(0,p.jsx)(`div`,{className:`buttons`,children:(0,p.jsx)(o.Rt,{onClick:()=>P(`data:image/jpeg;base64, ${re}`),icon:(0,p.jsx)(c.p,{icon:`CheckOutlined`}),children:S(`Use this one`)})})]})]})]})},H=({setNewLink:e,setCurrentImageLink:t,setModalHeight:n,setModalWidth:r,setImageGifList:s,imageGifList:c,currentReqGif:l,setCurrentReqGif:d,inputRef:f,setStockLink:m,customRequest:h})=>{let{__:g}=o.h(),_=i.pn(),v=i.at(),y=o.o(),[b,x]=(0,u.useState)(null),[S,C]=(0,u.useState)(!1),[w,T]=(0,u.useState)(25),[E]=a.b(),O=(0,u.useCallback)(e=>e instanceof Error||typeof e?.message==`string`&&e.message?e.message:typeof e?.error?.message==`string`&&e.error.message?e.error.message:g(`Failed to load GIFs through the configured proxy chain.`),[g]),k=(0,u.useCallback)(e=>{y.error({id:`STOCK_GIFS_SEARCH_FAILED`,title:g(`Failed to load GIFs`),description:O(e)})},[g,O,y]),A=async()=>{S||(C(!0),E({query:l,page:w}).then(e=>{if(e?.error){k(e.error),C(!1);return}s(t=>[...t,...e.data.data]),C(!1),T(e=>e+25)}).catch(()=>{C(!1)}))},j=async()=>{let e=await E({query:l,page:0});if(e?.error){k(e.error),s([]);return}e?.data?.data?.length>0&&(s(e.data.data),setTimeout(()=>{n(`84vh`),r(1060)},0))},M=(e,n)=>{x(n),setTimeout(()=>{x(null)},2e3),m(`${e}`),t(`${e}`),h(`${e}`)},N={default:3},P=(0,u.useCallback)(e=>i.co(e,{config:_,standalone:v,resourceType:`generic`,intent:`display`}),[_,v]),{getDisplaySrc:F,handleLoad:L,handleError:z}=R({items:c,getItemId:(0,u.useCallback)(e=>e.id,[]),getRequestUrl:(0,u.useCallback)(e=>e.images.downsized.url,[]),createController:P}),B=e=>t=>{L(e),t.target.parentNode.classList.add(`loaded`)},V=e=>()=>{z(e)};return(0,p.jsxs)(`div`,{className:`stock-tab`,children:[(0,p.jsxs)(o.Ft,{onValuesChange:j,className:c.length>0?`serach-results`:``,children:[(0,p.jsx)(o.Ot,{gutter:24,children:(0,p.jsx)(o.Dt,{span:c.length>0?``:24,children:(0,p.jsx)(o.Ft.Item,{className:`stock-search-input`,children:(0,p.jsx)(o.St,{onSearch:j,allowClear:!0,size:c.length>0?`medium`:`large`,placeholder:g(`Search GIFs`),value:l.keywords,onChange:e=>d(t=>({...t,keywords:e.target.value})),ref:f,spellCheck:`false`,enterButton:!1})})})}),c.length>0&&(0,p.jsx)(`div`,{className:`blocks-search__divider-wrapper`,children:(0,p.jsx)(`div`,{className:`ant-divider ant-divider-horizontal`,role:`separator`})})]}),(0,p.jsx)(`div`,{className:`serach-output-wrapper`,style:{marginRight:-10},children:c.length>0&&(0,p.jsx)(`div`,{id:`scrollableDiv`,style:{width:`100%`,height:`calc(84vh - 148px)`,overflow:`auto`,paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:`0`,boxSizing:`unset`},children:(0,p.jsx)(D,{dataLength:c&&c.length,next:A,hasMore:c,endMessage:(0,p.jsxs)(o.jt,{plain:!0,children:[g("That`s all we could find."),` 🤐`]}),scrollableTarget:`scrollableDiv`,style:{overflow:`visible`},loader:(0,p.jsx)(o.K,{size:`small`}),children:(0,p.jsx)(I,{breakpointCols:N,className:`my-masonry-grid`,columnClassName:`my-masonry-grid_column`,children:c.map((e,t)=>(0,p.jsxs)(`div`,{className:`list-item`,onClick:()=>M(e.images.downsized.url,e.id),children:[(0,p.jsx)(`img`,{className:b===e.id?`loaded-image`:``,width:`322px`,src:F(e),alt:e.title,onLoad:B(e),onError:V(e)}),(0,p.jsx)(`a`,{rel:`noreferrer`,href:`https://giphy.com/`,target:`_blank`,onClick:e=>e.stopPropagation(),children:(0,p.jsx)(`div`,{className:`overlay-image`,style:{backgroundImage:`url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=)`}})}),b===e.id&&(0,p.jsx)(o.K,{className:`ant-spin`,size:`small`})]},e.id+t))})})})})]})};function U(e){if(!(e==null||e===``))return e}async function W(e,t){if(e){if(e.url)return e.url;if(typeof t.getFileById==`function`&&e.id){let n=await t.getFileById(e.id);if(n?.url)return n.url;if(n?.thumbnailUrl)return n.thumbnailUrl;if(n?.thumbnail)return n.thumbnail}if(typeof t.getFileUrl==`function`&&e.folderId!==void 0&&e.name){let n=await t.getFileUrl(e.folderId||``,e.name);if(n)return n}if(typeof t.getUrl==`function`&&e.name){let n=await t.getUrl(e);if(n)return n}return e.thumbnail||e.thumbnailUrl}}function G(e){if(!(!e?.success||!Array.isArray(e.detailed)))return e.detailed.find(e=>e?.success&&e.data)?.data}function K(e,t,n){if(e)return{id:e.id,name:e.name||t.name,size:e.size??t.size,type:e.type||t.type,folderId:e.folderId??n??``,url:e.url,thumbnail:e.thumbnail,thumbnailUrl:e.thumbnailUrl,date:e.date,dimensions:e.dimensions,aspectRatio:e.aspectRatio,extension:e.extension,selected:e.selected,isFolder:e.isFolder,lastEdited:e.lastEdited,childrenCount:e.childrenCount}}async function ne(e,t,n){if(!t)return;let r=U(n??t.rootId),i;typeof t.uploadFiles==`function`?i=G(await t.uploadFiles({folderId:r,items:[{name:e.name,size:e.size,type:e.type,folderId:r,data:e}]})):typeof t.uploadFile==`function`&&(i=K(await t.uploadFile({name:e.name,size:e.size,type:e.type,folderId:r,data:e}),e,r));let a=await W(i,t);return a?{item:i,url:a}:void 0}var re=`IMG`,ie=`BACKGROUND`,ae=`GALLERY`,oe=`EDITOR`,q=`UPLOAD`,se=`STOCK`,ce=`GIF`,le=`AI`,{Dragger:ue}=o.gt,de=(e,t=`image`)=>{try{let n=new URL(e).pathname.split(`/`).pop();return n&&decodeURIComponent(n)||t}catch{return t}},fe=l.f,pe=(e,t)=>{let n=fe(t);return!n||e.includes(`.`)?e:`${e}.${n}`},me=(e,t)=>new File([e],pe(de(t),e.type),{type:e.type||`application/octet-stream`}),he=({dataProvider:e})=>{let t=i.pn(),n=i.at(),{__:r}=o.h(),s=i.Pi(),{projectId:d}=(0,f.useParams)(),[m]=a.y(),{modal:h}=o.Wt.useApp(),g=o.o(),_=i.Ni(i.r),v=i.Ni(i.n),b=i.Ni(a.s),{request:x,resolveImagePicker:S}=c.n(),[C,w]=(0,u.useState)(``),[T,E]=(0,u.useState)(``),[D,O]=(0,u.useState)(``),[k,A]=(0,u.useState)(``),[j,M]=(0,u.useState)(q),[N,P]=(0,u.useState)({width:``,height:``,size:``,format:``}),[F,I]=(0,u.useState)(`success`),[L,R]=(0,u.useState)(!1),z=u.default.useRef(null),V=u.default.useRef(null),ee=u.default.useRef(null),U=u.default.useRef(null),W=u.default.useRef(null),G=u.default.useRef(null),K=u.default.useRef(null),de=u.default.useRef(null),pe=u.default.useRef(null),[he,J]=(0,u.useState)(`auto`),[ge,Y]=(0,u.useState)(572),[_e,ve]=(0,u.useState)(!1),[ye,be]=(0,u.useState)({keywords:``,color:``,orientation:``}),[xe,Se]=(0,u.useState)({keywords:``}),[Ce,we]=(0,u.useState)([]),[Te,Ee]=(0,u.useState)([]),[De,Oe]=(0,u.useState)([]),[ke,Ae]=(0,u.useState)(!1),[je,Me]=(0,u.useState)(``),[Ne,Pe]=(0,u.useState)(!1),[Fe,Ie]=(0,u.useState)(0),Le=i.Ni(i.Mt),Re=Le?.id===void 0?d||``:String(Le.id),ze=i.J(i.ko.UPLOAD_EVENT_ID),Be=u.default.useRef(l.u()),Ve=u.default.useRef(``),He=u.default.useRef(0),X=u.default.useRef(``),[Ue,We]=(0,u.useState)(``),[Ge,Ke]=(0,u.useState)(``),Z=(0,u.useCallback)(()=>{X.current&&=(URL.revokeObjectURL(X.current),``),We(``)},[]),Q=(0,u.useCallback)(()=>{Ke(``)},[]),$=!(_||v.id?.toString()!==Le?.members?.owner.ID),qe=e=>{E(e.target.value)},Je=(0,u.useCallback)((e,t,n=r(`The image could not be uploaded.`))=>{let i=t instanceof Error?t.message:n;g.error({id:`IMAGE_UPLOAD_ERROR`,data:e,title:r(`Upload failed`),description:i})},[r,g]),Ye=(0,u.useCallback)(async e=>c.a(await ze.fire({file:e,project:Re})),[Re,ze]),Xe=l.t(),Ze=async e=>{if(e)try{let t=await $e(e);t&&it(t)?await at({file:t}):t||Je({url:e},null,r(`Failed to download image from URL.`))}catch(t){Je({url:e},t,r(`Failed to process image URL.`))}},Qe=u.default.useRef(Ze);Qe.current=Ze,u.default.useEffect(()=>{if(j!==q||!k)return;let e=T.trim();if(!e||!e.toLowerCase().startsWith(`http`))return;let t=setTimeout(()=>{Qe.current(e)},1e3);return()=>{clearTimeout(t)}},[T,j,k]);let $e=async e=>{try{let t=l.l(e);return me(await Be.current.resolve(t,void 0,Xe),t)}catch{}};document.onpaste=function(e){let n=e.clipboardData?.items?.[0];if(j===q&&k){if(n?.type?.indexOf(`image`)===0&&t.imageCenterLocalUploadEnabled!==!1){let e=n.getAsFile();it(e);let t={file:e};E(``),at(t);return}let r=e.clipboardData?.getData(`text/plain`);if(r&&r.trim().toLowerCase().startsWith(`http`)){e.preventDefault(),e.stopPropagation(),E(r.trim());return}n?.type?.indexOf(`text`)===0&&n.getAsString(e=>{if(e.trim().toLowerCase().startsWith(`http`))E(e.trim());else if(e.toString().slice(1,5)===`meta`){let t=e.toString().split(`"`)[1];t&&E(t)}})}},(0,u.useEffect)(()=>{let e=e=>{let t=null;x?.kind===`background`?(t=ie,A(ie)):x?.kind===`img`&&(A(re),t=re),x?.currentUrl&&t&&(w(x.currentUrl),M(e))};b===i.Ea.UPLOAD_IMAGE_MODAL||b===i.Ea.UPLOAD_BACKGROUND_MODAL?e(oe):b===i.Ea.UPLOAD_IMAGE_MODAL_AI||b===i.Ea.UPLOAD_BACKGROUND_MODAL_AI?($?(Pe(!0),Ie(2)):e(le),setTimeout(()=>pe.current?.focus({cursor:`start`}),100)):b===i.Ea.UPLOAD_IMAGE_MODAL_UPLOAD||b===i.Ea.UPLOAD_BACKGROUND_MODAL_UPLOAD?(e(q),setTimeout(()=>G.current?.focus({cursor:`start`}),100)):b===i.Ea.UPLOAD_IMAGE_MODAL_STOCK||b===i.Ea.UPLOAD_BACKGROUND_MODAL_STOCK?($?(Pe(!0),Ie(3)):e(se),setTimeout(()=>de.current?.focus({cursor:`start`}),100)):b===i.Ea.UPLOAD_IMAGE_MODAL_GIF||b===i.Ea.UPLOAD_BACKGROUND_MODAL_GIF?($?(Pe(!0),Ie(3)):e(ce),setTimeout(()=>K.current?.focus({cursor:`start`}),100)):b===i.Ea.UPLOAD_IMAGE_MODAL_EDIT||b===i.Ea.UPLOAD_BACKGROUND_MODAL_EDIT?($?(Pe(!0),Ie(5)):e(oe),s(a.i(i.Ea.IMAGE_EDITOR_MODAL))):A(``)},[b,s,$,x]);let et=(0,u.useCallback)(({url:e=C||``})=>{w(e),S({url:e,meta:{mode:`select`}}),setTimeout(()=>{Q(),Z(),be({keywords:``,color:``,orientation:``}),Se({keywords:``}),Ee([]),we([]),A(``),Me(``),Ae(!1),O(``),E(``),M(q)},200),s(a.t()),s(a.n())},[C,Q,s,S,Z]),tt=(0,u.useCallback)((e,t)=>(J(`auto`),R(!1),et({url:e}),g.success({id:`IMAGE_UPLOAD_SUCCESS`,data:t,title:r(`The image was successfully uploaded.`)}),e),[r,et,g]);(0,u.useEffect)(()=>{let t=T||D,r=l.l(t);if(!t||!r){I(``),Ve.current=``,Q(),Z(),Be.current.invalidateAll();return}let i=Ve.current;i&&i!==r&&(Be.current.abandonKey(i),Q(),Z()),Ve.current=r;let a=new AbortController,o=T?800:0,s=++He.current,c=setTimeout(async()=>{try{let i=async()=>{let e=await Be.current.resolve(r,a.signal,Xe);if(s!==He.current)return;let{width:t,height:n}=await l.d(e);if(s!==He.current)return;P({width:t,height:n,size:(e.size/1024).toFixed(2),format:fe(e.type)}),Q(),X.current&&URL.revokeObjectURL(X.current);let i=URL.createObjectURL(e);X.current=i,We(i)};if(n)await i();else{let t=await l.n(e,r);if(t?.previewUrl&&s===He.current){Ke(t.previewUrl),Z();try{let{data:e}=await m(r);if(s!==He.current)return;e?P({width:e?.width,height:e?.height,size:e?.fileSize==null?``:(e.fileSize/1024).toFixed(2),format:fe(e?.format)}):await i()}catch{await i()}}else await i()}if(s!==He.current)return;I(`success`),w(t),Y(572),setTimeout(()=>{let e=0;V.current&&(e=V.current.offsetHeight+62),J(e)},0)}catch(e){if(e?.name===`AbortError`||a.signal.aborted||s!==He.current)return;Q(),Z(),I(`error`)}},o);return()=>{clearTimeout(c),a.abort()}},[T,D,n,Q,Xe,m,Z,e]),(0,u.useEffect)(()=>{if(!C||T||D)return;let t=l.l(C),r=new AbortController,i=!1,a=async()=>{let e=await Be.current.resolve(t,r.signal,Xe);if(i)return;let{width:n,height:a}=await l.d(e);if(i)return;Q(),X.current&&URL.revokeObjectURL(X.current);let o=URL.createObjectURL(e);X.current=o,We(o),P({width:n,height:a,size:(e.size/1024).toFixed(2),format:fe(e.type)})};return(async()=>{try{if(!n){let n=await l.n(e,t);if(n?.previewUrl&&!i){Ke(n.previewUrl),Z();try{let{data:e}=await m(t);if(i)return;e?P({width:e?.width,height:e?.height,size:e?.fileSize==null?``:(e.fileSize/1024).toFixed(2),format:fe(e?.format)}):await a();return}catch{await a()}}}await a()}catch{i||Q()}})(),()=>{i=!0,r.abort()}},[n,Q,C,Xe,m,e,T,D]);let nt=()=>{s(a.t()),setTimeout(()=>{Q(),Z(),w(``),E(``),Ee([]),Ee([]),be({keywords:``,color:``,orientation:``}),Se({keywords:``}),J(`auto`),!ke&&Me(``),Y(572),M(q)},200)},rt=e=>{e===ae?h.success({mask:{closable:!0},centered:!0,title:r(`Coming soon`),content:r(`The feature is under development.`),okText:r(`Ok. I'll be waiting`),onOk:()=>{}}):e===oe&&C===``?h.warning({mask:{closable:!0},centered:!0,title:r(``),content:r(`To preview and edit the uploaded image`),okText:r(`Upload Image`),onOk:()=>{M(q)}}):(setTimeout(()=>{let t=0,n=0;e===q&&z.current?(ye.keywords===``&&G.current?.focus({cursor:`start`}),t=300,n=572):e===oe&&V.current?(t=V.current.offsetHeight+62,n=572):e===se&&ee.current?(ye.keywords===``&&de.current?.focus({cursor:`start`}),t=130,n=572,Te.length>0&&(n=1060,t=`84vh`)):e===ce&&U.current?(ye.keywords===``&&K.current?.focus({cursor:`start`}),t=130,n=572,Ce.length>0&&(n=1060,t=`84vh`)):e===le&&W.current&&(je===``&&De.length===0?(pe.current?.focus({cursor:`start`}),t=130):t=W.current.offsetHeight+82,n=572),J(t),Y(n)},0),M(e))};(0,u.useEffect)(()=>{ye.keywords===``&&(G?.current?.focus({cursor:`start`}),Ee([]),setTimeout(()=>{J(`auto`),Y(572)},0))},[ye,Ee,J,Y]);let it=e=>{let t=e.type===`image/jpeg`||e.type===`image/png`||e.type===`image/jpg`||e.type===`image/webp`||e.type===`image/gif`||e.type===`image/svg+xml`;return t||g.error({id:`IMAGE_UPLOAD_WRONG_FORMAT`,data:e,title:`Upload`,description:`You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!`}),t},at=async({file:n})=>{try{ve(!0);let r=await l.i(n,t),i=await Ye(r);if(i)return tt(i,r),i;let a=await ne(r,e);if(a?.url)return tt(a.url,r),a.url;Je(r,null);return}catch(e){Je(n,e);return}finally{ve(!1)}},ot=e=>at({file:e}),st=[{label:r(`Upload`),key:q,children:(0,p.jsxs)(`div`,{ref:z,style:{paddingBottom:24},children:[t.imageCenterLocalUploadEnabled!==!1&&(0,p.jsxs)(ue,{showUploadList:!1,name:`Image`,beforeUpload:it,customRequest:at,style:{marginBottom:10},multiple:!1,accept:`image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml`,children:[(0,p.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,p.jsx)(c.p,{icon:`InboxOutlined`})}),(0,p.jsx)(`p`,{className:`ant-upload-text`,children:r(`Click to select, paste from the clipboard, or drag and drop`)}),(0,p.jsx)(`p`,{className:`ant-upload-hint`,children:r(`Accepted formats: PNG, JPG, WEBP, SVG or GIF.`)})]}),(0,p.jsx)(o.Ft,{style:{padding:`0 2px 0 2px`},children:(0,p.jsx)(o.Ft.Item,{validateStatus:F,children:(0,p.jsx)(o.kt,{ref:G,allowClear:!0,size:`large`,placeholder:r(`Paste image URL here`),value:T,onChange:qe,spellCheck:`false`})})})]})}];return t.imageCenterStockEnabled&&!$&&st.push({label:r(`Stock`),key:se,children:(0,p.jsx)(`div`,{ref:ee,style:{paddingBottom:24},children:(0,p.jsx)(B,{currentReq:ye,setCurrentReq:be,imageStockList:Te,setImageStockList:Ee,setModalWidth:Y,setModalHeight:J,setStockLink:O,setCurrentImageLink:w,inputRef:de,customRequest:Ze})})}),t.imageCenterGifEnabled&&!$&&st.push({label:r(`GIF`),key:ce,children:(0,p.jsx)(`div`,{ref:U,style:{paddingBottom:24},children:(0,p.jsx)(H,{currentReqGif:xe,setCurrentReqGif:Se,imageGifList:Ce,setImageGifList:we,setModalWidth:Y,setModalHeight:J,setStockLink:O,setCurrentImageLink:w,inputRef:K,customRequest:Ze})})}),t.elementAIimageEnabled&&!$&&st.push({label:r(`AI`),key:le,children:(0,p.jsx)(`div`,{ref:W,style:{paddingBottom:24},children:(0,p.jsx)(te,{setModalHeight:J,customRequest:at,aiImageRequest:je,setAiImageRequest:Me,imageAiList:De,setImageAiList:Oe,isLoadingAi:ke,setIsLoadingAi:Ae,aiTabRef:W,inputAiRef:pe,isImageUploaded:L,setIsImageUploaded:R})})}),t.imageCenterEditorEnabled&&st.push({label:``,key:oe,children:(0,p.jsx)(`div`,{ref:V,children:(0,p.jsx)(y,{currentImageLink:C,newLink:T,previewDisplayUrl:Ge,resolvedPreviewObjectUrl:Ue,imageSize:N,onSave:ot,uploadImageResultIsLoading:_e||!1})})}),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.Y,{width:ge,className:`image-center`,title:r(`Image Center`),style:{minHeight:390},open:!!k,onOk:et,onCancel:nt,footer:j===oe?(0,p.jsx)(p.Fragment,{}):null,children:(0,p.jsx)(o.K,{spinning:_e,children:(0,p.jsx)(o.Z,{activeKey:j,onChange:rt,items:st,className:`modal-tabs`,style:{height:he,minHeight:130}})})}),(0,p.jsx)(c.h,{open:Ne,onCancel:()=>Pe(!1),initialSlide:Fe})]})};he.propTypes={dataProvider:d.default.object},t.default=he});