import{bY as gt,n as ge,bf as ot,c,A as ce,bZ as X,y as Z,z as T,m as ie,x as Pe,b_ as Ge,b$ as ht,bN as Te,R as pe,ai as se,c0 as yt,r as K,N as Se,c1 as st,G as Xe,ad as ae,c2 as _t,c3 as wt,V as C,ac as bt,c4 as Fe,O as ye,K as kt,c5 as Ot,J as me,c6 as Et,c7 as Lt,bX as $t,c8 as Pt,c9 as St,q as Ie,ca as Ft,cb as xe,o as it,ax as It,$ as Ae,I as Ce,ak as xt,E as Q,cc as Ct,cd as Mt,Q as Dt,d as rt,ce as Tt,cf as At,S as k,T as x,a2 as g,Y as B,U as A,a0 as oe,a1 as b,cg as zt,X as Y,W as E,a6 as ve,ae as Ye,a5 as jt,a4 as _e,ch as Oe,a3 as Nt,aj as Wt,ci as Bt,cj as Ht,M as Ut,aL as Vt,ck as qt,cl as Gt,aN as Xt,aO as Yt,Z as ct}from"./index-e0ccda42.js";import{u as he,e as Me,g as W,f as Ke,h as te,r as Kt,t as Ee,i as Jt,s as Je,j as we,_ as Qt}from"./FileItem-3efa541f.js";import{M as ut,c as dt,m as De,b as Zt,d as Rt,e as en}from"./functionalCallableComp-b00f52ee.js";import{C as tn,g as nn}from"./shortcut-65bf6cf3.js";/* empty css */import{_ as ln}from"./index-acc0f8a0.js";import{D as an}from"./index-6f43ab9c.js";var on="Expected a function";function sn(e,t,n){var l=!0,i=!0;if(typeof e!="function")throw new TypeError(on);return gt(n)&&(l="leading"in n?!!n.leading:l,i="trailing"in n?!!n.trailing:i),ge(e,t,{leading:l,maxWait:t,trailing:i})}const re=(...e)=>{document.addEventListener(...e),ot(()=>document.removeEventListener(...e))};var rn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 000 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0013.5-4.7L863.9 169a7.9 7.9 0 00-8.9-8.9zM416.6 562.3a8.03 8.03 0 00-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 00-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"}}]},name:"arrows-alt",theme:"outlined"};const cn=rn;function Qe(e){for(var t=1;t{const e=Array.from(document.querySelectorAll(".ant-image-preview-wrap")).find(t=>t.style.display!=="none");e?(console.log("closeImageFullscreenPreview success"),xn(e)):console.log("closeImageFullscreenPreview not found")};function xn(e){if(!(e instanceof HTMLElement))throw new Error("The provided value is not an HTMLElement.");const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0,target:e});e.dispatchEvent(t)}const Cn=(e,t)=>{const n=t.querySelector(`.idx-${e} .ant-image-img`);n?n.click():console.log("openImageFullscreenPreview error: not found",e,t)};function Sl(e){const{previewIdx:t,eventEmitter:n,canLoadNext:l,previewing:i,sortedFiles:u,scroller:S,props:M}=he().toRefs(),{state:F}=he();let y=null;const _=(w,d)=>{var r;i.value=w,y!=null&&!w&&d&&((r=S.value)==null||r.scrollToItem(y),y=null)},I=()=>{if(!$("next")){if(e!=null&&e.loadNext)return e.loadNext();M.value.mode==="walk"&&l.value&&(Z.info(T("loadingNextFolder")),n.value.emit("loadNextDir",!0))}};re("keydown",w=>{var d;if(i.value){let r=t.value;if(["ArrowDown","ArrowRight"].includes(w.key))for(r++;u.value[r]&&!X(u.value[r].name);)r++;else if(["ArrowUp","ArrowLeft"].includes(w.key))for(r--;u.value[r]&&!X(u.value[r].name);)r--;if(X((d=u.value[r])==null?void 0:d.name)??""){t.value=r;const P=S.value;P&&!(r>=P.$_startIndex&&r<=P.$_endIndex)&&(y=r)}I()}});const h=w=>{var r;let d=t.value;if(w==="next")for(d++;u.value[d]&&!X(u.value[d].name);)d++;else if(w==="prev")for(d--;u.value[d]&&!X(u.value[d].name);)d--;if(X((r=u.value[d])==null?void 0:r.name)??""){t.value=d;const P=S.value;P&&!(d>=P.$_startIndex&&d<=P.$_endIndex)&&(y=d)}I()},$=w=>{var r;let d=t.value;if(w==="next")for(d++;u.value[d]&&!X(u.value[d].name);)d++;else if(w==="prev")for(d--;u.value[d]&&!X(u.value[d].name);)d--;return X((r=u.value[d])==null?void 0:r.name)};return Me("removeFiles",async()=>{i.value&&!F.sortedFiles[t.value]&&be()}),{previewIdx:t,onPreviewVisibleChange:_,previewing:i,previewImgMove:h,canPreview:$}}function Le(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!yt(e)}function Fl(){const{currLocation:e,sortedFiles:t,currPage:n,multiSelectedIdxs:l,eventEmitter:i,walker:u}=he().toRefs(),S=()=>{l.value=[]};return re("click",()=>{W.keepMultiSelect||S()}),re("blur",()=>{W.keepMultiSelect||S()}),ie(n,S),{onFileDragStart:(_,I)=>{const h=Pe(t.value[I]);Ke.fileDragging=!0,console.log("onFileDragStart set drag file ",_,I,h);const $=[h];let w=h.type==="dir";if(l.value.includes(I)){const r=l.value.map(P=>t.value[P]);$.push(...r),w=r.some(P=>P.type==="dir")}const d={includeDir:w,loc:e.value||"search-result",path:Ge($,"fullpath").map(r=>r.fullpath),nodes:Ge($,"fullpath"),__id:"FileTransferData"};_.dataTransfer.setData("text/plain",JSON.stringify(d))},onDrop:async _=>{if(u.value)return;const I=ht(_);if(!I)return;const h=e.value;if(I.loc===h)return;const $=Te(),w=async()=>$.pushAction(async()=>{await dt(I.path,h),i.value.emit("refresh"),pe.destroyAll()}),d=()=>$.pushAction(async()=>{await De(I.path,h),te.emit("removeFiles",{paths:I.path,loc:I.loc}),i.value.emit("refresh"),pe.destroyAll()});pe.confirm({title:T("confirm")+"?",width:"60vw",content:()=>{let r,P,D;return c("div",null,[c("div",null,[`${T("moveSelectedFilesTo")} ${h}`,c("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[I.path.map(L=>c("li",null,[L.split(/[/\\]/).pop()]))])]),c(ut,null,null),c("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},class:"actions"},[c(se,{onClick:pe.destroyAll},Le(r=T("cancel"))?r:{default:()=>[r]}),c(se,{type:"primary",loading:!$.isIdle,onClick:w},Le(P=T("copy"))?P:{default:()=>[P]}),c(se,{type:"primary",loading:!$.isIdle,onClick:d},Le(D=T("move"))?D:{default:()=>[D]})])])},maskClosable:!0,wrapClassName:"hidden-antd-btns-modal"})},multiSelectedIdxs:l,onFileDragEnd:()=>{Ke.fileDragging=!1}}}function Il({openNext:e}){const t=K(!1),n=K(""),{sortedFiles:l,previewIdx:i,multiSelectedIdxs:u,stack:S,currLocation:M,spinning:F,previewing:y,stackViewEl:_,eventEmitter:I,props:h,deletedFiles:$}=he().toRefs(),w=Xe;Me("removeFiles",({paths:L,loc:o})=>{w(o)!==w(M.value)||!Se(S.value)||(L.forEach(v=>$.value.add(v)),L.filter(X).forEach(v=>$.value.add(v.replace(/\.\w+$/,".txt"))))}),Me("addFiles",({files:L,loc:o})=>{if(w(o)!==w(M.value))return;const m=Se(S.value);m&&m.files.unshift(...L)});const d=Te(),r=async(L,o,m)=>{i.value=m,W.fullscreenPreviewInitialUrl=ae(o);const v=u.value.indexOf(m);if(L.shiftKey){if(v!==-1)u.value.splice(v,1);else{u.value.push(m),u.value.sort((z,U)=>z-U);const N=u.value[0],q=u.value[u.value.length-1];u.value=Kt(N,q+1)}L.stopPropagation()}else L.ctrlKey||L.metaKey?(v!==-1?u.value.splice(v,1):u.value.push(m),L.stopPropagation()):await e(o)},P=async(L,o,m)=>{var R,ne,de;const v=ae(o),N=M.value,q={IIB_container_id:parent.IIB_container_id},z=()=>{let f=[];return u.value.includes(m)?f=u.value.map(p=>l.value[p]):f.push(o),f},U=async f=>{if(!F.value)try{F.value=!0,await Pt(o.fullpath),we.postMessage({...q,event:"click_hidden_button",btnEleId:"iib_hidden_img_update_trigger"}),await St(),we.postMessage({...q,event:"click_hidden_button",btnEleId:`iib_hidden_tab_${f}`})}catch(p){console.error(p),Z.error("发送图像失败,请携带console的错误消息找开发者")}finally{F.value=!1}},H=`${L.key}`;if(H.startsWith("toggle-tag-")){const f=+H.split("toggle-tag-")[1],{is_remove:p}=await _t({tag_id:f,img_path:o.fullpath}),a=(ne=(R=W.conf)==null?void 0:R.all_custom_tags.find(s=>s.id===f))==null?void 0:ne.name;await Ee.refreshTags([o.fullpath]),Z.success(T(p?"removedTagFromImage":"addedTagToImage",{tag:a}));return}else if(H.startsWith("batch-add-tag-")||H.startsWith("batch-remove-tag-")){const f=+H.split("-tag-")[1],p=H.includes("add")?"add":"remove",a=z().map(s=>s.fullpath);await wt({tag_id:f,img_paths:a,action:p}),await Ee.refreshTags(a),Z.success(T(p==="add"?"addCompleted":"removeCompleted"));return}else if(H.startsWith("copy-to-")){const f=H.split("copy-to-")[1],p=z(),a=p.map(s=>s.fullpath);await dt(a,f,!0),te.emit("addFiles",{files:p,loc:f}),Z.success(T("copySuccess"));return}else if(H.startsWith("move-to-")){const f=H.split("move-to-")[1],p=z(),a=p.map(s=>s.fullpath);await De(a,f,!0),te.emit("removeFiles",{paths:a,loc:M.value}),te.emit("addFiles",{files:p,loc:f}),Z.success(T("moveSuccess"));return}switch(L.key){case"previewInNewWindow":return window.open(v);case"copyFilePath":return me(o.fullpath);case"saveSelectedAsJson":return $t(z());case"openWithDefaultApp":return Lt(o.fullpath);case"download":{const f=z();Et(f.map(p=>ae(p,!0)));break}case"copyPreviewUrl":return me(parent.document.location.origin+v);case"rename":{let f=await Zt(o.fullpath);f=Xe(f);const p=Ee.tagMap;p.set(f,p.get(o.fullpath)??[]),p.delete(o.fullpath),o.fullpath=f,o.name=f.split(/[\\/]/).pop()??"";return}case"send2txt2img":return U("txt2img");case"send2img2img":return U("img2img");case"send2inpaint":return U("inpaint");case"send2extras":return U("extras");case"send2savedDir":{const f=W.quickMovePaths.find(s=>s.key==="outdir_save");if(!f)return Z.error(T("unknownSavedDir"));const p=Ot(f.dir,(de=W.conf)==null?void 0:de.sd_cwd),a=z();await De(a.map(s=>s.fullpath),p,!0),te.emit("removeFiles",{paths:a.map(s=>s.fullpath),loc:M.value}),te.emit("addFiles",{files:a,loc:p});break}case"send2controlnet-img2img":case"send2controlnet-txt2img":{const f=L.key.split("-")[1];we.postMessage({...q,event:"send_to_control_net",type:f,url:ae(o)});break}case"send2outpaint":{n.value=await d.pushAction(()=>Fe(o.fullpath)).res;const[f,p]=(n.value||"").split(` `);we.postMessage({...q,event:"send_to_outpaint",url:ae(o),prompt:f,negPrompt:p.slice(17)});break}case"openWithWalkMode":{Je.set(N,S.value);const f=W.tabList[h.value.tabIdx],p={type:"local",key:ye(),path:o.fullpath,name:T("local"),stackKey:N,mode:"walk"};f.panes.push(p),f.key=p.key;break}case"openFileLocationInNewTab":case"openInNewTab":{const f=W.tabList[h.value.tabIdx],p={type:"local",key:ye(),path:L.key==="openInNewTab"?o.fullpath:kt(o.fullpath),name:T("local"),mode:"scanned-fixed"};f.panes.push(p),f.key=p.key;break}case"openOnTheRight":{Je.set(N,S.value);let f=W.tabList[h.value.tabIdx+1];f||(f={panes:[],key:"",id:ye()},W.tabList[h.value.tabIdx+1]=f);const p={type:"local",key:ye(),path:o.fullpath,name:T("local"),stackKey:N};f.panes.push(p),f.key=p.key;break}case"send2BatchDownload":{Jt.addFiles(z());break}case"viewGenInfo":{t.value=!0,n.value=await d.pushAction(()=>Fe(o.fullpath)).res;break}case"openWithLocalFileBrowser":{await bt(o.fullpath);break}case"deleteFiles":{const f=z(),p=async()=>{const a=f.map(s=>s.fullpath);if(await Rt(a),Z.success(T("deleteSuccess")),y.value){const s=ae(o)===W.fullscreenPreviewInitialUrl,ee=i.value===l.value.length-1;if((s||ee)&&(be(),await Ie(100),s&&l.value.length>1)){const J=i.value;Ie(0).then(()=>Cn(J,_.value))}}te.emit("removeFiles",{paths:a,loc:M.value})};if(f.length===1&&W.ignoredConfirmActions.deleteOneOnly)return p();await new Promise(a=>{pe.confirm({title:T("confirmDelete"),maskClosable:!0,width:"60vw",content:()=>c("div",null,[c("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[f.map(s=>c("li",null,[s.fullpath.split(/[/\\]/).pop()]))]),c(ut,null,null),c(tn,{checked:W.ignoredConfirmActions.deleteOneOnly,"onUpdate:checked":s=>W.ignoredConfirmActions.deleteOneOnly=s},{default:()=>[T("deleteOneOnlySkipConfirm"),C(" ("),T("resetOnGlobalSettingsPage"),C(")")]})]),async onOk(){await p(),a()}})});break}}return{}},{isOutside:D}=st(_);return re("keydown",L=>{var m,v,N;const o=nn(L);if(y.value){o==="Esc"&&be();const q=(m=Object.entries(W.shortcut).find(z=>z[1]===o&&z[1]))==null?void 0:m[0];if(q){L.stopPropagation(),L.preventDefault();const z=i.value,U=l.value[z];switch(q){case"delete":return P({key:"deleteFiles"},U,z);case"download":return P({key:"download"},U,z);default:{const H=(v=/^toggle_tag_(.*)$/.exec(q))==null?void 0:v[1],R=(N=W.conf)==null?void 0:N.all_custom_tags.find(ne=>ne.name===H);return R?P({key:`toggle-tag-${R.id}`},U,z):void 0}}}}else!D.value&&["Ctrl + KeyA","Cmd + KeyA"].includes(o)&&(L.preventDefault(),L.stopPropagation(),I.value.emit("selectAll"))}),{onFileItemClick:r,onContextMenuClick:P,showGenInfo:t,imageGenInfo:n,q:d}}const $e=new Map,xl=()=>{const{useEventListen:e,sortedFiles:t,getViewableAreaFiles:n}=he().toRefs(),l=K(W.defaultChangeIndchecked),i=K(W.defaultSeedChangeChecked),u=async()=>{if(await Ie(100),!l.value)return;const F=n.value().filter(_=>X(_.fullpath)&&!_.gen_info_obj);if(!F.length)return;const y=await Ft(F.map(_=>_.fullpath).filter(_=>!$e.has(_)));F.forEach(_=>{const I=y[_.fullpath]||$e.get(_.fullpath)||"";$e.set(_.fullpath,I),_.gen_info_obj=xe(I),_.gen_info_raw=I})};e.value("viewableAreaFilesChange",u);const S=F=>{const y=t.value;return[F,i.value,y[F-1],y[F],y[F+1]]};function M(F,y,_,I){const h={diff:{},empty:!0,ownFile:"",otherFile:""};if(y+_<0||y+_>=t.value.length||t.value[y]==null||!("gen_info_obj"in t.value[y])||!("gen_info_obj"in t.value[y+_]))return h;const $=F,w=t.value[y+_].gen_info_obj;if(w==null)return h;const d=["hashes","resources"];h.diff={},h.ownFile=I.name,h.otherFile=t.value[y+_].name,h.empty=!1,i.value||d.push("seed");for(const r in $)if(!d.includes(r)){if(!(r in w)){h.diff[r]="+";continue}if($[r]!=w[r])if(r.includes("rompt")&&$[r]!=""&&w[r]!=""){const P=$[r].split(","),D=w[r].split(",");let L=0;for(const o in P)P[o]!=D[o]&&L++;h.diff[r]=L}else h.diff[r]=[$[r],w[r]]}return h}return{getGenDiff:M,changeIndchecked:l,seedChangeChecked:i,getRawGenParams:()=>u(),getGenDiffWatchDep:S}};function Mn(e,t,n,l){let i=0,u=0,S=typeof(l==null?void 0:l.width)=="number"?l.width:0,M=typeof(l==null?void 0:l.height)=="number"?l.height:0,F=typeof(l==null?void 0:l.left)=="number"?l.left:0,y=typeof(l==null?void 0:l.top)=="number"?l.top:0,_=!1;const I=o=>{o.stopPropagation(),o.preventDefault(),!(!e.value||!t.value)&&(i=o instanceof MouseEvent?o.clientX:o.touches[0].clientX,u=o instanceof MouseEvent?o.clientY:o.touches[0].clientY,S=e.value.offsetWidth,M=e.value.offsetHeight,t.value.offsetLeft,t.value.offsetTop,document.documentElement.addEventListener("mousemove",h),document.documentElement.addEventListener("touchmove",h),document.documentElement.addEventListener("mouseup",$),document.documentElement.addEventListener("touchend",$))},h=o=>{if(!e.value||!t.value)return;let m=S+((o instanceof MouseEvent?o.clientX:o.touches[0].clientX)-i),v=M+((o instanceof MouseEvent?o.clientY:o.touches[0].clientY)-u);e.value.offsetLeft+m>window.innerWidth&&(m=window.innerWidth-e.value.offsetLeft),e.value.offsetTop+v>window.innerHeight&&(v=window.innerHeight-e.value.offsetTop),e.value.style.width=`${m}px`,e.value.style.height=`${v}px`,l!=null&&l.onResize&&l.onResize(m,v)},$=()=>{document.documentElement.removeEventListener("mousemove",h),document.documentElement.removeEventListener("touchmove",h),document.documentElement.removeEventListener("mouseup",$),document.documentElement.removeEventListener("touchend",$)},w=o=>{o.stopPropagation(),o.preventDefault(),!(!e.value||!n.value)&&(_=!0,F=e.value.offsetLeft,y=e.value.offsetTop,i=o instanceof MouseEvent?o.clientX:o.touches[0].clientX,u=o instanceof MouseEvent?o.clientY:o.touches[0].clientY,document.documentElement.addEventListener("mousemove",d),document.documentElement.addEventListener("touchmove",d),document.documentElement.addEventListener("mouseup",r),document.documentElement.addEventListener("touchend",r))},d=o=>{if(!e.value||!n.value||!_)return;const m=F+((o instanceof MouseEvent?o.clientX:o.touches[0].clientX)-i),v=y+((o instanceof MouseEvent?o.clientY:o.touches[0].clientY)-u);m<0?e.value.style.left="0px":m+e.value.offsetWidth>window.innerWidth?e.value.style.left=`${window.innerWidth-e.value.offsetWidth}px`:e.value.style.left=`${m}px`,v<0?e.value.style.top="0px":v+e.value.offsetHeight>window.innerHeight?e.value.style.top=`${window.innerHeight-e.value.offsetHeight}px`:e.value.style.top=`${v}px`,l!=null&&l.onDrag&&l.onDrag(m,v)},r=()=>{_=!1,document.documentElement.removeEventListener("mousemove",d),document.documentElement.removeEventListener("touchmove",d),document.documentElement.removeEventListener("mouseup",r),document.documentElement.removeEventListener("touchend",r)},P=()=>{if(!e.value||!t.value)return;let o=e.value.offsetLeft,m=e.value.offsetTop,v=e.value.offsetWidth,N=e.value.offsetHeight;o+v>window.innerWidth&&(o=window.innerWidth-v,o<0&&(o=0,v=window.innerWidth)),m+N>window.innerHeight&&(m=window.innerHeight-N,m<0&&(m=0,N=window.innerHeight)),e.value.style.left=`${o}px`,e.value.style.top=`${m}px`,e.value.style.width=`${v}px`,e.value.style.height=`${N}px`},D=()=>{!e.value||!l||(typeof l.width=="number"&&(e.value.style.width=`${l.width}px`),typeof l.height=="number"&&(e.value.style.height=`${l.height}px`),typeof l.left=="number"&&(e.value.style.left=`${l.left}px`),typeof l.top=="number"&&(e.value.style.top=`${l.top}px`),P(),window.addEventListener("resize",P))},L=()=>{document.documentElement.removeEventListener("mousemove",h),document.documentElement.removeEventListener("touchmove",h),document.documentElement.removeEventListener("mouseup",$),document.documentElement.removeEventListener("touchend",$),document.documentElement.removeEventListener("mousemove",d),document.documentElement.removeEventListener("touchmove",d),document.documentElement.removeEventListener("mouseup",r),document.documentElement.removeEventListener("touchend",r),window.removeEventListener("resize",P)};return it(D),ot(L),ie(()=>l==null?void 0:l.disbaled,async o=>{await It(),o!==void 0&&(o?L():D())}),ie(()=>[e.value,t.value,n.value],([o,m,v])=>{o&&m&&(m.addEventListener("mousedown",I),m.addEventListener("touchstart",I)),o&&v&&(v.addEventListener("mousedown",w),v.addEventListener("touchstart",w))}),{handleResizeMouseDown:I,handleDragMouseDown:w}}let lt=null;const Dn=()=>{var F,y;const e=Ae(),t=Ce(Dt+"fullscreen_layout",{enable:!1,panelWidth:384,alwaysOn:!0}),n=xt(lt??((y=(F=e.conf)==null?void 0:F.app_fe_setting)==null?void 0:y.fullscreen_layout)??Pe(t.value)),l="--iib-lr-layout-info-panel-width",i=Q(()=>n.alwaysOn&&n.enable?n.panelWidth:0);ie(n,_=>{t.value=Pe(_),at(n,l,i),Tn(n),lt=n},{deep:!0}),it(()=>at(n,l,i));const{enable:u,panelWidth:S,alwaysOn:M}=Ct(n);return{state:n,isLeftRightLayout:u,panelwidtrhStyleVarName:l,lrLayoutInfoPanelWidth:S,lrMenuAlwaysOn:M}},Tn=ge(e=>Mt("fullscreen_layout",e),300),at=ge((e,t,n)=>{e.enable?(document.body.classList.add("fullscreen-lr-layout"),document.documentElement.style.setProperty(t,`${e.panelWidth}px`),document.documentElement.style.setProperty("--iib-lr-layout-container-offset",`${n.value}px`)):(document.documentElement.style.removeProperty(t),document.documentElement.style.removeProperty("--iib-lr-layout-container-offset"),document.body.classList.remove("fullscreen-lr-layout"))},300),ue=e=>(Xt("data-v-d41c2ac4"),e=e(),Yt(),e),An={key:0},zn={class:"container"},jn={class:"action-bar"},Nn=["title"],Wn=["title"],Bn=["title"],Hn=["src"],Un={key:0,class:"icon",style:{cursor:"pointer"}},Vn={key:2,"flex-placeholder":""},qn={key:3,class:"action-bar"},Gn={key:0,class:"gen-info"},Xn={class:"info-tags"},Yn={class:"name"},Kn={class:"value"},Jn={key:0,class:"tags-container"},Qn=["onClick"],Zn={class:"lr-layout-control"},Rn={class:"ctrl-item"},el={class:"ctrl-item"},tl={class:"ctrl-item"},nl=ue(()=>A("br",null,null,-1)),ll=ue(()=>A("h3",null,"Prompt",-1)),al=["innerHTML"],ol=ue(()=>A("br",null,null,-1)),sl=ue(()=>A("h3",null,"Negative Prompt",-1)),il=["innerHTML"],rl=ue(()=>A("br",null,null,-1)),cl=ue(()=>A("h3",null,"Params",-1)),ul={style:{"font-weight":"600","text-transform":"capitalize"}},dl=["onDblclick"],fl=["onDblclick"],vl=["title"],pl=rt({__name:"fullScreenContextMenu",props:{file:{},idx:{}},emits:["contextMenuClick"],setup(e,{emit:t}){const n=e;Tt(a=>({"6b8f62c2":g(m)?0:"46px","5f8aa996":g(o)+"px","1e8a5839":`calc(100vw - ${g(o)}px)`}));const l=Ae(),i=At(),u=K(),S=Q(()=>i.tagMap.get(n.file.fullpath)??[]),M=K(""),F=Te(),y=K(""),_=Q(()=>y.value.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")),I=Q(()=>_.value.split(` `)),h=Q(()=>xe(_.value)),$=Q(()=>{let a=xe(_.value);return delete a.prompt,delete a.negativePrompt,a});ie(()=>{var a;return(a=n==null?void 0:n.file)==null?void 0:a.fullpath},async a=>{a&&(F.tasks.forEach(s=>s.cancel()),F.pushAction(()=>Fe(a)).res.then(s=>{y.value=s}))},{immediate:!0});const w=Ce("iib@fullScreenContextMenu.prompt-tab","structedData"),d=K(),r=K(),P={left:100,top:100,width:512,height:384,expanded:!0},D=Ce("fullScreenContextMenu.vue-drag",P);D.value&&(D.value.left<0||D.value.top<0)&&(D.value={...P});const{isLeftRightLayout:L,lrLayoutInfoPanelWidth:o,lrMenuAlwaysOn:m}=Dn(),v=L;Mn(u,d,r,{disbaled:v,...D.value,onDrag:ge(function(a,s){D.value={...D.value,left:a,top:s}},300),onResize:ge(function(a,s){D.value={...D.value,width:a,height:s}},300)});const N=K(!1),{isOutside:q}=st(Q(()=>!v.value||m.value?null:N.value?u.value:Se(document.querySelectorAll(".iib-tab-edge-trigger"))));ie(q,sn(a=>{N.value=!a},300));function z(a){return a.parentNode}function U(a){if(!a)return"";const s=[],ee="BREAK",J=a.replace(/>\s/g,"> ,").replace(/\sBREAK\s/g,","+ee+",").split(/[\n,]+/).map(G=>G.trim()).filter(G=>G);let j=!1;for(let G=0;GBREAK
');continue}const le=J[G];j||(j=le.includes("("));const fe=["tag"];j&&fe.push("has-parentheses"),le.length<32&&fe.push("short-tag"),s.push(`${le}`),j&&(j=!le.includes(")"))}return s.join(l.showCommaInInfoPanel?",":" ")}re("load",a=>{const s=a.target;s.className==="ant-image-preview-img"&&(M.value=`${s.naturalWidth} x ${s.naturalHeight}`)},{capture:!0});const H=Q(()=>{const a=[{name:T("fileName"),val:n.file.name},{name:T("fileSize"),val:n.file.size}];return M.value&&a.push({name:T("resolution"),val:M.value}),a}),R=()=>{const a="Negative prompt:",s=y.value.includes(a)?y.value.split(a)[0]:I.value[0]??"";me(Oe(s.trim()))},ne=()=>document.body.requestFullscreen(),de=a=>{me(typeof a=="object"?JSON.stringify(a,null,4):a)},f=a=>{a.key.startsWith("Arrow")?(a.stopPropagation(),a.preventDefault(),document.dispatchEvent(new KeyboardEvent("keydown",a))):a.key==="Escape"&&document.fullscreenElement&&document.exitFullscreen()};re("dblclick",a=>{var s;((s=a.target)==null?void 0:s.className)==="ant-image-preview-img"&&be()});const p=Q(()=>v.value||D.value.expanded);return(a,s)=>{var qe;const ee=an,J=se,j=Wt,G=Bt,le=Ht,fe=Ut,ft=se,Ue=ln,vt=en,pt=Vt,Ve=qt,mt=Gt;return k(),x("div",{ref_key:"el",ref:u,class:Ye(["full-screen-menu",{"unset-size":!g(D).expanded,lr:g(v),"always-on":g(m),"mouse-in":N.value}]),onWheelCapture:s[9]||(s[9]=Nt(()=>{},["stop"])),onKeydownCapture:f},[g(v)?(k(),x("div",An)):B("",!0),A("div",zn,[A("div",jn,[g(v)?B("",!0):(k(),x("div",{key:0,ref_key:"dragHandle",ref:r,class:"icon",style:{cursor:"grab"},title:g(T)("dragToMovePanel")},[c(g(mn))],8,Nn)),g(v)?B("",!0):(k(),x("div",{key:1,class:"icon",style:{cursor:"pointer"},onClick:s[0]||(s[0]=O=>g(D).expanded=!g(D).expanded),title:g(T)("clickToToggleMaximizeMinimize")},[p.value?(k(),oe(g(_n),{key:0})):(k(),oe(g(On),{key:1}))],8,Wn)),A("div",{style:{display:"flex","flex-direction":"column","align-items":"center",cursor:"grab"},class:"icon",title:g(T)("fullscreenview"),onClick:ne},[A("img",{src:g(In),style:{width:"21px",height:"21px","padding-bottom":"2px"},alt:""},null,8,Hn)],8,Bn),c(ee,{"get-popup-container":z},{overlay:b(()=>[c(Qt,{file:a.file,idx:a.idx,"selected-tag":S.value,onContextMenuClick:s[1]||(s[1]=(O,V,ke)=>t("contextMenuClick",O,V,ke))},null,8,["file","idx","selected-tag"])]),default:b(()=>[g(D).expanded?B("",!0):(k(),x("div",Un,[c(g(zt))]))]),_:1}),p.value?(k(),x("div",Vn)):B("",!0),p.value?(k(),x("div",qn,[c(ee,{trigger:["hover"],"get-popup-container":z},{overlay:b(()=>[c(fe,{onClick:s[2]||(s[2]=O=>t("contextMenuClick",O,a.file,a.idx))},{default:b(()=>{var O;return[((O=g(l).conf)==null?void 0:O.launch_mode)!=="server"?(k(),x(Y,{key:0},[c(j,{key:"send2txt2img"},{default:b(()=>[C(E(a.$t("sendToTxt2img")),1)]),_:1}),c(j,{key:"send2img2img"},{default:b(()=>[C(E(a.$t("sendToImg2img")),1)]),_:1}),c(j,{key:"send2inpaint"},{default:b(()=>[C(E(a.$t("sendToInpaint")),1)]),_:1}),c(j,{key:"send2extras"},{default:b(()=>[C(E(a.$t("sendToExtraFeatures")),1)]),_:1}),c(G,{key:"sendToThirdPartyExtension",title:a.$t("sendToThirdPartyExtension")},{default:b(()=>[c(j,{key:"send2controlnet-txt2img"},{default:b(()=>[C("ControlNet - "+E(a.$t("t2i")),1)]),_:1}),c(j,{key:"send2controlnet-img2img"},{default:b(()=>[C("ControlNet - "+E(a.$t("i2i")),1)]),_:1}),c(j,{key:"send2outpaint"},{default:b(()=>[C("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):B("",!0),c(j,{key:"send2BatchDownload"},{default:b(()=>[C(E(a.$t("sendToBatchDownload")),1)]),_:1}),c(G,{key:"copy2target",title:a.$t("copyTo")},{default:b(()=>[(k(!0),x(Y,null,ve(g(l).quickMovePaths,V=>(k(),oe(j,{key:`copy-to-${V.dir}`},{default:b(()=>[C(E(V.zh),1)]),_:2},1024))),128))]),_:1},8,["title"]),c(G,{key:"move2target",title:a.$t("moveTo")},{default:b(()=>[(k(!0),x(Y,null,ve(g(l).quickMovePaths,V=>(k(),oe(j,{key:`move-to-${V.dir}`},{default:b(()=>[C(E(V.zh),1)]),_:2},1024))),128))]),_:1},8,["title"]),c(le),c(j,{key:"deleteFiles"},{default:b(()=>[C(E(a.$t("deleteSelected")),1)]),_:1}),c(j,{key:"previewInNewWindow"},{default:b(()=>[C(E(a.$t("previewInNewWindow")),1)]),_:1}),c(j,{key:"copyPreviewUrl"},{default:b(()=>[C(E(a.$t("copySourceFilePreviewLink")),1)]),_:1}),c(j,{key:"copyFilePath"},{default:b(()=>[C(E(a.$t("copyFilePath")),1)]),_:1})]}),_:1})]),default:b(()=>[c(J,null,{default:b(()=>[C(E(g(T)("openContextMenu")),1)]),_:1})]),_:1}),c(ft,{onClick:s[3]||(s[3]=O=>t("contextMenuClick",{key:"download"},n.file,n.idx))},{default:b(()=>[C(E(a.$t("download")),1)]),_:1}),y.value?(k(),oe(J,{key:0,onClick:s[4]||(s[4]=O=>g(me)(y.value))},{default:b(()=>[C(E(a.$t("copyPrompt")),1)]),_:1})):B("",!0),y.value?(k(),oe(J,{key:1,onClick:R},{default:b(()=>[C(E(a.$t("copyPositivePrompt")),1)]),_:1})):B("",!0)])):B("",!0)]),p.value?(k(),x("div",Gn,[A("div",Xn,[(k(!0),x(Y,null,ve(H.value,O=>(k(),x("span",{class:"info-tag",key:O.name},[A("span",Yn,E(O.name),1),A("span",Kn,E(O.val),1)]))),128))]),(qe=g(l).conf)!=null&&qe.all_custom_tags?(k(),x("div",Jn,[(k(!0),x(Y,null,ve(g(l).conf.all_custom_tags,O=>(k(),x("div",{class:Ye(["tag",{selected:S.value.some(V=>V.id===O.id)}]),onClick:V=>t("contextMenuClick",{key:`toggle-tag-${O.id}`},a.file,a.idx),key:O.id,style:jt({"--tag-color":g(i).getColor(O.name)})},E(O.name),15,Qn))),128))])):B("",!0),A("div",Zn,[A("div",Rn,[C(E(a.$t("experimentalLRLayout"))+": ",1),c(Ue,{checked:g(v),"onUpdate:checked":s[5]||(s[5]=O=>_e(v)?v.value=O:null),size:"small"},null,8,["checked"])]),g(v)?(k(),x(Y,{key:0},[A("div",el,[C(E(a.$t("width"))+": ",1),c(vt,{value:g(o),"onUpdate:value":s[6]||(s[6]=O=>_e(o)?o.value=O:null),style:{width:"64px"},step:16,min:128,max:1024},null,8,["value"])]),c(pt,{title:a.$t("alwaysOnTooltipInfo")},{default:b(()=>[A("div",tl,[C(E(a.$t("alwaysOn"))+": ",1),c(Ue,{checked:g(m),"onUpdate:checked":s[7]||(s[7]=O=>_e(m)?m.value=O:null),size:"small"},null,8,["checked"])])]),_:1},8,["title"])],64)):B("",!0)]),c(mt,{activeKey:g(w),"onUpdate:activeKey":s[8]||(s[8]=O=>_e(w)?w.value=O:null)},{default:b(()=>[c(Ve,{key:"structedData",tab:a.$t("structuredData")},{default:b(()=>[A("div",null,[h.value.prompt?(k(),x(Y,{key:0},[nl,ll,A("code",{innerHTML:U(h.value.prompt??"")},null,8,al)],64)):B("",!0),h.value.negativePrompt?(k(),x(Y,{key:1},[ol,sl,A("code",{innerHTML:U(h.value.negativePrompt??"")},null,8,il)],64)):B("",!0)]),Object.keys($.value).length?(k(),x(Y,{key:0},[rl,cl,A("table",null,[(k(!0),x(Y,null,ve($.value,(O,V)=>(k(),x("tr",{key:V,class:"gen-info-frag"},[A("td",ul,E(V),1),typeof O=="object"?(k(),x("td",{key:0,style:{cursor:"pointer"},onDblclick:ke=>de(O)},[A("code",null,E(O),1)],40,dl)):(k(),x("td",{key:1,style:{cursor:"pointer"},onDblclick:ke=>de(g(Oe)(O))},E(g(Oe)(O)),41,fl))]))),128))])],64)):B("",!0)]),_:1},8,["tab"]),c(Ve,{key:"sourceText",tab:a.$t("sourceText")},{default:b(()=>[A("code",null,E(y.value),1)]),_:1},8,["tab"])]),_:1},8,["activeKey"])])):B("",!0)]),g(D).expanded&&!g(v)?(k(),x("div",{key:1,class:"mouse-sensor",ref_key:"resizeHandle",ref:d,title:g(T)("dragToResizePanel")},[c(g(dn))],8,vl)):B("",!0)],34)}}});const Cl=ct(pl,[["__scopeId","data-v-d41c2ac4"]]),ml={key:0,class:"float-panel"},gl={key:0,class:"select-actions"},hl={key:1},yl=rt({__name:"MultiSelectKeep",props:{show:{type:Boolean}},emits:["selectAll","reverseSelect","clearAllSelected"],setup(e,{emit:t}){const n=Ae(),l=()=>{t("clearAllSelected"),n.keepMultiSelect=!1},i=()=>{n.keepMultiSelect=!0};return(u,S)=>{const M=se;return u.show?(k(),x("div",ml,[g(n).keepMultiSelect?(k(),x("div",gl,[c(M,{size:"small",onClick:S[0]||(S[0]=F=>t("selectAll"))},{default:b(()=>[C(E(u.$t("select-all")),1)]),_:1}),c(M,{size:"small",onClick:S[1]||(S[1]=F=>t("reverseSelect"))},{default:b(()=>[C(E(u.$t("rerverse-select")),1)]),_:1}),c(M,{size:"small",onClick:S[2]||(S[2]=F=>t("clearAllSelected"))},{default:b(()=>[C(E(u.$t("clear-all-selected")),1)]),_:1}),c(M,{size:"small",onClick:l},{default:b(()=>[C(E(u.$t("exit")),1)]),_:1})])):(k(),x("div",hl,[c(M,{size:"small",type:"primary",onClick:i},{default:b(()=>[C(E(u.$t("keep-multi-selected")),1)]),_:1})]))])):B("",!0)}}});const Ml=ct(yl,[["__scopeId","data-v-b04c3508"]]);export{$l as L,Ml as M,Pl as R,Fl as a,Il as b,Sl as c,xl as d,Cl as f,re as u};