1import{h as q,q as v}from"./GZ5kjSQm.js";import{d as _,ay as g,aA as C,al as S,G as b,y as A,S as O,q as Q}from"./1BEqaQKX.js";import"./DXIILEQB.js";const k=_({name:"ContentQuery",props:{path:{type:String,required:!1,default:void 0},only:{type:Array,required:!1,default:void 0},without:{type:Array,required:!1,default:void 0},where:{type:Object,required:!1,default:void 0},sort:{type:Object,required:!1,default:void 0},limit:{type:Number,required:!1,default:void 0},skip:{type:Number,required:!1,default:void 0},locale:{type:String,required:!1,default:void 0},find:{type:String,required:!1,default:void 0}},async setup(a){const{path:t,only:r,without:o,where:i,sort:l,limit:s,skip:d,locale:f,find:y}=C(a),h=Q(()=>t.value?.includes("/_")),p=!S().public.content.experimental.advanceQuery;b(()=>a,()=>n(),{deep:!0});const u=e=>p?e?.surround?e.surround:e?._id||Array.isArray(e)?e:e?.result:e.result,{data:c,refresh:n}=await A(`content-query-${q(a)}`,()=>{let e;return t.value?e=v(t.value):e=v(),r.value&&(e=e.only(r.value)),o.value&&(e=e.without(o.value)),i.value&&(e=e.where(i.value)),l.value&&(e=e.sort(l.value)),s.value&&(e=e.limit(s.value)),d.value&&(e=e.skip(d.value)),f.value&&(e=e.where({_locale:f.value})),y.value==="one"?e.findOne().then(u):y.value==="surround"?t.value?p?e.findSurround(t.value):e.withSurround(t.value).findOne().then(u):(console.warn("[Content] Surround queries requires `path` prop to be set."),console.warn("[Content] Query without `path` will return regular `find()` results."),e.find().then(u)):e.find().then(u)});return{isPartial:h,data:c,refresh:n}},render(a){const t=g(),{data:r,refresh:o,isPartial:i,path:l,only:s,without:d,where:f,sort:y,limit:h,skip:p,locale:u,find:c}=a,n={path:l,only:s,without:d,where:f,sort:y,limit:h,skip:p,locale:u,find:c};if(n.find==="one"){if(!r&&t?.["not-found"])return t["not-found"]({props:n,...this.$attrs});if(t?.empty&&r?._type==="markdown"&&!r?.body?.children.length)return t.empty({props:n,...this.$attrs})}else if((!r||!r.length)&&t?.["not-found"])return t["not-found"]({props:n,...this.$attrs});return t?.default?t.default({data:r,refresh:o,isPartial:i,props:n,...this.$attrs}):((m,w)=>O("pre",null,JSON.stringify({message:"You should use slots with <ContentQuery>!",slot:m,data:w},null,2)))("default",{data:r,props:n,isPartial:i})}}),N=k,R=Object.assign(N,{__name:"ContentQuery"});export{R as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.