()=>n.cancel()),[n]),n}var Do=o(6723),Fo=o.n(Do);const Mo=()=>React.createElement("div",{className:"spectra-ai flex items-start w-5 h-5"},React.createElement("span",{className:Fo().loaderDots}));function zo({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const Vo=i.forwardRef(zo);var Wo=o(8354);const Uo=({categoryName:e,onClick:r,disabled:n=!1,boxText:a,children:i})=>{const{remaining:o,pagesCategoryRate:s,patternsCategoryRate:l,currentBalanceStatus:c}=oi(),d=(0,t.A)((e=>{const{getCurrentScreen:t}=e(g.U);return t()}),[]),p="all-block-pages-grid"===d?s:l,m="all-block-pages-grid"===d?"page":"pattern",f=ot=>{f||"function"==typeof r&&(r(t),"function"==typeof e&&e())},b=e=>{window.open(ast_block_template_vars.get_more_credits_url,"_blank"),"function"==typeof e&&e()};return React.createElement(Ja,{trigger:({open:e})=>React.createElement("button",{className:(0,y.xW)("[&:has(.animate-none)]:!visible group-hover:visible flex items-center justify-center group border-0 focus:outline-none bg-transparent rounded cursor-pointer",!e&&"invisible"),disabled:n},i),placement:"right",width:"w-[15.5rem]",contentClassName:"border border-solid border-border-primary pt-3 pb-4 px-4 bg-white",offset:[13,5]},React.createElement(Ja.Item,null,(({close:t})=>React.createElement("div",{className:"w-full space-y-4",onClick:e=>{e.stopPropagation(),e.preventDefault()},role:"button",tabIndex:"0",onKeyDown:e=>{"Enter"===e.key&&(e.stopPropagation(),e.preventDefault())}},React.createElement("p",{className:"text-sm font-normal leading-[21px] text-body-text m-0 p-0"},"This will personalize the"," ",React.createElement("span",{className:"font-medium"},e)," ",m,"s again."),React.createElement("div",{className:"flex flex-col gap-2"},React.createElement(ii.A,{className:(0,y.xW)("w-full bg-background-tertiary text-accent-spectra !text-sm",f&&"bg-button-disabled text-secondary-text"),variant:"blank",onClick:h(t),isSmall:!0,disabled:f},a," (",(0,y.ZV)(p)," ","Credits)"),React.createElement("p",{className:(0,y.xW)("w-full m-0 p-0 text-sm font-normal text-secondary-text text-center",c.warning&&"text-credit-warning",c.danger&&"text-credit-danger")},o?.toLocaleString()," ",(0,u.__)("AI Credits remaining","astra-sites")),React.createElement("hr",{className:"border-t-border-primary border-b-0 my-2"}),React.createElement("div",{onClick:()=>b(t),className:"m-0 block text-sm font-normal !text-accent-spectra underline text-center",role:"button",tabIndex:"0",onKeyDown:e=>"Enter"===e.key?b(t):null},"astra-sites"))))))};function Ho({category:e,isActive:n,onClick:a,disableAi:o}){const[s,l]=(0,i.useState)(!1),{setDynamicContent:c,setNotice:u,dynamicContentFlagSet:d,dynamicContentSyncComplete:p,dynamicContentReSyncStatus:m,setCurrentCategory:f,setRegeneratingContentCategory:h,setCreditsDetails:b}=(0,r.A)(g.U),{dynamicContentSyncFlags:v,dynamicContentSyncStatus:w,currentScreen:x,allPatternsCategories:_,allPagesCategories:E,dynamicContent:k,reSyncStatus:S,regeneratingContentCategory:C,businessDetails:R,importInProgress:A}=(0,t.A)((e=>{const{getDynamicContentSyncFlags:t,getDynamicContentSyncStatus:r,getCurrentScreen:n,getAllPatternsCategories:a,getAllPagesCategories:i,getDynamicContent:o,getDynamicContentReSyncStatus:s,getRegeneratingContentCategory:l,getAIStepData:c,getImportInProgress:u}=e(g.U);return{dynamicContentSyncFlags:t(),dynamicContentSyncStatus:r(),currentScreen:n(),allPatternsCategories:a(),allPagesCategories:i(),dynamicContent:o(),reSyncStatus:s(),regeneratingContentCategory:l(),businessDetails:c()?.businessDetails,importInProgress:u()}}),[]),P="all-block-pages-grid"===x?"pages":"patterns",T=()=>{let t={};switch(x){case"all-block-pages-grid":t=v.pages;break;case"all-blocks-grid":t=v.patterns}return!(S||("favorite"!==e.id&&""!==e.id||!w[P])&&(!1!==t[e.id]||!w[P]))},N=Array.from(("pages"===P?E:_).reduce(((e,t)=>(e.has(t.id)||e.set(t.id,t),e)),new Map).values()),I=k&&Object.keys(k).length>0||!!R&&k&&!Object.keys(k).length,O="pages"===P&&!!k&&!k.hasOwnProperty(e.id),L=S&&C===e.id;return React.createElement("div",{className:(0,y.xW)("group flex items-center justify-between px-3 py-2 rounded text-base cursor-pointer hover:bg-background-tertiary transition duration-150 ease-in-out",n&&"bg-background-tertiary",A&&"disable-click-action"),onClick:a,role:"button",tabIndex:0,onKeyDown:e=>"Enter"===e.key?a():null},React.createElement("span",{className:(0,y.xW)("leading-6 inline-flex items-start gap-2 text-[0.92rem]",n?"text-nav-active font-medium":"text-nav-inactive font-normal")},e.name),React.createElement("span",{className:(0,y.xW)("leading-6 font-normal",n?"text-body-text":"text-secondary-text")},"Favorites"!==e.name&&(T()||L)&&React.createElement(Mo,null)),""!==e.id&&"favorite"!==e.id&&!T()&&!L&&!o&&I&&!w[P]&&React.createElement(Uo,{categoryName:e.name,onClick:async t=>{if(t.preventDefault(),t.stopPropagation(),s)return;if(S)return!1;if(!e)return;let r;r=e?.id&&e.name?`Personalizing "${e.name}"`:"Personalizing",u({type:"personalize",title:r,message:"Please wait a few moments. We are personalizing the selected category."}),h(e?.id??""),m(),l(!0);let n=!1;if(e?.id)try{n=await(async e=>{try{const t=new window.FormData;t.append("action","ast-block-templates-regenerate"),t.append("security",ast_block_template_vars.ai_content_ajax_nonce),t.append("category",e),t.append("regenerate",!0),t.append("block_type","all-blocks-grid"===x?"block":"page");const r=await(0,y.nr)({url:ast_block_template_vars.ajax_url,method:"POST",body:t});if(!r.success)throw new Error(r?.data?.data);if(r.success)return c(r.data.data),d(e,!0),b(r.data.spec_credit_details),!0;if("api_throttle_error"===r.data.code)throw r;return!1}catch(e){if((0,ti.v)(e),"api_throttle_error"===e.data.code)throw e;return!1}})(e?.id)}catch(e){n=e}else n=await(0,Wo.R2)(N,c,d,(e=>f(P,e)),b,"all-block-pages-grid"===x?"page":"block");l(!1),u("object"==typeof n&&"api_throttle_error"===n?.data?.code?{type:"error",title:"Check Back Soon",message:React.createElement(React.Fragment,null,"We are currently experiencing exceptionally high demand. Please try again in 5 minutes. If the error persists, kindly contact us through the website:",React.createElement("a",{href:"https://zipwp.com/contact",target:"_blank",rel:"noreferrer"}," ","https://zipwp.com/contact"),".")}:{type:n?"success":"error",title:n?"Library Personalized":"Library Personalization Failed",message:n?"Your library personalized successfully.":"Something went wrong, please try again"}),p(),m(),h(null)},disabled:s,boxText:"Personalize"},React.createElement("span",{className:(0,y.xW)("leading-6 inline-flex text-accent-spectra",s&&"animate-none")},O&&!s?React.createElement(Vo,{className:"h-5 w-5"}):React.createElement(ai.A,{className:"h-5 w-5"}))))}const $o=(0,e.A)((0,a.A)((e=>{const{getDisableAi:t,getLoadingBlocksAndSites:r}=e(g.U);return{disableAi:t(),loadingBlocksAndSites:r()}})))((0,i.memo)((({value:e,list:t,allCount:r,favoriteCount:n,onChange:a,hasSearchTerm:o,dynamicContentSyncFlags:s,disableAi:l,loadingBlocksAndSites:c})=>{let u=[{id:"",name:"All",count:r},...t];0===n&&(u=[{id:"",name:"All",count:r},...t]);const d=(0,i.useCallback)((t=>!o&&""===e&&""===t.id||e===t.id),[e,o]),p=e=>t=>{"function"==typeof a&&a(t,e)};return c?Array.from({length:5}).map(((e,t)=>React.createElement("div",{key:t,"data-placeholder":!0,className:"relative w-full h-10 rounded bg-gray-200"}))):React.createElement("div",{className:"spectra-ai flex flex-col flex-1 gap-1 overflow-auto -mx-1 p-0.5 scrollbar-hover"},u.map((e=>React.createElement(Ho,{key:e?.id,category:e,isActive:d(e),onClick:p(e),dynamicContentSyncFlags:s,disableAi:l}))))})));var Zo=o(860);const Go=(0,e.A)((0,a.A)((e=>{const{getFilterBlocksByCategory:t,getFilterBlocksByColor:r,getAllPatternsAndPages:n,getAllCategories:a}=e("astra-sites");return{filterBlocksByCategory:t(),filterBlocksByColor:r(),allPatterns:n()?.patterns,allCategories:a()}})),(0,n.A)((e=>{const{setFilterBlocksByCategory:t,setAllPatterns:r,setAllBlocksData:n}=e("astra-sites");return{setFilterBlocksByCategory:t,setAllPatterns:r,setAllBlocksData:n}})))((0,i.memo)((({filterBlocksByCategory:e,setFilterBlocksByCategory:r,allPatterns:n,allCategories:a})=>{const o=(0,i.useRef)(null),s={};let l=0;const{favorites:c}=(0,t.A)((e=>{const{getFavorites:t}=e("astra-sites");return{favorites:t()}}),[]);if(!n)return null;for(const e in a){let t=0;for(const r in n)a[e].id===n[r].category&&t++;0!==t&&(s[e]=a[e],s[e].count=t,l+=t)}const u=Object.keys(s).map((e=>s[e]));return React.createElement($o,{value:e,allCount:l,favoriteCount:c?.block?Object.keys(c?.block)?.length:0,list:u,onChange:(e,t)=>{""!==t.id?r(t.id):r(""),o.current!==t.id&&(o.current=t.id,Zo.A.emit("reset-list-count"))}})}))),qo=({selected:e,options:r,onChange:n,tabIndex:a})=>{const{importInProgress:i}=(0,t.A)((e=>{const{getImportInProgress:t}=e(g.U);return{importInProgress:t()}}),[]);return React.createElement("div",{className:"flex items-center gap-4"},Object.values(r).map(((t,r)=>{const o=t.title||"",s=t.default_color||"";return React.createElement("div",{key:r,className:(0,y.xW)("w-6 h-6 rounded-full cursor-pointer",t.slug===e?"ring-2 ring-offset-4 ring-accent-spectra":"",i&&"disable-click-action"),onClick:e=>{n(e,t)},onKeyDown:e=>{((e,t)=>{38===(e=e||window.event).keyCode?e.target.previousSibling&&e.target.previousSibling.focus():40===e.keyCode?e.target.nextSibling&&e.target.nextSibling.focus():13===e.keyCode&&n(e,t)})(e,t)},tabIndex:a,role:"button"},React.createElement("span",{className:"sr-only"},o),React.createElement("div",{className:"w-full h-full rounded-full border border-solid border-black/[0.12]",style:{backgroundColor:s}}))})))},Yo=(0,e.A)((0,a.A)((e=>{const{getDefaultBlockColorPalette:t,getActiveBlockPalette:r,getActiveBlockPaletteSlug:n,getDefaultPageColorPalette:a,getActivePagePalette:i,getActivePagePaletteSlug:o,getCurrentScreen:s,getBlockColorPaletteObj:l,getPageColorPaletteObj:c}=e(g.U);return{defaultBlockPalette:t(),activeBlockPalette:r(),activeBlockPaletteSlug:n(),defaultPagePalette:a(),activePagePalette:i(),activePagePaletteSlug:o(),currentScreen:s(),blockColorPaletteObj:l(),pageColorPaletteObj:c()}})),(0,n.A)((e=>{const{setActiveBlockPalette:t,setActiveBlockPaletteSlug:r,setActivePagePalette:n,setActivePagePaletteSlug:a}=e(g.U);return{setActiveBlockPalette:t,setActiveBlockPaletteSlug:r,setActivePagePalette:n,setActivePagePaletteSlug:a}})))((0,i.memo)((({setActiveBlockPalette:e,activeBlockPaletteSlug:t,setActiveBlockPaletteSlug:r,setActivePagePalette:n,activePagePaletteSlug:a,setActivePagePaletteSlug:i,currentScreen:o,blockColorPaletteObj:s,pageColorPaletteObj:l})=>{const c=s,d=l;return React.createElement("div",{className:"flex items-center justify-between gap-7 px-2 py-1 min-h-[2rem]"},React.createElement("span",{className:"text-base font-semibold leading-6 text-heading-text"},(0,u.__)("Color Styles: ","astra-sites")),React.createElement(qo,{selected:"all-blocks-grid"===o?t:a,options:"all-blocks-grid"===o?c:d,onChange:(t,a)=>{((t,a)=>{a&&("all-blocks-grid"===o?(r(a.slug),e(a)):(i(a.slug),n(a)))})(0,a)},tabIndex:"0",type:"others"}))})));function Ko(){return Ko=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{ref:E,...k}=Jo((()=>"function"==typeof w?w(i,o):{}),[i,w,o]),{importInProgress:S}=(0,t.A)((e=>{const{getImportInProgress:t}=e(g.U);return{importInProgress:t()}}),[]);return React.createElement("div",{className:r},s&&React.createElement("label",{htmlFor:i,className:(0,y.xW)("text-sm font-medium text-zip-app-heading",u)},s,o?.required&&React.createElement("span",{className:"text-alert-error"}," *")),React.createElement("div",{className:"flex relative items-center"},m&&React.createElement("div",{className:h},m),React.createElement("div",{className:(0,y.xW)(v?"relative overflow-hidden flex justify-start items-center":"w-full")},React.createElement("input",Ko({ref:e=>{if(e&&"function"==typeof E&&E(e),_)switch(typeof _){case"function":_(e);break;case"object":_.current=e}},name:i,disabled:e,className:(0,y.xW)("w-full px-[1rem] placeholder:text-secondary-text rounded-md outline-none text-sm placeholder:!text-sm",`h-${c}`,s?"mt-2":"",l?"bg-transparent":"px-3 border border-solid focus:ring-1 focus:ring-accent-st",a?(l?"":"shadow-error")+" border-alert-error focus:border-accent-st":(l?"":"shadow-sm")+" border-border-primary focus:border-accent-st",v&&"absolute left-0 min-w-[50px]",e?"cursor-not-allowed":"",n,S&&"disable-click-action"),onChange:d?(0,y.sg)(p,500):p},x,k)),v&&React.createElement("span",{className:"invisible inline whitespace-pre text-[0.9rem]"},x.value||x.placeholder)),f&&React.createElement("div",{className:b},f)),a&&React.createElement("div",{className:"mt-1 text-sm text-alert-error "},a.message))})),es=({className:e})=>{const{searchString:n}=(0,t.A)((e=>{const{getFilterBlocksBySearchTerm:t,getFilterBlocksPagesBySearchTerm:r,getCurrentScreen:n,getFilterSitesBySearchTerm:a,getFilterFavoritres:i}=e(g.U);return"all-sites-grid"===n()?{searchString:a()}:"all-block-pages-grid"===n()?{searchString:r()}:"all-favorites"===n()?{searchString:i()}:{searchString:t()}})),{setFullWidthBlockPreview:a,setFilterBlocksBySearchTerm:i,setFilterBlocksPagesBySearchTerm:o,setFilterSitesBySearchTerm:s,setFilterFavoritres:l}=(0,r.A)(g.U),c=(0,t.A)((e=>e(g.U).getCurrentScreen()));return React.createElement(Qo,{className:(0,y.xW)("w-full",e),inputClassName:"bg-background-secondary !border-transparent !text-base pr-9 focus:ring-accent-spectra",placeholder:"Search...",suffixIcon:n?.trim()?React.createElement("button",{onClick:()=>{i(""),o(""),s(""),l(""),Zo.A.emit("reset-list-count")},className:"flex items-center justify-center h-5 w-5 border-0 focus:outline-none bg-transparent cursor-pointer"},React.createElement(f,{className:"w-5 h-5 text-icon-secondary"})):React.createElement(ko,{className:"w-5 h-5 text-icon-secondary"}),suffixIconClassName:(0,y.xW)(!n?.trim()&&"pointer-events-none","absolute right-4 flex items-center"),height:"[2.8rem]",value:n,onChange:e=>{switch(a({}),Zo.A.emit("reset-list-count"),c){case"all-sites-grid":s(e.target.value);break;case"all-block-pages-grid":o(e.target.value);break;case"all-favorites":l(e.target.value);break;default:i(e.target.value)}},prefixIconClassName:"absolute left-4 flex items-center"})};function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{adaptiveMode:n}=(0,t.A)((e=>{const{getAdaptiveMode:t}=e(g.U);return{adaptiveMode:t()}}));return React.createElement("div",ts({className:(0,y.xW)("spectra-ai w-full lg:max-w-[280px] self-stretch bg-white border-0 border-r border-solid border-border-primary md:max-lg:max-w-[246px] xl:max-w-[280px] lg:max-xl:max-w-[260px] hidden sm:block max-w-60",e)},r),React.createElement("div",{className:"h-full w-full flex flex-col gap-5 py-5 px-4"},React.createElement(es,null),React.createElement(Qa,{className:"mx-2"}),React.createElement(Go,null),n&&React.createElement("div",{className:"mt-auto space-y-5 min-h-[3.125rem]"},React.createElement(Qa,{className:"mx-2"}),React.createElement(Yo,null))))}));var as=o(4848),is=[640,786,1024,1280,1536],os=(e,t)=>{let r=Object.keys((e=>Array.isArray(e)?(e=>e.reduce(((e,t,r)=>"number"!=typeof t?e:{...e,[is[r]]:t}),{}))(e):e)(e)).map(Number).sort(((e,t)=>e-t)),n=null;for(let e of r)t>e&&(n=e);return null!=n?n:r[0]},ss=e=>{let t="object"==typeof e,r=((e=!0)=>{let[t,r]=(0,i.useState)(window.innerWidth),n=(0,i.useCallback)((()=>{r(window.innerWidth)}),[]);return(0,i.useEffect)((()=>(e?window.addEventListener("resize",n):window.removeEventListener("resize",n),()=>{window.removeEventListener("resize",n)})),[e,n]),t})(t);return(0,i.useMemo)((()=>{var n;if(!t)return null!=e?e:3;let a=os(e,r);return null!=(n=e[a])?n:3}),[t,r,e])},ls=(0,i.createContext)({column:0,position:0}),cs=(0,i.forwardRef)(((e,t)=>{let{gap:r,as:n="div",columnProps:a,columns:o,...s}=e,l=(0,i.useId)(),c=((e,t)=>{let r=ss(t);return(0,i.useMemo)((()=>{let t=(e=>Array.from({length:e},(()=>[])))(r);return i.Children.forEach(e,((e,n)=>{(0,i.isValidElement)(e)&&t[n%r].push(e)})),t}),[r,e])})(e.children,o);return(0,as.jsx)(n,{"data-masonry-id":`Masonry-${l}`,...s,style:{display:"flex",gap:r,...s.style},ref:t,children:c.map(((e,t)=>(0,as.jsx)(n,{"data-masonry-column":t+1,...a,style:{display:"flex",flex:1,flexDirection:"column",gap:r,...null==a?void 0:a.style},children:e.map(((e,r)=>(0,as.jsx)(ls.Provider,{value:{column:t,position:r},children:e},`Masonry__Column_Child_${l}_${r}`)))},`Masonry__Column_${l}_${t}`)))})})),us=cs;function ds({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m15.75 10.5 4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25Z"}))}const ps=i.forwardRef(ds),ms=({videoIntroURL:e,className:t})=>React.createElement("a",{className:(0,y.xW)("no-underline text-[#111827] hover:text-[#111827] items-center gap-2 focus:shadow-none","2xl:mr-5",t),href:e,target:"_blank",rel:"noreferrer"},React.createElement(ps,{className:"w-4 h-4"}),React.createElement("span",{className:"underline text-inherit hover:text-inherit"},"How it works?")),fs=({type:e,icon:t,message:r,ctaLink:n,ctaText:a,rounded:i=0,onClose:o,className:s,isClose:l=!0,hasVideoIntro:c=!1,videoIntroURL:u})=>{const d={success:{text:"text-heading-text",icon:"text-[#0BC16A]",background:"bg-[#0BC16A]/[0.08]"},warning:{text:"text-heading-text",icon:"text-credit-warning",background:"bg-credit-warning/5"},error:{text:"text-heading-text",icon:"text-credit-danger",background:"bg-credit-danger/5"},info:{text:"text-heading-text",icon:"text-accent-spectra",background:"bg-background-tertiary"},notice:{text:"text-heading-text",icon:"text-credit-notice",background:"bg-[#E6FFFA]"}};return React.createElement("div",{className:(0,y.xW)("px-10 py-5 flex justify-between",d[e]?.background,{0:"rounded-none",4:"rounded",6:"rounded-md",8:"rounded-lg"}[i],s)},React.createElement("div",{className:"flex items-center gap-2 flex-grow max-2xl:items-start"},React.createElement("div",{className:(0,y.xW)("flex items-center",d[e]?.icon)},!!t&&t),React.createElement("div",{className:"flex-1 flex justify-start items-center gap-3"},React.createElement("div",{className:(0,y.xW)("text-sm m-0",d[e]?.text)},!!r&&r),React.createElement("div",{className:"text-sm m-0"},!!n&&React.createElement("a",{href:n,target:"_blank",className:"whitespace-nowrap font-normal !text-accent-spectra",rel:"noreferrer"},!!a&&a)),l&&React.createElement("button",{onClick:e=>{"function"==typeof o&&o(e)},className:"ml-auto bg-transparent border-0 focus:outline-none cursor-pointer p-2"},React.createElement(f,{className:"w-5 h-5 text-heading-text"})))),c&&u&&React.createElement(ms,{className:"flex max-2xl:hidden",videoIntroURL:u}))};function gs({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"}))}const hs=i.forwardRef(gs);function ys({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const bs=i.forwardRef(ys);var vs=o(6156);function ws(){return ws=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{className:t,wrapperClass:r,open:n,children:a,onClose:i,...o}=e;return React.createElement("div",ws({className:(0,y.xW)("absolute w-full h-full z-[99999] transition-transform bg-gray-500/50",n?"":"-translate-x-full",t)},o),React.createElement(ii.A,{onClick:()=>i(),className:"absolute right-4 top-4 bg-white rounded-full p-4 px-3",variant:"blank"},React.createElement(f,{className:"size-6"})),React.createElement("div",{className:(0,y.xW)("bg-white h-full shadow-xl w-3/4",r)},a))},_s=(0,e.A)((0,n.A)((e=>{const{setFilterBlocksBySearchTerm:t,setFilterBlocksByCategory:r,setActiveBlockPalette:n,setHideNotice:a,toggleOnboardingAIStep:i}=e(g.U);return{setFilterBlocksByCategory:r,setFilterBlocksBySearchTerm:t,setActiveBlockPalette:n,setHideNotice:a,toggleOnboardingAIStep:i}})),(0,a.A)((e=>{const{getAllPatterns:t,getAllCategories:r,getFilterBlocksByCategory:n,getFilterBlocksByColor:a,getDefaultBlockColorPalette:i,getActiveBlockPalette:o,getDynamicContent:s,getAIStepData:l,getFilterBlocksBySearchTerm:c,getDynamicContentSyncStatus:u,getDynamicContentSyncFlags:d,getAllPatternsCategories:p,getDynamicContentReSyncStatus:m,getRegeneratingContentCategory:f,getAdaptiveMode:h,getHideNotice:y,getSkipZipAIOnboarding:b,getDisableAi:v,getIsSyncBusinessDetails:w}=e(g.U);return{filterBlocksByCategory:n(),filterBlocksByColor:a(),allPatterns:t(),defaultPalette:i(),activePalette:o(),dynamicContent:s(),selectedImages:l().selectedImages,allCategories:r(),searchTerm:c(),syncStatus:u()?.patterns,syncFlags:d(),allPatternsCategories:p(),reSyncStatus:m(),regeneratingContentCategory:f(),adaptiveMode:h(),hideNotice:y(),skipZipAIOnboarding:b(),disableAi:v(),isSyncBusinessDetails:w()}})))((0,i.memo)((({filterBlocksByCategory:e,allPatterns:r,allPatternsCategories:n,defaultPalette:a,activePalette:o,dynamicContent:s,selectedImages:l,syncFlags:c,syncStatus:d,searchTerm:p,reSyncStatus:m,regeneratingContentCategory:f,adaptiveMode:h,hideNotice:b,setHideNotice:v,toggleOnboardingAIStep:w,disableAi:x,isSyncBusinessDetails:_})=>{const[E,k]=(0,i.useState)(!1),S=r,C="https://youtu.be/Zpkgw9USlEc",{stepsData:{businessContact:R,businessDetails:A,token:P},allPatternsAndPages:T,loadingBlocksAndSites:N}=(0,t.A)((e=>{const{getAIStepData:t,getAllPatternsAndPages:r,getLoadingBlocksAndSites:n}=e(g.U);return{stepsData:t(),allPatternsAndPages:r(),loadingBlocksAndSites:n()}})),{currentBalanceStatus:I,remaining:O}=oi(),L=n.slice(0,2).map((({name:e})=>e)).join(", "),B=(0,y._9)("ast-free-ai-content",!1),j={show:!!B&&I.warning&&I.danger||I.warning&&!b.creditWarning||I.danger&&!b.creditDanger||!1,variantAndType:!!B&&{variant:"success",type:"freeAiContent"}||I.warning&&{variant:"warning",type:"creditWarning"}||I.danger&&{variant:"error",type:"creditDanger"},message:!!B&&`Your ${L} content is ready to shine. Ready to personalize the your entire library?`||0===O&&"You're out of AI credits. Personalize the design library with content and images tailored to your website project"||(I.warning||I.danger)&&"You're almost out of AI credits. Personalize the design library with content and images tailored to your website project"};(0,i.useEffect)((()=>{Zo.A.on("reset-list-count",(()=>F(10)))}),[]);const[D,F]=(0,i.useState)(10),M=Object.keys(o).length>0?o.colors:a.colors,z=jo((()=>{if(H())return;const e=p&&!S.length?T.patterns:S;window.innerHeight+window.scrollY>=document.body.offsetHeight-500&&e.length>D&&F((e=>e+10))}),200),V=S.slice(0,D),W=e=>Math.floor(e/3)+1,U=()=>{if(""===e){const e=n.reduce(((e,t)=>(t.count,null)),0);return e>10?e:10}const t=n.find((t=>t.id===e)),r=t?.count?t.count:10;return t?.count>10?10:r},H=()=>!!N||!(!m||f!==e)||!(!m||""!==f)||!!d&&!(!d||(!Object.values(c.patterns).every((e=>!1===e))||""!==e)&&(""===e||!Object.keys(c.patterns).map(Number).includes(e)||c.patterns[e])),$=e=>()=>{(0,y.D6)("ast-free-ai-content"),v({[e]:!0}),"freeAiContent"!==e&&(0,Wo.yL)(e)},Z=V?.length||""===p?[]:T.patterns,G=(0,i.useMemo)((()=>(()=>{let e=1,t=0;return()=>{return e>3&&(e=1),t===U()-1&&(t=0),React.createElement(no,{key:t,type:(r=W(t++),n=e++,[1,2,3][(n-1+(r-1)%3)%3])});var r,n}})()),[]);return React.createElement("div",{className:"relative ast-block-templates-grid-blocks active h-full"},React.createElement(ii.A,{className:"absolute right-4 bottom-8 z-[9999] py-2 px-3.5 bg-accent-spectra shadow-xl sm:hidden",onClick:()=>k(!0)},React.createElement(hs,{className:"size-5 text-white"})),React.createElement(xs,{open:E,onClose:()=>k(!1),className:"sm:hidden",children:React.createElement(ns,{className:"block sm:hidden h-full !w-full",style:{maxWidth:"100%"}})}),React.createElement(ns,null),React.createElement("div",{onScroll:z,className:"ast-scrolling-container w-full md:ml-auto h-full overflow-auto md:max-w-[calc(100%_-_246px)]"},j.show&&P&&React.createElement(fs,{type:j.variantAndType.variant,message:j.message,icon:"success"===j.variantAndType.variant?React.createElement(bs,{className:"w-6 h-6"}):React.createElement(vs.A,{className:"w-6 h-6"}),ctaLink:ast_block_template_vars.get_more_credits_url,ctaText:(0,u.__)("Buy AI Credits","astra-sites"),onClose:$(j.variantAndType.type)}),!b.personalizeAi&&P&&(!A||A&&"yes"===_)&&!x&&!p&&!I.warning&&!I.danger&&React.createElement(fs,{className:"pl-6 py-4 !pr-0 mx-10 mt-9 md:max-lg:mx-5 hidden sm:block",rounded:8,type:"info",message:React.createElement("div",{className:"grid grid-cols-4 grid-rows-2 2xl:grid-rows-1 items-center justify-start gap-2 max-2xl:items-start"},React.createElement("span",{className:"col-span-12 2xl:col-span-4 "},(0,u.__)("Did you know, you can personalize this design library with content and images tailored to your website project?","astra-sites")),React.createElement("div",{className:"col-span-12 2xl:col-start-5 flex flex-col md:flex-row gap-5 items-baseline md:items-center"},React.createElement(ii.A,{id:"ast-block-template-setup-ai-btn",className:"min-w-fit",variant:"primary",isSmall:!0,onClick:()=>{$("personalizeAi")(),w(!0)}},"Personalize Library with AI"),C&&React.createElement(ms,{className:"flex 2xl:hidden",videoIntroURL:C}))),icon:React.createElement(Vo,{className:"w-6 h-6"}),onClose:$("personalizeAi"),isClose:!1,hasVideoIntro:!0,videoIntroURL:C}),React.createElement("div",{className:"h-full w-full p-10 md:max-lg:p-6"},!V.length&&""!==p&&React.createElement("div",{className:"pb-4"},React.createElement(So,{keyword:p}),React.createElement("h6",{className:"m-0 mt-10 text-heading-text text-xl font-semibold leading-7"},"Other suggested pattern designs")),React.createElement(us,{columns:{640:1,768:2,1024:3},gap:32,className:"ast-block-templates-grid",id:"ast-block-templates-grid-blocks"},(()=>{if(H()){const e=U();return Array(e>10?10:e).fill(1)}const e=Object.entries(c.patterns);return!m&&d&&e.some((([,e])=>!1===e))?V.filter((e=>!1!==c.patterns[e.category])):V.length||""===p?V:Z.slice(0,D)})()?.map(((e,t)=>((e,t)=>H()?G():React.createElement(io,{key:e.ID,index:t,item:e,content:e.content,stylesheet:e.stylesheet,astraCustomizer:h?ast_block_template_vars.astra_customizer_css:ast_block_template_vars.server_astra_customizer_css,globalStylesheet:e.global_stylesheet,colorPalette:M,dynamicContent:s[e.category]??[],selectedImages:l,email:R.email,phone:R.phone,address:R.address}))(e,t)))),React.createElement("div",{className:"h-10 w-full mb-10"}))))}))),{post:Es}=wp.ajax,{parse:ks}=wp.blocks,Ss=(e,t,r,n,a,i,o,s)=>{Es({action:"ast_block_templates_kit_importer",api_uri:e,id:s,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((e=>{!function(e,t,r,n,a,i,o){Es({action:"ast_block_templates_import_template_kit",content:e,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((e=>{n(ks(e),t,r),"function"==typeof i&&i(),a(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open");const o=(0,y.Fx)();(o.notInstalled||o.inactive)&&(0,Wo.mP)()})).fail((()=>{"function"==typeof o&&o()}))}(e,n,a,t,r,i,o)})).fail((e=>{h("fail",e),"function"==typeof o&&o()}))};var Cs=o(9431),Rs=o(9392),As=o(2944),Ps=o(5446),Ts=o(4715);const{post:Ns}=wp.ajax,Is=(0,i.memo)((({className:e,disabled:n})=>{const{insertBlocks:a}=wp.data.dispatch("core/block-editor"),{pagePreview:o}=(0,t.A)((e=>{const{getPagePreview:t}=e(g.U);return{pagePreview:t()}}),[]),{setTogglePopup:s,setImportInProgress:l}=(0,r.A)(g.U);let c=[];const[d,p]=(0,i.useState)(!1),[m,f]=(0,i.useState)(!1),h=(0,i.useRef)(null),b=o,v=o["required-plugins"]?o["required-plugins"].filter((e=>"wpforms-lite"===e.slug)):[],w=(0,y.Fx)(),{insertIndex:x,insertClientID:_}=wp.data.useSelect((e=>{const{index:t,rootClientId:r}=e("core/block-editor").getBlockInsertionPoint();return{insertIndex:t,insertClientID:r}}),[]),E=({title:e,message:t,type:r})=>{if(!h.current)return h.current=(0,Ps.oR)((0,Ts.A)({title:e,message:t}),Ts.A.getOptions({type:r}));Ps.oR.update(h.current,{...Ts.A.getOptions({type:r}),render:(0,Ts.A)({title:e,message:t})})},k=()=>{E({title:"Failed!",message:"Failed to insert template.",type:"error"})},S=async()=>{try{await(0,Cs.s)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"})}catch(e){R(!1),k()}},C=()=>{(0,Cs.s)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((()=>{A()})).catch((()=>{R(!1),k()}))},R=e=>{p(e),l(e)},A=()=>{const e=c["astra-site-wpforms-path"]||"",t=c["site-pages-required-plugins"]&&c["site-pages-required-plugins"].some((e=>"wpforms-lite"===e.slug));e&&t?P(e):Ss(b["astra-page-api-url"],a,s,x,_,(()=>{R(!1),E({title:"Template Inserted",message:"Template inserted successfully.",type:"success"})}),k,b?.ID)},P=()=>{Ns({action:"ast_block_templates_import_wpforms",id:b.ID,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((()=>{Ss(b["astra-page-api-url"],a,s,x,_)})).fail((()=>{R(!1),k()}))},T=async()=>{d||n||(p(!0),l(!0),E({title:"Inserting Template..",message:"Inserting selected template.",type:"importing-site"}),w.notInstalled?await(async()=>{try{await(0,Cs.o)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}),await S()}catch(e){R(!1),k()}})():w.inactive&&await S(),(0,Rs.V)(b.ID,"site-pages").then((e=>{c=e,v.length?"not-installed"===ast_block_template_vars.wpforms_status?(0,Cs.o)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((()=>{C()})).catch((()=>{R(!1),k()})):"inactive"===ast_block_template_vars.wpforms_status?C():A():A()})))};return React.createElement(React.Fragment,null,React.createElement(ii.A,{className:(0,y.xW)("lg:grow-[2] w-full lg:w-auto min-w-fit",e),variant:"primary",hasSuffixIcon:w.active,onClick:()=>{if(!n)return"yes"===o["dynamic-page"]?f(!0):void T()},disabled:n||d},w.notInstalled?(0,u.__)("Install Spectra & Insert","astra-sites"):w.inactive?(0,u.__)("Activate Spectra & Insert","astra-sites"):React.createElement(React.Fragment,null,React.createElement("span",{className:"hidden sm:inline"},"Insert Template"),React.createElement(As.A,{className:"sm:size-5 size-6"}))),React.createElement(Wi,{open:m,setOpen:f,title:"Heads Up!",description:(0,u.__)("This template includes dynamic content that won't carry over with the import. You'll need to manually add this dynamic data to the page.","astra-sites"),confirmBtnTitle:(0,u.__)("Skip & Import"),cancelBtnTitle:(0,u.__)("Cancel"),onClickConfirm:()=>{f(!1),T()},onClickCancel:()=>f(!1),variant:"info"}))}));o(1032);const Os=(0,e.A)((0,a.A)((e=>{const{getDisplayDynamicPopup:t,getPagePreview:r}=e(g.U);return{pagePreview:r(),displayDynamicPopup:t()}})),(0,n.A)((e=>{const{setDisplayDynamicPopup:t}=e("astra-sites");return{setDisplayDynamicPopup:t}})))((0,i.memo)((({pagePreview:e,displayDynamicPopup:t,setDisplayDynamicPopup:r})=>{const n=!1===t?"hide":"",a=()=>{r(!1)},o=e=>{e.target===document.querySelector(".ast-block-templates-popup-wrap")&&a()};return(0,i.useEffect)((()=>(document.addEventListener("click",o),()=>{document.removeEventListener("click",o)}))),React.createElement(i.Fragment,null,React.createElement("div",{className:`ast-block-templates-popup-wrap ${n}`},React.createElement("div",{className:"ast-block-templates-popup"},React.createElement("div",{className:"ast-block-templates-popup-header"},React.createElement("h3",{className:"ast-block-templates-popup-heading"},(0,u.__)("Heads Up!","astra-sites")),React.createElement("span",{className:"ast-block-templates-popup-close-icon",onClick:a,role:"button",tabIndex:0,onKeyDown:a},React.createElement("span",{className:"dashicons close dashicons-no-alt"}))),React.createElement("div",{className:"ast-block-templates-popup-content"},React.createElement("p",null,(0,u.__)("The page template you are about to import contains a dynamic widget/module. Please note this dynamic data will not be available with the imported page.","astra-sites")),React.createElement("p",null,(0,u.__)("You will need to add it manually on the page.","astra-sites"))),React.createElement("div",{className:"ast-block-templates-popup-footer"},React.createElement(Is,{title:(0,u.nv)((0,u.__)('Skip & Import "%s" Page',"astra-sites"),e.title),item:e}),React.createElement("div",{className:"button",onClick:a,role:"button",tabIndex:0,onKeyDown:a},(0,u.__)("Cancel","astra-sites"))))))}))),Ls=(0,e.A)((0,a.A)((e=>{const{getPagePreview:t,getImportInProgress:r}=e("astra-sites");return{pagePreview:t(),importInProgress:r()}})),(0,n.A)((e=>{const{setPagePreview:t,setFullWidthPagePreview:r,setCurrentScreen:n,setImportItemInfo:a}=e("astra-sites");return{setImportItemInfo:a,setPagePreview:t,updateFullWidthPagePreview(e){r(e),n("full-width-page-preview")}}})))((0,i.memo)((({item:e,pagePreview:t,setPagePreview:r,setImportItemInfo:n,importInProgress:a})=>{const i=e["thumbnail-image-url"]||`${ast_block_template_vars.uri}dist/placeholder.png`;return React.createElement("div",{className:(0,y.xW)("w-full content-start relative"),onClick:()=>{a||(n(e),r(e))}},React.createElement("div",{className:(0,y.xW)("relative cursor-pointer",a&&"cursor-not-allowed pointer-events-none")},React.createElement("div",{className:(0,y.xW)("bg-top bg-cover bg-no-repeat overflow-hidden bg-gray-300 block aspect-[6/7]"),style:{backgroundImage:`url('${i}')`}},React.createElement("div",{className:(0,y.xW)("absolute top-0 left-0 w-full h-full cursor-pointer opacity-0 invisible float-none transition-all duration-300 bg-black bg-opacity-50")},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"}))),React.createElement("div",{className:(0,y.xW)("absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end overflow-hidden border border-solid border-border-primary transition duration-150 ease-in-out",t.ID===e.ID?"border-accent-spectra shadow-large":"")},React.createElement("div",{className:(0,y.xW)("w-full flex items-center justify-between gap-3 py-2 pl-4 pr-3 bg-white/95 shadow-action-buttons backdrop-blur-[3px]")},React.createElement("div",null,React.createElement("p",{className:(0,y.xW)("title","m-0 text-base text-heading-text font-semibold leading-6")},(0,Wo.iZ)(e.title)))))))})));var Bs=o(4361);function js({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const Ds=i.forwardRef(js);function Fs({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const Ms=i.forwardRef(Fs),zs=({className:e})=>React.createElement("span",{className:(0,y.xW)("py-1 px-2 text-xs leading-3 text-heading-text font-semibold rounded bg-premium-badge uppercase",e)},"Premium");var Vs=o(9260),Ws=e=>"checkbox"===e.type,Us=e=>e instanceof Date,Hs=e=>null==e;const $s=e=>"object"==typeof e;var Zs=e=>!Hs(e)&&!Array.isArray(e)&&$s(e)&&!Us(e),Gs=e=>Zs(e)&&e.target?Ws(e.target)?e.target.checked:e.target.value:e,qs=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Ys=e=>{const t=e.constructor&&e.constructor.prototype;return Zs(t)&&t.hasOwnProperty("isPrototypeOf")},Ks="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Xs(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Ks&&(e instanceof Blob||e instanceof FileList)||!r&&!Zs(e))return e;if(t=r?[]:{},r||Ys(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Xs(e[r]));else t=e}return t}var Js=e=>Array.isArray(e)?e.filter(Boolean):[],Qs=e=>void 0===e,el=(e,t,r)=>{if(!t||!Zs(e))return r;const n=Js(t.split(/[,[\].]+?/)).reduce(((e,t)=>Hs(e)?e:e[t]),e);return Qs(n)||n===e?Qs(e[t])?r:e[t]:n},tl=e=>"boolean"==typeof e,rl=e=>/^\w*$/.test(e),nl=e=>Js(e.replace(/["|']|\]/g,"").split(/\.|\[/)),al=(e,t,r)=>{let n=-1;const a=rl(t)?[t]:nl(t),i=a.length,o=i-1;for(;++nZs(e)&&!Object.keys(e).length,ul=e=>Array.isArray(e)?e:[e];var dl=e=>"string"==typeof e,pl=(e,t,r,n,a)=>dl(e)?(n&&t.watch.add(e),el(r,e,a)):Array.isArray(e)?e.map((e=>(n&&t.watch.add(e),el(r,e)))):(n&&(t.watchAll=!0),r),ml=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},fl=e=>({isOnSubmit:!e||e===ol.onSubmit,isOnBlur:e===ol.onBlur,isOnChange:e===ol.onChange,isOnAll:e===ol.all,isOnTouch:e===ol.onTouched}),gl=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const hl=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=el(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)break;if(e.ref&&t(e.ref,e.name)&&!n)break;hl(i,t)}else Zs(i)&&hl(i,t)}}};var yl=(e,t,r)=>{const n=Js(el(e,r));return al(n,"root",t[r]),al(e,r,n),e},bl=e=>"file"===e.type,vl=e=>"function"==typeof e,wl=e=>{if(!Ks)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},xl=e=>dl(e),_l=e=>"radio"===e.type,El=e=>e instanceof RegExp;const kl={value:!1,isValid:!1},Sl={value:!0,isValid:!0};var Cl=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Qs(e[0].attributes.value)?Qs(e[0].value)||""===e[0].value?Sl:{value:e[0].value,isValid:!0}:Sl:kl}return kl};const Rl={isValid:!1,value:null};var Al=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Rl):Rl;function Pl(e,t,r="validate"){if(xl(e)||Array.isArray(e)&&e.every(xl)||tl(e)&&!e)return{type:r,message:xl(e)?e:"",ref:t}}var Tl=e=>Zs(e)&&!El(e)?e:{value:e,message:""},Nl=async(e,t,r,n,a)=>{const{ref:i,refs:o,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:m,name:f,valueAsNumber:g,mount:h,disabled:y}=e._f,b=el(t,f);if(!h||y)return{};const v=o?o[0]:i,w=e=>{n&&v.reportValidity&&(v.setCustomValidity(tl(e)?"":e||""),v.reportValidity())},x={},_=_l(i),E=Ws(i),k=_||E,S=(g||bl(i))&&Qs(i.value)&&Qs(b)||wl(i)&&""===i.value||""===b||Array.isArray(b)&&!b.length,C=ml.bind(null,f,r,x),R=(e,t,r,n="maxLength",a="minLength")=>{const o=e?t:r;x[f]={type:e?n:a,message:o,ref:i,...C(e?n:a,o)}};if(a?!Array.isArray(b)||!b.length:s&&(!k&&(S||Hs(b))||tl(b)&&!b||E&&!Cl(o).isValid||_&&!Al(o).isValid)){const{value:e,message:t}=xl(s)?{value:!!s,message:s}:Tl(s);if(e&&(x[f]={type:ll,message:t,ref:v,...C(ll,t)},!r))return w(t),x}if(!(S||Hs(u)&&Hs(d))){let e,t;const n=Tl(d),a=Tl(u);if(Hs(b)||isNaN(b)){const r=i.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,l="week"==i.type;dl(n.value)&&b&&(e=s?o(b)>o(n.value):l?b>n.value:r>new Date(n.value)),dl(a.value)&&b&&(t=s?o(b)n.value),Hs(a.value)||(t=r+e.value,a=!Hs(t.value)&&b.length<+t.value;if((n||a)&&(R(n,e.message,t.message),!r))return w(x[f].message),x}if(p&&!S&&dl(b)){const{value:e,message:t}=Tl(p);if(El(e)&&!b.match(e)&&(x[f]={type:sl,message:t,ref:i,...C(sl,t)},!r))return w(t),x}if(m)if(vl(m)){const e=Pl(await m(b,t),v);if(e&&(x[f]={...e,...C("validate",e.message)},!r))return w(e.message),x}else if(Zs(m)){let e={};for(const n in m){if(!cl(e)&&!r)break;const a=Pl(await m[n](b,t),v,n);a&&(e={...a,...C(n,a.message)},w(a.message),r&&(x[f]=e))}if(!cl(e)&&(x[f]={ref:v,...e},!r))return x}return w(!0),x};function Il(e,t){const r=Array.isArray(t)?t:rl(t)?[t]:nl(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},Ll=e=>Hs(e)||!$s(e);function Bl(e,t){if(Ll(e)||Ll(t))return e===t;if(Us(e)&&Us(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const r=e[a];if(!n.includes(a))return!1;if("ref"!==a){const e=t[a];if(Us(r)&&Us(e)||Zs(r)&&Zs(e)||Array.isArray(r)&&Array.isArray(e)?!Bl(r,e):r!==e)return!1}}return!0}var jl=e=>"select-multiple"===e.type,Dl=e=>_l(e)||Ws(e),Fl=e=>wl(e)&&e.isConnected,Ml=e=>{for(const t in e)if(vl(e[t]))return!0;return!1};function zl(e,t={}){const r=Array.isArray(e);if(Zs(e)||r)for(const r in e)Array.isArray(e[r])||Zs(e[r])&&!Ml(e[r])?(t[r]=Array.isArray(e[r])?[]:{},zl(e[r],t[r])):Hs(e[r])||(t[r]=!0);return t}function Vl(e,t,r){const n=Array.isArray(e);if(Zs(e)||n)for(const n in e)Array.isArray(e[n])||Zs(e[n])&&!Ml(e[n])?Qs(t)||Ll(r[n])?r[n]=Array.isArray(e[n])?zl(e[n],[]):{...zl(e[n])}:Vl(e[n],Hs(t)?{}:t[n],r[n]):r[n]=!Bl(e[n],t[n]);return r}var Wl=(e,t)=>Vl(e,t,zl(t)),Ul=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Qs(e)?e:t?""===e?NaN:e?+e:e:r&&dl(e)?new Date(e):n?n(e):e;function Hl(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return bl(t)?t.files:_l(t)?Al(e.refs).value:jl(t)?[...t.selectedOptions].map((({value:e})=>e)):Ws(t)?Cl(e.refs).value:Ul(Qs(t.value)?e.ref.value:t.value,e)}var $l=(e,t,r,n)=>{const a={};for(const r of e){const e=el(t,r);e&&al(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},Zl=e=>Qs(e)?e:El(e)?e.source:Zs(e)?El(e.value)?e.value.source:e.value:e,Gl=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function ql(e,t,r){const n=el(e,r);if(n||rl(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=el(t,n),o=el(e,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}var Yl=(e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e),Kl=(e,t)=>!Js(el(e,t)).length&&Il(e,t);const Xl={mode:ol.onSubmit,reValidateMode:ol.onChange,shouldFocusError:!0};function Jl(e={}){let t,r={...Xl,...e},n={submitCount:0,isDirty:!1,isLoading:vl(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},i=(Zs(r.defaultValues)||Zs(r.values))&&Xs(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Xs(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Ol(),array:Ol(),state:Ol()},p=fl(r.mode),m=fl(r.reValidateMode),f=r.criteriaMode===ol.all,g=async e=>{if(u.isValid||e){const e=r.resolver?cl((await v()).errors):await w(a,!0);e!==n.isValid&&d.state.next({isValid:e})}},h=(e,t)=>{(u.isValidating||u.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(t?al(n.validatingFields,e,t):Il(n.validatingFields,e))})),d.state.next({validatingFields:n.validatingFields,isValidating:!cl(n.validatingFields)}))},y=(e,t,r,n)=>{const l=el(a,e);if(l){const a=el(o,e,Qs(r)?el(i,e):r);Qs(a)||n&&n.defaultChecked||t?al(o,e,t?a:Hl(l._f)):E(e,a),s.mount&&g()}},b=(e,t,r,o,s)=>{let l=!1,c=!1;const p={name:e},m=!!(el(a,e)&&el(a,e)._f&&el(a,e)._f.disabled);if(!r||o){u.isDirty&&(c=n.isDirty,n.isDirty=p.isDirty=x(),l=c!==p.isDirty);const r=m||Bl(el(i,e),t);c=!(m||!el(n.dirtyFields,e)),r||m?Il(n.dirtyFields,e):al(n.dirtyFields,e,!0),p.dirtyFields=n.dirtyFields,l=l||u.dirtyFields&&c!==!r}if(r){const t=el(n.touchedFields,e);t||(al(n.touchedFields,e,r),p.touchedFields=n.touchedFields,l=l||u.touchedFields&&t!==r)}return l&&s&&d.state.next(p),l?p:{}},v=async e=>{h(e,!0);const t=await r.resolver(o,r.context,$l(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return h(e),t},w=async(e,t,a={valid:!0})=>{for(const i in e){const s=e[i];if(s){const{_f:e,...c}=s;if(e){const c=l.array.has(e.name);h([i],!0);const u=await Nl(s,o,f,r.shouldUseNativeValidation&&!t,c);if(h([i]),u[e.name]&&(a.valid=!1,t))break;!t&&(el(u,e.name)?c?yl(n.errors,u,e.name):al(n.errors,e.name,u[e.name]):Il(n.errors,e.name))}c&&await w(c,t,a)}}return a.valid},x=(e,t)=>(e&&t&&al(o,e,t),!Bl(P(),i)),_=(e,t,r)=>pl(e,l,{...s.mount?o:Qs(t)?i:dl(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=el(a,e);let i=t;if(n){const r=n._f;r&&(!r.disabled&&al(o,e,Ul(t,r)),i=wl(r.ref)&&Hs(t)?"":t,jl(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?Ws(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):bl(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||d.values.next({name:e,values:{...o}})))}(r.shouldDirty||r.shouldTouch)&&b(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&A(e)},k=(e,t,r)=>{for(const n in t){const i=t[n],o=`${e}.${n}`,s=el(a,o);!l.array.has(e)&&Ll(i)&&(!s||s._f)||Us(i)?E(o,i,r):k(o,i,r)}},S=(e,t,r={})=>{const c=el(a,e),p=l.array.has(e),m=Xs(t);al(o,e,m),p?(d.array.next({name:e,values:{...o}}),(u.isDirty||u.dirtyFields)&&r.shouldDirty&&d.state.next({name:e,dirtyFields:Wl(i,o),isDirty:x(e,m)})):!c||c._f||Hs(m)?E(e,m,r):k(e,m,r),gl(e,l)&&d.state.next({...n}),d.values.next({name:s.mount?e:void 0,values:{...o}})},C=async i=>{s.mount=!0;const y=i.target;let x=y.name,_=!0;const E=el(a,x),k=e=>{_=Number.isNaN(e)||e===el(o,x,e)};if(E){let s,S;const C=y.type?Hl(E._f):Gs(i),R=i.type===il.BLUR||i.type===il.FOCUS_OUT,P=!Gl(E._f)&&!r.resolver&&!el(n.errors,x)&&!E._f.deps||Yl(R,el(n.touchedFields,x),n.isSubmitted,m,p),T=gl(x,l,R);al(o,x,C),R?(E._f.onBlur&&E._f.onBlur(i),t&&t(0)):E._f.onChange&&E._f.onChange(i);const N=b(x,C,R,!1),I=!cl(N)||T;if(!R&&d.values.next({name:x,type:i.type,values:{...o}}),P)return u.isValid&&g(),I&&d.state.next({name:x,...T?{}:N});if(!R&&T&&d.state.next({...n}),r.resolver){const{errors:e}=await v([x]);if(k(C),_){const t=ql(n.errors,a,x),r=ql(e,a,t.name||x);s=r.error,x=r.name,S=cl(e)}}else h([x],!0),s=(await Nl(E,o,f,r.shouldUseNativeValidation))[x],h([x]),k(C),_&&(s?S=!1:u.isValid&&(S=await w(a,!0)));_&&(E._f.deps&&A(E._f.deps),((r,a,i,o)=>{const s=el(n.errors,r),l=u.isValid&&tl(a)&&n.isValid!==a;var p;if(e.delayError&&i?(p=()=>((e,t)=>{al(n.errors,e,t),d.state.next({errors:n.errors})})(r,i),t=e=>{clearTimeout(c),c=setTimeout(p,e)},t(e.delayError)):(clearTimeout(c),t=null,i?al(n.errors,r,i):Il(n.errors,r)),(i?!Bl(s,i):s)||!cl(o)||l){const e={...o,...l&&tl(a)?{isValid:a}:{},errors:n.errors,name:r};n={...n,...e},d.state.next(e)}})(x,S,s,N))}},R=(e,t)=>{if(el(n.errors,t)&&e.focus)return e.focus(),1},A=async(e,t={})=>{let i,o;const s=ul(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(e)for(const r of e){const e=el(t,r);e?al(n.errors,r,e):Il(n.errors,r)}else n.errors=t;return t})(Qs(e)?e:s);i=cl(t),o=e?!s.some((e=>el(t,e))):i}else e?(o=(await Promise.all(s.map((async e=>{const t=el(a,e);return await w(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||n.isValid)&&g()):o=i=await w(a);return d.state.next({...!dl(e)||u.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!o&&hl(a,R,e?s:l.mount),o},P=e=>{const t={...s.mount?o:i};return Qs(e)?t:dl(e)?el(t,e):e.map((e=>el(t,e)))},T=(e,t)=>({invalid:!!el((t||n).errors,e),isDirty:!!el((t||n).dirtyFields,e),error:el((t||n).errors,e),isValidating:!!el(n.validatingFields,e),isTouched:!!el((t||n).touchedFields,e)}),N=(e,t,r)=>{const i=(el(a,e,{_f:{}})._f||{}).ref,o=el(n.errors,e)||{},{ref:s,message:l,type:c,...u}=o;al(n.errors,e,{...u,...t,ref:i}),d.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},I=(e,t={})=>{for(const s of e?ul(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||(Il(a,s),Il(o,s)),!t.keepError&&Il(n.errors,s),!t.keepDirty&&Il(n.dirtyFields,s),!t.keepTouched&&Il(n.touchedFields,s),!t.keepIsValidating&&Il(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Il(i,s);d.values.next({values:{...o}}),d.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&g()},O=({disabled:e,name:t,field:r,fields:n,value:a})=>{if(tl(e)&&s.mount||e){const i=e?void 0:Qs(a)?Hl(r?r._f:el(n,t)._f):a;al(o,t,i),b(t,i,!1,!1,!0)}},L=(e,t={})=>{let n=el(a,e);const o=tl(t.disabled);return al(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?O({field:n,disabled:t.disabled,name:e,value:t.value}):y(e,!0,t.value),{...o?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:Zl(t.min),max:Zl(t.max),minLength:Zl(t.minLength),maxLength:Zl(t.maxLength),pattern:Zl(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:o=>{if(o){L(e,t),n=el(a,e);const r=Qs(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=Dl(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;al(a,e,{_f:{...n._f,...s?{refs:[...l.filter(Fl),r,...Array.isArray(el(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),y(e,!1,void 0,r)}else n=el(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!qs(l.array,e)||!s.action)&&l.unMount.add(e)}}},B=()=>r.shouldFocusError&&hl(a,R,l.mount),j=(e,t)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let l=Xs(o);if(d.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await v();n.errors=e,l=t}else await w(a);if(Il(n.errors,"root"),cl(n.errors)){d.state.next({errors:{}});try{await e(l,i)}catch(e){s=e}}else t&&await t({...n.errors},i),B(),setTimeout(B);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:cl(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},D=(t,r={})=>{const c=t?Xs(t):i,p=Xs(c),m=cl(t),f=m?i:p;if(r.keepDefaultValues||(i=c),!r.keepValues){if(r.keepDirtyValues)for(const e of l.mount)el(n.dirtyFields,e)?al(f,e,el(o,e)):S(e,el(f,e));else{if(Ks&&Qs(t))for(const e of l.mount){const t=el(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(wl(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}o=e.shouldUnregister?r.keepDefaultValues?Xs(i):{}:Xs(f),d.array.next({values:{...f}}),d.values.next({values:{...f}})}l={mount:r.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!r.keepIsValid||!!r.keepDirtyValues,s.watch=!!e.shouldUnregister,d.state.next({submitCount:r.keepSubmitCount?n.submitCount:0,isDirty:!m&&(r.keepDirty?n.isDirty:!(!r.keepDefaultValues||Bl(t,i))),isSubmitted:!!r.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?[]:r.keepDirtyValues?r.keepDefaultValues&&o?Wl(i,o):n.dirtyFields:r.keepDefaultValues&&t?Wl(i,t):r.keepDirty?n.dirtyFields:{},touchedFields:r.keepTouched?n.touchedFields:{},errors:r.keepErrors?n.errors:{},isSubmitSuccessful:!!r.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},F=(e,t)=>D(vl(e)?e(o):e,t);return{control:{register:L,unregister:I,getFieldState:T,handleSubmit:j,setError:N,_executeSchema:v,_getWatch:_,_getDirty:x,_updateValid:g,_removeUnmounted:()=>{for(const e of l.unMount){const t=el(a,e);t&&(t._f.refs?t._f.refs.every((e=>!Fl(e))):!Fl(t._f.ref))&&I(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],r,l,c=!0,p=!0)=>{if(l&&r){if(s.action=!0,p&&Array.isArray(el(a,e))){const t=r(el(a,e),l.argA,l.argB);c&&al(a,e,t)}if(p&&Array.isArray(el(n.errors,e))){const t=r(el(n.errors,e),l.argA,l.argB);c&&al(n.errors,e,t),Kl(n.errors,e)}if(u.touchedFields&&p&&Array.isArray(el(n.touchedFields,e))){const t=r(el(n.touchedFields,e),l.argA,l.argB);c&&al(n.touchedFields,e,t)}u.dirtyFields&&(n.dirtyFields=Wl(i,o)),d.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else al(o,e,t)},_updateDisabledField:O,_getFieldArray:t=>Js(el(s.mount?o:i,t,e.shouldUnregister?el(i,t,[]):[])),_reset:D,_resetDefaultValues:()=>vl(r.defaultValues)&&r.defaultValues().then((e=>{F(e,r.resetOptions),d.state.next({isLoading:!1})})),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{tl(e)&&(d.state.next({disabled:e}),hl(a,((t,r)=>{const n=el(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach((t=>{t.disabled=n._f.disabled||e})))}),0,!1))},_subjects:d,_proxyFormState:u,_setErrors:e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},get _fields(){return a},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},set _formState(e){n=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:A,register:L,handleSubmit:j,watch:(e,t)=>vl(e)?d.values.subscribe({next:r=>e(_(void 0,t),r)}):_(e,t,!0),setValue:S,getValues:P,reset:F,resetField:(e,t={})=>{el(a,e)&&(Qs(t.defaultValue)?S(e,Xs(el(i,e))):(S(e,t.defaultValue),al(i,e,Xs(t.defaultValue))),t.keepTouched||Il(n.touchedFields,e),t.keepDirty||(Il(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Xs(el(i,e))):x()),t.keepError||(Il(n.errors,e),u.isValid&&g()),d.state.next({...n}))},clearErrors:e=>{e&&ul(e).forEach((e=>Il(n.errors,e))),d.state.next({errors:e?n.errors:{}})},unregister:I,setError:N,setFocus:(e,t={})=>{const r=el(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:T}}function Ql(e={}){const t=i.useRef(),r=i.useRef(),[n,a]=i.useState({isDirty:!1,isValidating:!1,isLoading:vl(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:vl(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Jl(e),formState:n});const o=t.current.control;return o._options=e,function(e){const t=i.useRef(e);t.current=e,i.useEffect((()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}}),[e.disabled])}({subject:o._subjects.state,next:e=>{((e,t,r,n)=>{r(e);const{name:a,...i}=e;return cl(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!n||ol.all)))})(e,o._proxyFormState,o._updateFormState,!0)&&a({...o._formState})}}),i.useEffect((()=>o._disableForm(e.disabled)),[o,e.disabled]),i.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==n.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,n.isDirty]),i.useEffect((()=>{e.values&&!Bl(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,a((e=>({...e})))):o._resetDefaultValues()}),[e.values,o]),i.useEffect((()=>{e.errors&&o._setErrors(e.errors)}),[e.errors,o]),i.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),i.useEffect((()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[e.shouldUnregister,o]),t.current.formState=((e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const a=i;return t._proxyFormState[a]!==ol.all&&(t._proxyFormState[a]=!n||ol.all),r&&(r[a]=!0),e[a]}});return a})(n,o),t.current}const ec="loading",tc=()=>{const{licenseStatus:e}=(0,t.A)((e=>{const{getLicenseStatus:t}=e(g.U);return{licenseStatus:t()}}),[]),{updateLicenseStatus:n}=(0,r.A)(g.U),[a,o]=(0,i.useState)("");return{licenseStatus:e,getAstraSitesProStatus:y.Lv,handleActivateLicense:async e=>{if(a!==ec){o(ec);try{const t=await(0,y.nr)({path:"/wp-json/bsf-core/v1/license/activate",data:{"license-key":e,"product-id":"astra-pro-sites"},method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce}});if(t.success)return o("success"),(0,Ps.oR)((0,Ts.A)({title:"Successfully activated!",message:"Your license key has been activated successfully."}),Ts.A.getOptions({type:"success"})),n("active"),t;throw t}catch(e){return o("error"),(0,Ps.oR)((0,Ts.A)({title:"Failed to activate!",message:e?.message??"Your license key could not be activated."}),Ts.A.getOptions({type:"error"})),console.error(e),e}}},loadingStatus:a}},rc=()=>{const{loadingStatus:e,licenseStatus:t,getAstraSitesProStatus:r,handleActivateLicense:n}=tc(),a=r(),{register:o,handleSubmit:s,formState:{errors:l},setFocus:c}=Ql({defaultValues:{licenseKey:""}}),d=()=>a.notInstalled||a.inactive?"free":"premium";return(0,i.useEffect)((()=>{c("licenseKey")}),[]),"active"!==t&&React.createElement("div",{className:"spectra-ai p-4 space-y-4 rounded bg-background-tertiary"},React.createElement("div",{className:"space-y-2"},React.createElement("div",{className:"flex items-center justify-start gap-2"},React.createElement(ei.DE,null),React.createElement("p",{className:"m-0 text-base font-semibold text-heading-text"},"Premium Template")),React.createElement("p",{className:"m-0 text-sm font-normal text-body-text"},"free"===d()?(0,u.__)("Access this template and all others with Essentials & Business Toolkit package starting at just $79.","astra-sites"):(0,u.__)("Please Enter your Licence Key","astra-sites"))),"premium"===d()&&React.createElement("form",{className:"m-0 p-0",onSubmit:s((async({licenseKey:e})=>{await n(e)}))},React.createElement(Qo,{className:"w-full",inputClassName:"!pr-11",type:"text",id:"licenseKey",name:"licenseKey",placeholder:(0,u.__)("License key","astra-sites"),register:o,error:l.licenseKey,validations:{required:{value:!0,message:"License key is required"}},suffixIcon:React.createElement("button",{type:"submit",className:"border-0 bg-transparent focus:outline-none inline-flex items-center justify-center cursor-pointer p-3"},"loading"===e?React.createElement(p,{className:"w-5 h-5 text-icon-secondary animate-spin"}):React.createElement(Xi,{className:"w-5 h-5 text-icon-secondary"})),suffixIconClassName:"absolute right-4 flex items-center right-0"})),"premium"===d()&&React.createElement("div",{className:"m-0"},React.createElement("p",{className:"m-0 text-sm font-normal text-body-text"},React.createElement("span",{className:"font-semibold text-heading-text"},"Need help?")," ","Get in touch with our"," ",React.createElement("a",{href:"https://wpastra.com/contact",target:"_blank",className:"text-accent-spectra",rel:"noreferrer"},"support team"),".")))},nc=(0,e.A)((0,a.A)((e=>{const{getPagePreview:t,getSitePreview:r}=e("astra-sites");return{sitePreview:r(),pagePreview:t()}})))((0,i.memo)((function({sitePreview:e,pagePreview:n}){const{setCurrentScreen:a}=(0,r.A)(g.U),{licenseStatus:o,getAstraSitesProStatus:s}=tc(),l=s(),{importInProgress:c,previousScreen:d}=(0,t.A)((e=>{const{getImportInProgress:t,getPreviousScreen:r}=e(g.U);return{importInProgress:t(),previousScreen:r()}}),[]);if(!Object.keys(e).length)return"";e?.type||(e.type="site");const p=Object.values(e.pages)||[],m=n["featured-image-url"]||`${ast_block_template_vars.uri}dist/placeholder.png`,f="free"===e["astra-sites-type"],h=!f&&"active"!==o,b=!f&&"active"!==o&&!l.active;return React.createElement(i.Fragment,null,React.createElement(Os,null),React.createElement("div",{className:(0,y.xW)("flex h-full pt-6 px-10 mx-auto gap-10")},React.createElement("div",{className:(0,y.xW)("flex-1 h-full")},React.createElement("div",{className:"h-full flex flex-col items-stretch justify-stretch space-y-6"},React.createElement("div",{className:"flex flex-col sm:flex-row items-start justify-start gap-2 sm:gap-5"},React.createElement(ii.A,{className:(0,y.xW)("inline-flex pl-1 py-1 pr-2 h-7 gap-1 border-border-primary text-body-text",c&&"disable-click-action"),variant:"white",hasPrefixIcon:!0,isSmall:!0,onClick:()=>{a("all-favorites"===d?"all-favorites":"all-sites-grid")}},React.createElement(Yi,{className:"w-4 h-4"}),React.createElement("span",null,"Back")),React.createElement("div",{className:"space-x-3"},React.createElement("p",{className:"m-0 text-xl font-semibold inline-block"},e?.title),"free"!==e["astra-sites-type"]&&React.createElement(zs,{className:"align-text-top"}))),React.createElement("div",{className:(0,y.xW)("flex-1 w-full overflow-y-auto h-screen bg-gray-300 block ast-thin-scrollbar !mb-6")},React.createElement("img",{className:"w-full",src:m,alt:"screenshot",onLoad:e=>{e.target.parentElement.classList.remove("bg-gray-300")}})))),React.createElement("div",{className:(0,y.xW)("flex flex-col w-2/5 lg:w-[35%] h-full")},React.createElement("div",{className:"flex items-center justify-between gap-2 mb-6"},React.createElement("p",{className:"m-0 hidden sm:block text-xl font-semibold"},(0,u.nv)("%s (%s)",(0,u._n)("Page","Pages",p.length,"astra-sites"),p.length)),React.createElement(Vs.A,{item:e},(({isFavorite:e,onClickFavorite:t})=>React.createElement("button",{className:"min-w-fit inline-flex items-center justify-start gap-2 border-0 focus:outline-none bg-transparent cursor-pointer text-nav-active group/favorites",onClick:t},React.createElement(Bs.A,{className:(0,y.xW)("size-6 sm:size-5 transition-colors ease-out duration-150",e?"fill-favorite text-favorite":"group-hover/favorites:fill-favorite group-hover/favorites:text-favorite")}),React.createElement("span",{className:"text-base font-medium hidden sm:inline"},e?"Remove from favorites":"Add to favorites"))))),React.createElement("div",{className:"flex-1 overflow-y-auto ast-thin-scrollbar -mx-1"},React.createElement("div",{className:(0,y.xW)("grid grid-cols-1 lg:grid-cols-2 auto-rows-auto gap-10 border-x-4 border-solid border-transparent")},p.length?p.map((e=>React.createElement(Ls,{key:e.ID,item:e}))):React.createElement("div",{className:"no-search-result"},React.createElement("h3",null,(0,u.__)("No Result Found","astra-sites")),React.createElement("p",null,(0,u.__)("The search result not found. Try another search.","astra-sites"))))),React.createElement("div",{className:"py-8 space-y-6"},!f&&React.createElement(rc,null),React.createElement("div",{className:"min-w-min flex flex-wrap xl:flex-nowrap gap-6 items-center justify-center"},React.createElement(ii.A,{className:"lg:grow w-full lg:w-auto min-w-fit",variant:"white",hasSuffixIcon:!0,onClick:()=>{window.open(n["astra-page-url"]+"?customize=template","_blank")},disabled:c},React.createElement("span",{className:"hidden sm:inline"},(0,u.__)("Live Preview","astra-sites")),React.createElement(Ds,{className:"size-6 sm:size-5"})),b?React.createElement(ii.A,{variant:"primary",className:"lg:grow-[2] w-full lg:w-auto min-w-fit",onClick:()=>{window.open(ast_block_template_vars.getProURL,"_blank")},hasSuffixIcon:!0},React.createElement("span",null,(0,u.__)("Get Access","astra-sites")),React.createElement(Ms,{className:"w-5 h-5"})):React.createElement(Is,{disabled:h}))))))})));var ac=o(7497);const ic=(0,e.A)((0,a.A)((e=>{const{getSitePreview:t}=e("astra-sites");return{preview:t}})),(0,n.A)((e=>{const{setSitePreview:t,setPagePreview:r,setCurrentScreen:n,setImportItemInfo:a}=e("astra-sites");return{setSitePreview(e){const a=Object.values(e.pages).length?Object.values(e.pages)[0]:[];r(a),t(e),n("all-single-site-pages")},setImportItemInfo:a}})))((0,i.memo)((({setSitePreview:e,item:t,setImportItemInfo:r})=>{const n=t["thumbnail-image-url"]||"",a=t.pages?t.pages.length:0,o=a<=1?"Template":"Templates",[s,l]=(0,i.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),c=t["astra-sites-type"];return(0,i.useEffect)((()=>{let e=!0;const t=new Image;return t.src=n,t.onload=()=>{e&&l(t.src)},()=>{e=!1}}),[s]),React.createElement(ac.A,{className:(0,y.xW)("border-none w-full content-start relative")},React.createElement("div",{className:(0,y.xW)("inner","m-0 bg-white relative transition-all border border-solid border-border-primary cursor-pointer"),onClick:()=>{e(t),r(t)}},"free"!==c&&React.createElement(zs,{className:"absolute top-3 right-3"}),React.createElement("div",{className:(0,y.xW)("bg-top bg-cover bg-no-repeat overflow-hidden bg-gray-300 block aspect-[13/16]"),style:{backgroundImage:`url('${s}')`}},React.createElement("div",{className:(0,y.xW)("absolute top-0 left-0 w-full h-full cursor-pointer opacity-0 invisible float-none transition-all duration-300 bg-black bg-opacity-50")},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 overflow-hidden"},React.createElement("div",{className:(0,y.xW)("w-full flex items-center justify-between gap-3 py-2 pl-4 pr-3 bg-white/95 shadow-action-buttons backdrop-blur-[3px]")},React.createElement("div",null,React.createElement("p",{className:(0,y.xW)("m-0 text-base text-heading-text font-semibold leading-6")},(0,Wo.iZ)(t.title)),a?React.createElement("p",{className:"m-0 text-sm text-body-text font-normal leading-5 sub-title"},`${a} ${o}`):""),React.createElement(Vs.A,{item:t})))))}))),oc=(0,e.A)((0,a.A)((e=>{const{getAllPages:t,getCurrentScreen:r,getAllSites:n}=e("astra-sites");return{currentScreen:r(),allSites:n(),allPages:t()}})))((0,i.memo)((({allSites:e})=>{const{searchTerm:n,favorites:a,categoryFilter:o,loadingBlocksAndSites:s}=(0,t.A)((e=>{const{getFilterSitesBySearchTerm:t,getFavorites:r,getFilterSitesByCategory:n,getLoadingBlocksAndSites:a}=e(g.U);return{searchTerm:t(),favorites:r()?.site??[],categoryFilter:n(),loadingBlocksAndSites:a()}}),[]),{setFilterSitesBySearchTerm:l}=(0,r.A)(g.U),c=Object.values(e).map((e=>(e.type="site",e))).filter((e=>{if("favorite"===o)return a.map(Number).includes(+e.ID);if(!n)return!0;const t=Object.values(e.tag).map((e=>e.toLowerCase()));return e.title.toLowerCase().includes(n.toLowerCase())||t.includes(n.toLowerCase())})),u=(0,y._9)("ast-sites-visible-items")||12,d=(0,y._9)("ast-sites-scroll-position")||0,[p,m]=(0,i.useState)(u),f=(0,i.useRef)(null),h=(0,i.useCallback)((()=>{const{scrollTop:t,clientHeight:r,scrollHeight:n}=f.current;(0,y.HU)("ast-sites-scroll-position",t),e.length<=p||t+r>=n-r/2&&m((e=>((0,y.HU)("ast-sites-visible-items",e+12),e+12)))}),[]),b=(0,i.useCallback)((e=>{Zo.A.emit("reset-list-count"),l("")}),[]);if((0,i.useEffect)((()=>{f.current=document.getElementById("ast-template-kits-list");const e=f.current;if(e)return e.addEventListener("scroll",h),d&&e.scrollTo({top:d}),()=>{e.removeEventListener("scroll",h)}}),[]),(0,i.useEffect)((()=>{Zo.A.on("reset-list-count",(()=>{m(12),(0,y.D6)("ast-sites-visible-items"),(0,y.D6)("ast-sites-scroll-position")}))}),[]),s)return React.createElement("div",{className:"grid auto-rows-auto gap-8 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"},Array.from({length:12}).map(((e,t)=>React.createElement(no,{type:t%2?3:2,key:t}))));const v=c.slice(0,p);return React.createElement("div",{className:(0,y.xW)("grid auto-rows-auto gap-8",v.length?"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4":"grid-cols-1")},v.length?v.map((e=>React.createElement(ic,{key:e.ID,item:e}))):React.createElement("div",{className:"mx-auto mt-10 md:mt-16 lg:mt-24 xl:mt-32 space-y-6 text-center w-full"},React.createElement("div",{className:"space-y-2.5"},React.createElement("p",{className:"m-0 text-lg font-semibold text-heading-text"},"Sorry No Results Found 😕"),React.createElement("p",{className:"m-0 text-base font-normal text-body-text"},"Don’t see a template you would like to import?",React.createElement("br",null),React.createElement("a",{href:"https://wpastra.com/sites-suggestions/",className:"no-underline text-accent-spectra",target:"_blank"},"Make a template suggestion!"))),React.createElement(ii.A,{onClick:b,variant:"white",className:"mx-auto border-border-secondary text-border-secondary"},"Back to Templates")))}))),sc=(0,i.memo)((function(){const{myFavoritesActive:e}=(0,t.A)((e=>{const{getFilterSitesByCategory:t}=e(g.U);return{myFavoritesActive:"favorite"===t()}}),[]),{setFilterSitesByCategory:n}=(0,r.A)(g.U);return React.createElement("div",{id:"ast-template-kits-list",className:"h-full overflow-y-auto px-10 pb-10 pt-6"},React.createElement("div",{className:"flex flex-col sm:flex-row items-center justify-between mb-6 gap-4"},e?React.createElement(ii.A,{className:"inline-flex pl-1 py-1 pr-2 h-7 gap-1 border-border-primary text-body-text",variant:"white",hasPrefixIcon:!0,isSmall:!0,onClick:()=>{n("")}},React.createElement(Yi,{className:"w-4 h-4"}),React.createElement("span",null,"Back")):React.createElement("p",{className:"m-0 text-xl font-semibold inline-block"},"Template Kits"),React.createElement("div",{className:"flex items-center gap-10"},React.createElement(es,{className:"w-full md:w-[270px]",placeholder:"Search.."}))),React.createElement(oc,null))}));o(7525);const lc=(0,e.A)((0,a.A)((e=>{const{getFullWidthBlockPreview:t}=e("astra-sites");return{blockPreview:t()}})))((0,i.memo)((({blockPreview:e})=>{const t=e["featured-image-url"]||`${ast_block_template_vars.uri}dist/placeholder.png`;return React.createElement("div",{className:"ast-block-templates-full-preview"},React.createElement("img",{src:t,alt:"Preview"}))})));o(8509);const cc=(0,e.A)((0,a.A)((e=>{const{getFullWidthPagePreview:t}=e("astra-sites");return{pagePreview:t()}})))((0,i.memo)((({pagePreview:e})=>{const t=e["featured-image-url"]||"";return React.createElement("div",{className:"ast-block-templates-full-preview"},React.createElement("img",{src:t,alt:"Preview"}))}))),uc=()=>React.createElement("div",null,"All signle pages"),dc=(0,e.A)((0,a.A)((e=>{const{getFilterBlocksPagesByCategory:t,getFilterBlocksPagesByColor:r,getAllPatternsAndPages:n,getAllCategories:a}=e("astra-sites");return{filterBlocksByCategory:t(),filterBlocksByColor:r(),allPages:n()?.pages,allCategories:a()}})),(0,n.A)((e=>{const{setFilterBlocksPagesByCategory:t}=e("astra-sites");return{setFilterBlocksPagesByCategory:t}})))((0,i.memo)((({filterBlocksByCategory:e,setFilterBlocksPagesByCategory:r,allPages:n,allCategories:a})=>{const i={};let o=0;for(const e in a){let t=0;for(const r in n)a[e].id===n[r].category&&t++;0!==t&&(i[e]=a[e],i[e].count=t,o+=t)}const s=Object.keys(i).map((e=>i[e])),{favorites:l}=(0,t.A)((e=>{const{getFavorites:t}=e("astra-sites");return{favorites:t()}}));return React.createElement($o,{value:e,allCount:o,favoriteCount:l?.page?Object.keys(l?.page)?.length:0,list:s,onChange:(e,t)=>{""!==t.id?r(t.id):r("")}})})));function pc(){return pc=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{adaptiveMode:n}=(0,t.A)((e=>{const{getAdaptiveMode:t}=e(g.U);return{adaptiveMode:t()}}));return React.createElement("div",pc({className:(0,y.xW)("spectra-ai w-full lg:max-w-[280px] self-stretch bg-white border-0 border-r border-solid border-border-primary md:max-lg:max-w-[246px] xl:max-w-[280px] lg:max-xl:max-w-[260px] hidden sm:block max-w-60",e)},r),React.createElement("div",{className:"h-full w-full flex flex-col gap-5 py-5 px-4"},React.createElement(es,null),React.createElement(Qa,{className:"mx-2"}),React.createElement(dc,null),n&&React.createElement("div",{className:"mt-auto space-y-5 min-h-[3.125rem]"},React.createElement(Qa,{className:"mx-2"}),React.createElement(Yo,null))))})),gc=(0,e.A)((0,n.A)((e=>{const{setFilterBlocksPagesBySearchTerm:t,setFilterBlocksPagesByCategory:r,setActiveBlockPalette:n,setHideNotice:a,toggleOnboardingAIStep:i,setPagePreview:o,setCurrentScreen:s}=e(g.U);return{setFilterBlocksPagesByCategory:r,setFilterBlocksPagesBySearchTerm:t,setActiveBlockPalette:n,setHideNotice:a,toggleOnboardingAIStep:i,setFullPagePreview(e){o(e),s("single-block-page-full-preview")}}})),(0,a.A)((e=>{const{getAllBlocksPages:t,getAllCategories:r,getFilterBlocksPagesByCategory:n,getFilterBlocksPagesByColor:a,getDefaultPageColorPalette:i,getActivePagePalette:o,getDynamicContent:s,getAIStepData:l,getFilterBlocksPagesBySearchTerm:c,getDynamicContentSyncStatus:u,getDynamicContentSyncFlags:d,getAllPagesCategories:p,getDynamicContentReSyncStatus:m,getRegeneratingContentCategory:f,getAdaptiveMode:h,getHideNotice:y,getDisableAi:b,getIsSyncBusinessDetails:v}=e(g.U);return{filterBlocksPagesByCategory:n(),filterBlocksByColor:a(),allPages:t(),defaultPalette:i(),activePalette:o(),dynamicContent:s(),selectedImages:l().selectedImages,allCategories:r(),searchTerm:c(),syncStatus:u()?.pages,syncFlags:d(),allPagesCategories:p(),reSyncStatus:m(),regeneratingContentCategory:f(),adaptiveMode:h(),hideNotice:y(),disableAi:b(),isSyncBusinessDetails:v()}})))((0,i.memo)((({allPages:e,defaultPalette:r,activePalette:n,dynamicContent:a,selectedImages:o,filterBlocksPagesByCategory:s,allPagesCategories:l,searchTerm:c,syncFlags:d,syncStatus:p,reSyncStatus:m,regeneratingContentCategory:f,adaptiveMode:h,hideNotice:b,setHideNotice:v,disableAi:w,isSyncBusinessDetails:x,toggleOnboardingAIStep:_,setFullPagePreview:E})=>{const[k,S]=(0,i.useState)(!1),C=e,R="https://youtu.be/Zpkgw9USlEc",{stepsData:{businessContact:A,businessDetails:P,token:T},allPatternsAndPages:N,loadingBlocksAndSites:I}=(0,t.A)((e=>{const{getAIStepData:t,getAllPatternsAndPages:r,getLoadingBlocksAndSites:n}=e(g.U);return{stepsData:t(),allPatternsAndPages:r(),loadingBlocksAndSites:n()}})),O=(0,i.useRef)(null),{currentBalanceStatus:L,remaining:B}=oi(),j={show:L.warning&&!b.creditWarning||L.danger&&!b.creditDanger||!1,variantAndType:L.warning&&{variant:"warning",type:"creditWarning"}||L.danger&&{variant:"error",type:"creditDanger"},message:0===B?"You're out of AI credits. Personalize the design library with content and images tailored to your website project":(L.warning||L.danger)&&"You're almost out of AI credits. Personalize the design library with content and images tailored to your website project"},D=e=>()=>{v({[e]:!0}),(0,Wo.yL)(e)};(0,i.useEffect)((()=>{Zo.A.on("reset-list-count",(()=>{M(10),(0,y.D6)("ast-pages-visible-items"),(0,y.D6)("ast-pages-scroll-position")}))}),[]),(0,i.useEffect)((()=>{O.current&&(O.current.scrollTop=(0,y._9)("ast-pages-scroll-position")||0)}),[]);const[F,M]=(0,i.useState)((0,y._9)("ast-pages-visible-items")||10),z=Object.keys(n).length>0?n.colors:r.colors,V=()=>{const e=c&&!C.length?N.pages:C;window.innerHeight+window.scrollY>=document.body.offsetHeight-500&&e.length>F&&M((e=>e+10))};(0,i.useEffect)((()=>{const e=((e,t)=>{let r;return(...t)=>{clearTimeout(r),r=setTimeout((()=>e(...t)),200)}})(V),t=document.getElementsByClassName("ast-scrolling-container");if(t.length>0){const r=t[0];return r.addEventListener("scroll",e),()=>r.removeEventListener("scroll",e)}}),[V]);const W=jo(V,200),U=C.slice(0,F),H=e=>Math.floor(e/3)+1,$=()=>!!I||!(!m||f!==s)||!(!m||""!==f)||!!p&&!(!p||(!Object.values(d.pages).every((e=>!1===e))||""!==s)&&(""===s||!Object.keys(d.pages).map(Number).includes(s)||d.pages[s])),Z=U?.length||""===c?[]:N.pages,G=()=>{if(""===s){const e=l.reduce(((e,t)=>(t.count,null)),0);return e>10?e:10}const e=l.find((e=>e.id===s)),t=e?.count?e.count:10;return e?.count>10?10:t},q=(0,i.useMemo)((()=>(()=>{let e=1,t=0;return()=>{return e>3&&(e=1),t===G()-1&&(t=0),React.createElement(no,{key:t,type:(r=H(t++),n=e++,[1,2,3][(n-1+(r-1)%3)%3])});var r,n}})()),[]);return React.createElement("div",{className:"relative ast-block-templates-grid-blocks active h-full"},React.createElement(ii.A,{className:"absolute right-4 bottom-8 z-[9999] py-2 px-3.5 bg-accent-spectra shadow-xl sm:hidden",onClick:()=>S(!0)},React.createElement(hs,{className:"size-5 text-white"})),React.createElement(xs,{open:k,onClose:()=>S(!1),className:"sm:hidden",children:React.createElement(fc,{className:"block sm:hidden h-full !w-full",style:{maxWidth:"100%"}})}),React.createElement(fc,null),React.createElement("div",{onScroll:e=>{W(),(0,y.HU)("ast-pages-scroll-position",e.target.scrollTop),(0,y.HU)("ast-pages-visible-items",F)},className:"ast-scrolling-container w-full md:ml-auto h-full overflow-auto md:max-w-[calc(100%_-_246px)]",ref:O},j.show&&!!T&&React.createElement(fs,{type:j.variantAndType.variant,message:j.message,icon:React.createElement(vs.A,{className:"w-6 h-6"}),ctaLink:ast_block_template_vars.get_more_credits_url,ctaText:(0,u.__)("Buy AI Credits","astra-sites"),onClose:D(j.variantAndType.type)}),!(b.personalizeAi||!T||P&&(!P||"yes"!==x)||w||c||L.warning||L.danger)&&React.createElement(fs,{className:"pl-6 py-4 pr-4 mx-10 mt-9 md:max-lg:mx-5 hidden sm:block",rounded:8,type:"info",message:React.createElement("div",{className:"grid grid-cols-4 grid-rows-2 2xl:grid-rows-1 items-center justify-start gap-2 max-2xl:items-start"},React.createElement("span",{className:"col-span-12 2xl:col-span-4 "},(0,u.__)("Did you know, you can personalize this design library with content and images tailored to your website project?","astra-sites")),React.createElement("div",{className:"col-span-12 2xl:col-start-5 flex flex-col md:flex-row gap-5 items-baseline md:items-center"},React.createElement(ii.A,{id:"ast-block-template-setup-ai-btn",className:"min-w-fit",variant:"primary",isSmall:!0,onClick:()=>{D("personalizeAi")(),_(!0)}},"Personalize Library with AI"),R&&React.createElement(ms,{className:"flex 2xl:hidden",videoIntroURL:R}))),icon:React.createElement(Vo,{className:"w-6 h-6"}),onClose:D("personalizeAi"),isClose:!1,hasVideoIntro:!0,videoIntroURL:R}),React.createElement("div",{className:"h-full w-full p-10 md:max-lg:p-6"},!U.length&&""!==c&&React.createElement("div",{className:"pb-4"},React.createElement(So,{keyword:c}),React.createElement("h6",{className:"m-0 mt-10 text-heading-text text-xl font-semibold leading-7"},"Other suggested pattern designs")),React.createElement(us,{columns:{640:1,768:2,1024:3},gap:32,className:"ast-block-templates-grid",id:"ast-block-templates-grid-blocks-pages"},(()=>{if($()){const e=G();return Array(e>10?10:e).fill(1)}const e=Object.entries(d.pages);return!m&&p&&e.some((([,e])=>!1===e))?U.filter((e=>!1!==d.pages[e.category])):U.length||""===c?U:Z.slice(0,F)})()?.map(((e,t)=>((e,t)=>$()?q():React.createElement(io,{key:e.ID,index:t,item:e,content:e.content,stylesheet:e.stylesheet,astraCustomizer:h?ast_block_template_vars.astra_customizer_css:ast_block_template_vars.server_astra_customizer_css,globalStylesheet:e.global_stylesheet,colorPalette:z,dynamicContent:a[e.category]??[],selectedImages:o,email:A.email,phone:A.phone,address:A.address,onClickBlock:E}))(e,t)))),React.createElement("div",{className:"h-10 w-full mb-10"}))))})));function hc({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.115 5.19.319 1.913A6 6 0 0 0 8.11 10.36L9.75 12l-.387.775c-.217.433-.132.956.21 1.298l1.348 1.348c.21.21.329.497.329.795v1.089c0 .426.24.815.622 1.006l.153.076c.433.217.956.132 1.298-.21l.723-.723a8.7 8.7 0 0 0 2.288-4.042 1.087 1.087 0 0 0-.358-1.099l-1.33-1.108c-.251-.21-.582-.299-.905-.245l-1.17.195a1.125 1.125 0 0 1-.98-.314l-.295-.295a1.125 1.125 0 0 1 0-1.591l.13-.132a1.125 1.125 0 0 1 1.3-.21l.603.302a.809.809 0 0 0 1.086-1.086L14.25 7.5l1.256-.837a4.5 4.5 0 0 0 1.528-1.732l.146-.292M6.115 5.19A9 9 0 1 0 17.18 4.64M6.115 5.19A8.965 8.965 0 0 1 12 3c1.929 0 3.716.607 5.18 1.64"}))}const yc=i.forwardRef(hc);function bc({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12h15m0 0-6.75-6.75M19.5 12l-6.75 6.75"}))}const vc=i.forwardRef(bc),{images:wc}=ast_block_template_vars,xc=[{icon:ei.C1,text:(0,u.__)("Updated templates design library","astra-sites")},{icon:ai.A,text:(0,u.__)("Free AI credits to create personalized content","astra-sites")},{icon:Vo,text:(0,u.__)("Easily find stunning images for your website","astra-sites")},{icon:yc,text:(0,u.__)("Localized your website to any language","astra-sites")}],_c=()=>{const{toggleSkipZipAIOnboarding:e,toggleConnectZipAI:t}=(0,r.A)(g.U),[n,a]=(0,i.useState)(!1),o=(0,i.useCallback)((async()=>{if(n)return;a(!0);const t=new window.FormData;t.append("action","ast_skip_zip_ai_onboarding"),t.append("security",ast_block_template_vars.skip_zip_ai_onboarding_nonce);try{const r=await(0,y.nr)({url:ast_block_template_vars.ajax_url,method:"POST",body:t});if(r.success?e():(console.group("Onboarding Skip Failed!"),console.log(r),console.groupEnd()),!r.success)throw new Error(r.data)}catch(e){(0,ti.v)(e)}finally{a(!1)}}),[]),s=(0,i.useCallback)((()=>"active"===ast_block_template_vars.astra_sites_status||"active"===ast_block_template_vars.astra_sites_pro_status?React.createElement(ei.fp,{className:"w-10 h-10"}):React.createElement(ei.y0,{className:"w-10 h-10"})),[]);return React.createElement("div",{className:"relative h-full w-full",style:{backgroundImage:`url('${wc}background.png')`}},React.createElement("div",{className:"spectra-ai absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-center bg-background-tertiary/[0.85] backdrop-blur-[6px] z-[1]"},React.createElement("div",{className:"p-10 flex flex-col gap-8 max-w-[560px] border border-solid border-border-primary rounded-lg shadow-small bg-white"},React.createElement("div",{className:"space-y-5"},React.createElement("div",{className:"space-y-2"},s(),React.createElement("h4",{className:"text-[2rem] font-semibold leading-[2.625rem]"},(0,u.__)("Access Design Library","astra-sites")),React.createElement("p",{className:"text-base font-normal leading-6 text-body-text"},(0,u.__)("Get access to our library of hundreds of pixel-perfect, designer-made templates by creating a free account on ZipWP.","astra-sites")," ",React.createElement("br",null),React.createElement("span",null,(0,u.__)("Plus, you will get these extra benefits:","astra-sites")))),React.createElement("ul",{className:"!space-y-4"},xc.map(((e,t)=>React.createElement("li",{key:t,className:"m-0 flex gap-3 items-center justify-start"},React.createElement(e.icon,{className:"w-5 h-5 text-accent-spectra stroke-2"}),React.createElement("p",{className:"text-zip-app-heading text-base font-medium leading-6 m-0"},e.text)))))),React.createElement("div",{className:"flex flex-col md:flex-row flex-nowrap md:flex-wrap justify-start items-center gap-2"},React.createElement(ii.A,{variant:"primary",hasSuffixIcon:!0,className:"w-full md:w-fit min-w-[10.25rem]",onClick:async()=>{await o(),window.location.href=(0,Wo.i9)()}},n?React.createElement(Vi.A,null):React.createElement(React.Fragment,null,React.createElement("span",null,"Get Started"),React.createElement(vc,{className:"w-6 h-6"}))),React.createElement(ii.A,{variant:"link",className:"text-secondary-text w-full md:w-fit min-w-[5rem]",onClick:async()=>{t(),(0,y.D6)("ast-import"),await o()}},(0,u.__)("Cancel","astra-sites"))))))},{images:Ec}=ast_block_template_vars,kc=()=>{const{setShowPagesOnboarding:e,setCurrentCategory:n,setDynamicContent:a,dynamicContentFlagSet:i,dynamicContentSyncStart:o,dynamicContentFlagReset:s,dynamicContentSyncComplete:l,setCreditsDetails:c,setIsPersonalized:d}=(0,r.A)(g.U),{remaining:p,pagesLibraryRate:m}=oi(),{allPagesCategories:f,credits:h}=(0,t.A)((e=>{const{getAllPagesCategories:t,getCreditsDetails:r}=e(g.U);return{allPagesCategories:t(),credits:r()}}),[]),b=h.free_user||p{try{await(0,y.nr)({path:"gutenberg-templates/v1/pages-onboarding",method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce}})}catch(e){(0,ti.v)(e)}};return React.createElement("div",{className:"spectra-ai relative w-full h-full",style:{backgroundImage:`url('${Ec}background.png')`}},React.createElement("div",{className:"absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-center bg-background-tertiary/[0.85] backdrop-blur-[6px] z-[1]"},React.createElement("div",{className:"w-full max-w-[504px] h-max px-8 pt-8 pb-6 shadow-small rounded-lg space-y-8 bg-white"},React.createElement("div",{className:"space-y-2"},React.createElement(Vo,{className:"w-10 h-10 text-icon-primary stroke-[1]"}),React.createElement("h5",{className:"text-2xl font-semibold text-heading-text"},(0,u.__)("Generate Content for Pages","astra-sites")),React.createElement("p",{className:"text-body-text text-base"},(0,u.__)('Get the content for all your pages with just a click. You can generate content page by page by making use of the "Skip" option. We\'re here to make everything easy and tailored to suit your needs perfectly!',"astra-sites"))),React.createElement("div",{className:"space-y-4"},React.createElement(ii.A,{className:"w-full",variant:"primary",onClick:async()=>{const t="pages";s(t),o(t),e(),v();let r=!1;try{r=await(0,Wo.R2)(f,a,i,(e=>n(t,e)),c,"page",d)}catch(e){r=e}"object"==typeof r&&"api_throttle_error"===r?.data?.code&&(r={type:"error",title:"Check Back Soon",message:React.createElement(React.Fragment,null,"We are currently experiencing exceptionally high demand. Please try again in 5 minutes. If the error persists, kindly contact us through the website:",React.createElement("a",{href:"https://zipwp.com/contact",target:"_blank",rel:"noreferrer"}," ","https://zipwp.com/contact"),".")}),l(t,"object"==typeof r?r:null),n(t,{})},hasSuffixIcon:!0,disabled:b},React.createElement("span",null,(0,u.nv)((0,u.__)("Let’s Go (%s Credits)","astra-sites"),(0,y.ZV)(m))),React.createElement(Ms,{className:"w-5 h-5"})),b&&React.createElement("p",{className:"text-credit-danger text-center"},p," credits remaining"),React.createElement("button",{className:"w-full border-0 bg-transparent outline-none focus:outline-none active:outline-none underline text-base font-normal leading-6 text-center text-secondary-text cursor-pointer",onClick:()=>{v(),e()}},(0,u.__)("Skip","astra-sites"))))))};function Sc({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Cc=i.forwardRef(Sc),Rc={all:{value:"all",label:"All"},Patterns:{value:"pattern",label:"Pattern"},Pages:{value:"pages",label:"Pages"},Kits:{value:"kits",label:"Kits"}},Ac=(0,e.A)((0,n.A)((e=>{const{setFilterBlocksBySearchTerm:t,setFilterBlocksByCategory:r,setActiveBlockPalette:n,setHideNotice:a,toggleOnboardingAIStep:i}=e(g.U);return{setFilterBlocksByCategory:r,setFilterBlocksBySearchTerm:t,setActiveBlockPalette:n,setHideNotice:a,toggleOnboardingAIStep:i}})),(0,a.A)((e=>{const{getAllPatterns:t,getAllCategories:r,getFilterBlocksByCategory:n,getFilterBlocksByColor:a,getDefaultBlockColorPalette:i,getActiveBlockPalette:o,getDynamicContent:s,getAIStepData:l,getFilterFavoritres:c,getDynamicContentSyncStatus:u,getDynamicContentSyncFlags:d,getAllPatternsCategories:p,getDynamicContentReSyncStatus:m,getRegeneratingContentCategory:f,getAdaptiveMode:h,getHideNotice:y,getSkipZipAIOnboarding:b,getDisableAi:v,getIsSyncBusinessDetails:w}=e(g.U);return{filterBlocksByCategory:n(),filterBlocksByColor:a(),allPatterns:t(),defaultPalette:i(),activePalette:o(),dynamicContent:s(),selectedImages:l().selectedImages,allCategories:r(),searchTerm:c(),syncStatus:u()?.patterns,syncFlags:d(),allPatternsCategories:p(),reSyncStatus:m(),regeneratingContentCategory:f(),adaptiveMode:h(),hideNotice:y(),skipZipAIOnboarding:b(),disableAi:v(),isSyncBusinessDetails:w()}})))((0,i.memo)((({filterBlocksByCategory:e,allPatterns:r,allPatternsCategories:n,defaultPalette:a,activePalette:o,dynamicContent:s,selectedImages:l,syncFlags:c,syncStatus:d,searchTerm:p,reSyncStatus:m,regeneratingContentCategory:f,adaptiveMode:h})=>{const y=r,{stepsData:{businessContact:b},allPatternsAndPages:v,loadingBlocksAndSites:w,favorites:x,allSites:_}=(0,t.A)((e=>{const{getAIStepData:t,getAllPatternsAndPages:r,getAllSites:n,getLoadingBlocksAndSites:a,getFavorites:i}=e(g.U);return{stepsData:t(),allPatternsAndPages:r(),allSites:n(),loadingBlocksAndSites:a(),favorites:i()}})),E=[...Array.isArray(x?.block)?x?.block:[],...Array.isArray(x?.page)?x?.page:[],...Array.isArray(x?.site)?x?.site:[]],k=_.filter((e=>E.includes(parseInt(+e.ID)))),S=v.patterns.filter((e=>E.includes(parseInt(+e.ID)))),C=v.pages.filter((e=>E.includes(parseInt(+e.ID)))),R=[...S,...C,...k],[A,P]=(0,i.useState)(Rc.all);(0,i.useEffect)((()=>{Zo.A.on("reset-list-count",(()=>N(10)))}),[]);const[T,N]=(0,i.useState)(10),I=Object.keys(o).length>0?o.colors:a.colors,O=jo((()=>{if(j())return;const e=p&&!y.length?R:y;window.innerHeight+window.scrollY>=document.body.offsetHeight-500&&e.length>T&&N((e=>e+10))}),200),L=e=>Math.floor(e/3)+1,B=()=>{if(""===e){const e=n.reduce(((e,t)=>(t.count,null)),0);return e>10?e:10}const t=n.find((t=>t.id===e)),r=t?.count?t.count:10;return t?.count>10?10:r},j=()=>!!w||!(!m||f!==e)||!(!m||""!==f)||!!d&&!(!d||(!Object.values(c.patterns).every((e=>!1===e))||""!==e)&&(""===e||!Object.keys(c.patterns).map(Number).includes(e)||c.patterns[e])),D=(()=>{let e=[...R];return A&&"all"!==A.value&&(e=e.filter((e=>{switch(A.value){case"pattern":return S.includes(e);case"pages":return C.includes(e);case"kits":return k.includes(e);default:return!0}}))),p&&(e=e.filter((e=>e.title.toLowerCase().includes(p.toLowerCase())))),e})(),F=(0,i.useMemo)((()=>(()=>{let e=1,t=0;return()=>{return e>3&&(e=1),t===B()-1&&(t=0),React.createElement(no,{key:t,type:(r=L(t++),n=e++,[1,2,3][(n-1+(r-1)%3)%3])});var r,n}})()),[]);return React.createElement("div",{id:"ast-template-kits-list",onScroll:O,className:"h-full overflow-y-auto px-10 pb-10 pt-6"},React.createElement("div",{className:"flex items-center justify-between mb-6"},React.createElement("p",{className:"m-0 text-xl font-semibold sm:inline-block hidden min-w-32"},(0,u.__)("My Favorites","astra-sites")),React.createElement("div",{className:"flex flex-col justify-end sm:flex-row items-center px-0 gap-2 sm:gap-4 lg:gap-6 w-full"},React.createElement("div",{className:"w-full sm:w-52 border border-solid border-border-primary rounded-md py-2.5 px-2"},React.createElement(Ja,{placement:"right",trigger:React.createElement("div",{className:"flex items-center gap-2 min-w-32 cursor-pointer"},React.createElement("span",{className:"font-normal text-base leading-[150%]"},"",A.label),React.createElement(Cc,{className:"w-5 h-5 text-app-inactive-icon ml-auto"})),align:"top",contentClassName:"border border-solid border-border-primary p-4 bg-white [&>:first-child]:pb-3 [&>:last-child]:pt-3 [&>:not(:first-child,:last-child)]:py-3 !divide-y !divide-border-primary divide-solid divide-x-0"},Object.values(Rc).map(((e,t)=>{return React.createElement(Ja.Item,{as:"div",key:t,className:"only:!p-0"},React.createElement("button",{type:"button",className:"w-full flex items-center gap-2 px-1.5 py-1 text-sm font-normal leading-5 text-body-text hover:bg-background-secondary transition duration-150 ease-in-out space-x-2 rounded bg-white border-none cursor-pointer",onClick:(r=e,()=>{P(r)})},e.label));var r})))),React.createElement(es,{className:"!text-base w-full md:w-60",placeholder:"Search.."}))),React.createElement("div",{className:"ast-scrolling-container w-full max-w-full ml-auto h-full "},!j()&&0===D.length&&React.createElement(React.Fragment,null,p?React.createElement("div",{className:"mx-auto mt-10 md:mt-16 lg:mt-24 xl:mt-32 space-y-6 text-center"},React.createElement("div",{className:"space-y-2.5"},React.createElement("p",{className:"m-0 text-lg font-semibold text-heading-text"},(0,u.__)("Sorry No Favorites Found 😕","astra-sites")))):React.createElement(fs,{className:"p-10 !pl-8 !rounded-lg md:max-lg:mx-5 bg-background-secondary flex items-center",rounded:4,type:"info",message:React.createElement("div",{className:"flex flex-col md:flex-row items-start gap-4 w-full"},React.createElement("div",{className:"flex-shrink-0 pt-1"},React.createElement(Bs.A,{className:"w-10 h-10 text-accent-spectra"})),React.createElement("div",{className:"flex flex-col items-start leading-tight"},React.createElement("span",{className:"text-xl font-bold text-heading-text mb-1"},(0,u.__)("No favorites added.","astra-sites")),React.createElement("span",{className:"text-base font-normal text-body-text leading-6"},(0,u.__)("Your favorite templates will be displayed here. You do not have any favorites yet. Click the heart icon and start adding them!","astra-sites")))),isClose:!1})),React.createElement("div",{className:"h-full w-full py-4 md:py-10 md:max-lg:p-6"},React.createElement(us,{columns:{220:1,640:2,1024:3},gap:32,className:"ast-block-templates-grid",id:"ast-block-templates-grid-blocks"},(()=>{if(j()){const e=B();return Array(e>10?10:e).fill(1)}return D.slice(0,T)})()?.map(((e,t)=>((e,t)=>j()?F():"block"===e.type||"page"===e.type?React.createElement(io,{key:e.ID,index:t,item:e,content:e.content,stylesheet:e.stylesheet,astraCustomizer:h?ast_block_template_vars.astra_customizer_css:ast_block_template_vars.server_astra_customizer_css,globalStylesheet:e.global_stylesheet,colorPalette:I,dynamicContent:s[e.category]??[],selectedImages:l,email:b.email,phone:b.phone,address:b.address}):React.createElement(ic,{key:e.ID,item:e}))(e,t)))),React.createElement("div",{className:"h-10 w-full mb-10"}))))})));var Pc=o(8270),Tc=o(1635),Nc=o(7482);function Ic(e,t){return void 0===t&&(t={}),function(e,t){return void 0===t&&(t={}),(0,Nc.W)(e,(0,Tc.Cl)({delimiter:"."},t))}(e,(0,Tc.Cl)({delimiter:"-"},t))}const Oc=/[\u007F-\u009F "'>/="\uFDD0-\uFDEF]/;function Lc(e){return e.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi,"&")}function Bc(e){return function(e){return e.replace(/>/g,">")}(function(e){return e.replace(/"/g,""")}(Lc(e)))}function jc({children:e,...t}){let r="";return i.Children.toArray(e).forEach((e=>{"string"==typeof e&&""!==e.trim()&&(r+=e)})),(0,i.createElement)("div",{dangerouslySetInnerHTML:{__html:r},...t})}const{Provider:Dc,Consumer:Fc}=(0,i.createContext)(void 0),Mc=(0,i.forwardRef)((()=>null)),zc=new Set(["string","boolean","number"]),Vc=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),Wc=new Set(["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"]),Uc=new Set(["autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"]),Hc=new Set(["animation","animationIterationCount","baselineShift","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","cx","cy","fillOpacity","flexGrow","flexShrink","floodOpacity","fontWeight","gridColumnEnd","gridColumnStart","gridRowEnd","gridRowStart","lineHeight","opacity","order","orphans","r","rx","ry","shapeImageThreshold","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","x","y","zIndex","zoom"]);function $c(e,t){return t.some((t=>0===e.indexOf(t)))}function Zc(e){return"key"===e||"children"===e}function Gc(e,t){return"style"===e?function(e){if(!(0,Pc.Q)(e))return e;let t;for(const r in e){const n=e[r];null!=n&&(t?t+=";":t="",t+=Jc(r)+":"+Qc(r,n))}return t}(t):t}const qc=["accentHeight","alignmentBaseline","arabicForm","baselineShift","capHeight","clipPath","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","dominantBaseline","enableBackground","fillOpacity","fillRule","floodColor","floodOpacity","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","horizAdvX","horizOriginX","imageRendering","letterSpacing","lightingColor","markerEnd","markerMid","markerStart","overlinePosition","overlineThickness","paintOrder","panose1","pointerEvents","renderingIntent","shapeRendering","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","textAnchor","textDecoration","textRendering","underlinePosition","underlineThickness","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","vHanging","vIdeographic","vMathematical","vectorEffect","vertAdvY","vertOriginX","vertOriginY","wordSpacing","writingMode","xmlnsXlink","xHeight"].reduce(((e,t)=>(e[t.toLowerCase()]=t,e)),{}),Yc=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","suppressContentEditableWarning","suppressHydrationWarning","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector"].reduce(((e,t)=>(e[t.toLowerCase()]=t,e)),{}),Kc=["xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","xmlns:xlink"].reduce(((e,t)=>(e[t.replace(":","").toLowerCase()]=t,e)),{});function Xc(e){switch(e){case"htmlFor":return"for";case"className":return"class"}const t=e.toLowerCase();return Yc[t]?Yc[t]:qc[t]?Ic(qc[t]):Kc[t]?Kc[t]:t}function Jc(e){return e.startsWith("--")?e:$c(e,["ms","O","Moz","Webkit"])?"-"+Ic(e):Ic(e)}function Qc(e,t){return"number"!=typeof t||0===t||Hc.has(e)?t:t+"px"}function eu(e,t,r={}){if(null==e||!1===e)return"";if(Array.isArray(e))return ru(e,t,r);switch(typeof e){case"string":return Lc(e).replace(/":"<"+e+i+">"+a+""+e+">"}function ru(e,t,r={}){let n="";e=Array.isArray(e)?e:[e];for(let a=0;a{const e={};return Object.seal({on:(t,r)=>{const n=`ast:${t}`;e[n]||(e[n]=r),document.addEventListener(n,r)},emit:(e,t)=>{const r=new CustomEvent(`ast:${e}`,{detail:t});document.dispatchEvent(r)},off:(t,r)=>{const n=`ast:${t}`;e[n]&&document.removeEventListener(n,r)}})})(),{images:lu}=ast_block_template_vars,cu=()=>{const{importInProgress:e,notice:n}=(0,t.A)((e=>{const{getImportInProgress:t,getNotice:r}=e(g.U);return{importInProgress:t(),notice:r()}}),[]),{setImportInProgress:a}=(0,r.A)(g.U);return!(!e||"import-info"!==n?.type&&"import-error"!==n?.type)&&React.createElement("div",{className:"absolute inset-x-0 top-[4.5rem] h-[calc(100%_-_4.5rem)] w-full",style:{backgroundImage:`url('${lu}background.png')`}},React.createElement("div",{className:"absolute inset-0 backdrop-blur-md bg-[#F0F0FF]/[0.9]"}),React.createElement("div",{className:"relative w-full h-full grid grid-cols-1 grid-rows-1 place-items-center z-[1]"},React.createElement("div",{className:(0,y.xW)("h-auto w-full -mt-8 flex items-center justify-center flex-col rounded-lg py-7 px-10 border border-solid border-zip-light-border-primary shadow-xlarge bg-white","import-error"===n?.type?"max-w-[27.375rem]":"max-w-xs")},"import-error"===n?.type?React.createElement(ei.Rk,{className:"size-5"}):React.createElement(ei.ug,{className:"mx-auto text-accent-spectra animate-hour-glass"}),React.createElement("h6",{className:"mt-4 mb-1 text-center text-base font-medium text-zip-app-heading"},"import-error"===n?.type?n?.title:(0,u.__)("Please wait a moment","astra-sites")),React.createElement("p",{className:"m-0 text-center text-sm font-normal text-slate-500",dangerouslySetInnerHTML:{__html:n.message}}),"import-error"===n?.type&&React.createElement(ii.A,{variant:"primary",className:"mt-6",onClick:()=>{a(!1)},isSmall:!0},(0,u.__)("Back to Main Screen","astra-sites")))))};var uu=o(7510),du=o(5034);function pu(){return pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{getDisableAi:t,getTogglePopup:r}=e(g.U);return{disableAi:t(),togglePopup:r()}})))((0,i.memo)((({item:e,content:t,stylesheet:r,astraCustomizer:n,globalStylesheet:a,colorPalette:o,dynamicContent:s,selectedImages:l,disableAi:c,togglePopup:u,email:d,phone:p,address:m,onClickBlock:f,className:g="",fullPreview:h=!1,disableAutoScroll:b=!1})=>{const v=(0,i.useRef)(null),w=(0,i.useRef)(null),x=e["thumbnail-image-url"]||"",_=e["featured-image-url"]||"";let E=0,k=0;const[S,C]=(0,i.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),[R,A]=(0,i.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`);function P(){const e=v?.current,t=w?.current;if(!e||!t)return;const r=e.parentNode.offsetWidth/1200,n=r*t.offsetHeight;e.style.transform=`scale(${r})`,e.style.height=`${n}px`}(0,i.useLayoutEffect)((()=>{let e=!0;const i=l,u=new Image;u.src=x;const f=new Image;f.src=_;const g=w.current;function h(t,r){e&&(t.onload=()=>{r(t.src)})}h(u,C),h(f,A);const y=document.getElementById("astra-wp-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),b=document.getElementById("astra-block-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container");let v="";if(r&&(r=((e,t=[])=>c?e:0!==Object.keys(s).length&&s?t&&0===t.length?e:e.replace(/background-image\s*:\s*url\(['"]?([^'")]+)['"]?\)/g,(function(e,r){if((0,uu.p)(r))return e;if(!t[k]?.url)return"";const n=t[k]?.url;return k++,k%=t.length,'background-image: url("'+n+'")'})):e)(r,i)),v+=n?``:"",v+=``,v=r?`${v} `:v,a&&(v+=``),y&&(v+=``),b&&(v+=``),g&&t){let e=g.shadowRoot;if(null===e&&(e=g.attachShadow({mode:"open"})),null===e)return;let r=t;if(!c){const e=s??[];e&&Object.keys(e)?.length>0&&Object.keys(e).forEach((t=>{r=null!==e[t]?r.replace(t,e[t]):r})),s&&Object.keys(s).length>0&&(S=r,d&&(S=S.replace("contact@example.com",d)),p&&(S=S.replace("202-555-0188",p)),m&&(S=S.replace("2360 Hood Avenue, San Diego, CA, 92123",m)),r=S,r=N(r))}e.innerHTML=v+''+r+"
",o.forEach(((t,r)=>{e?.host.style.setProperty(`--ast-global-color-${r}`,t)}));const n=g.shadowRoot.querySelectorAll("img");e&&(n.forEach((e=>{(0,uu.p)(e.src)||c||0===i?.length||0===Object.keys(s).length||!s||T(e,"hidden")})),P(),((e,t)=>{c||0!==Object.keys(s).length&&s&&t?.length&&e?.forEach((function(e){(0,uu.p)(e.src)||(e.onload=()=>{const r=e.getAttribute("src")||"";if(r.includes("unsplash")||r.includes("pexels")||r.includes("pixabay"))return void T(e,gu);const n=t[E];if(void 0!==n)if(n.url.includes("unsplash")||n.url.includes("pexels")||n.url.includes("pixabay")){if(E++,void 0===t[E]&&(E=0),"PICTURE"===e.parentNode.nodeName)e.parentNode.querySelectorAll("source").forEach((e=>{e.setAttribute("srcset",n.optimized_url)})),e.parentNode.querySelector("img").setAttribute("src",n.optimized_url);else{const t=document.createElement("img");t.src=n.optimized_url,e.parentNode.replaceChild(t,e)}T(e,gu)}else T(e,gu);else T(e,gu)},e.onerror=()=>{T(e,gu)})}))})(n,i))}var S;return()=>{e=!1}}),[e,c,s,l]),(0,i.useEffect)((()=>{const e=new ResizeObserver(P);return e.observe(document.documentElement),()=>{e&&e.disconnect()}}),[]),(0,i.useEffect)((()=>{const e=document.querySelector("#ast-block-templates-modal-wrap");if(!e)return;const t=new MutationObserver(P);return t.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{t&&t.disconnect()}}),[]),(0,i.useEffect)((()=>{const e=w?.current;if(e){const t=e.shadowRoot;o.forEach(((e,r)=>{null!==t&&t.host.style.setProperty(`--ast-global-color-${r}`,e)}))}}),[o]);const T=(e,t)=>{e&&(e.style.visibility=t)},N=(e="")=>m?e.replace(/(src="https:\/\/maps\.google\.com\/maps\?q=)([^&]+)(&z=\d+&hl=en&t=m&output=embed&iwloc=near")/g,`$1${encodeURIComponent(m)}$3`):e;let I=0,O=0;const L=(e,t,r)=>{const n=e.scrollTop,a=t-n;let i=0;const o=function(){i+=20;const t=du.A.linearTween(i,n,a,r);e.scrollTop=t,i{e&&null===e.target.closest(".gt-single-block-action-btns")&&"function"==typeof f&&f(t)};(0,i.useEffect)((()=>{u||(E=0,k=0)}),[u]);const j=fu?"origin-top-right":"origin-top-left";return React.createElement("div",{className:(0,y.xW)("cursor-pointer relative border border-solid border-border-primary overflow-hidden group",g)},React.createElement("div",{className:(0,y.xW)("thumbnail left-0 m-0 min-h-[auto] overflow-visible text-left top-0 relative pointer-events-none",j),ref:v},React.createElement("div",{className:(0,y.xW)("absolute w-[1200px] pointer-events-none overflow-hidden",h?"max-h-fit":"max-h-[1600px]"),ref:w},!t&&React.createElement("img",{srcSet:`${R}, ${S}`,src:S,alt:"Preview"}),React.createElement("div",{className:"preview"},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"})))),!h&&React.createElement("div",pu({className:"absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end",onClick:t=>B(t,e)},b&&{onMouseEnter:()=>{if("page"!==e.type)return;const t=w.current;I&&clearTimeout(I),O=setTimeout((()=>{L(t,t.scrollHeight,4e3)}),1e3)},onMouseLeave:()=>{O&&clearTimeout(O);const e=w.current;I&&clearTimeout(I),L(e,0,1500)}},{role:"button",tabIndex:"0",onKeyDown:t=>"Enter"===t.key?B(t,e):null})))})));var yu=o(9453);const bu=(0,i.memo)((()=>{const{setCurrentScreen:e,setPagePreview:n}=(0,r.A)(g.U),{pagePreviewItem:a,adaptiveMode:o,defaultPalette:s,activePalette:l,dynamicContent:c,selectedImages:d,businessContact:p,allPages:m,importInProgress:f}=(0,t.A)((e=>{const{getPagePreview:t,getAdaptiveMode:r,getDefaultPageColorPalette:n,getActivePagePalette:a,getDynamicContent:i,getAIStepData:o,getAllBlocksPages:s,getImportInProgress:l}=e(g.U);return{pagePreviewItem:t(),adaptiveMode:r(),defaultPalette:n(),activePalette:a(),dynamicContent:i(),selectedImages:o().selectedImages,businessContact:o().businessContact,allPages:s(),importInProgress:l()}})),[h,b]=(0,i.useState)(!1),v=(0,y.Fx)(),w=()=>v.notInstalled?(0,u.__)("Install Spectra & Insert","astra-sites"):v.inactive?(0,u.__)("Activate Spectra & Insert","astra-sites"):(0,u.__)("Insert","astra-sites"),x=e=>()=>{n(e)},_=Object.keys(l).length>0?l.colors:s.colors,E=m.filter((e=>e.category===a.category));return React.createElement("div",{className:"flex h-full pt-6 px-10 mx-auto gap-10"},React.createElement("div",{className:"flex-1 h-full"},React.createElement("div",{className:"h-full flex flex-col items-stretch justify-stretch space-y-6"},React.createElement("div",{className:"flex flex-col sm:flex-row items-start justify-start gap-5"},React.createElement(ii.A,{className:(0,y.xW)("inline-flex pl-1 py-1 pr-2 h-7 gap-1 border-border-primary text-body-text"),variant:"white",hasPrefixIcon:!0,isSmall:!0,onClick:()=>e("all-block-pages-grid")},React.createElement(Yi,{className:"w-4 h-4"}),React.createElement("span",null,"Back")),React.createElement("h5",{className:"m-0 text-xl font-semibold inline-block"},"Page Preview")),React.createElement("div",{className:"h-full w-full overflow-y-auto ast-thin-scrollbar !mb-6"},React.createElement(hu,{item:a,content:a.content,stylesheet:a.stylesheet,astraCustomizer:o?ast_block_template_vars.astra_customizer_css:ast_block_template_vars.server_astra_customizer_css,globalStylesheet:a.global_stylesheet,colorPalette:_,dynamicContent:c[a.category]??[],selectedImages:d,email:p.email,phone:p.phone,address:p.address,fullPreview:!0})))),React.createElement("div",{className:"flex flex-col w-2/6 lg:w-[35%] h-full"},React.createElement("h5",{className:"m-0 text-xl font-semibold inline-block mb-6"},"Other Designs"),React.createElement("div",{className:"grid grid-cols-1 xl:grid-cols-2 auto-rows-auto overflow-y-auto ast-thin-scrollbar gap-2.5 lg:gap-5 xl:gap-10"},E.map((e=>React.createElement("div",{key:e.ID,className:(0,y.xW)("w-full h-fit hover:shadow-xl group transition ease-in-out duration-150",f&&"pointer-events-none !cursor-not-allowed")},React.createElement(hu,{className:"group-hover:border-accent-spectra transition ease-in-out duration-150",item:e,content:e.content,stylesheet:e.stylesheet,astraCustomizer:o?ast_block_template_vars.astra_customizer_css:ast_block_template_vars.server_astra_customizer_css,globalStylesheet:e.global_stylesheet,colorPalette:_,dynamicContent:c[e.category]??[],selectedImages:d,email:p.email,phone:p.phone,address:p.address,onClickBlock:x(e)}))))),React.createElement("div",{className:"pt-8 pb-6 mt-auto"},React.createElement("div",{className:"flex flex-wrap xl:flex-nowrap gap-6 items-center justify-center"},React.createElement(Vs.A,{item:a},(({isFavorite:e,onClickFavorite:t})=>React.createElement(ii.A,{className:(0,y.xW)("xl:w-1/2 w-full truncate",f&&"pointer-events-none !cursor-not-allowed"),variant:"white",hasSuffixIcon:!0,onClick:t},React.createElement("span",{className:"hidden sm:inline text-base font-medium truncate"},e?"Remove from favorites":"Add to favorites"),React.createElement(Bs.A,{className:(0,y.xW)("shrink-0 size-6 sm:size-5 transition-colors ease-out duration-150",e?"fill-favorite text-favorite":"group-hover/favorites:fill-favorite group-hover/favorites:text-favorite")})))),React.createElement(yu.A,{title:w(),showIcon:v.active,liveRequest:!0,item:a,importing:h,onClick:()=>{b(!0)},onBlockImport:()=>{b(!1),e("all-block-pages-grid")},onImportFail:()=>{b(!1)}},(({onClick:e,disableImport:t})=>React.createElement(ii.A,{className:(0,y.xW)("w-full xl:w-1/2 relative truncate"),variant:"primary",hasSuffixIcon:v.active,onClick:e,disabled:t||f&&!h},React.createElement("span",{className:(0,y.xW)("hidden sm:inline truncate",h&&"invisible")},w()),React.createElement(As.A,{className:(0,y.xW)("sm:size-5 size-6 shrink-0",h&&"invisible")}),h&&React.createElement("span",{className:"absolute top-0 left-0 w-full h-full flex items-center justify-center"},React.createElement(Vi.A,null)))))))))})),vu=({filterPagesBySearchTerm:e,currentScreen:r})=>{const{showPagesOnboarding:n,stepData:{businessDetails:a},dynamicContentSyncStatus:o,disableAi:s}=(0,t.A)((e=>{const{getShowPagesOnboarding:t,getAIStepData:r,getDynamicContentSyncStatus:n,getDisableAi:a}=e(g.U);return{showPagesOnboarding:t(),stepData:r(),dynamicContentSyncStatus:n(),disableAi:a()}}),[]);return(0,i.useEffect)((()=>{localStorage.setItem("gt-current-screen-"+ast_block_template_vars.site_host,r)}),[r]),"all-single-pages"===r?React.createElement(uc,null):"all-wireframe-grid"===r?React.createElement(Lo,null):"all-blocks-grid"===r?React.createElement(_s,null):"all-block-pages-grid"===r?n&&a&&!o.pages&&!s?React.createElement(kc,null):React.createElement(gc,null):"single-block-page-full-preview"===r?React.createElement(bu,null):e||"all-single-site-pages"!==r?"all-favorites"===r?React.createElement(Ac,null):"all-sites-grid"===r?React.createElement(sc,null):"full-width-block-preview"===r?React.createElement(lc,null):"full-width-page-preview"===r?React.createElement(cc,null):void 0:React.createElement(nc,null)},wu=(0,e.A)((0,a.A)((e=>{const{getFilterPagesBySearchTerm:t,getSitePreview:r,getCurrentScreen:n,getTogglePopup:a,getConnectZipAI:i}=e("astra-sites");return{filterPagesBySearchTerm:t(),sitePreview:r(),currentScreen:n(),togglePopup:a(),connectZipAI:i()}})),(0,n.A)((e=>{const{setActiveBlockPaletteSlug:t,setActiveBlockPalette:r,setActivePagePaletteSlug:n,setActivePagePalette:a,toggleOnboardingAIStep:i}=e("astra-sites");return{setActiveBlockPaletteSlug:t,setActiveBlockPalette:r,setActivePagePaletteSlug:n,setActivePagePalette:a,toggleOnboardingAIStep:i}})))((0,i.memo)((({sitePreview:e,currentScreen:n,togglePopup:a,setActiveBlockPaletteSlug:o,setActiveBlockPalette:s,setActivePagePaletteSlug:l,setActivePagePalette:c,connectZipAI:d,toggleOnboardingAIStep:p})=>{const{token:m=null}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return{...t()}}),[]),{initializeBlocksAndSites:f}=(0,r.A)(g.U);(0,i.useEffect)((()=>{!0===a&&(document.body.classList.add("ast-block-templates-modal-open"),document.getElementById("ast-block-templates-modal-wrap").classList.add("open"),o("style-1"),s(ast_block_template_vars.block_color_palette["style-1"]),l("style-1"),c(ast_block_template_vars.page_color_palette["style-1"]))}),[a,n,e]);const{initiateImportProcess:h}=((e=!1)=>{const{index:n}=wp.data.select("core/block-editor").getBlockInsertionPoint(),{insertBlocks:a}=wp.data.dispatch("core/block-editor"),{importInProgress:o,importItemInfo:s,activePagePaletteSlug:l,activeBlockPaletteSlug:c,currentScreen:d,disableAI:p,togglePopup:m}=(0,t.A)((e=>{const{getImportInProgress:t,getAIStepData:r,getImportItemInfo:n,getCurrentScreen:a,getActiveBlockPaletteSlug:i,getActivePagePaletteSlug:o,getDisableAi:s,getTogglePopup:l}=e(g.U);return{importInProgress:t(),stepData:r(),importItemInfo:n(),activePagePaletteSlug:o(),currentScreen:a(),activeBlockPaletteSlug:i(),disableAI:s(),togglePopup:l()}}),[]),{setImportInProgress:f,setTogglePopup:h,setImportItemInfo:b,setNotice:v}=(0,r.A)(g.U),w=(0,y.Fx)();let[x]=(0,i.useState)(s),_=[];const E=e=>{const t=React.createElement("a",{href:"https://wpastra.com/contact",target:"_blank",rel:"noreferrer"},(0,u.__)("support team","astra-sites")),r=`\n\t\t\t\n\t\t\t\t${(0,u.nv)((0,u.__)("If this error continues please contact our %1$s.","astra-sites"),nu(t))}\n\t\t\t \n\t\t`;v({type:"import-error",title:"Oops, something went wrong!",message:nu(React.createElement("span",{className:"block"},e))+r})},k=(e="info",t="",r="default")=>{wp?.data.dispatch("core/notices").createNotice(e,t,{isDismissible:!0,type:r})},S=async()=>{try{v({type:"import-info",message:(0,u.__)("Activating Spectra plugin…","astra-sites")}),await(0,Cs.s)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"})}catch(e){throw new Error((0,u.__)("Failed to active Spectra. Please try again later.","astra-sites"),{cause:"customError"})}},C=async()=>{try{v({type:"import-info",message:(0,u.__)("Activating WPForms plugin…","astra-sites")}),await(0,Cs.s)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}),await A()}catch(e){throw new Error((0,u.__)("Failed to active WPForms. Please try again later.","astra-sites"),{cause:"customError"})}},R=(t,{type:r,colorPalette:i})=>{const o=x.original_content,s=!!r&&r||("all-blocks-grid"===d?"block":"page"),m="block"===s?x["blocks-category"][0]:x["pages-category"][0],g=!!i&&i||("block"===s?c:l),b=x?.id;iu({action:"ast_block_templates_import_block",content:o,category:m,id:b,_ajax_nonce:ast_block_template_vars._ajax_nonce,style:g,disableAI:p,block_type:s}).done((r=>{f(!1);const i=(0,y.XD)(ou(r));a(i,n,"",!1),e&&h(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open"),"function"==typeof t&&t(r,n),k("success","The block has been imported successfully."),"active"!==ast_block_template_vars.spectra_status&&(0,Wo.mP)()})).fail((()=>{throw new Error((0,u.__)("Failed to import the block. Please try again later.","astra-sites"),{cause:"customError"})}))},A=(e,{type:t,colorPalette:r})=>{x?.["post-meta"]?.["astra-site-wpforms-path"]?(e=>{iu({action:"ast_block_templates_import_wpforms",id:x?.id,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((()=>{R(e)})).fail((()=>{throw new Error((0,u.__)("Failed import WPForms. Please try again later.","astra-sites"),{cause:"customError"})}))})(e):R(e,{type:t,colorPalette:r})};return{initiateImportProcess:async({blockId:e,type:t,colorPalette:r},n)=>{if(!o){f(!0),m||h();try{w.notInstalled?(await(async()=>{try{v({type:"import-info",message:(0,u.__)("Installing Spectra plugin…","astra-sites")}),await(0,Cs.o)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"})}catch(e){throw new Error((0,u.__)("Failed to install Spectra. Please try again later.","astra-sites"),{cause:"customError"})}})(),await S()):w.inactive&&await S();const a=await(0,Rs.V)(e,"astra-blocks");b(a),x=a,_=a?.["post-meta"]?.["astra-blocks-required-plugins"]?au.j.parse(a["post-meta"]["astra-blocks-required-plugins"]):[],_.length?"not-installed"===ast_block_template_vars.wpforms_status?(await(async()=>{try{v({type:"import-info",message:(0,u.__)("Installing WPForms plugin…","astra-sites")}),await(0,Cs.o)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"})}catch(e){throw new Error((0,u.__)("Failed to install WPForms. Please try again later.","astra-sites"),{cause:"customError"})}})(),await C()):"inactive"===ast_block_template_vars.wpforms_status?await C():await A(n,{type:t,colorPalette:r}):await A(n,{type:t,colorPalette:r})}catch(e){if("customError"===e?.cause)return void E(e.message);k("error","Failed to import the block. Please try again later or contact support for assistance."),E((0,u.__)("Failed to fetch block data. Please try again later.","astra-sites"))}}}}})(!0);return(0,i.useEffect)((()=>{const e="ast-import",t=(0,y._9)(e);if(!t||!m)return(0,y.D6)(e);const{blockId:r,blockType:n,blockPaletteSlug:a,pagePaletteSlug:i}=t;h({blockId:r,colorPalette:"block"===n?a:i,type:n}),(0,y.D6)(e),wb()}),[]),(0,i.useEffect)((()=>{su.on("open-onboarding-ai",(()=>{p(!0)}))}),[]),(0,i.useEffect)((()=>{f()}),[]),React.createElement("div",{className:"bg-white h-[calc(100vh_-_9.5rem)]"},d?React.createElement(_c,null):React.createElement(vu,{currentScreen:n}),React.createElement(cu,null))})));function xu({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const _u=i.forwardRef(xu);var Eu=o(6607),ku="tippy-content",Su="tippy-backdrop",Cu="tippy-arrow",Ru="tippy-svg-arrow",Au={passive:!0,capture:!0},Pu=function(){return document.body};function Tu(e,t,r){if(Array.isArray(e)){var n=e[t];return null==n?Array.isArray(r)?r[t]:r:n}return e}function Nu(e,t){var r={}.toString.call(e);return 0===r.indexOf("[object")&&r.indexOf(t+"]")>-1}function Iu(e,t){return"function"==typeof e?e.apply(void 0,t):e}function Ou(e,t){return 0===t?e:function(n){clearTimeout(r),r=setTimeout((function(){e(n)}),t)};var r}function Lu(e){return[].concat(e)}function Bu(e,t){-1===e.indexOf(t)&&e.push(t)}function ju(e){return[].slice.call(e)}function Du(e){return Object.keys(e).reduce((function(t,r){return void 0!==e[r]&&(t[r]=e[r]),t}),{})}function Fu(e){return["Element","Fragment"].some((function(t){return Nu(e,t)}))}function Mu(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function zu(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function Vu(e,t,r){var n=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[n](t,r)}))}function Wu(e,t){for(var r=t;r;){var n;if(e.contains(r))return!0;r=null==r.getRootNode||null==(n=r.getRootNode())?void 0:n.host}return!1}var Uu={isTouch:!1},Hu=0;function $u(){Uu.isTouch||(Uu.isTouch=!0,window.performance&&document.addEventListener("mousemove",Zu))}function Zu(){var e=performance.now();e-Hu<20&&(Uu.isTouch=!1,document.removeEventListener("mousemove",Zu)),Hu=e}function Gu(){var e,t=document.activeElement;if((e=t)&&e._tippy&&e._tippy.reference===e){var r=t._tippy;t.blur&&!r.state.isVisible&&t.blur()}}var qu=!("undefined"==typeof window||"undefined"==typeof document||!window.msCrypto),Yu=Object.assign({appendTo:Pu,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Ku=Object.keys(Yu);function Xu(e){var t=(e.plugins||[]).reduce((function(t,r){var n,a=r.name,i=r.defaultValue;return a&&(t[a]=void 0!==e[a]?e[a]:null!=(n=Yu[a])?n:i),t}),{});return Object.assign({},e,t)}function Ju(e,t){var r=Object.assign({},t,{content:Iu(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(Xu(Object.assign({},Yu,{plugins:t}))):Ku).reduce((function(t,r){var n=(e.getAttribute("data-tippy-"+r)||"").trim();if(!n)return t;if("content"===r)t[r]=n;else try{t[r]=JSON.parse(n)}catch(e){t[r]=n}return t}),{})}(e,t.plugins));return r.aria=Object.assign({},Yu.aria,r.aria),r.aria={expanded:"auto"===r.aria.expanded?t.interactive:r.aria.expanded,content:"auto"===r.aria.content?t.interactive?null:"describedby":r.aria.content},r}function Qu(e){var t=e.firstElementChild,r=ju(t.children);return{box:t,content:r.find((function(e){return e.classList.contains(ku)})),arrow:r.find((function(e){return e.classList.contains(Cu)||e.classList.contains(Ru)})),backdrop:r.find((function(e){return e.classList.contains(Su)}))}}var ed=1,td=[],rd=[];function nd(e,t){var r,n,a,i,o,s,l,c,u=Ju(e,Object.assign({},Yu,Xu(Du(t)))),d=!1,p=!1,m=!1,f=!1,g=[],h=Ou(G,u.interactiveDebounce),y=ed++,b=(c=u.plugins).filter((function(e,t){return c.indexOf(e)===t})),v={id:y,reference:e,popper:document.createElement("div"),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:b,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(n),cancelAnimationFrame(a)},setProps:function(t){if(!v.state.isDestroyed){O("onBeforeUpdate",[v,t]),$();var r=v.props,n=Ju(e,Object.assign({},r,Du(t),{ignoreAttributes:!0}));v.props=n,H(),r.interactiveDebounce!==n.interactiveDebounce&&(j(),h=Ou(G,n.interactiveDebounce)),r.triggerTarget&&!n.triggerTarget?Lu(r.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):n.triggerTarget&&e.removeAttribute("aria-expanded"),B(),I(),_&&_(r,n),v.popperInstance&&(X(),Q().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}))),O("onAfterUpdate",[v,t])}},setContent:function(e){v.setProps({content:e})},show:function(){var e=v.state.isVisible,t=v.state.isDestroyed,r=!v.state.isEnabled,n=Uu.isTouch&&!v.props.touch,a=Tu(v.props.duration,0,Yu.duration);if(!(e||t||r||n||A().hasAttribute("disabled")||(O("onShow",[v],!1),!1===v.props.onShow(v)))){if(v.state.isVisible=!0,R()&&(x.style.visibility="visible"),I(),z(),v.state.isMounted||(x.style.transition="none"),R()){var i=T();Mu([i.box,i.content],0)}var o,l,c;s=function(){var e;if(v.state.isVisible&&!f){if(f=!0,x.offsetHeight,x.style.transition=v.props.moveTransition,R()&&v.props.animation){var t=T(),r=t.box,n=t.content;Mu([r,n],a),zu([r,n],"visible")}L(),B(),Bu(rd,v),null==(e=v.popperInstance)||e.forceUpdate(),O("onMount",[v]),v.props.animation&&R()&&function(e,t){W(e,(function(){v.state.isShown=!0,O("onShown",[v])}))}(a)}},l=v.props.appendTo,c=A(),(o=v.props.interactive&&l===Pu||"parent"===l?c.parentNode:Iu(l,[c])).contains(x)||o.appendChild(x),v.state.isMounted=!0,X()}},hide:function(){var e=!v.state.isVisible,t=v.state.isDestroyed,r=!v.state.isEnabled,n=Tu(v.props.duration,1,Yu.duration);if(!(e||t||r)&&(O("onHide",[v],!1),!1!==v.props.onHide(v))){if(v.state.isVisible=!1,v.state.isShown=!1,f=!1,d=!1,R()&&(x.style.visibility="hidden"),j(),V(),I(!0),R()){var a=T(),i=a.box,o=a.content;v.props.animation&&(Mu([i,o],n),zu([i,o],"hidden"))}L(),B(),v.props.animation?R()&&function(e,t){W(e,(function(){!v.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&t()}))}(n,v.unmount):v.unmount()}},hideWithInteractivity:function(e){P().addEventListener("mousemove",h),Bu(td,h),h(e)},enable:function(){v.state.isEnabled=!0},disable:function(){v.hide(),v.state.isEnabled=!1},unmount:function(){v.state.isVisible&&v.hide(),v.state.isMounted&&(J(),Q().forEach((function(e){e._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),rd=rd.filter((function(e){return e!==v})),v.state.isMounted=!1,O("onHidden",[v]))},destroy:function(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),$(),delete e._tippy,v.state.isDestroyed=!0,O("onDestroy",[v]))}};if(!u.render)return v;var w=u.render(v),x=w.popper,_=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+v.id,v.popper=x,e._tippy=v,x._tippy=v;var E=b.map((function(e){return e.fn(v)})),k=e.hasAttribute("aria-expanded");return H(),B(),I(),O("onCreate",[v]),u.showOnCreate&&ee(),x.addEventListener("mouseenter",(function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&P().addEventListener("mousemove",h)})),v;function S(){var e=v.props.touch;return Array.isArray(e)?e:[e,0]}function C(){return"hold"===S()[0]}function R(){var e;return!(null==(e=v.props.render)||!e.$$tippy)}function A(){return l||e}function P(){var e,t,r=A().parentNode;return r?null!=(t=Lu(r)[0])&&null!=(e=t.ownerDocument)&&e.body?t.ownerDocument:document:document}function T(){return Qu(x)}function N(e){return v.state.isMounted&&!v.state.isVisible||Uu.isTouch||i&&"focus"===i.type?0:Tu(v.props.delay,e?0:1,Yu.delay)}function I(e){void 0===e&&(e=!1),x.style.pointerEvents=v.props.interactive&&!e?"":"none",x.style.zIndex=""+v.props.zIndex}function O(e,t,r){var n;void 0===r&&(r=!0),E.forEach((function(r){r[e]&&r[e].apply(r,t)})),r&&(n=v.props)[e].apply(n,t)}function L(){var t=v.props.aria;if(t.content){var r="aria-"+t.content,n=x.id;Lu(v.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(r);if(v.state.isVisible)e.setAttribute(r,t?t+" "+n:n);else{var a=t&&t.replace(n,"").trim();a?e.setAttribute(r,a):e.removeAttribute(r)}}))}}function B(){!k&&v.props.aria.expanded&&Lu(v.props.triggerTarget||e).forEach((function(e){v.props.interactive?e.setAttribute("aria-expanded",v.state.isVisible&&e===A()?"true":"false"):e.removeAttribute("aria-expanded")}))}function j(){P().removeEventListener("mousemove",h),td=td.filter((function(e){return e!==h}))}function D(t){if(!Uu.isTouch||!m&&"mousedown"!==t.type){var r=t.composedPath&&t.composedPath()[0]||t.target;if(!v.props.interactive||!Wu(x,r)){if(Lu(v.props.triggerTarget||e).some((function(e){return Wu(e,r)}))){if(Uu.isTouch)return;if(v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else O("onClickOutside",[v,t]);!0===v.props.hideOnClick&&(v.clearDelayTimeouts(),v.hide(),p=!0,setTimeout((function(){p=!1})),v.state.isMounted||V())}}}function F(){m=!0}function M(){m=!1}function z(){var e=P();e.addEventListener("mousedown",D,!0),e.addEventListener("touchend",D,Au),e.addEventListener("touchstart",M,Au),e.addEventListener("touchmove",F,Au)}function V(){var e=P();e.removeEventListener("mousedown",D,!0),e.removeEventListener("touchend",D,Au),e.removeEventListener("touchstart",M,Au),e.removeEventListener("touchmove",F,Au)}function W(e,t){var r=T().box;function n(e){e.target===r&&(Vu(r,"remove",n),t())}if(0===e)return t();Vu(r,"remove",o),Vu(r,"add",n),o=n}function U(t,r,n){void 0===n&&(n=!1),Lu(v.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,r,n),g.push({node:e,eventType:t,handler:r,options:n})}))}function H(){var e;C()&&(U("touchstart",Z,{passive:!0}),U("touchend",q,{passive:!0})),(e=v.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(U(e,Z),e){case"mouseenter":U("mouseleave",q);break;case"focus":U(qu?"focusout":"blur",Y);break;case"focusin":U("focusout",Y)}}))}function $(){g.forEach((function(e){var t=e.node,r=e.eventType,n=e.handler,a=e.options;t.removeEventListener(r,n,a)})),g=[]}function Z(e){var t,r=!1;if(v.state.isEnabled&&!K(e)&&!p){var n="focus"===(null==(t=i)?void 0:t.type);i=e,l=e.currentTarget,B(),!v.state.isVisible&&Nu(e,"MouseEvent")&&td.forEach((function(t){return t(e)})),"click"===e.type&&(v.props.trigger.indexOf("mouseenter")<0||d)&&!1!==v.props.hideOnClick&&v.state.isVisible?r=!0:ee(e),"click"===e.type&&(d=!r),r&&!n&&te(e)}}function G(e){var t=e.target,r=A().contains(t)||x.contains(t);if("mousemove"!==e.type||!r){var n=Q().concat(x).map((function(e){var t,r=null==(t=e._tippy.popperInstance)?void 0:t.state;return r?{popperRect:e.getBoundingClientRect(),popperState:r,props:u}:null})).filter(Boolean);(function(e,t){var r=t.clientX,n=t.clientY;return e.every((function(e){var t=e.popperRect,a=e.popperState,i=e.props.interactiveBorder,o=a.placement.split("-")[0],s=a.modifiersData.offset;if(!s)return!0;var l="bottom"===o?s.top.y:0,c="top"===o?s.bottom.y:0,u="right"===o?s.left.x:0,d="left"===o?s.right.x:0,p=t.top-n+l>i,m=n-t.bottom-c>i,f=t.left-r+u>i,g=r-t.right-d>i;return p||m||f||g}))})(n,e)&&(j(),te(e))}}function q(e){K(e)||v.props.trigger.indexOf("click")>=0&&d||(v.props.interactive?v.hideWithInteractivity(e):te(e))}function Y(e){v.props.trigger.indexOf("focusin")<0&&e.target!==A()||v.props.interactive&&e.relatedTarget&&x.contains(e.relatedTarget)||te(e)}function K(e){return!!Uu.isTouch&&C()!==e.type.indexOf("touch")>=0}function X(){J();var t=v.props,r=t.popperOptions,n=t.placement,a=t.offset,i=t.getReferenceClientRect,o=t.moveTransition,l=R()?Qu(x).arrow:null,c=i?{getBoundingClientRect:i,contextElement:i.contextElement||A()}:e,u=[{name:"offset",options:{offset:a}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!o}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(R()){var r=T().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?r.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?r.setAttribute("data-"+e,""):r.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];R()&&l&&u.push({name:"arrow",options:{element:l,padding:3}}),u.push.apply(u,(null==r?void 0:r.modifiers)||[]),v.popperInstance=(0,Za.n4)(c,x,Object.assign({},r,{placement:n,onFirstUpdate:s,modifiers:u}))}function J(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Q(){return ju(x.querySelectorAll("[data-tippy-root]"))}function ee(e){v.clearDelayTimeouts(),e&&O("onTrigger",[v,e]),z();var t=N(!0),n=S(),a=n[0],i=n[1];Uu.isTouch&&"hold"===a&&i&&(t=i),t?r=setTimeout((function(){v.show()}),t):v.show()}function te(e){if(v.clearDelayTimeouts(),O("onUntrigger",[v,e]),v.state.isVisible){if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&d)){var t=N(!1);t?n=setTimeout((function(){v.state.isVisible&&v.hide()}),t):a=requestAnimationFrame((function(){v.hide()}))}}else V()}}function ad(e,t){void 0===t&&(t={});var r=Yu.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",$u,Au),window.addEventListener("blur",Gu);var n,a=Object.assign({},t,{plugins:r}),i=(n=e,Fu(n)?[n]:function(e){return Nu(e,"NodeList")}(n)?ju(n):Array.isArray(n)?n:ju(document.querySelectorAll(n))).reduce((function(e,t){var r=t&&nd(t,a);return r&&e.push(r),e}),[]);return Fu(e)?i[0]:i}ad.defaultProps=Yu,ad.setDefaultProps=function(e){Object.keys(e).forEach((function(t){Yu[t]=e[t]}))},ad.currentInput=Uu,Object.assign({},Eu.A,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}}),ad.setDefaultProps({animation:!1});const id=ad;function od(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}var sd="undefined"!=typeof window&&"undefined"!=typeof document;function ld(e,t){e&&("function"==typeof e&&e(t),{}.hasOwnProperty.call(e,"current")&&(e.current=t))}function cd(){return sd&&document.createElement("div")}function ud(e,t){if(e===t)return!0;if("object"==typeof e&&null!=e&&"object"==typeof t&&null!=t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e){if(!t.hasOwnProperty(r))return!1;if(!ud(e[r],t[r]))return!1}return!0}return!1}function dd(e){var t=[];return e.forEach((function(e){t.find((function(t){return ud(e,t)}))||t.push(e)})),t}var pd=sd?i.useLayoutEffect:i.useEffect;function md(e,t,r){r.split(/\s+/).forEach((function(r){r&&e.classList[t](r)}))}var fd={name:"className",defaultValue:"",fn:function(e){var t=e.popper.firstElementChild,r=function(){var t;return!!(null==(t=e.props.render)?void 0:t.$$tippy)};function n(){e.props.className&&!r()||md(t,"add",e.props.className)}return{onCreate:n,onBeforeUpdate:function(){r()&&md(t,"remove",e.props.className)},onAfterUpdate:n}}};function gd(e){return function(t){var r,n,a=t.children,o=t.content,s=t.visible,l=t.singleton,u=t.render,d=t.reference,p=t.disabled,m=void 0!==p&&p,f=t.ignoreAttributes,g=void 0===f||f,h=(t.__source,t.__self,od(t,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"])),y=void 0!==s,b=void 0!==l,v=(0,i.useState)(!1),w=v[0],x=v[1],_=(0,i.useState)({}),E=_[0],k=_[1],S=(0,i.useState)(),C=S[0],R=S[1],A=(r=function(){return{container:cd(),renders:1}},(n=(0,i.useRef)()).current||(n.current="function"==typeof r?r():r),n.current),P=Object.assign({ignoreAttributes:g},h,{content:A.container});y&&(P.trigger="manual",P.hideOnClick=!1),b&&(m=!0);var T=P,N=P.plugins||[];u&&(T=Object.assign({},P,{plugins:b&&null!=l.data?[].concat(N,[{fn:function(){return{onTrigger:function(e,t){var r=l.data.children.find((function(e){return e.instance.reference===t.currentTarget}));e.state.$$activeSingletonInstance=r.instance,R(r.content)}}}}]):N,render:function(){return{popper:A.container}}}));var I=[d].concat(a?[a.type]:[]);return pd((function(){var t=d;d&&d.hasOwnProperty("current")&&(t=d.current);var r=e(t||A.ref||cd(),Object.assign({},T,{plugins:[fd].concat(P.plugins||[])}));return A.instance=r,m&&r.disable(),s&&r.show(),b&&l.hook({instance:r,content:o,props:T,setSingletonContent:R}),x(!0),function(){r.destroy(),null==l||l.cleanup(r)}}),I),pd((function(){var e,t,r,n,a;if(1!==A.renders){var i=A.instance;i.setProps((t=i.props,r=T,Object.assign({},r,{popperOptions:Object.assign({},t.popperOptions,r.popperOptions,{modifiers:dd([].concat((null==(n=t.popperOptions)?void 0:n.modifiers)||[],(null==(a=r.popperOptions)?void 0:a.modifiers)||[]))})}))),null==(e=i.popperInstance)||e.forceUpdate(),m?i.disable():i.enable(),y&&(s?i.show():i.hide()),b&&l.hook({instance:i,content:o,props:T,setSingletonContent:R})}else A.renders++})),pd((function(){var e;if(u){var t=A.instance;t.setProps({popperOptions:Object.assign({},t.props.popperOptions,{modifiers:[].concat(((null==(e=t.props.popperOptions)?void 0:e.modifiers)||[]).filter((function(e){return"$$tippyReact"!==e.name})),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t,r=e.state,n=null==(t=r.modifiersData)?void 0:t.hide;E.placement===r.placement&&E.referenceHidden===(null==n?void 0:n.isReferenceHidden)&&E.escaped===(null==n?void 0:n.hasPopperEscaped)||k({placement:r.placement,referenceHidden:null==n?void 0:n.isReferenceHidden,escaped:null==n?void 0:n.hasPopperEscaped}),r.attributes.popper={}}}])})})}}),[E.placement,E.referenceHidden,E.escaped].concat(I)),c().createElement(c().Fragment,null,a?(0,i.cloneElement)(a,{ref:function(e){A.ref=e,ld(a.ref,e)}}):null,w&&(0,ye.createPortal)(u?u(function(e){var t={"data-placement":e.placement};return e.referenceHidden&&(t["data-reference-hidden"]=""),e.escaped&&(t["data-escaped"]=""),t}(E),C,A.instance):o,A.container))}}var hd=function(e,t){return(0,i.forwardRef)((function(r,n){var a=r.children,o=od(r,["children"]);return c().createElement(e,Object.assign({},t,o),a?(0,i.cloneElement)(a,{ref:function(e){ld(n,e),ld(a.ref,e)}}):null)}))};const yd=hd(gd(id),{render:function(){return""}});var bd=o(9896),vd=o(4785),wd=o(3065),xd=o(8601),_d=o(5128),Ed=o(6542),kd=o(4833),Sd=o(7745);var Cd=o(3630);function Rd(){return Rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const[r,n]=(0,i.useState)(!1),a=function(e,t={}){const{isStatic:r}=(0,i.useContext)(wd.Q),n=(0,i.useRef)(null),a=function(e){const t=(0,xd.M)((()=>(0,vd.OQ)(e))),{isStatic:r}=(0,i.useContext)(wd.Q);if(r){const[,r]=(0,i.useState)(e);(0,i.useEffect)((()=>t.on("change",r)),[])}return t}((0,bd.S)(e)?e.get():e),o=()=>{n.current&&n.current.stop()};return(0,i.useInsertionEffect)((()=>a.attach(((e,i)=>{if(r)return i(e);if(o(),n.current=(0,Ed.L)({keyframes:[a.get(),e],velocity:a.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...t,onUpdate:i}),!Sd.uv.isProcessing){const e=performance.now()-Sd.uv.timestamp;e<30&&(n.current.time=(0,kd.X)(e))}return a.get()}),o)),[JSON.stringify(t)]),(0,_d.E)((()=>{if((0,bd.S)(e))return e.on("change",(e=>a.set(parseFloat(e))))}),[a]),a}(0,{damping:30,stiffness:300}),o=()=>{n((e=>!e))};return React.createElement(yd,{visible:r,onClickOutside:o,onMount:()=>{a.set(1)},onHide:()=>{a.set(0)},render:t=>React.createElement(Cd.P.div,Rd({className:"flex flex-col items-start gap-5 w-[300px] h-auto bg-white rounded-lg shadow-xl p-4 border border-solid border-border-primary",style:{opacity:a}},t),React.createElement("div",{className:"w-full space-y-2"},React.createElement("p",{className:"m-0 !text-zip-app-heading !text-base !font-semibold"},(0,u.__)("Are you sure?","astra-sites")),React.createElement("p",{className:"m-0 !text-zip-body-text !text-sm !font-normal"},(0,u.__)("If you prefer to continue, press “Cancel”.","astra-sites"))),React.createElement("div",{className:"flex justify-end gap-3 w-full"},React.createElement(ii.A,{className:"h-auto text-zip-app-heading !text-xs font-semibold !py-1.5 !px-3 rounded border border-solid border-border-primary shadow-sm",type:"button",variant:"blank",onClick:o},React.createElement("span",null,(0,u.__)("Cancel","astra-sites"))),React.createElement(ii.A,{className:"h-auto text-white !text-xs font-semibold !py-1.5 !px-3 rounded border border-solid border-alert-error-text bg-alert-error-text shadow-sm",type:"button",variant:"blank",onClick:e},React.createElement("span",null,(0,u.__)("Exit","astra-sites")))),React.createElement("div",{"data-popper-arrow":!0,className:"-top-1.5 !border-border-primary absolute size-3 bg-white !rotate-45 !border !right-5 !left-auto border-solid !border-b-0 !border-r-0"})),interactive:!0,interactiveBorder:20,placement:t},React.createElement("button",{onClick:o,className:"p-0 border-0 w-auto h-auto bg-transparent cursor-pointer focus:outline-none"},React.createElement(f,{className:"w-6 h-6 text-icon-secondary"})))};function Pd(){return Pd=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{ref:u,...d}=Nd((()=>"function"==typeof a?a(i,o):{}),[i,a,o]);return React.createElement("div",{className:t},s&&React.createElement("label",{htmlFor:i,className:"text-sm font-medium text-zip-app-heading"},s),React.createElement("div",{className:"relative"},React.createElement("textarea",Pd({ref:e=>{if(e&&"function"==typeof u&&u(e),c)switch(typeof c){case"function":c(e);break;case"object":c.current=e}},name:i,disabled:e,className:`${s?"mt-2":""} w-full placeholder:zw-placeholder zw-input !text-sm rounded-md border outline-none focus:ring-1 focus:ring-accent-st p-4 ${n?"shadow-error border-alert-error focus:border-accent-st ":"shadow-sm border-zip-light-border-primary focus:border-accent-st"} ${r}`},l,d))),n&&React.createElement("p",{className:"mt-1 text-sm text-alert-error "},n.message))})),Od=({continueButtonText:e="Next",previousButtonText:n="Back",onClickContinue:a,onClickPrevious:o,onClickSkip:s,disableContinue:l,loading:c=!1,className:u})=>{const{setLoadingNextStep:d}=(0,r.A)(g.U),{loadingNextStep:p}=(0,t.A)((e=>{const{getLoadingNextStep:t}=e(g.U);return{loadingNextStep:t()}}),[]),m=async(e,t)=>{p||(d(!0),"function"==typeof t&&await t(e),d(!1))};return(0,i.useEffect)((()=>{p!==c&&d(c)}),[c]),React.createElement("div",{className:(0,y.xW)("w-full flex items-center gap-4 flex-wrap md:flex-nowrap",u)},React.createElement("div",{className:"flex gap-4"},React.createElement(ii.A,{type:"submit",className:"relative !px-4.5 !leading-4 h-auto",onClick:e=>m(e,a),variant:"ai-primary",disabled:l,hasSuffixIcon:!0},React.createElement("span",{className:(0,y.xW)((p||c)&&"invisible")},e),React.createElement(Ms,{className:(0,y.xW)("w-4 h-4",(p||c)&&"invisible")}),(p||c)&&React.createElement("span",{className:"absolute inset-0 flex items-center justify-center"},React.createElement(Vi.A,null))),"function"==typeof o&&React.createElement(ii.A,{type:"button",className:"!px-4.5 !leading-4 h-auto",onClick:e=>m(e,o),variant:"ai-white"},React.createElement("span",null,n))),"function"==typeof s&&React.createElement(ii.A,{type:"button",className:"mr-auto ml-0 md:mr-0 md:ml-auto text-secondary-text !px-4.5 !leading-4 h-auto",onClick:e=>m(e,s),variant:"blank"},"Skip Step"))};var Ld=o(4403);const Bd=e=>{switch(e){case"Facebook":case"Twitter":case"Instagram":case"LinkedIn":case"YouTube":return(0,u.nv)((0,u.__)("Enter your %s account URL","astra-sites"),e);case"Google My Business":return(0,u.__)("Enter your Google Business URL","astra-sites");case"Yelp":return(0,u.__)("Enter your Yelp business URL","astra-sites");default:return(0,u.__)("Enter your account URL","astra-sites")}},jd=({socialMedia:e,onRemove:t,onEdit:r})=>{const[n,a]=(0,i.useState)(!1),[o,s]=(0,i.useState)(e.url),l=(e="")=>{""!==e?(r(e.trim()),a(!1)):a(!1)},c=Bd(e.name);return React.createElement("div",{key:e.id,className:"relative h-[50px] pl-[23px] pr-[25px] rounded-[25px] bg-white flex items-center gap-3 shadow-sm border border-solid border-border-primary",onDoubleClick:()=>{a(!0)}},!n&&React.createElement("div",{role:"button",className:"absolute top-0 right-0 w-4 h-4 rounded-full flex items-center justify-center cursor-pointer bg-nav-inactive",onClick:t,tabIndex:0,onKeyDown:t},React.createElement(f,{className:"w-4 h-4 text-white"})),React.createElement(e.icon,{className:"shrink-0 text-nav-active inline-block"}),n?React.createElement(Qo,{ref:e=>{e&&e.focus()},name:"socialMediaURL",inputClassName:"!border-0 !px-0 !bg-transparent !shadow-none focus:!ring-0 focus:!ring-0 px-0 min-w-fit placeholder:!text-[0.9rem] rounded-none flex-grow !text-black",value:o,onChange:e=>{s(e.target.value)},className:"w-full",placeholder:c,noBorder:!0,onBlur:()=>{l(o)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),l(o)):"Escape"===e.key&&l()},enableAutoGrow:!0}):React.createElement("p",{className:"text-sm font-medium text-nav-inactive"},e.url))},Dd=({list:e,onChange:t})=>{const r=[{name:"Facebook",id:"facebook",icon:ei.ik},{name:"Twitter",id:"twitter",icon:ei.Fi},{name:"Instagram",id:"instagram",icon:ei.oW},{name:"LinkedIn",id:"linkedin",icon:ei.ky},{name:"YouTube",id:"youtube",icon:ei.pd},{name:"Google My Business",id:"google",icon:ei.NR},{name:"Yelp",id:"yelp",icon:ei.ev}],[n,a]=(0,i.useState)(null),[o,s]=(0,i.useState)(""),l=e=>{if(""===e)return!0;const t=e.startsWith("https://");try{const r=new URL(e).hostname;return t&&!!r}catch(e){return!1}},c=t=>{if(0===e.length)return t;const r=e.map((e=>e.id));return t.filter((e=>!r.includes(e.id)))},d=r=>{if("string"!=typeof o||!o?.trim())return;const i=o.trim(),c=[...e,{...n,url:i,valid:l(i)}];t(c),a(null),s("")},p=(0,i.useMemo)((()=>e.map((e=>{const t=e.url,n=l(t,e.id);return{...e,url:t,valid:n,icon:r.find((t=>t.id===e.id))?.icon}}))),[e]);return React.createElement("div",null,React.createElement("div",{className:"text-sm font-medium mb-5 text-zip-app-heading flex gap-1 items-center"},(0,u.__)("Social Media","astra-sites"),React.createElement(b.A,{placement:"top",content:React.createElement(React.Fragment,null,(0,u.__)("Please enter a full URL. Eg. https://twitter.com/abcd, https://instagram.com/abcd, https://facebook.com/abcd","astra-sites"))},React.createElement(zi,{className:"w-4 h-4"}))),React.createElement("div",{className:"flex items-start gap-4 flex-wrap"},p?.length>0&&React.createElement("div",{className:"flex items-start gap-4 flex-wrap"},p.map((r=>React.createElement("div",{key:r.id},React.createElement(jd,{socialMedia:r,onRemove:()=>{t(p.filter((e=>e.id!==r.id)))},onEdit:n=>((r,n)=>{const a=e.map((e=>{if(e.id===r){const t=n.trim();return{...e,url:t,valid:l(t)}}return e}));t(a)})(r.id,n)}),!r.valid&&React.createElement("div",{className:"p-3"},React.createElement("p",{className:"!m-0 !p-0 !text-alert-error !text-sm"},(0,u.__)("This might not be a valid URL.","astra-sites"))))))),(()=>{if(n){const e=n?Bd(n.name):"Enter your account URL";return React.createElement("div",{className:"h-[50px] w-[520px] rounded-[25px] bg-white flex items-center border border-solid border-border-primary"},React.createElement(Qo,{value:o,onChange:e=>{s(e.target.value)},ref:e=>{e&&e.focus()},name:"socialMediaURL",inputClassName:"!pr-10 !pl-11 !border-0 !bg-transparent !shadow-none focus:!ring-0",className:"w-full",placeholder:e,noBorder:!0,prefixIconClassName:"absolute left-4 flex items-center",prefixIcon:React.createElement(n.icon,{className:"text-nav-active inline-block"}),onBlur:e=>{e.preventDefault(),d(n.id)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),d(n.id)):"Escape"===e.key&&(a(null),s(""))}}))}return c(r).length?React.createElement(Ja,{width:"60",contentClassName:"p-4 bg-white [&>:first-child]:pb-2.5 [&>:last-child]:pt-2.5 [&>:not(:first-child,:last-child)]:py-2.5 !divide-y !divide-border-primary divide-solid divide-x-0",trigger:React.createElement("div",{className:"p-3 rounded-full flex items-center justify-center bg-white cursor-pointer border border-border-primary border-solid shadow-sm"},React.createElement(Ld.A,{className:"w-6 h-6 text-accent-ai"})),placement:"top-start"},c(r).map(((e,t)=>React.createElement(Ja.Item,{as:"div",role:"none",key:t,className:"only:!py-0",onClick:()=>a(e)},React.createElement("button",{onClick:()=>null,type:"button",className:"w-full flex items-center text-sm font-normal text-left py-2 px-2 leading-5 hover:bg-background-secondary focus:outline-none transition duration-150 ease-in-out space-x-2 rounded bg-transparent border-0 cursor-pointer"},React.createElement(e.icon,{className:"text-nav-inactive inline-block"}),React.createElement("span",{className:"text-body-text"},e.name)))))):""})()))};var Fd,Md;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Fd||(Fd={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Md||(Md={}));const zd=Fd.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vd=e=>{switch(typeof e){case"undefined":return zd.undefined;case"string":return zd.string;case"number":return isNaN(e)?zd.nan:zd.number;case"boolean":return zd.boolean;case"function":return zd.function;case"bigint":return zd.bigint;case"symbol":return zd.symbol;case"object":return Array.isArray(e)?zd.array:null===e?zd.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?zd.promise:"undefined"!=typeof Map&&e instanceof Map?zd.map:"undefined"!=typeof Set&&e instanceof Set?zd.set:"undefined"!=typeof Date&&e instanceof Date?zd.date:zd.object;default:return zd.unknown}},Wd=Fd.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ud extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;ne.message)){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Ud.create=e=>new Ud(e);const Hd=(e,t)=>{let r;switch(e.code){case Wd.invalid_type:r=e.received===zd.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Wd.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Fd.jsonStringifyReplacer)}`;break;case Wd.unrecognized_keys:r=`Unrecognized key(s) in object: ${Fd.joinValues(e.keys,", ")}`;break;case Wd.invalid_union:r="Invalid input";break;case Wd.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Fd.joinValues(e.options)}`;break;case Wd.invalid_enum_value:r=`Invalid enum value. Expected ${Fd.joinValues(e.options)}, received '${e.received}'`;break;case Wd.invalid_arguments:r="Invalid function arguments";break;case Wd.invalid_return_type:r="Invalid function return type";break;case Wd.invalid_date:r="Invalid date";break;case Wd.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Fd.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Wd.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Wd.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Wd.custom:r="Invalid input";break;case Wd.invalid_intersection_types:r="Intersection results could not be merged";break;case Wd.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Wd.not_finite:r="Number must be finite";break;default:r=t.defaultError,Fd.assertNever(e)}return{message:r}};let $d=Hd;function Zd(){return $d}const Gd=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],o={...a,path:i};if(void 0!==a.message)return{...a,path:i,message:a.message};let s="";const l=n.filter((e=>!!e)).slice().reverse();for(const e of l)s=e(o,{data:t,defaultError:s}).message;return{...a,path:i,message:s}};function qd(e,t){const r=Zd(),n=Gd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Hd?void 0:Hd].filter((e=>!!e))});e.common.issues.push(n)}class Yd{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return Kd;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return Yd.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status)return Kd;if("aborted"===a.status)return Kd;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!n.alwaysSet||(r[t.value]=a.value)}return{status:e.value,value:r}}}const Kd=Object.freeze({status:"aborted"}),Xd=e=>({status:"dirty",value:e}),Jd=e=>({status:"valid",value:e}),Qd=e=>"aborted"===e.status,ep=e=>"dirty"===e.status,tp=e=>"valid"===e.status,rp=e=>"undefined"!=typeof Promise&&e instanceof Promise;function np(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function ap(e,t,r,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,r):a?a.value=r:t.set(e,r),r}var ip,op,sp;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(ip||(ip={}));class lp{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const cp=(e,t)=>{if(tp(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ud(e.common.issues);return this._error=t,this._error}}};function up(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:a.defaultError}:void 0===a.data?{message:null!==(i=null!=s?s:n)&&void 0!==i?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(o=null!=s?s:r)&&void 0!==o?o:a.defaultError}},description:a}}class dp{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Vd(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Vd(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yd,ctx:{common:e.parent.common,data:e.data,parsedType:Vd(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(rp(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vd(e)},a=this._parseSync({data:e,path:n.path,parent:n});return cp(n,a)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vd(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(rp(n)?n:Promise.resolve(n));return cp(r,a)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),i=()=>n.addIssue({code:Wd.custom,...r(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(i(),!1))):!!a||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new om({schema:this,typeName:bm.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return sm.create(this,this._def)}nullable(){return lm.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vp.create(this,this._def)}promise(){return im.create(this,this._def)}or(e){return Hp.create([this,e],this._def)}and(e){return qp.create(this,e,this._def)}transform(e){return new om({...up(this._def),schema:this,typeName:bm.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new cm({...up(this._def),innerType:this,defaultValue:t,typeName:bm.ZodDefault})}brand(){return new mm({typeName:bm.ZodBranded,type:this,...up(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new um({...up(this._def),innerType:this,catchValue:t,typeName:bm.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return fm.create(this,e)}readonly(){return gm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pp=/^c[^\s-]{8,}$/i,mp=/^[0-9a-z]+$/,fp=/^[0-9A-HJKMNP-TV-Z]{26}$/,gp=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hp=/^[a-z0-9_-]{21}$/i,yp=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,bp=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let vp;const xp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_p=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ep=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Sp=new RegExp(`^${kp}$`);function Cp(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Rp(e){let t=`${kp}T${Cp(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}class Ap extends dp{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==zd.string){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.string,received:t.parsedType}),Kd}const t=new Yd;let r;for(const i of this._def.checks)if("min"===i.kind)e.data.lengthi.value&&(r=this._getOrReturnCtx(e,r),qd(r,{code:Wd.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const n=e.data.length>i.value,a=e.data.lengthe.test(t)),{validation:t,code:Wd.invalid_string,...ip.errToObj(r)})}_addCheck(e){return new Ap({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ip.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ip.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ip.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ip.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ip.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ip.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ip.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ip.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ip.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ip.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...ip.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...ip.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ip.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ip.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...ip.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ip.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ip.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ip.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ip.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ip.errToObj(t)})}nonempty(e){return this.min(1,ip.errToObj(e))}trim(){return new Ap({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ap({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ap({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuen?r:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}Ap.create=e=>{var t;return new Ap({checks:[],typeName:bm.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...up(e)})};class Tp extends dp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==zd.number){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.number,received:t.parsedType}),Kd}let t;const r=new Yd;for(const n of this._def.checks)"int"===n.kind?Fd.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),qd(t,{code:Wd.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.datan.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),qd(t,{code:Wd.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==Pp(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),qd(t,{code:Wd.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),qd(t,{code:Wd.not_finite,message:n.message}),r.dirty()):Fd.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ip.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ip.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ip.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ip.toString(t))}setLimit(e,t,r,n){return new Tp({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ip.toString(n)}]})}_addCheck(e){return new Tp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ip.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ip.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ip.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ip.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ip.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ip.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ip.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ip.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ip.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Fd.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.valuenew Tp({checks:[],typeName:bm.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...up(e)});class Np extends dp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==zd.bigint){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.bigint,received:t.parsedType}),Kd}let t;const r=new Yd;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.datan.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),qd(t,{code:Wd.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),qd(t,{code:Wd.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Fd.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ip.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ip.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ip.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ip.toString(t))}setLimit(e,t,r,n){return new Np({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ip.toString(n)}]})}_addCheck(e){return new Np({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ip.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ip.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ip.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ip.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ip.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Np({checks:[],typeName:bm.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...up(e)})};class Ip extends dp{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==zd.boolean){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.boolean,received:t.parsedType}),Kd}return Jd(e.data)}}Ip.create=e=>new Ip({typeName:bm.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...up(e)});class Op extends dp{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==zd.date){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.date,received:t.parsedType}),Kd}if(isNaN(e.data.getTime()))return qd(this._getOrReturnCtx(e),{code:Wd.invalid_date}),Kd;const t=new Yd;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),qd(r,{code:Wd.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Fd.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Op({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ip.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ip.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Op({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:bm.ZodDate,...up(e)});class Lp extends dp{_parse(e){if(this._getType(e)!==zd.symbol){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.symbol,received:t.parsedType}),Kd}return Jd(e.data)}}Lp.create=e=>new Lp({typeName:bm.ZodSymbol,...up(e)});class Bp extends dp{_parse(e){if(this._getType(e)!==zd.undefined){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.undefined,received:t.parsedType}),Kd}return Jd(e.data)}}Bp.create=e=>new Bp({typeName:bm.ZodUndefined,...up(e)});class jp extends dp{_parse(e){if(this._getType(e)!==zd.null){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.null,received:t.parsedType}),Kd}return Jd(e.data)}}jp.create=e=>new jp({typeName:bm.ZodNull,...up(e)});class Dp extends dp{constructor(){super(...arguments),this._any=!0}_parse(e){return Jd(e.data)}}Dp.create=e=>new Dp({typeName:bm.ZodAny,...up(e)});class Fp extends dp{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Jd(e.data)}}Fp.create=e=>new Fp({typeName:bm.ZodUnknown,...up(e)});class Mp extends dp{_parse(e){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.never,received:t.parsedType}),Kd}}Mp.create=e=>new Mp({typeName:bm.ZodNever,...up(e)});class zp extends dp{_parse(e){if(this._getType(e)!==zd.undefined){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.void,received:t.parsedType}),Kd}return Jd(e.data)}}zp.create=e=>new zp({typeName:bm.ZodVoid,...up(e)});class Vp extends dp{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==zd.array)return qd(t,{code:Wd.invalid_type,expected:zd.array,received:t.parsedType}),Kd;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.lengthn.maxLength.value&&(qd(t,{code:Wd.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new lp(t,e,t.path,r))))).then((e=>Yd.mergeArray(r,e)));const a=[...t.data].map(((e,r)=>n.type._parseSync(new lp(t,e,t.path,r))));return Yd.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new Vp({...this._def,minLength:{value:e,message:ip.toString(t)}})}max(e,t){return new Vp({...this._def,maxLength:{value:e,message:ip.toString(t)}})}length(e,t){return new Vp({...this._def,exactLength:{value:e,message:ip.toString(t)}})}nonempty(e){return this.min(1,e)}}function Wp(e){if(e instanceof Up){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=sm.create(Wp(n))}return new Up({...e._def,shape:()=>t})}return e instanceof Vp?new Vp({...e._def,type:Wp(e.element)}):e instanceof sm?sm.create(Wp(e.unwrap())):e instanceof lm?lm.create(Wp(e.unwrap())):e instanceof Yp?Yp.create(e.items.map((e=>Wp(e)))):e}Vp.create=(e,t)=>new Vp({type:e,minLength:null,maxLength:null,exactLength:null,typeName:bm.ZodArray,...up(t)});class Up extends dp{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Fd.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==zd.object){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.object,received:t.parsedType}),Kd}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Mp&&"strip"===this._def.unknownKeys))for(const e in r.data)a.includes(e)||i.push(e);const o=[];for(const e of a){const t=n[e],a=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new lp(r,a,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Mp){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(qd(r,{code:Wd.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new lp(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Yd.mergeObjectSync(t,e))):Yd.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return ip.errToObj,new Up({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,a,i,o;const s=null!==(i=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=ip.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Up({...this._def,unknownKeys:"strip"})}passthrough(){return new Up({...this._def,unknownKeys:"passthrough"})}extend(e){return new Up({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Up({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:bm.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Up({...this._def,catchall:e})}pick(e){const t={};return Fd.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Up({...this._def,shape:()=>t})}omit(e){const t={};return Fd.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Up({...this._def,shape:()=>t})}deepPartial(){return Wp(this)}partial(e){const t={};return Fd.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Up({...this._def,shape:()=>t})}required(e){const t={};return Fd.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof sm;)e=e._def.innerType;t[r]=e}})),new Up({...this._def,shape:()=>t})}keyof(){return rm(Fd.objectKeys(this.shape))}}Up.create=(e,t)=>new Up({shape:()=>e,unknownKeys:"strip",catchall:Mp.create(),typeName:bm.ZodObject,...up(t)}),Up.strictCreate=(e,t)=>new Up({shape:()=>e,unknownKeys:"strict",catchall:Mp.create(),typeName:bm.ZodObject,...up(t)}),Up.lazycreate=(e,t)=>new Up({shape:e,unknownKeys:"strip",catchall:Mp.create(),typeName:bm.ZodObject,...up(t)});class Hp extends dp{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new Ud(e.ctx.common.issues)));return qd(t,{code:Wd.invalid_union,unionErrors:r}),Kd}));{let e;const n=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new Ud(e)));return qd(t,{code:Wd.invalid_union,unionErrors:a}),Kd}}get options(){return this._def.options}}Hp.create=(e,t)=>new Hp({options:e,typeName:bm.ZodUnion,...up(t)});const $p=e=>e instanceof em?$p(e.schema):e instanceof om?$p(e.innerType()):e instanceof tm?[e.value]:e instanceof nm?e.options:e instanceof am?Fd.objectValues(e.enum):e instanceof cm?$p(e._def.innerType):e instanceof Bp?[void 0]:e instanceof jp?[null]:e instanceof sm?[void 0,...$p(e.unwrap())]:e instanceof lm?[null,...$p(e.unwrap())]:e instanceof mm||e instanceof gm?$p(e.unwrap()):e instanceof um?$p(e._def.innerType):[];class Zp extends dp{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==zd.object)return qd(t,{code:Wd.invalid_type,expected:zd.object,received:t.parsedType}),Kd;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(qd(t,{code:Wd.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Kd)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=$p(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new Zp({typeName:bm.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...up(r)})}}function Gp(e,t){const r=Vd(e),n=Vd(t);if(e===t)return{valid:!0,data:e};if(r===zd.object&&n===zd.object){const r=Fd.objectKeys(t),n=Fd.objectKeys(e).filter((e=>-1!==r.indexOf(e))),a={...e,...t};for(const r of n){const n=Gp(e[r],t[r]);if(!n.valid)return{valid:!1};a[r]=n.data}return{valid:!0,data:a}}if(r===zd.array&&n===zd.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n{if(Qd(e)||Qd(n))return Kd;const a=Gp(e.value,n.value);return a.valid?((ep(e)||ep(n))&&t.dirty(),{status:t.value,value:a.data}):(qd(r,{code:Wd.invalid_intersection_types}),Kd)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}qp.create=(e,t,r)=>new qp({left:e,right:t,typeName:bm.ZodIntersection,...up(r)});class Yp extends dp{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==zd.array)return qd(r,{code:Wd.invalid_type,expected:zd.array,received:r.parsedType}),Kd;if(r.data.lengththis._def.items.length&&(qd(r,{code:Wd.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new lp(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Yd.mergeArray(t,e))):Yd.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Yp({...this._def,rest:e})}}Yp.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yp({items:e,typeName:bm.ZodTuple,rest:null,...up(t)})};class Kp extends dp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==zd.object)return qd(r,{code:Wd.invalid_type,expected:zd.object,received:r.parsedType}),Kd;const n=[],a=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:a._parse(new lp(r,e,r.path,e)),value:i._parse(new lp(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Yd.mergeObjectAsync(t,n):Yd.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Kp(t instanceof dp?{keyType:e,valueType:t,typeName:bm.ZodRecord,...up(r)}:{keyType:Ap.create(),valueType:e,typeName:bm.ZodRecord,...up(t)})}}class Xp extends dp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==zd.map)return qd(r,{code:Wd.invalid_type,expected:zd.map,received:r.parsedType}),Kd;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new lp(r,e,r.path,[i,"key"])),value:a._parse(new lp(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,a=await r.value;if("aborted"===n.status||"aborted"===a.status)return Kd;"dirty"!==n.status&&"dirty"!==a.status||t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,a=r.value;if("aborted"===n.status||"aborted"===a.status)return Kd;"dirty"!==n.status&&"dirty"!==a.status||t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}Xp.create=(e,t,r)=>new Xp({valueType:t,keyType:e,typeName:bm.ZodMap,...up(r)});class Jp extends dp{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==zd.set)return qd(r,{code:Wd.invalid_type,expected:zd.set,received:r.parsedType}),Kd;const n=this._def;null!==n.minSize&&r.data.sizen.maxSize.value&&(qd(r,{code:Wd.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return Kd;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>a._parse(new lp(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new Jp({...this._def,minSize:{value:e,message:ip.toString(t)}})}max(e,t){return new Jp({...this._def,maxSize:{value:e,message:ip.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Jp.create=(e,t)=>new Jp({valueType:e,minSize:null,maxSize:null,typeName:bm.ZodSet,...up(t)});class Qp extends dp{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==zd.function)return qd(t,{code:Wd.invalid_type,expected:zd.function,received:t.parsedType}),Kd;function r(e,r){return Gd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zd(),Hd].filter((e=>!!e)),issueData:{code:Wd.invalid_arguments,argumentsError:r}})}function n(e,r){return Gd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zd(),Hd].filter((e=>!!e)),issueData:{code:Wd.invalid_return_type,returnTypeError:r}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof im){const e=this;return Jd((async function(...t){const o=new Ud([]),s=await e._def.args.parseAsync(t,a).catch((e=>{throw o.addIssue(r(t,e)),o})),l=await Reflect.apply(i,this,s),c=await e._def.returns._def.type.parseAsync(l,a).catch((e=>{throw o.addIssue(n(l,e)),o}));return c}))}{const e=this;return Jd((function(...t){const o=e._def.args.safeParse(t,a);if(!o.success)throw new Ud([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),l=e._def.returns.safeParse(s,a);if(!l.success)throw new Ud([n(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Qp({...this._def,args:Yp.create(e).rest(Fp.create())})}returns(e){return new Qp({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Qp({args:e||Yp.create([]).rest(Fp.create()),returns:t||Fp.create(),typeName:bm.ZodFunction,...up(r)})}}class em extends dp{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}em.create=(e,t)=>new em({getter:e,typeName:bm.ZodLazy,...up(t)});class tm extends dp{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return qd(t,{received:t.data,code:Wd.invalid_literal,expected:this._def.value}),Kd}return{status:"valid",value:e.data}}get value(){return this._def.value}}function rm(e,t){return new nm({values:e,typeName:bm.ZodEnum,...up(t)})}tm.create=(e,t)=>new tm({value:e,typeName:bm.ZodLiteral,...up(t)});class nm extends dp{constructor(){super(...arguments),op.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return qd(t,{expected:Fd.joinValues(r),received:t.parsedType,code:Wd.invalid_type}),Kd}if(np(this,op,"f")||ap(this,op,new Set(this._def.values),"f"),!np(this,op,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return qd(t,{received:t.data,code:Wd.invalid_enum_value,options:r}),Kd}return Jd(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return nm.create(e,{...this._def,...t})}exclude(e,t=this._def){return nm.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}op=new WeakMap,nm.create=rm;class am extends dp{constructor(){super(...arguments),sp.set(this,void 0)}_parse(e){const t=Fd.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==zd.string&&r.parsedType!==zd.number){const e=Fd.objectValues(t);return qd(r,{expected:Fd.joinValues(e),received:r.parsedType,code:Wd.invalid_type}),Kd}if(np(this,sp,"f")||ap(this,sp,new Set(Fd.getValidEnumValues(this._def.values)),"f"),!np(this,sp,"f").has(e.data)){const e=Fd.objectValues(t);return qd(r,{received:r.data,code:Wd.invalid_enum_value,options:e}),Kd}return Jd(e.data)}get enum(){return this._def.values}}sp=new WeakMap,am.create=(e,t)=>new am({values:e,typeName:bm.ZodNativeEnum,...up(t)});class im extends dp{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==zd.promise&&!1===t.common.async)return qd(t,{code:Wd.invalid_type,expected:zd.promise,received:t.parsedType}),Kd;const r=t.parsedType===zd.promise?t.data:Promise.resolve(t.data);return Jd(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}im.create=(e,t)=>new im({type:e,typeName:bm.ZodPromise,...up(t)});class om extends dp{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bm.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:e=>{qd(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===n.type){const e=n.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Kd;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?Kd:"dirty"===n.status||"dirty"===t.value?Xd(n.value):n}));{if("aborted"===t.value)return Kd;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?Kd:"dirty"===n.status||"dirty"===t.value?Xd(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?Kd:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?Kd:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!tp(e))return e;const i=n.transform(e.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>tp(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}Fd.assertNever(n)}}om.create=(e,t,r)=>new om({schema:e,typeName:bm.ZodEffects,effect:t,...up(r)}),om.createWithPreprocess=(e,t,r)=>new om({schema:t,effect:{type:"preprocess",transform:e},typeName:bm.ZodEffects,...up(r)});class sm extends dp{_parse(e){return this._getType(e)===zd.undefined?Jd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}sm.create=(e,t)=>new sm({innerType:e,typeName:bm.ZodOptional,...up(t)});class lm extends dp{_parse(e){return this._getType(e)===zd.null?Jd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lm.create=(e,t)=>new lm({innerType:e,typeName:bm.ZodNullable,...up(t)});class cm extends dp{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===zd.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}cm.create=(e,t)=>new cm({innerType:e,typeName:bm.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...up(t)});class um extends dp{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return rp(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ud(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ud(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}um.create=(e,t)=>new um({innerType:e,typeName:bm.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...up(t)});class dm extends dp{_parse(e){if(this._getType(e)!==zd.nan){const t=this._getOrReturnCtx(e);return qd(t,{code:Wd.invalid_type,expected:zd.nan,received:t.parsedType}),Kd}return{status:"valid",value:e.data}}}dm.create=e=>new dm({typeName:bm.ZodNaN,...up(e)});const pm=Symbol("zod_brand");class mm extends dp{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class fm extends dp{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Kd:"dirty"===e.status?(t.dirty(),Xd(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Kd:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new fm({in:e,out:t,typeName:bm.ZodPipeline})}}class gm extends dp{_parse(e){const t=this._def.innerType._parse(e),r=e=>(tp(e)&&(e.value=Object.freeze(e.value)),e);return rp(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function hm(e,t={},r){return e?Dp.create().superRefine(((n,a)=>{var i,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,l="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...l,fatal:s})}})):Dp.create()}gm.create=(e,t)=>new gm({innerType:e,typeName:bm.ZodReadonly,...up(t)});const ym={object:Up.lazycreate};var bm;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(bm||(bm={}));const vm=Ap.create,wm=Tp.create,xm=dm.create,_m=Np.create,Em=Ip.create,km=Op.create,Sm=Lp.create,Cm=Bp.create,Rm=jp.create,Am=Dp.create,Pm=Fp.create,Tm=Mp.create,Nm=zp.create,Im=Vp.create,Om=Up.create,Lm=Up.strictCreate,Bm=Hp.create,jm=Zp.create,Dm=qp.create,Fm=Yp.create,Mm=Kp.create,zm=Xp.create,Vm=Jp.create,Wm=Qp.create,Um=em.create,Hm=tm.create,$m=nm.create,Zm=am.create,Gm=im.create,qm=om.create,Ym=sm.create,Km=lm.create,Xm=om.createWithPreprocess,Jm=fm.create,Qm={string:e=>Ap.create({...e,coerce:!0}),number:e=>Tp.create({...e,coerce:!0}),boolean:e=>Ip.create({...e,coerce:!0}),bigint:e=>Np.create({...e,coerce:!0}),date:e=>Op.create({...e,coerce:!0})},ef=Kd;var tf=Object.freeze({__proto__:null,defaultErrorMap:Hd,setErrorMap:function(e){$d=e},getErrorMap:Zd,makeIssue:Gd,EMPTY_PATH:[],addIssueToContext:qd,ParseStatus:Yd,INVALID:Kd,DIRTY:Xd,OK:Jd,isAborted:Qd,isDirty:ep,isValid:tp,isAsync:rp,get util(){return Fd},get objectUtil(){return Md},ZodParsedType:zd,getParsedType:Vd,ZodType:dp,datetimeRegex:Rp,ZodString:Ap,ZodNumber:Tp,ZodBigInt:Np,ZodBoolean:Ip,ZodDate:Op,ZodSymbol:Lp,ZodUndefined:Bp,ZodNull:jp,ZodAny:Dp,ZodUnknown:Fp,ZodNever:Mp,ZodVoid:zp,ZodArray:Vp,ZodObject:Up,ZodUnion:Hp,ZodDiscriminatedUnion:Zp,ZodIntersection:qp,ZodTuple:Yp,ZodRecord:Kp,ZodMap:Xp,ZodSet:Jp,ZodFunction:Qp,ZodLazy:em,ZodLiteral:tm,ZodEnum:nm,ZodNativeEnum:am,ZodPromise:im,ZodEffects:om,ZodTransformer:om,ZodOptional:sm,ZodNullable:lm,ZodDefault:cm,ZodCatch:um,ZodNaN:dm,BRAND:pm,ZodBranded:mm,ZodPipeline:fm,ZodReadonly:gm,custom:hm,Schema:dp,ZodSchema:dp,late:ym,get ZodFirstPartyTypeKind(){return bm},coerce:Qm,any:Am,array:Im,bigint:_m,boolean:Em,date:km,discriminatedUnion:jm,effect:qm,enum:$m,function:Wm,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>hm((t=>t instanceof e),t),intersection:Dm,lazy:Um,literal:Hm,map:zm,nan:xm,nativeEnum:Zm,never:Tm,null:Rm,nullable:Km,number:wm,object:Om,oboolean:()=>Em().optional(),onumber:()=>wm().optional(),optional:Ym,ostring:()=>vm().optional(),pipeline:Jm,preprocess:Xm,promise:Gm,record:Mm,set:Vm,strictObject:Lm,string:vm,symbol:Sm,transformer:qm,tuple:Fm,undefined:Cm,union:Bm,unknown:Pm,void:Nm,NEVER:ef,ZodIssueCode:Wd,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Ud});const rf=({text:e})=>c().createElement("span",{className:"text-center text-zip-app-heading relative"},c().createElement("span",{className:"bg-gradient-to-r from-gradient-color-1/50 via-gradient-color-2/50 to-gradient-color-3/50 bg-[length:100%_6px] bg-no-repeat bg-bottom pb-0 "},e));function nf(){return nf=Object.assign?Object.assign.bind():function(e){for(var t=1;tReact.createElement(r,nf({className:(0,y.xW)("max-w-container w-full bg-white p-8 flex flex-col gap-8 rounded-xl shadow",t)},n),e),of=/^[a-z0-9!'#$%&*+\/=?^_`{|}~-]+(?:\.[a-z0-9!'#$%&*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-zA-Z]{2,}$/i,sf=e=>e.map((e=>{const t=e?.type?e?.type:e?.id;return{type:t,id:t,url:e?.url}})),lf=e=>e.filter((e=>e.valid)),cf=e=>{const t=tf.object({email:tf.string().refine((e=>""===e||of.test(e)),{message:(0,u.__)("(Please enter a valid email","astra-sites")}),address:tf.string().optional()}).safeParse(e);return t?.success?t.data:{...e,...t.error.issues.reduce(((e,t)=>(e[t.path[0]]="",e)),{})}},uf=(0,e.A)((0,n.A)((e=>{const{setNextAIStep:t,setPreviousAIStep:r}=e("astra-sites");return{onClickContinue:t,onClickPrevious:r,onClickSkip:t}})))((({onClickContinue:e,onClickPrevious:n,onClickSkip:a})=>{const{businessContact:o}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()})),{setWebsiteContactAIStep:s}=(0,r.A)(g.U),[l,c]=(0,i.useState)(sf(o.socialMedia??[])?.map((e=>({...e,valid:!0})))),d=(0,i.useRef)({...o,socialMedia:sf(o?.socialMedia??[])?.map((e=>({...e,valid:!0})))}),{register:p,handleSubmit:m,formState:{errors:f},setFocus:h,watch:y}=Ql({defaultValues:{...o}});(0,i.useEffect)((()=>{h("email")}),[h]);const{businessName:b}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()})),v=l.some((e=>!e.valid));return React.createElement(af,{as:"form",className:"w-full max-w-container flex flex-col gap-4 pb-10",action:"#",onSubmit:m((t=>{s({...t,socialMedia:sf(l)}),e()}))},React.createElement("div",{className:"text-zip-app-heading text-[1.75rem] font-semibold leading-9"},(0,u.__)("How can people get in touch with ","astra-sites"),React.createElement(rf,{text:b}),"?"),React.createElement("p",{className:"text-zip-body-text text-base font-normal"},(0,u.__)("Please provide the contact information details below. These will be used on the website.","astra-sites")),React.createElement("div",{className:"space-y-5"},React.createElement("div",{className:"flex justify-between gap-x-8 items-start w-full"},React.createElement(Qo,{className:"w-full",type:"text",name:"email",id:"email",label:"Email",placeholder:"Your email",register:p,error:f.email,validations:{pattern:{value:of,message:(0,u.__)("Please enter a valid email","astra-sites")}},prefixIconClassName:"absolute left-4 flex items-center"}),React.createElement(Qo,{className:"w-full",type:"text",name:"phone",id:"phone",label:"Phone Number",placeholder:"Your phone number",register:p,error:f.phone,prefixIconClassName:"absolute left-4 flex items-center"})),React.createElement(Id,{rows:4,name:"address",id:"address",label:"Address",placeholder:"",register:p,error:f.address}),React.createElement(Dd,{list:l,onChange:e=>{c(e)}})),React.createElement(Qa,null),React.createElement(Od,{onClickPrevious:async()=>{const e=y(),t=cf(e);s({...t,socialMedia:sf(lf(l))}),n()},onClickSkip:async()=>{const{socialMedia:e=[],...t}=d.current,r=cf(t);s({...r,socialMedia:sf(lf(e))}),a()},disableContinue:v}))})),df=({heading:e,subHeading:t,className:r})=>React.createElement("div",{className:(0,y.xW)("space-y-3",r)},!!e&&React.createElement("div",{className:"text-zip-app-label text-[1.75rem] font-semibold leading-9"},e),!!t&&React.createElement("p",{className:"text-body-text text-base font-normal"},t));function pf(e,t){return null!==e&&null!==t&&"object"==typeof e&&"object"==typeof t&&"id"in e&&"id"in t?e.id===t.id:e===t}function mf(e={},t=null,r=[]){for(let[n,a]of Object.entries(e))gf(r,ff(t,n),a);return r}function ff(e,t){return e?e+"["+t+"]":t}function gf(e,t,r){if(Array.isArray(r))for(let[n,a]of r.entries())gf(e,ff(t,n.toString()),a);else r instanceof Date?e.push([t,r.toISOString()]):"boolean"==typeof r?e.push([t,r?"1":"0"]):"string"==typeof r?e.push([t,r]):"number"==typeof r?e.push([t,`${r}`]):null==r?e.push([t,""]):mf(r,t,e)}let hf=(0,i.createContext)(null);function yf({children:e}){let t=(0,i.useContext)(hf);if(!t)return i.createElement(i.Fragment,null,e);let{target:r}=t;return r?(0,ye.createPortal)(i.createElement(i.Fragment,null,e),r):null}function bf({data:e,form:t,disabled:r,onReset:n,overrides:a}){let[o,s]=(0,i.useState)(null),l=ke();return(0,i.useEffect)((()=>{if(n&&o)return l.addEventListener(o,"reset",n)}),[o,t,n]),i.createElement(yf,null,i.createElement(vf,{setForm:s,formId:t}),mf(e).map((([e,n])=>i.createElement(ci,{features:li.Hidden,...Fn({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:r,name:e,value:n,...a})}))))}function vf({setForm:e,formId:t}){return(0,i.useEffect)((()=>{if(t){let r=document.getElementById(t);r&&e(r)}}),[e,t]),t?null:i.createElement(ci,{features:li.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}var wf=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(wf||{}),xf=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(xf||{}),_f=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(_f||{}),Ef=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e))(Ef||{});function kf(e,t=(e=>e)){let r=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,n=rt(t(e.options.slice()),(e=>e.dataRef.current.domRef.current)),a=r?n.indexOf(r):null;return-1===a&&(a=null),{options:n,activeOptionIndex:a}}let Sf={1:e=>e.dataRef.current.disabled||1===e.listboxState?e:{...e,activeOptionIndex:null,listboxState:1,__demoMode:!1},0(e){if(e.dataRef.current.disabled||0===e.listboxState)return e;let t=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,n=e.options.findIndex((e=>r(e.dataRef.current.value)));return-1!==n&&(t=n),{...e,listboxState:0,activeOptionIndex:t,__demoMode:!1}},2(e,t){var r,n,a,i,o;if(e.dataRef.current.disabled||1===e.listboxState)return e;let s={...e,searchQuery:"",activationTrigger:null!=(r=t.trigger)?r:1,__demoMode:!1};if(t.focus===Rn.Nothing)return{...s,activeOptionIndex:null};if(t.focus===Rn.Specific)return{...s,activeOptionIndex:e.options.findIndex((e=>e.id===t.id))};if(t.focus===Rn.Previous){let r=e.activeOptionIndex;if(null!==r){let i=e.options[r].dataRef.current.domRef,o=An(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(null!==o){let t=e.options[o].dataRef.current.domRef;if((null==(n=i.current)?void 0:n.previousElementSibling)===t.current||null===(null==(a=t.current)?void 0:a.previousElementSibling))return{...s,activeOptionIndex:o}}}}else if(t.focus===Rn.Next){let r=e.activeOptionIndex;if(null!==r){let n=e.options[r].dataRef.current.domRef,a=An(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(null!==a){let t=e.options[a].dataRef.current.domRef;if((null==(i=n.current)?void 0:i.nextElementSibling)===t.current||null===(null==(o=t.current)?void 0:o.nextElementSibling))return{...s,activeOptionIndex:a}}}}let l=kf(e),c=An(t,{resolveItems:()=>l.options,resolveActiveIndex:()=>l.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...s,...l,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||1===e.listboxState)return e;let r=""!==e.searchQuery?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(null!==e.activeOptionIndex?e.options.slice(e.activeOptionIndex+r).concat(e.options.slice(0,e.activeOptionIndex+r)):e.options).find((e=>{var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))})),i=a?e.options.indexOf(a):-1;return-1===i||i===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:i,activationTrigger:1}},4:e=>e.dataRef.current.disabled||1===e.listboxState||""===e.searchQuery?e:{...e,searchQuery:""},5:(e,t)=>{let r={id:t.id,dataRef:t.dataRef},n=kf(e,(e=>[...e,r]));return null===e.activeOptionIndex&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(n.activeOptionIndex=n.options.indexOf(r)),{...e,...n}},6:(e,t)=>{let r=kf(e,(e=>{let r=e.findIndex((e=>e.id===t.id));return-1!==r&&e.splice(r,1),e}));return{...e,...r,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},Cf=(0,i.createContext)(null);function Rf(e){let t=(0,i.useContext)(Cf);if(null===t){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Rf),t}return t}Cf.displayName="ListboxActionsContext";let Af=(0,i.createContext)(null);function Pf(e){let t=(0,i.useContext)(Af);if(null===t){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Pf),t}return t}function Tf(e,t){return Ve(t.type,Sf,e,t)}Af.displayName="ListboxDataContext";let Nf=i.Fragment,If=(0,i.createContext)(!1),Of=Tn.RenderStrategy|Tn.Static,Lf=i.Fragment,Bf=Dn((function(e,t){var r;let n=Vn(),{value:a,defaultValue:o,form:s,name:l,onChange:c,by:u,invalid:d=!1,disabled:p=n||!1,horizontal:m=!1,multiple:f=!1,__demoMode:g=!1,...h}=e;const y=m?"horizontal":"vertical";let b=bt(t),v=function(e){let[t]=(0,i.useState)(e);return t}(o),[w=(f?[]:void 0),x]=function(e,t,r){let[n,a]=(0,i.useState)(r),o=void 0!==e,s=(0,i.useRef)(o),l=(0,i.useRef)(!1),c=(0,i.useRef)(!1);return!o||s.current||l.current?!o&&s.current&&!c.current&&(c.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(l.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[o?e:n,Re((e=>(o||a(e),null==t?void 0:t(e))))]}(a,c,v),[_,E]=(0,i.useReducer)(Tf,{dataRef:(0,i.createRef)(),listboxState:g?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,optionsVisible:!1,buttonElement:null,optionsElement:null,__demoMode:g}),k=(0,i.useRef)({static:!1,hold:!1}),S=(0,i.useRef)(new Map),C=function(e=pf){return(0,i.useCallback)(((t,r)=>{if("string"==typeof e){let n=e;return(null==t?void 0:t[n])===(null==r?void 0:r[n])}return e(t,r)}),[e])}(u),R=(0,i.useCallback)((e=>Ve(A.mode,{1:()=>w.some((t=>C(t,e))),0:()=>C(w,e)})),[w]),A=(0,i.useMemo)((()=>({..._,value:w,disabled:p,invalid:d,mode:f?1:0,orientation:y,compare:C,isSelected:R,optionsPropsRef:k,listRef:S})),[w,p,d,f,_,S]);Se((()=>{_.dataRef.current=A}),[A]),ct(0===A.listboxState,[A.buttonElement,A.optionsElement],((e,t)=>{var r;E({type:1}),Xe(t,Ke.Loose)||(e.preventDefault(),null==(r=A.buttonElement)||r.focus())}));let P=(0,i.useMemo)((()=>({open:0===A.listboxState,disabled:p,invalid:d,value:w})),[A,p,w,d]),T=Re((e=>{let t=A.options.find((t=>t.id===e));t&&D(t.dataRef.current.value)})),N=Re((()=>{if(null!==A.activeOptionIndex){let{dataRef:e,id:t}=A.options[A.activeOptionIndex];D(e.current.value),E({type:2,focus:Rn.Specific,id:t})}})),I=Re((()=>E({type:0}))),O=Re((()=>E({type:1}))),L=ke(),B=Re(((e,t,r)=>{L.dispose(),L.microTask((()=>e===Rn.Specific?E({type:2,focus:Rn.Specific,id:t,trigger:r}):E({type:2,focus:e,trigger:r})))})),j=Re(((e,t)=>(E({type:5,id:e,dataRef:t}),()=>E({type:6,id:e})))),D=Re((e=>Ve(A.mode,{0:()=>null==x?void 0:x(e),1(){let t=A.value.slice(),r=t.findIndex((t=>C(t,e)));return-1===r?t.push(e):t.splice(r,1),null==x?void 0:x(t)}}))),F=Re((e=>E({type:3,value:e}))),M=Re((()=>E({type:4}))),z=Re((e=>{E({type:7,element:e})})),V=Re((e=>{E({type:8,element:e})})),W=(0,i.useMemo)((()=>({onChange:D,registerOption:j,goToOption:B,closeListbox:O,openListbox:I,selectActiveOption:N,selectOption:T,search:F,clearSearch:M,setButtonElement:z,setOptionsElement:V})),[]),[U,H]=Qn({inherit:!0}),$={ref:b},Z=(0,i.useCallback)((()=>{if(void 0!==v)return null==x?void 0:x(v)}),[x,v]),G=In();return i.createElement(H,{value:U,props:{htmlFor:null==(r=A.buttonElement)?void 0:r.id},slot:{open:0===A.listboxState,disabled:p}},i.createElement(hn,null,i.createElement(Cf.Provider,{value:W},i.createElement(Af.Provider,{value:A},i.createElement(En,{value:Ve(A.listboxState,{0:xn.Open,1:xn.Closed})},null!=l&&null!=w&&i.createElement(bf,{disabled:p,data:{[l]:w},form:s,onReset:Z}),G({ourProps:$,theirProps:h,slot:P,defaultTag:Nf,name:"Listbox"}))))))})),jf=Dn((function(e,t){var r;let n=Pf("Listbox.Button"),a=Rf("Listbox.Button"),o=(0,i.useId)(),s=Yn(),{id:l=s||`headlessui-listbox-button-${o}`,disabled:c=n.disabled||!1,autoFocus:u=!1,...d}=e,p=bt(t,pn(),a.setButtonElement),m=mn(),f=Re((e=>{switch(e.key){case Gn.Enter:!function(e){var t,r;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n){for(let t of n.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(r=n.requestSubmit)||r.call(n)}}(e.currentTarget);break;case Gn.Space:case Gn.ArrowDown:e.preventDefault(),(0,ye.flushSync)((()=>a.openListbox())),n.value||a.goToOption(Rn.First);break;case Gn.ArrowUp:e.preventDefault(),(0,ye.flushSync)((()=>a.openListbox())),n.value||a.goToOption(Rn.Last)}})),g=Re((e=>{e.key===Gn.Space&&e.preventDefault()})),h=Re((e=>{var t;if(Sn(e.currentTarget))return e.preventDefault();0===n.listboxState?((0,ye.flushSync)((()=>a.closeListbox())),null==(t=n.buttonElement)||t.focus({preventScroll:!0})):(e.preventDefault(),a.openListbox())})),y=Re((e=>e.preventDefault())),b=Jn([l]),v=function(){var e,t;return null!=(t=null==(e=(0,i.useContext)(Wn))?void 0:e.value)?t:void 0}(),{isFocusVisible:w,focusProps:x}=ue({autoFocus:u}),{isHovered:_,hoverProps:E}=he({isDisabled:c}),{pressed:k,pressProps:S}=Ae({disabled:c}),C=(0,i.useMemo)((()=>({open:0===n.listboxState,active:k||0===n.listboxState,disabled:c,invalid:n.invalid,value:n.value,hover:_,focus:w,autofocus:u})),[n.listboxState,n.value,c,_,w,k,n.invalid,u]),R=jn(m(),{ref:p,id:l,type:dt(e,n.buttonElement),"aria-haspopup":"listbox","aria-controls":null==(r=n.optionsElement)?void 0:r.id,"aria-expanded":0===n.listboxState,"aria-labelledby":b,"aria-describedby":v,disabled:c||void 0,autoFocus:u,onKeyDown:f,onKeyUp:g,onKeyPress:y,onClick:h},x,E,S);return In()({ourProps:R,theirProps:d,slot:C,defaultTag:"button",name:"Listbox.Button"})})),Df=ta,Ff=Dn((function(e,t){var r,n;let a=(0,i.useId)(),{id:o=`headlessui-listbox-options-${a}`,anchor:s,portal:l=!1,modal:c=!0,transition:u=!1,...d}=e,p=dn(s),[m,f]=(0,i.useState)(null);p&&(l=!0);let g=Pf("Listbox.Options"),h=Rf("Listbox.Options"),y=ut(g.optionsElement),b=_n(),[v,w]=Pt(u,m,null!==b?(b&xn.Open)===xn.Open:0===g.listboxState);ze(v,g.buttonElement,h.closeListbox),ht(!g.__demoMode&&c&&0===g.listboxState,y),Me(!g.__demoMode&&c&&0===g.listboxState,{allowed:(0,i.useCallback)((()=>[g.buttonElement,g.optionsElement]),[g.buttonElement,g.optionsElement])});let x=!Pe(0!==g.listboxState,g.buttonElement)&&v,_=function(e,t){let[r,n]=(0,i.useState)(t);return!e&&r!==t&&n(t),e?r:t}(v&&1===g.listboxState,g.value),E=Re((e=>g.compare(_,e))),k=(0,i.useMemo)((()=>{var e;if(null==p||null==(e=null==p?void 0:p.to)||!e.includes("selection"))return null;let t=g.options.findIndex((e=>E(e.dataRef.current.value)));return-1===t&&(t=0),t}),[p,g.options]),S=(()=>{if(null==p)return;if(null===k)return{...p,inner:void 0};let e=Array.from(g.listRef.current.values());return{...p,inner:{listRef:{current:e},index:k}}})(),[C,R]=gn(S),A=fn(),P=bt(t,p?C:null,h.setOptionsElement,f),T=ke();(0,i.useEffect)((()=>{var e;let t=g.optionsElement;t&&0===g.listboxState&&t!==(null==(e=xe(t))?void 0:e.activeElement)&&(null==t||t.focus({preventScroll:!0}))}),[g.listboxState,g.optionsElement]);let N=Re((e=>{var t,r;switch(T.dispose(),e.key){case Gn.Space:if(""!==g.searchQuery)return e.preventDefault(),e.stopPropagation(),h.search(e.key);case Gn.Enter:if(e.preventDefault(),e.stopPropagation(),null!==g.activeOptionIndex){let{dataRef:e}=g.options[g.activeOptionIndex];h.onChange(e.current.value)}0===g.mode&&((0,ye.flushSync)((()=>h.closeListbox())),null==(t=g.buttonElement)||t.focus({preventScroll:!0}));break;case Ve(g.orientation,{vertical:Gn.ArrowDown,horizontal:Gn.ArrowRight}):return e.preventDefault(),e.stopPropagation(),h.goToOption(Rn.Next);case Ve(g.orientation,{vertical:Gn.ArrowUp,horizontal:Gn.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),h.goToOption(Rn.Previous);case Gn.Home:case Gn.PageUp:return e.preventDefault(),e.stopPropagation(),h.goToOption(Rn.First);case Gn.End:case Gn.PageDown:return e.preventDefault(),e.stopPropagation(),h.goToOption(Rn.Last);case Gn.Escape:return e.preventDefault(),e.stopPropagation(),(0,ye.flushSync)((()=>h.closeListbox())),void(null==(r=g.buttonElement)||r.focus({preventScroll:!0}));case Gn.Tab:e.preventDefault(),e.stopPropagation(),(0,ye.flushSync)((()=>h.closeListbox())),nt(g.buttonElement,e.shiftKey?Ze.Previous:Ze.Next);break;default:1===e.key.length&&(h.search(e.key),T.setTimeout((()=>h.clearSearch()),350))}})),I=null==(r=g.buttonElement)?void 0:r.id,O=(0,i.useMemo)((()=>({open:0===g.listboxState})),[g.listboxState]),L=jn(p?A():{},{id:o,ref:P,"aria-activedescendant":null===g.activeOptionIndex||null==(n=g.options[g.activeOptionIndex])?void 0:n.id,"aria-multiselectable":1===g.mode||void 0,"aria-labelledby":I,"aria-orientation":g.orientation,onKeyDown:N,role:"listbox",tabIndex:0===g.listboxState?0:void 0,style:{...d.style,...R,"--button-width":Te(g.buttonElement,!0).width},...At(w)}),B=In();return i.createElement(ma,{enabled:!!l&&(e.static||v)},i.createElement(Af.Provider,{value:1===g.mode?g:{...g,isSelected:E}},B({ourProps:L,theirProps:d,slot:O,defaultTag:"div",features:Of,visible:x,name:"Listbox.Options"})))})),Mf=Dn((function(e,t){let r=(0,i.useId)(),{id:n=`headlessui-listbox-option-${r}`,disabled:a=!1,value:o,...s}=e,l=!0===(0,i.useContext)(If),c=Pf("Listbox.Option"),u=Rf("Listbox.Option"),d=null!==c.activeOptionIndex&&c.options[c.activeOptionIndex].id===n,p=c.isSelected(o),m=(0,i.useRef)(null),f=xt(m),g=Ce({disabled:a,value:o,domRef:m,get textValue(){return f()}}),h=bt(t,m,(e=>{e?c.listRef.current.set(n,e):c.listRef.current.delete(n)}));Se((()=>{if(!c.__demoMode&&0===c.listboxState&&d&&0!==c.activationTrigger)return Ee().requestAnimationFrame((()=>{var e,t;null==(t=null==(e=m.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})}))}),[m,d,c.__demoMode,c.listboxState,c.activationTrigger,c.activeOptionIndex]),Se((()=>{if(!l)return u.registerOption(n,g)}),[g,n,l]);let y=Re((e=>{var t;if(a)return e.preventDefault();u.onChange(o),0===c.mode&&((0,ye.flushSync)((()=>u.closeListbox())),null==(t=c.buttonElement)||t.focus({preventScroll:!0}))})),b=Re((()=>{if(a)return u.goToOption(Rn.Nothing);u.goToOption(Rn.Specific,n)})),v=Et(),w=Re((e=>{v.update(e),!a&&(d||u.goToOption(Rn.Specific,n,0))})),x=Re((e=>{v.wasMoved(e)&&(a||d||u.goToOption(Rn.Specific,n,0))})),_=Re((e=>{v.wasMoved(e)&&(a||d&&u.goToOption(Rn.Nothing))})),E=(0,i.useMemo)((()=>({active:d,focus:d,selected:p,disabled:a,selectedOption:p&&l})),[d,p,a,l]),k=l?{}:{id:n,ref:h,role:"option",tabIndex:!0===a?void 0:-1,"aria-disabled":!0===a||void 0,"aria-selected":p,disabled:void 0,onClick:y,onFocus:b,onPointerEnter:w,onMouseEnter:w,onPointerMove:x,onMouseMove:x,onPointerLeave:_,onMouseLeave:_},S=In();return!p&&l?null:S({ourProps:k,theirProps:s,slot:E,defaultTag:"div",name:"Listbox.Option"})})),zf=Dn((function(e,t){let{options:r,placeholder:n,...a}=e,o={ref:bt(t)},s=Pf("ListboxSelectedOption"),l=(0,i.useMemo)((()=>({})),[]),c=void 0===s.value||null===s.value||1===s.mode&&Array.isArray(s.value)&&0===s.value.length,u=In();return i.createElement(If.Provider,{value:!0},u({ourProps:o,theirProps:{...a,children:i.createElement(i.Fragment,null,n&&c?n:r)},slot:l,defaultTag:Lf,name:"ListboxSelectedOption"}))})),Vf=Object.assign(Bf,{Button:jf,Label:Df,Options:Ff,Option:Mf,SelectedOption:zf});function Wf({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const Uf=i.forwardRef(Wf),Hf=({onSelect:e,value:r,showLabel:n,classNameChild:a="py-3 pl-4 pr-12",classNameParent:o="mt-2",placement:s="right",label:l="This website will be in",tooltipText:c=""})=>{const{siteLanguageList:u}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()})),[d,p]=(0,i.useState)(u.find((e=>"en"===e.code))),[m,f]=(0,i.useState)("");let h="bottom-end";h="left"===s?"bottom-start":"bottom-end";const[v,w]=Ka({placement:h,modifiers:[{name:"offset",options:{offset:[0,0]}}]}),x=e=>{f(e.target.value)},_=u.filter((e=>e.name.toLowerCase().includes(m.toLowerCase())));return(0,i.useEffect)((()=>{r&&r.code!==d.code&&p("string"==typeof r?u.find((e=>e.code===r)):r)}),[r]),React.createElement(Vf,{value:d,onChange:t=>{p(t),"function"==typeof e&&e(t)}},(({open:e})=>React.createElement(React.Fragment,null,n&&React.createElement(Vf.Label,{className:"text-base font-semibold flex leading-6 text-zip-app-heading"},c&&React.createElement("div",{className:"mr-1 pt-0.5"},React.createElement(b.A,{content:c},React.createElement(Uf,{className:"w-4 h-4"}))),l),React.createElement("div",{className:(0,y.xW)("relative",o)},React.createElement(Vf.Button,{ref:v,className:(0,y.xW)("min-h-[48px] relative w-full cursor-default rounded-md bg-white text-zip-app-heading shadow-sm border border-solid border-border-primary focus:border-accent-st active:border-accent-st ring-1 ring-inset ring-transparent focus:outline-none active:outline-none focus:ring-accent-st","text-base font-normal text-left leading-6")},React.createElement("div",{className:(0,y.xW)("inline-flex items-center gap-2 w-full max-w-container relative",a)},React.createElement("span",{className:"min-w-fit uppercase text-center text-sm text-zip-app-heading font-semibold leading-5"},d.code),React.createElement("span",{className:"!shrink-0 w-px h-[14px] bg-border-tertiary"}),React.createElement("span",{className:"w-full text-base font-normal leading-6 block truncate"},d.name," ","en"===d.code&&"(Default)")),React.createElement("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-4"},React.createElement(Cc,{className:"h-5 w-5 text-zip-app-heading","aria-hidden":"true"}))),React.createElement($a,{show:e,as:i.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0"},React.createElement(Vf.Options,{ref:w,className:(0,y.xW)("w-full absolute z-10 !mt-1 !mb-1 rounded-md bg-white p-4 space-y-3 text-base font-normal leading-6 shadow-xl border-0 ring-0 focus:outline-none")},React.createElement("div",{className:"group relative flex flex-1 rounded-md bg-white focus-within:ring-1 focus-within:outline-none focus-within:ring-accent-st border border-solid border-border-tertiary shadow-sm focus-within:border-accent-st transition duration-150 ease-in-out"},React.createElement("label",{htmlFor:"search-field",className:"sr-only"},"Search"),React.createElement(ko,{className:"pointer-events-none absolute inset-y-0 left-2.5 h-full w-5 text-app-inactive-icon group-focus-within:text-app-active-icon transition duration-150 ease-in-out","aria-hidden":"true"}),React.createElement("input",{ref:e=>{e&&e.focus()},className:"appearance-none text-base h-[2.625rem] block w-full !border-0 py-0 !pl-10 pr-5 text-zip-app-heading placeholder:!text-zip-app-inactive-icon focus:ring-0 sm:text-sm bg-transparent focus:outline-none focus:!shadow-none focus:!border-0 focus-within:!border-0",placeholder:"Search Language",type:"search",value:m,onChange:x,name:"search"})),React.createElement("div",{className:(0,y.xW)("max-h-60 w-full overflow-x-hidden overflow-y-auto space-y-1","[&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-md [&::-webkit-scrollbar-thumb]:bg-dark-app-background/20 [&::-webkit-scrollbar-thumb:hover]:bg-dark-app-background/30 [&::-webkit-scrollbar-track]:bg-white [&::-webkit-scrollbar-track]:my-1 [&::-webkit-scrollbar-track]:rounded-md scroll-p-0")},_.length>0&&_.map((e=>React.createElement(Vf.Option,{key:e.code,as:i.Fragment,value:e},(({active:t})=>React.createElement("div",{className:(0,y.xW)("w-full max-w-container relative flex items-center justify-between cursor-default select-none py-2 pl-3 pr-2 rounded",(d.code===e.code||t)&&"bg-alert-info-bg")},React.createElement("div",{className:"w-full flex items-center gap-2"},React.createElement("span",{className:"min-w-fit uppercase text-center text-sm text-zip-app-heading font-semibold leading-5"},e.code),React.createElement("span",{className:"w-px h-[14px] bg-border-tertiary !shrink-0"}),React.createElement("span",{className:(0,y.xW)("w-full truncate font-normal text-base leading-6",d.code===e.code?"text-zip-app-heading":"text-app-text")},e.name)),d.code===e.code&&React.createElement("span",{className:(0,y.xW)("absolute inset-y-0 right-0 flex items-center pr-4")},React.createElement(ei.It,{className:"h-6 w-6","aria-hidden":"true"}))))))),0===_.length&&React.createElement("div",{className:"relative cursor-default select-none py-2 px-4 text-base font-normal text-app-text"},"Nothing found"))))))))},$f=()=>{const{setWebsiteLanguageAIStep:e}=(0,r.A)(g.U),{siteLanguage:n,siteLanguageList:a}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()}));return c().createElement("div",{className:"flex flex-col items-start gap-x-2"},c().createElement("h5",{className:"text-zip-app-heading !text-sm flex !font-medium leading-6 items-center !mb-2"},"The website will be in:",c().createElement("div",{className:"ml-1 pt-1"})),a&&0!==a.length?c().createElement(Hf,{onSelect:t=>{e(t.code)},value:a.find((e=>e.code===n)),showLabel:!1,classNameParent:"w-full",classNameChild:"py-2 pl-3 pr-8"}):c().createElement("div",{className:"h-12 w-full inline-flex justify-start items-center gap-2 border border-solid border-border-tertiary py-2 pl-3 pr-8 rounded-md shadow-sm"},c().createElement("div",{className:"w-8 h-full bg-gray-300 animate-pulse"}),c().createElement("span",{className:"!shrink-0 w-px h-[14px] bg-border-tertiary"}),c().createElement("div",{className:"w-full h-full bg-gray-300 animate-pulse"})))},{useState:Zf,useEffect:Gf,useCallback:qf,useMemo:Yf}=wp.element,Kf=(e,t,r=null)=>{const[n,a]=Zf(e),i=qf((e=>{r&&"function"==typeof r&&r(e),a(e)}),[r]);return Gf((()=>{const r=setTimeout((()=>{i(e)}),t);return()=>{clearTimeout(r)}}),[e,t,i]),Yf((()=>n),[n])};function Xf(){return Xf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{setWebsiteTypeAIStep:e,setBusinessTypeListAIStep:n}=(0,r.A)(g.U),{businessType:a,businessTypeList:o}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()})),[s,l]=Ka({placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,0]}},{name:"flip",enabled:!1},{name:"preventOverflow",options:{boundariesElement:"viewport"}}]}),[c,u]=(0,i.useState)(!1),[d,p]=(0,i.useState)(!1),m=(0,i.useRef)(null),h=(0,i.useRef)(null),{register:b,setValue:v,reset:w,setFocus:x,watch:_}=Ql({defaultValues:{keyword:a??""}}),E=_("keyword"),k=Kf(E,300),S=e=>{E||""===a||v("keyword",a),E&&a&&E!==a&&v("keyword",E),u(!1),e&&e?.blur()},C=(0,i.useCallback)((()=>{(async(e="")=>{m.current&&(m.current.abort(),m.current=null),p(!0),m.current=new AbortController;try{const t=await(0,y.nr)({path:"zipwp/v1/search-category",method:"POST",data:{keyword:e},headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce},signal:m.current.signal});if(!t.success)throw new Error(t?.data?.data);n(t?.data?.data),p(!1)}catch(e){if("AbortError"===e.name)return;(0,ti.v)(e),p(!1)}})(c?k:"")}),[k]);(0,i.useEffect)((()=>{C()}),[C]);const R=e=>{const t=document.getElementById("business-types-suggestions");t&&!t.contains(e.target)&&S()};(0,i.useEffect)((()=>(document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R))),[R]);const A=()=>{try{const e=o&&Array.isArray(o)?o:[];if(!E)return e;const t=e?.find((({document:e})=>e.name?.toLowerCase()?.trim()===E?.toLowerCase()?.trim()));return t?e:[{document:{name:E},highlight:{name:{matched_tokens:[E.trim()]}}},...e]}catch(e){return[]}};return React.createElement("div",{id:"business-types-suggestions",ref:s,className:(0,y.xW)("relative pr-3 pl-4 py-3 bg-white rounded-md border border-solid border-border-primary w-full",{"pb-0 rounded-b-none border-b-0 shadow-md":c}),onKeyDown:e=>{const t=document.getElementById("business-types-suggestions");if(!t)return;const r=Array.from(t.querySelectorAll('button, input, [tabindex]:not([tabindex="-1"])'));let n=r.indexOf(document.activeElement);switch(e.key){case"Escape":S(e?.target);break;case"ArrowUp":n--,n<0&&(n=r.length-1),r[n].focus(),e.preventDefault();break;case"ArrowDown":n++,n>=r.length&&(n=0),r[n].focus(),e.preventDefault()}},role:"presentation"},React.createElement("div",{className:"flex items-center justify-start w-full gap-2"},d&&c?React.createElement(Vi.A,{className:"text-accent-st w-4 h-4"}):E?React.createElement("button",{className:"inline-flex !p-0 !m-0 border-0 !bg-transparent focus:outline-none cursor-pointer",onClick:()=>{h.current&&(h.current.scrollTop=0),w({keyword:""}),e(""),c&&setTimeout((()=>{x("keyword")}),10)}},React.createElement(f,{className:"w-4 h-4 !text-zip-app-inactive-icon peer-focus:text-nav-inactive stroke-2 !shrink-0"})):React.createElement(ko,{className:"w-4 h-4 text-zip-app-inactive-icon peer-focus:text-nav-inactive !shrink-0"}),React.createElement("input",Xf({className:"!h-auto !px-0 !mx-0 !border-0 !rounded-none !min-h-0 !shadow-none focus:ring-0 focus:!outline-none focus:!shadow-none w-full text-sm placeholder:text-sm placeholder:!text-zip-app-inactive-icon",type:"text",placeholder:"Type to search",onFocus:()=>u(!0),autoComplete:"off"},b("keyword")))),React.createElement("div",{ref:l,className:(0,y.xW)("w-[calc(100%_+_2px)] px-3 pb-3 z-10 bg-white shadow-md border-x border-b border-t-0 border-solid border-border-primary rounded-b-md",{invisible:!c})},c&&React.createElement("hr",{className:"!mx-0 !my-3 border-t border-solid border-b-0 border-border-primary",tabIndex:-1}),React.createElement("div",{ref:h,className:"max-h-[150px] w-full overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar-thumb:hover]:bg-black/[0.15] [&::-webkit-scrollbar-thumb]:w-2 [&::-webkit-scrollbar-thumb]:rounded-none [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-thumb]:bg-black/10"},React.createElement(Cd.P.div,{className:"w-full flex flex-col gap-1 justify-start",initial:!1,animate:c?"open":"closed",variants:Jf},A()?.length>0&&A().map((({document:t,highlight:r})=>React.createElement(Cd.P.button,{key:t.name,className:(0,y.xW)("flex items-center justify-start w-full gap-2 py-2 px-3 bg-background-tertiary rounded border-0 !bg-transparent hover:!bg-zip-app-light-bg focus:!bg-zip-app-light-bg !text-zip-body-text hover:!text-zip-app-heading focus:outline-none focus:!shadow-none",{"!bg-zip-app-light-bg !text-zip-app-heading":t.name===a},"text-left"),onClick:()=>{v("keyword",t.name),e(t.name),u(!1)},variants:Qf},((e,t)=>{if(!t)return e;const{name:{matched_tokens:r}}=t,n=e.split(new RegExp(`(${r.join("|")})`,"gi"));return React.createElement("span",null,n.map(((e,t)=>r.includes(e)?React.createElement("span",{key:t,className:"font-semibold"},e):e)))})(t.name,r))))))))},tg=(0,e.A)((0,n.A)((e=>{const{setNextAIStep:t}=e(g.U);return{onClickContinue:t}})))((({onClickContinue:e})=>{const{setSiteLanguageListAIStep:n,setWebsiteNameAIStep:a}=(0,r.A)(g.U),{businessType:o,siteLanguageList:s,businessName:l}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()}));(0,i.useEffect)((()=>{s?.length||(async()=>{try{const e=await(0,y.nr)({path:"zipwp/v1/site-languages",method:"GET",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce}});if(!e.success)throw new Error(e?.data?.data);n(e?.data?.data)}catch(e){(0,ti.v)(e)}})()}),[s]);const{register:c,formState:{errors:d},setFocus:p,watch:m}=Ql({defaultValues:{businessName:l}}),f=m("businessName");return(0,i.useEffect)((()=>{p("businessName")}),[p]),React.createElement(af,null,React.createElement(df,{heading:"Let's build your website!",subHeading:"Please share some basic details of the website to get started."}),React.createElement("div",{className:"w-full max-w-container flex flex-col gap-8"},React.createElement("div",{className:"!space-y-2"},React.createElement("h5",{className:"text-zip-app-heading !text-sm flex !font-medium leading-6 items-center !mb-2"},(0,u.__)("Name of the website:","astra-sites")),React.createElement(Qo,{className:"w-full",name:"businessName",placeholder:(0,u.__)("Enter name or title of the website","astra-sites"),register:c,maxLength:100,validations:{required:"Name is required",maxLength:100},error:d.businessName,height:"12"})),React.createElement("div",{className:"w-full flex items-start justify-start flex-wrap max-[1024px]:flex-col lg:flex-nowrap gap-8"},React.createElement("div",{className:"min-h-[48px] lg:w-full lg:flex-1 w-full !space-y-2"},React.createElement("h5",{className:"text-zip-app-heading !text-sm flex !font-medium leading-6 items-center"},(0,u.__)("This website is for:","astra-sites")),React.createElement(eg,null)),React.createElement("div",{className:"min-h-[48px] lg:w-full lg:flex-1 w-full !space-y-2"},React.createElement($f,null)))),React.createElement(Qa,null),React.createElement(Od,{onClickContinue:()=>{o&&""!==o&&(a(f),e())},disableContinue:!o||!f}))})),rg=()=>{const{token:e}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return t()})),{handleSubmit:r,setFocus:n}=Ql({defaultValues:{token:e}});(0,i.useEffect)((()=>{n("apiKey")}),[n]);const a=[{icon:React.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{clipPath:"url(#clip0_2919_32447)"},React.createElement("path",{d:"M13.2617 1.47461C13.2617 0.787597 12.6875 0.203125 12.0005 0.203125C11.3135 0.203125 10.729 0.787597 10.729 1.47461V4.60205C10.729 5.28906 11.3135 5.86328 12.0005 5.86328C12.6875 5.86328 13.2617 5.28906 13.2617 4.60205V1.47461ZM16.4199 5.86328C15.9482 6.34521 15.9482 7.16553 16.4405 7.65771C16.9121 8.1294 17.7426 8.1294 18.2246 7.63721L20.3676 5.49414C20.8496 5.02247 20.8394 4.1919 20.3472 3.69971C19.8755 3.21777 19.0449 3.23828 18.563 3.72021L16.4199 5.86328ZM5.76611 7.63721C6.24805 8.1294 7.07861 8.1294 7.55029 7.65771C8.04248 7.16553 8.04248 6.34521 7.57081 5.86328L5.43799 3.72021C4.95605 3.23828 4.12549 3.21777 3.65381 3.69971C3.16162 4.18164 3.16162 5.01221 3.63331 5.48388L5.76611 7.63721ZM19.9575 22.3925C20.5727 23.018 21.6186 23.0078 22.2236 22.3925C22.8287 21.767 22.8287 20.752 22.2236 20.1265L12.4927 10.3237C11.8774 9.7085 10.8315 9.7085 10.2266 10.3237C9.61133 10.9492 9.62158 11.9644 10.2266 12.5796L19.9575 22.3925ZM1.39795 10.7954C0.710938 10.7954 0.136719 11.3696 0.136719 12.0566C0.136719 12.7437 0.710938 13.3179 1.39795 13.3179H4.52539C5.2124 13.3179 5.79688 12.7437 5.79688 12.0566C5.79688 11.3696 5.2124 10.7954 4.52539 10.7954H1.39795ZM22.5927 13.3179C23.2797 13.3179 23.8643 12.7437 23.8643 12.0566C23.8643 11.3696 23.2797 10.7954 22.5927 10.7954H19.4756C18.7886 10.7954 18.204 11.3696 18.204 12.0566C18.204 12.7437 18.7886 13.3179 19.4756 13.3179H22.5927ZM14.4409 15.2045L11.2417 11.9951C10.9853 11.749 10.8931 11.4312 11.1494 11.1851C11.375 10.9595 11.7031 11.0415 11.9595 11.2979L15.1382 14.4868L14.4409 15.2045ZM3.63331 18.5986C3.15137 19.0805 3.14111 19.9111 3.61279 20.3828C4.09472 20.875 4.92529 20.8853 5.40722 20.4136L7.55029 18.2705C8.03222 17.7886 8.04248 16.9682 7.57081 16.4863C7.08887 16.0043 6.25831 15.9941 5.77637 16.4659L3.63331 18.5986ZM13.2617 19.5215C13.2617 18.8345 12.6875 18.25 12.0005 18.25C11.3135 18.25 10.729 18.8345 10.729 19.5215V22.6387C10.729 23.3257 11.3135 23.9102 12.0005 23.9102C12.6875 23.9102 13.2617 23.3257 13.2617 22.6387V19.5215Z",fill:"#2563EB"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_2919_32447"},React.createElement("rect",{width:"24",height:"24",fill:"white"})))),title:"Craft Compelling Content",description:"With our AI, you can effortlessly create persuasive and engaging copy that resonates with your audience."},{icon:React.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M19.4666 2.3999C20.6448 2.3999 21.5999 3.34194 21.5999 4.50401L21.5999 8.09583C21.5999 9.2579 20.6448 10.1999 19.4666 10.1999H16.2666C15.0884 10.1999 14.1332 9.2579 14.1332 8.09583L14.1332 4.50401C14.1332 3.34194 15.0884 2.3999 16.2666 2.3999L19.4666 2.3999Z",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("path",{d:"M4.53323 2.3999C3.35503 2.3999 2.3999 3.34194 2.3999 4.50401L2.39991 8.09583C2.39991 9.2579 3.35504 10.1999 4.53324 10.1999H7.73324C8.91145 10.1999 9.86658 9.2579 9.86658 8.09583L9.86657 4.50401C9.86657 3.34194 8.91144 2.3999 7.73323 2.3999L4.53323 2.3999Z",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("path",{d:"M19.4666 13.7999C20.6448 13.7999 21.5999 14.742 21.5999 15.9041V19.4958C21.5999 20.6579 20.6448 21.5999 19.4666 21.5999H16.2666C15.0884 21.5999 14.1332 20.6579 14.1332 19.4958L14.1332 15.9041C14.1332 14.742 15.0884 13.7999 16.2666 13.7999H19.4666Z",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("path",{d:"M4.53324 13.7999C3.35504 13.7999 2.39991 14.742 2.39991 15.9041L2.39991 19.4958C2.39991 20.6579 3.35504 21.5999 4.53325 21.5999H7.73325C8.91145 21.5999 9.86658 20.6579 9.86658 19.4958L9.86657 15.9041C9.86657 14.742 8.91145 13.7999 7.73324 13.7999H4.53324Z",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),title:"AI-Powered Block Patterns",description:"Our AI can personalize and customize the block patterns and section templates to tailor them to your website's unique needs."},{icon:React.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{clipPath:"url(#clip0_2919_32460)"},React.createElement("path",{d:"M24 12C24 5.376 18.624 0 12 0C5.376 0 0 5.376 0 12C0 18.624 5.376 24 12 24C18.624 24 24 18.624 24 12ZM12 1.212C17.964 1.212 22.788 6.036 22.788 12C22.788 17.964 17.964 22.788 12 22.788C6.036 22.788 1.212 17.964 1.212 12C1.212 6.036 6.036 1.212 12 1.212ZM9.612 17.784L5.952 7.932C6.54 7.896 7.212 7.836 7.212 7.836C7.728 7.776 7.668 6.624 7.14 6.648C7.14 6.648 5.592 6.768 4.584 6.768C4.404 6.768 4.188 6.768 3.96 6.756C5.688 4.152 8.64 2.436 12 2.436C14.508 2.436 16.788 3.384 18.492 4.944C17.772 4.848 16.752 5.364 16.752 6.648C16.752 7.44 17.208 8.112 17.7 8.904C18.072 9.552 18.3 10.368 18.3 11.556C18.3 13.164 16.776 16.932 16.776 16.932L13.524 7.932C14.1 7.896 14.424 7.74 14.424 7.74C14.94 7.68 14.88 6.42 14.364 6.444C14.364 6.444 12.804 6.576 11.796 6.576C10.86 6.576 9.264 6.444 9.264 6.444C8.748 6.42 8.688 7.716 9.204 7.74L10.212 7.836L11.556 11.484L9.612 17.784ZM16.836 20.364L19.968 12C19.968 12 20.772 9.972 20.436 7.428C21.192 8.796 21.564 10.332 21.564 12C21.564 15.552 19.692 18.696 16.836 20.364ZM3.216 8.124L7.8 20.7C4.596 19.14 2.436 15.804 2.436 12C2.436 10.608 2.676 9.324 3.216 8.124ZM12.156 13.56L14.904 21.06C14.004 21.384 13.02 21.564 12 21.564C11.136 21.564 10.308 21.432 9.528 21.204L12.156 13.56Z",fill:"#2563EB"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_2919_32460"},React.createElement("rect",{width:"24",height:"24",fill:"white"})))),title:"WordPress Wizardry",description:"Got questions? Our AI has the answers. Whether it's troubleshooting or customizing your site, we got your back."},{icon:React.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M2 3.97434C2 2.88394 2.89543 2 4 2H20C21.1046 2 22 2.88394 22 3.97434V20.0257C22 21.1161 21.1046 22 20 22H4C2.89543 22 2 21.1161 2 20.0257V3.97434Z",stroke:"#2563EB",strokeWidth:"1.7"}),React.createElement("path",{d:"M4.35748 5.44157C4.35748 4.89637 4.8052 4.4544 5.35748 4.4544H18.6426C19.1949 4.4544 19.6426 4.89637 19.6426 5.44157V7.94377C19.6426 8.48897 19.1949 8.93094 18.6426 8.93094H5.35748C4.8052 8.93094 4.35748 8.48897 4.35748 7.94377V5.44157Z",stroke:"#2563EB",strokeWidth:"1.7"}),React.createElement("path",{d:"M8.29303 11.1402C8.84531 11.1402 9.29303 11.5822 9.29303 12.1274L9.29303 18.7411C9.29303 19.2863 8.84531 19.7283 8.29303 19.7283H5.35742C4.80514 19.7283 4.35742 19.2863 4.35742 18.7411L4.35742 12.1274C4.35742 11.5822 4.80514 11.1402 5.35742 11.1402H8.29303Z",stroke:"#2563EB",strokeWidth:"1.7"}),React.createElement("path",{d:"M18.6426 11.1402C19.1949 11.1402 19.6426 11.5822 19.6426 12.1274V18.7411C19.6426 19.2863 19.1949 19.7283 18.6426 19.7283H12.3755C11.8233 19.7283 11.3755 19.2863 11.3755 18.7411V12.1274C11.3755 11.5822 11.8233 11.1402 12.3755 11.1402H18.6426Z",stroke:"#2563EB",strokeWidth:"1.7"})),title:"Personalized Templates",description:"Say goodbye to generic designs and say hello to our AI-personalized page templates, tailored just for you."},{icon:React.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M9.5999 14.9999L6.5999 11.9999L9.5999 8.9999M14.3999 8.9999L17.3999 11.9999L14.3999 14.9999M4.7999 21.5999C3.47442 21.5999 2.3999 20.5254 2.3999 19.1999V4.7999C2.3999 3.47442 3.47442 2.3999 4.7999 2.3999H19.1999C20.5254 2.3999 21.5999 3.47442 21.5999 4.7999V19.1999C21.5999 20.5254 20.5254 21.5999 19.1999 21.5999H4.7999Z",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),title:"Generate Custom Code",description:"No more struggling with complex coding issues. Our AI can generate custom code, functions, and CSS tailored to your needs."},{icon:React.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M2.9999 7.7999H20.9999M17.9999 11.9999H5.9999M13.1999 16.7999H5.9999M5.9999 21.5999H17.9999C19.9881 21.5999 21.5999 19.9881 21.5999 17.9999V5.9999C21.5999 4.01168 19.9881 2.3999 17.9999 2.3999H5.9999C4.01168 2.3999 2.3999 4.01168 2.3999 5.9999V17.9999C2.3999 19.9881 4.01168 21.5999 5.9999 21.5999Z",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),title:"Custom Pages with AI",description:"With our AI by your side, you can create beautiful, 100% custom web pages without the need for any design or coding skills."}],o=(0,i.useMemo)((()=>{const e=[];let t=[];for(let r=0;r0&&e.push(t),e.map(((t,r)=>React.createElement(React.Fragment,null,React.createElement("div",{className:"flex justify-between items-center gap-12"},t.map((e=>(({icon:e,title:t,description:r})=>React.createElement("div",{className:"flex w-[48%]"},React.createElement("div",{className:"mr-3"},e),React.createElement("div",{className:"space-y-2"},React.createElement("p",{className:"m-0 text-base font-semibold text-heading-text"},t),React.createElement("p",{className:"m-0 text-sm font-normal text-body-text"},r))))(e)))),r{window.location.href=(0,Wo.i9)()}))},React.createElement("div",{className:"flex items-center justify-center gap-3"},"active"===ast_block_template_vars.astra_sites_status||"active"===ast_block_template_vars.astra_sites_pro_status?React.createElement(ei.fp,{className:"w-10 h-10"}):React.createElement(ei.y0,{className:"w-10 h-10"}),React.createElement(Ld.A,{className:"w-4 h-4 text-icon-secondary",strokeWidth:"2"}),React.createElement(ei.g9,{className:"w-10 h-10"})),React.createElement("div",{className:"flex flex-col items-center justify-center gap-6"},React.createElement(df,{className:"text-center",heading:React.createElement(React.Fragment,null,"Build 10x Faster with ",React.createElement("br",null),"Starter Templates & ZipWP")}),React.createElement(ii.A,{type:"button",variant:"ai-primary",onClick:()=>{window.location.href=(0,Wo.i9)()},hasSuffixIcon:!0},React.createElement("span",null,"Get Started with Free 1000 Credits"),React.createElement(Ms,{className:"w-5 h-5"})),React.createElement("p",{className:"m-0 text-base font-normal"},"Already have one?"," ",React.createElement(ii.A,{type:"submit",variant:"blank",className:"font-normal underline text-accent-st p-0 inline-flex"},"Connect an Account"))),React.createElement("div",{className:"border border-solid border-border-primary rounded-lg gap-8 flex flex-wrap py-11 px-10 shadow-medium bg-white"},o))};var ng=function(){return ng=Object.assign||function(e){for(var t,r=1,n=arguments.length;rReact.createElement("div",{className:(0,y.xW)("w-full h-10 bg-gray-300 rounded animate-pulse",e)}),Ag="IMPROVE_USING_AI_MODAL",Pg=((e,t)=>{const r=Cg.create((({handleFetchSuggestion:e})=>{const t=xg(Ag),[r,n]=(0,i.useState)(null),[a,o]=(0,i.useState)(!1),s=(0,i.useCallback)((()=>a?React.createElement(Vi.A,null):r?(0,u.__)("Use this","ai-builder"):(0,u.__)("Improve Using AI","ai-builder")),[a,r]),l=()=>{t.resolve(""),t.hide(),t.remove()};return React.createElement(ji,{open:t.visible,setOpen:l,onFullyClose:t.remove,width:480,className:"!p-6 !w-[30rem]"},React.createElement(Di,null,React.createElement("span",{className:"flex items-center space-x-1 gap-2"},React.createElement(ei.Rk,{className:"w-6 h-6 "}),React.createElement("div",{className:"font-semibold text-lg text-black"},(0,u.__)("Add More Business Details","ai-builder")))),React.createElement("div",{className:"text-app-text !mt-5 text-base !opacity-80"},(0,u.__)("The business details provided are not enough to create the website content. Please describe your business with more details, or use AI to write it for you.","ai-builder")),r&&React.createElement("div",{className:"w-full mb-2"},React.createElement("p",{className:"text-base leading-6 font-semibold p-2 mb-0"},(0,u.__)("A good business description is:","ai-builder")),React.createElement("div",{className:"bg-[#F6FAFE] p-4 rounded-lg shadow-sm"},React.createElement("p",{className:"text-sm leading-5 my-0"},r))),a&&React.createElement("div",{className:"w-full mb-2"},React.createElement(Rg,{className:"h-20"})),React.createElement("div",{className:"flex flex-col pt-2 !mt-5 gap-y-5"},React.createElement("div",{className:"flex gap-4 items-center space-x-3"},React.createElement(ii.A,{className:"w-full h-10 !text-sm bg-accent-st hover:bg-accent-st/90 border border-accent-st disabled:bg-accent-st/90",variant:"primary",disabled:a,onClick:async()=>{if(!a&&r)return t.resolve(r),t.hide(),void n(null);o(!0);const i=await e();n(i),o(!1)}},s()),React.createElement(ii.A,{className:"w-full h-10 !text-sm border-gray-200 text-black",variant:"white",onClick:l},r?(0,u.__)("Close","ai-builder"):(0,u.__)("I'll Write by Myself","ai-builder")))))}));return Cg.register(t,r),{...r,show:e=>Cg.show(t,e)}})(0,Ag),Tg=(0,e.A)((0,n.A)((e=>{const{setNextAIStep:t,setPreviousAIStep:r}=e("astra-sites");return{onClickContinue:t,onClickPrevious:r}})))((({onClickContinue:e,onClickPrevious:n})=>{const{businessDetails:a,businessType:o,businessName:s,businessDetailsHistory:l,descriptionListStore:c,loadingNextStep:d,siteLanguage:p,siteLanguageList:m}=(0,t.A)((e=>{const{getAIStepData:t,getLoadingNextStep:r}=e(g.U);return{...t(),loadingNextStep:r()}})),f=(0,t.A)((e=>{const{getOnboardingAI:t}=e(g.U);return t()})),{setWebsiteDetailsAIStep:h,setWebsiteKeywordsAIStep:b,resetKeywordsImagesAIStep:v,setWebsiteDetailsHistoryAIStep:w,setOnboardingAIDetails:x}=(0,r.A)(g.U),[_,E]=(0,i.useState)(!1),[k,S]=(0,i.useState)(!1),[C]=(0,i.useState)(l),R=(0,i.useRef)(a),A=(0,i.useRef)(null),{register:P,handleSubmit:T,formState:{errors:N},watch:I,setValue:O,setFocus:L}=Ql({defaultValues:{businessDetails:a}}),B=I("businessDetails"),j=async()=>{try{const e=(async({businessName:e,formBusinessDetails:t,businessType:r,siteLanguage:n})=>{try{const a=await(0,y.nr)({path:"gutenberg-templates/v1/description",method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce},data:{business_name:e,business_description:t,category:r,language:n}});if(a?.success)return a?.data?.data;console.error(a?.data?.data)}catch(e){Ps.oR.error((0,y.yI)(e))}})({businessName:s,businessType:o,formBusinessDetails:B,siteLanguage:p});return e}catch(e){console.log(e)}},D=(e,t)=>("name"===t&&(t=s),React.createElement("div",{className:"text-[1.75rem] font-semibold leading-9"},e[0],React.createElement(rf,{text:s}),e[1])),F={business:{question:D`What is ${"name"}? Please describe the business.`,description:"Please be as descriptive as you can. Share details such as services, products, goals, etc."},person:{question:D`Who is ${"name"}? Tell us more about the person.`,description:"Please be as descriptive as you can. Share details such as what they do, their expertise, offerings, etc."},"personal-website":{question:D`Who is ${"name"}? Tell us more about the person.`,description:"Please be as descriptive as you can. Share details such as what they do, their expertise, offerings, etc."},organisation:{question:D`What is ${"name"}? Please describe the organisation.`,description:"Please be as descriptive as you can. Share details such as services, programs, mission, vision, etc."},restaurant:{question:D`What is ${"name"}? Tell us more about the restaurant.`,description:"Please be as descriptive as you can. Share details such as a brief about the restaurant, specialty, menu, etc."},product:{question:D`What is ${"name"}? Share more details about the product.`,description:"Please be as descriptive as you can. Share details such as a brief about the product, features, some USPs, etc."},event:{question:D`Tell us more about ${"name"}.`,description:"Please be as descriptive as you can. Share details such as Event information date, venue, some highlights, etc."},"landing-page":{question:D`Share more details about ${"name"}.`,description:"Please be as descriptive as you can. Share details such as a brief about the product, features, some USPs, etc."},medical:{question:D`Tell us more about the ${"name"}.`,description:"Please be as descriptive as you can. Share details such as treatments, procedures, facilities, etc."},unknown:{question:D`Please describe ${"name"} in a few words.`}};(0,i.useEffect)((()=>{L("businessDetails")}),[L]),(0,i.useLayoutEffect)((()=>{W(B);const e=A.current;e&&(0,y.R7)(e)}),[B]);const{list:M,currentPage:z}=c||{},V=e=>{const t=e?z+1:z-1,r=z-1,n=[...M];M[r]!==B&&(n[r]=B),O("businessDetails",n[t-1]),x({...f,stepData:{...f.stepData,descriptionListStore:{...c,list:n,currentPage:t}}})},W=(e,t)=>{e?.trim()!==a?.trim()&&x({...f,stepData:{...f.stepData,businessDetails:B,...!t&&{keywords:[],selectedImages:[],imagesPreSelected:!1},templateList:[]}})};return React.createElement(af,{as:"form",action:"#",onSubmit:T((async t=>{let{businessDetails:r}=t;if(r.length<200){if(L("businessDetails"),r=await Pg.show({handleFetchSuggestion:j}),!r)return;O("businessDetails",r,{shouldValidate:!0})}else h(t.businessDetails),w(C),R.current!==t.businessDetails&&v(),await(async e=>{if(!k&&R.current!==e){S(!0);try{const t=await(0,y.nr)({path:"gutenberg-templates/v1/keywords",method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce},data:{business_name:s,business_description:e,category:o}});if(t.success){const e=JSON.parse(t.data?.data);b(Array.isArray(e)?e:Object.values(e))}if(!t.success)throw new Error(t?.data?.data)}catch(e){(0,ti.v)(e)}finally{S(!1)}}})(t.businessDetails),e()}))},React.createElement(df,{heading:F[o?.toLowerCase()]?.question??F.unknown.question,subHeading:(e=>F[e]?.description??(0,u.__)("The best way to describe anything is by answering a few WH questions. Who, What, Where, Why, When, etc.","astra-sites"))(o?.replaceAll(" ","-")?.toLowerCase())}),React.createElement("div",null,React.createElement("div",{className:(0,y.xW)("ml-0 w-full text-right text-sm font-medium leading-5 text-app-text mb-2 -mt-2")},(0,u.__)("Characters: ","ai-builder"),React.createElement("span",null,B.length)," / 1000"),React.createElement(Id,{ref:A,rows:8,className:"w-full",placeholder:"E.g. Mantra Minds is a yoga studio located in Chino Hills, California. The studio offers a variety of classes such as Hatha yoga, Vinyasa flow, and Restorative yoga. The studio is led by Jane, an experienced and certified yoga instructor with over 10 years of teaching expertise. The welcoming atmosphere and personalized Jane make it a favorite among yoga enthusiasts in the area.",name:"businessDetails",register:P,maxLength:1e3,validations:{required:"Details are required",maxLength:1e3},error:N.businessDetails,disabled:_||d}),React.createElement("div",{className:"flex gap-3 justify-between items-center mt-3"},React.createElement("button",{type:"button",onClick:async e=>{if(e?.preventDefault(),e?.stopPropagation(),_)return;E(!0);const t=[B];try{const e=m?.find((e=>e.code===(p||"en"))),r=await(0,y.nr)({path:"gutenberg-templates/v1/description",method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce},data:{business_name:s,business_description:B,category:o,language_name:e?.name}});if(r.success){const e=r.data?.data||[];void 0!==e&&(t.push(e),(e=>{if(!Array.isArray(e))return;const t=e.filter((e=>0!==e?.trim()?.length&&!M?.includes(e))),r=[...M,...t];x({...f,stepData:{...f.stepData,descriptionListStore:{list:r,currentPage:r.length},businessDetails:B,templateList:[]}})})(t),O("businessDetails",e,{shouldValidate:!0}))}r.success||(0,Ps.oR)((0,Ts.A)({title:(0,u.__)("Description Generation Error!","astra-sites"),message:(0,u.__)("Failed to generate business description using AI. Please retry or enter details manually.","astra-sites")}),Ts.A.getOptions({type:"error"}))}catch(e){}finally{E(!1)}},className:"flex items-center gap-2 w-fit text-accent-st bg-transparent border-0 cursor-pointer",disabled:d},_?React.createElement(Vi.A,{className:"text-accent-ai"}):React.createElement(React.Fragment,null,React.createElement(ei.AW,{className:"w-5 h-5 transition duration-150 ease-in-out"}),React.createElement("span",null,I("businessDetails")?.length?"Improve Using AI":"Write Using AI"))),z>0&&M?.length>1&&React.createElement("div",{className:"flex gap-2 items-center justify-end w-[100px] cursor-default text-zip-body-text"},React.createElement("div",{className:"w-5"},1!==z?React.createElement(Yi,{className:"w-5 cursor-pointer text-zip-body-text flex justify-center",onClick:()=>V(!1),"data-disabled":d}):React.createElement(Yi,{className:"w-5 text-border-tertiary flex justify-center cursor-not-allowed","data-disabled":"true"})),React.createElement("div",{className:"zw-sm-semibold cursor-default self-stretch flex items-end"},z," /"," ",M?.length),React.createElement("div",{className:"w-5"},z!==M?.length?React.createElement(Xi,{className:"w-5 cursor-pointer text-zip-body-text flex justify-center",onClick:()=>V(!0),"data-disabled":d}):React.createElement(Xi,{className:"w-5 text-border-tertiary flex justify-center","data-disabled":"true"}))))),React.createElement(Qa,null),React.createElement(Od,{onClickPrevious:n,loading:k}))}));function Ng(){return Ng=Object.assign?Object.assign.bind():function(e){for(var t=1;t{};handleClosePopUop=e=>{e?.preventDefault(),e?.stopPropagation(),this.props.toggleOnboardingAIStep()};render(){return this.state.hasError?React.createElement("div",{className:"h-screen w-full bg-st-background-secondary grid grid-cols-1 grid-rows-[80px_1fr]"},React.createElement("div",{className:"grid grid-cols-1 auto-rows-min gap-4 w-full max-w-[590px] my-32 mx-auto text-center px-5 lg:px-0"},React.createElement("div",{className:"space-y-3"},React.createElement(ei.Rk,{className:"text-center space-y-3 w-6 h-6 mx-auto "}),React.createElement("h5",null,(0,u.__)("Oops , Something went wrong!","ast-block-template")),React.createElement("p",{className:"text-zip-body-text",dangerouslySetInnerHTML:{__html:(0,u.nv)((0,u.__)('There was a problem processing the request. Please try again. If this error continues please contact our support team .',"astra-sites"),"https://wpastra.com/contact")}})),React.createElement("div",{className:"flex justify-center space-x-4"},React.createElement(ii.A,{type:"button",variant:"primary",className:"mt-4 w-fit mx-auto",isSmall:!0,onClick:this.handleClosePopUop},(0,u.__)("Back to Main Screen","ast-block-template"))))):this.props.children}}const Og=e=>{const{toggleOnboardingAIStep:t}=(0,r.A)(g.U);return React.createElement(Ig,Ng({},e,{toggleOnboardingAIStep:t}))};function Lg({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}))}const Bg=i.forwardRef(Lg);function jg({title:e,titleId:t,...r},n){return i.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","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Dg=i.forwardRef(jg);function Fg(){const e=(0,i.useRef)(!1);return(0,_d.E)((()=>(e.current=!0,()=>{e.current=!1})),[]),e}var Mg=o(6719);class zg extends i.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Vg({children:e,isPresent:t}){const r=(0,i.useId)(),n=(0,i.useRef)(null),a=(0,i.useRef)({width:0,height:0,top:0,left:0});return(0,i.useInsertionEffect)((()=>{const{width:e,height:i,top:o,left:s}=a.current;if(t||!n.current||!e||!i)return;n.current.dataset.motionPopId=r;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`\n [data-motion-pop-id="${r}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${i}px !important;\n top: ${o}px !important;\n left: ${s}px !important;\n }\n `),()=>{document.head.removeChild(l)}}),[t]),i.createElement(zg,{isPresent:t,childRef:n,sizeRef:a},i.cloneElement(e,{ref:n}))}const Wg=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:o,mode:s})=>{const l=(0,xd.M)(Ug),c=(0,i.useId)(),u=(0,i.useMemo)((()=>({id:c,initial:t,isPresent:r,custom:a,onExitComplete:e=>{l.set(e,!0);for(const e of l.values())if(!e)return;n&&n()},register:e=>(l.set(e,!1),()=>l.delete(e))})),o?void 0:[r]);return(0,i.useMemo)((()=>{l.forEach(((e,t)=>l.set(t,!1)))}),[r]),i.useEffect((()=>{!r&&!l.size&&n&&n()}),[r]),"popLayout"===s&&(e=i.createElement(Vg,{isPresent:r},e)),i.createElement(Mg.t.Provider,{value:u},e)};function Ug(){return new Map}var Hg=o(9473),$g=o(5238);const Zg=e=>e.key||"",Gg=({children:e,custom:t,initial:r=!0,onExitComplete:n,exitBeforeEnter:a,presenceAffectsLayout:o=!0,mode:s="sync"})=>{(0,$g.V)(!a,"Replace exitBeforeEnter with mode='wait'");const l=(0,i.useContext)(Hg.L).forceRender||function(){const e=Fg(),[t,r]=(0,i.useState)(0),n=(0,i.useCallback)((()=>{e.current&&r(t+1)}),[t]);return[(0,i.useCallback)((()=>Sd.Gt.postRender(n)),[n]),t]}()[0],c=Fg(),u=function(e){const t=[];return i.Children.forEach(e,(e=>{(0,i.isValidElement)(e)&&t.push(e)})),t}(e);let d=u;const p=(0,i.useRef)(new Map).current,m=(0,i.useRef)(d),f=(0,i.useRef)(new Map).current,g=(0,i.useRef)(!0);var h;if((0,_d.E)((()=>{g.current=!1,function(e,t){e.forEach((e=>{const r=Zg(e);t.set(r,e)}))}(u,f),m.current=d})),h=()=>{g.current=!0,f.clear(),p.clear()},(0,i.useEffect)((()=>()=>h()),[]),g.current)return i.createElement(i.Fragment,null,d.map((e=>i.createElement(Wg,{key:Zg(e),isPresent:!0,initial:!!r&&void 0,presenceAffectsLayout:o,mode:s},e))));d=[...d];const y=m.current.map(Zg),b=u.map(Zg),v=y.length;for(let e=0;e{if(-1!==b.indexOf(r))return;const a=f.get(r);if(!a)return;const g=y.indexOf(r);let h=e;if(!h){const e=()=>{p.delete(r);const e=Array.from(f.keys()).filter((e=>!b.includes(e)));if(e.forEach((e=>f.delete(e))),m.current=u.filter((t=>{const n=Zg(t);return n===r||e.includes(n)})),!p.size){if(!1===c.current)return;l(),n&&n()}};h=i.createElement(Wg,{key:Zg(a),isPresent:!1,onExitComplete:e,custom:t,presenceAffectsLayout:o,mode:s},a),p.set(r,h)}d.splice(g,0,h)})),d=d.map((e=>{const t=e.key;return p.has(t)?e:i.createElement(Wg,{key:Zg(e),isPresent:!0,presenceAffectsLayout:o,mode:s},e)})),i.createElement(i.Fragment,null,p.size?d:d.map((e=>(0,i.cloneElement)(e))))};var qg=o(5556),Yg=o.n(qg),Kg=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Xg(e,t){var r=function(e){var t=e.name;if(t&&-1!==t.lastIndexOf(".")&&!e.type){var r=t.split(".").pop().toLowerCase(),n=Kg.get(r);n&&Object.defineProperty(e,"type",{value:n,writable:!1,configurable:!1,enumerable:!0})}return e}(e);if("string"!=typeof r.path){var n=e.webkitRelativePath;Object.defineProperty(r,"path",{value:"string"==typeof t?t:"string"==typeof n&&n.length>0?n:e.name,writable:!1,configurable:!1,enumerable:!0})}return r}var Jg=[".DS_Store","Thumbs.db"];function Qg(e){return"object"==typeof e&&null!==e}function eh(e){return ah(e.target.files).map((function(e){return Xg(e)}))}function th(e){return(0,Tc.sH)(this,void 0,void 0,(function(){return(0,Tc.YH)(this,(function(t){switch(t.label){case 0:return[4,Promise.all(e.map((function(e){return e.getFile()})))];case 1:return[2,t.sent().map((function(e){return Xg(e)}))]}}))}))}function rh(e,t){return(0,Tc.sH)(this,void 0,void 0,(function(){var r;return(0,Tc.YH)(this,(function(n){switch(n.label){case 0:return e.items?(r=ah(e.items).filter((function(e){return"file"===e.kind})),"drop"!==t?[2,r]:[4,Promise.all(r.map(ih))]):[3,2];case 1:return[2,nh(oh(n.sent()))];case 2:return[2,nh(ah(e.files).map((function(e){return Xg(e)})))]}}))}))}function nh(e){return e.filter((function(e){return-1===Jg.indexOf(e.name)}))}function ah(e){if(null===e)return[];for(var t=[],r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);rr)return[!1,wh(r)];if(e.sizer)return[!1,wh(r)]}return[!0,null]}function Sh(e){return null!=e}function Ch(e){return"function"==typeof e.isPropagationStopped?e.isPropagationStopped():void 0!==e.cancelBubble&&e.cancelBubble}function Rh(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,(function(e){return"Files"===e||"application/x-moz-file"===e})):!!e.target&&!!e.target.files}function Ah(e){e.preventDefault()}function Ph(){for(var e=arguments.length,t=new Array(e),r=0;r1?r-1:0),a=1;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var Uh=(0,i.forwardRef)((function(e,t){var r=e.children,n=Zh(Wh(e,Ih)),a=n.open,o=Wh(n,Oh);return(0,i.useImperativeHandle)(t,(function(){return{open:a}}),[a]),c().createElement(i.Fragment,null,r(zh(zh({},o),{},{open:a})))}));Uh.displayName="Dropzone";var Hh={disabled:!1,getFilesFromEvent:function(e){return(0,Tc.sH)(this,void 0,void 0,(function(){return(0,Tc.YH)(this,(function(t){return Qg(e)&&Qg(e.dataTransfer)?[2,rh(e.dataTransfer,e.type)]:Qg(r=e)&&Qg(r.target)?[2,eh(e)]:Array.isArray(e)&&e.every((function(e){return"getFile"in e&&"function"==typeof e.getFile}))?[2,th(e)]:[2,[]];var r}))}))},maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Uh.defaultProps=Hh,Uh.propTypes={children:Yg().func,accept:Yg().objectOf(Yg().arrayOf(Yg().string)),multiple:Yg().bool,preventDropOnDocument:Yg().bool,noClick:Yg().bool,noKeyboard:Yg().bool,noDrag:Yg().bool,noDragEventsBubbling:Yg().bool,minSize:Yg().number,maxSize:Yg().number,maxFiles:Yg().number,disabled:Yg().bool,getFilesFromEvent:Yg().func,onFileDialogCancel:Yg().func,onFileDialogOpen:Yg().func,useFsAccessApi:Yg().bool,autoFocus:Yg().bool,onDragEnter:Yg().func,onDragLeave:Yg().func,onDragOver:Yg().func,onDrop:Yg().func,onDropAccepted:Yg().func,onDropRejected:Yg().func,onError:Yg().func,validator:Yg().func};var $h={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Zh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=zh(zh({},Hh),e),r=t.accept,n=t.disabled,a=t.getFilesFromEvent,o=t.maxSize,s=t.minSize,l=t.multiple,c=t.maxFiles,u=t.onDragEnter,d=t.onDragLeave,p=t.onDragOver,m=t.onDrop,f=t.onDropAccepted,g=t.onDropRejected,h=t.onFileDialogCancel,y=t.onFileDialogOpen,b=t.useFsAccessApi,v=t.autoFocus,w=t.preventDropOnDocument,x=t.noClick,_=t.noKeyboard,E=t.noDrag,k=t.noDragEventsBubbling,S=t.onError,C=t.validator,R=(0,i.useMemo)((function(){return function(e){if(Sh(e))return Object.entries(e).reduce((function(e,t){var r=hh(t,2),n=r[0],a=r[1];return[].concat(ph(e),[n],ph(a))}),[]).filter((function(e){return Th(e)||Nh(e)})).join(",")}(r)}),[r]),A=(0,i.useMemo)((function(){return function(e){return Sh(e)?[{description:"Files",accept:Object.entries(e).filter((function(e){var t=hh(e,2),r=t[0],n=t[1],a=!0;return Th(r)||(console.warn('Skipped "'.concat(r,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),a=!1),Array.isArray(n)&&n.every(Nh)||(console.warn('Skipped "'.concat(r,'" because an invalid file extension was provided.')),a=!1),a})).reduce((function(e,t){var r=hh(t,2),n=r[0],a=r[1];return fh(fh({},e),{},gh({},n,a))}),{})}]:e}(r)}),[r]),P=(0,i.useMemo)((function(){return"function"==typeof y?y:qh}),[y]),T=(0,i.useMemo)((function(){return"function"==typeof h?h:qh}),[h]),N=(0,i.useRef)(null),I=(0,i.useRef)(null),O=jh((0,i.useReducer)(Gh,$h),2),L=O[0],B=O[1],j=L.isFocused,D=L.isFileDialogActive,F=(0,i.useRef)("undefined"!=typeof window&&window.isSecureContext&&b&&"showOpenFilePicker"in window),M=function(){!F.current&&D&&setTimeout((function(){I.current&&(I.current.files.length||(B({type:"closeDialog"}),T()))}),300)};(0,i.useEffect)((function(){return window.addEventListener("focus",M,!1),function(){window.removeEventListener("focus",M,!1)}}),[I,D,T,F]);var z=(0,i.useRef)([]),V=function(e){N.current&&N.current.contains(e.target)||(e.preventDefault(),z.current=[])};(0,i.useEffect)((function(){return w&&(document.addEventListener("dragover",Ah,!1),document.addEventListener("drop",V,!1)),function(){w&&(document.removeEventListener("dragover",Ah),document.removeEventListener("drop",V))}}),[N,w]),(0,i.useEffect)((function(){return!n&&v&&N.current&&N.current.focus(),function(){}}),[N,v,n]);var W=(0,i.useCallback)((function(e){S?S(e):console.error(e)}),[S]),U=(0,i.useCallback)((function(e){var t;e.preventDefault(),e.persist(),re(e),z.current=[].concat(function(e){if(Array.isArray(e))return Fh(e)}(t=z.current)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Dh(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e.target]),Rh(e)&&Promise.resolve(a(e)).then((function(t){if(!Ch(e)||k){var r=t.length,n=r>0&&function(e){var t=e.files,r=e.accept,n=e.minSize,a=e.maxSize,i=e.multiple,o=e.maxFiles,s=e.validator;return!(!i&&t.length>1||i&&o>=1&&t.length>o)&&t.every((function(e){var t=hh(Eh(e,r),1)[0],i=hh(kh(e,n,a),1)[0],o=s?s(e):null;return t&&i&&!o}))}({files:t,accept:R,minSize:s,maxSize:o,multiple:l,maxFiles:c,validator:C});B({isDragAccept:n,isDragReject:r>0&&!n,isDragActive:!0,type:"setDraggedFiles"}),u&&u(e)}})).catch((function(e){return W(e)}))}),[a,u,W,k,R,s,o,l,c,C]),H=(0,i.useCallback)((function(e){e.preventDefault(),e.persist(),re(e);var t=Rh(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect="copy"}catch(e){}return t&&p&&p(e),!1}),[p,k]),$=(0,i.useCallback)((function(e){e.preventDefault(),e.persist(),re(e);var t=z.current.filter((function(e){return N.current&&N.current.contains(e)})),r=t.indexOf(e.target);-1!==r&&t.splice(r,1),z.current=t,t.length>0||(B({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Rh(e)&&d&&d(e))}),[N,d,k]),Z=(0,i.useCallback)((function(e,t){var r=[],n=[];e.forEach((function(e){var t=jh(Eh(e,R),2),a=t[0],i=t[1],l=jh(kh(e,s,o),2),c=l[0],u=l[1],d=C?C(e):null;if(a&&c&&!d)r.push(e);else{var p=[i,u];d&&(p=p.concat(d)),n.push({file:e,errors:p.filter((function(e){return e}))})}})),(!l&&r.length>1||l&&c>=1&&r.length>c)&&(r.forEach((function(e){n.push({file:e,errors:[_h]})})),r.splice(0)),B({acceptedFiles:r,fileRejections:n,type:"setFiles"}),m&&m(r,n,t),n.length>0&&g&&g(n,t),r.length>0&&f&&f(r,t)}),[B,l,R,s,o,c,m,f,g,C]),G=(0,i.useCallback)((function(e){e.preventDefault(),e.persist(),re(e),z.current=[],Rh(e)&&Promise.resolve(a(e)).then((function(t){Ch(e)&&!k||Z(t,e)})).catch((function(e){return W(e)})),B({type:"reset"})}),[a,Z,W,k]),q=(0,i.useCallback)((function(){if(F.current){B({type:"openDialog"}),P();var e={multiple:l,types:A};window.showOpenFilePicker(e).then((function(e){return a(e)})).then((function(e){Z(e,null),B({type:"closeDialog"})})).catch((function(e){!function(e){return e instanceof DOMException&&("AbortError"===e.name||e.code===e.ABORT_ERR)}(e)?function(e){return e instanceof DOMException&&("SecurityError"===e.name||e.code===e.SECURITY_ERR)}(e)?(F.current=!1,I.current?(I.current.value=null,I.current.click()):W(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):W(e):(T(e),B({type:"closeDialog"}))}))}else I.current&&(B({type:"openDialog"}),P(),I.current.value=null,I.current.click())}),[B,P,T,b,Z,W,A,l]),Y=(0,i.useCallback)((function(e){N.current&&N.current.isEqualNode(e.target)&&(" "!==e.key&&"Enter"!==e.key&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),q()))}),[N,q]),K=(0,i.useCallback)((function(){B({type:"focus"})}),[]),X=(0,i.useCallback)((function(){B({type:"blur"})}),[]),J=(0,i.useCallback)((function(){x||(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator.userAgent;return function(e){return-1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")}(e)||function(e){return-1!==e.indexOf("Edge/")}(e)}()?setTimeout(q,0):q())}),[x,q]),Q=function(e){return n?null:e},ee=function(e){return _?null:Q(e)},te=function(e){return E?null:Q(e)},re=function(e){k&&e.stopPropagation()},ne=(0,i.useMemo)((function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.refKey,r=void 0===t?"ref":t,a=e.role,i=e.onKeyDown,o=e.onFocus,s=e.onBlur,l=e.onClick,c=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,p=e.onDrop,m=Wh(e,Lh);return zh(zh(Vh({onKeyDown:ee(Ph(i,Y)),onFocus:ee(Ph(o,K)),onBlur:ee(Ph(s,X)),onClick:Q(Ph(l,J)),onDragEnter:te(Ph(c,U)),onDragOver:te(Ph(u,H)),onDragLeave:te(Ph(d,$)),onDrop:te(Ph(p,G)),role:"string"==typeof a&&""!==a?a:"presentation"},r,N),n||_?{}:{tabIndex:0}),m)}}),[N,Y,K,X,J,U,H,$,G,_,E,n]),ae=(0,i.useCallback)((function(e){e.stopPropagation()}),[]),ie=(0,i.useMemo)((function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.refKey,r=void 0===t?"ref":t,n=e.onChange,a=e.onClick,i=Wh(e,Bh);return zh(zh({},Vh({accept:R,multiple:l,type:"file",style:{display:"none"},onChange:Q(Ph(n,G)),onClick:Q(Ph(a,ae)),tabIndex:-1},r,I)),i)}}),[I,r,l,G,n]);return zh(zh({},L),{},{isFocused:j&&!n,getRootProps:ne,getInputProps:ie,rootRef:N,inputRef:I,open:Q(q)})}function Gh(e,t){switch(t.type){case"focus":return zh(zh({},e),{},{isFocused:!0});case"blur":return zh(zh({},e),{},{isFocused:!1});case"openDialog":return zh(zh({},$h),{},{isFileDialogActive:!0});case"closeDialog":return zh(zh({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return zh(zh({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return zh(zh({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return zh({},$h);default:return e}}function qh(){}var Yh=o(5878);const{useState:Kh,useEffect:Xh,useRef:Jh}=wp.element,Qh=({className:e,onClick:t,children:r})=>{const n=e=>{"function"==typeof t&&t(e)};return React.createElement("div",{onClick:n,className:(0,y.xW)(e),role:"button",tabIndex:"0",onKeyDown:e=>"Enter"===e.key?n:null},r)};function ey(){return ey=Object.assign?Object.assign.bind():function(e){for(var t=1;t{return React.createElement(Cd.P.div,ey({key:e.id,initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},exit:{opacity:0}},a),React.createElement(Qh,{key:e?.id,className:(0,y.xW)("flex relative overflow-hidden rounded-lg border-2 border-solid border-transparent",n===ty&&"cursor-pointer",n===ty&&t&&"border-image-selection"),onClick:(i=e,e=>{e?.preventDefault(),e?.stopPropagation(),n===ry&&t||r(i)})},React.createElement("img",{className:"inline-block h-fit w-full relative aspect-[12/8] bg-background-secondary",src:e.optimized_url,alt:e?.description??"",loading:"lazy",onLoad:e=>{e.target.classList.remove("aspect-[12/8]")}}),(()=>{return t?n===ry?React.createElement("button",{onClick:(a=e,e=>{e?.preventDefault(),e?.stopPropagation(),r(a)}),className:"flex items-center justify-center absolute top-2 right-2 p-1 bg-white rounded-full border border-solid border-zip-dark-theme-border cursor-pointer focus:outline-none focus-visible:outline-none"},React.createElement(f,{className:"w-4 h-4 text-zip-app-heading"})):React.createElement("div",{className:"inline-flex absolute top-2 right-2 p-1 bg-image-selection rounded-full pointer-events-none"},React.createElement(_u,{className:"w-4 h-4 text-white"})):null;var a})()),e?.author_name&&React.createElement("a",{href:e?.author_url,target:"_blank",className:"block w-11/12 mt-1 mx-1 text-[0.625rem] font-normal leading-3 !text-secondary-text no-underline",rel:"noreferrer"},"by ",e.author_name," via"," ",e.engine?e.engine.charAt(0).toUpperCase()+e.engine.slice(1):"Default"));var i}),((e,t)=>String(e.image.id)===String(t.image.id)&&e.isSelected===t.isSelected&&e.onClick===t.onClick&&e.variant===t.variant));function ay(){return ay=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const[i,o]=iy(0),[s,l]=iy(!1),[c,u]=iy(!1),d=oy(null);sy((()=>{if(!d.current)return;const{scrollWidth:e,clientWidth:t}=d.current;l(i>0),u(i()=>{"function"==typeof n&&n(e)},m=(e,t)=>{e&&e.scrollTo({left:t,behavior:"smooth"})};return React.createElement("div",ay({className:(0,y.xW)("relative flex flex-row items-start",e)},a),s&&React.createElement("button",{className:"absolute inset-y-0 left-0 px-1.5 py-0.5 cursor-pointer text-app-inactive-icon hover:text-app-active-icon bg-gradient-to-r from-70% from-white to-transparent transition duration-150 ease-in-out border-none bg-transparent",onClick:()=>{m(d.current,0)}},React.createElement(Yi,{className:"w-6 h-6"})),React.createElement("div",{className:"flex flex-row flex-nowrap gap-2 overflow-x-auto hide-scrollbar",ref:d,onScroll:e=>{const{scrollLeft:t,scrollWidth:r,clientWidth:n}=e.target;o(t),l(t>0),u(tReact.createElement("div",{key:r,className:(0,y.xW)("px-3 py-1 text-sm font-normal leading-5 rounded-full shadow-sm cursor-pointer text-app-text whitespace-nowrap border border-solid",t),onClick:p(e),role:"button",tabIndex:"0",onKeyDown:t=>"Enter"===t.key?p(e):null},e)))),c&&React.createElement("button",{className:"absolute inset-y-0 right-0 px-1.5 py-0.5 cursor-pointer text-app-inactive-icon hover:text-app-active-icon bg-gradient-to-l from-70% from-white to-transparent transition duration-150 ease-in-out border-none bg-transparent",onClick:()=>{const e=d.current;m(e,e.scrollWidth)}},React.createElement(Xi,{className:"w-6 h-6"})))},cy=[],uy=()=>{const{wp:e}=window;return e.media.view.MediaFrame.Select.extend({featuredImageToolbar(t){this.createSelectToolbar(t,{text:e.media.view.l10n.setFeaturedImage,state:this.options.state})},editState(){const t=this.state("featured-image").get("selection"),r=new e.media.view.EditImage({model:t.single(),controller:this}).render();this.content.set(r),r.loadEditor()},createStates:function(){this.on("toolbar:create:featured-image",this.featuredImageToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new e.media.controller.FeaturedImage,new e.media.controller.EditImage({model:this.options.editImage})])}})},dy=()=>{const{wp:e}=window;return e.media.view.MediaFrame.Post.extend({galleryToolbar(){const t=this.state().get("editing");this.toolbar.set(new e.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?e.media.view.l10n.updateGallery:e.media.view.l10n.insertGallery,priority:80,requires:{library:!0},click(){const e=this.controller,t=e.state();e.close(),t.trigger("update",t.get("library")),e.setState(e.options.state),e.reset()}}}}))},editState(){const t=this.state("gallery").get("selection"),r=new e.media.view.EditImage({model:t.single(),controller:this}).render();this.content.set(r),r.loadEditor()},createStates:function(){this.on("toolbar:create:main-gallery",this.galleryToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new e.media.controller.Library({id:"gallery",title:e.media.view.l10n.createGalleryTitle,priority:40,toolbar:"main-gallery",filterable:"uploaded",multiple:"add",editable:!1,library:e.media.query({type:"image",...this.options.library})}),new e.media.controller.EditImage({model:this.options.editImage}),new e.media.controller.GalleryEdit({library:this.options.selection,editing:this.options.editing,menu:"gallery",displaySettings:!1,multiple:!0}),new e.media.controller.GalleryAdd])}})},py=e=>["sizes","mime","type","subtype","id","url","alt","link","caption"].reduce(((t,r)=>(e?.hasOwnProperty(r)&&(t[r]=e[r]),t)),{}),my=e=>{const{wp:t}=window;return t.media.query({order:"ASC",orderby:"post__in",post__in:e,posts_per_page:-1,query:!0,type:"image"})};class fy extends i.Component{constructor(){super(...arguments),this.openModal=this.openModal.bind(this),this.onOpen=this.onOpen.bind(this),this.onSelect=this.onSelect.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onClose=this.onClose.bind(this)}initializeListeners(){this.frame.on("select",this.onSelect),this.frame.on("update",this.onUpdate),this.frame.on("open",this.onOpen),this.frame.on("close",this.onClose)}buildAndSetGalleryFrame(){const{addToGallery:e=!1,allowedTypes:t,multiple:r=!1,value:n=cy}=this.props;if(n===this.lastGalleryValue)return;const{wp:a}=window;let i;this.lastGalleryValue=n,this.frame&&this.frame.remove(),i=e?"gallery-library":n&&n.length?"gallery-edit":"gallery",this.GalleryDetailsMediaFrame||(this.GalleryDetailsMediaFrame=dy());const o=my(n),s=new a.media.model.Selection(o.models,{props:o.props.toJSON(),multiple:r});this.frame=new this.GalleryDetailsMediaFrame({mimeType:t,state:i,multiple:r,selection:s,editing:!(!n||!n.length)}),a.media.frame=this.frame,this.initializeListeners()}buildAndSetFeatureImageFrame(){const{wp:e}=window,{value:t,multiple:r,allowedTypes:n}=this.props,a=uy(),i=my(t),o=new e.media.model.Selection(i.models,{props:i.props.toJSON()});this.frame=new a({mimeType:n,state:"featured-image",multiple:r,selection:o,editing:t}),e.media.frame=this.frame,e.media.view.settings.post={...e.media.view.settings.post,featuredImageId:t||-1}}componentWillUnmount(){this.frame?.remove()}onUpdate(e){const{onSelect:t,multiple:r=!1}=this.props,n=this.frame.state(),a=e||n.get("selection");a&&a.models.length&&t(r?a.models.map((e=>py(e.toJSON()))):py(a.models[0].toJSON()))}onSelect(){const{onSelect:e,multiple:t=!1}=this.props,r=this.frame.state().get("selection").toJSON();e(t?r:r[0])}onOpen(){const{wp:e}=window,{value:t}=this.props;if(this.updateCollection(),this.props.mode&&this.frame.content.mode(this.props.mode),!(Array.isArray(t)?t?.length:t))return;const r=this.props.gallery,n=this.frame.state().get("selection"),a=Array.isArray(t)?t:[t];r||a.forEach((t=>{n.add(e.media.attachment(t))}));const i=my(a);i.more().done((function(){r&&i?.models?.length&&n.add(i.models)}))}onClose(){const{onClose:e}=this.props;e&&e()}updateCollection(){const e=this.frame.content.get();if(e&&e.collection){const t=e.collection;t.toArray().forEach((e=>e.trigger("destroy",e))),t.mirroring._hasMore=!0,t.more()}}openModal(){const{allowedTypes:e,gallery:t=!1,unstableFeaturedImageFlow:r=!1,modalClass:n,multiple:a=!1,title:i=(0,u.__)("Select or Upload Media")}=this.props,{wp:o}=window;if(t)this.buildAndSetGalleryFrame();else{const t={title:i,multiple:a};e&&(t.library={type:e}),this.frame=o.media(t)}n&&this.frame.$el.addClass(n),r&&this.buildAndSetFeatureImageFrame(),this.initializeListeners(),this.frame.open()}render(){return this.props.render({open:this.openModal})}}const gy=fy,hy=(e,t)=>{let r,n,a=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),a=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:a})};function yy(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((e=>e.split("="))).map((e=>e.map(decodeURIComponent))).sort(((e,t)=>e[0].localeCompare(t[0]))).map((e=>e.map(encodeURIComponent))).map((e=>e.join("="))).join("&"):n}function by(e){try{return decodeURIComponent(e)}catch(t){return e}}function vy(e){return(function(e){let t;try{t=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(t)return t}(e)||"").replace(/\+/g,"%20").split("&").reduce(((e,t)=>{const[r,n=""]=t.split("=").filter(Boolean).map(by);return r&&function(e,t,r){const n=t.length,a=n-1;for(let i=0;i({...r,url:t&&xy(t,n),path:e&&xy(e,n)}),ky=e=>e.json?e.json():Promise.reject(e),Sy=e=>{const{next:t}=(e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}})(e.headers.get("link"));return t},Cy=async(e,t)=>{if(!1===e.parse)return t(e);if(!(e=>{const t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r})(e))return t(e);const r=await zy({...Ey(e,{per_page:100}),parse:!1}),n=await ky(r);if(!Array.isArray(n))return n;let a=Sy(r);if(!a)return n;let i=[].concat(n);for(;a;){const t=await zy({...e,path:void 0,url:a,parse:!1}),r=await ky(t);i=i.concat(r),a=Sy(t)}return i},Ry=new Set(["PATCH","PUT","DELETE"]),Ay="GET";function Py(e,t){return vy(e)[t]}function Ty(e,t){return void 0!==Py(e,t)}const Ny=(e,t=!0)=>Promise.resolve(((e,t=!0)=>t?204===e.status?null:e.json?e.json():Promise.reject(e):e)(e,t)).catch((e=>Iy(e,t)));function Iy(e,t=!0){if(!t)throw e;return(e=>{const t={code:"invalid_json",message:(0,u.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((()=>{throw t}))})(e).then((e=>{const t={code:"unknown_error",message:(0,u.__)("An unknown error occurred.")};throw e||t}))}function Oy(e,...t){const r=e.indexOf("?");if(-1===r)return e;const n=vy(e),a=e.substr(0,r);t.forEach((e=>delete n[e]));const i=wy(n);return i?a+"?"+i:a}const Ly={Accept:"application/json, */*;q=0.1"},By={credentials:"include"},jy=[(e,t)=>("string"!=typeof e.url||Ty(e.url,"_locale")||(e.url=xy(e.url,{_locale:"user"})),"string"!=typeof e.path||Ty(e.path,"_locale")||(e.path=xy(e.path,{_locale:"user"})),t(e)),hy,(e,t)=>{const{method:r=Ay}=e;return Ry.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},Cy],Dy=e=>{if(e.status>=200&&e.status<300)return e;throw e};let Fy=e=>{const{url:t,path:r,data:n,parse:a=!0,...i}=e;let{body:o,headers:s}=e;return s={...Ly,...s},n&&(o=JSON.stringify(n),s["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,{...By,...i,body:o,headers:s}).then((e=>Promise.resolve(e).then(Dy).catch((e=>Iy(e,a))).then((e=>Ny(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,u.__)("You are probably offline.")}}))};function My(e){return jy.reduceRight(((e,t)=>r=>t(r,e)),Fy)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(My.nonceEndpoint).then(Dy).then((e=>e.text())).then((t=>(My.nonceMiddleware.nonce=t,My(e))))))}My.use=function(e){jy.unshift(e)},My.setFetchHandler=function(e){Fy=e},My.createNonceMiddleware=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const a in n)if("x-wp-nonce"===a.toLowerCase()&&n[a]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t},My.createPreloadingMiddleware=function(e){const t=Object.fromEntries(Object.entries(e).map((([e,t])=>[yy(e),t])));return(e,r)=>{const{parse:n=!0}=e;let a=e.path;if(!a&&e.url){const{rest_route:t,...r}=vy(e.url);"string"==typeof t&&(a=xy(t,r))}if("string"!=typeof a)return r(e);const i=e.method||"GET",o=yy(a);if("GET"===i&&t[o]){const e=t[o];return delete t[o],_y(e,!!n)}if("OPTIONS"===i&&t[i]&&t[i][o]){const e=t[i][o];return delete t[i][o],_y(e,!!n)}return r(e)}},My.createRootURLMiddleware=e=>(t,r)=>hy(t,(t=>{let n,a=t.url,i=t.path;return"string"==typeof i&&(n=e,-1!==e.indexOf("?")&&(i=i.replace("?","&")),i=i.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(i=i.replace("?","&")),a=n+i),r({...t,url:a})})),My.fetchAllMiddleware=Cy,My.mediaUploadMiddleware=(e,t)=>{if(!function(e){const t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);let r=0;const n=e=>(r++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((()=>r<5?n(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject()))));return t({...e,parse:!1}).catch((t=>{const r=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&r?n(r).catch((()=>!1!==e.parse?Promise.reject({code:"post_process",message:(0,u.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t))):Iy(t,e.parse)})).then((t=>Ny(t,e.parse)))},My.createThemePreviewMiddleware=e=>(t,r)=>{if("string"==typeof t.url){const r=Py(t.url,"wp_theme_preview");void 0===r?t.url=xy(t.url,{wp_theme_preview:e}):""===r&&(t.url=Oy(t.url,"wp_theme_preview"))}if("string"==typeof t.path){const r=Py(t.path,"wp_theme_preview");void 0===r?t.path=xy(t.path,{wp_theme_preview:e}):""===r&&(t.path=Oy(t.path,"wp_theme_preview"))}return r(t)};const zy=My,Vy=(0,i.memo)((({render:e})=>{const{setWebsiteImagesAIStep:n}=(0,r.A)(g.U),{stepsData:{selectedImages:a=[]}}=(0,t.A)((e=>{const{getAIStepData:t}=e(g.U);return{stepsData:t()}}),[]);return React.createElement(React.Fragment,null,React.createElement(gy,{mode:"upload",allowedTypes:["image"],render:"function"==typeof e?e:({open:e})=>React.createElement("button",{type:"button",onClick:e,className:(0,y.xW)("flex flex-col items-center justify-center gap-3 py-[50px] px-[78px] aspect-video bg-zip-app-light-bg border border-solid border-border-tertiary rounded cursor-pointer")},React.createElement(Bg,{className:"w-6 h-6 text-accent-st"}),React.createElement("span",{className:"min-w-fit break-keep text-nowrap whitespace-nowrap text-base font-semibold text-zip-body-text"},(0,u.__)("Upload images","astra-sites"))),onSelect:e=>{const t=e.map((e=>(0,y.Bh)(e?.url)?e:(Ps.oR.error((0,y.yI)({message:(0,u.nv)((0,u.__)("Invalid file name! Please avoid special characters. (%s)","astra-sites"),e?.filename)}),y.GU),null))).filter((e=>null!==e)).map((e=>({id:String(e.id),url:e?.originalImageURL??e.url,optimized_url:e?.sizes?.large?.url??e.url,engine:"",description:e?.description??"",orientation:e?.orientation??(e?.width>e?.height?"landscape":"portrait"),author_name:e?.author_name??"",author_url:""}))).filter((e=>-1===a?.findIndex((t=>String(t.id)===String(e.id)))));n([...a,...t])},multiple:!0}))})),Wy=({open:e=!1,setOpen:r=(()=>{}),onClickGenerate:n,onClickSave:a})=>{const[o,s]=(0,i.useState)(!1),[l,c]=(0,i.useState)(!1),{remaining:d,patternsLibraryRate:p,patternsCategoryRate:m,isFreeUser:f}=oi(),{businessType:h,businessName:b,businessDetails:v,allPatternsCategories:w,isNewUser:x}=(0,t.A)((e=>{const{getAIStepData:t,getOnboardingAI:r,getAllPatternsCategories:n}=e(g.U);return{...t(),allPatternsCategories:n(),isNewUser:r()?.isNewUser}}),[]),_=f&&d<2*m||!f&&de)).join(" and "),k=[{key:h,label:"Business Type"},{key:b,label:"Business Name"},{key:v,label:"Business Description"}],S=async e=>{_||o||(s(!0),"function"==typeof n&&(f&&(0,y.HU)("ast-free-ai-content",Math.random().toString(36).substring(2)),await n(e),s(!1),r(!1)))},C=()=>{window.open(ast_block_template_vars.get_more_credits_url,"_blank")};return React.createElement(Fi,{open:e,setOpen:r,width:520,closeButton:!1},_?React.createElement(i.Fragment,null,React.createElement("div",{className:"space-y-2"},React.createElement(Fi.Title,null,(0,u.__)("Uh Oh, you're out of AI credits 😕","astra-sites")),React.createElement("p",{className:"text-body-text text-base font-normal m-0"},(0,u.__)("With AI credits, you have the power to personalize the design library with unique copy and beautiful images specific to your website.","astra-sites")),React.createElement("p",{className:"text-body-text text-base font-normal m-0"},(0,u.nv)((0,u.__)("Your account has %1$s AI credits left. If you want to personalize the entire design library with content and images tailored to your business and website project, you'll require %2$s credits.","astra-sites"),d,p))),React.createElement(ii.A,{variant:"ai-primary",className:"w-full min-h-[45px]",hasSuffixIcon:!0,onClick:C},React.createElement("span",null,"Unlock 200,000 Credits for Just $39"),React.createElement(Ms,{className:"h-5 w-5"}))):f&&d>0?React.createElement(i.Fragment,null,React.createElement("div",{className:"space-y-7 p-4 lg:p-8 bg-background-tertiary rounded-lg"},React.createElement("div",{className:"space-y-3"},React.createElement(Fi.Title,null,"Yay, you're almost there! 😍"),React.createElement("p",{className:"text-body-text m-0 text-sm font-normal"},"With AI credits, you have the power to personalize the design library with unique copy and beautiful images specific to your website."),React.createElement("p",{className:"text-body-text m-0 text-sm font-normal"},"Your free account includes 1000 AI credits. If you want to personalize the entire design library with content and images tailored to your business and website project, you'll require"," ",p," credits.")),React.createElement(ii.A,{className:"w-full min-h-[45px]",variant:"ai-primary",onClick:C},(0,u.__)("Unlock 200,000 AI Credits for Just $39","astra-sites"))),React.createElement("div",{className:"!-mb-2 !mt-0 px-4 lg:px-8 pt-4 lg:pt-8 pb-2 space-y-7"},React.createElement("div",{className:"space-y-3"},React.createElement("h6",{className:"text-xl font-bold leading-7"},(0,u.__)("Want to see how this works?","astra-sites")),React.createElement("p",{className:"text-body-text m-0 text-sm font-normal"},(0,u.nv)((0,u.__)("Begin with the 1000 AI credits provided when you signed up for your free account. With this, you can personalize templates in the %s categories.","astra-sites"),E)),React.createElement("p",{className:"text-body-text m-0 text-sm font-normal"},(0,u.__)("You can easily purchase additional AI credits later anytime.","astra-sites"))),React.createElement(ii.A,{className:"w-full min-h-[45px] text-body-text border-border-secondary border border-solid",variant:"blank",onClick:S},o?React.createElement(Vi.A,{className:"text-body-text"}):React.createElement(React.Fragment,null,"Try It Using Free 1000 Credits")))):React.createElement(i.Fragment,null,React.createElement("div",{className:"space-y-2"},React.createElement(Fi.Title,null,"Yay, you're almost there! 😍"),React.createElement("p",{className:"text-body-text"},"This will personalize the entire design library, and it will consume"," ",f?2*m:p," ","AI credits from your account.")),React.createElement("div",{className:"p-5 border border-solid border-border-primary rounded-md max-h-[248px] overflow-y-scroll"},k.map((({key:e,label:t},r)=>React.createElement(i.Fragment,{key:r},React.createElement("div",{className:"text-heading-text text-base"},React.createElement("p",{className:"font-semibold !m-0 !p-0"},t),React.createElement("p",{className:"font-normal !m-0 !p-0"},e)),r{l||(c(!0),"function"==typeof a&&(await a(e),c(!1),r(!1)))}},l?React.createElement(Vi.A,{className:"text-accent-ai"}):React.createElement("span",null,"Save & Exit"))))),React.createElement("button",{className:"w-full text-base font-medium text-secondary-text text-center underline border-none cursor-pointer bg-transparent",onClick:()=>r(!1)},"Back"))};var Uy=o(2543);function Hy(){return Hy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t=["aspect-[1/1]","aspect-[1/2]","aspect-[2/1]","aspect-[2/2]","aspect-[3/3]","aspect-[4/3]","aspect-[3/4]"];let r=0;return Array.from({length:e}).map(((e,n)=>(r=r===t.length?0:r,React.createElement(Qh,{key:n,className:(0,y.xW)("relative overflow-hidden rounded-lg","bg-slate-300 rounded-lg relative animate-pulse",t[r++])}))))},Ky=(0,e.A)((0,n.A)((e=>{const{setPreviousAIStep:t,setDynamicContent:r,setCurrentCategory:n,setIsSyncBusinessDetails:a}=e("astra-sites");return{onClickPrevious:t,setDynamicContent:r,setCurrentCategory:n,setIsSyncBusinessDetails:a}})))((({onClickPrevious:e,setDynamicContent:n,setIsSyncBusinessDetails:a})=>{const{setWebsiteImagesAIStep:o,setCurrentCategory:s,toggleOnboardingAIStep:l,dynamicContentFlagSet:c,dynamicContentSyncStart:d,dynamicContentSyncComplete:p,dynamicContentFlagReset:m,setCreditsDetails:h,setIsNewUserOnboarding:b,setIsPersonalized:v}=(0,r.A)(g.U),{stepsData:{businessName:w,selectedImages:x=[],keywords:_=[],businessType:E,businessDetails:k,businessContact:S,siteLanguage:C,siteLanguageList:R},allPatternsCategories:A,updateImages:P,isNewUser:T}=(0,t.A)((e=>{const{getAIStepData:t,getAllPatternsCategories:r,getDynamicContent:n,getOnboardingAI:a}=e(g.U),i=a();return{stepsData:t(),allPatternsCategories:r(),dynamicContent:n(),updateImages:i?.updateImages,isNewUser:i?.isNewUser}})),N=(0,i.useRef)([]),I=R?.find((e=>e.code===(C||"en"))),[O,L]=(0,i.useState)(Zy.all),[B,j]=(0,i.useState)(_?.length>0?_[0]:""),[D,F]=(0,i.useState)([]),[M,z]=(0,i.useState)(0),[V,W]=(0,i.useState)([]),[U,H]=(0,i.useState)(1),[$,Z]=(0,i.useState)(!0),[G,q]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(!1),[X,J]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)("all"),[te,re]=(0,i.useState)(!1),[ne,ae]=Ka({placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,0]}}]});(0,i.useEffect)((()=>{o((0,Uy.uniqBy)([...x,...D.map((e=>({id:String(e.id),url:e?.originalImageURL??e.url,optimized_url:e?.sizes?.large?.url??e.url,engine:"",description:"",orientation:e?.orientation??(e?.width>e?.height?"landscape":"portrait"),author_name:e?.author_name??"",author_url:""})))],"id"))}),[D.length]);const ie=(0,i.useRef)(null),oe=(0,i.useRef)(!1),se=(0,i.useRef)(new Set),le=(0,i.useRef)(null),{getRootProps:ce,getInputProps:ue}=Zh({accept:{"image/png":[".png"],"image/jpeg":[".jpeg",".jpg"]},noClick:!0,noKeyboard:!0,onDropAccepted:async e=>{F([]),z(e.length),e.forEach((async e=>{try{await $y({filesList:[e],onFileChange:e=>{if(e[0].id){if(!(0,y.Bh)(e[0]?.url))return Ps.oR.error((0,y.yI)({message:(0,u.nv)((0,u.__)("Invalid file name! Please avoid special characters. (%s)","astra-sites"),e[0].title)}),y.GU),void z((e=>e-1));F((t=>[...t,...e])),z((e=>e-1))}}})}catch(e){console.error(e),Ps.oR.error((0,y.yI)({message:e.message.toString()}),y.GU),z((e=>e-1))}}))},maxFiles:20,maxSize:5*Yh.$,onDropRejected:e=>{e.length>20?Ps.oR.error((0,y.yI)({message:(0,u.__)("You can only upload 20 images at once","astra-sites")}),y.GU):e.forEach((({errors:e,file:t})=>{Ps.oR.error((0,y.yI)({message:`${e[0].message} (${t?.name})`}),y.GU)}))}}),{register:de,handleSubmit:pe,setValue:me,reset:fe,setFocus:ge,watch:he}=Ql({defaultValues:{keyword:B}}),ye=he("keyword"),be=Kf(B,500),ve=Kf(O,500),{isFreeUser:we}=oi(),xe=async e=>{e.preventDefault();const t=new window.FormData;t.append("action","ast-block-templates-ai-content"),t.append("security",ast_block_template_vars.ai_content_ajax_nonce),t.append("business_name",w),t.append("business_desc",k),t.append("business_category",E),t.append("images",JSON.stringify(x)),t.append("image_keyword",JSON.stringify(_)),t.append("business_address",S?.address||""),t.append("business_phone",S?.phone||""),t.append("business_email",S?.email||""),t.append("language",JSON.stringify(I)),t.append("social_profiles",JSON.stringify(S?.socialMedia||[])),t.append("save_only",!0);try{const e=await(0,y.nr)({url:ast_block_template_vars.ajax_url,method:"POST",body:t});if(!e.success)throw new Error(e?.data?.data);l(),e?.data.images.length>0&&o(e.data.images),a(!1)}catch(e){(0,ti.v)(e)}},_e=()=>[...new Set(_)].filter((e=>""===B.trim()||e?.toLowerCase()!==B?.toLowerCase())),Ee=e=>{const t=x?.filter((t=>t.id===e.id));return t?.length>0},ke=(0,i.useCallback)((e=>{let t=[];Ee(e)?(e.id=String(e.id),t=x?.filter((t=>t.id!==e.id))):t=[...x,e],o(t)}),[x,o]),Se=()=>{N.current.length&&(N.current.forEach((e=>e.abort())),N.current=[],W([]))},Ce=async e=>{let t=B;"string"!=typeof B||B&&""!==B.trim()||(t=w);const r={keywords:t,orientation:O.value,per_page:20,page:U};try{const t=new AbortController;N.current.push(t);const n=await(0,y.nr)({path:"gutenberg-templates/v1/images",data:{...r,engine:e},method:"POST",headers:{"X-WP-Nonce":ast_block_template_vars.rest_api_nonce},signal:t.signal}),a=n.data?.data||[];if(!n.success)throw new Error(n?.data?.data);0===a?.length&&se.current.add(e);const i=a?.length>0?a.map((e=>({...e,id:String(e.id)}))).filter((e=>!x?.some((t=>t.id===e.id)))):[];return W((e=>((e,t)=>{const r=new Map;return[...e,...t].forEach((e=>{r.has(e.id)||r.set(e.id,e)})),Array.from(r.values())})(e,i))),a?.length||0}catch(e){if("AbortError"===e.name)throw e;(0,ti.v)(e)}return 0},Re=()=>{J(!0)};(0,i.useEffect)((()=>{oe.current=!1,(async()=>{try{q(!0);const e=[];for(const t of qy)if(!se.current.has(t)){const r=await Ce(t);e.push(r)}Math.max(e.filter(Boolean))<20?Z(!1):Z(!0),oe.current=!0,q(!1)}catch(e){if("AbortError"===e.name)return;oe.current=!0,q(!1),(0,ti.v)(e)}})()}),[be,ve,U]),(0,i.useEffect)((()=>{oe.current=!1,se.current.clear(),H(1),W([])}),[B,O]),(0,i.useEffect)((()=>{ge("keyword")}),[]);const Ae=(e=[])=>e.filter((e=>!e.engine)),Pe=(e=[])=>e.filter((e=>e.engine&&"placeholder"!==e.engine)),Te=e=>{!te&&_e()?.length&&("click"!==e?.type&&"keydown"!==e?.type||re(!0))},Ne=e=>{const t=document.getElementById("search-images-wrapper");t&&!t.contains(e.target)&&re(!1)};(0,i.useEffect)((()=>(document.addEventListener("mousedown",Ne),()=>document.removeEventListener("mousedown",Ne))),[Ne]);const Ie=(()=>{switch(Q){case Gy[0].value:return G?[...V,...Yy()]:V;case Gy[1].value:return[...Ae(x),...M?Yy(M):[]];case Gy[2].value:return Pe(x);default:return G?[...V,...Yy()]:V}})();return React.createElement("div",{ref:ie,className:"w-full flex flex-col flex-auto h-full overflow-y-auto",onScroll:e=>{if(!e)return;if((e=>{if(!e)return;const{scrollTop:t}=e.target;t>50&&!Y&&K(!0),t<=50&&Y&&K(!1)})(e),!$||G)return;const{scrollTop:t,scrollHeight:r,clientHeight:n}=ie.current;t+n>=r-200&&H((e=>e+1))}},React.createElement("div",{className:"w-full space-y-6"},React.createElement(df,{className:"pt-5 md:pt-12 px-5 md:px-10 lg:px-14 xl:px-20 max-w-fit mx-auto !text-zip-app-label",heading:"Select the Images"}),React.createElement("form",{className:"w-full overflow-visible min-h-[3.125rem]",onSubmit:pe((e=>{Se(),j(e.keyword)}))},React.createElement("div",{id:"search-images-wrapper",ref:ne,className:(0,y.xW)("relative w-full max-w-[37.5rem] mx-auto pl-4 pr-12 py-3 border border-button-disabled rounded-md shadow bg-white z-[2]",{"pb-0 rounded-b-none border-b-0 shadow-md":te}),onClick:e=>{"search-images-wrapper"===e.target.id&&(ge("keyword"),!te&&_e()?.length&&re(!0))},role:"button",tabIndex:"0",onKeyDown:e=>{if("Enter"===e.key){if("search-images-wrapper"!==e.target.id)return;if(ge("keyword"),te||!_e()?.length)return;re(!0)}}},React.createElement("div",{className:"absolute top-[0.875rem] right-3 flex items-center"},React.createElement("button",{type:"button",className:"w-auto h-auto p-0 flex items-center justify-center cursor-pointer bg-transparent border-0 focus:outline-none",onClick:()=>{ye&&(j(""),fe({keyword:""}))}},ye?React.createElement(f,{className:"w-5 h-5 text-zip-app-inactive-icon"}):React.createElement(ko,{className:"w-5 h-5 text-zip-app-inactive-icon"}))),React.createElement("input",Hy({className:"!text-sm placeholder:text-sm p-0 border-0 w-full h-6 shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none",placeholder:"Add more relevant keywords...",autoComplete:"off",onKeyDown:Te,onClick:Te},de("keyword"))),React.createElement("div",{ref:ae,className:(0,y.xW)("w-[calc(100%_+_2px)] px-3 pb-4 z-10 bg-white shadow-md border-x border-b border-t-0 border-solid border-border-tertiary rounded-b-md",{invisible:!te})},te&&React.createElement("hr",{className:"!mx-0 !my-3 border-t border-solid border-b-0 border-border-tertiary",tabIndex:-1}),React.createElement("h6",{className:"flex items-center justify-start gap-1.5 text-sm font-medium mb-4"},React.createElement("span",null,(0,u.__)("Suggested Keywords","astra-sites")),React.createElement(Vo,{className:"inline-block size-4"})),React.createElement(ly,{keywordClassName:"border-zip-light-border-primary bg-background-secondary",keywords:_e(),onClick:e=>{Se(),j(e),me("keyword",e),re(!1)}}))))),React.createElement("div",{className:"pt-4 px-5 md:px-10 lg:px-14 xl:px-20 sticky top-0 space-y-4 z-[1] bg-gt-container-background"},React.createElement("div",{className:"rounded-t-lg pt-2 pb-4"},React.createElement("div",{className:"flex items-center justify-between"},React.createElement("div",{className:"flex items-center gap-1 text-sm font-normal leading-[21px]"},React.createElement("div",{className:"flex items-center justify-start gap-3"},Gy.map((e=>React.createElement("button",{className:(0,y.xW)("relative before:content-[attr(data-title)] before:block before:font-bold before:text-sm before:invisible before:h-0","px-0 py-3 border-0 bg-transparent text-sm font-semibold text-accent-st cursor-pointer focus-visible:outline-none focus:outline-none active:outline-none transition-colors ease-in-out duration-150",e.value!==Q&&"font-normal text-body-text"),key:e.value,type:"button",onClick:()=>ee(e.value),"data-title":e.label},e.label,e.value===Gy[2].value&&!!Pe(x)?.length&&` (${Pe(x)?.length})`,e.value===Gy[1].value&&!!Ae(x)?.length&&` (${Ae(x)?.length})`,e.value===Q&&React.createElement("span",{className:"absolute bottom-0 inset-x-0 w-full h-0.5 bg-accent-ai"})))))),Q===Gy[0].value&&React.createElement(Ja,{placement:"right",trigger:React.createElement("div",{className:(0,y.xW)("flex items-center gap-2 min-w-[100px] py-3 pl-4 pr-3 cursor-pointer border border-border-primary rounded-md")},React.createElement("span",{className:"text-sm font-normal text-body-text leading-[150%]"},O.label),React.createElement(Cc,{className:"w-5 h-5 text-app-inactive-icon"})),align:"top",width:"48",contentClassName:"p-1 bg-white"},Object.values(Zy).map(((e,t)=>{return React.createElement(Ja.Item,{as:"div",key:t,className:"only:!p-0"},React.createElement("button",{type:"button",className:"w-full flex items-center justify-between gap-2 py-1.5 px-2 text-sm font-normal leading-5 text-body-text hover:bg-background-secondary transition duration-150 ease-in-out space-x-2 rounded bg-white border-none cursor-pointer",onClick:(r=e,()=>{r!==O&&Se(),L(r)})},React.createElement("span",null,e.label),e.value===O.value&&React.createElement(_u,{className:"w-4 h-4 text-heading-text"})));var r}))),Q===Gy[2].value&&!!x?.length&&React.createElement("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o(x.filter((e=>!e.engine)))},className:"px-1 py-px bg-transparent border border-solid border-border-primary rounded text-xs leading-4 text-body-text cursor-pointer"},(0,u.__)("Clear","astra-sites")),Q===Gy[1].value&&React.createElement(Vy,{render:({open:e})=>React.createElement("button",{ref:le,className:"px-0 bg-transparent border-none rounded text-xs leading-5 font-semibold text-accent-st cursor-pointer inline-flex items-center justify-end gap-2",onClick:e},React.createElement(Bg,{className:"w-4 h-4 text-zip-app-inactive-icon",strokeWidth:2}),React.createElement("span",null,(0,u.__)("Upload Your Images","astra-sites")))})))),React.createElement("div",{className:"py-4 px-5 md:px-10 lg:px-14 xl:px-20 flex flex-col flex-auto relative"},Q===Gy[1].value&&!Ie.length&&React.createElement("div",Hy({className:(0,y.xW)("relative flex flex-col items-center justify-center gap-3 py-[3.125rem] px-4 bg-background-primary border border-dashed border-border-tertiary rounded cursor-pointer")},ce()),React.createElement("input",ue()),React.createElement(Bg,{className:"w-6 h-6 text-zip-app-inactive-icon"}),React.createElement("p",{className:"text-zip-body-text text-base !my-0"},React.createElement("span",{className:"text-accent-st min-w-fit break-keep text-nowrap whitespace-nowrap font-semibold mr-1"},(0,u.__)("Upload images","astra-sites")),(0,u.__)("or drop your images here (Max 20)","astra-sites")),React.createElement("p",{className:"text-zip-body-text text-base !my-0"},(0,u.__)("PNG, JPG, JPEG","astra-sites")),React.createElement("p",{className:"text-zip-body-text text-base !my-0"},(0,u.__)("Max size: 5 MB per file","astra-sites")),React.createElement("div",{className:"absolute inset-0",onClick:()=>{le?.current&&le?.current.click()},tabIndex:0,role:"button",onKeyDown:e=>{(le?.current||"Enter"===e.key)&&le?.current.click()}})),React.createElement(Gg,null,Ie?.length>0&&React.createElement(us,{className:"gap-6 [&>div]:gap-6",columns:{default:1,220:2,767:3,1024:3,1280:5,1920:6}},Ie.map((e=>e?.optimized_url&&"placeholder"!==e?.engine?React.createElement(ny,{key:e.id,image:e,isSelected:Ee(e),onClick:ke,variant:Q===Gy[2].value||Q===Gy[1].value?"selection":"default"}):React.createElement(i.Fragment,{key:Math.random().toString(36).substring(2,10)},e))))),Q===Gy[0].value&&!G&&!V.length&&oe.current&&React.createElement("div",{className:"flex flex-col items-center justify-center h-full"},React.createElement("p",{className:"text-secondary-text text-center px-10 py-5 border-2 border-dashed border-border-primary rounded-md"},B.length?React.createElement(React.Fragment,null,(0,u.__)("We couldn`t find anything with your keyword.","astra-sites"),React.createElement("br",null),(0,u.__)("Try to refine your search.","astra-sites")):React.createElement(React.Fragment,null,(0,u.__)("Find the perfect images for your website by entering a keyword or selecting from the suggested options.","astra-sites")))),Q===Gy[0].value&&!G&&!$&&!!V.length&&React.createElement("div",{className:"pb-5 pt-10 flex flex-col items-center justify-center h-full"},React.createElement("p",{className:"text-secondary-text text-sm leading-5 text-center after:mx-2.5 after:content-[''] after:inline-block after:w-5 sm:after:w-12 after:h-px after:bg-app-border after:relative after:-top-[5px] before:mx-2.5 before:content-[''] before:inline-block before:w-5 sm:before:w-12 before:h-px before:bg-app-border before:relative before:-top-[5px]"},(0,u.__)("End of the search results","astra-sites"))),Q===Gy[2].value&&!Pe(x).length&&React.createElement("div",{className:"flex flex-col items-center justify-center h-full"},React.createElement("p",{className:"text-secondary-text text-center px-10 py-5 border-2 border-dashed border-border-primary rounded-md"},(0,u.__)("No images are selected yet.","astra-sites")))),Y&&React.createElement("div",{className:"absolute right-[6.5rem] bottom-28 ml-auto"},React.createElement("button",{type:"button",className:"absolute bottom-0 right-0 z-10 w-8 h-8 rounded-full bg-accent-st border-0 border-solid text-white flex items-center justify-center shadow-sm cursor-pointer",onClick:()=>{ie.current&&(K(!1),ie.current.scrollTo({top:0,behavior:"smooth"}))}},React.createElement(Dg,{className:"w-5 h-5"}))),React.createElement("div",{className:"min-h-[80px] py-4 px-5 md:px-10 lg:px-14 xl:px-20 sticky bottom-0 bg-gt-container-background"},React.createElement(Od,P?{continueButtonText:"Save & Exit",onClickContinue:xe}:{onClickContinue:Re,onClickSkip:Re,onClickPrevious:e})),React.createElement(Wy,{open:X,setOpen:J,onClickGenerate:async e=>{e.preventDefault();const t=new window.FormData;t.append("action","ast-block-templates-ai-content"),t.append("security",ast_block_template_vars.ai_content_ajax_nonce),t.append("business_name",w),t.append("business_desc",k),t.append("business_category",E),t.append("images",JSON.stringify(x)),t.append("image_keyword",JSON.stringify(_)),t.append("business_address",S?.address||""),t.append("business_phone",S?.phone||""),t.append("business_email",S?.email||""),t.append("language",JSON.stringify(I)),t.append("social_profiles",JSON.stringify(S?.socialMedia||[]));try{const e=await(0,y.nr)({url:ast_block_template_vars.ajax_url,method:"POST",body:t});e.success&&(a(!1),l(),e?.data.images.length>0&&o(e.data.images))}catch(e){(0,ti.v)(e)}const r="patterns",i=we?A.slice(0,2):A;m(r,we?i.map((e=>e.id)):null),d(r);let u=!1;try{u=await(0,Wo.R2)(i,n,c,(e=>s(r,e)),h,"block",v)}catch(e){u=e}"object"==typeof u&&"api_throttle_error"===u?.data?.code&&(u={type:"error",title:"Check Back Soon",message:React.createElement(React.Fragment,null,"We are currently experiencing exceptionally high demand. Please try again in 5 minutes. If the error persists, kindly contact us through the website:",React.createElement("a",{href:"https://zipwp.com/contact",target:"_blank",rel:"noreferrer"}," ","https://zipwp.com/contact"),".")}),p(r,"object"==typeof u?u:null),s(r,{}),T&&u&&b()},onClickSave:xe}))})),Xy=[{name:(0,u.__)("Connect","astra-sites"),description:(0,u.__)("Connect your account","astra-sites"),screen:"api-key",component:React.createElement(rg,null)},{name:(0,u.__)("Let's Start","astra-sites"),description:(0,u.__)("Name, language & type","astra-sites"),screen:"type",component:React.createElement(tg,null)},{name:"Describe",description:"Some details please",screen:"details",component:React.createElement(Tg,null)},{name:"Contact",description:"How can people get in touch",screen:"contact-details",component:React.createElement(uf,null)},{name:"Images",description:"Select relevant images",screen:"images",component:React.createElement(Ky,null),classNames:"p-0 md:p-0 lg:p-0 xl:p-0"}],Jy=(0,e.A)((0,a.A)((e=>{const{getTogglePopup:t,getSitePreview:r,getCurrentScreen:n,setCurrentScreen:a,getCurrentAIStep:i}=e("astra-sites");return{togglePopup:t(),sitePreview:r(),currentScreen:n(),setCurrentScreen:a,currentStep:i()}})),(0,n.A)((e=>{const{toggleOnboardingAIStep:t,setCurrentAIStep:r}=e("astra-sites");return{toggleOnboardingAIStep:t,setCurrentAIStep:r}})))((0,i.memo)((({togglePopup:e,currentScreen:t,sitePreview:r,toggleOnboardingAIStep:n,currentStep:a,setCurrentAIStep:o})=>{(0,i.useEffect)((()=>{e?(document.body.classList.add("ast-block-templates-modal-open"),document.getElementById("ast-block-templates-modal-wrap").classList.add("open")):(document.body.classList.remove("ast-block-templates-modal-open"),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"))}),[e,t,r]);const s=e=>{1!==e&&e<=a&&o(e)},l=1===a;return React.createElement("div",{id:"spectra-onboarding-ai",className:"h-[calc(100vh_-_5rem)] font-sans grid grid-cols-1 shadow-medium grid-rows-[4.5rem_1fr]"},React.createElement("header",{className:"grid grid-cols-[4rem_1fr_4rem] items-center justify-between md:justify-start w-full h-full z-10 bg-white shadow-md"},React.createElement("div",{className:"relative flex size-10 shrink-0 items-center mx-auto"},"active"===ast_block_template_vars.astra_sites_status||"active"===ast_block_template_vars.astra_sites_pro_status?React.createElement(ei.fp,{className:"size-10"}):React.createElement(ei.y0,{className:"size-10"})),React.createElement("nav",{className:"w-full h-full hidden md:flex items-center justify-center gap-4 flex-1"},Xy.map((({name:e},t)=>{return l||0!==t?React.createElement(i.Fragment,{key:t},React.createElement("div",{className:(0,y.xW)("flex gap-3",t+1s(t+1),role:"button",tabIndex:"0",onKeyDown:e=>"Enter"===e.key?s(t+1):null},React.createElement("div",{className:(0,y.xW)("flex flex-col gap-y-1 items-center",t===Xy.length-1?"justify-start":"justify-center")},React.createElement("div",{className:(0,y.xW)("rounded-full border border-border-primary text-xs font-semibold flex items-center justify-center w-6 h-6",(r=a,n=t,r===n+1?"border-accent-st bg-white text-accent-st border-solid":r>n+1?"bg-secondary-text text-white border-secondary-text border-solid":"border-solid border-step-connector text-secondary-text"))},a>t+1?React.createElement(_u,{className:"h-3 w-3"}):React.createElement("span",null,t+Number(l)))),React.createElement("div",{className:(0,y.xW)("text-sm font-medium text-secondary-text pt-0.5",a===t+1&&"text-accent-st")},e)),Xy.length-1>t&&React.createElement("div",{className:(0,y.xW)("w-8 h-px self-center","bg-border-primary")})):React.createElement(i.Fragment,{key:t});var r,n}))),React.createElement("div",{className:"[grid-area:1/3] flex items-center justify-center mx-auto"},React.createElement(Ad,{onExit:e=>{e?.preventDefault(),e?.stopPropagation(),n()}}))),React.createElement("main",{id:"sp-onboarding-content-wrapper",className:"flex-1 overflow-x-hidden h-full bg-gt-container-background"},React.createElement(Og,null,React.createElement("div",{className:"h-full w-full relative flex"},React.createElement("div",{className:(0,y.xW)("w-full max-h-full flex flex-col flex-auto items-center overflow-y-auto",!l&&"px-5 pt-5 [&:has(.max-w-container)]:pb-4 md:px-10 md:pt-10 md:[&:has(.max-w-container)]:pb-6 lg:px-14 lg:pt-14 lg:[&:has(.max-w-container)]:pb-8 xl:px-20 xl:pt-12 xl:[&:has(.max-w-container)]:pb-10",Xy[a-1]?.classNames)},Xy[a-1]?.component)))))})));o(5138);const Qy=e=>{const{syncFlags:r,syncStatus:n,reSyncCatContent:a,currentCategory:o,syncMessage:s}=(0,t.A)((t=>{const{getDynamicContentSyncStatus:r,getDynamicContentSyncFlags:n,getDynamicContentReSyncStatus:a,getCurrentCategory:i,getDynamicContentSyncMessage:o}=t(g.U);return{syncStatus:r()[e],syncFlags:n()[e],reSyncCatContent:a(),currentCategory:i()[e],syncMessage:o()}})),l=(0,i.useRef)(null);(0,i.useEffect)((()=>{if(a)return;const e=()=>{const e=Object.values(r),t=e.reduce(((e,t)=>t?e+1:e),0);return Math.round(t/e.length*100)};n&&null===l.current&&o?.name&&(l.current=(0,Ps.oR)((0,Ts.A)({title:'Personalizing "'+o?.name+'"',message:"Please wait a few moments. We are personalizing categories.",showProgress:!0,progress:e()}),Ts.A.getOptions({type:"sync"}))),null!==l.current&&o?.name&&Ps.oR.update(l.current,{...Ts.A.getOptions({type:"sync"}),render:(0,Ts.A)({title:'Personalizing "'+o?.name+'"',message:"Please wait a few moments. We are personalizing categories.",showProgress:!0,progress:e()})}),n||null===l.current||100!==e()||(Ps.oR.update(l.current,{...Ts.A.getOptions({type:"success"}),render:(0,Ts.A)({title:"Library Personalized",message:"Your library personalized successfully."})}),l.current=null),!n&&null!==l.current&&e()<100&&s&&(Ps.oR.update(l.current,{...Ts.A.getOptions({type:s.type}),render:(0,Ts.A)({title:s.title,message:s.message})}),l.current=null),!n&&null!==l.current&&e()<100&&(Ps.oR.update(l.current,{...Ts.A.getOptions({type:"error"}),render:(0,Ts.A)({title:"Error!",message:"An error occurred while personalizing. Please try again."})}),l.current=null)}),[n,r,o,a,l])},eb=()=>{const{setTogglePopup:e}=(0,r.A)(g.U);return React.createElement("div",{className:"spectra-ai h-[4.5rem] w-full grid grid-cols-2 grid-rows-1 items-center bg-white border-0 border-b border-solid border-b-border-primary px-5"},React.createElement("div",{className:"flex items-center gap-3"},React.createElement(ei.y0,{className:"w-10 h-10 !shrink-0"}),React.createElement("div",{className:"h-[1.0625rem] w-px !shrink-0 bg-border-primary"}),React.createElement("span",{className:"text-[1.15rem] font-semibold text-heading-text leading-[1.875rem]"},(0,u.__)("Build using AI","astra-sites"))),React.createElement("button",{className:"ml-auto border-0 bg-transparent outline-none focus:outline-none active:outline-none text-nav-inactive hover:text-nav-active cursor-pointer flex items-center justify-center rounded-full p-2 hover:bg-background-tertiary active:bg-background-tertiary transition-colors ease-in-out duration-150"},React.createElement(f,{className:"w-5 h-5 transition-colors duration-150 ease-in-out",onClick:()=>{e(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open")}})))},tb=[{id:1,name:"Home"},{id:2,name:"About"},{id:3,name:"Services"},{id:4,name:"Contact"},{id:5,name:"Blog"},{id:6,name:"Landing Page"},{id:7,name:"Something Else"}],rb=({type:e,selected:t,onClick:r,className:n})=>{const{name:a,prefixIcon:i,suffixIcon:o}=e,s=(e,t)=>{e?.preventDefault(),e?.stopPropagation(),"function"==typeof r&&r(t)};return React.createElement("div",{onClick:t=>s(t,e),className:(0,y.xW)("flex items-center justify-center gap-2 py-3 font-medium hover:shadow-medium transition duration-150 ease-in-out cursor-pointer border border-solid rounded-full hover:border-accent-spectra",t?"text-heading-text border-accent-spectra shadow-medium bg-white":"text-body-text border-transparent bg-background-secondary",!i&&!o&&"px-8",i&&!o&&"pr-8 pl-6",!i&&o&&"pl-8 pr-6",n),role:"button",tabIndex:"0",onKeyDown:t=>"Enter"===t.key?s(t,e):null},!!i&&i,React.createElement("span",null,a),!!o&&o)},nb=()=>{const[e,t]=(0,i.useState)("Home"),[n,a]=(0,i.useState)(!1),{setNextOnboardingPagesAIStep:o}=(0,r.A)(g.U);return React.createElement(i.Fragment,null,React.createElement(eb,null),React.createElement("div",{className:"w-full max-w-container px-10 lg:px-16 xl:px-20 py-12 mx-auto pt-10"},React.createElement("h4",{className:"font-semibold text-[2rem] leading-10 text-[#0F172A] m-0"},"What kind of page are you building?"),React.createElement("p",{className:"leading-6 text-base text-[#475569]"},"Let's get started by choosing the page you're designing."),React.createElement("div",{className:"my-8 flex gap-4 flex-wrap"},tb.length>0&&tb?.map((r=>React.createElement(rb,{className:"py-2 px-6 font-medium text-sm leading-[21px]",key:r.id,type:r,onClick:()=>{return t((e=r).name),void(7===e.id?(console.log(e.id),a(!0)):a(!1));var e},selected:e===r.name})))),n&&React.createElement("div",{className:"mb-8"},React.createElement(Qo,{placeholder:"Enter page name here",label:"Give it a name"})),React.createElement(ii.A,{variant:"primary",className:"w-full rounded-md",onClick:o,hasSuffixIcon:!0,isSmall:!0},React.createElement("span",null,"Next"),React.createElement(Ms,{className:"w-4 h-4"}))))},ab=()=>{const{setPreviousOnboardingPagesAIStep:e,setNextOnboardingPagesAIStep:t}=(0,r.A)(g.U);return React.createElement(i.Fragment,null,React.createElement(eb,null),React.createElement("div",{className:"w-full max-w-container px-10 lg:px-16 xl:px-20 py-12 mx-auto pt-10 space-y-8"},React.createElement("div",{className:"space-y-3"},React.createElement("h4",{className:"m-0"},"Please describe this page in few words"),React.createElement("p",{className:"m-0 leading-6 text-base text-body-text"},"Be as descriptive as you can. Share your vision for this page.")),React.createElement("div",{className:"space-y-3"},React.createElement(Id,{name:"description",className:"mt-8 w-full placeholder-[#9CA3secondary-text",placeholder:"On this page, I want to write about the founder of this business. Her name is Amber Kardile. She started this company 6 years ago. Her background is in service industry and education in psychology.",validations:{required:"Description is required"},rows:"5"}),React.createElement("div",{className:"flex items-center gap-2 mt-2 text-accent-spectra cursor-pointer"},React.createElement(ei.AW,{className:"w-5 h-5 transition duration-150 ease-in-out"}),React.createElement("span",{className:"font-semibold text-sm transition duration-150 ease-in-out"},"Write Using AI"))),React.createElement("div",null,React.createElement("div",{className:"flex flex-row gap-4"},React.createElement(ii.A,{variant:"primary",hasSuffixIcon:!0,className:"w-3/4 rounded-md",onClick:t},React.createElement("span",null,"Start Building (84 Credits)"),React.createElement(Ms,{className:"w-4 h-4"})),React.createElement(ii.A,{variant:"white",className:"w-1/4 rounded-md",onClick:e},React.createElement("span",null,"Previous Step"))),React.createElement("div",{className:"flex items-center justify-center mt-3 w-3/4"},React.createElement("span",{className:""},"968 Credits remaining")))))},ib=()=>React.createElement("div",{className:"w-full h-full bg-white shadow-xlarge"},React.createElement("div",{className:"w-full h-full overflow-hidden"},React.createElement("div",{className:"px-5 pt-5"},React.createElement("div",{className:"flex items-center justify-between mb-12 2xl:mb-20 overflow-hidden"},React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-8 2xl:h-10 w-3/12"}),React.createElement("div",{className:"flex gap-4 2xl:gap-5 w-full justify-center items-center overflow-hidden"},React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-3 2xl:h-4 w-2/12"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-3 2xl:h-4 w-2/12"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-3 2xl:h-4 w-2/12"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-3 2xl:h-4 w-2/12"})),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-8 2xl:h-10 w-3/12"})),React.createElement("div",{className:"flex flex-col gap-4 2xl:gap-5 items-center mb-8 2xl:mb-10 overflow-hidden"},React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-8 2xl:h-10 w-4/6"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-8 2xl:h-10 w-1/2"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-4 2xl:h-5 w-3/4"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-4 2xl:h-5 w-4/6"})),React.createElement("div",{className:"flex gap-4 2xl:gap-6 justify-center overflow-hidden"},React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-12 2xl:h-14 w-1/5"}),React.createElement("div",{"data-placeholder":!0,className:"relative bg-gray-200 h-12 2xl:h-14 w-1/5"}))),React.createElement("div",{"data-placeholder":!0,className:"relative mt-12 2xl:mt-24 bg-gray-200 h-full w-full"})));var ob=o(7614),sb=o.n(ob);const lb=({trigger:e,children:t})=>{const[r,n]=(0,i.useState)(!1);return React.createElement("div",{className:"bg-white relative"},React.createElement("div",{className:"absolute top-4 right-0 w-6 h-6 pointer-events-none "},r?React.createElement(Dg,{className:"text-app-body-text"}):React.createElement(Cc,{className:"text-app-body-text"})),React.createElement(sb(),{trigger:e,triggerClassName:"block py-4 pr-8 text-[16px] font-semibold leading-[24px]",triggerOpenedClassName:"block py-4 pr-8 text-[16px] font-semibold leading-[24px]",contentInnerClassName:"pb-5",transitionTime:200,transitionCloseTime:200,onOpen:()=>n(!0),onClose:()=>n(!1)},t))},cb=()=>{const{setTogglePopup:e,setPreviousOnboardingPagesAIStep:t}=(0,r.A)(g.U);return React.createElement("div",{className:"flex items-stretch flex-1"},React.createElement("div",{className:"xl:w-[72%] lg:w-[65%] w-[55%] flex flex-col items-start justify-start bg-background-secondary relative h-full"},React.createElement("div",{className:"py-4 px-5"},React.createElement(ei.y0,{className:"w-10 h-10"})),React.createElement("div",{className:"flex-1 px-[4.875rem] w-full"},React.createElement(ib,null))),React.createElement("div",{className:"xl:w-[28%] lg:w-[35%] w-[45%] pt-8 pb-5 px-8 bg-white relative flex flex-col"},React.createElement("div",{className:"flex items-start justify-between"},React.createElement("h5",{className:"m-0"},"Build Your Page"),React.createElement("button",{className:"border-0 bg-transparent outline-none focus:outline-none active:outline-none text-nav-inactive hover:text-nav-active cursor-pointer flex items-center justify-center rounded-full p-2 hover:bg-background-tertiary active:bg-background-tertiary transition-colors ease-in-out duration-150",onClick:()=>{e(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open")}},React.createElement(f,{className:"w-5 h-5"}))),React.createElement("p",{className:"text-sm font-normal text-body-text mt-2 mb-8"},"Craft your page by selecting designs section by section. Personalize your design and have your page ready in no time."),React.createElement("div",{className:"flex flex-col gap-2 items-center justify-center px-2 pb-8 w-full"},React.createElement("div",{className:"flex justify-around w-full flex-wrap"},React.createElement("div",{className:"flex flex-col divide-y divide-border-primary divide-solid [&>div]:border-x-0"},React.createElement(lb,{trigger:"1. Page Header"},"ZipWP is different from other AI website builders in so many ways. It's free so there's no monthly charge to use it, or the website you build with it."),React.createElement(lb,{trigger:"2. Intro"},"ZipWP is different from other AI website builders in so many ways. It's free so there's no monthly charge to use it, or the website you build with it."),React.createElement(lb,{trigger:"3. Team Member"},"ZipWP is different from other AI website builders in so many ways. It's free so there's no monthly charge to use it, or the website you build with it."),React.createElement(lb,{trigger:"4. Join The Team"},"ZipWP is different from other AI website builders in so many ways. It's free so there's no monthly charge to use it, or the website you build with it."),React.createElement(lb,{trigger:"5. Image Gallery"},"ZipWP is different from other AI website builders in so many ways. It's free so there's no monthly charge to use it, or the website you build with it.")))),React.createElement("div",{className:"w-full flex justify-between items-center gap-2 mt-auto"},React.createElement(ii.A,{variant:"blank",className:"text-secondary-text font-medium leading-4 bg-transparent border-0 text-base",onClick:t},"Previous Step"),React.createElement(ii.A,{variant:"primary",hasPrefixIcon:!0,className:"rounded-md",onClick:()=>{}},React.createElement("span",null,"Build Page"),React.createElement(Ms,{className:"w-4 h-4"})))))},ub=[React.createElement(nb,{key:"type-selection"}),React.createElement(ab,{key:"description"}),React.createElement(cb,{key:"build-page"})],db=()=>{const{togglePopup:e,currentStep:r}=(0,t.A)((e=>{const{getTogglePopup:t,getOnboardingPageAI:r}=e(g.U);return{togglePopup:t(),...r()}}),[]);return(0,i.useEffect)((()=>{if(!0===e){document.body.classList.add("ast-block-templates-modal-open");const e=document.getElementById("ast-block-templates-modal-wrap");if(!e)return;e.classList.add("open")}}),[e]),React.createElement("div",{className:"spectra-ai flex-1 overflow-x-hidden h-[calc(100vh_-_5rem)] bg-white"},React.createElement("div",{className:"w-full h-full flex flex-col mx-auto"},ub[r-1]))},pb=(0,e.A)((0,n.A)((e=>{const{setTogglePopup:t}=e("astra-sites");return{onSetTogglePopup:t}})))((0,i.memo)((({onSetTogglePopup:e})=>((0,i.useEffect)((()=>{wp.data.subscribe((()=>{setTimeout((()=>{(()=>{const t=document.querySelector("#ast-block-templates-button-wrap");if(!t)return null;if(document.getElementById("ast-block-templates-button"))return null;const r=document.createElement("button");r.id="ast-block-templates-button",r.className="components-button is-primary",r.onclick=e,r.innerHTML=ast_block_template_vars.display_button_logo&&""===ast_block_template_vars.white_label_name?` `:"",r.innerHTML+=ast_block_template_vars.white_label_name?''+ast_block_template_vars.white_label_name+" ":''+ast_block_template_vars.button_text+" ",t.appendChild(r)})()}),100)}))}),[]),null))));o(1726);const mb=()=>(0,ye.createPortal)(React.createElement("div",{id:"headlessui-portal-root",className:"gt-library-styles"},React.createElement("div",null)),document.body),fb=(0,e.A)((0,n.A)((e=>{const{setTogglePopup:t}=e("astra-sites");return{onSetTogglePopup:t}})))((0,i.memo)((({onSetTogglePopup:e})=>{const{onboardingAI:{showOnboarding:n},onboardingPageAI:{showOnboarding:a}}=(0,t.A)((e=>{const{getOnboardingAI:t,getOnboardingPageAI:r}=e(g.U);return{onboardingAI:t(),onboardingPageAI:r()}}),[]),o=(0,Ps.nk)({enter:"fade-in-fwd",exit:"fade-out-bck"}),{toggleOnboardingPageAI:s}=(0,r.A)(g.U);Qy("pages"),Qy("patterns"),(()=>{const{notice:e}=(0,t.A)((e=>{const{getNotice:t}=e(g.U);return{notice:t()}})),r=(0,i.useRef)(null);(0,i.useEffect)((()=>{const{type:t,title:n,message:a}=e;"info"!==t&&"personalize"!==t||r.current||(r.current=(0,Ps.oR)((0,Ts.A)({title:n||"Syncing design library",message:a||"Please wait for a few moment, we are syncing the library"}),Ts.A.getOptions({type:"personalize"===t?"personalize":"sync-lib-start"}))),"success"===t&&r.current&&(Ps.oR.update(r.current,{...Ts.A.getOptions({type:"sync-lib-success"}),render:(0,Ts.A)({title:n||"Successfully synced!",message:a||"Syncing design library is completed"})}),r.current=null),"error"===t&&r.current&&(Ps.oR.update(r.current,{...Ts.A.getOptions({type:"sync-lib-error"}),render:(0,Ts.A)({title:n||"Syncing failed!",message:a||"Syncing design library is failed"})}),r.current=null)}),[e])})();const l=t=>{t.target===document.getElementById("ast-block-templates-modal-wrap")&&(document.body.classList.remove("ast-block-templates-modal-open"),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),e())};(0,i.useEffect)((()=>(document.addEventListener("click",l),()=>{document.removeEventListener("click",l)}))),(0,i.useEffect)((()=>(su.on("toggle-onboarding-page-ai",s),()=>{su.off("toggle-onboarding-page-ai",s)})),[]);const c=(0,i.useCallback)((()=>{(0,y.D6)("ast-sites-visible-items"),(0,y.D6)("ast-sites-scroll-position"),(0,y.D6)("ast-pages-scroll-position"),(0,y.D6)("ast-pages-visible-items"),(0,y.D6)("ast-free-ai-content")}),[]);return(0,i.useEffect)((()=>(window.addEventListener("beforeunload",c),()=>window.removeEventListener("beforeunload",c))),[]),React.createElement(i.Fragment,null,React.createElement(pb,null),React.createElement(Ps.N9,{position:Ps.oR.POSITION.TOP_RIGHT,autoClose:!1,closeOnClick:!1,closeButton:({closeToast:e})=>React.createElement("button",{className:"bg-transparent border-0 m-0 p-0 focus:outline-none cursor-pointer flex items-center justify-center mt-2 self-start",onClick:e},React.createElement(f,{className:"w-4 h-4 text-background-primary"})),className:"[&.Toastify\\_\\_toast-container--top-right]:top-[8rem] [&.Toastify\\_\\_toast-container--top-right]:right-[4rem]",bodyClassName:"bg-nav-active flex-row gap-4 items-start !p-2 [&_:last-child]:w-auto [&_:first-child]:!m-0 [&_:first-child]:mr-auto [&_:first-child]:w-10",toastClassName:"bg-nav-active !p-2 !shadow-xlarge !rounded-lg",transition:o,hideProgressBar:!0}),React.createElement("div",{className:"inner"},a?React.createElement(db,null):n?React.createElement(Cg.Provider,null,React.createElement(Jy,null)):React.createElement(i.Fragment,null,React.createElement(eo,null),React.createElement(wu,null))),React.createElement(mb,null))})));var gb=o(5338);o(4473),document.addEventListener("DOMContentLoaded",(function(){wp.data.subscribe((function(){if(setTimeout((function(){!function(){if(!vb&&!document.querySelector(".edit-post-header-toolbar"))return null;if(document.querySelector("#ast-block-templates-button-wrap"))return null;if(ast_block_template_vars.is_white_label)return null;const e=document.createElement("div");e.id="ast-block-templates-button-wrap";let t=document.querySelector(".edit-post-header-toolbar");t||(t=document.querySelector(".edit-site-header-edit-mode__start")),t?.appendChild(e)}(),yb||function(){if(vb&&!document.getElementById("ast-block-templates-button-wrap"))return null;const e=document.getElementById("ast-block-templates-modal-root");if(document.getElementById("ast-block-templates-button")&&e)return null;const t=document.createElement("div");t.id="ast-block-templates-modal-root",t.classList.add("gt-library-styles");const r=document.createElement("div");r.id="ast-block-templates-modal-wrap",r.classList.add(ast_block_template_vars.popup_class,"p-10","backdrop-blur-sm","bg-border-secondary"),r.innerHTML='
',e||(t.appendChild(r),document.body.appendChild(t));const n=document.getElementById("ast-block-templates-modal");n&&(yb=(0,gb.H)(n),yb.render(React.createElement(fb,null)))}()}),100),(ast_block_template_vars.open_ai_auth||ast_block_template_vars.credit_purchased)&&!hb&&!bb){const e=document.getElementById("ast-block-templates-button");e&&setTimeout((()=>{hb||(e.click(),wb(),ast_block_template_vars.show_onboarding&&ast_block_template_vars.open_ai_auth&&su.emit("open-onboarding-ai"),hb=!0)}),400)}}))}));let hb=!1,yb=null;const bb=(0,y._9)("ast-import"),vb=document.getElementById("site-editor");function wb(){const e=new URL(window.location.href);["ast_action","token","nonce","sc_order","credit_token","email"].forEach((t=>{e.searchParams.has(t)&&e.searchParams.delete(t)}));const t=e.toString();window.history.replaceState({},"",t)}})()})();
Смартфонная версия гэмблинг-платформы для игры с мобильных устройств и планшетных компьютеров. – Complete Life
Skip to content Смартфонная версия гэмблинг-платформы для игры с мобильных устройств и планшетных компьютеров. Развлечение в интернет-казино в наше время реализована из разнообразных точек, а фактически в всяком месте. Для этой задачи достаточно применить смартфонной версией законного интернет-ресурса. С этой платформой подключение к одноруким бандитам будет обеспечен не только дома, но также в городском транспорте, в отдыхе, на свежем воздухе, в обеденный перерыв. Данное даст возможность забирать деньги на виртуальном казино online casino hediyeleri , в тот момент, когда будет время для развлечений.
Мобильная модификация практична так как запускается на смартфонах, iPhone'ах, и планшетах без установки программ. Вход на систему выполняется без посредников через большинство актуальных интернет-браузеров. Этим она выгодно различается от программы, которое сначала нужно загружать и инсталлировать на гаджет.
Специфики использования мобильной версии гэмблинг-платформы. Для проникновения в онлайн гэмблинг-платформу с бонусами этим способом необходимо иметь актуальный гаджет. Подходит почти любой мобильник, айфон или гаджет, изданный за минувшие 5-7 лет. Вид ОС для адаптивной веб-версии не критичен. Вдобавок к современного смартфона, для авторизации на ресурс потребуется стабильный интернет-соединение. Быстрота подключения должна быть начиная с 50 Mbps. Только в конкретном случае будет обеспечено мгновенное и плавное воспроизведение одноруких бандитов.
Нужно ещё убедиться в наличии обновлённого интернет-обозревателя на устройстве. Когда браузер старый, платформа может не открыться на смартфоне или планшете. Функциональный браузер будет подходящим какой угодно, с учетом брендовые Opera, Safari, Mozilla Firefox, Google Chrome. Для входа на портативную модификацию Online Casinolarda игорного заведения следует придерживаться несложной руководства:
Обнаружить актуальный веб-адрес гемблинговой платформы. Щелкнуть по ссылке или вставить ее в строку поиска интернет-обозревателя. Зайти в игорный дом (операция выполняется самостоятельно). Оформить профиль или авторизоваться (прохождение указанных процедур откроет доступ к ставкам на деньги). Линк для логина в веб редакцию приемлема любая. Основное, чтобы данная платформа была рабочей на данный период. Определить релевантность гиперссылки можно лишь по окончании клика на неё. Найти рабочий URL казино просто из систем поиска. Первые по списку веб-адреса из результатов поиска с высокой вероятностью отведут в заведение. Эту информацию ещё возможно потребовать у администрации интернет-казино, написав им через email или через живой чат.
Скачивать и инсталлировать приложения для входа в смартфонную редакцию не требуется. Это дает возможность освободить место на запоминающем устройстве гаджета. Специально конфигурировать браузер не придется. Портативные версии гэмблинг-платформ обычно оснащаются гибким интерфейсом пользователя. Благодаря этому они без труда подстраиваются под экран телефона или планшета. Благодаря подстраивающемуся интерфейса, игровой процесс становится приятным на гаджете с каким угодно размером дисплея.
Каталог услуг для обладателей переносных девайсов не меняется. С телефонов и таблетов можно включать те же игровые автоматы, что с ПК. Полностью равным образом переносятся премии, промоакции, способы платежей, способы входа. Сроки монетарных транзакций остаются неизменными, что на официальном портале. Сыграть в смартфонной варианте полностью защищенно, если определено официальное казино. В подобных учреждениях личные информация пользователей защищаются кодировочными технологиями, а любые переводы выполняются по шифрованным линиям связи.
Регистрация и логин в браузерной версии Открывать учетную запись с мобильного нужно только новым игрокам интернет-казино с поощрениями. Процесс осуществляется аналогично, как на официальном сайте. Часто пользователям доступны три метода данной авторизации: с использованием электронной почты, номера телефона или личного профиля в соцсети. Заключительный вариант – предельно скоростной и практичный. Геймерам необходимо выполнить только четыре этапа:
Попасть внутрь казино онлайн через интернет-навигатор с личного устройства. Открыть регистрационную форму правильной кнопкой в верхней области экрана. Щелкнуть по иконке с соцсетью, в которой существует аккаунт. Авторизоваться на другом сервисе или разрешить объединение сведений. Профиль будет автоматически создан в автоматическом режиме. Интернет-клуб сформирует его вслед за извлечения личной информации из соцсети. На это затрачивается 1-2 секунды. Информация на стороннем ресурсе должны быть достоверными. Впоследствии будущем всякая информация станет подвергаться повторной проверке в процессе верификации. Когда информация не будут подтверждены, пользователь рискует быть заблокированным.
Двойка других варианта разработки аккаунта аналогичны. В процессе регистрации по почте и контактному номеру новым пользователям мобильной версии Online Casinolarda нужно ввести данные в анкету. В неё записываются связные информацию, код доступа и прочие запрашиваемые сведения. Обязательно согласие согласия с регламентом казино. Авторизация в профиль часто доступен только по окончании идентификации указанного средства связи. Электронная почта подтверждается переходом на линку, отправленной из сервака заведения. Телефонный номер мобильного устройства распознается с помощью шифра, который отправляется в СМС. Это необходимо вставить внутрь бланка для учета.
Иногда в портативной версии может понадобиться вход. Эта процесс проверки данных пользователя. Как зачастую, она необходима при обновлении мобильного устройства или линка для логина в казино. Во любой из представленных ситуаций следует в логиновой форме заполнить информацию, использовавшиеся при регистрации. Когда чтобы логина в аккаунт применяется соцсеть, необходимо, чтобы она была идентична той, что применялась при создании профиля. На вход с смартфона у геймеров уходит не более 5 секунд.
Какие развлечения и слоты предлагаются геймерам? В портативной редакции казино предложены те же слоты, что в настольной. Неподключены могут быть только некоторые винтажные автоматы, выпущенные без использования методики HTML5. Прочие аттракционы предоставляются в максимальном спектре. Для удобства нахождения все игровые аппараты сортируют в казино Online Casinolarda по группам, RTP, новизне. В самом большом числе гостям предоставлены слоты. Предлагаются различные этих вариации:
обычные со облегченной механикой; передовые с дополнительными опциями и объемной графикой; с лотереей куша нарастающего типа; со приобретением выигрышных раундов; со большим числом линий. Несмотря на многообразные типы и возможности, все однорукие бандиты в казино аналогичны принципом работы. Оные выдают вознаграждения за создание непрерывных сочетаний из определенного количества одинаковых символов. При появлении специфических знаков запускаются призовые турниры, в этих можно повысить выигранную доход. Наиболее высокие коэффициенты предоставляют новейшие игровые автоматы. У этих также качественнее графика, значительно больше платежных строк и разнообразные истории.
В случае, если на основном портале доступны настольные игры, они будут доступны и в мобильной адаптации. Обычно в ассортимент игорного заведения включаются только наиболее известные типы блэкджека, покера, баккары, и рулетки. Азартные игроки, предпочитающие реалистичность хода игры, отдают предпочтение виртуальные столы с опытными крупье. За ними партия происходит в режиме живьем. Ведущих игроки казино наблюдают в время трансляций в реальном времени из студий для игр. Поиграть в карточные забавы можно ещё в противостоянии с автоматизированных систем. Выходы в данном случае будут создаваться в случайном порядке.
С целью игрового процесса с использованием финансов в мобильной версии требуется создать аккаунт и внести депозит. Затем этого разрешается выбрать и запустить видеоигровой слот из коллекции игр и ставить на кону платные пари. Если выбрали официальное онлайн казино с поощрениями, в его коллекции находятся лишь аутентичные сертифицированные аппараты. Такой софт характеризуется высоким уровнем и генерацией рандомных исходов.
Вознаграждения в смартфонной версии С переносных гаджетов бонусная программа игорного заведения доступна без корректировок. Пользователи забирают и разыгрывают презенты на аналогичных условиях. Новым гостям, какие лишь зарегистрировались и внесли начальный взнос, в мобильной версии Online Casinolarda начисляется приветственный пакет. В него часто предоставляются бесплатные вращения для популярных слот-машин и денежные средства. Число финальных зависит вследствие объема внесенной суммы. Объем бонуса, в большинстве случаев, равен 100% из первоначального вклада. В определённых игорных домах он может быть значительнее в 1,5-2 раза.
Для постоянных клиентов в онлайн версии игорного заведения заготовлены особые призы. Почти неизменно начисляется вознаграждение за постоянные вклады. Пользователям возвращается маленький процент от депонированных средств – от 10% до 20%. На понесенные издержки предоставляется выплата в виде кешбэка. Обычно клиентам возвращают в размере 3%-15% от утраченных денег. Максимальная выплата запланирована для игроков, достигших наивысших статусов во локальной программе лояльности. Величина кэшбэка ещё часто обусловлена от суммы, что потеряно финансов – чем выше убытки, тем значительнее вознаграждение.
С использовании промокода окажется предоставлен дополнительный подарок. Их тип и величина находятся на рассмотрение руководства казино. Для получения предоставленного подарка нужно указать активную секретный код в регистрационном поле. Временами её возможно задействовать в категории со всеми доступными акциями игорного дома. Купон пользователи добывают с разных мест:
с профилей казино в социальных сетях а также в месседжинговых приложениях; из платформ, в которых описаны описания сайта; из поисковых систем. у саппорта казино в веб-чате. Актуальный купон способен использоваться лишь единожды. Для активации прочих экстра бонусов нужно применение новых сочетаний. Необходимо также учитывать, что основная часть бонусов мгновенно на выплату не подлежит. Перед обналичиванием их следует отработать с указанным коэффициентом отыгрыша и остальными ограничениями.
Финансовые операции при игры с мобильного устройства В браузерной версии игорного заведения клиентам допускается задействовать те же способы оплаты, что в десктопной. Полный полный список отображен в секции, где формируются запросы на пополнение и обналичивание средств. В большинстве casino транзакции допускаются с применением:
финансовых карточек (дебетных и кредитных); кошельков с цифровой валютой; онлайн финансовых платформ; счета телефона через телекоммуникационных операторов. Игрокам в Online Casinolarda игорном заведении важно определить способ, который предоставляется в месте жительства. Следует также обратить внимание на пределы и периоды переводов. Наиболее благоприятные обстоятельства обычно предусматриваются при использовании виртуальных и цифровых бумажников. Из этих деньги переводятся мгновенно, а ограничения начинаются с минимальных сумм. Кроме платежного обработчика, в денежной заявке указываются данные. Они обязаны принадлежать непосредственно игроку. После ввода размера ставки следует отправлять форму на обработку. Деньги в смартфонной версии казино зачисляются на ставочный баланс быстро.
Вывод средств как правило происходит больше времени. В многочисленных казино перевод выигрыша требует от нескольких минут до 5 дней. Все определяется от подобранного способа перевода и занятости платежного сервиса. Получение приза произойдет в случае, если игрок ввел те же реквизиты, которые применялись при пополнении баланса. Это одно среди основных правил денежных транзакций на основной массе игровых площадок с слотами. Его используют для поддержания сохранности непосредственно пользователей, чтобы финансы всегда отправлялись в корректном направление. Следует также правильно указать сумму, не нарушив ограничения перевода.
В смартфонных версиях лицензионных гэмблинговых платформ сроки денежных переводов всегда поддерживаются. Ответственность за оперативные и защищенные финансовые транзакции несут платежные платформы. Они осуществляют монетарные сделки с применением систем шифрования – это дает возможность полностью устранить кражу средств.
Какие действия делать в ситуации блокировке версии сайта для мобильных устройств Время от времени вход в игорный дом через веб-обозреватель бывает недоступен. С подобной проблемой имеют возможность наталкиваться на владельцы компьютеров и мобильных устройств. Основание тому – действия надзорных структур в тех самых государствах, где онлайн-ставки находятся под запретом. По их указанию сетевые провайдеры ограничивают доступ к игровые клубы. Такое превращает официальный сайт игорного заведения неработающим. Совместно с этим в ограничение попадает портативная вариант. Данная платформа не сможет запускаться на всех мобильных устройствах, айфонах и планшетах.
Зайти в заблокированное казино онлайн с переносного девайса поможет дубликат сайта. Данная обновленная URL, ссылающаяся на официальный сайт сайт заведения. Хотя на другой URL, она предоставляет те же обслуживание и интерфейс. Применяя дубль-сайт гэмблинг-платформы Online Casinolarda, пользователи смогут:
включать игровые устройства на средства; вносить деньги на счёт и заказывать кэшауты; участвовать в конкурсе крупных призов в турнирах и розыгрышах; общаться с службой поддержки; получать экстра поощрения и преференции за показанную участие. Таким способом, зеркала ни в чем не сдерживают игроков игорного заведения. На данных ресурсах доступны те же возможности для выигрыша, что на главной странице. Разниц внутри дубликатами нет. Любой из них них устройств легко функционирует на телефонах и планшетах. После перехода на действующую URL, копия сайта превратится в адаптированной для мобильных устройств версией. Клиентам разрешено пройти скорую авторизацию для входа к персональному аккаунту.
Помимо резервного домена, для обхода запретов с портативных гаджетов геймеры применяют VPN-расширения. Эти специальные софт, гарантирующие доступ в ограниченное игорное заведение через закрытым линиям. Перед применением этих приложений необходимо скачать и инсталлировать на гаджет. Когда завершатся всех действий на мониторе смартфона отобразится иконка с приложением. После щелчка на нее обычно нужно выбрать зону, из какого будут обходиться блокировки, и включить соединение. Посредством VPN, недоступные линки станут открываться на мобильном устройстве. Минус этого метода в том, что за применение услуги взимается абонентская плата – при отсутствии оплаты, функции приложения окажутся сильно ограничены.
Игра в портативном приложении гэмблинга Помимо указанных ранее методов, пользователи мобильников и таблетов для обхождения блокировок часто используют скачиваемое приложение. Это уникальная аппликация, обеспечивающая проникать в игорный дом в один клик без использования веб-обозревателя. Искать точные ссылки в Сети не нужно. Для перейти на вебсайт необходимо щелкнуть по значку, который отображается на мониторе после инсталляции аппа. Вход будет обеспечен в любой обстановке – для преодоления блокировок в софт часто включаются плагины или автообновляемые альтернативные ссылки. Эти автоматически ищут оптимальный вариант сайта казино для геймера с принимая во внимание региона.
Каталог услуг программы не отличается от смартфонной редакции. В онлайн-казино доступны схожие игры, вознаграждения, чемпионаты, варианты финансовых операций. Разница часто уменьшается лишь к расположению отдельных категорий и элементов на мониторе. Профилем внутри приложении возможно использовать одним и тем же, что внутри браузерной версии. По окончании логина сумма счета не изменится. Свежие игроки гемблингового клуба способны осуществить регистрационный процесс в программе, чтобы войти в игру с опцией вывода призов.
Софт включаются на смартфонах после добавления и установки. На Android приложение скачивается в разделе нужном категории на сайте игорного заведения. Операция обычно проводится типично. В лицензионных казино программы тестируются на неимение вредоносного ПО – устанавливать их на аппарат без риска. Чтобы загрузки приложения, как правило, достаточно 50-100 мегабайт в хранилище девайса. Многие площадки также предоставляют программу для iPhone и iPad с iOS. Для загрузки приложение доступна лишь в App Store.
Приложение характеризуется более высокой скоростью действия, чем мобильного варианта. Скорость сети не обладает существенного влияния. Демонстрационные версии игровых автоматов гости нередко могут активировать даже оффлайн. Нужно только брать в расчет, что софт более капризны к параметрам смартфонов. Они исправно функционируют в основном на новейших девайсах с новыми редакциями операционной системы. Если телефон либо его ОС вышли из моды, софт может функционировать неправильно или вовсе не запускаться. В представленном контексте веб варианты отличаются оптимальной адаптацией с телефонами и гаджетами.
Scroll to Top
Uporabljamo piškotke, da vam zagotovimo najboljšo izkušnjo na naši spletni strani. Ok Politika zasebnosti