import{F as g,r as l,aN as k,c1 as w,ch as S,ci as C,cj as K,a3 as V,aH as I,m as p,bW as R,Q as A,W as B,R as E,X as L,e as M,c2 as N}from"./vendor-d3O24IFR.js";import{K as T}from"./index-DHcvdVIa.js";import{b as _}from"./customComponents-9vLpJ2ou.js";const W=g({__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}k(()=>{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||K(),t.value?s("ready"):s("empty"))}function s(a){v("setState",{state:a})}const r=V(null),y=I(r),i=p(()=>!!y.value&&!!e.value?.data),h=p(()=>T(e.value?.data?.title).title.value);R({title:()=>i.value?h.value:void 0,keywords:()=>i.value?e.value?.data?.keywords:void 0,description:()=>i.value?e.value?.data?.description:void 0});const b=()=>_;return(a,d)=>o.isVisible&&t.value?(E(),A("div",{key:0,ref_key:"builderIoAnchor",ref:r},[L(M(N),{model:"page",content:e.value,"api-key":o.apiKey,"custom-components":b()},null,8,["content","api-key","custom-components"])],512)):B("",!0)}});export{W as default};
//# sourceMappingURL=builder-io-Jg7L5yWH.js.map
