import{P as b,t as S,I as g,h as k,b as w}from"./customComponents-twZNGYGk.js";import{K as I,r as l,ap as V,c3 as C,D as K,aE as B,B as p,c4 as _,L as A,a7 as L,M,V as P,b as R}from"./vendor-bSWkQivH.js";import{ap as E}from"./index-Dqv5IkpS.js";const D=I({__name:"builder-io",props:{apiKey:{},isVisible:{type:Boolean}},emits:["setState"],setup(d,{emit:m}){const s=m,u=d,o=l(!1),t=l(null),n=l(!1);function v(){t.value=null,o.value=!1,n.value=!1}V(()=>{r(window.location.pathname)}),C((e,a)=>{e.path!==a.path&&(v(),r(e.path))});async function r(e){u.apiKey&&(n.value=!0,s("setState","loading"),t.value=await b({model:"page",apiKey:u.apiKey,options:S(new URLSearchParams(location.search)),userAttributes:{urlPath:e}}),n.value=!1,o.value=!!t.value||g(),o.value?s("setState","ready"):s("setState","empty"))}const c=K(null),f=B(c),i=p(()=>{var e;return!!f.value&&!!((e=t.value)!=null&&e.data)}),y=p(()=>{var e,a;return E((a=(e=t.value)==null?void 0:e.data)==null?void 0:a.title).title.value});_({title:()=>i.value?y.value:void 0,keywords:()=>{var e,a;return i.value?(a=(e=t.value)==null?void 0:e.data)==null?void 0:a.keywords:void 0},description:()=>{var e,a;return i.value?(a=(e=t.value)==null?void 0:e.data)==null?void 0:a.description:void 0}});const h=()=>w;return(e,a)=>e.isVisible&&o.value?(M(),A("div",{key:0,ref_key:"builderIoAnchor",ref:c},[P(R(k),{model:"page",content:t.value,"api-key":e.apiKey,"custom-components":h()},null,8,["content","api-key","custom-components"])],512)):L("",!0)}});export{D as default};
//# sourceMappingURL=builder-io-C3tnJe78.js.map
