import{h as C,E as ke,$ as U,c as b,H as n,Q as p,U as g,n as r,u as d,J as c,W as $e,L as v,F as N,q as K,I as P,N as I,f as R,r as ze,G as Ce,Y as qe,K as x,M as J,O as ge,P as pe,S as Ye,Z as Fe,V as X,_ as ne,a5 as Be,a6 as Xe,a7 as vt,a8 as ht,w as ft,v as _t,x as Ie,a9 as yt}from"./vue-BQgCUbk_.js";import{aL as Z,aM as bt,$ as re,aN as f,e as ee,Q as W,Y as gt,aO as Tt,g as Se,h as O,aP as Y,k as De,q as je,s as me,a as xe,V as Le,c as ve,d as Oe,f as Me,i as se,j as Re,Z as Ve,aQ as kt,aR as Pe,p as Ne,r as ye,v as be,E as We,a9 as $t,aS as Ze,m as F,aT as Te,aU as Qe,aV as Ct,aW as St,aX as Je,C as we,aY as et,aZ as tt,a_ as Vt,a$ as wt,b0 as D,b1 as ot,ac as Ue,X as Et,b2 as It,aH as Dt,b3 as Pt,x as Ke,b4 as Ae,b5 as At,__tla as __tla_0}from"./index-DF2-l4SD.js";import{d as Bt}from"./index-UntZWul-.js";import{_ as He,a as xt,__tla as __tla_1}from"./MoveTorrentDialog.vue_vue_type_script_setup_true_lang-G1lEzMcG.js";import{a as at,u as lt}from"./vuetify-DWkLi8Ew.js";import{u as Lt,__tla as __tla_2}from"./ArrayPagination-O41uS7-1.js";let ua;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})(),(()=>{try{return __tla_2}catch{}})()]).then(async()=>{let Ot,Mt,Rt,Nt,Ut,le,q,Ft,Ge,Kt,Ht,Gt,zt,qt,nt,Yt,Xt,jt,rt,Wt,Zt,Qt,st,Jt,eo,to,oo,it,ao,lo,no,ro,dt,so,io,ut,uo,co,ct,mo,po,vo,mt,ho,fo,pt,_o,yo,bo,go,To,ko,$o,Co,So,Vo,wo,Eo,Io,Do,Po,Ao,Bo,xo,Lo,Oo,Mo,Ro,No,Uo,Fo,Ko,Ho,Go,zo,qo,Yo,Xo,jo,Wo,Zo,Qo,Jo,ea,ta,oa,aa;Ot={class:"d-flex my-3"};Mt={class:"pa-0"};Rt={class:"d-flex align-center text-uppercase text-select",style:{"font-size":"0.8em"}};Nt=C({__name:"Toolbar",setup(y){const{t:e}=ke(),s=Z(),{torrentCountString:t,isSelectionMultiple:o,displayMode:i}=U(s),{isDrawerOpen:a}=U(bt()),u=re(),{sortOptions:m}=U(u),l=[{value:f.ADDED_ON,title:e("dashboard.sortBy.added_on")},{value:f.AMOUNT_LEFT,title:e("dashboard.sortBy.amount_left")},{value:f.AUTO_TMM,title:e("dashboard.sortBy.auto_tmm")},{value:f.AVAILABILITY,title:e("dashboard.sortBy.availability")},{value:f.AVG_DOWNLOAD_SPEED,title:e("dashboard.sortBy.avg_download_speed")},{value:f.AVG_UPLOAD_SPEED,title:e("dashboard.sortBy.avg_upload_speed")},{value:f.CATEGORY,title:e("dashboard.sortBy.category")},{value:f.COMPLETED,title:e("dashboard.sortBy.completed")},{value:f.COMPLETION_ON,title:e("dashboard.sortBy.completion_on")},{value:f.CONTENT_PATH,title:e("dashboard.sortBy.content_path")},{value:f.DL_LIMIT,title:e("dashboard.sortBy.dl_limit")},{value:f.DLSPEED,title:e("dashboard.sortBy.dlspeed")},{value:f.DOWNLOAD_PATH,title:e("dashboard.sortBy.download_path")},{value:f.DOWNLOADED,title:e("dashboard.sortBy.downloaded")},{value:f.DOWNLOADED_SESSION,title:e("dashboard.sortBy.downloaded_session")},{value:f.ETA,title:e("dashboard.sortBy.eta")},{value:f.F_L_PIECE_PRIO,title:e("dashboard.sortBy.f_l_piece_prio")},{value:f.FORCE_START,title:e("dashboard.sortBy.force_start")},{value:f.GLOBALSPEED,title:e("dashboard.sortBy.globalSpeed")},{value:f.GLOBALVOLUME,title:e("dashboard.sortBy.globalVolume")},{value:f.HASH,title:e("dashboard.sortBy.hash")},{value:f.INFOHASH_V1,title:e("dashboard.sortBy.infohash_v1")},{value:f.INFOHASH_V2,title:e("dashboard.sortBy.infohash_v2")},{value:f.LAST_ACTIVITY,title:e("dashboard.sortBy.last_activity")},{value:f.MAGNET_URI,title:e("dashboard.sortBy.magnet_uri")},{value:f.MAX_RATIO,title:e("dashboard.sortBy.max_ratio")},{value:f.MAX_SEEDING_TIME,title:e("dashboard.sortBy.max_seeding_time")},{value:f.NAME,title:e("dashboard.sortBy.name")},{value:f.NUM_COMPLETE,title:e("dashboard.sortBy.num_complete")},{value:f.NUM_INCOMPLETE,title:e("dashboard.sortBy.num_incomplete")},{value:f.NUM_LEECHS,title:e("dashboard.sortBy.num_leechs")},{value:f.NUM_SEEDS,title:e("dashboard.sortBy.num_seeds")},{value:f.PRIORITY,title:e("dashboard.sortBy.priority")},{value:f.PROGRESS,title:e("dashboard.sortBy.progress")},{value:f.RATIO,title:e("dashboard.sortBy.ratio")},{value:f.RATIO_LIMIT,title:e("dashboard.sortBy.ratio_limit")},{value:f.SAVE_PATH,title:e("dashboard.sortBy.save_path")},{value:f.SEEDING_TIME,title:e("dashboard.sortBy.seeding_time")},{value:f.SEEDING_TIME_LIMIT,title:e("dashboard.sortBy.seeding_time_limit")},{value:f.SEEN_COMPLETE,title:e("dashboard.sortBy.seen_complete")},{value:f.SEQ_DL,title:e("dashboard.sortBy.seq_dl")},{value:f.SIZE,title:e("dashboard.sortBy.size")},{value:f.STATE,title:e("dashboard.sortBy.state")},{value:f.SUPER_SEEDING,title:e("dashboard.sortBy.super_seeding")},{value:f.TAGS,title:e("dashboard.sortBy.tags")},{value:f.TIME_ACTIVE,title:e("dashboard.sortBy.time_active")},{value:f.TOTAL_SIZE,title:e("dashboard.sortBy.total_size")},{value:f.TRACKER,title:e("dashboard.sortBy.tracker")},{value:f.TRACKERS_COUNT,title:e("dashboard.sortBy.trackers_count")},{value:f.UP_LIMIT,title:e("dashboard.sortBy.up_limit")},{value:f.UPLOADED,title:e("dashboard.sortBy.uploaded")},{value:f.UPLOADED_SESSION,title:e("dashboard.sortBy.uploaded_session")},{value:f.UPSPEED,title:e("dashboard.sortBy.upspeed")}].sort((A,T)=>A.title.localeCompare(T.title));l.splice(0,0,{value:f.DEFAULT,title:e("dashboard.sortBy.default")});function h(){u.textFilter=""}const _=b({get:()=>u.textFilter,set:Bt(A=>{u.textFilter=A??""},300)});function B(){o.value&&s.unselectAllTorrents(),o.value=!o.value}return(A,T)=>(n(),p(N,null,[g("div",null,[r(ee,{id:"searchInput",modelValue:_.value,"onUpdate:modelValue":T[0]||(T[0]=S=>_.value=S),label:d(e)("dashboard.searchInputLabel"),clearable:"",density:"compact","single-line":"","hide-details":"","prepend-inner-icon":"mdi-magnify",variant:"solo","onClick:clear":T[1]||(T[1]=S=>h())},null,8,["modelValue","label"])]),g("div",Ot,[r(W,{text:d(e)("dashboard.toggleSelectMode"),location:"top"},{activator:c(({props:S})=>[r(O,K({icon:d(o)?"mdi-checkbox-marked":"mdi-checkbox-blank-outline"},S,{variant:"plain",onClick:B}),null,16,["icon"])]),_:1},8,["text"]),r(gt,null,{activator:c(({props:S})=>[r(W,{text:A.$t("dashboard.displayMode.title"),location:"top"},{activator:c(({props:V})=>[r(O,K({icon:""},K(S,V),{variant:"plain"}),{default:c(()=>[d(i)===d(Y).LIST?(n(),P(De,{key:0,icon:"mdi-view-list"})):I("",!0),d(i)===d(Y).GRID?(n(),P(De,{key:1,icon:"mdi-view-grid"})):I("",!0),d(i)===d(Y).TABLE?(n(),P(De,{key:2,icon:"mdi-table"})):I("",!0)]),_:2},1040)]),_:2},1032,["text"])]),default:c(()=>[r(je,null,{default:c(()=>[r(me,{title:A.$t("dashboard.displayMode.list"),"prepend-icon":"mdi-view-list",onClick:T[2]||(T[2]=S=>i.value=d(Y).LIST)},null,8,["title"]),r(me,{title:A.$t("dashboard.displayMode.grid"),"prepend-icon":"mdi-view-grid",onClick:T[3]||(T[3]=S=>i.value=d(Y).GRID)},null,8,["title"]),r(me,{title:A.$t("dashboard.displayMode.table"),"prepend-icon":"mdi-table",onClick:T[4]||(T[4]=S=>i.value=d(Y).TABLE)},null,8,["title"])]),_:1})]),_:1}),r(W,{text:d(e)("dashboard.toggleSortOrder"),location:"top"},{activator:c(({props:S})=>[r(O,K({icon:d(m).reverseOrder?"mdi-arrow-up-thin":"mdi-arrow-down-thin"},S,{variant:"plain",onClick:T[5]||(T[5]=V=>d(m).reverseOrder=!d(m).reverseOrder)}),null,16,["icon"])]),_:1},8,["text"]),g("div",Mt,[r(Tt,{modelValue:d(m).sortBy,"onUpdate:modelValue":T[6]||(T[6]=S=>d(m).sortBy=S),items:d(l),label:d(e)("dashboard.sortLabel"),"auto-select-first":"",density:"compact","hide-details":"",variant:"solo-filled",style:$e(`width: ${A.$vuetify.display.xs||A.$vuetify.display.sm&&d(a)?140:260}px`)},null,8,["modelValue","items","label","style"])]),r(Se),g("div",Rt,v(d(t)),1)])],64))}});Ut=C({__name:"RenameTorrentDialog",props:{guid:{},hash:{}},setup(y){const e=y,{isOpened:s}=xe(e.guid),{t}=ke(),o=re(),i=R(),a=R(),u=R(!1),m=ze({newName:""}),l=[T=>!!T||t("dialogs.renameTorrent.required"),T=>T!==_.value||t("dialogs.renameTorrent.sameName")],h=b(()=>o.getTorrentByHash(e.hash)),_=b(()=>h.value?.name);async function B(){await a.value?.validate(),u.value&&(await o.renameTorrent(e.hash,m.newName),A())}const A=()=>{s.value=!1};return Ce(()=>{m.newName=h.value?.name||""}),qe(()=>{i.value?.select()}),(T,S)=>(n(),P(Re,{modelValue:d(s),"onUpdate:modelValue":S[3]||(S[3]=V=>pe(s)?s.value=V:null)},{default:c(()=>[r(se,null,{default:c(()=>[r(Le,null,{default:c(()=>[x(v(T.$t("dialogs.renameTorrent.title")),1)]),_:1}),r(ve,null,{default:c(()=>[r(d(Oe),{modelValue:u.value,"onUpdate:modelValue":S[1]||(S[1]=V=>u.value=V),ref_key:"form",ref:a,onSubmit:S[2]||(S[2]=J(()=>{},["prevent"]))},{default:c(()=>[_.value?(n(),P(ee,{key:0,"model-value":_.value,disabled:"",label:T.$t("dialogs.renameTorrent.oldName")},null,8,["model-value","label"])):I("",!0),r(ee,{modelValue:m.newName,"onUpdate:modelValue":S[0]||(S[0]=V=>m.newName=V),ref_key:"field",ref:i,rules:l,autofocus:"",label:T.$t("dialogs.renameTorrent.newName"),onKeydown:ge(B,["enter"])},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1}),r(Me,null,{default:c(()=>[r(Se),r(O,{color:"error",onClick:A},{default:c(()=>[x(v(T.$t("common.cancel")),1)]),_:1}),r(O,{color:"accent",disabled:!u.value,onClick:B},{default:c(()=>[x(v(T.$t("common.save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["modelValue"]))}});le=-2;q=-1;Ft=C({__name:"ShareLimitDialog",props:{guid:{},hashes:{}},setup(y){const e=y,{isOpened:s}=xe(e.guid),t=Ve(),o=re(),i=R(!1),a=R("global"),u=R(!1),m=R(0),l=R(!1),h=R(0),_=R(!1),B=R(0),A=b(()=>a.value!=="enabled");function T(){s.value=!1}async function S(){switch(a.value){case"global":await t.setShareLimit(e.hashes,le,le,le);break;case"disabled":await t.setShareLimit(e.hashes,q,q,q);break;case"enabled":await t.setShareLimit(e.hashes,u.value?m.value:q,l.value?h.value:q,_.value?B.value:q);break}T()}return Ce(async()=>{const V=o.getTorrentByHash(e.hashes[0]);if(!V)return T();const k=V.ratio_limit,w=V.seeding_time_limit,G=V.inactive_seeding_time_limit;k===le&&w===le&&G===le?a.value="global":k===q&&w===q&&G===q?a.value="disabled":(a.value="enabled",u.value=k>=0,m.value=u.value?k:0,l.value=w>=0,h.value=l.value?w:0,_.value=G>=0,B.value=_.value?G:0)}),(V,k)=>(n(),P(Re,{modelValue:d(s),"onUpdate:modelValue":k[9]||(k[9]=w=>pe(s)?s.value=w:null),"max-width":"500"},{default:c(()=>[r(se,{title:V.$t("dialogs.share_limit.title")},{default:c(()=>[r(ve,null,{default:c(()=>[r(Oe,{modelValue:i.value,"onUpdate:modelValue":k[7]||(k[7]=w=>i.value=w),onSubmit:k[8]||(k[8]=J(()=>{},["prevent"])),onKeydown:ge(J(S,["prevent"]),["enter"])},{default:c(()=>[r(kt,{modelValue:a.value,"onUpdate:modelValue":k[0]||(k[0]=w=>a.value=w)},{default:c(()=>[r(Pe,{label:V.$t("dialogs.share_limit.global"),value:"global"},null,8,["label"]),r(Pe,{label:V.$t("dialogs.share_limit.disabled"),value:"disabled"},null,8,["label"]),r(Pe,{label:V.$t("dialogs.share_limit.enabled"),value:"enabled"},null,8,["label"])]),_:1},8,["modelValue"]),r(Ne,null,{default:c(()=>[r(ye,{cols:"12",class:"d-flex align-center"},{default:c(()=>[g("span",null,[r(be,{modelValue:u.value,"onUpdate:modelValue":k[1]||(k[1]=w=>u.value=w),disabled:A.value},null,8,["modelValue","disabled"])]),r(ee,{modelValue:m.value,"onUpdate:modelValue":k[2]||(k[2]=w=>m.value=w),disabled:A.value||!u.value,density:"compact","hide-details":"",label:V.$t("dialogs.share_limit.ratio_limit")},null,8,["modelValue","disabled","label"])]),_:1}),r(ye,{cols:"12",class:"d-flex align-center"},{default:c(()=>[g("span",null,[r(be,{modelValue:l.value,"onUpdate:modelValue":k[3]||(k[3]=w=>l.value=w),disabled:A.value},null,8,["modelValue","disabled"])]),r(ee,{modelValue:h.value,"onUpdate:modelValue":k[4]||(k[4]=w=>h.value=w),disabled:A.value||!l.value,density:"compact","hide-details":"",label:V.$t("dialogs.share_limit.seeding_time_limit")},null,8,["modelValue","disabled","label"])]),_:1}),r(ye,{cols:"12",class:"d-flex align-center"},{default:c(()=>[g("span",null,[r(be,{modelValue:_.value,"onUpdate:modelValue":k[5]||(k[5]=w=>_.value=w),disabled:A.value},null,8,["modelValue","disabled"])]),r(ee,{modelValue:B.value,"onUpdate:modelValue":k[6]||(k[6]=w=>B.value=w),disabled:A.value||!_.value,density:"compact","hide-details":"",label:V.$t("dialogs.share_limit.inactive_seeding_time_limit")},null,8,["modelValue","disabled","label"])]),_:1})]),_:1})]),_:1},8,["modelValue","onKeydown"])]),_:1}),r(Me,null,{default:c(()=>[r(Se),r(O,{color:"error",onClick:T},{default:c(()=>[x(v(V.$t("common.cancel")),1)]),_:1}),r(O,{color:"accent",disabled:!i.value,onClick:S},{default:c(()=>[x(v(V.$t("common.save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"]))}});Ge=C({__name:"SpeedLimitDialog",props:{guid:{},hashes:{},mode:{}},setup(y){const e=y,{isOpened:s}=xe(e.guid),t=Ve(),o=re(),i=R(!1),a=R(0);function u(){s.value=!1}async function m(){const l=Math.max(0,a.value)*1e3;switch(e.mode){case"download":await t.setDownloadLimit(l,e.hashes);break;case"upload":await t.setUploadLimit(l,e.hashes);break}u()}return Ce(async()=>{const l=o.getTorrentByHash(e.hashes[0]);if(!l)return u();switch(e.mode){case"download":a.value=Math.max(0,Math.round(l.dl_limit/1e3));break;case"upload":a.value=Math.max(0,Math.round(l.up_limit/1e3));break}}),(l,h)=>(n(),P(Re,{modelValue:d(s),"onUpdate:modelValue":h[3]||(h[3]=_=>pe(s)?s.value=_:null)},{default:c(()=>[r(se,{title:l.$t(`dialogs.speed_limit.${l.mode}`)},{default:c(()=>[r(ve,null,{default:c(()=>[r(Oe,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=_=>i.value=_),onSubmit:h[2]||(h[2]=J(()=>{},["prevent"])),onKeydown:ge(J(m,["prevent"]),["enter"])},{default:c(()=>[r(ee,{modelValue:a.value,"onUpdate:modelValue":h[0]||(h[0]=_=>a.value=_),modelModifiers:{number:!0},type:"number",autofocus:"",clearable:"",label:l.$t("dialogs.speed_limit.label"),"prepend-inner-icon":"mdi-speedometer",suffix:"kB/s",onKeydown:ge(J(m,["prevent"]),["enter"])},null,8,["modelValue","label","onKeydown"])]),_:1},8,["modelValue","onKeydown"])]),_:1}),r(Me,null,{default:c(()=>[r(Se),r(O,{color:"error",onClick:u},{default:c(()=>[x(v(l.$t("common.cancel")),1)]),_:1}),r(O,{color:"accent",disabled:!i.value,onClick:m},{default:c(()=>[x(v(l.$t("common.save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"]))}});Kt={class:"d-flex justify-space-around"};Ht=C({__name:"RightClick",props:{rightClickProperties:{}},setup(y){const{t:e}=ke(),s=Ye(),t=Z(),o=We(),i=Ve(),a=$t(),u=re(),m=b(()=>t.selectedTorrents.length>1),l=b(()=>t.selectedTorrents),h=b(()=>l.value[0]),_=b(()=>u.getTorrentByHash(h.value)),B=b(()=>t.selectedTorrents.map(u.getTorrentByHash).filter(E=>!!E)),A=b(()=>[{name:""},...i.categories]);async function T(){await u.resumeTorrents(l)}async function S(){await u.forceResumeTorrents(l)}async function V(){await u.pauseTorrents(l)}function k(){o.createDialog(Ze,{hashes:[...t.selectedTorrents]})}function w(){o.createDialog(He,{hashes:[...t.selectedTorrents],mode:"dl"})}function G(){o.createDialog(He,{hashes:[...t.selectedTorrents],mode:"save"})}function j(){o.createDialog(Ut,{hash:t.selectedTorrents[0]})}async function ie(){await u.recheckTorrents(l)}async function he(){await i.reannounceTorrents(l)}async function Ee(){await i.toggleSeqDl(l)}async function de(){await i.toggleFLPiecePrio(l)}async function ue(){await i.toggleAutoTmm(l,!_.value?.auto_tmm)}function te(E){return B.value.every(z=>z&&z.tags&&z.tags.includes(E))}async function oe(){await u.removeTorrentTags(l.value)}async function fe(E){te(E)?await u.removeTorrentTags(l.value,[E]):await u.addTorrentTags(l.value,[E])}async function Q(E){try{await navigator.clipboard.writeText(E)}catch{Fe.error(e("toast.copy.error"));return}Fe.success(e("toast.copy.success"))}function ce(){o.createDialog(Ge,{hashes:l.value,mode:"download"})}function _e(){o.createDialog(Ge,{hashes:l.value,mode:"upload"})}function $(){o.createDialog(Ft,{hashes:l.value})}async function L(){l.value.forEach(E=>{u.exportTorrent(E).then(z=>{const H=window.URL.createObjectURL(z),ae=document.createElement("a");ae.href=H,ae.style.opacity="0",ae.setAttribute("download",`${E}.torrent`),document.body.appendChild(ae),ae.click(),document.body.removeChild(ae)})})}const M=b(()=>[{text:e("dashboard.right_click.advanced.title"),icon:"mdi-head-cog",children:[{text:e("dashboard.right_click.advanced.download_path"),icon:"mdi-tray-arrow-down",action:w},{text:e("dashboard.right_click.advanced.save_path"),icon:"mdi-content-save",action:G},{text:e("dashboard.right_click.advanced.rename"),icon:"mdi-rename-box",hidden:m.value,action:j},{text:e("dashboard.right_click.advanced.recheck"),icon:"mdi-playlist-check",action:ie},{text:e("dashboard.right_click.advanced.reannounce"),icon:"mdi-bullhorn",action:he},{text:e("dashboard.right_click.advanced.seq_dl"),icon:_.value?.seq_dl?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",action:Ee},{text:e("dashboard.right_click.advanced.f_l_prio"),icon:_.value?.f_l_piece_prio?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",action:de},{text:e("dashboard.right_click.advanced.auto_tmm"),icon:_.value?.auto_tmm?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",action:ue}]},{text:e("dashboard.right_click.priority.title"),icon:"mdi-priority-high",hidden:!a.preferences?.queueing_enabled,children:[{text:e("dashboard.right_click.priority.top"),icon:"mdi-priority-high",action:async()=>await u.setTorrentPriority(l.value,"topPrio")},{text:e("dashboard.right_click.priority.increase"),icon:"mdi-arrow-up",action:async()=>await u.setTorrentPriority(l.value,"increasePrio")},{text:e("dashboard.right_click.priority.decrease"),icon:"mdi-arrow-down",action:async()=>await u.setTorrentPriority(l.value,"decreasePrio")},{text:e("dashboard.right_click.priority.bottom"),icon:"mdi-priority-low",action:async()=>await u.setTorrentPriority(l.value,"bottomPrio")}]},{text:e("dashboard.right_click.tags.title"),icon:"mdi-tag",disabled:i.tags.length===0,disabledText:e("dashboard.right_click.tags.disabled_title"),disabledIcon:"mdi-tag-off",children:[..._.value?.tags.length?[{text:e("dashboard.right_click.tags.remove_all"),action:oe,icon:"mdi-playlist-remove"}]:[],...i.tags.map(E=>({text:E,icon:te(E)?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",action:async()=>await fe(E)}))]},{text:e("dashboard.right_click.category.title"),icon:"mdi-label",disabled:i.categories.length===0,disabledText:e("dashboard.right_click.category.disabled_title"),disabledIcon:"mdi-label-off",children:A.value.map(E=>({text:E.name===""?e("dashboard.right_click.category.clear"):E.name,action:async()=>await u.setTorrentCategory(l.value,E.name)}))},{text:e("dashboard.right_click.speed_limit.title"),icon:"mdi-speedometer-slow",children:[{text:e("dashboard.right_click.speed_limit.download"),icon:"mdi-download",action:ce},{text:e("dashboard.right_click.speed_limit.upload"),icon:"mdi-upload",action:_e},{text:e("dashboard.right_click.speed_limit.share"),icon:"mdi-account-group",action:$}]},{text:e("dashboard.right_click.copy.title"),icon:"mdi-content-copy",hidden:m.value,children:[{text:e("dashboard.right_click.copy.name"),icon:"mdi-alphabetical-variant",action:async()=>_.value&&await Q(_.value.name)},{text:e("dashboard.right_click.copy.hash"),icon:"mdi-pound",action:async()=>await Q(h.value)},{text:e("dashboard.right_click.copy.magnet"),icon:"mdi-magnet",action:async()=>_.value&&await Q(_.value.magnet)}]},{text:e("dashboard.right_click.export",t.selectedTorrents.length),icon:m.value?"mdi-download-multiple":"mdi-download",action:L},{text:e("dashboard.right_click.info"),icon:"mdi-information",hidden:m.value,action:()=>s.push({name:"torrentDetail",params:{hash:h.value}})}]);return(E,z)=>(n(),p("div",{style:$e(`position: absolute; left: ${E.rightClickProperties.offset[0]}px; top: ${E.rightClickProperties.offset[1]}px;`)},[r(d(xt),{modelValue:E.rightClickProperties.isVisible,"onUpdate:modelValue":z[0]||(z[0]=H=>E.rightClickProperties.isVisible=H),"menu-data":M.value},{top:c(()=>[r(me,null,{default:c(()=>[g("div",Kt,[r(W,{location:"top"},{activator:c(({props:H})=>[r(O,K({density:"compact",variant:"plain",icon:"mdi-play"},H,{onClick:T}),null,16)]),default:c(()=>[g("span",null,v(E.$t("dashboard.right_click.top.resume")),1)]),_:1}),r(W,{location:"top"},{activator:c(({props:H})=>[r(O,K({density:"compact",variant:"plain",icon:"mdi-fast-forward"},H,{onClick:S}),null,16)]),default:c(()=>[g("span",null,v(E.$t("dashboard.right_click.top.force_resume")),1)]),_:1}),r(W,{location:"top"},{activator:c(({props:H})=>[r(O,K({density:"compact",variant:"plain",icon:"mdi-pause"},H,{onClick:V}),null,16)]),default:c(()=>[g("span",null,v(E.$t("dashboard.right_click.top.pause")),1)]),_:1}),r(W,{location:"top"},{activator:c(({props:H})=>[r(O,K({color:"red",density:"compact",variant:"plain",icon:"mdi-delete-forever"},H,{onClick:k}),null,16)]),default:c(()=>[g("span",null,v(E.$t("dashboard.right_click.top.delete")),1)]),_:1})])]),_:1})]),_:1},8,["modelValue","menu-data"])],4))}});Gt={class:"d-flex flex-column"};zt={key:0,class:"text-caption text-grey"};qt={key:0,class:"text-caption text-grey"};nt=C({__name:"ItemAmount",props:{torrent:{},titleKey:{},value:{type:Function},total:{type:Function}},setup(y){return(e,s)=>(n(),p("div",Gt,[e.titleKey?(n(),p("div",zt,v(e.$t(e.titleKey)),1)):I("",!0),g("div",null,[x(v(e.value(e.torrent))+" ",1),e.total?(n(),p("span",qt," / "+v(e.total(e.torrent)),1)):I("",!0)])]))}});Yt={key:0,class:"d-flex flex-column"};Xt={key:0,class:"text-caption text-grey"};jt={class:"d-flex flex-row flex-gap-column-small"};rt=C({__name:"ItemChip",props:{torrent:{},titleKey:{},value:{},emptyValueKey:{},color:{},enableHashColor:{type:Boolean,default:!1}},setup(y){const e=y,{hideChipIfUnset:s,enableHashColors:t,hideColoredChip:o}=U(F()),i=b(()=>e.value(e.torrent)),a=b(()=>i.value.length<1||i.value[0]===""),u=b(()=>!(s.value&&a.value)),m=b(()=>!o.value),l=b(()=>t.value&&e.enableHashColor);return(h,_)=>u.value?(n(),p("div",Yt,[h.titleKey?(n(),p("div",Xt,v(h.$t(h.titleKey)),1)):I("",!0),g("div",jt,[a.value?(n(),P(Te,{key:0,color:h.color(h.torrent),variant:m.value?"flat":"text",size:"small"},{default:c(()=>[x(v(h.$t(h.emptyValueKey)),1)]),_:1},8,["color","variant"])):(n(!0),p(N,{key:1},X(i.value,B=>(n(),P(Te,{color:l.value?d(Qe)(B):h.color(h.torrent),variant:m.value?"flat":"text",size:"small"},{default:c(()=>[x(v(B),1)]),_:2},1032,["color","variant"]))),256))])])):I("",!0)}});Wt={class:"d-flex flex-column"};Zt={key:0,class:"text-caption text-grey"};Qt={class:"text-caption text-grey"};st=C({__name:"ItemData",props:{torrent:{},titleKey:{},value:{type:Function}},setup(y){const e=y,{useBinarySize:s}=U(F()),t=b(()=>e.value(e.torrent));return(o,i)=>(n(),p("div",Wt,[o.titleKey?(n(),p("div",Zt,v(o.$t(o.titleKey)),1)):I("",!0),g("div",null,[x(v(d(Ct)(t.value,d(s)))+" ",1),g("span",Qt,v(d(St)(t.value,d(s))),1)])]))}});Jt={class:"d-flex flex-column"};eo={key:0,class:"text-caption text-grey"};to={key:0};oo={key:1};it=C({__name:"ItemDateTime",props:{torrent:{},titleKey:{},value:{type:Function}},setup(y){const e=y,{dateFormat:s}=U(F()),t=b(()=>e.value(e.torrent));return(o,i)=>(n(),p("div",Jt,[o.titleKey?(n(),p("div",eo,v(o.$t(o.titleKey)),1)):I("",!0),g("div",null,[t.value>0?(n(),p("span",to,v(d(Je)(t.value,d(s))),1)):(n(),p("span",oo,v(o.$t("dashboard.not_complete")),1))])]))}});ao={class:"d-flex flex-column"};lo={key:0,class:"text-caption text-grey"};no={key:0};ro={key:1};dt=C({__name:"ItemDuration",props:{torrent:{},titleKey:{},unit:{},value:{type:Function}},setup(y){const e=y,s=b(()=>e.value(e.torrent)),t=b(()=>{const o=we.duration(s.value,e.unit),i=[o.years(),o.months(),o.days(),o.hours(),o.minutes(),o.seconds()],a=["Y","M","d","h","m","s"];let u=!1;return i.map((m,l)=>{if(u||m)return u=!0,`${m}${a[l]}`}).filter(m=>m).join(" ")});return(o,i)=>(n(),p("div",ao,[o.titleKey?(n(),p("div",lo,v(o.$t(o.titleKey)),1)):I("",!0),g("div",null,[s.value>0?(n(),p("span",no,v(t.value),1)):(n(),p("span",ro,v(o.$t("common.NA")),1))])]))}});so={class:"d-flex flex-column"};io={key:0,class:"text-caption text-grey"};ut=C({__name:"ItemPercent",props:{torrent:{},titleKey:{},value:{type:Function},color:{type:Function}},setup(y){const e=y,s=b(()=>e.value(e.torrent));return(t,o)=>(n(),p("div",so,[t.titleKey?(n(),p("div",io,v(t.$t(t.titleKey)),1)):I("",!0),r(tt,{"model-value":s.value,max:1,height:20,color:t.color(t.torrent),rounded:"sm",style:{width:"10em"}},{default:c(()=>[x(v(d(et)(s.value)),1)]),_:1},8,["model-value","color"])]))}});uo={class:"d-flex flex-column"};co={key:0,class:"text-caption text-grey"};ct=C({__name:"ItemRelativeTime",props:{torrent:{},titleKey:{},value:{type:Function}},setup(y){return(e,s)=>(n(),p("div",uo,[e.titleKey?(n(),p("div",co,v(e.$t(e.titleKey)),1)):I("",!0),g("div",null,[g("span",null,v(d(we)(e.value(e.torrent)*1e3).fromNow()),1)])]))}});mo={class:"d-flex flex-column"};po={key:0,class:"text-caption text-grey"};vo={class:"text-caption text-grey"};mt=C({__name:"ItemSpeed",props:{torrent:{},titleKey:{},value:{type:Function}},setup(y){const e=y,{useBitSpeed:s}=U(F()),t=b(()=>e.value(e.torrent));return(o,i)=>(n(),p("div",mo,[o.titleKey?(n(),p("div",po,v(o.$t(o.titleKey)),1)):I("",!0),g("div",null,[x(v(d(Vt)(t.value,d(s)))+" ",1),g("span",vo,v(d(wt)(t.value,d(s))),1)])]))}});ho={class:"d-flex flex-column"};fo={key:0,class:"text-caption text-grey"};pt=C({__name:"ItemText",props:{torrent:{},titleKey:{},value:{type:Function},color:{type:Function}},setup(y){const e=y,s=b(()=>e.value(e.torrent));return(t,o)=>(n(),p("div",ho,[t.titleKey?(n(),p("div",fo,v(t.$t(t.titleKey)),1)):I("",!0),g("div",{class:ne(t.color?t.color(s.value):"")},v(s.value),3)]))}});_o={class:"d-flex flex-gap flex-wrap"};yo=C({__name:"GridTorrent",props:{torrent:{}},emits:["onTorrentClick"],setup(y){const e=y,{current:s}=at(),t=Z(),o=F(),i=b(()=>(e.torrent.progress===1?o.doneGridProperties:o.busyGridProperties).filter(h=>h.active).sort((h,_)=>h.order-_.order)),a=l=>{switch(l){case D.AMOUNT:return nt;case D.CHIP:return rt;case D.DATA:return st;case D.DATETIME:return it;case D.DURATION:return dt;case D.PERCENT:return ut;case D.RELATIVE:return ct;case D.SPEED:return mt;case D.TEXT:default:return pt}},u=b(()=>t.isTorrentInSelection(e.torrent.hash)),m=b(()=>s.value.colors[`torrent-${e.torrent.state}`]);return(l,h)=>(n(),P(se,{class:"cursor-pointer",style:$e(`border-left: 6px solid ${m.value}`),height:"100%",color:u.value?`torrent-${l.torrent.state}-darken-3`:void 0,onClick:h[0]||(h[0]=_=>l.$emit("onTorrentClick",_,l.torrent))},{default:c(()=>[r(Le,{class:"text-wrap text-subtitle-1 pt-1 pb-0"},{default:c(()=>[x(v(l.torrent.name),1)]),_:1}),r(ve,null,{default:c(()=>[g("div",_o,[(n(!0),p(N,null,X(i.value,_=>(n(),p(N,null,[_.props?(n(),P(Be(a(_.type)),K({key:0,torrent:l.torrent,ref_for:!0},_.props),null,16,["torrent"])):I("",!0)],64))),256))])]),_:1})]),_:1},8,["style","color"]))}});bo={class:"d-flex align-center",style:{height:"100%",width:"100%"}};go=C({__name:"GridView",props:{paginatedTorrents:{}},emits:["onCheckboxClick","onTorrentClick","onTorrentDblClick","onTorrentRightClick","startPress","endPress"],setup(y){const e=lt(),s=Z();return(t,o)=>(n(),P(Ne,{id:"torrentList"},{default:c(()=>[(n(!0),p(N,null,X(t.paginatedTorrents,i=>(n(),P(ye,{cols:"12",lg:"3",md:"4",sm:"6",xl:"2",class:ne([d(e).mobile?"pb-2":"pb-4","pt-0"]),onContextmenu:a=>t.$emit("onTorrentRightClick",a,i),onTouchcancel:o[1]||(o[1]=a=>t.$emit("endPress")),onTouchend:o[2]||(o[2]=a=>t.$emit("endPress")),onTouchmove:o[3]||(o[3]=a=>t.$emit("endPress")),onTouchstart:a=>t.$emit("startPress",a.touches.item(0),i),onDblclick:a=>t.$emit("onTorrentDblClick",i)},{default:c(()=>[g("div",bo,[r(ot,null,{default:c(()=>[d(s).isSelectionMultiple?(n(),P(O,{key:0,color:`torrent-${i.state}`,icon:d(s).isTorrentInSelection(i.hash)?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",class:"mr-2",variant:"text",onClick:a=>t.$emit("onCheckboxClick",i)},null,8,["color","icon","onClick"])):I("",!0)]),_:2},1024),r(yo,{torrent:i,onOnTorrentClick:o[0]||(o[0]=(a,u)=>t.$emit("onTorrentClick",a,u))},null,8,["torrent"])])]),_:2},1032,["class","onContextmenu","onTouchstart","onDblclick"]))),256))]),_:1}))}});To=Ue(go,[["__scopeId","data-v-8ab52227"]]);ko={class:"d-flex flex-gap flex-wrap"};$o=C({__name:"ListTorrent",props:{torrent:{}},emits:["onTorrentClick"],setup(y){const e=y,{current:s}=at(),t=Z(),o=F(),i=b(()=>(e.torrent.progress===1?o.doneTorrentProperties:o.busyTorrentProperties).filter(h=>h.active).sort((h,_)=>h.order-_.order)),a=l=>{switch(l){case D.AMOUNT:return nt;case D.CHIP:return rt;case D.DATA:return st;case D.DATETIME:return it;case D.DURATION:return dt;case D.PERCENT:return ut;case D.RELATIVE:return ct;case D.SPEED:return mt;case D.TEXT:default:return pt}},u=b(()=>t.isTorrentInSelection(e.torrent.hash)),m=b(()=>s.value.colors[`torrent-${e.torrent.state}`]);return(l,h)=>(n(),P(se,{class:"cursor-pointer",style:$e(`border-left: 6px solid ${m.value}`),width:"100%",color:u.value?`torrent-${l.torrent.state}-darken-3`:void 0,onClick:h[0]||(h[0]=_=>l.$emit("onTorrentClick",_,l.torrent))},{default:c(()=>[r(Le,{class:"text-wrap pt-1 pb-0 px-2 text-truncate",style:{"font-size":"0.97em"}},{default:c(()=>[x(v(l.torrent.name),1)]),_:1}),r(ve,{class:"pa-2 pt-0"},{default:c(()=>[g("div",ko,[(n(!0),p(N,null,X(i.value,_=>(n(),p(N,null,[_.props?(n(),P(Be(a(_.type)),K({key:0,torrent:l.torrent,ref_for:!0},_.props),null,16,["torrent"])):I("",!0)],64))),256))])]),_:1})]),_:1},8,["style","color"]))}});Co={class:"d-flex align-center"};So=C({__name:"ListView",props:{paginatedTorrents:{}},emits:["onCheckboxClick","onTorrentClick","onTorrentDblClick","onTorrentRightClick","startPress","endPress"],setup(y){const e=lt(),s=Z();return(t,o)=>(n(),P(je,{id:"torrentList",class:"pa-0"},{default:c(()=>[(n(!0),p(N,null,X(t.paginatedTorrents,i=>(n(),P(me,{id:`torrent-${i.hash}`,class:ne([d(e).mobile?"mb-2":"mb-4","pa-0"]),onContextmenu:a=>t.$emit("onTorrentRightClick",a,i),onTouchcancel:o[1]||(o[1]=a=>t.$emit("endPress")),onTouchend:o[2]||(o[2]=a=>t.$emit("endPress")),onTouchmove:o[3]||(o[3]=a=>t.$emit("endPress")),onTouchstart:a=>t.$emit("startPress",a.touches.item(0),i),onDblclick:a=>t.$emit("onTorrentDblClick",i)},{default:c(()=>[g("div",Co,[r(ot,null,{default:c(()=>[d(s).isSelectionMultiple?(n(),P(O,{key:0,color:`torrent-${i.state}`,icon:d(s).isTorrentInSelection(i.hash)?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",class:"mr-2",variant:"text",onClick:a=>t.$emit("onCheckboxClick",i)},null,8,["color","icon","onClick"])):I("",!0)]),_:2},1024),r($o,{torrent:i,onOnTorrentClick:o[0]||(o[0]=(a,u)=>t.$emit("onTorrentClick",a,u))},null,8,["torrent"])])]),_:2},1032,["id","class","onContextmenu","onTouchstart","onDblclick"]))),256))]),_:1}))}});Vo=Ue(So,[["__scopeId","data-v-57c5171f"]]);wo={key:0};Eo=C({__name:"ItemAmount",props:{torrent:{},value:{type:Function},total:{type:Function}},setup(y){return(e,s)=>(n(),p("td",null,[x(v(e.value(e.torrent))+" ",1),e.total?(n(),p("span",wo," / "+v(e.total(e.torrent)),1)):I("",!0)]))}});Io={key:0,class:"d-flex flex-row flex-gap-column-small"};Do=C({__name:"ItemChip",props:{torrent:{},value:{},emptyValueKey:{},color:{},enableHashColor:{type:Boolean,default:!1}},setup(y){const e=y,{hideChipIfUnset:s,enableHashColors:t,hideColoredChip:o}=U(F()),i=b(()=>e.value(e.torrent)),a=b(()=>i.value.length<1||i.value[0]===""),u=b(()=>!(s.value&&a.value)),m=b(()=>!o.value),l=b(()=>t.value&&e.enableHashColor);return(h,_)=>(n(),p("td",null,[u.value?(n(),p("div",Io,[a.value?(n(),P(Te,{key:0,color:h.color(h.torrent),variant:m.value?"flat":"text",size:"small"},{default:c(()=>[x(v(h.$t(h.emptyValueKey)),1)]),_:1},8,["color","variant"])):(n(!0),p(N,{key:1},X(i.value,B=>(n(),P(Te,{color:l.value?d(Qe)(B):h.color(h.torrent),variant:m.value?"flat":"text",size:"small"},{default:c(()=>[x(v(B),1)]),_:2},1032,["color","variant"]))),256))])):I("",!0)]))}});Po=C({__name:"ItemData",props:{torrent:{},value:{type:Function}},setup(y){const{useBinarySize:e}=U(F());return(s,t)=>(n(),p("td",null,v(d(Et)(s.value(s.torrent),d(e))),1))}});Ao={key:0};Bo={key:1};xo=C({__name:"ItemDateTime",props:{torrent:{},value:{type:Function}},setup(y){const e=y,{dateFormat:s}=U(F()),t=b(()=>e.value(e.torrent));return(o,i)=>t.value>0?(n(),p("td",Ao,v(d(Je)(t.value,d(s))),1)):(n(),p("td",Bo,v(o.$t("dashboard.not_complete")),1))}});Lo={key:0};Oo={key:1};Mo=C({__name:"ItemDuration",props:{torrent:{},unit:{},value:{type:Function}},setup(y){const e=y,s=b(()=>e.value(e.torrent)),t=b(()=>{const o=we.duration(s.value,e.unit),i=[o.years(),o.months(),o.days(),o.hours(),o.minutes(),o.seconds()],a=["Y","M","d","h","m","s"];let u=!1;return i.map((m,l)=>{if(u||m)return u=!0,`${m}${a[l]}`}).filter(m=>m).join(" ")});return(o,i)=>s.value>0?(n(),p("td",Lo,v(t.value),1)):(n(),p("td",Oo,v(o.$t("common.NA")),1))}});Ro=C({__name:"ItemPercent",props:{torrent:{},value:{type:Function},color:{type:Function}},setup(y){const e=y,s=b(()=>e.value(e.torrent));return(t,o)=>(n(),p("td",null,[r(tt,{"model-value":s.value,max:1,height:20,color:t.color(t.torrent),rounded:"sm",style:{width:"10em"}},{default:c(()=>[x(v(d(et)(s.value)),1)]),_:1},8,["model-value","color"])]))}});No=C({__name:"ItemRelativeTime",props:{torrent:{},value:{type:Function}},setup(y){return(e,s)=>(n(),p("td",null,v(d(we)(e.value(e.torrent)*1e3).fromNow()),1))}});Uo=C({__name:"ItemSpeed",props:{torrent:{},value:{type:Function}},setup(y){const{useBitSpeed:e}=U(F());return(s,t)=>(n(),p("td",null,v(d(It)(s.value(s.torrent),d(e))),1))}});Fo=C({__name:"ItemText",props:{torrent:{},value:{type:Function},color:{type:Function}},setup(y){const e=y,s=b(()=>e.value(e.torrent));return(t,o)=>(n(),p("td",{class:ne(t.color?t.color(s.value):"")},v(s.value),3))}});Ko=C({__name:"TableTorrent",props:{torrent:{}},setup(y){const e=F(),s=b(()=>e.tableProperties.filter(o=>o.active).sort((o,i)=>o.order-i.order)),t=o=>{switch(o){case D.AMOUNT:return Eo;case D.CHIP:return Do;case D.DATA:return Po;case D.DATETIME:return xo;case D.DURATION:return Mo;case D.PERCENT:return Ro;case D.RELATIVE:return No;case D.SPEED:return Uo;case D.TEXT:default:return Fo}};return(o,i)=>(n(!0),p(N,null,X(s.value,a=>(n(),p(N,null,[a.props?(n(),P(Be(t(a.type)),K({key:0,torrent:o.torrent,ref_for:!0},a.props),null,16,["torrent"])):I("",!0)],64))),256))}});Ho=y=>(vt("data-v-13e3f0fc"),y=y(),ht(),y);Go=Ho(()=>g("th",{class:"px-1"},null,-1));zo={key:0};qo={class:"text-left"};Yo={class:"text-left"};Xo=["onContextmenu","onTouchstart","onClick","onDblclick"];jo={key:0};Wo=C({__name:"TableView",props:{paginatedTorrents:{}},emits:["onCheckboxClick","onTorrentClick","onTorrentDblClick","onTorrentRightClick","startPress","endPress"],setup(y){const e=Z(),s=F(),t=b(()=>s.tableProperties.filter(a=>a.active).sort((a,u)=>a.order-u.order));function o(a){return e.isTorrentInSelection(a.hash)}const i=a=>["cursor-pointer",o(a)?`bg-torrent-${a.state}-darken-3 selected`:""];return(a,u)=>(n(),P(Dt,{id:"torrentList",class:"pa-0",density:"compact"},{default:c(()=>[g("thead",null,[g("tr",null,[Go,d(e).isSelectionMultiple?(n(),p("th",zo)):I("",!0),g("th",qo,v(a.$t("torrent.properties.name")),1),(n(!0),p(N,null,X(t.value,m=>(n(),p("th",Yo,v(a.$t(m.props.titleKey)),1))),256))])]),g("tbody",null,[(n(!0),p(N,null,X(a.paginatedTorrents,m=>Xe((n(),p("tr",{class:ne(i(m)),onContextmenu:l=>a.$emit("onTorrentRightClick",l,m),onTouchcancel:u[0]||(u[0]=l=>a.$emit("endPress")),onTouchend:u[1]||(u[1]=l=>a.$emit("endPress")),onTouchmove:u[2]||(u[2]=l=>a.$emit("endPress")),onTouchstart:l=>a.$emit("startPress",l.touches.item(0),m),onClick:l=>a.$emit("onTorrentClick",l,m),onDblclick:l=>a.$emit("onTorrentDblClick",m)},[g("td",{class:ne(`pa-0 bg-torrent-${m.state}`)},null,2),d(e).isSelectionMultiple?(n(),p("td",jo,[r(be,{"model-value":o(m),color:`torrent-${m.state}`,variant:"text",onClick:J(l=>a.$emit("onCheckboxClick",m),["stop"])},null,8,["model-value","color","onClick"])])):I("",!0),g("td",null,v(m.name),1),r(Ko,{torrent:m},null,8,["torrent"])],42,Xo)),[[Pt]])),256))])]),_:1}))}});Zo=Ue(Wo,[["__scopeId","data-v-13e3f0fc"]]);Qo={class:"pt-4 px-1 px-sm-5"};Jo={class:"text-grey"};ea={key:0,class:"mt-5 text-xs-center"};ta={class:"text-grey"};oa={key:1};aa={key:5};ua=C({__name:"Dashboard",setup(y){const{t:e}=ke(),s=Ye(),t=Z(),{currentPage:o,isSelectionMultiple:i,selectedTorrents:a,displayMode:u}=U(t),m=We(),l=Ve(),h=re(),{filteredTorrents:_}=U(h),B=F(),A=b(()=>u.value===Y.LIST),T=b(()=>u.value===Y.GRID),S=b(()=>u.value===Y.TABLE),{paginatedResults:V,currentPage:k,pageCount:w}=Lt(_,B.paginationSize,o),G=b(()=>_.value.length<=a.value.length),j=ze({isVisible:!1,offset:[0,0]});function ie(){window.scrollTo({top:0,behavior:"smooth"})}function he($){if($)return Ie(()=>{document.getElementById("searchInput")?.focus()});Ie(()=>{document.getElementById("searchInput")?.blur()})}function Ee(){G.value?t.unselectAllTorrents():t.selectTorrents(..._.value.map($=>$.hash))}function de($){i.value||s.push({name:"torrentDetail",params:{hash:$.hash}})}function ue($){t.toggleSelect($.hash)}function te($,L){$.shiftKey?t.spanTorrentSelection(L.hash):(Ae($)||t.isSelectionMultiple)&&(t.isSelectionMultiple=!0,t.toggleSelect(L.hash))}async function oe($,L){j.isVisible&&(j.isVisible=!1,await Ie()),j.isVisible=!0,j.offset=[$.pageX,$.pageY],i.value?a.value.length===0&&t.selectTorrent(L.hash):(t.unselectAllTorrents(),t.selectTorrent(L.hash))}const fe=R();function Q($,L){fe.value=setTimeout(()=>{oe($,L)},500)}function ce(){clearTimeout(fe.value)}function _e($){if(m.hasActiveDialog)return!1;const L=$.target;if(Ae($)&&$.key==="a"&&L.tagName!=="INPUT")return t.unselectAllTorrents(),t.selectTorrents(..._.value.map(M=>M.hash)),$.preventDefault(),!0;if(Ae($)&&$.key==="f"){const M=document.getElementById("searchInput");if(document.activeElement!==M)return he(!0),$.preventDefault(),!0}if($.key==="Escape"){const M=document.getElementById("searchInput");return document.activeElement===M?he(!1):(i.value=!1,t.unselectAllTorrents()),$.preventDefault(),!0}if($.key==="Delete")return a.value.length===0?void 0:(m.createDialog(Ze,{hashes:a.value}),$.preventDefault(),!0);if($.key==="/"){const M=document.getElementById("searchInput");return document.activeElement!==M&&(s.push({name:"searchEngine"}),$.preventDefault()),!0}}return ft(()=>j.isVisible,$=>{!$&&!i.value&&t.unselectAllTorrents()}),Ce(async()=>{await l.fetchCategories(),await l.fetchTags()}),qe(()=>{document.addEventListener("keydown",_e),i.value=!1,ie()}),_t(()=>{document.removeEventListener("keydown",_e)}),($,L)=>(n(),p(N,null,[g("div",Qo,[r(Nt),r(Ne,{class:"ma-0 pa-0"},{default:c(()=>[r(At,null,{default:c(()=>[Xe(r(se,{color:"transparent"},{default:c(()=>[r(W,{text:d(e)("common.selectAll"),location:"bottom"},{activator:c(({props:M})=>[r(O,K({icon:G.value?"mdi-checkbox-marked":"mdi-checkbox-blank-outline",class:"text-grey",color:"transparent",style:{left:"-8px"}},M,{onClick:Ee}),null,16,["icon"])]),_:1},8,["text"]),g("span",Jo,v(d(e)("dashboard.selectAll")),1)]),_:1},512),[[yt,d(i)]])]),_:1})]),_:1}),d(_).length===0?(n(),p("div",ea,[g("p",ta,v(d(e)("common.emptyList")),1)])):I("",!0),d(B).isPaginationOnTop&&!d(B).isInfiniteScrollActive&&d(w)>1?(n(),p("div",oa,[r(Ke,{modelValue:d(k),"onUpdate:modelValue":L[0]||(L[0]=M=>pe(k)?k.value=M:null),length:d(w),"next-icon":"mdi-menu-right","prev-icon":"mdi-menu-left",onInput:ie},null,8,["modelValue","length"])])):I("",!0),A.value?(n(),P(Vo,{key:2,"paginated-torrents":d(V),onOnTorrentClick:te,onOnTorrentDblClick:de,onOnCheckboxClick:ue,onOnTorrentRightClick:oe,onStartPress:Q,onEndPress:ce},null,8,["paginated-torrents"])):T.value?(n(),P(To,{key:3,class:"mb-2","paginated-torrents":d(V),onOnTorrentClick:te,onOnTorrentDblClick:de,onOnCheckboxClick:ue,onOnTorrentRightClick:oe,onStartPress:Q,onEndPress:ce},null,8,["paginated-torrents"])):S.value?(n(),P(Zo,{key:4,"paginated-torrents":d(V),onOnTorrentClick:te,onOnTorrentDblClick:de,onOnCheckboxClick:ue,onOnTorrentRightClick:oe,onStartPress:Q,onEndPress:ce},null,8,["paginated-torrents"])):I("",!0),!d(B).isPaginationOnTop&&!d(B).isInfiniteScrollActive&&d(w)>1?(n(),p("div",aa,[r(Ke,{modelValue:d(k),"onUpdate:modelValue":L[1]||(L[1]=M=>pe(k)?k.value=M:null),length:d(w),"next-icon":"mdi-menu-right","prev-icon":"mdi-menu-left",onInput:ie},null,8,["modelValue","length"])])):I("",!0)]),r(Ht,{"right-click-properties":j},null,8,["right-click-properties"])],64))}})});export{ua as default,__tla};