diff --git a/crates/librqbit/webui/dist/assets/index.js b/crates/librqbit/webui/dist/assets/index.js index 9193c20..e47b576 100644 --- a/crates/librqbit/webui/dist/assets/index.js +++ b/crates/librqbit/webui/dist/assets/index.js @@ -37,4 +37,4 @@ `+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{Zl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Mn(e):""}function Wf(e){switch(e.tag){case 5:return Mn(e.type);case 16:return Mn("Lazy");case 13:return Mn("Suspense");case 19:return Mn("SuspenseList");case 0:case 2:case 15:return e=Gl(e.type,!1),e;case 11:return e=Gl(e.type.render,!1),e;case 1:return e=Gl(e.type,!0),e;default:return""}}function To(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Xt:return"Fragment";case Yt:return"Portal";case _o:return"Profiler";case Ni:return"StrictMode";case jo:return"Suspense";case No:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oa:return(e.displayName||"Context")+".Consumer";case la:return(e._context.displayName||"Context")+".Provider";case Ti:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pi:return t=e.displayName||null,t!==null?t:To(e.type)||"Memo";case it:t=e._payload,e=e._init;try{return To(e(t))}catch{}}return null}function Qf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return To(t);case 8:return t===Ni?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function St(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ua(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kf(e){var t=ua(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){e._valueTracker||(e._valueTracker=Kf(e))}function sa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ua(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Gr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Po(e,t){var n=t.checked;return W({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Nu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=St(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function aa(e,t){t=t.checked,t!=null&&ji(e,"checked",t,!1)}function Lo(e,t){aa(e,t);var n=St(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?zo(e,t.type,n):t.hasOwnProperty("defaultValue")&&zo(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Tu(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function zo(e,t,n){(t!=="number"||Gr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var On=Array.isArray;function sn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=xr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Kn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Rn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Zf=["Webkit","ms","Moz","O"];Object.keys(Rn).forEach(function(e){Zf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rn[t]=Rn[e]})});function pa(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Rn.hasOwnProperty(e)&&Rn[e]?(""+t).trim():t+"px"}function ma(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=pa(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Gf=W({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fo(e,t){if(t){if(Gf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(k(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(k(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(k(61))}if(t.style!=null&&typeof t.style!="object")throw Error(k(62))}}function Io(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ro=null;function Li(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Do=null,an=null,cn=null;function zu(e){if(e=fr(e)){if(typeof Do!="function")throw Error(k(280));var t=e.stateNode;t&&(t=_l(t),Do(e.stateNode,e.type,t))}}function ha(e){an?cn?cn.push(e):cn=[e]:an=e}function va(){if(an){var e=an,t=cn;if(cn=an=null,zu(e),t)for(e=0;e>>=0,e===0?32:31-(od(e)/id|0)|0}var kr=64,Sr=4194304;function Fn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function qr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=Fn(u):(o&=i,o!==0&&(r=Fn(o)))}else i=n&~l,i!==0?r=Fn(i):o!==0&&(r=Fn(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Fe(t),e[t]=n}function cd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=$n),Au=String.fromCharCode(32),Bu=!1;function Ra(e,t){switch(e){case"keyup":return $d.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Da(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jt=!1;function Ad(e,t){switch(e){case"compositionend":return Da(t);case"keypress":return t.which!==32?null:(Bu=!0,Au);case"textInput":return e=t.data,e===Au&&Bu?null:e;default:return null}}function Bd(e,t){if(Jt)return e==="compositionend"||!$i&&Ra(e,t)?(e=Fa(),$r=Ii=ct=null,Jt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Qu(n)}}function Ba(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ba(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Va(){for(var e=window,t=Gr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Gr(e.document)}return t}function Ui(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Xd(e){var t=Va(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ba(n.ownerDocument.documentElement,n)){if(r!==null&&Ui(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=Ku(n,o);var i=Ku(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,qt=null,Ho=null,An=null,Wo=!1;function Zu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wo||qt==null||qt!==Gr(r)||(r=qt,"selectionStart"in r&&Ui(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),An&&qn(An,r)||(An=r,r=tl(Ho,"onSelect"),0tn||(e.current=Xo[tn],Xo[tn]=null,tn--)}function D(e,t){tn++,Xo[tn]=e.current,e.current=t}var Et={},ie=_t(Et),me=_t(!1),Ut=Et;function hn(e,t){var n=e.type.contextTypes;if(!n)return Et;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function he(e){return e=e.childContextTypes,e!=null}function rl(){A(me),A(ie)}function es(e,t,n){if(ie.current!==Et)throw Error(k(168));D(ie,t),D(me,n)}function Ja(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(k(108,Qf(e)||"Unknown",l));return W({},n,r)}function ll(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Et,Ut=ie.current,D(ie,e),D(me,me.current),!0}function ts(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=Ja(e,t,Ut),r.__reactInternalMemoizedMergedChildContext=e,A(me),A(ie),D(ie,e)):A(me),D(me,n)}var Ye=null,jl=!1,so=!1;function qa(e){Ye===null?Ye=[e]:Ye.push(e)}function s0(e){jl=!0,qa(e)}function jt(){if(!so&&Ye!==null){so=!0;var e=0,t=I;try{var n=Ye;for(I=1;e>=i,l-=i,Xe=1<<32-Fe(t)+l|n<j?(R=C,C=null):R=C.sibling;var M=m(d,C,p[j],x);if(M===null){C===null&&(C=R);break}e&&C&&M.alternate===null&&t(d,C),f=o(M,f,j),E===null?N=M:E.sibling=M,E=M,C=R}if(j===p.length)return n(d,C),B&&zt(d,j),N;if(C===null){for(;jj?(R=C,C=null):R=C.sibling;var ge=m(d,C,M.value,x);if(ge===null){C===null&&(C=R);break}e&&C&&ge.alternate===null&&t(d,C),f=o(ge,f,j),E===null?N=ge:E.sibling=ge,E=ge,C=R}if(M.done)return n(d,C),B&&zt(d,j),N;if(C===null){for(;!M.done;j++,M=p.next())M=h(d,M.value,x),M!==null&&(f=o(M,f,j),E===null?N=M:E.sibling=M,E=M);return B&&zt(d,j),N}for(C=r(d,C);!M.done;j++,M=p.next())M=w(C,d,j,M.value,x),M!==null&&(e&&M.alternate!==null&&C.delete(M.key===null?j:M.key),f=o(M,f,j),E===null?N=M:E.sibling=M,E=M);return e&&C.forEach(function(Tt){return t(d,Tt)}),B&&zt(d,j),N}function L(d,f,p,x){if(typeof p=="object"&&p!==null&&p.type===Xt&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case yr:e:{for(var N=p.key,E=f;E!==null;){if(E.key===N){if(N=p.type,N===Xt){if(E.tag===7){n(d,E.sibling),f=l(E,p.props.children),f.return=d,d=f;break e}}else if(E.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===it&&ss(N)===E.type){n(d,E.sibling),f=l(E,p.props),f.ref=Pn(d,E,p),f.return=d,d=f;break e}n(d,E);break}else t(d,E);E=E.sibling}p.type===Xt?(f=$t(p.props.children,d.mode,x,p.key),f.return=d,d=f):(x=Kr(p.type,p.key,p.props,null,d.mode,x),x.ref=Pn(d,f,p),x.return=d,d=x)}return i(d);case Yt:e:{for(E=p.key;f!==null;){if(f.key===E)if(f.tag===4&&f.stateNode.containerInfo===p.containerInfo&&f.stateNode.implementation===p.implementation){n(d,f.sibling),f=l(f,p.children||[]),f.return=d,d=f;break e}else{n(d,f);break}else t(d,f);f=f.sibling}f=go(p,d.mode,x),f.return=d,d=f}return i(d);case it:return E=p._init,L(d,f,E(p._payload),x)}if(On(p))return g(d,f,p,x);if(Cn(p))return S(d,f,p,x);Pr(d,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,f!==null&&f.tag===6?(n(d,f.sibling),f=l(f,p),f.return=d,d=f):(n(d,f),f=vo(p,d.mode,x),f.return=d,d=f),i(d)):n(d,f)}return L}var gn=ic(!0),uc=ic(!1),dr={},We=_t(dr),nr=_t(dr),rr=_t(dr);function Rt(e){if(e===dr)throw Error(k(174));return e}function Gi(e,t){switch(D(rr,t),D(nr,e),D(We,dr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Oo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Oo(t,e)}A(We),D(We,t)}function yn(){A(We),A(nr),A(rr)}function sc(e){Rt(rr.current);var t=Rt(We.current),n=Oo(t,e.type);t!==n&&(D(nr,e),D(We,n))}function Yi(e){nr.current===e&&(A(We),A(nr))}var V=_t(0);function cl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=[];function Xi(){for(var e=0;en?n:4,e(!0);var r=co.transition;co.transition={};try{e(!1),t()}finally{I=n,co.transition=r}}function Cc(){return Pe().memoizedState}function d0(e,t,n){var r=wt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_c(e))jc(t,n);else if(n=nc(e,t,n,r),n!==null){var l=se();Ie(n,e,r,l),Nc(n,t,r)}}function p0(e,t,n){var r=wt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_c(e))jc(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,Re(u,i)){var s=t.interleaved;s===null?(l.next=l,Ki(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=nc(e,t,l,r),n!==null&&(l=se(),Ie(n,e,r,l),Nc(n,t,r))}}function _c(e){var t=e.alternate;return e===H||t!==null&&t===H}function jc(e,t){Bn=fl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Nc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Mi(e,n)}}var dl={readContext:Te,useCallback:re,useContext:re,useEffect:re,useImperativeHandle:re,useInsertionEffect:re,useLayoutEffect:re,useMemo:re,useReducer:re,useRef:re,useState:re,useDebugValue:re,useDeferredValue:re,useTransition:re,useMutableSource:re,useSyncExternalStore:re,useId:re,unstable_isNewReconciler:!1},m0={readContext:Te,useCallback:function(e,t){return Ae().memoizedState=[e,t===void 0?null:t],e},useContext:Te,useEffect:cs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Vr(4194308,4,wc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vr(4,2,e,t)},useMemo:function(e,t){var n=Ae();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ae();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=d0.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Ae();return e={current:e},t.memoizedState=e},useState:as,useDebugValue:tu,useDeferredValue:function(e){return Ae().memoizedState=e},useTransition:function(){var e=as(!1),t=e[0];return e=f0.bind(null,e[1]),Ae().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Ae();if(B){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),b===null)throw Error(k(349));Bt&30||fc(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,cs(pc.bind(null,r,o,e),[e]),r.flags|=2048,ir(9,dc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ae(),t=b.identifierPrefix;if(B){var n=Je,r=Xe;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=lr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Be]=t,e[tr]=r,Rc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Io(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lxn&&(t.flags|=128,r=!0,Ln(o,!1),t.lanes=4194304)}else{if(!r)if(e=cl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ln(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!B)return le(t),null}else 2*G()-o.renderingStartTime>xn&&n!==1073741824&&(t.flags|=128,r=!0,Ln(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=G(),t.sibling=null,n=V.current,D(V,r?n&1|2:n&1),t):(le(t),null);case 22:case 23:return uu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ye&1073741824&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function S0(e,t){switch(Bi(t),t.tag){case 1:return he(t.type)&&rl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),A(me),A(ie),Xi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yi(t),null;case 13:if(A(V),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return A(V),null;case 4:return yn(),null;case 10:return Qi(t.type._context),null;case 22:case 23:return uu(),null;case 24:return null;default:return null}}var zr=!1,oe=!1,E0=typeof WeakSet=="function"?WeakSet:Set,T=null;function on(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Q(e,t,r)}else n.current=null}function si(e,t,n){try{n()}catch(r){Q(e,t,r)}}var ws=!1;function C0(e,t){if(Qo=br,e=Va(),Ui(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,v=0,h=e,m=null;t:for(;;){for(var w;h!==n||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(w=h.firstChild)!==null;)m=h,h=w;for(;;){if(h===e)break t;if(m===n&&++a===l&&(u=i),m===o&&++v===r&&(s=i),(w=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=w}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ko={focusedElem:e,selectionRange:n},br=!1,T=t;T!==null;)if(t=T,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,T=e;else for(;T!==null;){t=T;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var S=g.memoizedProps,L=g.memoizedState,d=t.stateNode,f=d.getSnapshotBeforeUpdate(t.elementType===t.type?S:ze(t.type,S),L);d.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(x){Q(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,T=e;break}T=t.return}return g=ws,ws=!1,g}function Vn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&si(t,n,o)}l=l.next}while(l!==r)}}function Pl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ai(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Uc(e){var t=e.alternate;t!==null&&(e.alternate=null,Uc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[tr],delete t[Yo],delete t[i0],delete t[u0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ac(e){return e.tag===5||e.tag===3||e.tag===4}function xs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ac(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ci(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=nl));else if(r!==4&&(e=e.child,e!==null))for(ci(e,t,n),e=e.sibling;e!==null;)ci(e,t,n),e=e.sibling}function fi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(fi(e,t,n),e=e.sibling;e!==null;)fi(e,t,n),e=e.sibling}var ee=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)Bc(e,t,n),n=n.sibling}function Bc(e,t,n){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(kl,n)}catch{}switch(n.tag){case 5:oe||on(n,t);case 6:var r=ee,l=Me;ee=null,ot(e,t,n),ee=r,Me=l,ee!==null&&(Me?(e=ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ee.removeChild(n.stateNode));break;case 18:ee!==null&&(Me?(e=ee,n=n.stateNode,e.nodeType===8?uo(e.parentNode,n):e.nodeType===1&&uo(e,n),Xn(e)):uo(ee,n.stateNode));break;case 4:r=ee,l=Me,ee=n.stateNode.containerInfo,Me=!0,ot(e,t,n),ee=r,Me=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&si(n,t,i),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!oe&&(on(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){Q(n,t,u)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,ot(e,t,n),oe=r):ot(e,t,n);break;default:ot(e,t,n)}}function ks(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new E0),t.forEach(function(r){var l=O0.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Le(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=G()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*j0(r/1960))-r,10e?16:e,ft===null)var r=!1;else{if(e=ft,ft=null,hl=0,F&6)throw Error(k(331));var l=F;for(F|=4,T=e.current;T!==null;){var o=T,i=o.child;if(T.flags&16){var u=o.deletions;if(u!==null){for(var s=0;sG()-ou?Dt(e,0):lu|=n),ve(e,t)}function Yc(e,t){t===0&&(e.mode&1?(t=Sr,Sr<<=1,!(Sr&130023424)&&(Sr=4194304)):t=1);var n=se();e=tt(e,t),e!==null&&(ar(e,t,n),ve(e,n))}function M0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yc(e,n)}function O0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),Yc(e,n)}var Xc;Xc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pe=!1,x0(e,t,n);pe=!!(e.flags&131072)}else pe=!1,B&&t.flags&1048576&&ba(t,il,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hr(e,t),e=t.pendingProps;var l=hn(t,ie.current);dn(t,n),l=qi(null,t,r,e,l,n);var o=bi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,he(r)?(o=!0,ll(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Zi(t),l.updater=Nl,t.stateNode=l,l._reactInternals=t,ti(t,r,e,n),t=li(null,t,r,!0,o,n)):(t.tag=0,B&&o&&Ai(t),ue(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=I0(r),e=ze(r,e),l){case 0:t=ri(null,t,r,e,n);break e;case 1:t=vs(null,t,r,e,n);break e;case 11:t=ms(null,t,r,e,n);break e;case 14:t=hs(null,t,r,ze(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ri(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),vs(e,t,r,l,n);case 3:e:{if(Oc(t),e===null)throw Error(k(387));r=t.pendingProps,o=t.memoizedState,l=o.element,rc(e,t),al(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=wn(Error(k(423)),t),t=gs(e,t,r,n,l);break e}else if(r!==l){l=wn(Error(k(424)),t),t=gs(e,t,r,n,l);break e}else for(we=vt(t.stateNode.containerInfo.firstChild),xe=t,B=!0,Oe=null,n=uc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=nt(e,t,n);break e}ue(e,t,r,n)}t=t.child}return t;case 5:return sc(t),e===null&&qo(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Zo(r,l)?i=null:o!==null&&Zo(r,o)&&(t.flags|=32),Mc(e,t),ue(e,t,i,n),t.child;case 6:return e===null&&qo(t),null;case 13:return Fc(e,t,n);case 4:return Gi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):ue(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ms(e,t,r,l,n);case 7:return ue(e,t,t.pendingProps,n),t.child;case 8:return ue(e,t,t.pendingProps.children,n),t.child;case 12:return ue(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,D(ul,r._currentValue),r._currentValue=i,o!==null)if(Re(o.value,i)){if(o.children===l.children&&!me.current){t=nt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=qe(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var v=a.pending;v===null?s.next=s:(s.next=v.next,v.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),bo(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(k(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),bo(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ue(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,dn(t,n),l=Te(l),r=r(l),t.flags|=1,ue(e,t,r,n),t.child;case 14:return r=t.type,l=ze(r,t.pendingProps),l=ze(r.type,l),hs(e,t,r,l,n);case 15:return Lc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Hr(e,t),t.tag=1,he(r)?(e=!0,ll(t)):e=!1,dn(t,n),oc(t,r,l),ti(t,r,l,n),li(null,t,r,!0,e,n);case 19:return Ic(e,t,n);case 22:return zc(e,t,n)}throw Error(k(156,t.tag))};function Jc(e,t){return Ea(e,t)}function F0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function je(e,t,n,r){return new F0(e,t,n,r)}function au(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I0(e){if(typeof e=="function")return au(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ti)return 11;if(e===Pi)return 14}return 2}function xt(e,t){var n=e.alternate;return n===null?(n=je(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kr(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")au(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Xt:return $t(n.children,l,o,t);case Ni:i=8,l|=8;break;case _o:return e=je(12,n,t,l|2),e.elementType=_o,e.lanes=o,e;case jo:return e=je(13,n,t,l),e.elementType=jo,e.lanes=o,e;case No:return e=je(19,n,t,l),e.elementType=No,e.lanes=o,e;case ia:return zl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case la:i=10;break e;case oa:i=9;break e;case Ti:i=11;break e;case Pi:i=14;break e;case it:i=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=je(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function $t(e,t,n,r){return e=je(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=je(22,e,r,t),e.elementType=ia,e.lanes=n,e.stateNode={isHidden:!1},e}function vo(e,t,n){return e=je(6,e,null,t),e.lanes=n,e}function go(e,t,n){return t=je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function R0(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xl(0),this.expirationTimes=Xl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,l,o,i,u,s){return e=new R0(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=je(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zi(o),e}function D0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(tf)}catch(e){console.error(e)}}tf(),bs.exports=Se;var nf=bs.exports;const V0=wi(nf);var Ps=nf;Eo.createRoot=Ps.createRoot,Eo.hydrateRoot=Ps.hydrateRoot;const Nt=y.createContext({listTorrents:()=>{throw new Error("Function not implemented.")},getTorrentDetails:()=>{throw new Error("Function not implemented.")},getTorrentStats:()=>{throw new Error("Function not implemented.")},uploadTorrent:()=>{throw new Error("Function not implemented.")},pause:()=>{throw new Error("Function not implemented.")},start:()=>{throw new Error("Function not implemented.")},forget:()=>{throw new Error("Function not implemented.")},delete:()=>{throw new Error("Function not implemented.")},getStreamLogsUrl:()=>null}),pr=y.createContext({setCloseableError:e=>{},refreshTorrents:()=>{}}),rf=y.createContext({refresh:()=>{}}),yl=()=>c.jsxs("div",{role:"status",children:[c.jsxs("svg",{"aria-hidden":"true",className:"inline w-8 h-8 text-gray-200 animate-spin fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),c.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),c.jsx("span",{className:"sr-only",children:"Loading..."})]}),mu="initializing",H0="paused",W0="live",Q0="error";function hu(e,t){let n,r=t;const l=async()=>{if(r=await e(),r==null)throw"asyncCallback returned null or undefined";o()};let o=()=>{n=setTimeout(l,r)};return o(),()=>{clearTimeout(n)}}function lf(e,t){let n;const r=async()=>{await e().then(()=>!1,()=>!0)&&l()};let l=o=>{n=setTimeout(r,o!==void 0?o:t)};return l(0),()=>clearTimeout(n)}var of={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ls=dt.createContext&&dt.createContext(of),kt=globalThis&&globalThis.__assign||function(){return kt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{onClick:t,disabled:n,color:r,children:l,className:o,...i}=e,u=a=>{a.stopPropagation(),!n&&t()},s=r?`text-${r}`:"";return c.jsx("a",{className:`block p-1 ${s} ${o}`,onClick:u,href:"#",...i,children:l})};function J0(e){return fe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M0 .5A.5.5 0 0 1 .5 0h4a.5.5 0 0 1 0 1h-4A.5.5 0 0 1 0 .5Zm0 2A.5.5 0 0 1 .5 2h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm9 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-9 2A.5.5 0 0 1 .5 4h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm5 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm-12 2A.5.5 0 0 1 .5 6h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm8 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-8 2A.5.5 0 0 1 .5 8h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm-7 2a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1h-8a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5Z"}}]})(e)}function sf(e){return fe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}}]})(e)}const q0=({title:e,children:t,onClose:n})=>c.jsxs("div",{className:"bg-red-200 p-3 rounded-md mb-3",children:[c.jsxs("div",{className:"flex justify-between mb-2",children:[c.jsx("h2",{className:"text-lg font-semibold",children:e}),n&&c.jsx("button",{onClick:n,children:c.jsx(sf,{})})]}),t]}),Wt=e=>{var r,l,o;let{error:t,remove:n}=e;return t==null?null:c.jsxs(q0,{onClose:n,title:t.text,children:[((r=t.details)==null?void 0:r.statusText)&&c.jsx("div",{className:"pb-2 text-md",children:(l=t.details)==null?void 0:l.statusText}),c.jsx("div",{className:"whitespace-pre text-sm",children:(o=t.details)==null?void 0:o.text})]})};function vu(e){return e&&e.ownerDocument||document}function yo(e){e===void 0&&(e=vu());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function zs(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Rl=!!(typeof window<"u"&&window.document&&window.document.createElement);var vi=!1,gi=!1;try{var wo={get passive(){return vi=!0},get once(){return gi=vi=!0}};Rl&&(window.addEventListener("test",wo,wo),window.removeEventListener("test",wo,!0))}catch{}function b0(e,t,n,r){if(r&&typeof r!="boolean"&&!gi){var l=r.once,o=r.capture,i=n;!gi&&l&&(i=n.__once||function u(s){this.removeEventListener(t,u,o),n.call(this,s)},n.__once=i),e.addEventListener(t,i,vi?r:o)}e.addEventListener(t,n,r)}function e1(e,t,n,r){var l=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,l),n.__once&&e.removeEventListener(t,n.__once,l)}function Ms(e,t,n,r){return b0(e,t,n,r),function(){e1(e,t,n,r)}}function t1(){const e=y.useRef(!0),t=y.useRef(()=>e.current);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function n1(e){const t=y.useRef(e);return t.current=e,t}function r1(e){const t=n1(e);y.useEffect(()=>()=>t.current(),[])}function l1(e){const t=y.useRef(null);return y.useEffect(()=>{t.current=e}),t.current}function o1(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e},[e]),t}function Ot(e){const t=o1(e);return y.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function i1(e){var t=vu(e);return t&&t.defaultView||window}function u1(e,t){return i1(e).getComputedStyle(e,t)}var s1=/([A-Z])/g;function a1(e){return e.replace(s1,"-$1").toLowerCase()}var c1=/^ms-/;function Fr(e){return a1(e).replace(c1,"-ms-")}var f1=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function d1(e){return!!(e&&f1.test(e))}function Os(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Fr(t))||u1(e).getPropertyValue(Fr(t));Object.keys(t).forEach(function(l){var o=t[l];!o&&o!==0?e.style.removeProperty(Fr(l)):d1(l)?r+=l+"("+o+") ":n+=Fr(l)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const p1="data-rr-ui-";function m1(e){return`${p1}${e}`}function h1(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const Fs=m1("modal-open");class v1{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return h1(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},r=this.isRTL?"paddingLeft":"paddingRight",l=this.getElement();t.style={overflow:l.style.overflow,[r]:l.style[r]},t.scrollBarWidth&&(n[r]=`${parseInt(Os(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(Fs,""),Os(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Fs),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const af=v1,cf=y.createContext(Rl?window:void 0);cf.Provider;function gu(){return y.useContext(cf)}const xo=(e,t)=>Rl?e==null?(t||vu()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function g1(e,t){const n=gu(),[r,l]=y.useState(()=>xo(e,n==null?void 0:n.document));if(!r){const o=xo(e);o&&l(o)}return y.useEffect(()=>{t&&r&&t(r)},[t,r]),y.useEffect(()=>{const o=xo(e);o!==r&&l(o)},[e,r]),r}const Is=e=>!e||typeof e=="function"?e:t=>{e.current=t};function y1(e,t){const n=Is(e),r=Is(t);return l=>{n&&n(l),r&&r(l)}}function ff(e,t){return y.useMemo(()=>y1(e,t),[e,t])}const w1=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",x1=typeof document<"u",Rs=x1||w1?y.useLayoutEffect:y.useEffect;function k1({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const o=y.useRef(null),i=y.useRef(t),u=Ot(n);y.useEffect(()=>{t?i.current=!0:u(o.current)},[t,u]);const s=ff(o,e.ref),a=y.cloneElement(e,{ref:s});return t?a:l||!i.current&&r?null:a}function S1({in:e,onTransition:t}){const n=y.useRef(null),r=y.useRef(!0),l=Ot(t);return Rs(()=>{if(!n.current)return;let o=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>o}),()=>{o=!0}},[e,l]),Rs(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function E1({children:e,in:t,onExited:n,onEntered:r,transition:l}){const[o,i]=y.useState(!t);t&&o&&i(!1);const u=S1({in:!!t,onTransition:a=>{const v=()=>{a.isStale()||(a.in?r==null||r(a.element,a.initial):(i(!0),n==null||n(a.element)))};Promise.resolve(l(a)).then(v,h=>{throw a.in||i(!0),h})}}),s=ff(u,e.ref);return o&&!t?null:y.cloneElement(e,{ref:s})}function Ds(e,t,n){return e?c.jsx(e,Object.assign({},n)):t?c.jsx(E1,Object.assign({},n,{transition:t})):c.jsx(k1,Object.assign({},n))}function C1(e){return e.code==="Escape"||e.keyCode===27}const _1=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function j1(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o=0)&&(n[l]=e[l]);return n}let ko;function N1(e){return ko||(ko=new af({ownerDocument:e==null?void 0:e.document})),ko}function T1(e){const t=gu(),n=e||N1(t),r=y.useRef({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:y.useCallback(l=>{r.current.dialog=l},[]),setBackdropRef:y.useCallback(l=>{r.current.backdrop=l},[])})}const df=y.forwardRef((e,t)=>{let{show:n=!1,role:r="dialog",className:l,style:o,children:i,backdrop:u=!0,keyboard:s=!0,onBackdropClick:a,onEscapeKeyDown:v,transition:h,runTransition:m,backdropTransition:w,runBackdropTransition:g,autoFocus:S=!0,enforceFocus:L=!0,restoreFocus:d=!0,restoreFocusOptions:f,renderDialog:p,renderBackdrop:x=Z=>c.jsx("div",Object.assign({},Z)),manager:N,container:E,onShow:C,onHide:j=()=>{},onExit:R,onExited:M,onExiting:ge,onEnter:Tt,onEntering:Pt,onEntered:mr}=e,Al=j1(e,_1);const De=gu(),lt=g1(E),_=T1(N),P=t1(),z=l1(n),[$,K]=y.useState(!n),Qe=y.useRef(null);y.useImperativeHandle(t,()=>_,[_]),Rl&&!z&&n&&(Qe.current=yo(De==null?void 0:De.document)),n&&$&&K(!1);const $e=Ot(()=>{if(_.add(),Vl.current=Ms(document,"keydown",vf),Bl.current=Ms(document,"focus",()=>setTimeout(Ke),!0),C&&C(),S){var Z,xu;const Wl=yo((Z=(xu=_.dialog)==null?void 0:xu.ownerDocument)!=null?Z:De==null?void 0:De.document);_.dialog&&Wl&&!zs(_.dialog,Wl)&&(Qe.current=Wl,_.dialog.focus())}}),Lt=Ot(()=>{if(_.remove(),Vl.current==null||Vl.current(),Bl.current==null||Bl.current(),d){var Z;(Z=Qe.current)==null||Z.focus==null||Z.focus(f),Qe.current=null}});y.useEffect(()=>{!n||!lt||$e()},[n,lt,$e]),y.useEffect(()=>{$&&Lt()},[$,Lt]),r1(()=>{Lt()});const Ke=Ot(()=>{if(!L||!P()||!_.isTopModal())return;const Z=yo(De==null?void 0:De.document);_.dialog&&Z&&!zs(_.dialog,Z)&&_.dialog.focus()}),Zt=Ot(Z=>{Z.target===Z.currentTarget&&(a==null||a(Z),u===!0&&j())}),vf=Ot(Z=>{s&&C1(Z)&&_.isTopModal()&&(v==null||v(Z),Z.defaultPrevented||j())}),Bl=y.useRef(),Vl=y.useRef(),gf=(...Z)=>{K(!0),M==null||M(...Z)};if(!lt)return null;const wu=Object.assign({role:r,ref:_.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},Al,{style:o,className:l,tabIndex:-1});let Hl=p?p(wu):c.jsx("div",Object.assign({},wu,{children:y.cloneElement(i,{role:"document"})}));Hl=Ds(h,m,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:R,onExiting:ge,onExited:gf,onEnter:Tt,onEntering:Pt,onEntered:mr,children:Hl});let hr=null;return u&&(hr=x({ref:_.setBackdropRef,onClick:Zt}),hr=Ds(w,g,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:hr})),c.jsx(c.Fragment,{children:V0.createPortal(c.jsxs(c.Fragment,{children:[hr,Hl]}),lt)})});df.displayName="Modal";const P1=Object.assign(df,{Manager:af}),L1=({onClose:e,title:t})=>c.jsxs("div",{className:"flex p-3 justify-between items-center border-b",children:[c.jsx("h2",{className:"text-xl font-semibold",children:t}),e&&c.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:e,"aria-label":"Close modal",children:c.jsx(sf,{className:"w-5 h-5"})})]}),Dl=({isOpen:e,onClose:t,title:n,children:r,className:l})=>{const o=()=>c.jsx("div",{className:"fixed inset-0 bg-black/30 z-[300]"});return c.jsx(P1,{show:e,onHide:t,renderBackdrop:o,className:"fixed z-[301] top-0 left-0 w-full h-full block overflow-x-hidden overflow-y-auto",children:c.jsxs("div",{className:`bg-white shadow-lg my-8 mx-auto max-w-2xl rounded ${l}`,children:[c.jsx(L1,{onClose:t,title:n}),r]})})},$l=({children:e})=>c.jsx("div",{className:"p-3 border-b",children:e}),Ul=({children:e,className:t})=>c.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),Ve=({onClick:e,children:t,className:n,disabled:r,variant:l})=>{let o={secondary:"hover:bg-blue-600 transition-colors duration-100 hover:text-white",danger:"bg-red-500 text-white border-green-50 hover:border-red-700 hover:bg-red-600",primary:"bg-blue-400 text-white hover:bg-blue-600",cancel:"bg-slate-50 hover:bg-slate-200",none:""}[l??"secondary"];return c.jsx("button",{disabled:r,onClick:i=>{i.preventDefault(),e(i)},className:`flex inline-flex items-center gap-1 border rounded-lg border disabled:cursor-not-allowed px-2 py-1 transition-colors duration-300 ${o} ${n}`,children:t})},z1=({id:e,show:t,onHide:n})=>{if(!t)return null;const[r,l]=y.useState(!1),[o,i]=y.useState(null),[u,s]=y.useState(!1),a=y.useContext(pr),v=y.useContext(Nt),h=()=>{l(!1),i(null),s(!1),n()},m=()=>{s(!0),(r?v.delete:v.forget)(e).then(()=>{a.refreshTorrents(),h()}).catch(g=>{i({text:`Error deleting torrent id=${e}`,details:g}),s(!1)})};return c.jsxs(Dl,{isOpen:t,onClose:n,title:"Delete torrent",children:[c.jsxs($l,{children:[c.jsx("p",{className:"text-gray-700",children:"Are you sure you want to delete the torrent?"}),c.jsxs("div",{className:"mt-4 flex items-center",children:[c.jsx("input",{type:"checkbox",id:"deleteFiles",className:"form-checkbox h-4 w-4 text-blue-500",onChange:()=>l(!r),checked:r,placeholder:"Also delete files"}),c.jsx("label",{htmlFor:"deleteFiles",className:"ml-2 text-gray-700",children:"Also delete files"})]}),o&&c.jsx(Wt,{error:o})]}),c.jsxs(Ul,{children:[u&&c.jsx(yl,{}),c.jsx(Ve,{variant:"cancel",onClick:h,children:"Cancel"}),c.jsx(Ve,{variant:"danger",onClick:m,disabled:u,children:"Delete Torrent"})]})]})};function M1(e){return fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function O1(e){return fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function F1(e){return fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}const I1=({id:e,statsResponse:t})=>{let n=t.state,[r,l]=y.useState(!1),[o,i]=y.useState(!1),u=y.useContext(rf);const s=n=="live",a=n=="paused"||n=="error",v=y.useContext(pr),h=y.useContext(Nt),m=()=>{l(!0),h.start(e).then(()=>{u.refresh()},L=>{v.setCloseableError({text:`Error starting torrent id=${e}`,details:L})}).finally(()=>l(!1))},w=()=>{l(!0),h.pause(e).then(()=>{u.refresh()},L=>{v.setCloseableError({text:`Error pausing torrent id=${e}`,details:L})}).finally(()=>l(!1))},g=()=>{l(!0),i(!0)},S=()=>{l(!1),i(!1)};return c.jsxs("div",{className:"flex w-full justify-center gap-2",children:[a&&c.jsx(Zr,{onClick:m,disabled:r,children:c.jsx(O1,{className:"hover:text-green-500 transition-colors duration-300"})}),s&&c.jsx(Zr,{onClick:w,disabled:r,children:c.jsx(M1,{className:"hover:text-yellow-500 transition-colors duration-300"})}),c.jsx(Zr,{onClick:g,disabled:r,children:c.jsx(F1,{className:"hover:text-red-500 transition-colors duration-500"})}),c.jsx(z1,{id:e,show:o,onHide:S})]})},R1=({now:e,variant:t,label:n})=>{const r=n??`${e.toFixed(2)}%`,l={warn:"bg-yellow-500",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"}[t??"info"];return c.jsx("div",{className:"w-full bg-gray-200 rounded-full",children:c.jsx("div",{className:`text-xs bg-blue-500 font-medium transition-all text-center p-0.5 leading-none rounded-full ${l}`,style:{width:`${e}%`},children:r})})};function wl(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const D1=({statsResponse:e})=>{var t,n;switch(e.state){case H0:return"Paused";case mu:return"Checking files";case Q0:return"Error"}return e.state!="live"||e.live===null?e.state:c.jsxs(c.Fragment,{children:[!e.finished&&c.jsxs("div",{className:"download-speed",children:["↓ ",(t=e.live.download_speed)==null?void 0:t.human_readable]}),c.jsxs("div",{className:"upload-speed",children:["↑ ",(n=e.live.upload_speed)==null?void 0:n.human_readable,e.live.snapshot.uploaded_bytes>0&&c.jsxs("span",{children:["(",wl(e.live.snapshot.uploaded_bytes),")"]})]})]})};function $1(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function U1(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,l=(o,i)=>o>0?`${o}${i}`:"";return t>0?`${l(t,"h")} ${l(n,"m")}`.trim():n>0?`${l(n,"m")} ${l(r,"s")}`.trim():`${l(r,"s")}`.trim()}function A1(e){var n,r,l;let t=(l=(r=(n=e==null?void 0:e.live)==null?void 0:n.time_remaining)==null?void 0:r.duration)==null?void 0:l.secs;return t==null?"N/A":U1(t)}function B1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}}]})(e)}function V1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}}]})(e)}function H1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}}]})(e)}function W1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}}]})(e)}function Q1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12c0-1.19.22-2.32.6-3.38l1.88.68C4.17 10.14 4 11.05 4 12c0 4.41 3.59 8 8 8s8-3.59 8-8-3.59-8-8-8c-.95 0-1.85.17-2.69.48l-.68-1.89C9.69 2.22 10.82 2 12 2c5.52 0 10 4.48 10 10zM5.5 4C4.67 4 4 4.67 4 5.5S4.67 7 5.5 7 7 6.33 7 5.5 6.33 4 5.5 4zM11 16V8H9v8h2zm4 0V8h-2v8h2z"}}]})(e)}const K1=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?c.jsx(V1,{className:e,color:"red"}):l?c.jsx(W1,{className:e,color:"green"}):t?c.jsx(B1,{className:e,color:"green"}):n?c.jsx(H1,{className:`text-blue-500 ${e}`}):c.jsx(Q1,{className:e})},Z1=({id:e,detailsResponse:t,statsResponse:n})=>{const r=(n==null?void 0:n.state)??"",l=(n==null?void 0:n.error)??null,o=(n==null?void 0:n.total_bytes)??1,i=(n==null?void 0:n.progress_bytes)??0,u=(n==null?void 0:n.finished)||!1,s=l?100:i/o*100,a=()=>{var m;let h=(m=n==null?void 0:n.live)==null?void 0:m.snapshot.peer_stats;return h?`${h.live} / ${h.seen}`:""},v=h=>c.jsx(K1,{className:h,error:!!l,live:!!(n!=null&&n.live),finished:u});return c.jsxs("section",{className:"flex flex-col sm:flex-row items-center gap-2 border p-2 border-gray-200 rounded-xl shadow-xs hover:drop-shadow-sm",children:[c.jsx("div",{className:"hidden md:block",children:v("w-10 h-10")}),c.jsxs("div",{className:"w-full flex flex-col gap-2",children:[t&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"md:hidden",children:v("w-5 h-5")}),c.jsx("div",{className:"text-left text-lg text-gray-900 text-ellipsis break-all",children:$1(t)})]}),l?c.jsxs("p",{className:"text-red-500 text-sm",children:[c.jsx("strong",{children:"Error:"})," ",l]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{children:c.jsx(R1,{now:s,label:l,variant:r==mu?"warn":u?"success":"info"})}),c.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 sm:flex-wrap items-center text-sm text-nowrap font-medium text-gray-500",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(X0,{})," ",a().toString()]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(Y0,{}),c.jsxs("div",{children:[wl(i),"/",wl(o)]})]}),n&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(G0,{}),A1(n)]}),c.jsx("div",{className:"flex gap-2 items-center",children:c.jsx(D1,{statsResponse:n})})]})]})]})]}),n&&c.jsx("div",{className:"",children:c.jsx(I1,{id:e,statsResponse:n})})]})},G1=({id:e,torrent:t})=>{const[n,r]=y.useState(null),[l,o]=y.useState(null),[i,u]=y.useState(0),s=y.useContext(Nt),a=()=>{u(i+1)};return y.useEffect(()=>{if(n===null)return lf(async()=>{await s.getTorrentDetails(t.id).then(r)},1e3)},[n]),y.useEffect(()=>hu(async()=>s.getTorrentStats(t.id).then(w=>(o(w),w)).then(w=>w.state==mu||w.state==W0?1e3:1e4,()=>1e4),0),[i]),c.jsx(rf.Provider,{value:{refresh:a},children:c.jsx(Z1,{id:e,detailsResponse:n,statsResponse:l})})},Y1=e=>{if(e.torrents===null&&e.loading)return c.jsx(yl,{});if(e.torrents!==null)return e.torrents.length===0?c.jsx("div",{className:"text-center",children:c.jsx("p",{children:"No existing torrents found."})}):c.jsx("div",{className:"flex flex-col gap-2 mx-2",children:e.torrents.map(t=>c.jsx(G1,{id:t.id,torrent:t},t.id))})},X1=e=>{let t=y.useContext(pr);return c.jsxs("div",{className:"container mx-auto",children:[c.jsx(Wt,{error:e.closeableError,remove:()=>t.setCloseableError(null)}),c.jsx(Wt,{error:e.otherError}),c.jsx(Y1,{torrents:e.torrents,loading:e.torrentsLoading})]})};var J1="Expected a function",$s=0/0,q1="[object Symbol]",b1=/^\s+|\s+$/g,ep=/^[-+]0x[0-9a-f]+$/i,tp=/^0b[01]+$/i,np=/^0o[0-7]+$/i,rp=parseInt,lp=typeof vr=="object"&&vr&&vr.Object===Object&&vr,op=typeof self=="object"&&self&&self.Object===Object&&self,ip=lp||op||Function("return this")(),up=Object.prototype,sp=up.toString,ap=Math.max,cp=Math.min,So=function(){return ip.Date.now()};function fp(e,t,n){var r,l,o,i,u,s,a=0,v=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(J1);t=Us(t)||0,yi(n)&&(v=!!n.leading,h="maxWait"in n,o=h?ap(Us(n.maxWait)||0,t):o,m="trailing"in n?!!n.trailing:m);function w(E){var C=r,j=l;return r=l=void 0,a=E,i=e.apply(j,C),i}function g(E){return a=E,u=setTimeout(d,t),v?w(E):i}function S(E){var C=E-s,j=E-a,R=t-C;return h?cp(R,o-j):R}function L(E){var C=E-s,j=E-a;return s===void 0||C>=t||C<0||h&&j>=o}function d(){var E=So();if(L(E))return f(E);u=setTimeout(d,S(E))}function f(E){return u=void 0,m&&r?w(E):(r=l=void 0,i)}function p(){u!==void 0&&clearTimeout(u),a=0,r=s=l=u=void 0}function x(){return u===void 0?i:f(So())}function N(){var E=So(),C=L(E);if(r=arguments,l=this,s=E,C){if(u===void 0)return g(s);if(h)return u=setTimeout(d,t),w(s)}return u===void 0&&(u=setTimeout(d,t)),i}return N.cancel=p,N.flush=x,N}function yi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function dp(e){return!!e&&typeof e=="object"}function pp(e){return typeof e=="symbol"||dp(e)&&sp.call(e)==q1}function Us(e){if(typeof e=="number")return e;if(pp(e))return $s;if(yi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=yi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(b1,"");var n=tp.test(e);return n||np.test(e)?rp(e.slice(2),n?2:8):ep.test(e)?$s:+e}var mp=fp;const hp=wi(mp),vp=({span:e})=>{let t=Object.entries(e).filter(([n,r])=>n!="name");return t.length==0?null:c.jsxs(c.Fragment,{children:["{",t.map(([n,r])=>c.jsxs("span",{children:[n," = ",r]},n)).reduce((n,r)=>c.jsxs(c.Fragment,{children:[n,", ",r]})),"}"]})},gp=({span:e})=>c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"font-bold",children:e.name}),c.jsx(vp,{span:e})]}),yp=({fields:e})=>c.jsxs("span",{className:`m-1 ${e.message.match(/error|fail/g)?"text-red-500":"text-slate-500"}`,children:[e.message,Object.entries(e).filter(([t,n])=>t!="message").map(([t,n])=>c.jsxs("span",{className:"m-1",children:[c.jsx("span",{className:"italic font-bold",children:t}),"=",n]},t))]}),wp=dt.memo(({line:e})=>{var r;const t=e,n=l=>{switch(l){case"DEBUG":return"text-blue-500";case"INFO":return"text-green-500";case"WARN":return"text-amber-500";case"ERROR":return"text-red-500";default:return"text-slate-500"}};return c.jsxs("p",{className:"font-mono m-0 text-break text-[10px]",children:[c.jsx("span",{className:"m-1 text-slate-500",children:t.timestamp}),c.jsx("span",{className:`m-1 ${n(t.level)}`,children:t.level}),c.jsx("span",{className:"m-1",children:(r=t.spans)==null?void 0:r.map((l,o)=>c.jsx(gp,{span:l},o))}),c.jsx("span",{className:"m-1 text-slate-500",children:t.target}),c.jsx(yp,{fields:t.fields})]})}),pf=({children:e})=>c.jsx("form",{children:e}),yu=({autoFocus:e,value:t,name:n,disabled:r,onChange:l,label:o,help:i,inputType:u,placeholder:s})=>c.jsxs("div",{className:"flex flex-col gap-2 text-sm mb-6",children:[c.jsx("label",{htmlFor:n,children:o}),c.jsx("input",{autoFocus:e,type:u,className:"block border rounded bg-transparent py-1.5 pl-2 text-gray-800 focus:ring-0 sm:text-sm sm:leading-6",id:n,name:n,disabled:r,placeholder:s,value:t,onChange:l}),i&&c.jsx("div",{className:"text-xs text-slate-500 mb-3",children:i})]}),xp=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},kp=(e,t,n)=>{const r=new AbortController,l=r.signal;let o=!1;const i=()=>{console.log("cancelling fetch"),o=!0,r.abort()},u=async()=>{let a=await fetch(e,{signal:l});if(!a.ok){let m=await a.text();throw n({text:"error fetching logs",details:{statusText:a.statusText,text:m}}),null}if(!a.body){n({text:"error fetching logs: ReadableStream not supported."});return}n(null);const v=a.body.getReader();let h=new Uint8Array;for(;;){const{done:m,value:w}=await v.read();if(m)throw n({text:"log stream terminated"}),null;h=xp(h,w);for(let g;(g=h.indexOf(10))!==-1;){let S=h.slice(0,g),L=new TextDecoder().decode(S);t(L),h=h.slice(g+1)}}};let s=lf(()=>u().then(()=>{},a=>{if(!o&&a!==null)throw n({text:"error streaming logs",details:{text:a.toString()}}),a}),1e3);return()=>{i(),s()}},Sp=({url:e,maxLines:t})=>{const[n,r]=y.useState([]),[l,o]=y.useState(null),[i,u]=y.useState(""),s=y.useRef(null),a=t??1e3,v=y.useCallback(g=>{r(S=>[{id:S.length==0?0:S[0].id+1,content:g,parsed:JSON.parse(g),show:s.current?!!g.match(s.current):!0},...S.slice(0,a-1)])},[s.current,t]),h=y.useRef(v);h.current=v;const m=hp(g=>{let S=null;try{S=new RegExp(g)}catch{return}s.current=S,r(L=>{let d=[...L];for(let f of d)f.show=!!f.content.match(S);return d})},200),w=g=>{u(g),m(g)};return y.useEffect(()=>m.cancel,[]),y.useEffect(()=>kp(e,g=>h.current(g),o),[e]),c.jsxs("div",{children:[c.jsx(Wt,{error:l}),c.jsxs("div",{className:"mb-3",children:["Showing last ",a," logs since this window was opened"]}),c.jsx(pf,{children:c.jsx(yu,{value:i,name:"filter",placeholder:"Enter filter (regex)",onChange:g=>w(g.target.value)})}),n.map(g=>c.jsx("div",{hidden:!g.show,children:c.jsx(wp,{line:g.parsed},g.id)}))]})},Ep=({show:e,onClose:t})=>{let r=y.useContext(Nt).getStreamLogsUrl();return c.jsxs(Dl,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[c.jsx($l,{children:r?c.jsx(Sp,{url:r}):c.jsx(Wt,{error:{text:"HTTP API not available to stream logs"}})}),c.jsx(Ul,{children:c.jsx(Ve,{variant:"primary",onClick:t,children:"Close"})})]})},As=({checked:e,name:t,disabled:n,onChange:r,label:l,help:o,inputType:i})=>c.jsxs("div",{className:"flex gap-3 items-start",children:[c.jsx("div",{className:"flex",children:c.jsx("input",{type:i||"checkbox",className:"block mt-1",id:t,name:t,disabled:n,checked:e,onChange:r})}),c.jsxs("div",{className:"text-sm flex flex-col gap-1",children:[c.jsx("label",{htmlFor:t,children:l}),o&&c.jsx("div",{className:"text-xs text-slate-500 mb-3",children:o})]})]}),Bs=({children:e,label:t,help:n,className:r})=>c.jsxs("fieldset",{className:`mb-4 ${r}`,children:[c.jsx("label",{className:"text-md font-md mb-3 block",children:t}),e]}),Cp=e=>{let{onHide:t,listTorrentResponse:n,listTorrentError:r,listTorrentLoading:l,data:o}=e;const[i,u]=y.useState([]),[s,a]=y.useState(!1),[v,h]=y.useState(null),[m,w]=y.useState(!1),[g,S]=y.useState(""),L=y.useContext(pr),d=y.useContext(Nt),f=()=>{u(n?n.details.files.map((C,j)=>j):[])};y.useEffect(()=>{console.log(n),f(),S((n==null?void 0:n.output_folder)||"")},[n]);const p=()=>{t(),u([]),h(null),a(!1)},x=C=>{i.includes(C)?u(i.filter(j=>j!==C)):u([...i,C])},N=async()=>{if(!n)return;a(!0);let C=n.seen_peers?n.seen_peers.slice(0,32):null,j={overwrite:!0,only_files:i,initial_peers:C,output_folder:g};m&&(j.peer_opts={connect_timeout:20,read_write_timeout:60}),d.uploadTorrent(o,j).then(()=>{t(),L.refreshTorrents()},R=>{h({text:"Error starting torrent",details:R})}).finally(()=>a(!1))},E=()=>{if(l)return c.jsx(yl,{});if(r)return c.jsx(Wt,{error:r});if(n)return c.jsxs(pf,{children:[c.jsxs(Bs,{className:"mb-4",label:"Pick the files to download",children:[c.jsxs("div",{className:"mb-3 flex gap-2",children:[c.jsx(Ve,{onClick:f,className:"text-sm",children:"Select all"}),c.jsx(Ve,{onClick:()=>u([]),className:"text-sm",children:"Deselect all"})]}),n.details.files.map((C,j)=>c.jsx(As,{label:`${C.name} (${wl(C.length)})`,checked:i.includes(j),onChange:()=>x(j),name:`check-${j}`},j))]}),c.jsxs(Bs,{label:"Options",children:[c.jsx(yu,{label:"Output folder",name:"output_folder",inputType:"text",value:g,onChange:C=>S(C.target.value)}),c.jsx(As,{label:"Increase timeouts",checked:m,onChange:()=>w(!m),help:"This might be useful for unpopular torrents with few peers. It will slow down fast torrents though.",name:"increase_timeouts"})]})]})};return c.jsxs(Dl,{isOpen:!0,onClose:p,title:"Add Torrent",children:[c.jsxs($l,{children:[E(),c.jsx(Wt,{error:v})]}),c.jsxs(Ul,{children:[s&&c.jsx(yl,{}),c.jsx(Ve,{onClick:p,variant:"cancel",children:"Cancel"}),c.jsx(Ve,{onClick:N,variant:"primary",disabled:l||s||i.length==0,children:"OK"})]})]})},mf=({onClick:e,data:t,resetData:n,children:r,className:l})=>{const[o,i]=y.useState(!1),[u,s]=y.useState(null),[a,v]=y.useState(null),h=y.useContext(Nt);y.useEffect(()=>{if(t===null)return;let w=setTimeout(async()=>{i(!0);try{const g=await h.uploadTorrent(t,{list_only:!0});s(g)}catch(g){v({text:"Error listing torrent files",details:g})}finally{i(!1)}},0);return()=>clearTimeout(w)},[t]);const m=()=>{n(),v(null),s(null),i(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(Ve,{onClick:e,className:l,children:r}),t&&c.jsx(Cp,{onHide:m,listTorrentError:a,listTorrentResponse:u,data:t,listTorrentLoading:o})]})};function _p(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z",fill:"currentColor"}},{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z",fill:"currentColor"}}]})(e)}function jp(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M14.8284 12L16.2426 13.4142L19.071 10.5858C20.6331 9.02365 20.6331 6.49099 19.071 4.9289C17.509 3.3668 14.9763 3.3668 13.4142 4.9289L10.5858 7.75732L12 9.17154L14.8284 6.34311C15.6095 5.56206 16.8758 5.56206 17.6568 6.34311C18.4379 7.12416 18.4379 8.39049 17.6568 9.17154L14.8284 12Z",fill:"currentColor"}},{tag:"path",attr:{d:"M12 14.8285L13.4142 16.2427L10.5858 19.0711C9.02372 20.6332 6.49106 20.6332 4.92896 19.0711C3.36686 17.509 3.36686 14.9764 4.92896 13.4143L7.75739 10.5858L9.1716 12L6.34317 14.8285C5.56212 15.6095 5.56212 16.8758 6.34317 17.6569C7.12422 18.4379 8.39055 18.4379 9.1716 17.6569L12 14.8285Z",fill:"currentColor"}},{tag:"path",attr:{d:"M14.8285 10.5857C15.219 10.1952 15.219 9.56199 14.8285 9.17147C14.4379 8.78094 13.8048 8.78094 13.4142 9.17147L9.1716 13.4141C8.78107 13.8046 8.78107 14.4378 9.1716 14.8283C9.56212 15.2188 10.1953 15.2188 10.5858 14.8283L14.8285 10.5857Z",fill:"currentColor"}}]})(e)}const Np=({className:e})=>{const t=y.useRef(),[n,r]=y.useState(null),l=async()=>{var s;if(!((s=t==null?void 0:t.current)!=null&&s.files))return;const u=t.current.files[0];r(u)},o=()=>{t!=null&&t.current&&(t.current.value="",r(null))},i=()=>{t!=null&&t.current&&t.current.click()};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",ref:t,accept:".torrent",onChange:l,hidden:!0}),c.jsxs(mf,{onClick:i,data:n,resetData:o,className:e,children:[c.jsx(_p,{color:"blue"}),c.jsx("div",{children:"Upload .torrent File"})]})]})},Tp=({className:e})=>{const[t,n]=y.useState(null),[r,l]=y.useState(""),[o,i]=y.useState(!1),u=()=>{i(!1),n(null)};return c.jsxs(c.Fragment,{children:[c.jsxs(mf,{onClick:()=>{i(!0)},data:t,className:e,resetData:()=>n(null),children:[c.jsx(jp,{color:"blue"}),c.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),c.jsxs(Dl,{isOpen:o,onClose:u,title:"Add torrent",children:[c.jsx($l,{children:c.jsx(yu,{autoFocus:!0,value:r,name:"magnet",onChange:s=>l(s.target.value),placeholder:"magnet:?xt=urn:btih:...",help:"Enter magnet or HTTP(S) URL to the .torrent"})}),c.jsxs(Ul,{children:[c.jsx(Ve,{variant:"cancel",onClick:u,children:"Cancel"}),c.jsx(Ve,{disabled:!r,variant:"primary",onClick:()=>{n(r),l(""),i(!1)},children:"Add"})]})]})]})},Pp=e=>y.createElement("svg",{width:"64mm",height:"64mm",viewBox:"0 0 64 64",id:"svg1",xmlSpace:"preserve","inkscape:version":"1.3.1 (91b66b0, 2023-11-16)","sodipodi:docname":"logo.svg","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},y.createElement("sodipodi:namedview",{id:"namedview1",pagecolor:"#ffffff",bordercolor:"#000000",borderopacity:.25,"inkscape:showpageshadow":2,"inkscape:pageopacity":0,"inkscape:pagecheckerboard":0,"inkscape:deskcolor":"#d1d1d1","inkscape:document-units":"mm","inkscape:zoom":1.4936372,"inkscape:cx":134.90559,"inkscape:cy":139.92689,"inkscape:window-width":1440,"inkscape:window-height":847,"inkscape:window-x":0,"inkscape:window-y":25,"inkscape:window-maximized":0,"inkscape:current-layer":"layer1"}),y.createElement("defs",{id:"defs1"},y.createElement("inkscape:perspective",{"sodipodi:type":"inkscape:persp3d","inkscape:vp_x":"3.1042448 : 18.147022 : 1","inkscape:vp_y":"0 : 999.99994 : 0","inkscape:vp_z":"303.94612 : 54.05812 : 1","inkscape:persp3d-origin":"105 : -134 : 1",id:"perspective4"})),y.createElement("g",{"inkscape:label":"Layer 1","inkscape:groupmode":"layer",id:"layer1",transform:"translate(-56.674541,-85.911432)"},y.createElement("path",{style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.610041},d:"m 81.603814,145.5382 -7.433116,-4.36986 -6.018097,-3.54529 -6.018099,-3.54529 -0.09405,-0.35761 -0.09406,-0.3576 v -15.31979 -15.31979 l 0.09451,-0.35939 0.09451,-0.35938 6.017643,-3.544433 6.017641,-3.544428 7.432805,-4.369167 7.432803,-4.369166 0.240089,0.09331 0.240083,0.09331 13.292394,7.826122 13.29241,7.826122 0.093,0.35355 0.093,0.35355 v 15.31979 15.31979 l -0.0928,0.35267 -0.0928,0.35266 -13.29682,7.82802 -13.296819,7.82803 -0.235583,0.0921 -0.235588,0.0921 z m 19.758596,-5.88315 12.13185,-7.15306 v -14.45996 -14.45994 l -5.11526,-3.01603 -5.11526,-3.016035 -7.017048,-4.136312 -7.017053,-4.13631 h -0.112738 -0.11273 l -7.097035,4.182089 -7.09703,4.18209 -5.035336,2.971548 -5.035335,2.97155 v 14.45761 14.45762 l 5.275113,3.11051 5.275113,3.11051 6.793709,4.02813 6.793702,4.02812 0.176743,0.0155 0.176742,0.0155 z",id:"path15","sodipodi:nodetypes":"cccccccccccccccccccccccccccccccccccccccccccccccccccc"}),y.createElement("path",{style:{fill:"#000000"},id:"path1",d:""}),y.createElement("path",{d:"m 84.161856,133.76725 -4.567369,-2.5483 -0.700367,0.28585 -0.700376,0.28584 -0.495731,0.11427 -0.495731,0.11426 -3.168791,-1.75603 -3.168782,-1.75603 -0.515321,-0.57002 -0.515323,-0.57002 0.0161,-3.59449 0.0161,-3.59448 0.164041,-0.41611 0.164042,-0.41611 1.480342,-0.85565 1.480346,-0.85565 0.06276,-3.67919 0.06276,-3.67921 0.39653,-0.35884 0.396521,-0.35886 3.663275,-2.04111 3.663267,-2.04112 0.114523,-1.62785 0.114506,-1.62786 0.229029,-0.21764 0.229038,-0.21765 3.341459,-1.854383 3.341467,-1.854382 h 0.301682 0.301682 l 2.476951,1.380374 2.476959,1.380381 1.151673,0.57845 1.151674,0.57845 0.02969,0.27424 0.02969,0.27423 0.02753,1.46272 0.02753,1.46273 3.663258,2.04521 3.66327,2.04521 0.40205,0.36386 0.40206,0.36385 v 3.60098 3.60097 l 0.28629,0.23408 0.28628,0.23408 1.43146,0.72479 1.43145,0.72479 v 3.9806 3.98059 l -0.51533,0.56995 -0.51532,0.56994 -3.19072,1.75191 -3.19072,1.75191 -0.47379,-0.11007 -0.473797,-0.11007 -0.699654,-0.28558 -0.699656,-0.28558 -4.589745,2.5527 -4.589746,2.55269 -0.321886,-0.004 -0.321886,-0.004 z m 8.681258,-1.65766 3.426793,-1.91645 0.06536,-0.19784 0.06535,-0.19785 -1.315884,-0.68709 -1.315885,-0.6871 -0.401264,-0.40081 -0.401265,-0.4008 v -3.79409 -3.79409 l 0.221568,-0.41401 0.221567,-0.414 3.411065,-1.86126 3.411061,-1.86126 h 0.38456 0.38455 l 0.91435,0.46646 0.91435,0.46646 -0.0646,-2.66249 -0.0646,-2.66248 -2.829977,-1.58148 -2.829984,-1.58149 -0.204696,0.12651 -0.204688,0.12651 v 1.11999 1.11999 l -0.744359,0.54975 -0.744358,0.54977 -2.773906,1.52318 -2.773906,1.52319 h -0.526565 -0.526565 l -3.34145,-1.85945 -3.341467,-1.85945 -0.168271,-0.2591 -0.16827,-0.25909 -0.0035,-1.07439 -0.0035,-1.07439 -0.204688,-0.12651 -0.204697,-0.12651 -2.82999,1.58149 -2.829982,1.58148 -0.06458,2.66248 -0.06458,2.66249 0.914351,-0.46646 0.914343,-0.46646 h 0.378551 0.37855 l 3.638639,1.97495 3.63864,1.97495 v 4.0944 4.09441 l -0.401265,0.4008 -0.401264,0.40081 -1.315885,0.6871 -1.315884,0.68709 0.06535,0.19785 0.06536,0.19784 3.426792,1.91645 3.426785,1.91644 h 0.343552 0.343544 z m -16.416873,-5.4431 -0.06475,-2.55838 -2.046125,-1.10985 -2.046124,-1.10984 -0.195677,0.19567 -0.195685,0.19568 0.06596,2.2656 0.06596,2.2656 2.06129,1.18713 2.06129,1.18713 0.179282,0.0198 0.179273,0.0198 z m 4.515881,1.34369 2.061291,-1.19456 0.06527,-2.48747 0.06527,-2.48748 -0.408821,0.15589 -0.408848,0.15589 -1.889514,1.02885 -1.889514,1.02885 v 2.50736 2.50736 l 0.171777,-0.01 0.171767,-0.01 z m 18.666131,-1.29267 v -2.50736 l -1.889509,-1.02885 -1.889522,-1.02885 -0.40883,-0.15589 -0.408839,-0.15589 0.06527,2.48748 0.06527,2.48747 2.061291,1.19456 2.061288,1.19456 0.171777,0.01 0.171774,0.01 z m 4.466127,1.28059 2.06129,-1.18713 0.0661,-2.2656 0.066,-2.2656 -0.19568,-0.19568 -0.19568,-0.19567 -2.04613,1.10984 -2.04612,1.10985 -0.0647,2.55838 -0.0648,2.55838 0.17927,-0.0198 0.17927,-0.0198 z m -24.281888,-6.71835 1.960418,-1.07415 -0.07566,-0.22693 -0.07566,-0.22691 -2.049423,-1.09443 -2.049431,-1.09442 -2.116604,1.14523 -2.116613,1.14523 v 0.17781 0.17782 l 2.004029,1.06709 2.004037,1.06711 0.277236,0.005 0.277237,0.005 z m 23.056528,4.3e-4 2.03643,-1.07372 -0.0708,-0.21245 -0.0708,-0.21244 -2.09332,-1.13015 -2.09332,-1.13016 -2.077692,1.17124 -2.077685,1.17123 v 0.17384 0.17386 l 1.889522,1.0551 1.889505,1.0551 0.31588,0.0161 0.31587,0.0161 z m -14.742004,-11.90808 0.06492,-2.2946 -0.293917,-0.23052 -0.293926,-0.2305 -2.011741,-1.08631 -2.01175,-1.08629 0.06501,2.57478 0.06501,2.57476 1.946776,1.09773 1.946767,1.09773 0.229038,-0.0611 0.229029,-0.0611 z m 4.401245,1.31989 1.946767,-1.09857 0.06501,-2.57476 0.06501,-2.57478 -2.01175,1.08629 -2.011741,1.08631 -0.286291,0.22417 -0.286291,0.22418 v 2.22411 2.2241 l 0.152689,0.15269 0.152689,0.15269 0.133602,-0.0139 0.133602,-0.0139 z m -1.021015,-6.79999 1.952048,-1.05546 -0.224347,-0.26147 -0.224337,-0.26149 -1.958921,-1.03065 -1.958911,-1.03064 -1.958912,1.03064 -1.958912,1.03065 -0.224303,0.26142 -0.224277,0.26141 1.896915,1.04261 1.896906,1.04261 0.517494,0.0129 0.517501,0.0129 z",style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.865634},id:"path1-8"}))),Lp=({title:e})=>{const[t,n]=e.split("-");return c.jsxs("header",{className:"bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center mb-3",children:[c.jsxs("div",{className:"flex flex-nowrap items-center justify-between m-2",children:[c.jsx(Pp,{className:"w-10 h-10 p-1",alt:"logo"}),c.jsxs("h1",{className:"flex items-center",children:[c.jsx("div",{className:"text-3xl",children:t}),c.jsx("div",{className:"bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2",children:n})]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1 m-2",children:[c.jsx(Tp,{className:"flex-grow justify-center"}),c.jsx(Np,{className:"flex-grow justify-center"})]})]})},zp=e=>{const[t,n]=y.useState(null),[r,l]=y.useState(null),[o,i]=y.useState(null),[u,s]=y.useState(!1);let[a,v]=y.useState(!1);const h=y.useContext(Nt),m=async()=>{s(!0);let g=await h.listTorrents().finally(()=>s(!1));i(g.torrents)};y.useEffect(()=>hu(async()=>m().then(()=>(l(null),5e3),g=>(l({text:"Error refreshing torrents",details:g}),console.error(g),5e3)),0),[]);const w={setCloseableError:n,refreshTorrents:m};return c.jsxs(pr.Provider,{value:w,children:[c.jsx(Lp,{title:e.title}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"absolute top-0 start-0 pl-2 z-10",children:[e.menuButtons&&e.menuButtons.map((g,S)=>c.jsx("span",{children:g},S)),c.jsx(Zr,{onClick:()=>v(!0),children:c.jsx(J0,{})})]}),c.jsx(X1,{closeableError:t,otherError:r,torrents:o,torrentsLoading:u})]}),c.jsx(Ep,{show:a,onClose:()=>v(!1)})]})},hf=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",Ze=async(e,t,n)=>{console.log(e,t);const r=hf+t,l={method:e,headers:{Accept:"application/json"},body:n};let o={method:e,path:t,text:""},i;try{i=await fetch(r,l)}catch{return o.text="network error",Promise.reject(o)}if(o.status=i.status,o.statusText=`${i.status} ${i.statusText}`,!i.ok){const s=await i.text();try{const a=JSON.parse(s);o.text=a.human_readable!==void 0?a.human_readable:JSON.stringify(a,null,2)}catch{o.text=s}return Promise.reject(o)}return await i.json()},Vs={getStreamLogsUrl:()=>hf+"/stream_logs",listTorrents:()=>Ze("GET","/torrents"),getTorrentDetails:e=>Ze("GET",`/torrents/${e}`),getTorrentStats:e=>Ze("GET",`/torrents/${e}/stats/v1`),uploadTorrent:(e,t)=>{var r,l;let n="/torrents?&overwrite=true";return t!=null&&t.list_only&&(n+="&list_only=true"),(t==null?void 0:t.only_files)!=null&&(n+=`&only_files=${t.only_files.join(",")}`),(r=t==null?void 0:t.peer_opts)!=null&&r.connect_timeout&&(n+=`&peer_connect_timeout=${t.peer_opts.connect_timeout}`),(l=t==null?void 0:t.peer_opts)!=null&&l.read_write_timeout&&(n+=`&peer_read_write_timeout=${t.peer_opts.read_write_timeout}`),t!=null&&t.initial_peers&&(n+=`&initial_peers=${t.initial_peers.join(",")}`),t!=null&&t.output_folder&&(n+=`&output_folder=${t.output_folder}`),typeof e=="string"&&(n+="&is_url=true"),Ze("POST",n,e)},pause:e=>Ze("POST",`/torrents/${e}/pause`),start:e=>Ze("POST",`/torrents/${e}/start`),forget:e=>Ze("POST",`/torrents/${e}/forget`),delete:e=>Ze("POST",`/torrents/${e}/delete`),getVersion:async()=>(await Ze("GET","/")).version},Mp=()=>{let[e,t]=y.useState("rqbit web UI");return y.useEffect(()=>hu(()=>Vs.getVersion().then(r=>{const l=`rqbit web UI - v${r}`;return t(l),document.title=l,1e4},r=>1e3),0),[]),c.jsx(y.StrictMode,{children:c.jsx(Nt.Provider,{value:Vs,children:c.jsx(zp,{title:e})})})};Eo.createRoot(document.getElementById("app")).render(c.jsx(Mp,{})); +`+o.stack}return{value:e,source:t,stack:l,digest:null}}function mo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ni(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var g0=typeof WeakMap=="function"?WeakMap:Map;function Tc(e,t,n){n=qe(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ml||(ml=!0,di=r),ni(e,t)},n}function Pc(e,t,n){n=qe(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){ni(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){ni(e,t),typeof r!="function"&&(yt===null?yt=new Set([this]):yt.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function fs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new g0;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=z0.bind(null,e,t,n),t.then(e,e))}function ds(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ps(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=qe(-1,1),t.tag=2,gt(n,t,1))),n.lanes|=1),e)}var y0=rt.ReactCurrentOwner,pe=!1;function ue(e,t,n,r){t.child=e===null?uc(t,null,n,r):gn(t,e.child,n,r)}function ms(e,t,n,r,l){n=n.render;var o=t.ref;return dn(t,l),r=qi(e,t,n,r,o,l),n=bi(),e!==null&&!pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,nt(e,t,l)):(B&&n&&Ai(t),t.flags|=1,ue(e,t,r,l),t.child)}function hs(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!au(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Lc(e,t,o,r,l)):(e=Kr(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:qn,n(i,r)&&e.ref===t.ref)return nt(e,t,l)}return t.flags|=1,e=xt(o,r),e.ref=t.ref,e.return=t,t.child=e}function Lc(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(qn(o,r)&&e.ref===t.ref)if(pe=!1,t.pendingProps=r=o,(e.lanes&l)!==0)e.flags&131072&&(pe=!0);else return t.lanes=e.lanes,nt(e,t,l)}return ri(e,t,n,r,l)}function zc(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},D(un,ye),ye|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,D(un,ye),ye|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,D(un,ye),ye|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,D(un,ye),ye|=r;return ue(e,t,l,n),t.child}function Mc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ri(e,t,n,r,l){var o=he(n)?Ut:ie.current;return o=hn(t,o),dn(t,l),n=qi(e,t,n,r,o,l),r=bi(),e!==null&&!pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,nt(e,t,l)):(B&&r&&Ai(t),t.flags|=1,ue(e,t,n,l),t.child)}function vs(e,t,n,r,l){if(he(n)){var o=!0;ll(t)}else o=!1;if(dn(t,l),t.stateNode===null)Hr(e,t),oc(t,n,r),ti(t,n,r,l),r=!0;else if(e===null){var i=t.stateNode,u=t.memoizedProps;i.props=u;var s=i.context,a=n.contextType;typeof a=="object"&&a!==null?a=Te(a):(a=he(n)?Ut:ie.current,a=hn(t,a));var v=n.getDerivedStateFromProps,h=typeof v=="function"||typeof i.getSnapshotBeforeUpdate=="function";h||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==r||s!==a)&&us(t,i,r,a),ut=!1;var m=t.memoizedState;i.state=m,al(t,r,i,l),s=t.memoizedState,u!==r||m!==s||me.current||ut?(typeof v=="function"&&(ei(t,n,v,r),s=t.memoizedState),(u=ut||is(t,n,u,r,m,s,a))?(h||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=s),i.props=r,i.state=s,i.context=a,r=u):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,rc(e,t),u=t.memoizedProps,a=t.type===t.elementType?u:ze(t.type,u),i.props=a,h=t.pendingProps,m=i.context,s=n.contextType,typeof s=="object"&&s!==null?s=Te(s):(s=he(n)?Ut:ie.current,s=hn(t,s));var w=n.getDerivedStateFromProps;(v=typeof w=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==h||m!==s)&&us(t,i,r,s),ut=!1,m=t.memoizedState,i.state=m,al(t,r,i,l);var g=t.memoizedState;u!==h||m!==g||me.current||ut?(typeof w=="function"&&(ei(t,n,w,r),g=t.memoizedState),(a=ut||is(t,n,a,r,m,g,s)||!1)?(v||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,g,s),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,g,s)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),i.props=r,i.state=g,i.context=s,r=a):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return li(e,t,n,r,o,l)}function li(e,t,n,r,l,o){Mc(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return l&&ts(t,n,!1),nt(e,t,o);r=t.stateNode,y0.current=t;var u=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=gn(t,e.child,null,o),t.child=gn(t,null,u,o)):ue(e,t,u,o),t.memoizedState=r.state,l&&ts(t,n,!0),t.child}function Oc(e){var t=e.stateNode;t.pendingContext?es(e,t.pendingContext,t.pendingContext!==t.context):t.context&&es(e,t.context,!1),Gi(e,t.containerInfo)}function gs(e,t,n,r,l){return vn(),Vi(l),t.flags|=256,ue(e,t,n,r),t.child}var oi={dehydrated:null,treeContext:null,retryLane:0};function ii(e){return{baseLanes:e,cachePool:null,transitions:null}}function Fc(e,t,n){var r=t.pendingProps,l=V.current,o=!1,i=(t.flags&128)!==0,u;if((u=i)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),D(V,l&1),e===null)return qo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=zl(i,r,0,null),e=$t(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ii(n),t.memoizedState=oi,e):nu(t,i));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return w0(e,t,i,r,u,l,n);if(o){o=r.fallback,i=t.mode,l=e.child,u=l.sibling;var s={mode:"hidden",children:r.children};return!(i&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=s,t.deletions=null):(r=xt(l,s),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?o=xt(u,o):(o=$t(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?ii(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=oi,r}return o=e.child,e=o.sibling,r=xt(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function nu(e,t){return t=zl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Lr(e,t,n,r){return r!==null&&Vi(r),gn(t,e.child,null,n),e=nu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function w0(e,t,n,r,l,o,i){if(n)return t.flags&256?(t.flags&=-257,r=mo(Error(k(422))),Lr(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=zl({mode:"visible",children:r.children},l,0,null),o=$t(o,l,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&gn(t,e.child,null,i),t.child.memoizedState=ii(i),t.memoizedState=oi,o);if(!(t.mode&1))return Lr(e,t,i,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,o=Error(k(419)),r=mo(o,r,void 0),Lr(e,t,i,r)}if(u=(i&e.childLanes)!==0,pe||u){if(r=b,r!==null){switch(i&-i){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|i)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,tt(e,l),Ie(r,e,l,-1))}return su(),r=mo(Error(k(421))),Lr(e,t,i,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=M0.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,we=vt(l.nextSibling),xe=t,B=!0,Oe=null,e!==null&&(Ce[_e++]=Xe,Ce[_e++]=Je,Ce[_e++]=At,Xe=e.id,Je=e.overflow,At=t),t=nu(t,r.children),t.flags|=4096,t)}function ys(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),bo(e.return,t,n)}function ho(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function Ic(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(ue(e,t,r.children,n),r=V.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ys(e,n,t);else if(e.tag===19)ys(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(D(V,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&cl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ho(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&cl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ho(t,!0,n,null,o);break;case"together":ho(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function nt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Vt|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(k(153));if(t.child!==null){for(e=t.child,n=xt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function x0(e,t,n){switch(t.tag){case 3:Oc(t),vn();break;case 5:sc(t);break;case 1:he(t.type)&&ll(t);break;case 4:Gi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;D(ul,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(D(V,V.current&1),t.flags|=128,null):n&t.child.childLanes?Fc(e,t,n):(D(V,V.current&1),e=nt(e,t,n),e!==null?e.sibling:null);D(V,V.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ic(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),D(V,V.current),r)break;return null;case 22:case 23:return t.lanes=0,zc(e,t,n)}return nt(e,t,n)}var Rc,ui,Dc,$c;Rc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ui=function(){};Dc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Rt(We.current);var o=null;switch(n){case"input":l=Po(e,l),r=Po(e,r),o=[];break;case"select":l=W({},l,{value:void 0}),r=W({},r,{value:void 0}),o=[];break;case"textarea":l=Mo(e,l),r=Mo(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=nl)}Fo(n,r);var i;n=null;for(a in l)if(!r.hasOwnProperty(a)&&l.hasOwnProperty(a)&&l[a]!=null)if(a==="style"){var u=l[a];for(i in u)u.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Qn.hasOwnProperty(a)?o||(o=[]):(o=o||[]).push(a,null));for(a in r){var s=r[a];if(u=l!=null?l[a]:void 0,r.hasOwnProperty(a)&&s!==u&&(s!=null||u!=null))if(a==="style")if(u){for(i in u)!u.hasOwnProperty(i)||s&&s.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in s)s.hasOwnProperty(i)&&u[i]!==s[i]&&(n||(n={}),n[i]=s[i])}else n||(o||(o=[]),o.push(a,n)),n=s;else a==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,u=u?u.__html:void 0,s!=null&&u!==s&&(o=o||[]).push(a,s)):a==="children"?typeof s!="string"&&typeof s!="number"||(o=o||[]).push(a,""+s):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(Qn.hasOwnProperty(a)?(s!=null&&a==="onScroll"&&U("scroll",e),o||u===s||(o=[])):(o=o||[]).push(a,s))}n&&(o=o||[]).push("style",n);var a=o;(t.updateQueue=a)&&(t.flags|=4)}};$c=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ln(e,t){if(!B)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function le(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function k0(e,t,n){var r=t.pendingProps;switch(Bi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return le(t),null;case 1:return he(t.type)&&rl(),le(t),null;case 3:return r=t.stateNode,yn(),A(me),A(ie),Xi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Tr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oe!==null&&(hi(Oe),Oe=null))),ui(e,t),le(t),null;case 5:Yi(t);var l=Rt(rr.current);if(n=t.type,e!==null&&t.stateNode!=null)Dc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(k(166));return le(t),null}if(e=Rt(We.current),Tr(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Be]=t,r[tr]=o,e=(t.mode&1)!==0,n){case"dialog":U("cancel",r),U("close",r);break;case"iframe":case"object":case"embed":U("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Be]=t,e[tr]=r,Rc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Io(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lxn&&(t.flags|=128,r=!0,Ln(o,!1),t.lanes=4194304)}else{if(!r)if(e=cl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ln(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!B)return le(t),null}else 2*G()-o.renderingStartTime>xn&&n!==1073741824&&(t.flags|=128,r=!0,Ln(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=G(),t.sibling=null,n=V.current,D(V,r?n&1|2:n&1),t):(le(t),null);case 22:case 23:return uu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ye&1073741824&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function S0(e,t){switch(Bi(t),t.tag){case 1:return he(t.type)&&rl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),A(me),A(ie),Xi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yi(t),null;case 13:if(A(V),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return A(V),null;case 4:return yn(),null;case 10:return Qi(t.type._context),null;case 22:case 23:return uu(),null;case 24:return null;default:return null}}var zr=!1,oe=!1,E0=typeof WeakSet=="function"?WeakSet:Set,T=null;function on(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Q(e,t,r)}else n.current=null}function si(e,t,n){try{n()}catch(r){Q(e,t,r)}}var ws=!1;function C0(e,t){if(Qo=br,e=Va(),Ui(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,v=0,h=e,m=null;t:for(;;){for(var w;h!==n||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(w=h.firstChild)!==null;)m=h,h=w;for(;;){if(h===e)break t;if(m===n&&++a===l&&(u=i),m===o&&++v===r&&(s=i),(w=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=w}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ko={focusedElem:e,selectionRange:n},br=!1,T=t;T!==null;)if(t=T,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,T=e;else for(;T!==null;){t=T;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var S=g.memoizedProps,L=g.memoizedState,d=t.stateNode,f=d.getSnapshotBeforeUpdate(t.elementType===t.type?S:ze(t.type,S),L);d.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(x){Q(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,T=e;break}T=t.return}return g=ws,ws=!1,g}function Vn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&si(t,n,o)}l=l.next}while(l!==r)}}function Pl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ai(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Uc(e){var t=e.alternate;t!==null&&(e.alternate=null,Uc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[tr],delete t[Yo],delete t[i0],delete t[u0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ac(e){return e.tag===5||e.tag===3||e.tag===4}function xs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ac(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ci(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=nl));else if(r!==4&&(e=e.child,e!==null))for(ci(e,t,n),e=e.sibling;e!==null;)ci(e,t,n),e=e.sibling}function fi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(fi(e,t,n),e=e.sibling;e!==null;)fi(e,t,n),e=e.sibling}var ee=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)Bc(e,t,n),n=n.sibling}function Bc(e,t,n){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(kl,n)}catch{}switch(n.tag){case 5:oe||on(n,t);case 6:var r=ee,l=Me;ee=null,ot(e,t,n),ee=r,Me=l,ee!==null&&(Me?(e=ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ee.removeChild(n.stateNode));break;case 18:ee!==null&&(Me?(e=ee,n=n.stateNode,e.nodeType===8?uo(e.parentNode,n):e.nodeType===1&&uo(e,n),Xn(e)):uo(ee,n.stateNode));break;case 4:r=ee,l=Me,ee=n.stateNode.containerInfo,Me=!0,ot(e,t,n),ee=r,Me=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&si(n,t,i),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!oe&&(on(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){Q(n,t,u)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,ot(e,t,n),oe=r):ot(e,t,n);break;default:ot(e,t,n)}}function ks(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new E0),t.forEach(function(r){var l=O0.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Le(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=G()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*j0(r/1960))-r,10e?16:e,ft===null)var r=!1;else{if(e=ft,ft=null,hl=0,F&6)throw Error(k(331));var l=F;for(F|=4,T=e.current;T!==null;){var o=T,i=o.child;if(T.flags&16){var u=o.deletions;if(u!==null){for(var s=0;sG()-ou?Dt(e,0):lu|=n),ve(e,t)}function Yc(e,t){t===0&&(e.mode&1?(t=Sr,Sr<<=1,!(Sr&130023424)&&(Sr=4194304)):t=1);var n=se();e=tt(e,t),e!==null&&(ar(e,t,n),ve(e,n))}function M0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yc(e,n)}function O0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),Yc(e,n)}var Xc;Xc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pe=!1,x0(e,t,n);pe=!!(e.flags&131072)}else pe=!1,B&&t.flags&1048576&&ba(t,il,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hr(e,t),e=t.pendingProps;var l=hn(t,ie.current);dn(t,n),l=qi(null,t,r,e,l,n);var o=bi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,he(r)?(o=!0,ll(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Zi(t),l.updater=Nl,t.stateNode=l,l._reactInternals=t,ti(t,r,e,n),t=li(null,t,r,!0,o,n)):(t.tag=0,B&&o&&Ai(t),ue(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=I0(r),e=ze(r,e),l){case 0:t=ri(null,t,r,e,n);break e;case 1:t=vs(null,t,r,e,n);break e;case 11:t=ms(null,t,r,e,n);break e;case 14:t=hs(null,t,r,ze(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ri(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),vs(e,t,r,l,n);case 3:e:{if(Oc(t),e===null)throw Error(k(387));r=t.pendingProps,o=t.memoizedState,l=o.element,rc(e,t),al(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=wn(Error(k(423)),t),t=gs(e,t,r,n,l);break e}else if(r!==l){l=wn(Error(k(424)),t),t=gs(e,t,r,n,l);break e}else for(we=vt(t.stateNode.containerInfo.firstChild),xe=t,B=!0,Oe=null,n=uc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=nt(e,t,n);break e}ue(e,t,r,n)}t=t.child}return t;case 5:return sc(t),e===null&&qo(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Zo(r,l)?i=null:o!==null&&Zo(r,o)&&(t.flags|=32),Mc(e,t),ue(e,t,i,n),t.child;case 6:return e===null&&qo(t),null;case 13:return Fc(e,t,n);case 4:return Gi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):ue(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ms(e,t,r,l,n);case 7:return ue(e,t,t.pendingProps,n),t.child;case 8:return ue(e,t,t.pendingProps.children,n),t.child;case 12:return ue(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,D(ul,r._currentValue),r._currentValue=i,o!==null)if(Re(o.value,i)){if(o.children===l.children&&!me.current){t=nt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=qe(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var v=a.pending;v===null?s.next=s:(s.next=v.next,v.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),bo(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(k(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),bo(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ue(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,dn(t,n),l=Te(l),r=r(l),t.flags|=1,ue(e,t,r,n),t.child;case 14:return r=t.type,l=ze(r,t.pendingProps),l=ze(r.type,l),hs(e,t,r,l,n);case 15:return Lc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Hr(e,t),t.tag=1,he(r)?(e=!0,ll(t)):e=!1,dn(t,n),oc(t,r,l),ti(t,r,l,n),li(null,t,r,!0,e,n);case 19:return Ic(e,t,n);case 22:return zc(e,t,n)}throw Error(k(156,t.tag))};function Jc(e,t){return Ea(e,t)}function F0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function je(e,t,n,r){return new F0(e,t,n,r)}function au(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I0(e){if(typeof e=="function")return au(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ti)return 11;if(e===Pi)return 14}return 2}function xt(e,t){var n=e.alternate;return n===null?(n=je(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kr(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")au(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Xt:return $t(n.children,l,o,t);case Ni:i=8,l|=8;break;case _o:return e=je(12,n,t,l|2),e.elementType=_o,e.lanes=o,e;case jo:return e=je(13,n,t,l),e.elementType=jo,e.lanes=o,e;case No:return e=je(19,n,t,l),e.elementType=No,e.lanes=o,e;case ia:return zl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case la:i=10;break e;case oa:i=9;break e;case Ti:i=11;break e;case Pi:i=14;break e;case it:i=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=je(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function $t(e,t,n,r){return e=je(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=je(22,e,r,t),e.elementType=ia,e.lanes=n,e.stateNode={isHidden:!1},e}function vo(e,t,n){return e=je(6,e,null,t),e.lanes=n,e}function go(e,t,n){return t=je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function R0(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xl(0),this.expirationTimes=Xl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,l,o,i,u,s){return e=new R0(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=je(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zi(o),e}function D0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(tf)}catch(e){console.error(e)}}tf(),bs.exports=Se;var nf=bs.exports;const V0=wi(nf);var Ps=nf;Eo.createRoot=Ps.createRoot,Eo.hydrateRoot=Ps.hydrateRoot;const Nt=y.createContext({listTorrents:()=>{throw new Error("Function not implemented.")},getTorrentDetails:()=>{throw new Error("Function not implemented.")},getTorrentStats:()=>{throw new Error("Function not implemented.")},uploadTorrent:()=>{throw new Error("Function not implemented.")},pause:()=>{throw new Error("Function not implemented.")},start:()=>{throw new Error("Function not implemented.")},forget:()=>{throw new Error("Function not implemented.")},delete:()=>{throw new Error("Function not implemented.")},getStreamLogsUrl:()=>null}),pr=y.createContext({setCloseableError:e=>{},refreshTorrents:()=>{}}),rf=y.createContext({refresh:()=>{}}),yl=()=>c.jsxs("div",{role:"status",children:[c.jsxs("svg",{"aria-hidden":"true",className:"inline w-8 h-8 text-gray-200 animate-spin fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),c.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),c.jsx("span",{className:"sr-only",children:"Loading..."})]}),mu="initializing",H0="paused",W0="live",Q0="error";function hu(e,t){let n,r=t;const l=async()=>{if(r=await e(),r==null)throw"asyncCallback returned null or undefined";o()};let o=()=>{n=setTimeout(l,r)};return o(),()=>{clearTimeout(n)}}function lf(e,t){let n;const r=async()=>{await e().then(()=>!1,()=>!0)&&l()};let l=o=>{n=setTimeout(r,o!==void 0?o:t)};return l(0),()=>clearTimeout(n)}var of={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ls=dt.createContext&&dt.createContext(of),kt=globalThis&&globalThis.__assign||function(){return kt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{onClick:t,disabled:n,color:r,children:l,className:o,...i}=e,u=a=>{a.stopPropagation(),!n&&t()},s=r?`text-${r}`:"";return c.jsx("a",{className:`block p-1 ${s} ${o}`,onClick:u,href:"#",...i,children:l})};function J0(e){return fe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M0 .5A.5.5 0 0 1 .5 0h4a.5.5 0 0 1 0 1h-4A.5.5 0 0 1 0 .5Zm0 2A.5.5 0 0 1 .5 2h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm9 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-9 2A.5.5 0 0 1 .5 4h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm5 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm-12 2A.5.5 0 0 1 .5 6h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm8 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-8 2A.5.5 0 0 1 .5 8h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm-7 2a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1h-8a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5Z"}}]})(e)}function sf(e){return fe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}}]})(e)}const q0=({title:e,children:t,onClose:n})=>c.jsxs("div",{className:"bg-red-200 p-3 rounded-md mb-3",children:[c.jsxs("div",{className:"flex justify-between mb-2",children:[c.jsx("h2",{className:"text-lg font-semibold",children:e}),n&&c.jsx("button",{onClick:n,children:c.jsx(sf,{})})]}),t]}),Wt=e=>{var r,l,o;let{error:t,remove:n}=e;return t==null?null:c.jsxs(q0,{onClose:n,title:t.text,children:[((r=t.details)==null?void 0:r.statusText)&&c.jsx("div",{className:"pb-2 text-md",children:(l=t.details)==null?void 0:l.statusText}),c.jsx("div",{className:"whitespace-pre text-sm",children:(o=t.details)==null?void 0:o.text})]})};function vu(e){return e&&e.ownerDocument||document}function yo(e){e===void 0&&(e=vu());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function zs(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Rl=!!(typeof window<"u"&&window.document&&window.document.createElement);var vi=!1,gi=!1;try{var wo={get passive(){return vi=!0},get once(){return gi=vi=!0}};Rl&&(window.addEventListener("test",wo,wo),window.removeEventListener("test",wo,!0))}catch{}function b0(e,t,n,r){if(r&&typeof r!="boolean"&&!gi){var l=r.once,o=r.capture,i=n;!gi&&l&&(i=n.__once||function u(s){this.removeEventListener(t,u,o),n.call(this,s)},n.__once=i),e.addEventListener(t,i,vi?r:o)}e.addEventListener(t,n,r)}function e1(e,t,n,r){var l=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,l),n.__once&&e.removeEventListener(t,n.__once,l)}function Ms(e,t,n,r){return b0(e,t,n,r),function(){e1(e,t,n,r)}}function t1(){const e=y.useRef(!0),t=y.useRef(()=>e.current);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function n1(e){const t=y.useRef(e);return t.current=e,t}function r1(e){const t=n1(e);y.useEffect(()=>()=>t.current(),[])}function l1(e){const t=y.useRef(null);return y.useEffect(()=>{t.current=e}),t.current}function o1(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e},[e]),t}function Ot(e){const t=o1(e);return y.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function i1(e){var t=vu(e);return t&&t.defaultView||window}function u1(e,t){return i1(e).getComputedStyle(e,t)}var s1=/([A-Z])/g;function a1(e){return e.replace(s1,"-$1").toLowerCase()}var c1=/^ms-/;function Fr(e){return a1(e).replace(c1,"-ms-")}var f1=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function d1(e){return!!(e&&f1.test(e))}function Os(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Fr(t))||u1(e).getPropertyValue(Fr(t));Object.keys(t).forEach(function(l){var o=t[l];!o&&o!==0?e.style.removeProperty(Fr(l)):d1(l)?r+=l+"("+o+") ":n+=Fr(l)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const p1="data-rr-ui-";function m1(e){return`${p1}${e}`}function h1(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const Fs=m1("modal-open");class v1{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return h1(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},r=this.isRTL?"paddingLeft":"paddingRight",l=this.getElement();t.style={overflow:l.style.overflow,[r]:l.style[r]},t.scrollBarWidth&&(n[r]=`${parseInt(Os(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(Fs,""),Os(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Fs),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const af=v1,cf=y.createContext(Rl?window:void 0);cf.Provider;function gu(){return y.useContext(cf)}const xo=(e,t)=>Rl?e==null?(t||vu()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function g1(e,t){const n=gu(),[r,l]=y.useState(()=>xo(e,n==null?void 0:n.document));if(!r){const o=xo(e);o&&l(o)}return y.useEffect(()=>{t&&r&&t(r)},[t,r]),y.useEffect(()=>{const o=xo(e);o!==r&&l(o)},[e,r]),r}const Is=e=>!e||typeof e=="function"?e:t=>{e.current=t};function y1(e,t){const n=Is(e),r=Is(t);return l=>{n&&n(l),r&&r(l)}}function ff(e,t){return y.useMemo(()=>y1(e,t),[e,t])}const w1=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",x1=typeof document<"u",Rs=x1||w1?y.useLayoutEffect:y.useEffect;function k1({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const o=y.useRef(null),i=y.useRef(t),u=Ot(n);y.useEffect(()=>{t?i.current=!0:u(o.current)},[t,u]);const s=ff(o,e.ref),a=y.cloneElement(e,{ref:s});return t?a:l||!i.current&&r?null:a}function S1({in:e,onTransition:t}){const n=y.useRef(null),r=y.useRef(!0),l=Ot(t);return Rs(()=>{if(!n.current)return;let o=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>o}),()=>{o=!0}},[e,l]),Rs(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function E1({children:e,in:t,onExited:n,onEntered:r,transition:l}){const[o,i]=y.useState(!t);t&&o&&i(!1);const u=S1({in:!!t,onTransition:a=>{const v=()=>{a.isStale()||(a.in?r==null||r(a.element,a.initial):(i(!0),n==null||n(a.element)))};Promise.resolve(l(a)).then(v,h=>{throw a.in||i(!0),h})}}),s=ff(u,e.ref);return o&&!t?null:y.cloneElement(e,{ref:s})}function Ds(e,t,n){return e?c.jsx(e,Object.assign({},n)):t?c.jsx(E1,Object.assign({},n,{transition:t})):c.jsx(k1,Object.assign({},n))}function C1(e){return e.code==="Escape"||e.keyCode===27}const _1=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function j1(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o=0)&&(n[l]=e[l]);return n}let ko;function N1(e){return ko||(ko=new af({ownerDocument:e==null?void 0:e.document})),ko}function T1(e){const t=gu(),n=e||N1(t),r=y.useRef({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:y.useCallback(l=>{r.current.dialog=l},[]),setBackdropRef:y.useCallback(l=>{r.current.backdrop=l},[])})}const df=y.forwardRef((e,t)=>{let{show:n=!1,role:r="dialog",className:l,style:o,children:i,backdrop:u=!0,keyboard:s=!0,onBackdropClick:a,onEscapeKeyDown:v,transition:h,runTransition:m,backdropTransition:w,runBackdropTransition:g,autoFocus:S=!0,enforceFocus:L=!0,restoreFocus:d=!0,restoreFocusOptions:f,renderDialog:p,renderBackdrop:x=Z=>c.jsx("div",Object.assign({},Z)),manager:N,container:E,onShow:C,onHide:j=()=>{},onExit:R,onExited:M,onExiting:ge,onEnter:Tt,onEntering:Pt,onEntered:mr}=e,Al=j1(e,_1);const De=gu(),lt=g1(E),_=T1(N),P=t1(),z=l1(n),[$,K]=y.useState(!n),Qe=y.useRef(null);y.useImperativeHandle(t,()=>_,[_]),Rl&&!z&&n&&(Qe.current=yo(De==null?void 0:De.document)),n&&$&&K(!1);const $e=Ot(()=>{if(_.add(),Vl.current=Ms(document,"keydown",vf),Bl.current=Ms(document,"focus",()=>setTimeout(Ke),!0),C&&C(),S){var Z,xu;const Wl=yo((Z=(xu=_.dialog)==null?void 0:xu.ownerDocument)!=null?Z:De==null?void 0:De.document);_.dialog&&Wl&&!zs(_.dialog,Wl)&&(Qe.current=Wl,_.dialog.focus())}}),Lt=Ot(()=>{if(_.remove(),Vl.current==null||Vl.current(),Bl.current==null||Bl.current(),d){var Z;(Z=Qe.current)==null||Z.focus==null||Z.focus(f),Qe.current=null}});y.useEffect(()=>{!n||!lt||$e()},[n,lt,$e]),y.useEffect(()=>{$&&Lt()},[$,Lt]),r1(()=>{Lt()});const Ke=Ot(()=>{if(!L||!P()||!_.isTopModal())return;const Z=yo(De==null?void 0:De.document);_.dialog&&Z&&!zs(_.dialog,Z)&&_.dialog.focus()}),Zt=Ot(Z=>{Z.target===Z.currentTarget&&(a==null||a(Z),u===!0&&j())}),vf=Ot(Z=>{s&&C1(Z)&&_.isTopModal()&&(v==null||v(Z),Z.defaultPrevented||j())}),Bl=y.useRef(),Vl=y.useRef(),gf=(...Z)=>{K(!0),M==null||M(...Z)};if(!lt)return null;const wu=Object.assign({role:r,ref:_.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},Al,{style:o,className:l,tabIndex:-1});let Hl=p?p(wu):c.jsx("div",Object.assign({},wu,{children:y.cloneElement(i,{role:"document"})}));Hl=Ds(h,m,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:R,onExiting:ge,onExited:gf,onEnter:Tt,onEntering:Pt,onEntered:mr,children:Hl});let hr=null;return u&&(hr=x({ref:_.setBackdropRef,onClick:Zt}),hr=Ds(w,g,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:hr})),c.jsx(c.Fragment,{children:V0.createPortal(c.jsxs(c.Fragment,{children:[hr,Hl]}),lt)})});df.displayName="Modal";const P1=Object.assign(df,{Manager:af}),L1=({onClose:e,title:t})=>c.jsxs("div",{className:"flex p-3 justify-between items-center border-b",children:[c.jsx("h2",{className:"text-xl font-semibold",children:t}),e&&c.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:e,"aria-label":"Close modal",children:c.jsx(sf,{className:"w-5 h-5"})})]}),Dl=({isOpen:e,onClose:t,title:n,children:r,className:l})=>{const o=()=>c.jsx("div",{className:"fixed inset-0 bg-black/30 z-[300]"});return c.jsx(P1,{show:e,onHide:t,renderBackdrop:o,className:"fixed z-[301] top-0 left-0 w-full h-full block overflow-x-hidden overflow-y-auto",children:c.jsxs("div",{className:`bg-white shadow-lg my-8 mx-auto max-w-2xl rounded ${l}`,children:[c.jsx(L1,{onClose:t,title:n}),r]})})},$l=({children:e})=>c.jsx("div",{className:"p-3 border-b",children:e}),Ul=({children:e,className:t})=>c.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),Ve=({onClick:e,children:t,className:n,disabled:r,variant:l})=>{let o={secondary:"hover:bg-blue-600 transition-colors duration-100 hover:text-white",danger:"bg-red-500 text-white border-green-50 hover:border-red-700 hover:bg-red-600",primary:"bg-blue-400 text-white hover:bg-blue-600",cancel:"bg-slate-50 hover:bg-slate-200",none:""}[l??"secondary"];return c.jsx("button",{disabled:r,onClick:i=>{i.preventDefault(),e(i)},className:`flex inline-flex items-center gap-1 border rounded-lg border disabled:cursor-not-allowed px-2 py-1 transition-colors duration-300 ${o} ${n}`,children:t})},z1=({id:e,show:t,onHide:n})=>{if(!t)return null;const[r,l]=y.useState(!1),[o,i]=y.useState(null),[u,s]=y.useState(!1),a=y.useContext(pr),v=y.useContext(Nt),h=()=>{l(!1),i(null),s(!1),n()},m=()=>{s(!0),(r?v.delete:v.forget)(e).then(()=>{a.refreshTorrents(),h()}).catch(g=>{i({text:`Error deleting torrent id=${e}`,details:g}),s(!1)})};return c.jsxs(Dl,{isOpen:t,onClose:n,title:"Delete torrent",children:[c.jsxs($l,{children:[c.jsx("p",{className:"text-gray-700",children:"Are you sure you want to delete the torrent?"}),c.jsxs("div",{className:"mt-4 flex items-center",children:[c.jsx("input",{type:"checkbox",id:"deleteFiles",className:"form-checkbox h-4 w-4 text-blue-500",onChange:()=>l(!r),checked:r,placeholder:"Also delete files"}),c.jsx("label",{htmlFor:"deleteFiles",className:"ml-2 text-gray-700",children:"Also delete files"})]}),o&&c.jsx(Wt,{error:o})]}),c.jsxs(Ul,{children:[u&&c.jsx(yl,{}),c.jsx(Ve,{variant:"cancel",onClick:h,children:"Cancel"}),c.jsx(Ve,{variant:"danger",onClick:m,disabled:u,children:"Delete Torrent"})]})]})};function M1(e){return fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function O1(e){return fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function F1(e){return fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}const I1=({id:e,statsResponse:t})=>{let n=t.state,[r,l]=y.useState(!1),[o,i]=y.useState(!1),u=y.useContext(rf);const s=n=="live",a=n=="paused"||n=="error",v=y.useContext(pr),h=y.useContext(Nt),m=()=>{l(!0),h.start(e).then(()=>{u.refresh()},L=>{v.setCloseableError({text:`Error starting torrent id=${e}`,details:L})}).finally(()=>l(!1))},w=()=>{l(!0),h.pause(e).then(()=>{u.refresh()},L=>{v.setCloseableError({text:`Error pausing torrent id=${e}`,details:L})}).finally(()=>l(!1))},g=()=>{l(!0),i(!0)},S=()=>{l(!1),i(!1)};return c.jsxs("div",{className:"flex w-full justify-center gap-2",children:[a&&c.jsx(Zr,{onClick:m,disabled:r,children:c.jsx(O1,{className:"hover:text-green-500 transition-colors duration-300"})}),s&&c.jsx(Zr,{onClick:w,disabled:r,children:c.jsx(M1,{className:"hover:text-yellow-500 transition-colors duration-300"})}),c.jsx(Zr,{onClick:g,disabled:r,children:c.jsx(F1,{className:"hover:text-red-500 transition-colors duration-500"})}),c.jsx(z1,{id:e,show:o,onHide:S})]})},R1=({now:e,variant:t,label:n})=>{const r=n??`${e.toFixed(2)}%`,l={warn:"bg-yellow-500",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"}[t??"info"];return c.jsx("div",{className:"w-full bg-gray-200 rounded-full",children:c.jsx("div",{className:`text-xs bg-blue-500 font-medium transition-all text-center p-0.5 leading-none rounded-full ${l}`,style:{width:`${e}%`},children:r})})};function wl(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const D1=({statsResponse:e})=>{var t,n;switch(e.state){case H0:return"Paused";case mu:return"Checking files";case Q0:return"Error"}return e.state!="live"||e.live===null?e.state:c.jsxs(c.Fragment,{children:[!e.finished&&c.jsxs("div",{className:"download-speed",children:["↓ ",(t=e.live.download_speed)==null?void 0:t.human_readable]}),c.jsxs("div",{className:"upload-speed",children:["↑ ",(n=e.live.upload_speed)==null?void 0:n.human_readable,e.live.snapshot.uploaded_bytes>0&&c.jsxs("span",{children:["(",wl(e.live.snapshot.uploaded_bytes),")"]})]})]})};function $1(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function U1(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,l=(o,i)=>o>0?`${o}${i}`:"";return t>0?`${l(t,"h")} ${l(n,"m")}`.trim():n>0?`${l(n,"m")} ${l(r,"s")}`.trim():`${l(r,"s")}`.trim()}function A1(e){var n,r,l;let t=(l=(r=(n=e==null?void 0:e.live)==null?void 0:n.time_remaining)==null?void 0:r.duration)==null?void 0:l.secs;return t==null?"N/A":U1(t)}function B1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}}]})(e)}function V1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}}]})(e)}function H1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}}]})(e)}function W1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}}]})(e)}function Q1(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12c0-1.19.22-2.32.6-3.38l1.88.68C4.17 10.14 4 11.05 4 12c0 4.41 3.59 8 8 8s8-3.59 8-8-3.59-8-8-8c-.95 0-1.85.17-2.69.48l-.68-1.89C9.69 2.22 10.82 2 12 2c5.52 0 10 4.48 10 10zM5.5 4C4.67 4 4 4.67 4 5.5S4.67 7 5.5 7 7 6.33 7 5.5 6.33 4 5.5 4zM11 16V8H9v8h2zm4 0V8h-2v8h2z"}}]})(e)}const K1=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?c.jsx(V1,{className:e,color:"red"}):l?c.jsx(W1,{className:e,color:"green"}):t?c.jsx(B1,{className:e,color:"green"}):n?c.jsx(H1,{className:`text-blue-500 ${e}`}):c.jsx(Q1,{className:e})},Z1=({id:e,detailsResponse:t,statsResponse:n})=>{const r=(n==null?void 0:n.state)??"",l=(n==null?void 0:n.error)??null,o=(n==null?void 0:n.total_bytes)??1,i=(n==null?void 0:n.progress_bytes)??0,u=(n==null?void 0:n.finished)||!1,s=l?100:i/o*100,a=()=>{var m;let h=(m=n==null?void 0:n.live)==null?void 0:m.snapshot.peer_stats;return h?`${h.live} / ${h.seen}`:""},v=h=>c.jsx(K1,{className:h,error:!!l,live:!!(n!=null&&n.live),finished:u});return c.jsxs("section",{className:"flex flex-col sm:flex-row items-center gap-2 border p-2 border-gray-200 rounded-xl shadow-xs hover:drop-shadow-sm",children:[c.jsx("div",{className:"hidden md:block",children:v("w-10 h-10")}),c.jsxs("div",{className:"w-full flex flex-col gap-2",children:[t&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"md:hidden",children:v("w-5 h-5")}),c.jsx("div",{className:"text-left text-lg text-gray-900 text-ellipsis break-all",children:$1(t)})]}),l?c.jsxs("p",{className:"text-red-500 text-sm",children:[c.jsx("strong",{children:"Error:"})," ",l]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{children:c.jsx(R1,{now:s,label:l,variant:r==mu?"warn":u?"success":"info"})}),c.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 sm:flex-wrap items-center text-sm text-nowrap font-medium text-gray-500",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(X0,{})," ",a().toString()]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(Y0,{}),c.jsxs("div",{children:[wl(i),"/",wl(o)]})]}),n&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(G0,{}),A1(n)]}),c.jsx("div",{className:"flex gap-2 items-center",children:c.jsx(D1,{statsResponse:n})})]})]})]})]}),n&&c.jsx("div",{className:"",children:c.jsx(I1,{id:e,statsResponse:n})})]})},G1=({id:e,torrent:t})=>{const[n,r]=y.useState(null),[l,o]=y.useState(null),[i,u]=y.useState(0),s=y.useContext(Nt),a=()=>{u(i+1)};return y.useEffect(()=>{if(n===null)return lf(async()=>{await s.getTorrentDetails(t.id).then(r)},1e3)},[n]),y.useEffect(()=>hu(async()=>s.getTorrentStats(t.id).then(w=>(o(w),w)).then(w=>w.state==mu||w.state==W0?1e3:1e4,()=>1e4),0),[i]),c.jsx(rf.Provider,{value:{refresh:a},children:c.jsx(Z1,{id:e,detailsResponse:n,statsResponse:l})})},Y1=e=>{if(e.torrents===null&&e.loading)return c.jsx(yl,{});if(e.torrents!==null)return e.torrents.length===0?c.jsx("div",{className:"text-center",children:c.jsx("p",{children:"No existing torrents found."})}):c.jsx("div",{className:"flex flex-col gap-2 mx-2",children:e.torrents.map(t=>c.jsx(G1,{id:t.id,torrent:t},t.id))})},X1=e=>{let t=y.useContext(pr);return c.jsxs("div",{className:"container mx-auto",children:[c.jsx(Wt,{error:e.closeableError,remove:()=>t.setCloseableError(null)}),c.jsx(Wt,{error:e.otherError}),c.jsx(Y1,{torrents:e.torrents,loading:e.torrentsLoading})]})};var J1="Expected a function",$s=0/0,q1="[object Symbol]",b1=/^\s+|\s+$/g,ep=/^[-+]0x[0-9a-f]+$/i,tp=/^0b[01]+$/i,np=/^0o[0-7]+$/i,rp=parseInt,lp=typeof vr=="object"&&vr&&vr.Object===Object&&vr,op=typeof self=="object"&&self&&self.Object===Object&&self,ip=lp||op||Function("return this")(),up=Object.prototype,sp=up.toString,ap=Math.max,cp=Math.min,So=function(){return ip.Date.now()};function fp(e,t,n){var r,l,o,i,u,s,a=0,v=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(J1);t=Us(t)||0,yi(n)&&(v=!!n.leading,h="maxWait"in n,o=h?ap(Us(n.maxWait)||0,t):o,m="trailing"in n?!!n.trailing:m);function w(E){var C=r,j=l;return r=l=void 0,a=E,i=e.apply(j,C),i}function g(E){return a=E,u=setTimeout(d,t),v?w(E):i}function S(E){var C=E-s,j=E-a,R=t-C;return h?cp(R,o-j):R}function L(E){var C=E-s,j=E-a;return s===void 0||C>=t||C<0||h&&j>=o}function d(){var E=So();if(L(E))return f(E);u=setTimeout(d,S(E))}function f(E){return u=void 0,m&&r?w(E):(r=l=void 0,i)}function p(){u!==void 0&&clearTimeout(u),a=0,r=s=l=u=void 0}function x(){return u===void 0?i:f(So())}function N(){var E=So(),C=L(E);if(r=arguments,l=this,s=E,C){if(u===void 0)return g(s);if(h)return u=setTimeout(d,t),w(s)}return u===void 0&&(u=setTimeout(d,t)),i}return N.cancel=p,N.flush=x,N}function yi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function dp(e){return!!e&&typeof e=="object"}function pp(e){return typeof e=="symbol"||dp(e)&&sp.call(e)==q1}function Us(e){if(typeof e=="number")return e;if(pp(e))return $s;if(yi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=yi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(b1,"");var n=tp.test(e);return n||np.test(e)?rp(e.slice(2),n?2:8):ep.test(e)?$s:+e}var mp=fp;const hp=wi(mp),vp=({span:e})=>{let t=Object.entries(e).filter(([n,r])=>n!="name");return t.length==0?null:c.jsxs(c.Fragment,{children:["{",t.map(([n,r])=>c.jsxs("span",{children:[n," = ",r]},n)).reduce((n,r)=>c.jsxs(c.Fragment,{children:[n,", ",r]})),"}"]})},gp=({span:e})=>c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"font-bold",children:e.name}),c.jsx(vp,{span:e})]}),yp=({fields:e})=>c.jsxs("span",{className:`m-1 ${e.message.match(/error|fail/g)?"text-red-500":"text-slate-500"}`,children:[e.message,Object.entries(e).filter(([t,n])=>t!="message").map(([t,n])=>c.jsxs("span",{className:"m-1",children:[c.jsx("span",{className:"italic font-bold",children:t}),"=",n]},t))]}),wp=dt.memo(({line:e})=>{var r;const t=e,n=l=>{switch(l){case"DEBUG":return"text-blue-500";case"INFO":return"text-green-500";case"WARN":return"text-amber-500";case"ERROR":return"text-red-500";default:return"text-slate-500"}};return c.jsxs("p",{className:"font-mono m-0 text-break text-[10px]",children:[c.jsx("span",{className:"m-1 text-slate-500",children:t.timestamp}),c.jsx("span",{className:`m-1 ${n(t.level)}`,children:t.level}),c.jsx("span",{className:"m-1",children:(r=t.spans)==null?void 0:r.map((l,o)=>c.jsx(gp,{span:l},o))}),c.jsx("span",{className:"m-1 text-slate-500",children:t.target}),c.jsx(yp,{fields:t.fields})]})}),pf=({children:e})=>c.jsx("form",{children:e}),yu=({autoFocus:e,value:t,name:n,disabled:r,onChange:l,label:o,help:i,inputType:u,placeholder:s})=>c.jsxs("div",{className:"flex flex-col gap-2 text-sm mb-6",children:[c.jsx("label",{htmlFor:n,children:o}),c.jsx("input",{autoFocus:e,type:u,className:"block border rounded bg-transparent py-1.5 pl-2 text-gray-800 focus:ring-0 sm:text-sm sm:leading-6",id:n,name:n,disabled:r,placeholder:s,value:t,onChange:l}),i&&c.jsx("div",{className:"text-xs text-slate-500 mb-3",children:i})]}),xp=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},kp=(e,t,n)=>{const r=new AbortController,l=r.signal;let o=!1;const i=()=>{console.log("cancelling fetch"),o=!0,r.abort()},u=async()=>{let a=await fetch(e,{signal:l});if(!a.ok){let m=await a.text();throw n({text:"error fetching logs",details:{statusText:a.statusText,text:m}}),null}if(!a.body){n({text:"error fetching logs: ReadableStream not supported."});return}n(null);const v=a.body.getReader();let h=new Uint8Array;for(;;){const{done:m,value:w}=await v.read();if(m)throw n({text:"log stream terminated"}),null;h=xp(h,w);for(let g;(g=h.indexOf(10))!==-1;){let S=h.slice(0,g),L=new TextDecoder().decode(S);t(L),h=h.slice(g+1)}}};let s=lf(()=>u().then(()=>{},a=>{if(!o&&a!==null)throw n({text:"error streaming logs",details:{text:a.toString()}}),a}),1e3);return()=>{i(),s()}},Sp=({url:e,maxLines:t})=>{const[n,r]=y.useState([]),[l,o]=y.useState(null),[i,u]=y.useState(""),s=y.useRef(null),a=t??1e3,v=y.useCallback(g=>{r(S=>[{id:S.length==0?0:S[0].id+1,content:g,parsed:JSON.parse(g),show:s.current?!!g.match(s.current):!0},...S.slice(0,a-1)])},[s.current,t]),h=y.useRef(v);h.current=v;const m=hp(g=>{let S=null;try{S=new RegExp(g)}catch{return}s.current=S,r(L=>{let d=[...L];for(let f of d)f.show=!!f.content.match(S);return d})},200),w=g=>{u(g),m(g)};return y.useEffect(()=>m.cancel,[]),y.useEffect(()=>kp(e,g=>h.current(g),o),[e]),c.jsxs("div",{children:[c.jsx(Wt,{error:l}),c.jsxs("div",{className:"mb-3",children:["Showing last ",a," logs since this window was opened"]}),c.jsx(pf,{children:c.jsx(yu,{value:i,name:"filter",placeholder:"Enter filter (regex)",onChange:g=>w(g.target.value)})}),n.map(g=>c.jsx("div",{hidden:!g.show,children:c.jsx(wp,{line:g.parsed})},g.id))]})},Ep=({show:e,onClose:t})=>{let r=y.useContext(Nt).getStreamLogsUrl();return c.jsxs(Dl,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[c.jsx($l,{children:r?c.jsx(Sp,{url:r}):c.jsx(Wt,{error:{text:"HTTP API not available to stream logs"}})}),c.jsx(Ul,{children:c.jsx(Ve,{variant:"primary",onClick:t,children:"Close"})})]})},As=({checked:e,name:t,disabled:n,onChange:r,label:l,help:o,inputType:i})=>c.jsxs("div",{className:"flex gap-3 items-start",children:[c.jsx("div",{className:"flex",children:c.jsx("input",{type:i||"checkbox",className:"block mt-1",id:t,name:t,disabled:n,checked:e,onChange:r})}),c.jsxs("div",{className:"text-sm flex flex-col gap-1",children:[c.jsx("label",{htmlFor:t,children:l}),o&&c.jsx("div",{className:"text-xs text-slate-500 mb-3",children:o})]})]}),Bs=({children:e,label:t,help:n,className:r})=>c.jsxs("fieldset",{className:`mb-4 ${r}`,children:[c.jsx("label",{className:"text-md font-md mb-3 block",children:t}),e]}),Cp=e=>{let{onHide:t,listTorrentResponse:n,listTorrentError:r,listTorrentLoading:l,data:o}=e;const[i,u]=y.useState([]),[s,a]=y.useState(!1),[v,h]=y.useState(null),[m,w]=y.useState(!1),[g,S]=y.useState(""),L=y.useContext(pr),d=y.useContext(Nt),f=()=>{u(n?n.details.files.map((C,j)=>j):[])};y.useEffect(()=>{console.log(n),f(),S((n==null?void 0:n.output_folder)||"")},[n]);const p=()=>{t(),u([]),h(null),a(!1)},x=C=>{i.includes(C)?u(i.filter(j=>j!==C)):u([...i,C])},N=async()=>{if(!n)return;a(!0);let C=n.seen_peers?n.seen_peers.slice(0,32):null,j={overwrite:!0,only_files:i,initial_peers:C,output_folder:g};m&&(j.peer_opts={connect_timeout:20,read_write_timeout:60}),d.uploadTorrent(o,j).then(()=>{t(),L.refreshTorrents()},R=>{h({text:"Error starting torrent",details:R})}).finally(()=>a(!1))},E=()=>{if(l)return c.jsx(yl,{});if(r)return c.jsx(Wt,{error:r});if(n)return c.jsxs(pf,{children:[c.jsxs(Bs,{className:"mb-4",label:"Pick the files to download",children:[c.jsxs("div",{className:"mb-3 flex gap-2",children:[c.jsx(Ve,{onClick:f,className:"text-sm",children:"Select all"}),c.jsx(Ve,{onClick:()=>u([]),className:"text-sm",children:"Deselect all"})]}),n.details.files.map((C,j)=>c.jsx(As,{label:`${C.name} (${wl(C.length)})`,checked:i.includes(j),onChange:()=>x(j),name:`check-${j}`},j))]}),c.jsxs(Bs,{label:"Options",children:[c.jsx(yu,{label:"Output folder",name:"output_folder",inputType:"text",value:g,onChange:C=>S(C.target.value)}),c.jsx(As,{label:"Increase timeouts",checked:m,onChange:()=>w(!m),help:"This might be useful for unpopular torrents with few peers. It will slow down fast torrents though.",name:"increase_timeouts"})]})]})};return c.jsxs(Dl,{isOpen:!0,onClose:p,title:"Add Torrent",children:[c.jsxs($l,{children:[E(),c.jsx(Wt,{error:v})]}),c.jsxs(Ul,{children:[s&&c.jsx(yl,{}),c.jsx(Ve,{onClick:p,variant:"cancel",children:"Cancel"}),c.jsx(Ve,{onClick:N,variant:"primary",disabled:l||s||i.length==0,children:"OK"})]})]})},mf=({onClick:e,data:t,resetData:n,children:r,className:l})=>{const[o,i]=y.useState(!1),[u,s]=y.useState(null),[a,v]=y.useState(null),h=y.useContext(Nt);y.useEffect(()=>{if(t===null)return;let w=setTimeout(async()=>{i(!0);try{const g=await h.uploadTorrent(t,{list_only:!0});s(g)}catch(g){v({text:"Error listing torrent files",details:g})}finally{i(!1)}},0);return()=>clearTimeout(w)},[t]);const m=()=>{n(),v(null),s(null),i(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(Ve,{onClick:e,className:l,children:r}),t&&c.jsx(Cp,{onHide:m,listTorrentError:a,listTorrentResponse:u,data:t,listTorrentLoading:o})]})};function _p(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z",fill:"currentColor"}},{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z",fill:"currentColor"}}]})(e)}function jp(e){return fe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M14.8284 12L16.2426 13.4142L19.071 10.5858C20.6331 9.02365 20.6331 6.49099 19.071 4.9289C17.509 3.3668 14.9763 3.3668 13.4142 4.9289L10.5858 7.75732L12 9.17154L14.8284 6.34311C15.6095 5.56206 16.8758 5.56206 17.6568 6.34311C18.4379 7.12416 18.4379 8.39049 17.6568 9.17154L14.8284 12Z",fill:"currentColor"}},{tag:"path",attr:{d:"M12 14.8285L13.4142 16.2427L10.5858 19.0711C9.02372 20.6332 6.49106 20.6332 4.92896 19.0711C3.36686 17.509 3.36686 14.9764 4.92896 13.4143L7.75739 10.5858L9.1716 12L6.34317 14.8285C5.56212 15.6095 5.56212 16.8758 6.34317 17.6569C7.12422 18.4379 8.39055 18.4379 9.1716 17.6569L12 14.8285Z",fill:"currentColor"}},{tag:"path",attr:{d:"M14.8285 10.5857C15.219 10.1952 15.219 9.56199 14.8285 9.17147C14.4379 8.78094 13.8048 8.78094 13.4142 9.17147L9.1716 13.4141C8.78107 13.8046 8.78107 14.4378 9.1716 14.8283C9.56212 15.2188 10.1953 15.2188 10.5858 14.8283L14.8285 10.5857Z",fill:"currentColor"}}]})(e)}const Np=({className:e})=>{const t=y.useRef(),[n,r]=y.useState(null),l=async()=>{var s;if(!((s=t==null?void 0:t.current)!=null&&s.files))return;const u=t.current.files[0];r(u)},o=()=>{t!=null&&t.current&&(t.current.value="",r(null))},i=()=>{t!=null&&t.current&&t.current.click()};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",ref:t,accept:".torrent",onChange:l,hidden:!0}),c.jsxs(mf,{onClick:i,data:n,resetData:o,className:e,children:[c.jsx(_p,{color:"blue"}),c.jsx("div",{children:"Upload .torrent File"})]})]})},Tp=({className:e})=>{const[t,n]=y.useState(null),[r,l]=y.useState(""),[o,i]=y.useState(!1),u=()=>{i(!1),n(null)};return c.jsxs(c.Fragment,{children:[c.jsxs(mf,{onClick:()=>{i(!0)},data:t,className:e,resetData:()=>n(null),children:[c.jsx(jp,{color:"blue"}),c.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),c.jsxs(Dl,{isOpen:o,onClose:u,title:"Add torrent",children:[c.jsx($l,{children:c.jsx(yu,{autoFocus:!0,value:r,name:"magnet",onChange:s=>l(s.target.value),placeholder:"magnet:?xt=urn:btih:...",help:"Enter magnet or HTTP(S) URL to the .torrent"})}),c.jsxs(Ul,{children:[c.jsx(Ve,{variant:"cancel",onClick:u,children:"Cancel"}),c.jsx(Ve,{disabled:!r,variant:"primary",onClick:()=>{n(r),l(""),i(!1)},children:"Add"})]})]})]})},Pp=e=>y.createElement("svg",{width:"64mm",height:"64mm",viewBox:"0 0 64 64",id:"svg1",xmlSpace:"preserve","inkscape:version":"1.3.1 (91b66b0, 2023-11-16)","sodipodi:docname":"logo.svg","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},y.createElement("sodipodi:namedview",{id:"namedview1",pagecolor:"#ffffff",bordercolor:"#000000",borderopacity:.25,"inkscape:showpageshadow":2,"inkscape:pageopacity":0,"inkscape:pagecheckerboard":0,"inkscape:deskcolor":"#d1d1d1","inkscape:document-units":"mm","inkscape:zoom":1.4936372,"inkscape:cx":134.90559,"inkscape:cy":139.92689,"inkscape:window-width":1440,"inkscape:window-height":847,"inkscape:window-x":0,"inkscape:window-y":25,"inkscape:window-maximized":0,"inkscape:current-layer":"layer1"}),y.createElement("defs",{id:"defs1"},y.createElement("inkscape:perspective",{"sodipodi:type":"inkscape:persp3d","inkscape:vp_x":"3.1042448 : 18.147022 : 1","inkscape:vp_y":"0 : 999.99994 : 0","inkscape:vp_z":"303.94612 : 54.05812 : 1","inkscape:persp3d-origin":"105 : -134 : 1",id:"perspective4"})),y.createElement("g",{"inkscape:label":"Layer 1","inkscape:groupmode":"layer",id:"layer1",transform:"translate(-56.674541,-85.911432)"},y.createElement("path",{style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.610041},d:"m 81.603814,145.5382 -7.433116,-4.36986 -6.018097,-3.54529 -6.018099,-3.54529 -0.09405,-0.35761 -0.09406,-0.3576 v -15.31979 -15.31979 l 0.09451,-0.35939 0.09451,-0.35938 6.017643,-3.544433 6.017641,-3.544428 7.432805,-4.369167 7.432803,-4.369166 0.240089,0.09331 0.240083,0.09331 13.292394,7.826122 13.29241,7.826122 0.093,0.35355 0.093,0.35355 v 15.31979 15.31979 l -0.0928,0.35267 -0.0928,0.35266 -13.29682,7.82802 -13.296819,7.82803 -0.235583,0.0921 -0.235588,0.0921 z m 19.758596,-5.88315 12.13185,-7.15306 v -14.45996 -14.45994 l -5.11526,-3.01603 -5.11526,-3.016035 -7.017048,-4.136312 -7.017053,-4.13631 h -0.112738 -0.11273 l -7.097035,4.182089 -7.09703,4.18209 -5.035336,2.971548 -5.035335,2.97155 v 14.45761 14.45762 l 5.275113,3.11051 5.275113,3.11051 6.793709,4.02813 6.793702,4.02812 0.176743,0.0155 0.176742,0.0155 z",id:"path15","sodipodi:nodetypes":"cccccccccccccccccccccccccccccccccccccccccccccccccccc"}),y.createElement("path",{style:{fill:"#000000"},id:"path1",d:""}),y.createElement("path",{d:"m 84.161856,133.76725 -4.567369,-2.5483 -0.700367,0.28585 -0.700376,0.28584 -0.495731,0.11427 -0.495731,0.11426 -3.168791,-1.75603 -3.168782,-1.75603 -0.515321,-0.57002 -0.515323,-0.57002 0.0161,-3.59449 0.0161,-3.59448 0.164041,-0.41611 0.164042,-0.41611 1.480342,-0.85565 1.480346,-0.85565 0.06276,-3.67919 0.06276,-3.67921 0.39653,-0.35884 0.396521,-0.35886 3.663275,-2.04111 3.663267,-2.04112 0.114523,-1.62785 0.114506,-1.62786 0.229029,-0.21764 0.229038,-0.21765 3.341459,-1.854383 3.341467,-1.854382 h 0.301682 0.301682 l 2.476951,1.380374 2.476959,1.380381 1.151673,0.57845 1.151674,0.57845 0.02969,0.27424 0.02969,0.27423 0.02753,1.46272 0.02753,1.46273 3.663258,2.04521 3.66327,2.04521 0.40205,0.36386 0.40206,0.36385 v 3.60098 3.60097 l 0.28629,0.23408 0.28628,0.23408 1.43146,0.72479 1.43145,0.72479 v 3.9806 3.98059 l -0.51533,0.56995 -0.51532,0.56994 -3.19072,1.75191 -3.19072,1.75191 -0.47379,-0.11007 -0.473797,-0.11007 -0.699654,-0.28558 -0.699656,-0.28558 -4.589745,2.5527 -4.589746,2.55269 -0.321886,-0.004 -0.321886,-0.004 z m 8.681258,-1.65766 3.426793,-1.91645 0.06536,-0.19784 0.06535,-0.19785 -1.315884,-0.68709 -1.315885,-0.6871 -0.401264,-0.40081 -0.401265,-0.4008 v -3.79409 -3.79409 l 0.221568,-0.41401 0.221567,-0.414 3.411065,-1.86126 3.411061,-1.86126 h 0.38456 0.38455 l 0.91435,0.46646 0.91435,0.46646 -0.0646,-2.66249 -0.0646,-2.66248 -2.829977,-1.58148 -2.829984,-1.58149 -0.204696,0.12651 -0.204688,0.12651 v 1.11999 1.11999 l -0.744359,0.54975 -0.744358,0.54977 -2.773906,1.52318 -2.773906,1.52319 h -0.526565 -0.526565 l -3.34145,-1.85945 -3.341467,-1.85945 -0.168271,-0.2591 -0.16827,-0.25909 -0.0035,-1.07439 -0.0035,-1.07439 -0.204688,-0.12651 -0.204697,-0.12651 -2.82999,1.58149 -2.829982,1.58148 -0.06458,2.66248 -0.06458,2.66249 0.914351,-0.46646 0.914343,-0.46646 h 0.378551 0.37855 l 3.638639,1.97495 3.63864,1.97495 v 4.0944 4.09441 l -0.401265,0.4008 -0.401264,0.40081 -1.315885,0.6871 -1.315884,0.68709 0.06535,0.19785 0.06536,0.19784 3.426792,1.91645 3.426785,1.91644 h 0.343552 0.343544 z m -16.416873,-5.4431 -0.06475,-2.55838 -2.046125,-1.10985 -2.046124,-1.10984 -0.195677,0.19567 -0.195685,0.19568 0.06596,2.2656 0.06596,2.2656 2.06129,1.18713 2.06129,1.18713 0.179282,0.0198 0.179273,0.0198 z m 4.515881,1.34369 2.061291,-1.19456 0.06527,-2.48747 0.06527,-2.48748 -0.408821,0.15589 -0.408848,0.15589 -1.889514,1.02885 -1.889514,1.02885 v 2.50736 2.50736 l 0.171777,-0.01 0.171767,-0.01 z m 18.666131,-1.29267 v -2.50736 l -1.889509,-1.02885 -1.889522,-1.02885 -0.40883,-0.15589 -0.408839,-0.15589 0.06527,2.48748 0.06527,2.48747 2.061291,1.19456 2.061288,1.19456 0.171777,0.01 0.171774,0.01 z m 4.466127,1.28059 2.06129,-1.18713 0.0661,-2.2656 0.066,-2.2656 -0.19568,-0.19568 -0.19568,-0.19567 -2.04613,1.10984 -2.04612,1.10985 -0.0647,2.55838 -0.0648,2.55838 0.17927,-0.0198 0.17927,-0.0198 z m -24.281888,-6.71835 1.960418,-1.07415 -0.07566,-0.22693 -0.07566,-0.22691 -2.049423,-1.09443 -2.049431,-1.09442 -2.116604,1.14523 -2.116613,1.14523 v 0.17781 0.17782 l 2.004029,1.06709 2.004037,1.06711 0.277236,0.005 0.277237,0.005 z m 23.056528,4.3e-4 2.03643,-1.07372 -0.0708,-0.21245 -0.0708,-0.21244 -2.09332,-1.13015 -2.09332,-1.13016 -2.077692,1.17124 -2.077685,1.17123 v 0.17384 0.17386 l 1.889522,1.0551 1.889505,1.0551 0.31588,0.0161 0.31587,0.0161 z m -14.742004,-11.90808 0.06492,-2.2946 -0.293917,-0.23052 -0.293926,-0.2305 -2.011741,-1.08631 -2.01175,-1.08629 0.06501,2.57478 0.06501,2.57476 1.946776,1.09773 1.946767,1.09773 0.229038,-0.0611 0.229029,-0.0611 z m 4.401245,1.31989 1.946767,-1.09857 0.06501,-2.57476 0.06501,-2.57478 -2.01175,1.08629 -2.011741,1.08631 -0.286291,0.22417 -0.286291,0.22418 v 2.22411 2.2241 l 0.152689,0.15269 0.152689,0.15269 0.133602,-0.0139 0.133602,-0.0139 z m -1.021015,-6.79999 1.952048,-1.05546 -0.224347,-0.26147 -0.224337,-0.26149 -1.958921,-1.03065 -1.958911,-1.03064 -1.958912,1.03064 -1.958912,1.03065 -0.224303,0.26142 -0.224277,0.26141 1.896915,1.04261 1.896906,1.04261 0.517494,0.0129 0.517501,0.0129 z",style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.865634},id:"path1-8"}))),Lp=({title:e})=>{const[t,n]=e.split("-");return c.jsxs("header",{className:"bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center mb-3",children:[c.jsxs("div",{className:"flex flex-nowrap items-center justify-between m-2",children:[c.jsx(Pp,{className:"w-10 h-10 p-1",alt:"logo"}),c.jsxs("h1",{className:"flex items-center",children:[c.jsx("div",{className:"text-3xl",children:t}),c.jsx("div",{className:"bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2",children:n})]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1 m-2",children:[c.jsx(Tp,{className:"flex-grow justify-center"}),c.jsx(Np,{className:"flex-grow justify-center"})]})]})},zp=e=>{const[t,n]=y.useState(null),[r,l]=y.useState(null),[o,i]=y.useState(null),[u,s]=y.useState(!1);let[a,v]=y.useState(!1);const h=y.useContext(Nt),m=async()=>{s(!0);let g=await h.listTorrents().finally(()=>s(!1));i(g.torrents)};y.useEffect(()=>hu(async()=>m().then(()=>(l(null),5e3),g=>(l({text:"Error refreshing torrents",details:g}),console.error(g),5e3)),0),[]);const w={setCloseableError:n,refreshTorrents:m};return c.jsxs(pr.Provider,{value:w,children:[c.jsx(Lp,{title:e.title}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"absolute top-0 start-0 pl-2 z-10",children:[e.menuButtons&&e.menuButtons.map((g,S)=>c.jsx("span",{children:g},S)),c.jsx(Zr,{onClick:()=>v(!0),children:c.jsx(J0,{})})]}),c.jsx(X1,{closeableError:t,otherError:r,torrents:o,torrentsLoading:u})]}),c.jsx(Ep,{show:a,onClose:()=>v(!1)})]})},hf=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",Ze=async(e,t,n)=>{console.log(e,t);const r=hf+t,l={method:e,headers:{Accept:"application/json"},body:n};let o={method:e,path:t,text:""},i;try{i=await fetch(r,l)}catch{return o.text="network error",Promise.reject(o)}if(o.status=i.status,o.statusText=`${i.status} ${i.statusText}`,!i.ok){const s=await i.text();try{const a=JSON.parse(s);o.text=a.human_readable!==void 0?a.human_readable:JSON.stringify(a,null,2)}catch{o.text=s}return Promise.reject(o)}return await i.json()},Vs={getStreamLogsUrl:()=>hf+"/stream_logs",listTorrents:()=>Ze("GET","/torrents"),getTorrentDetails:e=>Ze("GET",`/torrents/${e}`),getTorrentStats:e=>Ze("GET",`/torrents/${e}/stats/v1`),uploadTorrent:(e,t)=>{var r,l;let n="/torrents?&overwrite=true";return t!=null&&t.list_only&&(n+="&list_only=true"),(t==null?void 0:t.only_files)!=null&&(n+=`&only_files=${t.only_files.join(",")}`),(r=t==null?void 0:t.peer_opts)!=null&&r.connect_timeout&&(n+=`&peer_connect_timeout=${t.peer_opts.connect_timeout}`),(l=t==null?void 0:t.peer_opts)!=null&&l.read_write_timeout&&(n+=`&peer_read_write_timeout=${t.peer_opts.read_write_timeout}`),t!=null&&t.initial_peers&&(n+=`&initial_peers=${t.initial_peers.join(",")}`),t!=null&&t.output_folder&&(n+=`&output_folder=${t.output_folder}`),typeof e=="string"&&(n+="&is_url=true"),Ze("POST",n,e)},pause:e=>Ze("POST",`/torrents/${e}/pause`),start:e=>Ze("POST",`/torrents/${e}/start`),forget:e=>Ze("POST",`/torrents/${e}/forget`),delete:e=>Ze("POST",`/torrents/${e}/delete`),getVersion:async()=>(await Ze("GET","/")).version},Mp=()=>{let[e,t]=y.useState("rqbit web UI");return y.useEffect(()=>hu(()=>Vs.getVersion().then(r=>{const l=`rqbit web UI - v${r}`;return t(l),document.title=l,1e4},r=>1e3),0),[]),c.jsx(y.StrictMode,{children:c.jsx(Nt.Provider,{value:Vs,children:c.jsx(zp,{title:e})})})};Eo.createRoot(document.getElementById("app")).render(c.jsx(Mp,{})); diff --git a/crates/librqbit/webui/dist/manifest.json b/crates/librqbit/webui/dist/manifest.json index 19a4e17..456bd00 100644 --- a/crates/librqbit/webui/dist/manifest.json +++ b/crates/librqbit/webui/dist/manifest.json @@ -11,7 +11,7 @@ "css": [ "assets/index-bc066ae5.css" ], - "file": "assets/index-9e7b65dd.js", + "file": "assets/index-9469b905.js", "isEntry": true, "src": "index.html" } diff --git a/crates/librqbit/webui/src/components/LogStream.tsx b/crates/librqbit/webui/src/components/LogStream.tsx index 595538c..d4e2ee0 100644 --- a/crates/librqbit/webui/src/components/LogStream.tsx +++ b/crates/librqbit/webui/src/components/LogStream.tsx @@ -204,8 +204,8 @@ export const LogStream: React.FC = ({ url, maxLines }) => { {logLines.map((line) => ( -