PageSourceSearch

https://app.moegirl.org.cn/wiki/skins/MoeSkin/dist/search-nmCewiFg.js

js moegirl.org.cn collected 2026-09-24 18:25:26 UTC 2,396 bytes, 1 lines download raw bytes

1import{A as e,D as t,Mt as n,Nt as r,Tt as i,V as a,Z as o,et as s,f as c,i as l,p as u,r as d,t as f,wt as p,x as m}from"./mediawiki-Be-TfMdb.js";import{t as h}from"./Icon-B3FzFBN_.js";import{t as g}from"./msg-DnWM0JAp.js";import{t as _}from"./constants-BVykCNbK.js";function v(e,t){return o({render(){return s(`svg`,{class:`moe-custom-icon`,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:e},[s(`path`,{fill:`currentColor`,d:t})])}})}function y(e,t){return()=>s(h,t,{default:()=>s(e)})}var b=e(`search`,()=>{let e=l().pageData,o=g(),s=d(),h=e=>(e=e?.toString()?.trim()||``,e?y(e)?e:`"${e}"`:``),v=[`"`,`fulltext:`,`intitle:`,`inlanguage:`,`incategory:`,`insource:`,`intemplate:`,`innamespace:`],y=e=>v.some(t=>e.includes(t)),b=n(e.search),x=t(b,1500),S=a(()=>x.value?.toString()?.trim()||``),C=n(!1),w=a(()=>b.value?``:o.get(C.value?`moeskin-search-input-placeholder-focus`:`moeskin-search-input-placeholder`));i(()=>{document.body.classList[C.value?`add`:`remove`](`moe-advanced-search-focused`)});let T=m(_.searchHistory,[]),E=r([]),D=n(!1),O=n(!1),k=n(``),A=n(0),j=n(-1);function M(e){return!e||e.trim()===``||(T.value=[...new Set([e,...T.value])].slice(0,10)),T.value}function N(e){return T.value=T.value.filter(t=>t!==e),T.value}let P=()=>{j.value=-1,k.value=``,O.value=!1,E.value=[],D.value=!1,A.value=0};p(b,e=>{e||P()}),p(S,async e=>{e?I(e):P()});function F(e){let t=new Set;for(let n of e)for(let e of n.subPages)t.add(e.entryTitle);return t.size===0?e:e.filter(e=>!t.has(e.entryTitle))}let I=async e=>{P(),D.value=!0,k.value=``,j.value=-1;try{let t=await L(e);if(e!==S.value)return;t.totalSize===0?(O.value=!0,A.value=0,E.value=[]):(E.value=F(t.page),A.value=t.totalSize)}catch{k.value=o.get(`moeskin-search-error`)}finally{D.value=!1}};async function L(e){if(!e||e.trim()===``)return u.create({page:[],totalSize:0});let{response:t}=await s.moepad.searchEntry({searchText:e,searchOffset:0,pageSize:10,searchType:c.NEAR_MATCH});return t}function R(t,n){return f().getUrl(e.searchtitle,{...n,search:t})}function z(e,t){return e=h(e),R(e,{...t,fulltext:`1`})}return{inputValue:b,inputPlaceholder:w,inputIsFocused:C,activeIndex:j,errorMessage:k,historyList:T,isResultEmpty:O,isLoading:D,resultList:E,totalHits:A,addHistory:M,removeHistory:N,fetchSearchResults:L,handleInputChange:I,getSearchUrl:R,getSearchMoreUrl:z}});export{y as n,v as r,b as t};

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.