import{d as C,aa as w,w as x,A as r,J as s,B as u,j as a,_ as N,P as o,t as c,O as p,C as R,aA as T,K as B,L as V,r as v,g as n,e as q,b as A}from"./index-DOFLUERq.js";import{I as h}from"./iconify-p99pbjf9.js";import{api as E}from"./common-DEIQtiPI.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";const $={class:"search-results"},j={class:"search-header"},F={class:"search-info"},H={class:"search-title"},L={key:0,class:"search-subtitle"},M={key:1,class:"search-subtitle"},z={key:0,class:"loading-container"},D={class:"loading-text"},J={key:1,class:"results-container"},K={class:"results-grid"},O=["onClick"],P={class:"result-header"},G={class:"result-meta"},U={class:"result-type"},W={class:"result-title"},X={class:"result-content"},Y={key:0,class:"result-summary"},Z={class:"result-footer"},Q={key:2,class:"empty-state"},ee={class:"empty-icon"},se={class:"empty-title"},te={class:"empty-description"},ae={key:3,class:"initial-state"},oe={class:"initial-icon"},re={class:"initial-title"},ce={class:"initial-description"},ne=C({__name:"SearchResults",setup(ie){const m=A(),f=q(),g=w(),_=v(""),l=v([]),d=v(!1),y=async e=>{if(!e.trim()){l.value=[];return}d.value=!0;try{const t=await E.call("jingrow.utils.global_search.search",{text:e,start:0,limit:50});t&&t.message?l.value=t.message:l.value=[]}catch(t){console.error("搜索错误:",t),g.error(c("An error occurred during search")),l.value=[]}finally{d.value=!1}};x(()=>m.query.q,e=>{e&&typeof e=="string"&&(_.value=e,y(e))},{immediate:!0});const k=e=>{const{pagetype:t,name:i}=e;t&&i&&f.push(`/app/${t}/${i}`)},b=(e,t)=>e?e.length<=t?e:e.substring(0,t)+"...":"",S=e=>{if(!e)return"";const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""};return(e,t)=>(n(),r("div",$,[s("div",j,[s("div",F,[s("h1",H,[u(a(h),{icon:"tabler:search",class:"title-icon"}),N(" "+o(a(c)("Search Results")),1)]),_.value?(n(),r("p",L,o(a(c)("Search keyword"))+': "'+o(_.value)+'" ',1)):p("",!0),!d.value&&l.value.length>0?(n(),r("p",M,o(a(c)("Found"))+" "+o(l.value.length)+" "+o(a(c)("relevant results")),1)):p("",!0)])]),d.value?(n(),r("div",z,[u(a(T),{size:"large"},{default:R(()=>[s("div",D,o(a(c)("Searching...")),1)]),_:1})])):l.value.length>0?(n(),r("div",J,[s("div",K,[(n(!0),r(B,null,V(l.value,i=>(n(),r("div",{key:i.name,class:"result-card",onClick:le=>k(i)},[s("div",P,[s("div",G,[s("span",U,o(i.pagetype),1)]),s("div",W,o(i.name),1)]),s("div",X,[i.content?(n(),r("p",Y,o(b(S(i.content),200)),1)):p("",!0)]),s("div",Z,[u(a(h),{icon:"tabler:arrow-right",class:"result-arrow"})])],8,O))),128))])])):!d.value&&_.value?(n(),r("div",Q,[s("div",ee,[u(a(h),{icon:"tabler:search-off"})]),s("h3",se,o(a(c)("No relevant results found")),1),s("p",te,o(a(c)("Try using different keywords or check spelling")),1)])):(n(),r("div",ae,[s("div",oe,[u(a(h),{icon:"tabler:search"})]),s("h3",re,o(a(c)("Start searching")),1),s("p",ce,o(a(c)("Enter keywords in the search box above to start searching")),1)]))]))}}),pe=I(ne,[["__scopeId","data-v-ca2e107a"]]);export{pe as default};
