@jesec/flood 0.0.0-master.1d7ec6a → 0.0.0-master.1da2260
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/assets/index.html +1 -1
- package/dist/assets/static/js/{179.30908bfc.chunk.js → 179.c81c7db0.chunk.js} +1 -1
- package/dist/assets/static/js/{704.7c6c6361.chunk.js → 704.0a13f61a.chunk.js} +1 -1
- package/dist/assets/static/js/{main.9fcba1be.js → main.fe549a05.js} +1 -1
- package/dist/index.js +1029 -1039
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_jesec_flood=globalThis.webpackChunk_jesec_flood||[]).push([[704],{1693:(e,t,s)=>{s.d(t,{A:()=>n});const n={start:"torrents.list.context.start",stop:"torrents.list.context.stop",remove:"torrents.list.context.remove",checkHash:"torrents.list.context.check.hash",reannounce:"torrents.list.context.reannounce",setTaxonomy:"torrents.list.context.set.tags",move:"torrents.list.context.move",setTrackers:"torrents.list.context.set.trackers",torrentDetails:"torrents.list.context.details",downloadContents:"torrents.list.context.download.contents",downloadMetainfo:"torrents.list.context.download.metainfo",generateMagnet:"torrents.list.context.generate.magnet",setInitialSeeding:"torrents.list.context.initial.seeding",setSequential:"torrents.list.context.sequential",setPriority:"torrents.list.context.priority"}},1915:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(3443),r=s(6540),a=s(942),i=s(4848);const l=(0,r.memo)(({status:e})=>{switch(e){case"error":return(0,i.jsx)(a.$D,{});case"checking":return(0,i.jsx)(a.y$,{});case"downloading":case"seeding":return(0,i.jsx)(a.fe,{});default:return(0,i.jsx)(a.VG,{})}}),o=(0,n.PA)(({percent:e,status:t})=>(0,i.jsxs)("div",{className:"progress-bar",children:[(0,i.jsx)("div",{className:"progress-bar__icon",children:t&&(0,i.jsx)(l,{status:t})}),(0,i.jsx)("div",{className:"progress-bar__fill__wrapper",children:(0,i.jsx)("div",{className:"progress-bar__fill",style:{width:`${e}%`}})})]}))},2066:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Nt});var n=s(6540),r=s(6942),a=s.n(r),i=s(3443),l=s(9161),o=s(942),c=s(9075),d=s(2412),u=s(3537),p=s(484),h=s(4930),m=s(2189),_=s(4848);const x=({clickHandler:e,icon:t,label:s,slug:n,noTip:r=!1})=>{const i=a()("action tooltip__wrapper",{[`action--${n}`]:null!=n});return(0,_.jsxs)(m.A,{content:s,onClick:e,position:"bottom",wrapperClassName:i,suppress:r,children:[t,(0,_.jsx)("span",{className:"action__label",children:s})]})},j={dateAdded:"desc",dateFinished:"desc",dateActive:"desc",downRate:"desc",downTotal:"desc",upRate:"desc",upTotal:"desc"};var g=s(6488),A=s(2618),b=s(7200),f=s.n(b),v=s(9679),y=s(9475);const w=({className:e,label:t,isFocusHandled:s,onClick:n})=>s?(0,_.jsx)("div",{role:"none",className:e,onClick:n,children:t}):(0,_.jsx)("button",{type:"button",className:a()(e,(0,y.AH)({width:"100%",height:"100%",textAlign:"left",_focusVisible:{outline:"dashed"}})),onClick:n,children:t}),N=(0,i.PA)(({baseClassName:e="dropdown",dropdownWrapperClass:t="dropdown",dropdownButtonClass:s="dropdown__trigger",dropdownClickRef:r,direction:i="down",header:l,matchButtonWidth:o=!1,menuItems:c,noWrap:d=!1,trigger:u,width:p,isFocusHandled:m=!1,handleItemSelect:x,onOpen:j})=>{const b=(0,n.useRef)(f()("dropdown_")),y=h.A.activeDropdownMenu===b.current,N=a()(t,`${e}--direction-${i}`,{[`${e}--match-button-width`]:o,[`${e}--width-${p}`]:null!=p,[`${e}--no-wrap`]:d,"is-expanded":y}),k=(0,n.useCallback)(()=>{window.removeEventListener("click",k),h.A.setActiveDropdownMenu(null)},[]);(0,v.A)("Escape",()=>k());const C=(0,n.useCallback)(()=>{window.addEventListener("click",k),j&&j(),h.A.setActiveDropdownMenu(b.current)},[k,j]),S=e=>{e?.stopPropagation(),y?k():C()};let T;if(r&&(r.current=S),y){const e=(0,_.jsx)("div",{className:"dropdown__header",children:(0,_.jsx)(w,{className:s,label:l,isFocusHandled:m??!1,onClick:S})},"dropdown-header"),t=(0,_.jsx)("ul",{className:"dropdown__items",children:c.map((e,t)=>(0,_.jsx)("div",{className:"dropdown__list",children:e.map((e,t)=>{const s=a()("dropdown__item menu__item",e.className,{"is-selectable":!1!==e.selectable,"is-selected":e.selected});return(0,_.jsx)("li",{className:s,children:(0,_.jsx)("button",{type:"button",disabled:!1===e.selectable,onClick:!1===e.selectable?void 0:()=>{k(),x(e)},children:e.displayName})},t)})},t))},"dropdown-items");T=(0,_.jsx)(g.A,{classNames:"menu",timeout:{enter:250,exit:250},children:(0,_.jsx)("div",{className:"dropdown__content menu",children:"up"===i?[t,e]:[e,t]})})}return(0,_.jsxs)("div",{className:N,children:[(0,_.jsx)(w,{className:s,label:u??l,isFocusHandled:m??!1,onClick:S}),(0,_.jsx)(A.A,{children:T})]})});var k=s(2607);const C=["name","eta","downRate","upRate","ratio","percentComplete","downTotal","upTotal","sizeBytes","dateAdded","dateFinished","dateActive"],S=e=>{const{direction:t,selectedProperty:s,onSortChange:n}=e,{i18n:r}=(0,l.uB)();if(null==s)return null;const a=(0,_.jsxs)("div",{className:"dropdown__button",children:[(0,_.jsx)("span",{className:"dropdown__label",children:(0,_.jsx)(l.x6,{id:"torrents.sort.title"})}),(0,_.jsx)("span",{className:"dropdown__value",children:(0,_.jsx)(l.x6,{id:k.A[s]})})]}),i=[C.map(e=>{const n=e===s,a=n?(0,_.jsx)("span",{className:`sort-dropdown__indicator sort-dropdown__indicator--${t}`}):null;return{displayName:(0,_.jsxs)("div",{className:"sort-dropdown__item",children:[r._(k.A[e]),a]}),selected:n,property:e}})];return(0,_.jsx)(N,{handleItemSelect:e=>{const{property:r}=e;if(null==r)return;let a=j[r]??"asc";s===r&&(a="asc"===t?"desc":"asc"),n({direction:a,property:r})},header:a,menuItems:i})},T=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),{sortTorrents:t,torrentListViewSize:s}=d.A.floodSettings,n=a()("action-bar",{"action-bar--is-condensed":"condensed"===s});return(0,_.jsxs)("nav",{className:n,children:[(0,_.jsx)("div",{className:"actions action-bar__item action-bar__item--sidebar-expand-collapse",children:(0,_.jsx)(x,{label:"actionbar.button.sidebar.expand.collapse",slug:"sidebar-expand-collapse",icon:(0,_.jsx)(o.W1,{}),clickHandler:()=>{const e=document.getElementsByClassName("application__view")[0];null!=e&&e.classList.toggle("application__view--sidebar-alternative-state")},noTip:!0})}),(0,_.jsx)("div",{className:"actions action-bar__item action-bar__item--sort-torrents",children:(0,_.jsx)(S,{direction:null!=t?t.direction:"desc",onSortChange:e=>{c.A.saveSetting("sortTorrents",e)},selectedProperty:null!=t?t.property:"dateAdded"})}),(0,_.jsxs)("div",{className:"actions action-bar__item action-bar__item--torrent-operations",children:[(0,_.jsxs)("div",{className:"action-bar__group",children:[(0,_.jsx)(x,{label:e._("actionbar.button.start.torrent"),slug:"start-torrent",icon:(0,_.jsx)(o.fe,{}),clickHandler:()=>u.A.startTorrents({hashes:p.A.selectedTorrents})}),(0,_.jsx)(x,{label:e._("actionbar.button.stop.torrent"),slug:"stop-torrent",icon:(0,_.jsx)(o.VG,{}),clickHandler:()=>u.A.stopTorrents({hashes:p.A.selectedTorrents})})]}),(0,_.jsxs)("div",{className:"action-bar__group action-bar__group--has-divider",children:[(0,_.jsx)(x,{label:e._("actionbar.button.add.torrent"),slug:"add-torrent",icon:(0,_.jsx)(o.OM,{}),clickHandler:()=>h.A.setActiveModal({id:"add-torrents"})}),(0,_.jsx)(x,{label:e._("actionbar.button.remove.torrent"),slug:"remove-torrent",icon:(0,_.jsx)(o.n$,{}),clickHandler:()=>h.A.setActiveModal({id:"remove-torrents"})})]})]})]})}),$=({children:e})=>(0,_.jsx)("div",{className:"application__content",children:e}),R=({children:e,baseClassName:t="application__panel",className:s,modifier:n})=>{const r=a()(t,{[`${t}--${n}`]:t,[s]:s});return(0,_.jsx)("div",{className:r,children:e})};var M=s(6975),P=s(8851),H=s(1966),D=s(2543),B=s(6816),L=s(7189),E=s(1915);const z=({label:e,value:t})=>(0,_.jsxs)("li",{"aria-label":"label",className:"diskusage__details-list__item",role:"cell",children:[(0,_.jsx)("span",{className:"diskusage__details-list__label",children:e}),(0,_.jsx)(L.A,{className:"diskuage__size-used",value:t})]}),I=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),{disks:t}=B.A,{mountPoints:s}=d.A.floodSettings;if(null==t||null==s)return null;const n=t.reduce((e,t)=>({...e,[t.target]:t}),{}),r=s.filter(e=>e in n).map(e=>n[e]).map(t=>(0,_.jsx)("li",{className:"sidebar-filter__item sidebar__diskusage",role:"row",children:(0,_.jsxs)(m.A,{content:(0,_.jsxs)("ul",{className:"diskusage__details-list",role:"tooltip",children:[(0,_.jsx)(z,{value:t.used,label:e._("status.diskusage.used")}),(0,_.jsx)(z,{value:t.avail,label:e._("status.diskusage.free")}),(0,_.jsx)(z,{value:t.size,label:e._("status.diskusage.total")})]}),position:"top",styles:(0,y.AH)({cursor:"default"}),wrapperClassName:"diskusage__item",children:[(0,_.jsxs)("div",{className:"diskusage__text-row",children:[t.target,(0,_.jsxs)("span",{children:[D.round(100*t.used/t.size,2),"%"]})]}),(0,_.jsx)(E.A,{percent:D.round(100*t.used/t.size,2)})]})},t.target));if(null==r||0===r.length)return null;const a=e._("status.diskusage.title");return(0,_.jsxs)("ul",{"aria-label":a,className:"sidebar-filter sidebar__item",role:"table",children:[(0,_.jsx)("li",{className:"sidebar-filter__item sidebar-filter__item--heading",children:a}),r]})}),F=()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null);return(0,_.jsx)(m.A,{content:e._("sidebar.button.feeds"),onClick:()=>{null!=t.current&&t.current.dismissTooltip(),h.A.setActiveModal({id:"feeds"})},ref:t,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.jsx)(o.JY,{})})};var O=s(5504),W=s(6541);const G=(0,y.AH)({_focus:{outline:"none",WebkitTapHighlightColor:"transparent"}}),U=({children:e,name:t,icon:s,isActive:r,slug:i,count:c,size:d,handleClick:u})=>{const p=(0,n.createRef)(),h=(e=>{const[t,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{if(e.current){const{current:t}=e;s(t.scrollWidth>t.clientWidth)}},[e,e?.current?.scrollWidth,e?.current?.clientWidth]),t})(p),{i18n:m}=(0,l.uB)(),[x,j]=(0,n.useState)(!1),g=a()("sidebar-filter__item",{"is-active":r}),A=a()("sidebar-filter__expander",{"is-active":r,expanded:x});let b=t;if(""===b)b=m._("filter.all");else if("untagged"===b){if(0===c)return null;b=m._("filter.untagged")}return"checking"!==i&&"error"!==i||0!==c?(0,_.jsxs)("li",{children:[(0,_.jsxs)("div",{className:e?(0,y.AH)({display:"flex"}):void 0,children:[e&&(0,_.jsx)("button",{className:`${A} ${G}`,type:"button",onClick:()=>j(!x),role:"switch","aria-checked":x,children:(0,_.jsx)(o.fe,{})}),(0,_.jsxs)("button",{className:`${g} ${G}`,type:"button",onClick:e=>u(i,e),role:"menuitem",children:[s,(0,_.jsx)("span",{className:"name",ref:p,title:h?b||"":void 0,children:b}),(0,_.jsx)(W.A,{children:c}),null!=d&&(0,_.jsx)(L.A,{value:d,className:"size"})]})]}),e&&x&&(0,_.jsx)("ul",{className:"sidebar-filter__nested",children:e})]}):null};var q=s(9399);const K=e=>{if(1===e.children.length&&e.containedCount===e.children[0].containedCount){const t=e.children[0],s=t.fullPath.includes("/")?"/":"\\";return K({...t,directoryName:e.directoryName+s+t.directoryName})}const t=e.children.map(K);return(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setLocationFilters(e,t),count:e.containedCount,isActive:""===e.fullPath&&!q.A.locationFilter.length||q.A.locationFilter.includes(e.fullPath),name:e.directoryName,slug:e.fullPath,size:e.containedSize,children:t.length&&t||void 0},e.fullPath)},V=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)();if(0===q.A.taxonomy.locationTree.containedCount)return null;const t=K(q.A.taxonomy.locationTree),s=e._("filter.location.title");return(0,_.jsxs)("ul",{"aria-label":s,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item sidebar-filter__item--heading",role:"none",children:s}),t]})});var X=s(6289);const Y=10,J=e=>P.A.fetchNotifications({id:"notification-tooltip",limit:Y,start:e}),Q=({paginationStart:e,notificationTotal:t})=>{const{i18n:s}=(0,l.uB)();if(t>Y){let n=e+1,r=e+Y;return n>t&&(n=t),r>t&&(r=t),(0,_.jsx)("div",{className:"toolbar toolbar--dark toolbar--top tooltip__toolbar tooltip__content--padding-surrogate",children:(0,_.jsxs)("span",{className:"toolbar__item toolbar__item--label",children:[`${s._("notification.showing")} `,(0,_.jsxs)("strong",{children:[n,` ${s._("general.to")} `,r]}),` ${s._("general.of")} `,(0,_.jsx)("strong",{children:t})]})})}return null},Z=({notification:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.jsxs)("li",{className:"notifications__list__item",children:[(0,_.jsxs)("div",{className:"notification__heading",children:[(0,_.jsx)("span",{className:"notification__category",children:t._(`${e.id}.heading`)})," — ",(0,_.jsx)("span",{className:"notification__timestamp",children:t.date(new Date(e.ts),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,_.jsx)("div",{className:"notification__message",children:t._(`${e.id}.body`,e.data)})]})},ee=({paginationStart:e,notificationTotal:t,onPrevClick:s,onClearClick:n,onNextClick:r})=>{const{i18n:i}=(0,l.uB)();if(t>0){let l=e+20,c=e-Y;return l>t&&(l=t),c<0&&(c=0),(0,_.jsxs)("ul",{className:"notifications__toolbar toolbar toolbar--dark toolbar--bottom",children:[(0,_.jsx)("li",{className:a()("toolbar__item toolbar__item--button",{"is-disabled":0===e}),children:(0,_.jsxs)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:s,children:[(0,_.jsx)(o.JG,{}),`${c+1} - ${e}`]})}),(0,_.jsx)("li",{className:"toolbar__item toolbar__item--button",children:(0,_.jsx)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:n,children:i._("notification.clear.all")})}),(0,_.jsx)("li",{className:a()("toolbar__item toolbar__item--button",{"is-disabled":e+Y>=t}),children:(0,_.jsxs)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:r,children:[`${e+Y+1} - ${l}`,(0,_.jsx)(o.c_,{})]})})]})}return null},te=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null),s=(0,n.useRef)(null),[r,i]=(0,n.useState)(!1),[c,d]=(0,n.useState)(0),[u,p]=(0,n.useState)(0),{hasNotification:h,notifications:x,notificationCount:j}=X.A;return(0,n.useEffect)(()=>{j.total>0&&t.current?.isOpen()&&(i(!0),J(c).finally(()=>i(!1)))},[j,c]),(0,_.jsxs)(m.A,{contentClassName:"tooltip__content tooltip__content--no-padding",content:h?(0,_.jsxs)("div",{className:a()("notifications",{"notifications--is-loading":r}),children:[(0,_.jsx)(Q,{paginationStart:c,notificationTotal:j.total}),(0,_.jsx)("div",{className:"notifications__loading-indicator",children:(0,_.jsx)(o.mY,{})}),(0,_.jsx)("ul",{className:"notifications__list tooltip__content--padding-surrogate",ref:s,style:{minHeight:u},children:x.map((e,t)=>(0,_.jsx)(Z,{notification:e},t))}),(0,_.jsx)(ee,{paginationStart:c,notificationTotal:j.total,onPrevClick:()=>{const e=c-Y;e>=0&&(p(s.current?.clientHeight||0),d(e))},onClearClick:()=>{null!=t.current&&t.current.dismissTooltip(),P.A.clearNotifications(),p(0),d(0)},onNextClick:()=>{const e=c+Y;j.total>e&&(p(s.current?.clientHeight||0),d(e))}})]}):(0,_.jsx)("div",{className:"notifications tooltip__content--padding-surrogate",style:{textAlign:"center"},children:e._("notification.no.notification")}),interactive:!0,onOpen:()=>J(c),ref:t,width:340,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button tooltip__wrapper",children:[(0,_.jsx)(o.Eg,{}),h?(0,_.jsx)("span",{className:"notifications__badge",children:j.total}):null]})}),se=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null),{searchFilter:s}=q.A;(0,n.useEffect)(()=>{null!=t.current&&s!==t.current.value&&(t.current.value=s)},[t,s]);const r=""!==s;return(0,_.jsxs)("div",{className:a()({sidebar__item:!0,search:!0,"is-in-use":r}),children:[r&&(0,_.jsx)("button",{className:"button search__reset-button",onClick:()=>{q.A.setSearchFilter(""),null!=t.current&&t.current.blur()},type:"button",children:(0,_.jsx)(o.bm,{})}),(0,_.jsx)(o.vj,{}),(0,_.jsx)("input",{className:"textbox",ref:t,type:"text",placeholder:e._("sidebar.search.placeholder"),onChange:e=>{q.A.setSearchFilter(e.target.value)}})]})}),ne=()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null);return(0,_.jsx)(m.A,{content:e._("sidebar.button.settings"),onClick:()=>{null!=t.current&&t.current.dismissTooltip(),h.A.setActiveModal({id:"settings"})},ref:t,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.jsx)(o.wB,{})})},re=({children:e})=>(0,_.jsx)("div",{className:"sidebar__actions",children:e});var ae=s(9107),ie=s.n(ae),le=s(8440);const oe=({bytes:e})=>0===e?(0,_.jsx)(l.x6,{id:"speed.unlimited"}):(0,_.jsx)(L.A,{value:e,isSpeed:!0,precision:1}),ce=({i18n:e,direction:t,speedLimits:s,throttleGlobalDownSpeed:n,throttleGlobalUpSpeed:r})=>{const a={className:`dropdown__label dropdown__label--${t}`,..."download"===t?{displayName:e._("sidebar.speedlimits.download")}:{displayName:e._("sidebar.speedlimits.upload")},selectable:!1,value:null},i={download:n,upload:r},l=s[t];let o=!0;const c=l.map(e=>{let s=!1;return i&&i[t]===e&&(s=!0,o=!1),{displayName:(0,_.jsx)(oe,{bytes:e}),property:t,selected:s,selectable:!0,value:e}});if(o&&i){const e=ie()(l,i[t]);c.splice(e,0,{displayName:(0,_.jsx)(oe,{bytes:i[t]}),property:t,selected:!0,selectable:!0,value:i[t]})}return c.unshift(a),c},de=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null),s=(0,n.useRef)(()=>{}),r=e._("sidebar.button.speedlimits"),a={i18n:e,speedLimits:d.A.floodSettings.speedLimits,throttleGlobalDownSpeed:d.A.clientSettings?.throttleGlobalDownSpeed??0,throttleGlobalUpSpeed:d.A.clientSettings?.throttleGlobalUpSpeed??0};return(0,_.jsx)(N,{dropdownClickRef:s,dropdownWrapperClass:"dropdown dropdown--speed-limits sidebar__action",handleItemSelect:e=>{null!=e.value&&("download"===e.property?le.A.saveSetting("throttleGlobalDownSpeed",e.value):"upload"===e.property&&le.A.saveSetting("throttleGlobalUpSpeed",e.value))},header:(0,_.jsxs)("div",{className:"sidebar__icon-button sidebar__icon-button--interactive sidebar__icon-button--limits",title:r,children:[(0,_.jsx)(o.xu,{}),r]}),menuItems:[ce({direction:"download",...a}),ce({direction:"upload",...a})],onOpen:()=>{null!=t.current&&t.current.dismissTooltip()},trigger:(0,_.jsx)(m.A,{content:r,position:"bottom",ref:t,wrapperClassName:"sidebar__icon-button tooltip__wrapper",onClick:()=>s.current?.(),children:(0,_.jsx)(o.xu,{})}),isFocusHandled:!0})}),ue=({children:e,className:t,expanded:s,handleClick:n})=>(0,_.jsxs)("button",{className:t,onClick:e=>n(e),children:[e,s?(0,_.jsx)(o.cL,{className:(0,y.AH)({transform:"scaleY(-1)"})}):(0,_.jsx)(o.cL,{})]}),pe=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=[{label:e._("filter.all"),slug:"",icon:(0,_.jsx)(o.u8,{})},{label:e._("filter.status.downloading"),slug:"downloading",icon:(0,_.jsx)(o.QH,{})},{label:e._("filter.status.seeding"),slug:"seeding",icon:(0,_.jsx)(o.H8,{})},{label:e._("filter.status.checking"),slug:"checking",icon:(0,_.jsx)(o.y$,{})},{label:e._("filter.status.completed"),slug:"complete",icon:(0,_.jsx)(o.AY,{})},{label:e._("filter.status.stopped"),slug:"stopped",icon:(0,_.jsx)(o.VG,{})},{label:e._("filter.status.active"),slug:"active",icon:(0,_.jsx)(o.RZ,{})},{label:e._("filter.status.inactive"),slug:"inactive",icon:(0,_.jsx)(o.Up,{})},{label:e._("filter.status.error"),slug:"error",icon:(0,_.jsx)(o.$D,{})}].map(e=>(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setStatusFilters(e,t),count:q.A.taxonomy.statusCounts[e.slug]||0,icon:e.icon,isActive:""===e.slug&&!q.A.statusFilter.length||q.A.statusFilter.includes(e.slug),name:e.label,slug:e.slug,size:q.A.taxonomy.statusSizes[e.slug]??0},e.slug)),s=e._("filter.status.title"),[r,a]=(0,n.useState)(!0);return(0,_.jsxs)("ul",{"aria-label":s,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.jsx)(ue,{className:"sidebar-filter__item--heading",expanded:r,handleClick:()=>{a(!r)},children:s})}),r&&t]})}),he=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),[t,s]=(0,n.useState)(!0),r=Object.keys(q.A.taxonomy.tagCounts);if(1===r.length&&""===r[0]||2===r.length&&"untagged"===r[1])return null;const a=r.slice().sort((e,t)=>""===e||"untagged"===e?-1:""===t||"untagged"===t?1:e.localeCompare(t)).map(e=>(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setTagFilters(e,t),count:q.A.taxonomy.tagCounts[e]||0,isActive:""===e&&!q.A.tagFilter.length||q.A.tagFilter.includes(e),name:e,slug:e,size:q.A.taxonomy.tagSizes[e]},e)),i=e._("filter.tag.title");return(0,_.jsxs)("ul",{"aria-label":i,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.jsx)(ue,{className:"sidebar-filter__item--heading",expanded:t,handleClick:()=>{s(!t)},children:i})}),t&&a]})});var me=s(9550);const _e=()=>{const{i18n:e}=(0,l.uB)();return(0,_.jsx)(m.A,{content:e._(me.A.isPreferDark?"sidebar.button.theme.light":"sidebar.button.theme.dark"),onClick:()=>me.A.setUserPreferDark(!me.A.isPreferDark),position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.jsx)(o.oy,{})})},xe=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),[t,s]=(0,n.useState)(!0),r=Object.keys(q.A.taxonomy.trackerCounts);if(1===r.length&&""===r[0])return null;const a=r.slice().sort((e,t)=>""===e?-1:""===t?1:e.localeCompare(t)).map(e=>(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setTrackerFilters(e,t),count:q.A.taxonomy.trackerCounts[e]||0,isActive:""===e&&!q.A.trackerFilter.length||q.A.trackerFilter.includes(e),name:e,slug:e,size:q.A.taxonomy.trackerSizes[e]},e)),i=e._("filter.tracker.title");return(0,_.jsxs)("ul",{"aria-label":i,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.jsx)(ue,{className:"sidebar-filter__item--heading",expanded:t,handleClick:()=>{s(!t)},children:i})}),t&&a]})});var je=s(1304),ge=s(6307),Ae=s(4669),be=s(3230);const fe={download:(0,_.jsx)(o.f5,{}),infinity:(0,_.jsx)(o.Qt,{}),upload:(0,_.jsx)(o._O,{})},ve=(0,i.PA)(({inspectorPoint:e})=>{const{i18n:t}=(0,l.uB)(),s=(s,n={})=>{const{throttleGlobalDownSpeed:r=0,throttleGlobalUpSpeed:i=0}=d.A.clientSettings||{},{transferSummary:l}=Ae.A,o={download:r,upload:i},c={download:l.downTotal,upload:l.upTotal};let u={download:l.downRate,upload:l.upRate};null!=e&&(u={upload:e.upload,download:e.download});const p=a()("client-stats__rate__data--secondary",{"is-visible":null==e&&ge.A.isConnected}),h=a()("client-stats__rate__data--timestamp",{"is-visible":null!=e&&n.showHoverDuration});let m=null;null!=e?.timestamp&&(m=(0,_.jsx)("div",{className:h,children:(0,_.jsx)(be.A,{suffix:t._("general.ago"),value:Math.trunc((Date.now()-e.timestamp)/1e3)})}));let x=null;return x=0===o[s]?fe.infinity:(0,_.jsx)(L.A,{value:o[s],isSpeed:!0}),(0,_.jsxs)("div",{className:`client-stats__rate client-stats__rate--${s}`,children:[(0,_.jsx)("div",{className:"client-stats__rate__icon",children:fe[s]}),(0,_.jsxs)("div",{className:"client-stats__rate__data",children:[(0,_.jsx)("div",{className:"client-stats__rate__data--primary",children:(0,_.jsx)(L.A,{value:u[s],isSpeed:!0})}),m,(0,_.jsxs)("div",{className:p,children:[(0,_.jsx)("div",{className:"client-stats__rate__data--total",children:(0,_.jsx)(L.A,{value:c[s]})}),(0,_.jsx)("div",{className:"client-stats__rate__data--limit",children:x})]})]})]})};return(0,_.jsxs)("div",{className:"client-stats__rates",children:[s("download",{showHoverDuration:!0}),s("upload")]})});var ye=s(1253),we=s(4439),Ne=s(8640),ke=s(846),Ce=s(8239);const Se=({direction:e})=>(0,_.jsxs)("linearGradient",{id:`graph__gradient--${e}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[(0,_.jsx)("stop",{className:`graph__gradient--top graph__gradient--top--${e}`,offset:"0%"}),(0,_.jsx)("stop",{className:`graph__gradient--bottom graph__gradient--bottom--${e}`,offset:"100%"})]}),Te=(e,t,s)=>{const n=e[t][Math.ceil(s)],r=e[t][Math.floor(s)];return r+s%1*(n-r)},$e=(0,i.PA)(({id:e,height:t,width:s,handlerRefs:r,onHover:a,onMouseOut:i})=>{const[l,o]=(0,n.useState)(!1),c=(0,n.useRef)(0),d=(0,n.useRef)({download:0,upload:0,timestamp:0}),u=Ae.A.transferRates,p=(0,Ce.A)().domain([0,u.download.length-1]).range([0,s]),h=(0,Ce.A)().domain([0,(0,ke.A)(u.download,(e,t)=>Math.max(e,u.upload[t]))]).range([t-10,10]);r.current={handleMouseMove:e=>{c.current=p.invert(e),a(d.current)},handleMouseOut:()=>{o(!1),i()},handleMouseOver:()=>{o(!0)}},l&&(d.current={download:Te(u,"download",c.current),upload:Te(u,"upload",c.current),timestamp:u.timestamps[Math.round(c.current)]});const m=ye.G;return(0,_.jsxs)("svg",{className:"graph",id:e,height:"100%",width:"100%",children:[(0,_.jsxs)("defs",{children:[(0,_.jsx)(Se,{direction:"upload"}),(0,_.jsx)(Se,{direction:"download"})]}),Ae.j.map(e=>[(0,_.jsx)("path",{className:"graph__area",fill:`url('#graph__gradient--${e}')`,d:(0,we.A)().x((e,t)=>p(t)||0).y0(t).y1(e=>h(e)||0).curve(m)(u[e])},`area-${e}`),(0,_.jsx)("path",{className:`graph__line graph__line--${e}`,d:(0,Ne.A)().x((e,t)=>p(t)||0).y(e=>h(e)||0).curve(m)(u[e])},`line-${e}`),(0,_.jsx)("circle",{className:`graph__circle graph__circle--${e}`,r:2.5,style:{opacity:l?1:0},transform:`translate(${p(c.current)},${h(d.current[e])})`},`point-${e}`)])]})}),Re=(0,i.PA)(()=>{const[e,t]=(0,n.useState)(null),[s,r]=(0,n.useState)(250),a=(0,n.useRef)(null);return(0,_.jsx)(je.A,{offset:!0,onResize:e=>{e.offset?.width&&r(e.offset.width)},children:({measureRef:n})=>(0,_.jsx)("div",{ref:n,className:"client-stats__wrapper sidebar__item",children:(0,_.jsxs)("div",{className:"client-stats",onMouseMove:e=>{null!=e?.nativeEvent?.clientX&&a.current?.handleMouseMove(e.nativeEvent.clientX)},onMouseOver:()=>a.current?.handleMouseOver(),onMouseOut:()=>a.current?.handleMouseOut(),onFocus:()=>a.current?.handleMouseOver(),onBlur:()=>a.current?.handleMouseOut(),children:[(0,_.jsx)(ve,{inspectorPoint:e}),ge.A.isConnected&&(0,_.jsx)($e,{height:150,id:"transfer-rate-graph",onMouseOut:()=>{t(null)},onHover:e=>{t(e)},handlerRefs:a,width:s})]})})})}),Me=()=>(0,_.jsx)(H.r,{className:"application__sidebar",options:{scrollbars:{autoHide:"scroll",clickScroll:!1,dragScroll:!1,theme:"os-theme-thin"},overflow:{x:"hidden",y:"scroll"}},children:(0,_.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,_.jsxs)(re,{children:[(0,_.jsx)(de,{}),(0,_.jsx)(ne,{}),(0,_.jsx)(F,{}),(0,_.jsx)(te,{}),(0,_.jsx)(O.A,{})]}),(0,_.jsx)(Re,{}),(0,_.jsx)(se,{}),(0,_.jsx)(pe,{}),(0,_.jsx)(he,{}),(0,_.jsx)(xe,{}),(0,_.jsx)(V,{}),(0,_.jsx)(I,{}),(0,_.jsx)("div",{style:{flexGrow:1}}),(0,_.jsx)(re,{children:(0,_.jsx)(_e,{})})]})});var Pe=s(7813),He=s(377),De=s(6565),Be=s(3675);const Le=(0,i.PA)(({id:e})=>{const t=h.A.activeContextMenu?.id===e,s=h.A.activeContextMenu?.items??[],n=h.A.activeContextMenu?.clickPosition??{x:0,y:0},{i18n:r}=(0,l.uB)();return(0,v.A)("Escape",()=>h.A.dismissContextMenu(e)),(0,_.jsx)(De.tz,{triggerCoordinates:n,onOverlayClick:()=>{h.A.dismissContextMenu(e)},onOverlayRightClick:e=>{e.preventDefault()},isIn:t,children:s.map((t,s)=>{let n,i;if("action"===t.type)i=a()("menu__item",{"is-selectable":t.clickHandler}),n=(0,_.jsxs)("span",{children:[(0,_.jsxs)("span",{className:a()("menu__item__label--primary",{"has-action":t.labelAction}),children:[(0,_.jsx)("span",{className:"menu__item__label",children:r._(t.label)}),t.labelAction?(0,_.jsx)("span",{className:"menu__item__label__action",children:(0,_.jsx)(t.labelAction,{})}):void 0]}),t.labelSecondary?(0,_.jsx)("span",{className:"menu__item__label--secondary",children:(0,_.jsx)(t.labelSecondary,{})}):void 0]});else i=a()("menu__item",{"menu__item--separator":"separator"===t.type});return(0,_.jsx)("li",{className:i,children:(0,_.jsx)("button",{type:"button",disabled:"action"!==t.type||!t.clickHandler,onClick:s=>("separator"!==t.type&&(!1===t.dismissMenu&&s.nativeEvent.stopImmediatePropagation(),t.clickHandler&&t.clickHandler(s),!1!==t.dismissMenu&&h.A.dismissContextMenu(e)),!1),onContextMenu:e=>{e.preventDefault()},children:n})},"action"===t.type?t.action:`sep-${s}`)})})});var Ee=s(88),ze=s(4712);const Ie=(0,n.forwardRef)((e,t)=>{const{children:s,onScroll:r}=e,a=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const e=a.current;if(null==e)return()=>{};const s=e.osInstance()?.elements().viewport;return t(s),r&&s.addEventListener("scroll",e=>r(e),{passive:!0}),()=>{r&&s.removeEventListener("scroll",e=>r(e))}},[r,t]),(0,_.jsx)(H.r,{...e,options:{scrollbars:{autoHide:"leave",clickScroll:!0,theme:"os-theme-"+(me.A.isPreferDark?"light":"dark")}},ref:a,children:s})}),Fe=(0,n.forwardRef)((e,t)=>{const{className:s,itemCount:n,itemKey:r,itemRenderer:a,itemSize:i,outerRef:l}=e,{height:o}=(0,ze.A)();return(0,_.jsx)(Ee.Y1,{className:s,height:Math.max(30*i,o),itemCount:n,itemKey:r,itemSize:i,width:"100%",outerElementType:me.A.isSmallScreen?void 0:Ie,ref:t,overscanCount:30,outerRef:l,children:a})}),Oe=(0,i.PA)(Fe);var We=s(5162);const Ge="\n body { user-select: none !important; }\n * { cursor: col-resize !important; }\n",Ue=(0,i.PA)((0,n.forwardRef)(({onCellClick:e,onCellFocus:t,onWidthsChange:s},r)=>{const[i,o]=(0,n.useState)(!1),c=(0,n.useRef)(),u=(0,n.useRef)(),p=(0,n.useRef)(),m=(0,We.A)(r),x=(0,n.useRef)(null),{i18n:j}=(0,l.uB)(),g=e=>{let t=0;null!=p.current&&(t=e.clientX-p.current);let s=20;null!=u.current&&(s=u.current+t),s>20&&(u.current=s,p.current=e.clientX,null!=x.current&&null!=m.current&&(x.current.style.transform=`translate(${Math.max(0,e.clientX)}px, ${m.current.getBoundingClientRect().top}px)`))},A=()=>{h.A.removeGlobalStyle(Ge),window.removeEventListener("pointerup",A),window.removeEventListener("pointermove",g),o(!1),p.current=void 0,null!=x.current&&(x.current.style.opacity="0"),null!=c.current&&null!=u.current&&s(c.current,u.current),c.current=void 0,u.current=void 0};return(0,_.jsxs)("div",{className:"table__row table__row--heading",role:"row",ref:m,children:[d.A.floodSettings.torrentListColumns.reduce((s,{id:n,visible:r})=>{if(!r)return s;const b=k.A[n];if(null==b)return s;let f=null;const v=d.A.floodSettings.torrentListColumnWidths[n]||100;i||(f=(0,_.jsx)("span",{className:"table__heading__handle",onPointerDown:e=>{i||null==x.current||null==m.current||(o(!0),c.current=n,u.current=v,p.current=e.clientX,window.addEventListener("pointerup",A),window.addEventListener("pointermove",g),h.A.addGlobalStyle(Ge),x.current.style.transform=`translate(${Math.max(0,e.clientX)}px, ${m.current.getBoundingClientRect().top}px)`,x.current.style.opacity="1")}}));const w=n===d.A.floodSettings.sortTorrents.property,N=a()("table__cell table__heading",{"table__heading--is-sorted":w,[`table__heading--direction--${d.A.floodSettings.sortTorrents.direction}`]:w});return s.push((0,_.jsxs)("button",{className:`${N} ${(0,y.AH)({textAlign:"left",_focus:{outline:"none",WebkitTapHighlightColor:"transparent"}})}`,role:"columnheader","aria-sort":w?"asc"===d.A.floodSettings.sortTorrents.direction?"ascending":"descending":"none",type:"button",onClick:()=>e(n),onFocus:()=>t(),style:{width:`${v}px`},children:[(0,_.jsx)("span",{className:"table__heading__label",title:j._(b),children:(0,_.jsx)(l.x6,{id:b})}),f]},n)),s},[]),(0,_.jsx)("div",{className:"table__cell table__heading table__heading--fill"}),(0,_.jsx)("div",{className:"table__heading__resize-line",ref:x})]})}));var qe=s(6386);const Ke=e=>{const t=[];e.forEach(s=>{const n=new FileReader;n.onload=n=>{null!=n.target?.result&&"string"==typeof n.target.result&&t.push({name:s.name,data:n.target.result.split("base64,")[1]}),t.length===e.length&&null!=t[0]&&h.A.setActiveModal({id:"add-torrents",tab:"by-file",files:t})},n.readAsDataURL(s)})},Ve=({children:e})=>{const{getRootProps:t,isDragActive:s}=(0,qe.VB)({onDrop:Ke,noClick:!0,noKeyboard:!0});return(0,_.jsx)("div",{...t({onClick:e=>e.preventDefault()}),className:"dropzone dropzone--with-overlay torrents "+(s?"dropzone--is-dragging":""),children:e})};var Xe=s(3736),Ye=s(2471),Je=s(1693),Qe=s(9689);const Ze=()=>p.A.selectedTorrents[p.A.selectedTorrents.length-1],et=(0,i.PA)(({property:e})=>(0,_.jsx)("span",{className:"toggle-input checkbox",style:{display:"inline"},children:(0,_.jsx)("div",{className:"toggle-input__indicator",children:(0,_.jsx)("div",{className:"toggle-input__indicator__icon",style:{opacity:p.A.torrents[Ze()][e]?"1":void 0},children:(0,_.jsx)(o.MG,{})})})})),tt=e=>{const t=(0,n.createRef)();return[{type:"action",action:"start",label:Je.A.start,clickHandler:()=>{u.A.startTorrents({hashes:p.A.selectedTorrents})}},{type:"action",action:"stop",label:Je.A.stop,clickHandler:()=>{u.A.stopTorrents({hashes:p.A.selectedTorrents})}},{type:"action",action:"remove",label:Je.A.remove,clickHandler:()=>{h.A.setActiveModal({id:"remove-torrents"})}},{type:"action",action:"checkHash",label:Je.A.checkHash,clickHandler:()=>{u.A.checkHash({hashes:p.A.selectedTorrents})}},{type:"action",action:"reannounce",label:Je.A.reannounce,clickHandler:()=>{u.A.reannounce({hashes:p.A.selectedTorrents})}},{type:"separator"},{type:"action",action:"setTaxonomy",label:Je.A.setTaxonomy,clickHandler:()=>{h.A.setActiveModal({id:"set-taxonomy"})}},{type:"action",action:"move",label:Je.A.move,clickHandler:()=>{h.A.setActiveModal({id:"move-torrents"})}},{type:"action",action:"setTrackers",label:Je.A.setTrackers,clickHandler:()=>{h.A.setActiveModal({id:"set-trackers"})}},{type:"separator"},{type:"action",action:"torrentDetails",label:Je.A.torrentDetails,clickHandler:()=>{h.A.setActiveModal({id:"torrent-details",hash:Ze()})}},{type:"action",action:"downloadContents",label:Je.A.downloadContents,clickHandler:e=>{e.preventDefault(),p.A.selectedTorrents.forEach(e=>{const t=document.createElement("a");t.download="",t.href=`${me.A.baseURI}api/torrents/${e}/contents/all/data`,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)})}},{type:"action",action:"downloadMetainfo",label:Je.A.downloadMetainfo,clickHandler:e=>{e.preventDefault();const t=document.createElement("a");t.download="",t.href=`${me.A.baseURI}api/torrents/${p.A.selectedTorrents.join(",")}/metainfo`,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}},{type:"action",action:"generateMagnet",label:Je.A.generateMagnet,clickHandler:()=>{h.A.setActiveModal({id:"generate-magnet"})}},{type:"action",action:"setInitialSeeding",label:Je.A.setInitialSeeding,clickHandler:()=>{const{selectedTorrents:e}=p.A;u.A.setInitialSeeding({hashes:e,isInitialSeeding:!p.A.torrents[Ze()].isInitialSeeding})},dismissMenu:!1,labelAction:()=>(0,_.jsx)(et,{property:"isInitialSeeding"})},{type:"action",action:"setSequential",label:Je.A.setSequential,clickHandler:()=>{const{selectedTorrents:e}=p.A;u.A.setSequential({hashes:e,isSequential:!p.A.torrents[Ze()].isSequential})},dismissMenu:!1,labelAction:()=>(0,_.jsx)(et,{property:"isSequential"})},{type:"action",action:"setPriority",label:Je.A.setPriority,clickHandler:()=>{null!=t.current&&u.A.setPriority({hashes:p.A.selectedTorrents,priority:t.current()})},dismissMenu:!1,labelAction:()=>(0,_.jsx)(Qe.A,{id:e.hash,level:e.priority,maxLevel:3,onChange:()=>{},priorityType:"torrent",showLabel:!1,changePriorityFuncRef:t,clickHandled:!0},e.hash)}]},st={eta:(0,_.jsx)(o.zD,{}),sizeBytes:(0,_.jsx)(o.Vd,{}),downRate:(0,_.jsx)(o.Cx,{}),directory:(0,_.jsx)(o.Ah,{}),hash:(0,_.jsx)(o.Vw,{}),dateActive:(0,_.jsx)(o.zD,{}),dateAdded:(0,_.jsx)(o.Vv,{}),dateCreated:(0,_.jsx)(o.xo,{}),dateFinished:(0,_.jsx)(o.T9,{}),isPrivate:(0,_.jsx)(o.LM,{}),message:(0,_.jsx)(o.qX,{}),percentComplete:(0,_.jsx)(o.Cx,{}),peers:(0,_.jsx)(o.SL,{}),ratio:(0,_.jsx)(o.wj,{}),seeds:(0,_.jsx)(o.pK,{}),trackerURIs:(0,_.jsx)(o.mB,{}),upRate:(0,_.jsx)(o.NM,{}),upTotal:(0,_.jsx)(o.NM,{})},nt=(0,i.PA)(({value:e})=>e?(0,_.jsx)(o.H4,{className:"torrent__detail__icon torrent__detail__icon--checkmark"}):null),rt=(0,i.PA)(({date:e})=>{const{i18n:t}=(0,l.uB)();return 0===e?null:(0,_.jsx)("span",{children:t.date(new Date(1e3*e))})}),at=(0,i.PA)(({eta:e})=>e?(0,_.jsx)(be.A,{value:e}):null),it=(0,i.PA)(({peersConnected:e,totalPeers:t})=>{const{i18n:s}=(0,l.uB)();return(0,_.jsx)(l.x6,{id:"torrent.list.peers",values:{connected:s.number(e),of:(0,_.jsx)("em",{className:"unit",children:(0,_.jsx)(l.x6,{id:"torrent.list.peers.of"})}),total:s.number(t)}})}),lt=(0,i.PA)(({ratio:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.jsx)("span",{children:t.number(e,{maximumFractionDigits:2})})}),ot=(0,i.PA)(({tags:e})=>(0,_.jsx)("ul",{className:"torrent__tags tag",children:e.map(e=>(0,_.jsx)("li",{className:"torrent__tag",children:e},e))})),ct=(0,i.PA)(({trackers:e})=>(0,_.jsx)("span",{children:e.join(", ")})),dt=(0,i.PA)(({torrent:e,column:t})=>{switch(t){case"dateActive":case"dateAdded":case"dateCreated":case"dateFinished":return(0,_.jsx)(rt,{date:e[t]});case"downRate":case"upRate":return(0,_.jsx)(L.A,{value:e[t],isSpeed:!0});case"downTotal":case"upTotal":case"sizeBytes":return(0,_.jsx)(L.A,{value:e[t]});case"ratio":return(0,_.jsx)(lt,{ratio:e[t]});case"isPrivate":return(0,_.jsx)(nt,{value:e[t]});case"tags":return(0,_.jsx)(ot,{tags:e[t]});case"trackerURIs":return(0,_.jsx)(ct,{trackers:e[t]});case"eta":return(0,_.jsx)(at,{eta:e[t]});case"seeds":return(0,_.jsx)(it,{peersConnected:e.seedsConnected,totalPeers:e.seedsTotal});case"peers":return(0,_.jsx)(it,{peersConnected:e.peersConnected,totalPeers:e.peersTotal});case"percentComplete":return(0,_.jsx)(E.A,{percent:(0,Pe.EW)(()=>Math.ceil(e.percentComplete)).get(),status:(0,Pe.EW)(()=>(0,Ye.s)(e.status)).get()});default:return(0,_.jsx)("span",{children:e[t]})}}),ut=(0,i.PA)(({hash:e,content:t=dt,column:s,className:n,classNameOverride:r=!1,width:i,showIcon:l=!1})=>{const c=l?st[s]:null;return(0,_.jsxs)("div",{className:r?n:a()("torrent__detail",`torrent__detail--${s}`,n,(0,y.AH)({pointerEvents:"none",userSelect:"none"})),role:"cell",style:{width:`${i}px`},children:[c,t?(0,_.jsx)(t,{torrent:p.A.torrents[e],column:s}):(0,_.jsx)(o.Eh,{})]})}),pt=(0,i.PA)((0,n.forwardRef)(({className:e,style:t,hash:s,handleClick:n,handleDoubleClick:r,handleRightClick:a,handleTouchStart:i,handleTouchEnd:l,handleKeyPress:o,...c},u)=>{const p=d.A.floodSettings.torrentListColumns.reduce((e,{id:t,visible:n})=>null==k.A[t]?e:n?(e.push((0,_.jsx)(ut,{className:"table__cell",hash:s,column:t,width:d.A.floodSettings.torrentListColumnWidths[t]},t)),e):e,[]);return(0,_.jsx)("div",{className:e,role:"row",style:t,tabIndex:0,onClick:e=>n(s,e),onContextMenu:e=>a(s,e),onDoubleClick:()=>r(s),onTouchStart:i,onTouchEnd:l,onKeyPress:o,ref:u,...c,children:p})})),ht=(0,i.PA)(({torrent:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.jsxs)("span",{children:[t.number(e.percentComplete,{maximumFractionDigits:1}),(0,_.jsx)("em",{className:"unit",children:"%"})," — ",(0,_.jsx)(L.A,{value:e.downTotal})]})}),mt=(0,i.PA)((0,n.forwardRef)(({className:e,style:t,hash:s,handleClick:n,handleDoubleClick:r,handleRightClick:a,handleTouchStart:i,handleTouchEnd:l,handleKeyPress:o,...c},u)=>{const p=d.A.floodSettings.torrentListColumns,h=[(0,_.jsx)(ut,{hash:s,column:"name",className:"torrent__details__section torrent__details__section--primary"},"name")],m=[(0,_.jsx)(ut,{hash:s,column:"eta",showIcon:!0},"eta"),(0,_.jsx)(ut,{hash:s,column:"downRate",showIcon:!0},"downRate"),(0,_.jsx)(ut,{hash:s,column:"upRate",showIcon:!0},"upRate")],x=[(0,_.jsx)(ut,{hash:s,column:"percentComplete",content:ht,showIcon:!0},"percentComplete")],j=[(0,_.jsx)(ut,{hash:s,column:"percentComplete",className:"torrent__details__section torrent__details__section--quaternary",classNameOverride:!0},"percentBar")];for(let e=0;e<p.length;e+=1){const{id:t,visible:n}=p[e];if(null!=k.A[t]&&n)switch(t){case"name":case"downRate":case"upRate":case"eta":case"downTotal":case"percentComplete":break;default:x.push((0,_.jsx)(ut,{hash:s,column:t,showIcon:!0},t))}}return(0,_.jsxs)("div",{className:e,role:"row",style:t,tabIndex:0,onClick:e=>n(s,e),onContextMenu:e=>a(s,e),onDoubleClick:()=>r(s),onTouchStart:i,onTouchEnd:l,onKeyPress:o,ref:u,...c,children:[(0,_.jsxs)("div",{className:(0,y.AH)({alignItems:"center",display:"flex"}),children:[h,(0,_.jsx)("div",{className:"torrent__details__section torrent__details__section--secondary",children:m})]}),(0,_.jsx)("div",{className:"torrent__details__section torrent__details__section--tertiary",children:x}),j]})})),_t=(e,t)=>{!0===t.cancelable&&t.preventDefault();const s=t.clientX,n=t.clientY,r=t.touches?.[0].clientX,a=t.touches?.[0].clientY;p.A.selectedTorrents.includes(e)||p.A.setSelectedTorrents({hash:e,event:t});const{torrentContextMenuActions:i=Be.A.torrentContextMenuActions}=d.A.floodSettings,l=p.A.torrents[e];h.A.setActiveContextMenu({id:"torrent-list-item",clickPosition:{x:s||r||0,y:n||a||0},items:tt(l).filter(e=>"separator"===e.type||i.some(t=>t.id===e.action&&!0===t.visible))})},xt=e=>h.A.setActiveModal({id:"torrent-details",hash:e}),jt=(e,t)=>p.A.setSelectedTorrents({hash:e,event:t}),gt=(e,t)=>{" "!==t.key&&"Enter"!==t.key&&"ContextMenu"!==t.key||(t.preventDefault(),p.A.selectedTorrents.includes(e)?"Enter"===t.key?xt(e):"ContextMenu"===t.key&&_t(e,t):jt(e,t))},At=(0,i.PA)(({hash:e,style:t})=>{const[s,r]=(0,n.useState)(0),i=(0,n.useRef)(!1),l=(0,n.useRef)(null),o="condensed"===d.A.floodSettings.torrentListViewSize,c=(0,Pe.EW)(()=>p.A.selectedTorrents.includes(e)).get(),{status:u,upRate:h,downRate:m}=p.A.torrents?.[e]||{},x=(0,Ye.$)({status:u,upRate:h,downRate:m},a()({"torrent--is-selected":c,"torrent--is-condensed":o,"torrent--is-expanded":!o}),"torrent"),{onTouchStart:j,onTouchEnd:g}=(0,Xe.A)(t=>{const n=l.current?.getBoundingClientRect().top;null!=t&&null!=n&&Math.abs(n-s)<25&&_t(e,t)}),A=t=>{p.A.selectedTorrents.includes(e)||jt(e,t),i.current?xt(e):(i.current=!0,setTimeout(()=>{i.current=!1},200)),r(l.current?.getBoundingClientRect().top||0),j(t)},b=p.A.torrents?.[e],f=`torrent-${e}`,v=u?.join("-")||"unknown";return o?(0,_.jsx)(pt,{className:x,ref:l,style:t,hash:e,handleClick:jt,handleDoubleClick:xt,handleRightClick:_t,handleTouchStart:A,handleTouchEnd:g,handleKeyPress:t=>gt(e,t),"data-testid":f,"data-torrent-status":v,"data-torrent-name":b?.name,"data-is-selected":c,"data-view-size":"condensed"}):(0,_.jsx)(mt,{className:x,ref:l,style:t,hash:e,handleClick:jt,handleDoubleClick:xt,handleRightClick:_t,handleTouchStart:A,handleTouchEnd:g,handleKeyPress:t=>gt(e,t),"data-testid":f,"data-torrent-status":v,"data-torrent-name":b?.name,"data-is-selected":c,"data-view-size":"expanded"})}),bt=(0,i.PA)(({index:e,style:t})=>(0,_.jsx)(At,{hash:p.A.filteredTorrents[e].hash,style:t})),ft=(0,i.PA)(()=>{const e=(0,n.useRef)(null),t=(0,n.useRef)(null),s=(0,n.useRef)(null);(0,n.useEffect)(()=>(0,Pe.mJ)(()=>q.A.filterTrigger,()=>{null!=t.current&&t.current.scrollTo(0)}),[]),(0,He.A)("keydown",e=>{const{ctrlKey:t,key:s,metaKey:n,repeat:r,target:a}=e,i=a?.tagName?.toUpperCase();"INPUT"!==i&&"TEXTAREA"!==i&&(r||((n||t)&&"a"===s&&(e.preventDefault(),p.A.selectAllTorrents()),(n||t)&&"v"===s&&(async()=>{const t=await(navigator?.clipboard?.readText()),s=t?.startsWith("magnet:?"),n=t?.startsWith("http")&&t?.endsWith(".torrent");(s||n)&&(e.preventDefault(),h.A.setActiveModal({id:"add-torrents",tab:"by-url",urls:[{id:0,value:t}]}))})()))});const r=p.A.filteredTorrents,{torrentListViewSize:a="condensed"}=d.A.floodSettings,i="condensed"===a,u=null==r||0===r.length;let m=null,x=null;return ge.A.isConnected?u||null==r?m=(0,_.jsxs)("div",{className:"torrents__alert__wrapper",children:[(0,_.jsx)("div",{className:"torrents__alert",children:(0,_.jsx)(l.x6,{id:"torrents.list.no.torrents"})}),q.A.isFilterActive?(0,_.jsx)("div",{className:"torrents__alert__action",children:(0,_.jsx)(De.$n,{onClick:()=>{q.A.clearAllFilters()},priority:"tertiary",children:(0,_.jsx)(l.x6,{id:"torrents.list.clear.filters"})})}):null]}):(i&&(x=(0,_.jsx)(Ue,{onCellFocus:()=>{null!=s.current&&null!=e.current&&(s.current.scrollLeft=e.current.scrollLeft)},onCellClick:e=>{const t=d.A.floodSettings.sortTorrents;let s=j[e]??"asc";t.property===e&&(s="asc"===t.direction?"desc":"asc");const n={property:e,direction:s};c.A.saveSetting("sortTorrents",n)},onWidthsChange:(e,t)=>{const{torrentListColumnWidths:s=Be.A.torrentListColumnWidths}=d.A.floodSettings;c.A.saveSetting("torrentListColumnWidths",{...s,[e]:t})},ref:e})),m=(0,_.jsx)(Oe,{className:"torrent__list__viewport",itemCount:r.length,itemKey:e=>p.A.filteredTorrents[e].hash,itemRenderer:bt,itemSize:i?30:70,ref:t,outerRef:t=>{const n=t;null!=n&&null==n.onscroll&&(n.onscroll=()=>{null!=e.current&&(e.current.scrollLeft=n.scrollLeft)}),s.current=n}})):m=(0,_.jsx)("div",{className:"torrents__alert__wrapper",children:(0,_.jsx)("div",{className:"torrents__alert",children:(0,_.jsx)(l.x6,{id:"torrents.list.cannot.connect"})})}),(0,_.jsxs)(Ve,{children:[(0,_.jsxs)("div",{className:"torrent__list__wrapper",role:"table",children:[(0,_.jsx)(Le,{id:"torrent-list-item"}),x,m]}),(0,_.jsx)("div",{className:"dropzone__overlay",children:(0,_.jsxs)("div",{className:"dropzone__copy",children:[(0,_.jsx)("div",{className:"dropzone__icon",children:(0,_.jsx)(o.sv,{})}),(0,_.jsx)(l.x6,{id:"torrents.list.drop"})]})})]})});var vt=s(894);if("string"==typeof vt.A&&"undefined"!=typeof document){const e=document.createElement("style");e.textContent=`@layer third-party { ${vt.A} }`,e.setAttribute("data-layer","third-party"),document.head.appendChild(e)}const yt=(0,n.lazy)(()=>s.e(703).then(s.bind(s,6182))),wt=(0,n.lazy)(()=>Promise.all([s.e(525),s.e(179)]).then(s.bind(s,179))),Nt=()=>((0,n.useEffect)(()=>{P.A.startActivityStream()},[]),(0,_.jsxs)(M.A,{children:[(0,_.jsx)(Me,{}),(0,_.jsxs)($,{children:[(0,_.jsxs)(R,{modifier:"torrent-list",className:"view--torrent-list",children:[(0,_.jsx)(T,{}),(0,_.jsx)(ft,{})]}),(0,_.jsx)(wt,{}),(0,_.jsx)(yt,{})]})]}))},2428:(e,t,s)=>{s.r(t),s.d(t,{default:()=>i});var n=s(6975),r=s(7820),a=s(4848);const i=()=>(0,a.jsx)(n.A,{modifier:"auth-form",children:(0,a.jsx)(r.A,{mode:"login"})})},2471:(e,t,s)=>{s.d(t,{$:()=>a,s:()=>i});var n=s(6942),r=s.n(n);const a=({status:e,downRate:t,upRate:s},...n)=>r()(n,{"torrent--has-error":e.includes("error"),"torrent--is-stopped":e.includes("stopped"),"torrent--is-downloading":e.includes("downloading"),"torrent--is-downloading--actively":t>0,"torrent--is-uploading--actively":s>0,"torrent--is-seeding":e.includes("seeding"),"torrent--is-completed":e.includes("complete"),"torrent--is-checking":e.includes("checking"),"torrent--is-inactive":e.includes("inactive")}),i=e=>{let t="stopped";return["error","checking","stopped","downloading","seeding"].some(s=>!!e.includes(s)&&(t=s,!0)),t}},2607:(e,t,s)=>{s.d(t,{A:()=>n});const n={dateAdded:"torrents.properties.date.added",dateFinished:"torrents.properties.date.finished",downRate:"torrents.properties.download.speed",downTotal:"torrents.properties.download.total",eta:"torrents.properties.eta",name:"torrents.properties.name",peers:"torrents.properties.peers",percentComplete:"torrents.properties.percentage",ratio:"torrents.properties.ratio",seeds:"torrents.properties.seeds",sizeBytes:"torrents.properties.size",tags:"torrents.properties.tags",upRate:"torrents.properties.upload.speed",upTotal:"torrents.properties.upload.total",dateCreated:"torrents.properties.date.created",directory:"torrents.properties.directory",hash:"torrents.properties.hash",isPrivate:"torrents.properties.is.private",message:"torrents.properties.tracker.message",trackerURIs:"torrents.properties.trackers",dateActive:"torrents.properties.date.active"}},3230:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(9161),r=s(4848);const a=({suffix:e,value:t})=>{if(null==t)return null;let s=null,a=null;e&&(a=(0,r.jsx)("span",{className:"duration--segment",children:e}));const i=-1===t?-1:(e=>{const t=Math.floor(e/31536e3),s=Math.floor(e%31536e3/604800),n=Math.floor(e%31536e3%604800/86400),r=Math.floor(e%31536e3%604800%86400/3600),a=Math.floor(e%31536e3%604800%86400%3600/60),i=Math.floor(e-60*a);let l=null;return l=t>0?{years:t,weeks:s,cumSeconds:e}:s>0?{weeks:s,days:n,cumSeconds:e}:n>0?{days:n,hours:r,cumSeconds:e}:r>0?{hours:r,minutes:a,cumSeconds:e}:a>0?{minutes:a,seconds:i,cumSeconds:e}:{seconds:i,cumSeconds:e},l})(t);return s=-1===i?(0,r.jsx)(n.x6,{id:"unit.time.infinity"}):null!=i.years&&i.years>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.years,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.year"})})]},"years"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.weeks,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.week"})})]},"weeks")]:null!=i.weeks&&i.weeks>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.weeks,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.week"})})]},"weeks"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.days,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.day"})})]},"days")]:null!=i.days&&i.days>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.days,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.day"})})]},"days"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.hours,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.hour"})})]},"hours")]:null!=i.hours&&i.hours>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.hours,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.hour"})})]},"hours"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.minutes,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.minute"})})]},"minutes")]:null!=i.minutes&&i.minutes>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.minutes,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.minute"})})]},"minutes"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.seconds,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.second"})})]},"seconds")]:(0,r.jsxs)("span",{className:"duration--segment",children:[i.seconds,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.second"})})]}),(0,r.jsxs)("span",{className:"duration",children:[s,a]})}},3537:(e,t,s)=>{s.d(t,{A:()=>h});var n=s(1083),r=s(5419),a=s.n(r),i=s(7550),l=s(9550),o=s(4930);const{baseURI:c}=l.A,d=e=>{i.A.add({id:"alert.torrent.add.sent",count:e})},u=e=>{i.A.add({id:"alert.torrent.add",type:"success",count:e})},p=e=>{i.A.add({id:"alert.torrent.add.failed",type:"error",count:e})},h={addTorrentsByUrls:e=>n.A.post(`${c}api/torrents/add-urls`,e).then(({data:t})=>{t.length?u(t.length):d(e.urls.length)},()=>{p(e.urls.length)}),addTorrentsByFiles:e=>n.A.post(`${c}api/torrents/add-files`,e).then(({data:t})=>{t.length?u(t.length):d(e.files.length)},()=>{p(e.files.length)}),createTorrent:e=>n.A.post(`${c}api/torrents/create`,e,{responseType:"blob"}).then(({data:t})=>{a()(t,(e.name||`${Date.now()}`).concat(".torrent")),u(1)},()=>{p(1)}),deleteTorrents:e=>n.A.post(`${c}api/torrents/delete`,e).then(()=>i.A.add({id:"alert.torrent.remove",type:"success",count:e.hashes.length}),()=>i.A.add({id:"alert.torrent.remove.failed",type:"error",count:e.hashes.length})),checkHash:e=>n.A.post(`${c}api/torrents/check-hash`,e).then(()=>{},()=>{}),fetchMediainfo:(e,t)=>n.A.get(`${c}api/torrents/${e}/mediainfo`,{cancelToken:t}).then(e=>e.data),fetchTorrentContents:e=>n.A.get(`${c}api/torrents/${e}/contents`).then(e=>e.data,()=>null),fetchTorrentPeers:e=>n.A.get(`${c}api/torrents/${e}/peers`).then(e=>e.data,()=>null),fetchTorrentTrackers:e=>n.A.get(`${c}api/torrents/${e}/trackers`).then(e=>e.data,()=>null),getTorrentContentsDataPermalink:(e,t)=>n.A.get(`${l.A.baseURI}api/torrents/${e}/contents/${t.join(",")}/token`).then(s=>`${window.location.protocol}//${window.location.host}${l.A.baseURI}api/torrents/${e}/contents/${t.join(",")}/data?token=${s.data}`),moveTorrents:e=>n.A.post(`${c}api/torrents/move`,e).then(()=>i.A.add({id:"alert.torrent.move",type:"success",count:e.hashes.length}),()=>i.A.add({id:"alert.torrent.move.failed",type:"error",count:e.hashes.length})),reannounce:e=>n.A.post(`${c}api/torrents/reannounce`,e).then(()=>{},()=>{}),startTorrents:async e=>{if(e.hashes.length>0)return n.A.post(`${c}api/torrents/start`,e).then(()=>{},()=>{})},stopTorrents:async e=>{if(e.hashes.length>0)return n.A.post(`${c}api/torrents/stop`,e).then(()=>{},()=>{})},setInitialSeeding:e=>n.A.patch(`${c}api/torrents/initial-seeding`,e).then(()=>{},()=>{}),setPriority:e=>n.A.patch(`${c}api/torrents/priority`,e).then(()=>{},()=>{}),setSequential:e=>n.A.patch(`${c}api/torrents/sequential`,e).then(()=>{},()=>{}),setFilePriority:(e,t)=>n.A.patch(`${c}api/torrents/${e}/contents`,t).then(()=>{},()=>{}),setTags:e=>n.A.patch(`${c}api/torrents/tags`,e).then(()=>o.A.handleSetTaxonomySuccess(),()=>{}),setTrackers:e=>n.A.patch(`${c}api/torrents/trackers`,e).then(()=>{},()=>{})}},5440:(e,t,s)=>{s.r(t),s.d(t,{default:()=>i});var n=s(7820),r=s(6975),a=s(4848);const i=()=>(0,a.jsx)(r.A,{modifier:"auth-form",children:(0,a.jsx)(n.A,{mode:"register"})})},6541:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(4848);const r=({children:e})=>(0,n.jsx)("div",{className:"badge",children:e})},6975:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(6942),r=s.n(n),a=s(4848);const i=({children:e,modifier:t})=>{const s=r()("application__view",{[`application__view--${t}`]:null!=t});return(0,a.jsx)("div",{className:s,children:e})}},7189:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(9161),r=s(7458),a=s(4848);const i=({value:e,isSpeed:t=!1,className:s,precision:i=2})=>{const l=(0,r.O)(e,i),{i18n:o}=(0,n.uB)();let c=o._((0,r.b)(l.unit));return t&&(c=o._("unit.speed",{baseUnit:c})),(0,a.jsxs)("span",{className:s,children:[Number.isNaN(l.value)?"—":o.number(l.value),(0,a.jsx)("em",{className:"unit",children:c})]})}},7820:(e,t,s)=>{s.d(t,{A:()=>u});var n=s(6540),r=s(9161),a=s(7767),i=s(6565),l=s(5767),o=s(9119),c=s(8045),d=s(4848);const u=({mode:e})=>{const{i18n:t}=(0,r.uB)(),s=(0,n.useRef)(null),u=(0,n.useRef)(null),[p,h]=(0,n.useState)(void 0),[m,_]=(0,n.useState)(!1),x=(0,a.Zp)(),j="login"===e;return(0,d.jsx)("div",{className:"application__entry-barrier",children:(0,d.jsx)(i.Zk,{spacing:"large",children:(0,d.jsxs)(i.lV,{onSubmit:e=>{e.event.preventDefault(),_(!0);const t=e.formData;if(null==t.username||""===t.username)return _(!1),void h({id:"auth.error.username.empty"});if(null==t.password||""===t.password)return _(!1),void h({id:"auth.error.password.empty"});if(j){const e=t;l.A.authenticate({username:e.username,password:e.password}).then(()=>{_(!1),x("/overview",{replace:!0})}).catch(e=>{_(!1),h(e.message),x("/login",{replace:!0})})}else{const e=t;if(null==u.current)return _(!1),void h({id:"connection.settings.error.empty"});const s=u.current;if(null==s)return _(!1),void h({id:"connection.settings.error.empty"});l.A.register({username:e.username,password:e.password,client:s,level:o.h.ADMINISTRATOR}).then(()=>{_(!1),x("/overview",{replace:!0})},e=>{_(!1),h(e.message)})}},ref:s,children:[(0,d.jsx)(i.aO,{children:(0,d.jsx)("h1",{children:j?t._("auth.login"):t._("auth.create.an.account")})}),(0,d.jsxs)(i.wq,{children:[(0,d.jsx)("p",{className:"copy--lead",children:j?t._("auth.login.intro"):t._("auth.create.an.account.intro")}),null!=p?(0,d.jsx)(i.fh,{children:(0,d.jsx)(i.jQ,{isLoading:m,children:"string"==typeof p?p:t._(p)})}):null,(0,d.jsx)(i.fh,{children:(0,d.jsx)(i.Rj,{placeholder:t._("auth.username"),id:"username",autoComplete:"username"})}),(0,d.jsx)(i.fh,{children:(0,d.jsx)(i.Rj,{placeholder:t._("auth.password"),id:"password",type:"password",autoComplete:j?"current-password":"new-password"})})]}),j?null:(0,d.jsx)(i.wq,{hasBorder:!0,children:(0,d.jsx)(c.A,{onSettingsChange:e=>{u.current=e}})}),(0,d.jsx)(i.WH,{hasBorder:!0,children:(0,d.jsxs)(i.fh,{justify:"end",children:[(0,d.jsx)(i.$n,{priority:"tertiary",onClick:()=>{null!=s.current&&s.current.resetForm()},children:t._("auth.input.clear")}),(0,d.jsx)(i.$n,{isLoading:m,type:"submit",children:j?t._("auth.log.in"):t._("auth.create.account")})]})})]})})})}},9689:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(6540),r=s(9161),a=s(9475);const i={file:{0:"DONT_DOWNLOAD",1:"NORMAL",2:"HIGH"},torrent:{0:"DONT_DOWNLOAD",1:"LOW",2:"NORMAL",3:"HIGH"}};var l=s(4848);const o=({id:e,level:t,maxLevel:s,priorityType:o,showLabel:c=!1,clickHandled:d=!1,changePriorityFuncRef:u,onChange:p})=>{const{i18n:h}=(0,r.uB)(),[m,_]=(0,n.useState)(t),x=()=>{let t=m;return t>=s?t=0:t+=1,_(t),p(e,t),t};let j;if(null!=u&&(u.current=x),c){let e;switch(i[o][m]){case"DONT_DOWNLOAD":e=h._("priority.dont.download");break;case"HIGH":e=h._("priority.high");break;case"LOW":e=h._("priority.low");break;default:e=h._("priority.normal")}j=(0,l.jsx)("span",{className:"priority-meter__label",children:e})}const g=(0,l.jsx)("div",{className:`priority-meter priority-meter--max-${s} priority-meter--level-${m}`}),A=(0,a.AH)({_focus:{outline:"none",WebkitTapHighlightColor:"transparent"},_focusVisible:{outline:"dashed"}});return d?(0,l.jsxs)("div",{className:`priority-meter__wrapper ${A}`,children:[g,j]}):(0,l.jsxs)("button",{className:`priority-meter__wrapper ${A}`,type:"button",onClick:()=>{x()},children:[g,j]})}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_jesec_flood=globalThis.webpackChunk_jesec_flood||[]).push([[704],{1693:(e,t,s)=>{s.d(t,{A:()=>n});const n={start:"torrents.list.context.start",stop:"torrents.list.context.stop",remove:"torrents.list.context.remove",checkHash:"torrents.list.context.check.hash",reannounce:"torrents.list.context.reannounce",setTaxonomy:"torrents.list.context.set.tags",move:"torrents.list.context.move",setTrackers:"torrents.list.context.set.trackers",torrentDetails:"torrents.list.context.details",downloadContents:"torrents.list.context.download.contents",downloadMetainfo:"torrents.list.context.download.metainfo",generateMagnet:"torrents.list.context.generate.magnet",setInitialSeeding:"torrents.list.context.initial.seeding",setSequential:"torrents.list.context.sequential",setPriority:"torrents.list.context.priority"}},1915:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(3443),r=s(6540),a=s(942),i=s(4848);const l=(0,r.memo)(({status:e})=>{switch(e){case"error":return(0,i.jsx)(a.$D,{});case"checking":return(0,i.jsx)(a.y$,{});case"downloading":case"seeding":return(0,i.jsx)(a.fe,{});default:return(0,i.jsx)(a.VG,{})}}),o=(0,n.PA)(({percent:e,status:t})=>(0,i.jsxs)("div",{className:"progress-bar",children:[(0,i.jsx)("div",{className:"progress-bar__icon",children:t&&(0,i.jsx)(l,{status:t})}),(0,i.jsx)("div",{className:"progress-bar__fill__wrapper",children:(0,i.jsx)("div",{className:"progress-bar__fill",style:{width:`${e}%`}})})]}))},2066:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Nt});var n=s(6540),r=s(6942),a=s.n(r),i=s(3443),l=s(9161),o=s(942),c=s(9075),d=s(2412),u=s(3537),p=s(484),h=s(4930),m=s(2189),_=s(4848);const x=({clickHandler:e,icon:t,label:s,slug:n,noTip:r=!1})=>{const i=a()("action tooltip__wrapper",{[`action--${n}`]:null!=n});return(0,_.jsxs)(m.A,{content:s,onClick:e,position:"bottom",wrapperClassName:i,suppress:r,children:[t,(0,_.jsx)("span",{className:"action__label",children:s})]})},j={dateAdded:"desc",dateFinished:"desc",dateActive:"desc",downRate:"desc",downTotal:"desc",upRate:"desc",upTotal:"desc"};var g=s(6488),A=s(2618),b=s(7200),f=s.n(b),v=s(9679),y=s(8344);const w=({className:e,label:t,isFocusHandled:s,onClick:n})=>s?(0,_.jsx)("div",{role:"none",className:e,onClick:n,children:t}):(0,_.jsx)("button",{type:"button",className:a()(e,(0,y.AH)({width:"100%",height:"100%",textAlign:"left",_focusVisible:{outline:"dashed"}})),onClick:n,children:t}),N=(0,i.PA)(({baseClassName:e="dropdown",dropdownWrapperClass:t="dropdown",dropdownButtonClass:s="dropdown__trigger",dropdownClickRef:r,direction:i="down",header:l,matchButtonWidth:o=!1,menuItems:c,noWrap:d=!1,trigger:u,width:p,isFocusHandled:m=!1,handleItemSelect:x,onOpen:j})=>{const b=(0,n.useRef)(f()("dropdown_")),y=h.A.activeDropdownMenu===b.current,N=a()(t,`${e}--direction-${i}`,{[`${e}--match-button-width`]:o,[`${e}--width-${p}`]:null!=p,[`${e}--no-wrap`]:d,"is-expanded":y}),k=(0,n.useCallback)(()=>{window.removeEventListener("click",k),h.A.setActiveDropdownMenu(null)},[]);(0,v.A)("Escape",()=>k());const C=(0,n.useCallback)(()=>{window.addEventListener("click",k),j&&j(),h.A.setActiveDropdownMenu(b.current)},[k,j]),S=e=>{e?.stopPropagation(),y?k():C()};let T;if(r&&(r.current=S),y){const e=(0,_.jsx)("div",{className:"dropdown__header",children:(0,_.jsx)(w,{className:s,label:l,isFocusHandled:m??!1,onClick:S})},"dropdown-header"),t=(0,_.jsx)("ul",{className:"dropdown__items",children:c.map((e,t)=>(0,_.jsx)("div",{className:"dropdown__list",children:e.map((e,t)=>{const s=a()("dropdown__item menu__item",e.className,{"is-selectable":!1!==e.selectable,"is-selected":e.selected});return(0,_.jsx)("li",{className:s,children:(0,_.jsx)("button",{type:"button",disabled:!1===e.selectable,onClick:!1===e.selectable?void 0:()=>{k(),x(e)},children:e.displayName})},t)})},t))},"dropdown-items");T=(0,_.jsx)(g.A,{classNames:"menu",timeout:{enter:250,exit:250},children:(0,_.jsx)("div",{className:"dropdown__content menu",children:"up"===i?[t,e]:[e,t]})})}return(0,_.jsxs)("div",{className:N,children:[(0,_.jsx)(w,{className:s,label:u??l,isFocusHandled:m??!1,onClick:S}),(0,_.jsx)(A.A,{children:T})]})});var k=s(2607);const C=["name","eta","downRate","upRate","ratio","percentComplete","downTotal","upTotal","sizeBytes","dateAdded","dateFinished","dateActive"],S=e=>{const{direction:t,selectedProperty:s,onSortChange:n}=e,{i18n:r}=(0,l.uB)();if(null==s)return null;const a=(0,_.jsxs)("div",{className:"dropdown__button",children:[(0,_.jsx)("span",{className:"dropdown__label",children:(0,_.jsx)(l.x6,{id:"torrents.sort.title"})}),(0,_.jsx)("span",{className:"dropdown__value",children:(0,_.jsx)(l.x6,{id:k.A[s]})})]}),i=[C.map(e=>{const n=e===s,a=n?(0,_.jsx)("span",{className:`sort-dropdown__indicator sort-dropdown__indicator--${t}`}):null;return{displayName:(0,_.jsxs)("div",{className:"sort-dropdown__item",children:[r._(k.A[e]),a]}),selected:n,property:e}})];return(0,_.jsx)(N,{handleItemSelect:e=>{const{property:r}=e;if(null==r)return;let a=j[r]??"asc";s===r&&(a="asc"===t?"desc":"asc"),n({direction:a,property:r})},header:a,menuItems:i})},T=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),{sortTorrents:t,torrentListViewSize:s}=d.A.floodSettings,n=a()("action-bar",{"action-bar--is-condensed":"condensed"===s});return(0,_.jsxs)("nav",{className:n,children:[(0,_.jsx)("div",{className:"actions action-bar__item action-bar__item--sidebar-expand-collapse",children:(0,_.jsx)(x,{label:"actionbar.button.sidebar.expand.collapse",slug:"sidebar-expand-collapse",icon:(0,_.jsx)(o.W1,{}),clickHandler:()=>{const e=document.getElementsByClassName("application__view")[0];null!=e&&e.classList.toggle("application__view--sidebar-alternative-state")},noTip:!0})}),(0,_.jsx)("div",{className:"actions action-bar__item action-bar__item--sort-torrents",children:(0,_.jsx)(S,{direction:null!=t?t.direction:"desc",onSortChange:e=>{c.A.saveSetting("sortTorrents",e)},selectedProperty:null!=t?t.property:"dateAdded"})}),(0,_.jsxs)("div",{className:"actions action-bar__item action-bar__item--torrent-operations",children:[(0,_.jsxs)("div",{className:"action-bar__group",children:[(0,_.jsx)(x,{label:e._("actionbar.button.start.torrent"),slug:"start-torrent",icon:(0,_.jsx)(o.fe,{}),clickHandler:()=>u.A.startTorrents({hashes:p.A.selectedTorrents})}),(0,_.jsx)(x,{label:e._("actionbar.button.stop.torrent"),slug:"stop-torrent",icon:(0,_.jsx)(o.VG,{}),clickHandler:()=>u.A.stopTorrents({hashes:p.A.selectedTorrents})})]}),(0,_.jsxs)("div",{className:"action-bar__group action-bar__group--has-divider",children:[(0,_.jsx)(x,{label:e._("actionbar.button.add.torrent"),slug:"add-torrent",icon:(0,_.jsx)(o.OM,{}),clickHandler:()=>h.A.setActiveModal({id:"add-torrents"})}),(0,_.jsx)(x,{label:e._("actionbar.button.remove.torrent"),slug:"remove-torrent",icon:(0,_.jsx)(o.n$,{}),clickHandler:()=>h.A.setActiveModal({id:"remove-torrents"})})]})]})]})}),$=({children:e})=>(0,_.jsx)("div",{className:"application__content",children:e}),R=({children:e,baseClassName:t="application__panel",className:s,modifier:n})=>{const r=a()(t,{[`${t}--${n}`]:t,[s]:s});return(0,_.jsx)("div",{className:r,children:e})};var M=s(6975),P=s(8851),H=s(1966),D=s(2543),B=s(6816),L=s(7189),E=s(1915);const z=({label:e,value:t})=>(0,_.jsxs)("li",{"aria-label":"label",className:"diskusage__details-list__item",role:"cell",children:[(0,_.jsx)("span",{className:"diskusage__details-list__label",children:e}),(0,_.jsx)(L.A,{className:"diskuage__size-used",value:t})]}),I=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),{disks:t}=B.A,{mountPoints:s}=d.A.floodSettings;if(null==t||null==s)return null;const n=t.reduce((e,t)=>({...e,[t.target]:t}),{}),r=s.filter(e=>e in n).map(e=>n[e]).map(t=>(0,_.jsx)("li",{className:"sidebar-filter__item sidebar__diskusage",role:"row",children:(0,_.jsxs)(m.A,{content:(0,_.jsxs)("ul",{className:"diskusage__details-list",role:"tooltip",children:[(0,_.jsx)(z,{value:t.used,label:e._("status.diskusage.used")}),(0,_.jsx)(z,{value:t.avail,label:e._("status.diskusage.free")}),(0,_.jsx)(z,{value:t.size,label:e._("status.diskusage.total")})]}),position:"top",styles:(0,y.AH)({cursor:"default"}),wrapperClassName:"diskusage__item",children:[(0,_.jsxs)("div",{className:"diskusage__text-row",children:[t.target,(0,_.jsxs)("span",{children:[D.round(100*t.used/t.size,2),"%"]})]}),(0,_.jsx)(E.A,{percent:D.round(100*t.used/t.size,2)})]})},t.target));if(null==r||0===r.length)return null;const a=e._("status.diskusage.title");return(0,_.jsxs)("ul",{"aria-label":a,className:"sidebar-filter sidebar__item",role:"table",children:[(0,_.jsx)("li",{className:"sidebar-filter__item sidebar-filter__item--heading",children:a}),r]})}),F=()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null);return(0,_.jsx)(m.A,{content:e._("sidebar.button.feeds"),onClick:()=>{null!=t.current&&t.current.dismissTooltip(),h.A.setActiveModal({id:"feeds"})},ref:t,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.jsx)(o.JY,{})})};var O=s(5504),W=s(6541);const G=(0,y.AH)({_focus:{outline:"none",WebkitTapHighlightColor:"transparent"}}),U=({children:e,name:t,icon:s,isActive:r,slug:i,count:c,size:d,handleClick:u})=>{const p=(0,n.createRef)(),h=(e=>{const[t,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{if(e.current){const{current:t}=e;s(t.scrollWidth>t.clientWidth)}},[e,e?.current?.scrollWidth,e?.current?.clientWidth]),t})(p),{i18n:m}=(0,l.uB)(),[x,j]=(0,n.useState)(!1),g=a()("sidebar-filter__item",{"is-active":r}),A=a()("sidebar-filter__expander",{"is-active":r,expanded:x});let b=t;if(""===b)b=m._("filter.all");else if("untagged"===b){if(0===c)return null;b=m._("filter.untagged")}return"checking"!==i&&"error"!==i||0!==c?(0,_.jsxs)("li",{children:[(0,_.jsxs)("div",{className:e?(0,y.AH)({display:"flex"}):void 0,children:[e&&(0,_.jsx)("button",{className:`${A} ${G}`,type:"button",onClick:()=>j(!x),role:"switch","aria-checked":x,children:(0,_.jsx)(o.fe,{})}),(0,_.jsxs)("button",{className:`${g} ${G}`,type:"button",onClick:e=>u(i,e),role:"menuitem",children:[s,(0,_.jsx)("span",{className:"name",ref:p,title:h?b||"":void 0,children:b}),(0,_.jsx)(W.A,{children:c}),null!=d&&(0,_.jsx)(L.A,{value:d,className:"size"})]})]}),e&&x&&(0,_.jsx)("ul",{className:"sidebar-filter__nested",children:e})]}):null};var q=s(9399);const K=e=>{if(1===e.children.length&&e.containedCount===e.children[0].containedCount){const t=e.children[0],s=t.fullPath.includes("/")?"/":"\\";return K({...t,directoryName:e.directoryName+s+t.directoryName})}const t=e.children.map(K);return(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setLocationFilters(e,t),count:e.containedCount,isActive:""===e.fullPath&&!q.A.locationFilter.length||q.A.locationFilter.includes(e.fullPath),name:e.directoryName,slug:e.fullPath,size:e.containedSize,children:t.length&&t||void 0},e.fullPath)},V=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)();if(0===q.A.taxonomy.locationTree.containedCount)return null;const t=K(q.A.taxonomy.locationTree),s=e._("filter.location.title");return(0,_.jsxs)("ul",{"aria-label":s,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item sidebar-filter__item--heading",role:"none",children:s}),t]})});var X=s(6289);const Y=10,J=e=>P.A.fetchNotifications({id:"notification-tooltip",limit:Y,start:e}),Q=({paginationStart:e,notificationTotal:t})=>{const{i18n:s}=(0,l.uB)();if(t>Y){let n=e+1,r=e+Y;return n>t&&(n=t),r>t&&(r=t),(0,_.jsx)("div",{className:"toolbar toolbar--dark toolbar--top tooltip__toolbar tooltip__content--padding-surrogate",children:(0,_.jsxs)("span",{className:"toolbar__item toolbar__item--label",children:[`${s._("notification.showing")} `,(0,_.jsxs)("strong",{children:[n,` ${s._("general.to")} `,r]}),` ${s._("general.of")} `,(0,_.jsx)("strong",{children:t})]})})}return null},Z=({notification:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.jsxs)("li",{className:"notifications__list__item",children:[(0,_.jsxs)("div",{className:"notification__heading",children:[(0,_.jsx)("span",{className:"notification__category",children:t._(`${e.id}.heading`)})," — ",(0,_.jsx)("span",{className:"notification__timestamp",children:t.date(new Date(e.ts),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,_.jsx)("div",{className:"notification__message",children:t._(`${e.id}.body`,e.data)})]})},ee=({paginationStart:e,notificationTotal:t,onPrevClick:s,onClearClick:n,onNextClick:r})=>{const{i18n:i}=(0,l.uB)();if(t>0){let l=e+20,c=e-Y;return l>t&&(l=t),c<0&&(c=0),(0,_.jsxs)("ul",{className:"notifications__toolbar toolbar toolbar--dark toolbar--bottom",children:[(0,_.jsx)("li",{className:a()("toolbar__item toolbar__item--button",{"is-disabled":0===e}),children:(0,_.jsxs)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:s,children:[(0,_.jsx)(o.JG,{}),`${c+1} - ${e}`]})}),(0,_.jsx)("li",{className:"toolbar__item toolbar__item--button",children:(0,_.jsx)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:n,children:i._("notification.clear.all")})}),(0,_.jsx)("li",{className:a()("toolbar__item toolbar__item--button",{"is-disabled":e+Y>=t}),children:(0,_.jsxs)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:r,children:[`${e+Y+1} - ${l}`,(0,_.jsx)(o.c_,{})]})})]})}return null},te=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null),s=(0,n.useRef)(null),[r,i]=(0,n.useState)(!1),[c,d]=(0,n.useState)(0),[u,p]=(0,n.useState)(0),{hasNotification:h,notifications:x,notificationCount:j}=X.A;return(0,n.useEffect)(()=>{j.total>0&&t.current?.isOpen()&&(i(!0),J(c).finally(()=>i(!1)))},[j,c]),(0,_.jsxs)(m.A,{contentClassName:"tooltip__content tooltip__content--no-padding",content:h?(0,_.jsxs)("div",{className:a()("notifications",{"notifications--is-loading":r}),children:[(0,_.jsx)(Q,{paginationStart:c,notificationTotal:j.total}),(0,_.jsx)("div",{className:"notifications__loading-indicator",children:(0,_.jsx)(o.mY,{})}),(0,_.jsx)("ul",{className:"notifications__list tooltip__content--padding-surrogate",ref:s,style:{minHeight:u},children:x.map((e,t)=>(0,_.jsx)(Z,{notification:e},t))}),(0,_.jsx)(ee,{paginationStart:c,notificationTotal:j.total,onPrevClick:()=>{const e=c-Y;e>=0&&(p(s.current?.clientHeight||0),d(e))},onClearClick:()=>{null!=t.current&&t.current.dismissTooltip(),P.A.clearNotifications(),p(0),d(0)},onNextClick:()=>{const e=c+Y;j.total>e&&(p(s.current?.clientHeight||0),d(e))}})]}):(0,_.jsx)("div",{className:"notifications tooltip__content--padding-surrogate",style:{textAlign:"center"},children:e._("notification.no.notification")}),interactive:!0,onOpen:()=>J(c),ref:t,width:340,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button tooltip__wrapper",children:[(0,_.jsx)(o.Eg,{}),h?(0,_.jsx)("span",{className:"notifications__badge",children:j.total}):null]})}),se=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null),{searchFilter:s}=q.A;(0,n.useEffect)(()=>{null!=t.current&&s!==t.current.value&&(t.current.value=s)},[t,s]);const r=""!==s;return(0,_.jsxs)("div",{className:a()({sidebar__item:!0,search:!0,"is-in-use":r}),children:[r&&(0,_.jsx)("button",{className:"button search__reset-button",onClick:()=>{q.A.setSearchFilter(""),null!=t.current&&t.current.blur()},type:"button",children:(0,_.jsx)(o.bm,{})}),(0,_.jsx)(o.vj,{}),(0,_.jsx)("input",{className:"textbox",ref:t,type:"text",placeholder:e._("sidebar.search.placeholder"),onChange:e=>{q.A.setSearchFilter(e.target.value)}})]})}),ne=()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null);return(0,_.jsx)(m.A,{content:e._("sidebar.button.settings"),onClick:()=>{null!=t.current&&t.current.dismissTooltip(),h.A.setActiveModal({id:"settings"})},ref:t,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.jsx)(o.wB,{})})},re=({children:e})=>(0,_.jsx)("div",{className:"sidebar__actions",children:e});var ae=s(9107),ie=s.n(ae),le=s(8440);const oe=({bytes:e})=>0===e?(0,_.jsx)(l.x6,{id:"speed.unlimited"}):(0,_.jsx)(L.A,{value:e,isSpeed:!0,precision:1}),ce=({i18n:e,direction:t,speedLimits:s,throttleGlobalDownSpeed:n,throttleGlobalUpSpeed:r})=>{const a={className:`dropdown__label dropdown__label--${t}`,..."download"===t?{displayName:e._("sidebar.speedlimits.download")}:{displayName:e._("sidebar.speedlimits.upload")},selectable:!1,value:null},i={download:n,upload:r},l=s[t];let o=!0;const c=l.map(e=>{let s=!1;return i&&i[t]===e&&(s=!0,o=!1),{displayName:(0,_.jsx)(oe,{bytes:e}),property:t,selected:s,selectable:!0,value:e}});if(o&&i){const e=ie()(l,i[t]);c.splice(e,0,{displayName:(0,_.jsx)(oe,{bytes:i[t]}),property:t,selected:!0,selectable:!0,value:i[t]})}return c.unshift(a),c},de=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=(0,n.useRef)(null),s=(0,n.useRef)(()=>{}),r=e._("sidebar.button.speedlimits"),a={i18n:e,speedLimits:d.A.floodSettings.speedLimits,throttleGlobalDownSpeed:d.A.clientSettings?.throttleGlobalDownSpeed??0,throttleGlobalUpSpeed:d.A.clientSettings?.throttleGlobalUpSpeed??0};return(0,_.jsx)(N,{dropdownClickRef:s,dropdownWrapperClass:"dropdown dropdown--speed-limits sidebar__action",handleItemSelect:e=>{null!=e.value&&("download"===e.property?le.A.saveSetting("throttleGlobalDownSpeed",e.value):"upload"===e.property&&le.A.saveSetting("throttleGlobalUpSpeed",e.value))},header:(0,_.jsxs)("div",{className:"sidebar__icon-button sidebar__icon-button--interactive sidebar__icon-button--limits",title:r,children:[(0,_.jsx)(o.xu,{}),r]}),menuItems:[ce({direction:"download",...a}),ce({direction:"upload",...a})],onOpen:()=>{null!=t.current&&t.current.dismissTooltip()},trigger:(0,_.jsx)(m.A,{content:r,position:"bottom",ref:t,wrapperClassName:"sidebar__icon-button tooltip__wrapper",onClick:()=>s.current?.(),children:(0,_.jsx)(o.xu,{})}),isFocusHandled:!0})}),ue=({children:e,className:t,expanded:s,handleClick:n})=>(0,_.jsxs)("button",{className:t,onClick:e=>n(e),children:[e,s?(0,_.jsx)(o.cL,{className:(0,y.AH)({transform:"scaleY(-1)"})}):(0,_.jsx)(o.cL,{})]}),pe=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),t=[{label:e._("filter.all"),slug:"",icon:(0,_.jsx)(o.u8,{})},{label:e._("filter.status.downloading"),slug:"downloading",icon:(0,_.jsx)(o.QH,{})},{label:e._("filter.status.seeding"),slug:"seeding",icon:(0,_.jsx)(o.H8,{})},{label:e._("filter.status.checking"),slug:"checking",icon:(0,_.jsx)(o.y$,{})},{label:e._("filter.status.completed"),slug:"complete",icon:(0,_.jsx)(o.AY,{})},{label:e._("filter.status.stopped"),slug:"stopped",icon:(0,_.jsx)(o.VG,{})},{label:e._("filter.status.active"),slug:"active",icon:(0,_.jsx)(o.RZ,{})},{label:e._("filter.status.inactive"),slug:"inactive",icon:(0,_.jsx)(o.Up,{})},{label:e._("filter.status.error"),slug:"error",icon:(0,_.jsx)(o.$D,{})}].map(e=>(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setStatusFilters(e,t),count:q.A.taxonomy.statusCounts[e.slug]||0,icon:e.icon,isActive:""===e.slug&&!q.A.statusFilter.length||q.A.statusFilter.includes(e.slug),name:e.label,slug:e.slug,size:q.A.taxonomy.statusSizes[e.slug]??0},e.slug)),s=e._("filter.status.title"),[r,a]=(0,n.useState)(!0);return(0,_.jsxs)("ul",{"aria-label":s,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.jsx)(ue,{className:"sidebar-filter__item--heading",expanded:r,handleClick:()=>{a(!r)},children:s})}),r&&t]})}),he=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),[t,s]=(0,n.useState)(!0),r=Object.keys(q.A.taxonomy.tagCounts);if(1===r.length&&""===r[0]||2===r.length&&"untagged"===r[1])return null;const a=r.slice().sort((e,t)=>""===e||"untagged"===e?-1:""===t||"untagged"===t?1:e.localeCompare(t)).map(e=>(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setTagFilters(e,t),count:q.A.taxonomy.tagCounts[e]||0,isActive:""===e&&!q.A.tagFilter.length||q.A.tagFilter.includes(e),name:e,slug:e,size:q.A.taxonomy.tagSizes[e]},e)),i=e._("filter.tag.title");return(0,_.jsxs)("ul",{"aria-label":i,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.jsx)(ue,{className:"sidebar-filter__item--heading",expanded:t,handleClick:()=>{s(!t)},children:i})}),t&&a]})});var me=s(9550);const _e=()=>{const{i18n:e}=(0,l.uB)();return(0,_.jsx)(m.A,{content:e._(me.A.isPreferDark?"sidebar.button.theme.light":"sidebar.button.theme.dark"),onClick:()=>me.A.setUserPreferDark(!me.A.isPreferDark),position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.jsx)(o.oy,{})})},xe=(0,i.PA)(()=>{const{i18n:e}=(0,l.uB)(),[t,s]=(0,n.useState)(!0),r=Object.keys(q.A.taxonomy.trackerCounts);if(1===r.length&&""===r[0])return null;const a=r.slice().sort((e,t)=>""===e?-1:""===t?1:e.localeCompare(t)).map(e=>(0,_.jsx)(U,{handleClick:(e,t)=>q.A.setTrackerFilters(e,t),count:q.A.taxonomy.trackerCounts[e]||0,isActive:""===e&&!q.A.trackerFilter.length||q.A.trackerFilter.includes(e),name:e,slug:e,size:q.A.taxonomy.trackerSizes[e]},e)),i=e._("filter.tracker.title");return(0,_.jsxs)("ul",{"aria-label":i,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.jsx)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.jsx)(ue,{className:"sidebar-filter__item--heading",expanded:t,handleClick:()=>{s(!t)},children:i})}),t&&a]})});var je=s(1304),ge=s(6307),Ae=s(4669),be=s(3230);const fe={download:(0,_.jsx)(o.f5,{}),infinity:(0,_.jsx)(o.Qt,{}),upload:(0,_.jsx)(o._O,{})},ve=(0,i.PA)(({inspectorPoint:e})=>{const{i18n:t}=(0,l.uB)(),s=(s,n={})=>{const{throttleGlobalDownSpeed:r=0,throttleGlobalUpSpeed:i=0}=d.A.clientSettings||{},{transferSummary:l}=Ae.A,o={download:r,upload:i},c={download:l.downTotal,upload:l.upTotal};let u={download:l.downRate,upload:l.upRate};null!=e&&(u={upload:e.upload,download:e.download});const p=a()("client-stats__rate__data--secondary",{"is-visible":null==e&&ge.A.isConnected}),h=a()("client-stats__rate__data--timestamp",{"is-visible":null!=e&&n.showHoverDuration});let m=null;null!=e?.timestamp&&(m=(0,_.jsx)("div",{className:h,children:(0,_.jsx)(be.A,{suffix:t._("general.ago"),value:Math.trunc((Date.now()-e.timestamp)/1e3)})}));let x=null;return x=0===o[s]?fe.infinity:(0,_.jsx)(L.A,{value:o[s],isSpeed:!0}),(0,_.jsxs)("div",{className:`client-stats__rate client-stats__rate--${s}`,children:[(0,_.jsx)("div",{className:"client-stats__rate__icon",children:fe[s]}),(0,_.jsxs)("div",{className:"client-stats__rate__data",children:[(0,_.jsx)("div",{className:"client-stats__rate__data--primary",children:(0,_.jsx)(L.A,{value:u[s],isSpeed:!0})}),m,(0,_.jsxs)("div",{className:p,children:[(0,_.jsx)("div",{className:"client-stats__rate__data--total",children:(0,_.jsx)(L.A,{value:c[s]})}),(0,_.jsx)("div",{className:"client-stats__rate__data--limit",children:x})]})]})]})};return(0,_.jsxs)("div",{className:"client-stats__rates",children:[s("download",{showHoverDuration:!0}),s("upload")]})});var ye=s(1253),we=s(4439),Ne=s(8640),ke=s(846),Ce=s(8239);const Se=({direction:e})=>(0,_.jsxs)("linearGradient",{id:`graph__gradient--${e}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[(0,_.jsx)("stop",{className:`graph__gradient--top graph__gradient--top--${e}`,offset:"0%"}),(0,_.jsx)("stop",{className:`graph__gradient--bottom graph__gradient--bottom--${e}`,offset:"100%"})]}),Te=(e,t,s)=>{const n=e[t][Math.ceil(s)],r=e[t][Math.floor(s)];return r+s%1*(n-r)},$e=(0,i.PA)(({id:e,height:t,width:s,handlerRefs:r,onHover:a,onMouseOut:i})=>{const[l,o]=(0,n.useState)(!1),c=(0,n.useRef)(0),d=(0,n.useRef)({download:0,upload:0,timestamp:0}),u=Ae.A.transferRates,p=(0,Ce.A)().domain([0,u.download.length-1]).range([0,s]),h=(0,Ce.A)().domain([0,(0,ke.A)(u.download,(e,t)=>Math.max(e,u.upload[t]))]).range([t-10,10]);r.current={handleMouseMove:e=>{c.current=p.invert(e),a(d.current)},handleMouseOut:()=>{o(!1),i()},handleMouseOver:()=>{o(!0)}},l&&(d.current={download:Te(u,"download",c.current),upload:Te(u,"upload",c.current),timestamp:u.timestamps[Math.round(c.current)]});const m=ye.G;return(0,_.jsxs)("svg",{className:"graph",id:e,height:"100%",width:"100%",children:[(0,_.jsxs)("defs",{children:[(0,_.jsx)(Se,{direction:"upload"}),(0,_.jsx)(Se,{direction:"download"})]}),Ae.j.map(e=>[(0,_.jsx)("path",{className:"graph__area",fill:`url('#graph__gradient--${e}')`,d:(0,we.A)().x((e,t)=>p(t)||0).y0(t).y1(e=>h(e)||0).curve(m)(u[e])},`area-${e}`),(0,_.jsx)("path",{className:`graph__line graph__line--${e}`,d:(0,Ne.A)().x((e,t)=>p(t)||0).y(e=>h(e)||0).curve(m)(u[e])},`line-${e}`),(0,_.jsx)("circle",{className:`graph__circle graph__circle--${e}`,r:2.5,style:{opacity:l?1:0},transform:`translate(${p(c.current)},${h(d.current[e])})`},`point-${e}`)])]})}),Re=(0,i.PA)(()=>{const[e,t]=(0,n.useState)(null),[s,r]=(0,n.useState)(250),a=(0,n.useRef)(null);return(0,_.jsx)(je.A,{offset:!0,onResize:e=>{e.offset?.width&&r(e.offset.width)},children:({measureRef:n})=>(0,_.jsx)("div",{ref:n,className:"client-stats__wrapper sidebar__item",children:(0,_.jsxs)("div",{className:"client-stats",onMouseMove:e=>{null!=e?.nativeEvent?.clientX&&a.current?.handleMouseMove(e.nativeEvent.clientX)},onMouseOver:()=>a.current?.handleMouseOver(),onMouseOut:()=>a.current?.handleMouseOut(),onFocus:()=>a.current?.handleMouseOver(),onBlur:()=>a.current?.handleMouseOut(),children:[(0,_.jsx)(ve,{inspectorPoint:e}),ge.A.isConnected&&(0,_.jsx)($e,{height:150,id:"transfer-rate-graph",onMouseOut:()=>{t(null)},onHover:e=>{t(e)},handlerRefs:a,width:s})]})})})}),Me=()=>(0,_.jsx)(H.r,{className:"application__sidebar",options:{scrollbars:{autoHide:"scroll",clickScroll:!1,dragScroll:!1,theme:"os-theme-thin"},overflow:{x:"hidden",y:"scroll"}},children:(0,_.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,_.jsxs)(re,{children:[(0,_.jsx)(de,{}),(0,_.jsx)(ne,{}),(0,_.jsx)(F,{}),(0,_.jsx)(te,{}),(0,_.jsx)(O.A,{})]}),(0,_.jsx)(Re,{}),(0,_.jsx)(se,{}),(0,_.jsx)(pe,{}),(0,_.jsx)(he,{}),(0,_.jsx)(xe,{}),(0,_.jsx)(V,{}),(0,_.jsx)(I,{}),(0,_.jsx)("div",{style:{flexGrow:1}}),(0,_.jsx)(re,{children:(0,_.jsx)(_e,{})})]})});var Pe=s(7813),He=s(377),De=s(6565),Be=s(3675);const Le=(0,i.PA)(({id:e})=>{const t=h.A.activeContextMenu?.id===e,s=h.A.activeContextMenu?.items??[],n=h.A.activeContextMenu?.clickPosition??{x:0,y:0},{i18n:r}=(0,l.uB)();return(0,v.A)("Escape",()=>h.A.dismissContextMenu(e)),(0,_.jsx)(De.tz,{triggerCoordinates:n,onOverlayClick:()=>{h.A.dismissContextMenu(e)},onOverlayRightClick:e=>{e.preventDefault()},isIn:t,children:s.map((t,s)=>{let n,i;if("action"===t.type)i=a()("menu__item",{"is-selectable":t.clickHandler}),n=(0,_.jsxs)("span",{children:[(0,_.jsxs)("span",{className:a()("menu__item__label--primary",{"has-action":t.labelAction}),children:[(0,_.jsx)("span",{className:"menu__item__label",children:r._(t.label)}),t.labelAction?(0,_.jsx)("span",{className:"menu__item__label__action",children:(0,_.jsx)(t.labelAction,{})}):void 0]}),t.labelSecondary?(0,_.jsx)("span",{className:"menu__item__label--secondary",children:(0,_.jsx)(t.labelSecondary,{})}):void 0]});else i=a()("menu__item",{"menu__item--separator":"separator"===t.type});return(0,_.jsx)("li",{className:i,children:(0,_.jsx)("button",{type:"button",disabled:"action"!==t.type||!t.clickHandler,onClick:s=>("separator"!==t.type&&(!1===t.dismissMenu&&s.nativeEvent.stopImmediatePropagation(),t.clickHandler&&t.clickHandler(s),!1!==t.dismissMenu&&h.A.dismissContextMenu(e)),!1),onContextMenu:e=>{e.preventDefault()},children:n})},"action"===t.type?t.action:`sep-${s}`)})})});var Ee=s(88),ze=s(4712);const Ie=(0,n.forwardRef)((e,t)=>{const{children:s,onScroll:r}=e,a=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const e=a.current;if(null==e)return()=>{};const s=e.osInstance()?.elements().viewport;return t(s),r&&s.addEventListener("scroll",e=>r(e),{passive:!0}),()=>{r&&s.removeEventListener("scroll",e=>r(e))}},[r,t]),(0,_.jsx)(H.r,{...e,options:{scrollbars:{autoHide:"leave",clickScroll:!0,theme:"os-theme-"+(me.A.isPreferDark?"light":"dark")}},ref:a,children:s})}),Fe=(0,n.forwardRef)((e,t)=>{const{className:s,itemCount:n,itemKey:r,itemRenderer:a,itemSize:i,outerRef:l}=e,{height:o}=(0,ze.A)();return(0,_.jsx)(Ee.Y1,{className:s,height:Math.max(30*i,o),itemCount:n,itemKey:r,itemSize:i,width:"100%",outerElementType:me.A.isSmallScreen?void 0:Ie,ref:t,overscanCount:30,outerRef:l,children:a})}),Oe=(0,i.PA)(Fe);var We=s(5162);const Ge="\n body { user-select: none !important; }\n * { cursor: col-resize !important; }\n",Ue=(0,i.PA)((0,n.forwardRef)(({onCellClick:e,onCellFocus:t,onWidthsChange:s},r)=>{const[i,o]=(0,n.useState)(!1),c=(0,n.useRef)(),u=(0,n.useRef)(),p=(0,n.useRef)(),m=(0,We.A)(r),x=(0,n.useRef)(null),{i18n:j}=(0,l.uB)(),g=e=>{let t=0;null!=p.current&&(t=e.clientX-p.current);let s=20;null!=u.current&&(s=u.current+t),s>20&&(u.current=s,p.current=e.clientX,null!=x.current&&null!=m.current&&(x.current.style.transform=`translate(${Math.max(0,e.clientX)}px, ${m.current.getBoundingClientRect().top}px)`))},A=()=>{h.A.removeGlobalStyle(Ge),window.removeEventListener("pointerup",A),window.removeEventListener("pointermove",g),o(!1),p.current=void 0,null!=x.current&&(x.current.style.opacity="0"),null!=c.current&&null!=u.current&&s(c.current,u.current),c.current=void 0,u.current=void 0};return(0,_.jsxs)("div",{className:"table__row table__row--heading",role:"row",ref:m,children:[d.A.floodSettings.torrentListColumns.reduce((s,{id:n,visible:r})=>{if(!r)return s;const b=k.A[n];if(null==b)return s;let f=null;const v=d.A.floodSettings.torrentListColumnWidths[n]||100;i||(f=(0,_.jsx)("span",{className:"table__heading__handle",onPointerDown:e=>{i||null==x.current||null==m.current||(o(!0),c.current=n,u.current=v,p.current=e.clientX,window.addEventListener("pointerup",A),window.addEventListener("pointermove",g),h.A.addGlobalStyle(Ge),x.current.style.transform=`translate(${Math.max(0,e.clientX)}px, ${m.current.getBoundingClientRect().top}px)`,x.current.style.opacity="1")}}));const w=n===d.A.floodSettings.sortTorrents.property,N=a()("table__cell table__heading",{"table__heading--is-sorted":w,[`table__heading--direction--${d.A.floodSettings.sortTorrents.direction}`]:w});return s.push((0,_.jsxs)("button",{className:`${N} ${(0,y.AH)({textAlign:"left",_focus:{outline:"none",WebkitTapHighlightColor:"transparent"}})}`,role:"columnheader","aria-sort":w?"asc"===d.A.floodSettings.sortTorrents.direction?"ascending":"descending":"none",type:"button",onClick:()=>e(n),onFocus:()=>t(),style:{width:`${v}px`},children:[(0,_.jsx)("span",{className:"table__heading__label",title:j._(b),children:(0,_.jsx)(l.x6,{id:b})}),f]},n)),s},[]),(0,_.jsx)("div",{className:"table__cell table__heading table__heading--fill"}),(0,_.jsx)("div",{className:"table__heading__resize-line",ref:x})]})}));var qe=s(6386);const Ke=e=>{const t=[];e.forEach(s=>{const n=new FileReader;n.onload=n=>{null!=n.target?.result&&"string"==typeof n.target.result&&t.push({name:s.name,data:n.target.result.split("base64,")[1]}),t.length===e.length&&null!=t[0]&&h.A.setActiveModal({id:"add-torrents",tab:"by-file",files:t})},n.readAsDataURL(s)})},Ve=({children:e})=>{const{getRootProps:t,isDragActive:s}=(0,qe.VB)({onDrop:Ke,noClick:!0,noKeyboard:!0});return(0,_.jsx)("div",{...t({onClick:e=>e.preventDefault()}),className:"dropzone dropzone--with-overlay torrents "+(s?"dropzone--is-dragging":""),children:e})};var Xe=s(3736),Ye=s(2471),Je=s(1693),Qe=s(9689);const Ze=()=>p.A.selectedTorrents[p.A.selectedTorrents.length-1],et=(0,i.PA)(({property:e})=>(0,_.jsx)("span",{className:"toggle-input checkbox",style:{display:"inline"},children:(0,_.jsx)("div",{className:"toggle-input__indicator",children:(0,_.jsx)("div",{className:"toggle-input__indicator__icon",style:{opacity:p.A.torrents[Ze()][e]?"1":void 0},children:(0,_.jsx)(o.MG,{})})})})),tt=e=>{const t=(0,n.createRef)();return[{type:"action",action:"start",label:Je.A.start,clickHandler:()=>{u.A.startTorrents({hashes:p.A.selectedTorrents})}},{type:"action",action:"stop",label:Je.A.stop,clickHandler:()=>{u.A.stopTorrents({hashes:p.A.selectedTorrents})}},{type:"action",action:"remove",label:Je.A.remove,clickHandler:()=>{h.A.setActiveModal({id:"remove-torrents"})}},{type:"action",action:"checkHash",label:Je.A.checkHash,clickHandler:()=>{u.A.checkHash({hashes:p.A.selectedTorrents})}},{type:"action",action:"reannounce",label:Je.A.reannounce,clickHandler:()=>{u.A.reannounce({hashes:p.A.selectedTorrents})}},{type:"separator"},{type:"action",action:"setTaxonomy",label:Je.A.setTaxonomy,clickHandler:()=>{h.A.setActiveModal({id:"set-taxonomy"})}},{type:"action",action:"move",label:Je.A.move,clickHandler:()=>{h.A.setActiveModal({id:"move-torrents"})}},{type:"action",action:"setTrackers",label:Je.A.setTrackers,clickHandler:()=>{h.A.setActiveModal({id:"set-trackers"})}},{type:"separator"},{type:"action",action:"torrentDetails",label:Je.A.torrentDetails,clickHandler:()=>{h.A.setActiveModal({id:"torrent-details",hash:Ze()})}},{type:"action",action:"downloadContents",label:Je.A.downloadContents,clickHandler:e=>{e.preventDefault(),p.A.selectedTorrents.forEach(e=>{const t=document.createElement("a");t.download="",t.href=`${me.A.baseURI}api/torrents/${e}/contents/all/data`,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)})}},{type:"action",action:"downloadMetainfo",label:Je.A.downloadMetainfo,clickHandler:e=>{e.preventDefault();const t=document.createElement("a");t.download="",t.href=`${me.A.baseURI}api/torrents/${p.A.selectedTorrents.join(",")}/metainfo`,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}},{type:"action",action:"generateMagnet",label:Je.A.generateMagnet,clickHandler:()=>{h.A.setActiveModal({id:"generate-magnet"})}},{type:"action",action:"setInitialSeeding",label:Je.A.setInitialSeeding,clickHandler:()=>{const{selectedTorrents:e}=p.A;u.A.setInitialSeeding({hashes:e,isInitialSeeding:!p.A.torrents[Ze()].isInitialSeeding})},dismissMenu:!1,labelAction:()=>(0,_.jsx)(et,{property:"isInitialSeeding"})},{type:"action",action:"setSequential",label:Je.A.setSequential,clickHandler:()=>{const{selectedTorrents:e}=p.A;u.A.setSequential({hashes:e,isSequential:!p.A.torrents[Ze()].isSequential})},dismissMenu:!1,labelAction:()=>(0,_.jsx)(et,{property:"isSequential"})},{type:"action",action:"setPriority",label:Je.A.setPriority,clickHandler:()=>{null!=t.current&&u.A.setPriority({hashes:p.A.selectedTorrents,priority:t.current()})},dismissMenu:!1,labelAction:()=>(0,_.jsx)(Qe.A,{id:e.hash,level:e.priority,maxLevel:3,onChange:()=>{},priorityType:"torrent",showLabel:!1,changePriorityFuncRef:t,clickHandled:!0},e.hash)}]},st={eta:(0,_.jsx)(o.zD,{}),sizeBytes:(0,_.jsx)(o.Vd,{}),downRate:(0,_.jsx)(o.Cx,{}),directory:(0,_.jsx)(o.Ah,{}),hash:(0,_.jsx)(o.Vw,{}),dateActive:(0,_.jsx)(o.zD,{}),dateAdded:(0,_.jsx)(o.Vv,{}),dateCreated:(0,_.jsx)(o.xo,{}),dateFinished:(0,_.jsx)(o.T9,{}),isPrivate:(0,_.jsx)(o.LM,{}),message:(0,_.jsx)(o.qX,{}),percentComplete:(0,_.jsx)(o.Cx,{}),peers:(0,_.jsx)(o.SL,{}),ratio:(0,_.jsx)(o.wj,{}),seeds:(0,_.jsx)(o.pK,{}),trackerURIs:(0,_.jsx)(o.mB,{}),upRate:(0,_.jsx)(o.NM,{}),upTotal:(0,_.jsx)(o.NM,{})},nt=(0,i.PA)(({value:e})=>e?(0,_.jsx)(o.H4,{className:"torrent__detail__icon torrent__detail__icon--checkmark"}):null),rt=(0,i.PA)(({date:e})=>{const{i18n:t}=(0,l.uB)();return 0===e?null:(0,_.jsx)("span",{children:t.date(new Date(1e3*e))})}),at=(0,i.PA)(({eta:e})=>e?(0,_.jsx)(be.A,{value:e}):null),it=(0,i.PA)(({peersConnected:e,totalPeers:t})=>{const{i18n:s}=(0,l.uB)();return(0,_.jsx)(l.x6,{id:"torrent.list.peers",values:{connected:s.number(e),of:(0,_.jsx)("em",{className:"unit",children:(0,_.jsx)(l.x6,{id:"torrent.list.peers.of"})}),total:s.number(t)}})}),lt=(0,i.PA)(({ratio:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.jsx)("span",{children:t.number(e,{maximumFractionDigits:2})})}),ot=(0,i.PA)(({tags:e})=>(0,_.jsx)("ul",{className:"torrent__tags tag",children:e.map(e=>(0,_.jsx)("li",{className:"torrent__tag",children:e},e))})),ct=(0,i.PA)(({trackers:e})=>(0,_.jsx)("span",{children:e.join(", ")})),dt=(0,i.PA)(({torrent:e,column:t})=>{switch(t){case"dateActive":case"dateAdded":case"dateCreated":case"dateFinished":return(0,_.jsx)(rt,{date:e[t]});case"downRate":case"upRate":return(0,_.jsx)(L.A,{value:e[t],isSpeed:!0});case"downTotal":case"upTotal":case"sizeBytes":return(0,_.jsx)(L.A,{value:e[t]});case"ratio":return(0,_.jsx)(lt,{ratio:e[t]});case"isPrivate":return(0,_.jsx)(nt,{value:e[t]});case"tags":return(0,_.jsx)(ot,{tags:e[t]});case"trackerURIs":return(0,_.jsx)(ct,{trackers:e[t]});case"eta":return(0,_.jsx)(at,{eta:e[t]});case"seeds":return(0,_.jsx)(it,{peersConnected:e.seedsConnected,totalPeers:e.seedsTotal});case"peers":return(0,_.jsx)(it,{peersConnected:e.peersConnected,totalPeers:e.peersTotal});case"percentComplete":return(0,_.jsx)(E.A,{percent:(0,Pe.EW)(()=>Math.ceil(e.percentComplete)).get(),status:(0,Pe.EW)(()=>(0,Ye.s)(e.status)).get()});default:return(0,_.jsx)("span",{children:e[t]})}}),ut=(0,i.PA)(({hash:e,content:t=dt,column:s,className:n,classNameOverride:r=!1,width:i,showIcon:l=!1})=>{const c=l?st[s]:null;return(0,_.jsxs)("div",{className:r?n:a()("torrent__detail",`torrent__detail--${s}`,n,(0,y.AH)({pointerEvents:"none",userSelect:"none"})),role:"cell",style:{width:`${i}px`},children:[c,t?(0,_.jsx)(t,{torrent:p.A.torrents[e],column:s}):(0,_.jsx)(o.Eh,{})]})}),pt=(0,i.PA)((0,n.forwardRef)(({className:e,style:t,hash:s,handleClick:n,handleDoubleClick:r,handleRightClick:a,handleTouchStart:i,handleTouchEnd:l,handleKeyPress:o,...c},u)=>{const p=d.A.floodSettings.torrentListColumns.reduce((e,{id:t,visible:n})=>null==k.A[t]?e:n?(e.push((0,_.jsx)(ut,{className:"table__cell",hash:s,column:t,width:d.A.floodSettings.torrentListColumnWidths[t]},t)),e):e,[]);return(0,_.jsx)("div",{className:e,role:"row",style:t,tabIndex:0,onClick:e=>n(s,e),onContextMenu:e=>a(s,e),onDoubleClick:()=>r(s),onTouchStart:i,onTouchEnd:l,onKeyPress:o,ref:u,...c,children:p})})),ht=(0,i.PA)(({torrent:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.jsxs)("span",{children:[t.number(e.percentComplete,{maximumFractionDigits:1}),(0,_.jsx)("em",{className:"unit",children:"%"})," — ",(0,_.jsx)(L.A,{value:e.downTotal})]})}),mt=(0,i.PA)((0,n.forwardRef)(({className:e,style:t,hash:s,handleClick:n,handleDoubleClick:r,handleRightClick:a,handleTouchStart:i,handleTouchEnd:l,handleKeyPress:o,...c},u)=>{const p=d.A.floodSettings.torrentListColumns,h=[(0,_.jsx)(ut,{hash:s,column:"name",className:"torrent__details__section torrent__details__section--primary"},"name")],m=[(0,_.jsx)(ut,{hash:s,column:"eta",showIcon:!0},"eta"),(0,_.jsx)(ut,{hash:s,column:"downRate",showIcon:!0},"downRate"),(0,_.jsx)(ut,{hash:s,column:"upRate",showIcon:!0},"upRate")],x=[(0,_.jsx)(ut,{hash:s,column:"percentComplete",content:ht,showIcon:!0},"percentComplete")],j=[(0,_.jsx)(ut,{hash:s,column:"percentComplete",className:"torrent__details__section torrent__details__section--quaternary",classNameOverride:!0},"percentBar")];for(let e=0;e<p.length;e+=1){const{id:t,visible:n}=p[e];if(null!=k.A[t]&&n)switch(t){case"name":case"downRate":case"upRate":case"eta":case"downTotal":case"percentComplete":break;default:x.push((0,_.jsx)(ut,{hash:s,column:t,showIcon:!0},t))}}return(0,_.jsxs)("div",{className:e,role:"row",style:t,tabIndex:0,onClick:e=>n(s,e),onContextMenu:e=>a(s,e),onDoubleClick:()=>r(s),onTouchStart:i,onTouchEnd:l,onKeyPress:o,ref:u,...c,children:[(0,_.jsxs)("div",{className:(0,y.AH)({alignItems:"center",display:"flex"}),children:[h,(0,_.jsx)("div",{className:"torrent__details__section torrent__details__section--secondary",children:m})]}),(0,_.jsx)("div",{className:"torrent__details__section torrent__details__section--tertiary",children:x}),j]})})),_t=(e,t)=>{!0===t.cancelable&&t.preventDefault();const s=t.clientX,n=t.clientY,r=t.touches?.[0].clientX,a=t.touches?.[0].clientY;p.A.selectedTorrents.includes(e)||p.A.setSelectedTorrents({hash:e,event:t});const{torrentContextMenuActions:i=Be.A.torrentContextMenuActions}=d.A.floodSettings,l=p.A.torrents[e];h.A.setActiveContextMenu({id:"torrent-list-item",clickPosition:{x:s||r||0,y:n||a||0},items:tt(l).filter(e=>"separator"===e.type||i.some(t=>t.id===e.action&&!0===t.visible))})},xt=e=>h.A.setActiveModal({id:"torrent-details",hash:e}),jt=(e,t)=>p.A.setSelectedTorrents({hash:e,event:t}),gt=(e,t)=>{" "!==t.key&&"Enter"!==t.key&&"ContextMenu"!==t.key||(t.preventDefault(),p.A.selectedTorrents.includes(e)?"Enter"===t.key?xt(e):"ContextMenu"===t.key&&_t(e,t):jt(e,t))},At=(0,i.PA)(({hash:e,style:t})=>{const[s,r]=(0,n.useState)(0),i=(0,n.useRef)(!1),l=(0,n.useRef)(null),o="condensed"===d.A.floodSettings.torrentListViewSize,c=(0,Pe.EW)(()=>p.A.selectedTorrents.includes(e)).get(),{status:u,upRate:h,downRate:m}=p.A.torrents?.[e]||{},x=(0,Ye.$)({status:u,upRate:h,downRate:m},a()({"torrent--is-selected":c,"torrent--is-condensed":o,"torrent--is-expanded":!o}),"torrent"),{onTouchStart:j,onTouchEnd:g}=(0,Xe.A)(t=>{const n=l.current?.getBoundingClientRect().top;null!=t&&null!=n&&Math.abs(n-s)<25&&_t(e,t)}),A=t=>{p.A.selectedTorrents.includes(e)||jt(e,t),i.current?xt(e):(i.current=!0,setTimeout(()=>{i.current=!1},200)),r(l.current?.getBoundingClientRect().top||0),j(t)},b=p.A.torrents?.[e],f=`torrent-${e}`,v=u?.join("-")||"unknown";return o?(0,_.jsx)(pt,{className:x,ref:l,style:t,hash:e,handleClick:jt,handleDoubleClick:xt,handleRightClick:_t,handleTouchStart:A,handleTouchEnd:g,handleKeyPress:t=>gt(e,t),"data-testid":f,"data-torrent-status":v,"data-torrent-name":b?.name,"data-is-selected":c,"data-view-size":"condensed"}):(0,_.jsx)(mt,{className:x,ref:l,style:t,hash:e,handleClick:jt,handleDoubleClick:xt,handleRightClick:_t,handleTouchStart:A,handleTouchEnd:g,handleKeyPress:t=>gt(e,t),"data-testid":f,"data-torrent-status":v,"data-torrent-name":b?.name,"data-is-selected":c,"data-view-size":"expanded"})}),bt=(0,i.PA)(({index:e,style:t})=>(0,_.jsx)(At,{hash:p.A.filteredTorrents[e].hash,style:t})),ft=(0,i.PA)(()=>{const e=(0,n.useRef)(null),t=(0,n.useRef)(null),s=(0,n.useRef)(null);(0,n.useEffect)(()=>(0,Pe.mJ)(()=>q.A.filterTrigger,()=>{null!=t.current&&t.current.scrollTo(0)}),[]),(0,He.A)("keydown",e=>{const{ctrlKey:t,key:s,metaKey:n,repeat:r,target:a}=e,i=a?.tagName?.toUpperCase();"INPUT"!==i&&"TEXTAREA"!==i&&(r||((n||t)&&"a"===s&&(e.preventDefault(),p.A.selectAllTorrents()),(n||t)&&"v"===s&&(async()=>{const t=await(navigator?.clipboard?.readText()),s=t?.startsWith("magnet:?"),n=t?.startsWith("http")&&t?.endsWith(".torrent");(s||n)&&(e.preventDefault(),h.A.setActiveModal({id:"add-torrents",tab:"by-url",urls:[{id:0,value:t}]}))})()))});const r=p.A.filteredTorrents,{torrentListViewSize:a="condensed"}=d.A.floodSettings,i="condensed"===a,u=null==r||0===r.length;let m=null,x=null;return ge.A.isConnected?u||null==r?m=(0,_.jsxs)("div",{className:"torrents__alert__wrapper",children:[(0,_.jsx)("div",{className:"torrents__alert",children:(0,_.jsx)(l.x6,{id:"torrents.list.no.torrents"})}),q.A.isFilterActive?(0,_.jsx)("div",{className:"torrents__alert__action",children:(0,_.jsx)(De.$n,{onClick:()=>{q.A.clearAllFilters()},priority:"tertiary",children:(0,_.jsx)(l.x6,{id:"torrents.list.clear.filters"})})}):null]}):(i&&(x=(0,_.jsx)(Ue,{onCellFocus:()=>{null!=s.current&&null!=e.current&&(s.current.scrollLeft=e.current.scrollLeft)},onCellClick:e=>{const t=d.A.floodSettings.sortTorrents;let s=j[e]??"asc";t.property===e&&(s="asc"===t.direction?"desc":"asc");const n={property:e,direction:s};c.A.saveSetting("sortTorrents",n)},onWidthsChange:(e,t)=>{const{torrentListColumnWidths:s=Be.A.torrentListColumnWidths}=d.A.floodSettings;c.A.saveSetting("torrentListColumnWidths",{...s,[e]:t})},ref:e})),m=(0,_.jsx)(Oe,{className:"torrent__list__viewport",itemCount:r.length,itemKey:e=>p.A.filteredTorrents[e].hash,itemRenderer:bt,itemSize:i?30:70,ref:t,outerRef:t=>{const n=t;null!=n&&null==n.onscroll&&(n.onscroll=()=>{null!=e.current&&(e.current.scrollLeft=n.scrollLeft)}),s.current=n}})):m=(0,_.jsx)("div",{className:"torrents__alert__wrapper",children:(0,_.jsx)("div",{className:"torrents__alert",children:(0,_.jsx)(l.x6,{id:"torrents.list.cannot.connect"})})}),(0,_.jsxs)(Ve,{children:[(0,_.jsxs)("div",{className:"torrent__list__wrapper",role:"table",children:[(0,_.jsx)(Le,{id:"torrent-list-item"}),x,m]}),(0,_.jsx)("div",{className:"dropzone__overlay",children:(0,_.jsxs)("div",{className:"dropzone__copy",children:[(0,_.jsx)("div",{className:"dropzone__icon",children:(0,_.jsx)(o.sv,{})}),(0,_.jsx)(l.x6,{id:"torrents.list.drop"})]})})]})});var vt=s(894);if("string"==typeof vt.A&&"undefined"!=typeof document){const e=document.createElement("style");e.textContent=`@layer third-party { ${vt.A} }`,e.setAttribute("data-layer","third-party"),document.head.appendChild(e)}const yt=(0,n.lazy)(()=>s.e(703).then(s.bind(s,6182))),wt=(0,n.lazy)(()=>Promise.all([s.e(525),s.e(179)]).then(s.bind(s,179))),Nt=()=>((0,n.useEffect)(()=>{P.A.startActivityStream()},[]),(0,_.jsxs)(M.A,{children:[(0,_.jsx)(Me,{}),(0,_.jsxs)($,{children:[(0,_.jsxs)(R,{modifier:"torrent-list",className:"view--torrent-list",children:[(0,_.jsx)(T,{}),(0,_.jsx)(ft,{})]}),(0,_.jsx)(wt,{}),(0,_.jsx)(yt,{})]})]}))},2428:(e,t,s)=>{s.r(t),s.d(t,{default:()=>i});var n=s(6975),r=s(7820),a=s(4848);const i=()=>(0,a.jsx)(n.A,{modifier:"auth-form",children:(0,a.jsx)(r.A,{mode:"login"})})},2471:(e,t,s)=>{s.d(t,{$:()=>a,s:()=>i});var n=s(6942),r=s.n(n);const a=({status:e,downRate:t,upRate:s},...n)=>r()(n,{"torrent--has-error":e.includes("error"),"torrent--is-stopped":e.includes("stopped"),"torrent--is-downloading":e.includes("downloading"),"torrent--is-downloading--actively":t>0,"torrent--is-uploading--actively":s>0,"torrent--is-seeding":e.includes("seeding"),"torrent--is-completed":e.includes("complete"),"torrent--is-checking":e.includes("checking"),"torrent--is-inactive":e.includes("inactive")}),i=e=>{let t="stopped";return["error","checking","stopped","downloading","seeding"].some(s=>!!e.includes(s)&&(t=s,!0)),t}},2607:(e,t,s)=>{s.d(t,{A:()=>n});const n={dateAdded:"torrents.properties.date.added",dateFinished:"torrents.properties.date.finished",downRate:"torrents.properties.download.speed",downTotal:"torrents.properties.download.total",eta:"torrents.properties.eta",name:"torrents.properties.name",peers:"torrents.properties.peers",percentComplete:"torrents.properties.percentage",ratio:"torrents.properties.ratio",seeds:"torrents.properties.seeds",sizeBytes:"torrents.properties.size",tags:"torrents.properties.tags",upRate:"torrents.properties.upload.speed",upTotal:"torrents.properties.upload.total",dateCreated:"torrents.properties.date.created",directory:"torrents.properties.directory",hash:"torrents.properties.hash",isPrivate:"torrents.properties.is.private",message:"torrents.properties.tracker.message",trackerURIs:"torrents.properties.trackers",dateActive:"torrents.properties.date.active"}},3230:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(9161),r=s(4848);const a=({suffix:e,value:t})=>{if(null==t)return null;let s=null,a=null;e&&(a=(0,r.jsx)("span",{className:"duration--segment",children:e}));const i=-1===t?-1:(e=>{const t=Math.floor(e/31536e3),s=Math.floor(e%31536e3/604800),n=Math.floor(e%31536e3%604800/86400),r=Math.floor(e%31536e3%604800%86400/3600),a=Math.floor(e%31536e3%604800%86400%3600/60),i=Math.floor(e-60*a);let l=null;return l=t>0?{years:t,weeks:s,cumSeconds:e}:s>0?{weeks:s,days:n,cumSeconds:e}:n>0?{days:n,hours:r,cumSeconds:e}:r>0?{hours:r,minutes:a,cumSeconds:e}:a>0?{minutes:a,seconds:i,cumSeconds:e}:{seconds:i,cumSeconds:e},l})(t);return s=-1===i?(0,r.jsx)(n.x6,{id:"unit.time.infinity"}):null!=i.years&&i.years>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.years,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.year"})})]},"years"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.weeks,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.week"})})]},"weeks")]:null!=i.weeks&&i.weeks>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.weeks,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.week"})})]},"weeks"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.days,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.day"})})]},"days")]:null!=i.days&&i.days>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.days,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.day"})})]},"days"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.hours,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.hour"})})]},"hours")]:null!=i.hours&&i.hours>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.hours,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.hour"})})]},"hours"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.minutes,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.minute"})})]},"minutes")]:null!=i.minutes&&i.minutes>0?[(0,r.jsxs)("span",{className:"duration--segment",children:[i.minutes,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.minute"})})]},"minutes"),(0,r.jsxs)("span",{className:"duration--segment",children:[i.seconds,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.second"})})]},"seconds")]:(0,r.jsxs)("span",{className:"duration--segment",children:[i.seconds,(0,r.jsx)("em",{className:"unit",children:(0,r.jsx)(n.x6,{id:"unit.time.second"})})]}),(0,r.jsxs)("span",{className:"duration",children:[s,a]})}},3537:(e,t,s)=>{s.d(t,{A:()=>h});var n=s(1083),r=s(5419),a=s.n(r),i=s(7550),l=s(9550),o=s(4930);const{baseURI:c}=l.A,d=e=>{i.A.add({id:"alert.torrent.add.sent",count:e})},u=e=>{i.A.add({id:"alert.torrent.add",type:"success",count:e})},p=e=>{i.A.add({id:"alert.torrent.add.failed",type:"error",count:e})},h={addTorrentsByUrls:e=>n.A.post(`${c}api/torrents/add-urls`,e).then(({data:t})=>{t.length?u(t.length):d(e.urls.length)},()=>{p(e.urls.length)}),addTorrentsByFiles:e=>n.A.post(`${c}api/torrents/add-files`,e).then(({data:t})=>{t.length?u(t.length):d(e.files.length)},()=>{p(e.files.length)}),createTorrent:e=>n.A.post(`${c}api/torrents/create`,e,{responseType:"blob"}).then(({data:t})=>{a()(t,(e.name||`${Date.now()}`).concat(".torrent")),u(1)},()=>{p(1)}),deleteTorrents:e=>n.A.post(`${c}api/torrents/delete`,e).then(()=>i.A.add({id:"alert.torrent.remove",type:"success",count:e.hashes.length}),()=>i.A.add({id:"alert.torrent.remove.failed",type:"error",count:e.hashes.length})),checkHash:e=>n.A.post(`${c}api/torrents/check-hash`,e).then(()=>{},()=>{}),fetchMediainfo:(e,t)=>n.A.get(`${c}api/torrents/${e}/mediainfo`,{cancelToken:t}).then(e=>e.data),fetchTorrentContents:e=>n.A.get(`${c}api/torrents/${e}/contents`).then(e=>e.data,()=>null),fetchTorrentPeers:e=>n.A.get(`${c}api/torrents/${e}/peers`).then(e=>e.data,()=>null),fetchTorrentTrackers:e=>n.A.get(`${c}api/torrents/${e}/trackers`).then(e=>e.data,()=>null),getTorrentContentsDataPermalink:(e,t)=>n.A.get(`${l.A.baseURI}api/torrents/${e}/contents/${t.join(",")}/token`).then(s=>`${window.location.protocol}//${window.location.host}${l.A.baseURI}api/torrents/${e}/contents/${t.join(",")}/data?token=${s.data}`),moveTorrents:e=>n.A.post(`${c}api/torrents/move`,e).then(()=>i.A.add({id:"alert.torrent.move",type:"success",count:e.hashes.length}),()=>i.A.add({id:"alert.torrent.move.failed",type:"error",count:e.hashes.length})),reannounce:e=>n.A.post(`${c}api/torrents/reannounce`,e).then(()=>{},()=>{}),startTorrents:async e=>{if(e.hashes.length>0)return n.A.post(`${c}api/torrents/start`,e).then(()=>{},()=>{})},stopTorrents:async e=>{if(e.hashes.length>0)return n.A.post(`${c}api/torrents/stop`,e).then(()=>{},()=>{})},setInitialSeeding:e=>n.A.patch(`${c}api/torrents/initial-seeding`,e).then(()=>{},()=>{}),setPriority:e=>n.A.patch(`${c}api/torrents/priority`,e).then(()=>{},()=>{}),setSequential:e=>n.A.patch(`${c}api/torrents/sequential`,e).then(()=>{},()=>{}),setFilePriority:(e,t)=>n.A.patch(`${c}api/torrents/${e}/contents`,t).then(()=>{},()=>{}),setTags:e=>n.A.patch(`${c}api/torrents/tags`,e).then(()=>o.A.handleSetTaxonomySuccess(),()=>{}),setTrackers:e=>n.A.patch(`${c}api/torrents/trackers`,e).then(()=>{},()=>{})}},5440:(e,t,s)=>{s.r(t),s.d(t,{default:()=>i});var n=s(7820),r=s(6975),a=s(4848);const i=()=>(0,a.jsx)(r.A,{modifier:"auth-form",children:(0,a.jsx)(n.A,{mode:"register"})})},6541:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(4848);const r=({children:e})=>(0,n.jsx)("div",{className:"badge",children:e})},6975:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(6942),r=s.n(n),a=s(4848);const i=({children:e,modifier:t})=>{const s=r()("application__view",{[`application__view--${t}`]:null!=t});return(0,a.jsx)("div",{className:s,children:e})}},7189:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(9161),r=s(7458),a=s(4848);const i=({value:e,isSpeed:t=!1,className:s,precision:i=2})=>{const l=(0,r.O)(e,i),{i18n:o}=(0,n.uB)();let c=o._((0,r.b)(l.unit));return t&&(c=o._("unit.speed",{baseUnit:c})),(0,a.jsxs)("span",{className:s,children:[Number.isNaN(l.value)?"—":o.number(l.value),(0,a.jsx)("em",{className:"unit",children:c})]})}},7820:(e,t,s)=>{s.d(t,{A:()=>u});var n=s(6540),r=s(9161),a=s(7767),i=s(6565),l=s(5767),o=s(9119),c=s(8045),d=s(4848);const u=({mode:e})=>{const{i18n:t}=(0,r.uB)(),s=(0,n.useRef)(null),u=(0,n.useRef)(null),[p,h]=(0,n.useState)(void 0),[m,_]=(0,n.useState)(!1),x=(0,a.Zp)(),j="login"===e;return(0,d.jsx)("div",{className:"application__entry-barrier",children:(0,d.jsx)(i.Zk,{spacing:"large",children:(0,d.jsxs)(i.lV,{onSubmit:e=>{e.event.preventDefault(),_(!0);const t=e.formData;if(null==t.username||""===t.username)return _(!1),void h({id:"auth.error.username.empty"});if(null==t.password||""===t.password)return _(!1),void h({id:"auth.error.password.empty"});if(j){const e=t;l.A.authenticate({username:e.username,password:e.password}).then(()=>{_(!1),x("/overview",{replace:!0})}).catch(e=>{_(!1),h(e.message),x("/login",{replace:!0})})}else{const e=t;if(null==u.current)return _(!1),void h({id:"connection.settings.error.empty"});const s=u.current;if(null==s)return _(!1),void h({id:"connection.settings.error.empty"});l.A.register({username:e.username,password:e.password,client:s,level:o.h.ADMINISTRATOR}).then(()=>{_(!1),x("/overview",{replace:!0})},e=>{_(!1),h(e.message)})}},ref:s,children:[(0,d.jsx)(i.aO,{children:(0,d.jsx)("h1",{children:j?t._("auth.login"):t._("auth.create.an.account")})}),(0,d.jsxs)(i.wq,{children:[(0,d.jsx)("p",{className:"copy--lead",children:j?t._("auth.login.intro"):t._("auth.create.an.account.intro")}),null!=p?(0,d.jsx)(i.fh,{children:(0,d.jsx)(i.jQ,{isLoading:m,children:"string"==typeof p?p:t._(p)})}):null,(0,d.jsx)(i.fh,{children:(0,d.jsx)(i.Rj,{placeholder:t._("auth.username"),id:"username",autoComplete:"username"})}),(0,d.jsx)(i.fh,{children:(0,d.jsx)(i.Rj,{placeholder:t._("auth.password"),id:"password",type:"password",autoComplete:j?"current-password":"new-password"})})]}),j?null:(0,d.jsx)(i.wq,{hasBorder:!0,children:(0,d.jsx)(c.A,{onSettingsChange:e=>{u.current=e}})}),(0,d.jsx)(i.WH,{hasBorder:!0,children:(0,d.jsxs)(i.fh,{justify:"end",children:[(0,d.jsx)(i.$n,{priority:"tertiary",onClick:()=>{null!=s.current&&s.current.resetForm()},children:t._("auth.input.clear")}),(0,d.jsx)(i.$n,{isLoading:m,type:"submit",children:j?t._("auth.log.in"):t._("auth.create.account")})]})})]})})})}},9689:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(6540),r=s(9161),a=s(8344);const i={file:{0:"DONT_DOWNLOAD",1:"NORMAL",2:"HIGH"},torrent:{0:"DONT_DOWNLOAD",1:"LOW",2:"NORMAL",3:"HIGH"}};var l=s(4848);const o=({id:e,level:t,maxLevel:s,priorityType:o,showLabel:c=!1,clickHandled:d=!1,changePriorityFuncRef:u,onChange:p})=>{const{i18n:h}=(0,r.uB)(),[m,_]=(0,n.useState)(t),x=()=>{let t=m;return t>=s?t=0:t+=1,_(t),p(e,t),t};let j;if(null!=u&&(u.current=x),c){let e;switch(i[o][m]){case"DONT_DOWNLOAD":e=h._("priority.dont.download");break;case"HIGH":e=h._("priority.high");break;case"LOW":e=h._("priority.low");break;default:e=h._("priority.normal")}j=(0,l.jsx)("span",{className:"priority-meter__label",children:e})}const g=(0,l.jsx)("div",{className:`priority-meter priority-meter--max-${s} priority-meter--level-${m}`}),A=(0,a.AH)({_focus:{outline:"none",WebkitTapHighlightColor:"transparent"},_focusVisible:{outline:"dashed"}});return d?(0,l.jsxs)("div",{className:`priority-meter__wrapper ${A}`,children:[g,j]}):(0,l.jsxs)("button",{className:`priority-meter__wrapper ${A}`,type:"button",onClick:()=>{x()},children:[g,j]})}}}]);
|