OwlCyberSecurity - MANAGER
Edit File: 7.js
<<<<<<< HEAD <<<<<<< HEAD "use strict";(self.webpackChunkast_block_templates=self.webpackChunkast_block_templates||[]).push([[7],{5007:function(e,t,s){s.r(t),s.d(t,{default:function(){return z}});var o=s(6048),a=s(5868),r=s(4142),l=s(9148),n=s(6128),c=s(1569),i=s(5622),p=s(7363),m=p.forwardRef((function({title:e,titleId:t,...s},o){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:o,"aria-labelledby":t},s),e?p.createElement("title",{id:t},e):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}));const{compose:u}=wp.compose,{useSelect:d,withSelect:g,withDispatch:f}=wp.data,{post:b}=wp.ajax,{parse:y}=wp.blocks,{useState:h,memo:k}=wp.element;var v=u(g((e=>{const{getImportItemInfo:t,getCurrentScreen:s,getSitePreview:o,getActivePaletteSlug:a}=e("ast-block-templates");return{importItemInfo:t(),sitePreview:o(),currentScreen:s(),activePaletteSlug:a()}})),f((e=>{const{setImportItemInfo:t,setFullWidthBlockPreview:s,setCurrentScreen:o,setTogglePopup:a,setFullWidthPreview:r}=e("ast-block-templates"),{insertBlocks:l}=e("core/block-editor");return{setImportItemInfo:t,onSetTogglePopup:a,insertBlocks:l}})))(k((e=>{let{setImportItemInfo:t,liveRequest:s,requiredPlugins:o,importItemInfo:p,title:u,btnClass:g,currentScreen:f,insertBlocks:k,onSetTogglePopup:v,item:w,onClick:_,onBlockImport:I,activePaletteSlug:x}=e,[E,B]=h(p),P=o||[];const C=g||"",[S,R]=h(u||"Import"),[j,N]=h(!1),{insertIndex:F}=d((e=>{const{index:t}=e("core/block-editor").getBlockInsertionPoint();return{insertIndex:t}}),[]),$=()=>{(0,l.j)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}).then((e=>{})).catch((e=>{N(!1),R("Activation failed!")}))},A=()=>{(0,l.j)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((e=>{L()})).catch((e=>{N(!1),R("Activation failed!")}))},O=()=>{const e=E.original_content,t=E["blocks-category"][0];b({action:"ast_block_templates_import_block",content:e,category:t,_ajax_nonce:ast_block_template_vars._ajax_nonce,style:x}).done((e=>{N(!1),k(y(e),F,"",!1),v(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open"),"function"==typeof I&&I(e,F),"active"!==ast_block_template_vars.spectra_status&&(0,i.iP)()})).fail((e=>{}))},L=()=>{E?.["post-meta"]?.["astra-site-wpforms-path"]||""?b({action:"ast_block_templates_import_wpforms",id:E.id,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((e=>{O()})).fail((e=>{N(!1),R("WPForms import failed!")})):O()};return React.createElement(a.Z,{className:`min-w-[7rem] hover:shadow-small ${C}`,type:"button",variant:"primary",onClick:e=>{"function"==typeof _&&_(e),N(!0),"not-installed"===ast_block_template_vars.spectra_status?(0,l.H)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}).then((e=>{$()})).catch((e=>{N(!1),R("Installation failed!")})):"inactive"===ast_block_template_vars.spectra_status&&$(),(0,c.I)(w.ID,"astra-blocks").then((e=>{t(e),E=e,P=e?.["post-meta"]?.["astra-blocks-required-plugins"]?n.t.parse(e["post-meta"]["astra-blocks-required-plugins"]):[],P.length?"not-installed"===ast_block_template_vars.wpforms_status?(0,l.H)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((e=>{A()})).catch((e=>{N(!1),R("Installation failed!")})):"inactive"===ast_block_template_vars.wpforms_status?A():L():L()})).catch((e=>{}))},isSmall:!0,hasPrefixIcon:!j},j?React.createElement(r.Z,null):React.createElement(React.Fragment,null,React.createElement(m,{className:"h-6 w-6"}),S))}))),w=p.forwardRef((function({title:e,titleId:t,...s},o){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:o,"aria-labelledby":t},s),e?p.createElement("title",{id:t},e):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"}))})),_=s(10),I=s(6486);function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},x.apply(this,arguments)}const{useEffect:E,useState:B}=wp.element,{site_url:P}=ast_block_template_vars,{compose:C}=wp.compose,{withDispatch:S,withSelect:R,useSelect:j}=wp.data;var N=C(R((e=>{const{getFilterBlocksByCategory:t,getFilterBlocksPagesByCategory:s}=e("ast-block-templates");return{filterBlocksByCategory:t(),filterBlocksPagesByCategory:s()}})),S((e=>{const{setFavorites:t,setFilterBlocksByCategory:s,setFilterBlocksPagesByCategory:o}=e("ast-block-templates");return{setFavorites:t,setFilterBlocksByCategory:s,setFilterBlocksPagesByCategory:o}})))((e=>{let{item:t,className:s,setFavorites:a,setFilterBlocksByCategory:r,filterBlocksByCategory:l,filterBlocksPagesByCategory:n,setFilterBlocksPagesByCategory:c,...i}=e;const[p,m]=B(!1),{favorites:u}=j((e=>{const{getFavorites:t}=e("ast-block-templates");return{favorites:t()}})),d=p?{color:"red",fill:"red"}:{};return E((()=>{const e=u&&u[t.type]?Object.values(u[t.type]):[];u&&e&&e.includes((0,I.parseInt)(t.ID))&&m(!0)}),[p]),React.createElement("button",x({className:(0,o.AK)("flex items-center justify-center rounded-full p-2 bg-white cursor-pointer text-icon-secondary border-0 focus:outline-none hover:shadow-small",s),onClick:async e=>{e?.preventDefault(),e?.stopPropagation();try{await(0,_.Z)({path:`${P}/wp-json/gutenberg-templates/v1/favorite`,data:{type:t.type,block_id:t.ID,status:!p},method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce,"content-type":"application/json"}})}catch(e){console.error(e)}let s={};const o=t.type;if(p){const e=Object.keys(u[o]).find((e=>u[o][e]===(0,I.parseInt)(t.ID)));e&&delete u[o][e],s={...u}}else{const e=Object.keys(u[o]).length>0?Math.max(...Object.keys(u[o]).map(Number))+1:0;u[o][e]=(0,I.parseInt)(t.ID),s={...u}}m(!p),a(s),"block"===o?r(l):c(n)}},i),React.createElement(w,{className:"w-6 h-6",style:d}))}));const F=e=>{const t=["skip","logo","fav-icon"];for(const s of t)if(e.includes(s))return!0;return!1},{useEffect:$,useState:A,createRef:O}=wp.element,{spectra_common_styles:L}=ast_block_template_vars,{compose:D}=wp.compose,{withSelect:q}=wp.data,{memo:W}=wp.element;var z=D(q((e=>{const{getDisableAi:t,getDisablePreview:s}=e("ast-block-templates");return{disableAi:t(),disablePreview:s()}})))(W((e=>{let{item:t,content:s,stylesheet:a,astraCustomizer:r,globalStylesheet:l,colorPalette:n,dynamicContent:c,selectedImages:i,disableAi:p,email:m,phone:u,address:d}=e;const g=O(),f=O(),b=t["thumbnail-image-url"]||"",y=t["featured-image-url"]||"";let h=0,k=0;const[w,_]=A({importing:!1}),[I,x]=A(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),[E,B]=A(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`);function P(){const e=g?.current?.parentNode?.offsetWidth,t=e/1200,s=t*f?.current?.offsetHeight,o=g?.current;o&&(o.style.transform=`scale(${t})`,o.style.height=`${s}px`)}return $((()=>{let e=!0;const o={landscape:[],portrait:[]};i?.forEach((e=>{"landscape"===e.orientation?o.landscape.push(e):o.portrait.push(e)}));const g=o,v=new Image;v.src=b;const w=new Image;w.src=y;const _=f.current;function I(t,s){e&&(t.onload=()=>{s(t.src)})}I(v,x),I(w,B);const E=document.getElementById("astra-wp-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),C=document.getElementById("astra-block-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container");let S="";var R,j,N;if(a&&(R=a,j=g?.landscape,a=p||j&&0===j.length?R:R.replace(/background-image\s*:\s*url\(['"]?([^'")]+)['"]?\)/g,(function(e,t){if(F(t))return e;if(!j[h]?.url)return"";const s=j[h]?.url;return h++,'background-image: url("'+s+'")'}))),S+=r?`<style type="text/css" id="gt-astra-customizer">${r}</style>`:"",S+=`<style type="text/css" id="gt-spectra-common-stylesheet">${L}</style>`,S=a?`${S} <style type="text/css" id="gt-common-stylesheet">${a}</style>`:S,l&&(S+=`<style type="text/css" id="gt-global-stylesheet"> ${l} </style>`),E&&(S+=`<style type="text/css" id="gt-wpeditor-css" > ${E} </style>`),C&&(S+=`<style type="text/css" id="gt-blockeditor-css"> ${C} </style>`),_&&s){const e=_.attachShadow({mode:"open"});if(null===e)return;let o=s;if(!p){const e=c?c[t.category]:[];e&&Object.keys(e)?.length>0&&Object.keys(e).forEach((t=>{o=null!==e[t]?o.replace(t,e[t]):o})),N=o,m&&(N=N.replace("contact@example.com",m)),u&&(N=N.replace("202-555-0188",u)),d&&(N=N.replace("2360 Hood Avenue, San Diego, CA, 92123",d)),o=N}e.innerHTML=S+o,n.forEach(((t,s)=>{e?.host.style.setProperty(`--ast-global-color-${s}`,t)}));const a=_.shadowRoot.querySelectorAll("div")[0];a?.classList.add("st-block-container");const r=_.shadowRoot.querySelectorAll("img");e&&(P(),((e,t)=>{if(p)return;const s=t.landscape?t.landscape:[],o=t.portrait?t.portrait:[];0!==s.length&&0!==o.length&&e?.forEach((function(e){F(e.src)||(e.onload=()=>{const t=(e=>{const t=new Image;return t.src=e,t.width>t.height?"landscape":"portrait"})(e.src);let a;if(a="landscape"===t?s[h]:o[k],void 0!==a&&(a.url.includes("unsplash")||a.url.includes("pexels")||a.url.includes("pixabay")))if("landscape"===t?h++:k++,"PICTURE"===e.parentNode.nodeName)e.parentNode.querySelectorAll("source").forEach((e=>{e.setAttribute("srcset",a.optimized_url)})),e.parentNode.querySelector("img").setAttribute("src",a.optimized_url);else{const t=document.createElement("img");t.src=a.optimized_url,e.parentNode.replaceChild(t,e)}})}))})(r,g))}return()=>{e=!1}}),[t]),$((()=>(window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P)})),[]),$((()=>{const e=f?.current;if(e){const t=e.shadowRoot;n.forEach(((e,s)=>{null!==t&&t.host.style.setProperty(`--ast-global-color-${s}`,e)}))}}),[n]),React.createElement("div",{className:(0,o.AK)("w-full h-fit p-5",!0===w.importing?"importing":"")},React.createElement("div",{className:"cursor-pointer relative border border-solid border-border-primary hover:border-accent-spectra transition duration-150 ease-in-out overflow-hidden group"},React.createElement("div",{className:"thumbnail left-0 m-0 min-h-[auto] overflow-visible text-left top-0 origin-top-left relative pointer-events-none",ref:g},React.createElement("div",{className:"absolute w-[1200px] pointer-events-none max-h-[1600px] overflow-hidden",ref:f},!s&&React.createElement("img",{srcSet:`${E}, ${I}`,src:I}),React.createElement("div",{className:"preview"},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"})))),React.createElement("div",{className:"absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end"},React.createElement("div",{className:(0,o.AK)("opacity-0 group-hover:opacity-100 w-full flex items-center justify-between px-[14px] py-[20px] backdrop-blur-sm bg-white/[0.85] shadow-action-buttons transition-all duration-150 ease-in-out",!0===w.importing?"opacity-100":"")},React.createElement(v,{title:"Insert",liveRequest:!0,item:t,onClick:()=>{_({...w,importing:!0})},btnClass:"text-[14px]",onBlockImport:()=>{_({...w,importing:!1})}}),React.createElement(N,{item:t})))))})))}}]); ======= "use strict";(self.webpackChunkast_block_templates=self.webpackChunkast_block_templates||[]).push([[7],{5007:function(e,t,s){s.r(t),s.d(t,{default:function(){return A}});var o=s(7363),r=s(6048),a=s(5868),n=s(4142),l=s(9148),c=s(6128),i=s(1569),p=s(5622),m=o.forwardRef((function({title:e,titleId:t,...s},r){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},s),e?o.createElement("title",{id:t},e):null,o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}));const{compose:u}=wp.compose,{useSelect:d,withSelect:g,withDispatch:f}=wp.data,{post:b}=wp.ajax,{parse:h}=wp.blocks,{useState:y,memo:k}=wp.element;var v=u(g((e=>{const{getImportItemInfo:t,getCurrentScreen:s,getSitePreview:o,getActivePaletteSlug:r}=e("ast-block-templates");return{importItemInfo:t(),sitePreview:o(),currentScreen:s(),activePaletteSlug:r()}})),f((e=>{const{setImportItemInfo:t,setFullWidthBlockPreview:s,setCurrentScreen:o,setTogglePopup:r,setFullWidthPreview:a}=e("ast-block-templates"),{insertBlocks:n}=e("core/block-editor");return{setImportItemInfo:t,onSetTogglePopup:r,insertBlocks:n}})))(k((e=>{let{setImportItemInfo:t,liveRequest:s,requiredPlugins:o,importItemInfo:u,title:g,btnClass:f,currentScreen:k,insertBlocks:v,onSetTogglePopup:_,item:w,onClick:I,onBlockImport:E,activePaletteSlug:x}=e,[B,S]=y(u),C=o||[];const P=f||"",[R,j]=y(g||"Import"),[N,F]=y(!1),{insertIndex:$}=d((e=>{const{index:t}=e("core/block-editor").getBlockInsertionPoint();return{insertIndex:t}}),[]),A=()=>{(0,l.j)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}).then((e=>{})).catch((e=>{F(!1),j("Activation failed!")}))},O=()=>{(0,l.j)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((e=>{q()})).catch((e=>{F(!1),j("Activation failed!")}))},L=()=>{const e=B.original_content,t=B["blocks-category"][0];b({action:"ast_block_templates_import_block",content:e,category:t,_ajax_nonce:ast_block_template_vars._ajax_nonce,style:x}).done((e=>{F(!1),v(h(e),$,"",!1),_(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open"),"function"==typeof E&&E(e,$),"active"!==ast_block_template_vars.spectra_status&&(0,p.iP)()})).fail((e=>{}))},q=()=>{B?.["post-meta"]?.["astra-site-wpforms-path"]||""?b({action:"ast_block_templates_import_wpforms",id:B.id,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((e=>{L()})).fail((e=>{F(!1),j("WPForms import failed!")})):L()};return React.createElement(a.Z,{className:(0,r.AK)("min-w-[7rem] hover:shadow-small sp-text-sm",P),type:"button",variant:"primary",onClick:e=>{"function"==typeof I&&I(e),F(!0),"not-installed"===ast_block_template_vars.spectra_status?(0,l.H)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}).then((e=>{A()})).catch((e=>{F(!1),j("Installation failed!")})):"inactive"===ast_block_template_vars.spectra_status&&A(),(0,i.I)(w.ID,"astra-blocks").then((e=>{t(e),B=e,C=e?.["post-meta"]?.["astra-blocks-required-plugins"]?c.t.parse(e["post-meta"]["astra-blocks-required-plugins"]):[],C.length?"not-installed"===ast_block_template_vars.wpforms_status?(0,l.H)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((e=>{O()})).catch((e=>{F(!1),j("Installation failed!")})):"inactive"===ast_block_template_vars.wpforms_status?O():q():q()})).catch((e=>{}))},isSmall:!0,hasPrefixIcon:!N},N?React.createElement(n.Z,{className:"h-[1.3rem] w-[1.3rem] !shrink-0"}):React.createElement(React.Fragment,null,React.createElement(m,{className:"h-[1.3rem] w-[1.3rem] !shrink-0"}),R))}))),_=o.forwardRef((function({title:e,titleId:t,...s},r){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},s),e?o.createElement("title",{id:t},e):null,o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"}))})),w=s(10),I=s(6486);function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},E.apply(this,arguments)}const{useEffect:x,useState:B}=wp.element,{site_url:S}=ast_block_template_vars,{compose:C}=wp.compose,{withDispatch:P,withSelect:R,useSelect:j}=wp.data;var N=C(R((e=>{const{getFilterBlocksByCategory:t,getFilterBlocksPagesByCategory:s}=e("ast-block-templates");return{filterBlocksByCategory:t(),filterBlocksPagesByCategory:s()}})),P((e=>{const{setFavorites:t,setFilterBlocksByCategory:s,setFilterBlocksPagesByCategory:o}=e("ast-block-templates");return{setFavorites:t,setFilterBlocksByCategory:s,setFilterBlocksPagesByCategory:o}})))((e=>{let{item:t,className:s,setFavorites:o,setFilterBlocksByCategory:a,filterBlocksByCategory:n,filterBlocksPagesByCategory:l,setFilterBlocksPagesByCategory:c,...i}=e;const[p,m]=B(!1),{favorites:u}=j((e=>{const{getFavorites:t}=e("ast-block-templates");return{favorites:t()}}));return x((()=>{const e=u&&u[t.type]?Object.values(u[t.type]):[];u&&e&&e.includes((0,I.parseInt)(t.ID))&&m(!0)}),[p]),React.createElement("button",E({className:(0,r.AK)("flex items-center justify-center rounded-full p-2 bg-white cursor-pointer border-0 focus:outline-none",p?"":"text-icon-secondary",s),onClick:async e=>{e?.preventDefault(),e?.stopPropagation();try{await(0,w.Z)({path:`${S}/wp-json/gutenberg-templates/v1/favorite`,data:{type:t.type,block_id:t.ID,status:!p},method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce,"content-type":"application/json"}})}catch(e){console.error(e)}let s={};const r=t.type;if(p){const e=Object.keys(u[r]).find((e=>u[r][e]===(0,I.parseInt)(t.ID)));e&&delete u[r][e],s={...u}}else{const e=Object.keys(u[r]).length>0?Math.max(...Object.keys(u[r]).map(Number))+1:0;u[r][e]=(0,I.parseInt)(t.ID),s={...u}}m(!p),o(s),"block"===r?a(n):c(l)}},i),React.createElement(_,{className:(0,r.AK)("w-6 h-6 transition-colors ease-out duration-150",p?"fill-favorite text-favorite":"hover:fill-favorite hover:text-favorite")}))}));const F=e=>{const t=["skip","logo","fav-icon"];for(const s of t)if(e.includes(s))return!0;return!1},{spectra_common_styles:$}=ast_block_template_vars;var A=e=>{let{item:t,content:s,stylesheet:a,astraCustomizer:n,globalStylesheet:l,colorPalette:c,dynamicContent:i,selectedImages:p,email:m,phone:u,address:d}=e;const g=(0,o.useRef)(null),f=(0,o.useRef)(null),b=t["thumbnail-image-url"]||"",h=t["featured-image-url"]||"";let y=0,k=0;const[_,w]=(0,o.useState)({importing:!1}),[I,E]=(0,o.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),[x,B]=(0,o.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`);function S(){const e=g?.current,t=f?.current;if(!e||!t)return;const s=e.parentNode.offsetWidth/1200,o=s*t.offsetHeight;e.style.transform=`scale(${s})`,e.style.height=`${o}px`}return(0,o.useEffect)((()=>{let e=!0;const o={landscape:[],portrait:[]};p?.forEach((e=>{"landscape"===e.orientation?o.landscape.push(e):o.portrait.push(e)}));const r=o,g=new Image;g.src=b;const v=new Image;v.src=h;const _=f.current;function w(t,s){e&&(t.onload=()=>{s(t.src)})}w(g,E),w(v,B);const I=document.getElementById("astra-wp-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),x=document.getElementById("astra-block-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container");let C="";var P,R,j;if(a&&(P=a,R=r?.landscape,a=R&&0===R.length?P:P.replace(/background-image\s*:\s*url\(['"]?([^'")]+)['"]?\)/g,(function(e,t){if(F(t))return e;if(!R[y]?.url)return"";const s=R[y]?.url;return y++,'background-image: url("'+s+'")'}))),C+=n?`<style type="text/css" id="gt-astra-customizer">${n}</style>`:"",C+=`<style type="text/css" id="gt-spectra-common-stylesheet">${$}</style>`,C=a?`${C} <style type="text/css" id="gt-common-stylesheet">${a}</style>`:C,l&&(C+=`<style type="text/css" id="gt-global-stylesheet"> ${l} </style>`),I&&(C+=`<style type="text/css" id="gt-wpeditor-css" > ${I} </style>`),x&&(C+=`<style type="text/css" id="gt-blockeditor-css"> ${x} </style>`),_&&s){const e=_.attachShadow({mode:"open"});if(null===e)return;let o=s;const a=i?i[t.category]:[];a&&Object.keys(a)?.length>0&&Object.keys(a).forEach((e=>{o=null!==a[e]?o.replace(e,a[e]):o})),j=o,m&&(j=j.replace("contact@example.com",m)),u&&(j=j.replace("202-555-0188",u)),d&&(j=j.replace("2360 Hood Avenue, San Diego, CA, 92123",d)),o=j,e.innerHTML=C+o,c.forEach(((t,s)=>{e?.host.style.setProperty(`--ast-global-color-${s}`,t)}));const n=_.shadowRoot.querySelectorAll("div")[0];n?.classList.add("st-block-container");const l=_.shadowRoot.querySelectorAll("img");e&&(S(),((e,t)=>{const s=t.landscape?t.landscape:[],o=t.portrait?t.portrait:[];0!==s.length&&0!==o.length&&e?.forEach((function(e){F(e.src)||(e.onload=()=>{const t=(e=>{const t=new Image;return t.src=e,t.width>t.height?"landscape":"portrait"})(e.src);let r;if(r="landscape"===t?s[y]:o[k],void 0!==r&&(r.url.includes("unsplash")||r.url.includes("pexels")||r.url.includes("pixabay")))if("landscape"===t?y++:k++,"PICTURE"===e.parentNode.nodeName)e.parentNode.querySelectorAll("source").forEach((e=>{e.setAttribute("srcset",r.optimized_url)})),e.parentNode.querySelector("img").setAttribute("src",r.optimized_url);else{const t=document.createElement("img");t.src=r.optimized_url,e.parentNode.replaceChild(t,e)}})}))})(l,r))}return()=>{e=!1}}),[]),(0,o.useEffect)((()=>{const e=new ResizeObserver(S);return e.observe(document.documentElement),()=>{e&&e.disconnect()}}),[]),(0,o.useEffect)((()=>{const e=document.querySelector("#ast-block-templates-modal-wrap");if(!e)return;const t=new MutationObserver(S);return t.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{t&&t.disconnect()}}),[]),(0,o.useEffect)((()=>{const e=f?.current;if(e){const t=e.shadowRoot;c.forEach(((e,s)=>{null!==t&&t.host.style.setProperty(`--ast-global-color-${s}`,e)}))}}),[c]),React.createElement("div",{className:(0,r.AK)("w-full h-fit p-5",!0===_.importing?"importing":"")},React.createElement("div",{className:"cursor-pointer relative border border-solid border-border-primary hover:border-accent-spectra transition duration-150 ease-in-out overflow-hidden group"},React.createElement("div",{className:"thumbnail left-0 m-0 min-h-[auto] overflow-visible text-left top-0 origin-top-left relative pointer-events-none",ref:g},React.createElement("div",{className:"absolute w-[1200px] pointer-events-none max-h-[1600px] overflow-hidden",ref:f},!s&&React.createElement("img",{srcSet:`${x}, ${I}`,src:I}),React.createElement("div",{className:"preview"},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"})))),React.createElement("div",{className:"absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end"},React.createElement("div",{className:(0,r.AK)("opacity-0 group-hover:opacity-100 w-full flex items-center justify-between px-[20px] py-[14px] backdrop-blur-sm bg-white/[0.85] shadow-action-buttons transition-all duration-150 ease-in-out",!0===_.importing?"opacity-100":"")},React.createElement(v,{title:"Insert",liveRequest:!0,item:t,onClick:()=>{w({..._,importing:!0})},onBlockImport:()=>{w({..._,importing:!1})}}),React.createElement(N,{item:t})))))}}}]); >>>>>>> 83991021e1d3ca8e2da67e44fbc430cb41154aa2 ======= "use strict";(self.webpackChunkast_block_templates=self.webpackChunkast_block_templates||[]).push([[7],{5007:function(e,t,s){s.r(t),s.d(t,{default:function(){return A}});var o=s(7363),r=s(6048),a=s(5868),n=s(4142),l=s(9148),c=s(6128),i=s(1569),p=s(5622),m=o.forwardRef((function({title:e,titleId:t,...s},r){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},s),e?o.createElement("title",{id:t},e):null,o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}));const{compose:u}=wp.compose,{useSelect:d,withSelect:g,withDispatch:f}=wp.data,{post:b}=wp.ajax,{parse:h}=wp.blocks,{useState:y,memo:k}=wp.element;var v=u(g((e=>{const{getImportItemInfo:t,getCurrentScreen:s,getSitePreview:o,getActivePaletteSlug:r}=e("ast-block-templates");return{importItemInfo:t(),sitePreview:o(),currentScreen:s(),activePaletteSlug:r()}})),f((e=>{const{setImportItemInfo:t,setFullWidthBlockPreview:s,setCurrentScreen:o,setTogglePopup:r,setFullWidthPreview:a}=e("ast-block-templates"),{insertBlocks:n}=e("core/block-editor");return{setImportItemInfo:t,onSetTogglePopup:r,insertBlocks:n}})))(k((e=>{let{setImportItemInfo:t,liveRequest:s,requiredPlugins:o,importItemInfo:u,title:g,btnClass:f,currentScreen:k,insertBlocks:v,onSetTogglePopup:_,item:w,onClick:I,onBlockImport:E,activePaletteSlug:x}=e,[B,C]=y(u),S=o||[];const P=f||"",[R,j]=y(g||"Import"),[N,F]=y(!1),{insertIndex:$}=d((e=>{const{index:t}=e("core/block-editor").getBlockInsertionPoint();return{insertIndex:t}}),[]),A=()=>{(0,l.j)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}).then((e=>{})).catch((e=>{F(!1),j("Activation failed!")}))},O=()=>{(0,l.j)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((e=>{q()})).catch((e=>{F(!1),j("Activation failed!")}))},L=()=>{const e=B.original_content,t=B["blocks-category"][0];b({action:"ast_block_templates_import_block",content:e,category:t,_ajax_nonce:ast_block_template_vars._ajax_nonce,style:x}).done((e=>{F(!1);const t=(0,r.CN)(h(e));v(t,$,"",!1),_(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open"),"function"==typeof E&&E(e,$),"active"!==ast_block_template_vars.spectra_status&&(0,p.iP)()})).fail((e=>{}))},q=()=>{B?.["post-meta"]?.["astra-site-wpforms-path"]||""?b({action:"ast_block_templates_import_wpforms",id:B.id,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((e=>{L()})).fail((e=>{F(!1),j("WPForms import failed!")})):L()};return React.createElement(a.Z,{className:(0,r.AK)("min-w-[7rem] hover:shadow-small sp-text-sm",P),type:"button",variant:"primary",onClick:e=>{"function"==typeof I&&I(e),F(!0),"not-installed"===ast_block_template_vars.spectra_status?(0,l.H)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}).then((e=>{A()})).catch((e=>{F(!1),j("Installation failed!")})):"inactive"===ast_block_template_vars.spectra_status&&A(),(0,i.I)(w.ID,"astra-blocks").then((e=>{t(e),B=e,S=e?.["post-meta"]?.["astra-blocks-required-plugins"]?c.t.parse(e["post-meta"]["astra-blocks-required-plugins"]):[],S.length?"not-installed"===ast_block_template_vars.wpforms_status?(0,l.H)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((e=>{O()})).catch((e=>{F(!1),j("Installation failed!")})):"inactive"===ast_block_template_vars.wpforms_status?O():q():q()})).catch((e=>{}))},isSmall:!0,hasPrefixIcon:!N},N?React.createElement(n.Z,{className:"h-[1.3rem] w-[1.3rem] !shrink-0"}):React.createElement(React.Fragment,null,React.createElement(m,{className:"h-[1.3rem] w-[1.3rem] !shrink-0"}),R))}))),_=o.forwardRef((function({title:e,titleId:t,...s},r){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},s),e?o.createElement("title",{id:t},e):null,o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"}))})),w=s(10),I=s(6486);function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},E.apply(this,arguments)}const{useEffect:x,useState:B}=wp.element,{site_url:C}=ast_block_template_vars,{compose:S}=wp.compose,{withDispatch:P,withSelect:R,useSelect:j}=wp.data;var N=S(R((e=>{const{getFilterBlocksByCategory:t,getFilterBlocksPagesByCategory:s}=e("ast-block-templates");return{filterBlocksByCategory:t(),filterBlocksPagesByCategory:s()}})),P((e=>{const{setFavorites:t,setFilterBlocksByCategory:s,setFilterBlocksPagesByCategory:o}=e("ast-block-templates");return{setFavorites:t,setFilterBlocksByCategory:s,setFilterBlocksPagesByCategory:o}})))((e=>{let{item:t,className:s,setFavorites:o,setFilterBlocksByCategory:a,filterBlocksByCategory:n,filterBlocksPagesByCategory:l,setFilterBlocksPagesByCategory:c,...i}=e;const[p,m]=B(!1),{favorites:u}=j((e=>{const{getFavorites:t}=e("ast-block-templates");return{favorites:t()}}));return x((()=>{const e=u&&u[t.type]?Object.values(u[t.type]):[];u&&e&&e.includes((0,I.parseInt)(t.ID))&&m(!0)}),[p]),React.createElement("button",E({className:(0,r.AK)("flex items-center justify-center rounded-full p-2 bg-white cursor-pointer border-0 focus:outline-none",p?"":"text-icon-secondary",s),onClick:async e=>{e?.preventDefault(),e?.stopPropagation();try{await(0,w.Z)({path:`${C}/wp-json/gutenberg-templates/v1/favorite`,data:{type:t.type,block_id:t.ID,status:!p},method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce,"content-type":"application/json"}})}catch(e){console.error(e)}let s={};const r=t.type;if(p){const e=Object.keys(u[r]).find((e=>u[r][e]===(0,I.parseInt)(t.ID)));e&&delete u[r][e],s={...u}}else{const e=Object.keys(u[r]).length>0?Math.max(...Object.keys(u[r]).map(Number))+1:0;u[r][e]=(0,I.parseInt)(t.ID),s={...u}}m(!p),o(s),"block"===r?a(n):c(l)}},i),React.createElement(_,{className:(0,r.AK)("w-6 h-6 transition-colors ease-out duration-150",p?"fill-favorite text-favorite":"hover:fill-favorite hover:text-favorite")}))}));const F=e=>{const t=["skip","logo","fav-icon"];for(const s of t)if(e.includes(s))return!0;return!1},{spectra_common_styles:$}=ast_block_template_vars;var A=e=>{let{item:t,content:s,stylesheet:a,astraCustomizer:n,globalStylesheet:l,colorPalette:c,dynamicContent:i,selectedImages:p,email:m,phone:u,address:d}=e;const g=(0,o.useRef)(null),f=(0,o.useRef)(null),b=t["thumbnail-image-url"]||"",h=t["featured-image-url"]||"";let y=0,k=0;const[_,w]=(0,o.useState)({importing:!1}),[I,E]=(0,o.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),[x,B]=(0,o.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`);function C(){const e=g?.current,t=f?.current;if(!e||!t)return;const s=e.parentNode.offsetWidth/1200,o=s*t.offsetHeight;e.style.transform=`scale(${s})`,e.style.height=`${o}px`}return(0,o.useEffect)((()=>{let e=!0;const o={landscape:[],portrait:[]};p?.forEach((e=>{"landscape"===e.orientation?o.landscape.push(e):o.portrait.push(e)}));const r=o,g=new Image;g.src=b;const v=new Image;v.src=h;const _=f.current;function w(t,s){e&&(t.onload=()=>{s(t.src)})}w(g,E),w(v,B);const I=document.getElementById("astra-wp-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),x=document.getElementById("astra-block-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container");let S="";var P,R,j;if(a&&(P=a,R=r?.landscape,a=R&&0===R.length?P:P.replace(/background-image\s*:\s*url\(['"]?([^'")]+)['"]?\)/g,(function(e,t){if(F(t))return e;if(!R[y]?.url)return"";const s=R[y]?.url;return y++,'background-image: url("'+s+'")'}))),S+=n?`<style type="text/css" id="gt-astra-customizer">${n}</style>`:"",S+=`<style type="text/css" id="gt-spectra-common-stylesheet">${$}</style>`,S=a?`${S} <style type="text/css" id="gt-common-stylesheet">${a}</style>`:S,l&&(S+=`<style type="text/css" id="gt-global-stylesheet"> ${l} </style>`),I&&(S+=`<style type="text/css" id="gt-wpeditor-css" > ${I} </style>`),x&&(S+=`<style type="text/css" id="gt-blockeditor-css"> ${x} </style>`),_&&s){const e=_.attachShadow({mode:"open"});if(null===e)return;let o=s;const a=i?i[t.category]:[];a&&Object.keys(a)?.length>0&&Object.keys(a).forEach((e=>{o=null!==a[e]?o.replace(e,a[e]):o})),j=o,m&&(j=j.replace("contact@example.com",m)),u&&(j=j.replace("202-555-0188",u)),d&&(j=j.replace("2360 Hood Avenue, San Diego, CA, 92123",d)),o=j,e.innerHTML=S+o,c.forEach(((t,s)=>{e?.host.style.setProperty(`--ast-global-color-${s}`,t)}));const n=_.shadowRoot.querySelectorAll("div")[0];n?.classList.add("st-block-container");const l=_.shadowRoot.querySelectorAll("img");e&&(C(),((e,t)=>{const s=t.landscape?t.landscape:[],o=t.portrait?t.portrait:[];0!==s.length&&0!==o.length&&e?.forEach((function(e){F(e.src)||(e.onload=()=>{const t=(e=>{const t=new Image;return t.src=e,t.width>t.height?"landscape":"portrait"})(e.src);let r;if(r="landscape"===t?s[y]:o[k],void 0!==r&&(r.url.includes("unsplash")||r.url.includes("pexels")||r.url.includes("pixabay")))if("landscape"===t?y++:k++,"PICTURE"===e.parentNode.nodeName)e.parentNode.querySelectorAll("source").forEach((e=>{e.setAttribute("srcset",r.optimized_url)})),e.parentNode.querySelector("img").setAttribute("src",r.optimized_url);else{const t=document.createElement("img");t.src=r.optimized_url,e.parentNode.replaceChild(t,e)}})}))})(l,r))}return()=>{e=!1}}),[]),(0,o.useEffect)((()=>{const e=new ResizeObserver(C);return e.observe(document.documentElement),()=>{e&&e.disconnect()}}),[]),(0,o.useEffect)((()=>{const e=document.querySelector("#ast-block-templates-modal-wrap");if(!e)return;const t=new MutationObserver(C);return t.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{t&&t.disconnect()}}),[]),(0,o.useEffect)((()=>{const e=f?.current;if(e){const t=e.shadowRoot;c.forEach(((e,s)=>{null!==t&&t.host.style.setProperty(`--ast-global-color-${s}`,e)}))}}),[c]),React.createElement("div",{className:(0,r.AK)("w-full h-fit p-5",!0===_.importing?"importing":"")},React.createElement("div",{className:"cursor-pointer relative border border-solid border-border-primary hover:border-accent-spectra transition duration-150 ease-in-out overflow-hidden group"},React.createElement("div",{className:"thumbnail left-0 m-0 min-h-[auto] overflow-visible text-left top-0 origin-top-left relative pointer-events-none",ref:g},React.createElement("div",{className:"absolute w-[1200px] pointer-events-none max-h-[1600px] overflow-hidden",ref:f},!s&&React.createElement("img",{srcSet:`${x}, ${I}`,src:I}),React.createElement("div",{className:"preview"},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"})))),React.createElement("div",{className:"absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end"},React.createElement("div",{className:(0,r.AK)("opacity-0 group-hover:opacity-100 w-full flex items-center justify-between px-[20px] py-[14px] backdrop-blur-sm bg-white/[0.85] shadow-action-buttons transition-all duration-150 ease-in-out",!0===_.importing?"opacity-100":"")},React.createElement(v,{title:"Insert",liveRequest:!0,item:t,onClick:()=>{w({..._,importing:!0})},onBlockImport:()=>{w({..._,importing:!1})}}),React.createElement(N,{item:t})))))}}}]); >>>>>>> cef0857c550ecc19c6634bdc8e768bcc328b4c66