import{F as k,r as l,aR as g,c2 as w,ci as S,cj as C,ck as I,a3 as R,aI as V,m as p,bX as K,Q as A,W as B,R as E,X as L,e as M,c3 as T}from"./vendor-BeMjADS_.js";import{J as _}from"./index-Bf5vN7WQ.js";import{b as x}from"./customComponents-BkkEmBS-.js";const X=k({__name:"builder-io",props:{apiKey:{},isVisible:{type:Boolean}},emits:["setState"],setup(o,{emit:m}){const v=m,u=o,t=l(!1),e=l(null),n=l(!1);function f(){e.value=null,t.value=!1,n.value=!1}g(()=>{c(window.location.pathname)}),w((a,d)=>{a.path!==d.path&&(f(),c(a.path))});async function c(a){u.apiKey&&(n.value=!0,s("loading"),e.value=await S({model:"page",apiKey:u.apiKey,options:C(new URLSearchParams(location.search)),userAttributes:{urlPath:a}}),n.value=!1,t.value=!!e.value||I(),t.value?s("ready"):s("empty"))}function s(a){v("setState",{state:a})}const r=R(null),y=V(r),i=p(()=>!!y.value&&!!e.value?.data),b=p(()=>_(e.value?.data?.title).title.value);K({title:()=>i.value?b.value:void 0,keywords:()=>i.value?e.value?.data?.keywords:void 0,description:()=>i.value?e.value?.data?.description:void 0});const h=()=>x;return(a,d)=>o.isVisible&&t.value?(E(),A("div",{key:0,ref_key:"builderIoAnchor",ref:r},[L(M(T),{model:"page",content:e.value,"api-key":o.apiKey,"custom-components":h()},null,8,["content","api-key","custom-components"])],512)):B("",!0)}});export{X as default};
//# sourceMappingURL=builder-io-VRMw-y6J.js.map
