stable-diffusion-webui
/
extensions
/sd-webui-infinite-image-browsing
/vue
/dist
/assets
/hook-32698bdc.js
import{bo as A,$ as g,bW as q,bX as x,as as k,ap as D,bP as z,be as G}from"./index-7c0f3f3a.js";import{u as N,b as Q,f as W,c as j,d as H,e as L,h as O}from"./FileItem-39204ab7.js";let T=0;const U=()=>++T,X=(r,l,{dataUpdateStrategy:c="replace"}={})=>{const s=A([""]),u=g(!1),t=g(),a=g(!1);let f=g(-1);const v=new Set,b=e=>{var n;c==="replace"?t.value=e:c==="merge"&&(k((Array.isArray(t.value)||typeof t.value>"u")&&Array.isArray(e),"数据更新策略为合并时仅可用于值为数组的情况"),t.value=[...(n=t==null?void 0:t.value)!==null&&n!==void 0?n:[],...e])},d=e=>x(void 0,void 0,void 0,function*(){if(a.value||u.value&&typeof e>"u")return!1;a.value=!0;const n=U();f.value=n;try{let o;if(typeof e=="number"){if(o=s[e],typeof o!="string")return!1}else o=s[s.length-1];const m=yield r(o);if(v.has(n))return v.delete(n),!1;b(l(m));const i=m.cursor;if((e===s.length-1||typeof e!="number")&&(u.value=!i.has_next,i.has_next)){const I=i.next_cursor||i.next;k(typeof I=="string"),s.push(I)}}finally{f.value===n&&(a.value=!1)}return!0}),h=()=>{v.add(f.value),a.value=!1},w=(e=!1)=>x(void 0,void 0,void 0,function*(){const{refetch:n,force:o}=typeof e=="object"?e:{refetch:e};o&&h(),k(!a.value),s.splice(0,s.length,""),a.value=!1,t.value=void 0,u.value=!1,n&&(yield d())}),p=()=>({next:()=>x(void 0,void 0,void 0,function*(){if(a.value)throw new Error("不允许同时迭代");return{done:!(yield d()),value:t.value}})});return q({abort:h,load:u,next:d,res:t,loading:a,cursorStack:s,reset:w,[Symbol.asyncIterator]:p,iter:{[Symbol.asyncIterator]:p}})},J=r=>A(X(r,l=>l.files,{dataUpdateStrategy:"merge"})),K=r=>{const l=A(new Set),c=D(()=>(r.res??[]).filter(y=>!l.has(y.fullpath))),s=z(),{stackViewEl:u,multiSelectedIdxs:t,stack:a,scroller:f}=N({images:c}).toRefs(),{itemSize:v,gridItems:b,cellWidth:d,onScroll:h}=Q({fetchNext:()=>r.next()}),{showMenuIdx:w}=W(),{onFileDragStart:p,onFileDragEnd:e}=j(),{showGenInfo:n,imageGenInfo:o,q:m,onContextMenuClick:i,onFileItemClick:I}=H({openNext:G}),{previewIdx:C,previewing:F,onPreviewVisibleChange:_,previewImgMove:E,canPreview:M}=L(),P=async(y,S,R)=>{a.value=[{curr:"",files:c.value}],await i(y,S,R)};return O("removeFiles",async({paths:y})=>{y.forEach(S=>l.add(S))}),{images:c,scroller:f,queue:s,iter:r,onContextMenuClickU:P,stackViewEl:u,previewIdx:C,previewing:F,onPreviewVisibleChange:_,previewImgMove:E,canPreview:M,itemSize:v,gridItems:b,showGenInfo:n,imageGenInfo:o,q:m,onContextMenuClick:i,onFileItemClick:I,showMenuIdx:w,multiSelectedIdxs:t,onFileDragStart:p,onFileDragEnd:e,cellWidth:d,onScroll:h}};export{J as c,K as u}; | |