4 lines
34 KiB
JavaScript
4 lines
34 KiB
JavaScript
import{c8 as pt,l as pe,ba as nt,c as i,A as ie,J as G,v as Q,x,k as oe,t as mt,c9 as je,ca as gt,bX as Pe,ad as ve,af as se,cb as ht,r as Z,cc as lt,C as Be,a9 as le,cd as yt,ce as _t,R as $,a8 as wt,cf as Ee,I as me,G as bt,cg as kt,E as fe,ch as Ot,ci as Et,c7 as Lt,cj as $t,ck as xt,n as He,o as at,av as Pt,W as Se,ah as St,B as J,cl as Ct,cm as Ft,d as st,cn as It,co as Mt,L as Ue,cp as Ve,N as y,O as L,Z as m,U as j,Q as F,X as ae,Y as h,cq as Tt,T as Y,S as b,a2 as de,aa as qe,a1 as Dt,a0 as ge,cr as be,$ as At,ag as zt,cs as Nt,ct as Wt,M as jt,bH as Bt,cu as Ht,cv as Ut,aI as Vt,aJ as qt,V as ot}from"./index-5979b8db.js";import{u as ye,e as Le,g as B,f as Xe,h as te,r as Xt,t as ke,i as Yt,s as Ye,j as he,_ as Gt}from"./FileItem-9df133cb.js";import{M as rt,c as it,m as $e,l as xe,b as Jt,d as Kt}from"./functionalCallableComp-adb8dfdc.js";import{C as Qt,g as Zt,_ as Rt,a as en}from"./shortcut-7283cf43.js";/* empty css */import{D as tn}from"./index-314cf038.js";var nn="Expected a function";function ln(e,t,l){var n=!0,o=!0;if(typeof e!="function")throw new TypeError(nn);return pt(l)&&(n="leading"in l?!!l.leading:n,o="trailing"in l?!!l.trailing:o),pe(e,t,{leading:n,maxWait:t,trailing:o})}const re=(...e)=>{document.addEventListener(...e),nt(()=>document.removeEventListener(...e))};var an={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 sn=an;function Ge(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),n.forEach(function(o){on(e,o,l[o])})}return e}function on(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Ce=function(t,l){var n=Ge({},t,l.attrs);return i(ie,Ge({},n,{icon:sn}),null)};Ce.displayName="ArrowsAltOutlined";Ce.inheritAttrs=!1;const rn=Ce;var cn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.3 506.3L781.7 405.6a7.23 7.23 0 00-11.7 5.7V476H548V254h64.8c6 0 9.4-7 5.7-11.7L517.7 114.7a7.14 7.14 0 00-11.3 0L405.6 242.3a7.23 7.23 0 005.7 11.7H476v222H254v-64.8c0-6-7-9.4-11.7-5.7L114.7 506.3a7.14 7.14 0 000 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h222v222h-64.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V548h222v64.8c0 6 7 9.4 11.7 5.7l127.5-100.8a7.3 7.3 0 00.1-11.4z"}}]},name:"drag",theme:"outlined"};const un=cn;function Je(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),n.forEach(function(o){dn(e,o,l[o])})}return e}function dn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Fe=function(t,l){var n=Je({},t,l.attrs);return i(ie,Je({},n,{icon:un}),null)};Fe.displayName="DragOutlined";Fe.inheritAttrs=!1;const vn=Fe;var fn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 000 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 00391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 00-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"}}]},name:"fullscreen-exit",theme:"outlined"};const pn=fn;function Ke(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),n.forEach(function(o){mn(e,o,l[o])})}return e}function mn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Ie=function(t,l){var n=Ke({},t,l.attrs);return i(ie,Ke({},n,{icon:pn}),null)};Ie.displayName="FullscreenExitOutlined";Ie.inheritAttrs=!1;const gn=Ie;var hn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"}}]},name:"fullscreen",theme:"outlined"};const yn=hn;function Qe(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),n.forEach(function(o){_n(e,o,l[o])})}return e}function _n(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Me=function(t,l){var n=Qe({},t,l.attrs);return i(ie,Qe({},n,{icon:yn}),null)};Me.displayName="FullscreenOutlined";Me.inheritAttrs=!1;const wn=Me;var bn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"left-circle",theme:"outlined"};const kn=bn;function Ze(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),n.forEach(function(o){On(e,o,l[o])})}return e}function On(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Te=function(t,l){var n=Ze({},t,l.attrs);return i(ie,Ze({},n,{icon:kn}),null)};Te.displayName="LeftCircleOutlined";Te.inheritAttrs=!1;const kl=Te;var En={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"right-circle",theme:"outlined"};const Ln=En;function Re(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),n.forEach(function(o){$n(e,o,l[o])})}return e}function $n(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var De=function(t,l){var n=Re({},t,l.attrs);return i(ie,Re({},n,{icon:Ln}),null)};De.displayName="RightCircleOutlined";De.inheritAttrs=!1;const Ol=De,xn="/infinite_image_browsing/fe-static/assets/fullscreen-7f54b926.svg",_e=()=>{const e=Array.from(document.querySelectorAll(".ant-image-preview-wrap")).find(t=>t.style.display!=="none");e?(console.log("closeImageFullscreenPreview success"),Pn(e)):console.log("closeImageFullscreenPreview not found")};function Pn(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 Sn=(e,t)=>{const l=t.querySelector(`.idx-${e} .ant-image-img`);l?l.click():console.log("openImageFullscreenPreview error: not found",e,t)};function El(){const{previewIdx:e,eventEmitter:t,canLoadNext:l,previewing:n,sortedFiles:o,scroller:g,props:P}=ye().toRefs(),{state:S}=ye();let M=null;const W=(_,u)=>{var f;n.value=_,M!=null&&!_&&u&&((f=g.value)==null||f.scrollToItem(M),M=null)},z=()=>{P.value.mode==="walk"&&!k("next")&&l&&(Q.info(x("loadingNextFolder")),t.value.emit("loadNextDir",!0))};re("keydown",_=>{var u;if(n.value){let f=e.value;if(["ArrowDown","ArrowRight"].includes(_.key))for(f++;o.value[f]&&!G(o.value[f].name);)f++;else if(["ArrowUp","ArrowLeft"].includes(_.key))for(f--;o.value[f]&&!G(o.value[f].name);)f--;if(G((u=o.value[f])==null?void 0:u.name)??""){e.value=f;const O=g.value;O&&!(f>=O.$_startIndex&&f<=O.$_endIndex)&&(M=f)}z()}});const T=_=>{var f;let u=e.value;if(_==="next")for(u++;o.value[u]&&!G(o.value[u].name);)u++;else if(_==="prev")for(u--;o.value[u]&&!G(o.value[u].name);)u--;if(G((f=o.value[u])==null?void 0:f.name)??""){e.value=u;const O=g.value;O&&!(u>=O.$_startIndex&&u<=O.$_endIndex)&&(M=u)}z()},k=_=>{var f;let u=e.value;if(_==="next")for(u++;o.value[u]&&!G(o.value[u].name);)u++;else if(_==="prev")for(u--;o.value[u]&&!G(o.value[u].name);)u--;return G((f=o.value[u])==null?void 0:f.name)??""};return Le("removeFiles",async()=>{n.value&&!S.sortedFiles[e.value]&&_e()}),{previewIdx:e,onPreviewVisibleChange:W,previewing:n,previewImgMove:T,canPreview:k}}function Oe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ht(e)}function Ll(){const{currLocation:e,sortedFiles:t,currPage:l,multiSelectedIdxs:n,eventEmitter:o,walker:g}=ye().toRefs(),P=()=>{n.value=[]};return re("click",()=>{B.keepMultiSelect||P()}),re("blur",()=>{B.keepMultiSelect||P()}),oe(l,P),{onFileDragStart:(z,T)=>{const k=mt(t.value[T]);Xe.fileDragging=!0,console.log("onFileDragStart set drag file ",z,T,k);const _=[k];let u=k.type==="dir";if(n.value.includes(T)){const O=n.value.map(A=>t.value[A]);_.push(...O),u=O.some(A=>A.type==="dir")}const f={includeDir:u,loc:e.value||"search-result",path:je(_,"fullpath").map(O=>O.fullpath),nodes:je(_,"fullpath"),__id:"FileTransferData"};z.dataTransfer.setData("text/plain",JSON.stringify(f))},onDrop:async z=>{if(g.value)return;const T=gt(z);if(!T)return;const k=e.value;if(T.loc===k)return;const _=Pe(),u=async()=>_.pushAction(async()=>{await it(T.path,k),o.value.emit("refresh"),ve.destroyAll()}),f=()=>_.pushAction(async()=>{await $e(T.path,k),te.emit("removeFiles",{paths:T.path,loc:T.loc}),o.value.emit("refresh"),ve.destroyAll()});ve.confirm({title:x("confirm")+"?",width:"60vw",content:()=>{let O,A,C;return i("div",null,[i("div",null,[`${x("moveSelectedFilesTo")} ${k}`,i("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[T.path.map(E=>i("li",null,[E.split(/[/\\]/).pop()]))])]),i(rt,null,null),i("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},class:"actions"},[i(se,{onClick:ve.destroyAll},Oe(O=x("cancel"))?O:{default:()=>[O]}),i(se,{type:"primary",loading:!_.isIdle,onClick:u},Oe(A=x("copy"))?A:{default:()=>[A]}),i(se,{type:"primary",loading:!_.isIdle,onClick:f},Oe(C=x("move"))?C:{default:()=>[C]})])])},maskClosable:!0,wrapClassName:"hidden-antd-btns-modal"})},multiSelectedIdxs:n,onFileDragEnd:()=>{Xe.fileDragging=!1}}}function $l({openNext:e}){const t=Z(!1),l=Z(""),{sortedFiles:n,previewIdx:o,multiSelectedIdxs:g,stack:P,currLocation:S,spinning:M,previewing:W,stackViewEl:z,eventEmitter:T,props:k,deletedFiles:_}=ye().toRefs(),u=Be;Le("removeFiles",({paths:E,loc:s})=>{u(s)!==u(S.value)||!xe(P.value)||(E.forEach(d=>_.value.add(d)),E.filter(G).forEach(d=>_.value.add(d.replace(/\.\w+$/,".txt"))))}),Le("addFiles",({files:E,loc:s})=>{if(u(s)!==u(S.value))return;const p=xe(P.value);p&&p.files.unshift(...E)});const f=Pe(),O=async(E,s,p)=>{o.value=p,B.fullscreenPreviewInitialUrl=le(s);const d=g.value.indexOf(p);if(E.shiftKey){if(d!==-1)g.value.splice(d,1);else{g.value.push(p),g.value.sort((D,U)=>D-U);const N=g.value[0],q=g.value[g.value.length-1];g.value=Xt(N,q+1)}E.stopPropagation()}else E.ctrlKey||E.metaKey?(d!==-1?g.value.splice(d,1):g.value.push(p),E.stopPropagation()):await e(s)},A=async(E,s,p)=>{var R,ne,ue;const d=le(s),N=S.value,q={IIB_container_id:parent.IIB_container_id},D=()=>{let c=[];return g.value.includes(p)?c=g.value.map(v=>n.value[v]):c.push(s),c},U=async c=>{if(!M.value)try{M.value=!0,await $t(s.fullpath),he.postMessage({...q,event:"click_hidden_button",btnEleId:"iib_hidden_img_update_trigger"}),await xt(),he.postMessage({...q,event:"click_hidden_button",btnEleId:`iib_hidden_tab_${c}`})}catch(v){console.error(v),Q.error("发送图像失败,请携带console的错误消息找开发者")}finally{M.value=!1}},H=`${E.key}`;if(H.startsWith("toggle-tag-")){const c=+H.split("toggle-tag-")[1],{is_remove:v}=await yt({tag_id:c,img_path:s.fullpath}),a=(ne=(R=B.conf)==null?void 0:R.all_custom_tags.find(r=>r.id===c))==null?void 0:ne.name;await ke.refreshTags([s.fullpath]),Q.success(x(v?"removedTagFromImage":"addedTagToImage",{tag:a}));return}else if(H.startsWith("batch-add-tag-")||H.startsWith("batch-remove-tag-")){const c=+H.split("-tag-")[1],v=H.includes("add")?"add":"remove",a=D().map(r=>r.fullpath);await _t({tag_id:c,img_paths:a,action:v}),await ke.refreshTags(a),Q.success(x(v==="add"?"addCompleted":"removeCompleted"));return}else if(H.startsWith("copy-to-")){const c=H.split("copy-to-")[1],v=D(),a=v.map(r=>r.fullpath);await it(a,c,!0),te.emit("addFiles",{files:v,loc:c}),Q.success(x("copySuccess"));return}else if(H.startsWith("move-to-")){const c=H.split("move-to-")[1],v=D(),a=v.map(r=>r.fullpath);await $e(a,c,!0),te.emit("removeFiles",{paths:a,loc:S.value}),te.emit("addFiles",{files:v,loc:c}),Q.success(x("moveSuccess"));return}switch(E.key){case"previewInNewWindow":return window.open(d);case"copyFilePath":return fe(s.fullpath);case"saveSelectedAsJson":return Lt(D());case"openWithDefaultApp":return Et(s.fullpath);case"download":{const c=D();Ot(c.map(v=>le(v,!0)));break}case"copyPreviewUrl":return fe(parent.document.location.origin+d);case"rename":{let c=await Jt(s.fullpath);c=Be(c);const v=ke.tagMap;v.set(c,v.get(s.fullpath)??[]),v.delete(s.fullpath),s.fullpath=c,s.name=c.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 c=B.quickMovePaths.find(r=>r.key==="outdir_save");if(!c)return Q.error(x("unknownSavedDir"));const v=kt(c.dir,(ue=B.conf)==null?void 0:ue.sd_cwd),a=D();await $e(a.map(r=>r.fullpath),v,!0),te.emit("removeFiles",{paths:a.map(r=>r.fullpath),loc:S.value}),te.emit("addFiles",{files:a,loc:v});break}case"send2controlnet-img2img":case"send2controlnet-txt2img":{const c=E.key.split("-")[1];he.postMessage({...q,event:"send_to_control_net",type:c,url:le(s)});break}case"send2outpaint":{l.value=await f.pushAction(()=>Ee(s.fullpath)).res;const[c,v]=(l.value||"").split(`
|
||
`);he.postMessage({...q,event:"send_to_outpaint",url:le(s),prompt:c,negPrompt:v.slice(17)});break}case"openWithWalkMode":{Ye.set(N,P.value);const c=B.tabList[k.value.tabIdx],v={type:"local",key:me(),path:s.fullpath,name:x("local"),stackKey:N,mode:"walk"};c.panes.push(v),c.key=v.key;break}case"openFileLocationInNewTab":case"openInNewTab":{const c=B.tabList[k.value.tabIdx],v={type:"local",key:me(),path:E.key==="openInNewTab"?s.fullpath:bt(s.fullpath),name:x("local"),mode:"scanned-fixed"};c.panes.push(v),c.key=v.key;break}case"openOnTheRight":{Ye.set(N,P.value);let c=B.tabList[k.value.tabIdx+1];c||(c={panes:[],key:"",id:me()},B.tabList[k.value.tabIdx+1]=c);const v={type:"local",key:me(),path:s.fullpath,name:x("local"),stackKey:N};c.panes.push(v),c.key=v.key;break}case"send2BatchDownload":{Yt.addFiles(D());break}case"viewGenInfo":{t.value=!0,l.value=await f.pushAction(()=>Ee(s.fullpath)).res;break}case"openWithLocalFileBrowser":{await wt(s.fullpath);break}case"deleteFiles":{const c=D(),v=async()=>{const a=c.map(r=>r.fullpath);if(await Kt(a),Q.success(x("deleteSuccess")),W.value){const r=le(s)===B.fullscreenPreviewInitialUrl,K=o.value===n.value.length-1;if((r||K)&&(_e(),await He(100),r&&n.value.length>1)){const X=o.value;He(0).then(()=>Sn(X,z.value))}}te.emit("removeFiles",{paths:a,loc:S.value})};if(c.length===1&&B.ignoredConfirmActions.deleteOneOnly)return v();await new Promise(a=>{ve.confirm({title:x("confirmDelete"),maskClosable:!0,width:"60vw",content:()=>i("div",null,[i("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[c.map(r=>i("li",null,[r.fullpath.split(/[/\\]/).pop()]))]),i(rt,null,null),i(Qt,{checked:B.ignoredConfirmActions.deleteOneOnly,"onUpdate:checked":r=>B.ignoredConfirmActions.deleteOneOnly=r},{default:()=>[x("deleteOneOnlySkipConfirm"),$(" ("),x("resetOnGlobalSettingsPage"),$(")")]})]),async onOk(){await v(),a()}})});break}}return{}},{isOutside:C}=lt(z);return re("keydown",E=>{var p,d,N;const s=Zt(E);if(W.value){s==="Esc"&&_e();const q=(p=Object.entries(B.shortcut).find(D=>D[1]===s&&D[1]))==null?void 0:p[0];if(q){E.stopPropagation(),E.preventDefault();const D=o.value,U=n.value[D];switch(q){case"delete":return A({key:"deleteFiles"},U,D);case"download":return A({key:"download"},U,D);default:{const H=(d=/^toggle_tag_(.*)$/.exec(q))==null?void 0:d[1],R=(N=B.conf)==null?void 0:N.all_custom_tags.find(ne=>ne.name===H);return R?A({key:`toggle-tag-${R.id}`},U,D):void 0}}}}else!C.value&&["Ctrl + KeyA","Cmd + KeyA"].includes(s)&&(E.preventDefault(),E.stopPropagation(),T.value.emit("selectAll"))}),{onFileItemClick:O,onContextMenuClick:A,showGenInfo:t,imageGenInfo:l,q:f}}function Cn(e,t,l,n){let o=0,g=0,P=typeof(n==null?void 0:n.width)=="number"?n.width:0,S=typeof(n==null?void 0:n.height)=="number"?n.height:0,M=typeof(n==null?void 0:n.left)=="number"?n.left:0,W=typeof(n==null?void 0:n.top)=="number"?n.top:0,z=!1;const T=s=>{s.stopPropagation(),s.preventDefault(),!(!e.value||!t.value)&&(o=s instanceof MouseEvent?s.clientX:s.touches[0].clientX,g=s instanceof MouseEvent?s.clientY:s.touches[0].clientY,P=e.value.offsetWidth,S=e.value.offsetHeight,t.value.offsetLeft,t.value.offsetTop,document.documentElement.addEventListener("mousemove",k),document.documentElement.addEventListener("touchmove",k),document.documentElement.addEventListener("mouseup",_),document.documentElement.addEventListener("touchend",_))},k=s=>{if(!e.value||!t.value)return;let p=P+((s instanceof MouseEvent?s.clientX:s.touches[0].clientX)-o),d=S+((s instanceof MouseEvent?s.clientY:s.touches[0].clientY)-g);e.value.offsetLeft+p>window.innerWidth&&(p=window.innerWidth-e.value.offsetLeft),e.value.offsetTop+d>window.innerHeight&&(d=window.innerHeight-e.value.offsetTop),e.value.style.width=`${p}px`,e.value.style.height=`${d}px`,n!=null&&n.onResize&&n.onResize(p,d)},_=()=>{document.documentElement.removeEventListener("mousemove",k),document.documentElement.removeEventListener("touchmove",k),document.documentElement.removeEventListener("mouseup",_),document.documentElement.removeEventListener("touchend",_)},u=s=>{s.stopPropagation(),s.preventDefault(),!(!e.value||!l.value)&&(z=!0,M=e.value.offsetLeft,W=e.value.offsetTop,o=s instanceof MouseEvent?s.clientX:s.touches[0].clientX,g=s instanceof MouseEvent?s.clientY:s.touches[0].clientY,document.documentElement.addEventListener("mousemove",f),document.documentElement.addEventListener("touchmove",f),document.documentElement.addEventListener("mouseup",O),document.documentElement.addEventListener("touchend",O))},f=s=>{if(!e.value||!l.value||!z)return;const p=M+((s instanceof MouseEvent?s.clientX:s.touches[0].clientX)-o),d=W+((s instanceof MouseEvent?s.clientY:s.touches[0].clientY)-g);p<0?e.value.style.left="0px":p+e.value.offsetWidth>window.innerWidth?e.value.style.left=`${window.innerWidth-e.value.offsetWidth}px`:e.value.style.left=`${p}px`,d<0?e.value.style.top="0px":d+e.value.offsetHeight>window.innerHeight?e.value.style.top=`${window.innerHeight-e.value.offsetHeight}px`:e.value.style.top=`${d}px`,n!=null&&n.onDrag&&n.onDrag(p,d)},O=()=>{z=!1,document.documentElement.removeEventListener("mousemove",f),document.documentElement.removeEventListener("touchmove",f),document.documentElement.removeEventListener("mouseup",O),document.documentElement.removeEventListener("touchend",O)},A=()=>{if(!e.value||!t.value)return;let s=e.value.offsetLeft,p=e.value.offsetTop,d=e.value.offsetWidth,N=e.value.offsetHeight;s+d>window.innerWidth&&(s=window.innerWidth-d,s<0&&(s=0,d=window.innerWidth)),p+N>window.innerHeight&&(p=window.innerHeight-N,p<0&&(p=0,N=window.innerHeight)),e.value.style.left=`${s}px`,e.value.style.top=`${p}px`,e.value.style.width=`${d}px`,e.value.style.height=`${N}px`},C=()=>{!e.value||!n||(typeof n.width=="number"&&(e.value.style.width=`${n.width}px`),typeof n.height=="number"&&(e.value.style.height=`${n.height}px`),typeof n.left=="number"&&(e.value.style.left=`${n.left}px`),typeof n.top=="number"&&(e.value.style.top=`${n.top}px`),A(),window.addEventListener("resize",A))},E=()=>{document.documentElement.removeEventListener("mousemove",k),document.documentElement.removeEventListener("touchmove",k),document.documentElement.removeEventListener("mouseup",_),document.documentElement.removeEventListener("touchend",_),document.documentElement.removeEventListener("mousemove",f),document.documentElement.removeEventListener("touchmove",f),document.documentElement.removeEventListener("mouseup",O),document.documentElement.removeEventListener("touchend",O),window.removeEventListener("resize",A)};return at(C),nt(E),oe(()=>n==null?void 0:n.disbaled,async s=>{await Pt(),s!==void 0&&(s?E():C())}),oe(()=>[e.value,t.value,l.value],([s,p,d])=>{s&&p&&(p.addEventListener("mousedown",T),p.addEventListener("touchstart",T)),s&&d&&(d.addEventListener("mousedown",u),d.addEventListener("touchstart",u))}),{handleResizeMouseDown:T,handleDragMouseDown:u}}let et=null;const Fn=()=>{var S,M;const e=Se(),t=St(et??((M=(S=e.conf)==null?void 0:S.app_fe_setting)==null?void 0:M.fullscreen_layout)??{enable:!1,panelWidth:384,alwaysOn:!0}),l="--iib-lr-layout-info-panel-width",n=J(()=>t.alwaysOn&&t.enable?t.panelWidth:0);oe(t,()=>{tt(t,l,n),In(t),et=t},{deep:!0}),at(()=>tt(t,l,n));const{enable:o,panelWidth:g,alwaysOn:P}=Ct(t);return{state:t,isLeftRightLayout:o,panelwidtrhStyleVarName:l,lrLayoutInfoPanelWidth:g,lrMenuAlwaysOn:P}},In=pe(e=>Ft("fullscreen_layout",e),300),tt=pe((e,t,l)=>{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",`${l.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=>(Vt("data-v-6d0bf78c"),e=e(),qt(),e),Mn={key:0},Tn={class:"container"},Dn={class:"action-bar"},An=["title"],zn=["title"],Nn=["title"],Wn=["src"],jn={key:0,class:"icon",style:{cursor:"pointer"}},Bn={key:2,"flex-placeholder":""},Hn={key:3,class:"action-bar"},Un={key:0,class:"gen-info"},Vn={class:"info-tags"},qn={class:"name"},Xn={class:"value"},Yn={key:0,class:"tags-container"},Gn=["onClick"],Jn={class:"lr-layout-control"},Kn={class:"ctrl-item"},Qn={class:"ctrl-item"},Zn={class:"ctrl-item"},Rn=ce(()=>F("br",null,null,-1)),el=ce(()=>F("h3",null,"Prompt",-1)),tl=["innerHTML"],nl=ce(()=>F("br",null,null,-1)),ll=ce(()=>F("h3",null,"Negative Prompt",-1)),al=["innerHTML"],sl=ce(()=>F("br",null,null,-1)),ol=ce(()=>F("h3",null,"Params",-1)),rl={style:{"font-weight":"600","text-transform":"capitalize"}},il=["onDblclick"],cl=["onDblclick"],ul=["title"],dl=st({__name:"fullScreenContextMenu",props:{file:{},idx:{}},emits:["contextMenuClick"],setup(e,{emit:t}){const l=e;It(a=>({"6d199430":m(p)?0:"46px","44764cdb":m(s)+"px","519f1f5f":`calc(100vw - ${m(s)}px)`}));const n=Se(),o=Mt(),g=Z(),P=J(()=>o.tagMap.get(l.file.fullpath)??[]),S=Z(""),M=Pe(),W=Z(""),z=J(()=>W.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")),T=J(()=>z.value.split(`
|
||
`)),k=J(()=>Ue(z.value)),_=J(()=>{let a=Ue(z.value);return delete a.prompt,delete a.negativePrompt,a});oe(()=>{var a;return(a=l==null?void 0:l.file)==null?void 0:a.fullpath},async a=>{a&&(M.tasks.forEach(r=>r.cancel()),M.pushAction(()=>Ee(a)).res.then(r=>{W.value=r}))},{immediate:!0});const u=Ve("iib@fullScreenContextMenu.prompt-tab","structedData"),f=Z(),O=Z(),A={left:100,top:100,width:512,height:384,expanded:!0},C=Ve("fullScreenContextMenu.vue-drag",A);C.value&&(C.value.left<0||C.value.top<0)&&(C.value={...A});const{isLeftRightLayout:E,lrLayoutInfoPanelWidth:s,lrMenuAlwaysOn:p}=Fn(),d=E;Cn(g,f,O,{disbaled:d,...C.value,onDrag:pe(function(a,r){C.value={...C.value,left:a,top:r}},300),onResize:pe(function(a,r){C.value={...C.value,width:a,height:r}},300)});const N=Z(!1),{isOutside:q}=lt(J(()=>!d.value||p.value?null:N.value?g.value:xe(document.querySelectorAll(".iib-tab-edge-trigger"))));oe(q,ln(a=>{N.value=!a},300));function D(a){return a.parentNode}function U(a){if(!a)return"";let r="";const K=a.split(/[\n,]+/).map(I=>I.trim()).filter(I=>I);let X=!1;for(let I=0;I<K.length;I++){const ee=K[I];X||(X=ee.includes("(")),r+=`<span class="${X?"has-parentheses":""}">${ee}</span>`,I<K.length-1&&(r+=","),X&&(X=!ee.includes(")"))}return r}re("load",a=>{const r=a.target;r.className==="ant-image-preview-img"&&(S.value=`${r.naturalWidth} x ${r.naturalHeight}`)},{capture:!0});const H=J(()=>{const a=[{name:x("fileName"),val:l.file.name},{name:x("fileSize"),val:l.file.size}];return S.value&&a.push({name:x("resolution"),val:S.value}),a}),R=()=>{const a="Negative prompt:",r=W.value.includes(a)?W.value.split(a)[0]:T.value[0]??"";fe(be(r.trim()))},ne=()=>document.body.requestFullscreen(),ue=a=>{fe(typeof a=="object"?JSON.stringify(a,null,4):a)},c=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 r;((r=a.target)==null?void 0:r.className)==="ant-image-preview-img"&&_e()});const v=J(()=>d.value||C.value.expanded);return(a,r)=>{var We;const K=tn,X=se,I=zt,ee=Nt,Ae=Wt,ct=jt,ut=se,ze=Rt,dt=en,vt=Bt,Ne=Ht,ft=Ut;return y(),L("div",{ref_key:"el",ref:g,class:qe(["full-screen-menu",{"unset-size":!m(C).expanded,lr:m(d),"always-on":m(p),"mouse-in":N.value}]),onWheelCapture:r[9]||(r[9]=At(()=>{},["stop"])),onKeydownCapture:c},[m(d)?(y(),L("div",Mn)):j("",!0),F("div",Tn,[F("div",Dn,[m(d)?j("",!0):(y(),L("div",{key:0,ref_key:"dragHandle",ref:O,class:"icon",style:{cursor:"grab"},title:m(x)("dragToMovePanel")},[i(m(vn))],8,An)),m(d)?j("",!0):(y(),L("div",{key:1,class:"icon",style:{cursor:"pointer"},onClick:r[0]||(r[0]=w=>m(C).expanded=!m(C).expanded),title:m(x)("clickToToggleMaximizeMinimize")},[v.value?(y(),ae(m(gn),{key:0})):(y(),ae(m(wn),{key:1}))],8,zn)),F("div",{style:{display:"flex","flex-direction":"column","align-items":"center",cursor:"grab"},class:"icon",title:m(x)("fullscreenview"),onClick:ne},[F("img",{src:m(xn),style:{width:"21px",height:"21px","padding-bottom":"2px"},alt:""},null,8,Wn)],8,Nn),i(K,{"get-popup-container":D},{overlay:h(()=>[i(Gt,{file:a.file,idx:a.idx,"selected-tag":P.value,onContextMenuClick:r[1]||(r[1]=(w,V,we)=>t("contextMenuClick",w,V,we))},null,8,["file","idx","selected-tag"])]),default:h(()=>[m(C).expanded?j("",!0):(y(),L("div",jn,[i(m(Tt))]))]),_:1}),v.value?(y(),L("div",Bn)):j("",!0),v.value?(y(),L("div",Hn,[i(K,{trigger:["hover"],"get-popup-container":D},{overlay:h(()=>[i(ct,{onClick:r[2]||(r[2]=w=>t("contextMenuClick",w,a.file,a.idx))},{default:h(()=>{var w;return[((w=m(n).conf)==null?void 0:w.launch_mode)!=="server"?(y(),L(Y,{key:0},[i(I,{key:"send2txt2img"},{default:h(()=>[$(b(a.$t("sendToTxt2img")),1)]),_:1}),i(I,{key:"send2img2img"},{default:h(()=>[$(b(a.$t("sendToImg2img")),1)]),_:1}),i(I,{key:"send2inpaint"},{default:h(()=>[$(b(a.$t("sendToInpaint")),1)]),_:1}),i(I,{key:"send2extras"},{default:h(()=>[$(b(a.$t("sendToExtraFeatures")),1)]),_:1}),i(ee,{key:"sendToThirdPartyExtension",title:a.$t("sendToThirdPartyExtension")},{default:h(()=>[i(I,{key:"send2controlnet-txt2img"},{default:h(()=>[$("ControlNet - "+b(a.$t("t2i")),1)]),_:1}),i(I,{key:"send2controlnet-img2img"},{default:h(()=>[$("ControlNet - "+b(a.$t("i2i")),1)]),_:1}),i(I,{key:"send2outpaint"},{default:h(()=>[$("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):j("",!0),i(I,{key:"send2BatchDownload"},{default:h(()=>[$(b(a.$t("sendToBatchDownload")),1)]),_:1}),i(ee,{key:"copy2target",title:a.$t("copyTo")},{default:h(()=>[(y(!0),L(Y,null,de(m(n).quickMovePaths,V=>(y(),ae(I,{key:`copy-to-${V.dir}`},{default:h(()=>[$(b(V.zh),1)]),_:2},1024))),128))]),_:1},8,["title"]),i(ee,{key:"move2target",title:a.$t("moveTo")},{default:h(()=>[(y(!0),L(Y,null,de(m(n).quickMovePaths,V=>(y(),ae(I,{key:`move-to-${V.dir}`},{default:h(()=>[$(b(V.zh),1)]),_:2},1024))),128))]),_:1},8,["title"]),i(Ae),i(I,{key:"deleteFiles"},{default:h(()=>[$(b(a.$t("deleteSelected")),1)]),_:1}),i(I,{key:"previewInNewWindow"},{default:h(()=>[$(b(a.$t("previewInNewWindow")),1)]),_:1}),i(I,{key:"copyPreviewUrl"},{default:h(()=>[$(b(a.$t("copySourceFilePreviewLink")),1)]),_:1}),i(I,{key:"copyFilePath"},{default:h(()=>[$(b(a.$t("copyFilePath")),1)]),_:1})]}),_:1})]),default:h(()=>[i(X,null,{default:h(()=>[$(b(m(x)("openContextMenu")),1)]),_:1})]),_:1}),i(ut,{onClick:r[3]||(r[3]=w=>t("contextMenuClick",{key:"download"},l.file,l.idx))},{default:h(()=>[$(b(a.$t("download")),1)]),_:1}),W.value?(y(),ae(X,{key:0,onClick:r[4]||(r[4]=w=>m(fe)(W.value))},{default:h(()=>[$(b(a.$t("copyPrompt")),1)]),_:1})):j("",!0),W.value?(y(),ae(X,{key:1,onClick:R},{default:h(()=>[$(b(a.$t("copyPositivePrompt")),1)]),_:1})):j("",!0)])):j("",!0)]),v.value?(y(),L("div",Un,[F("div",Vn,[(y(!0),L(Y,null,de(H.value,w=>(y(),L("span",{class:"info-tag",key:w.name},[F("span",qn,b(w.name),1),F("span",Xn,b(w.val),1)]))),128))]),(We=m(n).conf)!=null&&We.all_custom_tags?(y(),L("div",Yn,[(y(!0),L(Y,null,de(m(n).conf.all_custom_tags,w=>(y(),L("div",{class:qe(["tag",{selected:P.value.some(V=>V.id===w.id)}]),onClick:V=>t("contextMenuClick",{key:`toggle-tag-${w.id}`},a.file,a.idx),key:w.id,style:Dt({"--tag-color":m(o).getColor(w.name)})},b(w.name),15,Gn))),128))])):j("",!0),F("div",Jn,[F("div",Kn,[$(b(a.$t("experimentalLRLayout"))+": ",1),i(ze,{checked:m(d),"onUpdate:checked":r[5]||(r[5]=w=>ge(d)?d.value=w:null),size:"small"},null,8,["checked"])]),m(d)?(y(),L(Y,{key:0},[F("div",Qn,[$(b(a.$t("width"))+": ",1),i(dt,{value:m(s),"onUpdate:value":r[6]||(r[6]=w=>ge(s)?s.value=w:null),style:{width:"64px"},step:16,min:128,max:1024},null,8,["value"])]),i(vt,{title:a.$t("alwaysOnTooltipInfo")},{default:h(()=>[F("div",Zn,[$(b(a.$t("alwaysOn"))+": ",1),i(ze,{checked:m(p),"onUpdate:checked":r[7]||(r[7]=w=>ge(p)?p.value=w:null),size:"small"},null,8,["checked"])])]),_:1},8,["title"])],64)):j("",!0)]),i(ft,{activeKey:m(u),"onUpdate:activeKey":r[8]||(r[8]=w=>ge(u)?u.value=w:null)},{default:h(()=>[i(Ne,{key:"structedData",tab:a.$t("structuredData")},{default:h(()=>[F("div",null,[k.value.prompt?(y(),L(Y,{key:0},[Rn,el,F("code",{innerHTML:U(k.value.prompt??"")},null,8,tl)],64)):j("",!0),k.value.negativePrompt?(y(),L(Y,{key:1},[nl,ll,F("code",{innerHTML:U(k.value.negativePrompt??"")},null,8,al)],64)):j("",!0)]),Object.keys(_.value).length?(y(),L(Y,{key:0},[sl,ol,F("table",null,[(y(!0),L(Y,null,de(_.value,(w,V)=>(y(),L("tr",{key:V,class:"gen-info-frag"},[F("td",rl,b(V),1),typeof w=="object"?(y(),L("td",{key:0,style:{cursor:"pointer"},onDblclick:we=>ue(w)},[F("code",null,b(w),1)],40,il)):(y(),L("td",{key:1,style:{cursor:"pointer"},onDblclick:we=>ue(m(be)(w))},b(m(be)(w)),41,cl))]))),128))])],64)):j("",!0)]),_:1},8,["tab"]),i(Ne,{key:"sourceText",tab:a.$t("sourceText")},{default:h(()=>[F("code",null,b(W.value),1)]),_:1},8,["tab"])]),_:1},8,["activeKey"])])):j("",!0)]),m(C).expanded&&!m(d)?(y(),L("div",{key:1,class:"mouse-sensor",ref_key:"resizeHandle",ref:f,title:m(x)("dragToResizePanel")},[i(m(rn))],8,ul)):j("",!0)],34)}}});const xl=ot(dl,[["__scopeId","data-v-6d0bf78c"]]),vl={key:0,class:"float-panel"},fl={key:0,class:"select-actions"},pl={key:1},ml=st({__name:"MultiSelectKeep",props:{show:{type:Boolean}},emits:["selectAll","reverseSelect","clearAllSelected"],setup(e,{emit:t}){const l=Se(),n=()=>{t("clearAllSelected"),l.keepMultiSelect=!1},o=()=>{l.keepMultiSelect=!0};return(g,P)=>{const S=se;return g.show?(y(),L("div",vl,[m(l).keepMultiSelect?(y(),L("div",fl,[i(S,{size:"small",onClick:P[0]||(P[0]=M=>t("selectAll"))},{default:h(()=>[$(b(g.$t("select-all")),1)]),_:1}),i(S,{size:"small",onClick:P[1]||(P[1]=M=>t("reverseSelect"))},{default:h(()=>[$(b(g.$t("rerverse-select")),1)]),_:1}),i(S,{size:"small",onClick:P[2]||(P[2]=M=>t("clearAllSelected"))},{default:h(()=>[$(b(g.$t("clear-all-selected")),1)]),_:1}),i(S,{size:"small",onClick:n},{default:h(()=>[$(b(g.$t("exit")),1)]),_:1})])):(y(),L("div",pl,[i(S,{size:"small",type:"primary",onClick:o},{default:h(()=>[$(b(g.$t("keep-multi-selected")),1)]),_:1})]))])):j("",!0)}}});const Pl=ot(ml,[["__scopeId","data-v-b04c3508"]]);export{kl as L,Pl as M,Ol as R,Ll as a,$l as b,El as c,xl as f,re as u};
|