1import $ from"./IkQHT9TU.js";import{_ as v}from"./CcfoF9L9.js";import{_ as C}from"./CNp_S-BQ.js";import{_ as w}from"./CxpPtAc5.js";import{d as j,o,c as n,b as r,e as x,w as q,i as z,t as a,u as e,k as R,f as u,l as g,m as N,F as k,r as y,n as V,q as B,g as I,s as M}from"./ZA0hEcxY.js";import{p as T}from"./I61Jzvju.js";import{f as b}from"./ByfrRg7U.js";import{u as E}from"./BsVcQj1X.js";import"./B86Z2gNS.js";import"./CqkleIqs.js";import"./DENJBKqB.js";import"./R3Dbim9n.js";const F={class:"py-2 text-base"},L={class:"mt-1 flex items-center align-middle text-xl"},O={class:"ml-2 font-sans text-sm uppercase text-granite"},U={key:0,class:"text-sm"},A={class:"after:content-['_|_']"},D={key:1,class:"text-sm capitalize"},P={key:2,class:"text-sm capitalize"},Q={key:3,class:"text-sm capitalize italic before:not-italic before:content-['From_']"},Z={class:"text-sm"},G={class:"font-bold"},H=j({__name:"SearchResult",props:{query:{},result:{}},setup(t){function i(l){return l.replace(/\|/g," ").replace(/(\r\n|\n|\r)/gm," ").replace(/-{3,}/g,"")}const m=l=>{const s=l.object_model.match(/[A-Z][a-z]+/g)?.join(" ");return s==="Creature"?"Monster":l.object?.is_magic_item?"Magic Item":s==="Item"?"Equipment":s==="Character Class"?l?.object?.subclass_of?`${l.object.subclass_of.name} Subclass`:"Class":l?.object?.subspecies_of?`${l.object.subspecies_of.name} Subspecies`:s};return(l,s)=>{const d=v,p=C,h=w;return o(),n("li",F,[r("h3",L,[x(d,{tag:"a",to:e(R)(t.result)},{default:q(()=>[z(a(t.result.object_name),1)]),_:1},8,["to"]),r("span",O,a(m(t.result)),1),x(p,{text:t.result.document.key,title:t.result.document.name},null,8,["text","title"])]),t.result.object_model==="Creature"&&t.result.object?.cr?(o(),n("div",U,[r("span",A,"CR "+a(e(T)(t.result.object.cr)),1),r("span",null,a(`${t.result.object.type} (${t.result.object.size})`),1)])):u("",!0),t.result.object_model==="Spell"&&e(b)(t.result)?(o(),n("div",D,a(e(b)(t.result)),1)):t.result.object_model==="Item"&&t.result.object?.is_magic_item&&e(b)(t.result)?(o(),n("span",P,a(e(b)(t.result)),1)):u("",!0),t.result.object_model==="Rule"?(o(),n("div",Q,a(t.result.object_pk.split("_")[1].split("-").join(" ")),1)):u("",!0),r("div",Z,[s[0]||(s[0]=r("span",{class:"after:content-[':_']"},"Source",-1)),r("span",G,a(t.result.document.name),1)]),t.result.object_name.toUpperCase().includes(t.query.toUpperCase())?u("",!0):(o(),g(h,{key:4,class:"text-sm italic text-granite dark:text-granite",markdown:i(t.result.highlighted??"")},null,8,["markdown"]))])}}}),J={class:"docs-container container"},K={class:"font-sans text-xl font-bold text-slate-400"},W={key:0,class:"h-8"},X={key:1},Y={key:2},ee={key:0,class:"font-thin"},te={key:0},se={key:1,class:"my-2 border-t"},oe={key:2},be=j({__name:"index",setup(t){E({title:"Search"});const i=B("text"),{data:m}=N(i),{sources:l}=M(),s=I(()=>{const h=[],c=[];if(!m||!m.value)return{inScope:h,outScope:c};for(const f of m.value)l.value.includes(f.document.key)?h.push(f):c.push(f);return{inScope:h,outScope:c}}),d=V(!1),p=()=>{d.value=!d.value};return(h,c)=>{const f=$,S=H;return o(),n("section",J,[c[2]||(c[2]=r("h1",null,"Search",-1)),c[3]||(c[3]=r("hr",{class:"mb-8"},null,-1)),r("p",K,[e(m)?e(i)?e(s).inScope?(o(),n("span",Y,[x(f,{name:"majesticons:scroll-line",class:"mr-2 size-8"}),r("span",null,a(e(s).inScope.length)+" results in your sources",1),e(s).outScope.length>0?(o(),n("span",ee," ("+a(e(s).outScope.length)+" in other sources) ",1)):u("",!0)])):u("",!0):(o(),n("span",X,[x(f,{name:"majesticons:search-line",class:"mr-2 size-8"}),c[1]||(c[1]=r("span",null,"Search for something to see results...",-1))])):(o(),n("span",W,"Searching Open5e..."))]),e(s)&&e(s).inScope.length>0?(o(),n("ul",te,[(o(!0),n(k,null,y(e(s).inScope,_=>(o(),g(S,{key:_.object_pk,result:_,query:e(i)},null,8,["result","query"]))),128))])):u("",!0),e(s)&&e(s).outScope.length>0?(o(),n("div",se,[r("button",{class:"mt-2 font-sans text-xl font-bold tracking-wide text-indigo-600 hover:text-blood hover:underline dark:text-indigo-200 dark:hover:text-red",onClick:c[0]||(c[0]=_=>p())},a(e(d)?"Showing ":"Show ")+" "+a(e(s).outScope.length)+" results from other sources ",1)])):u("",!0),e(s)&&e(s).outScope.length>0&&e(d)?(o(),n("ul",oe,[(o(!0),n(k,null,y(e(s).outScope,_=>(o(),g(S,{key:_.object_pk,result:_,query:e(i)},null,8,["result","query"]))),128))])):u("",!0)])}}});
1export{be 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.