import{bW as mt,n as ge,bd as at,c as u,A as ue,bX as X,y as Q,z as T,m as ie,x as gt,bY as Ue,bZ as ht,bL as Me,R as pe,ai as oe,b_ as yt,r as K,N as Pe,b$ as st,G as qe,ad as ae,c0 as _t,c1 as wt,V as C,ac as bt,c2 as Se,O as ye,K as kt,c3 as Ot,J as me,c4 as Et,c5 as Lt,bV as $t,c6 as Pt,c7 as St,q as Fe,c8 as Ft,c9 as xe,o as ot,ax as xt,$ as De,ak as It,E as Z,ca as Ct,cb as Mt,d as it,cc as Dt,cd as Tt,I as Ge,S as k,T as I,a2 as g,Y as B,U as A,a0 as se,a1 as b,ce as At,X as Y,W as E,a6 as ve,ae as Xe,a5 as zt,a4 as _e,cf as Oe,a3 as jt,aj as Nt,cg as Wt,ch as Bt,M as Ht,ci as Vt,cj as Ut,ck as qt,aL as Gt,aM as Xt,Z as rt}from"./index-4d943b58.js";import{u as he,e as Ie,g as W,f as Ye,h as te,r as Yt,t as Ee,i as Kt,s as Ke,j as we,_ as Jt}from"./FileItem-df657b05.js";import{M as ut,c as ct,m as Ce,b as Zt,d as Qt,e as Rt}from"./functionalCallableComp-89ac6972.js";import{C as en,g as tn,_ as nn}from"./shortcut-5818cc90.js";/* empty css */import{D as ln}from"./index-1d8a49d5.js";var an="Expected a function";function sn(e,t,n){var l=!0,i=!0;if(typeof e!="function")throw new TypeError(an);return mt(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),at(()=>document.removeEventListener(...e))};var on={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 rn=on;function Je(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 In=(e,t)=>{const n=t.querySelector(`.idx-${e} .ant-image-img`);n?n.click():console.log("openImageFullscreenPreview error: not found",e,t)};function $l(e){const{previewIdx:t,eventEmitter:n,canLoadNext:l,previewing:i,sortedFiles:c,scroller:S,props:M}=he().toRefs(),{state:F}=he();let w=null;const y=(_,d)=>{var r;i.value=_,w!=null&&!_&&d&&((r=S.value)==null||r.scrollToItem(w),w=null)},x=()=>{if(!$("next")){if(e!=null&&e.loadNext)return e.loadNext();M.value.mode==="walk"&&l.value&&(Q.info(T("loadingNextFolder")),n.value.emit("loadNextDir",!0))}};re("keydown",_=>{var d;if(i.value){let r=t.value;if(["ArrowDown","ArrowRight"].includes(_.key))for(r++;c.value[r]&&!X(c.value[r].name);)r++;else if(["ArrowUp","ArrowLeft"].includes(_.key))for(r--;c.value[r]&&!X(c.value[r].name);)r--;if(X((d=c.value[r])==null?void 0:d.name)??""){t.value=r;const P=S.value;P&&!(r>=P.$_startIndex&&r<=P.$_endIndex)&&(w=r)}x()}});const h=_=>{var r;let d=t.value;if(_==="next")for(d++;c.value[d]&&!X(c.value[d].name);)d++;else if(_==="prev")for(d--;c.value[d]&&!X(c.value[d].name);)d--;if(X((r=c.value[d])==null?void 0:r.name)??""){t.value=d;const P=S.value;P&&!(d>=P.$_startIndex&&d<=P.$_endIndex)&&(w=d)}x()},$=_=>{var r;let d=t.value;if(_==="next")for(d++;c.value[d]&&!X(c.value[d].name);)d++;else if(_==="prev")for(d--;c.value[d]&&!X(c.value[d].name);)d--;return X((r=c.value[d])==null?void 0:r.name)};return Ie("removeFiles",async()=>{i.value&&!F.sortedFiles[t.value]&&be()}),{previewIdx:t,onPreviewVisibleChange:y,previewing:i,previewImgMove:h,canPreview:$}}function Le(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!yt(e)}function Pl(){const{currLocation:e,sortedFiles:t,currPage:n,multiSelectedIdxs:l,eventEmitter:i,walker:c}=he().toRefs(),S=()=>{l.value=[]};return re("click",()=>{W.keepMultiSelect||S()}),re("blur",()=>{W.keepMultiSelect||S()}),ie(n,S),{onFileDragStart:(y,x)=>{const h=gt(t.value[x]);Ye.fileDragging=!0,console.log("onFileDragStart set drag file ",y,x,h);const $=[h];let _=h.type==="dir";if(l.value.includes(x)){const r=l.value.map(P=>t.value[P]);$.push(...r),_=r.some(P=>P.type==="dir")}const d={includeDir:_,loc:e.value||"search-result",path:Ue($,"fullpath").map(r=>r.fullpath),nodes:Ue($,"fullpath"),__id:"FileTransferData"};y.dataTransfer.setData("text/plain",JSON.stringify(d))},onDrop:async y=>{if(c.value)return;const x=ht(y);if(!x)return;const h=e.value;if(x.loc===h)return;const $=Me(),_=async()=>$.pushAction(async()=>{await ct(x.path,h),i.value.emit("refresh"),pe.destroyAll()}),d=()=>$.pushAction(async()=>{await Ce(x.path,h),te.emit("removeFiles",{paths:x.path,loc:x.loc}),i.value.emit("refresh"),pe.destroyAll()});pe.confirm({title:T("confirm")+"?",width:"60vw",content:()=>{let r,P,D;return u("div",null,[u("div",null,[`${T("moveSelectedFilesTo")} ${h}`,u("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[x.path.map(L=>u("li",null,[L.split(/[/\\]/).pop()]))])]),u(ut,null,null),u("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},class:"actions"},[u(oe,{onClick:pe.destroyAll},Le(r=T("cancel"))?r:{default:()=>[r]}),u(oe,{type:"primary",loading:!$.isIdle,onClick:_},Le(P=T("copy"))?P:{default:()=>[P]}),u(oe,{type:"primary",loading:!$.isIdle,onClick:d},Le(D=T("move"))?D:{default:()=>[D]})])])},maskClosable:!0,wrapClassName:"hidden-antd-btns-modal"})},multiSelectedIdxs:l,onFileDragEnd:()=>{Ye.fileDragging=!1}}}function Sl({openNext:e}){const t=K(!1),n=K(""),{sortedFiles:l,previewIdx:i,multiSelectedIdxs:c,stack:S,currLocation:M,spinning:F,previewing:w,stackViewEl:y,eventEmitter:x,props:h,deletedFiles:$}=he().toRefs(),_=qe;Ie("removeFiles",({paths:L,loc:s})=>{_(s)!==_(M.value)||!Pe(S.value)||(L.forEach(v=>$.value.add(v)),L.filter(X).forEach(v=>$.value.add(v.replace(/\.\w+$/,".txt"))))}),Ie("addFiles",({files:L,loc:s})=>{if(_(s)!==_(M.value))return;const m=Pe(S.value);m&&m.files.unshift(...L)});const d=Me(),r=async(L,s,m)=>{i.value=m,W.fullscreenPreviewInitialUrl=ae(s);const v=c.value.indexOf(m);if(L.shiftKey){if(v!==-1)c.value.splice(v,1);else{c.value.push(m),c.value.sort((z,V)=>z-V);const N=c.value[0],q=c.value[c.value.length-1];c.value=Yt(N,q+1)}L.stopPropagation()}else L.ctrlKey||L.metaKey?(v!==-1?c.value.splice(v,1):c.value.push(m),L.stopPropagation()):await e(s)},P=async(L,s,m)=>{var R,ne,de;const v=ae(s),N=M.value,q={IIB_container_id:parent.IIB_container_id},z=()=>{let f=[];return c.value.includes(m)?f=c.value.map(p=>l.value[p]):f.push(s),f},V=async f=>{if(!F.value)try{F.value=!0,await Pt(s.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),Q.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:s.fullpath}),a=(ne=(R=W.conf)==null?void 0:R.all_custom_tags.find(o=>o.id===f))==null?void 0:ne.name;await Ee.refreshTags([s.fullpath]),Q.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(o=>o.fullpath);await wt({tag_id:f,img_paths:a,action:p}),await Ee.refreshTags(a),Q.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(o=>o.fullpath);await ct(a,f,!0),te.emit("addFiles",{files:p,loc:f}),Q.success(T("copySuccess"));return}else if(H.startsWith("move-to-")){const f=H.split("move-to-")[1],p=z(),a=p.map(o=>o.fullpath);await Ce(a,f,!0),te.emit("removeFiles",{paths:a,loc:M.value}),te.emit("addFiles",{files:p,loc:f}),Q.success(T("moveSuccess"));return}switch(L.key){case"previewInNewWindow":return window.open(v);case"copyFilePath":return me(s.fullpath);case"saveSelectedAsJson":return $t(z());case"openWithDefaultApp":return Lt(s.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(s.fullpath);f=qe(f);const p=Ee.tagMap;p.set(f,p.get(s.fullpath)??[]),p.delete(s.fullpath),s.fullpath=f,s.name=f.split(/[\\/]/).pop()??"";return}case"send2txt2img":return V("txt2img");case"send2img2img":return V("img2img");case"send2inpaint":return V("inpaint");case"send2extras":return V("extras");case"send2savedDir":{const f=W.quickMovePaths.find(o=>o.key==="outdir_save");if(!f)return Q.error(T("unknownSavedDir"));const p=Ot(f.dir,(de=W.conf)==null?void 0:de.sd_cwd),a=z();await Ce(a.map(o=>o.fullpath),p,!0),te.emit("removeFiles",{paths:a.map(o=>o.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(s)});break}case"send2outpaint":{n.value=await d.pushAction(()=>Se(s.fullpath)).res;const[f,p]=(n.value||"").split(` `);we.postMessage({...q,event:"send_to_outpaint",url:ae(s),prompt:f,negPrompt:p.slice(17)});break}case"openWithWalkMode":{Ke.set(N,S.value);const f=W.tabList[h.value.tabIdx],p={type:"local",key:ye(),path:s.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"?s.fullpath:kt(s.fullpath),name:T("local"),mode:"scanned-fixed"};f.panes.push(p),f.key=p.key;break}case"openOnTheRight":{Ke.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:s.fullpath,name:T("local"),stackKey:N};f.panes.push(p),f.key=p.key;break}case"send2BatchDownload":{Kt.addFiles(z());break}case"viewGenInfo":{t.value=!0,n.value=await d.pushAction(()=>Se(s.fullpath)).res;break}case"openWithLocalFileBrowser":{await bt(s.fullpath);break}case"deleteFiles":{const f=z(),p=async()=>{const a=f.map(o=>o.fullpath);if(await Qt(a),Q.success(T("deleteSuccess")),w.value){const o=ae(s)===W.fullscreenPreviewInitialUrl,ee=i.value===l.value.length-1;if((o||ee)&&(be(),await Fe(100),o&&l.value.length>1)){const J=i.value;Fe(0).then(()=>In(J,y.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:()=>u("div",null,[u("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[f.map(o=>u("li",null,[o.fullpath.split(/[/\\]/).pop()]))]),u(ut,null,null),u(en,{checked:W.ignoredConfirmActions.deleteOneOnly,"onUpdate:checked":o=>W.ignoredConfirmActions.deleteOneOnly=o},{default:()=>[T("deleteOneOnlySkipConfirm"),C(" ("),T("resetOnGlobalSettingsPage"),C(")")]})]),async onOk(){await p(),a()}})});break}}return{}},{isOutside:D}=st(y);return re("keydown",L=>{var m,v,N;const s=tn(L);if(w.value){s==="Esc"&&be();const q=(m=Object.entries(W.shortcut).find(z=>z[1]===s&&z[1]))==null?void 0:m[0];if(q){L.stopPropagation(),L.preventDefault();const z=i.value,V=l.value[z];switch(q){case"delete":return P({key:"deleteFiles"},V,z);case"download":return P({key:"download"},V,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}`},V,z):void 0}}}}else!D.value&&["Ctrl + KeyA","Cmd + KeyA"].includes(s)&&(L.preventDefault(),L.stopPropagation(),x.value.emit("selectAll"))}),{onFileItemClick:r,onContextMenuClick:P,showGenInfo:t,imageGenInfo:n,q:d}}const $e=new Map,Fl=()=>{const{useEventListen:e,sortedFiles:t,getViewableAreaFiles:n}=he().toRefs(),l=K(W.defaultChangeIndchecked),i=K(W.defaultSeedChangeChecked),c=async()=>{if(await Fe(100),!l.value)return;const F=n.value().filter(y=>X(y.fullpath)&&!y.gen_info_obj);if(!F.length)return;const w=await Ft(F.map(y=>y.fullpath).filter(y=>!$e.has(y)));F.forEach(y=>{const x=w[y.fullpath]||$e.get(y.fullpath)||"";$e.set(y.fullpath,x),y.gen_info_obj=xe(x),y.gen_info_raw=x})};e.value("viewableAreaFilesChange",c);const S=F=>{const w=t.value;return[F,i.value,w[F-1],w[F],w[F+1]]};function M(F,w,y,x){const h={diff:{},empty:!0,ownFile:"",otherFile:""};if(w+y<0||w+y>=t.value.length||t.value[w]==null||!("gen_info_obj"in t.value[w])||!("gen_info_obj"in t.value[w+y]))return h;const $=F,_=t.value[w+y].gen_info_obj;if(_==null)return h;const d=["hashes","resources"];h.diff={},h.ownFile=x.name,h.otherFile=t.value[w+y].name,h.empty=!1,i.value||d.push("seed");for(const r in $)if(!d.includes(r)){if(!(r in _)){h.diff[r]="+";continue}if($[r]!=_[r])if(r.includes("rompt")&&$[r]!=""&&_[r]!=""){const P=$[r].split(","),D=_[r].split(",");let L=0;for(const s in P)P[s]!=D[s]&&L++;h.diff[r]=L}else h.diff[r]=[$[r],_[r]]}return h}return{getGenDiff:M,changeIndchecked:l,seedChangeChecked:i,getRawGenParams:()=>c(),getGenDiffWatchDep:S}};function Cn(e,t,n,l){let i=0,c=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,w=typeof(l==null?void 0:l.top)=="number"?l.top:0,y=!1;const x=s=>{s.stopPropagation(),s.preventDefault(),!(!e.value||!t.value)&&(i=s instanceof MouseEvent?s.clientX:s.touches[0].clientX,c=s instanceof MouseEvent?s.clientY:s.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=s=>{if(!e.value||!t.value)return;let m=S+((s instanceof MouseEvent?s.clientX:s.touches[0].clientX)-i),v=M+((s instanceof MouseEvent?s.clientY:s.touches[0].clientY)-c);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",$)},_=s=>{s.stopPropagation(),s.preventDefault(),!(!e.value||!n.value)&&(y=!0,F=e.value.offsetLeft,w=e.value.offsetTop,i=s instanceof MouseEvent?s.clientX:s.touches[0].clientX,c=s instanceof MouseEvent?s.clientY:s.touches[0].clientY,document.documentElement.addEventListener("mousemove",d),document.documentElement.addEventListener("touchmove",d),document.documentElement.addEventListener("mouseup",r),document.documentElement.addEventListener("touchend",r))},d=s=>{if(!e.value||!n.value||!y)return;const m=F+((s instanceof MouseEvent?s.clientX:s.touches[0].clientX)-i),v=w+((s instanceof MouseEvent?s.clientY:s.touches[0].clientY)-c);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=()=>{y=!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 s=e.value.offsetLeft,m=e.value.offsetTop,v=e.value.offsetWidth,N=e.value.offsetHeight;s+v>window.innerWidth&&(s=window.innerWidth-v,s<0&&(s=0,v=window.innerWidth)),m+N>window.innerHeight&&(m=window.innerHeight-N,m<0&&(m=0,N=window.innerHeight)),e.value.style.left=`${s}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 ot(D),at(L),ie(()=>l==null?void 0:l.disbaled,async s=>{await xt(),s!==void 0&&(s?L():D())}),ie(()=>[e.value,t.value,n.value],([s,m,v])=>{s&&m&&(m.addEventListener("mousedown",x),m.addEventListener("touchstart",x)),s&&v&&(v.addEventListener("mousedown",_),v.addEventListener("touchstart",_))}),{handleResizeMouseDown:x,handleDragMouseDown:_}}let nt=null;const Mn=()=>{var M,F;const e=De(),t=It(nt??((F=(M=e.conf)==null?void 0:M.app_fe_setting)==null?void 0:F.fullscreen_layout)??{enable:!1,panelWidth:384,alwaysOn:!0}),n="--iib-lr-layout-info-panel-width",l=Z(()=>t.alwaysOn&&t.enable?t.panelWidth:0);ie(t,()=>{lt(t,n,l),Dn(t),nt=t},{deep:!0}),ot(()=>lt(t,n,l));const{enable:i,panelWidth:c,alwaysOn:S}=Ct(t);return{state:t,isLeftRightLayout:i,panelwidtrhStyleVarName:n,lrLayoutInfoPanelWidth:c,lrMenuAlwaysOn:S}},Dn=ge(e=>Mt("fullscreen_layout",e),300),lt=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),ce=e=>(Gt("data-v-0b177f20"),e=e(),Xt(),e),Tn={key:0},An={class:"container"},zn={class:"action-bar"},jn=["title"],Nn=["title"],Wn=["title"],Bn=["src"],Hn={key:0,class:"icon",style:{cursor:"pointer"}},Vn={key:2,"flex-placeholder":""},Un={key:3,class:"action-bar"},qn={key:0,class:"gen-info"},Gn={class:"info-tags"},Xn={class:"name"},Yn={class:"value"},Kn={key:0,class:"tags-container"},Jn=["onClick"],Zn={class:"lr-layout-control"},Qn={class:"ctrl-item"},Rn={class:"ctrl-item"},el={class:"ctrl-item"},tl=ce(()=>A("br",null,null,-1)),nl=ce(()=>A("h3",null,"Prompt",-1)),ll=["innerHTML"],al=ce(()=>A("br",null,null,-1)),sl=ce(()=>A("h3",null,"Negative Prompt",-1)),ol=["innerHTML"],il=ce(()=>A("br",null,null,-1)),rl=ce(()=>A("h3",null,"Params",-1)),ul={style:{"font-weight":"600","text-transform":"capitalize"}},cl=["onDblclick"],dl=["onDblclick"],fl=["title"],vl=it({__name:"fullScreenContextMenu",props:{file:{},idx:{}},emits:["contextMenuClick"],setup(e,{emit:t}){const n=e;Dt(a=>({"4961c802":g(m)?0:"46px","4ef10932":g(s)+"px","2a31f776":`calc(100vw - ${g(s)}px)`}));const l=De(),i=Tt(),c=K(),S=Z(()=>i.tagMap.get(n.file.fullpath)??[]),M=K(""),F=Me(),w=K(""),y=Z(()=>w.value.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")),x=Z(()=>y.value.split(` `)),h=Z(()=>xe(y.value)),$=Z(()=>{let a=xe(y.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(o=>o.cancel()),F.pushAction(()=>Se(a)).res.then(o=>{w.value=o}))},{immediate:!0});const _=Ge("iib@fullScreenContextMenu.prompt-tab","structedData"),d=K(),r=K(),P={left:100,top:100,width:512,height:384,expanded:!0},D=Ge("fullScreenContextMenu.vue-drag",P);D.value&&(D.value.left<0||D.value.top<0)&&(D.value={...P});const{isLeftRightLayout:L,lrLayoutInfoPanelWidth:s,lrMenuAlwaysOn:m}=Mn(),v=L;Cn(c,d,r,{disbaled:v,...D.value,onDrag:ge(function(a,o){D.value={...D.value,left:a,top:o}},300),onResize:ge(function(a,o){D.value={...D.value,width:a,height:o}},300)});const N=K(!1),{isOutside:q}=st(Z(()=>!v.value||m.value?null:N.value?c.value:Pe(document.querySelectorAll(".iib-tab-edge-trigger"))));ie(q,sn(a=>{N.value=!a},300));function z(a){return a.parentNode}function V(a){if(!a)return"";const o=[],ee="BREAK",J=a.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"),o.push(`${le}`),j&&(j=!le.includes(")"))}return o.join("")}re("load",a=>{const o=a.target;o.className==="ant-image-preview-img"&&(M.value=`${o.naturalWidth} x ${o.naturalHeight}`)},{capture:!0});const H=Z(()=>{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:",o=w.value.includes(a)?w.value.split(a)[0]:x.value[0]??"";me(Oe(o.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 o;((o=a.target)==null?void 0:o.className)==="ant-image-preview-img"&&be()});const p=Z(()=>v.value||D.value.expanded);return(a,o)=>{var Ve;const ee=ln,J=oe,j=Nt,G=Wt,le=Bt,fe=Ht,dt=oe,Be=nn,ft=Rt,vt=Vt,He=Ut,pt=qt;return k(),I("div",{ref_key:"el",ref:c,class:Xe(["full-screen-menu",{"unset-size":!g(D).expanded,lr:g(v),"always-on":g(m),"mouse-in":N.value}]),onWheelCapture:o[9]||(o[9]=jt(()=>{},["stop"])),onKeydownCapture:f},[g(v)?(k(),I("div",Tn)):B("",!0),A("div",An,[A("div",zn,[g(v)?B("",!0):(k(),I("div",{key:0,ref_key:"dragHandle",ref:r,class:"icon",style:{cursor:"grab"},title:g(T)("dragToMovePanel")},[u(g(pn))],8,jn)),g(v)?B("",!0):(k(),I("div",{key:1,class:"icon",style:{cursor:"pointer"},onClick:o[0]||(o[0]=O=>g(D).expanded=!g(D).expanded),title:g(T)("clickToToggleMaximizeMinimize")},[p.value?(k(),se(g(yn),{key:0})):(k(),se(g(kn),{key:1}))],8,Nn)),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(Fn),style:{width:"21px",height:"21px","padding-bottom":"2px"},alt:""},null,8,Bn)],8,Wn),u(ee,{"get-popup-container":z},{overlay:b(()=>[u(Jt,{file:a.file,idx:a.idx,"selected-tag":S.value,onContextMenuClick:o[1]||(o[1]=(O,U,ke)=>t("contextMenuClick",O,U,ke))},null,8,["file","idx","selected-tag"])]),default:b(()=>[g(D).expanded?B("",!0):(k(),I("div",Hn,[u(g(At))]))]),_:1}),p.value?(k(),I("div",Vn)):B("",!0),p.value?(k(),I("div",Un,[u(ee,{trigger:["hover"],"get-popup-container":z},{overlay:b(()=>[u(fe,{onClick:o[2]||(o[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(),I(Y,{key:0},[u(j,{key:"send2txt2img"},{default:b(()=>[C(E(a.$t("sendToTxt2img")),1)]),_:1}),u(j,{key:"send2img2img"},{default:b(()=>[C(E(a.$t("sendToImg2img")),1)]),_:1}),u(j,{key:"send2inpaint"},{default:b(()=>[C(E(a.$t("sendToInpaint")),1)]),_:1}),u(j,{key:"send2extras"},{default:b(()=>[C(E(a.$t("sendToExtraFeatures")),1)]),_:1}),u(G,{key:"sendToThirdPartyExtension",title:a.$t("sendToThirdPartyExtension")},{default:b(()=>[u(j,{key:"send2controlnet-txt2img"},{default:b(()=>[C("ControlNet - "+E(a.$t("t2i")),1)]),_:1}),u(j,{key:"send2controlnet-img2img"},{default:b(()=>[C("ControlNet - "+E(a.$t("i2i")),1)]),_:1}),u(j,{key:"send2outpaint"},{default:b(()=>[C("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):B("",!0),u(j,{key:"send2BatchDownload"},{default:b(()=>[C(E(a.$t("sendToBatchDownload")),1)]),_:1}),u(G,{key:"copy2target",title:a.$t("copyTo")},{default:b(()=>[(k(!0),I(Y,null,ve(g(l).quickMovePaths,U=>(k(),se(j,{key:`copy-to-${U.dir}`},{default:b(()=>[C(E(U.zh),1)]),_:2},1024))),128))]),_:1},8,["title"]),u(G,{key:"move2target",title:a.$t("moveTo")},{default:b(()=>[(k(!0),I(Y,null,ve(g(l).quickMovePaths,U=>(k(),se(j,{key:`move-to-${U.dir}`},{default:b(()=>[C(E(U.zh),1)]),_:2},1024))),128))]),_:1},8,["title"]),u(le),u(j,{key:"deleteFiles"},{default:b(()=>[C(E(a.$t("deleteSelected")),1)]),_:1}),u(j,{key:"previewInNewWindow"},{default:b(()=>[C(E(a.$t("previewInNewWindow")),1)]),_:1}),u(j,{key:"copyPreviewUrl"},{default:b(()=>[C(E(a.$t("copySourceFilePreviewLink")),1)]),_:1}),u(j,{key:"copyFilePath"},{default:b(()=>[C(E(a.$t("copyFilePath")),1)]),_:1})]}),_:1})]),default:b(()=>[u(J,null,{default:b(()=>[C(E(g(T)("openContextMenu")),1)]),_:1})]),_:1}),u(dt,{onClick:o[3]||(o[3]=O=>t("contextMenuClick",{key:"download"},n.file,n.idx))},{default:b(()=>[C(E(a.$t("download")),1)]),_:1}),w.value?(k(),se(J,{key:0,onClick:o[4]||(o[4]=O=>g(me)(w.value))},{default:b(()=>[C(E(a.$t("copyPrompt")),1)]),_:1})):B("",!0),w.value?(k(),se(J,{key:1,onClick:R},{default:b(()=>[C(E(a.$t("copyPositivePrompt")),1)]),_:1})):B("",!0)])):B("",!0)]),p.value?(k(),I("div",qn,[A("div",Gn,[(k(!0),I(Y,null,ve(H.value,O=>(k(),I("span",{class:"info-tag",key:O.name},[A("span",Xn,E(O.name),1),A("span",Yn,E(O.val),1)]))),128))]),(Ve=g(l).conf)!=null&&Ve.all_custom_tags?(k(),I("div",Kn,[(k(!0),I(Y,null,ve(g(l).conf.all_custom_tags,O=>(k(),I("div",{class:Xe(["tag",{selected:S.value.some(U=>U.id===O.id)}]),onClick:U=>t("contextMenuClick",{key:`toggle-tag-${O.id}`},a.file,a.idx),key:O.id,style:zt({"--tag-color":g(i).getColor(O.name)})},E(O.name),15,Jn))),128))])):B("",!0),A("div",Zn,[A("div",Qn,[C(E(a.$t("experimentalLRLayout"))+": ",1),u(Be,{checked:g(v),"onUpdate:checked":o[5]||(o[5]=O=>_e(v)?v.value=O:null),size:"small"},null,8,["checked"])]),g(v)?(k(),I(Y,{key:0},[A("div",Rn,[C(E(a.$t("width"))+": ",1),u(ft,{value:g(s),"onUpdate:value":o[6]||(o[6]=O=>_e(s)?s.value=O:null),style:{width:"64px"},step:16,min:128,max:1024},null,8,["value"])]),u(vt,{title:a.$t("alwaysOnTooltipInfo")},{default:b(()=>[A("div",el,[C(E(a.$t("alwaysOn"))+": ",1),u(Be,{checked:g(m),"onUpdate:checked":o[7]||(o[7]=O=>_e(m)?m.value=O:null),size:"small"},null,8,["checked"])])]),_:1},8,["title"])],64)):B("",!0)]),u(pt,{activeKey:g(_),"onUpdate:activeKey":o[8]||(o[8]=O=>_e(_)?_.value=O:null)},{default:b(()=>[u(He,{key:"structedData",tab:a.$t("structuredData")},{default:b(()=>[A("div",null,[h.value.prompt?(k(),I(Y,{key:0},[tl,nl,A("code",{innerHTML:V(h.value.prompt??"")},null,8,ll)],64)):B("",!0),h.value.negativePrompt?(k(),I(Y,{key:1},[al,sl,A("code",{innerHTML:V(h.value.negativePrompt??"")},null,8,ol)],64)):B("",!0)]),Object.keys($.value).length?(k(),I(Y,{key:0},[il,rl,A("table",null,[(k(!0),I(Y,null,ve($.value,(O,U)=>(k(),I("tr",{key:U,class:"gen-info-frag"},[A("td",ul,E(U),1),typeof O=="object"?(k(),I("td",{key:0,style:{cursor:"pointer"},onDblclick:ke=>de(O)},[A("code",null,E(O),1)],40,cl)):(k(),I("td",{key:1,style:{cursor:"pointer"},onDblclick:ke=>de(g(Oe)(O))},E(g(Oe)(O)),41,dl))]))),128))])],64)):B("",!0)]),_:1},8,["tab"]),u(He,{key:"sourceText",tab:a.$t("sourceText")},{default:b(()=>[A("code",null,E(w.value),1)]),_:1},8,["tab"])]),_:1},8,["activeKey"])])):B("",!0)]),g(D).expanded&&!g(v)?(k(),I("div",{key:1,class:"mouse-sensor",ref_key:"resizeHandle",ref:d,title:g(T)("dragToResizePanel")},[u(g(cn))],8,fl)):B("",!0)],34)}}});const xl=rt(vl,[["__scopeId","data-v-0b177f20"]]),pl={key:0,class:"float-panel"},ml={key:0,class:"select-actions"},gl={key:1},hl=it({__name:"MultiSelectKeep",props:{show:{type:Boolean}},emits:["selectAll","reverseSelect","clearAllSelected"],setup(e,{emit:t}){const n=De(),l=()=>{t("clearAllSelected"),n.keepMultiSelect=!1},i=()=>{n.keepMultiSelect=!0};return(c,S)=>{const M=oe;return c.show?(k(),I("div",pl,[g(n).keepMultiSelect?(k(),I("div",ml,[u(M,{size:"small",onClick:S[0]||(S[0]=F=>t("selectAll"))},{default:b(()=>[C(E(c.$t("select-all")),1)]),_:1}),u(M,{size:"small",onClick:S[1]||(S[1]=F=>t("reverseSelect"))},{default:b(()=>[C(E(c.$t("rerverse-select")),1)]),_:1}),u(M,{size:"small",onClick:S[2]||(S[2]=F=>t("clearAllSelected"))},{default:b(()=>[C(E(c.$t("clear-all-selected")),1)]),_:1}),u(M,{size:"small",onClick:l},{default:b(()=>[C(E(c.$t("exit")),1)]),_:1})])):(k(),I("div",gl,[u(M,{size:"small",type:"primary",onClick:i},{default:b(()=>[C(E(c.$t("keep-multi-selected")),1)]),_:1})]))])):B("",!0)}}});const Il=rt(hl,[["__scopeId","data-v-b04c3508"]]);export{El as L,Il as M,Ll as R,Pl as a,Sl as b,$l as c,Fl as d,xl as f,re as u};