1import{h as g}from"./D105ix7p.js";import{u as C}from"./DD_Kd3MK.js";import{q as v}from"./BzMSdArx.js";import{d as S,t as b,c as _,C as k,a as A,aI as N,I as O}from"./BDcWx1R4.js";import"./DuEPoBOq.js";const Q=S({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(i){const{path:t,only:n,without:f,where:a,sort:o,limit:d,skip:l,locale:s,find:p}=b(i),y=_(()=>{var e;return(e=t.value)==null?void 0:e.includes("/_")}),h=!k().public.content.experimental.advanceQuery;A(()=>i,()=>r(),{deep:!0});const u=e=>h?e!=null&&e.surround?e.surround:e!=null&&e._id||Array.isArray(e)?e:e==null?void 0:e.result:e.result,{data:c,refresh:r}=await C(`content-query-${g(i)}`,()=>{let e;return t.value?e=v(t.value):e=v(),n.value&&(e=e.only(n.value)),f.value&&(e=e.without(f.value)),a.value&&(e=e.where(a.value)),o.value&&(e=e.sort(o.value)),d.value&&(e=e.limit(d.value)),l.value&&(e=e.skip(l.value)),s.value&&(e=e.where({_locale:s.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):e.find().then(u)});return{isPartial:y,data:c,refresh:r}},render(i){var m;const t=N(),{data:n,refresh:f,isPartial:a,path:o,only:d,without:l,where:s,sort:p,limit:y,skip:h,locale:u,find:c}=i,r={path:o,only:d,without:l,where:s,sort:p,limit:y,skip:h,locale:u,find:c};if(r.find==="one"){if(!n&&(t!=null&&t["not-found"]))return t["not-found"]({props:r,...this.$attrs});if(t!=null&&t.empty&&(n==null?void 0:n._type)==="markdown"&&!((m=n==null?void 0:n.body)!=null&&m.children.length))return t.empty({props:r,...this.$attrs})}else if((!n||!n.length)&&t!=null&&t["not-found"])return t["not-found"]({props:r,...this.$attrs});return t!=null&&t.default?t.default({data:n,refresh:f,isPartial:a,props:r,...this.$attrs}):((w,q)=>O("pre",null,JSON.stringify({message:"You should use slots with <ContentQuery>!",slot:w,data:q},null,2)))("default",{data:n,props:r,isPartial:a})}}),P=Q;export{P 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.