OwlCyberSecurity - MANAGER
Edit File: extendify-page-creator-0275e3e5be93452bbb4c.js
"use strict";(globalThis.webpackChunkextendify=globalThis.webpackChunkextendify||[]).push([[525],{9858:(e,t,a)=>{var r=a(9196),n=a(9307),o=a(8817),i=a(9818),l=a(2238),s=a(5736),c=a(1984),d=a(5609),m=a(6993);const{adminUrl:g}=window.extSharedData,p=({setConfirmationOpen:e,confirmationOpen:t,setModalOpen:a})=>{const{incrementActivity:n}=(0,m.j)();return(0,r.createElement)(d.Modal,{onRequestClose:()=>e(!1),className:"extendify-page-creator",size:"medium","aria-labelledby":"page-creator-confirmation",role:"dialog",isOpen:t,title:(0,s.__)("Confirmation","extendify-local")},(0,r.createElement)("div",{className:"flex flex-col space-y-6 text-sm"},(0,r.createElement)("div",null,(0,s.__)("Do you want to replace existing content or create a new page?","extendify-local")),(0,r.createElement)("div",{className:"flex w-full items-center justify-end space-x-2"},(0,r.createElement)(d.Button,{size:"default",variant:"tertiary",onClick:()=>{e(!1),a(!0),n("page-creator-delete-content-button-click")}},(0,s.__)("Delete existing content","extendify-local")),(0,r.createElement)(d.Button,{variant:"primary",size:"default",href:`${g}post-new.php?post_type=page&ext-open-ai-creator`,target:"_blank"},(0,s.__)("Create a new page","extendify-local")))))},u=(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)("path",{d:"M11.1515 20H7.04C6.32593 20 5.9689 20 5.69616 19.861C5.45626 19.7388 5.26121 19.5437 5.13897 19.3038C5 19.0311 5 18.6741 5 17.96V6.04C5 5.32593 5 4.9689 5.13897 4.69616C5.26121 4.45626 5.45626 4.26121 5.69616 4.13897C5.9689 4 6.32593 4 7.04 4H16.96C17.6741 4 18.0311 4 18.3038 4.13897C18.5437 4.26121 18.7388 4.45626 18.861 4.69616C19 4.9689 19 5.32593 19 6.04V11.0303",stroke:"white",strokeWidth:"1.275",strokeLinecap:"square"}),(0,r.createElement)("path",{d:"M13.1 8H8",stroke:"white",strokeWidth:"1.275",strokeLinecap:"square",strokeLinejoin:"round"}),(0,r.createElement)("path",{d:"M10.55 10.5H8",stroke:"white",strokeWidth:"1.275",strokeLinecap:"square",strokeLinejoin:"round"}),(0,r.createElement)("path",{d:"M16.8592 17.8578L15.9955 20.4901C15.8384 20.9685 15.1616 20.9685 15.0045 20.4901L14.1408 17.8578C13.9857 17.385 13.615 17.0143 13.1422 16.8592L10.5099 15.9955C10.0315 15.8384 10.0315 15.1616 10.51 15.0045L13.1422 14.1408C13.615 13.9857 13.9857 13.615 14.1408 13.1422L15.0045 10.5099C15.1616 10.0315 15.8384 10.0315 15.9955 10.5099L16.8592 13.1422C17.0143 13.615 17.385 13.9857 17.8578 14.1408L20.49 15.0045C20.9685 15.1616 20.9685 15.8384 20.49 15.9955L17.8578 16.8592C17.385 17.0143 17.0143 17.385 16.8592 17.8578Z",fill:"white"}));var f=a(270),w=a(782);const x=e=>({open:!1,setOpen:t=>e({open:t}),progress:"",setProgress:t=>e({progress:t}),regenerationCount:0,incrementRegenerationCount:()=>e((e=>({regenerationCount:e.regenerationCount+1})))}),y=(0,f.Ue)((0,w.mW)(x,{name:"Extendify Page Creator Globals"}),x),h=()=>{const{setOpen:e}=y(),{incrementActivity:t}=(0,m.j)(),[a,o]=(0,n.useState)(!1),d=(0,i.useSelect)((e=>e(l.store).isEditedPostEmpty()),[]);return(0,r.createElement)(r.Fragment,null,a&&(0,r.createElement)(p,{setConfirmationOpen:o,setModalOpen:e,confirmationOpen:a}),(0,r.createElement)("div",{role:"button",onClick:()=>{if(window.dispatchEvent(new CustomEvent("extendify-hc:minimize")),!d)return o(!0);e(!0),t("page-creator-button-click")},className:"components-button has-icon is-primary ml-3 h-8 min-w-0 cursor-pointer px-2 xs:h-9 sm:ml-2 xl:pr-3"},(0,r.createElement)(c.Z,{icon:u,size:24,className:"fill-none"}),(0,r.createElement)("span",{className:"ml-1 hidden xl:inline"},(0,s.__)("AI Page Generator","extendify-local"))))};var v=a(2067),b=a(7918);const E=({onClose:e})=>(0,r.createElement)("button",{className:"block h-6 w-6 cursor-pointer bg-transparent p-px text-inherit outline-none focus:shadow-none focus:ring-wp focus:ring-design-main",type:"button",onClick:e,"data-test":"modal-close-button","aria-label":(0,s.__)("Close","extendify-local")},(0,r.createElement)("svg",{style:{fill:"currentColor"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)("path",{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}))),S=(0,r.createElement)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)("path",{clipRule:"evenodd",d:"m13.505 4h3.3044c.936 0 1.2747.10161 1.6171.29127.3424.19042.6102.46965.7934.82489.1831.356.2801.70824.2801 1.6814v3.43584c0 .9731-.0977 1.3254-.2801 1.6814-.1832.356-.4517.6344-.7934.8248-.153.0852-.3057.1552-.5112.2054v2.7344c0 1.503-.151 2.047-.4327 2.5968-.2828.5498-.6976.9799-1.2252 1.274-.5288.294-1.052.4498-2.4975.4498h-5.10341c-1.44549 0-1.96869-.1569-2.49747-.4498-.52878-.2941-.94242-.7254-1.22526-1.274-.28284-.5487-.43376-1.0938-.43376-2.5968v-5.3051c0-1.50301.15092-2.04701.43264-2.59682.28284-.54981.6976-.98106 1.22638-1.27514.52767-.29293 1.05198-.44985 2.49747-.44985h2.18511c.041-.44652.1265-.69015.2522-.93557.1832-.356.4517-.63523.7941-.82565.3417-.18966.6812-.29127 1.6171-.29127zm-1.6984 2.18698c0-.63769.4973-1.15464 1.1106-1.15464h4.4793c.6133 0 1.1106.51695 1.1106 1.15464v4.65692c0 .6377-.4973 1.1547-1.1106 1.1547h-4.4793c-.6133 0-1.1106-.517-1.1106-1.1547z",fill:"currentColor",fillRule:"evenodd"}));var P=a(3967),k=a.n(P);const{partnerLogo:C,partnerName:N}=window.extSharedData,_=({openOnNewPage:e,updateUserOption:t,onClose:a})=>(0,r.createElement)("div",{role:"banner",className:k()("flex max-h-28 flex-row items-center justify-between p-5 md:px-8 md:py-5",{"bg-banner-main":C})},(0,r.createElement)("div",null,C?(0,r.createElement)("div",{className:"flex justify-center bg-banner-main"},(0,r.createElement)("div",{className:"flex h-6 max-w-40 overflow-hidden md:h-8 md:max-w-64"},(0,r.createElement)("img",{className:"max-h-full max-w-full object-contain",src:C,alt:N}))):(0,r.createElement)("div",{className:"-mb-5 hidden px-5 py-3 text-extendify-black sm:flex sm:pt-5"},(0,r.createElement)(c.Z,{icon:S,size:40}))),(0,r.createElement)("div",{className:k()("flex w-auto flex-shrink-0 items-center justify-end gap-4",{"text-banner-text":C})},(0,r.createElement)("label",{className:"flex items-center gap-2",htmlFor:"extendify-open-on-new-pages",title:(0,s.sprintf)( // translators: %s: Extendify AI Page creator term (0,s.__)("Toggle %s on new pages","extendify-local"),"Extendify AI Page Creator")},(0,r.createElement)("input",{id:"extendify-open-on-new-pages",className:"m-0 rounded-sm border border-solid border-gray-900",type:"checkbox",checked:e,onChange:e=>t("openOnNewPage",e.target.checked)}),(0,r.createElement)("span",null,(0,s.__)("Open for new pages","extendify-local"))),(0,r.createElement)("div",null,(0,r.createElement)(E,{onClose:a}))));var O=a(3689),D=a(3773);const I=({show:e})=>e?(0,r.createElement)(O.M,null,(0,r.createElement)(D.E.div,{className:"fixed bottom-[20px] right-0 z-max flex justify-end px-4 pb-4"},(0,r.createElement)("div",{className:"shadow-2xl"},(0,r.createElement)(d.Snackbar,null,(0,s.__)("Just a moment, this is taking longer than expected.","extendify-local"))))):null;var T=a(2629);const $=({label:e,checked:t,onChange:a,slug:n="checkbox-input"})=>(0,r.createElement)("label",{htmlFor:n,className:"relative flex h-full w-full cursor-pointer items-center justify-between rounded-sm p-2 text-gray-900"},(0,r.createElement)("div",{className:"flex flex-auto items-center"},(0,r.createElement)("span",{className:"relative mr-1 inline-block h-4 w-4 align-middle rtl:ml-1 rtl:mr-0"},(0,r.createElement)("input",{id:n,className:"h-4 w-4 rounded-sm focus:ring-0 focus:ring-offset-0",type:"checkbox",onChange:a,checked:t}),(0,r.createElement)("svg",{className:"absolute inset-0 -mt-px block h-4 w-4 text-transparent",viewBox:"1 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"presentation"},(0,r.createElement)("path",{d:"M8.72912 13.7449L5.77536 10.7911L4.76953 11.7899L8.72912 15.7495L17.2291 7.24948L16.2304 6.25073L8.72912 13.7449Z",fill:"currentColor"}))),(0,r.createElement)("span",{className:"font-light"},e)));var j=a(5202),z=a(6123),L=a(5389),B=a(9516),A=a(9486);const R=({placeholder:e,className:t,title:a,onChange:n,value:o,description:i=null,required:l=!1,hideEditor:m=!1,setHideEditor:g=function(){},id:p})=>(0,r.createElement)(z.g,{id:p,className:"p-3"},(0,r.createElement)(L.__,{as:"h4",className:"mb-2 mt-0 text-base font-medium data-[disabled]:opacity-50"},(0,s.__)(a,"extendify-local")," ",l&&(0,r.createElement)("span",{className:"text-sm font-light text-wp-alert-red"},"*")),i&&(0,r.createElement)(B.dk,{className:"data-[disabled]:opacity-50"},(0,s.__)(i,"extendify-local")),m?(0,r.createElement)("div",null,(0,r.createElement)("span",{className:"line-clamp-4 opacity-80"},o),(0,r.createElement)("span",{className:"link mt-1 flex w-full justify-end"},(0,r.createElement)(d.Button,{variant:"link",onClick:e=>{e.preventDefault(),g(!1)}},(0,s.__)("Edit","extendify-local")))):(0,r.createElement)("div",{className:"relative"},(0,r.createElement)(A.g,{name:"description",placeholder:e,value:o,onChange:n,className:t}),o?(0,r.createElement)("span",{className:"absolute right-0 top-0 z-10 flex items-center pr-2 pt-2"},(0,r.createElement)("button",{type:"button",className:"m-0 border-0 bg-transparent p-0 text-gray-500","aria-label":(0,s.__)("Clear","extendify-local"),onClick:()=>{n({currentTarget:{value:""}})}},(0,r.createElement)(c.Z,{icon:j.Z,size:16}))):null)),F=({title:e,description:t})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)("h2",{className:"m-0 text-center text-2xl leading-8 text-gray-900 md:leading-10"},e),t&&(0,r.createElement)("p",{className:"m-0 text-center text-base leading-6 text-gray-700"},t)),M=(0,f.Ue)((0,w.tJ)((e=>({description:null,setDescription:t=>e({description:t}),reset:()=>e({description:null})})),{name:`extendify-page-creator-page-description-cache-${window.extSharedData.siteId}`}));var U=a(6989),q=a.n(U),J=a(7403);const W={getItem:async()=>await q()({path:"/wp/v2/users/me"}),setItem:async(e,t)=>await q()({path:"/wp/v2/users/me",method:"PUT",data:{extendify_page_creator_user:t}})},G=(0,f.Ue)((0,w.tJ)(((e,t)=>{var a;return{openOnNewPage:!0,allowsInstallingPlugins:!0,updateUserOption:(a,r)=>{Object.keys(t()).includes(a)&&e({[a]:r})},...null!==(a=(0,J.a)(window.extPageCreator.userInfo)?.state)&&void 0!==a?a:{}}}),{name:"extendify_page_creator_user",storage:(0,w.FL)((()=>W)),partialize:e=>({...e,ready:!1}),skipHydration:!0})),H=(0,J.a)(window.extSharedData.userData.userSelectionData)?.state?.siteProfile||{},Z={siteProfile:{aiDescription:window.extSharedData?.siteProfile?.aiDescription||H?.aiDescription,aiSiteType:H?.aiSiteType,aiSiteCategory:H?.aiSiteCategory,aiKeywords:H?.aiKeywords}},K=e=>({...Z,setSiteProfile(t){const a=Object.assign({aiSiteType:Z?.siteProfile?.aiSiteType,aiSiteCategory:Z?.siteProfile?.aiSiteCategory,aiDescription:Z?.siteProfile?.aiDescription,aiKeywords:Z?.siteProfile?.aiKeywords},t||{});e({siteProfile:a})},resetState(){e(Z)}}),V="/extendify/v1/shared/site-profile",Y={getItem:async()=>await q()({path:V}),setItem:async(e,t)=>{await q()({path:V,method:"POST",data:{value:(0,J.a)(t)?.state?.siteProfile||{}}})}},Q=(0,f.Ue)((0,w.tJ)((0,w.mW)(K,{name:"Extendify Site Profile"}),{storage:(0,w.FL)((()=>Y)),skipHydration:!1}),K),{siteTitle:X}=window.extSharedData;var ee=a(4981),te=a(6483);const ae=e=>q()({path:"/extendify/v1/shared/process-placeholders",method:"POST",data:{patterns:e}}),re=({path:e,poster:t,className:a=null})=>{const n=(0,r.useRef)(),[o,i]=(0,r.useState)(!1);return(0,r.createElement)("div",{className:`relative ${a}`,style:{backgroundImage:o?"none":`url(${t})`,backgroundSize:"contain",backgroundPosition:"center",backgroundRepeat:"no-repeat"}},(0,r.createElement)("video",{ref:n,id:"video-player",className:"h-auto max-h-[min(50vh,400px)] w-full object-contain",playsInline:!0,muted:!0,autoPlay:!0,poster:t,loop:!0,onPlay:()=>i(!0)},(0,r.createElement)("source",{src:e,type:"video/webm"}),"Your browser does not support the video tag."))};var ne=a(2200);const{siteTitle:oe,siteType:ie}=window.extSharedData,le={...Object.fromEntries(Object.entries(window.extSharedData).filter((([e])=>["partnerId","devbuild","version","siteId","wpLanguage","wpVersion","siteProfile"].includes(e))))},se=async({pageProfile:e,siteImages:t})=>{const a=await(async()=>await q()({method:"GET",path:(0,te.addQueryArgs)("/extendify/v1/page-creator/settings/get-option",{name:"extendify_siteStyle"})})||{vibe:"standard"})(),r=await(async(e={})=>{var t;const{showLocalizedCopy:a,activePlugins:r,allowedPlugins:n,installedPlugins:o}=window.extSharedData,{allowsInstallingPlugins:i}=G.getState(),l=null!==(t=r?.map((e=>e.split("/")[0])))&&void 0!==t?t:[],s=Object.entries(e).reduce(((e,[t,a])=>({...e,[t]:"object"==typeof a?JSON.stringify(a):a})),{}),c=await fetch(`${ne.kE}/api/page-creator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...le,siteType:ie?.slug,showLocalizedCopy:!!a,allowsInstallingPlugins:i,plugins:JSON.stringify(l),installedPlugins:JSON.stringify(o),allowedPlugins:JSON.stringify(n),...s})});if(!c.ok)throw new Error("Bad response from server");return await c.json()})({siteInformation:{title:oe},siteImages:t,siteStyle:a,pageProfile:e});if(!r?.template)throw new Error("Could not get page");return"extendable"!==(window.extSharedData?.themeSlug||"extendable")&&(r.template.patterns=r.template.patterns.filter((e=>!e.patternTypes.includes("page-title")))),r},ce=async({page:e,userState:t,pageProfile:a})=>{const r=await fetch(`${ne.Yy}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...le,page:e,userState:t,siteProfile:a})});if(!r.ok)throw new Error("Bad response from server");return await r.json()},de=async({description:e,siteProfile:t})=>{const a=await fetch(`${ne.Yy}/api/page-profile`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...le,siteDescription:t?.aiDescription||"",description:e})});if(!a.ok)throw new Error("Something went wrong while fetching the profile");const r=await a.json();return r?.aiDescription?r:{aiTitle:null,aiPageType:null,aiDescription:null,aiKeywords:[]}},me=async({pageProfile:e})=>{const{aiSiteType:t,aiSiteCategory:a,aiDescription:r,aiKeywords:n}=e,o=new URLSearchParams({aiSiteType:t,aiSiteCategory:a,aiDescription:r,aiKeywords:n,...le,source:"page-creator"});oe&&o.append("title",oe);const i=await fetch(`${ne.TS}/api/search?${o}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error("Something went wrong while fetching the images");const l=await i.json();return l?.siteImages?l:{siteImages:[]}};var ge=a(9870);const pe=()=>{const{description:e}=M(),{setProgress:t,regenerationCount:a}=y(),{siteProfile:r}=Q(),{data:o,error:i}=(0,ge.Z)({key:`page-profile-${a}`,description:e,siteProfile:r},de);return(0,n.useEffect)((()=>{o||t((0,s.__)("Generating AI page profile...","extendify-local"))}),[o,t]),{pageProfile:o,error:i,loading:!o&&!i}},ue=JSON.parse('{"twentytwentyfive":{"colorSlugs":{"background":"base","foreground":"contrast","primary":"contrast","secondary":"accent-4","tertiary":"accent-1","foreground-alt":"contrast"},"spacingScale":{"20":"30","30":"40","40":"50","50":"60","60":"70","70":"min(7rem,10vw)","80":"80"},"fontSizeScale":{"small":"small","medium":"medium","large":"x-large","x-large":"xx-large","xx-large":"xx-large"}},"twentytwentyfour":{"colorSlugs":{"background":"base","foreground":"contrast","primary":"contrast-2","secondary":"accent-3","tertiary":"base-2","foreground-alt":"contrast"},"spacingScale":{"20":"1rem","30":"30","40":"70","50":"40","60":"50","70":"min(7rem,10vw)","80":"60"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"astra":{"colorSlugs":{"background":"ast-global-color-4","foreground":"ast-global-color-2","primary":"ast-global-color-0","secondary":"ast-global-color-6","tertiary":"ast-global-color-5","foreground-alt":"ast-global-color-3"},"spacingScale":{"20":"1rem","30":"min(2rem, 5vw)","40":"min(3rem, 6vw)","50":"min(4rem, 7vw)","60":"min(6rem, 8vw)","70":"min(7rem, 10vw)","80":"min(8rem, 12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"x-large","x-large":"xx-large","xx-large":"xx-large"}},"hello-elementor":{"colorSlugs":{"background":"white","foreground":"black","primary":"vivid-red","secondary":"vivid-purple","tertiary":"cyan-bluish-gray","foreground-alt":"black"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"twentytwentytwo":{"colorSlugs":{"background":"background","foreground":"foreground","primary":"primary","secondary":"vivid-purple","tertiary":"tertiary","foreground-alt":"foreground"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"generatepress":{"colorSlugs":{"background":"base-3","foreground":"contrast","primary":"accent","secondary":"contrast-2","tertiary":"base","foreground-alt":"contrast"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"divi":{"colorSlugs":{"background":"background","foreground":"foreground","primary":"primary","secondary":"vivid-purple","tertiary":"tertiary","foreground-alt":"foreground"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"twentytwentythree":{"colorSlugs":{"background":"background","foreground":"foreground","primary":"primary","secondary":"vivid-purple","tertiary":"tertiary","foreground-alt":"foreground"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"ultra":{"colorSlugs":{"background":"white","foreground":"black","primary":"vivid-red","secondary":"vivid-purple","tertiary":"cyan-bluish-gray","foreground-alt":"black"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"oceanwp":{"colorSlugs":{"background":"white","foreground":"black","primary":"vivid-red","secondary":"vivid-purple","tertiary":"cyan-bluish-gray","foreground-alt":"black"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"kadence":{"colorSlugs":{"background":"theme-palette-8","foreground":"theme-palette-3","primary":"theme-palette-1","secondary":"theme-palette-2","tertiary":"theme-palette-9","foreground-alt":"theme-palette-3"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"small","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"popularfx":{"colorSlugs":{"background":"white","foreground":"black","primary":"vivid-red","secondary":"vivid-purple","tertiary":"cyan-bluish-gray","foreground-alt":"black"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"normal","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"blocksy":{"colorSlugs":{"background":"palette-color-7","foreground":"palette-color-3","primary":"palette-color-1","secondary":"palette-color-4","tertiary":"palette-color-5","foreground-alt":"palette-color-3"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"normal","medium":"medium","large":"large","x-large":"x-large","xx-large":"xx-large"}},"neve":{"colorSlugs":{"background":"nv-site-bg","foreground":"neve-text-color","primary":"nv-primary-accent","secondary":"nv-secondary-accent","tertiary":"nv-light-bg","foreground-alt":"neve-text-color"},"spacingScale":{"20":"20","30":"60","40":"70","50":"min(4rem,7vw)","60":"min(6rem,8vw)","70":"min(7rem,10vw)","80":"min(8rem,12vw)"},"fontSizeScale":{"small":"medium","medium":"medium","large":"x-large","x-large":"x-large","xx-large":"xx-large"}}}'),fe="extendable",we=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),xe=(e={})=>{const t={};return Object.entries(e).forEach((([e,a])=>{t[`"backgroundColor":"${e}"`]=`"backgroundColor":"${a}"`,t[`"textColor":"${e}"`]=`"textColor":"${a}"`,t[`"linkColor":"${e}"`]=`"linkColor":"${a}"`,t[`has-${e}-background-color`]=`has-${a}-background-color`,t[`has-${e}-color`]=`has-${a}-color`,t[`has-${e}-link-color`]=`has-${a}-link-color`,t[`var:preset|color|${e}`]=`var:preset|color|${a}`,t[`var(--wp--preset--color--${e})`]=`var(--wp--preset--color--${a})`})),t},ye=(e={})=>{const t={};return Object.entries(e).forEach((([e,a])=>{const r=a.startsWith("min(")?a:`var:preset|spacing|${a}`,n=a.startsWith("min(")?a:`var(--wp--preset--spacing--${a})`;t[`var:preset|spacing|${e}`]=r,t[`var(--wp--preset--spacing--${e})`]=n})),t},he=(e={})=>{const t={};return Object.entries(e).forEach((([e,a])=>{t[`"fontSize":"${e}"`]=`"fontSize":"${a}"`,t[`has-${e}-font-size`]=`has-${a}-font-size`})),t};function ve(e="",t=fe){if(!e||t===fe)return e;const a=ue[t];if(!a)return e;const r={...xe(a.colorSlugs),...ye(a.spacingScale),...he(a.fontSizeScale)};if(console.log("map",r),"kadence"===t&&Object.keys(r).forEach((e=>{(e.startsWith('"backgroundColor":')||e.startsWith('"textColor":')||e.startsWith('"linkColor":'))&&r[e].includes("theme-palette-")&&(r[e]=r[e].replace(/theme-palette-(\d+)/,"theme-palette$1"))})),!Object.keys(r).length)return e;const n=new RegExp(Object.keys(r).map(we).join("|"),"g");return e.replace(n,(e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e}))}const{state:be}=(0,J.a)(window.extSharedData?.userData?.userSelectionData),Ee=window.extSharedData.siteId,Se=window.extSharedData?.themeSlug||"extendable",Pe=window.wp.blockDirectory,ke=window.wpApiSettings.root,Ce={"contact-form-7":{id:"contact-form-7",name:"contact-form-7/contact-form-selector",title:"Contact Form 7",links:{"wp:plugin":[{href:`${ke}wp/v2/plugins/contact-form-7/wp-contact-form-7`}]}},simplybook:{id:"simplybook",name:"simplybook/widget",title:"SimplyBook",links:{"wp:plugin":[{href:`${ke}wp/v2/plugins/simplybook/simplybook`}]}}},Ne=(0,f.Ue)((0,w.tJ)((e=>({installedPlugins:window.extSharedData?.activePlugins?.map((e=>e.split("/")[0])),updateInstalledPlugins:async()=>{const t=(await q()({path:"/wp/v2/plugins",method:"GET"}))?.map((e=>e.plugin.split("/")[0]));e({installedPlugins:t})}})),{name:`extendify-page-creator-page-installed-plugins-cache-${window.extSharedData.siteId}`})),_e=["contact-form-7","simplybook"],{pageTitlePattern:Oe}=window.extPageCreator,De={"ai-dashboard":{component:()=>{const{nextPage:e}=$e(),{allowsInstallingPlugins:t,updateUserOption:a}=G(),{siteProfile:o,setSiteProfile:i}=Q(),{setDescription:l,description:c}=M(),[d,m]=(0,n.useState)(null!=c?c:""),[g,p]=(0,n.useState)(!0),[u,f]=(0,n.useState)(!0),{incrementRegenerationCount:w}=y(),[x,h]=(0,n.useState)((0,T.decodeEntities)(o?.aiDescription)||"");return(0,n.useLayoutEffect)((()=>{x||f(!1)}),[x]),(0,n.useEffect)((()=>{p(!0);const e=setTimeout((()=>{d&&l(d),x&&x!==o?.aiDescription&&i({aiDescription:x}),p(!d.length)}),1e3);return()=>clearTimeout(e)}),[l,d,x,p,i,o]),(0,r.createElement)("div",{className:"mx-auto my-12 flex max-w-xl flex-col"},(0,r.createElement)("div",{className:"mb-12 grid grid-cols-1 gap-1 text-center"},(0,r.createElement)(F,{title:(0,s.__)("AI Page Creation","extendify-local"),description:(0,s.__)("Describe the page you want to create, adding key details, and Al will generate a unique, ready-to-use page for you.","extendify-local")})),(0,r.createElement)("div",{className:"grid grid-cols-1 gap-3"},(0,r.createElement)(R,{id:"extendify-page-creator-page-description",title:(0,s.__)("Describe Your Page","extendify-local"),required:!0,className:"input-focus h-[220px] w-full max-w-full resize-none border border-gray-600 py-3 pe-6 ps-3 text-base placeholder:italic placeholder:opacity-70",placeholder:(0,s.__)('E.g., Create an "About Us" page highlighting our story, mission, values and leam overview.',"extendify-local"),value:d,onChange:e=>m(e.currentTarget.value)}),(0,r.createElement)(R,{id:"extendify-page-creator-site-description",hideEditor:u,setHideEditor:f,title:X? // translators: %s: The site title (0,s.sprintf)((0,s.__)("Site Description for %s","extendify-local"),(0,T.decodeEntities)(X)):(0,s.__)("Site Description","extendify-local"),className:"input-focus h-[220px] w-full max-w-full resize-none border border-gray-600 py-3 pe-6 ps-3 text-base placeholder:italic placeholder:opacity-70",placeholder:(0,s.__)("This is the site description with all its ups and downs.","extendify-local"),value:x,onChange:e=>h(e.currentTarget.value)}),(0,r.createElement)($,{label:(0,s.__)("Allow plugins to be installed for advanced page features","extendify-local"),slug:"extendify-page-creator-allow-plugins",checked:t,onChange:e=>a("allowsInstallingPlugins",e.target.checked)}),(0,r.createElement)("button",{id:"extendify-page-creator-generate-btn",type:"button",disabled:g,onClick:()=>{w(),e()},className:"mt-2.5 rounded-sm bg-editor-main px-4 py-2.5 text-sm font-medium text-design-text hover:opacity-90 disabled:cursor-not-allowed disabled:bg-gray-300"},(0,s.__)("Generate Page","extendify-local"))))}},"generating-page":{component:({insertPage:e})=>{const{page:t,loading:a}=(()=>{const{pageProfile:e}=pe(),{template:t}=(()=>{var e;const{pageProfile:t}=pe(),{siteImages:a}=(()=>{const{loading:e,pageProfile:t}=pe(),{setProgress:a,regenerationCount:r}=y(),{data:o,error:i}=(0,ge.Z)(e?null:{key:`page-images-${r}`,pageProfile:t},me);return(0,n.useEffect)((()=>{o||a((0,s.__)("Finding images...","extendify-local"))}),[o,a]),{siteImages:o,error:i,loading:!o&&!i}})(),r=!t||!a,{setProgress:o,regenerationCount:i}=y(),l={key:`page-creator-page-layout-${i}`,pageProfile:t,siteImages:a},{data:c,error:d}=(0,ge.Z)(r?null:l,se);return(0,n.useEffect)((()=>{c||o((0,s.__)("Creating a custom layout...","extendify-local"))}),[c,o]),{template:null!==(e=c?.template)&&void 0!==e?e:c,error:d,loading:!c&&!d}})(),{setProgress:a,regenerationCount:r}=y(),o=!e||!t,i={key:`page-creator-page-custom-content-${r}`,pageProfile:e,userState:{businessInformation:be?.businessInformation,goals:be?.goals,siteInformation:be?.siteInformation,siteId:Ee},page:t},{data:l,error:c}=(0,ge.Z)(o?null:i,ce);(0,n.useEffect)((()=>{o||a((0,s.__)("Writing custom content...","extendify-local"))}),[l,a,o]);const d=(0,n.useMemo)((()=>l?.patterns?l.patterns.map((e=>({...e,code:ve(e.code,Se)}))):[]),[l?.patterns]);return{page:l?{patterns:d,title:e.aiTitle}:l,error:c,loading:!l&&!c}})(),{progress:o,setProgress:c}=y(),{editPost:d}=(0,i.useDispatch)(l.store),[m,g]=(0,n.useState)([]),p=(0,n.useRef)(!1),u=(0,i.useSelect)((e=>e("core").getCurrentTheme()));return(0,n.useEffect)((()=>{!t&&a||p.current||(p.current=!0,c((0,s.__)("Processing patterns and installing required plugins...","extendify-local")),(async()=>{const e=await(async e=>{for(let t=1;t<=3;t++)try{return await ae(e)}catch(a){if(3===t)return console.error("Failed to process patterns after 3 attempts:",a),e;await new Promise((e=>setTimeout(e,1e3)))}})(t?.patterns);await(async({patterns:e})=>{const{installBlockType:t}=(0,i.dispatch)(Pe.store),{installedPlugins:a,updateInstalledPlugins:r}=Ne.getState(),n=e.flatMap((e=>e.patternReplacementCode)).filter(Boolean),o=_e.filter((e=>n.some((t=>t.includes(e)))&&!a.includes(e)));for(const e of o){const a=Ce[e];a&&await t(a)}await r()})({patterns:e}),g(e)})())}),[a,t,g,c]),(0,n.useEffect)((()=>{if(!m?.length||!p.current)return;const a=m.flatMap((({code:e})=>{let a=e;if(Oe&&e.includes('"name":"Page Title"')){const e=/<h1([^>]*)>[^<]*<\/h1>/g,r=(e,a)=>`<h1${a}>${t.title}</h1>`;a=(0,T.decodeEntities)(Oe).replaceAll(e,r)}const r=a.replaceAll(/href="#extendify-([^"]+)"/g,'href="#"');return(0,ee.rawHandler)({HTML:r})}));u?.textdomain&&"extendable"===u?.textdomain&&d({template:"no-title"}).catch((()=>{})),(async(e,t)=>{await q()({path:"/extendify/v1/page-creator/settings/single",method:"POST",data:{key:"extendify_check_for_image_imports",value:!0}})})();let r=setTimeout((()=>e(a,t.title)),1e3);return()=>clearTimeout(r)}),[e,m,d,t,u]),(0,r.createElement)("div",{className:"mx-auto flex flex-grow items-center justify-center"},(0,r.createElement)("div",{className:"mx-auto flex h-full flex-col justify-center"},(0,r.createElement)(re,{poster:`${window.extSharedData.assetPath}/site-building.webp`,path:"https://images.extendify-cdn.com/launch/site-building.webm",className:"mx-auto h-auto w-[200px] md:w-[400px]"}),o&&(0,r.createElement)("p",{className:"text-center text-lg","aria-live":"polite"},o)))}}},Ie=Object.entries(De),Te=(0,w.mW)(((e,t)=>({pages:new Map(Ie),currentPageIndex:0,count:()=>t().pages.size,getPageOrder:()=>Array.from(t().pages.keys()),getCurrentPageData:()=>t().pages.get(t().getCurrentPageSlug()),getPageSlug:e=>t().getPageOrder()[e],getCurrentPageSlug:()=>t().getPageOrder()[t().currentPageIndex]||(t().setPage(0),t().getPageOrder()[0]),getPageData:e=>t().pages.get(e),getNextPageData:()=>{const e=t().currentPageIndex+1;return e>t().count()-1?{}:t().getPageData(t().getPageSlug(e))},setPage:a=>{"string"==typeof a&&(a=t().getPageOrder().indexOf(a)),a>t().count()-1||a<0||e({currentPageIndex:a})},findPreviousValidPage:e=>{let t=e;do{t-=1}while(t>0);return t},nextPage:()=>{const e=t().currentPageIndex+1;t().setPage(e)},previousPage:()=>{t().setPage(t().findPreviousValidPage(t().currentPageIndex))}})),{name:"Extendify Page Creator Pages",serialize:!0}),$e=(0,f.Ue)(Te);var je=a(9820);const ze=({insertPage:e})=>{const[t,a]=(0,n.useState)(!1),{component:o}=$e((e=>e.getCurrentPageData()));return(0,r.createElement)(je.J$,{value:{errorRetryInterval:1e3,onErrorRetry:(e,r,n,o,{retryCount:i})=>{console.error(e),403!==e?.data?.status?t||(a(!0),setTimeout((()=>{a(!1),o({retryCount:i})}),5e3)):window.location.reload()}}},o?(0,r.createElement)(o,{insertPage:e}):null,(0,r.createElement)(I,{show:t}))},Le=()=>{const{incrementActivity:e}=(0,m.j)(),{open:t,setOpen:a}=y(),{updateUserOption:o,openOnNewPage:c}=G(),{setPage:d}=$e(),{resetBlocks:g}=(0,i.dispatch)("core/block-editor"),{closeGeneralSidebar:p}=(0,i.useDispatch)(v.store),u=(0,i.useSelect)((e=>e("core/preferences").get("core","renderingModes")||{}),[]),f="template-locked"===u?.extendable?.page,{set:w}=(0,i.useDispatch)("core/preferences"),x=e=>w("core","renderingModes",{...u,extendable:{...u.extendable||{},page:e}}),{createNotice:h}=(0,i.dispatch)("core/notices"),E=(0,n.useRef)(!1),S=()=>{e("page-creator-modal-close"),a(!1),d(0)},P=(0,i.useSelect)((e=>{const t=e(l.store);return{isPage:"page"===t.getCurrentPostType(),isNew:t.isCleanNewPost(),isEmptyPost:t.isEditedPostEmpty()}}),[]);return(0,n.useLayoutEffect)((()=>{t||E.current||(E.current=!0,c&&P.isNew&&(window.dispatchEvent(new CustomEvent("extendify-hc:minimize")),window.dispatchEvent(new CustomEvent("extendify::close-library")),e("page-creator-auto-open"),a(!0)),new URLSearchParams(window.location.search).has("ext-open-ai-creator")&&(a(!0),e("page-creator-search-param-auto-open")))}),[c,a,e,t,P.isNew]),(0,n.useEffect)((()=>{const t=new URLSearchParams(window.location.search),{pathname:r}=window.location;t.has("ext-page-creator-close")&&(a(!1),t.delete("ext-page-creator-close"),window.history.replaceState({},"",r+"?"+t.toString()),e("page-creator-search-param-auto-close")),t.has("ext-open")&&(window.dispatchEvent(new CustomEvent("extendify::open-library")),t.delete("ext-open"),window.history.replaceState({},"",r+"?"+t.toString()))}),[a,e]),(0,n.useEffect)((()=>{const e=()=>a(!0),t=()=>a(!1);return window.addEventListener("extendify::open-page-creator",e),window.addEventListener("extendify::close-page-creator",t),()=>{window.removeEventListener("extendify::open-page-creator",e),window.removeEventListener("extendify::close-page-creator",t)}}),[a]),(0,n.useEffect)((()=>{t&&(0,i.select)("core/edit-post").isFeatureActive("welcomeGuide")&&(0,i.dispatch)("core/edit-post").toggleFeature("welcomeGuide")}),[t]),t?(0,r.createElement)(b.Vq,{className:"extendify-page-creator extendify-page-creator-modal",open:t,static:!0,"aria-labelledby":"page-creator-modal",role:"dialog",onClose:()=>{}},(0,r.createElement)("div",{className:"mx-auto flex h-full w-full items-center justify-center pt-10 md:p-10"},(0,r.createElement)("div",{onClick:S,role:"button",tabIndex:0,"aria-label":(0,s.__)("Close AI Page Creator","extendify-local"),className:"fixed inset-0 bg-black/30",style:{backdropFilter:"blur(2px)"},"aria-hidden":"true"}),(0,r.createElement)(D.E.div,{key:"ai-page-generator-modal",initial:{y:30,opacity:0},animate:{y:0,opacity:1},exit:{y:0,opacity:0},transition:{duration:.3},className:"relative mx-auto h-full max-h-full w-full max-w-4xl rounded-lg bg-white shadow-2xl sm:flex sm:overflow-hidden md:h-auto"},(0,r.createElement)(b.$N,{className:"sr-only"},(0,s.__)("AI Page Creator","extendify-local")),(0,r.createElement)("div",{className:"relative flex w-full flex-col bg-white"},(0,r.createElement)(_,{openOnNewPage:c,updateUserOption:o,onClose:S}),(0,r.createElement)("div",{id:"extendify-page-creator-pages",className:"mx-8 flex-grow overflow-y-auto"},(0,r.createElement)(ze,{insertPage:async(t,a)=>{p();try{f&&(x("post-only"),await new Promise((e=>requestAnimationFrame(e)))),!(()=>{const{getBlocks:e}=(0,i.select)("core/block-editor"),t=e();return 1===t.length&&"core/paragraph"===t[0].name&&""===t[0].attributes?.content?.text})()&&P.isEmptyPost||g([]),await(async e=>{const{insertBlocks:t,replaceBlock:a}=(0,i.dispatch)("core/block-editor"),{getSelectedBlock:r,getBlockHierarchyRootClientId:n,getBlockIndex:o,getGlobalBlockCount:l}=(0,i.select)("core/block-editor"),{clientId:s,name:c,attributes:d}=r()||{},m=s?n(s):"",g=(m?o(m):l())+1;return"core/paragraph"===c&&""===d?.content?await a(s,e):await t(e,g)})(t),(0,i.dispatch)("core/editor").editPost({title:a}),e("page-creator-page-insert"),S(),h("info",(0,s.__)("Page added","extendify-local"),{isDismissible:!0,type:"snackbar"})}catch(e){console.error("Failed to insert page:",e),h("error",(0,s.__)("Failed to add page","extendify-local"),{isDismissible:!0,type:"snackbar"})}finally{f&&x("template-locked")}}})))))):null};var Be=a(5829),Ae=a(8239);(0,o.registerPlugin)("extendify-page-creator-buttons",{render:()=>(0,r.createElement)(Re,null)});const Re=()=>((0,n.useEffect)((()=>{if(!Ae.O||"page"!==window.wp.data.select("core/editor").getCurrentPostType())return;const e="extendify-page-creator-btn",t="extendify-page-creator";document.getElementById(e)||requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(document.getElementById(e))return;const a=document.createElement("div"),n=Object.assign(a,{id:e,className:t});document.querySelector(".edit-post-header-toolbar")?.append(n),document.querySelector(".edit-site-header-edit-mode__start")?.append(n),(0,Be.s)((0,r.createElement)(h,null),n);const o="extendify-page-creator-modal";if(document.getElementById(o))return;const i=document.createElement("div"),l=Object.assign(i,{id:o,className:t});document.body.append(l),(0,Be.s)((0,r.createElement)(Le,null),l)}))}))}),[]),null)},9196:e=>{e.exports=window.React},1850:e=>{e.exports=window.ReactDOM},6989:e=>{e.exports=window.wp.apiFetch},4981:e=>{e.exports=window.wp.blocks},5609:e=>{e.exports=window.wp.components},9818:e=>{e.exports=window.wp.data},2067:e=>{e.exports=window.wp.editPost},2238:e=>{e.exports=window.wp.editor},9307:e=>{e.exports=window.wp.element},2629:e=>{e.exports=window.wp.htmlEntities},5736:e=>{e.exports=window.wp.i18n},8817:e=>{e.exports=window.wp.plugins},444:e=>{e.exports=window.wp.primitives},6483:e=>{e.exports=window.wp.url}},e=>{e.O(0,[746,857],(()=>(9858,e(e.s=9858)))),e.O()}]);