import{M as g,r as i,aM as k,c0 as w,cg as S,ch as V,ci as C,F as K,aG as I,E as p,bV as M,N as _,a8 as A,O as B,X as E,e as R,c1 as L}from"./vendor-CsGITfgk.js";import{K as N}from"./index-CsCqMgta.js";import{b as T}from"./customComponents-CXLINvk3.js";const F=g({__name:"builder-io",props:{apiKey:{},isVisible:{type:Boolean}},emits:["setState"],setup(d,{emit:m}){const v=m,l=d,t=i(!1),a=i(null),o=i(!1);function f(){a.value=null,t.value=!1,o.value=!1}k(()=>{u(window.location.pathname)}),w((e,r)=>{e.path!==r.path&&(f(),u(e.path))});async function u(e){l.apiKey&&(o.value=!0,s("loading"),a.value=await S({model:"page",apiKey:l.apiKey,options:V(new URLSearchParams(location.search)),userAttributes:{urlPath:e}}),o.value=!1,t.value=!!a.value||C(),t.value?s("ready"):s("empty"))}function s(e){v("setState",{state:e})}const c=K(null),y=I(c),n=p(()=>!!y.value&&!!a.value?.data),h=p(()=>N(a.value?.data?.title).title.value);M({title:()=>n.value?h.value:void 0,keywords:()=>n.value?a.value?.data?.keywords:void 0,description:()=>n.value?a.value?.data?.description:void 0});const b=()=>T;return(e,r)=>e.isVisible&&t.value?(B(),_("div",{key:0,ref_key:"builderIoAnchor",ref:c},[E(R(L),{model:"page",content:a.value,"api-key":e.apiKey,"custom-components":b()},null,8,["content","api-key","custom-components"])],512)):A("",!0)}});export{F as default};
//# sourceMappingURL=builder-io-imukhcpW.js.map
