function Im(s,a){for(var i=0;iu[d]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function nf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var no={exports:{}},Es={},ro={exports:{}},be={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var vd;function $m(){if(vd)return be;vd=1;var s=Symbol.for("react.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),C=Symbol.iterator;function z(b){return b===null||typeof b!="object"?null:(b=C&&b[C]||b["@@iterator"],typeof b=="function"?b:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,P={};function N(b,I,te){this.props=b,this.context=I,this.refs=P,this.updater=te||B}N.prototype.isReactComponent={},N.prototype.setState=function(b,I){if(typeof b!="object"&&typeof b!="function"&&b!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,b,I,"setState")},N.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function A(){}A.prototype=N.prototype;function M(b,I,te){this.props=b,this.context=I,this.refs=P,this.updater=te||B}var K=M.prototype=new A;K.constructor=M,L(K,N.prototype),K.isPureReactComponent=!0;var Q=Array.isArray,me=Object.prototype.hasOwnProperty,fe={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function ae(b,I,te){var pe,ye={},Ne=null,we=null;if(I!=null)for(pe in I.ref!==void 0&&(we=I.ref),I.key!==void 0&&(Ne=""+I.key),I)me.call(I,pe)&&!O.hasOwnProperty(pe)&&(ye[pe]=I[pe]);var oe=arguments.length-2;if(oe===1)ye.children=te;else if(1>>1,I=U[b];if(0>>1;bd(ye,G))Ned(we,ye)?(U[b]=we,U[Ne]=G,b=Ne):(U[b]=ye,U[pe]=G,b=pe);else if(Ned(we,G))U[b]=we,U[Ne]=G,b=Ne;else break e}}return ee}function d(U,ee){var G=U.sortIndex-ee.sortIndex;return G!==0?G:U.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();s.unstable_now=function(){return m.now()-h}}var x=[],y=[],k=1,C=null,z=3,B=!1,L=!1,P=!1,N=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function K(U){for(var ee=i(y);ee!==null;){if(ee.callback===null)u(y);else if(ee.startTime<=U)u(y),ee.sortIndex=ee.expirationTime,a(x,ee);else break;ee=i(y)}}function Q(U){if(P=!1,K(U),!L)if(i(x)!==null)L=!0,ge(me);else{var ee=i(y);ee!==null&&D(Q,ee.startTime-U)}}function me(U,ee){L=!1,P&&(P=!1,A(ae),ae=-1),B=!0;var G=z;try{for(K(ee),C=i(x);C!==null&&(!(C.expirationTime>ee)||U&&!ke());){var b=C.callback;if(typeof b=="function"){C.callback=null,z=C.priorityLevel;var I=b(C.expirationTime<=ee);ee=s.unstable_now(),typeof I=="function"?C.callback=I:C===i(x)&&u(x),K(ee)}else u(x);C=i(x)}if(C!==null)var te=!0;else{var pe=i(y);pe!==null&&D(Q,pe.startTime-ee),te=!1}return te}finally{C=null,z=G,B=!1}}var fe=!1,O=null,ae=-1,de=5,Y=-1;function ke(){return!(s.unstable_now()-YU||125b?(U.sortIndex=G,a(y,U),i(x)===null&&U===i(y)&&(P?(A(ae),ae=-1):P=!0,D(Q,G-b))):(U.sortIndex=I,a(x,U),L||B||(L=!0,ge(me))),U},s.unstable_shouldYield=ke,s.unstable_wrapCallback=function(U){var ee=z;return function(){var G=z;z=ee;try{return U.apply(this,arguments)}finally{z=G}}}})(ao)),ao}var Sd;function qm(){return Sd||(Sd=1,lo.exports=Wm()),lo.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var bd;function Km(){if(bd)return gt;bd=1;var s=To(),a=qm();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,y=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,k={},C={};function z(e){return x.call(C,e)?!0:x.call(k,e)?!1:y.test(e)?C[e]=!0:(k[e]=!0,!1)}function B(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L(e,t,n,r){if(t===null||typeof t>"u"||B(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function P(e,t,n,r,o,c,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=p}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new P(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];N[t]=new P(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new P(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new P(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){N[e]=new P(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new P(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new P(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new P(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new P(e,5,!1,e.toLowerCase(),null,!1,!1)});var A=/[\-:]([a-z])/g;function M(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(A,M);N[t]=new P(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(A,M);N[t]=new P(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(A,M);N[t]=new P(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new P(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new P("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new P(e,1,!1,e.toLowerCase(),null,!0,!0)});function K(e,t,n,r){var o=N.hasOwnProperty(t)?N[t]:null;(o!==null?o.type!==0:r||!(2g||o[p]!==c[g]){var j=` `+o[p].replace(" at new "," at ");return e.displayName&&j.includes("")&&(j=j.replace("",e.displayName)),j}while(1<=p&&0<=g);break}}}finally{te=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?I(e):""}function ye(e){switch(e.tag){case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return e=pe(e.type,!1),e;case 11:return e=pe(e.type.render,!1),e;case 1:return e=pe(e.type,!0),e;default:return""}}function Ne(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 O:return"Fragment";case fe:return"Portal";case de:return"Profiler";case ae:return"StrictMode";case ze:return"Suspense";case Ee:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ke:return(e.displayName||"Context")+".Consumer";case Y:return(e._context.displayName||"Context")+".Provider";case Te:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return t=e.displayName||null,t!==null?t:Ne(e.type)||"Memo";case ge:t=e._payload,e=e._init;try{return Ne(e(t))}catch{}}return null}function we(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 Ne(t);case 8:return t===ae?"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 oe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function F(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ne(e){var t=F(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 o=n.get,c=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(p){r=""+p,c.call(this,p)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(p){r=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function je(e){e._valueTracker||(e._valueTracker=ne(e))}function _e(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=F(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function De(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 Le(e,t){var n=t.checked;return G({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Fr(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=oe(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 Ur(e,t){t=t.checked,t!=null&&K(e,"checked",t,!1)}function wt(e,t){Ur(e,t);var n=oe(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")?Mr(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mr(e,t.type,oe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function rr(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 Mr(e,t,n){(t!=="number"||De(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=sr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function An(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Dn={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},va=["Webkit","ms","Moz","O"];Object.keys(Dn).forEach(function(e){va.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Dn[t]=Dn[e]})});function Bs(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Dn.hasOwnProperty(e)&&Dn[e]?(""+t).trim():t+"px"}function Vs(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Bs(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var wa=G({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 Br(e,t){if(t){if(wa[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function on(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 Vr=null;function Hr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wr=null,Qt=null,w=null;function $(e){if(e=ps(e)){if(typeof Wr!="function")throw Error(i(280));var t=e.stateNode;t&&(t=fl(t),Wr(e.stateNode,e.type,t))}}function ue(e){Qt?w?w.push(e):w=[e]:Qt=e}function Se(){if(Qt){var e=Qt,t=w;if(w=Qt=null,$(e),t)for(e=0;e>>=0,e===0?32:31-(np(e)/rp|0)|0}var Qs=64,Js=4194304;function Jr(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 Gs(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,c=e.pingedLanes,p=n&268435455;if(p!==0){var g=p&~o;g!==0?r=Jr(g):(c&=p,c!==0&&(r=Jr(c)))}else p=n&~o,p!==0?r=Jr(p):c!==0&&(r=Jr(c));if(r===0)return 0;if(t!==0&&t!==r&&(t&o)===0&&(o=r&-r,c=t&-t,o>=c||o===16&&(c&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Gr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Lt(t),e[t]=n}function ip(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=ss),fu=" ",pu=!1;function mu(e,t){switch(e){case"keyup":return Ap.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var or=!1;function Fp(e,t){switch(e){case"compositionend":return hu(t);case"keypress":return t.which!==32?null:(pu=!0,fu);case"textInput":return e=t.data,e===fu&&pu?null:e;default:return null}}function Up(e,t){if(or)return e==="compositionend"||!Da&&mu(e,t)?(e=au(),tl=Ra=mn=null,or=!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=ku(n)}}function Su(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Su(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bu(){for(var e=window,t=De();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=De(e.document)}return t}function Ma(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 Kp(e){var t=bu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Su(n.ownerDocument.documentElement,n)){if(r!==null&&Ma(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 o=n.textContent.length,c=Math.min(r.start,o);r=r.end===void 0?c:Math.min(r.end,o),!e.extend&&c>r&&(o=r,r=c,c=o),o=Nu(n,c);var p=Nu(n,r);o&&p&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),c>r?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.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,ur=null,Ia=null,os=null,$a=!1;function _u(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$a||ur==null||ur!==De(r)||(r=ur,"selectionStart"in r&&Ma(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}),os&&is(os,r)||(os=r,r=ul(Ia,"onSelect"),0mr||(e.current=Za[mr],Za[mr]=null,mr--)}function Fe(e,t){mr++,Za[mr]=e.current,e.current=t}var yn={},st=gn(yn),ft=gn(!1),Mn=yn;function hr(e,t){var n=e.type.contextTypes;if(!n)return yn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},c;for(c in n)o[c]=t[c];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function pt(e){return e=e.childContextTypes,e!=null}function pl(){Me(ft),Me(st)}function $u(e,t,n){if(st.current!==yn)throw Error(i(168));Fe(st,t),Fe(ft,n)}function Bu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(i(108,we(e)||"Unknown",o));return G({},n,r)}function ml(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||yn,Mn=st.current,Fe(st,e),Fe(ft,ft.current),!0}function Vu(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=Bu(e,t,Mn),r.__reactInternalMemoizedMergedChildContext=e,Me(ft),Me(st),Fe(st,e)):Me(ft),Fe(ft,n)}var Gt=null,hl=!1,ei=!1;function Hu(e){Gt===null?Gt=[e]:Gt.push(e)}function lm(e){hl=!0,Hu(e)}function vn(){if(!ei&&Gt!==null){ei=!0;var e=0,t=Oe;try{var n=Gt;for(Oe=1;e>=p,o-=p,Yt=1<<32-Lt(t)+o|n<ve?(tt=xe,xe=null):tt=xe.sibling;var Re=V(E,xe,R[ve],J);if(Re===null){xe===null&&(xe=tt);break}e&&xe&&Re.alternate===null&&t(E,xe),S=c(Re,S,ve),he===null?ce=Re:he.sibling=Re,he=Re,xe=tt}if(ve===R.length)return n(E,xe),Ie&&$n(E,ve),ce;if(xe===null){for(;veve?(tt=xe,xe=null):tt=xe.sibling;var En=V(E,xe,Re.value,J);if(En===null){xe===null&&(xe=tt);break}e&&xe&&En.alternate===null&&t(E,xe),S=c(En,S,ve),he===null?ce=En:he.sibling=En,he=En,xe=tt}if(Re.done)return n(E,xe),Ie&&$n(E,ve),ce;if(xe===null){for(;!Re.done;ve++,Re=R.next())Re=W(E,Re.value,J),Re!==null&&(S=c(Re,S,ve),he===null?ce=Re:he.sibling=Re,he=Re);return Ie&&$n(E,ve),ce}for(xe=r(E,xe);!Re.done;ve++,Re=R.next())Re=Z(xe,E,ve,Re.value,J),Re!==null&&(e&&Re.alternate!==null&&xe.delete(Re.key===null?ve:Re.key),S=c(Re,S,ve),he===null?ce=Re:he.sibling=Re,he=Re);return e&&xe.forEach(function(Mm){return t(E,Mm)}),Ie&&$n(E,ve),ce}function Qe(E,S,R,J){if(typeof R=="object"&&R!==null&&R.type===O&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case me:e:{for(var ce=R.key,he=S;he!==null;){if(he.key===ce){if(ce=R.type,ce===O){if(he.tag===7){n(E,he.sibling),S=o(he,R.props.children),S.return=E,E=S;break e}}else if(he.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===ge&&Gu(ce)===he.type){n(E,he.sibling),S=o(he,R.props),S.ref=ms(E,he,R),S.return=E,E=S;break e}n(E,he);break}else t(E,he);he=he.sibling}R.type===O?(S=Jn(R.props.children,E.mode,J,R.key),S.return=E,E=S):(J=Vl(R.type,R.key,R.props,null,E.mode,J),J.ref=ms(E,S,R),J.return=E,E=J)}return p(E);case fe:e:{for(he=R.key;S!==null;){if(S.key===he)if(S.tag===4&&S.stateNode.containerInfo===R.containerInfo&&S.stateNode.implementation===R.implementation){n(E,S.sibling),S=o(S,R.children||[]),S.return=E,E=S;break e}else{n(E,S);break}else t(E,S);S=S.sibling}S=Yi(R,E.mode,J),S.return=E,E=S}return p(E);case ge:return he=R._init,Qe(E,S,he(R._payload),J)}if(zn(R))return se(E,S,R,J);if(ee(R))return ie(E,S,R,J);vl(E,R)}return typeof R=="string"&&R!==""||typeof R=="number"?(R=""+R,S!==null&&S.tag===6?(n(E,S.sibling),S=o(S,R),S.return=E,E=S):(n(E,S),S=Gi(R,E.mode,J),S.return=E,E=S),p(E)):n(E,S)}return Qe}var vr=Yu(!0),Xu=Yu(!1),wl=gn(null),jl=null,wr=null,ai=null;function ii(){ai=wr=jl=null}function oi(e){var t=wl.current;Me(wl),e._currentValue=t}function ui(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function jr(e,t){jl=e,ai=wr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(mt=!0),e.firstContext=null)}function Ct(e){var t=e._currentValue;if(ai!==e)if(e={context:e,memoizedValue:t,next:null},wr===null){if(jl===null)throw Error(i(308));wr=e,jl.dependencies={lanes:0,firstContext:e}}else wr=wr.next=e;return t}var Bn=null;function ci(e){Bn===null?Bn=[e]:Bn.push(e)}function Zu(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,ci(t)):(n.next=o.next,o.next=n),t.interleaved=n,Zt(e,r)}function Zt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var wn=!1;function di(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ec(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function en(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function jn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Pe&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Zt(e,n)}return o=r.interleaved,o===null?(t.next=t,ci(r)):(t.next=o.next,o.next=t),r.interleaved=t,Zt(e,n)}function kl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ba(e,n)}}function tc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,c=null;if(n=n.firstBaseUpdate,n!==null){do{var p={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};c===null?o=c=p:c=c.next=p,n=n.next}while(n!==null);c===null?o=c=t:c=c.next=t}else o=c=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Nl(e,t,n,r){var o=e.updateQueue;wn=!1;var c=o.firstBaseUpdate,p=o.lastBaseUpdate,g=o.shared.pending;if(g!==null){o.shared.pending=null;var j=g,T=j.next;j.next=null,p===null?c=T:p.next=T,p=j;var H=e.alternate;H!==null&&(H=H.updateQueue,g=H.lastBaseUpdate,g!==p&&(g===null?H.firstBaseUpdate=T:g.next=T,H.lastBaseUpdate=j))}if(c!==null){var W=o.baseState;p=0,H=T=j=null,g=c;do{var V=g.lane,Z=g.eventTime;if((r&V)===V){H!==null&&(H=H.next={eventTime:Z,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var se=e,ie=g;switch(V=t,Z=n,ie.tag){case 1:if(se=ie.payload,typeof se=="function"){W=se.call(Z,W,V);break e}W=se;break e;case 3:se.flags=se.flags&-65537|128;case 0:if(se=ie.payload,V=typeof se=="function"?se.call(Z,W,V):se,V==null)break e;W=G({},W,V);break e;case 2:wn=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,V=o.effects,V===null?o.effects=[g]:V.push(g))}else Z={eventTime:Z,lane:V,tag:g.tag,payload:g.payload,callback:g.callback,next:null},H===null?(T=H=Z,j=W):H=H.next=Z,p|=V;if(g=g.next,g===null){if(g=o.shared.pending,g===null)break;V=g,g=V.next,V.next=null,o.lastBaseUpdate=V,o.shared.pending=null}}while(!0);if(H===null&&(j=W),o.baseState=j,o.firstBaseUpdate=T,o.lastBaseUpdate=H,t=o.shared.interleaved,t!==null){o=t;do p|=o.lane,o=o.next;while(o!==t)}else c===null&&(o.shared.lanes=0);Wn|=p,e.lanes=p,e.memoizedState=W}}function nc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=xi.transition;xi.transition={};try{e(!1),t()}finally{Oe=n,xi.transition=r}}function jc(){return Et().memoizedState}function um(e,t,n){var r=bn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},kc(e))Nc(t,n);else if(n=Zu(e,t,n,r),n!==null){var o=ct();Ut(n,e,r,o),Sc(n,t,r)}}function cm(e,t,n){var r=bn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(kc(e))Nc(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var p=t.lastRenderedState,g=c(p,n);if(o.hasEagerState=!0,o.eagerState=g,Ot(g,p)){var j=t.interleaved;j===null?(o.next=o,ci(t)):(o.next=j.next,j.next=o),t.interleaved=o;return}}catch{}finally{}n=Zu(e,t,o,r),n!==null&&(o=ct(),Ut(n,e,r,o),Sc(n,t,r))}}function kc(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function Nc(e,t){ys=_l=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Sc(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ba(e,n)}}var Pl={readContext:Ct,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useInsertionEffect:lt,useLayoutEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useMutableSource:lt,useSyncExternalStore:lt,useId:lt,unstable_isNewReconciler:!1},dm={readContext:Ct,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:pc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Cl(4194308,4,xc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Cl(4,2,e,t)},useMemo:function(e,t){var n=Wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wt();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=um.bind(null,Ve,e),[r.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:dc,useDebugValue:Ni,useDeferredValue:function(e){return Wt().memoizedState=e},useTransition:function(){var e=dc(!1),t=e[0];return e=om.bind(null,e[1]),Wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ve,o=Wt();if(Ie){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),et===null)throw Error(i(349));(Hn&30)!==0||ac(r,t,n)}o.memoizedState=n;var c={value:n,getSnapshot:t};return o.queue=c,pc(oc.bind(null,r,c,e),[e]),r.flags|=2048,js(9,ic.bind(null,r,c,n,t),void 0,null),n},useId:function(){var e=Wt(),t=et.identifierPrefix;if(Ie){var n=Xt,r=Yt;n=(r&~(1<<32-Lt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=p.createElement(n,{is:r.is}):(e=p.createElement(n),n==="select"&&(p=e,r.multiple?p.multiple=!0:r.size&&(p.size=r.size))):e=p.createElementNS(e,n),e[Vt]=t,e[fs]=r,Hc(e,t,!1,!1),t.stateNode=e;e:{switch(p=on(n,r),n){case"dialog":Ue("cancel",e),Ue("close",e),o=r;break;case"iframe":case"object":case"embed":Ue("load",e),o=r;break;case"video":case"audio":for(o=0;o_r&&(t.flags|=128,r=!0,ks(c,!1),t.lanes=4194304)}else{if(!r)if(e=Sl(p),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ks(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!Ie)return at(t),null}else 2*Ke()-c.renderingStartTime>_r&&n!==1073741824&&(t.flags|=128,r=!0,ks(c,!1),t.lanes=4194304);c.isBackwards?(p.sibling=t.child,t.child=p):(n=c.last,n!==null?n.sibling=p:t.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Ke(),t.sibling=null,n=Be.current,Fe(Be,r?n&1|2:n&1),t):(at(t),null);case 22:case 23:return Ki(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(St&1073741824)!==0&&(at(t),t.subtreeFlags&6&&(t.flags|=8192)):at(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function vm(e,t){switch(ni(t),t.tag){case 1:return pt(t.type)&&pl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kr(),Me(ft),Me(st),hi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return pi(t),null;case 13:if(Me(Be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));yr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Me(Be),null;case 4:return kr(),null;case 10:return oi(t.type._context),null;case 22:case 23:return Ki(),null;case 24:return null;default:return null}}var Ol=!1,it=!1,wm=typeof WeakSet=="function"?WeakSet:Set,re=null;function Sr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){We(e,t,r)}else n.current=null}function Ai(e,t,n){try{n()}catch(r){We(e,t,r)}}var Kc=!1;function jm(e,t){if(Ka=Zs,e=bu(),Ma(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 o=r.anchorOffset,c=r.focusNode;r=r.focusOffset;try{n.nodeType,c.nodeType}catch{n=null;break e}var p=0,g=-1,j=-1,T=0,H=0,W=e,V=null;t:for(;;){for(var Z;W!==n||o!==0&&W.nodeType!==3||(g=p+o),W!==c||r!==0&&W.nodeType!==3||(j=p+r),W.nodeType===3&&(p+=W.nodeValue.length),(Z=W.firstChild)!==null;)V=W,W=Z;for(;;){if(W===e)break t;if(V===n&&++T===o&&(g=p),V===c&&++H===r&&(j=p),(Z=W.nextSibling)!==null)break;W=V,V=W.parentNode}W=Z}n=g===-1||j===-1?null:{start:g,end:j}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qa={focusedElem:e,selectionRange:n},Zs=!1,re=t;re!==null;)if(t=re,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,re=e;else for(;re!==null;){t=re;try{var se=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(se!==null){var ie=se.memoizedProps,Qe=se.memoizedState,E=t.stateNode,S=E.getSnapshotBeforeUpdate(t.elementType===t.type?ie:At(t.type,ie),Qe);E.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var R=t.stateNode.containerInfo;R.nodeType===1?R.textContent="":R.nodeType===9&&R.documentElement&&R.removeChild(R.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(J){We(t,t.return,J)}if(e=t.sibling,e!==null){e.return=t.return,re=e;break}re=t.return}return se=Kc,Kc=!1,se}function Ns(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var c=o.destroy;o.destroy=void 0,c!==void 0&&Ai(t,n,c)}o=o.next}while(o!==r)}}function zl(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 Di(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 Qc(e){var t=e.alternate;t!==null&&(e.alternate=null,Qc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vt],delete t[fs],delete t[Xa],delete t[rm],delete t[sm])),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 Jc(e){return e.tag===5||e.tag===3||e.tag===4}function Gc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(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 Fi(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=dl));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}function Ui(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(Ui(e,t,n),e=e.sibling;e!==null;)Ui(e,t,n),e=e.sibling}var nt=null,Dt=!1;function kn(e,t,n){for(n=n.child;n!==null;)Yc(e,t,n),n=n.sibling}function Yc(e,t,n){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(Ks,n)}catch{}switch(n.tag){case 5:it||Sr(n,t);case 6:var r=nt,o=Dt;nt=null,kn(e,t,n),nt=r,Dt=o,nt!==null&&(Dt?(e=nt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):nt.removeChild(n.stateNode));break;case 18:nt!==null&&(Dt?(e=nt,n=n.stateNode,e.nodeType===8?Ya(e.parentNode,n):e.nodeType===1&&Ya(e,n),ts(e)):Ya(nt,n.stateNode));break;case 4:r=nt,o=Dt,nt=n.stateNode.containerInfo,Dt=!0,kn(e,t,n),nt=r,Dt=o;break;case 0:case 11:case 14:case 15:if(!it&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var c=o,p=c.destroy;c=c.tag,p!==void 0&&((c&2)!==0||(c&4)!==0)&&Ai(n,t,p),o=o.next}while(o!==r)}kn(e,t,n);break;case 1:if(!it&&(Sr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(g){We(n,t,g)}kn(e,t,n);break;case 21:kn(e,t,n);break;case 22:n.mode&1?(it=(r=it)||n.memoizedState!==null,kn(e,t,n),it=r):kn(e,t,n);break;default:kn(e,t,n)}}function Xc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new wm),t.forEach(function(r){var o=Rm.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Ft(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=p),r&=~c}if(r=o,r=Ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Nm(r/1960))-r,10e?16:e,Sn===null)var r=!1;else{if(e=Sn,Sn=null,Ml=0,(Pe&6)!==0)throw Error(i(331));var o=Pe;for(Pe|=4,re=e.current;re!==null;){var c=re,p=c.child;if((re.flags&16)!==0){var g=c.deletions;if(g!==null){for(var j=0;jKe()-$i?Kn(e,0):Ii|=n),xt(e,t)}function dd(e,t){t===0&&((e.mode&1)===0?t=1:(t=Js,Js<<=1,(Js&130023424)===0&&(Js=4194304)));var n=ct();e=Zt(e,t),e!==null&&(Gr(e,t,n),xt(e,n))}function Pm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dd(e,n)}function Rm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),dd(e,n)}var fd;fd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ft.current)mt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return mt=!1,gm(e,t,n);mt=(e.flags&131072)!==0}else mt=!1,Ie&&(t.flags&1048576)!==0&&Wu(t,gl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ll(e,t),e=t.pendingProps;var o=hr(t,st.current);jr(t,n),o=yi(null,t,r,e,o,n);var c=vi();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,pt(r)?(c=!0,ml(t)):c=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,di(t),o.updater=Rl,t.stateNode=o,o._reactInternals=t,bi(t,r,e,n),t=Pi(null,t,r,!0,c,n)):(t.tag=0,Ie&&c&&ti(t),ut(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ll(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Lm(r),e=At(r,e),o){case 0:t=Ei(null,t,r,e,n);break e;case 1:t=Uc(null,t,r,e,n);break e;case 11:t=Oc(null,t,r,e,n);break e;case 14:t=zc(null,t,r,At(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:At(r,o),Ei(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:At(r,o),Uc(e,t,r,o,n);case 3:e:{if(Mc(t),e===null)throw Error(i(387));r=t.pendingProps,c=t.memoizedState,o=c.element,ec(e,t),Nl(t,r,null,n);var p=t.memoizedState;if(r=p.element,c.isDehydrated)if(c={element:r,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){o=Nr(Error(i(423)),t),t=Ic(e,t,r,n,o);break e}else if(r!==o){o=Nr(Error(i(424)),t),t=Ic(e,t,r,n,o);break e}else for(Nt=xn(t.stateNode.containerInfo.firstChild),kt=t,Ie=!0,zt=null,n=Xu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(yr(),r===o){t=tn(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return rc(t),e===null&&si(t),r=t.type,o=t.pendingProps,c=e!==null?e.memoizedProps:null,p=o.children,Ja(r,o)?p=null:c!==null&&Ja(r,c)&&(t.flags|=32),Fc(e,t),ut(e,t,p,n),t.child;case 6:return e===null&&si(t),null;case 13:return $c(e,t,n);case 4:return fi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vr(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:At(r,o),Oc(e,t,r,o,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,c=t.memoizedProps,p=o.value,Fe(wl,r._currentValue),r._currentValue=p,c!==null)if(Ot(c.value,p)){if(c.children===o.children&&!ft.current){t=tn(e,t,n);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var g=c.dependencies;if(g!==null){p=c.child;for(var j=g.firstContext;j!==null;){if(j.context===r){if(c.tag===1){j=en(-1,n&-n),j.tag=2;var T=c.updateQueue;if(T!==null){T=T.shared;var H=T.pending;H===null?j.next=j:(j.next=H.next,H.next=j),T.pending=j}}c.lanes|=n,j=c.alternate,j!==null&&(j.lanes|=n),ui(c.return,n,t),g.lanes|=n;break}j=j.next}}else if(c.tag===10)p=c.type===t.type?null:c.child;else if(c.tag===18){if(p=c.return,p===null)throw Error(i(341));p.lanes|=n,g=p.alternate,g!==null&&(g.lanes|=n),ui(p,n,t),p=c.sibling}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===t){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}ut(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,jr(t,n),o=Ct(o),r=r(o),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,o=At(r,t.pendingProps),o=At(r.type,o),zc(e,t,r,o,n);case 15:return Ac(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:At(r,o),Ll(e,t),t.tag=1,pt(r)?(e=!0,ml(t)):e=!1,jr(t,n),_c(t,r,o),bi(t,r,o,n),Pi(null,t,r,!0,e,n);case 19:return Vc(e,t,n);case 22:return Dc(e,t,n)}throw Error(i(156,t.tag))};function pd(e,t){return qo(e,t)}function Tm(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 Rt(e,t,n,r){return new Tm(e,t,n,r)}function Ji(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Lm(e){if(typeof e=="function")return Ji(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Te)return 11;if(e===q)return 14}return 2}function Cn(e,t){var n=e.alternate;return n===null?(n=Rt(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 Vl(e,t,n,r,o,c){var p=2;if(r=e,typeof e=="function")Ji(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case O:return Jn(n.children,o,c,t);case ae:p=8,o|=8;break;case de:return e=Rt(12,n,t,o|2),e.elementType=de,e.lanes=c,e;case ze:return e=Rt(13,n,t,o),e.elementType=ze,e.lanes=c,e;case Ee:return e=Rt(19,n,t,o),e.elementType=Ee,e.lanes=c,e;case D:return Hl(n,o,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Y:p=10;break e;case ke:p=9;break e;case Te:p=11;break e;case q:p=14;break e;case ge:p=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=Rt(p,n,t,o),t.elementType=e,t.type=r,t.lanes=c,t}function Jn(e,t,n,r){return e=Rt(7,e,r,t),e.lanes=n,e}function Hl(e,t,n,r){return e=Rt(22,e,r,t),e.elementType=D,e.lanes=n,e.stateNode={isHidden:!1},e}function Gi(e,t,n){return e=Rt(6,e,null,t),e.lanes=n,e}function Yi(e,t,n){return t=Rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Om(e,t,n,r,o){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=Sa(0),this.expirationTimes=Sa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sa(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Xi(e,t,n,r,o,c,p,g,j){return e=new Om(e,t,n,g,j),t===1?(t=1,c===!0&&(t|=8)):t=0,c=Rt(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},di(c),e}function zm(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),so.exports=Km(),so.exports}var Cd;function Qm(){if(Cd)return Yl;Cd=1;var s=sf();return Yl.createRoot=s.createRoot,Yl.hydrateRoot=s.hydrateRoot,Yl}var Jm=Qm();const Gm=nf(Jm);sf();/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Rs(){return Rs=Object.assign?Object.assign.bind():function(s){for(var a=1;a"u")throw new Error(a)}function Lo(s,a){if(!s){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function Xm(){return Math.random().toString(36).substr(2,8)}function Pd(s,a){return{usr:s.state,key:s.key,idx:a}}function go(s,a,i,u){return i===void 0&&(i=null),Rs({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof a=="string"?Or(a):a,{state:i,key:a&&a.key||u||Xm()})}function sa(s){let{pathname:a="/",search:i="",hash:u=""}=s;return i&&i!=="?"&&(a+=i.charAt(0)==="?"?i:"?"+i),u&&u!=="#"&&(a+=u.charAt(0)==="#"?u:"#"+u),a}function Or(s){let a={};if(s){let i=s.indexOf("#");i>=0&&(a.hash=s.substr(i),s=s.substr(0,i));let u=s.indexOf("?");u>=0&&(a.search=s.substr(u),s=s.substr(0,u)),s&&(a.pathname=s)}return a}function Zm(s,a,i,u){u===void 0&&(u={});let{window:d=document.defaultView,v5Compat:f=!1}=u,m=d.history,h=Rn.Pop,x=null,y=k();y==null&&(y=0,m.replaceState(Rs({},m.state,{idx:y}),""));function k(){return(m.state||{idx:null}).idx}function C(){h=Rn.Pop;let N=k(),A=N==null?null:N-y;y=N,x&&x({action:h,location:P.location,delta:A})}function z(N,A){h=Rn.Push;let M=go(P.location,N,A);y=k()+1;let K=Pd(M,y),Q=P.createHref(M);try{m.pushState(K,"",Q)}catch(me){if(me instanceof DOMException&&me.name==="DataCloneError")throw me;d.location.assign(Q)}f&&x&&x({action:h,location:P.location,delta:1})}function B(N,A){h=Rn.Replace;let M=go(P.location,N,A);y=k();let K=Pd(M,y),Q=P.createHref(M);m.replaceState(K,"",Q),f&&x&&x({action:h,location:P.location,delta:0})}function L(N){let A=d.location.origin!=="null"?d.location.origin:d.location.href,M=typeof N=="string"?N:sa(N);return M=M.replace(/ $/,"%20"),He(A,"No window.location.(origin|href) available to create URL for href: "+M),new URL(M,A)}let P={get action(){return h},get location(){return s(d,m)},listen(N){if(x)throw new Error("A history only accepts one active listener");return d.addEventListener(Ed,C),x=N,()=>{d.removeEventListener(Ed,C),x=null}},createHref(N){return a(d,N)},createURL:L,encodeLocation(N){let A=L(N);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:z,replace:B,go(N){return m.go(N)}};return P}var Rd;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(Rd||(Rd={}));function e0(s,a,i){return i===void 0&&(i="/"),t0(s,a,i)}function t0(s,a,i,u){let d=typeof a=="string"?Or(a):a,f=Rr(d.pathname||"/",i);if(f==null)return null;let m=lf(s);n0(m);let h=null;for(let x=0;h==null&&x{let x={relativePath:h===void 0?f.path||"":h,caseSensitive:f.caseSensitive===!0,childrenIndex:m,route:f};x.relativePath.startsWith("/")&&(He(x.relativePath.startsWith(u),'Absolute route path "'+x.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),x.relativePath=x.relativePath.slice(u.length));let y=Tn([u,x.relativePath]),k=i.concat(x);f.children&&f.children.length>0&&(He(f.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+y+'".')),lf(f.children,a,k,y)),!(f.path==null&&!f.index)&&a.push({path:y,score:u0(y,f.index),routesMeta:k})};return s.forEach((f,m)=>{var h;if(f.path===""||!((h=f.path)!=null&&h.includes("?")))d(f,m);else for(let x of af(f.path))d(f,m,x)}),a}function af(s){let a=s.split("/");if(a.length===0)return[];let[i,...u]=a,d=i.endsWith("?"),f=i.replace(/\?$/,"");if(u.length===0)return d?[f,""]:[f];let m=af(u.join("/")),h=[];return h.push(...m.map(x=>x===""?f:[f,x].join("/"))),d&&h.push(...m),h.map(x=>s.startsWith("/")&&x===""?"/":x)}function n0(s){s.sort((a,i)=>a.score!==i.score?i.score-a.score:c0(a.routesMeta.map(u=>u.childrenIndex),i.routesMeta.map(u=>u.childrenIndex)))}const r0=/^:[\w-]+$/,s0=3,l0=2,a0=1,i0=10,o0=-2,Td=s=>s==="*";function u0(s,a){let i=s.split("/"),u=i.length;return i.some(Td)&&(u+=o0),a&&(u+=l0),i.filter(d=>!Td(d)).reduce((d,f)=>d+(r0.test(f)?s0:f===""?a0:i0),u)}function c0(s,a){return s.length===a.length&&s.slice(0,-1).every((u,d)=>u===a[d])?s[s.length-1]-a[a.length-1]:0}function d0(s,a,i){let{routesMeta:u}=s,d={},f="/",m=[];for(let h=0;h{let{paramName:z,isOptional:B}=k;if(z==="*"){let P=h[C]||"";m=f.slice(0,f.length-P.length).replace(/(.)\/+$/,"$1")}const L=h[C];return B&&!L?y[z]=void 0:y[z]=(L||"").replace(/%2F/g,"/"),y},{}),pathname:f,pathnameBase:m,pattern:s}}function f0(s,a,i){a===void 0&&(a=!1),i===void 0&&(i=!0),Lo(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let u=[],d="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,h,x)=>(u.push({paramName:h,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(u.push({paramName:"*"}),d+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?d+="\\/*$":s!==""&&s!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,a?void 0:"i"),u]}function p0(s){try{return s.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Lo(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),s}}function Rr(s,a){if(a==="/")return s;if(!s.toLowerCase().startsWith(a.toLowerCase()))return null;let i=a.endsWith("/")?a.length-1:a.length,u=s.charAt(i);return u&&u!=="/"?null:s.slice(i)||"/"}const m0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,h0=s=>m0.test(s);function x0(s,a){a===void 0&&(a="/");let{pathname:i,search:u="",hash:d=""}=typeof s=="string"?Or(s):s,f;if(i)if(h0(i))f=i;else{if(i.includes("//")){let m=i;i=i.replace(/\/\/+/g,"/"),Lo(!1,"Pathnames cannot have embedded double slashes - normalizing "+(m+" -> "+i))}i.startsWith("/")?f=Ld(i.substring(1),"/"):f=Ld(i,a)}else f=a;return{pathname:f,search:v0(u),hash:w0(d)}}function Ld(s,a){let i=a.replace(/\/+$/,"").split("/");return s.split("/").forEach(d=>{d===".."?i.length>1&&i.pop():d!=="."&&i.push(d)}),i.length>1?i.join("/"):"/"}function io(s,a,i,u){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function g0(s){return s.filter((a,i)=>i===0||a.route.path&&a.route.path.length>0)}function Oo(s,a){let i=g0(s);return a?i.map((u,d)=>d===i.length-1?u.pathname:u.pathnameBase):i.map(u=>u.pathnameBase)}function zo(s,a,i,u){u===void 0&&(u=!1);let d;typeof s=="string"?d=Or(s):(d=Rs({},s),He(!d.pathname||!d.pathname.includes("?"),io("?","pathname","search",d)),He(!d.pathname||!d.pathname.includes("#"),io("#","pathname","hash",d)),He(!d.search||!d.search.includes("#"),io("#","search","hash",d)));let f=s===""||d.pathname==="",m=f?"/":d.pathname,h;if(m==null)h=i;else{let C=a.length-1;if(!u&&m.startsWith("..")){let z=m.split("/");for(;z[0]==="..";)z.shift(),C-=1;d.pathname=z.join("/")}h=C>=0?a[C]:"/"}let x=x0(d,h),y=m&&m!=="/"&&m.endsWith("/"),k=(f||m===".")&&i.endsWith("/");return!x.pathname.endsWith("/")&&(y||k)&&(x.pathname+="/"),x}const Tn=s=>s.join("/").replace(/\/\/+/g,"/"),y0=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),v0=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,w0=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function j0(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const of=["post","put","patch","delete"];new Set(of);const k0=["get",...of];new Set(k0);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Ts(){return Ts=Object.assign?Object.assign.bind():function(s){for(var a=1;a{h.current=!0}),v.useCallback(function(y,k){if(k===void 0&&(k={}),!h.current)return;if(typeof y=="number"){u.go(y);return}let C=zo(y,JSON.parse(m),f,k.relative==="path");s==null&&a!=="/"&&(C.pathname=C.pathname==="/"?a:Tn([a,C.pathname])),(k.replace?u.replace:u.push)(C,k.state,k)},[a,u,m,f,s])}const b0=v.createContext(null);function _0(s){let a=v.useContext(ln).outlet;return a&&v.createElement(b0.Provider,{value:s},a)}function da(s,a){let{relative:i}=a===void 0?{}:a,{future:u}=v.useContext(sn),{matches:d}=v.useContext(ln),{pathname:f}=Ar(),m=JSON.stringify(Oo(d,u.v7_relativeSplatPath));return v.useMemo(()=>zo(s,JSON.parse(m),f,i==="path"),[s,m,f,i])}function C0(s,a){return E0(s,a)}function E0(s,a,i,u){zr()||He(!1);let{navigator:d}=v.useContext(sn),{matches:f}=v.useContext(ln),m=f[f.length-1],h=m?m.params:{};m&&m.pathname;let x=m?m.pathnameBase:"/";m&&m.route;let y=Ar(),k;if(a){var C;let N=typeof a=="string"?Or(a):a;x==="/"||(C=N.pathname)!=null&&C.startsWith(x)||He(!1),k=N}else k=y;let z=k.pathname||"/",B=z;if(x!=="/"){let N=x.replace(/^\//,"").split("/");B="/"+z.replace(/^\//,"").split("/").slice(N.length).join("/")}let L=e0(s,{pathname:B}),P=O0(L&&L.map(N=>Object.assign({},N,{params:Object.assign({},h,N.params),pathname:Tn([x,d.encodeLocation?d.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?x:Tn([x,d.encodeLocation?d.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),f,i,u);return a&&P?v.createElement(ua.Provider,{value:{location:Ts({pathname:"/",search:"",hash:"",state:null,key:"default"},k),navigationType:Rn.Pop}},P):P}function P0(){let s=F0(),a=j0(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),i=s instanceof Error?s.stack:null,d={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},a),i?v.createElement("pre",{style:d},i):null,null)}const R0=v.createElement(P0,null);class T0 extends v.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,i){return i.location!==a.location||i.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:i.error,location:i.location,revalidation:a.revalidation||i.revalidation}}componentDidCatch(a,i){console.error("React Router caught the following error during render",a,i)}render(){return this.state.error!==void 0?v.createElement(ln.Provider,{value:this.props.routeContext},v.createElement(cf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function L0(s){let{routeContext:a,match:i,children:u}=s,d=v.useContext(oa);return d&&d.static&&d.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(d.staticContext._deepestRenderedBoundaryId=i.route.id),v.createElement(ln.Provider,{value:a},u)}function O0(s,a,i,u){var d;if(a===void 0&&(a=[]),i===void 0&&(i=null),u===void 0&&(u=null),s==null){var f;if(!i)return null;if(i.errors)s=i.matches;else if((f=u)!=null&&f.v7_partialHydration&&a.length===0&&!i.initialized&&i.matches.length>0)s=i.matches;else return null}let m=s,h=(d=i)==null?void 0:d.errors;if(h!=null){let k=m.findIndex(C=>C.route.id&&(h==null?void 0:h[C.route.id])!==void 0);k>=0||He(!1),m=m.slice(0,Math.min(m.length,k+1))}let x=!1,y=-1;if(i&&u&&u.v7_partialHydration)for(let k=0;k=0?m=m.slice(0,y+1):m=[m[0]];break}}}return m.reduceRight((k,C,z)=>{let B,L=!1,P=null,N=null;i&&(B=h&&C.route.id?h[C.route.id]:void 0,P=C.route.errorElement||R0,x&&(y<0&&z===0?(M0("route-fallback"),L=!0,N=null):y===z&&(L=!0,N=C.route.hydrateFallbackElement||null)));let A=a.concat(m.slice(0,z+1)),M=()=>{let K;return B?K=P:L?K=N:C.route.Component?K=v.createElement(C.route.Component,null):C.route.element?K=C.route.element:K=k,v.createElement(L0,{match:C,routeContext:{outlet:k,matches:A,isDataRoute:i!=null},children:K})};return i&&(C.route.ErrorBoundary||C.route.errorElement||z===0)?v.createElement(T0,{location:i.location,revalidation:i.revalidation,component:P,error:B,children:M(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):M()},null)}var ff=(function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s})(ff||{}),pf=(function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s})(pf||{});function z0(s){let a=v.useContext(oa);return a||He(!1),a}function A0(s){let a=v.useContext(uf);return a||He(!1),a}function D0(s){let a=v.useContext(ln);return a||He(!1),a}function mf(s){let a=D0(),i=a.matches[a.matches.length-1];return i.route.id||He(!1),i.route.id}function F0(){var s;let a=v.useContext(cf),i=A0(),u=mf();return a!==void 0?a:(s=i.errors)==null?void 0:s[u]}function U0(){let{router:s}=z0(ff.UseNavigateStable),a=mf(pf.UseNavigateStable),i=v.useRef(!1);return df(()=>{i.current=!0}),v.useCallback(function(d,f){f===void 0&&(f={}),i.current&&(typeof d=="number"?s.navigate(d):s.navigate(d,Ts({fromRouteId:a},f)))},[s,a])}const Od={};function M0(s,a,i){Od[s]||(Od[s]=!0)}function I0(s,a){s==null||s.v7_startTransition,s==null||s.v7_relativeSplatPath}function vo(s){let{to:a,replace:i,state:u,relative:d}=s;zr()||He(!1);let{future:f,static:m}=v.useContext(sn),{matches:h}=v.useContext(ln),{pathname:x}=Ar(),y=ca(),k=zo(a,Oo(h,f.v7_relativeSplatPath),x,d==="path"),C=JSON.stringify(k);return v.useEffect(()=>y(JSON.parse(C),{replace:i,state:u,relative:d}),[y,C,d,i,u]),null}function $0(s){return _0(s.context)}function yt(s){He(!1)}function B0(s){let{basename:a="/",children:i=null,location:u,navigationType:d=Rn.Pop,navigator:f,static:m=!1,future:h}=s;zr()&&He(!1);let x=a.replace(/^\/*/,"/"),y=v.useMemo(()=>({basename:x,navigator:f,static:m,future:Ts({v7_relativeSplatPath:!1},h)}),[x,h,f,m]);typeof u=="string"&&(u=Or(u));let{pathname:k="/",search:C="",hash:z="",state:B=null,key:L="default"}=u,P=v.useMemo(()=>{let N=Rr(k,x);return N==null?null:{location:{pathname:N,search:C,hash:z,state:B,key:L},navigationType:d}},[x,k,C,z,B,L,d]);return P==null?null:v.createElement(sn.Provider,{value:y},v.createElement(ua.Provider,{children:i,value:P}))}function V0(s){let{children:a,location:i}=s;return C0(wo(a),i)}new Promise(()=>{});function wo(s,a){a===void 0&&(a=[]);let i=[];return v.Children.forEach(s,(u,d)=>{if(!v.isValidElement(u))return;let f=[...a,d];if(u.type===v.Fragment){i.push.apply(i,wo(u.props.children,f));return}u.type!==yt&&He(!1),!u.props.index||!u.props.children||He(!1);let m={id:u.props.id||f.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(m.children=wo(u.props.children,f)),i.push(m)}),i}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function la(){return la=Object.assign?Object.assign.bind():function(s){for(var a=1;a=0)&&(i[d]=s[d]);return i}function H0(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function W0(s,a){return s.button===0&&(!a||a==="_self")&&!H0(s)}const q0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],K0=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Q0="6";try{window.__reactRouterVersion=Q0}catch{}const J0=v.createContext({isTransitioning:!1}),G0="startTransition",zd=Hm[G0];function Y0(s){let{basename:a,children:i,future:u,window:d}=s,f=v.useRef();f.current==null&&(f.current=Ym({window:d,v5Compat:!0}));let m=f.current,[h,x]=v.useState({action:m.action,location:m.location}),{v7_startTransition:y}=u||{},k=v.useCallback(C=>{y&&zd?zd(()=>x(C)):x(C)},[x,y]);return v.useLayoutEffect(()=>m.listen(k),[m,k]),v.useEffect(()=>I0(u),[u]),v.createElement(B0,{basename:a,children:i,location:h.location,navigationType:h.action,navigator:m,future:u})}const X0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Z0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eh=v.forwardRef(function(a,i){let{onClick:u,relative:d,reloadDocument:f,replace:m,state:h,target:x,to:y,preventScrollReset:k,viewTransition:C}=a,z=hf(a,q0),{basename:B}=v.useContext(sn),L,P=!1;if(typeof y=="string"&&Z0.test(y)&&(L=y,X0))try{let K=new URL(window.location.href),Q=y.startsWith("//")?new URL(K.protocol+y):new URL(y),me=Rr(Q.pathname,B);Q.origin===K.origin&&me!=null?y=me+Q.search+Q.hash:P=!0}catch{}let N=N0(y,{relative:d}),A=rh(y,{replace:m,state:h,target:x,preventScrollReset:k,relative:d,viewTransition:C});function M(K){u&&u(K),K.defaultPrevented||A(K)}return v.createElement("a",la({},z,{href:L||N,onClick:P||f?u:M,ref:i,target:x}))}),th=v.forwardRef(function(a,i){let{"aria-current":u="page",caseSensitive:d=!1,className:f="",end:m=!1,style:h,to:x,viewTransition:y,children:k}=a,C=hf(a,K0),z=da(x,{relative:C.relative}),B=Ar(),L=v.useContext(uf),{navigator:P,basename:N}=v.useContext(sn),A=L!=null&&sh(z)&&y===!0,M=P.encodeLocation?P.encodeLocation(z).pathname:z.pathname,K=B.pathname,Q=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;d||(K=K.toLowerCase(),Q=Q?Q.toLowerCase():null,M=M.toLowerCase()),Q&&N&&(Q=Rr(Q,N)||Q);const me=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let fe=K===M||!m&&K.startsWith(M)&&K.charAt(me)==="/",O=Q!=null&&(Q===M||!m&&Q.startsWith(M)&&Q.charAt(M.length)==="/"),ae={isActive:fe,isPending:O,isTransitioning:A},de=fe?u:void 0,Y;typeof f=="function"?Y=f(ae):Y=[f,fe?"active":null,O?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let ke=typeof h=="function"?h(ae):h;return v.createElement(eh,la({},C,{"aria-current":de,className:Y,ref:i,style:ke,to:x,viewTransition:y}),typeof k=="function"?k(ae):k)});var jo;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(jo||(jo={}));var Ad;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(Ad||(Ad={}));function nh(s){let a=v.useContext(oa);return a||He(!1),a}function rh(s,a){let{target:i,replace:u,state:d,preventScrollReset:f,relative:m,viewTransition:h}=a===void 0?{}:a,x=ca(),y=Ar(),k=da(s,{relative:m});return v.useCallback(C=>{if(W0(C,i)){C.preventDefault();let z=u!==void 0?u:sa(y)===sa(k);x(s,{replace:z,state:d,preventScrollReset:f,relative:m,viewTransition:h})}},[y,x,k,u,d,i,s,f,m,h])}function sh(s,a){a===void 0&&(a={});let i=v.useContext(J0);i==null&&He(!1);let{basename:u}=nh(jo.useViewTransitionState),d=da(s,{relative:a.relative});if(!i.isTransitioning)return!1;let f=Rr(i.currentLocation.pathname,u)||i.currentLocation.pathname,m=Rr(i.nextLocation.pathname,u)||i.nextLocation.pathname;return yo(d.pathname,m)!=null||yo(d.pathname,f)!=null}/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lh=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xf=(...s)=>s.filter((a,i,u)=>!!a&&a.trim()!==""&&u.indexOf(a)===i).join(" ").trim();/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var ah={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ih=v.forwardRef(({color:s="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:m,...h},x)=>v.createElement("svg",{ref:x,...ah,width:a,height:a,stroke:s,strokeWidth:u?Number(i)*24/Number(a):i,className:xf("lucide",d),...h},[...m.map(([y,k])=>v.createElement(y,k)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ce=(s,a)=>{const i=v.forwardRef(({className:u,...d},f)=>v.createElement(ih,{ref:f,iconNode:a,className:xf(`lucide-${lh(s)}`,u),...d}));return i.displayName=`${s}`,i};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oh=Ce("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gf=Ce("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oo=Ce("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ko=Ce("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const No=Ce("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uh=Ce("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dd=Ce("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yf=Ce("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const So=Ce("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fd=Ce("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ch=Ce("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yn=Ce("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vf=Ce("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dh=Ce("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fh=Ce("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ph=Ce("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wf=Ce("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xl=Ce("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mh=Ce("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jf=Ce("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hh=Ce("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tr=Ce("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ge=Ce("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xh=Ce("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kt=Ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ao=Ce("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gh=Ce("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yh=Ce("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pn=Ce("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rn=Ce("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ln=Ce("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tr=Ce("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vh=Ce("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aa=Ce("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fa=Ce("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const On=Ce("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function kf(s,a){return function(){return s.apply(a,arguments)}}const{toString:wh}=Object.prototype,{getPrototypeOf:pa}=Object,{iterator:ma,toStringTag:Nf}=Symbol,ha=(s=>a=>{const i=wh.call(a);return s[i]||(s[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),It=s=>(s=s.toLowerCase(),a=>ha(a)===s),xa=s=>a=>typeof a===s,{isArray:Dr}=Array,Lr=xa("undefined");function Ls(s){return s!==null&&!Lr(s)&&s.constructor!==null&&!Lr(s.constructor)&&vt(s.constructor.isBuffer)&&s.constructor.isBuffer(s)}const Sf=It("ArrayBuffer");function jh(s){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(s):a=s&&s.buffer&&Sf(s.buffer),a}const kh=xa("string"),vt=xa("function"),bf=xa("number"),Os=s=>s!==null&&typeof s=="object",Nh=s=>s===!0||s===!1,ta=s=>{if(ha(s)!=="object")return!1;const a=pa(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Nf in s)&&!(ma in s)},Sh=s=>{if(!Os(s)||Ls(s))return!1;try{return Object.keys(s).length===0&&Object.getPrototypeOf(s)===Object.prototype}catch{return!1}},bh=It("Date"),_h=It("File"),Ch=s=>!!(s&&typeof s.uri<"u"),Eh=s=>s&&typeof s.getParts<"u",Ph=It("Blob"),Rh=It("FileList"),Th=s=>Os(s)&&vt(s.pipe);function Lh(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ud=Lh(),Md=typeof Ud.FormData<"u"?Ud.FormData:void 0,Oh=s=>{if(!s)return!1;if(Md&&s instanceof Md)return!0;const a=pa(s);if(!a||a===Object.prototype||!vt(s.append))return!1;const i=ha(s);return i==="formdata"||i==="object"&&vt(s.toString)&&s.toString()==="[object FormData]"},zh=It("URLSearchParams"),[Ah,Dh,Fh,Uh]=["ReadableStream","Request","Response","Headers"].map(It),Mh=s=>s.trim?s.trim():s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zs(s,a,{allOwnKeys:i=!1}={}){if(s===null||typeof s>"u")return;let u,d;if(typeof s!="object"&&(s=[s]),Dr(s))for(u=0,d=s.length;u0;)if(d=i[u],a===d.toLowerCase())return d;return null}const Xn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Cf=s=>!Lr(s)&&s!==Xn;function bo(...s){const{caseless:a,skipUndefined:i}=Cf(this)&&this||{},u={},d=(f,m)=>{if(m==="__proto__"||m==="constructor"||m==="prototype")return;const h=a&&_f(u,m)||m,x=_o(u,h)?u[h]:void 0;ta(x)&&ta(f)?u[h]=bo(x,f):ta(f)?u[h]=bo({},f):Dr(f)?u[h]=f.slice():(!i||!Lr(f))&&(u[h]=f)};for(let f=0,m=s.length;f(zs(a,(d,f)=>{i&&vt(d)?Object.defineProperty(s,f,{__proto__:null,value:kf(d,i),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(s,f,{__proto__:null,value:d,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:u}),s),$h=s=>(s.charCodeAt(0)===65279&&(s=s.slice(1)),s),Bh=(s,a,i,u)=>{s.prototype=Object.create(a.prototype,u),Object.defineProperty(s.prototype,"constructor",{__proto__:null,value:s,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(s,"super",{__proto__:null,value:a.prototype}),i&&Object.assign(s.prototype,i)},Vh=(s,a,i,u)=>{let d,f,m;const h={};if(a=a||{},s==null)return a;do{for(d=Object.getOwnPropertyNames(s),f=d.length;f-- >0;)m=d[f],(!u||u(m,s,a))&&!h[m]&&(a[m]=s[m],h[m]=!0);s=i!==!1&&pa(s)}while(s&&(!i||i(s,a))&&s!==Object.prototype);return a},Hh=(s,a,i)=>{s=String(s),(i===void 0||i>s.length)&&(i=s.length),i-=a.length;const u=s.indexOf(a,i);return u!==-1&&u===i},Wh=s=>{if(!s)return null;if(Dr(s))return s;let a=s.length;if(!bf(a))return null;const i=new Array(a);for(;a-- >0;)i[a]=s[a];return i},qh=(s=>a=>s&&a instanceof s)(typeof Uint8Array<"u"&&pa(Uint8Array)),Kh=(s,a)=>{const u=(s&&s[ma]).call(s);let d;for(;(d=u.next())&&!d.done;){const f=d.value;a.call(s,f[0],f[1])}},Qh=(s,a)=>{let i;const u=[];for(;(i=s.exec(a))!==null;)u.push(i);return u},Jh=It("HTMLFormElement"),Gh=s=>s.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,u,d){return u.toUpperCase()+d}),_o=(({hasOwnProperty:s})=>(a,i)=>s.call(a,i))(Object.prototype),Yh=It("RegExp"),Ef=(s,a)=>{const i=Object.getOwnPropertyDescriptors(s),u={};zs(i,(d,f)=>{let m;(m=a(d,f,s))!==!1&&(u[f]=m||d)}),Object.defineProperties(s,u)},Xh=s=>{Ef(s,(a,i)=>{if(vt(s)&&["arguments","caller","callee"].includes(i))return!1;const u=s[i];if(vt(u)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Zh=(s,a)=>{const i={},u=d=>{d.forEach(f=>{i[f]=!0})};return Dr(s)?u(s):u(String(s).split(a)),i},ex=()=>{},tx=(s,a)=>s!=null&&Number.isFinite(s=+s)?s:a;function nx(s){return!!(s&&vt(s.append)&&s[Nf]==="FormData"&&s[ma])}const rx=s=>{const a=new WeakSet,i=u=>{if(Os(u)){if(a.has(u))return;if(Ls(u))return u;if(!("toJSON"in u)){a.add(u);const d=Dr(u)?[]:{};return zs(u,(f,m)=>{const h=i(f);!Lr(h)&&(d[m]=h)}),a.delete(u),d}}return u};return i(s)},sx=It("AsyncFunction"),lx=s=>s&&(Os(s)||vt(s))&&vt(s.then)&&vt(s.catch),Pf=((s,a)=>s?setImmediate:a?((i,u)=>(Xn.addEventListener("message",({source:d,data:f})=>{d===Xn&&f===i&&u.length&&u.shift()()},!1),d=>{u.push(d),Xn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",vt(Xn.postMessage)),ax=typeof queueMicrotask<"u"?queueMicrotask.bind(Xn):typeof process<"u"&&process.nextTick||Pf,ix=s=>s!=null&&vt(s[ma]),_={isArray:Dr,isArrayBuffer:Sf,isBuffer:Ls,isFormData:Oh,isArrayBufferView:jh,isString:kh,isNumber:bf,isBoolean:Nh,isObject:Os,isPlainObject:ta,isEmptyObject:Sh,isReadableStream:Ah,isRequest:Dh,isResponse:Fh,isHeaders:Uh,isUndefined:Lr,isDate:bh,isFile:_h,isReactNativeBlob:Ch,isReactNative:Eh,isBlob:Ph,isRegExp:Yh,isFunction:vt,isStream:Th,isURLSearchParams:zh,isTypedArray:qh,isFileList:Rh,forEach:zs,merge:bo,extend:Ih,trim:Mh,stripBOM:$h,inherits:Bh,toFlatObject:Vh,kindOf:ha,kindOfTest:It,endsWith:Hh,toArray:Wh,forEachEntry:Kh,matchAll:Qh,isHTMLForm:Jh,hasOwnProperty:_o,hasOwnProp:_o,reduceDescriptors:Ef,freezeMethods:Xh,toObjectSet:Zh,toCamelCase:Gh,noop:ex,toFiniteNumber:tx,findKey:_f,global:Xn,isContextDefined:Cf,isSpecCompliantForm:nx,toJSONObject:rx,isAsyncFn:sx,isThenable:lx,setImmediate:Pf,asap:ax,isIterable:ix},ox=_.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ux=s=>{const a={};let i,u,d;return s&&s.split(` `).forEach(function(m){d=m.indexOf(":"),i=m.substring(0,d).trim().toLowerCase(),u=m.substring(d+1).trim(),!(!i||a[i]&&ox[i])&&(i==="set-cookie"?a[i]?a[i].push(u):a[i]=[u]:a[i]=a[i]?a[i]+", "+u:u)}),a};function cx(s){let a=0,i=s.length;for(;aa;){const u=s.charCodeAt(i-1);if(u!==9&&u!==32)break;i-=1}return a===0&&i===s.length?s:s.slice(a,i)}const dx=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),fx=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Do(s,a){return _.isArray(s)?s.map(i=>Do(i,a)):cx(String(s).replace(a,""))}const px=s=>Do(s,dx),mx=s=>Do(s,fx);function Rf(s){const a=Object.create(null);return _.forEach(s.toJSON(),(i,u)=>{a[u]=mx(i)}),a}const Id=Symbol("internals");function Ps(s){return s&&String(s).trim().toLowerCase()}function na(s){return s===!1||s==null?s:_.isArray(s)?s.map(na):px(String(s))}function hx(s){const a=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let u;for(;u=i.exec(s);)a[u[1]]=u[2];return a}const xx=s=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());function uo(s,a,i,u,d){if(_.isFunction(u))return u.call(this,a,i);if(d&&(a=i),!!_.isString(a)){if(_.isString(u))return a.indexOf(u)!==-1;if(_.isRegExp(u))return u.test(a)}}function gx(s){return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,i,u)=>i.toUpperCase()+u)}function yx(s,a){const i=_.toCamelCase(" "+a);["get","set","has"].forEach(u=>{Object.defineProperty(s,u+i,{__proto__:null,value:function(d,f,m){return this[u].call(this,a,d,f,m)},configurable:!0})})}let dt=class{constructor(a){a&&this.set(a)}set(a,i,u){const d=this;function f(h,x,y){const k=Ps(x);if(!k)throw new Error("header name must be a non-empty string");const C=_.findKey(d,k);(!C||d[C]===void 0||y===!0||y===void 0&&d[C]!==!1)&&(d[C||x]=na(h))}const m=(h,x)=>_.forEach(h,(y,k)=>f(y,k,x));if(_.isPlainObject(a)||a instanceof this.constructor)m(a,i);else if(_.isString(a)&&(a=a.trim())&&!xx(a))m(ux(a),i);else if(_.isObject(a)&&_.isIterable(a)){let h={},x,y;for(const k of a){if(!_.isArray(k))throw TypeError("Object iterator must return a key-value pair");h[y=k[0]]=(x=h[y])?_.isArray(x)?[...x,k[1]]:[x,k[1]]:k[1]}m(h,i)}else a!=null&&f(i,a,u);return this}get(a,i){if(a=Ps(a),a){const u=_.findKey(this,a);if(u){const d=this[u];if(!i)return d;if(i===!0)return hx(d);if(_.isFunction(i))return i.call(this,d,u);if(_.isRegExp(i))return i.exec(d);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,i){if(a=Ps(a),a){const u=_.findKey(this,a);return!!(u&&this[u]!==void 0&&(!i||uo(this,this[u],u,i)))}return!1}delete(a,i){const u=this;let d=!1;function f(m){if(m=Ps(m),m){const h=_.findKey(u,m);h&&(!i||uo(u,u[h],h,i))&&(delete u[h],d=!0)}}return _.isArray(a)?a.forEach(f):f(a),d}clear(a){const i=Object.keys(this);let u=i.length,d=!1;for(;u--;){const f=i[u];(!a||uo(this,this[f],f,a,!0))&&(delete this[f],d=!0)}return d}normalize(a){const i=this,u={};return _.forEach(this,(d,f)=>{const m=_.findKey(u,f);if(m){i[m]=na(d),delete i[f];return}const h=a?gx(f):String(f).trim();h!==f&&delete i[f],i[h]=na(d),u[h]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const i=Object.create(null);return _.forEach(this,(u,d)=>{u!=null&&u!==!1&&(i[d]=a&&_.isArray(u)?u.join(", "):u)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,i])=>a+": "+i).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...i){const u=new this(a);return i.forEach(d=>u.set(d)),u}static accessor(a){const u=(this[Id]=this[Id]={accessors:{}}).accessors,d=this.prototype;function f(m){const h=Ps(m);u[h]||(yx(d,m),u[h]=!0)}return _.isArray(a)?a.forEach(f):f(a),this}};dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(dt.prototype,({value:s},a)=>{let i=a[0].toUpperCase()+a.slice(1);return{get:()=>s,set(u){this[i]=u}}});_.freezeMethods(dt);const vx="[REDACTED ****]";function wx(s){if(_.hasOwnProp(s,"toJSON"))return!0;let a=Object.getPrototypeOf(s);for(;a&&a!==Object.prototype;){if(_.hasOwnProp(a,"toJSON"))return!0;a=Object.getPrototypeOf(a)}return!1}function jx(s,a){const i=new Set(a.map(f=>String(f).toLowerCase())),u=[],d=f=>{if(f===null||typeof f!="object"||_.isBuffer(f))return f;if(u.indexOf(f)!==-1)return;f instanceof dt&&(f=f.toJSON()),u.push(f);let m;if(_.isArray(f))m=[],f.forEach((h,x)=>{const y=d(h);_.isUndefined(y)||(m[x]=y)});else{if(!_.isPlainObject(f)&&wx(f))return u.pop(),f;m=Object.create(null);for(const[h,x]of Object.entries(f)){const y=i.has(h.toLowerCase())?vx:d(x);_.isUndefined(y)||(m[h]=y)}}return u.pop(),m};return d(s)}let le=class Tf extends Error{static from(a,i,u,d,f,m){const h=new Tf(a.message,i||a.code,u,d,f);return h.cause=a,h.name=a.name,a.status!=null&&h.status==null&&(h.status=a.status),m&&Object.assign(h,m),h}constructor(a,i,u,d,f){super(a),Object.defineProperty(this,"message",{__proto__:null,value:a,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,i&&(this.code=i),u&&(this.config=u),d&&(this.request=d),f&&(this.response=f,this.status=f.status)}toJSON(){const a=this.config,i=a&&_.hasOwnProp(a,"redact")?a.redact:void 0,u=_.isArray(i)&&i.length>0?jx(a,i):_.toJSONObject(a);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:u,code:this.code,status:this.status}}};le.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";le.ERR_BAD_OPTION="ERR_BAD_OPTION";le.ECONNABORTED="ECONNABORTED";le.ETIMEDOUT="ETIMEDOUT";le.ECONNREFUSED="ECONNREFUSED";le.ERR_NETWORK="ERR_NETWORK";le.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";le.ERR_DEPRECATED="ERR_DEPRECATED";le.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";le.ERR_BAD_REQUEST="ERR_BAD_REQUEST";le.ERR_CANCELED="ERR_CANCELED";le.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";le.ERR_INVALID_URL="ERR_INVALID_URL";le.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const kx=null;function Co(s){return _.isPlainObject(s)||_.isArray(s)}function Lf(s){return _.endsWith(s,"[]")?s.slice(0,-2):s}function co(s,a,i){return s?s.concat(a).map(function(d,f){return d=Lf(d),!i&&f?"["+d+"]":d}).join(i?".":""):a}function Nx(s){return _.isArray(s)&&!s.some(Co)}const Sx=_.toFlatObject(_,{},null,function(a){return/^is[A-Z]/.test(a)});function ga(s,a,i){if(!_.isObject(s))throw new TypeError("target must be an object");a=a||new FormData,i=_.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,A){return!_.isUndefined(A[N])});const u=i.metaTokens,d=i.visitor||C,f=i.dots,m=i.indexes,h=i.Blob||typeof Blob<"u"&&Blob,x=i.maxDepth===void 0?100:i.maxDepth,y=h&&_.isSpecCompliantForm(a);if(!_.isFunction(d))throw new TypeError("visitor must be a function");function k(P){if(P===null)return"";if(_.isDate(P))return P.toISOString();if(_.isBoolean(P))return P.toString();if(!y&&_.isBlob(P))throw new le("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(P)||_.isTypedArray(P)?y&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function C(P,N,A){let M=P;if(_.isReactNative(a)&&_.isReactNativeBlob(P))return a.append(co(A,N,f),k(P)),!1;if(P&&!A&&typeof P=="object"){if(_.endsWith(N,"{}"))N=u?N:N.slice(0,-2),P=JSON.stringify(P);else if(_.isArray(P)&&Nx(P)||(_.isFileList(P)||_.endsWith(N,"[]"))&&(M=_.toArray(P)))return N=Lf(N),M.forEach(function(Q,me){!(_.isUndefined(Q)||Q===null)&&a.append(m===!0?co([N],me,f):m===null?N:N+"[]",k(Q))}),!1}return Co(P)?!0:(a.append(co(A,N,f),k(P)),!1)}const z=[],B=Object.assign(Sx,{defaultVisitor:C,convertValue:k,isVisitable:Co});function L(P,N,A=0){if(!_.isUndefined(P)){if(A>x)throw new le("Object is too deeply nested ("+A+" levels). Max depth: "+x,le.ERR_FORM_DATA_DEPTH_EXCEEDED);if(z.indexOf(P)!==-1)throw Error("Circular reference detected in "+N.join("."));z.push(P),_.forEach(P,function(K,Q){(!(_.isUndefined(K)||K===null)&&d.call(a,K,_.isString(Q)?Q.trim():Q,N,B))===!0&&L(K,N?N.concat(Q):[Q],A+1)}),z.pop()}}if(!_.isObject(s))throw new TypeError("data must be an object");return L(s),a}function $d(s){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(s).replace(/[!'()~]|%20/g,function(u){return a[u]})}function Fo(s,a){this._pairs=[],s&&ga(s,this,a)}const Of=Fo.prototype;Of.append=function(a,i){this._pairs.push([a,i])};Of.toString=function(a){const i=a?function(u){return a.call(this,u,$d)}:$d;return this._pairs.map(function(d){return i(d[0])+"="+i(d[1])},"").join("&")};function bx(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zf(s,a,i){if(!a)return s;const u=i&&i.encode||bx,d=_.isFunction(i)?{serialize:i}:i,f=d&&d.serialize;let m;if(f?m=f(a,d):m=_.isURLSearchParams(a)?a.toString():new Fo(a,d).toString(u),m){const h=s.indexOf("#");h!==-1&&(s=s.slice(0,h)),s+=(s.indexOf("?")===-1?"?":"&")+m}return s}class Bd{constructor(){this.handlers=[]}use(a,i,u){return this.handlers.push({fulfilled:a,rejected:i,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){_.forEach(this.handlers,function(u){u!==null&&a(u)})}}const Uo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_x=typeof URLSearchParams<"u"?URLSearchParams:Fo,Cx=typeof FormData<"u"?FormData:null,Ex=typeof Blob<"u"?Blob:null,Px={isBrowser:!0,classes:{URLSearchParams:_x,FormData:Cx,Blob:Ex},protocols:["http","https","file","blob","url","data"]},Mo=typeof window<"u"&&typeof document<"u",Eo=typeof navigator=="object"&&navigator||void 0,Rx=Mo&&(!Eo||["ReactNative","NativeScript","NS"].indexOf(Eo.product)<0),Tx=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Lx=Mo&&window.location.href||"http://localhost",Ox=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Mo,hasStandardBrowserEnv:Rx,hasStandardBrowserWebWorkerEnv:Tx,navigator:Eo,origin:Lx},Symbol.toStringTag,{value:"Module"})),ot={...Ox,...Px};function zx(s,a){return ga(s,new ot.classes.URLSearchParams,{visitor:function(i,u,d,f){return ot.isNode&&_.isBuffer(i)?(this.append(u,i.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...a})}function Ax(s){return _.matchAll(/\w+|\[(\w*)]/g,s).map(a=>a[0]==="[]"?"":a[1]||a[0])}function Dx(s){const a={},i=Object.keys(s);let u;const d=i.length;let f;for(u=0;u=i.length;return m=!m&&_.isArray(d)?d.length:m,x?(_.hasOwnProp(d,m)?d[m]=_.isArray(d[m])?d[m].concat(u):[d[m],u]:d[m]=u,!h):((!_.hasOwnProp(d,m)||!_.isObject(d[m]))&&(d[m]=[]),a(i,u,d[m],f)&&_.isArray(d[m])&&(d[m]=Dx(d[m])),!h)}if(_.isFormData(s)&&_.isFunction(s.entries)){const i={};return _.forEachEntry(s,(u,d)=>{a(Ax(u),d,i,0)}),i}return null}const Er=(s,a)=>s!=null&&_.hasOwnProp(s,a)?s[a]:void 0;function Fx(s,a,i){if(_.isString(s))try{return(a||JSON.parse)(s),_.trim(s)}catch(u){if(u.name!=="SyntaxError")throw u}return(i||JSON.stringify)(s)}const As={transitional:Uo,adapter:["xhr","http","fetch"],transformRequest:[function(a,i){const u=i.getContentType()||"",d=u.indexOf("application/json")>-1,f=_.isObject(a);if(f&&_.isHTMLForm(a)&&(a=new FormData(a)),_.isFormData(a))return d?JSON.stringify(Af(a)):a;if(_.isArrayBuffer(a)||_.isBuffer(a)||_.isStream(a)||_.isFile(a)||_.isBlob(a)||_.isReadableStream(a))return a;if(_.isArrayBufferView(a))return a.buffer;if(_.isURLSearchParams(a))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let h;if(f){const x=Er(this,"formSerializer");if(u.indexOf("application/x-www-form-urlencoded")>-1)return zx(a,x).toString();if((h=_.isFileList(a))||u.indexOf("multipart/form-data")>-1){const y=Er(this,"env"),k=y&&y.FormData;return ga(h?{"files[]":a}:a,k&&new k,x)}}return f||d?(i.setContentType("application/json",!1),Fx(a)):a}],transformResponse:[function(a){const i=Er(this,"transitional")||As.transitional,u=i&&i.forcedJSONParsing,d=Er(this,"responseType"),f=d==="json";if(_.isResponse(a)||_.isReadableStream(a))return a;if(a&&_.isString(a)&&(u&&!d||f)){const h=!(i&&i.silentJSONParsing)&&f;try{return JSON.parse(a,Er(this,"parseReviver"))}catch(x){if(h)throw x.name==="SyntaxError"?le.from(x,le.ERR_BAD_RESPONSE,this,null,Er(this,"response")):x}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ot.classes.FormData,Blob:ot.classes.Blob},validateStatus:function(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch","query"],s=>{As.headers[s]={}});function fo(s,a){const i=this||As,u=a||i,d=dt.from(u.headers);let f=u.data;return _.forEach(s,function(h){f=h.call(i,f,d.normalize(),a?a.status:void 0)}),d.normalize(),f}function Df(s){return!!(s&&s.__CANCEL__)}let Ds=class extends le{constructor(a,i,u){super(a??"canceled",le.ERR_CANCELED,i,u),this.name="CanceledError",this.__CANCEL__=!0}};function Ff(s,a,i){const u=i.config.validateStatus;!i.status||!u||u(i.status)?s(i):a(new le("Request failed with status code "+i.status,i.status>=400&&i.status<500?le.ERR_BAD_REQUEST:le.ERR_BAD_RESPONSE,i.config,i.request,i))}function Ux(s){const a=/^([-+\w]{1,25}):(?:\/\/)?/.exec(s);return a&&a[1]||""}function Mx(s,a){s=s||10;const i=new Array(s),u=new Array(s);let d=0,f=0,m;return a=a!==void 0?a:1e3,function(x){const y=Date.now(),k=u[f];m||(m=y),i[d]=x,u[d]=y;let C=f,z=0;for(;C!==d;)z+=i[C++],C=C%s;if(d=(d+1)%s,d===f&&(f=(f+1)%s),y-m{i=k,d=null,f&&(clearTimeout(f),f=null),s(...y)};return[(...y)=>{const k=Date.now(),C=k-i;C>=u?m(y,k):(d=y,f||(f=setTimeout(()=>{f=null,m(d)},u-C)))},()=>d&&m(d)]}const ia=(s,a,i=3)=>{let u=0;const d=Mx(50,250);return Ix(f=>{if(!f||typeof f.loaded!="number")return;const m=f.loaded,h=f.lengthComputable?f.total:void 0,x=h!=null?Math.min(m,h):m,y=Math.max(0,x-u),k=d(y);u=Math.max(u,x);const C={loaded:x,total:h,progress:h?x/h:void 0,bytes:y,rate:k||void 0,estimated:k&&h?(h-x)/k:void 0,event:f,lengthComputable:h!=null,[a?"download":"upload"]:!0};s(C)},i)},Vd=(s,a)=>{const i=s!=null;return[u=>a[0]({lengthComputable:i,total:s,loaded:u}),a[1]]},Hd=s=>(...a)=>_.asap(()=>s(...a)),$x=ot.hasStandardBrowserEnv?((s,a)=>i=>(i=new URL(i,ot.origin),s.protocol===i.protocol&&s.host===i.host&&(a||s.port===i.port)))(new URL(ot.origin),ot.navigator&&/(msie|trident)/i.test(ot.navigator.userAgent)):()=>!0,Bx=ot.hasStandardBrowserEnv?{write(s,a,i,u,d,f,m){if(typeof document>"u")return;const h=[`${s}=${encodeURIComponent(a)}`];_.isNumber(i)&&h.push(`expires=${new Date(i).toUTCString()}`),_.isString(u)&&h.push(`path=${u}`),_.isString(d)&&h.push(`domain=${d}`),f===!0&&h.push("secure"),_.isString(m)&&h.push(`SameSite=${m}`),document.cookie=h.join("; ")},read(s){if(typeof document>"u")return null;const a=document.cookie.split(";");for(let i=0;is instanceof dt?{...s}:s;function nr(s,a){a=a||{};const i=Object.create(null);Object.defineProperty(i,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function u(y,k,C,z){return _.isPlainObject(y)&&_.isPlainObject(k)?_.merge.call({caseless:z},y,k):_.isPlainObject(k)?_.merge({},k):_.isArray(k)?k.slice():k}function d(y,k,C,z){if(_.isUndefined(k)){if(!_.isUndefined(y))return u(void 0,y,C,z)}else return u(y,k,C,z)}function f(y,k){if(!_.isUndefined(k))return u(void 0,k)}function m(y,k){if(_.isUndefined(k)){if(!_.isUndefined(y))return u(void 0,y)}else return u(void 0,k)}function h(y,k,C){if(_.hasOwnProp(a,C))return u(y,k);if(_.hasOwnProp(s,C))return u(void 0,y)}const x={url:f,method:f,data:f,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,allowedSocketPaths:m,responseEncoding:m,validateStatus:h,headers:(y,k,C)=>d(Wd(y),Wd(k),C,!0)};return _.forEach(Object.keys({...s,...a}),function(k){if(k==="__proto__"||k==="constructor"||k==="prototype")return;const C=_.hasOwnProp(x,k)?x[k]:d,z=_.hasOwnProp(s,k)?s[k]:void 0,B=_.hasOwnProp(a,k)?a[k]:void 0,L=C(z,B,k);_.isUndefined(L)&&C!==h||(i[k]=L)}),i}const Wx=["content-type","content-length"];function qx(s,a,i){if(i!=="content-only"){s.set(a);return}Object.entries(a).forEach(([u,d])=>{Wx.includes(u.toLowerCase())&&s.set(u,d)})}const Kx=s=>encodeURIComponent(s).replace(/%([0-9A-F]{2})/gi,(a,i)=>String.fromCharCode(parseInt(i,16))),Mf=s=>{const a=nr({},s),i=z=>_.hasOwnProp(a,z)?a[z]:void 0,u=i("data");let d=i("withXSRFToken");const f=i("xsrfHeaderName"),m=i("xsrfCookieName");let h=i("headers");const x=i("auth"),y=i("baseURL"),k=i("allowAbsoluteUrls"),C=i("url");if(a.headers=h=dt.from(h),a.url=zf(Uf(y,C,k),s.params,s.paramsSerializer),x&&h.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?Kx(x.password):""))),_.isFormData(u)&&(ot.hasStandardBrowserEnv||ot.hasStandardBrowserWebWorkerEnv?h.setContentType(void 0):_.isFunction(u.getHeaders)&&qx(h,u.getHeaders(),i("formDataHeaderPolicy"))),ot.hasStandardBrowserEnv&&(_.isFunction(d)&&(d=d(a)),d===!0||d==null&&$x(a.url))){const B=f&&m&&Bx.read(m);B&&h.set(f,B)}return a},Qx=typeof XMLHttpRequest<"u",Jx=Qx&&function(s){return new Promise(function(i,u){const d=Mf(s);let f=d.data;const m=dt.from(d.headers).normalize();let{responseType:h,onUploadProgress:x,onDownloadProgress:y}=d,k,C,z,B,L;function P(){B&&B(),L&&L(),d.cancelToken&&d.cancelToken.unsubscribe(k),d.signal&&d.signal.removeEventListener("abort",k)}let N=new XMLHttpRequest;N.open(d.method.toUpperCase(),d.url,!0),N.timeout=d.timeout;function A(){if(!N)return;const K=dt.from("getAllResponseHeaders"in N&&N.getAllResponseHeaders()),me={data:!h||h==="text"||h==="json"?N.responseText:N.response,status:N.status,statusText:N.statusText,headers:K,config:s,request:N};Ff(function(O){i(O),P()},function(O){u(O),P()},me),N=null}"onloadend"in N?N.onloadend=A:N.onreadystatechange=function(){!N||N.readyState!==4||N.status===0&&!(N.responseURL&&N.responseURL.startsWith("file:"))||setTimeout(A)},N.onabort=function(){N&&(u(new le("Request aborted",le.ECONNABORTED,s,N)),P(),N=null)},N.onerror=function(Q){const me=Q&&Q.message?Q.message:"Network Error",fe=new le(me,le.ERR_NETWORK,s,N);fe.event=Q||null,u(fe),P(),N=null},N.ontimeout=function(){let Q=d.timeout?"timeout of "+d.timeout+"ms exceeded":"timeout exceeded";const me=d.transitional||Uo;d.timeoutErrorMessage&&(Q=d.timeoutErrorMessage),u(new le(Q,me.clarifyTimeoutError?le.ETIMEDOUT:le.ECONNABORTED,s,N)),P(),N=null},f===void 0&&m.setContentType(null),"setRequestHeader"in N&&_.forEach(Rf(m),function(Q,me){N.setRequestHeader(me,Q)}),_.isUndefined(d.withCredentials)||(N.withCredentials=!!d.withCredentials),h&&h!=="json"&&(N.responseType=d.responseType),y&&([z,L]=ia(y,!0),N.addEventListener("progress",z)),x&&N.upload&&([C,B]=ia(x),N.upload.addEventListener("progress",C),N.upload.addEventListener("loadend",B)),(d.cancelToken||d.signal)&&(k=K=>{N&&(u(!K||K.type?new Ds(null,s,N):K),N.abort(),P(),N=null)},d.cancelToken&&d.cancelToken.subscribe(k),d.signal&&(d.signal.aborted?k():d.signal.addEventListener("abort",k)));const M=Ux(d.url);if(M&&!ot.protocols.includes(M)){u(new le("Unsupported protocol "+M+":",le.ERR_BAD_REQUEST,s));return}N.send(f||null)})},Gx=(s,a)=>{if(s=s?s.filter(Boolean):[],!a&&!s.length)return;const i=new AbortController;let u=!1;const d=function(x){if(!u){u=!0,m();const y=x instanceof Error?x:this.reason;i.abort(y instanceof le?y:new Ds(y instanceof Error?y.message:y))}};let f=a&&setTimeout(()=>{f=null,d(new le(`timeout of ${a}ms exceeded`,le.ETIMEDOUT))},a);const m=()=>{s&&(f&&clearTimeout(f),f=null,s.forEach(x=>{x.unsubscribe?x.unsubscribe(d):x.removeEventListener("abort",d)}),s=null)};s.forEach(x=>x.addEventListener("abort",d));const{signal:h}=i;return h.unsubscribe=()=>_.asap(m),h},Yx=function*(s,a){let i=s.byteLength;if(i{const d=Xx(s,a);let f=0,m,h=x=>{m||(m=!0,u&&u(x))};return new ReadableStream({async pull(x){try{const{done:y,value:k}=await d.next();if(y){h(),x.close();return}let C=k.byteLength;if(i){let z=f+=C;i(z)}x.enqueue(new Uint8Array(k))}catch(y){throw h(y),y}},cancel(x){return h(x),d.return()}},{highWaterMark:2})};function eg(s){if(!s||typeof s!="string"||!s.startsWith("data:"))return 0;const a=s.indexOf(",");if(a<0)return 0;const i=s.slice(5,a),u=s.slice(a+1);if(/;base64/i.test(i)){let m=u.length;const h=u.length;for(let B=0;B=48&&L<=57||L>=65&&L<=70||L>=97&&L<=102)&&(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(m-=2,B+=2)}let x=0,y=h-1;const k=B=>B>=2&&u.charCodeAt(B-2)===37&&u.charCodeAt(B-1)===51&&(u.charCodeAt(B)===68||u.charCodeAt(B)===100);y>=0&&(u.charCodeAt(y)===61?(x++,y--):k(y)&&(x++,y-=3)),x===1&&y>=0&&(u.charCodeAt(y)===61||k(y))&&x++;const z=Math.floor(m/4)*3-(x||0);return z>0?z:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(u,"utf8");let f=0;for(let m=0,h=u.length;m=55296&&x<=56319&&m+1=56320&&y<=57343?(f+=4,m++):f+=3}else f+=3}return f}const Io="1.16.1",Kd=64*1024,{isFunction:Zl}=_,Qd=(s,...a)=>{try{return!!s(...a)}catch{return!1}},tg=s=>{const a=_.global!==void 0&&_.global!==null?_.global:globalThis,{ReadableStream:i,TextEncoder:u}=a;s=_.merge.call({skipUndefined:!0},{Request:a.Request,Response:a.Response},s);const{fetch:d,Request:f,Response:m}=s,h=d?Zl(d):typeof fetch=="function",x=Zl(f),y=Zl(m);if(!h)return!1;const k=h&&Zl(i),C=h&&(typeof u=="function"?(A=>M=>A.encode(M))(new u):async A=>new Uint8Array(await new f(A).arrayBuffer())),z=x&&k&&Qd(()=>{let A=!1;const M=new f(ot.origin,{body:new i,method:"POST",get duplex(){return A=!0,"half"}}),K=M.headers.has("Content-Type");return M.body!=null&&M.body.cancel(),A&&!K}),B=y&&k&&Qd(()=>_.isReadableStream(new m("").body)),L={stream:B&&(A=>A.body)};h&&["text","arrayBuffer","blob","formData","stream"].forEach(A=>{!L[A]&&(L[A]=(M,K)=>{let Q=M&&M[A];if(Q)return Q.call(M);throw new le(`Response type '${A}' is not supported`,le.ERR_NOT_SUPPORT,K)})});const P=async A=>{if(A==null)return 0;if(_.isBlob(A))return A.size;if(_.isSpecCompliantForm(A))return(await new f(ot.origin,{method:"POST",body:A}).arrayBuffer()).byteLength;if(_.isArrayBufferView(A)||_.isArrayBuffer(A))return A.byteLength;if(_.isURLSearchParams(A)&&(A=A+""),_.isString(A))return(await C(A)).byteLength},N=async(A,M)=>{const K=_.toFiniteNumber(A.getContentLength());return K??P(M)};return async A=>{let{url:M,method:K,data:Q,signal:me,cancelToken:fe,timeout:O,onDownloadProgress:ae,onUploadProgress:de,responseType:Y,headers:ke,withCredentials:Te="same-origin",fetchOptions:ze,maxContentLength:Ee,maxBodyLength:q}=Mf(A);const ge=_.isNumber(Ee)&&Ee>-1,D=_.isNumber(q)&&q>-1;let U=d||fetch;Y=Y?(Y+"").toLowerCase():"text";let ee=Gx([me,fe&&fe.toAbortSignal()],O),G=null;const b=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let I;try{if(ge&&typeof M=="string"&&M.startsWith("data:")&&eg(M)>Ee)throw new le("maxContentLength size of "+Ee+" exceeded",le.ERR_BAD_RESPONSE,A,G);if(D&&K!=="get"&&K!=="head"){const oe=await N(ke,Q);if(typeof oe=="number"&&isFinite(oe)&&oe>q)throw new le("Request body larger than maxBodyLength limit",le.ERR_BAD_REQUEST,A,G)}if(de&&z&&K!=="get"&&K!=="head"&&(I=await N(ke,Q))!==0){let oe=new f(M,{method:"POST",body:Q,duplex:"half"}),F;if(_.isFormData(Q)&&(F=oe.headers.get("content-type"))&&ke.setContentType(F),oe.body){const[ne,je]=Vd(I,ia(Hd(de)));Q=qd(oe.body,Kd,ne,je)}}_.isString(Te)||(Te=Te?"include":"omit");const te=x&&"credentials"in f.prototype;if(_.isFormData(Q)){const oe=ke.getContentType();oe&&/^multipart\/form-data/i.test(oe)&&!/boundary=/i.test(oe)&&ke.delete("content-type")}ke.set("User-Agent","axios/"+Io,!1);const pe={...ze,signal:ee,method:K.toUpperCase(),headers:Rf(ke.normalize()),body:Q,duplex:"half",credentials:te?Te:void 0};G=x&&new f(M,pe);let ye=await(x?U(G,ze):U(M,pe));if(ge){const oe=_.toFiniteNumber(ye.headers.get("content-length"));if(oe!=null&&oe>Ee)throw new le("maxContentLength size of "+Ee+" exceeded",le.ERR_BAD_RESPONSE,A,G)}const Ne=B&&(Y==="stream"||Y==="response");if(B&&ye.body&&(ae||ge||Ne&&b)){const oe={};["status","statusText","headers"].forEach(Le=>{oe[Le]=ye[Le]});const F=_.toFiniteNumber(ye.headers.get("content-length")),[ne,je]=ae&&Vd(F,ia(Hd(ae),!0))||[];let _e=0;const De=Le=>{if(ge&&(_e=Le,_e>Ee))throw new le("maxContentLength size of "+Ee+" exceeded",le.ERR_BAD_RESPONSE,A,G);ne&&ne(Le)};ye=new m(qd(ye.body,Kd,De,()=>{je&&je(),b&&b()}),oe)}Y=Y||"text";let we=await L[_.findKey(L,Y)||"text"](ye,A);if(ge&&!B&&!Ne){let oe;if(we!=null&&(typeof we.byteLength=="number"?oe=we.byteLength:typeof we.size=="number"?oe=we.size:typeof we=="string"&&(oe=typeof u=="function"?new u().encode(we).byteLength:we.length)),typeof oe=="number"&&oe>Ee)throw new le("maxContentLength size of "+Ee+" exceeded",le.ERR_BAD_RESPONSE,A,G)}return!Ne&&b&&b(),await new Promise((oe,F)=>{Ff(oe,F,{data:we,headers:dt.from(ye.headers),status:ye.status,statusText:ye.statusText,config:A,request:G})})}catch(te){if(b&&b(),ee&&ee.aborted&&ee.reason instanceof le){const pe=ee.reason;throw pe.config=A,G&&(pe.request=G),te!==pe&&(pe.cause=te),pe}throw te&&te.name==="TypeError"&&/Load failed|fetch/i.test(te.message)?Object.assign(new le("Network Error",le.ERR_NETWORK,A,G,te&&te.response),{cause:te.cause||te}):le.from(te,te&&te.code,A,G,te&&te.response)}}},ng=new Map,If=s=>{let a=s&&s.env||{};const{fetch:i,Request:u,Response:d}=a,f=[u,d,i];let m=f.length,h=m,x,y,k=ng;for(;h--;)x=f[h],y=k.get(x),y===void 0&&k.set(x,y=h?new Map:tg(a)),k=y;return y};If();const $o={http:kx,xhr:Jx,fetch:{get:If}};_.forEach($o,(s,a)=>{if(s){try{Object.defineProperty(s,"name",{__proto__:null,value:a})}catch{}Object.defineProperty(s,"adapterName",{__proto__:null,value:a})}});const Jd=s=>`- ${s}`,rg=s=>_.isFunction(s)||s===null||s===!1;function sg(s,a){s=_.isArray(s)?s:[s];const{length:i}=s;let u,d;const f={};for(let m=0;m`adapter ${x} `+(y===!1?"is not supported by the environment":"is not available in the build"));let h=i?m.length>1?`since : `+m.map(Jd).join(` `):" "+Jd(m[0]):"as no adapter specified";throw new le("There is no suitable adapter to dispatch the request "+h,"ERR_NOT_SUPPORT")}return d}const $f={getAdapter:sg,adapters:$o};function po(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new Ds(null,s)}function Gd(s){return po(s),s.headers=dt.from(s.headers),s.data=fo.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),$f.getAdapter(s.adapter||As.adapter,s)(s).then(function(u){po(s),s.response=u;try{u.data=fo.call(s,s.transformResponse,u)}finally{delete s.response}return u.headers=dt.from(u.headers),u},function(u){if(!Df(u)&&(po(s),u&&u.response)){s.response=u.response;try{u.response.data=fo.call(s,s.transformResponse,u.response)}finally{delete s.response}u.response.headers=dt.from(u.response.headers)}return Promise.reject(u)})}const ya={};["object","boolean","number","function","string","symbol"].forEach((s,a)=>{ya[s]=function(u){return typeof u===s||"a"+(a<1?"n ":" ")+s}});const Yd={};ya.transitional=function(a,i,u){function d(f,m){return"[Axios v"+Io+"] Transitional option '"+f+"'"+m+(u?". "+u:"")}return(f,m,h)=>{if(a===!1)throw new le(d(m," has been removed"+(i?" in "+i:"")),le.ERR_DEPRECATED);return i&&!Yd[m]&&(Yd[m]=!0,console.warn(d(m," has been deprecated since v"+i+" and will be removed in the near future"))),a?a(f,m,h):!0}};ya.spelling=function(a){return(i,u)=>(console.warn(`${u} is likely a misspelling of ${a}`),!0)};function lg(s,a,i){if(typeof s!="object")throw new le("options must be an object",le.ERR_BAD_OPTION_VALUE);const u=Object.keys(s);let d=u.length;for(;d-- >0;){const f=u[d],m=Object.prototype.hasOwnProperty.call(a,f)?a[f]:void 0;if(m){const h=s[f],x=h===void 0||m(h,f,s);if(x!==!0)throw new le("option "+f+" must be "+x,le.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new le("Unknown option "+f,le.ERR_BAD_OPTION)}}const ra={assertOptions:lg,validators:ya},Tt=ra.validators;let er=class{constructor(a){this.defaults=a||{},this.interceptors={request:new Bd,response:new Bd}}async request(a,i){try{return await this._request(a,i)}catch(u){if(u instanceof Error){let d={};Error.captureStackTrace?Error.captureStackTrace(d):d=new Error;const f=(()=>{if(!d.stack)return"";const m=d.stack.indexOf(` `);return m===-1?"":d.stack.slice(m+1)})();try{if(!u.stack)u.stack=f;else if(f){const m=f.indexOf(` `),h=m===-1?-1:f.indexOf(` `,m+1),x=h===-1?"":f.slice(h+1);String(u.stack).endsWith(x)||(u.stack+=` `+f)}}catch{}}throw u}}_request(a,i){typeof a=="string"?(i=i||{},i.url=a):i=a||{},i=nr(this.defaults,i);const{transitional:u,paramsSerializer:d,headers:f}=i;u!==void 0&&ra.assertOptions(u,{silentJSONParsing:Tt.transitional(Tt.boolean),forcedJSONParsing:Tt.transitional(Tt.boolean),clarifyTimeoutError:Tt.transitional(Tt.boolean),legacyInterceptorReqResOrdering:Tt.transitional(Tt.boolean)},!1),d!=null&&(_.isFunction(d)?i.paramsSerializer={serialize:d}:ra.assertOptions(d,{encode:Tt.function,serialize:Tt.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),ra.assertOptions(i,{baseUrl:Tt.spelling("baseURL"),withXsrfToken:Tt.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=f&&_.merge(f.common,f[i.method]);f&&_.forEach(["delete","get","head","post","put","patch","query","common"],L=>{delete f[L]}),i.headers=dt.concat(m,f);const h=[];let x=!0;this.interceptors.request.forEach(function(P){if(typeof P.runWhen=="function"&&P.runWhen(i)===!1)return;x=x&&P.synchronous;const N=i.transitional||Uo;N&&N.legacyInterceptorReqResOrdering?h.unshift(P.fulfilled,P.rejected):h.push(P.fulfilled,P.rejected)});const y=[];this.interceptors.response.forEach(function(P){y.push(P.fulfilled,P.rejected)});let k,C=0,z;if(!x){const L=[Gd.bind(this),void 0];for(L.unshift(...h),L.push(...y),z=L.length,k=Promise.resolve(i);C{if(!u._listeners)return;let f=u._listeners.length;for(;f-- >0;)u._listeners[f](d);u._listeners=null}),this.promise.then=d=>{let f;const m=new Promise(h=>{u.subscribe(h),f=h}).then(d);return m.cancel=function(){u.unsubscribe(f)},m},a(function(f,m,h){u.reason||(u.reason=new Ds(f,m,h),i(u.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const i=this._listeners.indexOf(a);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const a=new AbortController,i=u=>{a.abort(u)};return this.subscribe(i),a.signal.unsubscribe=()=>this.unsubscribe(i),a.signal}static source(){let a;return{token:new Bf(function(d){a=d}),cancel:a}}};function ig(s){return function(i){return s.apply(null,i)}}function og(s){return _.isObject(s)&&s.isAxiosError===!0}const Po={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Po).forEach(([s,a])=>{Po[a]=s});function Vf(s){const a=new er(s),i=kf(er.prototype.request,a);return _.extend(i,er.prototype,a,{allOwnKeys:!0}),_.extend(i,a,null,{allOwnKeys:!0}),i.create=function(d){return Vf(nr(s,d))},i}const qe=Vf(As);qe.Axios=er;qe.CanceledError=Ds;qe.CancelToken=ag;qe.isCancel=Df;qe.VERSION=Io;qe.toFormData=ga;qe.AxiosError=le;qe.Cancel=qe.CanceledError;qe.all=function(a){return Promise.all(a)};qe.spread=ig;qe.isAxiosError=og;qe.mergeConfig=nr;qe.AxiosHeaders=dt;qe.formToJSON=s=>Af(_.isHTMLForm(s)?new FormData(s):s);qe.getAdapter=$f.getAdapter;qe.HttpStatusCode=Po;qe.default=qe;const{Axios:Qg,AxiosError:Jg,CanceledError:Gg,isCancel:Yg,CancelToken:Xg,VERSION:Zg,all:ey,Cancel:ty,isAxiosError:ny,spread:ry,toFormData:sy,AxiosHeaders:ly,HttpStatusCode:ay,formToJSON:iy,getAdapter:oy,mergeConfig:uy,create:cy}=qe,X=qe.create({baseURL:"/api/admin"});X.interceptors.request.use(s=>{const a=localStorage.getItem("token");return a&&(s.headers.Authorization=`Bearer ${a}`),s});X.interceptors.response.use(s=>s,s=>{var a;return((a=s.response)==null?void 0:a.status)===401&&(localStorage.removeItem("token"),window.location.href="/login"),Promise.reject(s)});async function ug(s,a){const i=new FormData;i.append("username",s),i.append("password",a);const{data:u}=await qe.post("/api/admin/auth/token",i);return u.access_token}function cg(){const[s,a]=v.useState(""),[i,u]=v.useState(""),[d,f]=v.useState(""),[m,h]=v.useState(!1),x=ca();async function y(k){k.preventDefault(),h(!0),f("");try{const C=await ug(s,i);localStorage.setItem("token",C),x("/dashboard")}catch{f("Credenciales incorrectas")}finally{h(!1)}}return l.jsx("div",{className:"min-h-screen bg-dark-900 flex items-center justify-center p-4",children:l.jsxs("div",{className:"w-full max-w-sm",children:[l.jsxs("div",{className:"flex items-center justify-center gap-3 mb-8",children:[l.jsx(fa,{className:"text-primary-500",size:32}),l.jsx("h1",{className:"text-3xl font-bold",children:"KiraStream"})]}),l.jsxs("form",{onSubmit:y,className:"bg-dark-800 rounded-xl p-6 space-y-4 border border-dark-700",children:[l.jsx("h2",{className:"text-center text-gray-400 text-sm",children:"Panel de Administración"}),d&&l.jsx("div",{className:"bg-red-900/30 border border-red-700 text-red-400 text-sm rounded p-2 text-center",children:d}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Usuario"}),l.jsx("input",{value:s,onChange:k=>a(k.target.value),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-primary-500",autoComplete:"username",required:!0})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Contraseña"}),l.jsx("input",{type:"password",value:i,onChange:k=>u(k.target.value),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-primary-500",autoComplete:"current-password",required:!0})]}),l.jsx("button",{type:"submit",disabled:m,className:"w-full bg-primary-500 hover:bg-primary-600 disabled:opacity-50 rounded-lg py-2 text-sm font-medium transition-colors",children:m?"Entrando...":"Entrar"})]})]})})}function Hf(s){var a,i,u="";if(typeof s=="string"||typeof s=="number")u+=s;else if(typeof s=="object")if(Array.isArray(s)){var d=s.length;for(a=0;a{const L=async()=>{try{const{data:N}=await X.get("/providers/notifications/all");m(N.total||0),a&&d(N.notifications||[])}catch{}};L();const P=setInterval(L,12e4);return()=>clearInterval(P)},[a]),v.useEffect(()=>{a&&C()},[a]),v.useEffect(()=>{const L=P=>{y.current&&!y.current.contains(P.target)&&i(!1)};return a&&document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[a]);async function z(L,P,N){await X.post("/providers/notifications/dismiss",{provider_id:L,category_id:P,category_type:N}),d(A=>A.map(M=>M.provider_id===L?{...M,categories:M.categories.filter(K=>!(K.id===P&&K.type===N))}:M).filter(M=>M.categories.length>0)),m(A=>Math.max(0,A-1))}async function B(L){var N;await X.post(`/providers/notifications/dismiss-provider/${L}`),d(A=>A.filter(M=>M.provider_id!==L));const P=((N=u.find(A=>A.provider_id===L))==null?void 0:N.categories.length)??0;m(A=>Math.max(0,A-P))}return l.jsxs("div",{className:"flex h-screen overflow-hidden",children:[l.jsxs("aside",{className:"w-56 bg-dark-800 border-r border-dark-700 flex flex-col shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-2 p-4 border-b border-dark-700",children:[l.jsx(fa,{className:"text-primary-500",size:22}),l.jsx("span",{className:"font-bold text-lg tracking-tight flex-1",children:"KiraStream"}),l.jsxs("div",{className:"relative",ref:y,children:[l.jsxs("button",{onClick:()=>i(L=>!L),className:Mt("relative p-1 rounded-lg transition-colors",a?"bg-dark-600 text-yellow-400":"text-gray-500 hover:text-yellow-400 hover:bg-dark-700"),title:"Notificaciones",children:[l.jsx(gf,{size:16}),f>0&&l.jsx("span",{className:"absolute -top-1 -right-1 bg-yellow-500 text-black text-[9px] font-bold rounded-full w-4 h-4 flex items-center justify-center",children:f>99?"99+":f})]}),a&&l.jsxs("div",{className:"absolute left-0 top-full mt-2 w-80 bg-dark-800 border border-dark-700 rounded-xl shadow-2xl z-50 flex flex-col max-h-[70vh]",children:[l.jsxs("div",{className:"p-3 border-b border-dark-700 flex items-center justify-between shrink-0",children:[l.jsx("span",{className:"font-semibold text-sm",children:"Nuevas categorías"}),l.jsx("button",{onClick:()=>i(!1),className:"text-gray-500 hover:text-white",children:l.jsx(On,{size:14})})]}),h?l.jsx("div",{className:"flex items-center justify-center p-8",children:l.jsx(Ge,{size:18,className:"animate-spin text-gray-400"})}):u.length===0?l.jsx("div",{className:"p-6 text-center text-gray-500 text-sm",children:"Sin novedades pendientes ✓"}):l.jsx("div",{className:"overflow-y-auto flex-1 p-2 space-y-3",children:u.map(L=>l.jsxs("div",{className:"bg-dark-900/50 rounded-lg border border-dark-700 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-dark-700/40",children:[l.jsx("span",{className:"text-xs font-semibold text-gray-300 truncate",children:L.provider_name}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l.jsx("span",{className:"text-xs text-gray-500",children:L.categories.length}),l.jsx("button",{onClick:()=>B(L.provider_id),className:"text-xs text-gray-500 hover:text-red-400 ml-1 px-1.5 py-0.5 rounded hover:bg-dark-600",title:"Descartar todas",children:"Ignorar todas"})]})]}),l.jsx("div",{className:"p-2 space-y-1 max-h-48 overflow-y-auto",children:L.categories.map(P=>l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded hover:bg-dark-700 group",children:[l.jsx("span",{className:"text-xs flex-1 truncate",children:P.name}),l.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded border shrink-0 ${pg[P.type]}`,children:fg[P.type]}),l.jsx("button",{onClick:()=>z(L.provider_id,P.id,P.type),className:"opacity-0 group-hover:opacity-100 text-gray-600 hover:text-red-400 transition-opacity shrink-0",title:"Descartar",children:l.jsx(On,{size:12})})]},`${P.id}_${P.type}`))}),l.jsx("div",{className:"px-3 py-2 border-t border-dark-700",children:l.jsxs("button",{onClick:()=>{i(!1),s("/providers")},className:"text-xs text-primary-400 hover:text-primary-300 flex items-center gap-1",children:["Ir a Proveedores para sincronizar ",l.jsx(No,{size:11})]})})]},L.provider_id))})]})]})]}),l.jsx("nav",{className:"flex-1 p-3 space-y-1",children:dg.map(({to:L,icon:P,label:N})=>l.jsxs(th,{to:L,className:({isActive:A})=>Mt("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors",A?"bg-primary-500/20 text-primary-400":"text-gray-400 hover:bg-dark-700 hover:text-gray-100"),children:[l.jsx(P,{size:17}),N]},L))}),l.jsxs("button",{onClick:k,className:"flex items-center gap-3 p-4 text-sm text-gray-500 hover:text-red-400 border-t border-dark-700 transition-colors",children:[l.jsx(mh,{size:16})," Cerrar sesión"]})]}),l.jsx("main",{className:"flex-1 overflow-auto bg-dark-900",children:l.jsx($0,{})})]})}function hg(s){return s<1024?s+" B":s<1048576?(s/1024).toFixed(1)+" KB":s<1073741824?(s/1048576).toFixed(1)+" MB":(s/1073741824).toFixed(2)+" GB"}function mo(s){return s<=0?"—":s<1024?s.toFixed(0)+" B/s":s<1048576?(s/1024).toFixed(0)+" KB/s":(s/1048576).toFixed(1)+" MB/s"}function xg(s){const a=Math.floor(Date.now()/1e3-s),i=Math.floor(a/3600),u=Math.floor(a%3600/60),d=a%60;return i>0?`${i}h ${u}m`:u>0?`${u}m ${d}s`:`${d}s`}function gg(s){if(!s.width||!s.height)return null;const a=s.width>=3840?"4K":s.width>=1920?"FHD":s.width>=1280?"HD":s.width>=720?"SD":"LD";return`${s.width}×${s.height} (${a})`}function yg({info:s}){if(!s||Object.keys(s).length===0)return l.jsx("span",{className:"text-gray-600 text-xs italic",children:"Detectando..."});const a=gg(s),i=s.fps?`${s.fps} fps`:null,u=s.video_codec?s.video_codec.toUpperCase():null,d=s.audio_codec?s.audio_codec.toUpperCase():null,f=s.bitrate_bps?`${(s.bitrate_bps/1e6).toFixed(1)} Mb/s`:null;return l.jsxs("div",{className:"space-y-0.5",children:[a&&l.jsxs("div",{className:"text-gray-200 font-mono text-xs",children:[a,i?` · ${i}`:""]}),l.jsxs("div",{className:"flex gap-1 flex-wrap",children:[u&&l.jsx("span",{className:"bg-blue-900/40 text-blue-300 text-[10px] px-1.5 py-0.5 rounded border border-blue-800",children:u}),d&&l.jsxs("span",{className:"bg-purple-900/40 text-purple-300 text-[10px] px-1.5 py-0.5 rounded border border-purple-800",children:[d,s.audio_channels?` ${s.audio_channels}ch`:""]}),f&&l.jsx("span",{className:"text-gray-500 text-[10px]",children:f})]})]})}function vg({status:s,sessionCount:a,failureCount:i}){const u=i!=null&&i>0,d=a!=null&&a>0;return s==="connecting"?l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-gray-400",children:[l.jsx(Ge,{size:9,className:"animate-spin"})," Conectando"]}):s==="reconnecting"?l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-orange-400",children:[l.jsx(Ge,{size:9,className:"animate-spin"})," Reconectando",u&&l.jsxs("span",{className:"ml-1 px-1 bg-red-900/40 text-red-300 border border-red-800 rounded",children:[i," fallo",i>1?"s":""]})]}):!s||s==="ok"?l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-green-500",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse inline-block"})," OK"]}),d&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-gray-500",title:`${a} rotación(es) de sesión del proveedor — el proveedor cierra la conexión cada ~2 min (normal). El buffer absorbe el cambio sin interrupción.`,children:[l.jsx(Ge,{size:8})," ",a," sesión",a>1?"es":""]}),u&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] px-1 bg-red-900/40 text-red-300 border border-red-800 rounded",title:`${i} fallo(s) real(es) detectado(s) — conexión rechazada, DNS, auth u otro error. Ver Registro → Fallos de stream.`,children:[l.jsx(Ln,{size:8})," ",i," fallo",i>1?"s":""]})]}):l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-red-400",children:[l.jsx(Ln,{size:9})," ",s]})}function wg({health:s,desyncs:a,corrections:i}){const u=i!=null&&i>0,d=a!=null&&a>0,f=s==="error"?l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-red-900/40 text-red-300 border border-red-800",children:[l.jsx(Ln,{size:9})," A/V error"]}):s==="warning"?l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-yellow-900/40 text-yellow-300 border border-yellow-800",children:[l.jsx(vf,{size:9})," A/V aviso"]}):l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-500",children:[l.jsx(yh,{size:9})," A/V ok"]});return l.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[f,u&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-violet-900/40 text-violet-300 border border-violet-800",title:"Correcciones automáticas del monitor de salud",children:[l.jsx(Ge,{size:9})," ×",i]}),d&&l.jsxs("span",{className:"text-[10px] text-gray-600 tabular-nums",title:"Eventos A/V en stderr de ffmpeg (informativos)",children:[a," ev."]})]})}function jg({pct:s,serverSecs:a,serverCapacity:i}){const u=s??0,d=u>=70?"bg-red-500":u>=40?"bg-yellow-400":"bg-emerald-500",f=u>=70?"text-red-400":u>=40?"text-yellow-400":"text-emerald-500",m=a??0,h=((i??0)/1048576).toFixed(0),x=m>.5?`${m.toFixed(1)}s`:"ok",y=m>10?"text-yellow-400":"text-emerald-500",k=`Buffer servidor: ${m>0?m.toFixed(1)+"s de cobertura":"0 — normal en reposo"}. Capacidad máx: ${h} MB. El buffer se activa durante reconexiones del proveedor.`;return l.jsxs("div",{className:"mt-1.5 space-y-0.5",children:[l.jsxs("div",{className:"flex items-center justify-between",title:`Cola cliente: ${u.toFixed(0)}% — 0%=consume sin retraso, 100%=cliente lento`,children:[l.jsx("span",{className:"text-[10px] text-gray-500",children:"Cola cliente"}),l.jsxs("span",{className:`text-[10px] font-mono tabular-nums ${f}`,children:[u.toFixed(0),"%"]})]}),l.jsx("div",{className:"w-full h-1.5 rounded-full bg-dark-700 overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-700 ${d}`,style:{width:`${Math.min(u,100)}%`}})}),l.jsxs("div",{className:"flex items-center justify-between pt-0.5",title:k,children:[l.jsxs("span",{className:"text-[10px] text-gray-500",children:["Reserva (",h," MB)"]}),l.jsx("span",{className:`text-[10px] font-mono tabular-nums ${y}`,children:x})]})]})}const kg={live:l.jsx(Tr,{size:12,className:"text-blue-400"}),movie:l.jsx(Yn,{size:12,className:"text-purple-400"}),series:l.jsx(yf,{size:12,className:"text-green-400"})},Ng={live:"Directo",movie:"Película",series:"Serie"},Sg={live:"bg-blue-900/30 border-blue-800 text-blue-300",movie:"bg-purple-900/30 border-purple-800 text-purple-300",series:"bg-green-900/30 border-green-800 text-green-300"};function bg(){const[s,a]=v.useState([]),[i,u]=v.useState([]),[d,f]=v.useState(!1),[m,h]=v.useState(null),[x,y]=v.useState(null),k=v.useRef(null);v.useEffect(()=>{const ae=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/admin/monitoring/ws`,de=new WebSocket(ae);return k.current=de,de.onopen=()=>f(!0),de.onclose=()=>f(!1),de.onmessage=Y=>{const ke=JSON.parse(Y.data);(ke.type==="state"||ke.type==="update")&&a(ke.data)},()=>de.close()},[]),v.useEffect(()=>{X.get("/monitoring/slots").then(O=>u(O.data)).catch(()=>{})},[s]);async function C(O,ae){var de,Y;if(confirm(`¿Cortar la conexión de "${ae}"?`)){h(O),y(null);try{await X.post("/monitoring/kill",{client_id:O})}catch(ke){const Te=(Y=(de=ke==null?void 0:ke.response)==null?void 0:de.data)==null?void 0:Y.detail;y(Te||"Error al cortar la conexión"),setTimeout(()=>y(null),4e3)}finally{h(null)}}}const z=s.reduce((O,ae)=>O+ae.client_count,0),B=i.filter(O=>O.status==="busy").length,L=s.reduce((O,ae)=>O+(ae.bps_down||0),0),P=s.reduce((O,ae)=>O+(ae.ffmpeg_cpu_pct??0),0),N=s.some(O=>O.status==="reconnecting"),A=s.filter(O=>!O.av_health||O.av_health==="ok").length,M=s.filter(O=>O.av_health==="warning").length,K=s.filter(O=>O.av_health==="error").length,Q=s.reduce((O,ae)=>O+(ae.corrections??0),0),me=K>0?"text-red-400":M>0?"text-yellow-400":"text-emerald-400",fe=s.length===0?"—":K>0?`${K} error${K>1?"es":""}`:M>0?`${M} aviso${M>1?"s":""}`:`${A} ok`;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-bold",children:"Dashboard"}),l.jsxs("div",{className:"flex items-center gap-3",children:[N&&l.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-orange-400 bg-orange-900/30 border border-orange-800 px-2 py-1 rounded-lg",children:[l.jsx(Ge,{size:11,className:"animate-spin"}),"Reconectando stream(s)..."]}),K>0&&l.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-red-400 bg-red-900/30 border border-red-800 px-2 py-1 rounded-lg",children:[l.jsx(Ln,{size:11}),K," stream",K>1?"s":""," con error A/V"]}),l.jsxs("div",{className:`flex items-center gap-2 text-xs ${d?"text-green-400":"text-red-400"}`,children:[l.jsx("span",{className:`w-2 h-2 rounded-full ${d?"bg-green-400 animate-pulse":"bg-red-400"}`}),d?"Conectado en tiempo real":"Desconectado"]})]})]}),x&&l.jsx("div",{className:"bg-red-900/40 border border-red-700 rounded-lg px-4 py-2 text-sm text-red-300",children:x}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-6 gap-4",children:[l.jsx(Pr,{icon:l.jsx(oh,{size:20,className:"text-blue-400"}),label:"Streams activos",value:s.length}),l.jsx(Pr,{icon:l.jsx(aa,{size:20,className:"text-green-400"}),label:"Usuarios conectados",value:z}),l.jsx(Pr,{icon:l.jsx(Ao,{size:20,className:"text-orange-400"}),label:"Slots ocupados",value:`${B}/${i.length}`}),l.jsx(Pr,{icon:l.jsx(fa,{size:20,className:"text-purple-400"}),label:"↓ Total proveedor",value:mo(L)}),l.jsx(Pr,{icon:l.jsx(Fd,{size:20,className:P>80?"text-red-400":P>40?"text-yellow-400":"text-cyan-400"}),label:"ffmpeg CPU total",value:`${P.toFixed(2)}%`}),l.jsx(Pr,{icon:l.jsx(vf,{size:20,className:me}),label:`Salud A/V${Q>0?` · ${Q} corr.`:""}`,value:fe,valueClass:me})]}),i.length>0&&l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700 p-4",children:[l.jsx("h2",{className:"text-sm font-semibold text-gray-400 mb-3",children:"Estado de Slots del Proveedor"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(O=>l.jsxs("div",{className:`px-3 py-1.5 rounded-lg text-xs font-medium border ${O.status==="busy"?"bg-orange-900/30 border-orange-700 text-orange-300":"bg-green-900/30 border-green-800 text-green-400"}`,children:[l.jsx("span",{className:"font-bold",children:O.name}),l.jsx("span",{className:"ml-2 opacity-70",children:O.status==="busy"?`ch#${O.channel_id}`:"libre"})]},O.id))})]}),l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700",children:[l.jsx("div",{className:"p-4 border-b border-dark-700",children:l.jsx("h2",{className:"text-sm font-semibold text-gray-300",children:"Streams en Reproducción"})}),s.length===0?l.jsx("div",{className:"p-8 text-center text-gray-500 text-sm",children:"No hay streams activos"}):l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-left text-xs text-gray-500 border-b border-dark-700",children:[l.jsx("th",{className:"px-4 py-2",children:"Tipo"}),l.jsx("th",{className:"px-4 py-2",children:"Canal"}),l.jsx("th",{className:"px-4 py-2",children:"Proveedor"}),l.jsx("th",{className:"px-4 py-2",children:"Stream"}),l.jsx("th",{className:"px-4 py-2",children:"Estado"}),l.jsx("th",{className:"px-4 py-2",children:"Salud A/V"}),l.jsx("th",{className:"px-4 py-2",children:"Usuarios"}),l.jsx("th",{className:"px-4 py-2",children:"↓ / ↑"}),l.jsx("th",{className:"px-4 py-2",children:"Tiempo"}),l.jsx("th",{className:"px-4 py-2",children:"Datos"})]})}),l.jsx("tbody",{children:s.map((O,ae)=>l.jsxs("tr",{className:"border-b border-dark-700 hover:bg-dark-700/30 align-top",children:[l.jsx("td",{className:"px-4 py-2.5",children:l.jsxs("span",{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded border ${Sg[O.stream_type]}`,children:[kg[O.stream_type],Ng[O.stream_type]]})}),l.jsxs("td",{className:"px-4 py-2.5",children:[l.jsx("span",{className:"font-medium text-gray-200 text-xs leading-tight block max-w-[160px] truncate",title:O.channel_name,children:O.channel_name}),l.jsxs("span",{className:"text-gray-600 text-xs",children:["#",O.channel_id]})]}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:"bg-orange-900/40 text-orange-300 text-xs px-2 py-0.5 rounded",children:O.provider_name||`#${O.provider_account_id}`})}),l.jsx("td",{className:"px-4 py-2.5 min-w-[160px]",children:O.stream_info?l.jsx(yg,{info:O.stream_info}):l.jsx("span",{className:"text-gray-600 text-xs italic",children:"—"})}),l.jsxs("td",{className:"px-4 py-2.5",children:[l.jsx(vg,{status:O.status,sessionCount:O.session_count,failureCount:O.failure_count}),O.ffmpeg_pid&&l.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[l.jsxs("span",{className:"inline-flex items-center gap-1 bg-cyan-900/40 text-cyan-300 text-[10px] px-1.5 py-0.5 rounded border border-cyan-800 font-mono",children:[l.jsx(Fd,{size:9}),"ffmpeg"]}),O.ffmpeg_cpu_pct!==void 0&&l.jsxs("span",{className:`font-mono text-[10px] tabular-nums ${O.ffmpeg_cpu_pct>80?"text-red-400":O.ffmpeg_cpu_pct>40?"text-yellow-400":"text-gray-400"}`,children:[O.ffmpeg_cpu_pct.toFixed(2),"%"]})]})]}),l.jsxs("td",{className:"px-4 py-2.5 min-w-[140px]",children:[l.jsx(wg,{health:O.av_health,desyncs:O.av_desync_count,corrections:O.corrections}),l.jsx(jg,{pct:O.buffer_pct,serverSecs:O.buffer_server_secs,serverCapacity:O.buffer_capacity})]}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("div",{className:"flex flex-col gap-1",children:O.clients.map(de=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-gray-300 text-xs font-medium",children:de.username}),l.jsx("button",{onClick:()=>C(de.client_id,de.username),disabled:m===de.client_id,title:`Cortar conexión de ${de.username}`,className:"p-0.5 rounded hover:bg-red-900/40 text-gray-600 hover:text-red-400 transition-colors disabled:opacity-40 shrink-0",children:l.jsx(On,{size:11})})]},de.client_id))})}),l.jsxs("td",{className:"px-4 py-2.5 font-mono text-xs",children:[l.jsxs("div",{className:"text-cyan-400",children:["↓ ",mo(O.bps_down)]}),l.jsxs("div",{className:"text-green-400",children:["↑ ",mo(O.bps_up)]})]}),l.jsxs("td",{className:"px-4 py-2.5 text-gray-400 font-mono text-xs",children:[l.jsx(So,{size:11,className:"inline mr-1"}),xg(O.started_at)]}),l.jsx("td",{className:"px-4 py-2.5 text-gray-500 text-xs font-mono",children:hg(O.bytes_pumped)})]},ae))})]})})]})]})}function Pr({icon:s,label:a,value:i,valueClass:u}){return l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-center gap-4",children:[l.jsx("div",{className:"bg-dark-700 p-2.5 rounded-lg",children:s}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-gray-500",children:a}),l.jsx("p",{className:`text-2xl font-bold ${u??""}`,children:i})]})]})}function _g(s){if(!s)return null;const a=new Date(s),i=Math.ceil((a.getTime()-Date.now())/864e5);return i<0?{label:"Expirado",cls:"text-red-400 bg-red-900/20 border border-red-800"}:i<=7?{label:`Caduca en ${i}d`,cls:"text-red-400 bg-red-900/20 border border-red-800"}:i<=30?{label:`Caduca en ${i}d`,cls:"text-yellow-400 bg-yellow-900/20 border border-yellow-800"}:{label:`Caduca: ${a.toLocaleDateString("es-ES")}`,cls:"text-green-400 bg-green-900/20 border border-green-800"}}const Cg=[{key:"live",label:"Canales en directo"},{key:"movie",label:"Películas (VOD)"},{key:"series",label:"Series"}],Xd=[{value:0,label:"Desactivado"},{value:6,label:"Cada 6 horas"},{value:12,label:"Cada 12 horas"},{value:24,label:"Cada 24 horas"}],Zd={name:"",base_url:"",username:"",password:"",max_connections:1,auto_sync_hours:0};function Eg(){const[s,a]=v.useState([]),[i,u]=v.useState(Zd),[d,f]=v.useState(!1),[m,h]=v.useState(new Set),[x,y]=v.useState({}),[k,C]=v.useState({}),[z,B]=v.useState(null),[L,P]=v.useState({}),N=v.useRef({}),[A,M]=v.useState(null),[K,Q]=v.useState(!1),[me,fe]=v.useState({live:[],movie:[],series:[]}),[O,ae]=v.useState({live:new Set,movie:new Set,series:new Set}),[de,Y]=v.useState(""),[ke,Te]=v.useState({}),[ze,Ee]=v.useState(null),[q,ge]=v.useState({name:"",base_url:"",username:"",password:"",max_connections:1,auto_sync_hours:0}),[D,U]=v.useState(null),[ee,G]=v.useState(!1),[b,I]=v.useState([]),[te,pe]=v.useState(new Set),[ye,Ne]=v.useState(""),[we,oe]=v.useState({}),[F,ne]=v.useState(new Set),[je,_e]=v.useState(null),[De,Le]=v.useState({url:"",priority:10,is_active:!0}),[Fr,Ur]=v.useState(new Set);async function wt(){const{data:w}=await X.get("/providers/");return a(w),w}v.useEffect(()=>(wt().then(async w=>{for(const $ of w)try{const{data:ue}=await X.get(`/providers/${$.id}/sync/status`);ue.status==="running"&&(h(Se=>new Set(Se).add($.id)),y(Se=>({...Se,[$.id]:ue.progress||"Sincronizando..."})),rr($.id))}catch{}}),()=>{Object.keys(N.current).forEach(w=>{N.current[+w]=!1})}),[]);function rr(w){N.current[w]=!0;const $=async()=>{if(N.current[w])try{const{data:ue}=await X.get(`/providers/${w}/sync/status`);y(Se=>({...Se,[w]:ue.progress||""})),C(Se=>({...Se,[w]:ue.stats||{}})),ue.status==="running"?setTimeout($,1500):(N.current[w]=!1,h(Se=>{const Ae=new Set(Se);return Ae.delete(w),Ae}),y(Se=>({...Se,[w]:ue.status==="done"?"✓ Sync completado":`Error: ${ue.progress}`})),wt())}catch{N.current[w]=!1,h(ue=>{const Se=new Set(ue);return Se.delete(w),Se})}};$()}async function Mr(w){w.preventDefault(),await X.post("/providers/",i),u(Zd),f(!1),wt()}async function zn(w){confirm("¿Eliminar este proveedor y todos sus canales?")&&(await X.delete(`/providers/${w}`),wt())}async function an(w){B(w);try{const{data:$}=await X.post(`/providers/${w}/test`);P(ue=>({...ue,[w]:$.connected})),$.connected&&wt()}finally{B(null)}}function Ir(w){Ee(w),ge({name:w.name,base_url:w.base_url,username:w.username,password:"",max_connections:w.max_connections,auto_sync_hours:w.auto_sync_hours})}async function Fs(){var w,$;if(ze)try{await X.put(`/providers/${ze.id}`,q),Ee(null),wt()}catch(ue){alert("Error al guardar: "+((($=(w=ue.response)==null?void 0:w.data)==null?void 0:$.detail)||ue.message))}}async function Us(w){var $,ue,Se;M(w),Q(!0),Y(""),Te({});try{const[Ae,$e]=await Promise.all([X.get(`/providers/${w.id}/sync/categories`),X.get(`/providers/${w.id}/synced-category-ids`)]);fe(Ae.data);let lr=$e.data.live,qr=$e.data.movie,un=$e.data.series;if(w.last_sync_categories)try{const $t=JSON.parse(w.last_sync_categories);((($=$t.live)==null?void 0:$.length)??0)+(((ue=$t.movie)==null?void 0:ue.length)??0)+(((Se=$t.series)==null?void 0:Se.length)??0)>0&&(lr=$t.live??[],qr=$t.movie??[],un=$t.series??[])}catch{}ae({live:new Set(lr),movie:new Set(qr),series:new Set(un)})}catch{M(null)}finally{Q(!1)}}async function Ms(){if(!A)return;const w=A.id;M(null),h($=>new Set($).add(w)),y($=>({...$,[w]:"Iniciando..."}));try{await X.post(`/providers/${w}/sync`,{live_category_ids:Array.from(O.live),movie_category_ids:Array.from(O.movie),series_category_ids:Array.from(O.series)}),rr(w)}catch{h($=>{const ue=new Set($);return ue.delete(w),ue}),y($=>({...$,[w]:"Error al iniciar sync"}))}}function Is(w,$){ae(ue=>{const Se=new Set(ue[w]);return Se.has($)?Se.delete($):Se.add($),{...ue,[w]:Se}})}function $r(w,$){ae(ue=>({...ue,[w]:new Set($.map(Se=>Se.id))}))}function sr(w){ae($=>({...$,[w]:new Set}))}async function $s(w){U(w),G(!0),Ne(""),pe(new Set);try{const{data:$}=await X.get(`/providers/${w.id}/available-updates`);I($.new_categories||[])}catch{I([])}finally{G(!1)}}async function An(w){try{const{data:$}=await X.get(`/providers/${w}/available-updates`);oe(ue=>({...ue,[w]:$.total||0}))}catch{}}v.useEffect(()=>{s.forEach(w=>{w.last_sync_at&&An(w.id)})},[s.length]);async function Dn(){if(!D||te.size===0)return;const w=D.id,$=[],ue=[],Se=[];b.filter(Ae=>te.has(Ae.id+"_"+Ae.type)).forEach(Ae=>{Ae.type==="live"?$.push(Ae.id):Ae.type==="movie"?ue.push(Ae.id):Ae.type==="series"&&Se.push(Ae.id)}),U(null),h(Ae=>new Set(Ae).add(w)),y(Ae=>({...Ae,[w]:"Iniciando..."}));try{await X.post(`/providers/${w}/sync`,{live_category_ids:$.length>0?$:void 0,movie_category_ids:ue.length>0?ue:void 0,series_category_ids:Se.length>0?Se:void 0}),rr(w)}catch{h(Ae=>{const $e=new Set(Ae);return $e.delete(w),$e}),y(Ae=>({...Ae,[w]:"Error al iniciar sync"}))}}function va(w){ne($=>{const ue=new Set($);return ue.has(w)?ue.delete(w):ue.add(w),ue})}async function Bs(w){await X.post(`/providers/${w}/urls`,De),_e(null),Le({url:"",priority:10,is_active:!0}),wt()}async function Vs(w,$){confirm("¿Eliminar esta URL de failover?")&&(await X.delete(`/providers/${w}/urls/${$}`),wt())}async function wa(w){Ur($=>new Set($).add(w));try{await X.post(`/providers/${w}/urls/check-all`),wt()}finally{Ur($=>{const ue=new Set($);return ue.delete(w),ue})}}function Br(w){return w.status==="ok"?l.jsxs("span",{className:"text-green-400 text-xs font-mono",children:["● ",w.response_ms!=null?`${w.response_ms}ms`:"OK"]}):w.status==="error"?l.jsx("span",{className:"text-red-400 text-xs font-mono",children:"● Error"}):w.status==="timeout"?l.jsx("span",{className:"text-yellow-400 text-xs font-mono",children:"● Timeout"}):l.jsx("span",{className:"text-gray-500 text-xs font-mono",children:"○ Desconocido"})}const on=Object.values(O).reduce((w,$)=>w+$.size,0),Vr=Object.values(me).reduce((w,$)=>w+$.length,0),Hr={live:"Directo",movie:"Película",series:"Serie"},Wr={live:"bg-blue-900/30 text-blue-300 border-blue-800",movie:"bg-purple-900/30 text-purple-300 border-purple-800",series:"bg-green-900/30 text-green-300 border-green-800"},Qt=b.filter(w=>!ye||w.name.toLowerCase().includes(ye.toLowerCase()));return l.jsxs("div",{className:"p-6 space-y-5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-bold",children:"Proveedores IPTV"}),l.jsxs("button",{onClick:()=>f(w=>!w),className:"flex items-center gap-2 bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:[l.jsx(tr,{size:16})," Añadir proveedor"]})]}),d&&l.jsxs("form",{onSubmit:Mr,className:"bg-dark-800 border border-dark-700 rounded-xl p-5 space-y-3",children:[l.jsx("h3",{className:"font-semibold text-sm mb-2",children:"Nueva cuenta de proveedor"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Gn,{label:"Nombre",value:i.name,onChange:w=>u($=>({...$,name:w})),required:!0}),l.jsx(Gn,{label:"URL base (ej: http://provider.com:8080)",value:i.base_url,onChange:w=>u($=>({...$,base_url:w})),required:!0}),l.jsx(Gn,{label:"Usuario",value:i.username,onChange:w=>u($=>({...$,username:w})),required:!0}),l.jsx(Gn,{label:"Contraseña",value:i.password,onChange:w=>u($=>({...$,password:w})),required:!0}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Conexiones máx."}),l.jsx("input",{type:"number",min:1,max:100,value:i.max_connections,onChange:w=>u($=>({...$,max_connections:+w.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Auto-sincronización"}),l.jsx("select",{value:i.auto_sync_hours,onChange:w=>u($=>({...$,auto_sync_hours:+w.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",children:Xd.map(w=>l.jsx("option",{value:w.value,children:w.label},w.value))})]})]}),l.jsxs("div",{className:"flex gap-2 pt-1",children:[l.jsx("button",{type:"submit",className:"bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium",children:"Guardar"}),l.jsx("button",{type:"button",onClick:()=>f(!1),className:"bg-dark-700 hover:bg-dark-600 px-4 py-2 rounded-lg text-sm",children:"Cancelar"})]})]}),A&&l.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700 w-full max-w-2xl flex flex-col max-h-[90vh]",children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between shrink-0",children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"font-semibold",children:["Seleccionar categorías — ",l.jsx("span",{className:"text-primary-400",children:A.name})]}),!K&&l.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[on," de ",Vr," categorías seleccionadas"]})]}),l.jsx("button",{onClick:()=>M(null),className:"text-gray-500 hover:text-white",children:"✕"})]}),K?l.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:l.jsxs("div",{className:"text-center text-gray-400",children:[l.jsx(Ge,{size:24,className:"animate-spin mx-auto mb-3"}),l.jsx("p",{className:"text-sm",children:"Obteniendo categorías del proveedor..."})]})}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-3 border-b border-dark-700 shrink-0",children:l.jsxs("div",{className:"relative",children:[l.jsx(Kt,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:de,onChange:w=>Y(w.target.value),placeholder:"Buscar categoría...",className:"w-full bg-dark-700 border border-dark-600 rounded-lg pl-9 pr-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]})}),l.jsx("div",{className:"overflow-y-auto flex-1 p-3 space-y-2",children:Cg.map(({key:w,label:$})=>{const ue=me[w].filter($e=>!de||$e.name.toLowerCase().includes(de.toLowerCase()));if(!ue.length&&!de)return null;const Se=ue.filter($e=>O[w].has($e.id)).length,Ae=ke[w];return l.jsxs("div",{className:"bg-dark-900/50 rounded-lg border border-dark-700 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-dark-700/50 select-none",onClick:()=>Te($e=>({...$e,[w]:!$e[w]})),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[Ae?l.jsx(No,{size:14,className:"text-gray-500"}):l.jsx(ko,{size:14,className:"text-gray-500"}),l.jsx("span",{className:"text-sm font-medium",children:$}),l.jsxs("span",{className:"text-xs text-gray-500",children:["(",Se,"/",ue.length," sel.)"]})]}),l.jsxs("div",{className:"flex gap-2",onClick:$e=>$e.stopPropagation(),children:[l.jsx("button",{onClick:()=>$r(w,ue),className:"text-xs text-primary-400 hover:text-primary-300 px-2 py-0.5 rounded hover:bg-dark-600",children:"Todo"}),l.jsx("button",{onClick:()=>sr(w),className:"text-xs text-gray-500 hover:text-gray-300 px-2 py-0.5 rounded hover:bg-dark-600",children:"Nada"})]})]}),!Ae&&l.jsx("div",{className:"grid grid-cols-2 gap-0.5 p-2 border-t border-dark-700 max-h-64 overflow-y-auto",children:ue.length===0?l.jsx("div",{className:"col-span-2 text-center text-gray-500 text-xs py-3",children:"Sin resultados"}):ue.map($e=>l.jsxs("label",{className:"flex items-center gap-2 px-2 py-1 rounded hover:bg-dark-700 cursor-pointer text-sm",children:[l.jsx("input",{type:"checkbox",checked:O[w].has($e.id),onChange:()=>Is(w,$e.id),className:"shrink-0"}),l.jsx("span",{className:"truncate text-xs",children:$e.name})]},$e.id))})]},w)})}),l.jsxs("div",{className:"p-4 border-t border-dark-700 flex gap-2 justify-end shrink-0",children:[l.jsx("button",{onClick:()=>M(null),className:"bg-dark-700 hover:bg-dark-600 px-4 py-2 rounded-lg text-sm",children:"Cancelar"}),l.jsxs("button",{onClick:Ms,disabled:on===0,className:"bg-primary-500 hover:bg-primary-600 disabled:opacity-40 px-4 py-2 rounded-lg text-sm font-medium flex items-center gap-2",children:[l.jsx(Ge,{size:14}),"Importar ",on," ",on===1?"categoría":"categorías"]})]})]})]})}),D&&l.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700 w-full max-w-lg flex flex-col max-h-[80vh]",children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between shrink-0",children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"font-semibold",children:["Novedades — ",l.jsx("span",{className:"text-primary-400",children:D.name})]}),!ee&&l.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:b.length===0?"No hay categorías nuevas":`${b.length} categorías nuevas sin sincronizar`})]}),l.jsx("button",{onClick:()=>U(null),className:"text-gray-500 hover:text-white",children:"✕"})]}),ee?l.jsx("div",{className:"flex-1 flex items-center justify-center p-10",children:l.jsx(Ge,{size:22,className:"animate-spin text-gray-400"})}):b.length===0?l.jsx("div",{className:"flex-1 flex items-center justify-center p-10 text-gray-500 text-sm",children:"Todo está actualizado ✓"}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-3 border-b border-dark-700 shrink-0",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Kt,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:ye,onChange:w=>Ne(w.target.value),placeholder:"Buscar...",className:"w-full bg-dark-700 border border-dark-600 rounded-lg pl-9 pr-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:()=>pe(new Set(Qt.map(w=>w.id+"_"+w.type))),className:"text-xs text-primary-400 hover:text-primary-300 px-2 py-0.5 rounded hover:bg-dark-600",children:"Seleccionar todo"}),l.jsx("button",{onClick:()=>pe(new Set),className:"text-xs text-gray-500 hover:text-gray-300 px-2 py-0.5 rounded hover:bg-dark-600",children:"Ninguna"}),l.jsxs("span",{className:"text-xs text-gray-600 ml-auto self-center",children:[te.size," seleccionadas"]})]})]}),l.jsx("div",{className:"overflow-y-auto flex-1 p-3 space-y-1",children:Qt.map(w=>{const $=w.id+"_"+w.type;return l.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-dark-700 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:te.has($),onChange:()=>{pe(ue=>{const Se=new Set(ue);return Se.has($)?Se.delete($):Se.add($),Se})},className:"shrink-0"}),l.jsx("span",{className:"text-sm flex-1 truncate",children:w.name}),l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded border ${Wr[w.type]}`,children:Hr[w.type]})]},$)})}),l.jsxs("div",{className:"p-4 border-t border-dark-700 flex gap-2 justify-end shrink-0",children:[l.jsx("button",{onClick:()=>U(null),className:"bg-dark-700 hover:bg-dark-600 px-4 py-2 rounded-lg text-sm",children:"Cancelar"}),l.jsxs("button",{onClick:Dn,disabled:te.size===0,className:"bg-primary-500 hover:bg-primary-600 disabled:opacity-40 px-4 py-2 rounded-lg text-sm font-medium flex items-center gap-2",children:[l.jsx(Ge,{size:14}),"Importar ",te.size," ",te.size===1?"categoría":"categorías"]})]})]})]})}),ze&&l.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700 w-full max-w-lg",children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold",children:["Editar proveedor — ",l.jsx("span",{className:"text-primary-400",children:ze.name})]}),l.jsx("button",{onClick:()=>Ee(null),className:"text-gray-500 hover:text-white",children:"✕"})]}),l.jsx("div",{className:"p-4 space-y-3",children:l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Gn,{label:"Nombre",value:q.name,onChange:w=>ge($=>({...$,name:w})),required:!0}),l.jsx(Gn,{label:"URL base",value:q.base_url,onChange:w=>ge($=>({...$,base_url:w})),required:!0}),l.jsx(Gn,{label:"Usuario",value:q.username,onChange:w=>ge($=>({...$,username:w})),required:!0}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Contraseña (vacío = no cambiar)"}),l.jsx("input",{type:"password",value:q.password,onChange:w=>ge($=>({...$,password:w.target.value})),placeholder:"••••••••",className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Conexiones máx."}),l.jsx("input",{type:"number",min:1,max:100,value:q.max_connections,onChange:w=>ge($=>({...$,max_connections:+w.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Auto-sincronización"}),l.jsx("select",{value:q.auto_sync_hours,onChange:w=>ge($=>({...$,auto_sync_hours:+w.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",children:Xd.map(w=>l.jsx("option",{value:w.value,children:w.label},w.value))})]})]})}),l.jsxs("div",{className:"p-4 border-t border-dark-700 flex gap-2 justify-end",children:[l.jsx("button",{onClick:()=>Ee(null),className:"bg-dark-700 hover:bg-dark-600 px-4 py-2 rounded-lg text-sm",children:"Cancelar"}),l.jsx("button",{onClick:Fs,className:"bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium",children:"Guardar"})]})]})}),l.jsxs("div",{className:"space-y-3",children:[s.map(w=>l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"p-4 flex items-center justify-between gap-4",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-semibold",children:w.name}),w.auto_sync_hours>0&&l.jsxs("span",{className:"text-xs bg-dark-700 text-gray-400 px-1.5 py-0.5 rounded",children:["Auto ",w.auto_sync_hours,"h"]})]}),l.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-0.5",children:[l.jsxs("span",{className:"text-xs text-gray-500 truncate",children:[w.base_url," • ",w.username," • ",w.max_connections," conex."]}),(()=>{const $=_g(w.expiry_date);return $?l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${$.cls}`,children:$.label}):null})()]}),w.last_sync_at&&l.jsxs("div",{className:"text-xs text-gray-600 mt-0.5",children:["Último sync: ",new Date(w.last_sync_at).toLocaleString("es-ES")]}),L[w.id]!==void 0&&l.jsx("div",{className:`text-xs mt-0.5 ${L[w.id]?"text-green-400":"text-red-400"}`,children:L[w.id]?"✓ Conexión OK":"✗ Sin conexión"}),x[w.id]&&l.jsxs("div",{className:`text-xs mt-1 ${x[w.id].startsWith("✓")?"text-green-400":x[w.id].startsWith("Error")?"text-red-400":"text-blue-400"}`,children:[m.has(w.id)&&l.jsx(Ge,{size:10,className:"inline animate-spin mr-1"}),x[w.id],k[w.id]&&m.has(w.id)&&l.jsxs("span",{className:"text-gray-500 ml-1",children:["(",Object.entries(k[w.id]).filter(([,$])=>$>0).map(([$,ue])=>`${ue} ${$}`).join(", "),")"]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx("button",{onClick:()=>an(w.id),disabled:z===w.id,title:"Probar conexión",className:"p-2 rounded-lg bg-dark-700 hover:bg-dark-600 text-gray-400 hover:text-blue-400 transition-colors",children:z===w.id?l.jsx(Ge,{size:15,className:"animate-spin"}):l.jsx(fa,{size:15})}),w.last_sync_at&&l.jsxs("button",{onClick:()=>$s(w),title:"Ver novedades del proveedor",className:"relative p-2 rounded-lg bg-dark-700 hover:bg-dark-600 text-gray-400 hover:text-yellow-400 transition-colors",children:[l.jsx(gf,{size:15}),(we[w.id]??0)>0&&l.jsx("span",{className:"absolute -top-1 -right-1 bg-yellow-500 text-black text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center",children:we[w.id]>9?"9+":we[w.id]})]}),l.jsxs("button",{onClick:()=>Us(w),disabled:m.has(w.id),title:"Sincronizar canales",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-dark-700 hover:bg-dark-600 text-xs text-gray-300 hover:text-white transition-colors disabled:opacity-50",children:[l.jsx(Ge,{size:13,className:m.has(w.id)?"animate-spin":""}),m.has(w.id)?"Sincronizando...":"Sync canales"]}),l.jsx("button",{onClick:()=>Ir(w),title:"Editar proveedor",className:"p-2 rounded-lg bg-dark-700 hover:bg-dark-600 text-gray-400 hover:text-yellow-400 transition-colors",children:l.jsx(jf,{size:15})}),l.jsx("button",{onClick:()=>va(w.id),title:"Gestionar dominios de failover",className:`p-2 rounded-lg bg-dark-700 hover:bg-dark-600 transition-colors ${F.has(w.id)?"text-primary-400":"text-gray-400 hover:text-primary-400"}`,children:F.has(w.id)?l.jsx(ko,{size:15}):l.jsx(No,{size:15})}),l.jsx("button",{onClick:()=>zn(w.id),className:"p-2 rounded-lg bg-dark-700 hover:bg-red-900/40 text-gray-500 hover:text-red-400 transition-colors",children:l.jsx(rn,{size:15})})]})]}),F.has(w.id)&&l.jsxs("div",{className:"border-t border-dark-700 bg-dark-900/40 p-4 space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Dominios (failover)"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("button",{onClick:()=>wa(w.id),disabled:Fr.has(w.id),className:"flex items-center gap-1 text-xs px-2 py-1 rounded bg-dark-700 hover:bg-dark-600 text-gray-400 hover:text-blue-400 transition-colors disabled:opacity-50",children:[l.jsx(Ge,{size:11,className:Fr.has(w.id)?"animate-spin":""}),"Verificar todos"]}),l.jsxs("button",{onClick:()=>{_e(w.id),Le({url:"",priority:10,is_active:!0})},className:"flex items-center gap-1 text-xs px-2 py-1 rounded bg-dark-700 hover:bg-dark-600 text-gray-400 hover:text-green-400 transition-colors",children:[l.jsx(tr,{size:11}),"Añadir URL"]})]})]}),(w.urls??[]).length===0&&je!==w.id&&l.jsx("div",{className:"text-xs text-gray-600 text-center py-2",children:"No hay URLs adicionales configuradas"}),(w.urls??[]).map($=>l.jsxs("div",{className:"flex items-center gap-3 bg-dark-800 rounded-lg px-3 py-2",children:[l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-mono text-gray-300 truncate",children:$.url}),$.priority===0&&l.jsx("span",{className:"text-[10px] bg-primary-900/40 text-primary-400 px-1 rounded",children:"primaria"}),!$.is_active&&l.jsx("span",{className:"text-[10px] bg-dark-600 text-gray-500 px-1 rounded",children:"inactiva"})]})}),l.jsx("div",{className:"shrink-0",children:Br($)}),l.jsx("button",{onClick:()=>Vs(w.id,$.id),className:"p-1 rounded text-gray-600 hover:text-red-400 transition-colors",children:l.jsx(rn,{size:12})})]},$.id)),je===w.id&&l.jsxs("div",{className:"bg-dark-800 rounded-lg p-3 space-y-2 border border-dark-600",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[l.jsxs("div",{className:"col-span-2",children:[l.jsx("label",{className:"block text-[10px] text-gray-500 mb-1",children:"URL base (ej: http://mirror.com:8080)"}),l.jsx("input",{value:De.url,onChange:$=>Le(ue=>({...ue,url:$.target.value})),placeholder:"http://...",className:"w-full bg-dark-700 border border-dark-600 rounded px-2 py-1.5 text-xs focus:outline-none focus:border-primary-500"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] text-gray-500 mb-1",children:"Prioridad (0=más alta)"}),l.jsx("input",{type:"number",min:0,max:999,value:De.priority,onChange:$=>Le(ue=>({...ue,priority:+$.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded px-2 py-1.5 text-xs"})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-400 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:De.is_active,onChange:$=>Le(ue=>({...ue,is_active:$.target.checked}))}),"Activa"]}),l.jsxs("div",{className:"flex gap-2 ml-auto",children:[l.jsx("button",{onClick:()=>_e(null),className:"text-xs px-2 py-1 rounded bg-dark-700 hover:bg-dark-600 text-gray-400",children:"Cancelar"}),l.jsx("button",{onClick:()=>Bs(w.id),disabled:!De.url,className:"text-xs px-2 py-1 rounded bg-primary-500 hover:bg-primary-600 disabled:opacity-40 font-medium",children:"Guardar"})]})]})]})]})]},w.id)),s.length===0&&l.jsx("div",{className:"bg-dark-800 border border-dark-700 border-dashed rounded-xl p-10 text-center text-gray-500 text-sm",children:"No hay proveedores. Añade uno para empezar."})]})]})}function Gn({label:s,value:a,onChange:i,required:u}){return l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:s}),l.jsx("input",{value:a,onChange:d=>i(d.target.value),required:u,className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]})}const Pg={live:"Canales en directo",movie:"Películas",series:"Series"};function Rg(){const[s,a]=v.useState([]),[i,u]=v.useState(!1),[d,f]=v.useState(null),[m,h]=v.useState(null),[x,y]=v.useState(null),[k,C]=v.useState([]),[z,B]=v.useState(new Set),[L,P]=v.useState([]),[N,A]=v.useState(new Set),[M,K]=v.useState(""),[Q,me]=v.useState([]),[fe,O]=v.useState([]),[ae,de]=v.useState({username:"",password:"",max_connections:1,expiry_date:"",is_active:!0,is_priority:!1});async function Y(){const{data:F}=await X.get("/users/");a(F)}v.useEffect(()=>{Y()},[]);async function ke(F){F.preventDefault();const ne={...ae,expiry_date:ae.expiry_date||null};d?await X.put(`/users/${d.id}`,ne):await X.post("/users/",ne),Te(),Y()}function Te(){de({username:"",password:"",max_connections:1,expiry_date:"",is_active:!0,is_priority:!1}),u(!1),f(null)}function ze(F){var ne;de({username:F.username,password:"",max_connections:F.max_connections,expiry_date:((ne=F.expiry_date)==null?void 0:ne.split("T")[0])||"",is_active:F.is_active,is_priority:F.is_priority}),f(F),u(!0)}async function Ee(F){confirm("¿Eliminar usuario?")&&(await X.delete(`/users/${F}`),Y())}async function q(F){await X.put(`/users/${F.id}`,{is_priority:!F.is_priority}),Y()}async function ge(F){h(F),K("");const[ne,je,_e,De]=await Promise.all([X.get("/catalogs/grouped").then(Le=>Le.data),X.get(`/users/${F.id}/catalog`).then(Le=>Le.data),X.get("/custom-categories/").then(Le=>Le.data),X.get(`/users/${F.id}/custom-catalog`).then(Le=>Le.data)]);C(ne),B(new Set(je.map(Le=>Le.category_id))),P(_e),A(new Set(De))}function D(F){return F.category_ids.some(ne=>z.has(ne))}function U(F,ne){B(je=>{const _e=new Set(je);return ne?F.category_ids.forEach(De=>_e.add(De)):F.category_ids.forEach(De=>_e.delete(De)),_e})}function ee(F){B(je=>{const _e=new Set(je);return F.forEach(De=>De.category_ids.forEach(Le=>_e.add(Le))),_e});const ne=L.filter(je=>!M||je.name.toLowerCase().includes(M.toLowerCase()));A(je=>{const _e=new Set(je);return ne.forEach(De=>_e.add(De.id)),_e})}function G(F){B(je=>{const _e=new Set(je);return F.forEach(De=>De.category_ids.forEach(Le=>_e.delete(Le))),_e});const ne=L.filter(je=>!M||je.name.toLowerCase().includes(M.toLowerCase()));A(je=>{const _e=new Set(je);return ne.forEach(De=>_e.delete(De.id)),_e})}async function b(){m&&(await Promise.all([X.post(`/users/${m.id}/catalog`,Array.from(z)),X.post(`/users/${m.id}/custom-catalog`,Array.from(N))]),h(null))}async function I(F){y(F);const[ne,je]=await Promise.all([X.get("/providers/").then(_e=>_e.data),X.get(`/users/${F.id}/providers`).then(_e=>_e.data)]);me(ne),O(je)}async function te(F){if(!x)return;await X.post(`/users/${x.id}/providers`,{provider_account_id:F,priority:fe.length});const{data:ne}=await X.get(`/users/${x.id}/providers`);O(ne)}async function pe(F){if(!x)return;await X.delete(`/users/${x.id}/providers/${F}`);const{data:ne}=await X.get(`/users/${x.id}/providers`);O(ne)}const ye=new Set(fe.map(F=>F.provider_account_id)),Ne=k.filter(F=>!M||F.name.toLowerCase().includes(M.toLowerCase())),we=L.filter(F=>!M||F.name.toLowerCase().includes(M.toLowerCase())),oe=k.filter(F=>D(F)).length+N.size;return l.jsxs("div",{className:"p-6 space-y-5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-bold",children:"Usuarios"}),l.jsxs("button",{onClick:()=>u(F=>!F),className:"flex items-center gap-2 bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:[l.jsx(tr,{size:16})," Nuevo usuario"]})]}),i&&l.jsxs("form",{onSubmit:ke,className:"bg-dark-800 border border-dark-700 rounded-xl p-5 space-y-3",children:[l.jsx("h3",{className:"font-semibold text-sm",children:d?"Editar usuario":"Nuevo usuario"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Usuario"}),l.jsx("input",{value:ae.username,onChange:F=>de(ne=>({...ne,username:F.target.value})),required:!0,disabled:!!d,className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs text-gray-500 mb-1",children:["Contraseña ",d&&"(dejar vacío para no cambiar)"]}),l.jsx("input",{type:"password",value:ae.password,onChange:F=>de(ne=>({...ne,password:F.target.value})),required:!d,className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Max. conexiones simultáneas"}),l.jsx("input",{type:"number",min:1,value:ae.max_connections,onChange:F=>de(ne=>({...ne,max_connections:+F.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Fecha expiración"}),l.jsx("input",{type:"date",value:ae.expiry_date,onChange:F=>de(ne=>({...ne,expiry_date:F.target.value})),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{className:"flex items-center gap-4 col-span-2",children:[l.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:ae.is_active,onChange:F=>de(ne=>({...ne,is_active:F.target.checked}))}),"Activo"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:ae.is_priority,onChange:F=>de(ne=>({...ne,is_priority:F.target.checked}))}),l.jsx(Pn,{size:13,className:"text-yellow-400"}),"Usuario prioritario"]})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{type:"submit",className:"bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium",children:"Guardar"}),l.jsx("button",{type:"button",onClick:Te,className:"bg-dark-700 hover:bg-dark-600 px-4 py-2 rounded-lg text-sm",children:"Cancelar"})]})]}),m&&l.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700 w-full max-w-2xl max-h-[85vh] flex flex-col",children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between shrink-0",children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"font-semibold",children:["Catálogo de ",l.jsx("span",{className:"text-primary-400",children:m.username})]}),l.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[oe," de ",k.length+L.length," categorías seleccionadas"]})]}),l.jsx("button",{onClick:()=>h(null),className:"text-gray-500 hover:text-white",children:"✕"})]}),l.jsxs("div",{className:"p-3 border-b border-dark-700 shrink-0 space-y-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Kt,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:M,onChange:F=>K(F.target.value),placeholder:"Buscar categoría...",className:"w-full bg-dark-700 border border-dark-600 rounded-lg pl-9 pr-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>ee(Ne),className:"text-xs px-3 py-1 rounded-lg bg-primary-900/40 hover:bg-primary-900/70 text-primary-300 border border-primary-800 transition-colors",children:"Seleccionar todo"}),l.jsx("button",{onClick:()=>G(Ne),className:"text-xs px-3 py-1 rounded-lg bg-dark-700 hover:bg-dark-600 text-gray-400 border border-dark-600 transition-colors",children:"Ninguna"})]})]}),l.jsxs("div",{className:"overflow-y-auto flex-1 p-4 space-y-4",children:[["live","movie","series"].map(F=>{const ne=Ne.filter(je=>je.type===F);return ne.length?l.jsxs("div",{children:[l.jsxs("h3",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2 flex items-center justify-between",children:[l.jsx("span",{children:Pg[F]}),l.jsxs("span",{className:"normal-case text-gray-600",children:[ne.filter(je=>D(je)).length,"/",ne.length]})]}),l.jsx("div",{className:"grid grid-cols-2 gap-1",children:ne.map(je=>l.jsxs("label",{className:`flex items-center gap-2 text-sm p-2 rounded-lg cursor-pointer transition-colors ${D(je)?"bg-primary-900/20 hover:bg-primary-900/30":"hover:bg-dark-700"}`,children:[l.jsx("input",{type:"checkbox",checked:D(je),onChange:_e=>U(je,_e.target.checked),className:"shrink-0"}),l.jsx("span",{className:"truncate",children:je.name}),je.provider_count>0&&l.jsxs("span",{className:`shrink-0 text-xs px-1.5 py-0.5 rounded ml-auto font-medium ${je.provider_count>1?"bg-green-900/50 text-green-400":"bg-dark-600 text-gray-500"}`,children:[je.provider_count,"p"]})]},je.name))})]},F):null}),Ne.length===0&&we.length===0&&l.jsx("div",{className:"text-center text-gray-500 text-sm py-8",children:"Sin resultados"}),we.length>0&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-xs text-gray-500 uppercase tracking-wider mb-2 flex items-center gap-2",children:[l.jsx(Pn,{size:11,className:"text-yellow-400"}),l.jsx("span",{children:"Categorías personalizadas"}),l.jsxs("span",{className:"normal-case text-gray-600",children:[we.filter(F=>N.has(F.id)).length,"/",we.length]})]}),l.jsx("div",{className:"grid grid-cols-2 gap-1",children:we.map(F=>l.jsxs("label",{className:`flex items-center gap-2 text-sm p-2 rounded-lg cursor-pointer transition-colors ${N.has(F.id)?"bg-yellow-900/20 hover:bg-yellow-900/30":"hover:bg-dark-700"}`,children:[l.jsx("input",{type:"checkbox",checked:N.has(F.id),onChange:ne=>{A(je=>{const _e=new Set(je);return ne.target.checked?_e.add(F.id):_e.delete(F.id),_e})},className:"shrink-0"}),l.jsx("span",{className:"truncate",children:F.name}),l.jsx(Pn,{size:10,className:"shrink-0 text-yellow-500 ml-auto"})]},F.id))})]})]}),l.jsxs("div",{className:"p-4 border-t border-dark-700 flex gap-2 justify-end shrink-0",children:[l.jsx("button",{onClick:()=>h(null),className:"bg-dark-700 px-4 py-2 rounded-lg text-sm",children:"Cancelar"}),l.jsx("button",{onClick:b,className:"bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium",children:"Guardar catálogo"})]})]})}),x&&l.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-dark-800 rounded-xl border border-dark-700 w-full max-w-md flex flex-col",children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold",children:["Proveedores preferidos — ",l.jsx("span",{className:"text-primary-400",children:x.username})]}),l.jsx("button",{onClick:()=>y(null),className:"text-gray-500 hover:text-white",children:"✕"})]}),l.jsxs("div",{className:"p-4 space-y-2",children:[l.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"Los proveedores marcados se intentan primero al asignar un slot. Si ninguno está disponible, se usa cualquiera con slot libre."}),Q.map(F=>{const ne=ye.has(F.id);return l.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${ne?"border-primary-700 bg-primary-900/20":"border-dark-600 bg-dark-700"}`,children:[l.jsx("span",{className:"text-sm",children:F.name}),l.jsx("button",{onClick:()=>ne?pe(F.id):te(F.id),className:`text-xs px-3 py-1 rounded-lg font-medium transition-colors ${ne?"bg-primary-600 hover:bg-red-700 text-white":"bg-dark-600 hover:bg-primary-700 text-gray-300 hover:text-white"}`,children:ne?"Quitar":"Preferido"})]},F.id)}),Q.length===0&&l.jsx("div",{className:"text-center text-gray-500 text-sm py-4",children:"No hay proveedores configurados"})]}),l.jsx("div",{className:"p-4 border-t border-dark-700 flex justify-end",children:l.jsx("button",{onClick:()=>y(null),className:"bg-dark-700 px-4 py-2 rounded-lg text-sm",children:"Cerrar"})})]})}),l.jsx("div",{className:"bg-dark-800 border border-dark-700 rounded-xl overflow-hidden",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{className:"border-b border-dark-700 text-xs text-gray-500",children:l.jsxs("tr",{children:[l.jsx("th",{className:"text-left px-4 py-3",children:"Usuario"}),l.jsx("th",{className:"text-left px-4 py-3",children:"Conexiones"}),l.jsx("th",{className:"text-left px-4 py-3",children:"Expiración"}),l.jsx("th",{className:"text-left px-4 py-3",children:"Estado"}),l.jsx("th",{className:"text-left px-4 py-3",children:"Acciones"})]})}),l.jsxs("tbody",{children:[s.map(F=>l.jsxs("tr",{className:"border-b border-dark-700 hover:bg-dark-700/30",children:[l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-1.5",children:[F.is_priority&&l.jsx(Pn,{size:12,className:"text-yellow-400 shrink-0"}),l.jsx("span",{className:"font-mono",children:F.username})]})}),l.jsx("td",{className:"px-4 py-3",children:F.max_connections}),l.jsx("td",{className:"px-4 py-3 text-gray-400",children:F.expiry_date?new Date(F.expiry_date).toLocaleDateString("es-ES"):"—"}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${F.is_active?"bg-green-900/40 text-green-400":"bg-red-900/40 text-red-400"}`,children:F.is_active?"Activo":"Inactivo"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>ge(F),title:"Asignar catálogo",className:"p-1.5 rounded hover:bg-dark-600 text-gray-400 hover:text-blue-400",children:l.jsx(wf,{size:14})}),l.jsx("button",{onClick:()=>I(F),title:"Proveedores preferidos",className:"p-1.5 rounded hover:bg-dark-600 text-gray-400 hover:text-purple-400",children:l.jsx(Ao,{size:14})}),l.jsx("button",{onClick:()=>q(F),title:F.is_priority?"Quitar prioridad":"Hacer prioritario",className:`p-1.5 rounded hover:bg-dark-600 transition-colors ${F.is_priority?"text-yellow-400":"text-gray-400 hover:text-yellow-400"}`,children:l.jsx(Pn,{size:14})}),l.jsx("button",{onClick:()=>ze(F),title:"Editar",className:"p-1.5 rounded hover:bg-dark-600 text-gray-400 hover:text-yellow-400",children:l.jsx(jf,{size:14})}),l.jsx("button",{onClick:()=>Ee(F.id),title:"Eliminar",className:"p-1.5 rounded hover:bg-dark-600 text-gray-400 hover:text-red-400",children:l.jsx(rn,{size:14})})]})})]},F.id)),s.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-gray-500",children:"No hay usuarios"})})]})]})})]})}const Tg={live:"Directo",movie:"Películas",series:"Series"},Lg={live:"bg-blue-900/40 text-blue-300",movie:"bg-purple-900/40 text-purple-300",series:"bg-green-900/40 text-green-300"};function Og(){const[s,a]=v.useState([]),[i,u]=v.useState(""),[d,f]=v.useState("");v.useEffect(()=>{X.get("/catalogs/grouped").then(h=>a(h.data))},[]);const m=s.filter(h=>{const x=!d||h.type===d,y=!i||h.name.toLowerCase().includes(i.toLowerCase());return x&&y});return l.jsxs("div",{className:"p-6 space-y-5",children:[l.jsx("h1",{className:"text-xl font-bold",children:"Catálogos de Categorías"}),l.jsx("p",{className:"text-sm text-gray-400",children:"Categorías importadas de los proveedores. El badge indica cuántos proveedores cubren cada categoría (= streams simultáneos posibles). Asígnalas a usuarios desde la sección Usuarios."}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("div",{className:"relative flex-1 max-w-sm",children:[l.jsx(Kt,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:i,onChange:h=>u(h.target.value),placeholder:"Buscar categoría...",className:"w-full bg-dark-800 border border-dark-700 rounded-lg pl-8 pr-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]}),l.jsxs("select",{value:d,onChange:h=>f(h.target.value),className:"bg-dark-800 border border-dark-700 rounded-lg px-3 py-2 text-sm focus:outline-none",children:[l.jsx("option",{value:"",children:"Todos los tipos"}),l.jsx("option",{value:"live",children:"Directo"}),l.jsx("option",{value:"movie",children:"Películas"}),l.jsx("option",{value:"series",children:"Series"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[m.map(h=>l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl p-3 flex items-center gap-2",children:[l.jsx("span",{className:"text-sm truncate flex-1 min-w-0",title:h.name,children:h.name}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[h.provider_count>0&&l.jsxs("span",{title:`${h.provider_count} proveedor${h.provider_count!==1?"es":""} — ${h.provider_count} stream${h.provider_count!==1?"s":""} simultáneo${h.provider_count!==1?"s":""} posible${h.provider_count!==1?"s":""}`,className:`text-xs px-1.5 py-0.5 rounded font-medium ${h.provider_count>1?"bg-green-900/50 text-green-400":"bg-dark-600 text-gray-500"}`,children:[h.provider_count,"p"]}),l.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${Lg[h.type]}`,children:Tg[h.type]})]})]},h.name+h.type)),m.length===0&&l.jsx("div",{className:"col-span-full bg-dark-800 border border-dark-700 border-dashed rounded-xl p-8 text-center text-gray-500 text-sm",children:s.length===0?"Sincroniza un proveedor para ver las categorías":"No se encontraron categorías"})]}),l.jsxs("p",{className:"text-xs text-gray-600",children:[m.length," categorías mostradas de ",s.length," totales"]})]})}function zg(){const[s,a]=v.useState([]),[i,u]=v.useState(!1),[d,f]=v.useState({name:"",url:""}),[m,h]=v.useState(!1);async function x(){const{data:z}=await X.get("/epg/");a(z)}v.useEffect(()=>{x()},[]);async function y(z){z.preventDefault(),await X.post("/epg/",d),f({name:"",url:""}),u(!1),x()}async function k(z){confirm("¿Eliminar fuente EPG?")&&(await X.delete(`/epg/${z}`),x())}async function C(){h(!0);try{await X.post("/epg/refresh"),alert("EPG actualización iniciada en segundo plano")}finally{h(!1)}}return l.jsxs("div",{className:"p-6 space-y-5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-bold",children:"Gestión EPG"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("button",{onClick:C,disabled:m,className:"flex items-center gap-2 bg-dark-700 hover:bg-dark-600 px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:[l.jsx(Ge,{size:15,className:m?"animate-spin":""}),"Actualizar EPG"]}),l.jsxs("button",{onClick:()=>u(z=>!z),className:"flex items-center gap-2 bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium",children:[l.jsx(tr,{size:16})," Añadir fuente"]})]})]}),l.jsxs("div",{className:"bg-dark-800 border border-primary-500/20 rounded-xl p-4 text-sm text-gray-400",children:[l.jsx("strong",{className:"text-gray-200",children:"Endpoint EPG para tus apps IPTV:"}),l.jsx("div",{className:"font-mono text-xs mt-1 bg-dark-700 rounded p-2 text-green-400",children:"http://10.10.10.234/xmltv.php?username=USUARIO&password=CONTRASEÑA"})]}),i&&l.jsxs("form",{onSubmit:y,className:"bg-dark-800 border border-dark-700 rounded-xl p-5 space-y-3",children:[l.jsx("h3",{className:"font-semibold text-sm",children:"Nueva fuente XMLTV"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Nombre"}),l.jsx("input",{value:d.name,onChange:z=>f(B=>({...B,name:z.target.value})),required:!0,className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"URL XMLTV (o del proveedor)"}),l.jsx("input",{value:d.url,onChange:z=>f(B=>({...B,url:z.target.value})),required:!0,placeholder:"http://proveedor.com/xmltv.php?username=X&password=Y",className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{type:"submit",className:"bg-primary-500 hover:bg-primary-600 px-4 py-2 rounded-lg text-sm font-medium",children:"Guardar"}),l.jsx("button",{type:"button",onClick:()=>u(!1),className:"bg-dark-700 px-4 py-2 rounded-lg text-sm",children:"Cancelar"})]})]}),l.jsxs("div",{className:"space-y-3",children:[s.map(z=>l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"font-semibold",children:z.name}),l.jsx("div",{className:"text-xs text-gray-500 truncate max-w-xl",children:z.url}),z.last_fetched_at&&l.jsxs("div",{className:"text-xs text-gray-600 mt-0.5",children:["Última actualización: ",new Date(z.last_fetched_at).toLocaleString("es-ES")]})]}),l.jsx("button",{onClick:()=>k(z.id),className:"p-2 rounded-lg bg-dark-700 hover:bg-red-900/40 text-gray-500 hover:text-red-400 transition-colors",children:l.jsx(rn,{size:15})})]},z.id)),s.length===0&&l.jsx("div",{className:"bg-dark-800 border border-dark-700 border-dashed rounded-xl p-8 text-center text-gray-500 text-sm",children:"No hay fuentes EPG configuradas"})]})]})}const ho={live:"Directo",movie:"Película",series:"Serie"},ef={live:Tr,movie:Yn,series:yf},ea={live:"bg-blue-500/20 text-blue-400",movie:"bg-purple-500/20 text-purple-400",series:"bg-orange-500/20 text-orange-400"};function Ag(){const[s,a]=v.useState([]),[i,u]=v.useState(null),[d,f]=v.useState([]),[m,h]=v.useState(""),[x,y]=v.useState(""),[k,C]=v.useState([]),[z,B]=v.useState(!1),[L,P]=v.useState(!1),[N,A]=v.useState(""),[M,K]=v.useState("live"),[Q,me]=v.useState(!1),fe=v.useCallback(async()=>{const{data:q}=await X.get("/custom-categories");a(q)},[]),O=v.useCallback(async q=>{const{data:ge}=await X.get(`/custom-categories/${q.id}/channels`);f(ge)},[]);v.useEffect(()=>{fe()},[fe]),v.useEffect(()=>{i&&O(i)},[i,O]);const ae=q=>{u(q),B(!1),h(""),C([])},de=async()=>{N.trim()&&(await X.post("/custom-categories",{name:N.trim(),type:M}),A(""),P(!1),await fe())},Y=async q=>{confirm(`¿Eliminar categoría "${q.name}"?`)&&(await X.delete(`/custom-categories/${q.id}`),(i==null?void 0:i.id)===q.id&&u(null),await fe())},ke=async q=>{await X.patch(`/custom-categories/${q.id}`,{is_visible:!q.is_visible}),await fe(),(i==null?void 0:i.id)===q.id&&u({...q,is_visible:!q.is_visible})},Te=v.useCallback(async(q,ge)=>{if(!q&&!ge){C([]);return}const{data:D}=await X.get("/custom-categories/channels/search",{params:{q,type:ge}});C(D)},[]);v.useEffect(()=>{const q=setTimeout(()=>Te(m,x),300);return()=>clearTimeout(q)},[m,x,Te]);const ze=async q=>{var ge;if(i)try{await X.post(`/custom-categories/${i.id}/channels`,{channel_id:q.id}),await O(i),await fe()}catch(D){((ge=D.response)==null?void 0:ge.status)!==409&&alert("Error al añadir canal")}},Ee=async q=>{i&&(await X.delete(`/custom-categories/${i.id}/channels/${q.item_id}`),await O(i),await fe())};return l.jsxs("div",{className:"flex h-full",children:[l.jsxs("aside",{className:"w-72 border-r border-dark-700 flex flex-col bg-dark-800",children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pn,{size:18,className:"text-yellow-400"}),l.jsx("h2",{className:"font-semibold text-sm",children:"Categorías personalizadas"})]}),l.jsx("button",{onClick:()=>P(!0),className:"p-1.5 rounded-lg bg-primary-500/20 text-primary-400 hover:bg-primary-500/30 transition-colors",children:l.jsx(tr,{size:15})})]}),L&&l.jsxs("div",{className:"p-3 border-b border-dark-700 bg-dark-900 space-y-2",children:[l.jsx("input",{autoFocus:!0,value:N,onChange:q=>A(q.target.value),onKeyDown:q=>q.key==="Enter"&&de(),placeholder:"Nombre de la categoría",className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:border-primary-500"}),l.jsxs("select",{value:M,onChange:q=>K(q.target.value),className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none",children:[l.jsx("option",{value:"live",children:"Directo"}),l.jsx("option",{value:"movie",children:"Película"}),l.jsx("option",{value:"series",children:"Serie"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:de,className:"flex-1 bg-primary-500 hover:bg-primary-600 text-white text-xs py-1.5 rounded-lg transition-colors",children:"Crear"}),l.jsx("button",{onClick:()=>P(!1),className:"flex-1 bg-dark-700 hover:bg-dark-600 text-xs py-1.5 rounded-lg transition-colors",children:"Cancelar"})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[s.length===0&&l.jsx("p",{className:"text-xs text-gray-500 text-center py-8",children:"No hay categorías personalizadas"}),s.map(q=>{const ge=ef[q.type];return l.jsxs("div",{onClick:()=>ae(q),className:Mt("flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer group transition-colors",(i==null?void 0:i.id)===q.id?"bg-primary-500/20":"hover:bg-dark-700"),children:[l.jsx(ge,{size:14,className:ea[q.type].split(" ")[1]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:Mt("text-sm font-medium truncate",(i==null?void 0:i.id)===q.id?"text-primary-300":"text-gray-200"),children:q.name}),l.jsxs("p",{className:"text-xs text-gray-500",children:[ho[q.type]," · ",q.item_count," canales"]})]}),l.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",onClick:D=>D.stopPropagation(),children:[l.jsx("button",{onClick:()=>ke(q),className:Mt("text-xs px-1.5 py-0.5 rounded",q.is_visible?"text-green-400":"text-gray-600"),title:q.is_visible?"Visible (clic para ocultar)":"Oculto (clic para mostrar)",children:q.is_visible?"●":"○"}),l.jsx("button",{onClick:()=>Y(q),className:"text-red-500 hover:text-red-400 p-0.5 rounded",children:l.jsx(rn,{size:12})})]})]},q.id)})]})]}),l.jsx("main",{className:"flex-1 flex flex-col overflow-hidden",children:i?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-4 border-b border-dark-700 flex items-center justify-between bg-dark-800",children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[(()=>{const q=ef[i.type];return l.jsx(q,{size:16,className:ea[i.type].split(" ")[1]})})(),i.name,l.jsx("span",{className:Mt("text-xs px-2 py-0.5 rounded-full",ea[i.type]),children:ho[i.type]})]}),l.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[d.length," canales asignados"]})]}),l.jsxs("button",{onClick:()=>B(!z),className:"flex items-center gap-2 px-3 py-1.5 bg-primary-500/20 text-primary-400 hover:bg-primary-500/30 rounded-lg text-sm transition-colors",children:[l.jsx(tr,{size:14})," Añadir canales"]})]}),z&&l.jsxs("div",{className:"border-b border-dark-700 bg-dark-900 p-4 space-y-3",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Kt,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{autoFocus:!0,value:m,onChange:q=>h(q.target.value),placeholder:"Buscar canal...",className:"w-full bg-dark-700 border border-dark-600 rounded-lg pl-9 pr-3 py-2 text-sm focus:outline-none focus:border-primary-500"})]}),l.jsxs("select",{value:x,onChange:q=>y(q.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 text-sm focus:outline-none",children:[l.jsx("option",{value:"",children:"Todos los tipos"}),l.jsx("option",{value:"live",children:"Directo"}),l.jsx("option",{value:"movie",children:"Película"}),l.jsx("option",{value:"series",children:"Serie"})]}),l.jsx("button",{onClick:()=>B(!1),className:"text-gray-500 hover:text-gray-300 p-2",children:l.jsx(On,{size:16})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-1 max-h-48 overflow-y-auto",children:[k.map(q=>{const ge=d.some(D=>D.channel_id===q.id);return l.jsxs("button",{onClick:()=>!ge&&ze(q),disabled:ge,className:Mt("flex items-center gap-2 px-3 py-2 rounded-lg text-left text-sm transition-colors",ge?"opacity-40 cursor-not-allowed bg-dark-700":"bg-dark-700 hover:bg-dark-600 cursor-pointer"),children:[q.logo?l.jsx("img",{src:q.logo,alt:"",className:"w-6 h-6 object-contain rounded",onError:D=>D.currentTarget.style.display="none"}):l.jsx("div",{className:"w-6 h-6 bg-dark-600 rounded"}),l.jsx("span",{className:"truncate flex-1",children:q.name}),ge&&l.jsx("span",{className:"text-xs text-green-500",children:"✓"})]},q.id)}),k.length===0&&(m||x)&&l.jsx("p",{className:"col-span-2 text-xs text-gray-500 text-center py-4",children:"Sin resultados"})]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d.length===0?l.jsxs("div",{className:"text-center py-16 text-gray-500",children:[l.jsx("p",{children:"Esta categoría está vacía."}),l.jsx("p",{className:"text-xs mt-1",children:'Usa "Añadir canales" para añadir contenido.'})]}):l.jsx("div",{className:"grid grid-cols-1 gap-1",children:d.map((q,ge)=>l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-dark-800 hover:bg-dark-700 group transition-colors",children:[l.jsx("span",{className:"text-xs text-gray-600 w-6 text-right",children:ge+1}),q.logo?l.jsx("img",{src:q.logo,alt:"",className:"w-8 h-8 object-contain rounded",onError:D=>D.currentTarget.style.display="none"}):l.jsx("div",{className:"w-8 h-8 bg-dark-600 rounded"}),l.jsx("span",{className:"flex-1 text-sm",children:q.name}),l.jsx("span",{className:Mt("text-xs px-1.5 py-0.5 rounded",ea[q.type]||"bg-gray-700 text-gray-400"),children:ho[q.type]||q.type}),l.jsx("button",{onClick:()=>Ee(q),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-400 p-1 transition-all",children:l.jsx(On,{size:14})})]},q.item_id))})})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500",children:l.jsxs("div",{className:"text-center",children:[l.jsx(Pn,{size:40,className:"mx-auto mb-3 text-gray-700"}),l.jsx("p",{children:"Selecciona una categoría para gestionar sus canales"})]})})})]})}function xo(s){return s>=1e9?(s/1e9).toFixed(2)+" GB":s>=1e6?(s/1e6).toFixed(1)+" MB":s>=1e3?(s/1e3).toFixed(0)+" KB":s+" B"}function Ro(s){return s?s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m ${s%60}s`:`${Math.floor(s/3600)}h ${Math.floor(s%3600/60)}m`:"—"}function Wf(s){return s?new Date(s).toLocaleString("es-ES",{dateStyle:"short",timeStyle:"short"}):"—"}const Dg={live:"bg-blue-500/20 text-blue-400",movie:"bg-purple-500/20 text-purple-400",series:"bg-orange-500/20 text-orange-400"},Fg={live:"Directo",movie:"Película",series:"Serie"};function Zn({icon:s,label:a,value:i,color:u}){return l.jsxs("div",{className:"bg-dark-800 rounded-xl p-4 flex items-center gap-3",children:[l.jsx(s,{size:20,className:u}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-gray-500",children:a}),l.jsx("p",{className:"text-lg font-bold",children:i})]})]})}function Ug(){const[s,a]=v.useState([]),[i,u]=v.useState(null),[d,f]=v.useState(0),[m,h]=v.useState(1),[x,y]=v.useState(!1),[k,C]=v.useState(""),[z,B]=v.useState(""),[L,P]=v.useState(""),[N,A]=v.useState(""),[M,K]=v.useState(""),Q=50,me=v.useCallback(async()=>{try{const{data:Y}=await X.get("/logs/stats");u(Y)}catch{}},[]),fe=v.useCallback(async(Y=1)=>{y(!0);try{const ke={page:Y,limit:Q};k&&(ke.username=k),z&&(ke.channel=z),L&&(ke.content_type=L),N&&(ke.date_from=N),M&&(ke.date_to=M);const{data:Te}=await X.get("/logs",{params:ke});a(Te.items),f(Te.total),h(Y)}finally{y(!1)}},[k,z,L,N,M]);v.useEffect(()=>{me(),fe(1)},[]);const O=()=>{me(),fe(1)},ae=async()=>{confirm("¿Eliminar todos los registros de conexión?")&&(await X.delete("/logs"),a([]),f(0),me())},de=Math.ceil(d/Q);return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs("button",{onClick:()=>{me(),fe(m)},className:"flex items-center gap-2 px-3 py-1.5 bg-dark-700 hover:bg-dark-600 rounded-lg text-sm transition-colors",children:[l.jsx(Ge,{size:14})," Actualizar"]}),l.jsxs("button",{onClick:ae,className:"flex items-center gap-2 px-3 py-1.5 bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded-lg text-sm transition-colors",children:[l.jsx(rn,{size:14})," Limpiar todo"]})]}),i&&l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(Zn,{icon:So,label:"Total sesiones",value:i.total_sessions.toLocaleString(),color:"text-primary-400"}),l.jsx(Zn,{icon:ch,label:"Datos totales",value:xo(i.total_bytes),color:"text-green-400"}),l.jsx(Zn,{icon:So,label:"Duración media",value:Ro(i.avg_duration_seconds),color:"text-yellow-400"}),l.jsx(Zn,{icon:aa,label:"Usuarios únicos",value:i.unique_users.toString(),color:"text-blue-400"})]}),i&&l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"bg-dark-800 rounded-xl p-4",children:[l.jsxs("h3",{className:"text-sm font-semibold mb-3 text-gray-300 flex items-center gap-2",children:[l.jsx(aa,{size:14})," Top usuarios"]}),l.jsxs("div",{className:"space-y-2",children:[i.top_users.map((Y,ke)=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"text-gray-600 w-4",children:ke+1}),l.jsx("span",{className:"flex-1 text-gray-200 font-medium",children:Y.username}),l.jsxs("span",{className:"text-gray-400",children:[Y.sessions," sesiones"]}),l.jsx("span",{className:"text-green-400 text-xs",children:xo(Y.bytes)})]},Y.username)),i.top_users.length===0&&l.jsx("p",{className:"text-xs text-gray-600",children:"Sin datos"})]})]}),l.jsxs("div",{className:"bg-dark-800 rounded-xl p-4",children:[l.jsxs("h3",{className:"text-sm font-semibold mb-3 text-gray-300 flex items-center gap-2",children:[l.jsx(Tr,{size:14})," Top canales/contenido"]}),l.jsxs("div",{className:"space-y-2",children:[i.top_channels.map((Y,ke)=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"text-gray-600 w-4",children:ke+1}),l.jsx("span",{className:"flex-1 text-gray-200 truncate",children:Y.channel_name}),l.jsx("span",{className:"text-gray-400",children:Y.sessions})]},Y.channel_name)),i.top_channels.length===0&&l.jsx("p",{className:"text-xs text-gray-600",children:"Sin datos"})]})]})]}),l.jsx("div",{className:"bg-dark-800 rounded-xl p-4",children:l.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Kt,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:k,onChange:Y=>C(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&O(),placeholder:"Usuario",className:"bg-dark-700 border border-dark-600 rounded-lg pl-8 pr-3 py-1.5 text-sm w-36 focus:outline-none focus:border-primary-500"})]}),l.jsxs("div",{className:"relative",children:[l.jsx(Kt,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:z,onChange:Y=>B(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&O(),placeholder:"Canal / película",className:"bg-dark-700 border border-dark-600 rounded-lg pl-8 pr-3 py-1.5 text-sm w-48 focus:outline-none focus:border-primary-500"})]}),l.jsxs("select",{value:L,onChange:Y=>P(Y.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none",children:[l.jsx("option",{value:"",children:"Todos los tipos"}),l.jsx("option",{value:"live",children:"Directo"}),l.jsx("option",{value:"movie",children:"Película"}),l.jsx("option",{value:"series",children:"Serie"})]}),l.jsx("input",{type:"date",value:N,onChange:Y=>A(Y.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none"}),l.jsx("span",{className:"text-gray-500 text-sm",children:"→"}),l.jsx("input",{type:"date",value:M,onChange:Y=>K(Y.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none"}),l.jsxs("button",{onClick:O,className:"flex items-center gap-2 px-4 py-1.5 bg-primary-500 hover:bg-primary-600 rounded-lg text-sm transition-colors",children:[l.jsx(Kt,{size:13})," Buscar"]})]})}),l.jsxs("div",{className:"bg-dark-800 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-dark-700",children:[l.jsxs("span",{className:"text-sm text-gray-400",children:[d.toLocaleString()," registros"]}),de>1&&l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("button",{onClick:()=>fe(m-1),disabled:m===1,className:"px-2 py-1 bg-dark-700 rounded disabled:opacity-40",children:"←"}),l.jsxs("span",{className:"text-gray-400",children:[m," / ",de]}),l.jsx("button",{onClick:()=>fe(m+1),disabled:m===de,className:"px-2 py-1 bg-dark-700 rounded disabled:opacity-40",children:"→"})]})]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-xs text-gray-500 border-b border-dark-700",children:[l.jsx("th",{className:"text-left px-4 py-2",children:"Usuario"}),l.jsx("th",{className:"text-left px-4 py-2",children:"IP"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Canal / Contenido"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Tipo"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Inicio"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Duración"}),l.jsx("th",{className:"text-right px-4 py-2",children:"Datos"})]})}),l.jsxs("tbody",{children:[x&&l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"text-center py-8 text-gray-500",children:"Cargando..."})}),!x&&s.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"text-center py-8 text-gray-500",children:"No hay registros"})}),s.map(Y=>l.jsxs("tr",{className:"border-b border-dark-700/50 hover:bg-dark-700/30 transition-colors",children:[l.jsx("td",{className:"px-4 py-2 font-medium text-gray-200",children:Y.username}),l.jsx("td",{className:"px-4 py-2 text-gray-400 font-mono text-xs",children:Y.client_ip||"—"}),l.jsx("td",{className:"px-4 py-2 text-gray-300 max-w-xs truncate",children:Y.channel_name||Y.stream_id||"—"}),l.jsx("td",{className:"px-4 py-2",children:Y.content_type?l.jsx("span",{className:Mt("text-xs px-2 py-0.5 rounded-full",Dg[Y.content_type]||"bg-gray-700 text-gray-400"),children:Fg[Y.content_type]||Y.content_type}):"—"}),l.jsx("td",{className:"px-4 py-2 text-gray-400 text-xs",children:Wf(Y.started_at)}),l.jsx("td",{className:"px-4 py-2 text-gray-400",children:Ro(Y.duration_seconds)}),l.jsx("td",{className:"px-4 py-2 text-right text-green-400 text-xs",children:xo(Y.bytes_transferred)})]},Y.id))]})]})})]})]})}function Mg(){const[s,a]=v.useState([]),[i,u]=v.useState(0),[d,f]=v.useState(1),[m,h]=v.useState(!1),[x,y]=v.useState(""),[k,C]=v.useState(""),[z,B]=v.useState(""),[L,P]=v.useState(""),N=50,A=v.useCallback(async(O=1)=>{h(!0);try{const ae={page:O,limit:N};x&&(ae.channel=x),k&&(ae.event_type=k),z&&(ae.date_from=z),L&&(ae.date_to=L);const{data:de}=await X.get("/logs/events",{params:ae});a(de.items),u(de.total),f(O)}finally{h(!1)}},[x,k,z,L]);v.useEffect(()=>{A(1)},[]);const M=()=>A(1),K=async()=>{confirm("¿Eliminar todos los registros de fallos?")&&(await X.delete("/logs/events"),a([]),u(0))},Q=Math.ceil(i/N),me=s.filter(O=>O.event_type==="caida").length,fe=s.filter(O=>O.event_type==="recuperado").length;return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs("button",{onClick:()=>A(d),className:"flex items-center gap-2 px-3 py-1.5 bg-dark-700 hover:bg-dark-600 rounded-lg text-sm transition-colors",children:[l.jsx(Ge,{size:14})," Actualizar"]}),l.jsxs("button",{onClick:K,className:"flex items-center gap-2 px-3 py-1.5 bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded-lg text-sm transition-colors",children:[l.jsx(rn,{size:14})," Limpiar todo"]})]}),l.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:[l.jsx(Zn,{icon:Ln,label:"Total fallos registrados",value:i.toLocaleString(),color:"text-orange-400"}),l.jsx(Zn,{icon:Ln,label:"Caídas (en vista actual)",value:me.toString(),color:"text-red-400"}),l.jsx(Zn,{icon:Dd,label:"Recuperaciones (en vista actual)",value:fe.toString(),color:"text-emerald-400"})]}),l.jsx("div",{className:"bg-dark-800 rounded-xl p-4",children:l.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Kt,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),l.jsx("input",{value:x,onChange:O=>y(O.target.value),onKeyDown:O=>O.key==="Enter"&&M(),placeholder:"Canal / proveedor",className:"bg-dark-700 border border-dark-600 rounded-lg pl-8 pr-3 py-1.5 text-sm w-48 focus:outline-none focus:border-primary-500"})]}),l.jsxs("select",{value:k,onChange:O=>C(O.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none",children:[l.jsx("option",{value:"",children:"Todos los eventos"}),l.jsx("option",{value:"caida",children:"Caídas"}),l.jsx("option",{value:"recuperado",children:"Recuperaciones"})]}),l.jsx("input",{type:"date",value:z,onChange:O=>B(O.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none"}),l.jsx("span",{className:"text-gray-500 text-sm",children:"→"}),l.jsx("input",{type:"date",value:L,onChange:O=>P(O.target.value),className:"bg-dark-700 border border-dark-600 rounded-lg px-3 py-1.5 text-sm focus:outline-none"}),l.jsxs("button",{onClick:M,className:"flex items-center gap-2 px-4 py-1.5 bg-primary-500 hover:bg-primary-600 rounded-lg text-sm transition-colors",children:[l.jsx(Kt,{size:13})," Buscar"]})]})}),l.jsxs("div",{className:"bg-dark-800 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-dark-700",children:[l.jsxs("span",{className:"text-sm text-gray-400",children:[i.toLocaleString()," eventos"]}),Q>1&&l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("button",{onClick:()=>A(d-1),disabled:d===1,className:"px-2 py-1 bg-dark-700 rounded disabled:opacity-40",children:"←"}),l.jsxs("span",{className:"text-gray-400",children:[d," / ",Q]}),l.jsx("button",{onClick:()=>A(d+1),disabled:d===Q,className:"px-2 py-1 bg-dark-700 rounded disabled:opacity-40",children:"→"})]})]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-xs text-gray-500 border-b border-dark-700",children:[l.jsx("th",{className:"text-left px-4 py-2",children:"Fecha"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Tipo"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Canal"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Proveedor · Dominio"}),l.jsx("th",{className:"text-left px-4 py-2",children:"Causa"}),l.jsx("th",{className:"text-left px-4 py-2 whitespace-nowrap",title:"Para caídas: tiempo que duró ffmpeg antes de fallar. Para recuperados: duración total de la interrupción.",children:"Duración fallo"}),l.jsx("th",{className:"text-right px-4 py-2",title:"Número de intentos fallidos antes de recuperar (solo en recuperados)",children:"Intentos"})]})}),l.jsxs("tbody",{children:[m&&l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"text-center py-8 text-gray-500",children:"Cargando..."})}),!m&&s.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"text-center py-8 text-gray-500",children:"Sin fallos registrados — los errores reales del proveedor aparecerán aquí automáticamente"})}),s.map(O=>l.jsxs("tr",{className:`border-b border-dark-700/50 hover:bg-dark-700/30 transition-colors ${O.event_type==="caida"?"bg-red-950/10":O.event_type==="recuperado"?"bg-emerald-950/10":""}`,children:[l.jsx("td",{className:"px-4 py-2.5 text-gray-400 text-xs whitespace-nowrap",children:Wf(O.created_at)}),l.jsx("td",{className:"px-4 py-2.5",children:O.event_type==="caida"?l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-red-500/20 text-red-400 border border-red-800/50",children:[l.jsx(Ln,{size:10})," Caída"]}):O.event_type==="recuperado"?l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400 border border-emerald-800/50",children:[l.jsx(Dd,{size:10})," Recuperado"]}):l.jsx("span",{className:"text-xs text-gray-400",children:O.event_type})}),l.jsx("td",{className:"px-4 py-2.5 text-gray-200 max-w-[180px] truncate text-xs",title:O.channel_name??"",children:O.channel_name||(O.channel_id?`#${O.channel_id}`:"—")}),l.jsxs("td",{className:"px-4 py-2.5 text-xs",children:[l.jsx("span",{className:"text-gray-400",children:O.provider_name||"—"}),O.domain&&l.jsx("span",{className:"block text-gray-600 font-mono text-[10px]",children:O.domain})]}),l.jsx("td",{className:"px-4 py-2.5 text-gray-300 text-xs max-w-[260px]",title:O.error_message??"",children:O.error_message||"—"}),l.jsx("td",{className:"px-4 py-2.5 text-xs tabular-nums",children:O.pump_duration_secs!=null?l.jsx("span",{className:O.event_type==="caida"?"text-red-400":"text-emerald-400",children:Ro(O.pump_duration_secs)}):"—"}),l.jsx("td",{className:"px-4 py-2.5 text-right text-gray-500 text-xs tabular-nums",children:O.attempt_number??"—"})]},O.id))]})]})})]})]})}function Ig(){const[s,a]=v.useState("connections");return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsx("h1",{className:"text-xl font-bold",children:"Registro"})}),l.jsxs("div",{className:"flex gap-1 border-b border-dark-700 pb-0",children:[l.jsx("button",{onClick:()=>a("connections"),className:Mt("px-4 py-2 text-sm font-medium rounded-t-lg transition-colors border-b-2 -mb-px",s==="connections"?"border-primary-500 text-primary-400 bg-dark-800":"border-transparent text-gray-500 hover:text-gray-300"),children:"Conexiones de usuarios"}),l.jsxs("button",{onClick:()=>a("events"),className:Mt("px-4 py-2 text-sm font-medium rounded-t-lg transition-colors border-b-2 -mb-px flex items-center gap-1.5",s==="events"?"border-red-500 text-red-400 bg-dark-800":"border-transparent text-gray-500 hover:text-gray-300"),children:[l.jsx(Ln,{size:13})," Fallos de stream"]})]}),s==="connections"&&l.jsx(Ug,{}),s==="events"&&l.jsx(Mg,{})]})}function $g(){const[s,a]=v.useState(!1),[i,u]=v.useState(""),[d,f]=v.useState(!1),[m,h]=v.useState(!1),x=v.useRef(null),y=async()=>{try{const L=localStorage.getItem("token");(await fetch("/api/admin/settings/blocked-image",{headers:{Authorization:`Bearer ${L}`}})).ok?(a(!0),u("/panel/blocked_image.jpg?t="+Date.now())):(a(!1),u(""))}catch{a(!1)}};v.useEffect(()=>{y()},[]);const k=async L=>{var P,N;if(!L.type.startsWith("image/")){alert("Solo se permiten imágenes (JPEG, PNG, WebP, GIF)");return}f(!0);try{const A=new FormData;A.append("file",L),await X.post("/settings/blocked-image",A,{headers:{"Content-Type":"multipart/form-data"}}),await y()}catch(A){alert("Error al subir la imagen: "+(((N=(P=A.response)==null?void 0:P.data)==null?void 0:N.detail)||A.message))}finally{f(!1)}},C=L=>{var N;const P=(N=L.target.files)==null?void 0:N[0];P&&k(P),L.target.value=""},z=L=>{L.preventDefault(),h(!1);const P=L.dataTransfer.files[0];P&&k(P)},B=async()=>{confirm("¿Eliminar la imagen de bloqueo?")&&(await X.delete("/settings/blocked-image"),a(!1),u(""))};return l.jsxs("div",{className:"p-6 max-w-2xl space-y-6",children:[l.jsx("h1",{className:"text-xl font-bold",children:"Ajustes"}),l.jsxs("div",{className:"bg-dark-800 rounded-xl p-6 space-y-4",children:[l.jsxs("div",{children:[l.jsxs("h2",{className:"font-semibold text-base flex items-center gap-2",children:[l.jsx(dh,{size:18,className:"text-primary-400"}),"Imagen de conexión bloqueada"]}),l.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Esta imagen se mostrará como canal de vídeo cuando un usuario intente reproducir en un segundo dispositivo habiendo alcanzado su límite de conexiones simultáneas."})]}),l.jsxs("div",{className:"flex items-start gap-2 text-xs text-blue-400 bg-blue-500/10 rounded-lg px-3 py-2",children:[l.jsx(fh,{size:13,className:"mt-0.5 shrink-0"}),l.jsx("span",{children:"El zapping normal (cambiar de canal en el mismo dispositivo) sigue funcionando sin interrupciones. La imagen solo aparece cuando se conecta un segundo dispositivo diferente con la misma cuenta."})]}),l.jsxs("div",{onDragOver:L=>{L.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:z,onClick:()=>{var L;return!d&&((L=x.current)==null?void 0:L.click())},className:` relative border-2 border-dashed rounded-xl cursor-pointer transition-colors ${m?"border-primary-400 bg-primary-500/10":"border-dark-600 hover:border-dark-500"} `,children:[l.jsx("input",{ref:x,type:"file",accept:"image/*",className:"hidden",onChange:C}),s&&i?l.jsxs("div",{className:"relative",children:[l.jsx("img",{src:i,alt:"Blocked image",className:"w-full rounded-xl object-contain max-h-72"}),l.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 hover:opacity-100 transition-opacity rounded-xl flex items-center justify-center",children:l.jsx("span",{className:"text-white text-sm font-medium",children:"Haz clic para cambiar"})})]}):l.jsxs("div",{className:"py-12 flex flex-col items-center gap-3 text-gray-500",children:[l.jsx(vh,{size:32,className:m?"text-primary-400":""}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"font-medium text-sm",children:"Arrastra una imagen o haz clic para subir"}),l.jsx("p",{className:"text-xs mt-1",children:"JPEG, PNG, WebP o GIF · máx. 10 MB"})]})]}),d&&l.jsx("div",{className:"absolute inset-0 bg-dark-900/80 rounded-xl flex items-center justify-center",children:l.jsx("div",{className:"text-sm text-primary-400",children:"Subiendo..."})})]}),s&&l.jsx("div",{className:"flex justify-end",children:l.jsxs("button",{onClick:B,className:"flex items-center gap-2 px-3 py-1.5 bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded-lg text-sm transition-colors",children:[l.jsx(rn,{size:14})," Eliminar imagen"]})})]})]})}const tf={name:"",url:"http://10.10.10.15:8096",api_key:"c339ccd3b7234c9a874bcfb70e92364a",movies_category_name:"Películas KiraTV",series_category_name:"Series KiraTV",movies_library_id:"",series_library_id:""};function Bg(){const[s,a]=v.useState([]),[i,u]=v.useState(!0),[d,f]=v.useState(!1),[m,h]=v.useState(null),[x,y]=v.useState({...tf}),[k,C]=v.useState(!1),[z,B]=v.useState(null),[L,P]=v.useState(!1),[N,A]=v.useState([]),[M,K]=v.useState(!1),[Q,me]=v.useState({}),[fe,O]=v.useState(null);v.useEffect(()=>{ae()},[]);async function ae(){u(!0);try{const{data:D}=await X.get("/jellyfin");a(D)}finally{u(!1)}}function de(){h(null),y({...tf}),B(null),A([]),f(!0)}function Y(D){h(D.id),y({name:D.name,url:D.url,api_key:D.api_key,movies_category_name:D.movies_category_name,series_category_name:D.series_category_name,movies_library_id:D.movies_library_id??"",series_library_id:D.series_library_id??""}),B(null),A([]),f(!0)}async function ke(){if(!(!x.url||!x.api_key)){P(!0),B(null);try{if(m){const{data:D}=await X.post(`/jellyfin/${m}/test`);B(D)}else{const{data:D}=await X.post("/jellyfin",{name:"__test__",url:x.url,api_key:x.api_key,movies_category_name:x.movies_category_name,series_category_name:x.series_category_name}),{data:U}=await X.post(`/jellyfin/${D.id}/test`);await X.delete(`/jellyfin/${D.id}`),B(U)}}catch{B({ok:!1,error:"Error de red"})}finally{P(!1)}}}async function Te(){if(!m){await ze();return}K(!0);try{const{data:D}=await X.get(`/jellyfin/${m}/libraries`);A(D)}catch{A([])}finally{K(!1)}}async function ze(){C(!0);try{const D={...x,movies_library_id:x.movies_library_id||null,series_library_id:x.series_library_id||null};if(m)await X.put(`/jellyfin/${m}`,D);else{const{data:U}=await X.post("/jellyfin",D);h(U.id)}await ae()}finally{C(!1)}}async function Ee(D){confirm("¿Eliminar esta configuración de Jellyfin? Se borrarán todos los canales sincronizados.")&&(await X.delete(`/jellyfin/${D}`),a(U=>U.filter(ee=>ee.id!==D)),m===D&&f(!1))}async function q(D){me(U=>({...U,[D]:{status:"running",message:"Iniciando…",synced:0}})),await X.post(`/jellyfin/${D}/sync`),ge(D)}function ge(D){const U=setInterval(async()=>{try{const{data:ee}=await X.get(`/jellyfin/${D}/sync-status`);me(G=>({...G,[D]:ee})),ee.status!=="running"&&(clearInterval(U),ee.status==="done"&&ae())}catch{clearInterval(U)}},1500)}return N.filter(D=>D.type==="movies"||D.type===""),N.filter(D=>D.type==="tvshows"||D.type===""),l.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-bold",children:"Biblioteca Jellyfin"}),l.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"Integra tu catálogo local de Jellyfin como VOD y Series en KiraStream"})]}),l.jsxs("button",{onClick:de,className:"flex items-center gap-2 bg-primary-600 hover:bg-primary-500 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:[l.jsx(tr,{size:16})," Nueva conexión"]})]}),i?l.jsx("div",{className:"flex justify-center py-12",children:l.jsx(Xl,{size:24,className:"animate-spin text-gray-400"})}):s.length===0?l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl p-12 text-center text-gray-500",children:[l.jsx(Yn,{size:36,className:"mx-auto mb-3 opacity-30"}),l.jsx("p",{className:"text-sm",children:"No hay conexiones Jellyfin configuradas"}),l.jsx("button",{onClick:de,className:"mt-4 text-primary-400 hover:text-primary-300 text-sm",children:"+ Añadir primera conexión"})]}):l.jsx("div",{className:"space-y-4",children:s.map(D=>{const U=Q[D.id];return l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-4 p-4",children:[l.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-900/30 flex items-center justify-center shrink-0",children:l.jsx(Yn,{size:20,className:"text-purple-400"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:D.name}),l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${D.is_active?"bg-green-900/30 text-green-400":"bg-gray-700 text-gray-400"}`,children:D.is_active?"activo":"inactivo"})]}),l.jsx("div",{className:"text-xs text-gray-500 mt-0.5 truncate",children:D.url}),l.jsxs("div",{className:"text-xs text-gray-600 mt-0.5",children:[D.item_count," elementos",D.last_sync_at&&` · Última sync: ${new Date(D.last_sync_at).toLocaleString("es-ES")}`]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[(U==null?void 0:U.status)==="running"?l.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[l.jsx(Ge,{size:12,className:"animate-spin"})," ",U.message]}):l.jsxs("button",{onClick:()=>q(D.id),className:"flex items-center gap-1.5 text-xs bg-dark-700 hover:bg-primary-600 text-gray-300 hover:text-white px-3 py-1.5 rounded-lg transition-colors",children:[l.jsx(Ge,{size:12})," Sincronizar"]}),l.jsx("button",{onClick:()=>Y(D),className:"text-gray-500 hover:text-primary-400 p-1.5 rounded transition-colors",title:"Editar",children:l.jsx(hh,{size:14})}),l.jsx("button",{onClick:()=>Ee(D.id),className:"text-gray-500 hover:text-red-400 p-1.5 rounded transition-colors",title:"Eliminar",children:l.jsx(rn,{size:14})}),l.jsx("button",{onClick:()=>O(fe===D.id?null:D.id),className:"text-gray-500 hover:text-gray-300 p-1.5 rounded transition-colors",children:fe===D.id?l.jsx(uh,{size:14}):l.jsx(ko,{size:14})})]})]}),(U==null?void 0:U.status)==="done"&&l.jsxs("div",{className:"px-4 pb-3 text-xs text-green-400 flex items-center gap-1",children:[l.jsx(oo,{size:12})," ",U.message," · ",U.synced," elementos importados"]}),(U==null?void 0:U.status)==="error"&&l.jsxs("div",{className:"px-4 pb-3 text-xs text-red-400 flex items-center gap-1",children:[l.jsx(On,{size:12})," Error: ",U.message]}),fe===D.id&&l.jsxs("div",{className:"px-4 pb-4 border-t border-dark-700 pt-3 grid grid-cols-2 gap-4 text-xs text-gray-400",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-1 mb-1 text-purple-400 font-medium",children:[l.jsx(Yn,{size:12})," Películas"]}),l.jsxs("div",{children:["Categoría: ",l.jsx("span",{className:"text-gray-300",children:D.movies_category_name})]}),l.jsxs("div",{children:["Biblioteca: ",l.jsx("span",{className:"text-gray-300",children:D.movies_library_id||"—"})]})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-1 mb-1 text-blue-400 font-medium",children:[l.jsx(Tr,{size:12})," Series"]}),l.jsxs("div",{children:["Categoría: ",l.jsx("span",{className:"text-gray-300",children:D.series_category_name})]}),l.jsxs("div",{children:["Biblioteca: ",l.jsx("span",{className:"text-gray-300",children:D.series_library_id||"—"})]})]})]})]},D.id)})}),d&&l.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",children:l.jsxs("div",{className:"bg-dark-800 border border-dark-700 rounded-xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-dark-700",children:[l.jsx("h2",{className:"font-semibold",children:m?"Editar conexión":"Nueva conexión Jellyfin"}),l.jsx("button",{onClick:()=>f(!1),className:"text-gray-500 hover:text-white",children:l.jsx(On,{size:16})})]}),l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Nombre"}),l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",value:x.name,onChange:D=>y(U=>({...U,name:D.target.value})),placeholder:"Mi Jellyfin"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"URL del servidor"}),l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm font-mono",value:x.url,onChange:D=>y(U=>({...U,url:D.target.value})),placeholder:"http://192.168.1.x:8096"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"API Key"}),l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm font-mono",value:x.api_key,onChange:D=>y(U=>({...U,api_key:D.target.value})),placeholder:"Tu API key de Jellyfin"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("button",{onClick:ke,disabled:L||!x.url||!x.api_key,className:"flex items-center gap-1.5 bg-dark-700 hover:bg-dark-600 text-sm px-3 py-2 rounded-lg transition-colors disabled:opacity-50",children:[L?l.jsx(Xl,{size:14,className:"animate-spin"}):l.jsx(oo,{size:14}),"Probar conexión"]}),z&&l.jsx("span",{className:`text-xs flex items-center gap-1 ${z.ok?"text-green-400":"text-red-400"}`,children:z.ok?l.jsxs(l.Fragment,{children:[l.jsx(oo,{size:12})," ",z.server_name]}):l.jsxs(l.Fragment,{children:[l.jsx(On,{size:12})," ",z.error]})})]}),l.jsx("hr",{className:"border-dark-600"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-gray-400 font-medium uppercase tracking-wider",children:"Bibliotecas"}),l.jsxs("button",{onClick:Te,disabled:M,className:"flex items-center gap-1 text-xs text-primary-400 hover:text-primary-300 transition-colors disabled:opacity-50",children:[M?l.jsx(Xl,{size:11,className:"animate-spin"}):l.jsx(Ge,{size:11}),m?"Cargar bibliotecas":"Guardar primero para cargar"]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsxs("label",{className:"text-xs text-gray-400 mb-1 block flex items-center gap-1",children:[l.jsx(Yn,{size:11})," Biblioteca de Películas"]}),N.length>0?l.jsxs("select",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",value:x.movies_library_id,onChange:D=>y(U=>({...U,movies_library_id:D.target.value})),children:[l.jsx("option",{value:"",children:"— ninguna —"}),N.map(D=>l.jsxs("option",{value:D.id,children:[D.name," (",D.type||"sin tipo",")"]},D.id))]}):l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm font-mono text-xs",value:x.movies_library_id,onChange:D=>y(U=>({...U,movies_library_id:D.target.value})),placeholder:"ID de biblioteca"})]}),l.jsxs("div",{children:[l.jsxs("label",{className:"text-xs text-gray-400 mb-1 block flex items-center gap-1",children:[l.jsx(Tr,{size:11})," Biblioteca de Series"]}),N.length>0?l.jsxs("select",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",value:x.series_library_id,onChange:D=>y(U=>({...U,series_library_id:D.target.value})),children:[l.jsx("option",{value:"",children:"— ninguna —"}),N.map(D=>l.jsxs("option",{value:D.id,children:[D.name," (",D.type||"sin tipo",")"]},D.id))]}):l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm font-mono text-xs",value:x.series_library_id,onChange:D=>y(U=>({...U,series_library_id:D.target.value})),placeholder:"ID de biblioteca"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Nombre categoría Películas"}),l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",value:x.movies_category_name,onChange:D=>y(U=>({...U,movies_category_name:D.target.value}))})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Nombre categoría Series"}),l.jsx("input",{className:"w-full bg-dark-700 border border-dark-600 rounded-lg px-3 py-2 text-sm",value:x.series_category_name,onChange:D=>y(U=>({...U,series_category_name:D.target.value}))})]})]})]}),l.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-dark-700",children:[l.jsx("button",{onClick:()=>f(!1),className:"px-4 py-2 text-sm text-gray-400 hover:text-white",children:"Cancelar"}),l.jsxs("button",{onClick:async()=>{await ze(),f(!1)},disabled:k||!x.name||!x.url||!x.api_key,className:"flex items-center gap-2 bg-primary-600 hover:bg-primary-500 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-50",children:[k&&l.jsx(Xl,{size:14,className:"animate-spin"}),m?"Guardar cambios":"Crear"]})]})]})})]})}function Vg({children:s}){return localStorage.getItem("token")?l.jsx(l.Fragment,{children:s}):l.jsx(vo,{to:"/login",replace:!0})}function Hg(){return l.jsx(Y0,{basename:"/panel",children:l.jsxs(V0,{children:[l.jsx(yt,{path:"/login",element:l.jsx(cg,{})}),l.jsxs(yt,{path:"/",element:l.jsx(Vg,{children:l.jsx(mg,{})}),children:[l.jsx(yt,{index:!0,element:l.jsx(vo,{to:"/dashboard",replace:!0})}),l.jsx(yt,{path:"dashboard",element:l.jsx(bg,{})}),l.jsx(yt,{path:"providers",element:l.jsx(Eg,{})}),l.jsx(yt,{path:"users",element:l.jsx(Rg,{})}),l.jsx(yt,{path:"catalogs",element:l.jsx(Og,{})}),l.jsx(yt,{path:"custom-categories",element:l.jsx(Ag,{})}),l.jsx(yt,{path:"epg",element:l.jsx(zg,{})}),l.jsx(yt,{path:"logs",element:l.jsx(Ig,{})}),l.jsx(yt,{path:"settings",element:l.jsx($g,{})}),l.jsx(yt,{path:"jellyfin",element:l.jsx(Bg,{})})]}),l.jsx(yt,{path:"*",element:l.jsx(vo,{to:"/dashboard",replace:!0})})]})})}Gm.createRoot(document.getElementById("root")).render(l.jsx(rf.StrictMode,{children:l.jsx(Hg,{})}));