File size: 5,128 Bytes
b173115
1
2
import{d as ne,$ as x,ax as ie,bR as oe,ay as re,al as ue,ai as de,bQ as K,o,y as C,q as N,c as i,r as e,bV as ce,p as d,N as _,m as k,n as r,x as S,v as f,C as h,s as L,t as pe,L as me,U as ve,V as fe,bT as ge,Q as we,R as xe,X as ke}from"./index-7c0f3f3a.js";import{L as he,R as ye,f as Ie,S as be}from"./fullScreenContextMenu-780774ab.js";/* empty css              */import{g as Ce,F as _e}from"./FileItem-39204ab7.js";import{b as P,c as Se,f as $e,u as Me}from"./db-90de1b1b.js";import{c as ze,u as De}from"./hook-32698bdc.js";import"./index-00c5caf5.js";/* empty css              */import"./functionalCallableComp-6d05295c.js";const Re="/infinite_image_browsing/fe-static/assets/regex-a447f877.svg",Ve=["src"],Be={class:"search-bar last"},Fe={class:"form-name"},Ue={class:"hint"},Ee={key:1,class:"preview-switch"},Ae=ne({__name:"SubstrSearch",props:{tabIdx:{},paneIdx:{},searchScope:{}},setup(G){const $=G,c=x(!1),p=x(""),g=x($.searchScope??""),y=ze(a=>{const s={cursor:a,regexp:c.value?p.value:"",surstr:c.value?"":p.value,folder_paths:(g.value??"").split(/,|\n/).map(v=>v.trim()).filter(v=>v)};return $e(s)}),{queue:u,images:n,onContextMenuClickU:M,stackViewEl:O,previewIdx:m,previewing:z,onPreviewVisibleChange:Q,previewImgMove:D,canPreview:R,itemSize:V,gridItems:H,showGenInfo:w,imageGenInfo:B,q:W,multiSelectedIdxs:F,onFileItemClick:X,scroller:U,showMenuIdx:I,onFileDragStart:j,onFileDragEnd:J,cellWidth:Y,onScroll:E}=De(y),t=x();ie(async()=>{t.value=await P(),t.value.img_count&&t.value.expired&&await A(),$.searchScope&&await b()});const A=oe(()=>u.pushAction(async()=>(await Me(),t.value=await P(),t.value)).res),b=async()=>{await y.reset({refetch:!0}),await re(),E(),U.value.scrollToItem(0),n.value.length||ue.info(de("fuzzy-search-noResults"))};K("returnToIIB",async()=>{const a=await u.pushAction(Se).res;t.value.expired=a.expired}),K("searchIndexExpired",()=>t.value&&(t.value.expired=!0));const Z=()=>{c.value=!c.value};return(a,s)=>{const v=ve,T=fe,ee=ge,se=we,te=xe,ae=be;return o(),C("div",{class:"container",ref_key:"stackViewEl",ref:O},[t.value?(o(),C("div",{key:0,class:"search-bar",onKeydown:s[2]||(s[2]=N(()=>{},["stop"]))},[i(v,{value:p.value,"onUpdate:value":s[0]||(s[0]=l=>p.value=l),placeholder:a.$t("fuzzy-search-placeholder")+" "+a.$t("regexSearchEnabledHint"),disabled:!e(u).isIdle,onKeydown:ce(b,["enter"]),"allow-clear":""},null,8,["value","placeholder","disabled","onKeydown"]),d("div",{class:_(["regex-icon",{selected:c.value}]),onKeydown:s[1]||(s[1]=N(()=>{},["stop"])),onClick:Z,title:"Use Regular Expression"},[d("img",{src:e(Re)},null,8,Ve)],34),t.value.expired||!t.value.img_count?(o(),k(T,{key:0,onClick:e(A),loading:!e(u).isIdle,type:"primary"},{default:r(()=>[S(f(t.value.img_count===0?a.$t("generateIndexHint"):a.$t("UpdateIndex")),1)]),_:1},8,["onClick","loading"])):(o(),k(T,{key:1,type:"primary",onClick:b,loading:!e(u).isIdle||e(y).loading,disabled:!p.value&&!g.value},{default:r(()=>[S(f(a.$t("search")),1)]),_:1},8,["loading","disabled"]))],32)):h("",!0),d("div",Be,[d("div",Fe,f(a.$t("searchScope")),1),i(ee,{"auto-size":{maxRows:8},value:g.value,"onUpdate:value":s[3]||(s[3]=l=>g.value=l),placeholder:a.$t("specifiedSearchFolder")},null,8,["value","placeholder"])]),i(ae,{size:"large",spinning:!e(u).isIdle},{default:r(()=>[i(te,{visible:e(w),"onUpdate:visible":s[5]||(s[5]=l=>L(w)?w.value=l:null),width:"70vw","mask-closable":"",onOk:s[6]||(s[6]=l=>w.value=!1)},{cancelText:r(()=>[]),default:r(()=>[i(se,{active:"",loading:!e(W).isIdle},{default:r(()=>[d("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:s[4]||(s[4]=l=>e(pe)(e(B)))},[d("div",Ue,f(a.$t("doubleClickToCopy")),1),S(" "+f(e(B)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),e(n)?(o(),k(e(Ce),{key:0,ref_key:"scroller",ref:U,class:"file-list",items:e(n),"item-size":e(V).first,"key-field":"fullpath","item-secondary-size":e(V).second,gridItems:e(H),onScroll:e(E)},{default:r(({item:l,index:q})=>[i(_e,{idx:q,file:l,"show-menu-idx":e(I),"onUpdate:showMenuIdx":s[7]||(s[7]=le=>L(I)?I.value=le:null),onFileItemClick:e(X),"full-screen-preview-image-url":e(n)[e(m)]?e(me)(e(n)[e(m)]):"","cell-width":e(Y),selected:e(F).includes(q),onContextMenuClick:e(M),onDragstart:e(j),onDragend:e(J),"is-selected-mutil-files":e(F).length>1,onPreviewVisibleChange:e(Q)},null,8,["idx","file","show-menu-idx","onFileItemClick","full-screen-preview-image-url","cell-width","selected","onContextMenuClick","onDragstart","onDragend","is-selected-mutil-files","onPreviewVisibleChange"])]),_:1},8,["items","item-size","item-secondary-size","gridItems","onScroll"])):h("",!0),e(z)?(o(),C("div",Ee,[i(e(he),{onClick:s[8]||(s[8]=l=>e(D)("prev")),class:_({disable:!e(R)("prev")})},null,8,["class"]),i(e(ye),{onClick:s[9]||(s[9]=l=>e(D)("next")),class:_({disable:!e(R)("next")})},null,8,["class"])])):h("",!0)]),_:1},8,["spinning"]),e(z)&&e(n)&&e(n)[e(m)]?(o(),k(Ie,{key:1,file:e(n)[e(m)],idx:e(m),onContextMenuClick:e(M)},null,8,["file","idx","onContextMenuClick"])):h("",!0)],512)}}});const He=ke(Ae,[["__scopeId","data-v-7afef8c2"]]);export{He as default};