1import{h as q,q as v}from"./CleaqcBB.js";import{e as _,Y as g,a0 as C,X as b,I as S,j as O,$ as Q,v as $}from"./gOzCsuuL.js";import"./Bh0T9ZVI.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:p}=C(a),y=$(()=>t.value?.includes("/_")),h=!b().public.content.experimental.advanceQuery;S(()=>a,()=>n(),{deep:!0});const u=e=>h?e?.surround?e.surround:e?._id||Array.isArray(e)?e:e?.result:e.result,{data:c,refresh:n}=await O(`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})),p.value==="one"?e.findOne().then(u):p.value==="surround"?t.value?h?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:y,data:c,refresh:n}},render(a){const t=g(),{data:r,refresh:o,isPartial:i,path:l,only:s,without:d,where:f,sort:p,limit:y,skip:h,locale:u,find:c}=a,n={path:l,only:s,without:d,where:f,sort:p,limit:y,skip:h,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)=>Q("pre",null,JSON.stringify({message:"You should use slots with <ContentQuery>!",slot:m,data:w},null,2)))("default",{data:r,props:n,isPartial:i})}}),A=k,R=Object.assign(A,{__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.