figranium 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ (function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function r(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function u(f){if(f.ep)return;f.ep=!0;const d=r(f);fetch(f.href,d)}})();var Ps=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var zc={exports:{}},Si={};var Gh;function d0(){if(Gh)return Si;Gh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function r(u,f,d){var h=null;if(d!==void 0&&(h=""+d),f.key!==void 0&&(h=""+f.key),"key"in f){d={};for(var p in f)p!=="key"&&(d[p]=f[p])}else d=f;return f=d.ref,{$$typeof:i,type:u,key:h,ref:f!==void 0?f:null,props:d}}return Si.Fragment=c,Si.jsx=r,Si.jsxs=r,Si}var Vh;function f0(){return Vh||(Vh=1,zc.exports=d0()),zc.exports}var l=f0(),Rc={exports:{}},Ge={};var Xh;function h0(){if(Xh)return Ge;Xh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),k=Symbol.iterator;function y(R){return R===null||typeof R!="object"?null:(R=k&&R[k]||R["@@iterator"],typeof R=="function"?R:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,b={};function j(R,D,W){this.props=R,this.context=D,this.refs=b,this.updater=W||_}j.prototype.isReactComponent={},j.prototype.setState=function(R,D){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,D,"setState")},j.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function S(){}S.prototype=j.prototype;function A(R,D,W){this.props=R,this.context=D,this.refs=b,this.updater=W||_}var M=A.prototype=new S;M.constructor=A,m(M,j.prototype),M.isPureReactComponent=!0;var O=Array.isArray;function U(){}var L={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function V(R,D,W){var te=W.ref;return{$$typeof:i,type:R,key:D,ref:te!==void 0?te:null,props:W}}function de(R,D){return V(R.type,D,R.props)}function ae(R){return typeof R=="object"&&R!==null&&R.$$typeof===i}function H(R){var D={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(W){return D[W]})}var F=/\/+/g;function z(R,D){return typeof R=="object"&&R!==null&&R.key!=null?H(""+R.key):D.toString(36)}function se(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(U,U):(R.status="pending",R.then(function(D){R.status==="pending"&&(R.status="fulfilled",R.value=D)},function(D){R.status==="pending"&&(R.status="rejected",R.reason=D)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function $(R,D,W,te,Y){var he=typeof R;(he==="undefined"||he==="boolean")&&(R=null);var ke=!1;if(R===null)ke=!0;else switch(he){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(R.$$typeof){case i:case c:ke=!0;break;case C:return ke=R._init,$(ke(R._payload),D,W,te,Y)}}if(ke)return Y=Y(R),ke=te===""?"."+z(R,0):te,O(Y)?(W="",ke!=null&&(W=ke.replace(F,"$&/")+"/"),$(Y,D,W,"",function(Ke){return Ke})):Y!=null&&(ae(Y)&&(Y=de(Y,W+(Y.key==null||R&&R.key===Y.key?"":(""+Y.key).replace(F,"$&/")+"/")+ke)),D.push(Y)),1;ke=0;var Ae=te===""?".":te+":";if(O(R))for(var Oe=0;Oe<R.length;Oe++)te=R[Oe],he=Ae+z(te,Oe),ke+=$(te,D,W,he,Y);else if(Oe=y(R),typeof Oe=="function")for(R=Oe.call(R),Oe=0;!(te=R.next()).done;)te=te.value,he=Ae+z(te,Oe++),ke+=$(te,D,W,he,Y);else if(he==="object"){if(typeof R.then=="function")return $(se(R),D,W,te,Y);throw D=String(R),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return ke}function P(R,D,W){if(R==null)return R;var te=[],Y=0;return $(R,te,"","",function(he){return D.call(W,he,Y++)}),te}function Z(R){if(R._status===-1){var D=R._result;D=D(),D.then(function(W){(R._status===0||R._status===-1)&&(R._status=1,R._result=W)},function(W){(R._status===0||R._status===-1)&&(R._status=2,R._result=W)}),R._status===-1&&(R._status=0,R._result=D)}if(R._status===1)return R._result.default;throw R._result}var X=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},ge={map:P,forEach:function(R,D,W){P(R,function(){D.apply(this,arguments)},W)},count:function(R){var D=0;return P(R,function(){D++}),D},toArray:function(R){return P(R,function(D){return D})||[]},only:function(R){if(!ae(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ge.Activity=w,Ge.Children=ge,Ge.Component=j,Ge.Fragment=r,Ge.Profiler=f,Ge.PureComponent=A,Ge.StrictMode=u,Ge.Suspense=x,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(R){return L.H.useMemoCache(R)}},Ge.cache=function(R){return function(){return R.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(R,D,W){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var te=m({},R.props),Y=R.key;if(D!=null)for(he in D.key!==void 0&&(Y=""+D.key),D)!I.call(D,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&D.ref===void 0||(te[he]=D[he]);var he=arguments.length-2;if(he===1)te.children=W;else if(1<he){for(var ke=Array(he),Ae=0;Ae<he;Ae++)ke[Ae]=arguments[Ae+2];te.children=ke}return V(R.type,Y,te)},Ge.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:d,_context:R},R},Ge.createElement=function(R,D,W){var te,Y={},he=null;if(D!=null)for(te in D.key!==void 0&&(he=""+D.key),D)I.call(D,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(Y[te]=D[te]);var ke=arguments.length-2;if(ke===1)Y.children=W;else if(1<ke){for(var Ae=Array(ke),Oe=0;Oe<ke;Oe++)Ae[Oe]=arguments[Oe+2];Y.children=Ae}if(R&&R.defaultProps)for(te in ke=R.defaultProps,ke)Y[te]===void 0&&(Y[te]=ke[te]);return V(R,he,Y)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(R){return{$$typeof:p,render:R}},Ge.isValidElement=ae,Ge.lazy=function(R){return{$$typeof:C,_payload:{_status:-1,_result:R},_init:Z}},Ge.memo=function(R,D){return{$$typeof:g,type:R,compare:D===void 0?null:D}},Ge.startTransition=function(R){var D=L.T,W={};L.T=W;try{var te=R(),Y=L.S;Y!==null&&Y(W,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(U,X)}catch(he){X(he)}finally{D!==null&&W.types!==null&&(D.types=W.types),L.T=D}},Ge.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ge.use=function(R){return L.H.use(R)},Ge.useActionState=function(R,D,W){return L.H.useActionState(R,D,W)},Ge.useCallback=function(R,D){return L.H.useCallback(R,D)},Ge.useContext=function(R){return L.H.useContext(R)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(R,D){return L.H.useDeferredValue(R,D)},Ge.useEffect=function(R,D){return L.H.useEffect(R,D)},Ge.useEffectEvent=function(R){return L.H.useEffectEvent(R)},Ge.useId=function(){return L.H.useId()},Ge.useImperativeHandle=function(R,D,W){return L.H.useImperativeHandle(R,D,W)},Ge.useInsertionEffect=function(R,D){return L.H.useInsertionEffect(R,D)},Ge.useLayoutEffect=function(R,D){return L.H.useLayoutEffect(R,D)},Ge.useMemo=function(R,D){return L.H.useMemo(R,D)},Ge.useOptimistic=function(R,D){return L.H.useOptimistic(R,D)},Ge.useReducer=function(R,D,W){return L.H.useReducer(R,D,W)},Ge.useRef=function(R){return L.H.useRef(R)},Ge.useState=function(R){return L.H.useState(R)},Ge.useSyncExternalStore=function(R,D,W){return L.H.useSyncExternalStore(R,D,W)},Ge.useTransition=function(){return L.H.useTransition()},Ge.version="19.2.3",Ge}var Zh;function Jc(){return Zh||(Zh=1,Rc.exports=h0()),Rc.exports}var E=Jc();const tt=Pc(E);var Oc={exports:{}},Ni={},Dc={exports:{}},Tc={};var $h;function p0(){return $h||($h=1,(function(i){function c($,P){var Z=$.length;$.push(P);e:for(;0<Z;){var X=Z-1>>>1,ge=$[X];if(0<f(ge,P))$[X]=P,$[Z]=ge,Z=X;else break e}}function r($){return $.length===0?null:$[0]}function u($){if($.length===0)return null;var P=$[0],Z=$.pop();if(Z!==P){$[0]=Z;e:for(var X=0,ge=$.length,R=ge>>>1;X<R;){var D=2*(X+1)-1,W=$[D],te=D+1,Y=$[te];if(0>f(W,Z))te<ge&&0>f(Y,W)?($[X]=Y,$[te]=Z,X=te):($[X]=W,$[D]=Z,X=D);else if(te<ge&&0>f(Y,Z))$[X]=Y,$[te]=Z,X=te;else break e}}return P}function f($,P){var Z=$.sortIndex-P.sortIndex;return Z!==0?Z:$.id-P.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;i.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();i.unstable_now=function(){return h.now()-p}}var x=[],g=[],C=1,w=null,k=3,y=!1,_=!1,m=!1,b=!1,j=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function M($){for(var P=r(g);P!==null;){if(P.callback===null)u(g);else if(P.startTime<=$)u(g),P.sortIndex=P.expirationTime,c(x,P);else break;P=r(g)}}function O($){if(m=!1,M($),!_)if(r(x)!==null)_=!0,U||(U=!0,H());else{var P=r(g);P!==null&&se(O,P.startTime-$)}}var U=!1,L=-1,I=5,V=-1;function de(){return b?!0:!(i.unstable_now()-V<I)}function ae(){if(b=!1,U){var $=i.unstable_now();V=$;var P=!0;try{e:{_=!1,m&&(m=!1,S(L),L=-1),y=!0;var Z=k;try{t:{for(M($),w=r(x);w!==null&&!(w.expirationTime>$&&de());){var X=w.callback;if(typeof X=="function"){w.callback=null,k=w.priorityLevel;var ge=X(w.expirationTime<=$);if($=i.unstable_now(),typeof ge=="function"){w.callback=ge,M($),P=!0;break t}w===r(x)&&u(x),M($)}else u(x);w=r(x)}if(w!==null)P=!0;else{var R=r(g);R!==null&&se(O,R.startTime-$),P=!1}}break e}finally{w=null,k=Z,y=!1}P=void 0}}finally{P?H():U=!1}}}var H;if(typeof A=="function")H=function(){A(ae)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,z=F.port2;F.port1.onmessage=ae,H=function(){z.postMessage(null)}}else H=function(){j(ae,0)};function se($,P){L=j(function(){$(i.unstable_now())},P)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function($){$.callback=null},i.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<$?Math.floor(1e3/$):5},i.unstable_getCurrentPriorityLevel=function(){return k},i.unstable_next=function($){switch(k){case 1:case 2:case 3:var P=3;break;default:P=k}var Z=k;k=P;try{return $()}finally{k=Z}},i.unstable_requestPaint=function(){b=!0},i.unstable_runWithPriority=function($,P){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Z=k;k=$;try{return P()}finally{k=Z}},i.unstable_scheduleCallback=function($,P,Z){var X=i.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?X+Z:X):Z=X,$){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=Z+ge,$={id:C++,callback:P,priorityLevel:$,startTime:Z,expirationTime:ge,sortIndex:-1},Z>X?($.sortIndex=Z,c(g,$),r(x)===null&&$===r(g)&&(m?(S(L),L=-1):m=!0,se(O,Z-X))):($.sortIndex=ge,c(x,$),_||y||(_=!0,U||(U=!0,H()))),$},i.unstable_shouldYield=de,i.unstable_wrapCallback=function($){var P=k;return function(){var Z=k;k=P;try{return $.apply(this,arguments)}finally{k=Z}}}})(Tc)),Tc}var Qh;function m0(){return Qh||(Qh=1,Dc.exports=p0()),Dc.exports}var Mc={exports:{}},Yt={};var Fh;function x0(){if(Fh)return Yt;Fh=1;var i=Jc();function c(x){var g="https://react.dev/errors/"+x;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)g+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+x+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var u={d:{f:r,r:function(){throw Error(c(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},f=Symbol.for("react.portal");function d(x,g,C){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:w==null?null:""+w,children:x,containerInfo:g,implementation:C}}var h=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(x,g){if(x==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,Yt.createPortal=function(x,g){var C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(c(299));return d(x,g,null,C)},Yt.flushSync=function(x){var g=h.T,C=u.p;try{if(h.T=null,u.p=2,x)return x()}finally{h.T=g,u.p=C,u.d.f()}},Yt.preconnect=function(x,g){typeof x=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,u.d.C(x,g))},Yt.prefetchDNS=function(x){typeof x=="string"&&u.d.D(x)},Yt.preinit=function(x,g){if(typeof x=="string"&&g&&typeof g.as=="string"){var C=g.as,w=p(C,g.crossOrigin),k=typeof g.integrity=="string"?g.integrity:void 0,y=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;C==="style"?u.d.S(x,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:w,integrity:k,fetchPriority:y}):C==="script"&&u.d.X(x,{crossOrigin:w,integrity:k,fetchPriority:y,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Yt.preinitModule=function(x,g){if(typeof x=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var C=p(g.as,g.crossOrigin);u.d.M(x,{crossOrigin:C,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&u.d.M(x)},Yt.preload=function(x,g){if(typeof x=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var C=g.as,w=p(C,g.crossOrigin);u.d.L(x,C,{crossOrigin:w,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Yt.preloadModule=function(x,g){if(typeof x=="string")if(g){var C=p(g.as,g.crossOrigin);u.d.m(x,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:C,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else u.d.m(x)},Yt.requestFormReset=function(x){u.d.r(x)},Yt.unstable_batchedUpdates=function(x,g){return x(g)},Yt.useFormState=function(x,g,C){return h.H.useFormState(x,g,C)},Yt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Yt.version="19.2.3",Yt}var Ph;function Cp(){if(Ph)return Mc.exports;Ph=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Mc.exports=x0(),Mc.exports}var Jh;function g0(){if(Jh)return Ni;Jh=1;var i=m0(),c=Jc(),r=Cp();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function f(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(d(e)!==e)throw Error(u(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(u(188));return t!==e?null:e}for(var a=e,n=t;;){var s=a.return;if(s===null)break;var o=s.alternate;if(o===null){if(n=s.return,n!==null){a=n;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===a)return x(s),e;if(o===n)return x(s),t;o=o.sibling}throw Error(u(188))}if(a.return!==n.return)a=s,n=o;else{for(var v=!1,T=s.child;T;){if(T===a){v=!0,a=s,n=o;break}if(T===n){v=!0,n=s,a=o;break}T=T.sibling}if(!v){for(T=o.child;T;){if(T===a){v=!0,a=o,n=s;break}if(T===n){v=!0,n=o,a=s;break}T=T.sibling}if(!v)throw Error(u(189))}}if(a.alternate!==n)throw Error(u(190))}if(a.tag!==3)throw Error(u(188));return a.stateNode.current===a?e:t}function C(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=C(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,k=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),A=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),de=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function H(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var F=Symbol.for("react.client.reference");function z(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===F?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case m:return"Fragment";case j:return"Profiler";case b:return"StrictMode";case O:return"Suspense";case U:return"SuspenseList";case V:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case A:return e.displayName||"Context";case S:return(e._context.displayName||"Context")+".Consumer";case M:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return t=e.displayName||null,t!==null?t:z(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return z(e(t))}catch{}}return null}var se=Array.isArray,$=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},X=[],ge=-1;function R(e){return{current:e}}function D(e){0>ge||(e.current=X[ge],X[ge]=null,ge--)}function W(e,t){ge++,X[ge]=e.current,e.current=t}var te=R(null),Y=R(null),he=R(null),ke=R(null);function Ae(e,t){switch(W(he,t),W(Y,e),W(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hh(t),e=ph(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}D(te),W(te,e)}function Oe(){D(te),D(Y),D(he)}function Ke(e){e.memoizedState!==null&&W(ke,e);var t=te.current,a=ph(t,e.type);t!==a&&(W(Y,e),W(te,a))}function Ie(e){Y.current===e&&(D(te),D(Y)),ke.current===e&&(D(ke),yi._currentValue=Z)}var nt,We;function N(e){if(nt===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);nt=t&&t[1]||"",We=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+nt+e+We}var me=!1;function ne(e,t){if(!e||me)return"";me=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(fe){var oe=fe}Reflect.construct(e,[],Ne)}else{try{Ne.call()}catch(fe){oe=fe}e.call(Ne.prototype)}}else{try{throw Error()}catch(fe){oe=fe}(Ne=e())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(fe){if(fe&&oe&&typeof fe.stack=="string")return[fe.stack,oe.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=n.DetermineComponentFrameRoot(),v=o[0],T=o[1];if(v&&T){var G=v.split(`
4
+ `),ie=T.split(`
5
+ `);for(s=n=0;n<G.length&&!G[n].includes("DetermineComponentFrameRoot");)n++;for(;s<ie.length&&!ie[s].includes("DetermineComponentFrameRoot");)s++;if(n===G.length||s===ie.length)for(n=G.length-1,s=ie.length-1;1<=n&&0<=s&&G[n]!==ie[s];)s--;for(;1<=n&&0<=s;n--,s--)if(G[n]!==ie[s]){if(n!==1||s!==1)do if(n--,s--,0>s||G[n]!==ie[s]){var ye=`
6
+ `+G[n].replace(" at new "," at ");return e.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",e.displayName)),ye}while(1<=n&&0<=s);break}}}finally{me=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?N(a):""}function q(e,t){switch(e.tag){case 26:case 27:case 5:return N(e.type);case 16:return N("Lazy");case 13:return e.child!==t&&t!==null?N("Suspense Fallback"):N("Suspense");case 19:return N("SuspenseList");case 0:case 15:return ne(e.type,!1);case 11:return ne(e.type.render,!1);case 1:return ne(e.type,!0);case 31:return N("Activity");default:return""}}function B(e){try{var t="",a=null;do t+=q(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
7
+ Error generating stack: `+n.message+`
8
+ `+n.stack}}var J=Object.prototype.hasOwnProperty,xe=i.unstable_scheduleCallback,re=i.unstable_cancelCallback,K=i.unstable_shouldYield,ve=i.unstable_requestPaint,_e=i.unstable_now,Se=i.unstable_getCurrentPriorityLevel,ze=i.unstable_ImmediatePriority,Ve=i.unstable_UserBlockingPriority,De=i.unstable_NormalPriority,pt=i.unstable_LowPriority,be=i.unstable_IdlePriority,we=i.log,Re=i.unstable_setDisableYieldValue,Ue=null,Be=null;function qe(e){if(typeof we=="function"&&Re(e),Be&&typeof Be.setStrictMode=="function")try{Be.setStrictMode(Ue,e)}catch{}}var Me=Math.clz32?Math.clz32:pa,Fe=Math.log,rt=Math.LN2;function pa(e){return e>>>=0,e===0?32:31-(Fe(e)/rt|0)|0}var ma=256,va=262144,Qt=4194304;function qt(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function jn(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var s=0,o=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var T=n&134217727;return T!==0?(n=T&~o,n!==0?s=qt(n):(v&=T,v!==0?s=qt(v):a||(a=T&~e,a!==0&&(s=qt(a))))):(T=n&~o,T!==0?s=qt(T):v!==0?s=qt(v):a||(a=n&~e,a!==0&&(s=qt(a)))),s===0?0:t!==0&&t!==s&&(t&o)===0&&(o=s&-s,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:s}function Sn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function gr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Oi(){var e=Qt;return Qt<<=1,(Qt&62914560)===0&&(Qt=4194304),e}function Ol(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Nn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function br(e,t,a,n,s,o){var v=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var T=e.entanglements,G=e.expirationTimes,ie=e.hiddenUpdates;for(a=v&~a;0<a;){var ye=31-Me(a),Ne=1<<ye;T[ye]=0,G[ye]=-1;var oe=ie[ye];if(oe!==null)for(ie[ye]=null,ye=0;ye<oe.length;ye++){var fe=oe[ye];fe!==null&&(fe.lane&=-536870913)}a&=~Ne}n!==0&&Di(e,n,0),o!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=o&~(v&~t))}function Di(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-Me(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function Ti(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-Me(a),s=1<<n;s&t|e[n]&t&&(e[n]|=t),a&=~s}}function Mi(e,t){var a=t&-t;return a=(a&42)!==0?1:Dl(a),(a&(e.suspendedLanes|t))!==0?0:a}function Dl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Tl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Zn(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:Lh(e.type))}function $n(e,t){var a=P.p;try{return P.p=e,t()}finally{P.p=a}}var xa=Math.random().toString(36).slice(2),wt="__reactFiber$"+xa,Rt="__reactProps$"+xa,Ea="__reactContainer$"+xa,Ml="__reactEvents$"+xa,yr="__reactListeners$"+xa,vr="__reactHandles$"+xa,Ui="__reactResources$"+xa,Bt="__reactMarker$"+xa;function Li(e){delete e[wt],delete e[Rt],delete e[Ml],delete e[yr],delete e[vr]}function _n(e){var t=e[wt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Ea]||a[wt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=wh(e);e!==null;){if(a=e[wt])return a;e=wh(e)}return t}e=a,a=e.parentNode}return null}function Cn(e){if(e=e[wt]||e[Ea]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function Qa(e){var t=e[Ui];return t||(t=e[Ui]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Nt(e){e[Bt]=!0}var wr=new Set,Bi={};function ce(e,t){pe(e,t),pe(e+"Capture",t)}function pe(e,t){for(Bi[e]=t,e=0;e<t.length;e++)wr.add(t[e])}var Ce=RegExp("^[: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]*$"),Ee={},at={};function Ht(e){return J.call(at,e)?!0:J.call(Ee,e)?!1:Ce.test(e)?at[e]=!0:(Ee[e]=!0,!1)}function Hi(e,t,a){if(Ht(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Yi(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Aa(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function na(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function lm(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(v){a=""+v,o.call(this,v)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(v){a=""+v},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jr(e){if(!e._valueTracker){var t=lu(e)?"checked":"value";e._valueTracker=lm(e,t,""+e[t])}}function iu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=lu(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function qi(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}}var im=/[\n"\\]/g;function la(e){return e.replace(im,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Sr(e,t,a,n,s,o,v,T){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),t!=null?v==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+na(t)):e.value!==""+na(t)&&(e.value=""+na(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?Nr(e,v,na(t)):a!=null?Nr(e,v,na(a)):n!=null&&e.removeAttribute("value"),s==null&&o!=null&&(e.defaultChecked=!!o),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.name=""+na(T):e.removeAttribute("name")}function su(e,t,a,n,s,o,v,T){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){jr(e);return}a=a!=null?""+na(a):"",t=t!=null?""+na(t):a,T||t===e.value||(e.value=t),e.defaultValue=t}n=n??s,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=T?e.checked:!!n,e.defaultChecked=!!n,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),jr(e)}function Nr(e,t,a){t==="number"&&qi(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Qn(e,t,a,n){if(e=e.options,t){t={};for(var s=0;s<a.length;s++)t["$"+a[s]]=!0;for(a=0;a<e.length;a++)s=t.hasOwnProperty("$"+e[a].value),e[a].selected!==s&&(e[a].selected=s),s&&n&&(e[a].defaultSelected=!0)}else{for(a=""+na(a),t=null,s=0;s<e.length;s++){if(e[s].value===a){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function ru(e,t,a){if(t!=null&&(t=""+na(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+na(a):""}function ou(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(u(92));if(se(n)){if(1<n.length)throw Error(u(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=na(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),jr(e)}function Fn(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var sm=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function cu(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||sm.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function uu(e,t,a){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&a[s]!==n&&cu(e,s,n)}else for(var o in t)t.hasOwnProperty(o)&&cu(e,o,t[o])}function _r(e){if(e.indexOf("-")===-1)return!1;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 rm=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),om=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ki(e){return om.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function za(){}var Cr=null;function kr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pn=null,Jn=null;function du(e){var t=Cn(e);if(t&&(e=t.stateNode)){var a=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Sr(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+la(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var s=n[Rt]||null;if(!s)throw Error(u(90));Sr(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&iu(n)}break e;case"textarea":ru(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Qn(e,!!a.multiple,t,!1)}}}var Er=!1;function fu(e,t,a){if(Er)return e(t,a);Er=!0;try{var n=e(t);return n}finally{if(Er=!1,(Pn!==null||Jn!==null)&&(As(),Pn&&(t=Pn,e=Jn,Jn=Pn=null,du(t),e)))for(t=0;t<e.length;t++)du(e[t])}}function Ul(e,t){var a=e.stateNode;if(a===null)return null;var n=a[Rt]||null;if(n===null)return null;a=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(u(231,t,typeof a));return a}var Ra=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ar=!1;if(Ra)try{var Ll={};Object.defineProperty(Ll,"passive",{get:function(){Ar=!0}}),window.addEventListener("test",Ll,Ll),window.removeEventListener("test",Ll,Ll)}catch{Ar=!1}var Fa=null,zr=null,Ii=null;function hu(){if(Ii)return Ii;var e,t=zr,a=t.length,n,s="value"in Fa?Fa.value:Fa.textContent,o=s.length;for(e=0;e<a&&t[e]===s[e];e++);var v=a-e;for(n=1;n<=v&&t[a-n]===s[o-n];n++);return Ii=s.slice(e,1<n?1-n:void 0)}function Gi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vi(){return!0}function pu(){return!1}function It(e){function t(a,n,s,o,v){this._reactName=a,this._targetInst=s,this.type=n,this.nativeEvent=o,this.target=v,this.currentTarget=null;for(var T in e)e.hasOwnProperty(T)&&(a=e[T],this[T]=a?a(o):o[T]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Vi:pu,this.isPropagationStopped=pu,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Vi)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Vi)},persist:function(){},isPersistent:Vi}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xi=It(En),Bl=w({},En,{view:0,detail:0}),cm=It(Bl),Rr,Or,Hl,Zi=w({},Bl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Hl&&(Hl&&e.type==="mousemove"?(Rr=e.screenX-Hl.screenX,Or=e.screenY-Hl.screenY):Or=Rr=0,Hl=e),Rr)},movementY:function(e){return"movementY"in e?e.movementY:Or}}),mu=It(Zi),um=w({},Zi,{dataTransfer:0}),dm=It(um),fm=w({},Bl,{relatedTarget:0}),Dr=It(fm),hm=w({},En,{animationName:0,elapsedTime:0,pseudoElement:0}),pm=It(hm),mm=w({},En,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xm=It(mm),gm=w({},En,{data:0}),xu=It(gm),bm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ym={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},vm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=vm[e])?!!t[e]:!1}function Tr(){return wm}var jm=w({},Bl,{key:function(e){if(e.key){var t=bm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ym[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tr,charCode:function(e){return e.type==="keypress"?Gi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Sm=It(jm),Nm=w({},Zi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gu=It(Nm),_m=w({},Bl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tr}),Cm=It(_m),km=w({},En,{propertyName:0,elapsedTime:0,pseudoElement:0}),Em=It(km),Am=w({},Zi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),zm=It(Am),Rm=w({},En,{newState:0,oldState:0}),Om=It(Rm),Dm=[9,13,27,32],Mr=Ra&&"CompositionEvent"in window,Yl=null;Ra&&"documentMode"in document&&(Yl=document.documentMode);var Tm=Ra&&"TextEvent"in window&&!Yl,bu=Ra&&(!Mr||Yl&&8<Yl&&11>=Yl),yu=" ",vu=!1;function wu(e,t){switch(e){case"keyup":return Dm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ju(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wn=!1;function Mm(e,t){switch(e){case"compositionend":return ju(t);case"keypress":return t.which!==32?null:(vu=!0,yu);case"textInput":return e=t.data,e===yu&&vu?null:e;default:return null}}function Um(e,t){if(Wn)return e==="compositionend"||!Mr&&wu(e,t)?(e=hu(),Ii=zr=Fa=null,Wn=!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.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return bu&&t.locale!=="ko"?null:t.data;default:return null}}var Lm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Su(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Lm[e.type]:t==="textarea"}function Nu(e,t,a,n){Pn?Jn?Jn.push(n):Jn=[n]:Pn=n,t=Us(t,"onChange"),0<t.length&&(a=new Xi("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var ql=null,Kl=null;function Bm(e){rh(e,0)}function $i(e){var t=kn(e);if(iu(t))return e}function _u(e,t){if(e==="change")return t}var Cu=!1;if(Ra){var Ur;if(Ra){var Lr="oninput"in document;if(!Lr){var ku=document.createElement("div");ku.setAttribute("oninput","return;"),Lr=typeof ku.oninput=="function"}Ur=Lr}else Ur=!1;Cu=Ur&&(!document.documentMode||9<document.documentMode)}function Eu(){ql&&(ql.detachEvent("onpropertychange",Au),Kl=ql=null)}function Au(e){if(e.propertyName==="value"&&$i(Kl)){var t=[];Nu(t,Kl,e,kr(e)),fu(Bm,t)}}function Hm(e,t,a){e==="focusin"?(Eu(),ql=t,Kl=a,ql.attachEvent("onpropertychange",Au)):e==="focusout"&&Eu()}function Ym(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $i(Kl)}function qm(e,t){if(e==="click")return $i(t)}function Km(e,t){if(e==="input"||e==="change")return $i(t)}function Im(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ft=typeof Object.is=="function"?Object.is:Im;function Il(e,t){if(Ft(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var s=a[n];if(!J.call(t,s)||!Ft(e[s],t[s]))return!1}return!0}function zu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ru(e,t){var a=zu(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=zu(a)}}function Ou(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ou(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Du(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qi(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=qi(e.document)}return t}function Br(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")}var Gm=Ra&&"documentMode"in document&&11>=document.documentMode,el=null,Hr=null,Gl=null,Yr=!1;function Tu(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Yr||el==null||el!==qi(n)||(n=el,"selectionStart"in n&&Br(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Gl&&Il(Gl,n)||(Gl=n,n=Us(Hr,"onSelect"),0<n.length&&(t=new Xi("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=el)))}function An(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var tl={animationend:An("Animation","AnimationEnd"),animationiteration:An("Animation","AnimationIteration"),animationstart:An("Animation","AnimationStart"),transitionrun:An("Transition","TransitionRun"),transitionstart:An("Transition","TransitionStart"),transitioncancel:An("Transition","TransitionCancel"),transitionend:An("Transition","TransitionEnd")},qr={},Mu={};Ra&&(Mu=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function zn(e){if(qr[e])return qr[e];if(!tl[e])return e;var t=tl[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Mu)return qr[e]=t[a];return e}var Uu=zn("animationend"),Lu=zn("animationiteration"),Bu=zn("animationstart"),Vm=zn("transitionrun"),Xm=zn("transitionstart"),Zm=zn("transitioncancel"),Hu=zn("transitionend"),Yu=new Map,Kr="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Kr.push("scrollEnd");function ga(e,t){Yu.set(e,t),ce(t,[e])}var Qi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ia=[],al=0,Ir=0;function Fi(){for(var e=al,t=Ir=al=0;t<e;){var a=ia[t];ia[t++]=null;var n=ia[t];ia[t++]=null;var s=ia[t];ia[t++]=null;var o=ia[t];if(ia[t++]=null,n!==null&&s!==null){var v=n.pending;v===null?s.next=s:(s.next=v.next,v.next=s),n.pending=s}o!==0&&qu(a,s,o)}}function Pi(e,t,a,n){ia[al++]=e,ia[al++]=t,ia[al++]=a,ia[al++]=n,Ir|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function Gr(e,t,a,n){return Pi(e,t,a,n),Ji(e)}function Rn(e,t){return Pi(e,null,null,t),Ji(e)}function qu(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var s=!1,o=e.return;o!==null;)o.childLanes|=a,n=o.alternate,n!==null&&(n.childLanes|=a),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(s=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,s&&t!==null&&(s=31-Me(a),e=o.hiddenUpdates,n=e[s],n===null?e[s]=[t]:n.push(t),t.lane=a|536870912),o):null}function Ji(e){if(50<fi)throw fi=0,ec=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var nl={};function $m(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,a,n){return new $m(e,t,a,n)}function Vr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oa(e,t){var a=e.alternate;return a===null?(a=Pt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Ku(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Wi(e,t,a,n,s,o){var v=0;if(n=e,typeof e=="function")Vr(e)&&(v=1);else if(typeof e=="string")v=Wx(e,a,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case V:return e=Pt(31,a,t,s),e.elementType=V,e.lanes=o,e;case m:return On(a.children,s,o,t);case b:v=8,s|=24;break;case j:return e=Pt(12,a,t,s|2),e.elementType=j,e.lanes=o,e;case O:return e=Pt(13,a,t,s),e.elementType=O,e.lanes=o,e;case U:return e=Pt(19,a,t,s),e.elementType=U,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:v=10;break e;case S:v=9;break e;case M:v=11;break e;case L:v=14;break e;case I:v=16,n=null;break e}v=29,a=Error(u(130,e===null?"null":typeof e,"")),n=null}return t=Pt(v,a,t,s),t.elementType=e,t.type=n,t.lanes=o,t}function On(e,t,a,n){return e=Pt(7,e,n,t),e.lanes=a,e}function Xr(e,t,a){return e=Pt(6,e,null,t),e.lanes=a,e}function Iu(e){var t=Pt(18,null,null,0);return t.stateNode=e,t}function Zr(e,t,a){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Gu=new WeakMap;function sa(e,t){if(typeof e=="object"&&e!==null){var a=Gu.get(e);return a!==void 0?a:(t={value:e,source:t,stack:B(t)},Gu.set(e,t),t)}return{value:e,source:t,stack:B(t)}}var ll=[],il=0,es=null,Vl=0,ra=[],oa=0,Pa=null,wa=1,ja="";function Da(e,t){ll[il++]=Vl,ll[il++]=es,es=e,Vl=t}function Vu(e,t,a){ra[oa++]=wa,ra[oa++]=ja,ra[oa++]=Pa,Pa=e;var n=wa;e=ja;var s=32-Me(n)-1;n&=~(1<<s),a+=1;var o=32-Me(t)+s;if(30<o){var v=s-s%5;o=(n&(1<<v)-1).toString(32),n>>=v,s-=v,wa=1<<32-Me(t)+s|a<<s|n,ja=o+e}else wa=1<<o|a<<s|n,ja=e}function $r(e){e.return!==null&&(Da(e,1),Vu(e,1,0))}function Qr(e){for(;e===es;)es=ll[--il],ll[il]=null,Vl=ll[--il],ll[il]=null;for(;e===Pa;)Pa=ra[--oa],ra[oa]=null,ja=ra[--oa],ra[oa]=null,wa=ra[--oa],ra[oa]=null}function Xu(e,t){ra[oa++]=wa,ra[oa++]=ja,ra[oa++]=Pa,wa=t.id,ja=t.overflow,Pa=e}var Dt=null,mt=null,et=!1,Ja=null,ca=!1,Fr=Error(u(519));function Wa(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xl(sa(t,e)),Fr}function Zu(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[wt]=e,t[Rt]=n,a){case"dialog":Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":case"embed":Qe("load",t);break;case"video":case"audio":for(a=0;a<pi.length;a++)Qe(pi[a],t);break;case"source":Qe("error",t);break;case"img":case"image":case"link":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"input":Qe("invalid",t),su(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":Qe("invalid",t);break;case"textarea":Qe("invalid",t),ou(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||dh(t.textContent,a)?(n.popover!=null&&(Qe("beforetoggle",t),Qe("toggle",t)),n.onScroll!=null&&Qe("scroll",t),n.onScrollEnd!=null&&Qe("scrollend",t),n.onClick!=null&&(t.onclick=za),t=!0):t=!1,t||Wa(e,!0)}function $u(e){for(Dt=e.return;Dt;)switch(Dt.tag){case 5:case 31:case 13:ca=!1;return;case 27:case 3:ca=!0;return;default:Dt=Dt.return}}function sl(e){if(e!==Dt)return!1;if(!et)return $u(e),et=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||mc(e.type,e.memoizedProps)),a=!a),a&&mt&&Wa(e),$u(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));mt=vh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));mt=vh(e)}else t===27?(t=mt,pn(e.type)?(e=vc,vc=null,mt=e):mt=t):mt=Dt?da(e.stateNode.nextSibling):null;return!0}function Dn(){mt=Dt=null,et=!1}function Pr(){var e=Ja;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Ja=null),e}function Xl(e){Ja===null?Ja=[e]:Ja.push(e)}var Jr=R(null),Tn=null,Ta=null;function en(e,t,a){W(Jr,t._currentValue),t._currentValue=a}function Ma(e){e._currentValue=Jr.current,D(Jr)}function Wr(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function eo(e,t,a,n){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){var v=s.child;o=o.firstContext;e:for(;o!==null;){var T=o;o=s;for(var G=0;G<t.length;G++)if(T.context===t[G]){o.lanes|=a,T=o.alternate,T!==null&&(T.lanes|=a),Wr(o.return,a,e),n||(v=null);break e}o=T.next}}else if(s.tag===18){if(v=s.return,v===null)throw Error(u(341));v.lanes|=a,o=v.alternate,o!==null&&(o.lanes|=a),Wr(v,a,e),v=null}else v=s.child;if(v!==null)v.return=s;else for(v=s;v!==null;){if(v===e){v=null;break}if(s=v.sibling,s!==null){s.return=v.return,v=s;break}v=v.return}s=v}}function rl(e,t,a,n){e=null;for(var s=t,o=!1;s!==null;){if(!o){if((s.flags&524288)!==0)o=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var v=s.alternate;if(v===null)throw Error(u(387));if(v=v.memoizedProps,v!==null){var T=s.type;Ft(s.pendingProps.value,v.value)||(e!==null?e.push(T):e=[T])}}else if(s===ke.current){if(v=s.alternate,v===null)throw Error(u(387));v.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(yi):e=[yi])}s=s.return}e!==null&&eo(t,e,a,n),t.flags|=262144}function ts(e){for(e=e.firstContext;e!==null;){if(!Ft(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Mn(e){Tn=e,Ta=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return Qu(Tn,e)}function as(e,t){return Tn===null&&Mn(e),Qu(e,t)}function Qu(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Ta===null){if(e===null)throw Error(u(308));Ta=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ta=Ta.next=t;return a}var Qm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},Fm=i.unstable_scheduleCallback,Pm=i.unstable_NormalPriority,_t={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function to(){return{controller:new Qm,data:new Map,refCount:0}}function Zl(e){e.refCount--,e.refCount===0&&Fm(Pm,function(){e.controller.abort()})}var $l=null,ao=0,ol=0,cl=null;function Jm(e,t){if($l===null){var a=$l=[];ao=0,ol=sc(),cl={status:"pending",value:void 0,then:function(n){a.push(n)}}}return ao++,t.then(Fu,Fu),t}function Fu(){if(--ao===0&&$l!==null){cl!==null&&(cl.status="fulfilled");var e=$l;$l=null,ol=0,cl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Wm(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(s){a.push(s)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<a.length;s++)(0,a[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<a.length;s++)(0,a[s])(void 0)}),n}var Pu=$.S;$.S=function(e,t){Mf=_e(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Jm(e,t),Pu!==null&&Pu(e,t)};var Un=R(null);function no(){var e=Un.current;return e!==null?e:ht.pooledCache}function ns(e,t){t===null?W(Un,Un.current):W(Un,t.pool)}function Ju(){var e=no();return e===null?null:{parent:_t._currentValue,pool:e}}var ul=Error(u(460)),lo=Error(u(474)),ls=Error(u(542)),is={then:function(){}};function Wu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ed(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(za,za),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ad(e),e;default:if(typeof t.status=="string")t.then(za,za);else{if(e=ht,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ad(e),e}throw Bn=t,ul}}function Ln(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Bn=a,ul):a}}var Bn=null;function td(){if(Bn===null)throw Error(u(459));var e=Bn;return Bn=null,e}function ad(e){if(e===ul||e===ls)throw Error(u(483))}var dl=null,Ql=0;function ss(e){var t=Ql;return Ql+=1,dl===null&&(dl=[]),ed(dl,e,t)}function Fl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function rs(e,t){throw t.$$typeof===k?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function nd(e){function t(ee,Q){if(e){var le=ee.deletions;le===null?(ee.deletions=[Q],ee.flags|=16):le.push(Q)}}function a(ee,Q){if(!e)return null;for(;Q!==null;)t(ee,Q),Q=Q.sibling;return null}function n(ee){for(var Q=new Map;ee!==null;)ee.key!==null?Q.set(ee.key,ee):Q.set(ee.index,ee),ee=ee.sibling;return Q}function s(ee,Q){return ee=Oa(ee,Q),ee.index=0,ee.sibling=null,ee}function o(ee,Q,le){return ee.index=le,e?(le=ee.alternate,le!==null?(le=le.index,le<Q?(ee.flags|=67108866,Q):le):(ee.flags|=67108866,Q)):(ee.flags|=1048576,Q)}function v(ee){return e&&ee.alternate===null&&(ee.flags|=67108866),ee}function T(ee,Q,le,je){return Q===null||Q.tag!==6?(Q=Xr(le,ee.mode,je),Q.return=ee,Q):(Q=s(Q,le),Q.return=ee,Q)}function G(ee,Q,le,je){var He=le.type;return He===m?ye(ee,Q,le.props.children,je,le.key):Q!==null&&(Q.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===I&&Ln(He)===Q.type)?(Q=s(Q,le.props),Fl(Q,le),Q.return=ee,Q):(Q=Wi(le.type,le.key,le.props,null,ee.mode,je),Fl(Q,le),Q.return=ee,Q)}function ie(ee,Q,le,je){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==le.containerInfo||Q.stateNode.implementation!==le.implementation?(Q=Zr(le,ee.mode,je),Q.return=ee,Q):(Q=s(Q,le.children||[]),Q.return=ee,Q)}function ye(ee,Q,le,je,He){return Q===null||Q.tag!==7?(Q=On(le,ee.mode,je,He),Q.return=ee,Q):(Q=s(Q,le),Q.return=ee,Q)}function Ne(ee,Q,le){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Xr(""+Q,ee.mode,le),Q.return=ee,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return le=Wi(Q.type,Q.key,Q.props,null,ee.mode,le),Fl(le,Q),le.return=ee,le;case _:return Q=Zr(Q,ee.mode,le),Q.return=ee,Q;case I:return Q=Ln(Q),Ne(ee,Q,le)}if(se(Q)||H(Q))return Q=On(Q,ee.mode,le,null),Q.return=ee,Q;if(typeof Q.then=="function")return Ne(ee,ss(Q),le);if(Q.$$typeof===A)return Ne(ee,as(ee,Q),le);rs(ee,Q)}return null}function oe(ee,Q,le,je){var He=Q!==null?Q.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return He!==null?null:T(ee,Q,""+le,je);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return le.key===He?G(ee,Q,le,je):null;case _:return le.key===He?ie(ee,Q,le,je):null;case I:return le=Ln(le),oe(ee,Q,le,je)}if(se(le)||H(le))return He!==null?null:ye(ee,Q,le,je,null);if(typeof le.then=="function")return oe(ee,Q,ss(le),je);if(le.$$typeof===A)return oe(ee,Q,as(ee,le),je);rs(ee,le)}return null}function fe(ee,Q,le,je,He){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return ee=ee.get(le)||null,T(Q,ee,""+je,He);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case y:return ee=ee.get(je.key===null?le:je.key)||null,G(Q,ee,je,He);case _:return ee=ee.get(je.key===null?le:je.key)||null,ie(Q,ee,je,He);case I:return je=Ln(je),fe(ee,Q,le,je,He)}if(se(je)||H(je))return ee=ee.get(le)||null,ye(Q,ee,je,He,null);if(typeof je.then=="function")return fe(ee,Q,le,ss(je),He);if(je.$$typeof===A)return fe(ee,Q,le,as(Q,je),He);rs(Q,je)}return null}function Te(ee,Q,le,je){for(var He=null,lt=null,Le=Q,Ze=Q=0,Je=null;Le!==null&&Ze<le.length;Ze++){Le.index>Ze?(Je=Le,Le=null):Je=Le.sibling;var it=oe(ee,Le,le[Ze],je);if(it===null){Le===null&&(Le=Je);break}e&&Le&&it.alternate===null&&t(ee,Le),Q=o(it,Q,Ze),lt===null?He=it:lt.sibling=it,lt=it,Le=Je}if(Ze===le.length)return a(ee,Le),et&&Da(ee,Ze),He;if(Le===null){for(;Ze<le.length;Ze++)Le=Ne(ee,le[Ze],je),Le!==null&&(Q=o(Le,Q,Ze),lt===null?He=Le:lt.sibling=Le,lt=Le);return et&&Da(ee,Ze),He}for(Le=n(Le);Ze<le.length;Ze++)Je=fe(Le,ee,Ze,le[Ze],je),Je!==null&&(e&&Je.alternate!==null&&Le.delete(Je.key===null?Ze:Je.key),Q=o(Je,Q,Ze),lt===null?He=Je:lt.sibling=Je,lt=Je);return e&&Le.forEach(function(yn){return t(ee,yn)}),et&&Da(ee,Ze),He}function Ye(ee,Q,le,je){if(le==null)throw Error(u(151));for(var He=null,lt=null,Le=Q,Ze=Q=0,Je=null,it=le.next();Le!==null&&!it.done;Ze++,it=le.next()){Le.index>Ze?(Je=Le,Le=null):Je=Le.sibling;var yn=oe(ee,Le,it.value,je);if(yn===null){Le===null&&(Le=Je);break}e&&Le&&yn.alternate===null&&t(ee,Le),Q=o(yn,Q,Ze),lt===null?He=yn:lt.sibling=yn,lt=yn,Le=Je}if(it.done)return a(ee,Le),et&&Da(ee,Ze),He;if(Le===null){for(;!it.done;Ze++,it=le.next())it=Ne(ee,it.value,je),it!==null&&(Q=o(it,Q,Ze),lt===null?He=it:lt.sibling=it,lt=it);return et&&Da(ee,Ze),He}for(Le=n(Le);!it.done;Ze++,it=le.next())it=fe(Le,ee,Ze,it.value,je),it!==null&&(e&&it.alternate!==null&&Le.delete(it.key===null?Ze:it.key),Q=o(it,Q,Ze),lt===null?He=it:lt.sibling=it,lt=it);return e&&Le.forEach(function(u0){return t(ee,u0)}),et&&Da(ee,Ze),He}function ft(ee,Q,le,je){if(typeof le=="object"&&le!==null&&le.type===m&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case y:e:{for(var He=le.key;Q!==null;){if(Q.key===He){if(He=le.type,He===m){if(Q.tag===7){a(ee,Q.sibling),je=s(Q,le.props.children),je.return=ee,ee=je;break e}}else if(Q.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===I&&Ln(He)===Q.type){a(ee,Q.sibling),je=s(Q,le.props),Fl(je,le),je.return=ee,ee=je;break e}a(ee,Q);break}else t(ee,Q);Q=Q.sibling}le.type===m?(je=On(le.props.children,ee.mode,je,le.key),je.return=ee,ee=je):(je=Wi(le.type,le.key,le.props,null,ee.mode,je),Fl(je,le),je.return=ee,ee=je)}return v(ee);case _:e:{for(He=le.key;Q!==null;){if(Q.key===He)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){a(ee,Q.sibling),je=s(Q,le.children||[]),je.return=ee,ee=je;break e}else{a(ee,Q);break}else t(ee,Q);Q=Q.sibling}je=Zr(le,ee.mode,je),je.return=ee,ee=je}return v(ee);case I:return le=Ln(le),ft(ee,Q,le,je)}if(se(le))return Te(ee,Q,le,je);if(H(le)){if(He=H(le),typeof He!="function")throw Error(u(150));return le=He.call(le),Ye(ee,Q,le,je)}if(typeof le.then=="function")return ft(ee,Q,ss(le),je);if(le.$$typeof===A)return ft(ee,Q,as(ee,le),je);rs(ee,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,Q!==null&&Q.tag===6?(a(ee,Q.sibling),je=s(Q,le),je.return=ee,ee=je):(a(ee,Q),je=Xr(le,ee.mode,je),je.return=ee,ee=je),v(ee)):a(ee,Q)}return function(ee,Q,le,je){try{Ql=0;var He=ft(ee,Q,le,je);return dl=null,He}catch(Le){if(Le===ul||Le===ls)throw Le;var lt=Pt(29,Le,null,ee.mode);return lt.lanes=je,lt.return=ee,lt}}}var Hn=nd(!0),ld=nd(!1),tn=!1;function io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function so(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function an(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function nn(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(st&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=Ji(e),qu(e,null,a),t}return Pi(e,n,t,a),Ji(e)}function Pl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Ti(e,a)}}function ro(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var s=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?s=o=v:o=o.next=v,a=a.next}while(a!==null);o===null?s=o=t:o=o.next=t}else s=o=t;a={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var oo=!1;function Jl(){if(oo){var e=cl;if(e!==null)throw e}}function Wl(e,t,a,n){oo=!1;var s=e.updateQueue;tn=!1;var o=s.firstBaseUpdate,v=s.lastBaseUpdate,T=s.shared.pending;if(T!==null){s.shared.pending=null;var G=T,ie=G.next;G.next=null,v===null?o=ie:v.next=ie,v=G;var ye=e.alternate;ye!==null&&(ye=ye.updateQueue,T=ye.lastBaseUpdate,T!==v&&(T===null?ye.firstBaseUpdate=ie:T.next=ie,ye.lastBaseUpdate=G))}if(o!==null){var Ne=s.baseState;v=0,ye=ie=G=null,T=o;do{var oe=T.lane&-536870913,fe=oe!==T.lane;if(fe?(Pe&oe)===oe:(n&oe)===oe){oe!==0&&oe===ol&&(oo=!0),ye!==null&&(ye=ye.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Te=e,Ye=T;oe=t;var ft=a;switch(Ye.tag){case 1:if(Te=Ye.payload,typeof Te=="function"){Ne=Te.call(ft,Ne,oe);break e}Ne=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ye.payload,oe=typeof Te=="function"?Te.call(ft,Ne,oe):Te,oe==null)break e;Ne=w({},Ne,oe);break e;case 2:tn=!0}}oe=T.callback,oe!==null&&(e.flags|=64,fe&&(e.flags|=8192),fe=s.callbacks,fe===null?s.callbacks=[oe]:fe.push(oe))}else fe={lane:oe,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ye===null?(ie=ye=fe,G=Ne):ye=ye.next=fe,v|=oe;if(T=T.next,T===null){if(T=s.shared.pending,T===null)break;fe=T,T=fe.next,fe.next=null,s.lastBaseUpdate=fe,s.shared.pending=null}}while(!0);ye===null&&(G=Ne),s.baseState=G,s.firstBaseUpdate=ie,s.lastBaseUpdate=ye,o===null&&(s.shared.lanes=0),cn|=v,e.lanes=v,e.memoizedState=Ne}}function id(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function sd(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)id(a[e],t)}var fl=R(null),os=R(0);function rd(e,t){e=Ga,W(os,e),W(fl,t),Ga=e|t.baseLanes}function co(){W(os,Ga),W(fl,fl.current)}function uo(){Ga=os.current,D(fl),D(os)}var Jt=R(null),ua=null;function ln(e){var t=e.alternate;W(jt,jt.current&1),W(Jt,e),ua===null&&(t===null||fl.current!==null||t.memoizedState!==null)&&(ua=e)}function fo(e){W(jt,jt.current),W(Jt,e),ua===null&&(ua=e)}function od(e){e.tag===22?(W(jt,jt.current),W(Jt,e),ua===null&&(ua=e)):sn()}function sn(){W(jt,jt.current),W(Jt,Jt.current)}function Wt(e){D(Jt),ua===e&&(ua=null),D(jt)}var jt=R(0);function cs(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||bc(a)||yc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ua=0,Xe=null,ut=null,Ct=null,us=!1,hl=!1,Yn=!1,ds=0,ei=0,pl=null,ex=0;function yt(){throw Error(u(321))}function ho(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Ft(e[a],t[a]))return!1;return!0}function po(e,t,a,n,s,o){return Ua=o,Xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?Vd:Ao,Yn=!1,o=a(n,s),Yn=!1,hl&&(o=ud(t,a,n,s)),cd(e),o}function cd(e){$.H=ni;var t=ut!==null&&ut.next!==null;if(Ua=0,Ct=ut=Xe=null,us=!1,ei=0,pl=null,t)throw Error(u(300));e===null||kt||(e=e.dependencies,e!==null&&ts(e)&&(kt=!0))}function ud(e,t,a,n){Xe=e;var s=0;do{if(hl&&(pl=null),ei=0,hl=!1,25<=s)throw Error(u(301));if(s+=1,Ct=ut=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}$.H=Xd,o=t(a,n)}while(hl);return o}function tx(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ti(t):t,e=e.useState()[0],(ut!==null?ut.memoizedState:null)!==e&&(Xe.flags|=1024),t}function mo(){var e=ds!==0;return ds=0,e}function xo(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function go(e){if(us){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}us=!1}Ua=0,Ct=ut=Xe=null,hl=!1,ei=ds=0,pl=null}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?Xe.memoizedState=Ct=e:Ct=Ct.next=e,Ct}function St(){if(ut===null){var e=Xe.alternate;e=e!==null?e.memoizedState:null}else e=ut.next;var t=Ct===null?Xe.memoizedState:Ct.next;if(t!==null)Ct=t,ut=e;else{if(e===null)throw Xe.alternate===null?Error(u(467)):Error(u(310));ut=e,e={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Ct===null?Xe.memoizedState=Ct=e:Ct=Ct.next=e}return Ct}function fs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ti(e){var t=ei;return ei+=1,pl===null&&(pl=[]),e=ed(pl,e,t),t=Xe,(Ct===null?t.memoizedState:Ct.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?Vd:Ao),e}function hs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ti(e);if(e.$$typeof===A)return Tt(e)}throw Error(u(438,String(e)))}function bo(e){var t=null,a=Xe.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=Xe.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=fs(),Xe.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=de;return t.index++,a}function La(e,t){return typeof t=="function"?t(e):t}function ps(e){var t=St();return yo(t,ut,e)}function yo(e,t,a){var n=e.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=a;var s=e.baseQueue,o=n.pending;if(o!==null){if(s!==null){var v=s.next;s.next=o.next,o.next=v}t.baseQueue=s=o,n.pending=null}if(o=e.baseState,s===null)e.memoizedState=o;else{t=s.next;var T=v=null,G=null,ie=t,ye=!1;do{var Ne=ie.lane&-536870913;if(Ne!==ie.lane?(Pe&Ne)===Ne:(Ua&Ne)===Ne){var oe=ie.revertLane;if(oe===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),Ne===ol&&(ye=!0);else if((Ua&oe)===oe){ie=ie.next,oe===ol&&(ye=!0);continue}else Ne={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},G===null?(T=G=Ne,v=o):G=G.next=Ne,Xe.lanes|=oe,cn|=oe;Ne=ie.action,Yn&&a(o,Ne),o=ie.hasEagerState?ie.eagerState:a(o,Ne)}else oe={lane:Ne,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},G===null?(T=G=oe,v=o):G=G.next=oe,Xe.lanes|=Ne,cn|=Ne;ie=ie.next}while(ie!==null&&ie!==t);if(G===null?v=o:G.next=T,!Ft(o,e.memoizedState)&&(kt=!0,ye&&(a=cl,a!==null)))throw a;e.memoizedState=o,e.baseState=v,e.baseQueue=G,n.lastRenderedState=o}return s===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function vo(e){var t=St(),a=t.queue;if(a===null)throw Error(u(311));a.lastRenderedReducer=e;var n=a.dispatch,s=a.pending,o=t.memoizedState;if(s!==null){a.pending=null;var v=s=s.next;do o=e(o,v.action),v=v.next;while(v!==s);Ft(o,t.memoizedState)||(kt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),a.lastRenderedState=o}return[o,n]}function dd(e,t,a){var n=Xe,s=St(),o=et;if(o){if(a===void 0)throw Error(u(407));a=a()}else a=t();var v=!Ft((ut||s).memoizedState,a);if(v&&(s.memoizedState=a,kt=!0),s=s.queue,So(pd.bind(null,n,s,e),[e]),s.getSnapshot!==t||v||Ct!==null&&Ct.memoizedState.tag&1){if(n.flags|=2048,ml(9,{destroy:void 0},hd.bind(null,n,s,a,t),null),ht===null)throw Error(u(349));o||(Ua&127)!==0||fd(n,t,a)}return a}function fd(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Xe.updateQueue,t===null?(t=fs(),Xe.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function hd(e,t,a,n){t.value=a,t.getSnapshot=n,md(t)&&xd(e)}function pd(e,t,a){return a(function(){md(t)&&xd(e)})}function md(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Ft(e,a)}catch{return!0}}function xd(e){var t=Rn(e,2);t!==null&&$t(t,e,2)}function wo(e){var t=Kt();if(typeof e=="function"){var a=e;if(e=a(),Yn){qe(!0);try{a()}finally{qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:e},t}function gd(e,t,a,n){return e.baseState=a,yo(e,ut,typeof n=="function"?n:La)}function ax(e,t,a,n,s){if(gs(e))throw Error(u(485));if(e=t.action,e!==null){var o={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){o.listeners.push(v)}};$.T!==null?a(!0):o.isTransition=!1,n(o),a=t.pending,a===null?(o.next=t.pending=o,bd(t,o)):(o.next=a.next,t.pending=a.next=o)}}function bd(e,t){var a=t.action,n=t.payload,s=e.state;if(t.isTransition){var o=$.T,v={};$.T=v;try{var T=a(s,n),G=$.S;G!==null&&G(v,T),yd(e,t,T)}catch(ie){jo(e,t,ie)}finally{o!==null&&v.types!==null&&(o.types=v.types),$.T=o}}else try{o=a(s,n),yd(e,t,o)}catch(ie){jo(e,t,ie)}}function yd(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){vd(e,t,n)},function(n){return jo(e,t,n)}):vd(e,t,a)}function vd(e,t,a){t.status="fulfilled",t.value=a,wd(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,bd(e,a)))}function jo(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,wd(t),t=t.next;while(t!==n)}e.action=null}function wd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jd(e,t){return t}function Sd(e,t){if(et){var a=ht.formState;if(a!==null){e:{var n=Xe;if(et){if(mt){t:{for(var s=mt,o=ca;s.nodeType!==8;){if(!o){s=null;break t}if(s=da(s.nextSibling),s===null){s=null;break t}}o=s.data,s=o==="F!"||o==="F"?s:null}if(s){mt=da(s.nextSibling),n=s.data==="F!";break e}}Wa(n)}n=!1}n&&(t=a[0])}}return a=Kt(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:t},a.queue=n,a=Kd.bind(null,Xe,n),n.dispatch=a,n=wo(!1),o=Eo.bind(null,Xe,!1,n.queue),n=Kt(),s={state:t,dispatch:null,action:e,pending:null},n.queue=s,a=ax.bind(null,Xe,s,o,a),s.dispatch=a,n.memoizedState=e,[t,a,!1]}function Nd(e){var t=St();return _d(t,ut,e)}function _d(e,t,a){if(t=yo(e,t,jd)[0],e=ps(La)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=ti(t)}catch(v){throw v===ul?ls:v}else n=t;t=St();var s=t.queue,o=s.dispatch;return a!==t.memoizedState&&(Xe.flags|=2048,ml(9,{destroy:void 0},nx.bind(null,s,a),null)),[n,o,e]}function nx(e,t){e.action=t}function Cd(e){var t=St(),a=ut;if(a!==null)return _d(t,a,e);St(),t=t.memoizedState,a=St();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function ml(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=Xe.updateQueue,t===null&&(t=fs(),Xe.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function kd(){return St().memoizedState}function ms(e,t,a,n){var s=Kt();Xe.flags|=e,s.memoizedState=ml(1|t,{destroy:void 0},a,n===void 0?null:n)}function xs(e,t,a,n){var s=St();n=n===void 0?null:n;var o=s.memoizedState.inst;ut!==null&&n!==null&&ho(n,ut.memoizedState.deps)?s.memoizedState=ml(t,o,a,n):(Xe.flags|=e,s.memoizedState=ml(1|t,o,a,n))}function Ed(e,t){ms(8390656,8,e,t)}function So(e,t){xs(2048,8,e,t)}function lx(e){Xe.flags|=4;var t=Xe.updateQueue;if(t===null)t=fs(),Xe.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Ad(e){var t=St().memoizedState;return lx({ref:t,nextImpl:e}),function(){if((st&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function zd(e,t){return xs(4,2,e,t)}function Rd(e,t){return xs(4,4,e,t)}function Od(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Dd(e,t,a){a=a!=null?a.concat([e]):null,xs(4,4,Od.bind(null,t,e),a)}function No(){}function Td(e,t){var a=St();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&ho(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function Md(e,t){var a=St();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&ho(t,n[1]))return n[0];if(n=e(),Yn){qe(!0);try{e()}finally{qe(!1)}}return a.memoizedState=[n,t],n}function _o(e,t,a){return a===void 0||(Ua&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Lf(),Xe.lanes|=e,cn|=e,a)}function Ud(e,t,a,n){return Ft(a,t)?a:fl.current!==null?(e=_o(e,a,n),Ft(e,t)||(kt=!0),e):(Ua&42)===0||(Ua&1073741824)!==0&&(Pe&261930)===0?(kt=!0,e.memoizedState=a):(e=Lf(),Xe.lanes|=e,cn|=e,t)}function Ld(e,t,a,n,s){var o=P.p;P.p=o!==0&&8>o?o:8;var v=$.T,T={};$.T=T,Eo(e,!1,t,a);try{var G=s(),ie=$.S;if(ie!==null&&ie(T,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var ye=Wm(G,n);ai(e,t,ye,aa(e))}else ai(e,t,n,aa(e))}catch(Ne){ai(e,t,{then:function(){},status:"rejected",reason:Ne},aa())}finally{P.p=o,v!==null&&T.types!==null&&(v.types=T.types),$.T=v}}function ix(){}function Co(e,t,a,n){if(e.tag!==5)throw Error(u(476));var s=Bd(e).queue;Ld(e,s,t,Z,a===null?ix:function(){return Hd(e),a(n)})}function Bd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:Z},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Hd(e){var t=Bd(e);t.next===null&&(t=e.alternate.memoizedState),ai(e,t.next.queue,{},aa())}function ko(){return Tt(yi)}function Yd(){return St().memoizedState}function qd(){return St().memoizedState}function sx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=aa();e=an(a);var n=nn(t,e,a);n!==null&&($t(n,t,a),Pl(n,t,a)),t={cache:to()},e.payload=t;return}t=t.return}}function rx(e,t,a){var n=aa();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},gs(e)?Id(t,a):(a=Gr(e,t,a,n),a!==null&&($t(a,e,n),Gd(a,t,n)))}function Kd(e,t,a){var n=aa();ai(e,t,a,n)}function ai(e,t,a,n){var s={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(gs(e))Id(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var v=t.lastRenderedState,T=o(v,a);if(s.hasEagerState=!0,s.eagerState=T,Ft(T,v))return Pi(e,t,s,0),ht===null&&Fi(),!1}catch{}if(a=Gr(e,t,s,n),a!==null)return $t(a,e,n),Gd(a,t,n),!0}return!1}function Eo(e,t,a,n){if(n={lane:2,revertLane:sc(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},gs(e)){if(t)throw Error(u(479))}else t=Gr(e,a,n,2),t!==null&&$t(t,e,2)}function gs(e){var t=e.alternate;return e===Xe||t!==null&&t===Xe}function Id(e,t){hl=us=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Gd(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Ti(e,a)}}var ni={readContext:Tt,use:hs,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};ni.useEffectEvent=yt;var Vd={readContext:Tt,use:hs,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:Ed,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,ms(4194308,4,Od.bind(null,t,e),a)},useLayoutEffect:function(e,t){return ms(4194308,4,e,t)},useInsertionEffect:function(e,t){ms(4,2,e,t)},useMemo:function(e,t){var a=Kt();t=t===void 0?null:t;var n=e();if(Yn){qe(!0);try{e()}finally{qe(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=Kt();if(a!==void 0){var s=a(t);if(Yn){qe(!0);try{a(t)}finally{qe(!1)}}}else s=t;return n.memoizedState=n.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},n.queue=e,e=e.dispatch=rx.bind(null,Xe,e),[n.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:function(e){e=wo(e);var t=e.queue,a=Kd.bind(null,Xe,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:No,useDeferredValue:function(e,t){var a=Kt();return _o(a,e,t)},useTransition:function(){var e=wo(!1);return e=Ld.bind(null,Xe,e.queue,!0,!1),Kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Xe,s=Kt();if(et){if(a===void 0)throw Error(u(407));a=a()}else{if(a=t(),ht===null)throw Error(u(349));(Pe&127)!==0||fd(n,t,a)}s.memoizedState=a;var o={value:a,getSnapshot:t};return s.queue=o,Ed(pd.bind(null,n,o,e),[e]),n.flags|=2048,ml(9,{destroy:void 0},hd.bind(null,n,o,a,t),null),a},useId:function(){var e=Kt(),t=ht.identifierPrefix;if(et){var a=ja,n=wa;a=(n&~(1<<32-Me(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ds++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=ex++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ko,useFormState:Sd,useActionState:Sd,useOptimistic:function(e){var t=Kt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Eo.bind(null,Xe,!0,a),a.dispatch=t,[e,t]},useMemoCache:bo,useCacheRefresh:function(){return Kt().memoizedState=sx.bind(null,Xe)},useEffectEvent:function(e){var t=Kt(),a={impl:e};return t.memoizedState=a,function(){if((st&2)!==0)throw Error(u(440));return a.impl.apply(void 0,arguments)}}},Ao={readContext:Tt,use:hs,useCallback:Td,useContext:Tt,useEffect:So,useImperativeHandle:Dd,useInsertionEffect:zd,useLayoutEffect:Rd,useMemo:Md,useReducer:ps,useRef:kd,useState:function(){return ps(La)},useDebugValue:No,useDeferredValue:function(e,t){var a=St();return Ud(a,ut.memoizedState,e,t)},useTransition:function(){var e=ps(La)[0],t=St().memoizedState;return[typeof e=="boolean"?e:ti(e),t]},useSyncExternalStore:dd,useId:Yd,useHostTransitionStatus:ko,useFormState:Nd,useActionState:Nd,useOptimistic:function(e,t){var a=St();return gd(a,ut,e,t)},useMemoCache:bo,useCacheRefresh:qd};Ao.useEffectEvent=Ad;var Xd={readContext:Tt,use:hs,useCallback:Td,useContext:Tt,useEffect:So,useImperativeHandle:Dd,useInsertionEffect:zd,useLayoutEffect:Rd,useMemo:Md,useReducer:vo,useRef:kd,useState:function(){return vo(La)},useDebugValue:No,useDeferredValue:function(e,t){var a=St();return ut===null?_o(a,e,t):Ud(a,ut.memoizedState,e,t)},useTransition:function(){var e=vo(La)[0],t=St().memoizedState;return[typeof e=="boolean"?e:ti(e),t]},useSyncExternalStore:dd,useId:Yd,useHostTransitionStatus:ko,useFormState:Cd,useActionState:Cd,useOptimistic:function(e,t){var a=St();return ut!==null?gd(a,ut,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:bo,useCacheRefresh:qd};Xd.useEffectEvent=Ad;function zo(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:w({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Ro={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=aa(),s=an(n);s.payload=t,a!=null&&(s.callback=a),t=nn(e,s,n),t!==null&&($t(t,e,n),Pl(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=aa(),s=an(n);s.tag=1,s.payload=t,a!=null&&(s.callback=a),t=nn(e,s,n),t!==null&&($t(t,e,n),Pl(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=aa(),n=an(a);n.tag=2,t!=null&&(n.callback=t),t=nn(e,n,a),t!==null&&($t(t,e,a),Pl(t,e,a))}};function Zd(e,t,a,n,s,o,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,v):t.prototype&&t.prototype.isPureReactComponent?!Il(a,n)||!Il(s,o):!0}function $d(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&Ro.enqueueReplaceState(t,t.state,null)}function qn(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=w({},a));for(var s in e)a[s]===void 0&&(a[s]=e[s])}return a}function Qd(e){Qi(e)}function Fd(e){console.error(e)}function Pd(e){Qi(e)}function bs(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Jd(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Oo(e,t,a){return a=an(a),a.tag=3,a.payload={element:null},a.callback=function(){bs(e,t)},a}function Wd(e){return e=an(e),e.tag=3,e}function ef(e,t,a,n){var s=a.type.getDerivedStateFromError;if(typeof s=="function"){var o=n.value;e.payload=function(){return s(o)},e.callback=function(){Jd(t,a,n)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){Jd(t,a,n),typeof s!="function"&&(un===null?un=new Set([this]):un.add(this));var T=n.stack;this.componentDidCatch(n.value,{componentStack:T!==null?T:""})})}function ox(e,t,a,n,s){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&rl(t,a,s,!0),a=Jt.current,a!==null){switch(a.tag){case 31:case 13:return ua===null?zs():a.alternate===null&&vt===0&&(vt=3),a.flags&=-257,a.flags|=65536,a.lanes=s,n===is?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),nc(e,n,s)),!1;case 22:return a.flags|=65536,n===is?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),nc(e,n,s)),!1}throw Error(u(435,a.tag))}return nc(e,n,s),zs(),!1}if(et)return t=Jt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==Fr&&(e=Error(u(422),{cause:n}),Xl(sa(e,a)))):(n!==Fr&&(t=Error(u(423),{cause:n}),Xl(sa(t,a))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,n=sa(n,a),s=Oo(e.stateNode,n,s),ro(e,s),vt!==4&&(vt=2)),!1;var o=Error(u(520),{cause:n});if(o=sa(o,a),di===null?di=[o]:di.push(o),vt!==4&&(vt=2),t===null)return!0;n=sa(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=s&-s,a.lanes|=e,e=Oo(a.stateNode,n,e),ro(a,e),!1;case 1:if(t=a.type,o=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(un===null||!un.has(o))))return a.flags|=65536,s&=-s,a.lanes|=s,s=Wd(s),ef(s,e,a,n),ro(a,s),!1}a=a.return}while(a!==null);return!1}var Do=Error(u(461)),kt=!1;function Mt(e,t,a,n){t.child=e===null?ld(t,null,a,n):Hn(t,e.child,a,n)}function tf(e,t,a,n,s){a=a.render;var o=t.ref;if("ref"in n){var v={};for(var T in n)T!=="ref"&&(v[T]=n[T])}else v=n;return Mn(t),n=po(e,t,a,v,o,s),T=mo(),e!==null&&!kt?(xo(e,t,s),Ba(e,t,s)):(et&&T&&$r(t),t.flags|=1,Mt(e,t,n,s),t.child)}function af(e,t,a,n,s){if(e===null){var o=a.type;return typeof o=="function"&&!Vr(o)&&o.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=o,nf(e,t,o,n,s)):(e=Wi(a.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!qo(e,s)){var v=o.memoizedProps;if(a=a.compare,a=a!==null?a:Il,a(v,n)&&e.ref===t.ref)return Ba(e,t,s)}return t.flags|=1,e=Oa(o,n),e.ref=t.ref,e.return=t,t.child=e}function nf(e,t,a,n,s){if(e!==null){var o=e.memoizedProps;if(Il(o,n)&&e.ref===t.ref)if(kt=!1,t.pendingProps=n=o,qo(e,s))(e.flags&131072)!==0&&(kt=!0);else return t.lanes=e.lanes,Ba(e,t,s)}return To(e,t,a,n,s)}function lf(e,t,a,n){var s=n.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|a:a,e!==null){for(n=t.child=e.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~o}else n=0,t.child=null;return sf(e,t,o,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ns(t,o!==null?o.cachePool:null),o!==null?rd(t,o):co(),od(t);else return n=t.lanes=536870912,sf(e,t,o!==null?o.baseLanes|a:a,a,n)}else o!==null?(ns(t,o.cachePool),rd(t,o),sn(),t.memoizedState=null):(e!==null&&ns(t,null),co(),sn());return Mt(e,t,s,a),t.child}function li(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sf(e,t,a,n,s){var o=no();return o=o===null?null:{parent:_t._currentValue,pool:o},t.memoizedState={baseLanes:a,cachePool:o},e!==null&&ns(t,null),co(),od(t),e!==null&&rl(e,t,n,!0),t.childLanes=s,null}function ys(e,t){return t=ws({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rf(e,t,a){return Hn(t,e.child,null,a),e=ys(t,t.pendingProps),e.flags|=2,Wt(t),t.memoizedState=null,e}function cx(e,t,a){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(et){if(n.mode==="hidden")return e=ys(t,n),t.lanes=536870912,li(null,e);if(fo(t),(e=mt)?(e=yh(e,ca),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pa!==null?{id:wa,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},a=Iu(e),a.return=t,t.child=a,Dt=t,mt=null)):e=null,e===null)throw Wa(t);return t.lanes=536870912,null}return ys(t,n)}var o=e.memoizedState;if(o!==null){var v=o.dehydrated;if(fo(t),s)if(t.flags&256)t.flags&=-257,t=rf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(kt||rl(e,t,a,!1),s=(a&e.childLanes)!==0,kt||s){if(n=ht,n!==null&&(v=Mi(n,a),v!==0&&v!==o.retryLane))throw o.retryLane=v,Rn(e,v),$t(n,e,v),Do;zs(),t=rf(e,t,a)}else e=o.treeContext,mt=da(v.nextSibling),Dt=t,et=!0,Ja=null,ca=!1,e!==null&&Xu(t,e),t=ys(t,n),t.flags|=4096;return t}return e=Oa(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function vs(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(u(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function To(e,t,a,n,s){return Mn(t),a=po(e,t,a,n,void 0,s),n=mo(),e!==null&&!kt?(xo(e,t,s),Ba(e,t,s)):(et&&n&&$r(t),t.flags|=1,Mt(e,t,a,s),t.child)}function of(e,t,a,n,s,o){return Mn(t),t.updateQueue=null,a=ud(t,n,a,s),cd(e),n=mo(),e!==null&&!kt?(xo(e,t,o),Ba(e,t,o)):(et&&n&&$r(t),t.flags|=1,Mt(e,t,a,o),t.child)}function cf(e,t,a,n,s){if(Mn(t),t.stateNode===null){var o=nl,v=a.contextType;typeof v=="object"&&v!==null&&(o=Tt(v)),o=new a(n,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ro,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=n,o.state=t.memoizedState,o.refs={},io(t),v=a.contextType,o.context=typeof v=="object"&&v!==null?Tt(v):nl,o.state=t.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(zo(t,a,v,n),o.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(v=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),v!==o.state&&Ro.enqueueReplaceState(o,o.state,null),Wl(t,n,o,s),Jl(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){o=t.stateNode;var T=t.memoizedProps,G=qn(a,T);o.props=G;var ie=o.context,ye=a.contextType;v=nl,typeof ye=="object"&&ye!==null&&(v=Tt(ye));var Ne=a.getDerivedStateFromProps;ye=typeof Ne=="function"||typeof o.getSnapshotBeforeUpdate=="function",T=t.pendingProps!==T,ye||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(T||ie!==v)&&$d(t,o,n,v),tn=!1;var oe=t.memoizedState;o.state=oe,Wl(t,n,o,s),Jl(),ie=t.memoizedState,T||oe!==ie||tn?(typeof Ne=="function"&&(zo(t,a,Ne,n),ie=t.memoizedState),(G=tn||Zd(t,a,G,n,oe,ie,v))?(ye||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=ie),o.props=n,o.state=ie,o.context=v,n=G):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,so(e,t),v=t.memoizedProps,ye=qn(a,v),o.props=ye,Ne=t.pendingProps,oe=o.context,ie=a.contextType,G=nl,typeof ie=="object"&&ie!==null&&(G=Tt(ie)),T=a.getDerivedStateFromProps,(ie=typeof T=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(v!==Ne||oe!==G)&&$d(t,o,n,G),tn=!1,oe=t.memoizedState,o.state=oe,Wl(t,n,o,s),Jl();var fe=t.memoizedState;v!==Ne||oe!==fe||tn||e!==null&&e.dependencies!==null&&ts(e.dependencies)?(typeof T=="function"&&(zo(t,a,T,n),fe=t.memoizedState),(ye=tn||Zd(t,a,ye,n,oe,fe,G)||e!==null&&e.dependencies!==null&&ts(e.dependencies))?(ie||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,fe,G),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,fe,G)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||v===e.memoizedProps&&oe===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&oe===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=fe),o.props=n,o.state=fe,o.context=G,n=ye):(typeof o.componentDidUpdate!="function"||v===e.memoizedProps&&oe===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&oe===e.memoizedState||(t.flags|=1024),n=!1)}return o=n,vs(e,t),n=(t.flags&128)!==0,o||n?(o=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&n?(t.child=Hn(t,e.child,null,s),t.child=Hn(t,null,a,s)):Mt(e,t,a,s),t.memoizedState=o.state,e=t.child):e=Ba(e,t,s),e}function uf(e,t,a,n){return Dn(),t.flags|=256,Mt(e,t,a,n),t.child}var Mo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uo(e){return{baseLanes:e,cachePool:Ju()}}function Lo(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ta),e}function df(e,t,a){var n=t.pendingProps,s=!1,o=(t.flags&128)!==0,v;if((v=o)||(v=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),v&&(s=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(et){if(s?ln(t):sn(),(e=mt)?(e=yh(e,ca),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pa!==null?{id:wa,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},a=Iu(e),a.return=t,t.child=a,Dt=t,mt=null)):e=null,e===null)throw Wa(t);return yc(e)?t.lanes=32:t.lanes=536870912,null}var T=n.children;return n=n.fallback,s?(sn(),s=t.mode,T=ws({mode:"hidden",children:T},s),n=On(n,s,a,null),T.return=t,n.return=t,T.sibling=n,t.child=T,n=t.child,n.memoizedState=Uo(a),n.childLanes=Lo(e,v,a),t.memoizedState=Mo,li(null,n)):(ln(t),Bo(t,T))}var G=e.memoizedState;if(G!==null&&(T=G.dehydrated,T!==null)){if(o)t.flags&256?(ln(t),t.flags&=-257,t=Ho(e,t,a)):t.memoizedState!==null?(sn(),t.child=e.child,t.flags|=128,t=null):(sn(),T=n.fallback,s=t.mode,n=ws({mode:"visible",children:n.children},s),T=On(T,s,a,null),T.flags|=2,n.return=t,T.return=t,n.sibling=T,t.child=n,Hn(t,e.child,null,a),n=t.child,n.memoizedState=Uo(a),n.childLanes=Lo(e,v,a),t.memoizedState=Mo,t=li(null,n));else if(ln(t),yc(T)){if(v=T.nextSibling&&T.nextSibling.dataset,v)var ie=v.dgst;v=ie,n=Error(u(419)),n.stack="",n.digest=v,Xl({value:n,source:null,stack:null}),t=Ho(e,t,a)}else if(kt||rl(e,t,a,!1),v=(a&e.childLanes)!==0,kt||v){if(v=ht,v!==null&&(n=Mi(v,a),n!==0&&n!==G.retryLane))throw G.retryLane=n,Rn(e,n),$t(v,e,n),Do;bc(T)||zs(),t=Ho(e,t,a)}else bc(T)?(t.flags|=192,t.child=e.child,t=null):(e=G.treeContext,mt=da(T.nextSibling),Dt=t,et=!0,Ja=null,ca=!1,e!==null&&Xu(t,e),t=Bo(t,n.children),t.flags|=4096);return t}return s?(sn(),T=n.fallback,s=t.mode,G=e.child,ie=G.sibling,n=Oa(G,{mode:"hidden",children:n.children}),n.subtreeFlags=G.subtreeFlags&65011712,ie!==null?T=Oa(ie,T):(T=On(T,s,a,null),T.flags|=2),T.return=t,n.return=t,n.sibling=T,t.child=n,li(null,n),n=t.child,T=e.child.memoizedState,T===null?T=Uo(a):(s=T.cachePool,s!==null?(G=_t._currentValue,s=s.parent!==G?{parent:G,pool:G}:s):s=Ju(),T={baseLanes:T.baseLanes|a,cachePool:s}),n.memoizedState=T,n.childLanes=Lo(e,v,a),t.memoizedState=Mo,li(e.child,n)):(ln(t),a=e.child,e=a.sibling,a=Oa(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(v=t.deletions,v===null?(t.deletions=[e],t.flags|=16):v.push(e)),t.child=a,t.memoizedState=null,a)}function Bo(e,t){return t=ws({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ws(e,t){return e=Pt(22,e,null,t),e.lanes=0,e}function Ho(e,t,a){return Hn(t,e.child,null,a),e=Bo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ff(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Wr(e.return,t,a)}function Yo(e,t,a,n,s,o){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:s,treeForkCount:o}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=n,v.tail=a,v.tailMode=s,v.treeForkCount=o)}function hf(e,t,a){var n=t.pendingProps,s=n.revealOrder,o=n.tail;n=n.children;var v=jt.current,T=(v&2)!==0;if(T?(v=v&1|2,t.flags|=128):v&=1,W(jt,v),Mt(e,t,n,a),n=et?Vl:0,!T&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ff(e,a,t);else if(e.tag===19)ff(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(a=t.child,s=null;a!==null;)e=a.alternate,e!==null&&cs(e)===null&&(s=a),a=a.sibling;a=s,a===null?(s=t.child,t.child=null):(s=a.sibling,a.sibling=null),Yo(t,!1,s,a,o,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&cs(e)===null){t.child=s;break}e=s.sibling,s.sibling=a,a=s,s=e}Yo(t,!0,a,null,o,n);break;case"together":Yo(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function Ba(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),cn|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(rl(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,a=Oa(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Oa(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function qo(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ts(e)))}function ux(e,t,a){switch(t.tag){case 3:Ae(t,t.stateNode.containerInfo),en(t,_t,e.memoizedState.cache),Dn();break;case 27:case 5:Ke(t);break;case 4:Ae(t,t.stateNode.containerInfo);break;case 10:en(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,fo(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(ln(t),t.flags|=128,null):(a&t.child.childLanes)!==0?df(e,t,a):(ln(t),e=Ba(e,t,a),e!==null?e.sibling:null);ln(t);break;case 19:var s=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||(rl(e,t,a,!1),n=(a&t.childLanes)!==0),s){if(n)return hf(e,t,a);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),W(jt,jt.current),n)break;return null;case 22:return t.lanes=0,lf(e,t,a,t.pendingProps);case 24:en(t,_t,e.memoizedState.cache)}return Ba(e,t,a)}function pf(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)kt=!0;else{if(!qo(e,a)&&(t.flags&128)===0)return kt=!1,ux(e,t,a);kt=(e.flags&131072)!==0}else kt=!1,et&&(t.flags&1048576)!==0&&Vu(t,Vl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=Ln(t.elementType),t.type=e,typeof e=="function")Vr(e)?(n=qn(e,n),t.tag=1,t=cf(null,t,e,n,a)):(t.tag=0,t=To(null,t,e,n,a));else{if(e!=null){var s=e.$$typeof;if(s===M){t.tag=11,t=tf(null,t,e,n,a);break e}else if(s===L){t.tag=14,t=af(null,t,e,n,a);break e}}throw t=z(e)||e,Error(u(306,t,""))}}return t;case 0:return To(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,s=qn(n,t.pendingProps),cf(e,t,n,s,a);case 3:e:{if(Ae(t,t.stateNode.containerInfo),e===null)throw Error(u(387));n=t.pendingProps;var o=t.memoizedState;s=o.element,so(e,t),Wl(t,n,null,a);var v=t.memoizedState;if(n=v.cache,en(t,_t,n),n!==o.cache&&eo(t,[_t],a,!0),Jl(),n=v.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=uf(e,t,n,a);break e}else if(n!==s){s=sa(Error(u(424)),t),Xl(s),t=uf(e,t,n,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,mt=da(e.firstChild),Dt=t,et=!0,Ja=null,ca=!0,a=ld(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Dn(),n===s){t=Ba(e,t,a);break e}Mt(e,t,n,a)}t=t.child}return t;case 26:return vs(e,t),e===null?(a=_h(t.type,null,t.pendingProps,null))?t.memoizedState=a:et||(a=t.type,e=t.pendingProps,n=Ls(he.current).createElement(a),n[wt]=t,n[Rt]=e,Ut(n,a,e),Nt(n),t.stateNode=n):t.memoizedState=_h(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ke(t),e===null&&et&&(n=t.stateNode=jh(t.type,t.pendingProps,he.current),Dt=t,ca=!0,s=mt,pn(t.type)?(vc=s,mt=da(n.firstChild)):mt=s),Mt(e,t,t.pendingProps.children,a),vs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&et&&((s=n=mt)&&(n=Yx(n,t.type,t.pendingProps,ca),n!==null?(t.stateNode=n,Dt=t,mt=da(n.firstChild),ca=!1,s=!0):s=!1),s||Wa(t)),Ke(t),s=t.type,o=t.pendingProps,v=e!==null?e.memoizedProps:null,n=o.children,mc(s,o)?n=null:v!==null&&mc(s,v)&&(t.flags|=32),t.memoizedState!==null&&(s=po(e,t,tx,null,null,a),yi._currentValue=s),vs(e,t),Mt(e,t,n,a),t.child;case 6:return e===null&&et&&((e=a=mt)&&(a=qx(a,t.pendingProps,ca),a!==null?(t.stateNode=a,Dt=t,mt=null,e=!0):e=!1),e||Wa(t)),null;case 13:return df(e,t,a);case 4:return Ae(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Hn(t,null,n,a):Mt(e,t,n,a),t.child;case 11:return tf(e,t,t.type,t.pendingProps,a);case 7:return Mt(e,t,t.pendingProps,a),t.child;case 8:return Mt(e,t,t.pendingProps.children,a),t.child;case 12:return Mt(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,en(t,t.type,n.value),Mt(e,t,n.children,a),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,Mn(t),s=Tt(s),n=n(s),t.flags|=1,Mt(e,t,n,a),t.child;case 14:return af(e,t,t.type,t.pendingProps,a);case 15:return nf(e,t,t.type,t.pendingProps,a);case 19:return hf(e,t,a);case 31:return cx(e,t,a);case 22:return lf(e,t,a,t.pendingProps);case 24:return Mn(t),n=Tt(_t),e===null?(s=no(),s===null&&(s=ht,o=to(),s.pooledCache=o,o.refCount++,o!==null&&(s.pooledCacheLanes|=a),s=o),t.memoizedState={parent:n,cache:s},io(t),en(t,_t,s)):((e.lanes&a)!==0&&(so(e,t),Wl(t,null,null,a),Jl()),s=e.memoizedState,o=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),en(t,_t,n)):(n=o.cache,en(t,_t,n),n!==s.cache&&eo(t,[_t],a,!0))),Mt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function Ha(e){e.flags|=4}function Ko(e,t,a,n,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(qf())e.flags|=8192;else throw Bn=is,lo}else e.flags&=-16777217}function mf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zh(t))if(qf())e.flags|=8192;else throw Bn=is,lo}function js(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Oi():536870912,e.lanes|=t,yl|=t)}function ii(e,t){if(!et)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function xt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var s=e.child;s!==null;)a|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)a|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function dx(e,t,a){var n=t.pendingProps;switch(Qr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(t),null;case 1:return xt(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ma(_t),Oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(sl(t)?Ha(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Pr())),xt(t),null;case 26:var s=t.type,o=t.memoizedState;return e===null?(Ha(t),o!==null?(xt(t),mf(t,o)):(xt(t),Ko(t,s,null,n,a))):o?o!==e.memoizedState?(Ha(t),xt(t),mf(t,o)):(xt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&Ha(t),xt(t),Ko(t,s,e,n,a)),null;case 27:if(Ie(t),a=he.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Ha(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return xt(t),null}e=te.current,sl(t)?Zu(t):(e=jh(s,n,a),t.stateNode=e,Ha(t))}return xt(t),null;case 5:if(Ie(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Ha(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return xt(t),null}if(o=te.current,sl(t))Zu(t);else{var v=Ls(he.current);switch(o){case 1:o=v.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:o=v.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":o=v.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":o=v.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":o=v.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof n.is=="string"?v.createElement("select",{is:n.is}):v.createElement("select"),n.multiple?o.multiple=!0:n.size&&(o.size=n.size);break;default:o=typeof n.is=="string"?v.createElement(s,{is:n.is}):v.createElement(s)}}o[wt]=t,o[Rt]=n;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)o.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=o;e:switch(Ut(o,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Ha(t)}}return xt(t),Ko(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Ha(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=he.current,sl(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,s=Dt,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}e[wt]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||dh(e.nodeValue,a)),e||Wa(t,!0)}else e=Ls(e).createTextNode(n),e[wt]=t,t.stateNode=e}return xt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=sl(t),a!==null){if(e===null){if(!n)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[wt]=t}else Dn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),e=!1}else a=Pr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Wt(t),t):(Wt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return xt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=sl(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(u(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(u(317));s[wt]=t}else Dn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),s=!1}else s=Pr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Wt(t),t):(Wt(t),null)}return Wt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==s&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),js(t,t.updateQueue),xt(t),null);case 4:return Oe(),e===null&&uc(t.stateNode.containerInfo),xt(t),null;case 10:return Ma(t.type),xt(t),null;case 19:if(D(jt),n=t.memoizedState,n===null)return xt(t),null;if(s=(t.flags&128)!==0,o=n.rendering,o===null)if(s)ii(n,!1);else{if(vt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=cs(e),o!==null){for(t.flags|=128,ii(n,!1),e=o.updateQueue,t.updateQueue=e,js(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Ku(a,e),a=a.sibling;return W(jt,jt.current&1|2),et&&Da(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&_e()>ks&&(t.flags|=128,s=!0,ii(n,!1),t.lanes=4194304)}else{if(!s)if(e=cs(o),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,js(t,e),ii(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!et)return xt(t),null}else 2*_e()-n.renderingStartTime>ks&&a!==536870912&&(t.flags|=128,s=!0,ii(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(e=n.last,e!==null?e.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=_e(),e.sibling=null,a=jt.current,W(jt,s?a&1|2:a&1),et&&Da(t,n.treeForkCount),e):(xt(t),null);case 22:case 23:return Wt(t),uo(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),a=t.updateQueue,a!==null&&js(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&D(Un),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ma(_t),xt(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function fx(e,t){switch(Qr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ma(_t),Oe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ie(t),null;case 31:if(t.memoizedState!==null){if(Wt(t),t.alternate===null)throw Error(u(340));Dn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Wt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));Dn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return D(jt),null;case 4:return Oe(),null;case 10:return Ma(t.type),null;case 22:case 23:return Wt(t),uo(),e!==null&&D(Un),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ma(_t),null;case 25:return null;default:return null}}function xf(e,t){switch(Qr(t),t.tag){case 3:Ma(_t),Oe();break;case 26:case 27:case 5:Ie(t);break;case 4:Oe();break;case 31:t.memoizedState!==null&&Wt(t);break;case 13:Wt(t);break;case 19:D(jt);break;case 10:Ma(t.type);break;case 22:case 23:Wt(t),uo(),e!==null&&D(Un);break;case 24:Ma(_t)}}function si(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var s=n.next;a=s;do{if((a.tag&e)===e){n=void 0;var o=a.create,v=a.inst;n=o(),v.destroy=n}a=a.next}while(a!==s)}}catch(T){ct(t,t.return,T)}}function rn(e,t,a){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var o=s.next;n=o;do{if((n.tag&e)===e){var v=n.inst,T=v.destroy;if(T!==void 0){v.destroy=void 0,s=t;var G=a,ie=T;try{ie()}catch(ye){ct(s,G,ye)}}}n=n.next}while(n!==o)}}catch(ye){ct(t,t.return,ye)}}function gf(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{sd(t,a)}catch(n){ct(e,e.return,n)}}}function bf(e,t,a){a.props=qn(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){ct(e,t,n)}}function ri(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(s){ct(e,t,s)}}function Sa(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(s){ct(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(s){ct(e,t,s)}else a.current=null}function yf(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(s){ct(e,e.return,s)}}function Io(e,t,a){try{var n=e.stateNode;Tx(n,e.type,a,t),n[Rt]=t}catch(s){ct(e,e.return,s)}}function vf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pn(e.type)||e.tag===4}function Go(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vf(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.tag===27&&pn(e.type)||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 Vo(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=za));else if(n!==4&&(n===27&&pn(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Vo(e,t,a),e=e.sibling;e!==null;)Vo(e,t,a),e=e.sibling}function Ss(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&pn(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ss(e,t,a),e=e.sibling;e!==null;)Ss(e,t,a),e=e.sibling}function wf(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Ut(t,n,a),t[wt]=e,t[Rt]=a}catch(o){ct(e,e.return,o)}}var Ya=!1,Et=!1,Xo=!1,jf=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function hx(e,t){if(e=e.containerInfo,hc=Gs,e=Du(e),Br(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var s=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var v=0,T=-1,G=-1,ie=0,ye=0,Ne=e,oe=null;t:for(;;){for(var fe;Ne!==a||s!==0&&Ne.nodeType!==3||(T=v+s),Ne!==o||n!==0&&Ne.nodeType!==3||(G=v+n),Ne.nodeType===3&&(v+=Ne.nodeValue.length),(fe=Ne.firstChild)!==null;)oe=Ne,Ne=fe;for(;;){if(Ne===e)break t;if(oe===a&&++ie===s&&(T=v),oe===o&&++ye===n&&(G=v),(fe=Ne.nextSibling)!==null)break;Ne=oe,oe=Ne.parentNode}Ne=fe}a=T===-1||G===-1?null:{start:T,end:G}}else a=null}a=a||{start:0,end:0}}else a=null;for(pc={focusedElem:e,selectionRange:a},Gs=!1,Ot=t;Ot!==null;)if(t=Ot,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ot=e;else for(;Ot!==null;){switch(t=Ot,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)s=e[a],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,a=t,s=o.memoizedProps,o=o.memoizedState,n=a.stateNode;try{var Te=qn(a.type,s);e=n.getSnapshotBeforeUpdate(Te,o),n.__reactInternalSnapshotBeforeUpdate=e}catch(Ye){ct(a,a.return,Ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)gc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":gc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(u(163))}if(e=t.sibling,e!==null){e.return=t.return,Ot=e;break}Ot=t.return}}function Sf(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:Ka(e,a),n&4&&si(5,a);break;case 1:if(Ka(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(v){ct(a,a.return,v)}else{var s=qn(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){ct(a,a.return,v)}}n&64&&gf(a),n&512&&ri(a,a.return);break;case 3:if(Ka(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{sd(e,t)}catch(v){ct(a,a.return,v)}}break;case 27:t===null&&n&4&&wf(a);case 26:case 5:Ka(e,a),t===null&&n&4&&yf(a),n&512&&ri(a,a.return);break;case 12:Ka(e,a);break;case 31:Ka(e,a),n&4&&Cf(e,a);break;case 13:Ka(e,a),n&4&&kf(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=jx.bind(null,a),Kx(e,a))));break;case 22:if(n=a.memoizedState!==null||Ya,!n){t=t!==null&&t.memoizedState!==null||Et,s=Ya;var o=Et;Ya=n,(Et=t)&&!o?Ia(e,a,(a.subtreeFlags&8772)!==0):Ka(e,a),Ya=s,Et=o}break;case 30:break;default:Ka(e,a)}}function Nf(e){var t=e.alternate;t!==null&&(e.alternate=null,Nf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Li(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var gt=null,Gt=!1;function qa(e,t,a){for(a=a.child;a!==null;)_f(e,t,a),a=a.sibling}function _f(e,t,a){if(Be&&typeof Be.onCommitFiberUnmount=="function")try{Be.onCommitFiberUnmount(Ue,a)}catch{}switch(a.tag){case 26:Et||Sa(a,t),qa(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Et||Sa(a,t);var n=gt,s=Gt;pn(a.type)&&(gt=a.stateNode,Gt=!1),qa(e,t,a),xi(a.stateNode),gt=n,Gt=s;break;case 5:Et||Sa(a,t);case 6:if(n=gt,s=Gt,gt=null,qa(e,t,a),gt=n,Gt=s,gt!==null)if(Gt)try{(gt.nodeType===9?gt.body:gt.nodeName==="HTML"?gt.ownerDocument.body:gt).removeChild(a.stateNode)}catch(o){ct(a,t,o)}else try{gt.removeChild(a.stateNode)}catch(o){ct(a,t,o)}break;case 18:gt!==null&&(Gt?(e=gt,gh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),kl(e)):gh(gt,a.stateNode));break;case 4:n=gt,s=Gt,gt=a.stateNode.containerInfo,Gt=!0,qa(e,t,a),gt=n,Gt=s;break;case 0:case 11:case 14:case 15:rn(2,a,t),Et||rn(4,a,t),qa(e,t,a);break;case 1:Et||(Sa(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&bf(a,t,n)),qa(e,t,a);break;case 21:qa(e,t,a);break;case 22:Et=(n=Et)||a.memoizedState!==null,qa(e,t,a),Et=n;break;default:qa(e,t,a)}}function Cf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{kl(e)}catch(a){ct(t,t.return,a)}}}function kf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{kl(e)}catch(a){ct(t,t.return,a)}}function px(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new jf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new jf),t;default:throw Error(u(435,e.tag))}}function Ns(e,t){var a=px(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var s=Sx.bind(null,e,n);n.then(s,s)}})}function Vt(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var s=a[n],o=e,v=t,T=v;e:for(;T!==null;){switch(T.tag){case 27:if(pn(T.type)){gt=T.stateNode,Gt=!1;break e}break;case 5:gt=T.stateNode,Gt=!1;break e;case 3:case 4:gt=T.stateNode.containerInfo,Gt=!0;break e}T=T.return}if(gt===null)throw Error(u(160));_f(o,v,s),gt=null,Gt=!1,o=s.alternate,o!==null&&(o.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ef(t,e),t=t.sibling}var ba=null;function Ef(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vt(t,e),Xt(e),n&4&&(rn(3,e,e.return),si(3,e),rn(5,e,e.return));break;case 1:Vt(t,e),Xt(e),n&512&&(Et||a===null||Sa(a,a.return)),n&64&&Ya&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var s=ba;if(Vt(t,e),Xt(e),n&512&&(Et||a===null||Sa(a,a.return)),n&4){var o=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,s=s.ownerDocument||s;t:switch(n){case"title":o=s.getElementsByTagName("title")[0],(!o||o[Bt]||o[wt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=s.createElement(n),s.head.insertBefore(o,s.querySelector("head > title"))),Ut(o,n,a),o[wt]=e,Nt(o),n=o;break e;case"link":var v=Eh("link","href",s).get(n+(a.href||""));if(v){for(var T=0;T<v.length;T++)if(o=v[T],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(T,1);break t}}o=s.createElement(n),Ut(o,n,a),s.head.appendChild(o);break;case"meta":if(v=Eh("meta","content",s).get(n+(a.content||""))){for(T=0;T<v.length;T++)if(o=v[T],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(T,1);break t}}o=s.createElement(n),Ut(o,n,a),s.head.appendChild(o);break;default:throw Error(u(468,n))}o[wt]=e,Nt(o),n=o}e.stateNode=n}else Ah(s,e.type,e.stateNode);else e.stateNode=kh(s,n,e.memoizedProps);else o!==n?(o===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):o.count--,n===null?Ah(s,e.type,e.stateNode):kh(s,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Io(e,e.memoizedProps,a.memoizedProps)}break;case 27:Vt(t,e),Xt(e),n&512&&(Et||a===null||Sa(a,a.return)),a!==null&&n&4&&Io(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Vt(t,e),Xt(e),n&512&&(Et||a===null||Sa(a,a.return)),e.flags&32){s=e.stateNode;try{Fn(s,"")}catch(Te){ct(e,e.return,Te)}}n&4&&e.stateNode!=null&&(s=e.memoizedProps,Io(e,s,a!==null?a.memoizedProps:s)),n&1024&&(Xo=!0);break;case 6:if(Vt(t,e),Xt(e),n&4){if(e.stateNode===null)throw Error(u(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(Te){ct(e,e.return,Te)}}break;case 3:if(Ys=null,s=ba,ba=Bs(t.containerInfo),Vt(t,e),ba=s,Xt(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{kl(t.containerInfo)}catch(Te){ct(e,e.return,Te)}Xo&&(Xo=!1,Af(e));break;case 4:n=ba,ba=Bs(e.stateNode.containerInfo),Vt(t,e),Xt(e),ba=n;break;case 12:Vt(t,e),Xt(e);break;case 31:Vt(t,e),Xt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ns(e,n)));break;case 13:Vt(t,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Cs=_e()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ns(e,n)));break;case 22:s=e.memoizedState!==null;var G=a!==null&&a.memoizedState!==null,ie=Ya,ye=Et;if(Ya=ie||s,Et=ye||G,Vt(t,e),Et=ye,Ya=ie,Xt(e),n&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(a===null||G||Ya||Et||Kn(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){G=a=t;try{if(o=G.stateNode,s)v=o.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{T=G.stateNode;var Ne=G.memoizedProps.style,oe=Ne!=null&&Ne.hasOwnProperty("display")?Ne.display:null;T.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Te){ct(G,G.return,Te)}}}else if(t.tag===6){if(a===null){G=t;try{G.stateNode.nodeValue=s?"":G.memoizedProps}catch(Te){ct(G,G.return,Te)}}}else if(t.tag===18){if(a===null){G=t;try{var fe=G.stateNode;s?bh(fe,!0):bh(G.stateNode,!1)}catch(Te){ct(G,G.return,Te)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Ns(e,a))));break;case 19:Vt(t,e),Xt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ns(e,n)));break;case 30:break;case 21:break;default:Vt(t,e),Xt(e)}}function Xt(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(vf(n)){a=n;break}n=n.return}if(a==null)throw Error(u(160));switch(a.tag){case 27:var s=a.stateNode,o=Go(e);Ss(e,o,s);break;case 5:var v=a.stateNode;a.flags&32&&(Fn(v,""),a.flags&=-33);var T=Go(e);Ss(e,T,v);break;case 3:case 4:var G=a.stateNode.containerInfo,ie=Go(e);Vo(e,ie,G);break;default:throw Error(u(161))}}catch(ye){ct(e,e.return,ye)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Af(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Af(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ka(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Sf(e,t.alternate,t),t=t.sibling}function Kn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:rn(4,t,t.return),Kn(t);break;case 1:Sa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&bf(t,t.return,a),Kn(t);break;case 27:xi(t.stateNode);case 26:case 5:Sa(t,t.return),Kn(t);break;case 22:t.memoizedState===null&&Kn(t);break;case 30:Kn(t);break;default:Kn(t)}e=e.sibling}}function Ia(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=e,o=t,v=o.flags;switch(o.tag){case 0:case 11:case 15:Ia(s,o,a),si(4,o);break;case 1:if(Ia(s,o,a),n=o,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(ie){ct(n,n.return,ie)}if(n=o,s=n.updateQueue,s!==null){var T=n.stateNode;try{var G=s.shared.hiddenCallbacks;if(G!==null)for(s.shared.hiddenCallbacks=null,s=0;s<G.length;s++)id(G[s],T)}catch(ie){ct(n,n.return,ie)}}a&&v&64&&gf(o),ri(o,o.return);break;case 27:wf(o);case 26:case 5:Ia(s,o,a),a&&n===null&&v&4&&yf(o),ri(o,o.return);break;case 12:Ia(s,o,a);break;case 31:Ia(s,o,a),a&&v&4&&Cf(s,o);break;case 13:Ia(s,o,a),a&&v&4&&kf(s,o);break;case 22:o.memoizedState===null&&Ia(s,o,a),ri(o,o.return);break;case 30:break;default:Ia(s,o,a)}t=t.sibling}}function Zo(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Zl(a))}function $o(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zl(e))}function ya(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)zf(e,t,a,n),t=t.sibling}function zf(e,t,a,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:ya(e,t,a,n),s&2048&&si(9,t);break;case 1:ya(e,t,a,n);break;case 3:ya(e,t,a,n),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zl(e)));break;case 12:if(s&2048){ya(e,t,a,n),e=t.stateNode;try{var o=t.memoizedProps,v=o.id,T=o.onPostCommit;typeof T=="function"&&T(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(G){ct(t,t.return,G)}}else ya(e,t,a,n);break;case 31:ya(e,t,a,n);break;case 13:ya(e,t,a,n);break;case 23:break;case 22:o=t.stateNode,v=t.alternate,t.memoizedState!==null?o._visibility&2?ya(e,t,a,n):oi(e,t):o._visibility&2?ya(e,t,a,n):(o._visibility|=2,xl(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Zo(v,t);break;case 24:ya(e,t,a,n),s&2048&&$o(t.alternate,t);break;default:ya(e,t,a,n)}}function xl(e,t,a,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,v=t,T=a,G=n,ie=v.flags;switch(v.tag){case 0:case 11:case 15:xl(o,v,T,G,s),si(8,v);break;case 23:break;case 22:var ye=v.stateNode;v.memoizedState!==null?ye._visibility&2?xl(o,v,T,G,s):oi(o,v):(ye._visibility|=2,xl(o,v,T,G,s)),s&&ie&2048&&Zo(v.alternate,v);break;case 24:xl(o,v,T,G,s),s&&ie&2048&&$o(v.alternate,v);break;default:xl(o,v,T,G,s)}t=t.sibling}}function oi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,s=n.flags;switch(n.tag){case 22:oi(a,n),s&2048&&Zo(n.alternate,n);break;case 24:oi(a,n),s&2048&&$o(n.alternate,n);break;default:oi(a,n)}t=t.sibling}}var ci=8192;function gl(e,t,a){if(e.subtreeFlags&ci)for(e=e.child;e!==null;)Rf(e,t,a),e=e.sibling}function Rf(e,t,a){switch(e.tag){case 26:gl(e,t,a),e.flags&ci&&e.memoizedState!==null&&e0(a,ba,e.memoizedState,e.memoizedProps);break;case 5:gl(e,t,a);break;case 3:case 4:var n=ba;ba=Bs(e.stateNode.containerInfo),gl(e,t,a),ba=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=ci,ci=16777216,gl(e,t,a),ci=n):gl(e,t,a));break;default:gl(e,t,a)}}function Of(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ui(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];Ot=n,Tf(n,e)}Of(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Df(e),e=e.sibling}function Df(e){switch(e.tag){case 0:case 11:case 15:ui(e),e.flags&2048&&rn(9,e,e.return);break;case 3:ui(e);break;case 12:ui(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,_s(e)):ui(e);break;default:ui(e)}}function _s(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];Ot=n,Tf(n,e)}Of(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:rn(8,t,t.return),_s(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,_s(t));break;default:_s(t)}e=e.sibling}}function Tf(e,t){for(;Ot!==null;){var a=Ot;switch(a.tag){case 0:case 11:case 15:rn(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Zl(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,Ot=n;else e:for(a=e;Ot!==null;){n=Ot;var s=n.sibling,o=n.return;if(Nf(n),n===a){Ot=null;break e}if(s!==null){s.return=o,Ot=s;break e}Ot=o}}}var mx={getCacheForType:function(e){var t=Tt(_t),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(_t).controller.signal}},xx=typeof WeakMap=="function"?WeakMap:Map,st=0,ht=null,$e=null,Pe=0,ot=0,ea=null,on=!1,bl=!1,Qo=!1,Ga=0,vt=0,cn=0,In=0,Fo=0,ta=0,yl=0,di=null,Zt=null,Po=!1,Cs=0,Mf=0,ks=1/0,Es=null,un=null,zt=0,dn=null,vl=null,Va=0,Jo=0,Wo=null,Uf=null,fi=0,ec=null;function aa(){return(st&2)!==0&&Pe!==0?Pe&-Pe:$.T!==null?sc():Zn()}function Lf(){if(ta===0)if((Pe&536870912)===0||et){var e=va;va<<=1,(va&3932160)===0&&(va=262144),ta=e}else ta=536870912;return e=Jt.current,e!==null&&(e.flags|=32),ta}function $t(e,t,a){(e===ht&&(ot===2||ot===9)||e.cancelPendingCommit!==null)&&(wl(e,0),fn(e,Pe,ta,!1)),Nn(e,a),((st&2)===0||e!==ht)&&(e===ht&&((st&2)===0&&(In|=a),vt===4&&fn(e,Pe,ta,!1)),Na(e))}function Bf(e,t,a){if((st&6)!==0)throw Error(u(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Sn(e,t),s=n?yx(e,t):ac(e,t,!0),o=n;do{if(s===0){bl&&!n&&fn(e,t,0,!1);break}else{if(a=e.current.alternate,o&&!gx(a)){s=ac(e,t,!1),o=!1;continue}if(s===2){if(o=t,e.errorRecoveryDisabledLanes&o)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){t=v;e:{var T=e;s=di;var G=T.current.memoizedState.isDehydrated;if(G&&(wl(T,v).flags|=256),v=ac(T,v,!1),v!==2){if(Qo&&!G){T.errorRecoveryDisabledLanes|=o,In|=o,s=4;break e}o=Zt,Zt=s,o!==null&&(Zt===null?Zt=o:Zt.push.apply(Zt,o))}s=v}if(o=!1,s!==2)continue}}if(s===1){wl(e,0),fn(e,t,0,!0);break}e:{switch(n=e,o=s,o){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:fn(n,t,ta,!on);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(s=Cs+300-_e(),10<s)){if(fn(n,t,ta,!on),jn(n,0,!0)!==0)break e;Va=t,n.timeoutHandle=mh(Hf.bind(null,n,a,Zt,Es,Po,t,ta,In,yl,on,o,"Throttled",-0,0),s);break e}Hf(n,a,Zt,Es,Po,t,ta,In,yl,on,o,null,-0,0)}}break}while(!0);Na(e)}function Hf(e,t,a,n,s,o,v,T,G,ie,ye,Ne,oe,fe){if(e.timeoutHandle=-1,Ne=t.subtreeFlags,Ne&8192||(Ne&16785408)===16785408){Ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:za},Rf(t,o,Ne);var Te=(o&62914560)===o?Cs-_e():(o&4194048)===o?Mf-_e():0;if(Te=t0(Ne,Te),Te!==null){Va=o,e.cancelPendingCommit=Te(Zf.bind(null,e,t,o,a,n,s,v,T,G,ye,Ne,null,oe,fe)),fn(e,o,v,!ie);return}}Zf(e,t,o,a,n,s,v,T,G)}function gx(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var s=a[n],o=s.getSnapshot;s=s.value;try{if(!Ft(o(),s))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function fn(e,t,a,n){t&=~Fo,t&=~In,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var s=t;0<s;){var o=31-Me(s),v=1<<o;n[o]=-1,s&=~v}a!==0&&Di(e,a,t)}function As(){return(st&6)===0?(hi(0),!1):!0}function tc(){if($e!==null){if(ot===0)var e=$e.return;else e=$e,Ta=Tn=null,go(e),dl=null,Ql=0,e=$e;for(;e!==null;)xf(e.alternate,e),e=e.return;$e=null}}function wl(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Lx(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Va=0,tc(),ht=e,$e=a=Oa(e.current,null),Pe=t,ot=0,ea=null,on=!1,bl=Sn(e,t),Qo=!1,yl=ta=Fo=In=cn=vt=0,Zt=di=null,Po=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var s=31-Me(n),o=1<<s;t|=e[s],n&=~o}return Ga=t,Fi(),a}function Yf(e,t){Xe=null,$.H=ni,t===ul||t===ls?(t=td(),ot=3):t===lo?(t=td(),ot=4):ot=t===Do?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ea=t,$e===null&&(vt=1,bs(e,sa(t,e.current)))}function qf(){var e=Jt.current;return e===null?!0:(Pe&4194048)===Pe?ua===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===ua:!1}function Kf(){var e=$.H;return $.H=ni,e===null?ni:e}function If(){var e=$.A;return $.A=mx,e}function zs(){vt=4,on||(Pe&4194048)!==Pe&&Jt.current!==null||(bl=!0),(cn&134217727)===0&&(In&134217727)===0||ht===null||fn(ht,Pe,ta,!1)}function ac(e,t,a){var n=st;st|=2;var s=Kf(),o=If();(ht!==e||Pe!==t)&&(Es=null,wl(e,t)),t=!1;var v=vt;e:do try{if(ot!==0&&$e!==null){var T=$e,G=ea;switch(ot){case 8:tc(),v=6;break e;case 3:case 2:case 9:case 6:Jt.current===null&&(t=!0);var ie=ot;if(ot=0,ea=null,jl(e,T,G,ie),a&&bl){v=0;break e}break;default:ie=ot,ot=0,ea=null,jl(e,T,G,ie)}}bx(),v=vt;break}catch(ye){Yf(e,ye)}while(!0);return t&&e.shellSuspendCounter++,Ta=Tn=null,st=n,$.H=s,$.A=o,$e===null&&(ht=null,Pe=0,Fi()),v}function bx(){for(;$e!==null;)Gf($e)}function yx(e,t){var a=st;st|=2;var n=Kf(),s=If();ht!==e||Pe!==t?(Es=null,ks=_e()+500,wl(e,t)):bl=Sn(e,t);e:do try{if(ot!==0&&$e!==null){t=$e;var o=ea;t:switch(ot){case 1:ot=0,ea=null,jl(e,t,o,1);break;case 2:case 9:if(Wu(o)){ot=0,ea=null,Vf(t);break}t=function(){ot!==2&&ot!==9||ht!==e||(ot=7),Na(e)},o.then(t,t);break e;case 3:ot=7;break e;case 4:ot=5;break e;case 7:Wu(o)?(ot=0,ea=null,Vf(t)):(ot=0,ea=null,jl(e,t,o,7));break;case 5:var v=null;switch($e.tag){case 26:v=$e.memoizedState;case 5:case 27:var T=$e;if(v?zh(v):T.stateNode.complete){ot=0,ea=null;var G=T.sibling;if(G!==null)$e=G;else{var ie=T.return;ie!==null?($e=ie,Rs(ie)):$e=null}break t}}ot=0,ea=null,jl(e,t,o,5);break;case 6:ot=0,ea=null,jl(e,t,o,6);break;case 8:tc(),vt=6;break e;default:throw Error(u(462))}}vx();break}catch(ye){Yf(e,ye)}while(!0);return Ta=Tn=null,$.H=n,$.A=s,st=a,$e!==null?0:(ht=null,Pe=0,Fi(),vt)}function vx(){for(;$e!==null&&!K();)Gf($e)}function Gf(e){var t=pf(e.alternate,e,Ga);e.memoizedProps=e.pendingProps,t===null?Rs(e):$e=t}function Vf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=of(a,t,t.pendingProps,t.type,void 0,Pe);break;case 11:t=of(a,t,t.pendingProps,t.type.render,t.ref,Pe);break;case 5:go(t);default:xf(a,t),t=$e=Ku(t,Ga),t=pf(a,t,Ga)}e.memoizedProps=e.pendingProps,t===null?Rs(e):$e=t}function jl(e,t,a,n){Ta=Tn=null,go(t),dl=null,Ql=0;var s=t.return;try{if(ox(e,s,t,a,Pe)){vt=1,bs(e,sa(a,e.current)),$e=null;return}}catch(o){if(s!==null)throw $e=s,o;vt=1,bs(e,sa(a,e.current)),$e=null;return}t.flags&32768?(et||n===1?e=!0:bl||(Pe&536870912)!==0?e=!1:(on=e=!0,(n===2||n===9||n===3||n===6)&&(n=Jt.current,n!==null&&n.tag===13&&(n.flags|=16384))),Xf(t,e)):Rs(t)}function Rs(e){var t=e;do{if((t.flags&32768)!==0){Xf(t,on);return}e=t.return;var a=dx(t.alternate,t,Ga);if(a!==null){$e=a;return}if(t=t.sibling,t!==null){$e=t;return}$e=t=e}while(t!==null);vt===0&&(vt=5)}function Xf(e,t){do{var a=fx(e.alternate,e);if(a!==null){a.flags&=32767,$e=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){$e=e;return}$e=e=a}while(e!==null);vt=6,$e=null}function Zf(e,t,a,n,s,o,v,T,G){e.cancelPendingCommit=null;do Os();while(zt!==0);if((st&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(o=t.lanes|t.childLanes,o|=Ir,br(e,a,o,v,T,G),e===ht&&($e=ht=null,Pe=0),vl=t,dn=e,Va=a,Jo=o,Wo=s,Uf=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Nx(De,function(){return Jf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=$.T,$.T=null,s=P.p,P.p=2,v=st,st|=4;try{hx(e,t,a)}finally{st=v,P.p=s,$.T=n}}zt=1,$f(),Qf(),Ff()}}function $f(){if(zt===1){zt=0;var e=dn,t=vl,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=$.T,$.T=null;var n=P.p;P.p=2;var s=st;st|=4;try{Ef(t,e);var o=pc,v=Du(e.containerInfo),T=o.focusedElem,G=o.selectionRange;if(v!==T&&T&&T.ownerDocument&&Ou(T.ownerDocument.documentElement,T)){if(G!==null&&Br(T)){var ie=G.start,ye=G.end;if(ye===void 0&&(ye=ie),"selectionStart"in T)T.selectionStart=ie,T.selectionEnd=Math.min(ye,T.value.length);else{var Ne=T.ownerDocument||document,oe=Ne&&Ne.defaultView||window;if(oe.getSelection){var fe=oe.getSelection(),Te=T.textContent.length,Ye=Math.min(G.start,Te),ft=G.end===void 0?Ye:Math.min(G.end,Te);!fe.extend&&Ye>ft&&(v=ft,ft=Ye,Ye=v);var ee=Ru(T,Ye),Q=Ru(T,ft);if(ee&&Q&&(fe.rangeCount!==1||fe.anchorNode!==ee.node||fe.anchorOffset!==ee.offset||fe.focusNode!==Q.node||fe.focusOffset!==Q.offset)){var le=Ne.createRange();le.setStart(ee.node,ee.offset),fe.removeAllRanges(),Ye>ft?(fe.addRange(le),fe.extend(Q.node,Q.offset)):(le.setEnd(Q.node,Q.offset),fe.addRange(le))}}}}for(Ne=[],fe=T;fe=fe.parentNode;)fe.nodeType===1&&Ne.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<Ne.length;T++){var je=Ne[T];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}Gs=!!hc,pc=hc=null}finally{st=s,P.p=n,$.T=a}}e.current=t,zt=2}}function Qf(){if(zt===2){zt=0;var e=dn,t=vl,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=$.T,$.T=null;var n=P.p;P.p=2;var s=st;st|=4;try{Sf(e,t.alternate,t)}finally{st=s,P.p=n,$.T=a}}zt=3}}function Ff(){if(zt===4||zt===3){zt=0,ve();var e=dn,t=vl,a=Va,n=Uf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?zt=5:(zt=0,vl=dn=null,Pf(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(un=null),Tl(a),t=t.stateNode,Be&&typeof Be.onCommitFiberRoot=="function")try{Be.onCommitFiberRoot(Ue,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=$.T,s=P.p,P.p=2,$.T=null;try{for(var o=e.onRecoverableError,v=0;v<n.length;v++){var T=n[v];o(T.value,{componentStack:T.stack})}}finally{$.T=t,P.p=s}}(Va&3)!==0&&Os(),Na(e),s=e.pendingLanes,(a&261930)!==0&&(s&42)!==0?e===ec?fi++:(fi=0,ec=e):fi=0,hi(0)}}function Pf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zl(t)))}function Os(){return $f(),Qf(),Ff(),Jf()}function Jf(){if(zt!==5)return!1;var e=dn,t=Jo;Jo=0;var a=Tl(Va),n=$.T,s=P.p;try{P.p=32>a?32:a,$.T=null,a=Wo,Wo=null;var o=dn,v=Va;if(zt=0,vl=dn=null,Va=0,(st&6)!==0)throw Error(u(331));var T=st;if(st|=4,Df(o.current),zf(o,o.current,v,a),st=T,hi(0,!1),Be&&typeof Be.onPostCommitFiberRoot=="function")try{Be.onPostCommitFiberRoot(Ue,o)}catch{}return!0}finally{P.p=s,$.T=n,Pf(e,t)}}function Wf(e,t,a){t=sa(a,t),t=Oo(e.stateNode,t,2),e=nn(e,t,2),e!==null&&(Nn(e,2),Na(e))}function ct(e,t,a){if(e.tag===3)Wf(e,e,a);else for(;t!==null;){if(t.tag===3){Wf(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(un===null||!un.has(n))){e=sa(a,e),a=Wd(2),n=nn(t,a,2),n!==null&&(ef(a,n,t,e),Nn(n,2),Na(n));break}}t=t.return}}function nc(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new xx;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(a)||(Qo=!0,s.add(a),e=wx.bind(null,e,t,a),t.then(e,e))}function wx(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ht===e&&(Pe&a)===a&&(vt===4||vt===3&&(Pe&62914560)===Pe&&300>_e()-Cs?(st&2)===0&&wl(e,0):Fo|=a,yl===Pe&&(yl=0)),Na(e)}function eh(e,t){t===0&&(t=Oi()),e=Rn(e,t),e!==null&&(Nn(e,t),Na(e))}function jx(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),eh(e,a)}function Sx(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(a=s.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(u(314))}n!==null&&n.delete(t),eh(e,a)}function Nx(e,t){return xe(e,t)}var Ds=null,Sl=null,lc=!1,Ts=!1,ic=!1,hn=0;function Na(e){e!==Sl&&e.next===null&&(Sl===null?Ds=Sl=e:Sl=Sl.next=e),Ts=!0,lc||(lc=!0,Cx())}function hi(e,t){if(!ic&&Ts){ic=!0;do for(var a=!1,n=Ds;n!==null;){if(e!==0){var s=n.pendingLanes;if(s===0)var o=0;else{var v=n.suspendedLanes,T=n.pingedLanes;o=(1<<31-Me(42|e)+1)-1,o&=s&~(v&~T),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,lh(n,o))}else o=Pe,o=jn(n,n===ht?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(o&3)===0||Sn(n,o)||(a=!0,lh(n,o));n=n.next}while(a);ic=!1}}function _x(){th()}function th(){Ts=lc=!1;var e=0;hn!==0&&Ux()&&(e=hn);for(var t=_e(),a=null,n=Ds;n!==null;){var s=n.next,o=ah(n,t);o===0?(n.next=null,a===null?Ds=s:a.next=s,s===null&&(Sl=a)):(a=n,(e!==0||(o&3)!==0)&&(Ts=!0)),n=s}zt!==0&&zt!==5||hi(e),hn!==0&&(hn=0)}function ah(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var v=31-Me(o),T=1<<v,G=s[v];G===-1?((T&a)===0||(T&n)!==0)&&(s[v]=gr(T,t)):G<=t&&(e.expiredLanes|=T),o&=~T}if(t=ht,a=Pe,a=jn(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(ot===2||ot===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&re(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Sn(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&re(n),Tl(a)){case 2:case 8:a=Ve;break;case 32:a=De;break;case 268435456:a=be;break;default:a=De}return n=nh.bind(null,e),a=xe(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&re(n),e.callbackPriority=2,e.callbackNode=null,2}function nh(e,t){if(zt!==0&&zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Os()&&e.callbackNode!==a)return null;var n=Pe;return n=jn(e,e===ht?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(Bf(e,n,t),ah(e,_e()),e.callbackNode!=null&&e.callbackNode===a?nh.bind(null,e):null)}function lh(e,t){if(Os())return null;Bf(e,t,!0)}function Cx(){Bx(function(){(st&6)!==0?xe(ze,_x):th()})}function sc(){if(hn===0){var e=ol;e===0&&(e=ma,ma<<=1,(ma&261888)===0&&(ma=256)),hn=e}return hn}function ih(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ki(""+e)}function sh(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function kx(e,t,a,n,s){if(t==="submit"&&a&&a.stateNode===s){var o=ih((s[Rt]||null).action),v=n.submitter;v&&(t=(t=v[Rt]||null)?ih(t.formAction):v.getAttribute("formAction"),t!==null&&(o=t,v=null));var T=new Xi("action","action",null,n,s);e.push({event:T,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(hn!==0){var G=v?sh(s,v):new FormData(s);Co(a,{pending:!0,data:G,method:s.method,action:o},null,G)}}else typeof o=="function"&&(T.preventDefault(),G=v?sh(s,v):new FormData(s),Co(a,{pending:!0,data:G,method:s.method,action:o},o,G))},currentTarget:s}]})}}for(var rc=0;rc<Kr.length;rc++){var oc=Kr[rc],Ex=oc.toLowerCase(),Ax=oc[0].toUpperCase()+oc.slice(1);ga(Ex,"on"+Ax)}ga(Uu,"onAnimationEnd"),ga(Lu,"onAnimationIteration"),ga(Bu,"onAnimationStart"),ga("dblclick","onDoubleClick"),ga("focusin","onFocus"),ga("focusout","onBlur"),ga(Vm,"onTransitionRun"),ga(Xm,"onTransitionStart"),ga(Zm,"onTransitionCancel"),ga(Hu,"onTransitionEnd"),pe("onMouseEnter",["mouseout","mouseover"]),pe("onMouseLeave",["mouseout","mouseover"]),pe("onPointerEnter",["pointerout","pointerover"]),pe("onPointerLeave",["pointerout","pointerover"]),ce("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ce("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ce("onBeforeInput",["compositionend","keypress","textInput","paste"]),ce("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ce("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ce("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pi));function rh(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],s=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var v=n.length-1;0<=v;v--){var T=n[v],G=T.instance,ie=T.currentTarget;if(T=T.listener,G!==o&&s.isPropagationStopped())break e;o=T,s.currentTarget=ie;try{o(s)}catch(ye){Qi(ye)}s.currentTarget=null,o=G}else for(v=0;v<n.length;v++){if(T=n[v],G=T.instance,ie=T.currentTarget,T=T.listener,G!==o&&s.isPropagationStopped())break e;o=T,s.currentTarget=ie;try{o(s)}catch(ye){Qi(ye)}s.currentTarget=null,o=G}}}}function Qe(e,t){var a=t[Ml];a===void 0&&(a=t[Ml]=new Set);var n=e+"__bubble";a.has(n)||(oh(t,e,2,!1),a.add(n))}function cc(e,t,a){var n=0;t&&(n|=4),oh(a,e,n,t)}var Ms="_reactListening"+Math.random().toString(36).slice(2);function uc(e){if(!e[Ms]){e[Ms]=!0,wr.forEach(function(a){a!=="selectionchange"&&(zx.has(a)||cc(a,!1,e),cc(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ms]||(t[Ms]=!0,cc("selectionchange",!1,t))}}function oh(e,t,a,n){switch(Lh(t)){case 2:var s=l0;break;case 8:s=i0;break;default:s=_c}a=s.bind(null,t,a,e),s=void 0,!Ar||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,a,{capture:!0,passive:s}):e.addEventListener(t,a,!0):s!==void 0?e.addEventListener(t,a,{passive:s}):e.addEventListener(t,a,!1)}function dc(e,t,a,n,s){var o=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var v=n.tag;if(v===3||v===4){var T=n.stateNode.containerInfo;if(T===s)break;if(v===4)for(v=n.return;v!==null;){var G=v.tag;if((G===3||G===4)&&v.stateNode.containerInfo===s)return;v=v.return}for(;T!==null;){if(v=_n(T),v===null)return;if(G=v.tag,G===5||G===6||G===26||G===27){n=o=v;continue e}T=T.parentNode}}n=n.return}fu(function(){var ie=o,ye=kr(a),Ne=[];e:{var oe=Yu.get(e);if(oe!==void 0){var fe=Xi,Te=e;switch(e){case"keypress":if(Gi(a)===0)break e;case"keydown":case"keyup":fe=Sm;break;case"focusin":Te="focus",fe=Dr;break;case"focusout":Te="blur",fe=Dr;break;case"beforeblur":case"afterblur":fe=Dr;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=mu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=dm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=Cm;break;case Uu:case Lu:case Bu:fe=pm;break;case Hu:fe=Em;break;case"scroll":case"scrollend":fe=cm;break;case"wheel":fe=zm;break;case"copy":case"cut":case"paste":fe=xm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=gu;break;case"toggle":case"beforetoggle":fe=Om}var Ye=(t&4)!==0,ft=!Ye&&(e==="scroll"||e==="scrollend"),ee=Ye?oe!==null?oe+"Capture":null:oe;Ye=[];for(var Q=ie,le;Q!==null;){var je=Q;if(le=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||le===null||ee===null||(je=Ul(Q,ee),je!=null&&Ye.push(mi(Q,je,le))),ft)break;Q=Q.return}0<Ye.length&&(oe=new fe(oe,Te,null,a,ye),Ne.push({event:oe,listeners:Ye}))}}if((t&7)===0){e:{if(oe=e==="mouseover"||e==="pointerover",fe=e==="mouseout"||e==="pointerout",oe&&a!==Cr&&(Te=a.relatedTarget||a.fromElement)&&(_n(Te)||Te[Ea]))break e;if((fe||oe)&&(oe=ye.window===ye?ye:(oe=ye.ownerDocument)?oe.defaultView||oe.parentWindow:window,fe?(Te=a.relatedTarget||a.toElement,fe=ie,Te=Te?_n(Te):null,Te!==null&&(ft=d(Te),Ye=Te.tag,Te!==ft||Ye!==5&&Ye!==27&&Ye!==6)&&(Te=null)):(fe=null,Te=ie),fe!==Te)){if(Ye=mu,je="onMouseLeave",ee="onMouseEnter",Q="mouse",(e==="pointerout"||e==="pointerover")&&(Ye=gu,je="onPointerLeave",ee="onPointerEnter",Q="pointer"),ft=fe==null?oe:kn(fe),le=Te==null?oe:kn(Te),oe=new Ye(je,Q+"leave",fe,a,ye),oe.target=ft,oe.relatedTarget=le,je=null,_n(ye)===ie&&(Ye=new Ye(ee,Q+"enter",Te,a,ye),Ye.target=le,Ye.relatedTarget=ft,je=Ye),ft=je,fe&&Te)t:{for(Ye=Rx,ee=fe,Q=Te,le=0,je=ee;je;je=Ye(je))le++;je=0;for(var He=Q;He;He=Ye(He))je++;for(;0<le-je;)ee=Ye(ee),le--;for(;0<je-le;)Q=Ye(Q),je--;for(;le--;){if(ee===Q||Q!==null&&ee===Q.alternate){Ye=ee;break t}ee=Ye(ee),Q=Ye(Q)}Ye=null}else Ye=null;fe!==null&&ch(Ne,oe,fe,Ye,!1),Te!==null&&ft!==null&&ch(Ne,ft,Te,Ye,!0)}}e:{if(oe=ie?kn(ie):window,fe=oe.nodeName&&oe.nodeName.toLowerCase(),fe==="select"||fe==="input"&&oe.type==="file")var lt=_u;else if(Su(oe))if(Cu)lt=Km;else{lt=Ym;var Le=Hm}else fe=oe.nodeName,!fe||fe.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ie&&_r(ie.elementType)&&(lt=_u):lt=qm;if(lt&&(lt=lt(e,ie))){Nu(Ne,lt,a,ye);break e}Le&&Le(e,oe,ie),e==="focusout"&&ie&&oe.type==="number"&&ie.memoizedProps.value!=null&&Nr(oe,"number",oe.value)}switch(Le=ie?kn(ie):window,e){case"focusin":(Su(Le)||Le.contentEditable==="true")&&(el=Le,Hr=ie,Gl=null);break;case"focusout":Gl=Hr=el=null;break;case"mousedown":Yr=!0;break;case"contextmenu":case"mouseup":case"dragend":Yr=!1,Tu(Ne,a,ye);break;case"selectionchange":if(Gm)break;case"keydown":case"keyup":Tu(Ne,a,ye)}var Ze;if(Mr)e:{switch(e){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else Wn?wu(e,a)&&(Je="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Je="onCompositionStart");Je&&(bu&&a.locale!=="ko"&&(Wn||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&Wn&&(Ze=hu()):(Fa=ye,zr="value"in Fa?Fa.value:Fa.textContent,Wn=!0)),Le=Us(ie,Je),0<Le.length&&(Je=new xu(Je,e,null,a,ye),Ne.push({event:Je,listeners:Le}),Ze?Je.data=Ze:(Ze=ju(a),Ze!==null&&(Je.data=Ze)))),(Ze=Tm?Mm(e,a):Um(e,a))&&(Je=Us(ie,"onBeforeInput"),0<Je.length&&(Le=new xu("onBeforeInput","beforeinput",null,a,ye),Ne.push({event:Le,listeners:Je}),Le.data=Ze)),kx(Ne,e,ie,a,ye)}rh(Ne,t)})}function mi(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Us(e,t){for(var a=t+"Capture",n=[];e!==null;){var s=e,o=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||o===null||(s=Ul(e,a),s!=null&&n.unshift(mi(e,s,o)),s=Ul(e,t),s!=null&&n.push(mi(e,s,o))),e.tag===3)return n;e=e.return}return[]}function Rx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ch(e,t,a,n,s){for(var o=t._reactName,v=[];a!==null&&a!==n;){var T=a,G=T.alternate,ie=T.stateNode;if(T=T.tag,G!==null&&G===n)break;T!==5&&T!==26&&T!==27||ie===null||(G=ie,s?(ie=Ul(a,o),ie!=null&&v.unshift(mi(a,ie,G))):s||(ie=Ul(a,o),ie!=null&&v.push(mi(a,ie,G)))),a=a.return}v.length!==0&&e.push({event:t,listeners:v})}var Ox=/\r\n?/g,Dx=/\u0000|\uFFFD/g;function uh(e){return(typeof e=="string"?e:""+e).replace(Ox,`
9
+ `).replace(Dx,"")}function dh(e,t){return t=uh(t),uh(e)===t}function dt(e,t,a,n,s,o){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||Fn(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&Fn(e,""+n);break;case"className":Yi(e,"class",n);break;case"tabIndex":Yi(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Yi(e,a,n);break;case"style":uu(e,n,o);break;case"data":if(t!=="object"){Yi(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=Ki(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(a==="formAction"?(t!=="input"&&dt(e,t,"name",s.name,s,null),dt(e,t,"formEncType",s.formEncType,s,null),dt(e,t,"formMethod",s.formMethod,s,null),dt(e,t,"formTarget",s.formTarget,s,null)):(dt(e,t,"encType",s.encType,s,null),dt(e,t,"method",s.method,s,null),dt(e,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=Ki(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=za);break;case"onScroll":n!=null&&Qe("scroll",e);break;case"onScrollEnd":n!=null&&Qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(a=n.__html,a!=null){if(s.children!=null)throw Error(u(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=Ki(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":Qe("beforetoggle",e),Qe("toggle",e),Hi(e,"popover",n);break;case"xlinkActuate":Aa(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":Aa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":Aa(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":Aa(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":Aa(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":Aa(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":Aa(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":Aa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":Aa(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Hi(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=rm.get(a)||a,Hi(e,a,n))}}function fc(e,t,a,n,s,o){switch(a){case"style":uu(e,n,o);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(a=n.__html,a!=null){if(s.children!=null)throw Error(u(60));e.innerHTML=a}}break;case"children":typeof n=="string"?Fn(e,n):(typeof n=="number"||typeof n=="bigint")&&Fn(e,""+n);break;case"onScroll":n!=null&&Qe("scroll",e);break;case"onScrollEnd":n!=null&&Qe("scrollend",e);break;case"onClick":n!=null&&(e.onclick=za);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Bi.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(s=a.endsWith("Capture"),t=a.slice(2,s?a.length-7:void 0),o=e[Rt]||null,o=o!=null?o[a]:null,typeof o=="function"&&e.removeEventListener(t,o,s),typeof n=="function")){typeof o!="function"&&o!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,s);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):Hi(e,a,n)}}}function Ut(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",e),Qe("load",e);var n=!1,s=!1,o;for(o in a)if(a.hasOwnProperty(o)){var v=a[o];if(v!=null)switch(o){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:dt(e,t,o,v,a,null)}}s&&dt(e,t,"srcSet",a.srcSet,a,null),n&&dt(e,t,"src",a.src,a,null);return;case"input":Qe("invalid",e);var T=o=v=s=null,G=null,ie=null;for(n in a)if(a.hasOwnProperty(n)){var ye=a[n];if(ye!=null)switch(n){case"name":s=ye;break;case"type":v=ye;break;case"checked":G=ye;break;case"defaultChecked":ie=ye;break;case"value":o=ye;break;case"defaultValue":T=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(u(137,t));break;default:dt(e,t,n,ye,a,null)}}su(e,o,T,G,ie,v,s,!1);return;case"select":Qe("invalid",e),n=v=o=null;for(s in a)if(a.hasOwnProperty(s)&&(T=a[s],T!=null))switch(s){case"value":o=T;break;case"defaultValue":v=T;break;case"multiple":n=T;default:dt(e,t,s,T,a,null)}t=o,a=v,e.multiple=!!n,t!=null?Qn(e,!!n,t,!1):a!=null&&Qn(e,!!n,a,!0);return;case"textarea":Qe("invalid",e),o=s=n=null;for(v in a)if(a.hasOwnProperty(v)&&(T=a[v],T!=null))switch(v){case"value":n=T;break;case"defaultValue":s=T;break;case"children":o=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(u(91));break;default:dt(e,t,v,T,a,null)}ou(e,n,s,o);return;case"option":for(G in a)a.hasOwnProperty(G)&&(n=a[G],n!=null)&&(G==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":dt(e,t,G,n,a,null));return;case"dialog":Qe("beforetoggle",e),Qe("toggle",e),Qe("cancel",e),Qe("close",e);break;case"iframe":case"object":Qe("load",e);break;case"video":case"audio":for(n=0;n<pi.length;n++)Qe(pi[n],e);break;case"image":Qe("error",e),Qe("load",e);break;case"details":Qe("toggle",e);break;case"embed":case"source":case"link":Qe("error",e),Qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in a)if(a.hasOwnProperty(ie)&&(n=a[ie],n!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:dt(e,t,ie,n,a,null)}return;default:if(_r(t)){for(ye in a)a.hasOwnProperty(ye)&&(n=a[ye],n!==void 0&&fc(e,t,ye,n,a,void 0));return}}for(T in a)a.hasOwnProperty(T)&&(n=a[T],n!=null&&dt(e,t,T,n,a,null))}function Tx(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,o=null,v=null,T=null,G=null,ie=null,ye=null;for(fe in a){var Ne=a[fe];if(a.hasOwnProperty(fe)&&Ne!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":G=Ne;default:n.hasOwnProperty(fe)||dt(e,t,fe,null,n,Ne)}}for(var oe in n){var fe=n[oe];if(Ne=a[oe],n.hasOwnProperty(oe)&&(fe!=null||Ne!=null))switch(oe){case"type":o=fe;break;case"name":s=fe;break;case"checked":ie=fe;break;case"defaultChecked":ye=fe;break;case"value":v=fe;break;case"defaultValue":T=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(u(137,t));break;default:fe!==Ne&&dt(e,t,oe,fe,n,Ne)}}Sr(e,v,T,G,ie,ye,o,s);return;case"select":fe=v=T=oe=null;for(o in a)if(G=a[o],a.hasOwnProperty(o)&&G!=null)switch(o){case"value":break;case"multiple":fe=G;default:n.hasOwnProperty(o)||dt(e,t,o,null,n,G)}for(s in n)if(o=n[s],G=a[s],n.hasOwnProperty(s)&&(o!=null||G!=null))switch(s){case"value":oe=o;break;case"defaultValue":T=o;break;case"multiple":v=o;default:o!==G&&dt(e,t,s,o,n,G)}t=T,a=v,n=fe,oe!=null?Qn(e,!!a,oe,!1):!!n!=!!a&&(t!=null?Qn(e,!!a,t,!0):Qn(e,!!a,a?[]:"",!1));return;case"textarea":fe=oe=null;for(T in a)if(s=a[T],a.hasOwnProperty(T)&&s!=null&&!n.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:dt(e,t,T,null,n,s)}for(v in n)if(s=n[v],o=a[v],n.hasOwnProperty(v)&&(s!=null||o!=null))switch(v){case"value":oe=s;break;case"defaultValue":fe=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(u(91));break;default:s!==o&&dt(e,t,v,s,n,o)}ru(e,oe,fe);return;case"option":for(var Te in a)oe=a[Te],a.hasOwnProperty(Te)&&oe!=null&&!n.hasOwnProperty(Te)&&(Te==="selected"?e.selected=!1:dt(e,t,Te,null,n,oe));for(G in n)oe=n[G],fe=a[G],n.hasOwnProperty(G)&&oe!==fe&&(oe!=null||fe!=null)&&(G==="selected"?e.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":dt(e,t,G,oe,n,fe));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ye in a)oe=a[Ye],a.hasOwnProperty(Ye)&&oe!=null&&!n.hasOwnProperty(Ye)&&dt(e,t,Ye,null,n,oe);for(ie in n)if(oe=n[ie],fe=a[ie],n.hasOwnProperty(ie)&&oe!==fe&&(oe!=null||fe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(u(137,t));break;default:dt(e,t,ie,oe,n,fe)}return;default:if(_r(t)){for(var ft in a)oe=a[ft],a.hasOwnProperty(ft)&&oe!==void 0&&!n.hasOwnProperty(ft)&&fc(e,t,ft,void 0,n,oe);for(ye in n)oe=n[ye],fe=a[ye],!n.hasOwnProperty(ye)||oe===fe||oe===void 0&&fe===void 0||fc(e,t,ye,oe,n,fe);return}}for(var ee in a)oe=a[ee],a.hasOwnProperty(ee)&&oe!=null&&!n.hasOwnProperty(ee)&&dt(e,t,ee,null,n,oe);for(Ne in n)oe=n[Ne],fe=a[Ne],!n.hasOwnProperty(Ne)||oe===fe||oe==null&&fe==null||dt(e,t,Ne,oe,n,fe)}function fh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Mx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var s=a[n],o=s.transferSize,v=s.initiatorType,T=s.duration;if(o&&T&&fh(v)){for(v=0,T=s.responseEnd,n+=1;n<a.length;n++){var G=a[n],ie=G.startTime;if(ie>T)break;var ye=G.transferSize,Ne=G.initiatorType;ye&&fh(Ne)&&(G=G.responseEnd,v+=ye*(G<T?1:(T-ie)/(G-ie)))}if(--n,t+=8*(o+v)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var hc=null,pc=null;function Ls(e){return e.nodeType===9?e:e.ownerDocument}function hh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ph(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function mc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var xc=null;function Ux(){var e=window.event;return e&&e.type==="popstate"?e===xc?!1:(xc=e,!0):(xc=null,!1)}var mh=typeof setTimeout=="function"?setTimeout:void 0,Lx=typeof clearTimeout=="function"?clearTimeout:void 0,xh=typeof Promise=="function"?Promise:void 0,Bx=typeof queueMicrotask=="function"?queueMicrotask:typeof xh<"u"?function(e){return xh.resolve(null).then(e).catch(Hx)}:mh;function Hx(e){setTimeout(function(){throw e})}function pn(e){return e==="head"}function gh(e,t){var a=t,n=0;do{var s=a.nextSibling;if(e.removeChild(a),s&&s.nodeType===8)if(a=s.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(s),kl(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")xi(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,xi(a);for(var o=a.firstChild;o;){var v=o.nextSibling,T=o.nodeName;o[Bt]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&o.rel.toLowerCase()==="stylesheet"||a.removeChild(o),o=v}}else a==="body"&&xi(e.ownerDocument.body);a=s}while(a);kl(t)}function bh(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function gc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":gc(a),Li(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Yx(e,t,a,n){for(;e.nodeType===1;){var s=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[Bt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=da(e.nextSibling),e===null)break}return null}function qx(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=da(e.nextSibling),e===null))return null;return e}function yh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=da(e.nextSibling),e===null))return null;return e}function bc(e){return e.data==="$?"||e.data==="$~"}function yc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Kx(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function da(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var vc=null;function vh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return da(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function wh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function jh(e,t,a){switch(t=Ls(a),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function xi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Li(e)}var fa=new Map,Sh=new Set;function Bs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Xa=P.d;P.d={f:Ix,r:Gx,D:Vx,C:Xx,L:Zx,m:$x,X:Fx,S:Qx,M:Px};function Ix(){var e=Xa.f(),t=As();return e||t}function Gx(e){var t=Cn(e);t!==null&&t.tag===5&&t.type==="form"?Hd(t):Xa.r(e)}var Nl=typeof document>"u"?null:document;function Nh(e,t,a){var n=Nl;if(n&&typeof t=="string"&&t){var s=la(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof a=="string"&&(s+='[crossorigin="'+a+'"]'),Sh.has(s)||(Sh.add(s),e={rel:e,crossOrigin:a,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),Ut(t,"link",e),Nt(t),n.head.appendChild(t)))}}function Vx(e){Xa.D(e),Nh("dns-prefetch",e,null)}function Xx(e,t){Xa.C(e,t),Nh("preconnect",e,t)}function Zx(e,t,a){Xa.L(e,t,a);var n=Nl;if(n&&e&&t){var s='link[rel="preload"][as="'+la(t)+'"]';t==="image"&&a&&a.imageSrcSet?(s+='[imagesrcset="'+la(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(s+='[imagesizes="'+la(a.imageSizes)+'"]')):s+='[href="'+la(e)+'"]';var o=s;switch(t){case"style":o=_l(e);break;case"script":o=Cl(e)}fa.has(o)||(e=w({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),fa.set(o,e),n.querySelector(s)!==null||t==="style"&&n.querySelector(gi(o))||t==="script"&&n.querySelector(bi(o))||(t=n.createElement("link"),Ut(t,"link",e),Nt(t),n.head.appendChild(t)))}}function $x(e,t){Xa.m(e,t);var a=Nl;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+la(n)+'"][href="'+la(e)+'"]',o=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Cl(e)}if(!fa.has(o)&&(e=w({rel:"modulepreload",href:e},t),fa.set(o,e),a.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(bi(o)))return}n=a.createElement("link"),Ut(n,"link",e),Nt(n),a.head.appendChild(n)}}}function Qx(e,t,a){Xa.S(e,t,a);var n=Nl;if(n&&e){var s=Qa(n).hoistableStyles,o=_l(e);t=t||"default";var v=s.get(o);if(!v){var T={loading:0,preload:null};if(v=n.querySelector(gi(o)))T.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},a),(a=fa.get(o))&&wc(e,a);var G=v=n.createElement("link");Nt(G),Ut(G,"link",e),G._p=new Promise(function(ie,ye){G.onload=ie,G.onerror=ye}),G.addEventListener("load",function(){T.loading|=1}),G.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Hs(v,t,n)}v={type:"stylesheet",instance:v,count:1,state:T},s.set(o,v)}}}function Fx(e,t){Xa.X(e,t);var a=Nl;if(a&&e){var n=Qa(a).hoistableScripts,s=Cl(e),o=n.get(s);o||(o=a.querySelector(bi(s)),o||(e=w({src:e,async:!0},t),(t=fa.get(s))&&jc(e,t),o=a.createElement("script"),Nt(o),Ut(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(s,o))}}function Px(e,t){Xa.M(e,t);var a=Nl;if(a&&e){var n=Qa(a).hoistableScripts,s=Cl(e),o=n.get(s);o||(o=a.querySelector(bi(s)),o||(e=w({src:e,async:!0,type:"module"},t),(t=fa.get(s))&&jc(e,t),o=a.createElement("script"),Nt(o),Ut(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(s,o))}}function _h(e,t,a,n){var s=(s=he.current)?Bs(s):null;if(!s)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=_l(a.href),a=Qa(s).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=_l(a.href);var o=Qa(s).hoistableStyles,v=o.get(e);if(v||(s=s.ownerDocument||s,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,v),(o=s.querySelector(gi(e)))&&!o._p&&(v.instance=o,v.state.loading=5),fa.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},fa.set(e,a),o||Jx(s,e,a,v.state))),t&&n===null)throw Error(u(528,""));return v}if(t&&n!==null)throw Error(u(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Cl(a),a=Qa(s).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function _l(e){return'href="'+la(e)+'"'}function gi(e){return'link[rel="stylesheet"]['+e+"]"}function Ch(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Jx(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),Ut(t,"link",a),Nt(t),e.head.appendChild(t))}function Cl(e){return'[src="'+la(e)+'"]'}function bi(e){return"script[async]"+e}function kh(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+la(a.href)+'"]');if(n)return t.instance=n,Nt(n),n;var s=w({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),Nt(n),Ut(n,"style",s),Hs(n,a.precedence,e),t.instance=n;case"stylesheet":s=_l(a.href);var o=e.querySelector(gi(s));if(o)return t.state.loading|=4,t.instance=o,Nt(o),o;n=Ch(a),(s=fa.get(s))&&wc(n,s),o=(e.ownerDocument||e).createElement("link"),Nt(o);var v=o;return v._p=new Promise(function(T,G){v.onload=T,v.onerror=G}),Ut(o,"link",n),t.state.loading|=4,Hs(o,a.precedence,e),t.instance=o;case"script":return o=Cl(a.src),(s=e.querySelector(bi(o)))?(t.instance=s,Nt(s),s):(n=a,(s=fa.get(o))&&(n=w({},a),jc(n,s)),e=e.ownerDocument||e,s=e.createElement("script"),Nt(s),Ut(s,"link",n),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Hs(n,a.precedence,e));return t.instance}function Hs(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,o=s,v=0;v<n.length;v++){var T=n[v];if(T.dataset.precedence===t)o=T;else if(o!==s)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function wc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function jc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ys=null;function Eh(e,t,a){if(Ys===null){var n=new Map,s=Ys=new Map;s.set(a,n)}else s=Ys,n=s.get(a),n||(n=new Map,s.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),s=0;s<a.length;s++){var o=a[s];if(!(o[Bt]||o[wt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var v=o.getAttribute(t)||"";v=e+v;var T=n.get(v);T?T.push(o):n.set(v,[o])}}return n}function Ah(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Wx(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function zh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function e0(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var s=_l(n.href),o=t.querySelector(gi(s));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=qs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=o,Nt(o);return}o=t.ownerDocument||t,n=Ch(n),(s=fa.get(s))&&wc(n,s),o=o.createElement("link"),Nt(o);var v=o;v._p=new Promise(function(T,G){v.onload=T,v.onerror=G}),Ut(o,"link",n),a.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=qs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Sc=0;function t0(e,t){return e.stylesheets&&e.count===0&&Is(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&Is(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Sc===0&&(Sc=62500*Mx());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Is(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Sc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function qs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Is(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ks=null;function Is(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ks=new Map,t.forEach(a0,e),Ks=null,qs.call(e))}function a0(e,t){if(!(t.state.loading&4)){var a=Ks.get(e);if(a)var n=a.get(null);else{a=new Map,Ks.set(e,a);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<s.length;o++){var v=s[o];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),n=v)}n&&a.set(null,n)}s=t.instance,v=s.getAttribute("data-precedence"),o=a.get(v)||n,o===n&&a.set(null,s),a.set(v,s),this.count++,n=qs.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),o?o.parentNode.insertBefore(s,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var yi={$$typeof:A,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function n0(e,t,a,n,s,o,v,T,G){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ol(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ol(0),this.hiddenUpdates=Ol(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=o,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function Rh(e,t,a,n,s,o,v,T,G,ie,ye,Ne){return e=new n0(e,t,a,v,G,ie,ye,Ne,T),t=1,o===!0&&(t|=24),o=Pt(3,null,null,t),e.current=o,o.stateNode=e,t=to(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:n,isDehydrated:a,cache:t},io(o),e}function Oh(e){return e?(e=nl,e):nl}function Dh(e,t,a,n,s,o){s=Oh(s),n.context===null?n.context=s:n.pendingContext=s,n=an(t),n.payload={element:a},o=o===void 0?null:o,o!==null&&(n.callback=o),a=nn(e,n,t),a!==null&&($t(a,e,t),Pl(a,e,t))}function Th(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Nc(e,t){Th(e,t),(e=e.alternate)&&Th(e,t)}function Mh(e){if(e.tag===13||e.tag===31){var t=Rn(e,67108864);t!==null&&$t(t,e,67108864),Nc(e,67108864)}}function Uh(e){if(e.tag===13||e.tag===31){var t=aa();t=Dl(t);var a=Rn(e,t);a!==null&&$t(a,e,t),Nc(e,t)}}var Gs=!0;function l0(e,t,a,n){var s=$.T;$.T=null;var o=P.p;try{P.p=2,_c(e,t,a,n)}finally{P.p=o,$.T=s}}function i0(e,t,a,n){var s=$.T;$.T=null;var o=P.p;try{P.p=8,_c(e,t,a,n)}finally{P.p=o,$.T=s}}function _c(e,t,a,n){if(Gs){var s=Cc(n);if(s===null)dc(e,t,n,Vs,a),Bh(e,n);else if(r0(s,e,t,a,n))n.stopPropagation();else if(Bh(e,n),t&4&&-1<s0.indexOf(e)){for(;s!==null;){var o=Cn(s);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var v=qt(o.pendingLanes);if(v!==0){var T=o;for(T.pendingLanes|=2,T.entangledLanes|=2;v;){var G=1<<31-Me(v);T.entanglements[1]|=G,v&=~G}Na(o),(st&6)===0&&(ks=_e()+500,hi(0))}}break;case 31:case 13:T=Rn(o,2),T!==null&&$t(T,o,2),As(),Nc(o,2)}if(o=Cc(n),o===null&&dc(e,t,n,Vs,a),o===s)break;s=o}s!==null&&n.stopPropagation()}else dc(e,t,n,null,a)}}function Cc(e){return e=kr(e),kc(e)}var Vs=null;function kc(e){if(Vs=null,e=_n(e),e!==null){var t=d(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=p(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vs=e,null}function Lh(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Se()){case ze:return 2;case Ve:return 8;case De:case pt:return 32;case be:return 268435456;default:return 32}default:return 32}}var Ec=!1,mn=null,xn=null,gn=null,vi=new Map,wi=new Map,bn=[],s0="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Bh(e,t){switch(e){case"focusin":case"focusout":mn=null;break;case"dragenter":case"dragleave":xn=null;break;case"mouseover":case"mouseout":gn=null;break;case"pointerover":case"pointerout":vi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wi.delete(t.pointerId)}}function ji(e,t,a,n,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:o,targetContainers:[s]},t!==null&&(t=Cn(t),t!==null&&Mh(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function r0(e,t,a,n,s){switch(t){case"focusin":return mn=ji(mn,e,t,a,n,s),!0;case"dragenter":return xn=ji(xn,e,t,a,n,s),!0;case"mouseover":return gn=ji(gn,e,t,a,n,s),!0;case"pointerover":var o=s.pointerId;return vi.set(o,ji(vi.get(o)||null,e,t,a,n,s)),!0;case"gotpointercapture":return o=s.pointerId,wi.set(o,ji(wi.get(o)||null,e,t,a,n,s)),!0}return!1}function Hh(e){var t=_n(e.target);if(t!==null){var a=d(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,$n(e.priority,function(){Uh(a)});return}}else if(t===31){if(t=p(a),t!==null){e.blockedOn=t,$n(e.priority,function(){Uh(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Xs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Cc(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);Cr=n,a.target.dispatchEvent(n),Cr=null}else return t=Cn(a),t!==null&&Mh(t),e.blockedOn=a,!1;t.shift()}return!0}function Yh(e,t,a){Xs(e)&&a.delete(t)}function o0(){Ec=!1,mn!==null&&Xs(mn)&&(mn=null),xn!==null&&Xs(xn)&&(xn=null),gn!==null&&Xs(gn)&&(gn=null),vi.forEach(Yh),wi.forEach(Yh)}function Zs(e,t){e.blockedOn===t&&(e.blockedOn=null,Ec||(Ec=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,o0)))}var $s=null;function qh(e){$s!==e&&($s=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){$s===e&&($s=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],s=e[t+2];if(typeof n!="function"){if(kc(n||a)===null)continue;break}var o=Cn(a);o!==null&&(e.splice(t,3),t-=3,Co(o,{pending:!0,data:s,method:a.method,action:n},n,s))}}))}function kl(e){function t(G){return Zs(G,e)}mn!==null&&Zs(mn,e),xn!==null&&Zs(xn,e),gn!==null&&Zs(gn,e),vi.forEach(t),wi.forEach(t);for(var a=0;a<bn.length;a++){var n=bn[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<bn.length&&(a=bn[0],a.blockedOn===null);)Hh(a),a.blockedOn===null&&bn.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var s=a[n],o=a[n+1],v=s[Rt]||null;if(typeof o=="function")v||qh(a);else if(v){var T=null;if(o&&o.hasAttribute("formAction")){if(s=o,v=o[Rt]||null)T=v.formAction;else if(kc(s)!==null)continue}else T=v.action;typeof T=="function"?a[n+1]=T:(a.splice(n,3),n-=3),qh(a)}}}function Kh(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(v){return s=v})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Ac(e){this._internalRoot=e}Qs.prototype.render=Ac.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var a=t.current,n=aa();Dh(a,n,e,t,null,null)},Qs.prototype.unmount=Ac.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Dh(e.current,2,null,e,null,null),As(),t[Ea]=null}};function Qs(e){this._internalRoot=e}Qs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Zn();e={blockedOn:null,target:e,priority:t};for(var a=0;a<bn.length&&t!==0&&t<bn[a].priority;a++);bn.splice(a,0,e),a===0&&Hh(e)}};var Ih=c.version;if(Ih!=="19.2.3")throw Error(u(527,Ih,"19.2.3"));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=g(t),e=e!==null?C(e):null,e=e===null?null:e.stateNode,e};var c0={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fs.isDisabled&&Fs.supportsFiber)try{Ue=Fs.inject(c0),Be=Fs}catch{}}return Ni.createRoot=function(e,t){if(!f(e))throw Error(u(299));var a=!1,n="",s=Qd,o=Fd,v=Pd;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(v=t.onRecoverableError)),t=Rh(e,1,!1,null,null,a,n,null,s,o,v,Kh),e[Ea]=t.current,uc(e),new Ac(t)},Ni.hydrateRoot=function(e,t,a){if(!f(e))throw Error(u(299));var n=!1,s="",o=Qd,v=Fd,T=Pd,G=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(s=a.identifierPrefix),a.onUncaughtError!==void 0&&(o=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError),a.formState!==void 0&&(G=a.formState)),t=Rh(e,1,!0,t,a??null,n,s,G,o,v,T,Kh),t.context=Oh(null),a=t.current,n=aa(),n=Dl(n),s=an(n),s.callback=null,nn(a,s,n),a=n,t.current.lanes=a,Nn(t,a),Na(t),e[Ea]=t.current,uc(e),new Qs(t)},Ni.version="19.2.3",Ni}var Wh;function b0(){if(Wh)return Oc.exports;Wh=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Oc.exports=g0(),Oc.exports}var y0=b0();const v0=Pc(y0);var ep="popstate";function w0(i={}){function c(u,f){let{pathname:d,search:h,hash:p}=u.location;return Vc("",{pathname:d,search:h,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function r(u,f){return typeof f=="string"?f:ki(f)}return S0(c,r,null,i)}function bt(i,c){if(i===!1||i===null||typeof i>"u")throw new Error(c)}function Ca(i,c){if(!i){typeof console<"u"&&console.warn(c);try{throw new Error(c)}catch{}}}function j0(){return Math.random().toString(36).substring(2,10)}function tp(i,c){return{usr:i.state,key:i.key,idx:c}}function Vc(i,c,r=null,u){return{pathname:typeof i=="string"?i:i.pathname,search:"",hash:"",...typeof c=="string"?zl(c):c,state:r,key:c&&c.key||u||j0()}}function ki({pathname:i="/",search:c="",hash:r=""}){return c&&c!=="?"&&(i+=c.charAt(0)==="?"?c:"?"+c),r&&r!=="#"&&(i+=r.charAt(0)==="#"?r:"#"+r),i}function zl(i){let c={};if(i){let r=i.indexOf("#");r>=0&&(c.hash=i.substring(r),i=i.substring(0,r));let u=i.indexOf("?");u>=0&&(c.search=i.substring(u),i=i.substring(0,u)),i&&(c.pathname=i)}return c}function S0(i,c,r,u={}){let{window:f=document.defaultView,v5Compat:d=!1}=u,h=f.history,p="POP",x=null,g=C();g==null&&(g=0,h.replaceState({...h.state,idx:g},""));function C(){return(h.state||{idx:null}).idx}function w(){p="POP";let b=C(),j=b==null?null:b-g;g=b,x&&x({action:p,location:m.location,delta:j})}function k(b,j){p="PUSH";let S=Vc(m.location,b,j);g=C()+1;let A=tp(S,g),M=m.createHref(S);try{h.pushState(A,"",M)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;f.location.assign(M)}d&&x&&x({action:p,location:m.location,delta:1})}function y(b,j){p="REPLACE";let S=Vc(m.location,b,j);g=C();let A=tp(S,g),M=m.createHref(S);h.replaceState(A,"",M),d&&x&&x({action:p,location:m.location,delta:0})}function _(b){return N0(b)}let m={get action(){return p},get location(){return i(f,h)},listen(b){if(x)throw new Error("A history only accepts one active listener");return f.addEventListener(ep,w),x=b,()=>{f.removeEventListener(ep,w),x=null}},createHref(b){return c(f,b)},createURL:_,encodeLocation(b){let j=_(b);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:k,replace:y,go(b){return h.go(b)}};return m}function N0(i,c=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),bt(r,"No window.location.(origin|href) available to create URL");let u=typeof i=="string"?i:ki(i);return u=u.replace(/ $/,"%20"),!c&&u.startsWith("//")&&(u=r+u),new URL(u,r)}function kp(i,c,r="/"){return _0(i,c,r,!1)}function _0(i,c,r,u){let f=typeof c=="string"?zl(c):c,d=$a(f.pathname||"/",r);if(d==null)return null;let h=Ep(i);C0(h);let p=null;for(let x=0;p==null&&x<h.length;++x){let g=L0(d);p=M0(h[x],g,u)}return p}function Ep(i,c=[],r=[],u="",f=!1){let d=(h,p,x=f,g)=>{let C={relativePath:g===void 0?h.path||"":g,caseSensitive:h.caseSensitive===!0,childrenIndex:p,route:h};if(C.relativePath.startsWith("/")){if(!C.relativePath.startsWith(u)&&x)return;bt(C.relativePath.startsWith(u),`Absolute route path "${C.relativePath}" nested under path "${u}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),C.relativePath=C.relativePath.slice(u.length)}let w=Za([u,C.relativePath]),k=r.concat(C);h.children&&h.children.length>0&&(bt(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${w}".`),Ep(h.children,c,k,w,x)),!(h.path==null&&!h.index)&&c.push({path:w,score:D0(w,h.index),routesMeta:k})};return i.forEach((h,p)=>{if(h.path===""||!h.path?.includes("?"))d(h,p);else for(let x of Ap(h.path))d(h,p,!0,x)}),c}function Ap(i){let c=i.split("/");if(c.length===0)return[];let[r,...u]=c,f=r.endsWith("?"),d=r.replace(/\?$/,"");if(u.length===0)return f?[d,""]:[d];let h=Ap(u.join("/")),p=[];return p.push(...h.map(x=>x===""?d:[d,x].join("/"))),f&&p.push(...h),p.map(x=>i.startsWith("/")&&x===""?"/":x)}function C0(i){i.sort((c,r)=>c.score!==r.score?r.score-c.score:T0(c.routesMeta.map(u=>u.childrenIndex),r.routesMeta.map(u=>u.childrenIndex)))}var k0=/^:[\w-]+$/,E0=3,A0=2,z0=1,R0=10,O0=-2,ap=i=>i==="*";function D0(i,c){let r=i.split("/"),u=r.length;return r.some(ap)&&(u+=O0),c&&(u+=A0),r.filter(f=>!ap(f)).reduce((f,d)=>f+(k0.test(d)?E0:d===""?z0:R0),u)}function T0(i,c){return i.length===c.length&&i.slice(0,-1).every((u,f)=>u===c[f])?i[i.length-1]-c[c.length-1]:0}function M0(i,c,r=!1){let{routesMeta:u}=i,f={},d="/",h=[];for(let p=0;p<u.length;++p){let x=u[p],g=p===u.length-1,C=d==="/"?c:c.slice(d.length)||"/",w=ur({path:x.relativePath,caseSensitive:x.caseSensitive,end:g},C),k=x.route;if(!w&&g&&r&&!u[u.length-1].route.index&&(w=ur({path:x.relativePath,caseSensitive:x.caseSensitive,end:!1},C)),!w)return null;Object.assign(f,w.params),h.push({params:f,pathname:Za([d,w.pathname]),pathnameBase:q0(Za([d,w.pathnameBase])),route:k}),w.pathnameBase!=="/"&&(d=Za([d,w.pathnameBase]))}return h}function ur(i,c){typeof i=="string"&&(i={path:i,caseSensitive:!1,end:!0});let[r,u]=U0(i.path,i.caseSensitive,i.end),f=c.match(r);if(!f)return null;let d=f[0],h=d.replace(/(.)\/+$/,"$1"),p=f.slice(1);return{params:u.reduce((g,{paramName:C,isOptional:w},k)=>{if(C==="*"){let _=p[k]||"";h=d.slice(0,d.length-_.length).replace(/(.)\/+$/,"$1")}const y=p[k];return w&&!y?g[C]=void 0:g[C]=(y||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:h,pattern:i}}function U0(i,c=!1,r=!0){Ca(i==="*"||!i.endsWith("*")||i.endsWith("/*"),`Route path "${i}" will be treated as if it were "${i.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${i.replace(/\*$/,"/*")}".`);let u=[],f="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,p,x)=>(u.push({paramName:p,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return i.endsWith("*")?(u.push({paramName:"*"}),f+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?f+="\\/*$":i!==""&&i!=="/"&&(f+="(?:(?=\\/|$))"),[new RegExp(f,c?void 0:"i"),u]}function L0(i){try{return i.split("/").map(c=>decodeURIComponent(c).replace(/\//g,"%2F")).join("/")}catch(c){return Ca(!1,`The URL path "${i}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${c}).`),i}}function $a(i,c){if(c==="/")return i;if(!i.toLowerCase().startsWith(c.toLowerCase()))return null;let r=c.endsWith("/")?c.length-1:c.length,u=i.charAt(r);return u&&u!=="/"?null:i.slice(r)||"/"}var B0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function H0(i,c="/"){let{pathname:r,search:u="",hash:f=""}=typeof i=="string"?zl(i):i,d;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?d=np(r.substring(1),"/"):d=np(r,c)):d=c,{pathname:d,search:K0(u),hash:I0(f)}}function np(i,c){let r=c.replace(/\/+$/,"").split("/");return i.split("/").forEach(f=>{f===".."?r.length>1&&r.pop():f!=="."&&r.push(f)}),r.length>1?r.join("/"):"/"}function Uc(i,c,r,u){return`Cannot include a '${i}' character in a manually specified \`to.${c}\` field [${JSON.stringify(u)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Y0(i){return i.filter((c,r)=>r===0||c.route.path&&c.route.path.length>0)}function zp(i){let c=Y0(i);return c.map((r,u)=>u===c.length-1?r.pathname:r.pathnameBase)}function Rp(i,c,r,u=!1){let f;typeof i=="string"?f=zl(i):(f={...i},bt(!f.pathname||!f.pathname.includes("?"),Uc("?","pathname","search",f)),bt(!f.pathname||!f.pathname.includes("#"),Uc("#","pathname","hash",f)),bt(!f.search||!f.search.includes("#"),Uc("#","search","hash",f)));let d=i===""||f.pathname==="",h=d?"/":f.pathname,p;if(h==null)p=r;else{let w=c.length-1;if(!u&&h.startsWith("..")){let k=h.split("/");for(;k[0]==="..";)k.shift(),w-=1;f.pathname=k.join("/")}p=w>=0?c[w]:"/"}let x=H0(f,p),g=h&&h!=="/"&&h.endsWith("/"),C=(d||h===".")&&r.endsWith("/");return!x.pathname.endsWith("/")&&(g||C)&&(x.pathname+="/"),x}var Za=i=>i.join("/").replace(/\/\/+/g,"/"),q0=i=>i.replace(/\/+$/,"").replace(/^\/*/,"/"),K0=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,I0=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i,G0=class{constructor(i,c,r,u=!1){this.status=i,this.statusText=c||"",this.internal=u,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function V0(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}function X0(i){return i.map(c=>c.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Op=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Dp(i,c){let r=i;if(typeof r!="string"||!B0.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let u=r,f=!1;if(Op)try{let d=new URL(window.location.href),h=r.startsWith("//")?new URL(d.protocol+r):new URL(r),p=$a(h.pathname,c);h.origin===d.origin&&p!=null?r=p+h.search+h.hash:f=!0}catch{Ca(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:u,isExternal:f,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Tp=["POST","PUT","PATCH","DELETE"];new Set(Tp);var Z0=["GET",...Tp];new Set(Z0);var Rl=E.createContext(null);Rl.displayName="DataRouter";var pr=E.createContext(null);pr.displayName="DataRouterState";var $0=E.createContext(!1),Mp=E.createContext({isTransitioning:!1});Mp.displayName="ViewTransition";var Q0=E.createContext(new Map);Q0.displayName="Fetchers";var F0=E.createContext(null);F0.displayName="Await";var ha=E.createContext(null);ha.displayName="Navigation";var Ai=E.createContext(null);Ai.displayName="Location";var ka=E.createContext({outlet:null,matches:[],isDataRoute:!1});ka.displayName="Route";var Wc=E.createContext(null);Wc.displayName="RouteError";var Up="REACT_ROUTER_ERROR",P0="REDIRECT",J0="ROUTE_ERROR_RESPONSE";function W0(i){if(i.startsWith(`${Up}:${P0}:{`))try{let c=JSON.parse(i.slice(28));if(typeof c=="object"&&c&&typeof c.status=="number"&&typeof c.statusText=="string"&&typeof c.location=="string"&&typeof c.reloadDocument=="boolean"&&typeof c.replace=="boolean")return c}catch{}}function eg(i){if(i.startsWith(`${Up}:${J0}:{`))try{let c=JSON.parse(i.slice(40));if(typeof c=="object"&&c&&typeof c.status=="number"&&typeof c.statusText=="string")return new G0(c.status,c.statusText,c.data)}catch{}}function tg(i,{relative:c}={}){bt(zi(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:u}=E.useContext(ha),{hash:f,pathname:d,search:h}=Ri(i,{relative:c}),p=d;return r!=="/"&&(p=d==="/"?r:Za([r,d])),u.createHref({pathname:p,search:h,hash:f})}function zi(){return E.useContext(Ai)!=null}function wn(){return bt(zi(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(Ai).location}var Lp="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Bp(i){E.useContext(ha).static||E.useLayoutEffect(i)}function Xn(){let{isDataRoute:i}=E.useContext(ka);return i?pg():ag()}function ag(){bt(zi(),"useNavigate() may be used only in the context of a <Router> component.");let i=E.useContext(Rl),{basename:c,navigator:r}=E.useContext(ha),{matches:u}=E.useContext(ka),{pathname:f}=wn(),d=JSON.stringify(zp(u)),h=E.useRef(!1);return Bp(()=>{h.current=!0}),E.useCallback((x,g={})=>{if(Ca(h.current,Lp),!h.current)return;if(typeof x=="number"){r.go(x);return}let C=Rp(x,JSON.parse(d),f,g.relative==="path");i==null&&c!=="/"&&(C.pathname=C.pathname==="/"?c:Za([c,C.pathname])),(g.replace?r.replace:r.push)(C,g.state,g)},[c,r,d,f,i])}E.createContext(null);function Hp(){let{matches:i}=E.useContext(ka),c=i[i.length-1];return c?c.params:{}}function Ri(i,{relative:c}={}){let{matches:r}=E.useContext(ka),{pathname:u}=wn(),f=JSON.stringify(zp(r));return E.useMemo(()=>Rp(i,JSON.parse(f),u,c==="path"),[i,f,u,c])}function ng(i,c){return Yp(i,c)}function Yp(i,c,r,u,f){bt(zi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=E.useContext(ha),{matches:h}=E.useContext(ka),p=h[h.length-1],x=p?p.params:{},g=p?p.pathname:"/",C=p?p.pathnameBase:"/",w=p&&p.route;{let S=w&&w.path||"";Kp(g,!w||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
+
11
+ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let k=wn(),y;if(c){let S=typeof c=="string"?zl(c):c;bt(C==="/"||S.pathname?.startsWith(C),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${C}" but pathname "${S.pathname}" was given in the \`location\` prop.`),y=S}else y=k;let _=y.pathname||"/",m=_;if(C!=="/"){let S=C.replace(/^\//,"").split("/");m="/"+_.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=kp(i,{pathname:m});Ca(w||b!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Ca(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=og(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},x,S.params),pathname:Za([C,d.encodeLocation?d.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?C:Za([C,d.encodeLocation?d.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),h,r,u,f);return c&&j?E.createElement(Ai.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},j):j}function lg(){let i=hg(),c=V0(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),r=i instanceof Error?i.stack:null,u="rgba(200,200,200, 0.5)",f={padding:"0.5rem",backgroundColor:u},d={padding:"2px 4px",backgroundColor:u},h=null;return console.error("Error handled by React Router default ErrorBoundary:",i),h=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:d},"ErrorBoundary")," or"," ",E.createElement("code",{style:d},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},c),r?E.createElement("pre",{style:f},r):null,h)}var ig=E.createElement(lg,null),qp=class extends E.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,c){return c.location!==i.location||c.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:c.error,location:c.location,revalidation:i.revalidation||c.revalidation}}componentDidCatch(i,c){this.props.onError?this.props.onError(i,c):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const r=eg(i.digest);r&&(i=r)}let c=i!==void 0?E.createElement(ka.Provider,{value:this.props.routeContext},E.createElement(Wc.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?E.createElement(sg,{error:i},c):c}};qp.contextType=$0;var Lc=new WeakMap;function sg({children:i,error:c}){let{basename:r}=E.useContext(ha);if(typeof c=="object"&&c&&"digest"in c&&typeof c.digest=="string"){let u=W0(c.digest);if(u){let f=Lc.get(c);if(f)throw f;let d=Dp(u.location,r);if(Op&&!Lc.get(c))if(d.isExternal||u.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:u.replace}));throw Lc.set(c,h),h}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return i}function rg({routeContext:i,match:c,children:r}){let u=E.useContext(Rl);return u&&u.static&&u.staticContext&&(c.route.errorElement||c.route.ErrorBoundary)&&(u.staticContext._deepestRenderedBoundaryId=c.route.id),E.createElement(ka.Provider,{value:i},r)}function og(i,c=[],r=null,u=null,f=null){if(i==null){if(!r)return null;if(r.errors)i=r.matches;else if(c.length===0&&!r.initialized&&r.matches.length>0)i=r.matches;else return null}let d=i,h=r?.errors;if(h!=null){let C=d.findIndex(w=>w.route.id&&h?.[w.route.id]!==void 0);bt(C>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,C+1))}let p=!1,x=-1;if(r)for(let C=0;C<d.length;C++){let w=d[C];if((w.route.HydrateFallback||w.route.hydrateFallbackElement)&&(x=C),w.route.id){let{loaderData:k,errors:y}=r,_=w.route.loader&&!k.hasOwnProperty(w.route.id)&&(!y||y[w.route.id]===void 0);if(w.route.lazy||_){p=!0,x>=0?d=d.slice(0,x+1):d=[d[0]];break}}}let g=r&&u?(C,w)=>{u(C,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:X0(r.matches),errorInfo:w})}:void 0;return d.reduceRight((C,w,k)=>{let y,_=!1,m=null,b=null;r&&(y=h&&w.route.id?h[w.route.id]:void 0,m=w.route.errorElement||ig,p&&(x<0&&k===0?(Kp("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,b=null):x===k&&(_=!0,b=w.route.hydrateFallbackElement||null)));let j=c.concat(d.slice(0,k+1)),S=()=>{let A;return y?A=m:_?A=b:w.route.Component?A=E.createElement(w.route.Component,null):w.route.element?A=w.route.element:A=C,E.createElement(rg,{match:w,routeContext:{outlet:C,matches:j,isDataRoute:r!=null},children:A})};return r&&(w.route.ErrorBoundary||w.route.errorElement||k===0)?E.createElement(qp,{location:r.location,revalidation:r.revalidation,component:m,error:y,children:S(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:g}):S()},null)}function eu(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cg(i){let c=E.useContext(Rl);return bt(c,eu(i)),c}function ug(i){let c=E.useContext(pr);return bt(c,eu(i)),c}function dg(i){let c=E.useContext(ka);return bt(c,eu(i)),c}function tu(i){let c=dg(i),r=c.matches[c.matches.length-1];return bt(r.route.id,`${i} can only be used on routes that contain a unique "id"`),r.route.id}function fg(){return tu("useRouteId")}function hg(){let i=E.useContext(Wc),c=ug("useRouteError"),r=tu("useRouteError");return i!==void 0?i:c.errors?.[r]}function pg(){let{router:i}=cg("useNavigate"),c=tu("useNavigate"),r=E.useRef(!1);return Bp(()=>{r.current=!0}),E.useCallback(async(f,d={})=>{Ca(r.current,Lp),r.current&&(typeof f=="number"?await i.navigate(f):await i.navigate(f,{fromRouteId:c,...d}))},[i,c])}var lp={};function Kp(i,c,r){!c&&!lp[i]&&(lp[i]=!0,Ca(!1,r))}E.memo(mg);function mg({routes:i,future:c,state:r,onError:u}){return Yp(i,void 0,r,u,c)}function _a(i){bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function xg({basename:i="/",children:c=null,location:r,navigationType:u="POP",navigator:f,static:d=!1,unstable_useTransitions:h}){bt(!zi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=i.replace(/^\/*/,"/"),x=E.useMemo(()=>({basename:p,navigator:f,static:d,unstable_useTransitions:h,future:{}}),[p,f,d,h]);typeof r=="string"&&(r=zl(r));let{pathname:g="/",search:C="",hash:w="",state:k=null,key:y="default"}=r,_=E.useMemo(()=>{let m=$a(g,p);return m==null?null:{location:{pathname:m,search:C,hash:w,state:k,key:y},navigationType:u}},[p,g,C,w,k,y,u]);return Ca(_!=null,`<Router basename="${p}"> is not able to match the URL "${g}${C}${w}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:E.createElement(ha.Provider,{value:x},E.createElement(Ai.Provider,{children:c,value:_}))}function gg({children:i,location:c}){return ng(Xc(i),c)}function Xc(i,c=[]){let r=[];return E.Children.forEach(i,(u,f)=>{if(!E.isValidElement(u))return;let d=[...c,f];if(u.type===E.Fragment){r.push.apply(r,Xc(u.props.children,d));return}bt(u.type===_a,`[${typeof u.type=="string"?u.type:u.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),bt(!u.props.index||!u.props.children,"An index route cannot have child routes.");let h={id:u.props.id||d.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,middleware:u.props.middleware,loader:u.props.loader,action:u.props.action,hydrateFallbackElement:u.props.hydrateFallbackElement,HydrateFallback:u.props.HydrateFallback,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.hasErrorBoundary===!0||u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(h.children=Xc(u.props.children,d)),r.push(h)}),r}var or="get",cr="application/x-www-form-urlencoded";function mr(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function bg(i){return mr(i)&&i.tagName.toLowerCase()==="button"}function yg(i){return mr(i)&&i.tagName.toLowerCase()==="form"}function vg(i){return mr(i)&&i.tagName.toLowerCase()==="input"}function wg(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function jg(i,c){return i.button===0&&(!c||c==="_self")&&!wg(i)}var Js=null;function Sg(){if(Js===null)try{new FormData(document.createElement("form"),0),Js=!1}catch{Js=!0}return Js}var Ng=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Bc(i){return i!=null&&!Ng.has(i)?(Ca(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${cr}"`),null):i}function _g(i,c){let r,u,f,d,h;if(yg(i)){let p=i.getAttribute("action");u=p?$a(p,c):null,r=i.getAttribute("method")||or,f=Bc(i.getAttribute("enctype"))||cr,d=new FormData(i)}else if(bg(i)||vg(i)&&(i.type==="submit"||i.type==="image")){let p=i.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let x=i.getAttribute("formaction")||p.getAttribute("action");if(u=x?$a(x,c):null,r=i.getAttribute("formmethod")||p.getAttribute("method")||or,f=Bc(i.getAttribute("formenctype"))||Bc(p.getAttribute("enctype"))||cr,d=new FormData(p,i),!Sg()){let{name:g,type:C,value:w}=i;if(C==="image"){let k=g?`${g}.`:"";d.append(`${k}x`,"0"),d.append(`${k}y`,"0")}else g&&d.append(g,w)}}else{if(mr(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=or,u=null,f=cr,h=i}return d&&f==="text/plain"&&(h=d,d=void 0),{action:u,method:r.toLowerCase(),encType:f,formData:d,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function au(i,c){if(i===!1||i===null||typeof i>"u")throw new Error(c)}function Cg(i,c,r,u){let f=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return r?f.pathname.endsWith("/")?f.pathname=`${f.pathname}_.${u}`:f.pathname=`${f.pathname}.${u}`:f.pathname==="/"?f.pathname=`_root.${u}`:c&&$a(f.pathname,c)==="/"?f.pathname=`${c.replace(/\/$/,"")}/_root.${u}`:f.pathname=`${f.pathname.replace(/\/$/,"")}.${u}`,f}async function kg(i,c){if(i.id in c)return c[i.id];try{let r=await import(i.module);return c[i.id]=r,r}catch(r){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Eg(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function Ag(i,c,r){let u=await Promise.all(i.map(async f=>{let d=c.routes[f.route.id];if(d){let h=await kg(d,r);return h.links?h.links():[]}return[]}));return Dg(u.flat(1).filter(Eg).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function ip(i,c,r,u,f,d){let h=(x,g)=>r[g]?x.route.id!==r[g].route.id:!0,p=(x,g)=>r[g].pathname!==x.pathname||r[g].route.path?.endsWith("*")&&r[g].params["*"]!==x.params["*"];return d==="assets"?c.filter((x,g)=>h(x,g)||p(x,g)):d==="data"?c.filter((x,g)=>{let C=u.routes[x.route.id];if(!C||!C.hasLoader)return!1;if(h(x,g)||p(x,g))return!0;if(x.route.shouldRevalidate){let w=x.route.shouldRevalidate({currentUrl:new URL(f.pathname+f.search+f.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(i,window.origin),nextParams:x.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function zg(i,c,{includeHydrateFallback:r}={}){return Rg(i.map(u=>{let f=c.routes[u.route.id];if(!f)return[];let d=[f.module];return f.clientActionModule&&(d=d.concat(f.clientActionModule)),f.clientLoaderModule&&(d=d.concat(f.clientLoaderModule)),r&&f.hydrateFallbackModule&&(d=d.concat(f.hydrateFallbackModule)),f.imports&&(d=d.concat(f.imports)),d}).flat(1))}function Rg(i){return[...new Set(i)]}function Og(i){let c={},r=Object.keys(i).sort();for(let u of r)c[u]=i[u];return c}function Dg(i,c){let r=new Set;return new Set(c),i.reduce((u,f)=>{let d=JSON.stringify(Og(f));return r.has(d)||(r.add(d),u.push({key:d,link:f})),u},[])}function Ip(){let i=E.useContext(Rl);return au(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function Tg(){let i=E.useContext(pr);return au(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var nu=E.createContext(void 0);nu.displayName="FrameworkContext";function Gp(){let i=E.useContext(nu);return au(i,"You must render this element inside a <HydratedRouter> element"),i}function Mg(i,c){let r=E.useContext(nu),[u,f]=E.useState(!1),[d,h]=E.useState(!1),{onFocus:p,onBlur:x,onMouseEnter:g,onMouseLeave:C,onTouchStart:w}=c,k=E.useRef(null);E.useEffect(()=>{if(i==="render"&&h(!0),i==="viewport"){let m=j=>{j.forEach(S=>{h(S.isIntersecting)})},b=new IntersectionObserver(m,{threshold:.5});return k.current&&b.observe(k.current),()=>{b.disconnect()}}},[i]),E.useEffect(()=>{if(u){let m=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(m)}}},[u]);let y=()=>{f(!0)},_=()=>{f(!1),h(!1)};return r?i!=="intent"?[d,k,{}]:[d,k,{onFocus:_i(p,y),onBlur:_i(x,_),onMouseEnter:_i(g,y),onMouseLeave:_i(C,_),onTouchStart:_i(w,y)}]:[!1,k,{}]}function _i(i,c){return r=>{i&&i(r),r.defaultPrevented||c(r)}}function Ug({page:i,...c}){let{router:r}=Ip(),u=E.useMemo(()=>kp(r.routes,i,r.basename),[r.routes,i,r.basename]);return u?E.createElement(Bg,{page:i,matches:u,...c}):null}function Lg(i){let{manifest:c,routeModules:r}=Gp(),[u,f]=E.useState([]);return E.useEffect(()=>{let d=!1;return Ag(i,c,r).then(h=>{d||f(h)}),()=>{d=!0}},[i,c,r]),u}function Bg({page:i,matches:c,...r}){let u=wn(),{future:f,manifest:d,routeModules:h}=Gp(),{basename:p}=Ip(),{loaderData:x,matches:g}=Tg(),C=E.useMemo(()=>ip(i,c,g,d,u,"data"),[i,c,g,d,u]),w=E.useMemo(()=>ip(i,c,g,d,u,"assets"),[i,c,g,d,u]),k=E.useMemo(()=>{if(i===u.pathname+u.search+u.hash)return[];let m=new Set,b=!1;if(c.forEach(S=>{let A=d.routes[S.route.id];!A||!A.hasLoader||(!C.some(M=>M.route.id===S.route.id)&&S.route.id in x&&h[S.route.id]?.shouldRevalidate||A.hasClientLoader?b=!0:m.add(S.route.id))}),m.size===0)return[];let j=Cg(i,p,f.unstable_trailingSlashAwareDataRequests,"data");return b&&m.size>0&&j.searchParams.set("_routes",c.filter(S=>m.has(S.route.id)).map(S=>S.route.id).join(",")),[j.pathname+j.search]},[p,f.unstable_trailingSlashAwareDataRequests,x,u,d,C,c,i,h]),y=E.useMemo(()=>zg(w,d),[w,d]),_=Lg(w);return E.createElement(E.Fragment,null,k.map(m=>E.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})),y.map(m=>E.createElement("link",{key:m,rel:"modulepreload",href:m,...r})),_.map(({key:m,link:b})=>E.createElement("link",{key:m,nonce:r.nonce,...b,crossOrigin:b.crossOrigin??r.crossOrigin})))}function Hg(...i){return c=>{i.forEach(r=>{typeof r=="function"?r(c):r!=null&&(r.current=c)})}}var Yg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Yg&&(window.__reactRouterVersion="7.13.0")}catch{}function qg({basename:i,children:c,unstable_useTransitions:r,window:u}){let f=E.useRef();f.current==null&&(f.current=w0({window:u,v5Compat:!0}));let d=f.current,[h,p]=E.useState({action:d.action,location:d.location}),x=E.useCallback(g=>{r===!1?p(g):E.startTransition(()=>p(g))},[r]);return E.useLayoutEffect(()=>d.listen(x),[d,x]),E.createElement(xg,{basename:i,children:c,location:h.location,navigationType:h.action,navigator:d,unstable_useTransitions:r})}var Vp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xp=E.forwardRef(function({onClick:c,discover:r="render",prefetch:u="none",relative:f,reloadDocument:d,replace:h,state:p,target:x,to:g,preventScrollReset:C,viewTransition:w,unstable_defaultShouldRevalidate:k,...y},_){let{basename:m,unstable_useTransitions:b}=E.useContext(ha),j=typeof g=="string"&&Vp.test(g),S=Dp(g,m);g=S.to;let A=tg(g,{relative:f}),[M,O,U]=Mg(u,y),L=Vg(g,{replace:h,state:p,target:x,preventScrollReset:C,relative:f,viewTransition:w,unstable_defaultShouldRevalidate:k,unstable_useTransitions:b});function I(de){c&&c(de),de.defaultPrevented||L(de)}let V=E.createElement("a",{...y,...U,href:S.absoluteURL||A,onClick:S.isExternal||d?c:I,ref:Hg(_,O),target:x,"data-discover":!j&&r==="render"?"true":void 0});return M&&!j?E.createElement(E.Fragment,null,V,E.createElement(Ug,{page:A})):V});Xp.displayName="Link";var Kg=E.forwardRef(function({"aria-current":c="page",caseSensitive:r=!1,className:u="",end:f=!1,style:d,to:h,viewTransition:p,children:x,...g},C){let w=Ri(h,{relative:g.relative}),k=wn(),y=E.useContext(pr),{navigator:_,basename:m}=E.useContext(ha),b=y!=null&&Fg(w)&&p===!0,j=_.encodeLocation?_.encodeLocation(w).pathname:w.pathname,S=k.pathname,A=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(S=S.toLowerCase(),A=A?A.toLowerCase():null,j=j.toLowerCase()),A&&m&&(A=$a(A,m)||A);const M=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let O=S===j||!f&&S.startsWith(j)&&S.charAt(M)==="/",U=A!=null&&(A===j||!f&&A.startsWith(j)&&A.charAt(j.length)==="/"),L={isActive:O,isPending:U,isTransitioning:b},I=O?c:void 0,V;typeof u=="function"?V=u(L):V=[u,O?"active":null,U?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let de=typeof d=="function"?d(L):d;return E.createElement(Xp,{...g,"aria-current":I,className:V,ref:C,style:de,to:h,viewTransition:p},typeof x=="function"?x(L):x)});Kg.displayName="NavLink";var Ig=E.forwardRef(({discover:i="render",fetcherKey:c,navigate:r,reloadDocument:u,replace:f,state:d,method:h=or,action:p,onSubmit:x,relative:g,preventScrollReset:C,viewTransition:w,unstable_defaultShouldRevalidate:k,...y},_)=>{let{unstable_useTransitions:m}=E.useContext(ha),b=$g(),j=Qg(p,{relative:g}),S=h.toLowerCase()==="get"?"get":"post",A=typeof p=="string"&&Vp.test(p),M=O=>{if(x&&x(O),O.defaultPrevented)return;O.preventDefault();let U=O.nativeEvent.submitter,L=U?.getAttribute("formmethod")||h,I=()=>b(U||O.currentTarget,{fetcherKey:c,method:L,navigate:r,replace:f,state:d,relative:g,preventScrollReset:C,viewTransition:w,unstable_defaultShouldRevalidate:k});m&&r!==!1?E.startTransition(()=>I()):I()};return E.createElement("form",{ref:_,method:S,action:j,onSubmit:u?x:M,...y,"data-discover":!A&&i==="render"?"true":void 0})});Ig.displayName="Form";function Gg(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Zp(i){let c=E.useContext(Rl);return bt(c,Gg(i)),c}function Vg(i,{target:c,replace:r,state:u,preventScrollReset:f,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:p,unstable_useTransitions:x}={}){let g=Xn(),C=wn(),w=Ri(i,{relative:d});return E.useCallback(k=>{if(jg(k,c)){k.preventDefault();let y=r!==void 0?r:ki(C)===ki(w),_=()=>g(i,{replace:y,state:u,preventScrollReset:f,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:p});x?E.startTransition(()=>_()):_()}},[C,g,w,r,u,c,i,f,d,h,p,x])}var Xg=0,Zg=()=>`__${String(++Xg)}__`;function $g(){let{router:i}=Zp("useSubmit"),{basename:c}=E.useContext(ha),r=fg(),u=i.fetch,f=i.navigate;return E.useCallback(async(d,h={})=>{let{action:p,method:x,encType:g,formData:C,body:w}=_g(d,c);if(h.navigate===!1){let k=h.fetcherKey||Zg();await u(k,r,h.action||p,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:C,body:w,formMethod:h.method||x,formEncType:h.encType||g,flushSync:h.flushSync})}else await f(h.action||p,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:C,body:w,formMethod:h.method||x,formEncType:h.encType||g,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[u,f,c,r])}function Qg(i,{relative:c}={}){let{basename:r}=E.useContext(ha),u=E.useContext(ka);bt(u,"useFormAction must be used inside a RouteContext");let[f]=u.matches.slice(-1),d={...Ri(i||".",{relative:c})},h=wn();if(i==null){d.search=h.search;let p=new URLSearchParams(d.search),x=p.getAll("index");if(x.some(C=>C==="")){p.delete("index"),x.filter(w=>w).forEach(w=>p.append("index",w));let C=p.toString();d.search=C?`?${C}`:""}}return(!i||i===".")&&f.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(d.pathname=d.pathname==="/"?r:Za([r,d.pathname])),ki(d)}function Fg(i,{relative:c}={}){let r=E.useContext(Mp);bt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:u}=Zp("useViewTransitionState"),f=Ri(i,{relative:c});if(!r.isTransitioning)return!1;let d=$a(r.currentLocation.pathname,u)||r.currentLocation.pathname,h=$a(r.nextLocation.pathname,u)||r.nextLocation.pathname;return ur(f.pathname,h)!=null||ur(f.pathname,d)!=null}var Ei=Cp();const ue=tt.memo(({name:i,className:c="",fill:r=!1})=>l.jsx("span",{className:`material-symbols-outlined ${c}`,style:{fontVariationSettings:r?"'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24":"'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24"},"aria-hidden":"true",children:i})),Pg=({onNavigate:i,onNewTask:c,onLogout:r,currentScreen:u})=>l.jsxs("aside",{className:"w-20 h-full border-r border-white/10 glass flex flex-col items-center py-8 shrink-0 z-50",children:[l.jsx("button",{onClick:()=>i("dashboard"),className:"mb-12 hover:opacity-80 transition-opacity focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded-lg","aria-label":"Go to Dashboard (Alt + 1)",title:"Go to Dashboard (Alt + 1)",children:l.jsx("img",{src:"/figranium_icon.svg",alt:"Figranium Logo",className:"w-10 h-10",onError:f=>{f.currentTarget.src="/figranium_icon.svg"}})}),l.jsxs("div",{className:"flex-1 flex flex-col gap-6",children:[l.jsx("button",{onClick:c,className:"w-12 h-12 rounded-2xl flex items-center justify-center text-white bg-white/5 hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"New Task (Alt + N)","aria-label":"New Task (Alt + N)",children:l.jsx(ue,{name:"add",className:"text-2xl"})}),l.jsx("button",{onClick:()=>i("dashboard"),className:`w-12 h-12 rounded-2xl flex items-center justify-center transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${u==="dashboard"?"bg-white/10 text-white":"text-gray-500 hover:bg-white/5 hover:text-white"}`,title:"Dashboard (Alt + 1)","aria-label":"Dashboard (Alt + 1)",children:l.jsx(ue,{name:"home",className:"text-2xl"})}),l.jsx("button",{onClick:()=>i("settings"),className:`w-12 h-12 rounded-2xl flex items-center justify-center transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${u==="settings"?"bg-white/10 text-white":"text-gray-500 hover:bg-white/5 hover:text-white"}`,title:"Settings (Alt + 2)","aria-label":"Settings (Alt + 2)",children:l.jsx(ue,{name:"settings",className:"text-2xl"})}),l.jsx("button",{onClick:()=>i("executions"),className:`w-12 h-12 rounded-2xl flex items-center justify-center transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${u==="executions"?"bg-white/10 text-white":"text-gray-500 hover:bg-white/5 hover:text-white"}`,title:"Executions (Alt + 3)","aria-label":"Executions (Alt + 3)",children:l.jsx(ue,{name:"history",className:"text-2xl"})}),l.jsx("button",{onClick:()=>i("captures"),className:`w-12 h-12 rounded-2xl flex items-center justify-center transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${u==="captures"?"bg-white/10 text-white":"text-gray-500 hover:bg-white/5 hover:text-white"}`,title:"Captures (Alt + 4)","aria-label":"Captures (Alt + 4)",children:l.jsx(ue,{name:"photo_camera",className:"text-2xl"})})]}),l.jsx("button",{onClick:r,className:"w-12 h-12 rounded-2xl flex items-center justify-center text-gray-500 hover:bg-red-500/10 hover:text-red-500 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Logout (Alt + L)","aria-label":"Logout (Alt + L)",children:l.jsx(ue,{name:"logout",className:"text-2xl"})})]}),Jg=tt.memo(Pg),Wg=({status:i,onSubmit:c,error:r,busy:u=!1})=>{const[f,d]=E.useState(""),[h,p]=E.useState(""),[x,g]=E.useState(""),[C,w]=E.useState(""),[k,y]=E.useState(!1),[_,m]=E.useState(!1),b=S=>{S.preventDefault(),c(h,x,f,C)},j=i==="setup"?u?"Creating account...":"Create Account":u?"Authenticating...":"Authenticate";return l.jsxs("div",{className:"fixed inset-0 z-[100] bg-[#020202] flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",style:{backgroundImage:"radial-gradient(#fff 1px, transparent 1px)",backgroundSize:"40px 40px"}}),l.jsxs("div",{className:"w-[400px] glass-card p-10 rounded-[48px] space-y-8 relative",children:[l.jsx("div",{className:"text-center space-y-3",children:l.jsx("img",{src:"/figranium_logo.svg",alt:"Figranium",className:"h-24 mx-auto object-contain"})}),l.jsxs("form",{onSubmit:b,className:"space-y-8",children:[l.jsxs("div",{className:"space-y-4",children:[i==="setup"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"auth-name",className:"text-[9px] font-bold text-gray-400 uppercase tracking-[0.2em]",children:"Name"}),l.jsx("input",{id:"auth-name",type:"text",value:f,onChange:S=>d(S.target.value),placeholder:"Full Name",className:"w-full bg-white/[0.05] border border-white/10 rounded-2xl px-5 py-4 text-sm focus:outline-none focus:border-white/30 focus-visible:ring-2 focus-visible:ring-white/50 transition-all placeholder:text-gray-600",autoComplete:"name"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"auth-email",className:"text-[9px] font-bold text-gray-400 uppercase tracking-[0.2em]",children:"Email"}),l.jsx("input",{id:"auth-email",type:"email",value:h,onChange:S=>p(S.target.value),placeholder:"user@example.com",className:"w-full bg-white/[0.05] border border-white/10 rounded-2xl px-5 py-4 text-sm focus:outline-none focus:border-white/30 focus-visible:ring-2 focus-visible:ring-white/50 transition-all placeholder:text-gray-600",required:!0,autoComplete:"email"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"auth-pass",className:"text-[9px] font-bold text-gray-400 uppercase tracking-[0.2em]",children:"Password"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-pass",type:k?"text":"password",value:x,onChange:S=>g(S.target.value),placeholder:"••••••••",className:"w-full bg-white/[0.05] border border-white/10 rounded-2xl px-5 py-4 pr-12 text-sm focus:outline-none focus:border-white/30 focus-visible:ring-2 focus-visible:ring-white/50 transition-all placeholder:text-gray-600",required:!0,autoComplete:i==="setup"?"new-password":"current-password"}),l.jsx("button",{type:"button",onClick:()=>y(!k),className:"absolute right-4 top-1/2 -translate-y-1/2 p-1.5 rounded-lg text-white/30 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":k?"Hide password":"Show password",title:k?"Hide password":"Show password",children:l.jsx(ue,{name:k?"visibility_off":"visibility",className:"text-lg"})})]})]}),i==="setup"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"auth-pass-confirm",className:"text-[9px] font-bold text-gray-400 uppercase tracking-[0.2em]",children:"Confirm Password"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-pass-confirm",type:_?"text":"password",value:C,onChange:S=>w(S.target.value),placeholder:"••••••••",className:"w-full bg-white/[0.05] border border-white/10 rounded-2xl px-5 py-4 pr-12 text-sm focus:outline-none focus:border-white/30 focus-visible:ring-2 focus-visible:ring-white/50 transition-all placeholder:text-gray-600",required:!0,autoComplete:"new-password"}),l.jsx("button",{type:"button",onClick:()=>m(!_),className:"absolute right-4 top-1/2 -translate-y-1/2 p-1.5 rounded-lg text-white/30 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":_?"Hide password confirmation":"Show password confirmation",title:_?"Hide password confirmation":"Show password confirmation",children:l.jsx(ue,{name:_?"visibility_off":"visibility",className:"text-lg"})})]})]})]}),l.jsxs("button",{type:"submit",disabled:u,"aria-busy":u,className:"shine-effect w-full bg-white text-black py-4 rounded-2xl font-bold text-[10px] tracking-[0.3em] uppercase hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-60 disabled:cursor-default flex items-center justify-center gap-3 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:[u&&l.jsx("div",{className:"w-4 h-4 border-2 border-black/10 border-t-black rounded-full animate-spin"}),j]}),r&&l.jsx("div",{role:"alert",className:"text-[9px] font-bold text-red-500 text-center uppercase tracking-widest",children:r})]})]})]})},eb=async i=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(i),!0;{const c=document.createElement("textarea");c.value=i,c.style.position="fixed",c.style.left="-999999px",c.style.top="-999999px",document.body.appendChild(c),c.focus(),c.select();const r=document.execCommand("copy");return c.remove(),r}}catch(c){return console.error("Copy failed:",c),!1}},Vn=({text:i,label:c,className:r,iconClassName:u,onCopy:f,title:d,disabled:h=!1})=>{const[p,x]=E.useState(!1),g=async _=>{if(_.stopPropagation(),h)return;await eb(i)&&(x(!0),f?.(),setTimeout(()=>x(!1),2e3))},C="flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all text-[9px] font-bold uppercase tracking-widest disabled:opacity-50 disabled:cursor-not-allowed",w="focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",k=r?`${r} ${w}`:`${C} ${w}`,y=p?k.replace("border-white/10","border-green-400 text-green-400"):k;return l.jsxs("button",{onClick:g,disabled:h,className:y,title:d||(p?"Copied":"Copy"),type:"button","aria-label":c||d||"Copy to clipboard",children:[p?l.jsx(ue,{name:"check",className:`${u||"text-sm"} text-green-400`}):l.jsx(ue,{name:"content_copy",className:u||"text-sm"}),c&&l.jsx("span",{children:p?"Copied":c})]})},tb=i=>{if(!i)return null;const c=i.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:/\n?]+)/im);return c?`https://www.google.com/s2/favicons?domain=${c[1]}&sz=64`:null},ab=({task:i,onEditTask:c,onDeleteTask:r})=>{const u=tb(i.url);return l.jsxs("div",{className:"bg-[#050505] border border-white/10 p-6 rounded-2xl flex flex-col gap-6 group hover:-translate-y-1 hover:border-white/30 transition-all shadow-xl hover:bg-[#0a0a0a]",children:[l.jsxs("div",{className:"flex justify-between items-start",children:[l.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/5 border border-white/10 flex items-center justify-center overflow-hidden",children:u?l.jsx("img",{src:u,alt:"",className:"w-6 h-6 object-contain grayscale opacity-100 group-hover:grayscale-0 transition-all duration-300",onError:f=>{f.target.style.display="none"}}):l.jsx(ue,{name:"public",className:"text-gray-500 text-xl"})}),l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("div",{className:"px-3 py-1 rounded-lg bg-white/5 text-[7px] font-bold uppercase tracking-widest text-white/60",children:i.mode})})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-bold text-white truncate",children:i.name||"Untitled"}),l.jsxs("div",{className:"flex items-center gap-2 mt-1 min-w-0",children:[l.jsx("p",{className:"text-[10px] text-gray-600 font-mono truncate flex-1",children:i.url||"Target undefined"}),i.url&&l.jsx(Vn,{text:i.url,title:"Copy URL",className:"p-1 rounded-md text-white/20 hover:text-white hover:bg-white/10 transition-all opacity-0 group-hover:opacity-100 focus-within:opacity-100",iconClassName:"text-[10px]"})]})]}),l.jsxs("div",{className:"flex gap-3 pt-4 border-t border-white/5",children:[l.jsx("button",{onClick:()=>c(i),className:"flex-1 py-2 rounded-lg bg-white text-black text-[9px] font-bold uppercase tracking-widest hover:scale-105 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:"Edit Task"}),l.jsx("button",{onClick:()=>r(i.id),className:"w-10 h-10 rounded-lg bg-transparent border border-white/10 flex items-center justify-center hover:bg-red-500/10 hover:text-red-500 hover:border-red-500/30 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Delete task",title:"Delete task",children:l.jsx(ue,{name:"close",className:"text-base"})})]})]})},nb=E.memo(ab),lb=({tasks:i,onNewTask:c,onEditTask:r,onDeleteTask:u,onExportTasks:f,onImportTasks:d})=>{const h=E.useRef(null),p=E.useRef(null),[x,g]=tt.useState(!1),[C,w]=tt.useState([]),[k,y]=tt.useState("");tt.useEffect(()=>{const S=A=>{A.key==="/"&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA"&&(A.preventDefault(),p.current?.focus())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]);const _=tt.useMemo(()=>{const S=k.toLowerCase().trim();return S?i.filter(A=>(A.name||"").toLowerCase().includes(S)||(A.url||"").toLowerCase().includes(S)):i},[i,k]),m=()=>{h.current?.click()},b=S=>{const A=Array.from(S.target.files||[]);A.length>0&&A.forEach(M=>d(M)),S.target.value=""},j=S=>{w(A=>A.includes(S)?A.filter(M=>M!==S):[...A,S])};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-1 overflow-hidden animate-in fade-in duration-500 bg-black",children:l.jsxs("div",{className:"h-full flex flex-col px-12 py-12 max-w-7xl mx-auto space-y-12 w-full",children:[l.jsxs("div",{className:"relative flex items-center justify-between",children:[l.jsx("h2",{className:"text-2xl font-medium tracking-[0.25em] text-white uppercase shrink-0",children:"Dashboard"}),i.length>0&&l.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 group/search w-[260px]",children:[l.jsx(ue,{name:"search",className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-500 text-lg group-focus-within/search:text-white transition-colors"}),l.jsx("input",{ref:p,type:"text",value:k,onChange:S=>y(S.target.value),placeholder:"Filter tasks... (/)",className:"w-full bg-white/[0.05] border border-white/10 rounded-2xl py-3 pl-12 pr-10 text-[10px] font-bold uppercase tracking-widest text-white placeholder:text-gray-600 focus:outline-none focus:border-white/30 focus-visible:ring-2 focus-visible:ring-white/20 transition-all","aria-label":"Filter tasks",title:"Filter tasks by name or URL (/)"}),k&&l.jsx("button",{onClick:()=>y(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white transition-colors","aria-label":"Clear filter",title:"Clear filter",children:l.jsx(ue,{name:"cancel",className:"text-base"})})]}),l.jsxs("div",{className:"flex items-center gap-5",children:[l.jsxs("button",{onClick:()=>{w([]),g(!0)},className:"px-5 py-3 rounded-2xl border border-white/10 text-white text-[9px] font-bold uppercase tracking-[0.3em] hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Export tasks","aria-label":"Export tasks",children:[l.jsx(ue,{name:"download",className:"w-4 h-4 inline-block mr-2 text-[16px] align-sub"}),"Export"]}),l.jsxs("button",{onClick:m,className:"px-5 py-3 rounded-2xl border border-white/10 text-white text-[9px] font-bold uppercase tracking-[0.3em] hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Import tasks","aria-label":"Import tasks",children:[l.jsx(ue,{name:"upload",className:"w-4 h-4 inline-block mr-2 text-[16px] align-sub"}),"Import"]}),l.jsx("button",{onClick:c,className:"shine-effect bg-white text-black px-9 py-3 rounded-2xl font-bold text-[10px] tracking-[0.2em] uppercase transition-all hover:scale-105 active:scale-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Create new task",title:"Create new task",children:"+ New Task"}),l.jsx("input",{ref:h,type:"file",accept:"application/json",multiple:!0,className:"hidden",onChange:b})]})]}),l.jsxs("div",{className:"relative flex-1 min-h-0",children:[l.jsx("div",{className:"pointer-events-none absolute top-0 left-0 right-0 h-10 bg-gradient-to-b from-[#050505] via-[#050505]/50 to-transparent z-10"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 content-start gap-6 overflow-y-auto custom-scrollbar pb-12 pr-4 h-full",children:[k&&_.length===0&&l.jsxs("div",{className:"col-span-full py-20 flex flex-col items-center justify-center text-center space-y-4",children:[l.jsx(ue,{name:"search_off",className:"text-5xl text-white/10"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-white/40",children:"No matching tasks"}),l.jsx("p",{className:"text-[10px] text-gray-600",children:"Try a different search term or clear the filter."})]}),l.jsx("button",{onClick:()=>y(""),className:"text-[9px] font-bold uppercase tracking-widest text-blue-400 hover:text-blue-300 transition-colors",children:"Clear Filter"})]}),_.map(S=>l.jsx(nb,{task:S,onEditTask:r,onDeleteTask:u},S.id))]})]}),i.length===0&&l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:l.jsxs("button",{onClick:c,className:"w-full max-w-[400px] bg-[#0a0a0a] border border-dashed border-white/15 rounded-2xl p-8 hover:border-white/30 hover:bg-white/[0.03] transition-all flex flex-col items-center justify-center gap-4 group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Create first task","aria-label":"Create first task",children:[l.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/5 group-hover:bg-white/10 transition-all flex items-center justify-center border border-white/5",children:l.jsx(ue,{name:"add",className:"text-3xl text-gray-500 group-hover:text-white transition-colors"})}),l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-white/70 group-hover:text-white transition-colors",children:"Create First Task"}),l.jsx("p",{className:"text-[10px] text-gray-500 max-w-[250px] mx-auto leading-relaxed group-hover:text-gray-400 transition-colors",children:"Get started by creating your first automation task. This will open the visual editor."})]})]})})]})}),x&&l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 pb-20 sm:pb-6",children:[l.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm",onClick:()=>g(!1)}),l.jsxs("div",{className:"relative w-full max-w-lg bg-[#0a0a0a] border border-white/10 rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-full slide-up",children:[l.jsxs("div",{className:"p-6 sm:p-8 shrink-0",children:[l.jsx("h3",{className:"text-xl font-bold text-white tracking-tight",children:"Export Tasks"}),l.jsx("p",{className:"text-[11px] text-white/50 mt-2 font-mono",children:"Select the tasks you want to export."})]}),l.jsxs("div",{className:"px-6 sm:px-8 pb-4 flex items-center gap-3 shrink-0 border-b border-white/5",children:[l.jsx("button",{onClick:()=>w(i.map(S=>S.id)),className:"text-[10px] font-bold uppercase tracking-widest text-blue-400 hover:text-blue-300 transition-colors",children:"Select All"}),l.jsx("span",{className:"text-white/20",children:"|"}),l.jsx("button",{onClick:()=>w([]),className:"text-[10px] font-bold uppercase tracking-widest text-white/40 hover:text-white/80 transition-colors",children:"Deselect All"}),l.jsx("div",{className:"flex-1"}),l.jsxs("span",{className:"text-[10px] font-mono text-white/30",children:[C.length," selected"]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 sm:p-8 space-y-2",children:i.map(S=>l.jsxs("button",{onClick:()=>j(S.id),className:`w-full text-left p-4 rounded-2xl border transition-all flex items-center gap-4 ${C.includes(S.id)?"bg-blue-500/10 border-blue-500/30":"bg-white/5 border-white/5 hover:border-white/10"}`,children:[l.jsx("div",{className:`w-5 h-5 rounded flex items-center justify-center border transition-colors ${C.includes(S.id)?"bg-blue-500 border-blue-400 text-white":"border-white/20"}`,children:C.includes(S.id)&&l.jsx(ue,{name:"check",className:"text-[14px]"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-bold text-white truncate",children:S.name||"Untitled"}),l.jsx("div",{className:"text-[10px] text-white/40 font-mono truncate",children:S.url||"No URL"})]})]},S.id))}),l.jsxs("div",{className:"p-6 sm:p-8 bg-black/40 border-t border-white/5 flex gap-3 shrink-0",children:[l.jsx("button",{onClick:()=>g(!1),className:"flex-1 px-4 py-3 rounded-xl border border-white/10 text-white text-[10px] font-bold uppercase tracking-widest hover:bg-white/5 transition-all",children:"Cancel"}),l.jsxs("button",{onClick:()=>{f(C),g(!1)},disabled:C.length===0,className:`flex-1 px-4 py-3 rounded-xl text-[10px] font-bold uppercase tracking-widest transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 ${C.length>0?"bg-white text-black hover:scale-105":"bg-white/10 text-white/30 cursor-not-allowed"}`,children:["Export (",C.length,")"]})]})]})]})]})},sp=E.memo(lb),dr=[{type:"click",label:"Click",description:"Click an element",icon:"ads_click"},{type:"type",label:"Type",description:"Type text into a field",icon:"text_format"},{type:"hover",label:"Hover",description:"Hover an element",icon:"my_location"},{type:"press",label:"Press",description:"Press a key",icon:"keyboard"},{type:"wait",label:"Wait",description:"Pause for seconds",icon:"schedule"},{type:"wait_selector",label:"Wait for Selector",description:"Wait until element appears",icon:"schedule"},{type:"wait_downloads",label:"Wait for Downloads",description:"Wait until downloads finish",icon:"download"},{type:"scroll",label:"Scroll",description:"Scroll the page or container",icon:"swap_vert"},{type:"javascript",label:"JavaScript",description:"Run custom JS",icon:"code"},{type:"csv",label:"CSV",description:"Parse CSV into rows",icon:"table_chart"},{type:"merge",label:"Merge",description:"Merge inputs into a single output",icon:"layers"},{type:"screenshot",label:"Screenshot",description:"Capture a screenshot",icon:"photo_camera"},{type:"navigate",label:"Navigate To",description:"Navigate to a URL",icon:"navigation"},{type:"if",label:"If",description:"Conditional block start",icon:"call_split"},{type:"else",label:"Else",description:"Conditional alternate path",icon:"call_split"},{type:"end",label:"End Block",description:"Close a block",icon:"subdirectory_arrow_right"},{type:"while",label:"While",description:"Loop while condition true",icon:"repeat"},{type:"repeat",label:"Repeat N",description:"Repeat block N times",icon:"repeat"},{type:"foreach",label:"For Each",description:"Loop through items",icon:"list"},{type:"set",label:"Set Variable",description:"Update variable value",icon:"data_object"},{type:"stop",label:"Stop Task",description:"Stop task with status",icon:"stop"},{type:"on_error",label:"On Error",description:"Run on failure",icon:"warning"},{type:"start",label:"Start Task",description:"Run another task",icon:"play_circle"},{type:"http_request",label:"HTTP Request",description:"Make an API call",icon:"language"},{type:"get_content",label:"Get Content",description:"Get page or element text content",icon:"article"}],ib=({open:i,query:c,onQueryChange:r,onClose:u,onSelect:f})=>{const d=E.useRef(null),h=E.useRef(null),[p,x]=E.useState(-1);E.useEffect(()=>{if(i){x(-1);const w=setTimeout(()=>d.current?.focus(),50);return()=>clearTimeout(w)}},[i]);const g=E.useMemo(()=>{const w=c.trim().toLowerCase();return w?dr.filter(k=>k.label.toLowerCase().includes(w)||k.description.toLowerCase().includes(w)):dr},[c]);E.useEffect(()=>{x(-1)},[c]),E.useEffect(()=>{if(i&&h.current){const w=h.current.querySelector(`[data-index="${p}"]`);w&&w.scrollIntoView({block:"nearest",behavior:"smooth"})}},[p,i]);const C=w=>{w.key==="Escape"?c?(w.stopPropagation(),r("")):u():w.key==="ArrowDown"?(w.preventDefault(),x(k=>k===-1?0:k+2<g.length?k+2:k)):w.key==="ArrowUp"?(w.preventDefault(),x(k=>k<=0?-1:k-2)):w.key==="ArrowRight"?(w.preventDefault(),x(k=>k===-1?0:k+1<g.length?k+1:k)):w.key==="ArrowLeft"?(w.preventDefault(),x(k=>k<=0?-1:k-1)):w.key==="Enter"&&(w.preventDefault(),g[p]&&f(g[p].type))};return i?l.jsx("div",{className:"fixed inset-0 z-[190] flex items-center justify-center bg-black/70 backdrop-blur-sm px-6",onClick:u,children:l.jsxs("div",{className:"glass-card w-full max-w-xl rounded-[28px] border border-white/10 p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200",onClick:w=>w.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-[0.4em] text-gray-500",children:"Add Block"}),l.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Search actions and control flow blocks."})]}),l.jsx("button",{onClick:u,className:"p-2 rounded-xl text-white/70 hover:text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Close",title:"Close palette",children:l.jsx(ue,{name:"close",className:"text-base"})})]}),l.jsxs("div",{className:"relative group/search",children:[l.jsx("input",{ref:d,value:c,onChange:w=>r(w.target.value),onKeyDown:C,placeholder:"Type to filter (e.g., if, click, while)","aria-label":"Search actions","aria-activedescendant":g[p]?`action-item-${g[p].type}`:void 0,className:"w-full rounded-xl bg-black/40 border border-white/10 px-4 py-3 pr-10 text-sm text-white placeholder:text-gray-600 focus:outline-none focus:border-white/30 transition-all focus-visible:ring-2 focus-visible:ring-white/20"}),c&&l.jsx("button",{onClick:()=>{r(""),d.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white transition-colors","aria-label":"Clear search",title:"Clear search",children:l.jsx(ue,{name:"cancel",className:"text-lg"})})]}),l.jsxs("div",{ref:h,className:"mt-4 max-h-[400px] overflow-y-auto custom-scrollbar pr-2",children:[l.jsx("div",{className:"grid grid-cols-2 gap-3 pb-2",role:"listbox",children:g.map((w,k)=>l.jsxs("button",{id:`action-item-${w.type}`,"data-index":k,role:"option","aria-selected":k===p,onClick:()=>f(w.type),className:`flex flex-col items-start gap-2 text-left p-4 rounded-2xl border transition-all hover:scale-[1.02] active:scale-95 group focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${k===p?"bg-white/10 border-white/30 ring-1 ring-white/20":"border-white/5 bg-white/[0.02] hover:bg-white/[0.08] hover:border-white/20"}`,children:[l.jsx(ue,{name:w.icon||"extension",className:"text-2xl text-white/80 group-hover:text-white transition-colors shrink-0 mb-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-bold uppercase tracking-widest text-white/90 group-hover:text-white mb-1",children:w.label}),l.jsx("div",{className:"text-[10px] text-gray-500 line-clamp-2 leading-relaxed",children:w.description})]})]},w.type))}),g.length===0&&l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-3",children:[l.jsx(ue,{name:"search_off",className:"text-4xl text-white/10"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/40",children:"No matches found"}),l.jsx("p",{className:"text-[10px] text-gray-600",children:"Try a different search term or browse the catalog."})]})]})]})]})}):null},sb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},At=i=>/[&<>"']/.test(i)?i.replace(/[&<>"']/g,c=>sb[c]):i,rb=new Set(["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","try","catch","finally","throw","new","class","extends","super","import","from","export","default","await","async","typeof","instanceof","in","of","this"]),fr=(i,c)=>{if(!i.includes("{$"))return At(i);const r=/\{\$(\w+)\}/g;let u="",f=0,d;const h=x=>!!c&&(x in c||x==="now"),p=x=>{if(x==="now")return!0;const g=c?c[x]:void 0;return g&&g.value!==""&&g.value!==void 0&&g.value!==null};for(;(d=r.exec(i))!==null;){d.index>f&&(u+=At(i.substring(f,d.index)));const x=d[1],g=h(x),C=p(x);u+=`<span class="${g?C?"var-highlight-default":"var-highlight":"var-highlight-undefined"}">${At(d[0])}</span>`,f=r.lastIndex}return u+=At(i.substring(f)),u},ob=i=>{const c=/("(?:\\.|[^"\\])*")|(-?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b)|\b(true|false|null)\b/g;let r="",u=0,f;for(;(f=c.exec(i))!==null;){f.index>u&&(r+=At(i.substring(u,f.index)));const d=f[0];if(f[1]){let h=!1,p=f.index+d.length;for(;p<i.length&&/\s/.test(i[p]);)p+=1;i[p]===":"&&(h=!0),r+=`<span class="${h?"code-token-key":"code-token-string"}">${At(d)}</span>`}else f[2]?r+=`<span class="code-token-number">${At(d)}</span>`:r+=`<span class="code-token-boolean">${At(d)}</span>`;u=c.lastIndex}return r+=At(i.substring(u)),r},cb=(i,c)=>{const r=/(\{\$\w+\})|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)|(\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b)|(\btrue\b|\bfalse\b|\bnull\b|\bundefined\b)|(\b[A-Za-z_]\w*\b)/g;let u="",f=0,d;for(;(d=r.exec(i))!==null;){d.index>f&&(u+=At(i.substring(f,d.index)));const h=d[0];if(d[1])u+=fr(h,c);else if(d[2])u+=`<span class="code-token-comment">${At(h)}</span>`;else if(d[3])u+=`<span class="code-token-string">${At(h)}</span>`;else if(d[4])u+=`<span class="code-token-number">${At(h)}</span>`;else if(d[5])u+=`<span class="code-token-boolean">${At(h)}</span>`;else if(d[6]){const p=rb.has(h)?"code-token-keyword":"code-token-identifier";u+=`<span class="${p}">${At(h)}</span>`}else u+=At(h);f=r.lastIndex}return u+=At(i.substring(f)),u},ub=(i,c)=>{const r=/<\/?[^>]+>/g;let u="",f=0,d;for(;(d=r.exec(i))!==null;){d.index>f&&(u+=fr(i.substring(f,d.index),c));const p=d[0],x=p.match(/^<(\/?[A-Za-z0-9-]+)([\s\S]*?)>$/);if(x){const g=x[1],C=x[2];let w=At(g);w.startsWith("/")?w=`/<span class="code-token-tag">${w.substring(1)}</span>`:w=`<span class="code-token-tag">${w}</span>`;let k=At(C);k=k.replace(/(\s)([A-Za-z0-9-:]+)(=)/g,'$1<span class="code-token-attr">$2</span>$3'),k=k.replace(/(&quot;.*?&quot;|&#39;.*?&#39;)/g,'<span class="code-token-string">$1</span>'),u+=`<span class="code-token-punct">&lt;${w}${k}&gt;</span>`}else u+=`<span class="code-token-punct">${At(p)}</span>`;f=r.lastIndex}const h=i.substring(f);return h&&(u+=fr(h,c)),u},$p=(i,c,r)=>c==="javascript"?cb(i,r):c==="json"?ob(i):c==="html"?ub(i,r):fr(i,r),vn=({value:i,onChange:c,onBlur:r,language:u,placeholder:f,className:d,readOnly:h,variables:p})=>{const x=E.useRef(null),g=E.useRef(null),C=i||f||"",w=!i&&!!f,k=E.useMemo(()=>$p(C,u,p),[C,u,p]);return E.useEffect(()=>{const y=x.current,_=g.current;if(!y||!_)return;const m=()=>{_.scrollTop=y.scrollTop,_.scrollLeft=y.scrollLeft};return y.addEventListener("scroll",m),()=>{y.removeEventListener("scroll",m)}},[]),l.jsxs("div",{className:`code-editor ${d||""}`,onWheel:y=>{const _=x.current;_&&(_.scrollHeight<=_.clientHeight||(_.scrollTop+=y.deltaY,_.scrollLeft+=y.deltaX,_.focus(),y.preventDefault()))},children:[l.jsx("pre",{ref:g,className:`code-editor-pre ${w?"code-editor-placeholder":""}`,"aria-hidden":!0,dangerouslySetInnerHTML:{__html:k}}),l.jsx("textarea",{ref:x,value:i,onChange:y=>c?.(y.target.value),onBlur:y=>r?.(y.target.value),spellCheck:!1,wrap:"off",readOnly:h,className:`code-editor-textarea ${h?"code-editor-textarea-readonly":""}`,"aria-label":"Code editor",tabIndex:h?-1:0})]})},db=({currentTask:i,onUpdateTask:c})=>{if(!i.id)return l.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center space-y-4 animate-in fade-in duration-300",children:[l.jsx("div",{className:"w-12 h-12 rounded-full bg-white/5 flex items-center justify-center",children:l.jsx(ue,{name:"save",className:"text-gray-500"})}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-white font-medium",children:"Save Required"}),l.jsx("p",{className:"text-[10px] text-gray-500 mt-1 max-w-[200px]",children:"You must save this task before you can set an execution schedule."})]})]});const r=i.schedule||{enabled:!1},[u,f]=tt.useState(!!r.cron&&!r.frequency);tt.useEffect(()=>{r.cron&&!r.frequency&&f(!0),r.frequency&&!r.cron&&f(!1)},[r.cron,r.frequency]);const[d,h]=tt.useState(null),[p,x]=tt.useState(r.nextRun||null),[g,C]=tt.useState(!1),[w,k]=tt.useState(null),[y,_]=tt.useState(!1),m=O=>{const U={...r,...O};U.enabled&&!U.frequency&&!U.cron&&(U.frequency="daily",U.hour=9,U.minute=0),c({schedule:U}),fetch(`/api/schedules/${i.id}/describe`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(U)}).then(L=>L.json()).then(L=>{h(L.description||null),x(L.nextRun||null)}).catch(()=>{})};tt.useEffect(()=>{(r.enabled||r.frequency||r.cron)&&fetch(`/api/schedules/${i.id}/describe`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(r)}).then(O=>O.json()).then(O=>{h(O.description||null),x(O.nextRun||null)}).catch(()=>{})},[]);const b=O=>{C(!0),k(null),_(!1);const U=O||{...r};fetch(`/api/schedules/${i.id}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(U)}).then(async L=>{const I=await L.json();if(!L.ok)throw new Error(I.message||I.error||"Failed to save");return I}).then(L=>{L.schedule&&(c({schedule:L.schedule}),h(L.description||null),x(L.schedule?.nextRun||null),_(!0),setTimeout(()=>_(!1),2e3))}).catch(L=>{k(L.message)}).finally(()=>{C(!1)})},j=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],S=r.frequency||(u?void 0:"daily"),A=r.daysOfWeek||[],M=O=>{const U=O-Date.now();if(U<0)return"now";const L=Math.floor(U/6e4);if(L<1)return"less than a minute";if(L<60)return`${L}m`;const I=Math.floor(L/60);return I<24?`${I}h ${L%60}m`:`${Math.floor(I/24)}d ${I%24}h`};return l.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-300",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Scheduled Execution"}),l.jsxs("button",{role:"switch","aria-checked":r.enabled,onClick:()=>{const O=!r.enabled,U={...r,enabled:O};O&&!U.frequency&&!U.cron&&(U.frequency="daily",U.hour=9,U.minute=0),m(U),b(U)},className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-[10px] font-bold uppercase tracking-wider transition-all border focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${r.enabled?"bg-emerald-500/20 border-emerald-500/40 text-emerald-400":"bg-white/5 border-white/10 text-gray-500 hover:text-white hover:border-white/20"}`,children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${r.enabled?"bg-emerald-400 animate-pulse":"bg-gray-600"}`}),r.enabled?"Active":"Inactive"]})]}),l.jsxs("div",{role:"tablist",className:"flex items-center gap-2 bg-black/40 p-1 rounded-xl border border-white/5",children:[l.jsx("button",{role:"tab","aria-selected":!u,onClick:()=>{f(!1),m({cron:void 0,frequency:r.frequency||"daily"})},className:`flex-1 px-3 py-1.5 rounded-lg text-[10px] font-bold uppercase tracking-wider transition-all focus:outline-none focus-visible:ring-2 ${u?"text-gray-500 hover:text-white focus-visible:ring-white/50":"bg-white text-black focus-visible:ring-blue-500"}`,children:"Visual"}),l.jsx("button",{role:"tab","aria-selected":u,onClick:()=>{f(!0),m({frequency:void 0,cron:r.cron||"0 9 * * *"})},className:`flex-1 px-3 py-1.5 rounded-lg text-[10px] font-bold uppercase tracking-wider transition-all focus:outline-none focus-visible:ring-2 ${u?"bg-white text-black focus-visible:ring-blue-500":"text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:"Advanced"})]}),u?l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Cron Expression"}),l.jsx("input",{type:"text","aria-label":"Cron Expression",value:r.cron||"",onChange:O=>m({cron:O.target.value,frequency:void 0}),placeholder:"*/5 * * * *",className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white font-mono placeholder:text-gray-700 focus:outline-none focus:border-white/30 transition-all focus-visible:ring-2 focus-visible:ring-white/50"}),l.jsx("p",{className:"text-[9px] text-gray-600 font-mono",children:"minute hour day-of-month month day-of-week"})]}):l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Frequency"}),l.jsx("div",{role:"tablist",className:"grid grid-cols-3 gap-2",children:["interval","hourly","daily","weekly","monthly"].map(O=>l.jsx("button",{role:"tab","aria-selected":S===O,onClick:()=>m({frequency:O,cron:void 0}),className:`px-3 py-2.5 rounded-xl text-[10px] font-bold uppercase tracking-wider border transition-all focus:outline-none focus-visible:ring-2 ${S===O?"bg-white/15 border-white/40 text-white focus-visible:ring-blue-500":"bg-white/5 border-white/5 text-gray-500 hover:text-white hover:border-white/15 focus-visible:ring-white/50"}`,children:O==="interval"?"Every X min":O},O))})]}),S==="interval"&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Run every"}),l.jsx("div",{role:"tablist",className:"grid grid-cols-6 gap-2",children:[1,5,10,15,30,60].map(O=>l.jsxs("button",{role:"tab","aria-selected":(r.intervalMinutes||5)===O,onClick:()=>m({intervalMinutes:O}),className:`py-2 rounded-xl text-xs font-bold border transition-all focus:outline-none focus-visible:ring-2 ${(r.intervalMinutes||5)===O?"bg-white/15 border-white/40 text-white focus-visible:ring-blue-500":"bg-white/5 border-white/5 text-gray-500 hover:text-white hover:border-white/15 focus-visible:ring-white/50"}`,children:[O,"m"]},O))})]}),S==="hourly"&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"At minute"}),l.jsx("div",{role:"tablist",className:"grid grid-cols-4 gap-2",children:[0,15,30,45].map(O=>l.jsxs("button",{role:"tab","aria-selected":(r.minute??0)===O,onClick:()=>m({minute:O}),className:`py-2 rounded-xl text-xs font-bold border transition-all focus:outline-none focus-visible:ring-2 ${(r.minute??0)===O?"bg-white/15 border-white/40 text-white focus-visible:ring-blue-500":"bg-white/5 border-white/5 text-gray-500 hover:text-white hover:border-white/15 focus-visible:ring-white/50"}`,children:[":",String(O).padStart(2,"0")]},O))})]}),(S==="daily"||S==="weekly"||S==="monthly")&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Time"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("select",{"aria-label":"Hour",value:r.hour??9,onChange:O=>m({hour:parseInt(O.target.value)}),className:"flex-1 bg-black/40 border border-white/10 rounded-xl px-3 py-2.5 text-xs text-white focus:outline-none focus:border-white/30 transition-all focus-visible:ring-2 focus-visible:ring-white/50",children:Array.from({length:24},(O,U)=>l.jsx("option",{value:U,children:U===0?"12 AM":U<12?`${U} AM`:U===12?"12 PM":`${U-12} PM`},U))}),l.jsx("select",{"aria-label":"Minute",value:r.minute??0,onChange:O=>m({minute:parseInt(O.target.value)}),className:"flex-1 bg-black/40 border border-white/10 rounded-xl px-3 py-2.5 text-xs text-white focus:outline-none focus:border-white/30 transition-all focus-visible:ring-2 focus-visible:ring-white/50",children:Array.from({length:60},(O,U)=>l.jsxs("option",{value:U,children:[":",String(U).padStart(2,"0")]},U))})]})]}),S==="weekly"&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Days"}),l.jsx("div",{className:"grid grid-cols-7 gap-1.5",children:j.map((O,U)=>l.jsx("button",{"aria-pressed":A.includes(U),onClick:()=>{const L=A.includes(U)?A.filter(I=>I!==U):[...A,U].sort();m({daysOfWeek:L})},className:`py-2 rounded-xl text-[10px] font-bold uppercase border transition-all focus:outline-none focus-visible:ring-2 ${A.includes(U)?"bg-white/20 border-white/40 text-white focus-visible:ring-blue-500":"bg-white/5 border-white/5 text-gray-600 hover:text-white hover:border-white/15 focus-visible:ring-white/50"}`,children:O},U))})]}),S==="monthly"&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Day of Month"}),l.jsx("select",{"aria-label":"Day of Month",value:r.dayOfMonth??1,onChange:O=>m({dayOfMonth:parseInt(O.target.value)}),className:"w-full bg-black/40 border border-white/10 rounded-xl px-3 py-2.5 text-xs text-white focus:outline-none focus:border-white/30 transition-all focus-visible:ring-2 focus-visible:ring-white/50",children:Array.from({length:31},(O,U)=>l.jsx("option",{value:U+1,children:U+1},U+1))})]})]}),d&&l.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(ue,{name:"event_repeat",className:"text-sm text-white/40"}),l.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Schedule"})]}),l.jsx("p",{className:"text-sm text-white font-medium",children:d})]}),p&&l.jsxs("div",{className:"flex items-center justify-between bg-white/5 border border-white/10 rounded-2xl p-4",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Next Run"}),l.jsx("p",{className:"text-xs text-white mt-1",children:new Date(p).toLocaleString()})]}),l.jsxs("span",{className:"text-xs text-gray-400",children:["in ",M(p)]})]}),r.lastRun&&l.jsxs("div",{className:"flex items-center justify-between bg-white/5 border border-white/10 rounded-2xl p-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:`w-2 h-2 rounded-full ${r.lastRunStatus==="success"?"bg-emerald-400":"bg-red-400"}`}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Last Run"}),l.jsx("p",{className:"text-xs text-white mt-0.5",children:new Date(r.lastRun).toLocaleString()})]})]}),r.lastRunDurationMs!=null&&l.jsxs("span",{className:"text-[10px] text-gray-500",children:[(r.lastRunDurationMs/1e3).toFixed(1),"s"]})]}),w&&l.jsx("div",{className:"p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-[10px] font-bold uppercase tracking-widest text-center",children:w}),l.jsxs("button",{onClick:()=>b(),disabled:g,className:`w-full py-3 rounded-2xl text-[10px] font-bold uppercase tracking-[0.2em] transition-all flex items-center justify-center gap-3 focus:outline-none focus-visible:ring-2 ${y?"bg-emerald-500 text-white shadow-lg shadow-emerald-500/20 focus-visible:ring-white":"bg-white text-black hover:bg-gray-200 shadow-xl shadow-white/5 focus-visible:ring-blue-500"} disabled:opacity-50`,children:[g?l.jsx("div",{className:"w-3 h-3 border-2 border-black/20 border-t-black rounded-full animate-spin"}):y?l.jsx(ue,{name:"check",className:"text-sm"}):null,y?"Schedule Saved":g?"Saving...":"Save Schedule"]})]})},fb=({isOpen:i,onClose:c,currentTask:r,onUpdateTask:u,proxyListLoaded:f,proxyList:d,initialTab:h="mode",versions:p,versionsLoading:x,onRollback:g,onPreview:C})=>{const[w,k]=tt.useState(h),[y,_]=tt.useState([]),[m,b]=tt.useState({name:"",baseUrl:"https://api.baserow.io",token:""}),[j,S]=tt.useState(!1),[A,M]=tt.useState(!1),[O,U]=tt.useState([]),[L,I]=tt.useState([]),[V,de]=tt.useState(!1),[ae,H]=tt.useState(!1),[F,z]=tt.useState(!0);tt.useEffect(()=>{i&&k(h)},[i,h]),tt.useEffect(()=>{i&&w==="output"&&fetch("/api/credentials").then(Y=>Y.json()).then(_).catch(()=>{})},[i,w]);const se=tt.useCallback(async Y=>{if(!Y){U([]),I([]),z(!0);return}de(!0),z(!0);try{const he=await fetch(`/api/credentials/${Y}/proxy/baserow/databases`);if(he.ok){const ke=await he.json();U(ke),z(!0)}else U([]),z(!1)}catch{U([]),z(!1)}finally{de(!1)}},[]),$=tt.useCallback(async(Y,he)=>{if(!Y||!he){I([]);return}H(!0);try{const ke=await fetch(`/api/credentials/${Y}/proxy/baserow/databases/${he}/tables`);ke.ok?I(await ke.json()):I([])}catch{I([])}finally{H(!1)}},[]);tt.useEffect(()=>{r.output?.credentialId?se(r.output.credentialId):(U([]),I([]))},[r.output?.credentialId,se]),tt.useEffect(()=>{r.output?.credentialId&&r.output?.databaseId?$(r.output.credentialId,r.output.databaseId):I([])},[r.output?.databaseId,r.output?.credentialId,$]);const P=async()=>{if(!(!m.name||!m.token)){M(!0);try{const Y=await fetch("/api/credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:m.name,provider:"baserow",config:{baseUrl:m.baseUrl,token:m.token}})});if(Y.ok){const he=await Y.json();_(ke=>[...ke,he]),b({name:"",baseUrl:"https://api.baserow.io",token:""}),S(!1),r.output?.credentialId||u({output:{...r.output,credentialId:he.id,provider:"baserow",tableId:r.output?.tableId||"",onError:r.output?.onError||"ignore"}})}}finally{M(!1)}}},Z=async Y=>{await fetch(`/api/credentials/${Y}`,{method:"DELETE"}),_(he=>he.filter(ke=>ke.id!==Y)),r.output?.credentialId===Y&&u({output:{...r.output,credentialId:""}})};if(!i)return null;const X=f&&d.length===1&&d[0]?.id==="host",ge=(Y,he,ke,Ae)=>{const Oe={...r.variables};Y!==he&&delete Oe[Y],Oe[he]={type:ke,value:Ae},u({variables:Oe})},R=Y=>{const he={...r.variables};delete he[Y],u({variables:he})},D=()=>{const Y=`var_${Object.keys(r.variables||{}).length+1}`;ge(Y,Y,"string","")},W=Y=>{u({stealth:{...r.stealth,[Y]:!r.stealth[Y]}})},te=(Y,he,ke)=>l.jsxs("button",{role:"tab","aria-selected":w===Y,onClick:()=>k(Y),className:`flex items-center gap-2 px-4 py-2 rounded-xl text-[10px] font-bold uppercase tracking-widest transition-all focus:outline-none focus-visible:ring-2 ${w===Y?"bg-white text-black shadow-lg shadow-white/10 focus-visible:ring-blue-500":"text-gray-500 hover:text-white hover:bg-white/5 focus-visible:ring-white/50"}`,children:[l.jsx(ue,{name:ke,className:"text-sm"}),he]});return l.jsxs("div",{className:"fixed inset-y-0 right-0 w-[450px] z-[100] flex",children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-[2px]",onClick:c}),l.jsxs("div",{className:"relative h-full w-full bg-[#080808]/90 border-l border-white/10 backdrop-blur-2xl shadow-[-20px_0_50px_rgba(0,0,0,0.5)] flex flex-col animate-in slide-in-from-right duration-300 ease-out p-8",children:[l.jsxs("div",{className:"flex items-center justify-between mb-8",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-xl font-bold text-white tracking-tight",children:"Task Settings"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-[0.2em] mt-1",children:r.name||"Untitled Task"})]}),l.jsx("button",{onClick:c,className:"w-10 h-10 rounded-full flex items-center justify-center hover:bg-white/5 text-gray-400 hover:text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Close settings",title:"Close settings",children:l.jsx(ue,{name:"close"})})]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em] block mb-2",children:"Description"}),l.jsx("textarea",{value:r.description||"",onChange:Y=>u({description:Y.target.value}),placeholder:"What does this task do? Give AI agents and operators context...",rows:3,className:"w-full bg-black/40 border border-white/10 rounded-xl px-3 py-2.5 text-xs text-white placeholder:text-gray-600 focus:outline-none focus:border-white/30 resize-none transition-all custom-scrollbar"})]}),l.jsxs("div",{role:"tablist",className:"flex flex-wrap gap-2 mb-8 bg-black/40 p-1 rounded-2xl border border-white/5",children:[te("mode","Mode","settings_input_component"),te("variables","Vars","data_object"),te("behavior","Behavior","psychology"),te("extraction","Extract","terminal"),te("api","API","api"),te("output","Output","table"),te("schedule","Schedule","event_repeat"),te("history","History","history")]}),l.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar pr-2 -mr-2",children:[w==="mode"&&l.jsx("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-300",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Execution Mode"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("button",{onClick:()=>u({mode:"agent"}),className:`p-4 rounded-2xl border transition-all text-left space-y-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${r.mode==="agent"?"bg-white/10 border-white/30 ring-1 ring-white/20":"bg-white/5 border-white/5 opacity-50 hover:opacity-100 hover:border-white/10"}`,children:[l.jsx("div",{className:"w-8 h-8 rounded-full bg-white/10 flex items-center justify-center",children:l.jsx(ue,{name:"smart_toy",className:"text-white/60"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs font-bold text-white",children:"Agent Mode"}),l.jsx("div",{className:"text-[9px] text-gray-500",children:"Autonomous decision making"})]})]}),l.jsxs("button",{onClick:()=>u({mode:"scrape"}),className:`p-4 rounded-2xl border transition-all text-left space-y-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${r.mode==="scrape"?"bg-white/10 border-white/30 ring-1 ring-white/20":"bg-white/5 border-white/5 opacity-50 hover:opacity-100 hover:border-white/10"}`,children:[l.jsx("div",{className:"w-8 h-8 rounded-full bg-white/10 flex items-center justify-center",children:l.jsx(ue,{name:"api",className:"text-white/60"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs font-bold text-white",children:"Scrape Mode"}),l.jsx("div",{className:"text-[9px] text-gray-500",children:"Fixed data extraction flow"})]})]})]})]})}),w==="variables"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-300",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Task Variables"}),l.jsx("button",{onClick:D,className:"px-3 py-1 rounded-lg bg-white/10 text-white text-[10px] font-bold uppercase tracking-wider hover:bg-white/20 transition-all border border-white/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:"+ Add Var"})]}),l.jsxs("div",{className:"space-y-3",children:[Object.entries(r.variables||{}).map(([Y,he])=>l.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4 space-y-3",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",defaultValue:Y,onBlur:ke=>{ke.target.value!==Y&&ge(Y,ke.target.value,he.type,he.value)},placeholder:"Name",className:"flex-1 bg-black/40 border border-white/5 rounded-xl px-3 py-2 text-xs text-white placeholder:text-gray-700"}),l.jsxs("select",{value:he.type,onChange:ke=>ge(Y,Y,ke.target.value,he.value),className:"bg-black/40 border border-white/5 rounded-xl px-2 py-2 text-[10px] font-bold uppercase text-gray-500",children:[l.jsx("option",{value:"string",children:"String"}),l.jsx("option",{value:"number",children:"Number"}),l.jsx("option",{value:"boolean",children:"Bool"})]}),l.jsx("button",{onClick:()=>R(Y),className:"text-red-500/50 hover:text-red-500 p-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded-lg","aria-label":"Remove variable",title:"Remove variable",children:l.jsx(ue,{name:"delete",className:"text-sm"})})]}),l.jsx("div",{className:"pl-1",children:he.type==="boolean"?l.jsxs("select",{value:String(he.value),onChange:ke=>ge(Y,Y,he.type,ke.target.value==="true"),className:"w-full bg-black/40 border border-white/5 rounded-xl px-3 py-2 text-xs text-white",children:[l.jsx("option",{value:"true",children:"True"}),l.jsx("option",{value:"false",children:"False"})]}):l.jsx("input",{type:he.type==="number"?"number":"text",value:he.value,onChange:ke=>ge(Y,Y,he.type,he.type==="number"?parseFloat(ke.target.value):ke.target.value),placeholder:"Default Value",className:"w-full bg-black/40 border border-white/5 rounded-xl px-3 py-2 text-xs text-white"})})]},Y)),Object.keys(r.variables||{}).length===0&&l.jsx("div",{className:"text-center py-12 border border-dashed border-white/10 rounded-3xl",children:l.jsx("p",{className:"text-[10px] text-gray-600 uppercase tracking-widest",children:"No variables defined"})})]})]}),w==="behavior"&&l.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-300",children:[l.jsxs("div",{className:"space-y-4",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Runtime Flags"}),l.jsx("div",{className:"grid grid-cols-1 gap-2",children:[{label:"Stateless Execution",key:"statelessExecution",icon:"auto_delete"},{label:"Disable Recording",key:"disableRecording",icon:"videocam_off"},{label:"Rotate Proxies",key:"rotateProxies",icon:"vpn_lock",disabled:X},{label:"Rotate User Agents",key:"rotateUserAgents",icon:"person_search"},{label:"Rotate Viewport",key:"rotateViewport",icon:"screenshot_monitor"},{label:"Include Shadow DOM",key:"includeShadowDom",icon:"layers"}].map(Y=>l.jsxs("button",{disabled:Y.disabled,role:"switch","aria-checked":!!r[Y.key],onClick:()=>u({[Y.key]:!r[Y.key]}),className:`flex items-center justify-between p-4 rounded-2xl border transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${r[Y.key]?"bg-white/10 border-white/30 text-white":"bg-white/5 border-white/5 text-gray-400 opacity-60 hover:opacity-100"} ${Y.disabled?"opacity-20 cursor-not-allowed":""}`,children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ue,{name:Y.icon,className:"text-sm opacity-70"}),l.jsx("span",{className:"text-xs font-medium",children:Y.label})]}),l.jsx("div",{className:`w-8 h-4 rounded-full relative transition-colors ${r[Y.key]?"bg-white":"bg-white/10"}`,children:l.jsx("div",{className:`absolute top-1 w-2 h-2 rounded-full transition-all ${r[Y.key]?"right-1 bg-black":"left-1 bg-white/20"}`})})]},Y.key))})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Stealth & Behavior"}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{label:"Human Typing",key:"naturalTyping",icon:"keyboard"},{label:"Cursor Glide",key:"cursorGlide",icon:"near_me"},{label:"Idle Moves",key:"idleMovements",icon:"mouse"},{label:"Dead Clicks",key:"deadClicks",icon:"ads_click"},{label:"Fatigue Sim",key:"fatigue",icon:"hourglass_empty"},{label:"Allow Typos",key:"allowTypos",icon:"spellcheck"},{label:"Random Clicks",key:"randomizeClicks",icon:"shuffle"},{label:"Overscroll",key:"overscroll",icon:"unfold_more"}].map(Y=>l.jsxs("button",{role:"switch","aria-checked":!!r.stealth[Y.key],onClick:()=>W(Y.key),className:`flex flex-col gap-2 p-4 rounded-2xl border transition-all text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${r.stealth[Y.key]?"bg-white/15 border-white/40 text-white":"bg-white/5 border-white/5 text-gray-500 opacity-60 hover:opacity-100"}`,children:[l.jsx(ue,{name:Y.icon,className:"text-sm opacity-70"}),l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-tight",children:Y.label})]},Y.key))})]})]}),w==="extraction"&&l.jsx("div",{className:"space-y-6 h-full flex flex-col animate-in fade-in slide-in-from-bottom-2 duration-300",children:l.jsxs("div",{className:"space-y-4 flex-1 flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Post-Execution Script"}),l.jsxs("select",{value:r.extractionFormat||"json",onChange:Y=>u({extractionFormat:Y.target.value}),className:"bg-black/40 border border-white/5 rounded-lg px-2 py-1 text-[8px] font-bold uppercase text-gray-500",children:[l.jsx("option",{value:"json",children:"JSON"}),l.jsx("option",{value:"csv",children:"CSV"})]})]}),l.jsx("div",{className:"flex-1 bg-black/40 border border-white/5 rounded-2xl overflow-hidden min-h-[300px]",children:l.jsx(vn,{language:"javascript",value:r.extractionScript||"",onChange:Y=>u({extractionScript:Y}),placeholder:"// Example: return { title: document.title };",className:"h-full text-[11px]"})})]})}),w==="api"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-300",children:[l.jsxs("div",{className:"space-y-4",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Trigger via API"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-[10px] text-gray-500",children:"Run this task from external tools using the endpoint below:"}),l.jsxs("div",{className:"relative group",children:[l.jsxs("div",{className:"bg-black/40 border border-white/10 rounded-xl p-4 pr-12 font-mono text-[10px] text-white/80 break-all border-dashed",children:["POST /api/tasks/",r.id,"/api"]}),l.jsx(Vn,{text:`POST /api/tasks/${r.id}/api`,className:"absolute right-2 top-2 p-2 rounded-lg bg-white/5 border border-white/10 text-white opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-all",iconClassName:"text-xs",title:"Copy Endpoint"})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Response Options"}),l.jsxs("button",{role:"switch","aria-checked":r.includeHtml,onClick:()=>u({includeHtml:!r.includeHtml}),className:"w-full flex items-center justify-between p-3 rounded-xl bg-black/20 border border-white/5 hover:bg-white/5 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsxs("div",{className:"text-left",children:[l.jsx("span",{className:"text-xs font-medium",children:"Include HTML in response"}),l.jsx("p",{className:"text-[9px] text-gray-500 mt-0.5",children:"When an extraction script is set, also return the raw HTML"})]}),l.jsx("div",{className:`w-8 h-4 rounded-full relative transition-colors flex-shrink-0 ${r.includeHtml?"bg-white":"bg-white/10"}`,children:l.jsx("div",{className:`absolute top-1 w-2 h-2 rounded-full transition-all ${r.includeHtml?"right-1 bg-black":"left-1 bg-white/20"}`})})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Passing Variables"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-[10px] text-gray-500",children:"You can override task variables in the request body:"}),l.jsxs("div",{className:"relative group",children:[l.jsx("div",{className:"bg-black/40 border border-white/5 rounded-xl p-4 pr-12 font-mono text-[10px] text-white/60",children:l.jsx("pre",{children:JSON.stringify({variables:Object.fromEntries(Object.entries(r.variables||{}).slice(0,2).map(([Y,he])=>[Y,he.value]))},null,2)})}),l.jsx(Vn,{text:JSON.stringify({variables:Object.fromEntries(Object.entries(r.variables||{}).slice(0,2).map(([Y,he])=>[Y,he.value]))},null,2),className:"absolute right-2 top-2 p-2 rounded-lg bg-white/5 border border-white/10 text-white opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-all",iconClassName:"text-xs",title:"Copy Payload"})]})]})]})]}),w==="output"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-300",children:[l.jsxs("button",{role:"switch","aria-checked":!!r.output,onClick:()=>u({output:r.output?void 0:{provider:"baserow",credentialId:"",tableId:"",onError:"ignore"}}),className:"w-full flex items-center justify-between p-3 rounded-xl bg-black/20 border border-white/5 hover:bg-white/5 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsxs("div",{className:"text-left",children:[l.jsx("span",{className:"text-xs font-medium",children:"Push results to destination"}),l.jsx("p",{className:"text-[9px] text-gray-500 mt-0.5",children:"Send extracted data to an external table after each run"})]}),l.jsx("div",{className:`w-8 h-4 rounded-full relative transition-colors flex-shrink-0 ${r.output?"bg-white":"bg-white/10"}`,children:l.jsx("div",{className:`absolute top-1 w-2 h-2 rounded-full transition-all ${r.output?"right-1 bg-black":"left-1 bg-white/20"}`})})]}),r.output&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Provider"}),l.jsx("select",{value:r.output.provider,onChange:Y=>u({output:{...r.output,provider:Y.target.value,credentialId:"",tableId:""}}),className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-white/20",children:l.jsx("option",{value:"baserow",children:"Baserow"})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Credential"}),l.jsxs("button",{onClick:()=>S(Y=>!Y),className:"text-[9px] font-bold text-gray-400 hover:text-white transition-colors flex items-center gap-1 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded",children:[l.jsx(ue,{name:"add",className:"text-xs"}),"New"]})]}),j&&l.jsxs("div",{className:"space-y-2 p-3 rounded-xl bg-black/40 border border-white/5",children:[l.jsx("input",{className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none focus:border-white/20",placeholder:"Name (e.g. My Baserow)",value:m.name,onChange:Y=>b(he=>({...he,name:Y.target.value}))}),l.jsx("input",{className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none focus:border-white/20",placeholder:"Base URL",value:m.baseUrl,onChange:Y=>b(he=>({...he,baseUrl:Y.target.value}))}),l.jsx("input",{className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none focus:border-white/20",placeholder:"API Token",type:"password",value:m.token,onChange:Y=>b(he=>({...he,token:Y.target.value}))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:P,disabled:A||!m.name||!m.token,className:"flex-1 py-1.5 rounded-lg bg-white text-black text-[10px] font-bold disabled:opacity-40 transition-opacity focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:A?"Saving…":"Save"}),l.jsx("button",{onClick:()=>S(!1),className:"px-3 py-1.5 rounded-lg bg-white/5 text-gray-400 text-[10px] font-bold hover:text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:"Cancel"})]})]}),(()=>{const Y=y.filter(he=>he.provider===r.output?.provider);return Y.length===0&&!j?l.jsxs("p",{className:"text-[10px] text-gray-600",children:["No credentials yet. Click ",l.jsx("span",{className:"text-gray-400",children:"+ New"})," to add one."]}):l.jsxs("select",{value:r.output.credentialId,onChange:he=>u({output:{...r.output,credentialId:he.target.value}}),className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-white/20",children:[l.jsx("option",{value:"",children:"Select credential…"}),Y.map(he=>l.jsx("option",{value:he.id,children:he.name},he.id))]})})(),y.filter(Y=>Y.provider===r.output?.provider).length>0&&l.jsx("div",{className:"space-y-1",children:y.filter(Y=>Y.provider===r.output?.provider).map(Y=>l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 rounded-lg bg-black/20 border border-white/5",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-white",children:Y.name}),l.jsx("span",{className:"text-[9px] text-gray-600 ml-2",children:Y.config.baseUrl})]}),l.jsx("button",{onClick:()=>Z(Y.id),className:"text-gray-600 hover:text-red-400 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded",children:l.jsx(ue,{name:"delete",className:"text-sm"})})]},Y.id))})]}),r.output.credentialId&&F&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Database"}),V&&l.jsx("div",{className:"w-3 h-3 border-2 border-white/20 border-t-white rounded-full animate-spin"})]}),l.jsxs("select",{value:r.output.databaseId||"",onChange:Y=>u({output:{...r.output,databaseId:Y.target.value,tableId:""}}),className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-white/20",disabled:V,children:[l.jsx("option",{value:"",children:"Select database…"}),O.map(Y=>l.jsx("option",{value:Y.id,children:Y.name},Y.id))]})]}),r.output.databaseId&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Table"}),ae&&l.jsx("div",{className:"w-3 h-3 border-2 border-white/20 border-t-white rounded-full animate-spin"})]}),l.jsxs("select",{value:r.output.tableId,onChange:Y=>u({output:{...r.output,tableId:Y.target.value}}),className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-white/20",disabled:ae,children:[l.jsx("option",{value:"",children:"Select table…"}),L.map(Y=>l.jsx("option",{value:Y.id,children:Y.name},Y.id))]})]})]}),r.output.credentialId&&!F&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Table ID"}),l.jsx("input",{className:"w-full bg-black/40 border border-white/5 rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none focus:border-white/20",placeholder:"e.g. 1234",value:r.output.tableId,onChange:Y=>u({output:{...r.output,tableId:Y.target.value}})}),l.jsxs("p",{className:"text-[9px] text-gray-600",children:["Your token doesn't support browsing. Use a ",l.jsx("span",{className:"text-gray-400",children:"Personal API Token"})," for dropdowns, or enter the Table ID from the Baserow URL."]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"On Push Error"}),l.jsx("div",{className:"flex gap-2",children:["ignore","fail"].map(Y=>l.jsx("button",{onClick:()=>u({output:{...r.output,onError:Y}}),className:`flex-1 py-2 rounded-lg text-[10px] font-bold uppercase tracking-widest transition-all focus:outline-none focus-visible:ring-2 ${r.output?.onError===Y?"bg-white text-black focus-visible:ring-blue-500":"bg-white/5 text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:Y==="ignore"?"Ignore":"Log Error"},Y))}),l.jsx("p",{className:"text-[9px] text-gray-600",children:r.output.onError==="fail"?"Push errors will be logged prominently in the server console.":"Push errors will be silently suppressed."})]})]})]}),w==="schedule"&&l.jsx(db,{currentTask:r,onUpdateTask:u}),w==="history"&&l.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-300",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Version History"}),x&&l.jsx("div",{className:"w-3 h-3 border-2 border-white/20 border-t-white rounded-full animate-spin"})]}),l.jsxs("div",{className:"space-y-2",children:[p.map(Y=>l.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4 flex items-center justify-between group hover:border-white/20 transition-all",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("div",{className:"text-xs font-bold text-white mb-0.5",children:new Date(Y.timestamp).toLocaleString()}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-white/10 text-gray-400 font-bold uppercase tracking-widest",children:Y.mode}),l.jsx("span",{className:"text-[9px] text-gray-600 truncate max-w-[150px]",children:Y.name||"Untitled"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>C(Y.id),className:"w-8 h-8 rounded-lg flex items-center justify-center text-white/30 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Preview version","aria-label":"Preview version",children:l.jsx(ue,{name:"visibility",className:"text-sm"})}),l.jsx("button",{onClick:()=>g(Y.id),className:"w-8 h-8 rounded-lg flex items-center justify-center text-white/30 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Rollback to this version","aria-label":"Rollback to this version",children:l.jsx(ue,{name:"restore",className:"text-sm"})})]})]},Y.id)),p.length===0&&!x&&l.jsx("div",{className:"text-center py-12 border border-dashed border-white/10 rounded-3xl",children:l.jsx("p",{className:"text-[10px] text-gray-600 uppercase tracking-widest",children:"No previous versions found"})})]})]})]})]})]})},hb=()=>{const[i,c]=E.useState({x:0,y:0}),[r,u]=E.useState(1),f=E.useRef(!1),d=E.useRef({x:0,y:0,offsetX:0,offsetY:0}),h=E.useRef(!1),p=E.useRef(null),x=E.useRef(!1),g=E.useRef(r);E.useEffect(()=>{g.current=r},[r]),E.useEffect(()=>{if(x.current)return;x.current=!0;const y=p.current;if(!y)return;const _=y.clientWidth;c({x:(_-400)/2,y:20})},[]),E.useEffect(()=>{const y=p.current;if(!y)return;const _=m=>{if(m.preventDefault(),m.ctrlKey||m.metaKey){const b=y.getBoundingClientRect(),j=m.clientX-b.left,S=m.clientY-b.top,A=g.current,M=m.deltaY<0?1.1:.9,O=Math.min(2,Math.max(.25,A*M)),U=O/A;c(L=>({x:j-U*(j-L.x),y:S-U*(S-L.y)})),u(O)}else c(b=>({x:b.x-m.deltaX,y:b.y-m.deltaY}))};return y.addEventListener("wheel",_,{passive:!1}),()=>y.removeEventListener("wheel",_)},[]);const C=E.useCallback(y=>{f.current=!0,d.current={x:y.clientX,y:y.clientY,offsetX:i.x,offsetY:i.y},y.target.setPointerCapture?.(y.pointerId)},[i]),w=E.useCallback(y=>{if(!f.current)return;const _=y.clientX-d.current.x,m=y.clientY-d.current.y;c({x:d.current.offsetX+_,y:d.current.offsetY+m})},[]),k=E.useCallback(()=>{f.current=!1},[]);return{canvasOffset:i,setCanvasOffset:c,canvasScale:r,setCanvasScale:u,canvasViewportRef:p,spaceHeldRef:h,isPanning:f,startPanning:C,handlePanning:w,stopPanning:k}},Ci=i=>{if(!i)return"";const{last_opened:c,versions:r,...u}=i;return JSON.stringify(u)},hr=i=>{if(typeof i=="boolean")return i;if(i==null)return!1;const c=String(i).toLowerCase();return c==="true"||c==="1"},pb=i=>i&&i[0].toUpperCase()+i.slice(1),Qp=i=>{if(!i.actions||!Array.isArray(i.actions))return i;let c=!1;const r=i.actions.map((u,f)=>u.id?u:(c=!0,{...u,id:`act_${Date.now()}_${f}_${Math.floor(Math.random()*1e3)}`}));return c?{...i,actions:r}:i},mb=()=>({name:"Imported Task",url:"",mode:"scrape",wait:3,selector:"",rotateUserAgents:!1,rotateProxies:!1,rotateViewport:!1,humanTyping:!1,stealth:{allowTypos:!1,idleMovements:!1,overscroll:!1,deadClicks:!1,fatigue:!1,naturalTyping:!1,cursorGlide:!1,randomizeClicks:!1},actions:[],variables:{},includeShadowDom:!0,disableRecording:!1,statelessExecution:!1}),xb=(i,c)=>{if(!i||typeof i!="object")return null;const r=mb(),u={...r,...i};return(!u.name||typeof u.name!="string")&&(u.name=`Imported Task ${c+1}`),(!u.mode||!["scrape","agent","headful"].includes(u.mode))&&(u.mode="scrape"),typeof u.wait!="number"&&(u.wait=3),u.stealth||(u.stealth=r.stealth),(!u.variables||Array.isArray(u.variables))&&(u.variables={}),Array.isArray(u.actions)||(u.actions=[]),u.rotateProxies===void 0&&(u.rotateProxies=!1),u.disableRecording===void 0&&(u.disableRecording=!1),u.disableRecording=hr(u.disableRecording),u.statelessExecution===void 0&&(u.statelessExecution=!1),u.statelessExecution=hr(u.statelessExecution),delete u.versions,delete u.last_opened,u},gb=()=>({name:"Task "+Math.floor(Math.random()*100),url:"",mode:"agent",wait:3,selector:"",rotateUserAgents:!1,rotateProxies:!1,rotateViewport:!1,humanTyping:!1,stealth:{allowTypos:!1,idleMovements:!1,overscroll:!1,deadClicks:!1,fatigue:!1,naturalTyping:!1,cursorGlide:!1,randomizeClicks:!1},actions:[],variables:{},extractionFormat:"json",includeHtml:!1,includeShadowDom:!0,disableRecording:!1,statelessExecution:!1}),bb=(i,c,r)=>{const u=E.useRef([]),f=E.useRef(-1),d=E.useRef(!1),h=E.useRef("");E.useEffect(()=>{if(d.current){d.current=!1;return}const g=Ci(i);if(g===h.current)return;const C=setTimeout(()=>{h.current=g,f.current<u.current.length-1&&(u.current=u.current.slice(0,f.current+1)),u.current.push(JSON.parse(g)),f.current=u.current.length-1,u.current.length>50&&(u.current.shift(),f.current-=1)},300);return()=>clearTimeout(C)},[i]);const p=E.useCallback(()=>{if(f.current>0){f.current-=1;const C={...u.current[f.current],versions:i.versions,last_opened:Date.now()};d.current=!0,h.current=Ci(C),c(C),r(C,!1)}},[c,r,i.versions]),x=E.useCallback(()=>{if(f.current<u.current.length-1){f.current+=1;const C={...u.current[f.current],versions:i.versions,last_opened:Date.now()};d.current=!0,h.current=Ci(C),c(C),r(C,!1)}},[c,r,i.versions]);return E.useEffect(()=>{const g=C=>{const w=document.activeElement;if(w){const y=w.tagName.toLowerCase(),_=w.getAttribute("contenteditable")==="true";if(y==="input"||y==="textarea"||_)return}const k=C.metaKey||C.ctrlKey;k&&C.key.toLowerCase()==="z"?(C.preventDefault(),C.shiftKey?x():p()):k&&!C.shiftKey&&C.key.toLowerCase()==="y"&&(C.preventDefault(),x())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[p,x]),{undo:p,redo:x}},yb=(i,c,r)=>{const[u,f]=E.useState(new Set),[d,h]=E.useState(null),[p,x]=E.useState(null),g=E.useRef(null),C=E.useCallback((b,j,S=!1)=>{c(S?A=>{if(!A)return null;const M={...A,actions:A.actions.map(O=>O.id===b?{...O,...j}:O)};return r(M,!1),M}:A=>A?{...A,actions:A.actions.map(M=>M.id===b?{...M,...j}:M)}:null)},[c,r]),w=E.useCallback((b,j)=>{b!==j&&c(S=>{if(!S)return null;const A=[...S.actions],M=A.findIndex(I=>I.id===b),O=A.findIndex(I=>I.id===j);if(M===-1||O===-1)return S;const[U]=A.splice(M,1);A.splice(O,0,U);const L={...S,actions:A};return r(L,!1),L})},[c,r]),k=E.useCallback(b=>{c(j=>{if(!j)return null;const S={...j,actions:j.actions.filter(A=>A.id!==b)};return r(S,!1),S})},[c,r]),y=E.useCallback((b,j,S,A)=>{if(S!==void 0&&A!==void 0&&Math.abs(b-A)<14)return S;const M=i.actions;let O=M.length-1;for(let U=0;U<M.length;U++){if(M[U].id===j)continue;const L=document.getElementById(`action-${M[U].id}`);if(!L)continue;const I=L.getBoundingClientRect(),V=I.top+I.height*.4;if(b<V){O=U;break}}return O},[i.actions]),_=E.useCallback(()=>{if(d){if(p!==null&&p!==d.index){const b=i.actions[p]?.id;b&&w(d.id,b)}h(null),x(null),g.current=null}},[d,p,i.actions,w]),m=E.useCallback((b,j,S)=>{if(b.shiftKey||b.ctrlKey||b.metaKey){f(O=>{const U=new Set(O);return U.has(j)?U.delete(j):U.add(j),U});return}f(new Set([j]));const A=document.getElementById(`action-${j}`);if(!A)return;const M=A.getBoundingClientRect();g.current=b.pointerId,h({id:j,startY:b.clientY,currentY:b.clientY,height:M.height,index:S,originTop:M.top,pointerOffset:b.clientY-M.top}),x(S)},[]);return E.useEffect(()=>{if(!d)return;const b=S=>{if(g.current!==null&&S.pointerId!==g.current)return;const A=d.originTop+d.height/2,M=y(S.clientY,d.id,d.index,A);h(O=>O&&{...O,currentY:S.clientY}),x(M)},j=S=>{g.current!==null&&S.pointerId!==g.current||_()};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j)}},[d,y,_]),{selectedActionIds:u,setSelectedActionIds:f,dragState:d,dragOverIndex:p,updateAction:C,moveAction:w,removeAction:k,handleActionPointerDown:m}},vb=(i,c,r,u)=>{const[f,d]=E.useState([]),[h,p]=E.useState(!1),[x,g]=E.useState(null),C=E.useCallback(async()=>{if(i.id){p(!0);try{const y=await fetch(`/api/tasks/${i.id}/versions`);if(!y.ok)throw new Error("Failed to load versions");const _=await y.json();d(Array.isArray(_.versions)?_.versions:[])}catch{d([])}finally{p(!1)}}},[i.id]),w=E.useCallback(async y=>{if(!(!i.id||!await r("Rollback to this version? Current changes will be saved as a new version.")))try{const m=await fetch(`/api/tasks/${i.id}/rollback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({versionId:y})});if(!m.ok)throw new Error("Rollback failed");const b=await m.json();u(b),c("Rolled back to selected version.","success"),C()}catch{c("Rollback failed.","error")}},[i.id,r,c,u,C]),k=E.useCallback(async y=>{if(i.id)try{const _=await fetch(`/api/tasks/${i.id}/versions/${y}`);if(!_.ok)throw new Error("Failed to load version");const m=await _.json();if(!m?.snapshot)throw new Error("Missing snapshot");g({id:m.metadata?.id||y,timestamp:m.metadata?.timestamp||Date.now(),snapshot:m.snapshot})}catch{c("Failed to load version snapshot.","error")}},[i.id,c]);return{versions:f,versionsLoading:h,versionPreview:x,setVersionPreview:g,loadVersions:C,rollbackToVersion:w,openVersionPreview:k}},wb=(i,c,r,u,f)=>{const[d,h]=E.useState(!1),[p,x]=E.useState(!1),[g,C]=E.useState(null),[w,k]=E.useState({}),y=E.useRef(null);E.useEffect(()=>{y.current=g},[g]);const _=E.useRef(f);E.useEffect(()=>{_.current=f},[f]),E.useEffect(()=>{c?y.current&&h(!0):(h(!1),x(!1))},[c]),E.useEffect(()=>{let b=null;return c&&(b=new EventSource("/api/headful/selector_stream"),b.onmessage=j=>{try{const S=JSON.parse(j.data),A=y.current;if(S.selector&&A){try{const M=JSON.parse(S.selector);Array.isArray(M)&&M.length>0?(k(O=>({...O,[A]:M})),r(A,{selector:M[0]},!0)):r(A,{selector:S.selector},!0)}catch{r(A,{selector:S.selector},!0)}C(null),_.current?.()}}catch{}}),()=>{b&&b.close()}},[c,r]);const m=E.useCallback(async()=>{const b=!d;x(!0);try{if(!(await fetch("/api/headful/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:b})})).ok)throw new Error("Failed to toggle inspect mode");h(b),u(`Inspect mode ${b?"enabled":"disabled"}`,"success")}catch{u("Failed to toggle inspect mode","error")}finally{x(!1)}},[d,u]);return{isInspectMode:d,isInspectLoading:p,activeInspectActionId:g,setActiveInspectActionId:C,selectorOptionsById:w,handleToggleInspect:m}},jb=()=>{const[i,c]=E.useState([]),[r,u]=E.useState(!1);return E.useEffect(()=>{let f=!1;return(async()=>{try{const h=await fetch("/api/settings/proxies",{credentials:"include"});if(!h.ok)throw new Error("Failed to load proxies");const p=await h.json();if(f)return;c(Array.isArray(p.proxies)?p.proxies:[])}catch{f||c([])}finally{f||u(!0)}})(),()=>{f=!0}},[]),{proxyList:i,proxyListLoaded:r}},Sb=({currentTask:i,onUpdateTaskName:c,onAutoSave:r,onOpenHistory:u})=>l.jsx("div",{className:"fixed top-0 left-0 right-0 z-40 w-full pointer-events-none",children:l.jsxs("div",{className:"glass-card flex items-center justify-between p-1 px-6 border-b border-white/10 backdrop-blur-xl pointer-events-auto",children:[l.jsx("div",{className:"flex-1 overflow-hidden flex justify-center",children:l.jsx("input",{type:"text",value:i.name||"",onChange:f=>c(f.target.value),onBlur:()=>r(),placeholder:"Task name",className:"bg-transparent border-none text-[11px] font-bold text-white uppercase tracking-[0.25em] focus:outline-none w-full max-w-[400px] text-center placeholder:text-white/20 py-1"})}),l.jsx("div",{className:"flex items-center gap-1",children:l.jsx("button",{onClick:u,className:"w-8 h-8 rounded-lg flex items-center justify-center text-white/30 hover:text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Version History","aria-label":"Version History",children:l.jsx(ue,{name:"history",className:"text-base"})})})]})}),Nb=({isExecuting:i,isHeadfulOpen:c,onRun:r,onStop:u,onOpenHeadful:f,onStopHeadful:d})=>l.jsxs("div",{className:"fixed bottom-8 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 bg-[#111] border border-white/10 p-2 rounded-3xl shadow-2xl backdrop-blur-xl",children:[l.jsxs("button",{onClick:r,disabled:i||c,className:"shine-effect bg-white text-black px-8 py-4 rounded-2xl font-bold text-[10px] tracking-[0.3em] uppercase transition-all shadow-xl shadow-white/5 flex items-center justify-center gap-3 disabled:opacity-50 disabled:cursor-not-allowed min-w-[200px] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",title:"Run Task (Ctrl + Enter)","aria-label":"Run Task (Ctrl + Enter)",children:[i?l.jsx("div",{className:"w-3 h-3 border-2 border-black/20 border-t-black rounded-full animate-spin"}):l.jsx(ue,{name:"play_arrow",className:"text-sm text-black"}),l.jsx("span",{children:i?"Running...":"Run Task"})]}),i&&l.jsx("button",{onClick:()=>u?.(),className:"w-12 h-12 rounded-2xl border border-white/10 text-white/80 hover:text-white hover:bg-white/10 transition-all flex items-center justify-center",title:"Stop task","aria-label":"Stop task",children:l.jsx(ue,{name:"stop",className:"text-base"})}),l.jsxs("button",{onClick:()=>{c?d?.():f()},disabled:i,className:`px-4 h-12 rounded-2xl border text-[9px] font-bold uppercase tracking-widest transition-all flex items-center gap-2 disabled:opacity-30 disabled:cursor-not-allowed ${c?"border-blue-500/30 bg-blue-500/20 text-blue-400 hover:bg-blue-500/30":"border-white/10 text-white/80 hover:text-white hover:bg-white/10"}`,title:c?"Stop headful browser":"Open browser to log in",children:[l.jsx(ue,{name:c?"stop":"open_in_browser",className:"text-base"}),c?"Close Browser":"Open Browser"]})]});function Zc(){return Zc=Object.assign?Object.assign.bind():function(i){for(var c=1;c<arguments.length;c++){var r=arguments[c];for(var u in r)({}).hasOwnProperty.call(r,u)&&(i[u]=r[u])}return i},Zc.apply(null,arguments)}function rp(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function $c(i,c){return $c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,u){return r.__proto__=u,r},$c(i,c)}function _b(i,c){i.prototype=Object.create(c.prototype),i.prototype.constructor=i,$c(i,c)}var op=Number.isNaN||function(c){return typeof c=="number"&&c!==c};function Cb(i,c){return!!(i===c||op(i)&&op(c))}function kb(i,c){if(i.length!==c.length)return!1;for(var r=0;r<i.length;r++)if(!Cb(i[r],c[r]))return!1;return!0}function Hc(i,c){c===void 0&&(c=kb);var r,u=[],f,d=!1;function h(){for(var p=[],x=0;x<arguments.length;x++)p[x]=arguments[x];return d&&r===this&&c(p,u)||(f=i.apply(this,p),d=!0,r=this,u=p),f}return h}var Eb=typeof performance=="object"&&typeof performance.now=="function",cp=Eb?function(){return performance.now()}:function(){return Date.now()};function up(i){cancelAnimationFrame(i.id)}function Ab(i,c){var r=cp();function u(){cp()-r>=c?i.call(null):f.id=requestAnimationFrame(u)}var f={id:requestAnimationFrame(u)};return f}var Yc=-1;function dp(i){if(i===void 0&&(i=!1),Yc===-1||i){var c=document.createElement("div"),r=c.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(c),Yc=c.offsetWidth-c.clientWidth,document.body.removeChild(c)}return Yc}var El=null;function fp(i){if(i===void 0&&(i=!1),El===null||i){var c=document.createElement("div"),r=c.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var u=document.createElement("div"),f=u.style;return f.width="100px",f.height="100px",c.appendChild(u),document.body.appendChild(c),c.scrollLeft>0?El="positive-descending":(c.scrollLeft=1,c.scrollLeft===0?El="negative":El="positive-ascending"),document.body.removeChild(c),El}return El}var zb=150,Rb=function(c,r){return c};function Ob(i){var c,r=i.getItemOffset,u=i.getEstimatedTotalSize,f=i.getItemSize,d=i.getOffsetForIndexAndAlignment,h=i.getStartIndexForOffset,p=i.getStopIndexForStartIndex,x=i.initInstanceProps,g=i.shouldResetStyleCacheOnItemSizeChange,C=i.validateProps;return c=(function(w){_b(k,w);function k(_){var m;return m=w.call(this,_)||this,m._instanceProps=x(m.props,rp(m)),m._outerRef=void 0,m._resetIsScrollingTimeoutId=null,m.state={instance:rp(m),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof m.props.initialScrollOffset=="number"?m.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},m._callOnItemsRendered=void 0,m._callOnItemsRendered=Hc(function(b,j,S,A){return m.props.onItemsRendered({overscanStartIndex:b,overscanStopIndex:j,visibleStartIndex:S,visibleStopIndex:A})}),m._callOnScroll=void 0,m._callOnScroll=Hc(function(b,j,S){return m.props.onScroll({scrollDirection:b,scrollOffset:j,scrollUpdateWasRequested:S})}),m._getItemStyle=void 0,m._getItemStyle=function(b){var j=m.props,S=j.direction,A=j.itemSize,M=j.layout,O=m._getItemStyleCache(g&&A,g&&M,g&&S),U;if(O.hasOwnProperty(b))U=O[b];else{var L=r(m.props,b,m._instanceProps),I=f(m.props,b,m._instanceProps),V=S==="horizontal"||M==="horizontal",de=S==="rtl",ae=V?L:0;O[b]=U={position:"absolute",left:de?void 0:ae,right:de?ae:void 0,top:V?0:L,height:V?"100%":I,width:V?I:"100%"}}return U},m._getItemStyleCache=void 0,m._getItemStyleCache=Hc(function(b,j,S){return{}}),m._onScrollHorizontal=function(b){var j=b.currentTarget,S=j.clientWidth,A=j.scrollLeft,M=j.scrollWidth;m.setState(function(O){if(O.scrollOffset===A)return null;var U=m.props.direction,L=A;if(U==="rtl")switch(fp()){case"negative":L=-A;break;case"positive-descending":L=M-S-A;break}return L=Math.max(0,Math.min(L,M-S)),{isScrolling:!0,scrollDirection:O.scrollOffset<L?"forward":"backward",scrollOffset:L,scrollUpdateWasRequested:!1}},m._resetIsScrollingDebounced)},m._onScrollVertical=function(b){var j=b.currentTarget,S=j.clientHeight,A=j.scrollHeight,M=j.scrollTop;m.setState(function(O){if(O.scrollOffset===M)return null;var U=Math.max(0,Math.min(M,A-S));return{isScrolling:!0,scrollDirection:O.scrollOffset<U?"forward":"backward",scrollOffset:U,scrollUpdateWasRequested:!1}},m._resetIsScrollingDebounced)},m._outerRefSetter=function(b){var j=m.props.outerRef;m._outerRef=b,typeof j=="function"?j(b):j!=null&&typeof j=="object"&&j.hasOwnProperty("current")&&(j.current=b)},m._resetIsScrollingDebounced=function(){m._resetIsScrollingTimeoutId!==null&&up(m._resetIsScrollingTimeoutId),m._resetIsScrollingTimeoutId=Ab(m._resetIsScrolling,zb)},m._resetIsScrolling=function(){m._resetIsScrollingTimeoutId=null,m.setState({isScrolling:!1},function(){m._getItemStyleCache(-1,null)})},m}k.getDerivedStateFromProps=function(m,b){return Db(m,b),C(m),null};var y=k.prototype;return y.scrollTo=function(m){m=Math.max(0,m),this.setState(function(b){return b.scrollOffset===m?null:{scrollDirection:b.scrollOffset<m?"forward":"backward",scrollOffset:m,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(m,b){b===void 0&&(b="auto");var j=this.props,S=j.itemCount,A=j.layout,M=this.state.scrollOffset;m=Math.max(0,Math.min(m,S-1));var O=0;if(this._outerRef){var U=this._outerRef;A==="vertical"?O=U.scrollWidth>U.clientWidth?dp():0:O=U.scrollHeight>U.clientHeight?dp():0}this.scrollTo(d(this.props,m,b,M,this._instanceProps,O))},y.componentDidMount=function(){var m=this.props,b=m.direction,j=m.initialScrollOffset,S=m.layout;if(typeof j=="number"&&this._outerRef!=null){var A=this._outerRef;b==="horizontal"||S==="horizontal"?A.scrollLeft=j:A.scrollTop=j}this._callPropsCallbacks()},y.componentDidUpdate=function(){var m=this.props,b=m.direction,j=m.layout,S=this.state,A=S.scrollOffset,M=S.scrollUpdateWasRequested;if(M&&this._outerRef!=null){var O=this._outerRef;if(b==="horizontal"||j==="horizontal")if(b==="rtl")switch(fp()){case"negative":O.scrollLeft=-A;break;case"positive-ascending":O.scrollLeft=A;break;default:var U=O.clientWidth,L=O.scrollWidth;O.scrollLeft=L-U-A;break}else O.scrollLeft=A;else O.scrollTop=A}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&up(this._resetIsScrollingTimeoutId)},y.render=function(){var m=this.props,b=m.children,j=m.className,S=m.direction,A=m.height,M=m.innerRef,O=m.innerElementType,U=m.innerTagName,L=m.itemCount,I=m.itemData,V=m.itemKey,de=V===void 0?Rb:V,ae=m.layout,H=m.outerElementType,F=m.outerTagName,z=m.style,se=m.useIsScrolling,$=m.width,P=this.state.isScrolling,Z=S==="horizontal"||ae==="horizontal",X=Z?this._onScrollHorizontal:this._onScrollVertical,ge=this._getRangeToRender(),R=ge[0],D=ge[1],W=[];if(L>0)for(var te=R;te<=D;te++)W.push(E.createElement(b,{data:I,key:de(te,I),index:te,isScrolling:se?P:void 0,style:this._getItemStyle(te)}));var Y=u(this.props,this._instanceProps);return E.createElement(H||F||"div",{className:j,onScroll:X,ref:this._outerRefSetter,style:Zc({position:"relative",height:A,width:$,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:S},z)},E.createElement(O||U||"div",{children:W,ref:M,style:{height:Z?"100%":Y,pointerEvents:P?"none":void 0,width:Z?Y:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var m=this.props.itemCount;if(m>0){var b=this._getRangeToRender(),j=b[0],S=b[1],A=b[2],M=b[3];this._callOnItemsRendered(j,S,A,M)}}if(typeof this.props.onScroll=="function"){var O=this.state,U=O.scrollDirection,L=O.scrollOffset,I=O.scrollUpdateWasRequested;this._callOnScroll(U,L,I)}},y._getRangeToRender=function(){var m=this.props,b=m.itemCount,j=m.overscanCount,S=this.state,A=S.isScrolling,M=S.scrollDirection,O=S.scrollOffset;if(b===0)return[0,0,0,0];var U=h(this.props,O,this._instanceProps),L=p(this.props,U,O,this._instanceProps),I=!A||M==="backward"?Math.max(1,j):1,V=!A||M==="forward"?Math.max(1,j):1;return[Math.max(0,U-I),Math.max(0,Math.min(b-1,L+V)),U,L]},k})(E.PureComponent),c.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},c}var Db=function(c,r){c.children,c.direction,c.height,c.layout,c.innerTagName,c.outerTagName,c.width,r.instance},xr=Ob({getItemOffset:function(c,r){var u=c.itemSize;return r*u},getItemSize:function(c,r){var u=c.itemSize;return u},getEstimatedTotalSize:function(c){var r=c.itemCount,u=c.itemSize;return u*r},getOffsetForIndexAndAlignment:function(c,r,u,f,d,h){var p=c.direction,x=c.height,g=c.itemCount,C=c.itemSize,w=c.layout,k=c.width,y=p==="horizontal"||w==="horizontal",_=y?k:x,m=Math.max(0,g*C-_),b=Math.min(m,r*C),j=Math.max(0,r*C-_+C+h);switch(u==="smart"&&(f>=j-_&&f<=b+_?u="auto":u="center"),u){case"start":return b;case"end":return j;case"center":{var S=Math.round(j+(b-j)/2);return S<Math.ceil(_/2)?0:S>m+Math.floor(_/2)?m:S}default:return f>=j&&f<=b?f:f<j?j:b}},getStartIndexForOffset:function(c,r){var u=c.itemCount,f=c.itemSize;return Math.max(0,Math.min(u-1,Math.floor(r/f)))},getStopIndexForStartIndex:function(c,r,u){var f=c.direction,d=c.height,h=c.itemCount,p=c.itemSize,x=c.layout,g=c.width,C=f==="horizontal"||x==="horizontal",w=r*p,k=C?g:d,y=Math.ceil((k+u-w)/p);return Math.max(0,Math.min(h-1,r+y-1))},initInstanceProps:function(c){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(c){c.itemSize}});const Tb=(i,c=2)=>{if(i===0)return"0 B";const r=1024,u=c<0?0:c,f=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],d=Math.floor(Math.log(i)/Math.log(r));return parseFloat((i/Math.pow(r,d)).toFixed(u))+" "+f[d]},Mb=({capture:i,onDelete:c})=>{const r=new URL(i.url,window.location.origin).toString();return l.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/[0.02] overflow-hidden",children:[l.jsxs("div",{className:"p-3 border-b border-white/10 flex items-center justify-between",children:[l.jsxs("div",{className:"text-[9px] font-bold text-white uppercase tracking-widest flex items-center gap-1.5",children:[l.jsx(ue,{name:i.type==="recording"?"play_circle":"photo_camera",className:"text-xs text-white/50"}),i.type==="recording"?"Recording":"Screenshot"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Vn,{text:r,title:"Copy URL",className:"p-1.5 rounded-lg text-white/50 hover:text-white hover:bg-white/10 transition-all",iconClassName:"text-sm"}),l.jsx("a",{href:i.url,download:i.name,className:"p-1.5 rounded-lg text-white/50 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Download","aria-label":"Download capture",children:l.jsx(ue,{name:"download",className:"text-sm"})}),l.jsx("a",{href:i.url,target:"_blank",rel:"noreferrer",className:"p-1.5 rounded-lg text-white/50 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Open in new tab","aria-label":"Open capture in new tab",children:l.jsx(ue,{name:"open_in_new",className:"text-sm"})}),c&&l.jsx("button",{onClick:()=>c(i.name),className:"p-1.5 rounded-lg text-red-300 hover:text-red-200 hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Delete","aria-label":"Delete capture",children:l.jsx(ue,{name:"delete",className:"text-sm"})})]})]}),l.jsx("div",{className:"bg-black relative group",children:i.type==="recording"?l.jsx("video",{src:i.url,controls:!0,className:"w-full h-64 object-contain bg-black"}):l.jsx("img",{src:i.url,className:"w-full h-64 object-contain bg-black",alt:`Screenshot of ${i.name}`})}),l.jsxs("div",{className:"p-3 border-t border-white/5 bg-white/[0.01]",children:[l.jsx("div",{className:"text-[9px] text-white font-bold uppercase tracking-widest truncate",title:i.name,children:i.name}),l.jsxs("div",{className:"flex items-center justify-between mt-1 text-[8px] text-gray-500 uppercase tracking-widest",children:[l.jsx("span",{children:Tb(i.size)}),l.jsx("span",{children:new Date(i.modified).toLocaleDateString()})]})]})]})},Fp=tt.memo(Mb);function Ws(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var qc={exports:{}};var hp;function Ub(){return hp||(hp=1,(function(i,c){(function(r){i.exports=r()})(function(){return(function r(u,f,d){function h(g,C){if(!f[g]){if(!u[g]){var w=typeof Ws=="function"&&Ws;if(!C&&w)return w(g,!0);if(p)return p(g,!0);var k=new Error("Cannot find module '"+g+"'");throw k.code="MODULE_NOT_FOUND",k}var y=f[g]={exports:{}};u[g][0].call(y.exports,function(_){var m=u[g][1][_];return h(m||_)},y,y.exports,r,u,f,d)}return f[g].exports}for(var p=typeof Ws=="function"&&Ws,x=0;x<d.length;x++)h(d[x]);return h})({1:[function(r,u,f){var d=r("./utils"),h=r("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";f.encode=function(x){for(var g,C,w,k,y,_,m,b=[],j=0,S=x.length,A=S,M=d.getTypeOf(x)!=="string";j<x.length;)A=S-j,w=M?(g=x[j++],C=j<S?x[j++]:0,j<S?x[j++]:0):(g=x.charCodeAt(j++),C=j<S?x.charCodeAt(j++):0,j<S?x.charCodeAt(j++):0),k=g>>2,y=(3&g)<<4|C>>4,_=1<A?(15&C)<<2|w>>6:64,m=2<A?63&w:64,b.push(p.charAt(k)+p.charAt(y)+p.charAt(_)+p.charAt(m));return b.join("")},f.decode=function(x){var g,C,w,k,y,_,m=0,b=0,j="data:";if(x.substr(0,j.length)===j)throw new Error("Invalid base64 input, it looks like a data url.");var S,A=3*(x=x.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(x.charAt(x.length-1)===p.charAt(64)&&A--,x.charAt(x.length-2)===p.charAt(64)&&A--,A%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=h.uint8array?new Uint8Array(0|A):new Array(0|A);m<x.length;)g=p.indexOf(x.charAt(m++))<<2|(k=p.indexOf(x.charAt(m++)))>>4,C=(15&k)<<4|(y=p.indexOf(x.charAt(m++)))>>2,w=(3&y)<<6|(_=p.indexOf(x.charAt(m++))),S[b++]=g,y!==64&&(S[b++]=C),_!==64&&(S[b++]=w);return S}},{"./support":30,"./utils":32}],2:[function(r,u,f){var d=r("./external"),h=r("./stream/DataWorker"),p=r("./stream/Crc32Probe"),x=r("./stream/DataLengthProbe");function g(C,w,k,y,_){this.compressedSize=C,this.uncompressedSize=w,this.crc32=k,this.compression=y,this.compressedContent=_}g.prototype={getContentWorker:function(){var C=new h(d.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new x("data_length")),w=this;return C.on("end",function(){if(this.streamInfo.data_length!==w.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),C},getCompressedWorker:function(){return new h(d.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},g.createWorkerFrom=function(C,w,k){return C.pipe(new p).pipe(new x("uncompressedSize")).pipe(w.compressWorker(k)).pipe(new x("compressedSize")).withStreamInfo("compression",w)},u.exports=g},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,u,f){var d=r("./stream/GenericWorker");f.STORE={magic:"\0\0",compressWorker:function(){return new d("STORE compression")},uncompressWorker:function(){return new d("STORE decompression")}},f.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,u,f){var d=r("./utils"),h=(function(){for(var p,x=[],g=0;g<256;g++){p=g;for(var C=0;C<8;C++)p=1&p?3988292384^p>>>1:p>>>1;x[g]=p}return x})();u.exports=function(p,x){return p!==void 0&&p.length?d.getTypeOf(p)!=="string"?(function(g,C,w,k){var y=h,_=k+w;g^=-1;for(var m=k;m<_;m++)g=g>>>8^y[255&(g^C[m])];return-1^g})(0|x,p,p.length,0):(function(g,C,w,k){var y=h,_=k+w;g^=-1;for(var m=k;m<_;m++)g=g>>>8^y[255&(g^C.charCodeAt(m))];return-1^g})(0|x,p,p.length,0):0}},{"./utils":32}],5:[function(r,u,f){f.base64=!1,f.binary=!1,f.dir=!1,f.createFolders=!0,f.date=null,f.compression=null,f.compressionOptions=null,f.comment=null,f.unixPermissions=null,f.dosPermissions=null},{}],6:[function(r,u,f){var d=null;d=typeof Promise<"u"?Promise:r("lie"),u.exports={Promise:d}},{lie:37}],7:[function(r,u,f){var d=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",h=r("pako"),p=r("./utils"),x=r("./stream/GenericWorker"),g=d?"uint8array":"array";function C(w,k){x.call(this,"FlateWorker/"+w),this._pako=null,this._pakoAction=w,this._pakoOptions=k,this.meta={}}f.magic="\b\0",p.inherits(C,x),C.prototype.processChunk=function(w){this.meta=w.meta,this._pako===null&&this._createPako(),this._pako.push(p.transformTo(g,w.data),!1)},C.prototype.flush=function(){x.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},C.prototype.cleanUp=function(){x.prototype.cleanUp.call(this),this._pako=null},C.prototype._createPako=function(){this._pako=new h[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var w=this;this._pako.onData=function(k){w.push({data:k,meta:w.meta})}},f.compressWorker=function(w){return new C("Deflate",w)},f.uncompressWorker=function(){return new C("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,u,f){function d(y,_){var m,b="";for(m=0;m<_;m++)b+=String.fromCharCode(255&y),y>>>=8;return b}function h(y,_,m,b,j,S){var A,M,O=y.file,U=y.compression,L=S!==g.utf8encode,I=p.transformTo("string",S(O.name)),V=p.transformTo("string",g.utf8encode(O.name)),de=O.comment,ae=p.transformTo("string",S(de)),H=p.transformTo("string",g.utf8encode(de)),F=V.length!==O.name.length,z=H.length!==de.length,se="",$="",P="",Z=O.dir,X=O.date,ge={crc32:0,compressedSize:0,uncompressedSize:0};_&&!m||(ge.crc32=y.crc32,ge.compressedSize=y.compressedSize,ge.uncompressedSize=y.uncompressedSize);var R=0;_&&(R|=8),L||!F&&!z||(R|=2048);var D=0,W=0;Z&&(D|=16),j==="UNIX"?(W=798,D|=(function(Y,he){var ke=Y;return Y||(ke=he?16893:33204),(65535&ke)<<16})(O.unixPermissions,Z)):(W=20,D|=(function(Y){return 63&(Y||0)})(O.dosPermissions)),A=X.getUTCHours(),A<<=6,A|=X.getUTCMinutes(),A<<=5,A|=X.getUTCSeconds()/2,M=X.getUTCFullYear()-1980,M<<=4,M|=X.getUTCMonth()+1,M<<=5,M|=X.getUTCDate(),F&&($=d(1,1)+d(C(I),4)+V,se+="up"+d($.length,2)+$),z&&(P=d(1,1)+d(C(ae),4)+H,se+="uc"+d(P.length,2)+P);var te="";return te+=`
12
+ \0`,te+=d(R,2),te+=U.magic,te+=d(A,2),te+=d(M,2),te+=d(ge.crc32,4),te+=d(ge.compressedSize,4),te+=d(ge.uncompressedSize,4),te+=d(I.length,2),te+=d(se.length,2),{fileRecord:w.LOCAL_FILE_HEADER+te+I+se,dirRecord:w.CENTRAL_FILE_HEADER+d(W,2)+te+d(ae.length,2)+"\0\0\0\0"+d(D,4)+d(b,4)+I+se+ae}}var p=r("../utils"),x=r("../stream/GenericWorker"),g=r("../utf8"),C=r("../crc32"),w=r("../signature");function k(y,_,m,b){x.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=_,this.zipPlatform=m,this.encodeFileName=b,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}p.inherits(k,x),k.prototype.push=function(y){var _=y.meta.percent||0,m=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,x.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:m?(_+100*(m-b-1))/m:100}}))},k.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var _=this.streamFiles&&!y.file.dir;if(_){var m=h(y,_,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},k.prototype.closedSource=function(y){this.accumulate=!1;var _=this.streamFiles&&!y.file.dir,m=h(y,_,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),_)this.push({data:(function(b){return w.DATA_DESCRIPTOR+d(b.crc32,4)+d(b.compressedSize,4)+d(b.uncompressedSize,4)})(y),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},k.prototype.flush=function(){for(var y=this.bytesWritten,_=0;_<this.dirRecords.length;_++)this.push({data:this.dirRecords[_],meta:{percent:100}});var m=this.bytesWritten-y,b=(function(j,S,A,M,O){var U=p.transformTo("string",O(M));return w.CENTRAL_DIRECTORY_END+"\0\0\0\0"+d(j,2)+d(j,2)+d(S,4)+d(A,4)+d(U.length,2)+U})(this.dirRecords.length,m,y,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},k.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},k.prototype.registerPrevious=function(y){this._sources.push(y);var _=this;return y.on("data",function(m){_.processChunk(m)}),y.on("end",function(){_.closedSource(_.previous.streamInfo),_._sources.length?_.prepareNextSource():_.end()}),y.on("error",function(m){_.error(m)}),this},k.prototype.resume=function(){return!!x.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},k.prototype.error=function(y){var _=this._sources;if(!x.prototype.error.call(this,y))return!1;for(var m=0;m<_.length;m++)try{_[m].error(y)}catch{}return!0},k.prototype.lock=function(){x.prototype.lock.call(this);for(var y=this._sources,_=0;_<y.length;_++)y[_].lock()},u.exports=k},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,u,f){var d=r("../compressions"),h=r("./ZipFileWorker");f.generateWorker=function(p,x,g){var C=new h(x.streamFiles,g,x.platform,x.encodeFileName),w=0;try{p.forEach(function(k,y){w++;var _=(function(S,A){var M=S||A,O=d[M];if(!O)throw new Error(M+" is not a valid compression method !");return O})(y.options.compression,x.compression),m=y.options.compressionOptions||x.compressionOptions||{},b=y.dir,j=y.date;y._compressWorker(_,m).withStreamInfo("file",{name:k,dir:b,date:j,comment:y.comment||"",unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions}).pipe(C)}),C.entriesCount=w}catch(k){C.error(k)}return C}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,u,f){function d(){if(!(this instanceof d))return new d;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var h=new d;for(var p in this)typeof this[p]!="function"&&(h[p]=this[p]);return h}}(d.prototype=r("./object")).loadAsync=r("./load"),d.support=r("./support"),d.defaults=r("./defaults"),d.version="3.10.1",d.loadAsync=function(h,p){return new d().loadAsync(h,p)},d.external=r("./external"),u.exports=d},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,u,f){var d=r("./utils"),h=r("./external"),p=r("./utf8"),x=r("./zipEntries"),g=r("./stream/Crc32Probe"),C=r("./nodejsUtils");function w(k){return new h.Promise(function(y,_){var m=k.decompressed.getContentWorker().pipe(new g);m.on("error",function(b){_(b)}).on("end",function(){m.streamInfo.crc32!==k.decompressed.crc32?_(new Error("Corrupted zip : CRC32 mismatch")):y()}).resume()})}u.exports=function(k,y){var _=this;return y=d.extend(y||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:p.utf8decode}),C.isNode&&C.isStream(k)?h.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):d.prepareContent("the loaded zip file",k,!0,y.optimizedBinaryString,y.base64).then(function(m){var b=new x(y);return b.load(m),b}).then(function(m){var b=[h.Promise.resolve(m)],j=m.files;if(y.checkCRC32)for(var S=0;S<j.length;S++)b.push(w(j[S]));return h.Promise.all(b)}).then(function(m){for(var b=m.shift(),j=b.files,S=0;S<j.length;S++){var A=j[S],M=A.fileNameStr,O=d.resolve(A.fileNameStr);_.file(O,A.decompressed,{binary:!0,optimizedBinaryString:!0,date:A.date,dir:A.dir,comment:A.fileCommentStr.length?A.fileCommentStr:null,unixPermissions:A.unixPermissions,dosPermissions:A.dosPermissions,createFolders:y.createFolders}),A.dir||(_.file(O).unsafeOriginalName=M)}return b.zipComment.length&&(_.comment=b.zipComment),_})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,u,f){var d=r("../utils"),h=r("../stream/GenericWorker");function p(x,g){h.call(this,"Nodejs stream input adapter for "+x),this._upstreamEnded=!1,this._bindStream(g)}d.inherits(p,h),p.prototype._bindStream=function(x){var g=this;(this._stream=x).pause(),x.on("data",function(C){g.push({data:C,meta:{percent:0}})}).on("error",function(C){g.isPaused?this.generatedError=C:g.error(C)}).on("end",function(){g.isPaused?g._upstreamEnded=!0:g.end()})},p.prototype.pause=function(){return!!h.prototype.pause.call(this)&&(this._stream.pause(),!0)},p.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},u.exports=p},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,u,f){var d=r("readable-stream").Readable;function h(p,x,g){d.call(this,x),this._helper=p;var C=this;p.on("data",function(w,k){C.push(w)||C._helper.pause(),g&&g(k)}).on("error",function(w){C.emit("error",w)}).on("end",function(){C.push(null)})}r("../utils").inherits(h,d),h.prototype._read=function(){this._helper.resume()},u.exports=h},{"../utils":32,"readable-stream":16}],14:[function(r,u,f){u.exports={isNode:typeof Buffer<"u",newBufferFrom:function(d,h){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(d,h);if(typeof d=="number")throw new Error('The "data" argument must not be a number');return new Buffer(d,h)},allocBuffer:function(d){if(Buffer.alloc)return Buffer.alloc(d);var h=new Buffer(d);return h.fill(0),h},isBuffer:function(d){return Buffer.isBuffer(d)},isStream:function(d){return d&&typeof d.on=="function"&&typeof d.pause=="function"&&typeof d.resume=="function"}}},{}],15:[function(r,u,f){function d(O,U,L){var I,V=p.getTypeOf(U),de=p.extend(L||{},C);de.date=de.date||new Date,de.compression!==null&&(de.compression=de.compression.toUpperCase()),typeof de.unixPermissions=="string"&&(de.unixPermissions=parseInt(de.unixPermissions,8)),de.unixPermissions&&16384&de.unixPermissions&&(de.dir=!0),de.dosPermissions&&16&de.dosPermissions&&(de.dir=!0),de.dir&&(O=j(O)),de.createFolders&&(I=b(O))&&S.call(this,I,!0);var ae=V==="string"&&de.binary===!1&&de.base64===!1;L&&L.binary!==void 0||(de.binary=!ae),(U instanceof w&&U.uncompressedSize===0||de.dir||!U||U.length===0)&&(de.base64=!1,de.binary=!0,U="",de.compression="STORE",V="string");var H=null;H=U instanceof w||U instanceof x?U:_.isNode&&_.isStream(U)?new m(O,U):p.prepareContent(O,U,de.binary,de.optimizedBinaryString,de.base64);var F=new k(O,H,de);this.files[O]=F}var h=r("./utf8"),p=r("./utils"),x=r("./stream/GenericWorker"),g=r("./stream/StreamHelper"),C=r("./defaults"),w=r("./compressedObject"),k=r("./zipObject"),y=r("./generate"),_=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),b=function(O){O.slice(-1)==="/"&&(O=O.substring(0,O.length-1));var U=O.lastIndexOf("/");return 0<U?O.substring(0,U):""},j=function(O){return O.slice(-1)!=="/"&&(O+="/"),O},S=function(O,U){return U=U!==void 0?U:C.createFolders,O=j(O),this.files[O]||d.call(this,O,null,{dir:!0,createFolders:U}),this.files[O]};function A(O){return Object.prototype.toString.call(O)==="[object RegExp]"}var M={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(O){var U,L,I;for(U in this.files)I=this.files[U],(L=U.slice(this.root.length,U.length))&&U.slice(0,this.root.length)===this.root&&O(L,I)},filter:function(O){var U=[];return this.forEach(function(L,I){O(L,I)&&U.push(I)}),U},file:function(O,U,L){if(arguments.length!==1)return O=this.root+O,d.call(this,O,U,L),this;if(A(O)){var I=O;return this.filter(function(de,ae){return!ae.dir&&I.test(de)})}var V=this.files[this.root+O];return V&&!V.dir?V:null},folder:function(O){if(!O)return this;if(A(O))return this.filter(function(V,de){return de.dir&&O.test(V)});var U=this.root+O,L=S.call(this,U),I=this.clone();return I.root=L.name,I},remove:function(O){O=this.root+O;var U=this.files[O];if(U||(O.slice(-1)!=="/"&&(O+="/"),U=this.files[O]),U&&!U.dir)delete this.files[O];else for(var L=this.filter(function(V,de){return de.name.slice(0,O.length)===O}),I=0;I<L.length;I++)delete this.files[L[I].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(O){var U,L={};try{if((L=p.extend(O||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:h.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");p.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var I=L.comment||this.comment||"";U=y.generateWorker(this,L,I)}catch(V){(U=new x("error")).error(V)}return new g(U,L.type||"string",L.mimeType)},generateAsync:function(O,U){return this.generateInternalStream(O).accumulate(U)},generateNodeStream:function(O,U){return(O=O||{}).type||(O.type="nodebuffer"),this.generateInternalStream(O).toNodejsStream(U)}};u.exports=M},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,u,f){u.exports=r("stream")},{stream:void 0}],17:[function(r,u,f){var d=r("./DataReader");function h(p){d.call(this,p);for(var x=0;x<this.data.length;x++)p[x]=255&p[x]}r("../utils").inherits(h,d),h.prototype.byteAt=function(p){return this.data[this.zero+p]},h.prototype.lastIndexOfSignature=function(p){for(var x=p.charCodeAt(0),g=p.charCodeAt(1),C=p.charCodeAt(2),w=p.charCodeAt(3),k=this.length-4;0<=k;--k)if(this.data[k]===x&&this.data[k+1]===g&&this.data[k+2]===C&&this.data[k+3]===w)return k-this.zero;return-1},h.prototype.readAndCheckSignature=function(p){var x=p.charCodeAt(0),g=p.charCodeAt(1),C=p.charCodeAt(2),w=p.charCodeAt(3),k=this.readData(4);return x===k[0]&&g===k[1]&&C===k[2]&&w===k[3]},h.prototype.readData=function(p){if(this.checkOffset(p),p===0)return[];var x=this.data.slice(this.zero+this.index,this.zero+this.index+p);return this.index+=p,x},u.exports=h},{"../utils":32,"./DataReader":18}],18:[function(r,u,f){var d=r("../utils");function h(p){this.data=p,this.length=p.length,this.index=0,this.zero=0}h.prototype={checkOffset:function(p){this.checkIndex(this.index+p)},checkIndex:function(p){if(this.length<this.zero+p||p<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+p+"). Corrupted zip ?")},setIndex:function(p){this.checkIndex(p),this.index=p},skip:function(p){this.setIndex(this.index+p)},byteAt:function(){},readInt:function(p){var x,g=0;for(this.checkOffset(p),x=this.index+p-1;x>=this.index;x--)g=(g<<8)+this.byteAt(x);return this.index+=p,g},readString:function(p){return d.transformTo("string",this.readData(p))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var p=this.readInt(4);return new Date(Date.UTC(1980+(p>>25&127),(p>>21&15)-1,p>>16&31,p>>11&31,p>>5&63,(31&p)<<1))}},u.exports=h},{"../utils":32}],19:[function(r,u,f){var d=r("./Uint8ArrayReader");function h(p){d.call(this,p)}r("../utils").inherits(h,d),h.prototype.readData=function(p){this.checkOffset(p);var x=this.data.slice(this.zero+this.index,this.zero+this.index+p);return this.index+=p,x},u.exports=h},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,u,f){var d=r("./DataReader");function h(p){d.call(this,p)}r("../utils").inherits(h,d),h.prototype.byteAt=function(p){return this.data.charCodeAt(this.zero+p)},h.prototype.lastIndexOfSignature=function(p){return this.data.lastIndexOf(p)-this.zero},h.prototype.readAndCheckSignature=function(p){return p===this.readData(4)},h.prototype.readData=function(p){this.checkOffset(p);var x=this.data.slice(this.zero+this.index,this.zero+this.index+p);return this.index+=p,x},u.exports=h},{"../utils":32,"./DataReader":18}],21:[function(r,u,f){var d=r("./ArrayReader");function h(p){d.call(this,p)}r("../utils").inherits(h,d),h.prototype.readData=function(p){if(this.checkOffset(p),p===0)return new Uint8Array(0);var x=this.data.subarray(this.zero+this.index,this.zero+this.index+p);return this.index+=p,x},u.exports=h},{"../utils":32,"./ArrayReader":17}],22:[function(r,u,f){var d=r("../utils"),h=r("../support"),p=r("./ArrayReader"),x=r("./StringReader"),g=r("./NodeBufferReader"),C=r("./Uint8ArrayReader");u.exports=function(w){var k=d.getTypeOf(w);return d.checkSupport(k),k!=="string"||h.uint8array?k==="nodebuffer"?new g(w):h.uint8array?new C(d.transformTo("uint8array",w)):new p(d.transformTo("array",w)):new x(w)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,u,f){f.LOCAL_FILE_HEADER="PK",f.CENTRAL_FILE_HEADER="PK",f.CENTRAL_DIRECTORY_END="PK",f.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",f.ZIP64_CENTRAL_DIRECTORY_END="PK",f.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,u,f){var d=r("./GenericWorker"),h=r("../utils");function p(x){d.call(this,"ConvertWorker to "+x),this.destType=x}h.inherits(p,d),p.prototype.processChunk=function(x){this.push({data:h.transformTo(this.destType,x.data),meta:x.meta})},u.exports=p},{"../utils":32,"./GenericWorker":28}],25:[function(r,u,f){var d=r("./GenericWorker"),h=r("../crc32");function p(){d.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(p,d),p.prototype.processChunk=function(x){this.streamInfo.crc32=h(x.data,this.streamInfo.crc32||0),this.push(x)},u.exports=p},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,u,f){var d=r("../utils"),h=r("./GenericWorker");function p(x){h.call(this,"DataLengthProbe for "+x),this.propName=x,this.withStreamInfo(x,0)}d.inherits(p,h),p.prototype.processChunk=function(x){if(x){var g=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=g+x.data.length}h.prototype.processChunk.call(this,x)},u.exports=p},{"../utils":32,"./GenericWorker":28}],27:[function(r,u,f){var d=r("../utils"),h=r("./GenericWorker");function p(x){h.call(this,"DataWorker");var g=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,x.then(function(C){g.dataIsReady=!0,g.data=C,g.max=C&&C.length||0,g.type=d.getTypeOf(C),g.isPaused||g._tickAndRepeat()},function(C){g.error(C)})}d.inherits(p,h),p.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this.data=null},p.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,d.delay(this._tickAndRepeat,[],this)),!0)},p.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(d.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},p.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var x=null,g=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":x=this.data.substring(this.index,g);break;case"uint8array":x=this.data.subarray(this.index,g);break;case"array":case"nodebuffer":x=this.data.slice(this.index,g)}return this.index=g,this.push({data:x,meta:{percent:this.max?this.index/this.max*100:0}})},u.exports=p},{"../utils":32,"./GenericWorker":28}],28:[function(r,u,f){function d(h){this.name=h||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}d.prototype={push:function(h){this.emit("data",h)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(h){this.emit("error",h)}return!0},error:function(h){return!this.isFinished&&(this.isPaused?this.generatedError=h:(this.isFinished=!0,this.emit("error",h),this.previous&&this.previous.error(h),this.cleanUp()),!0)},on:function(h,p){return this._listeners[h].push(p),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(h,p){if(this._listeners[h])for(var x=0;x<this._listeners[h].length;x++)this._listeners[h][x].call(this,p)},pipe:function(h){return h.registerPrevious(this)},registerPrevious:function(h){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=h.streamInfo,this.mergeStreamInfo(),this.previous=h;var p=this;return h.on("data",function(x){p.processChunk(x)}),h.on("end",function(){p.end()}),h.on("error",function(x){p.error(x)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var h=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),h=!0),this.previous&&this.previous.resume(),!h},flush:function(){},processChunk:function(h){this.push(h)},withStreamInfo:function(h,p){return this.extraStreamInfo[h]=p,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var h in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,h)&&(this.streamInfo[h]=this.extraStreamInfo[h])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var h="Worker "+this.name;return this.previous?this.previous+" -> "+h:h}},u.exports=d},{}],29:[function(r,u,f){var d=r("../utils"),h=r("./ConvertWorker"),p=r("./GenericWorker"),x=r("../base64"),g=r("../support"),C=r("../external"),w=null;if(g.nodestream)try{w=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function k(_,m){return new C.Promise(function(b,j){var S=[],A=_._internalType,M=_._outputType,O=_._mimeType;_.on("data",function(U,L){S.push(U),m&&m(L)}).on("error",function(U){S=[],j(U)}).on("end",function(){try{var U=(function(L,I,V){switch(L){case"blob":return d.newBlob(d.transformTo("arraybuffer",I),V);case"base64":return x.encode(I);default:return d.transformTo(L,I)}})(M,(function(L,I){var V,de=0,ae=null,H=0;for(V=0;V<I.length;V++)H+=I[V].length;switch(L){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(ae=new Uint8Array(H),V=0;V<I.length;V++)ae.set(I[V],de),de+=I[V].length;return ae;case"nodebuffer":return Buffer.concat(I);default:throw new Error("concat : unsupported type '"+L+"'")}})(A,S),O);b(U)}catch(L){j(L)}S=[]}).resume()})}function y(_,m,b){var j=m;switch(m){case"blob":case"arraybuffer":j="uint8array";break;case"base64":j="string"}try{this._internalType=j,this._outputType=m,this._mimeType=b,d.checkSupport(j),this._worker=_.pipe(new h(j)),_.lock()}catch(S){this._worker=new p("error"),this._worker.error(S)}}y.prototype={accumulate:function(_){return k(this,_)},on:function(_,m){var b=this;return _==="data"?this._worker.on(_,function(j){m.call(b,j.data,j.meta)}):this._worker.on(_,function(){d.delay(m,arguments,b)}),this},resume:function(){return d.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(_){if(d.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new w(this,{objectMode:this._outputType!=="nodebuffer"},_)}},u.exports=y},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,u,f){if(f.base64=!0,f.array=!0,f.string=!0,f.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",f.nodebuffer=typeof Buffer<"u",f.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")f.blob=!1;else{var d=new ArrayBuffer(0);try{f.blob=new Blob([d],{type:"application/zip"}).size===0}catch{try{var h=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);h.append(d),f.blob=h.getBlob("application/zip").size===0}catch{f.blob=!1}}}try{f.nodestream=!!r("readable-stream").Readable}catch{f.nodestream=!1}},{"readable-stream":16}],31:[function(r,u,f){for(var d=r("./utils"),h=r("./support"),p=r("./nodejsUtils"),x=r("./stream/GenericWorker"),g=new Array(256),C=0;C<256;C++)g[C]=252<=C?6:248<=C?5:240<=C?4:224<=C?3:192<=C?2:1;g[254]=g[254]=1;function w(){x.call(this,"utf-8 decode"),this.leftOver=null}function k(){x.call(this,"utf-8 encode")}f.utf8encode=function(y){return h.nodebuffer?p.newBufferFrom(y,"utf-8"):(function(_){var m,b,j,S,A,M=_.length,O=0;for(S=0;S<M;S++)(64512&(b=_.charCodeAt(S)))==55296&&S+1<M&&(64512&(j=_.charCodeAt(S+1)))==56320&&(b=65536+(b-55296<<10)+(j-56320),S++),O+=b<128?1:b<2048?2:b<65536?3:4;for(m=h.uint8array?new Uint8Array(O):new Array(O),S=A=0;A<O;S++)(64512&(b=_.charCodeAt(S)))==55296&&S+1<M&&(64512&(j=_.charCodeAt(S+1)))==56320&&(b=65536+(b-55296<<10)+(j-56320),S++),b<128?m[A++]=b:(b<2048?m[A++]=192|b>>>6:(b<65536?m[A++]=224|b>>>12:(m[A++]=240|b>>>18,m[A++]=128|b>>>12&63),m[A++]=128|b>>>6&63),m[A++]=128|63&b);return m})(y)},f.utf8decode=function(y){return h.nodebuffer?d.transformTo("nodebuffer",y).toString("utf-8"):(function(_){var m,b,j,S,A=_.length,M=new Array(2*A);for(m=b=0;m<A;)if((j=_[m++])<128)M[b++]=j;else if(4<(S=g[j]))M[b++]=65533,m+=S-1;else{for(j&=S===2?31:S===3?15:7;1<S&&m<A;)j=j<<6|63&_[m++],S--;1<S?M[b++]=65533:j<65536?M[b++]=j:(j-=65536,M[b++]=55296|j>>10&1023,M[b++]=56320|1023&j)}return M.length!==b&&(M.subarray?M=M.subarray(0,b):M.length=b),d.applyFromCharCode(M)})(y=d.transformTo(h.uint8array?"uint8array":"array",y))},d.inherits(w,x),w.prototype.processChunk=function(y){var _=d.transformTo(h.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var m=_;(_=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),_.set(m,this.leftOver.length)}else _=this.leftOver.concat(_);this.leftOver=null}var b=(function(S,A){var M;for((A=A||S.length)>S.length&&(A=S.length),M=A-1;0<=M&&(192&S[M])==128;)M--;return M<0||M===0?A:M+g[S[M]]>A?M:A})(_),j=_;b!==_.length&&(h.uint8array?(j=_.subarray(0,b),this.leftOver=_.subarray(b,_.length)):(j=_.slice(0,b),this.leftOver=_.slice(b,_.length))),this.push({data:f.utf8decode(j),meta:y.meta})},w.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:f.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},f.Utf8DecodeWorker=w,d.inherits(k,x),k.prototype.processChunk=function(y){this.push({data:f.utf8encode(y.data),meta:y.meta})},f.Utf8EncodeWorker=k},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,u,f){var d=r("./support"),h=r("./base64"),p=r("./nodejsUtils"),x=r("./external");function g(m){return m}function C(m,b){for(var j=0;j<m.length;++j)b[j]=255&m.charCodeAt(j);return b}r("setimmediate"),f.newBlob=function(m,b){f.checkSupport("blob");try{return new Blob([m],{type:b})}catch{try{var j=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return j.append(m),j.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var w={stringifyByChunk:function(m,b,j){var S=[],A=0,M=m.length;if(M<=j)return String.fromCharCode.apply(null,m);for(;A<M;)b==="array"||b==="nodebuffer"?S.push(String.fromCharCode.apply(null,m.slice(A,Math.min(A+j,M)))):S.push(String.fromCharCode.apply(null,m.subarray(A,Math.min(A+j,M)))),A+=j;return S.join("")},stringifyByChar:function(m){for(var b="",j=0;j<m.length;j++)b+=String.fromCharCode(m[j]);return b},applyCanBeUsed:{uint8array:(function(){try{return d.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return d.nodebuffer&&String.fromCharCode.apply(null,p.allocBuffer(1)).length===1}catch{return!1}})()}};function k(m){var b=65536,j=f.getTypeOf(m),S=!0;if(j==="uint8array"?S=w.applyCanBeUsed.uint8array:j==="nodebuffer"&&(S=w.applyCanBeUsed.nodebuffer),S)for(;1<b;)try{return w.stringifyByChunk(m,j,b)}catch{b=Math.floor(b/2)}return w.stringifyByChar(m)}function y(m,b){for(var j=0;j<m.length;j++)b[j]=m[j];return b}f.applyFromCharCode=k;var _={};_.string={string:g,array:function(m){return C(m,new Array(m.length))},arraybuffer:function(m){return _.string.uint8array(m).buffer},uint8array:function(m){return C(m,new Uint8Array(m.length))},nodebuffer:function(m){return C(m,p.allocBuffer(m.length))}},_.array={string:k,array:g,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return p.newBufferFrom(m)}},_.arraybuffer={string:function(m){return k(new Uint8Array(m))},array:function(m){return y(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:g,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return p.newBufferFrom(new Uint8Array(m))}},_.uint8array={string:k,array:function(m){return y(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:g,nodebuffer:function(m){return p.newBufferFrom(m)}},_.nodebuffer={string:k,array:function(m){return y(m,new Array(m.length))},arraybuffer:function(m){return _.nodebuffer.uint8array(m).buffer},uint8array:function(m){return y(m,new Uint8Array(m.length))},nodebuffer:g},f.transformTo=function(m,b){if(b=b||"",!m)return b;f.checkSupport(m);var j=f.getTypeOf(b);return _[j][m](b)},f.resolve=function(m){for(var b=m.split("/"),j=[],S=0;S<b.length;S++){var A=b[S];A==="."||A===""&&S!==0&&S!==b.length-1||(A===".."?j.pop():j.push(A))}return j.join("/")},f.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":d.nodebuffer&&p.isBuffer(m)?"nodebuffer":d.uint8array&&m instanceof Uint8Array?"uint8array":d.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},f.checkSupport=function(m){if(!d[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},f.MAX_VALUE_16BITS=65535,f.MAX_VALUE_32BITS=-1,f.pretty=function(m){var b,j,S="";for(j=0;j<(m||"").length;j++)S+="\\x"+((b=m.charCodeAt(j))<16?"0":"")+b.toString(16).toUpperCase();return S},f.delay=function(m,b,j){setImmediate(function(){m.apply(j||null,b||[])})},f.inherits=function(m,b){function j(){}j.prototype=b.prototype,m.prototype=new j},f.extend=function(){var m,b,j={};for(m=0;m<arguments.length;m++)for(b in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],b)&&j[b]===void 0&&(j[b]=arguments[m][b]);return j},f.prepareContent=function(m,b,j,S,A){return x.Promise.resolve(b).then(function(M){return d.blob&&(M instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(M))!==-1)&&typeof FileReader<"u"?new x.Promise(function(O,U){var L=new FileReader;L.onload=function(I){O(I.target.result)},L.onerror=function(I){U(I.target.error)},L.readAsArrayBuffer(M)}):M}).then(function(M){var O=f.getTypeOf(M);return O?(O==="arraybuffer"?M=f.transformTo("uint8array",M):O==="string"&&(A?M=h.decode(M):j&&S!==!0&&(M=(function(U){return C(U,d.uint8array?new Uint8Array(U.length):new Array(U.length))})(M))),M):x.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,u,f){var d=r("./reader/readerFor"),h=r("./utils"),p=r("./signature"),x=r("./zipEntry"),g=r("./support");function C(w){this.files=[],this.loadOptions=w}C.prototype={checkSignature:function(w){if(!this.reader.readAndCheckSignature(w)){this.reader.index-=4;var k=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+h.pretty(k)+", expected "+h.pretty(w)+")")}},isSignature:function(w,k){var y=this.reader.index;this.reader.setIndex(w);var _=this.reader.readString(4)===k;return this.reader.setIndex(y),_},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var w=this.reader.readData(this.zipCommentLength),k=g.uint8array?"uint8array":"array",y=h.transformTo(k,w);this.zipComment=this.loadOptions.decodeFileName(y)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var w,k,y,_=this.zip64EndOfCentralSize-44;0<_;)w=this.reader.readInt(2),k=this.reader.readInt(4),y=this.reader.readData(k),this.zip64ExtensibleData[w]={id:w,length:k,value:y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var w,k;for(w=0;w<this.files.length;w++)k=this.files[w],this.reader.setIndex(k.localHeaderOffset),this.checkSignature(p.LOCAL_FILE_HEADER),k.readLocalPart(this.reader),k.handleUTF8(),k.processAttributes()},readCentralDir:function(){var w;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(p.CENTRAL_FILE_HEADER);)(w=new x({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(w);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var w=this.reader.lastIndexOfSignature(p.CENTRAL_DIRECTORY_END);if(w<0)throw this.isSignature(0,p.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(w);var k=w;if(this.checkSignature(p.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===h.MAX_VALUE_16BITS||this.diskWithCentralDirStart===h.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===h.MAX_VALUE_16BITS||this.centralDirRecords===h.MAX_VALUE_16BITS||this.centralDirSize===h.MAX_VALUE_32BITS||this.centralDirOffset===h.MAX_VALUE_32BITS){if(this.zip64=!0,(w=this.reader.lastIndexOfSignature(p.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(w),this.checkSignature(p.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,p.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(p.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(p.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var y=this.centralDirOffset+this.centralDirSize;this.zip64&&(y+=20,y+=12+this.zip64EndOfCentralSize);var _=k-y;if(0<_)this.isSignature(k,p.CENTRAL_FILE_HEADER)||(this.reader.zero=_);else if(_<0)throw new Error("Corrupted zip: missing "+Math.abs(_)+" bytes.")},prepareReader:function(w){this.reader=d(w)},load:function(w){this.prepareReader(w),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},u.exports=C},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,u,f){var d=r("./reader/readerFor"),h=r("./utils"),p=r("./compressedObject"),x=r("./crc32"),g=r("./utf8"),C=r("./compressions"),w=r("./support");function k(y,_){this.options=y,this.loadOptions=_}k.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(y){var _,m;if(y.skip(22),this.fileNameLength=y.readInt(2),m=y.readInt(2),this.fileName=y.readData(this.fileNameLength),y.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((_=(function(b){for(var j in C)if(Object.prototype.hasOwnProperty.call(C,j)&&C[j].magic===b)return C[j];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+h.pretty(this.compressionMethod)+" unknown (inner file : "+h.transformTo("string",this.fileName)+")");this.decompressed=new p(this.compressedSize,this.uncompressedSize,this.crc32,_,y.readData(this.compressedSize))},readCentralPart:function(y){this.versionMadeBy=y.readInt(2),y.skip(2),this.bitFlag=y.readInt(2),this.compressionMethod=y.readString(2),this.date=y.readDate(),this.crc32=y.readInt(4),this.compressedSize=y.readInt(4),this.uncompressedSize=y.readInt(4);var _=y.readInt(2);if(this.extraFieldsLength=y.readInt(2),this.fileCommentLength=y.readInt(2),this.diskNumberStart=y.readInt(2),this.internalFileAttributes=y.readInt(2),this.externalFileAttributes=y.readInt(4),this.localHeaderOffset=y.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");y.skip(_),this.readExtraFields(y),this.parseZIP64ExtraField(y),this.fileComment=y.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var y=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=d(this.extraFields[1].value);this.uncompressedSize===h.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===h.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===h.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===h.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var _,m,b,j=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4<j;)_=y.readInt(2),m=y.readInt(2),b=y.readData(m),this.extraFields[_]={id:_,length:m,value:b};y.setIndex(j)},handleUTF8:function(){var y=w.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=g.utf8decode(this.fileName),this.fileCommentStr=g.utf8decode(this.fileComment);else{var _=this.findExtraFieldUnicodePath();if(_!==null)this.fileNameStr=_;else{var m=h.transformTo(y,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var j=h.transformTo(y,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(j)}}},findExtraFieldUnicodePath:function(){var y=this.extraFields[28789];if(y){var _=d(y.value);return _.readInt(1)!==1||x(this.fileName)!==_.readInt(4)?null:g.utf8decode(_.readData(y.length-5))}return null},findExtraFieldUnicodeComment:function(){var y=this.extraFields[25461];if(y){var _=d(y.value);return _.readInt(1)!==1||x(this.fileComment)!==_.readInt(4)?null:g.utf8decode(_.readData(y.length-5))}return null}},u.exports=k},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,u,f){function d(_,m,b){this.name=_,this.dir=b.dir,this.date=b.date,this.comment=b.comment,this.unixPermissions=b.unixPermissions,this.dosPermissions=b.dosPermissions,this._data=m,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var h=r("./stream/StreamHelper"),p=r("./stream/DataWorker"),x=r("./utf8"),g=r("./compressedObject"),C=r("./stream/GenericWorker");d.prototype={internalStream:function(_){var m=null,b="string";try{if(!_)throw new Error("No output type specified.");var j=(b=_.toLowerCase())==="string"||b==="text";b!=="binarystring"&&b!=="text"||(b="string"),m=this._decompressWorker();var S=!this._dataBinary;S&&!j&&(m=m.pipe(new x.Utf8EncodeWorker)),!S&&j&&(m=m.pipe(new x.Utf8DecodeWorker))}catch(A){(m=new C("error")).error(A)}return new h(m,b,"")},async:function(_,m){return this.internalStream(_).accumulate(m)},nodeStream:function(_,m){return this.internalStream(_||"nodebuffer").toNodejsStream(m)},_compressWorker:function(_,m){if(this._data instanceof g&&this._data.compression.magic===_.magic)return this._data.getCompressedWorker();var b=this._decompressWorker();return this._dataBinary||(b=b.pipe(new x.Utf8EncodeWorker)),g.createWorkerFrom(b,_,m)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof C?this._data:new p(this._data)}};for(var w=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],k=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},y=0;y<w.length;y++)d.prototype[w[y]]=k;u.exports=d},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,u,f){(function(d){var h,p,x=d.MutationObserver||d.WebKitMutationObserver;if(x){var g=0,C=new x(_),w=d.document.createTextNode("");C.observe(w,{characterData:!0}),h=function(){w.data=g=++g%2}}else if(d.setImmediate||d.MessageChannel===void 0)h="document"in d&&"onreadystatechange"in d.document.createElement("script")?function(){var m=d.document.createElement("script");m.onreadystatechange=function(){_(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},d.document.documentElement.appendChild(m)}:function(){setTimeout(_,0)};else{var k=new d.MessageChannel;k.port1.onmessage=_,h=function(){k.port2.postMessage(0)}}var y=[];function _(){var m,b;p=!0;for(var j=y.length;j;){for(b=y,y=[],m=-1;++m<j;)b[m]();j=y.length}p=!1}u.exports=function(m){y.push(m)!==1||p||h()}}).call(this,typeof Ps<"u"?Ps:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,u,f){var d=r("immediate");function h(){}var p={},x=["REJECTED"],g=["FULFILLED"],C=["PENDING"];function w(j){if(typeof j!="function")throw new TypeError("resolver must be a function");this.state=C,this.queue=[],this.outcome=void 0,j!==h&&m(this,j)}function k(j,S,A){this.promise=j,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof A=="function"&&(this.onRejected=A,this.callRejected=this.otherCallRejected)}function y(j,S,A){d(function(){var M;try{M=S(A)}catch(O){return p.reject(j,O)}M===j?p.reject(j,new TypeError("Cannot resolve promise with itself")):p.resolve(j,M)})}function _(j){var S=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof S=="function")return function(){S.apply(j,arguments)}}function m(j,S){var A=!1;function M(L){A||(A=!0,p.reject(j,L))}function O(L){A||(A=!0,p.resolve(j,L))}var U=b(function(){S(O,M)});U.status==="error"&&M(U.value)}function b(j,S){var A={};try{A.value=j(S),A.status="success"}catch(M){A.status="error",A.value=M}return A}(u.exports=w).prototype.finally=function(j){if(typeof j!="function")return this;var S=this.constructor;return this.then(function(A){return S.resolve(j()).then(function(){return A})},function(A){return S.resolve(j()).then(function(){throw A})})},w.prototype.catch=function(j){return this.then(null,j)},w.prototype.then=function(j,S){if(typeof j!="function"&&this.state===g||typeof S!="function"&&this.state===x)return this;var A=new this.constructor(h);return this.state!==C?y(A,this.state===g?j:S,this.outcome):this.queue.push(new k(A,j,S)),A},k.prototype.callFulfilled=function(j){p.resolve(this.promise,j)},k.prototype.otherCallFulfilled=function(j){y(this.promise,this.onFulfilled,j)},k.prototype.callRejected=function(j){p.reject(this.promise,j)},k.prototype.otherCallRejected=function(j){y(this.promise,this.onRejected,j)},p.resolve=function(j,S){var A=b(_,S);if(A.status==="error")return p.reject(j,A.value);var M=A.value;if(M)m(j,M);else{j.state=g,j.outcome=S;for(var O=-1,U=j.queue.length;++O<U;)j.queue[O].callFulfilled(S)}return j},p.reject=function(j,S){j.state=x,j.outcome=S;for(var A=-1,M=j.queue.length;++A<M;)j.queue[A].callRejected(S);return j},w.resolve=function(j){return j instanceof this?j:p.resolve(new this(h),j)},w.reject=function(j){var S=new this(h);return p.reject(S,j)},w.all=function(j){var S=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=j.length,M=!1;if(!A)return this.resolve([]);for(var O=new Array(A),U=0,L=-1,I=new this(h);++L<A;)V(j[L],L);return I;function V(de,ae){S.resolve(de).then(function(H){O[ae]=H,++U!==A||M||(M=!0,p.resolve(I,O))},function(H){M||(M=!0,p.reject(I,H))})}},w.race=function(j){var S=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=j.length,M=!1;if(!A)return this.resolve([]);for(var O=-1,U=new this(h);++O<A;)L=j[O],S.resolve(L).then(function(I){M||(M=!0,p.resolve(U,I))},function(I){M||(M=!0,p.reject(U,I))});var L;return U}},{immediate:36}],38:[function(r,u,f){var d={};(0,r("./lib/utils/common").assign)(d,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),u.exports=d},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,u,f){var d=r("./zlib/deflate"),h=r("./utils/common"),p=r("./utils/strings"),x=r("./zlib/messages"),g=r("./zlib/zstream"),C=Object.prototype.toString,w=0,k=-1,y=0,_=8;function m(j){if(!(this instanceof m))return new m(j);this.options=h.assign({level:k,method:_,chunkSize:16384,windowBits:15,memLevel:8,strategy:y,to:""},j||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new g,this.strm.avail_out=0;var A=d.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(A!==w)throw new Error(x[A]);if(S.header&&d.deflateSetHeader(this.strm,S.header),S.dictionary){var M;if(M=typeof S.dictionary=="string"?p.string2buf(S.dictionary):C.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(A=d.deflateSetDictionary(this.strm,M))!==w)throw new Error(x[A]);this._dict_set=!0}}function b(j,S){var A=new m(S);if(A.push(j,!0),A.err)throw A.msg||x[A.err];return A.result}m.prototype.push=function(j,S){var A,M,O=this.strm,U=this.options.chunkSize;if(this.ended)return!1;M=S===~~S?S:S===!0?4:0,typeof j=="string"?O.input=p.string2buf(j):C.call(j)==="[object ArrayBuffer]"?O.input=new Uint8Array(j):O.input=j,O.next_in=0,O.avail_in=O.input.length;do{if(O.avail_out===0&&(O.output=new h.Buf8(U),O.next_out=0,O.avail_out=U),(A=d.deflate(O,M))!==1&&A!==w)return this.onEnd(A),!(this.ended=!0);O.avail_out!==0&&(O.avail_in!==0||M!==4&&M!==2)||(this.options.to==="string"?this.onData(p.buf2binstring(h.shrinkBuf(O.output,O.next_out))):this.onData(h.shrinkBuf(O.output,O.next_out)))}while((0<O.avail_in||O.avail_out===0)&&A!==1);return M===4?(A=d.deflateEnd(this.strm),this.onEnd(A),this.ended=!0,A===w):M!==2||(this.onEnd(w),!(O.avail_out=0))},m.prototype.onData=function(j){this.chunks.push(j)},m.prototype.onEnd=function(j){j===w&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=j,this.msg=this.strm.msg},f.Deflate=m,f.deflate=b,f.deflateRaw=function(j,S){return(S=S||{}).raw=!0,b(j,S)},f.gzip=function(j,S){return(S=S||{}).gzip=!0,b(j,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,u,f){var d=r("./zlib/inflate"),h=r("./utils/common"),p=r("./utils/strings"),x=r("./zlib/constants"),g=r("./zlib/messages"),C=r("./zlib/zstream"),w=r("./zlib/gzheader"),k=Object.prototype.toString;function y(m){if(!(this instanceof y))return new y(m);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},m||{});var b=this.options;b.raw&&0<=b.windowBits&&b.windowBits<16&&(b.windowBits=-b.windowBits,b.windowBits===0&&(b.windowBits=-15)),!(0<=b.windowBits&&b.windowBits<16)||m&&m.windowBits||(b.windowBits+=32),15<b.windowBits&&b.windowBits<48&&(15&b.windowBits)==0&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new C,this.strm.avail_out=0;var j=d.inflateInit2(this.strm,b.windowBits);if(j!==x.Z_OK)throw new Error(g[j]);this.header=new w,d.inflateGetHeader(this.strm,this.header)}function _(m,b){var j=new y(b);if(j.push(m,!0),j.err)throw j.msg||g[j.err];return j.result}y.prototype.push=function(m,b){var j,S,A,M,O,U,L=this.strm,I=this.options.chunkSize,V=this.options.dictionary,de=!1;if(this.ended)return!1;S=b===~~b?b:b===!0?x.Z_FINISH:x.Z_NO_FLUSH,typeof m=="string"?L.input=p.binstring2buf(m):k.call(m)==="[object ArrayBuffer]"?L.input=new Uint8Array(m):L.input=m,L.next_in=0,L.avail_in=L.input.length;do{if(L.avail_out===0&&(L.output=new h.Buf8(I),L.next_out=0,L.avail_out=I),(j=d.inflate(L,x.Z_NO_FLUSH))===x.Z_NEED_DICT&&V&&(U=typeof V=="string"?p.string2buf(V):k.call(V)==="[object ArrayBuffer]"?new Uint8Array(V):V,j=d.inflateSetDictionary(this.strm,U)),j===x.Z_BUF_ERROR&&de===!0&&(j=x.Z_OK,de=!1),j!==x.Z_STREAM_END&&j!==x.Z_OK)return this.onEnd(j),!(this.ended=!0);L.next_out&&(L.avail_out!==0&&j!==x.Z_STREAM_END&&(L.avail_in!==0||S!==x.Z_FINISH&&S!==x.Z_SYNC_FLUSH)||(this.options.to==="string"?(A=p.utf8border(L.output,L.next_out),M=L.next_out-A,O=p.buf2string(L.output,A),L.next_out=M,L.avail_out=I-M,M&&h.arraySet(L.output,L.output,A,M,0),this.onData(O)):this.onData(h.shrinkBuf(L.output,L.next_out)))),L.avail_in===0&&L.avail_out===0&&(de=!0)}while((0<L.avail_in||L.avail_out===0)&&j!==x.Z_STREAM_END);return j===x.Z_STREAM_END&&(S=x.Z_FINISH),S===x.Z_FINISH?(j=d.inflateEnd(this.strm),this.onEnd(j),this.ended=!0,j===x.Z_OK):S!==x.Z_SYNC_FLUSH||(this.onEnd(x.Z_OK),!(L.avail_out=0))},y.prototype.onData=function(m){this.chunks.push(m)},y.prototype.onEnd=function(m){m===x.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},f.Inflate=y,f.inflate=_,f.inflateRaw=function(m,b){return(b=b||{}).raw=!0,_(m,b)},f.ungzip=_},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,u,f){var d=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";f.assign=function(x){for(var g=Array.prototype.slice.call(arguments,1);g.length;){var C=g.shift();if(C){if(typeof C!="object")throw new TypeError(C+"must be non-object");for(var w in C)C.hasOwnProperty(w)&&(x[w]=C[w])}}return x},f.shrinkBuf=function(x,g){return x.length===g?x:x.subarray?x.subarray(0,g):(x.length=g,x)};var h={arraySet:function(x,g,C,w,k){if(g.subarray&&x.subarray)x.set(g.subarray(C,C+w),k);else for(var y=0;y<w;y++)x[k+y]=g[C+y]},flattenChunks:function(x){var g,C,w,k,y,_;for(g=w=0,C=x.length;g<C;g++)w+=x[g].length;for(_=new Uint8Array(w),g=k=0,C=x.length;g<C;g++)y=x[g],_.set(y,k),k+=y.length;return _}},p={arraySet:function(x,g,C,w,k){for(var y=0;y<w;y++)x[k+y]=g[C+y]},flattenChunks:function(x){return[].concat.apply([],x)}};f.setTyped=function(x){x?(f.Buf8=Uint8Array,f.Buf16=Uint16Array,f.Buf32=Int32Array,f.assign(f,h)):(f.Buf8=Array,f.Buf16=Array,f.Buf32=Array,f.assign(f,p))},f.setTyped(d)},{}],42:[function(r,u,f){var d=r("./common"),h=!0,p=!0;try{String.fromCharCode.apply(null,[0])}catch{h=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{p=!1}for(var x=new d.Buf8(256),g=0;g<256;g++)x[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;function C(w,k){if(k<65537&&(w.subarray&&p||!w.subarray&&h))return String.fromCharCode.apply(null,d.shrinkBuf(w,k));for(var y="",_=0;_<k;_++)y+=String.fromCharCode(w[_]);return y}x[254]=x[254]=1,f.string2buf=function(w){var k,y,_,m,b,j=w.length,S=0;for(m=0;m<j;m++)(64512&(y=w.charCodeAt(m)))==55296&&m+1<j&&(64512&(_=w.charCodeAt(m+1)))==56320&&(y=65536+(y-55296<<10)+(_-56320),m++),S+=y<128?1:y<2048?2:y<65536?3:4;for(k=new d.Buf8(S),m=b=0;b<S;m++)(64512&(y=w.charCodeAt(m)))==55296&&m+1<j&&(64512&(_=w.charCodeAt(m+1)))==56320&&(y=65536+(y-55296<<10)+(_-56320),m++),y<128?k[b++]=y:(y<2048?k[b++]=192|y>>>6:(y<65536?k[b++]=224|y>>>12:(k[b++]=240|y>>>18,k[b++]=128|y>>>12&63),k[b++]=128|y>>>6&63),k[b++]=128|63&y);return k},f.buf2binstring=function(w){return C(w,w.length)},f.binstring2buf=function(w){for(var k=new d.Buf8(w.length),y=0,_=k.length;y<_;y++)k[y]=w.charCodeAt(y);return k},f.buf2string=function(w,k){var y,_,m,b,j=k||w.length,S=new Array(2*j);for(y=_=0;y<j;)if((m=w[y++])<128)S[_++]=m;else if(4<(b=x[m]))S[_++]=65533,y+=b-1;else{for(m&=b===2?31:b===3?15:7;1<b&&y<j;)m=m<<6|63&w[y++],b--;1<b?S[_++]=65533:m<65536?S[_++]=m:(m-=65536,S[_++]=55296|m>>10&1023,S[_++]=56320|1023&m)}return C(S,_)},f.utf8border=function(w,k){var y;for((k=k||w.length)>w.length&&(k=w.length),y=k-1;0<=y&&(192&w[y])==128;)y--;return y<0||y===0?k:y+x[w[y]]>k?y:k}},{"./common":41}],43:[function(r,u,f){u.exports=function(d,h,p,x){for(var g=65535&d|0,C=d>>>16&65535|0,w=0;p!==0;){for(p-=w=2e3<p?2e3:p;C=C+(g=g+h[x++]|0)|0,--w;);g%=65521,C%=65521}return g|C<<16|0}},{}],44:[function(r,u,f){u.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,u,f){var d=(function(){for(var h,p=[],x=0;x<256;x++){h=x;for(var g=0;g<8;g++)h=1&h?3988292384^h>>>1:h>>>1;p[x]=h}return p})();u.exports=function(h,p,x,g){var C=d,w=g+x;h^=-1;for(var k=g;k<w;k++)h=h>>>8^C[255&(h^p[k])];return-1^h}},{}],46:[function(r,u,f){var d,h=r("../utils/common"),p=r("./trees"),x=r("./adler32"),g=r("./crc32"),C=r("./messages"),w=0,k=4,y=0,_=-2,m=-1,b=4,j=2,S=8,A=9,M=286,O=30,U=19,L=2*M+1,I=15,V=3,de=258,ae=de+V+1,H=42,F=113,z=1,se=2,$=3,P=4;function Z(N,me){return N.msg=C[me],me}function X(N){return(N<<1)-(4<N?9:0)}function ge(N){for(var me=N.length;0<=--me;)N[me]=0}function R(N){var me=N.state,ne=me.pending;ne>N.avail_out&&(ne=N.avail_out),ne!==0&&(h.arraySet(N.output,me.pending_buf,me.pending_out,ne,N.next_out),N.next_out+=ne,me.pending_out+=ne,N.total_out+=ne,N.avail_out-=ne,me.pending-=ne,me.pending===0&&(me.pending_out=0))}function D(N,me){p._tr_flush_block(N,0<=N.block_start?N.block_start:-1,N.strstart-N.block_start,me),N.block_start=N.strstart,R(N.strm)}function W(N,me){N.pending_buf[N.pending++]=me}function te(N,me){N.pending_buf[N.pending++]=me>>>8&255,N.pending_buf[N.pending++]=255&me}function Y(N,me){var ne,q,B=N.max_chain_length,J=N.strstart,xe=N.prev_length,re=N.nice_match,K=N.strstart>N.w_size-ae?N.strstart-(N.w_size-ae):0,ve=N.window,_e=N.w_mask,Se=N.prev,ze=N.strstart+de,Ve=ve[J+xe-1],De=ve[J+xe];N.prev_length>=N.good_match&&(B>>=2),re>N.lookahead&&(re=N.lookahead);do if(ve[(ne=me)+xe]===De&&ve[ne+xe-1]===Ve&&ve[ne]===ve[J]&&ve[++ne]===ve[J+1]){J+=2,ne++;do;while(ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&ve[++J]===ve[++ne]&&J<ze);if(q=de-(ze-J),J=ze-de,xe<q){if(N.match_start=me,re<=(xe=q))break;Ve=ve[J+xe-1],De=ve[J+xe]}}while((me=Se[me&_e])>K&&--B!=0);return xe<=N.lookahead?xe:N.lookahead}function he(N){var me,ne,q,B,J,xe,re,K,ve,_e,Se=N.w_size;do{if(B=N.window_size-N.lookahead-N.strstart,N.strstart>=Se+(Se-ae)){for(h.arraySet(N.window,N.window,Se,Se,0),N.match_start-=Se,N.strstart-=Se,N.block_start-=Se,me=ne=N.hash_size;q=N.head[--me],N.head[me]=Se<=q?q-Se:0,--ne;);for(me=ne=Se;q=N.prev[--me],N.prev[me]=Se<=q?q-Se:0,--ne;);B+=Se}if(N.strm.avail_in===0)break;if(xe=N.strm,re=N.window,K=N.strstart+N.lookahead,ve=B,_e=void 0,_e=xe.avail_in,ve<_e&&(_e=ve),ne=_e===0?0:(xe.avail_in-=_e,h.arraySet(re,xe.input,xe.next_in,_e,K),xe.state.wrap===1?xe.adler=x(xe.adler,re,_e,K):xe.state.wrap===2&&(xe.adler=g(xe.adler,re,_e,K)),xe.next_in+=_e,xe.total_in+=_e,_e),N.lookahead+=ne,N.lookahead+N.insert>=V)for(J=N.strstart-N.insert,N.ins_h=N.window[J],N.ins_h=(N.ins_h<<N.hash_shift^N.window[J+1])&N.hash_mask;N.insert&&(N.ins_h=(N.ins_h<<N.hash_shift^N.window[J+V-1])&N.hash_mask,N.prev[J&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=J,J++,N.insert--,!(N.lookahead+N.insert<V)););}while(N.lookahead<ae&&N.strm.avail_in!==0)}function ke(N,me){for(var ne,q;;){if(N.lookahead<ae){if(he(N),N.lookahead<ae&&me===w)return z;if(N.lookahead===0)break}if(ne=0,N.lookahead>=V&&(N.ins_h=(N.ins_h<<N.hash_shift^N.window[N.strstart+V-1])&N.hash_mask,ne=N.prev[N.strstart&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=N.strstart),ne!==0&&N.strstart-ne<=N.w_size-ae&&(N.match_length=Y(N,ne)),N.match_length>=V)if(q=p._tr_tally(N,N.strstart-N.match_start,N.match_length-V),N.lookahead-=N.match_length,N.match_length<=N.max_lazy_match&&N.lookahead>=V){for(N.match_length--;N.strstart++,N.ins_h=(N.ins_h<<N.hash_shift^N.window[N.strstart+V-1])&N.hash_mask,ne=N.prev[N.strstart&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=N.strstart,--N.match_length!=0;);N.strstart++}else N.strstart+=N.match_length,N.match_length=0,N.ins_h=N.window[N.strstart],N.ins_h=(N.ins_h<<N.hash_shift^N.window[N.strstart+1])&N.hash_mask;else q=p._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++;if(q&&(D(N,!1),N.strm.avail_out===0))return z}return N.insert=N.strstart<V-1?N.strstart:V-1,me===k?(D(N,!0),N.strm.avail_out===0?$:P):N.last_lit&&(D(N,!1),N.strm.avail_out===0)?z:se}function Ae(N,me){for(var ne,q,B;;){if(N.lookahead<ae){if(he(N),N.lookahead<ae&&me===w)return z;if(N.lookahead===0)break}if(ne=0,N.lookahead>=V&&(N.ins_h=(N.ins_h<<N.hash_shift^N.window[N.strstart+V-1])&N.hash_mask,ne=N.prev[N.strstart&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=N.strstart),N.prev_length=N.match_length,N.prev_match=N.match_start,N.match_length=V-1,ne!==0&&N.prev_length<N.max_lazy_match&&N.strstart-ne<=N.w_size-ae&&(N.match_length=Y(N,ne),N.match_length<=5&&(N.strategy===1||N.match_length===V&&4096<N.strstart-N.match_start)&&(N.match_length=V-1)),N.prev_length>=V&&N.match_length<=N.prev_length){for(B=N.strstart+N.lookahead-V,q=p._tr_tally(N,N.strstart-1-N.prev_match,N.prev_length-V),N.lookahead-=N.prev_length-1,N.prev_length-=2;++N.strstart<=B&&(N.ins_h=(N.ins_h<<N.hash_shift^N.window[N.strstart+V-1])&N.hash_mask,ne=N.prev[N.strstart&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=N.strstart),--N.prev_length!=0;);if(N.match_available=0,N.match_length=V-1,N.strstart++,q&&(D(N,!1),N.strm.avail_out===0))return z}else if(N.match_available){if((q=p._tr_tally(N,0,N.window[N.strstart-1]))&&D(N,!1),N.strstart++,N.lookahead--,N.strm.avail_out===0)return z}else N.match_available=1,N.strstart++,N.lookahead--}return N.match_available&&(q=p._tr_tally(N,0,N.window[N.strstart-1]),N.match_available=0),N.insert=N.strstart<V-1?N.strstart:V-1,me===k?(D(N,!0),N.strm.avail_out===0?$:P):N.last_lit&&(D(N,!1),N.strm.avail_out===0)?z:se}function Oe(N,me,ne,q,B){this.good_length=N,this.max_lazy=me,this.nice_length=ne,this.max_chain=q,this.func=B}function Ke(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new h.Buf16(2*L),this.dyn_dtree=new h.Buf16(2*(2*O+1)),this.bl_tree=new h.Buf16(2*(2*U+1)),ge(this.dyn_ltree),ge(this.dyn_dtree),ge(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new h.Buf16(I+1),this.heap=new h.Buf16(2*M+1),ge(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new h.Buf16(2*M+1),ge(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ie(N){var me;return N&&N.state?(N.total_in=N.total_out=0,N.data_type=j,(me=N.state).pending=0,me.pending_out=0,me.wrap<0&&(me.wrap=-me.wrap),me.status=me.wrap?H:F,N.adler=me.wrap===2?0:1,me.last_flush=w,p._tr_init(me),y):Z(N,_)}function nt(N){var me=Ie(N);return me===y&&(function(ne){ne.window_size=2*ne.w_size,ge(ne.head),ne.max_lazy_match=d[ne.level].max_lazy,ne.good_match=d[ne.level].good_length,ne.nice_match=d[ne.level].nice_length,ne.max_chain_length=d[ne.level].max_chain,ne.strstart=0,ne.block_start=0,ne.lookahead=0,ne.insert=0,ne.match_length=ne.prev_length=V-1,ne.match_available=0,ne.ins_h=0})(N.state),me}function We(N,me,ne,q,B,J){if(!N)return _;var xe=1;if(me===m&&(me=6),q<0?(xe=0,q=-q):15<q&&(xe=2,q-=16),B<1||A<B||ne!==S||q<8||15<q||me<0||9<me||J<0||b<J)return Z(N,_);q===8&&(q=9);var re=new Ke;return(N.state=re).strm=N,re.wrap=xe,re.gzhead=null,re.w_bits=q,re.w_size=1<<re.w_bits,re.w_mask=re.w_size-1,re.hash_bits=B+7,re.hash_size=1<<re.hash_bits,re.hash_mask=re.hash_size-1,re.hash_shift=~~((re.hash_bits+V-1)/V),re.window=new h.Buf8(2*re.w_size),re.head=new h.Buf16(re.hash_size),re.prev=new h.Buf16(re.w_size),re.lit_bufsize=1<<B+6,re.pending_buf_size=4*re.lit_bufsize,re.pending_buf=new h.Buf8(re.pending_buf_size),re.d_buf=1*re.lit_bufsize,re.l_buf=3*re.lit_bufsize,re.level=me,re.strategy=J,re.method=ne,nt(N)}d=[new Oe(0,0,0,0,function(N,me){var ne=65535;for(ne>N.pending_buf_size-5&&(ne=N.pending_buf_size-5);;){if(N.lookahead<=1){if(he(N),N.lookahead===0&&me===w)return z;if(N.lookahead===0)break}N.strstart+=N.lookahead,N.lookahead=0;var q=N.block_start+ne;if((N.strstart===0||N.strstart>=q)&&(N.lookahead=N.strstart-q,N.strstart=q,D(N,!1),N.strm.avail_out===0)||N.strstart-N.block_start>=N.w_size-ae&&(D(N,!1),N.strm.avail_out===0))return z}return N.insert=0,me===k?(D(N,!0),N.strm.avail_out===0?$:P):(N.strstart>N.block_start&&(D(N,!1),N.strm.avail_out),z)}),new Oe(4,4,8,4,ke),new Oe(4,5,16,8,ke),new Oe(4,6,32,32,ke),new Oe(4,4,16,16,Ae),new Oe(8,16,32,32,Ae),new Oe(8,16,128,128,Ae),new Oe(8,32,128,256,Ae),new Oe(32,128,258,1024,Ae),new Oe(32,258,258,4096,Ae)],f.deflateInit=function(N,me){return We(N,me,S,15,8,0)},f.deflateInit2=We,f.deflateReset=nt,f.deflateResetKeep=Ie,f.deflateSetHeader=function(N,me){return N&&N.state?N.state.wrap!==2?_:(N.state.gzhead=me,y):_},f.deflate=function(N,me){var ne,q,B,J;if(!N||!N.state||5<me||me<0)return N?Z(N,_):_;if(q=N.state,!N.output||!N.input&&N.avail_in!==0||q.status===666&&me!==k)return Z(N,N.avail_out===0?-5:_);if(q.strm=N,ne=q.last_flush,q.last_flush=me,q.status===H)if(q.wrap===2)N.adler=0,W(q,31),W(q,139),W(q,8),q.gzhead?(W(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(q.gzhead.extra?4:0)+(q.gzhead.name?8:0)+(q.gzhead.comment?16:0)),W(q,255&q.gzhead.time),W(q,q.gzhead.time>>8&255),W(q,q.gzhead.time>>16&255),W(q,q.gzhead.time>>24&255),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(W(q,255&q.gzhead.extra.length),W(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(N.adler=g(N.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(W(q,0),W(q,0),W(q,0),W(q,0),W(q,0),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,3),q.status=F);else{var xe=S+(q.w_bits-8<<4)<<8;xe|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(xe|=32),xe+=31-xe%31,q.status=F,te(q,xe),q.strstart!==0&&(te(q,N.adler>>>16),te(q,65535&N.adler)),N.adler=1}if(q.status===69)if(q.gzhead.extra){for(B=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>B&&(N.adler=g(N.adler,q.pending_buf,q.pending-B,B)),R(N),B=q.pending,q.pending!==q.pending_buf_size));)W(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>B&&(N.adler=g(N.adler,q.pending_buf,q.pending-B,B)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){B=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>B&&(N.adler=g(N.adler,q.pending_buf,q.pending-B,B)),R(N),B=q.pending,q.pending===q.pending_buf_size)){J=1;break}J=q.gzindex<q.gzhead.name.length?255&q.gzhead.name.charCodeAt(q.gzindex++):0,W(q,J)}while(J!==0);q.gzhead.hcrc&&q.pending>B&&(N.adler=g(N.adler,q.pending_buf,q.pending-B,B)),J===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){B=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>B&&(N.adler=g(N.adler,q.pending_buf,q.pending-B,B)),R(N),B=q.pending,q.pending===q.pending_buf_size)){J=1;break}J=q.gzindex<q.gzhead.comment.length?255&q.gzhead.comment.charCodeAt(q.gzindex++):0,W(q,J)}while(J!==0);q.gzhead.hcrc&&q.pending>B&&(N.adler=g(N.adler,q.pending_buf,q.pending-B,B)),J===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&R(N),q.pending+2<=q.pending_buf_size&&(W(q,255&N.adler),W(q,N.adler>>8&255),N.adler=0,q.status=F)):q.status=F),q.pending!==0){if(R(N),N.avail_out===0)return q.last_flush=-1,y}else if(N.avail_in===0&&X(me)<=X(ne)&&me!==k)return Z(N,-5);if(q.status===666&&N.avail_in!==0)return Z(N,-5);if(N.avail_in!==0||q.lookahead!==0||me!==w&&q.status!==666){var re=q.strategy===2?(function(K,ve){for(var _e;;){if(K.lookahead===0&&(he(K),K.lookahead===0)){if(ve===w)return z;break}if(K.match_length=0,_e=p._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,_e&&(D(K,!1),K.strm.avail_out===0))return z}return K.insert=0,ve===k?(D(K,!0),K.strm.avail_out===0?$:P):K.last_lit&&(D(K,!1),K.strm.avail_out===0)?z:se})(q,me):q.strategy===3?(function(K,ve){for(var _e,Se,ze,Ve,De=K.window;;){if(K.lookahead<=de){if(he(K),K.lookahead<=de&&ve===w)return z;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=V&&0<K.strstart&&(Se=De[ze=K.strstart-1])===De[++ze]&&Se===De[++ze]&&Se===De[++ze]){Ve=K.strstart+de;do;while(Se===De[++ze]&&Se===De[++ze]&&Se===De[++ze]&&Se===De[++ze]&&Se===De[++ze]&&Se===De[++ze]&&Se===De[++ze]&&Se===De[++ze]&&ze<Ve);K.match_length=de-(Ve-ze),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=V?(_e=p._tr_tally(K,1,K.match_length-V),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(_e=p._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),_e&&(D(K,!1),K.strm.avail_out===0))return z}return K.insert=0,ve===k?(D(K,!0),K.strm.avail_out===0?$:P):K.last_lit&&(D(K,!1),K.strm.avail_out===0)?z:se})(q,me):d[q.level].func(q,me);if(re!==$&&re!==P||(q.status=666),re===z||re===$)return N.avail_out===0&&(q.last_flush=-1),y;if(re===se&&(me===1?p._tr_align(q):me!==5&&(p._tr_stored_block(q,0,0,!1),me===3&&(ge(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),R(N),N.avail_out===0))return q.last_flush=-1,y}return me!==k?y:q.wrap<=0?1:(q.wrap===2?(W(q,255&N.adler),W(q,N.adler>>8&255),W(q,N.adler>>16&255),W(q,N.adler>>24&255),W(q,255&N.total_in),W(q,N.total_in>>8&255),W(q,N.total_in>>16&255),W(q,N.total_in>>24&255)):(te(q,N.adler>>>16),te(q,65535&N.adler)),R(N),0<q.wrap&&(q.wrap=-q.wrap),q.pending!==0?y:1)},f.deflateEnd=function(N){var me;return N&&N.state?(me=N.state.status)!==H&&me!==69&&me!==73&&me!==91&&me!==103&&me!==F&&me!==666?Z(N,_):(N.state=null,me===F?Z(N,-3):y):_},f.deflateSetDictionary=function(N,me){var ne,q,B,J,xe,re,K,ve,_e=me.length;if(!N||!N.state||(J=(ne=N.state).wrap)===2||J===1&&ne.status!==H||ne.lookahead)return _;for(J===1&&(N.adler=x(N.adler,me,_e,0)),ne.wrap=0,_e>=ne.w_size&&(J===0&&(ge(ne.head),ne.strstart=0,ne.block_start=0,ne.insert=0),ve=new h.Buf8(ne.w_size),h.arraySet(ve,me,_e-ne.w_size,ne.w_size,0),me=ve,_e=ne.w_size),xe=N.avail_in,re=N.next_in,K=N.input,N.avail_in=_e,N.next_in=0,N.input=me,he(ne);ne.lookahead>=V;){for(q=ne.strstart,B=ne.lookahead-(V-1);ne.ins_h=(ne.ins_h<<ne.hash_shift^ne.window[q+V-1])&ne.hash_mask,ne.prev[q&ne.w_mask]=ne.head[ne.ins_h],ne.head[ne.ins_h]=q,q++,--B;);ne.strstart=q,ne.lookahead=V-1,he(ne)}return ne.strstart+=ne.lookahead,ne.block_start=ne.strstart,ne.insert=ne.lookahead,ne.lookahead=0,ne.match_length=ne.prev_length=V-1,ne.match_available=0,N.next_in=re,N.input=K,N.avail_in=xe,ne.wrap=J,y},f.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,u,f){u.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,u,f){u.exports=function(d,h){var p,x,g,C,w,k,y,_,m,b,j,S,A,M,O,U,L,I,V,de,ae,H,F,z,se;p=d.state,x=d.next_in,z=d.input,g=x+(d.avail_in-5),C=d.next_out,se=d.output,w=C-(h-d.avail_out),k=C+(d.avail_out-257),y=p.dmax,_=p.wsize,m=p.whave,b=p.wnext,j=p.window,S=p.hold,A=p.bits,M=p.lencode,O=p.distcode,U=(1<<p.lenbits)-1,L=(1<<p.distbits)-1;e:do{A<15&&(S+=z[x++]<<A,A+=8,S+=z[x++]<<A,A+=8),I=M[S&U];t:for(;;){if(S>>>=V=I>>>24,A-=V,(V=I>>>16&255)===0)se[C++]=65535&I;else{if(!(16&V)){if((64&V)==0){I=M[(65535&I)+(S&(1<<V)-1)];continue t}if(32&V){p.mode=12;break e}d.msg="invalid literal/length code",p.mode=30;break e}de=65535&I,(V&=15)&&(A<V&&(S+=z[x++]<<A,A+=8),de+=S&(1<<V)-1,S>>>=V,A-=V),A<15&&(S+=z[x++]<<A,A+=8,S+=z[x++]<<A,A+=8),I=O[S&L];a:for(;;){if(S>>>=V=I>>>24,A-=V,!(16&(V=I>>>16&255))){if((64&V)==0){I=O[(65535&I)+(S&(1<<V)-1)];continue a}d.msg="invalid distance code",p.mode=30;break e}if(ae=65535&I,A<(V&=15)&&(S+=z[x++]<<A,(A+=8)<V&&(S+=z[x++]<<A,A+=8)),y<(ae+=S&(1<<V)-1)){d.msg="invalid distance too far back",p.mode=30;break e}if(S>>>=V,A-=V,(V=C-w)<ae){if(m<(V=ae-V)&&p.sane){d.msg="invalid distance too far back",p.mode=30;break e}if(F=j,(H=0)===b){if(H+=_-V,V<de){for(de-=V;se[C++]=j[H++],--V;);H=C-ae,F=se}}else if(b<V){if(H+=_+b-V,(V-=b)<de){for(de-=V;se[C++]=j[H++],--V;);if(H=0,b<de){for(de-=V=b;se[C++]=j[H++],--V;);H=C-ae,F=se}}}else if(H+=b-V,V<de){for(de-=V;se[C++]=j[H++],--V;);H=C-ae,F=se}for(;2<de;)se[C++]=F[H++],se[C++]=F[H++],se[C++]=F[H++],de-=3;de&&(se[C++]=F[H++],1<de&&(se[C++]=F[H++]))}else{for(H=C-ae;se[C++]=se[H++],se[C++]=se[H++],se[C++]=se[H++],2<(de-=3););de&&(se[C++]=se[H++],1<de&&(se[C++]=se[H++]))}break}}break}}while(x<g&&C<k);x-=de=A>>3,S&=(1<<(A-=de<<3))-1,d.next_in=x,d.next_out=C,d.avail_in=x<g?g-x+5:5-(x-g),d.avail_out=C<k?k-C+257:257-(C-k),p.hold=S,p.bits=A}},{}],49:[function(r,u,f){var d=r("../utils/common"),h=r("./adler32"),p=r("./crc32"),x=r("./inffast"),g=r("./inftrees"),C=1,w=2,k=0,y=-2,_=1,m=852,b=592;function j(H){return(H>>>24&255)+(H>>>8&65280)+((65280&H)<<8)+((255&H)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new d.Buf16(320),this.work=new d.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function A(H){var F;return H&&H.state?(F=H.state,H.total_in=H.total_out=F.total=0,H.msg="",F.wrap&&(H.adler=1&F.wrap),F.mode=_,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new d.Buf32(m),F.distcode=F.distdyn=new d.Buf32(b),F.sane=1,F.back=-1,k):y}function M(H){var F;return H&&H.state?((F=H.state).wsize=0,F.whave=0,F.wnext=0,A(H)):y}function O(H,F){var z,se;return H&&H.state?(se=H.state,F<0?(z=0,F=-F):(z=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?y:(se.window!==null&&se.wbits!==F&&(se.window=null),se.wrap=z,se.wbits=F,M(H))):y}function U(H,F){var z,se;return H?(se=new S,(H.state=se).window=null,(z=O(H,F))!==k&&(H.state=null),z):y}var L,I,V=!0;function de(H){if(V){var F;for(L=new d.Buf32(512),I=new d.Buf32(32),F=0;F<144;)H.lens[F++]=8;for(;F<256;)H.lens[F++]=9;for(;F<280;)H.lens[F++]=7;for(;F<288;)H.lens[F++]=8;for(g(C,H.lens,0,288,L,0,H.work,{bits:9}),F=0;F<32;)H.lens[F++]=5;g(w,H.lens,0,32,I,0,H.work,{bits:5}),V=!1}H.lencode=L,H.lenbits=9,H.distcode=I,H.distbits=5}function ae(H,F,z,se){var $,P=H.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new d.Buf8(P.wsize)),se>=P.wsize?(d.arraySet(P.window,F,z-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(se<($=P.wsize-P.wnext)&&($=se),d.arraySet(P.window,F,z-se,$,P.wnext),(se-=$)?(d.arraySet(P.window,F,z-se,se,0),P.wnext=se,P.whave=P.wsize):(P.wnext+=$,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=$))),0}f.inflateReset=M,f.inflateReset2=O,f.inflateResetKeep=A,f.inflateInit=function(H){return U(H,15)},f.inflateInit2=U,f.inflate=function(H,F){var z,se,$,P,Z,X,ge,R,D,W,te,Y,he,ke,Ae,Oe,Ke,Ie,nt,We,N,me,ne,q,B=0,J=new d.Buf8(4),xe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!H||!H.state||!H.output||!H.input&&H.avail_in!==0)return y;(z=H.state).mode===12&&(z.mode=13),Z=H.next_out,$=H.output,ge=H.avail_out,P=H.next_in,se=H.input,X=H.avail_in,R=z.hold,D=z.bits,W=X,te=ge,me=k;e:for(;;)switch(z.mode){case _:if(z.wrap===0){z.mode=13;break}for(;D<16;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(2&z.wrap&&R===35615){J[z.check=0]=255&R,J[1]=R>>>8&255,z.check=p(z.check,J,2,0),D=R=0,z.mode=2;break}if(z.flags=0,z.head&&(z.head.done=!1),!(1&z.wrap)||(((255&R)<<8)+(R>>8))%31){H.msg="incorrect header check",z.mode=30;break}if((15&R)!=8){H.msg="unknown compression method",z.mode=30;break}if(D-=4,N=8+(15&(R>>>=4)),z.wbits===0)z.wbits=N;else if(N>z.wbits){H.msg="invalid window size",z.mode=30;break}z.dmax=1<<N,H.adler=z.check=1,z.mode=512&R?10:12,D=R=0;break;case 2:for(;D<16;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(z.flags=R,(255&z.flags)!=8){H.msg="unknown compression method",z.mode=30;break}if(57344&z.flags){H.msg="unknown header flags set",z.mode=30;break}z.head&&(z.head.text=R>>8&1),512&z.flags&&(J[0]=255&R,J[1]=R>>>8&255,z.check=p(z.check,J,2,0)),D=R=0,z.mode=3;case 3:for(;D<32;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}z.head&&(z.head.time=R),512&z.flags&&(J[0]=255&R,J[1]=R>>>8&255,J[2]=R>>>16&255,J[3]=R>>>24&255,z.check=p(z.check,J,4,0)),D=R=0,z.mode=4;case 4:for(;D<16;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}z.head&&(z.head.xflags=255&R,z.head.os=R>>8),512&z.flags&&(J[0]=255&R,J[1]=R>>>8&255,z.check=p(z.check,J,2,0)),D=R=0,z.mode=5;case 5:if(1024&z.flags){for(;D<16;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}z.length=R,z.head&&(z.head.extra_len=R),512&z.flags&&(J[0]=255&R,J[1]=R>>>8&255,z.check=p(z.check,J,2,0)),D=R=0}else z.head&&(z.head.extra=null);z.mode=6;case 6:if(1024&z.flags&&(X<(Y=z.length)&&(Y=X),Y&&(z.head&&(N=z.head.extra_len-z.length,z.head.extra||(z.head.extra=new Array(z.head.extra_len)),d.arraySet(z.head.extra,se,P,Y,N)),512&z.flags&&(z.check=p(z.check,se,Y,P)),X-=Y,P+=Y,z.length-=Y),z.length))break e;z.length=0,z.mode=7;case 7:if(2048&z.flags){if(X===0)break e;for(Y=0;N=se[P+Y++],z.head&&N&&z.length<65536&&(z.head.name+=String.fromCharCode(N)),N&&Y<X;);if(512&z.flags&&(z.check=p(z.check,se,Y,P)),X-=Y,P+=Y,N)break e}else z.head&&(z.head.name=null);z.length=0,z.mode=8;case 8:if(4096&z.flags){if(X===0)break e;for(Y=0;N=se[P+Y++],z.head&&N&&z.length<65536&&(z.head.comment+=String.fromCharCode(N)),N&&Y<X;);if(512&z.flags&&(z.check=p(z.check,se,Y,P)),X-=Y,P+=Y,N)break e}else z.head&&(z.head.comment=null);z.mode=9;case 9:if(512&z.flags){for(;D<16;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(R!==(65535&z.check)){H.msg="header crc mismatch",z.mode=30;break}D=R=0}z.head&&(z.head.hcrc=z.flags>>9&1,z.head.done=!0),H.adler=z.check=0,z.mode=12;break;case 10:for(;D<32;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}H.adler=z.check=j(R),D=R=0,z.mode=11;case 11:if(z.havedict===0)return H.next_out=Z,H.avail_out=ge,H.next_in=P,H.avail_in=X,z.hold=R,z.bits=D,2;H.adler=z.check=1,z.mode=12;case 12:if(F===5||F===6)break e;case 13:if(z.last){R>>>=7&D,D-=7&D,z.mode=27;break}for(;D<3;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}switch(z.last=1&R,D-=1,3&(R>>>=1)){case 0:z.mode=14;break;case 1:if(de(z),z.mode=20,F!==6)break;R>>>=2,D-=2;break e;case 2:z.mode=17;break;case 3:H.msg="invalid block type",z.mode=30}R>>>=2,D-=2;break;case 14:for(R>>>=7&D,D-=7&D;D<32;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if((65535&R)!=(R>>>16^65535)){H.msg="invalid stored block lengths",z.mode=30;break}if(z.length=65535&R,D=R=0,z.mode=15,F===6)break e;case 15:z.mode=16;case 16:if(Y=z.length){if(X<Y&&(Y=X),ge<Y&&(Y=ge),Y===0)break e;d.arraySet($,se,P,Y,Z),X-=Y,P+=Y,ge-=Y,Z+=Y,z.length-=Y;break}z.mode=12;break;case 17:for(;D<14;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(z.nlen=257+(31&R),R>>>=5,D-=5,z.ndist=1+(31&R),R>>>=5,D-=5,z.ncode=4+(15&R),R>>>=4,D-=4,286<z.nlen||30<z.ndist){H.msg="too many length or distance symbols",z.mode=30;break}z.have=0,z.mode=18;case 18:for(;z.have<z.ncode;){for(;D<3;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}z.lens[xe[z.have++]]=7&R,R>>>=3,D-=3}for(;z.have<19;)z.lens[xe[z.have++]]=0;if(z.lencode=z.lendyn,z.lenbits=7,ne={bits:z.lenbits},me=g(0,z.lens,0,19,z.lencode,0,z.work,ne),z.lenbits=ne.bits,me){H.msg="invalid code lengths set",z.mode=30;break}z.have=0,z.mode=19;case 19:for(;z.have<z.nlen+z.ndist;){for(;Oe=(B=z.lencode[R&(1<<z.lenbits)-1])>>>16&255,Ke=65535&B,!((Ae=B>>>24)<=D);){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(Ke<16)R>>>=Ae,D-=Ae,z.lens[z.have++]=Ke;else{if(Ke===16){for(q=Ae+2;D<q;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(R>>>=Ae,D-=Ae,z.have===0){H.msg="invalid bit length repeat",z.mode=30;break}N=z.lens[z.have-1],Y=3+(3&R),R>>>=2,D-=2}else if(Ke===17){for(q=Ae+3;D<q;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}D-=Ae,N=0,Y=3+(7&(R>>>=Ae)),R>>>=3,D-=3}else{for(q=Ae+7;D<q;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}D-=Ae,N=0,Y=11+(127&(R>>>=Ae)),R>>>=7,D-=7}if(z.have+Y>z.nlen+z.ndist){H.msg="invalid bit length repeat",z.mode=30;break}for(;Y--;)z.lens[z.have++]=N}}if(z.mode===30)break;if(z.lens[256]===0){H.msg="invalid code -- missing end-of-block",z.mode=30;break}if(z.lenbits=9,ne={bits:z.lenbits},me=g(C,z.lens,0,z.nlen,z.lencode,0,z.work,ne),z.lenbits=ne.bits,me){H.msg="invalid literal/lengths set",z.mode=30;break}if(z.distbits=6,z.distcode=z.distdyn,ne={bits:z.distbits},me=g(w,z.lens,z.nlen,z.ndist,z.distcode,0,z.work,ne),z.distbits=ne.bits,me){H.msg="invalid distances set",z.mode=30;break}if(z.mode=20,F===6)break e;case 20:z.mode=21;case 21:if(6<=X&&258<=ge){H.next_out=Z,H.avail_out=ge,H.next_in=P,H.avail_in=X,z.hold=R,z.bits=D,x(H,te),Z=H.next_out,$=H.output,ge=H.avail_out,P=H.next_in,se=H.input,X=H.avail_in,R=z.hold,D=z.bits,z.mode===12&&(z.back=-1);break}for(z.back=0;Oe=(B=z.lencode[R&(1<<z.lenbits)-1])>>>16&255,Ke=65535&B,!((Ae=B>>>24)<=D);){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(Oe&&(240&Oe)==0){for(Ie=Ae,nt=Oe,We=Ke;Oe=(B=z.lencode[We+((R&(1<<Ie+nt)-1)>>Ie)])>>>16&255,Ke=65535&B,!(Ie+(Ae=B>>>24)<=D);){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}R>>>=Ie,D-=Ie,z.back+=Ie}if(R>>>=Ae,D-=Ae,z.back+=Ae,z.length=Ke,Oe===0){z.mode=26;break}if(32&Oe){z.back=-1,z.mode=12;break}if(64&Oe){H.msg="invalid literal/length code",z.mode=30;break}z.extra=15&Oe,z.mode=22;case 22:if(z.extra){for(q=z.extra;D<q;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}z.length+=R&(1<<z.extra)-1,R>>>=z.extra,D-=z.extra,z.back+=z.extra}z.was=z.length,z.mode=23;case 23:for(;Oe=(B=z.distcode[R&(1<<z.distbits)-1])>>>16&255,Ke=65535&B,!((Ae=B>>>24)<=D);){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if((240&Oe)==0){for(Ie=Ae,nt=Oe,We=Ke;Oe=(B=z.distcode[We+((R&(1<<Ie+nt)-1)>>Ie)])>>>16&255,Ke=65535&B,!(Ie+(Ae=B>>>24)<=D);){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}R>>>=Ie,D-=Ie,z.back+=Ie}if(R>>>=Ae,D-=Ae,z.back+=Ae,64&Oe){H.msg="invalid distance code",z.mode=30;break}z.offset=Ke,z.extra=15&Oe,z.mode=24;case 24:if(z.extra){for(q=z.extra;D<q;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}z.offset+=R&(1<<z.extra)-1,R>>>=z.extra,D-=z.extra,z.back+=z.extra}if(z.offset>z.dmax){H.msg="invalid distance too far back",z.mode=30;break}z.mode=25;case 25:if(ge===0)break e;if(Y=te-ge,z.offset>Y){if((Y=z.offset-Y)>z.whave&&z.sane){H.msg="invalid distance too far back",z.mode=30;break}he=Y>z.wnext?(Y-=z.wnext,z.wsize-Y):z.wnext-Y,Y>z.length&&(Y=z.length),ke=z.window}else ke=$,he=Z-z.offset,Y=z.length;for(ge<Y&&(Y=ge),ge-=Y,z.length-=Y;$[Z++]=ke[he++],--Y;);z.length===0&&(z.mode=21);break;case 26:if(ge===0)break e;$[Z++]=z.length,ge--,z.mode=21;break;case 27:if(z.wrap){for(;D<32;){if(X===0)break e;X--,R|=se[P++]<<D,D+=8}if(te-=ge,H.total_out+=te,z.total+=te,te&&(H.adler=z.check=z.flags?p(z.check,$,te,Z-te):h(z.check,$,te,Z-te)),te=ge,(z.flags?R:j(R))!==z.check){H.msg="incorrect data check",z.mode=30;break}D=R=0}z.mode=28;case 28:if(z.wrap&&z.flags){for(;D<32;){if(X===0)break e;X--,R+=se[P++]<<D,D+=8}if(R!==(4294967295&z.total)){H.msg="incorrect length check",z.mode=30;break}D=R=0}z.mode=29;case 29:me=1;break e;case 30:me=-3;break e;case 31:return-4;default:return y}return H.next_out=Z,H.avail_out=ge,H.next_in=P,H.avail_in=X,z.hold=R,z.bits=D,(z.wsize||te!==H.avail_out&&z.mode<30&&(z.mode<27||F!==4))&&ae(H,H.output,H.next_out,te-H.avail_out)?(z.mode=31,-4):(W-=H.avail_in,te-=H.avail_out,H.total_in+=W,H.total_out+=te,z.total+=te,z.wrap&&te&&(H.adler=z.check=z.flags?p(z.check,$,te,H.next_out-te):h(z.check,$,te,H.next_out-te)),H.data_type=z.bits+(z.last?64:0)+(z.mode===12?128:0)+(z.mode===20||z.mode===15?256:0),(W==0&&te===0||F===4)&&me===k&&(me=-5),me)},f.inflateEnd=function(H){if(!H||!H.state)return y;var F=H.state;return F.window&&(F.window=null),H.state=null,k},f.inflateGetHeader=function(H,F){var z;return H&&H.state?(2&(z=H.state).wrap)==0?y:((z.head=F).done=!1,k):y},f.inflateSetDictionary=function(H,F){var z,se=F.length;return H&&H.state?(z=H.state).wrap!==0&&z.mode!==11?y:z.mode===11&&h(1,F,se,0)!==z.check?-3:ae(H,F,se,se)?(z.mode=31,-4):(z.havedict=1,k):y},f.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,u,f){var d=r("../utils/common"),h=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],p=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],x=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],g=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];u.exports=function(C,w,k,y,_,m,b,j){var S,A,M,O,U,L,I,V,de,ae=j.bits,H=0,F=0,z=0,se=0,$=0,P=0,Z=0,X=0,ge=0,R=0,D=null,W=0,te=new d.Buf16(16),Y=new d.Buf16(16),he=null,ke=0;for(H=0;H<=15;H++)te[H]=0;for(F=0;F<y;F++)te[w[k+F]]++;for($=ae,se=15;1<=se&&te[se]===0;se--);if(se<$&&($=se),se===0)return _[m++]=20971520,_[m++]=20971520,j.bits=1,0;for(z=1;z<se&&te[z]===0;z++);for($<z&&($=z),H=X=1;H<=15;H++)if(X<<=1,(X-=te[H])<0)return-1;if(0<X&&(C===0||se!==1))return-1;for(Y[1]=0,H=1;H<15;H++)Y[H+1]=Y[H]+te[H];for(F=0;F<y;F++)w[k+F]!==0&&(b[Y[w[k+F]]++]=F);if(L=C===0?(D=he=b,19):C===1?(D=h,W-=257,he=p,ke-=257,256):(D=x,he=g,-1),H=z,U=m,Z=F=R=0,M=-1,O=(ge=1<<(P=$))-1,C===1&&852<ge||C===2&&592<ge)return 1;for(;;){for(I=H-Z,de=b[F]<L?(V=0,b[F]):b[F]>L?(V=he[ke+b[F]],D[W+b[F]]):(V=96,0),S=1<<H-Z,z=A=1<<P;_[U+(R>>Z)+(A-=S)]=I<<24|V<<16|de|0,A!==0;);for(S=1<<H-1;R&S;)S>>=1;if(S!==0?(R&=S-1,R+=S):R=0,F++,--te[H]==0){if(H===se)break;H=w[k+b[F]]}if($<H&&(R&O)!==M){for(Z===0&&(Z=$),U+=z,X=1<<(P=H-Z);P+Z<se&&!((X-=te[P+Z])<=0);)P++,X<<=1;if(ge+=1<<P,C===1&&852<ge||C===2&&592<ge)return 1;_[M=R&O]=$<<24|P<<16|U-m|0}}return R!==0&&(_[U+R]=H-Z<<24|64<<16|0),j.bits=$,0}},{"../utils/common":41}],51:[function(r,u,f){u.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,u,f){var d=r("../utils/common"),h=0,p=1;function x(B){for(var J=B.length;0<=--J;)B[J]=0}var g=0,C=29,w=256,k=w+1+C,y=30,_=19,m=2*k+1,b=15,j=16,S=7,A=256,M=16,O=17,U=18,L=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],I=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],V=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],de=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ae=new Array(2*(k+2));x(ae);var H=new Array(2*y);x(H);var F=new Array(512);x(F);var z=new Array(256);x(z);var se=new Array(C);x(se);var $,P,Z,X=new Array(y);function ge(B,J,xe,re,K){this.static_tree=B,this.extra_bits=J,this.extra_base=xe,this.elems=re,this.max_length=K,this.has_stree=B&&B.length}function R(B,J){this.dyn_tree=B,this.max_code=0,this.stat_desc=J}function D(B){return B<256?F[B]:F[256+(B>>>7)]}function W(B,J){B.pending_buf[B.pending++]=255&J,B.pending_buf[B.pending++]=J>>>8&255}function te(B,J,xe){B.bi_valid>j-xe?(B.bi_buf|=J<<B.bi_valid&65535,W(B,B.bi_buf),B.bi_buf=J>>j-B.bi_valid,B.bi_valid+=xe-j):(B.bi_buf|=J<<B.bi_valid&65535,B.bi_valid+=xe)}function Y(B,J,xe){te(B,xe[2*J],xe[2*J+1])}function he(B,J){for(var xe=0;xe|=1&B,B>>>=1,xe<<=1,0<--J;);return xe>>>1}function ke(B,J,xe){var re,K,ve=new Array(b+1),_e=0;for(re=1;re<=b;re++)ve[re]=_e=_e+xe[re-1]<<1;for(K=0;K<=J;K++){var Se=B[2*K+1];Se!==0&&(B[2*K]=he(ve[Se]++,Se))}}function Ae(B){var J;for(J=0;J<k;J++)B.dyn_ltree[2*J]=0;for(J=0;J<y;J++)B.dyn_dtree[2*J]=0;for(J=0;J<_;J++)B.bl_tree[2*J]=0;B.dyn_ltree[2*A]=1,B.opt_len=B.static_len=0,B.last_lit=B.matches=0}function Oe(B){8<B.bi_valid?W(B,B.bi_buf):0<B.bi_valid&&(B.pending_buf[B.pending++]=B.bi_buf),B.bi_buf=0,B.bi_valid=0}function Ke(B,J,xe,re){var K=2*J,ve=2*xe;return B[K]<B[ve]||B[K]===B[ve]&&re[J]<=re[xe]}function Ie(B,J,xe){for(var re=B.heap[xe],K=xe<<1;K<=B.heap_len&&(K<B.heap_len&&Ke(J,B.heap[K+1],B.heap[K],B.depth)&&K++,!Ke(J,re,B.heap[K],B.depth));)B.heap[xe]=B.heap[K],xe=K,K<<=1;B.heap[xe]=re}function nt(B,J,xe){var re,K,ve,_e,Se=0;if(B.last_lit!==0)for(;re=B.pending_buf[B.d_buf+2*Se]<<8|B.pending_buf[B.d_buf+2*Se+1],K=B.pending_buf[B.l_buf+Se],Se++,re===0?Y(B,K,J):(Y(B,(ve=z[K])+w+1,J),(_e=L[ve])!==0&&te(B,K-=se[ve],_e),Y(B,ve=D(--re),xe),(_e=I[ve])!==0&&te(B,re-=X[ve],_e)),Se<B.last_lit;);Y(B,A,J)}function We(B,J){var xe,re,K,ve=J.dyn_tree,_e=J.stat_desc.static_tree,Se=J.stat_desc.has_stree,ze=J.stat_desc.elems,Ve=-1;for(B.heap_len=0,B.heap_max=m,xe=0;xe<ze;xe++)ve[2*xe]!==0?(B.heap[++B.heap_len]=Ve=xe,B.depth[xe]=0):ve[2*xe+1]=0;for(;B.heap_len<2;)ve[2*(K=B.heap[++B.heap_len]=Ve<2?++Ve:0)]=1,B.depth[K]=0,B.opt_len--,Se&&(B.static_len-=_e[2*K+1]);for(J.max_code=Ve,xe=B.heap_len>>1;1<=xe;xe--)Ie(B,ve,xe);for(K=ze;xe=B.heap[1],B.heap[1]=B.heap[B.heap_len--],Ie(B,ve,1),re=B.heap[1],B.heap[--B.heap_max]=xe,B.heap[--B.heap_max]=re,ve[2*K]=ve[2*xe]+ve[2*re],B.depth[K]=(B.depth[xe]>=B.depth[re]?B.depth[xe]:B.depth[re])+1,ve[2*xe+1]=ve[2*re+1]=K,B.heap[1]=K++,Ie(B,ve,1),2<=B.heap_len;);B.heap[--B.heap_max]=B.heap[1],(function(De,pt){var be,we,Re,Ue,Be,qe,Me=pt.dyn_tree,Fe=pt.max_code,rt=pt.stat_desc.static_tree,pa=pt.stat_desc.has_stree,ma=pt.stat_desc.extra_bits,va=pt.stat_desc.extra_base,Qt=pt.stat_desc.max_length,qt=0;for(Ue=0;Ue<=b;Ue++)De.bl_count[Ue]=0;for(Me[2*De.heap[De.heap_max]+1]=0,be=De.heap_max+1;be<m;be++)Qt<(Ue=Me[2*Me[2*(we=De.heap[be])+1]+1]+1)&&(Ue=Qt,qt++),Me[2*we+1]=Ue,Fe<we||(De.bl_count[Ue]++,Be=0,va<=we&&(Be=ma[we-va]),qe=Me[2*we],De.opt_len+=qe*(Ue+Be),pa&&(De.static_len+=qe*(rt[2*we+1]+Be)));if(qt!==0){do{for(Ue=Qt-1;De.bl_count[Ue]===0;)Ue--;De.bl_count[Ue]--,De.bl_count[Ue+1]+=2,De.bl_count[Qt]--,qt-=2}while(0<qt);for(Ue=Qt;Ue!==0;Ue--)for(we=De.bl_count[Ue];we!==0;)Fe<(Re=De.heap[--be])||(Me[2*Re+1]!==Ue&&(De.opt_len+=(Ue-Me[2*Re+1])*Me[2*Re],Me[2*Re+1]=Ue),we--)}})(B,J),ke(ve,Ve,B.bl_count)}function N(B,J,xe){var re,K,ve=-1,_e=J[1],Se=0,ze=7,Ve=4;for(_e===0&&(ze=138,Ve=3),J[2*(xe+1)+1]=65535,re=0;re<=xe;re++)K=_e,_e=J[2*(re+1)+1],++Se<ze&&K===_e||(Se<Ve?B.bl_tree[2*K]+=Se:K!==0?(K!==ve&&B.bl_tree[2*K]++,B.bl_tree[2*M]++):Se<=10?B.bl_tree[2*O]++:B.bl_tree[2*U]++,ve=K,Ve=(Se=0)===_e?(ze=138,3):K===_e?(ze=6,3):(ze=7,4))}function me(B,J,xe){var re,K,ve=-1,_e=J[1],Se=0,ze=7,Ve=4;for(_e===0&&(ze=138,Ve=3),re=0;re<=xe;re++)if(K=_e,_e=J[2*(re+1)+1],!(++Se<ze&&K===_e)){if(Se<Ve)for(;Y(B,K,B.bl_tree),--Se!=0;);else K!==0?(K!==ve&&(Y(B,K,B.bl_tree),Se--),Y(B,M,B.bl_tree),te(B,Se-3,2)):Se<=10?(Y(B,O,B.bl_tree),te(B,Se-3,3)):(Y(B,U,B.bl_tree),te(B,Se-11,7));ve=K,Ve=(Se=0)===_e?(ze=138,3):K===_e?(ze=6,3):(ze=7,4)}}x(X);var ne=!1;function q(B,J,xe,re){te(B,(g<<1)+(re?1:0),3),(function(K,ve,_e,Se){Oe(K),W(K,_e),W(K,~_e),d.arraySet(K.pending_buf,K.window,ve,_e,K.pending),K.pending+=_e})(B,J,xe)}f._tr_init=function(B){ne||((function(){var J,xe,re,K,ve,_e=new Array(b+1);for(K=re=0;K<C-1;K++)for(se[K]=re,J=0;J<1<<L[K];J++)z[re++]=K;for(z[re-1]=K,K=ve=0;K<16;K++)for(X[K]=ve,J=0;J<1<<I[K];J++)F[ve++]=K;for(ve>>=7;K<y;K++)for(X[K]=ve<<7,J=0;J<1<<I[K]-7;J++)F[256+ve++]=K;for(xe=0;xe<=b;xe++)_e[xe]=0;for(J=0;J<=143;)ae[2*J+1]=8,J++,_e[8]++;for(;J<=255;)ae[2*J+1]=9,J++,_e[9]++;for(;J<=279;)ae[2*J+1]=7,J++,_e[7]++;for(;J<=287;)ae[2*J+1]=8,J++,_e[8]++;for(ke(ae,k+1,_e),J=0;J<y;J++)H[2*J+1]=5,H[2*J]=he(J,5);$=new ge(ae,L,w+1,k,b),P=new ge(H,I,0,y,b),Z=new ge(new Array(0),V,0,_,S)})(),ne=!0),B.l_desc=new R(B.dyn_ltree,$),B.d_desc=new R(B.dyn_dtree,P),B.bl_desc=new R(B.bl_tree,Z),B.bi_buf=0,B.bi_valid=0,Ae(B)},f._tr_stored_block=q,f._tr_flush_block=function(B,J,xe,re){var K,ve,_e=0;0<B.level?(B.strm.data_type===2&&(B.strm.data_type=(function(Se){var ze,Ve=4093624447;for(ze=0;ze<=31;ze++,Ve>>>=1)if(1&Ve&&Se.dyn_ltree[2*ze]!==0)return h;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return p;for(ze=32;ze<w;ze++)if(Se.dyn_ltree[2*ze]!==0)return p;return h})(B)),We(B,B.l_desc),We(B,B.d_desc),_e=(function(Se){var ze;for(N(Se,Se.dyn_ltree,Se.l_desc.max_code),N(Se,Se.dyn_dtree,Se.d_desc.max_code),We(Se,Se.bl_desc),ze=_-1;3<=ze&&Se.bl_tree[2*de[ze]+1]===0;ze--);return Se.opt_len+=3*(ze+1)+5+5+4,ze})(B),K=B.opt_len+3+7>>>3,(ve=B.static_len+3+7>>>3)<=K&&(K=ve)):K=ve=xe+5,xe+4<=K&&J!==-1?q(B,J,xe,re):B.strategy===4||ve===K?(te(B,2+(re?1:0),3),nt(B,ae,H)):(te(B,4+(re?1:0),3),(function(Se,ze,Ve,De){var pt;for(te(Se,ze-257,5),te(Se,Ve-1,5),te(Se,De-4,4),pt=0;pt<De;pt++)te(Se,Se.bl_tree[2*de[pt]+1],3);me(Se,Se.dyn_ltree,ze-1),me(Se,Se.dyn_dtree,Ve-1)})(B,B.l_desc.max_code+1,B.d_desc.max_code+1,_e+1),nt(B,B.dyn_ltree,B.dyn_dtree)),Ae(B),re&&Oe(B)},f._tr_tally=function(B,J,xe){return B.pending_buf[B.d_buf+2*B.last_lit]=J>>>8&255,B.pending_buf[B.d_buf+2*B.last_lit+1]=255&J,B.pending_buf[B.l_buf+B.last_lit]=255&xe,B.last_lit++,J===0?B.dyn_ltree[2*xe]++:(B.matches++,J--,B.dyn_ltree[2*(z[xe]+w+1)]++,B.dyn_dtree[2*D(J)]++),B.last_lit===B.lit_bufsize-1},f._tr_align=function(B){te(B,2,3),Y(B,A,ae),(function(J){J.bi_valid===16?(W(J,J.bi_buf),J.bi_buf=0,J.bi_valid=0):8<=J.bi_valid&&(J.pending_buf[J.pending++]=255&J.bi_buf,J.bi_buf>>=8,J.bi_valid-=8)})(B)}},{"../utils/common":41}],53:[function(r,u,f){u.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,u,f){(function(d){(function(h,p){if(!h.setImmediate){var x,g,C,w,k=1,y={},_=!1,m=h.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(h);b=b&&b.setTimeout?b:h,x={}.toString.call(h.process)==="[object process]"?function(M){process.nextTick(function(){S(M)})}:(function(){if(h.postMessage&&!h.importScripts){var M=!0,O=h.onmessage;return h.onmessage=function(){M=!1},h.postMessage("","*"),h.onmessage=O,M}})()?(w="setImmediate$"+Math.random()+"$",h.addEventListener?h.addEventListener("message",A,!1):h.attachEvent("onmessage",A),function(M){h.postMessage(w+M,"*")}):h.MessageChannel?((C=new MessageChannel).port1.onmessage=function(M){S(M.data)},function(M){C.port2.postMessage(M)}):m&&"onreadystatechange"in m.createElement("script")?(g=m.documentElement,function(M){var O=m.createElement("script");O.onreadystatechange=function(){S(M),O.onreadystatechange=null,g.removeChild(O),O=null},g.appendChild(O)}):function(M){setTimeout(S,0,M)},b.setImmediate=function(M){typeof M!="function"&&(M=new Function(""+M));for(var O=new Array(arguments.length-1),U=0;U<O.length;U++)O[U]=arguments[U+1];var L={callback:M,args:O};return y[k]=L,x(k),k++},b.clearImmediate=j}function j(M){delete y[M]}function S(M){if(_)setTimeout(S,0,M);else{var O=y[M];if(O){_=!0;try{(function(U){var L=U.callback,I=U.args;switch(I.length){case 0:L();break;case 1:L(I[0]);break;case 2:L(I[0],I[1]);break;case 3:L(I[0],I[1],I[2]);break;default:L.apply(p,I)}})(O)}finally{j(M),_=!1}}}}function A(M){M.source===h&&typeof M.data=="string"&&M.data.indexOf(w)===0&&S(+M.data.slice(w.length))}})(typeof self>"u"?d===void 0?this:d:self)}).call(this,typeof Ps<"u"?Ps:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(qc)),qc.exports}var Lb=Ub();const Bb=Pc(Lb),Hb=i=>{switch(i.split(".").pop()?.toLowerCase()||""){case"pdf":return"picture_as_pdf";case"csv":case"xls":case"xlsx":return"table_view";case"png":case"jpg":case"jpeg":case"gif":case"svg":return"image";case"txt":case"md":return"description";case"json":return"data_object";case"zip":case"tar":case"gz":return"folder_zip";default:return"insert_drive_file"}},er=6e4,Al=200,pp=200,Gn=1e6,Kc=2e3,Ic=2e3,Yb=360,Pp=12,tr=Yb+Pp,qb=4,Kb=4,Ib=({index:i,style:c,data:r})=>{const u=r[i];return u?l.jsx("div",{style:{...c,paddingBottom:Pp},children:l.jsx(Fp,{capture:u})}):null},mp=i=>`${(i/(1024*1024)).toFixed(2)} MB`,Gb=i=>{if(typeof i=="boolean")return i;if(typeof i=="string"){const c=i.trim().toLowerCase();if(c==="true")return!0;if(c==="false")return!1}return null},ar=(i,c)=>i.length<=c?{text:i,truncated:!1}:{text:i.slice(0,c),truncated:!0},Vb=i=>!i||i.data===void 0||i.data===null?{reason:"No data to copy."}:{raw:i.data},nr=(i,c,r)=>i.length<=c?i:(r.push(`first ${c.toLocaleString()} chars`),i.slice(0,c)),Xb=i=>{const c=[];if(typeof i=="string")return{text:nr(i,Gn,c),truncated:c.length>0,reason:c.join(", ")};if(Array.isArray(i)){let u=i;i.length>Kc&&(u=i.slice(0,Kc),c.push(`first ${Kc.toLocaleString()} items`));let f="";try{f=JSON.stringify(u,null,2)}catch{f=String(u)}return f=nr(f,Gn,c),{text:f,truncated:c.length>0,reason:c.join(", ")}}if(i&&typeof i=="object"){let u=i;const f=Object.keys(i);f.length>Ic&&(u=f.slice(0,Ic).reduce((h,p)=>(h[p]=i[p],h),{}),c.push(`first ${Ic.toLocaleString()} keys`));let d="";try{d=JSON.stringify(u,null,2)}catch{d=String(u)}return d=nr(d,Gn,c),{text:d,truncated:c.length>0,reason:c.join(", ")}}return{text:nr(String(i),Gn,c),truncated:c.length>0,reason:c.join(", ")}},Zb=i=>{if(typeof i=="string")return i;try{return JSON.stringify(i,null,2)}catch{return String(i)}},xp=i=>{if(!i||i.data===void 0||i.data===null||i.data==="")return{text:"",truncated:!1,language:"plain"};const c=i.data;if(typeof c=="string"){const u=c.slice(0,2e3).trim(),f=u.startsWith("<")&&u.includes(">")?"html":u.startsWith("{")||u.startsWith("[")?"json":"plain",d=ar(c,er);return{text:d.text,truncated:d.truncated,language:f}}if(Array.isArray(c)){const u=c.length>Al?c.slice(0,Al):c,f=JSON.stringify(u,null,2),d=ar(f,er);return{text:d.text,truncated:d.truncated||c.length>Al,language:"json"}}if(c&&typeof c=="object"){const u=Object.keys(c);let f=c,d=!1;u.length>pp&&(d=!0,f=u.slice(0,pp).reduce((x,g)=>(x[g]=c[g],x),{}));const h=JSON.stringify(f,null,2),p=ar(h,er);return{text:p.text,truncated:p.truncated||d,language:"json"}}const r=ar(String(c),er);return{text:r.text,truncated:r.truncated,language:"plain"}},$b=(i,c)=>{const r=[];let u=[],f="",d=!1;for(let h=0;h<i.length;h+=1){const p=i[h];if(d)p==='"'?i[h+1]==='"'?(f+='"',h+=1):d=!1:f+=p;else if(p==='"')d=!0;else if(p===",")u.push(f),f="";else if(p===`
13
+ `){if(u.push(f),r.push(u),r.length>=c)return r;u=[],f=""}else p==="\r"||(f+=p)}return u.push(f),(u.length>1||u[0]!==""||r.length>0)&&r.push(u),r},Qb=i=>{if(!i)return null;if(typeof i=="string"){const c=i.slice(0,2e3).trim();if(c.startsWith("{")||c.startsWith("[")||!c.includes(",")||!c.includes(`
14
+ `))return null;const r=i.trim(),u=$b(r,Al+1).filter(h=>h.some(p=>String(p||"").trim()!==""));if(u.length<2)return null;const f=u[0].map((h,p)=>String(h||"").trim()||`column_${p+1}`),d=u.slice(1,Al+1);return f.length<2?null:{headers:f,rows:d}}if(Array.isArray(i)){if(i.length===0)return null;const c=i.slice(0,Al);if(c.every(r=>r&&typeof r=="object"&&!Array.isArray(r))){const r=[],u=new Set;if(c.forEach(d=>{Object.keys(d).forEach(h=>{u.has(h)||(u.add(h),r.push(h))})}),r.length===0)return null;const f=c.map(d=>r.map(h=>d[h]??""));return{headers:r,rows:f}}if(c.every(r=>Array.isArray(r))){const r=Math.max(...c.map(f=>f.length));return{headers:Array.from({length:r},(f,d)=>`column_${d+1}`),rows:c}}return null}if(i&&typeof i=="object"){const c=Object.keys(i);return c.length===0?null:{headers:c,rows:[c.map(r=>i[r]??"")]}}return null},Fb=(i,c)=>i==null?null:typeof i=="string"?c?{content:i,mime:"text/csv",ext:"csv"}:{content:i,mime:"application/json",ext:"json"}:{content:JSON.stringify(i,null,2),mime:"application/json",ext:"json"},Pb=(i,c,r)=>{const u=new Blob([c],{type:r}),f=URL.createObjectURL(u),d=document.createElement("a");d.href=f,d.download=i,document.body.appendChild(d),d.click(),d.remove(),URL.revokeObjectURL(f)},Jb=({results:i,pinnedResults:c,isExecuting:r,isHeadful:u,runId:f,onConfirm:d,onNotify:h,onPin:p,onUnpin:x,fullWidth:g,useNovnc:C})=>{const[w,k]=E.useState(null),[y,_]=E.useState("raw"),[m,b]=E.useState("data"),[j,S]=E.useState(()=>c&&!i?"pinned":"latest"),A=E.useMemo(()=>C===null?"checking":C?"novnc":"native",[C]),[M,O]=E.useState(!1),[U,L]=E.useState(!1),[I,V]=E.useState([]),de=E.useRef(null),ae=j==="pinned"&&c?c:i,H=E.useMemo(()=>Qb(ae?.data),[ae?.data]),F=E.useMemo(()=>ae&&ae.data!==void 0&&ae.data!==null&&ae.data!==""?xp(ae):null,[ae?.data]),z=E.useMemo(()=>ae?.screenshotUrl?`${ae.screenshotUrl}${j==="latest"?`?t=${Date.now()}`:""}`:null,[ae?.screenshotUrl,j]),se=X=>{const ge=Gb(X);return ge!==null?ge?l.jsx(ue,{name:"check",className:"text-xs text-blue-400"}):"":X??""},$=async()=>{L(!0);try{const X=f?`?runId=${encodeURIComponent(f)}`:"",ge=await fetch(`/api/data/captures${X}`),R=ge.ok?await ge.json():{captures:[]};V(Array.isArray(R.captures)?R.captures:[])}catch{V([])}finally{L(!1)}};E.useEffect(()=>{_(H?"table":"raw"),!ae?.downloads||ae.downloads.length===0?b("data"):ae?.data||b("downloads")},[ae]),E.useEffect(()=>{i&&S("latest")},[i]),E.useEffect(()=>{!c&&j==="pinned"&&S("latest")},[c,j]),E.useEffect(()=>{if(!M)return;const X=ge=>{ge.key==="Escape"&&O(!1)};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[M]);const P=async(X,ge,R)=>{if(!X){h("Nothing to copy.","error");return}let D=X;!R?.skipSizeConfirm&&X.length>Gn&&(await d({message:`Copying ${mp(X.length)} may freeze your browser.`,confirmLabel:"Copy full",cancelLabel:"Copy segment"})||(D=X.slice(0,Gn)));try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(D);else{const W=document.createElement("textarea");W.value=D,W.style.position="fixed",W.style.left="-999999px",W.style.top="-999999px",document.body.appendChild(W),W.focus(),W.select(),document.execCommand("copy"),W.remove()}k(ge),setTimeout(()=>k(null),2e3),R?.truncatedNotice?h("Copied truncated data.","success"):D.length!==X.length&&h("Copied a truncated preview.","success")}catch(W){console.error("Copy failed:",W),h("Copy failed.","error")}};if(u&&j==="latest"){const{origin:X,hostname:ge}=window.location,R=`${X}/novnc.html?host=${ge}&path=websockify`,D=()=>{const W=de.current;if(W){if(document.fullscreenElement){document.exitFullscreen().catch(()=>{});return}W.requestFullscreen?.().catch(()=>{})}};return A==="native"?l.jsxs("div",{className:"glass-card rounded-[32px] overflow-hidden h-[80vh] w-full relative flex flex-col items-center justify-center p-8 text-center gap-4",children:[l.jsx("div",{className:"text-[12px] font-bold uppercase tracking-widest text-white",children:"Headful Session Active"}),l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-widest text-amber-500/80 max-w-lg leading-relaxed",children:"Figranium is not optimized for native browser windows. Please install the proper tools for stability (Xvfb, x11vnc, websockify) or simply use the Docker version."})]}):A==="checking"?l.jsx("div",{className:"glass-card rounded-[32px] overflow-hidden h-[80vh] w-full relative flex items-center justify-center",children:l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-widest text-gray-500",children:"Checking headful viewer..."})}):l.jsxs("div",{ref:de,className:"glass-card rounded-[32px] overflow-hidden h-[80vh] w-full relative",children:[l.jsx("button",{type:"button",onClick:D,className:"absolute top-4 right-4 z-10 px-3 py-2 rounded-xl border border-white/20 bg-black/40 text-[9px] font-bold uppercase tracking-widest text-white/80 hover:bg-black/60 transition-all",title:"Toggle fullscreen",children:"Fullscreen"}),l.jsx("iframe",{src:R,className:"absolute inset-0 w-full h-full",title:"Headful Browser"})]})}if(!ae&&!(r&&j==="latest"))return l.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center space-y-4 opacity-20",children:[l.jsx("div",{className:"w-16 h-16 border border-white/10 rounded-full flex items-center justify-center",children:l.jsx(ue,{name:"terminal",className:"text-2xl text-white"})}),l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-[0.3em]",children:"Ready"})]});const Z=g?"space-y-8 relative z-10 w-full":"space-y-12 relative z-10 max-w-5xl mx-auto";return l.jsxs("div",{className:Z,children:[l.jsxs("div",{className:"flex items-end justify-between border-b border-white/5 pb-4",children:[l.jsxs("div",{className:"space-y-2 min-w-0 mr-3",children:[l.jsx("p",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.3em]",children:"Preview"}),l.jsx("h2",{className:"text-sm font-mono text-white truncate tracking-tight italic",children:ae?.finalUrl||ae?.url||""})]}),l.jsx("div",{className:`px-4 py-2 rounded-xl text-[9px] font-bold uppercase tracking-[0.2em] ${j==="pinned"?"bg-amber-500/10 text-amber-300":r?"bg-blue-500/10 text-blue-400 animate-pulse":"bg-green-500/10 text-green-400"}`,children:j==="pinned"?"Pinned":r?"Running":"Finished"})]}),l.jsxs("div",{className:`grid grid-cols-1 ${g?"gap-6":"xl:grid-cols-2 gap-8"}`,children:[l.jsxs("div",{className:`glass-card overflow-hidden flex flex-col ${g?"rounded-2xl min-h-[260px]":"rounded-[32px] min-h-[400px]"}`,children:[l.jsxs("div",{className:`border-b border-white/5 flex items-center justify-between text-[8px] font-bold text-gray-500 uppercase tracking-widest ${g?"p-4":"p-6"}`,children:[l.jsx("span",{children:"Screenshot"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-white/20",children:ae?.timestamp||"--:--:--"}),l.jsx("button",{type:"button",onClick:()=>{O(!0),$()},className:"px-3 py-2 rounded-xl border border-white/10 text-[8px] font-bold uppercase tracking-widest text-white/70 hover:text-white hover:bg-white/5 transition-all",children:"View All Captures"})]})]}),l.jsx("div",{className:"relative bg-black flex-1 flex items-center justify-center overflow-hidden",children:z?l.jsx("img",{src:z,className:"absolute inset-0 w-full h-full object-contain transition-opacity duration-1000"}):l.jsx("div",{className:"text-[8px] font-bold text-white/5 uppercase tracking-widest",children:"Waiting for Frame..."})})]}),l.jsxs("div",{className:`glass-card flex flex-col ${g?"rounded-2xl p-4 h-[240px]":"rounded-[32px] p-8 h-[400px]"}`,children:[l.jsxs("div",{className:`flex items-center justify-between border-b border-white/5 ${g?"mb-4 pb-3":"mb-6 pb-4"}`,children:[l.jsx("span",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-widest",children:"Activity Log"}),l.jsxs("button",{onClick:()=>P((ae?.logs||[]).join(`
15
+ `),"logs"),className:`px-3 py-1.5 border text-[7px] font-bold rounded-lg uppercase transition-all flex items-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${w==="logs"?"bg-green-500/10 border-green-500/20 text-green-400":"bg-white/5 border-white/10 text-white/50 hover:text-white hover:bg-white/10"}`,title:"Copy activity log","aria-label":"Copy activity log",children:[l.jsx(ue,{name:w==="logs"?"check":"content_copy",className:"text-[12px]"}),w==="logs"?"Copied":"Copy"]})]}),l.jsxs("div",{className:"flex-1 font-mono text-[10px] text-gray-400 space-y-2 overflow-y-auto custom-scrollbar pr-2",children:[ae?.logs?.map((X,ge)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx("span",{className:"text-white/10 shrink-0",children:"›"})," ",l.jsx("span",{children:X})]},ge)),r&&j==="latest"&&(!ae?.logs||ae?.logs.length===0)&&l.jsx("div",{className:"animate-pulse",children:"Connecting to kernel..."})]})]})]}),M&&l.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-6",children:l.jsxs("div",{className:"glass-card rounded-[32px] w-full max-w-5xl max-h-[85vh] overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-widest",children:"Captures"}),l.jsx("div",{className:"text-sm font-bold text-white",children:"Recordings and Screenshots"})]}),l.jsx("button",{onClick:()=>O(!1),className:"px-3 py-2 border text-[9px] font-bold rounded-xl uppercase transition-all bg-white/5 border-white/10 text-white hover:bg-white/10",children:"Close"})]}),l.jsxs("div",{className:"p-6 overflow-y-auto custom-scrollbar",children:[U&&l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"Loading captures..."}),!U&&I.length===0&&l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"No captures found."}),!U&&I.length>0&&l.jsx(xr,{height:Math.min(Math.max(tr,I.length*tr),tr*qb),width:"100%",itemCount:I.length,itemSize:tr,overscanCount:Kb,itemData:I,className:"custom-scrollbar",children:Ib})]})]})}),l.jsxs("div",{className:`glass-card flex flex-col relative ${g?"rounded-2xl p-4":"rounded-[32px] p-8"}`,children:[l.jsxs("div",{className:`flex items-center justify-between border-b border-white/5 ${g?"flex-wrap gap-2 pb-4 mb-4":"pb-4 mb-6"}`,children:[l.jsx("span",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-widest",children:m==="downloads"?"Downloads":"Data"}),l.jsxs("div",{className:"flex items-center gap-2",children:[ae?.downloads&&ae.downloads.length>0&&l.jsx("div",{role:"tablist",className:"flex bg-white/5 rounded-lg p-0.5 border border-white/10",children:["data","downloads"].map(X=>l.jsx("button",{role:"tab","aria-selected":m===X,onClick:()=>b(X),className:`px-3 py-1 rounded text-[8px] font-bold uppercase tracking-widest transition-all focus:outline-none focus-visible:ring-2 ${m===X?"bg-white text-black focus-visible:ring-blue-500":"text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:X},X))}),c&&l.jsx("div",{role:"tablist",className:"flex bg-white/5 rounded-lg p-0.5 border border-white/10",children:["latest","pinned"].map(X=>l.jsx("button",{role:"tab","aria-selected":j===X,onClick:()=>S(X),className:`px-3 py-1 rounded text-[8px] font-bold uppercase tracking-widest transition-all focus:outline-none focus-visible:ring-2 ${j===X?"bg-white text-black focus-visible:ring-blue-500":"text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:X},X))}),H&&m==="data"&&l.jsx("div",{role:"tablist",className:"flex bg-white/5 rounded-lg p-0.5 border border-white/10",children:["table","raw"].map(X=>l.jsx("button",{role:"tab","aria-selected":y===X,onClick:()=>_(X),className:`px-3 py-1 rounded text-[8px] font-bold uppercase tracking-widest transition-all focus:outline-none focus-visible:ring-2 ${y===X?"bg-white text-black focus-visible:ring-blue-500":"text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:X},X))}),j==="pinned"?l.jsx("button",{onClick:()=>{x?.(),S("latest")},className:"px-3 py-2 border text-[9px] font-bold rounded-xl uppercase transition-all flex items-center gap-2 bg-white/5 border-white/10 text-amber-200 hover:bg-white/10",title:"Unpin data",children:"Unpin"}):l.jsx("button",{onClick:()=>{if(!ae){h("No data to pin.","error");return}p?.(ae),S("pinned")},className:"px-3 py-2 border text-[9px] font-bold rounded-xl uppercase transition-all flex items-center gap-2 bg-white/5 border-white/10 text-white hover:bg-white/10",title:"Pin data",children:c?"Update Pin":"Pin"}),m==="data"&&l.jsx("button",{onClick:()=>{const X=Fb(ae?.data,H);if(!X){h("No data to export.","error");return}const ge=`doppelganger-data-${new Date().toISOString().replace(/[:.]/g,"-")}.${X.ext}`;Pb(ge,X.content,X.mime),h(`Exported ${X.ext.toUpperCase()}.`,"success")},className:"px-3 py-2 border text-[9px] font-bold rounded-xl uppercase transition-all flex items-center gap-2 bg-white/5 border-white/10 text-white hover:bg-white/10",title:"Export extracted data",children:"Export"}),m==="downloads"&&l.jsxs("button",{onClick:async()=>{if(!(!ae?.downloads||ae.downloads.length===0)){if(ae.downloads.length===1){const X=ae.downloads[0],ge=document.createElement("a");ge.href=X.path,ge.download=X.name,document.body.appendChild(ge),ge.click(),ge.remove(),h(`Downloading ${X.name}`,"success");return}h("Generating ZIP...","success");try{const X=new Bb;for(const W of ae.downloads){const Y=await(await fetch(W.path)).blob();X.file(W.name,Y)}const ge=await X.generateAsync({type:"blob"}),R=URL.createObjectURL(ge),D=document.createElement("a");D.href=R,D.download=`doppelganger-downloads-${new Date().toISOString().replace(/[:.]/g,"-")}.zip`,document.body.appendChild(D),D.click(),D.remove(),URL.revokeObjectURL(R)}catch(X){console.error("Failed to zip files:",X),h("Failed to zip files.","error")}}},className:"px-3 py-2 border text-[9px] font-bold rounded-xl uppercase transition-all flex items-center gap-2 bg-white/5 border-white/10 text-white hover:bg-white/10",title:ae?.downloads?.length===1?"Download File":"Download ZIP",children:[l.jsx(ue,{name:"folder_zip",className:"text-[14px]"}),ae?.downloads?.length===1?"Download":"Download ZIP"]}),m==="data"&&l.jsxs("button",{onClick:async()=>{const X=Vb(ae);if(X.reason){h(X.reason||"Data too large to copy safely.","error");return}const ge=xp(ae);let D=Zb(X.raw),W=!1;ge.truncated&&(await d({message:"Preview is truncated for performance.",confirmLabel:"Copy full",cancelLabel:"Copy preview"})||(D=ge.text||"",W=!0)),D.length>Gn&&(await d({message:`Copying ${mp(D.length)} may freeze your browser.`,confirmLabel:"Copy full",cancelLabel:W?"Copy preview":"Copy truncated"})||(D=Xb(X.raw).text,W=!0)),P(D,"data",{skipSizeConfirm:!0,truncatedNotice:W})},className:`px-3 py-2 border text-[9px] font-bold rounded-xl uppercase transition-all flex items-center gap-2 ${w==="data"?"bg-green-500/10 border-green-500/20 text-green-400":"bg-white/5 border-white/10 text-white hover:bg-white/10"}`,title:"Copy extracted data",children:[w==="data"?l.jsx(ue,{name:"check",className:"text-sm"}):l.jsx(ue,{name:"content_copy",className:"text-sm"}),w==="data"?"Copied":"Copy"]})]})]}),F?.truncated&&l.jsx("button",{type:"button",onClick:()=>h("Preview truncated for performance.","error"),className:"absolute top-5 right-5 h-2.5 w-2.5 rounded-full bg-amber-400 shadow-[0_0_8px_rgba(251,191,36,0.6)]",title:"Preview truncated","aria-label":"Preview truncated"}),l.jsx("div",{className:"max-h-[70vh] overflow-y-auto custom-scrollbar pr-2 relative",children:(()=>{const X=ae&&ae.data!==void 0&&ae.data!==null&&ae.data!=="",ge=ae&&ae.downloads&&ae.downloads.length>0;return r&&j==="latest"&&(!ae||!X&&!ge)?l.jsx("pre",{className:"font-mono text-[10px] text-blue-300/60 whitespace-pre-wrap leading-relaxed",children:"Buffering data stream..."}):!ae||!X&&!ge?null:l.jsx("div",{className:"h-full",children:m==="downloads"?l.jsx("div",{className:"space-y-2",children:ae.downloads.map((R,D)=>l.jsxs("div",{className:"flex items-center justify-between bg-white/[0.02] border border-white/5 rounded-xl p-4 hover:bg-white/[0.04] transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-4 overflow-hidden pr-4",children:[l.jsx("div",{className:"p-3 bg-white/5 rounded-lg border border-white/10 shrink-0",children:l.jsx(ue,{name:Hb(R.name),className:"text-2xl text-white/70"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h4",{className:"text-sm font-bold text-white truncate",children:R.name}),l.jsx("p",{className:"text-[10px] text-gray-500 truncate mt-1",children:R.url})]})]}),l.jsx("a",{href:R.path,download:R.name,className:"shrink-0 p-3 rounded-lg border border-white/10 bg-white/5 text-white/80 hover:bg-white/10 hover:text-white transition-all flex items-center justify-center",title:"Download file","aria-label":"Download file",children:l.jsx(ue,{name:"download",className:"text-[18px]"})})]},D))}):H&&y==="table"?l.jsx("div",{className:"overflow-auto custom-scrollbar rounded-2xl border border-white/10",children:l.jsxs("table",{className:"min-w-full table-auto text-[10px] text-left text-white/80 font-mono",children:[l.jsx("thead",{className:"bg-white/5 text-[9px] uppercase tracking-widest text-white/50",children:l.jsx("tr",{children:H.headers.map(R=>l.jsx("th",{className:"px-3 py-2 border-b border-white/10 whitespace-nowrap",children:R},R))})}),l.jsx("tbody",{children:H.rows.map((R,D)=>l.jsx("tr",{className:"odd:bg-white/[0.02]",children:H.headers.map((W,te)=>l.jsx("td",{className:"px-3 py-2 border-b border-white/5 align-top whitespace-normal break-words",children:se(R[te])},`${D}-${te}`))},D))})]})}):l.jsx(vn,{readOnly:!0,value:F?.text||"",language:F?.language||"plain"})})})()})]})]})},Jp=E.memo(Jb),Wb=({isOpen:i,onToggle:c,results:r,pinnedResults:u,isExecuting:f,isHeadfulOpen:d,runId:h,onConfirm:p,onNotify:x,onPinResults:g,onUnpinResults:C,useNovnc:w})=>l.jsxs("div",{className:`fixed top-0 right-0 h-full w-[420px] max-w-[90vw] bg-[#080808] border-l border-white/10 shadow-2xl transition-transform duration-500 ease-in-out z-40 transform ${i?"translate-x-0":"translate-x-full"}`,children:[l.jsx("button",{onClick:c,className:"absolute top-1/2 -left-8 -translate-y-1/2 w-8 h-24 bg-[#111] border border-r-0 border-white/10 rounded-l-xl flex items-center justify-center cursor-pointer shadow-[-8px_0_15px_rgba(0,0,0,0.5)] transition-all hover:bg-white/5 hover:w-10 hover:-left-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":i?"Close Results Drawer":"Open Results Drawer",title:i?"Close Results Drawer":"Open Results Drawer",children:l.jsx(ue,{name:"drag_indicator",className:`text-white/30 text-xl transition-transform duration-500 ${i?"rotate-180":""}`})}),l.jsx("div",{className:"h-full w-full overflow-y-auto custom-scrollbar p-4",children:l.jsx(Jp,{results:r,pinnedResults:u,isExecuting:f,isHeadful:d,runId:h,onConfirm:p,onNotify:x,onPin:g,onUnpin:C,fullWidth:!0,useNovnc:w})})]}),ey=({versionPreview:i,onClose:c,onRunSnapshot:r})=>i?l.jsx("div",{className:"fixed inset-0 z-[210] flex items-center justify-center bg-black/70 backdrop-blur-sm px-6",children:l.jsxs("div",{className:"glass-card w-full max-w-6xl rounded-[32px] border border-white/10 p-8 shadow-2xl flex flex-col max-h-[90vh]",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 pb-4 mb-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.3em]",children:"Task Snapshot"}),l.jsx("div",{className:"text-lg font-bold text-white",children:i.snapshot.name}),l.jsxs("div",{className:"text-[8px] text-gray-500 uppercase tracking-[0.2em]",children:[new Date(i.timestamp).toLocaleString()," | ",i.snapshot.mode]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:c,className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:"Close"}),l.jsx("button",{onClick:()=>{r(i.snapshot),c()},className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white text-black hover:bg-white/90 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:"Run Version"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6 overflow-y-auto custom-scrollbar pr-2 flex-1 min-h-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-widest",children:"Snapshot JSON"}),l.jsx(vn,{readOnly:!0,value:JSON.stringify(i.snapshot,null,2),language:"json",className:"min-h-[320px]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-widest",children:"Output"}),l.jsx("div",{className:"glass-card rounded-2xl p-6 border border-white/10 text-[10px] text-gray-500",children:"No output captured for this snapshot yet. Run this version to see results."})]})]})]})}):null,ty=({isHeadfulOpen:i,isInspectMode:c,isInspectLoading:r,isExecuting:u,useNovnc:f,onToggleInspect:d,onStopHeadful:h})=>{const p=E.useRef(null);if(!i)return null;const{origin:x,hostname:g}=window.location,C=`${x}/novnc.html?host=${g}&path=websockify`,w=()=>{const k=p.current;if(k){if(document.fullscreenElement){document.exitFullscreen().catch(()=>{});return}k.requestFullscreen?.().catch(()=>{})}};return l.jsx("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-md flex items-center justify-center p-8 pointer-events-auto",children:l.jsxs("div",{className:"w-full max-w-6xl bg-black/60 backdrop-blur-3xl border border-white/20 rounded-[32px] shadow-2xl overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between px-6 py-4 border-b border-white/10 bg-black/20 gap-4",children:[l.jsx("div",{className:"flex flex-col gap-1",children:l.jsx("div",{className:"flex items-center gap-3",children:l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-white",children:"Active Browser Session"})})}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("button",{type:"button",onClick:d,disabled:r||u,className:`px-3 py-1.5 rounded-xl border text-[9px] font-bold uppercase tracking-widest transition-all flex items-center gap-2 disabled:opacity-30 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${c?"border-green-500/30 bg-green-500/20 text-green-400 hover:bg-green-500/30":"border-white/10 text-white/60 hover:text-white hover:bg-white/10"}`,title:c?"Stop inspecting elements":"Highlight elements on hover","aria-label":c?"Stop inspecting elements":"Highlight elements on hover",children:[r?l.jsx("div",{className:"w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"}):l.jsx(ue,{name:c?"visibility_off":"center_focus_strong",className:"text-[14px]"}),c?"Stop Inspect":"Inspect UI"]}),l.jsx("button",{type:"button",onClick:w,className:"p-2 text-white/60 hover:text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded-lg",title:"Toggle fullscreen","aria-label":"Toggle fullscreen",children:l.jsx(ue,{name:"fullscreen",className:"text-[16px]"})}),l.jsx("button",{type:"button",onClick:h,className:"p-2 text-white/60 hover:text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded-lg",title:"Close Browser","aria-label":"Close Browser",children:l.jsx(ue,{name:"close",className:"text-[16px]"})})]})]}),l.jsx("div",{ref:p,className:"w-full aspect-video relative bg-black flex items-center justify-center",children:f===!1?l.jsxs("div",{className:"text-center p-8",children:[l.jsx(ue,{name:"open_in_new",className:"text-6xl text-white/20 mb-4 block"}),l.jsx("h3",{className:"text-white text-lg font-bold mb-2",children:"Browser Opened Natively"}),l.jsx("p",{className:"text-white/60 text-sm max-w-md mx-auto leading-relaxed mb-6",children:"The headful browser has been launched in a separate window on your desktop. Use that window to pick selectors. It will automatically sync back here."})]}):l.jsx("iframe",{src:C,className:"absolute inset-0 w-full h-full border-0",title:"Headful Browser"})})]})})},Lt=({value:i,onChange:c,onBlur:r,placeholder:u,variables:f,className:d,syntax:h="plain"})=>{const p=E.useRef(null);return E.useEffect(()=>{if(p.current){const x=p.current.innerHTML,g=$p(i,h,f);if(x!==g){const C=window.getSelection();let w=0;if(C&&C.rangeCount>0){const k=C.getRangeAt(0),y=k.cloneRange();y.selectNodeContents(p.current),y.setEnd(k.endContainer,k.endOffset),w=y.toString().length}if(p.current.innerHTML=g,w>0){const k=document.createTreeWalker(p.current,NodeFilter.SHOW_TEXT);let y=0,_=k.nextNode();for(;_;){const m=_.textContent?.length||0;if(y+m>=w){const b=document.createRange();b.setStart(_,w-y),b.collapse(!0),C?.removeAllRanges(),C?.addRange(b);break}y+=m,_=k.nextNode()}}}}},[i,f]),l.jsx("div",{ref:p,contentEditable:!0,role:"textbox","aria-multiline":"true","aria-label":u||"Text input",className:`rich-input-content w-full bg-transparent focus:outline-none text-white min-h-[1.5rem] ${d}`,"data-placeholder":u,onInput:x=>c(x.currentTarget.textContent||""),onBlur:x=>{const g=x.currentTarget.textContent||"";c(g),r?.(g)}})},ay=[{value:"Control",label:"Ctrl"},{value:"Shift",label:"Shift"},{value:"Alt",label:"Alt"},{value:"Meta",label:"Meta"}],ny=["Enter","Tab","Escape","Space","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","F1","F2","F3","F4","F5"].concat([...Array(10)].map((i,c)=>`${c}`)).concat(Array.from({length:26},(i,c)=>String.fromCharCode(65+c))),ly=[{value:"replace",label:"Replace Text"},{value:"append",label:"Append Text"}],iy=i=>{if(!i)return{modifiers:[],baseKey:""};const c=i.split("+"),r=c.pop()||"";return{modifiers:c,baseKey:r}},gp=(i,c)=>[...i.filter(Boolean),c].filter(Boolean).join("+"),sy=i=>{const c=(i||"").trim(),r=c.match(/^\{\$([\w.]+)\}$/);return r?r[1]:c},lr={string:[{value:"equals",label:"Equals"},{value:"not_equals",label:"Not equal"},{value:"contains",label:"Contains"},{value:"starts_with",label:"Starts with"},{value:"ends_with",label:"Ends with"},{value:"matches",label:"Matches regex"}],number:[{value:"equals",label:"Equals"},{value:"not_equals",label:"Not equal"},{value:"gt",label:"Greater than"},{value:"gte",label:"Greater or equal"},{value:"lt",label:"Less than"},{value:"lte",label:"Less or equal"}],boolean:[{value:"is_true",label:"Is true"},{value:"is_false",label:"Is false"}]},ry=["else","end","on_error"],oy=({action:i,variables:c,availableTasks:r,selectorOptions:u,onUpdate:f,onAutoSave:d,onClose:h,onStartInspect:p,onCreateVariable:x,onDeleteVariable:g})=>{const C=dr.find(I=>I.type===i.type)?.label||i.type,[w,k]=E.useState(!1),[y,_]=E.useState(""),[m,b]=E.useState(!1),[j,S]=E.useState(null),A=async()=>{if(y.trim()){b(!0),S(null);try{const I=await fetch("/api/tasks/generate-script",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:y.trim()})}),V=await I.json();if(!I.ok)throw new Error(V.details?`${V.error}: ${V.details}`:V.error||"Generation failed");f(i.id,{value:V.script}),k(!1),_("")}catch(I){S(I.message)}finally{b(!1)}}};E.useEffect(()=>{const I=V=>{V.key==="Escape"&&h()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[h]);const M=E.useRef(new Set);E.useEffect(()=>{const I=[i.selector,i.value,i.key,i.varName,i.conditionValue,i.headers,i.body],V=/\{\$([\w.]+)\}/g,de=new Set;for(const ae of I){if(!ae)continue;V.lastIndex=0;let H;for(;(H=V.exec(ae))!==null;){const F=H[1];F!=="now"&&F!=="block.output"&&de.add(F)}}for(const ae of de)ae in c||(x?.(ae),M.current.add(ae));for(const ae of M.current)!de.has(ae)&&c[ae]?.autoCreated&&(g?.(ae),M.current.delete(ae))},[i]);const O=(I,V)=>l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1 block",children:I}),V]}),U=I=>l.jsx("div",{className:"bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 text-[11px] focus-within:border-white/20 transition-all",children:I}),L=()=>{if(ry.includes(i.type))return l.jsx("p",{className:"text-[10px] text-gray-600 text-center py-4",children:"This block has no configurable options."});const{modifiers:I,baseKey:V}=iy(i.key),de=Object.keys(c||{}),ae=sy(i.conditionVar||""),H=ae&&c?.[ae]?.type,F=i.conditionVarType||H||"string",z=lr[F]||lr.string,se=i.conditionOp||z[0].value,$=i.method||"GET",P=["POST","PUT","PATCH","DELETE"];return l.jsxs("div",{className:"space-y-10",children:[(i.type==="click"||i.type==="type"||i.type==="hover"||i.type==="wait_selector"||i.type==="scroll")&&O(i.type==="scroll"?"Selector (Optional)":"Selector",l.jsxs("div",{className:"bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 text-[11px] focus-within:border-white/20 transition-all flex items-center gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[l.jsx(Lt,{value:i.selector||"",onChange:Z=>f(i.id,{selector:Z}),onBlur:()=>d(),variables:c,placeholder:i.type==="scroll"?".scroll-container or leave empty":".btn-primary"}),u&&u.length>1&&l.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:u.map((Z,X)=>l.jsx("button",{onClick:()=>f(i.id,{selector:Z},!0),className:`text-[9px] px-1.5 py-0.5 rounded border transition-colors ${i.selector===Z?"bg-blue-500/20 border-blue-500/50 text-blue-300":"bg-white/[0.02] border-white/10 text-white/40 hover:text-white/80 hover:bg-white/[0.05]"}`,children:Z},X))})]}),p&&l.jsx("button",{onClick:()=>{h(),p(i.id)},disabled:i.disabled,className:"text-white opacity-50 hover:opacity-100 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 shrink-0 disabled:opacity-20 disabled:cursor-not-allowed rounded",title:"Pick Selector in Browser","aria-label":"Pick Selector in Browser",children:l.jsx(ue,{name:"my_location",className:"text-lg"})})]})),i.type==="scroll"&&O("Scroll Speed (ms)",U(l.jsx(Lt,{value:i.key||"",onChange:Z=>f(i.id,{key:Z}),onBlur:()=>d(),variables:c,placeholder:"500"}))),(i.type==="navigate"||i.type==="type"||i.type==="wait"||i.type==="wait_selector"||i.type==="javascript"||i.type==="csv")&&(i.type==="javascript"?l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"Script"}),l.jsxs("button",{onClick:()=>{k(Z=>!Z),S(null)},className:"flex items-center gap-1 text-[8px] font-bold uppercase tracking-widest text-white/60 hover:text-white transition-colors",title:"Generate with AI",children:[l.jsx(ue,{name:"auto_awesome",className:"text-sm"}),"Generate"]})]}),w&&l.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-xl bg-white/5 border border-white/10",children:[l.jsx("input",{autoFocus:!0,type:"text",value:y,onChange:Z=>_(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&!m&&A()},placeholder:"e.g. extract all article titles and links",className:"bg-transparent text-[11px] text-white placeholder-gray-600 focus:outline-none"}),j&&l.jsx("p",{className:"text-[9px] text-red-400",children:j}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:()=>{k(!1),S(null)},className:"text-[8px] font-bold uppercase tracking-widest text-gray-500 hover:text-white transition-colors",children:"Cancel"}),l.jsxs("button",{onClick:A,disabled:m||!y.trim(),className:"px-3 py-1 rounded-lg bg-white text-black text-[8px] font-bold uppercase tracking-widest hover:bg-white/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1",children:[m&&l.jsx(ue,{name:"autorenew",className:"text-xs animate-spin"}),m?"Generating…":"Generate"]})]})]}),U(l.jsx(vn,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),language:"javascript",variables:c,className:"min-h-[120px]",placeholder:"return document.title"}))]}):O(i.type==="navigate"?"URL":i.type==="type"?"Content":i.type==="wait"?"Seconds":i.type==="wait_selector"?"Timeout (Sec)":"CSV Input",U(i.type==="csv"?l.jsx(vn,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),language:"plain",variables:c,className:"min-h-[120px]",placeholder:`name,age
16
+ Ada,31`}):l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:i.type==="navigate"?"https://example.com":i.type==="type"?"Search keywords":i.type==="wait"?"3":i.type==="wait_selector"?"10":"400"})))),i.type==="type"&&O("Mode",U(l.jsx("select",{value:i.typeMode||"replace",onChange:Z=>f(i.id,{typeMode:Z.target.value},!0),className:"custom-select w-full bg-transparent border-none px-0 py-0 text-[11px] text-white",children:ly.map(Z=>l.jsx("option",{value:Z.value,children:Z.label},Z.value))}))),i.type==="screenshot"&&O("Label (Optional)",U(l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:"checkout-step"}))),i.type==="press"&&l.jsxs("div",{className:"space-y-5",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"Key"}),l.jsx("div",{className:"grid grid-cols-2 gap-3 text-[10px] text-white",children:ay.map(Z=>l.jsxs("label",{className:"inline-flex items-center space-x-1",children:[l.jsx("input",{type:"checkbox",checked:I.includes(Z.value),onChange:X=>{const ge=X.target.checked?[...I,Z.value]:I.filter(R=>R!==Z.value);f(i.id,{key:gp(ge,V)},!0)},className:"h-3 w-3 rounded border border-white/30 bg-black/80"}),l.jsx("span",{className:"uppercase text-[9px] text-white/70",children:Z.label})]},Z.value))}),U(l.jsxs("select",{value:V,onChange:Z=>f(i.id,{key:gp(I,Z.target.value)},!0),className:"custom-select w-full bg-transparent border-none px-0 py-0 text-[11px] text-white",children:[l.jsx("option",{value:"",children:"Select key"}),ny.map(Z=>l.jsx("option",{value:Z,children:Z},Z))]}))]}),(i.type==="if"||i.type==="while")&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"Condition"}),l.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"text-[7px] font-bold text-gray-500 uppercase tracking-widest pl-1",children:"Variable"}),l.jsx("input",{type:"text",list:`cond-var-${i.id}`,value:i.conditionVar||"",onChange:Z=>f(i.id,{conditionVar:Z.target.value}),onBlur:()=>d(),placeholder:"variable name",className:"w-full bg-white/[0.05] border border-white/10 rounded-lg px-3 py-2 text-[10px] text-white focus:outline-none focus:border-white/30"}),de.length>0&&l.jsx("datalist",{id:`cond-var-${i.id}`,children:de.map(Z=>l.jsx("option",{value:Z},Z))})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"text-[7px] font-bold text-gray-500 uppercase tracking-widest pl-1",children:"Type"}),l.jsxs("select",{value:F,onChange:Z=>{const X=Z.target.value,ge=lr[X]||lr.string;f(i.id,{conditionVarType:X,conditionOp:ge[0].value,conditionValue:X==="boolean"?"":i.conditionValue||""},!0)},className:"custom-select w-full bg-white/[0.05] border border-white/10 rounded-xl px-3 py-2 text-[8px] font-bold uppercase text-white/60 focus:outline-none",children:[l.jsx("option",{value:"string",children:"String"}),l.jsx("option",{value:"number",children:"Number"}),l.jsx("option",{value:"boolean",children:"Boolean"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"text-[7px] font-bold text-gray-500 uppercase tracking-widest pl-1",children:"Relation"}),l.jsx("select",{value:se,onChange:Z=>f(i.id,{conditionOp:Z.target.value},!0),className:"custom-select w-full bg-white/[0.05] border border-white/10 rounded-xl px-3 py-2 text-[8px] font-bold uppercase text-white/60 focus:outline-none",children:z.map(Z=>l.jsx("option",{value:Z.value,children:Z.label},Z.value))})]})]}),F!=="boolean"&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"text-[7px] font-bold text-gray-500 uppercase tracking-widest pl-1",children:"Value"}),l.jsx("input",{type:F==="number"?"number":"text",value:i.conditionValue||"",onChange:Z=>f(i.id,{conditionValue:Z.target.value}),onBlur:()=>d(),placeholder:F==="number"?"0":"value",className:"w-full bg-white/[0.05] border border-white/10 rounded-lg px-3 py-2 text-[10px] text-white focus:outline-none focus:border-white/30"})]})]}),i.type==="repeat"&&O("Times",U(l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:"3"}))),i.type==="foreach"&&l.jsxs(l.Fragment,{children:[O("Selector (Optional)",U(l.jsx(Lt,{value:i.selector||"",onChange:Z=>f(i.id,{selector:Z}),onBlur:()=>d(),variables:c,placeholder:".list-item"}))),O("Variable (Array Name)",U(l.jsx(Lt,{value:i.varName||"",onChange:Z=>f(i.id,{varName:Z}),onBlur:()=>d(),variables:c,placeholder:"items"})))]}),i.type==="set"&&l.jsxs(l.Fragment,{children:[O("Variable Name",U(l.jsx(Lt,{value:i.varName||"",onChange:Z=>f(i.id,{varName:Z}),onBlur:()=>d(),variables:c,placeholder:"status"}))),O("Value",U(l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:"ready"})))]}),i.type==="merge"&&l.jsxs(l.Fragment,{children:[O("Sources",U(l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:"items, extraItems, {$block.output}"}))),O("Target Variable (Optional)",U(l.jsx(Lt,{value:i.varName||"",onChange:Z=>f(i.id,{varName:Z}),onBlur:()=>d(),variables:c,placeholder:"allItems"})))]}),i.type==="stop"&&O("Outcome",l.jsxs("select",{value:i.value||"success",onChange:Z=>f(i.id,{value:Z.target.value},!0),className:"custom-select w-full bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 text-[9px] font-bold uppercase tracking-[0.2em] text-white/70 focus:outline-none",children:[l.jsx("option",{value:"success",children:"Success"}),l.jsx("option",{value:"error",children:"Error"})]})),i.type==="start"&&O("Task",l.jsxs("select",{value:i.value||"",onChange:Z=>f(i.id,{value:Z.target.value},!0),className:"custom-select w-full bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 text-[9px] font-bold uppercase tracking-[0.2em] text-white/70 focus:outline-none",children:[l.jsx("option",{value:"",disabled:!0,children:"Select task"}),r.length===0&&l.jsx("option",{value:"",disabled:!0,children:"No other tasks"}),r.map(Z=>l.jsx("option",{value:Z.id,children:Z.name||Z.id},Z.id))]})),i.type==="wait_downloads"&&O("Max Wait (Sec, Optional)",U(l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:"30"}))),i.type==="http_request"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"Method"}),l.jsx("select",{value:$,onChange:Z=>f(i.id,{method:Z.target.value},!0),className:"custom-select w-full bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 text-[9px] font-bold uppercase tracking-[0.1em] text-white/70 focus:outline-none focus:border-white/20",children:["GET","POST","PUT","PATCH","DELETE"].map(Z=>l.jsx("option",{value:Z,children:Z},Z))})]}),l.jsxs("div",{className:"col-span-2 space-y-1.5",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"URL"}),U(l.jsx(Lt,{value:i.value||"",onChange:Z=>f(i.id,{value:Z}),onBlur:()=>d(),variables:c,placeholder:"https://api.example.com/data"}))]})]}),O("Headers (JSON, Optional)",U(l.jsx(vn,{value:i.headers||"",onChange:Z=>f(i.id,{headers:Z}),onBlur:()=>d(),language:"json",variables:c,className:"min-h-[56px]",placeholder:'{"Authorization": "Bearer {$token}"}'}))),P.includes($)&&O("Body",U(l.jsx(vn,{value:i.body||"",onChange:Z=>f(i.id,{body:Z}),onBlur:()=>d(),language:"json",variables:c,className:"min-h-[80px]",placeholder:'{"key": "value"}'}))),O("Store Response In Variable (Optional)",U(l.jsx(Lt,{value:i.varName||"",onChange:Z=>f(i.id,{varName:Z}),onBlur:()=>d(),variables:c,placeholder:"apiResponse"})))]}),i.type==="get_content"&&l.jsxs(l.Fragment,{children:[O("Selector (Optional)",U(l.jsx(Lt,{value:i.selector||"",onChange:Z=>f(i.id,{selector:Z}),onBlur:()=>d(),variables:c,placeholder:".article-body or leave empty for full page"}))),O("Store In Variable (Optional)",U(l.jsx(Lt,{value:i.varName||"",onChange:Z=>f(i.id,{varName:Z}),onBlur:()=>d(),variables:c,placeholder:"pageContent"})))]})]})};return Ei.createPortal(l.jsx("div",{className:"fixed inset-0 z-[190] flex items-center justify-center bg-black/70 backdrop-blur-sm px-6",onPointerDown:I=>I.stopPropagation(),onPointerUp:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),onMouseUp:I=>I.stopPropagation(),onClick:I=>I.stopPropagation(),children:l.jsxs("div",{className:"glass-card w-full max-w-lg rounded-[28px] border border-white/10 p-7 shadow-2xl animate-in fade-in zoom-in-95 duration-200 flex flex-col gap-10 max-h-[85vh]",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-[0.4em] text-gray-500",children:C}),l.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Configure this block."})]}),l.jsx("button",{onClick:h,className:"p-2 text-white/40 hover:text-white transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded-xl","aria-label":"Close",title:"Close",children:l.jsx(ue,{name:"close",className:"text-base"})})]}),l.jsx("div",{className:"overflow-y-auto custom-scrollbar pr-1",children:L()}),l.jsx("button",{onClick:h,className:"shrink-0 w-full py-3 rounded-2xl bg-white text-black text-[10px] font-bold uppercase tracking-[0.2em] hover:scale-[1.02] active:scale-[0.98] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:"Done"})]})}),document.body)},cy=i=>{let c="";if(i.type==="click"||i.type==="hover"||i.type==="scroll"||i.type==="wait_selector")c=i.selector||"";else if(i.type==="type"||i.type==="navigate"||i.type==="wait"||i.type==="javascript"||i.type==="repeat"||i.type==="start"||i.type==="screenshot"||i.type==="wait_downloads"||i.type==="stop")c=i.value||"";else if(i.type==="set"||i.type==="foreach"||i.type==="merge")c=i.varName||"";else if(i.type==="press")c=i.key||"";else if(i.type==="if"||i.type==="while")c=i.conditionVar||"";else if(i.type==="http_request"){const r=i.method||"GET";c=i.value?`[${r}] ${i.value}`:r}else i.type==="get_content"&&(c=i.varName?`→ ${i.varName}`:i.selector||"");return c.trim()},uy=i=>{const c="text-[12px]";return i==="if"||i==="else"?l.jsx(ue,{name:"call_split",className:`${c} text-white`}):i==="end"?l.jsx(ue,{name:"subdirectory_arrow_right",className:`${c} text-gray-500`}):i==="while"||i==="repeat"?l.jsx(ue,{name:"repeat",className:`${c} text-white`}):i==="foreach"?l.jsx(ue,{name:"list",className:`${c} text-white`}):i==="on_error"?l.jsx(ue,{name:"warning",className:`${c} text-red-400`}):i==="set"?l.jsx(ue,{name:"data_object",className:`${c} text-white`}):i==="stop"?l.jsx(ue,{name:"stop",className:`${c} text-white`}):i==="click"?l.jsx(ue,{name:"ads_click",className:`${c} text-white`}):i==="type"?l.jsx(ue,{name:"text_format",className:`${c} text-white`}):i==="hover"?l.jsx(ue,{name:"my_location",className:`${c} text-white`}):i==="press"?l.jsx(ue,{name:"keyboard",className:`${c} text-white`}):i==="wait"?l.jsx(ue,{name:"schedule",className:`${c} text-white`}):i==="wait_selector"?l.jsx(ue,{name:"schedule",className:`${c} text-white`}):i==="scroll"?l.jsx(ue,{name:"swap_vert",className:`${c} text-white`}):i==="javascript"?l.jsx(ue,{name:"code",className:`${c} text-white`}):i==="csv"?l.jsx(ue,{name:"table_chart",className:`${c} text-white`}):i==="merge"?l.jsx(ue,{name:"layers",className:`${c} text-white`}):i==="screenshot"?l.jsx(ue,{name:"photo_camera",className:`${c} text-white`}):i==="start"?l.jsx(ue,{name:"play_circle",className:`${c} text-white`}):i==="navigate"?l.jsx(ue,{name:"navigation",className:`${c} text-white`}):i==="http_request"?l.jsx(ue,{name:"language",className:`${c} text-white`}):i==="wait_downloads"?l.jsx(ue,{name:"download",className:`${c} text-white`}):i==="get_content"?l.jsx(ue,{name:"article",className:`${c} text-white`}):l.jsx("span",{className:"text-[9px] text-white/20",children:"|"})},dy=["else","end","on_error"],bp=tt.memo(({action:i,index:c,status:r,isDragging:u,isDragOver:f,translateY:d,variables:h,availableTasks:p,onUpdate:x,onAutoSave:g,onOpenPalette:C,onOpenContextMenu:w,onPointerDown:k,dragTransformY:y,onStartInspect:_,onCreateVariable:m,onDeleteVariable:b,isSelected:j,selectorOptions:S})=>{const[A,M]=E.useState(!1),O=E.useRef(null),U=E.useRef(null),L=r==="running"?"border-yellow-400/60":r==="success"?"border-green-400/60":r==="error"?"border-red-400/70":r==="skipped"?"border-gray-500/40":"",I=F=>!F||!(F instanceof HTMLElement)?!1:!!F.closest('input, textarea, select, button, a, [contenteditable="true"], [data-no-drag="true"], [role="button"]'),V=u?`translateY(${y||0}px)`:d?`translateY(${d}px)`:void 0,de=cy(i),ae=!dy.includes(i.type);E.useEffect(()=>()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]);const H=()=>{if(U.current){clearTimeout(U.current),U.current=null,ae&&M(!0);return}U.current=setTimeout(()=>{U.current=null,C(i.id)},180)};return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`action-${i.id}`,"data-action-id":i.id,onPointerDown:F=>{I(F.target)||F.button===0&&(O.current={x:F.clientX,y:F.clientY},F.stopPropagation(),k(F,i.id,c))},onDoubleClick:F=>{ae&&(I(F.target)||(F.stopPropagation(),M(!0)))},onContextMenu:F=>w(F,i.id),className:`bg-black min-w-[280px] w-full max-w-sm mx-auto border p-5 rounded-2xl group/item relative transition-[transform,box-shadow,opacity,filter,background-color,border-color] duration-150 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform select-none touch-none ${L||(j?"border-blue-500 ring-2 ring-blue-500/50":"border-white/20")} ${u?"ring-2 ring-white/40 scale-[1.02] shadow-[0_30px_80px_rgba(0,0,0,0.45)] opacity-85 z-20 mx-auto":""} ${f&&!u?"ring-2 ring-blue-400/60 bg-blue-500/5":""} ${i.disabled?"opacity-40 grayscale":""}`,style:{transform:V},children:l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx("div",{className:"text-[8px] font-bold text-white/20 font-mono tracking-tighter shrink-0",children:(c+1).toString().padStart(2,"0")}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:uy(i.type)}),l.jsx("button",{onClick:F=>{F.stopPropagation(),H()},onDoubleClick:F=>{ae&&(I(F.target)||(F.preventDefault(),F.stopPropagation(),M(!0)))},className:"action-type-select text-[10px] font-bold uppercase tracking-[0.2em] text-white focus:outline-none cursor-pointer rounded focus-visible:ring-2 focus-visible:ring-white/50 shrink-0","aria-label":`Change action type: ${i.type}`,children:dr.find(F=>F.type===i.type)?.label||i.type}),de&&l.jsx("span",{className:"text-white/40 text-[9px] font-mono truncate min-w-0 pointer-events-none",children:de}),ae&&l.jsx("button",{"data-no-drag":"true",onClick:F=>{F.stopPropagation(),M(!0)},className:"ml-auto shrink-0 text-white/20 hover:text-white/70 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded","aria-label":"Configure block",title:"Configure block",children:l.jsx(ue,{name:"tune",className:"text-sm"})})]})}),A&&l.jsx(oy,{action:i,variables:h,availableTasks:p,selectorOptions:S,onUpdate:x,onAutoSave:g,onClose:()=>M(!1),onStartInspect:_,onCreateVariable:m,onDeleteVariable:b})]})}),yp={default:{bg:"rgba(255,255,255,0.07)",border:"rgba(255,255,255,0.18)",header:"rgba(255,255,255,0.10)"},yellow:{bg:"rgba(250,204,21,0.14)",border:"rgba(250,204,21,0.40)",header:"rgba(250,204,21,0.20)"},pink:{bg:"rgba(236,72,153,0.14)",border:"rgba(236,72,153,0.40)",header:"rgba(236,72,153,0.20)"},green:{bg:"rgba(34,197,94,0.14)",border:"rgba(34,197,94,0.40)",header:"rgba(34,197,94,0.20)"},purple:{bg:"rgba(168,85,247,0.14)",border:"rgba(168,85,247,0.40)",header:"rgba(168,85,247,0.20)"}},vp={default:"#ffffff",yellow:"#facc15",pink:"#ec4899",green:"#22c55e",purple:"#a855f7"},fy=["default","yellow","pink","green","purple"],hy=({note:i,canvasScale:c,isSelected:r,onUpdate:u,onDelete:f,onDuplicate:d})=>{const[h,p]=E.useState(i.content===""),[x,g]=E.useState(i.content),[C,w]=E.useState(null),k=E.useRef(null),y=E.useRef(null),_=E.useRef(null),m=yp[i.color]||yp.default;E.useEffect(()=>{h&&k.current&&(k.current.focus(),k.current.select())},[h]);const b=E.useCallback(L=>{L.stopPropagation(),L.preventDefault(),y.current={startX:L.clientX,startY:L.clientY,origX:i.x,origY:i.y},L.target.setPointerCapture(L.pointerId)},[i.x,i.y]),j=E.useCallback(L=>{if(L.stopPropagation(),!y.current)return;const I=(L.clientX-y.current.startX)/c,V=(L.clientY-y.current.startY)/c;u(i.id,{x:Math.round(y.current.origX+I),y:Math.round(y.current.origY+V)})},[c,i.id,u]),S=E.useCallback(L=>{L.stopPropagation(),y.current=null},[]),A=E.useCallback(L=>{L.stopPropagation(),L.preventDefault(),_.current={startX:L.clientX,startY:L.clientY,origW:i.width,origH:i.height},L.target.setPointerCapture(L.pointerId)},[i.width,i.height]),M=E.useCallback(L=>{if(L.stopPropagation(),!_.current)return;const I=(L.clientX-_.current.startX)/c,V=(L.clientY-_.current.startY)/c;u(i.id,{width:Math.round(Math.max(160,_.current.origW+I)),height:Math.round(Math.max(100,_.current.origH+V))})},[c,i.id,u]),O=E.useCallback(L=>{L.stopPropagation(),_.current=null},[]),U=E.useCallback(()=>{u(i.id,{content:x}),p(!1)},[i.id,x,u]);return l.jsxs(l.Fragment,{children:[l.jsx("div",{"data-sticky-note-id":i.id,className:"absolute select-none group",style:{left:i.x,top:i.y,width:i.width,height:i.height,zIndex:5},onPointerDown:L=>L.stopPropagation(),onContextMenu:L=>{L.preventDefault(),L.stopPropagation();const I=8,V=200,de=164,ae=Math.min(Math.max(L.clientX+12,I),window.innerWidth-V-I),H=Math.min(Math.max(L.clientY+12,I),window.innerHeight-de-I);w({x:ae,y:H})},children:l.jsxs("div",{className:"w-full h-full rounded-xl flex flex-col overflow-hidden",style:{background:m.bg,border:`1px solid ${r?"rgba(96,165,250,0.8)":m.border}`,boxShadow:r?"0 0 0 2px rgba(59,130,246,0.4), 0 4px 24px rgba(0,0,0,0.4)":"0 4px 24px rgba(0,0,0,0.4)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-2.5 py-1.5 cursor-grab active:cursor-grabbing shrink-0",style:{background:m.header},onPointerDown:b,onPointerMove:j,onPointerUp:S,onPointerCancel:S,children:[l.jsx("div",{className:"flex items-center gap-1",style:{opacity:h?1:0,pointerEvents:h?"auto":"none",transition:"opacity 0.15s"},children:fy.map(L=>l.jsx("button",{className:"w-3 h-3 rounded-full transition-all hover:scale-125 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",style:{background:vp[L],opacity:i.color===L?1:.35,outline:i.color===L?`1.5px solid ${vp[L]}`:"none",outlineOffset:"1px"},onMouseDown:I=>{I.preventDefault(),I.stopPropagation()},onPointerDown:I=>I.stopPropagation(),onClick:I=>{I.stopPropagation(),u(i.id,{color:L})},title:`Set color to ${L}`,"aria-label":`Set color to ${L}`},L))}),l.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-200",children:[l.jsx("button",{className:"w-6 h-6 rounded flex items-center justify-center text-white/50 hover:text-white hover:bg-white/10 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",onPointerDown:L=>L.stopPropagation(),onClick:L=>{L.stopPropagation(),p(!0),g(i.content)},title:"Edit note","aria-label":"Edit note",children:l.jsx(ue,{name:"edit",className:"text-[14px]"})}),l.jsx(Vn,{text:i.content,title:"Copy note",className:"w-6 h-6 rounded flex items-center justify-center text-white/50 hover:text-white hover:bg-white/10 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",iconClassName:"text-[14px]"}),l.jsx("button",{className:"w-6 h-6 rounded flex items-center justify-center text-white/50 hover:text-red-400 hover:bg-white/10 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",onPointerDown:L=>L.stopPropagation(),onClick:L=>{L.stopPropagation(),f(i.id)},title:"Delete note","aria-label":"Delete note",children:l.jsx(ue,{name:"close",className:"text-[14px]"})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto min-h-0 custom-scrollbar",onDoubleClick:()=>{h||(p(!0),g(i.content))},children:h?l.jsx("textarea",{ref:k,value:x,onChange:L=>g(L.target.value),onBlur:U,onKeyDown:L=>{L.key==="Escape"&&U(),(L.ctrlKey||L.metaKey)&&L.key==="Enter"&&U(),L.stopPropagation()},className:"w-full h-full resize-none bg-transparent px-3 py-2 text-xs text-white/80 placeholder-white/20 focus:outline-none font-mono leading-relaxed",placeholder:"Write markdown here...",style:{minHeight:0},onClick:L=>L.stopPropagation()}):l.jsx("div",{className:"px-3 py-2 text-xs text-white/75 leading-relaxed overflow-auto h-full cursor-text custom-scrollbar font-mono whitespace-pre-wrap",children:i.content||l.jsx("span",{className:"text-white/20 italic",children:"Double-click to edit..."})})}),l.jsx("div",{className:"absolute bottom-0 right-0 w-5 h-5 cursor-se-resize flex items-end justify-end pb-1 pr-1",onPointerDown:A,onPointerMove:M,onPointerUp:O,onPointerCancel:O,children:l.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:l.jsx("path",{d:"M7 1L1 7M7 4L4 7",stroke:"rgba(255,255,255,0.25)",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}),C&&Ei.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(null),onContextMenu:L=>{L.preventDefault(),w(null)}}),l.jsxs("div",{className:"fixed z-50 w-[200px] bg-[#0b0b0b] border border-white/10 rounded-xl shadow-2xl p-2 text-[10px] font-bold uppercase tracking-widest text-white/80",style:{left:C.x,top:C.y},children:[l.jsxs("button",{className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",onClick:()=>{d(i),w(null)},children:[l.jsx("span",{className:"material-symbols-outlined text-white/40",style:{fontSize:"14px"},children:"copy_all"}),"Duplicate"]}),l.jsxs("button",{className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",onClick:()=>{navigator.clipboard.writeText(i.content).catch(()=>{}),w(null)},children:[l.jsx("span",{className:"material-symbols-outlined text-white/40",style:{fontSize:"14px"},children:"content_copy"}),"Copy"]}),l.jsxs("button",{className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",onClick:()=>{navigator.clipboard.writeText(i.content).catch(()=>{}),f(i.id),w(null)},children:[l.jsx("span",{className:"material-symbols-outlined text-white/40",style:{fontSize:"14px"},children:"content_cut"}),"Cut"]}),l.jsxs("button",{className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors text-red-400 flex items-center gap-2.5",onClick:()=>{f(i.id),w(null)},children:[l.jsx("span",{className:"material-symbols-outlined text-red-400/70",style:{fontSize:"14px"},children:"delete"}),"Delete"]})]})]}),document.body)]})},wp=({task:i,onUpdate:c,onAutoSave:r,onDelete:u})=>{const[f,d]=E.useState(!1),[h,p]=E.useState(!1),[x,g]=E.useState(""),[C,w]=E.useState(null),[k,y]=E.useState(!1),[_,m]=E.useState(null),b=(i.extractionScript||"").split(`
17
+ `).find(M=>M.trim())||"",j=async()=>{if(x.trim()){y(!0),m(null);try{const M=await fetch("/api/tasks/generate-script",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:x.trim()})}),O=await M.json();if(!M.ok)throw new Error(O.details?`${O.error}: ${O.details}`:O.error||"Generation failed");c({extractionScript:O.script}),p(!1),g("")}catch(M){m(M.message)}finally{y(!1)}}},S=f?Ei.createPortal(l.jsx("div",{className:"fixed inset-0 z-[190] flex items-center justify-center bg-black/70 backdrop-blur-sm px-6",onClick:()=>{d(!1),p(!1),m(null)},children:l.jsxs("div",{className:"glass-card w-full max-w-lg rounded-[28px] border border-white/10 p-7 shadow-2xl animate-in fade-in zoom-in-95 duration-200 flex flex-col gap-8 max-h-[85vh]",onClick:M=>M.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-[0.4em] text-gray-500",children:"Extraction Script"}),l.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Runs after page actions. Return data to capture it."})]}),l.jsx("button",{onClick:()=>{d(!1),p(!1),m(null)},className:"p-2 rounded-xl text-white/40 hover:text-white transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:l.jsx(ue,{name:"close",className:"text-base"})})]}),l.jsxs("div",{className:"overflow-y-auto custom-scrollbar pr-1 flex flex-col gap-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"Script"}),l.jsxs("button",{onClick:()=>{p(M=>!M),m(null)},className:"flex items-center gap-1 text-[8px] font-bold uppercase tracking-widest text-white/60 hover:text-white transition-colors",title:"Generate with AI",children:[l.jsx(ue,{name:"auto_awesome",className:"text-sm"}),"Generate"]})]}),h&&l.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-xl bg-white/5 border border-white/10",children:[l.jsx("input",{autoFocus:!0,type:"text",value:x,onChange:M=>g(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!k&&j()},placeholder:"e.g. extract all article titles and links",className:"bg-transparent text-[11px] text-white placeholder-gray-600 focus:outline-none"}),_&&l.jsx("p",{className:"text-[9px] text-red-400",children:_}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:()=>{p(!1),m(null)},className:"text-[8px] font-bold uppercase tracking-widest text-gray-500 hover:text-white transition-colors",children:"Cancel"}),l.jsxs("button",{onClick:j,disabled:k||!x.trim(),className:"px-3 py-1 rounded-lg bg-white text-black text-[8px] font-bold uppercase tracking-widest hover:bg-white/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1",children:[k&&l.jsx(ue,{name:"autorenew",className:"text-xs animate-spin"}),k?"Generating…":"Generate"]})]})]}),l.jsx("div",{className:"bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 focus-within:border-white/20 transition-all",children:l.jsx(vn,{value:i.extractionScript||"",onChange:M=>c({extractionScript:M}),onBlur:r,language:"javascript",className:"min-h-[180px]",placeholder:"// Example: return { title: document.title };"})})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"text-[7px] font-bold text-gray-600 uppercase tracking-widest pl-1",children:"Output Format"}),l.jsx("div",{className:"bg-white/[0.03] border border-white/5 rounded-xl px-3 py-2.5 focus-within:border-white/20 transition-all",children:l.jsxs("select",{value:i.extractionFormat||"json",onChange:M=>{c({extractionFormat:M.target.value})},className:"custom-select w-full bg-transparent border-none px-0 py-0 text-[11px] text-white",children:[l.jsx("option",{value:"json",children:"JSON"}),l.jsx("option",{value:"csv",children:"CSV"})]})})]})]}),l.jsx("button",{onClick:()=>{d(!1),p(!1),m(null),r()},className:"shrink-0 w-full py-3 rounded-2xl bg-white text-black text-[10px] font-bold uppercase tracking-[0.2em] hover:scale-[1.02] active:scale-[0.98] transition-all focus:outline-none",children:"Done"})]})}),document.body):null,A=C?Ei.createPortal(l.jsx("div",{className:"fixed inset-0 z-[200]",onClick:()=>w(null),onContextMenu:M=>{M.preventDefault(),w(null)},children:l.jsx("div",{className:"absolute bg-[#1a1a1a] border border-white/10 rounded-xl shadow-2xl py-1 min-w-[140px]",style:{top:C.y,left:C.x},onClick:M=>M.stopPropagation(),children:l.jsxs("button",{onClick:()=>{w(null),u()},className:"w-full flex items-center gap-2 px-3 py-2 text-[10px] text-red-400 hover:bg-white/5 transition-colors",children:[l.jsx(ue,{name:"delete",className:"text-sm"}),"Remove extraction script"]})})}),document.body):null;return l.jsxs(l.Fragment,{children:[l.jsx("div",{onClick:()=>d(!0),onContextMenu:M=>{M.preventDefault(),w({x:M.clientX,y:M.clientY})},"data-interactive-target":"true",className:"bg-black min-w-[280px] w-full max-w-sm mx-auto border border-white/20 p-5 rounded-2xl group/item relative transition-all duration-150 select-none touch-none cursor-pointer hover:border-white/40 hover:bg-white/[0.02]",children:l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:l.jsx(ue,{name:"data_object",className:"text-[12px] text-white"})}),l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-white shrink-0",children:"Extraction Script"}),b&&l.jsx("span",{className:"text-white/40 text-[9px] font-mono truncate min-w-0 pointer-events-none",children:b.trim()})]})}),S,A]})},py=({currentTask:i,setCurrentTask:c,canvasOffset:r,canvasScale:u,canvasViewportRef:f,triggerExpanded:d,setTriggerExpanded:h,onOpenCabinet:p,handleAutoSave:x,dragState:g,dragOverIndex:C,selectedActionIds:w,actionStatusById:k,availableTasks:y,selectorOptionsById:_,updateAction:m,openActionPalette:b,openContextMenu:j,handleActionPointerDown:S,onOpenHeadful:A,isHeadfulOpen:M,onPointerDown:O,onPointerMove:U,onPointerUp:L,onPointerCancel:I,selectionBox:V,onAddStickyNote:de,onUpdateStickyNote:ae,onDeleteStickyNote:H,onDuplicateStickyNote:F,selectedNoteIds:z})=>{const se=E.useCallback(D=>{M||A?.(i.url||"https://www.google.com",D,i,i.variables)},[M,A,i.url,i.variables]),$=E.useCallback(D=>{const W={...i.variables};if(D in W)return;W[D]={type:"string",value:"",autoCreated:!0};const te={...i,variables:W};c(te),x(te)},[i,c,x]),P=E.useCallback(D=>{const W={...i.variables};if(!(D in W)||!W[D].autoCreated)return;delete W[D];const te={...i,variables:W};c(te),x(te)},[i,c,x]),[Z,X]=E.useState(null),ge=E.useCallback(D=>{const W=D.target;if(W.closest("[data-action-id]")||W.closest("[data-sticky-note-id]")||W.closest('[data-interactive-target="true"]'))return;D.preventDefault();const te=D.currentTarget.getBoundingClientRect(),Y=Math.round((D.clientX-te.left-r.x)/u),he=Math.round((D.clientY-te.top-r.y)/u),ke=8,Ae=180,Oe=48,Ke=Math.min(Math.max(D.clientX+12,ke),window.innerWidth-Ae-ke),Ie=Math.min(Math.max(D.clientY+12,ke),window.innerHeight-Oe-ke);X({x:Ke,y:Ie,worldX:Y,worldY:he})},[r,u]),R=(D,W,te=0)=>{const Y=[];let he=D;for(;he<W;){const ke=he,Ae=i.actions[ke];if(!Ae){he++;continue}if(Ae.type==="if"||Ae.type==="while"){const Oe=he;let Ke=1,Ie=he+1,nt=-1;for(;Ie<W&&Ke>0;){const B=i.actions[Ie];if((B.type==="if"||B.type==="while")&&Ke++,B.type==="end"&&(Ke--,Ke===0))break;B.type==="else"&&Ke===1&&Ae.type==="if"&&(nt=Ie),Ie++}const We=Ie,N=Oe+1,me=nt!==-1?nt:We,ne=nt!==-1?nt+1:-1,q=nt!==-1?We:-1;Y.push(l.jsxs("div",{className:"flex flex-col items-center w-full",children:[l.jsx("div",{className:"w-[360px]",children:l.jsx(bp,{action:Ae,index:ke,isDragOver:C===ke&&g?.id!==Ae.id,isDragging:g?.id===Ae.id,dragTransformY:g?.id===Ae.id?g.currentY-g.startY:void 0,isSelected:w.has(Ae.id),status:k[Ae.id],translateY:0,variables:i.variables,availableTasks:y,selectorOptions:_[Ae.id],onUpdate:m,onAutoSave:x,onOpenPalette:b,onOpenContextMenu:j,onPointerDown:S,onStartInspect:se,onCreateVariable:$,onDeleteVariable:P})}),l.jsxs("div",{className:"flex gap-16 mt-4 relative",children:[l.jsxs("div",{className:"flex flex-col items-center min-w-[200px]",children:[l.jsx("div",{className:"text-[8px] font-bold text-white/60 uppercase tracking-widest mb-2",children:Ae.type==="while"?"Loop":"True"}),l.jsx("div",{className:"w-px h-6 bg-white/25"}),l.jsx("div",{className:"flex flex-col items-center gap-3",children:R(N,me,te+1)}),l.jsxs("div",{className:"mt-2 flex flex-col items-center",children:[l.jsx("div",{className:"w-px h-4 bg-white/20"}),l.jsx("button",{onClick:()=>b(void 0,me),className:"w-12 h-12 border border-dashed border-white/15 rounded-xl hover:border-white/30 hover:bg-white/5 transition-all flex items-center justify-center group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Add action (Ctrl + K)",title:"Add action (Ctrl + K)",children:l.jsx(ue,{name:"add",className:"text-lg text-gray-500 group-hover:text-white transition-colors"})})]})]}),Ae.type==="if"&&l.jsxs("div",{className:"flex flex-col items-center min-w-[200px]",children:[l.jsx("div",{className:"text-[8px] font-bold text-white/60 uppercase tracking-widest mb-2",children:"Otherwise"}),l.jsx("div",{className:"w-px h-6 bg-white/25"}),l.jsx("div",{className:"flex flex-col items-center gap-3",children:ne!==-1?R(ne,q,te+1):null}),l.jsxs("div",{className:"mt-2 flex flex-col items-center",children:[l.jsx("div",{className:"w-px h-4 bg-white/20"}),l.jsx("button",{onClick:()=>{if(ne!==-1)b(void 0,q);else{const B={id:"act_"+Date.now()+"_else",type:"else",selector:"",value:""},J=[...i.actions];J.splice(We,0,B),c({...i,actions:J}),x({...i,actions:J}),setTimeout(()=>b(void 0,We+1),50)}},className:"w-12 h-12 border border-dashed border-white/15 rounded-xl hover:border-white/30 hover:bg-white/5 transition-all flex items-center justify-center group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Add action (Ctrl + K)",title:"Add action (Ctrl + K)",children:l.jsx(ue,{name:"add",className:"text-lg text-gray-500 group-hover:text-white transition-colors"})})]})]})]}),l.jsxs("div",{className:"flex flex-col items-center mt-3",children:[l.jsx("div",{className:"w-px h-2 bg-white/25"}),l.jsx("button",{onClick:()=>b(void 0,We+1),className:"w-8 h-8 border border-dashed border-white/10 rounded-lg hover:border-white/30 hover:bg-white/5 transition-all flex items-center justify-center group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Add action (Ctrl + K)",title:"Add action (Ctrl + K)",children:l.jsx(ue,{name:"add",className:"text-sm text-gray-600 group-hover:text-white transition-colors"})}),l.jsx("div",{className:"w-px h-2 bg-white/25"})]})]},Ae.id)),he=We+1}else Ae.type==="end"||Ae.type==="else"||Y.push(l.jsxs("div",{className:"flex flex-col items-center",children:[l.jsx("div",{className:"w-[360px]",children:l.jsx(bp,{action:Ae,index:ke,isDragOver:C===ke&&g?.id!==Ae.id,isDragging:g?.id===Ae.id,dragTransformY:g?.id===Ae.id?g.currentY-g.startY:void 0,isSelected:w.has(Ae.id),status:k[Ae.id],translateY:0,variables:i.variables,availableTasks:y,selectorOptions:_[Ae.id],onUpdate:m,onAutoSave:x,onOpenPalette:b,onOpenContextMenu:j,onPointerDown:S,onStartInspect:se,onCreateVariable:$,onDeleteVariable:P})}),he<W-1&&i.actions[he+1]?.type!=="end"&&l.jsxs("div",{className:"flex flex-col items-center my-1",children:[l.jsx("div",{className:"w-px h-2 bg-white/25"}),l.jsx("button",{onClick:()=>b(void 0,ke+1),className:"w-8 h-8 border border-dashed border-white/10 rounded-lg hover:border-white/30 hover:bg-white/5 transition-all flex items-center justify-center group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Add action (Ctrl + K)",title:"Add action (Ctrl + K)",children:l.jsx(ue,{name:"add",className:"text-sm text-gray-600 group-hover:text-white transition-colors"})}),l.jsx("div",{className:"w-px h-2 bg-white/25"})]})]},Ae.id)),he++}return Y};return l.jsxs("div",{ref:f,className:"flex-1 overflow-hidden relative cursor-grab active:cursor-grabbing select-none",style:{touchAction:"none"},onPointerDown:O,onPointerMove:U,onPointerUp:L,onPointerCancel:I,onContextMenu:ge,children:[l.jsx("div",{className:"absolute inset-0 pointer-events-none z-0",style:{backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.12) 0.8px, transparent 0)",backgroundSize:`${22*u}px ${22*u}px`,backgroundPosition:`${r.x}px ${r.y}px`}}),l.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${r.x}px, ${r.y}px) scale(${u})`},children:[(i.stickyNotes||[]).map(D=>l.jsx(hy,{note:D,canvasScale:u,isSelected:z.has(D.id),onUpdate:ae,onDelete:H,onDuplicate:F},D.id)),l.jsxs("div",{className:"relative z-10 flex flex-col items-center pointer-events-none",style:{paddingTop:"60px",minWidth:"500px"},children:[l.jsxs("div",{className:"w-[360px] bg-black border border-white/15 p-5 rounded-2xl shadow-2xl shadow-black/50 select-text cursor-auto relative z-10 pointer-events-auto",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("button",{type:"button","aria-expanded":d,"aria-label":d?"Collapse trigger settings":"Expand trigger settings",title:d?"Collapse":"Expand",onClick:()=>h(!d),className:"flex items-center gap-3 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 rounded-lg pr-2 transition-all",children:[l.jsx(ue,{name:"bolt",className:"text-white/40 text-base"}),l.jsx("h3",{className:"text-white/60 font-bold tracking-widest uppercase text-[10px]",children:"On Execution"}),l.jsx(ue,{name:d?"expand_less":"expand_more",className:"text-xs text-gray-600"})]}),l.jsx("button",{onClick:()=>p("mode"),className:"p-2 rounded-lg hover:bg-white/10 text-white/30 hover:text-white transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Task Settings","aria-label":"Task Settings",children:l.jsx(ue,{name:"settings",className:"text-lg"})})]}),i.description&&l.jsx("p",{className:"text-[10px] text-gray-500 mt-2 leading-relaxed",children:i.description}),d&&l.jsxs("div",{className:"space-y-4 mt-4 pt-3 border-t border-white/10",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"URL"}),l.jsx("div",{className:"w-full bg-[#111] border border-white/10 rounded-lg px-3 py-2 text-sm focus-within:border-white/30 transition-all",children:l.jsx(Lt,{value:i.url,onChange:D=>c({...i,url:D}),onBlur:()=>x(),variables:i.variables,placeholder:"https://..."})})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Wait (sec)"}),l.jsx("input",{type:"number",value:i.wait,onChange:D=>c({...i,wait:parseFloat(D.target.value)||0}),onBlur:()=>x(),className:"w-full bg-[#111] border border-white/10 rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-white/30 transition-all text-white"})]})]})]}),(i.mode==="agent"||i.mode==="scrape")&&l.jsx("div",{className:"w-px h-10 bg-white/25"}),i.mode==="scrape"&&l.jsx("div",{className:"w-[360px] pointer-events-auto",children:i.extractionScript!==void 0?l.jsx(wp,{task:i,onUpdate:D=>{const W={...i,...D};c(W),x(W)},onAutoSave:()=>x(),onDelete:()=>{const D={...i,extractionScript:void 0,extractionFormat:void 0};c(D),x(D)}}):l.jsxs("button",{onClick:()=>{const D={...i,extractionScript:""};c(D),x(D)},"data-interactive-target":"true",className:"w-full border border-dashed border-white/15 rounded-2xl p-5 hover:border-white/30 hover:bg-white/[0.03] transition-all flex items-center justify-center gap-2 group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsx(ue,{name:"add",className:"text-lg text-gray-500 group-hover:text-white transition-colors"}),l.jsx("span",{className:"text-[9px] font-bold uppercase tracking-[0.2em] text-gray-500 group-hover:text-gray-300 transition-colors",children:"Add Extraction Script"})]})}),i.mode==="agent"&&l.jsx("div",{className:"flex flex-col items-center w-full select-text cursor-auto pointer-events-auto",children:l.jsxs("div",{className:"space-y-6 w-full flex flex-col items-center relative",children:[R(0,i.actions.length),l.jsxs("div",{className:"pt-2 flex flex-col items-center",children:[l.jsx("div",{className:"w-px h-6 bg-white/10"}),l.jsxs("button",{onClick:()=>b(),className:"w-[360px] bg-[#0a0a0a] border border-dashed border-white/15 rounded-2xl p-6 hover:border-white/30 hover:bg-white/[0.03] transition-all flex flex-col items-center justify-center gap-2 group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Add action (Ctrl + K)",title:"Add action (Ctrl + K)",children:[l.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/5 group-hover:bg-white/10 transition-all flex items-center justify-center",children:l.jsx(ue,{name:"add",className:"text-2xl text-gray-500 group-hover:text-white transition-colors"})}),l.jsx("span",{className:"text-[9px] font-bold uppercase tracking-[0.2em] text-gray-500 group-hover:text-gray-300 transition-colors",children:"Add Action"})]})]}),l.jsx("div",{className:"w-px h-6 bg-white/25"}),l.jsx("div",{className:"w-[360px]",children:i.extractionScript!==void 0?l.jsx(wp,{task:i,onUpdate:D=>{const W={...i,...D};c(W),x(W)},onAutoSave:()=>x(),onDelete:()=>{const D={...i,extractionScript:void 0,extractionFormat:void 0};c(D),x(D)}}):l.jsxs("button",{onClick:()=>{const D={...i,extractionScript:""};c(D),x(D)},"data-interactive-target":"true",className:"w-full border border-dashed border-white/15 rounded-2xl p-5 hover:border-white/30 hover:bg-white/[0.03] transition-all flex items-center justify-center gap-2 group cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsx(ue,{name:"add",className:"text-lg text-gray-500 group-hover:text-white transition-colors"}),l.jsx("span",{className:"text-[9px] font-bold uppercase tracking-[0.2em] text-gray-500 group-hover:text-gray-300 transition-colors",children:"Add Extraction Script"})]})})]})})]})]}),V&&l.jsx("div",{className:"fixed inset-0 pointer-events-none z-20 overflow-hidden",children:l.jsx("div",{className:"absolute bg-blue-500/10 border border-blue-400",style:{left:Math.min(V.startX,V.currentX),top:Math.min(V.startY,V.currentY),width:Math.abs(V.currentX-V.startX),height:Math.abs(V.currentY-V.startY)}})}),Z&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(null),onContextMenu:D=>{D.preventDefault(),X(null)}}),l.jsx("div",{className:"fixed z-50 w-[180px] bg-[#0b0b0b] border border-white/10 rounded-xl shadow-2xl p-2 text-[10px] font-bold uppercase tracking-widest text-white/80",style:{left:Z.x,top:Z.y},children:l.jsxs("button",{className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2",onClick:()=>{de(Z.worldX,Z.worldY),X(null)},children:[l.jsx("span",{className:"material-symbols-outlined text-white/50",style:{fontSize:"14px"},children:"sticky_note_2"}),"Add sticky note"]})})]})]})},Wp=({currentTask:i,setCurrentTask:c,tasks:r=[],isExecuting:u,onSave:f,onRun:d,results:h,pinnedResults:p,onConfirm:x,onNotify:g,onPinResults:C,onUnpinResults:w,onRunSnapshot:k,runId:y,onStop:_,isHeadfulOpen:m,onOpenHeadful:b,onStopHeadful:j,useNovnc:S})=>{const A=hb();bb(i,be=>c(be),(be,we)=>f(be,we));const M=yb(i,c,(be,we)=>f(be,we)),O=vb(i,g,x,be=>c(be)),U=wb(i,m,M.updateAction,g,j),{proxyList:L,proxyListLoaded:I}=jb(),V=E.useRef(i);E.useEffect(()=>{V.current=i},[i]);const[de,ae]=E.useState(null),[H,F]=E.useState([]),[z,se]=E.useState([]),[$,P]=E.useState(!1),[Z,X]=E.useState(!1),[ge,R]=E.useState("mode"),[D,W]=E.useState(null),[te,Y]=E.useState(""),[he,ke]=E.useState(null),[Ae,Oe]=E.useState(null),[Ke,Ie]=E.useState({}),[nt,We]=E.useState(!1),[N,me]=E.useState(!1),[ne,q]=E.useState(new Set);E.useEffect(()=>{if(!y||i.mode!=="agent")return;Ie({});const be=new EventSource(`/api/executions/stream?runId=${encodeURIComponent(y)}`,{withCredentials:!0});return be.onmessage=we=>{if(we.data)try{const Re=JSON.parse(we.data);Re&&Re.actionId&&Re.status&&Ie(Ue=>({...Ue,[Re.actionId]:Re.status}))}catch{}},()=>be.close()},[y,i.mode]);const B=E.useCallback(be=>{f(be||V.current,!1)},[f]),J=E.useCallback((be,we)=>{const Re={id:"note_"+Date.now()+"_"+Math.floor(Math.random()*1e3),x:be-100,y:we-60,width:220,height:160,content:"",color:"default"},Ue={...i,stickyNotes:[...i.stickyNotes||[],Re]};c(Ue),B(Ue)},[i,B,c]),xe=E.useCallback((be,we)=>{if((we.x!==void 0||we.y!==void 0)&&we.color===void 0&&we.content===void 0&&we.width===void 0&&we.height===void 0&&ne.has(be)&&ne.size>1){const Be=(i.stickyNotes||[]).find(qe=>qe.id===be);if(Be){const qe=(we.x??Be.x)-Be.x,Me=(we.y??Be.y)-Be.y,Fe={...i,stickyNotes:(i.stickyNotes||[]).map(rt=>rt.id===be?{...rt,...we}:ne.has(rt.id)?{...rt,x:rt.x+qe,y:rt.y+Me}:rt)};c(Fe),B(Fe);return}}const Ue={...i,stickyNotes:(i.stickyNotes||[]).map(Be=>Be.id===be?{...Be,...we}:Be)};c(Ue),B(Ue)},[i,B,c,ne]),re=E.useCallback(be=>{const we={...be,id:"note_"+Date.now()+"_"+Math.floor(Math.random()*1e3),x:be.x+24,y:be.y+24},Re={...i,stickyNotes:[...i.stickyNotes||[],we]};c(Re),B(Re)},[i,B,c]),K=E.useCallback(be=>{const we={...i,stickyNotes:(i.stickyNotes||[]).filter(Re=>Re.id!==be)};c(we),B(we)},[i,B,c]),ve=(be="mode")=>{R(be),be==="history"&&O.loadVersions(),X(!0)},_e=E.useCallback((be,we)=>{P(!0),Y(""),ke(be||null),Oe(we!==void 0?we:null)},[]),Se=be=>{const we=be.tagName.toLowerCase();return we==="input"||we==="textarea"||be.isContentEditable||be.closest('[data-interactive-target="true"]')};E.useEffect(()=>{const be=we=>{if((we.ctrlKey||we.metaKey)&&we.key==="Enter"){we.preventDefault(),We(!0),d();return}if(!Se(we.target))if(we.key==="Backspace"||we.key==="Delete"){if(M.selectedActionIds.size>0||ne.size>0){we.preventDefault();let Re=[...i.actions];M.selectedActionIds.forEach(Be=>{const qe=Re.findIndex(Me=>Me.id===Be);if(qe!==-1){const Me=Re[qe];if(Me.type==="if"||Me.type==="while"){let Fe=1;for(let rt=qe+1;rt<Re.length;rt++)if((Re[rt].type==="if"||Re[rt].type==="while")&&Fe++,Re[rt].type==="end"&&Fe--,Fe===0){Re.splice(rt,1);break}}Re.splice(qe,1)}});const Ue={...i,actions:Re,stickyNotes:(i.stickyNotes||[]).filter(Be=>!ne.has(Be.id))};c(Ue),B(Ue),M.setSelectedActionIds(new Set),q(new Set)}}else if((we.ctrlKey||we.metaKey)&&we.key==="c")(M.selectedActionIds.size>0||ne.size>0)&&(we.preventDefault(),M.selectedActionIds.size>0&&F(i.actions.filter(Re=>M.selectedActionIds.has(Re.id))),ne.size>0&&se((i.stickyNotes||[]).filter(Re=>ne.has(Re.id))));else if((we.ctrlKey||we.metaKey)&&we.key==="v"){if(H.length>0||z.length>0){we.preventDefault();let Re={...i},Ue=[],Be=[];if(H.length>0){const qe=H.map(pa=>({...pa,id:"act_"+Date.now()+"_"+Math.floor(Math.random()*1e3)})),Me=Math.max(-1,...H.map(pa=>Re.actions.findIndex(ma=>ma.id===pa.id))),Fe=Me>=0?Me+1:Re.actions.length,rt=[...Re.actions];rt.splice(Fe,0,...qe),Re={...Re,actions:rt},Ue=qe.map(pa=>pa.id)}if(z.length>0){const qe=z.map(Me=>({...Me,id:"note_"+Date.now()+"_"+Math.floor(Math.random()*1e3),x:Me.x+24,y:Me.y+24}));Re={...Re,stickyNotes:[...Re.stickyNotes||[],...qe]},Be=qe.map(Me=>Me.id)}c(Re),B(Re),Ue.length>0&&M.setSelectedActionIds(new Set(Ue)),Be.length>0&&q(new Set(Be))}}else(we.ctrlKey||we.metaKey)&&we.key==="a"?(we.preventDefault(),M.setSelectedActionIds(new Set(i.actions.map(Re=>Re.id)))):(we.metaKey||we.ctrlKey)&&we.key==="k"?(we.preventDefault(),$||_e()):we.key==="Escape"&&(O.versionPreview?O.setVersionPreview(null):$?P(!1):Z?X(!1):de?ae(null):nt&&We(!1))};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[M,i,B,$,_e,c,ne,H,z]);const ze=E.useCallback((be,we)=>{be.preventDefault();const Re=8,Ue=200,Be=190,qe=Math.min(Math.max(be.clientX+12,Re),window.innerWidth-Ue-Re),Me=Math.min(Math.max(be.clientY+12,Re),window.innerHeight-Be-Re);ae({id:we,x:qe,y:Me})},[]),Ve=be=>({...be,id:"act_"+Date.now()+"_"+Math.floor(Math.random()*1e3)}),De=be=>{const we={id:"act_"+Date.now(),type:be,selector:"",value:""};if((be==="set"||be==="merge")&&(we.varName=""),be==="start"&&(we.value=""),be==="type"&&(we.typeMode="replace"),be==="if"||be==="while"){we.conditionVar="",we.conditionVarType="string",we.conditionOp="equals",we.conditionValue="";const Re={id:"act_"+Date.now()+"_end",type:"end",selector:"",value:""},Ue={...i,actions:[...i.actions,we,Re]};c(Ue),B(Ue)}else{be==="wait_downloads"&&(we.value="30");const Re={...i,actions:[...i.actions,we]};c(Re),B(Re)}},pt=E.useMemo(()=>r.filter(be=>String(be.id||"")!==String(i.id||"")),[r,i.id]);return l.jsxs("div",{className:"flex-1 flex overflow-hidden animate-in fade-in slide-in-from-bottom-4 duration-500 bg-black relative",children:[l.jsx(Sb,{currentTask:i,onUpdateTaskName:be=>c({...i,name:be}),onAutoSave:B,onOpenHistory:()=>ve("history")}),l.jsx(py,{currentTask:i,setCurrentTask:c,canvasOffset:A.canvasOffset,canvasScale:A.canvasScale,canvasViewportRef:A.canvasViewportRef,triggerExpanded:N,setTriggerExpanded:me,onOpenCabinet:ve,handleAutoSave:B,dragState:M.dragState,dragOverIndex:M.dragOverIndex,selectedActionIds:M.selectedActionIds,setSelectedActionIds:M.setSelectedActionIds,actionStatusById:Ke,availableTasks:pt,selectorOptionsById:U.selectorOptionsById,updateAction:M.updateAction,openActionPalette:_e,openContextMenu:ze,handleActionPointerDown:M.handleActionPointerDown,onOpenHeadful:E.useCallback((be,we)=>{U.setActiveInspectActionId(we||null),b?.(be,we,V.current,V.current.variables)},[b,U.setActiveInspectActionId]),isHeadfulOpen:m,onPointerDown:be=>{if(be.button===1||be.button===0&&A.spaceHeldRef.current)A.startPanning(be);else if(be.button===0&&!Se(be.target)){if(be.target.closest("[data-action-id]")||be.target.closest("[data-sticky-note-id]"))return;W({startX:be.clientX,startY:be.clientY,currentX:be.clientX,currentY:be.clientY}),!be.shiftKey&&!be.ctrlKey&&!be.metaKey&&(M.setSelectedActionIds(new Set),q(new Set)),be.target.setPointerCapture?.(be.pointerId)}},onPointerMove:be=>{if(A.isPanning.current)A.handlePanning(be.nativeEvent);else if(D){W(Me=>Me?{...Me,currentX:be.clientX,currentY:be.clientY}:null);const we={left:Math.min(D.startX,be.clientX),right:Math.max(D.startX,be.clientX),top:Math.min(D.startY,be.clientY),bottom:Math.max(D.startY,be.clientY)},Re=document.querySelectorAll("[data-action-id]"),Ue=new Set(be.shiftKey||be.ctrlKey||be.metaKey?Array.from(M.selectedActionIds):[]);Re.forEach(Me=>{const Fe=Me.getBoundingClientRect();!(Fe.right<we.left||Fe.left>we.right||Fe.bottom<we.top||Fe.top>we.bottom)&&Ue.add(Me.getAttribute("data-action-id"))}),M.setSelectedActionIds(Ue);const Be=document.querySelectorAll("[data-sticky-note-id]"),qe=new Set(be.shiftKey||be.ctrlKey||be.metaKey?Array.from(ne):[]);Be.forEach(Me=>{const Fe=Me.getBoundingClientRect();!(Fe.right<we.left||Fe.left>we.right||Fe.bottom<we.top||Fe.top>we.bottom)&&qe.add(Me.getAttribute("data-sticky-note-id"))}),q(qe)}},onPointerUp:()=>{A.stopPanning(),W(null)},onPointerCancel:()=>{A.stopPanning(),W(null)},selectionBox:D,onAddStickyNote:J,onUpdateStickyNote:xe,onDeleteStickyNote:K,onDuplicateStickyNote:re,selectedNoteIds:ne}),l.jsxs("div",{className:"absolute bottom-24 left-6 z-30 flex flex-col gap-1 bg-[#111] border border-white/10 rounded-xl p-1 shadow-xl",role:"group","aria-label":"Zoom controls",children:[l.jsx("button",{onClick:()=>A.setCanvasScale(Math.min(2,A.canvasScale*1.2)),className:"w-8 h-8 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-all flex items-center justify-center text-sm font-bold focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Zoom in",title:"Zoom in",children:"+"}),l.jsxs("div",{className:"text-[8px] text-center text-gray-500 font-bold select-none","aria-live":"polite",children:[Math.round(A.canvasScale*100),"%"]}),l.jsx("button",{onClick:()=>A.setCanvasScale(Math.max(.25,A.canvasScale*.8)),className:"w-8 h-8 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-all flex items-center justify-center text-sm font-bold focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Zoom out",title:"Zoom out",children:"−"}),l.jsx("button",{onClick:()=>{A.setCanvasScale(1);const be=A.canvasViewportRef.current;A.setCanvasOffset({x:((be?be.clientWidth:1e3)-400)/2,y:20})},className:"w-8 h-8 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-all flex items-center justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Reset zoom and center",title:"Reset zoom and center",children:l.jsx(ue,{name:"fit_screen",className:"text-sm"})})]}),de&&(()=>{const be=i.actions.findIndex(Be=>Be.id===de.id),we=i.actions[be];if(!we)return null;const Re=M.selectedActionIds.has(we.id)&&M.selectedActionIds.size>1,Ue=Re?Array.from(M.selectedActionIds):[we.id];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ae(null)}),l.jsxs("div",{className:"action-context-menu fixed z-50 w-[200px] bg-[#0b0b0b] border border-white/10 rounded-xl shadow-2xl p-2 text-[10px] font-bold uppercase tracking-widest text-white/80",style:{left:de.x,top:de.y},children:[l.jsxs("button",{onClick:()=>{const Be=!we.disabled,qe=i.actions.map(Fe=>Ue.includes(Fe.id)?{...Fe,disabled:Be}:Fe),Me={...i,actions:qe};c(Me),B(Me),ae(null)},className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",children:[l.jsx(ue,{name:we.disabled?"visibility":"visibility_off",className:"text-sm text-white/40"}),we.disabled?"Enable":"Disable"," ",Re?"All":""]}),l.jsxs("button",{onClick:()=>{const Be=i.actions.filter(Me=>!Ue.includes(Me.id)),qe={...i,actions:Be};c(qe),B(qe),ae(null),M.setSelectedActionIds(new Set)},className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors text-red-400 flex items-center gap-2.5",children:[l.jsx(ue,{name:"delete",className:"text-sm text-red-400/70"}),"Delete ",Re?"All":""]}),l.jsxs("button",{onClick:()=>{const Be=i.actions.filter(Fe=>Ue.includes(Fe.id));F(Be);const qe=i.actions.filter(Fe=>!Ue.includes(Fe.id)),Me={...i,actions:qe};c(Me),B(Me),M.setSelectedActionIds(new Set),ae(null)},className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",children:[l.jsx(ue,{name:"content_cut",className:"text-sm text-white/40"}),"Cut ",Re?"All":""]}),l.jsxs("button",{onClick:()=>{F(i.actions.filter(Be=>Ue.includes(Be.id))),ae(null)},className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",children:[l.jsx(ue,{name:"content_copy",className:"text-sm text-white/40"}),"Copy ",Re?"All":""]}),l.jsxs("button",{onClick:()=>{const qe=i.actions.filter(rt=>Ue.includes(rt.id)).map(rt=>Ve(rt)),Me=[...i.actions];Me.splice(be+1,0,...qe);const Fe={...i,actions:Me};c(Fe),B(Fe),ae(null)},className:"w-full text-left px-3 py-2 rounded-lg hover:bg-white/5 transition-colors flex items-center gap-2.5",children:[l.jsx(ue,{name:"copy_all",className:"text-sm text-white/40"}),"Duplicate ",Re?"All":""]})]})]})})(),l.jsx(ib,{open:$,query:te,onQueryChange:Y,onClose:()=>P(!1),onSelect:be=>{if(he)M.updateAction(he,{type:be},!0);else if(Ae!==null){const we={id:"act_"+Date.now(),type:be,selector:"",value:""};(be==="set"||be==="merge")&&(we.varName=""),be==="start"&&(we.value=""),be==="type"&&(we.typeMode="replace"),(be==="if"||be==="while")&&(we.conditionVar="",we.conditionVarType="string",we.conditionOp="equals",we.conditionValue=""),be==="wait_downloads"&&(we.value="30");const Re=[...i.actions];if(be==="if"||be==="while"){const Be={id:"act_"+Date.now()+"_end",type:"end",selector:"",value:""};Re.splice(Ae,0,we,Be)}else Re.splice(Ae,0,we);const Ue={...i,actions:Re};c(Ue),B(Ue)}else De(be);P(!1),Oe(null)}}),l.jsx(Wb,{isOpen:nt,onToggle:()=>We(!nt),results:h,pinnedResults:p,isExecuting:u,isHeadfulOpen:m||!1,runId:y,onConfirm:x,onNotify:g,onPinResults:C,onUnpinResults:w,useNovnc:S}),l.jsx(ey,{versionPreview:O.versionPreview,onClose:()=>O.setVersionPreview(null),onRunSnapshot:k}),l.jsx(ty,{isHeadfulOpen:m||!1,isInspectMode:U.isInspectMode,isInspectLoading:U.isInspectLoading,isExecuting:u,useNovnc:S,onToggleInspect:U.handleToggleInspect,onStopHeadful:()=>j?.()}),l.jsx(Nb,{isExecuting:u,isHeadfulOpen:m||!1,onRun:()=>{We(!0),d()},onStop:_,onOpenHeadful:()=>b?.(i.url||"https://www.google.com",void 0,i,i.variables),onStopHeadful:j}),l.jsx(fb,{isOpen:Z,onClose:()=>X(!1),currentTask:i,onUpdateTask:be=>{const we={...i,...be};c(we),B(we)},proxyListLoaded:I,proxyList:L,initialTab:ge,versions:O.versions,versionsLoading:O.versionsLoading,onRollback:O.rollbackToVersion,onPreview:O.openVersionPreview})]})};function my(i){return i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}m`:i>=1e3?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(i)}const xy=({className:i})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:i,"aria-hidden":"true",children:l.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.699-2.782.603-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0112 6.844c.85.004 1.705.114 2.504.336 1.909-1.294 2.747-1.025 2.747-1.025.546 1.379.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.161 22 16.418 22 12c0-5.523-4.477-10-10-10z"})});function gy({className:i=""}){const[c,r]=E.useState("—"),u=d=>{const h=d.currentTarget.getBoundingClientRect(),p=Math.min(1,Math.max(0,(d.clientX-h.left)/h.width)),x=Math.min(1,Math.max(0,(d.clientY-h.top)/h.height));d.currentTarget.style.setProperty("--beam-x",`${(p*100).toFixed(2)}%`),d.currentTarget.style.setProperty("--beam-y",`${(x*100).toFixed(2)}%`)},f=d=>{d.currentTarget.style.setProperty("--beam-x","50%"),d.currentTarget.style.setProperty("--beam-y","50%")};return E.useEffect(()=>{let d=!0;return fetch("https://api.github.com/repos/figranium/figranium").then(h=>h.ok?h.json():null).then(h=>{!d||!h?.stargazers_count||r(my(Number(h.stargazers_count)))}).catch(()=>{d&&r("—")}),()=>{d=!1}},[]),l.jsxs("a",{href:"https://github.com/figranium/figranium",target:"_blank",rel:"noreferrer",onPointerMove:u,onPointerLeave:f,className:`gh-pill beam-follow inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-4 py-2 text-[11px] uppercase tracking-[0.25em] text-white/70 transition hover:border-white/20 hover:bg-white/10 hover:text-white ${i}`,"aria-label":"Star Figranium on GitHub",children:[l.jsx(xy,{className:"h-4 w-4"}),"GitHub",l.jsx("span",{className:"mx-1 h-3 w-px bg-white/20","aria-hidden":"true"}),l.jsx(ue,{name:"star",className:"text-base",fill:!0}),c]})}const jp=i=>{if(!i)return{url:"",model:""};try{const c=JSON.parse(i);return{url:c.url||"",model:c.model||""}}catch{return{url:i,model:""}}},by=({config:i,onConfirm:c})=>{const[r,u]=E.useState(i.startEditing||!1),[f,d]=E.useState(i.startEditing&&i.value||""),[h,p]=E.useState(!1),[x,g]=E.useState(""),C=()=>{i.urlModel?g(jp(i.value).url):(d(i.value||""),p(!1)),u(!0)},w=()=>{u(!1),d(""),g(""),p(!1)},k=async()=>{i.urlModel?await i.onSave(x.trim()):await i.onSave(f.trim()),u(!1)},y=async()=>{i.onRegenerate&&await i.onRegenerate()},_=i.loading?"Loading...":i.value?"••••••••••••••••••••••••••••••••••••••••":"No key set",m=l.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center text-blue-400 overflow-hidden shrink-0",children:i.iconUrl?l.jsx("img",{src:i.iconUrl,alt:i.name,className:"w-6 h-6 object-contain"}):i.iconComponent?l.jsx(i.iconComponent,{className:"w-5 h-5"}):l.jsx(ue,{name:i.icon||"key",className:"text-xl"})}),b=i.onDelete&&l.jsx("button",{onClick:async()=>{(c?await c(`Are you sure you want to delete the ${i.name}?`):confirm(`Are you sure you want to delete the ${i.name}?`))&&await i.onDelete?.()},disabled:i.loading||i.saving,className:"p-3 rounded-2xl bg-white/5 border border-white/10 text-red-400 hover:bg-red-500/20 hover:border-red-500/30 transition-all disabled:opacity-50 disabled:cursor-not-allowed shrink-0",title:"Delete","aria-label":"Delete",children:l.jsx(ue,{name:"delete",className:"text-base"})});if(i.urlModel){const j=jp(i.value);return l.jsxs("div",{className:"flex flex-col gap-4 py-4 border-b border-white/5 last:border-0",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[m,l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h4",{className:"text-sm font-bold text-white uppercase tracking-widest",children:i.name}),i.badge&&l.jsx("span",{className:`text-[8px] font-bold uppercase tracking-widest px-2 py-0.5 rounded-full ${i.badge==="Primary"?"bg-blue-500/20 text-blue-400 border border-blue-500/30":"bg-white/10 text-white/50 border border-white/10"}`,children:i.badge})]}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:i.description})]})]}),r?l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsx("div",{className:"flex items-center gap-3 rounded-2xl bg-black/40 border border-white/30 focus-within:border-white px-4 py-3 transition-all",children:l.jsx("input",{type:"text",value:x,onChange:S=>g(S.target.value),disabled:i.saving,placeholder:"http://localhost:11434",className:"flex-1 bg-transparent text-[11px] text-white font-mono focus:outline-none",autoFocus:!0})}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:w,disabled:i.saving,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-transparent border border-white/20 text-white hover:bg-white/10 transition-all disabled:opacity-50",children:"Cancel"}),l.jsxs("button",{onClick:k,disabled:i.saving||!x.trim(),className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-blue-500 text-white hover:bg-blue-400 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(ue,{name:"save",className:"text-base"}),i.saving?"Saving...":"Save"]})]})]}):l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"flex-1 rounded-2xl bg-black/40 border border-white/10 px-4 py-3 text-[10px] text-blue-200/80 min-h-[44px] flex items-center",children:i.loading?l.jsx("span",{className:"opacity-50",children:"Loading..."}):i.value?l.jsx("span",{className:"font-mono",children:j.url||l.jsx("span",{className:"opacity-40",children:"No URL"})}):l.jsx("span",{className:"opacity-40",children:"Not configured"})}),!i.readOnly&&l.jsxs("button",{onClick:C,disabled:i.loading||i.saving,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-white/10 text-white hover:bg-white/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 shrink-0",children:[l.jsx(ue,{name:"edit",className:"text-base"}),"Edit"]}),b]})]})}return l.jsxs("div",{className:"flex flex-col gap-4 py-4 border-b border-white/5 last:border-0",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[m,l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h4",{className:"text-sm font-bold text-white uppercase tracking-widest",children:i.name}),i.badge&&l.jsx("span",{className:`text-[8px] font-bold uppercase tracking-widest px-2 py-0.5 rounded-full ${i.badge==="Primary"?"bg-blue-500/20 text-blue-400 border border-blue-500/30":"bg-white/10 text-white/50 border border-white/10"}`,children:i.badge})]}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:i.description})]})]}),r?l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex-1 flex items-center gap-3 rounded-2xl bg-black/40 border border-white/30 focus-within:border-white px-4 py-2 transition-all",children:[l.jsx("input",{type:h?"text":"password",value:f,onChange:j=>d(j.target.value),disabled:i.saving,placeholder:"Enter new API key...",className:"flex-1 bg-transparent text-[10px] text-white font-mono focus:outline-none",autoFocus:!0}),l.jsx("button",{onClick:()=>p(!h),type:"button",className:"p-2 rounded-xl text-white/50 hover:text-white hover:bg-white/10 transition-all",title:h?"Hide value":"Show value","aria-label":h?"Hide value":"Show value",children:l.jsx(ue,{name:h?"visibility_off":"visibility",className:"text-base"})})]}),l.jsx("button",{onClick:w,disabled:i.saving,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-transparent border border-white/20 text-white hover:bg-white/10 transition-all disabled:opacity-50",children:"Cancel"}),l.jsxs("button",{onClick:k,disabled:i.saving,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-blue-500 text-white hover:bg-blue-400 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(ue,{name:"save",className:"text-base"}),i.saving?"Saving...":"Save"]})]}):l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"flex-1 rounded-2xl bg-black/40 border border-white/10 px-4 py-3 font-mono text-[10px] text-blue-200/80 break-all min-h-[44px] flex items-center",children:l.jsx("span",{className:"opacity-80 select-none",children:_})}),!i.readOnly&&l.jsxs("button",{onClick:C,disabled:i.loading||i.saving,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-white/10 text-white hover:bg-white/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(ue,{name:"edit",className:"text-base"}),"Edit"]}),i.onRegenerate&&l.jsxs("button",{onClick:y,disabled:i.loading||i.saving,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-white text-black hover:scale-105 transition-all disabled:opacity-50 disabled:hover:scale-100 disabled:cursor-not-allowed flex items-center gap-2",children:[l.jsx(ue,{name:"autorenew",className:"text-base"}),i.saving?"Generating...":"Regenerate"]}),i.showCopyButton&&i.value&&l.jsx(Vn,{text:i.value,className:"p-3 rounded-2xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all",iconClassName:"text-base"}),b]})]})},yy=({keys:i,availableProviders:c,onAddProvider:r,dbProviders:u,onAddDbCredential:f,onConfirm:d})=>{const[h,p]=E.useState(!1),[x,g]=E.useState("list"),[C,w]=E.useState(null),[k,y]=E.useState({name:"",baseUrl:"https://api.baserow.io",token:""}),[_,m]=E.useState(!1),[b,j]=E.useState(null),S=c&&c.length>0&&r||u&&u.length>0&&f,A=()=>{p(!1),g("list"),w(null),y({name:"",baseUrl:"https://api.baserow.io",token:""}),j(null)},M=U=>{w(U),g("db-form"),j(null)},O=async()=>{if(!(!C||!k.name||!k.token||!f)){m(!0),j(null);try{await f({name:k.name,provider:C.providerKey,config:{baseUrl:k.baseUrl,token:k.token}})?A():j("Failed to save credential. Check the server console for details.")}catch(U){console.error("[ApiKeysPanel] handleDbSave error:",U),j("An unexpected error occurred.")}finally{m(!1)}}};return E.useEffect(()=>{if(h){document.body.style.overflow="hidden";const U=document.querySelector("main");U&&(U.style.overflow="hidden")}else{document.body.style.overflow="";const U=document.querySelector("main");U&&(U.style.overflow="")}return()=>{document.body.style.overflow="";const U=document.querySelector("main");U&&(U.style.overflow="")}},[h]),l.jsxs("div",{className:"glass-card p-8 rounded-[40px]",children:[l.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-bold text-white uppercase tracking-widest",children:"API Keys"}),l.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-widest mt-1",children:"Manage external integrations and API access"})]}),S&&l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>p(!0),className:"px-6 py-3 rounded-2xl text-[10px] font-bold uppercase tracking-widest bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 transition-all flex items-center gap-2 border border-blue-500/10",children:[l.jsx(ue,{name:"add",className:"text-base"}),"Add API Key"]}),h&&Ei.createPortal(l.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 bg-black/80 backdrop-blur-md animate-in fade-in duration-200",style:{position:"fixed",top:0,left:0,right:0,bottom:0},onClick:U=>{U.target===U.currentTarget&&A()},children:l.jsxs("div",{className:"glass-card max-w-2xl w-full p-10 rounded-[40px] shadow-2xl relative border border-white/10 animate-in zoom-in-95 duration-300 bg-gray-900/80",children:[l.jsx("button",{onClick:A,className:"absolute top-6 right-6 p-3 rounded-2xl text-white/50 hover:text-white hover:bg-white/10 transition-all","aria-label":"Close",children:l.jsx(ue,{name:"close",className:"text-2xl"})}),x==="list"&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-2xl font-bold text-white tracking-wide mb-2",children:"Add Key"}),l.jsx("p",{className:"text-sm text-white/50 mb-8",children:"Choose what you'd like to add."}),c&&c.length>0&&r&&l.jsxs("div",{className:"mb-8",children:[l.jsx("p",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.2em] mb-4",children:"AI Providers"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:c.map(U=>l.jsxs("button",{onClick:()=>{U.disabled||(r(U.id),A())},disabled:U.disabled,className:`flex items-start gap-4 p-5 rounded-3xl border transition-all text-left ${U.disabled?"border-white/5 bg-white/5 opacity-40 cursor-not-allowed grayscale":"border-white/10 hover:border-blue-400/30 hover:bg-blue-500/5 cursor-pointer group"}`,children:[l.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 overflow-hidden ${U.disabled?"bg-black/20":"bg-white/5 group-hover:scale-110 transition-transform"}`,children:U.iconUrl?l.jsx("img",{src:U.iconUrl,alt:U.name,className:"w-8 h-8 object-contain drop-shadow-md"}):U.iconComponent?l.jsx(U.iconComponent,{className:"w-6 h-6 text-white"}):l.jsx(ue,{name:"api",className:"text-xl text-white"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"text-base font-bold text-white mb-1",children:U.name}),l.jsx("div",{className:"text-[10px] text-white/50 uppercase tracking-widest",children:U.disabled?"Coming Soon":"Available"})]})]},U.id))})]}),u&&u.length>0&&f&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.2em] mb-4",children:"Database / Output"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:u.map(U=>l.jsxs("button",{onClick:()=>!U.disabled&&M(U),disabled:U.disabled,className:`flex items-start gap-4 p-5 rounded-3xl border transition-all text-left ${U.disabled?"border-white/5 bg-white/5 opacity-40 cursor-not-allowed grayscale":"border-white/10 hover:border-emerald-400/30 hover:bg-emerald-500/5 cursor-pointer group"}`,children:[l.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 overflow-hidden ${U.disabled?"bg-black/20":"bg-white/5 group-hover:scale-110 transition-transform"}`,children:U.iconUrl?l.jsx("img",{src:U.iconUrl,alt:U.name,className:"w-8 h-8 object-contain drop-shadow-md"}):l.jsx(ue,{name:"database",className:"text-xl text-white"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"text-base font-bold text-white mb-1",children:U.name}),l.jsx("div",{className:"text-[10px] text-white/50 uppercase tracking-widest",children:U.disabled?"Coming Soon":"Available"})]})]},U.providerKey))})]})]}),x==="db-form"&&C&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>g("list"),className:"flex items-center gap-2 text-[10px] font-bold text-gray-500 hover:text-white uppercase tracking-widest mb-6 transition-colors",children:[l.jsx(ue,{name:"arrow_back",className:"text-sm"}),"Back"]}),l.jsxs("h3",{className:"text-2xl font-bold text-white tracking-wide mb-2",children:["Add ",C.name]}),l.jsxs("p",{className:"text-sm text-white/50 mb-8",children:["Enter your ",C.name," credentials."]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Name"}),l.jsx("input",{className:"w-full bg-black/40 border border-white/10 rounded-2xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-white/30 transition-colors",placeholder:"e.g. My Baserow",value:k.name,onChange:U=>y(L=>({...L,name:U.target.value})),autoFocus:!0})]}),C.providerKey==="baserow"&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"Base URL"}),l.jsx("input",{className:"w-full bg-black/40 border border-white/10 rounded-2xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-white/30 transition-colors",placeholder:"https://api.baserow.io",value:k.baseUrl,onChange:U=>y(L=>({...L,baseUrl:U.target.value}))})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[9px] font-bold text-gray-500 uppercase tracking-[0.2em]",children:"API Token"}),l.jsx("input",{className:"w-full bg-black/40 border border-white/10 rounded-2xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-white/30 transition-colors font-mono",placeholder:"Token",type:"password",value:k.token,onChange:U=>y(L=>({...L,token:U.target.value}))})]})]}),b&&l.jsx("p",{className:"mt-4 text-[10px] text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3 py-2",children:b}),l.jsxs("div",{className:"flex gap-3 mt-4",children:[l.jsx("button",{onClick:A,className:"px-6 py-3 rounded-2xl text-[10px] font-bold uppercase tracking-widest bg-transparent border border-white/10 text-gray-400 hover:text-white hover:border-white/20 transition-all",children:"Cancel"}),l.jsx("button",{onClick:O,disabled:_||!k.name||!k.token,className:"flex-1 py-3 rounded-2xl text-[10px] font-bold uppercase tracking-widest bg-white text-black hover:bg-white/90 transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:_?"Saving…":"Save Credential"})]})]})]})}),document.body)]})]}),l.jsx("div",{className:"flex flex-col",children:i.map(U=>l.jsx(by,{config:U,onConfirm:d},U.id))})]})},vy=({onClearStorage:i})=>l.jsxs("div",{className:"glass-card p-8 rounded-[40px] space-y-6",children:[l.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[l.jsx("div",{className:"w-10 h-10 rounded-2xl bg-white/5 flex items-center justify-center text-gray-400",children:l.jsx(ue,{name:"delete",className:"text-xl"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Storage"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:"Manage stored data"})]})]}),l.jsxs("div",{className:"flex gap-4",children:[l.jsx("button",{type:"button",onClick:()=>i("screenshots"),"aria-label":"Clear all captures",title:"Clear all captures",className:"flex-1 px-6 py-4 bg-red-500/5 border border-red-500/10 text-red-400 rounded-2xl text-[9px] font-bold uppercase tracking-widest hover:bg-red-500/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500/50",children:"Clear Captures"}),l.jsx("button",{type:"button",onClick:()=>i("cookies"),"aria-label":"Reset all cookies",title:"Reset all cookies",className:"flex-1 px-6 py-4 bg-yellow-500/5 border border-yellow-500/10 text-yellow-400 rounded-2xl text-[9px] font-bold uppercase tracking-widest hover:bg-yellow-500/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-yellow-500/50",children:"Reset Cookies"})]})]}),wy=72,em=6,ir=wy+em,jy=5,Sy=2,Ny=({index:i,style:c,data:r})=>{const u=r.captures[i];return u?l.jsx("div",{style:{...c,paddingBottom:em},children:l.jsxs("div",{className:"flex items-center justify-between gap-4 p-4 rounded-2xl border border-white/10 bg-white/[0.02]",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] font-bold text-white uppercase tracking-widest",children:u.type==="recording"?"Recording":"Screenshot"}),l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:u.name})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("a",{href:u.url,target:"_blank",rel:"noreferrer",className:"px-3 py-2 rounded-xl border border-white/10 text-[9px] font-bold uppercase tracking-widest text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":`Open ${u.name}`,title:`Open ${u.name}`,children:"Open"}),l.jsx("button",{type:"button",onClick:()=>r.onDelete(u.name),className:"px-3 py-2 rounded-xl border border-red-500/20 text-[9px] font-bold uppercase tracking-widest text-red-300 hover:bg-red-500/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500/50","aria-label":`Delete ${u.name}`,title:`Delete ${u.name}`,children:"Delete"})]})]})}):null},_y=({captures:i,loading:c,onRefresh:r,onDelete:u})=>{const f=Math.min(Math.max(ir,i.length*ir),ir*jy),d=E.useMemo(()=>({captures:i,onDelete:u}),[i,u]);return l.jsxs("div",{className:"glass-card p-8 rounded-[40px] space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Captures"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:"Recordings and screenshots"})]}),l.jsx("button",{type:"button",onClick:r,disabled:c,className:"px-4 py-2 border border-white/10 text-[9px] font-bold rounded-xl uppercase tracking-widest text-white/70 hover:text-white hover:bg-white/5 transition-all disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":"Refresh captures list",title:"Refresh captures list",children:"Refresh"})]}),c&&l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"Loading captures..."}),!c&&i.length===0&&l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"No captures found."}),!c&&i.length>0&&l.jsx(xr,{height:f,width:"100%",itemCount:i.length,itemSize:ir,overscanCount:Sy,itemData:d,children:Ny})]})},Gc=i=>`${i.name}|${i.domain||""}|${i.path||""}|${i.expires||""}`,Sp=i=>{if(!i)return!1;let c=0;for(let r=0;r<i.length;r+=1){const u=i.charCodeAt(r);(u===9||u===10||u===13||u>=32&&u<=126)&&(c+=1)}return c/i.length>=.85},Cy=i=>{if(!i)return null;if(/%[0-9A-Fa-f]{2}/.test(i))try{const c=decodeURIComponent(i);if(c!==i&&Sp(c))return{value:c,kind:"URL"}}catch{}if(/^[A-Za-z0-9+/=]+$/.test(i)&&i.length>=12&&i.length%4===0)try{const c=atob(i);if(c&&Sp(c))return{value:c,kind:"Base64"}}catch{}return null},ky=({cookies:i,originsCount:c,loading:r,onClear:u,onDelete:f})=>{const[d,h]=E.useState({}),[p,x]=E.useState({}),g=k=>{const y=Gc(k);h(_=>({..._,[y]:!_[y]}))},C=k=>{const y=Gc(k);x(_=>({..._,[y]:!_[y]}))},w=E.useMemo(()=>i.map(k=>{const y=Gc(k),_=k.value||"";return{cookie:k,key:y,value:_,decodedCandidate:Cy(_)}}),[i]);return l.jsxs("div",{className:"glass-card p-8 rounded-[40px] space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"w-10 h-10 rounded-2xl bg-white/5 flex items-center justify-center text-gray-400",children:l.jsx(ue,{name:"database",className:"text-xl"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Cookies"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:"Browser storage state"})]})]}),l.jsx("button",{type:"button",onClick:u,title:"Clear all cookies","aria-label":"Clear all cookies",className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-yellow-500/5 border border-yellow-500/10 text-yellow-400 hover:bg-yellow-500/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:"Clear Cookies"})]}),r&&l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"Loading data..."}),!r&&i.length===0&&l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"No cookies found."}),l.jsx("div",{className:"space-y-3",children:w.map(({cookie:k,key:y,value:_,decodedCandidate:m})=>{const b=!!d[y],j=!!m&&!!p[y],S=j&&m?m.value:_,A=b||S.length<=120?S:`${S.slice(0,120)}...`;return l.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] font-bold text-white uppercase tracking-widest truncate",children:k.name}),l.jsxs("div",{className:"text-[8px] text-gray-500 uppercase tracking-[0.2em]",children:[k.domain||"local"," | ",k.path||"/",k.expires?` | ${new Date(k.expires*1e3).toLocaleString()}`:""]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[m&&l.jsx("button",{type:"button",onClick:()=>C(k),title:j?"Show raw value":`Decode ${m.kind}`,"aria-label":j?"Show raw value":`Decode ${m.kind}`,className:"px-3 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl border border-white/10 text-white/70 hover:text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:j?"Show Raw":`Decode ${m.kind}`}),l.jsx(Vn,{text:S,title:"Copy cookie value",label:"Copy",className:"px-3 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all",iconClassName:"text-sm"}),l.jsx("button",{type:"button",onClick:()=>f(k),title:`Delete cookie ${k.name}`,"aria-label":`Delete cookie ${k.name}`,className:"px-3 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-red-500/5 border border-red-500/10 text-red-400 hover:bg-red-500/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:"Delete"})]})]}),l.jsx("button",{type:"button",onClick:()=>g(k),"aria-expanded":b,"aria-label":b?"Collapse cookie value":"Expand cookie value",className:"w-full text-left cursor-pointer rounded-xl bg-black/40 border border-white/10 px-3 py-2 font-mono text-[10px] text-blue-200/80 whitespace-pre-wrap break-words focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:b?"Click to collapse":"Click to expand",children:A||"(empty)"})]},y)})}),!r&&c>0&&l.jsxs("div",{className:"pt-2 text-[8px] text-gray-600 uppercase tracking-widest",children:["Origins stored: ",c]})]})},Ey=({tab:i,onTabChange:c})=>l.jsxs("div",{className:"flex items-end justify-between mb-8",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("h2",{className:"text-2xl font-medium tracking-[0.25em] text-white uppercase",children:"Settings"})}),l.jsx("div",{role:"tablist",className:"flex bg-white/5 rounded-xl p-1 border border-white/5",children:["system","data","proxies"].map(r=>l.jsx("button",{role:"tab","aria-selected":i===r,onClick:()=>c(r),className:`px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-lg transition-all focus:outline-none focus-visible:ring-2 ${i===r?"bg-white text-black focus-visible:ring-blue-500":"text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:r},r))})]}),Ay=({proxies:i,defaultProxyId:c,includeDefaultInRotation:r,rotationMode:u,loading:f,onRefresh:d,onAdd:h,onImport:p,onUpdate:x,onDelete:g,onDeleteMultiple:C,onSetDefault:w,onToggleIncludeDefault:k,onRotationModeChange:y})=>{const[_,m]=E.useState(""),[b,j]=E.useState(""),[S,A]=E.useState(""),[M,O]=E.useState(""),[U,L]=E.useState(!1),[I,V]=E.useState(""),[de,ae]=E.useState(null),[H,F]=E.useState(""),[z,se]=E.useState(""),[$,P]=E.useState(""),[Z,X]=E.useState(""),[ge,R]=E.useState(!1),[D,W]=E.useState(""),[te,Y]=E.useState(""),[he,ke]=E.useState(new Set),[Ae,Oe]=E.useState(null),Ke=E.useRef(null),Ie=()=>{_.trim()&&(h({server:_.trim(),username:b.trim()||void 0,password:S.trim()||void 0,label:M.trim()||void 0,isRotatingPool:U,estimatedPoolSize:I?parseInt(I,10):void 0}),m(""),j(""),A(""),O(""),L(!1),V(""))},nt=K=>{ae(K.id),F(K.server),se(K.username||""),P(""),X(K.label||""),R(!!K.isRotatingPool),W(K.estimatedPoolSize?String(K.estimatedPoolSize):"")},We=()=>{ae(null),F(""),se(""),P(""),X(""),R(!1),W("")},N=()=>{!de||!H.trim()||(x(de,{server:H.trim(),username:z.trim()||void 0,password:$.trim()||void 0,label:Z.trim()||void 0,isRotatingPool:ge,estimatedPoolSize:D?parseInt(D,10):void 0}),We())},me=K=>{const ve=K.trim();if(!ve)return null;if(ve.includes("://"))return{server:ve};const _e=ve.split(":");if(_e.length<2)return null;const Se=_e[0]?.trim(),ze=_e[1]?.trim();if(!Se||!ze)return null;const Ve=_e[2]?_e[2].trim():"",De=_e.length>3?_e.slice(3).join(":").trim():"";return{server:`${Se}:${ze}`,username:Ve||void 0,password:De||void 0}},ne=async K=>{const ve=Array.from(K.target.files||[]);if(ve.length)try{const ze=(await Promise.all(ve.map(Ve=>Ve.text()))).join(`
18
+ `).split(/\r?\n/).flatMap(Ve=>Ve.split(/[,;]+/)).map(me).filter(Boolean);if(ze.length===0){Y("No valid proxies found in file.");return}Y(""),p(ze)}catch{Y("Failed to read file.")}finally{Ke.current&&(Ke.current.value="")}},q=(K,ve)=>{ke(_e=>{const Se=new Set(_e);if(ve?.shiftKey&&Ae){const ze=i.filter(pt=>pt.id!=="host"),Ve=ze.findIndex(pt=>pt.id===Ae),De=ze.findIndex(pt=>pt.id===K);if(Ve!==-1&&De!==-1){const pt=Math.min(Ve,De),be=Math.max(Ve,De);for(let we=pt;we<=be;we++)Se.add(ze[we].id);return Se}}return Se.has(K)?Se.delete(K):Se.add(K),Se}),Oe(K)},B=()=>{const K=i.filter(ve=>ve.id!=="host");he.size>=K.length&&K.length>0?ke(new Set):ke(new Set(K.map(ve=>ve.id)))},J=()=>{he.size>0&&(C(Array.from(he)),ke(new Set))},xe=i.filter(K=>K.id!=="host"),re=xe.length>0&&he.size>=xe.length;return l.jsxs("div",{className:"glass-card p-8 rounded-[40px] space-y-6",children:[l.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[l.jsx("div",{className:"w-10 h-10 rounded-2xl bg-white/5 flex items-center justify-center text-gray-400",children:l.jsx(ue,{name:"security",className:"text-xl"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Proxies"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:"Set defaults and rotate per task"})]}),l.jsx("div",{className:"ml-auto",children:l.jsxs("button",{onClick:d,disabled:f,className:"px-4 py-2 rounded-xl border border-white/10 text-[9px] font-bold uppercase tracking-widest text-white hover:bg-white/5 transition-all disabled:opacity-50 inline-flex items-center gap-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Refresh proxy list","aria-label":"Refresh proxy list",children:[l.jsx(ue,{name:"sync",className:`text-base ${f?"animate-spin":""}`}),"Refresh"]})})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsx("input",{type:"text",placeholder:"Proxy server (host:port or scheme://host:port)",value:_,onChange:K=>m(K.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-3 text-[10px] text-white","aria-label":"Proxy server address"}),l.jsx("input",{type:"text",placeholder:"Label (optional)",value:M,onChange:K=>O(K.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-3 text-[10px] text-white","aria-label":"Proxy label"}),l.jsx("input",{type:"text",placeholder:"Username (optional)",value:b,onChange:K=>j(K.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-3 text-[10px] text-white","aria-label":"Proxy username"}),l.jsx("input",{type:"password",placeholder:"Password (optional)",value:S,onChange:K=>A(K.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-3 text-[10px] text-white","aria-label":"Proxy password"}),l.jsxs("label",{className:"flex items-center gap-3 px-4 py-3 rounded-xl bg-white/[0.05] border border-white/10 group cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:U,onChange:K=>L(K.target.checked),className:"w-4 h-4 rounded border-white/20 bg-transparent"}),l.jsx("span",{className:"text-[10px] text-gray-400 uppercase tracking-widest group-hover:text-white transition-colors",children:"Rotating pool"})]}),U&&l.jsx("input",{type:"number",placeholder:"Estimated size (optional)",value:I,onChange:K=>V(K.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-3 text-[10px] text-white","aria-label":"Estimated pool size",min:"1"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("button",{onClick:Ie,disabled:f||!_.trim(),className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-white text-black hover:scale-105 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[f&&l.jsx("div",{className:"w-3 h-3 border-2 border-black/20 border-t-black rounded-full animate-spin"}),"Add Proxy"]}),l.jsx("button",{onClick:()=>Ke.current?.click(),className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest border border-white/10 text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:"Import"}),l.jsx("button",{onClick:()=>w("host"),className:`px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest border border-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 ${c?"text-white hover:bg-white/5":"bg-white/10 text-white"}`,children:"Use Host IP"})]}),(he.size>0||xe.length>0)&&l.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-2xl bg-white/[0.02] border border-white/5",children:[l.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[l.jsx("input",{type:"checkbox",checked:re,onChange:B,disabled:xe.length===0,className:"w-4 h-4 rounded border-white/20 bg-transparent disabled:opacity-50"}),l.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest group-hover:text-white transition-colors",children:he.size>0?`${he.size} Selected`:"Select All"})]}),he.size>0&&l.jsxs("button",{onClick:J,className:"px-4 py-2 rounded-xl bg-red-500/10 border border-red-500/20 text-[9px] font-bold uppercase tracking-widest text-red-400 hover:bg-red-500/20 transition-all inline-flex items-center gap-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsx(ue,{name:"delete",className:"text-base"}),"Delete Selected"]})]}),l.jsx("input",{ref:Ke,type:"file",accept:".txt,text/plain",onChange:ne,className:"hidden"}),te&&l.jsx("div",{className:"text-[9px] text-red-400 uppercase tracking-widest",children:te}),l.jsxs("label",{className:"flex items-center justify-between gap-3 p-3.5 rounded-2xl bg-white/[0.02] border border-white/5 hover:bg-white/[0.05] transition-all group",children:[l.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest group-hover:text-white",children:"Rotation mode"}),l.jsxs("select",{value:u,onChange:K=>y(K.target.value==="random"?"random":"round-robin"),className:"bg-white/[0.05] border border-white/10 rounded-xl px-3 py-2 text-[10px] text-white uppercase tracking-widest","aria-label":"Rotation mode",children:[l.jsx("option",{value:"round-robin",children:"Round robin"}),l.jsx("option",{value:"random",children:"Random"})]})]}),l.jsxs("label",{className:"flex items-center gap-3 p-3.5 rounded-2xl bg-white/[0.02] border border-white/5 hover:bg-white/[0.05] transition-all cursor-pointer group",children:[l.jsx("input",{type:"checkbox",checked:r,onChange:K=>k(K.target.checked),className:"w-4 h-4 rounded border-white/20 bg-transparent"}),l.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest group-hover:text-white",children:"Include default IP in rotation pool"})]}),l.jsxs("div",{className:"space-y-3",children:[f&&l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"Loading proxies..."}),!f&&i.length===0&&l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"No proxies saved yet."}),!f&&i.map(K=>{const ve=K.id===c,_e=K.id===de;return l.jsx("div",{className:"flex items-center justify-between gap-4 p-4 rounded-2xl border border-white/10 bg-white/[0.02]",children:_e?l.jsxs("div",{className:"w-full space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[l.jsx("input",{type:"text",value:H,onChange:Se=>F(Se.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-2 text-[10px] text-white",placeholder:"Proxy server","aria-label":"Proxy server"}),l.jsx("input",{type:"text",value:Z,onChange:Se=>X(Se.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-2 text-[10px] text-white",placeholder:"Label","aria-label":"Label"}),l.jsx("input",{type:"text",value:z,onChange:Se=>se(Se.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-2 text-[10px] text-white",placeholder:"Username","aria-label":"Username"}),l.jsx("input",{type:"password",value:$,onChange:Se=>P(Se.target.value),placeholder:"Password (leave blank to keep)",className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-2 text-[10px] text-white","aria-label":"Password"}),l.jsxs("label",{className:"flex items-center gap-3 px-4 py-2 rounded-xl bg-white/[0.05] border border-white/10 group cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:ge,onChange:Se=>R(Se.target.checked),className:"w-3.5 h-3.5 rounded border-white/20 bg-transparent"}),l.jsx("span",{className:"text-[10px] text-gray-400 uppercase tracking-widest group-hover:text-white transition-colors",children:"Rotating pool"})]}),ge&&l.jsx("input",{type:"number",placeholder:"Estimated size",value:D,onChange:Se=>W(Se.target.value),className:"bg-white/[0.05] border border-white/10 rounded-xl px-4 py-2 text-[10px] text-white","aria-label":"Estimated pool size",min:"1"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:N,className:"px-3 py-2 rounded-xl border border-white/10 text-[9px] font-bold uppercase tracking-widest text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Save proxy changes","aria-label":"Save proxy changes",children:"Save"}),l.jsx("button",{onClick:We,className:"px-3 py-2 rounded-xl border border-white/10 text-[9px] font-bold uppercase tracking-widest text-white/70 hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Cancel editing","aria-label":"Cancel editing",children:"Cancel"})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex items-center gap-4 border-r border-white/10 pr-4 w-12 justify-center",children:K.id!=="host"?l.jsx("input",{type:"checkbox",checked:he.has(K.id),onChange:()=>{},onClick:Se=>{Se.stopPropagation(),q(K.id,Se)},className:"w-4 h-4 rounded border-white/20 bg-transparent"}):l.jsx("div",{title:"Host IP (Cannot be deleted)",className:"flex items-center justify-center opacity-70",children:l.jsx(ue,{name:"computer",className:"text-lg text-white"})})}),l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsx("div",{className:"text-[10px] font-bold text-white uppercase tracking-widest",children:K.label||K.server}),l.jsxs("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest flex items-center gap-2",children:[l.jsx("span",{children:K.server}),K.isRotatingPool&&l.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-white/10 text-white font-bold inline-flex items-center gap-1",children:[l.jsx(ue,{name:"autorenew",className:"text-[10px]"}),"Pool",K.estimatedPoolSize?`(~${K.estimatedPoolSize})`:""]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>w(K.id),className:`px-3 py-2 rounded-xl border text-[9px] font-bold uppercase tracking-widest transition-all inline-flex items-center gap-2 focus:outline-none focus-visible:ring-2 ${ve?"bg-white text-black border-white focus-visible:ring-blue-500":"border-white/10 text-white hover:bg-white/5 focus-visible:ring-white/50"}`,title:ve?"Current default proxy":"Set as default proxy","aria-label":ve?"Current default proxy":"Set as default proxy",children:[ve?l.jsx(ue,{name:"star",className:"text-base"}):l.jsx(ue,{name:"star_outline",className:"text-base"}),ve?"Default":"Set Default"]}),K.id!=="host"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>nt(K),className:"px-3 py-2 rounded-xl border border-white/10 text-[9px] font-bold uppercase tracking-widest text-white hover:bg-white/5 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Edit proxy","aria-label":"Edit proxy",children:"Edit"}),l.jsxs("button",{onClick:()=>g(K.id),className:"px-3 py-2 rounded-xl border border-red-500/20 text-[9px] font-bold uppercase tracking-widest text-red-300 hover:bg-red-500/10 transition-all inline-flex items-center gap-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Delete proxy","aria-label":"Delete proxy",children:[l.jsx(ue,{name:"delete",className:"text-base"}),"Delete"]})]})]})]})},K.id)})]})]})},zy=({selection:i,options:c,loading:r,onChange:u})=>l.jsxs("div",{className:"glass-card p-8 rounded-[40px] space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"User Agent"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:"Default browser identity"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"user-agent-select",className:"sr-only",children:"Select Default User Agent"}),l.jsxs("select",{id:"user-agent-select",value:i,onChange:f=>u(f.target.value),disabled:r,className:"w-full bg-white/[0.05] border border-white/10 rounded-xl px-4 py-3 text-[10px] text-white uppercase tracking-widest disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsx("option",{value:"system",children:"System user agent (default)"}),c.map(f=>l.jsx("option",{value:f,children:f},f))]}),l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"Applies when rotate UA is disabled in tasks."})]})]}),Ry=({version:i})=>{const[c,r]=E.useState(!1),u=i?`v${i}`:"Unknown",f=async()=>{const d=i||u;try{if(typeof navigator<"u"&&navigator.clipboard&&typeof window<"u"&&window.isSecureContext)await navigator.clipboard.writeText(d);else if(typeof document<"u"){const p=document.createElement("textarea");p.value=d,p.style.position="fixed",p.style.opacity="0",document.body.appendChild(p),p.select(),document.execCommand("copy"),document.body.removeChild(p)}r(!0),setTimeout(()=>r(!1),1500)}catch{r(!1)}};return l.jsxs("div",{className:"glass-card p-8 rounded-[40px] space-y-6",children:[l.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[l.jsx("div",{className:"w-10 h-10 rounded-2xl bg-white/5 flex items-center justify-center text-gray-400",children:l.jsx(ue,{name:"content_copy",className:"text-xl"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Version"}),l.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest mt-1",children:"Package metadata"})]})]}),l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsx("div",{className:"text-[9px] font-bold uppercase tracking-[0.3em] text-white",children:u}),l.jsx("button",{onClick:f,className:"px-4 py-2 rounded-xl border border-white/10 text-[9px] font-bold uppercase tracking-widest text-white hover:bg-white/5 transition-all",type:"button",children:c?"Copied":"Copy version"})]})]})},Oy="0.12.1",Dy={version:Oy},Qc=Dy.version,Ty={gemini:["gemini-3-flash-preview","gemini-2.5-flash-preview-05-20","gemini-2.5-pro-preview-05-06","gemini-2.0-flash","gemini-2.0-flash-lite","gemini-1.5-flash"],openai:["gpt-5-nano","gpt-4.5-nano","gpt-4o-mini","gpt-4o","gpt-4.1-nano","gpt-4.1-mini","gpt-4.1"],claude:["claude-haiku-4-6","claude-haiku-4-5-20251001","claude-3-5-haiku-20241022","claude-sonnet-4-5","claude-opus-4-5"],ollama:["llama3.2","llama3.1","llama3","gemma3","gemma4:e2b","mistral","codellama","qwen2.5"]},My=[{key:"gemini",label:"Gemini",iconUrl:"https://www.google.com/s2/favicons?domain=gemini.google.com&sz=128"},{key:"openai",label:"OpenAI",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/openai.svg"},{key:"claude",label:"Anthropic",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/claude.svg"},{key:"ollama",label:"Ollama",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/ollama.svg"}],Uy=({providerKey:i,label:c,iconUrl:r,value:u,saving:f,loading:d,onSave:h})=>{const[p,x]=E.useState(!1),[g,C]=E.useState(u),w=()=>{C(u),x(!0)},k=()=>{x(!1),C(u)},y=async()=>{await h(g.trim()||u),x(!1)};return l.jsxs("div",{className:"flex flex-col gap-3 py-4 border-b border-white/5 last:border-0",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center overflow-hidden shrink-0",children:l.jsx("img",{src:r,alt:c,className:"w-6 h-6 object-contain"})}),l.jsx("div",{className:"flex-1",children:l.jsx("h4",{className:"text-sm font-bold text-white uppercase tracking-widest",children:c})})]}),p?l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex-1 rounded-2xl bg-black/40 border border-white/30 focus-within:border-white px-4 py-3 transition-all",children:[l.jsx("input",{list:`model-list-${i}`,value:g,onChange:_=>C(_.target.value),onKeyDown:_=>{_.key==="Enter"&&y(),_.key==="Escape"&&k()},className:"w-full bg-transparent text-[10px] text-white font-mono focus:outline-none",autoFocus:!0}),l.jsx("datalist",{id:`model-list-${i}`,children:Ty[i].map(_=>l.jsx("option",{value:_},_))})]}),l.jsx("button",{onClick:k,disabled:f,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest border border-white/20 text-white hover:bg-white/10 transition-all disabled:opacity-50",children:"Cancel"}),l.jsxs("button",{onClick:y,disabled:f||!g.trim(),className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-blue-500 text-white hover:bg-blue-400 transition-all disabled:opacity-50 flex items-center gap-2",children:[l.jsx(ue,{name:"save",className:"text-base"}),f?"Saving…":"Save"]})]}):l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"flex-1 rounded-2xl bg-black/40 border border-white/10 px-4 py-3 font-mono text-[10px] text-blue-200/80 min-h-[44px] flex items-center",children:d?l.jsx("span",{className:"opacity-50",children:"Loading…"}):l.jsx("span",{children:u})}),l.jsxs("button",{onClick:w,disabled:d||f,className:"px-6 py-3 rounded-2xl text-[9px] font-bold uppercase tracking-widest bg-white/10 text-white hover:bg-white/20 transition-all disabled:opacity-50 flex items-center gap-2",children:[l.jsx(ue,{name:"edit",className:"text-base"}),"Edit"]})]})]})},Ly=({models:i,loading:c,saving:r,onSave:u})=>l.jsxs("div",{className:"glass-card p-8 rounded-[40px]",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-lg font-bold text-white uppercase tracking-widest",children:"AI Models"}),l.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-widest mt-1",children:"Preferred model for each AI provider"})]}),l.jsx("div",{className:"flex flex-col",children:My.map(f=>l.jsx(Uy,{providerKey:f.key,label:f.label,iconUrl:f.iconUrl,value:i[f.key],loading:c,saving:r,onSave:d=>u(f.key,d)},f.key))})]}),By=({onClearStorage:i,onConfirm:c,onNotify:r})=>{const[u,f]=E.useState("system"),[d,h]=E.useState([]),[p,x]=E.useState(!1),[g,C]=E.useState([]),[w,k]=E.useState([]),[y,_]=E.useState([]),[m,b]=E.useState([]),[j,S]=E.useState(!1),[A,M]=E.useState(null),[O,U]=E.useState(!0),[L,I]=E.useState(!1),[V,de]=E.useState([]),[ae,H]=E.useState(!0),[F,z]=E.useState(!1),[se,$]=E.useState([]),[P,Z]=E.useState(!0),[X,ge]=E.useState(!1),[R,D]=E.useState([]),[W,te]=E.useState(!0),[Y,he]=E.useState(!1),[ke,Ae]=E.useState([]),[Oe,Ke]=E.useState(!0),[Ie,nt]=E.useState(!1),[We,N]=E.useState({gemini:"gemini-3-flash-preview",openai:"gpt-5-nano",claude:"claude-haiku-4-6",ollama:"llama3.2"}),[me,ne]=E.useState(!1),[q,B]=E.useState(!1),[J,xe]=E.useState([]),[re,K]=E.useState(null),[ve,_e]=E.useState(!1),[Se,ze]=E.useState("round-robin"),[Ve,De]=E.useState(!1),[pt,be]=E.useState("system"),[we,Re]=E.useState([]),[Ue,Be]=E.useState(!1),qe=E.useCallback(async()=>{S(!0);try{const[ce,pe]=await Promise.all([fetch("/api/data/captures"),fetch("/api/data/cookies")]),Ce=ce.ok?await ce.json():{captures:[]},Ee=pe.ok?await pe.json():{cookies:[],origins:[]};k(Array.isArray(Ce.captures)?Ce.captures:[]),_(Array.isArray(Ee.cookies)?Ee.cookies:[]),b(Array.isArray(Ee.origins)?Ee.origins:[])}catch{k([]),_([]),b([])}finally{S(!1)}},[]),Me=E.useCallback(async()=>{x(!0);try{const ce=await fetch("/api/credentials");ce.ok&&h(await ce.json())}catch{h([])}finally{x(!1)}},[]),Fe=E.useCallback(async ce=>{await fetch(`/api/credentials/${ce}`,{method:"DELETE"}),h(pe=>pe.filter(Ce=>Ce.id!==ce))},[]),rt=E.useCallback(async ce=>{if(!await c(`Delete capture ${ce}?`))return;(await fetch(`/api/data/captures/${encodeURIComponent(ce)}`,{method:"DELETE"})).ok?(r("Capture deleted.","success"),qe()):r("Delete failed.","error")},[c,r,qe]),pa=E.useCallback(async ce=>{if(!await c(`Delete cookie ${ce.name}?`))return;(await fetch("/api/data/cookies/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ce.name,domain:ce.domain,path:ce.path})})).ok?(r("Cookie deleted.","success"),qe()):r("Delete failed.","error")},[c,r,qe]),ma=async()=>{U(!0);try{const ce=await fetch("/api/settings/api-key",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),M(null);return}const pe=await ce.json();M(pe.apiKey||null)}catch{M(null)}finally{U(!1)}},va=async()=>{H(!0);try{const ce=await fetch("/api/settings/gemini-api-key",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),de([]);return}const pe=await ce.json();de(Array.isArray(pe.geminiApiKeys)?pe.geminiApiKeys:[])}catch{de([])}finally{H(!1)}},Qt=async()=>{Z(!0);try{const ce=await fetch("/api/settings/openai-api-key",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),$([]);return}const pe=await ce.json();$(Array.isArray(pe.openAiApiKeys)?pe.openAiApiKeys:[])}catch{$([])}finally{Z(!1)}},qt=async()=>{te(!0);try{const ce=await fetch("/api/settings/claude-api-key",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),D([]);return}const pe=await ce.json();D(Array.isArray(pe.claudeApiKeys)?pe.claudeApiKeys:[])}catch{D([])}finally{te(!1)}},jn=async()=>{De(!0);try{const ce=await fetch("/api/settings/proxies",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),xe([]),K(null),ze("round-robin");return}const pe=await ce.json();xe(Array.isArray(pe.proxies)?pe.proxies:[]),K(pe.defaultProxyId||null),_e(!!pe.includeDefaultInRotation),ze(pe.rotationMode==="random"?"random":"round-robin")}catch{xe([]),K(null),_e(!1),ze("round-robin")}finally{De(!1)}},Sn=async ce=>{De(!0);try{const pe=await fetch("/api/settings/proxies",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(ce)});if(!pe.ok){let Ee="";try{const at=await pe.json();Ee=at?.error||at?.message||""}catch{Ee=""}r(`Failed to add proxy${Ee?`: ${Ee}`:""}.`,"error");return}const Ce=await pe.json();xe(Array.isArray(Ce.proxies)?Ce.proxies:[]),K(Ce.defaultProxyId||null),_e(!!Ce.includeDefaultInRotation),ze(Ce.rotationMode==="random"?"random":"round-robin"),r("Proxy added.","success")}catch{r("Failed to add proxy.","error")}finally{De(!1)}},gr=async()=>{Be(!0);try{const ce=await fetch("/api/settings/user-agent",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),be("system"),Re([]);return}const pe=await ce.json();be(pe.selection==="system"?"system":String(pe.selection||"system")),Re(Array.isArray(pe.userAgents)?pe.userAgents:[])}catch{be("system"),Re([])}finally{Be(!1)}},Oi=async ce=>{Be(!0);try{const pe=await fetch("/api/settings/user-agent",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({selection:ce})});if(!pe.ok){r("Failed to update user agent.","error");return}const Ce=await pe.json();be(Ce.selection==="system"?"system":String(Ce.selection||"system")),Re(Array.isArray(Ce.userAgents)?Ce.userAgents:[]),r("User agent updated.","success")}catch{r("Failed to update user agent.","error")}finally{Be(!1)}},Ol=async ce=>{if(!ce.length){r("No valid proxies found in file.","error");return}De(!0);try{const pe=await fetch("/api/settings/proxies/import",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({proxies:ce})});if(!pe.ok){let Ee="";try{const at=await pe.json();Ee=at?.error||at?.message||""}catch{Ee=""}r(`Failed to import proxies${Ee?`: ${Ee}`:""}.`,"error");return}const Ce=await pe.json();xe(Array.isArray(Ce.proxies)?Ce.proxies:[]),K(Ce.defaultProxyId||null),_e(!!Ce.includeDefaultInRotation),ze(Ce.rotationMode==="random"?"random":"round-robin"),r("Proxies imported.","success")}catch{r("Failed to import proxies.","error")}finally{De(!1)}},Nn=async(ce,pe)=>{De(!0);try{const Ce=await fetch(`/api/settings/proxies/${encodeURIComponent(ce)}`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(pe)});if(!Ce.ok){let at="";try{const Ht=await Ce.json();at=Ht?.error||Ht?.message||""}catch{at=""}r(`Failed to update proxy${at?`: ${at}`:""}.`,"error");return}const Ee=await Ce.json();xe(Array.isArray(Ee.proxies)?Ee.proxies:[]),K(Ee.defaultProxyId||null),_e(!!Ee.includeDefaultInRotation),ze(Ee.rotationMode==="random"?"random":"round-robin"),r("Proxy updated.","success")}catch{r("Failed to update proxy.","error")}finally{De(!1)}},br=async ce=>{if(!(ce==="host"||!await c("Delete this proxy?"))){De(!0);try{const Ce=await fetch(`/api/settings/proxies/${encodeURIComponent(ce)}`,{method:"DELETE",credentials:"include"});if(!Ce.ok){r("Delete failed.","error");return}const Ee=await Ce.json();xe(Array.isArray(Ee.proxies)?Ee.proxies:[]),K(Ee.defaultProxyId||null),_e(!!Ee.includeDefaultInRotation),ze(Ee.rotationMode==="random"?"random":"round-robin"),r("Proxy deleted.","success")}catch{r("Delete failed.","error")}finally{De(!1)}}},Di=async ce=>{if(!(ce.length===0||!await c(`Delete ${ce.length} proxies?`))){De(!0);try{const Ce=await fetch("/api/settings/proxies",{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ids:ce})});if(!Ce.ok){r("Bulk delete failed.","error");return}const Ee=await Ce.json();xe(Array.isArray(Ee.proxies)?Ee.proxies:[]),K(Ee.defaultProxyId||null),_e(!!Ee.includeDefaultInRotation),ze(Ee.rotationMode==="random"?"random":"round-robin"),r(`${ce.length} proxies deleted.`,"success")}catch{r("Bulk delete failed.","error")}finally{De(!1)}}},Ti=async ce=>{const pe=ce==="host"?null:ce;De(!0);try{const Ce=await fetch("/api/settings/proxies/default",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:pe})});if(!Ce.ok){r("Failed to set default.","error");return}const Ee=await Ce.json();xe(Array.isArray(Ee.proxies)?Ee.proxies:[]),K(Ee.defaultProxyId||null),_e(!!Ee.includeDefaultInRotation),ze(Ee.rotationMode==="random"?"random":"round-robin"),r("Default proxy updated.","success")}catch{r("Failed to set default.","error")}finally{De(!1)}},Mi=async ce=>{De(!0);try{const pe=await fetch("/api/settings/proxies/rotation",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({includeDefaultInRotation:ce})});if(!pe.ok){r("Failed to update rotation setting.","error");return}const Ce=await pe.json();xe(Array.isArray(Ce.proxies)?Ce.proxies:[]),K(Ce.defaultProxyId||null),_e(!!Ce.includeDefaultInRotation),ze(Ce.rotationMode==="random"?"random":"round-robin"),r("Rotation setting updated.","success")}catch{r("Failed to update rotation setting.","error")}finally{De(!1)}},Dl=async ce=>{De(!0);try{const pe=await fetch("/api/settings/proxies/rotation",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({rotationMode:ce})});if(!pe.ok){r("Failed to update rotation mode.","error");return}const Ce=await pe.json();xe(Array.isArray(Ce.proxies)?Ce.proxies:[]),K(Ce.defaultProxyId||null),_e(!!Ce.includeDefaultInRotation),ze(Ce.rotationMode==="random"?"random":"round-robin"),r("Rotation mode updated.","success")}catch{r("Failed to update rotation mode.","error")}finally{De(!1)}},Tl=async()=>{I(!0);try{const ce=await fetch("/api/settings/api-key",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!ce.ok){let Ce="";try{const Ee=await ce.json();Ce=Ee?.error||Ee?.message||""}catch{Ce=""}ce.status===401?r("Session expired. Please log in again.","error"):r(`Failed to generate API key${Ce?`: ${Ce}`:""}.`,"error");return}const pe=await ce.json();M(pe.apiKey||null),r("API key generated.","success")}catch{r("Failed to generate API key.","error")}finally{I(!1)}},Zn=async ce=>{z(!0);try{const pe=await fetch("/api/settings/gemini-api-key",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({geminiApiKeys:ce})});if(!pe.ok){pe.status===401?r("Session expired. Please log in again.","error"):r("Failed to save Gemini API keys.","error");return}const Ce=await pe.json();de(Array.isArray(Ce.geminiApiKeys)?Ce.geminiApiKeys:[]),r("Gemini API keys saved.","success")}catch{r("Failed to save Gemini API keys.","error")}finally{z(!1)}},$n=async ce=>{ge(!0);try{const pe=await fetch("/api/settings/openai-api-key",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({openAiApiKeys:ce})});if(!pe.ok){pe.status===401?r("Session expired. Please log in again.","error"):r("Failed to save OpenAI API keys.","error");return}const Ce=await pe.json();$(Array.isArray(Ce.openAiApiKeys)?Ce.openAiApiKeys:[]),r("OpenAI API keys saved.","success")}catch{r("Failed to save OpenAI API keys.","error")}finally{ge(!1)}},xa=async()=>{Ke(!0);try{const ce=await fetch("/api/settings/ollama-api-key",{credentials:"include"});if(!ce.ok){ce.status===401&&r("Session expired. Please log in again.","error"),Ae([]);return}const pe=await ce.json();Ae(Array.isArray(pe.ollamaApiKeys)?pe.ollamaApiKeys:[])}catch{Ae([])}finally{Ke(!1)}},wt=async ce=>{nt(!0);try{const pe=await fetch("/api/settings/ollama-api-key",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ollamaApiKeys:ce})});if(!pe.ok){pe.status===401?r("Session expired. Please log in again.","error"):r("Failed to save Ollama settings.","error");return}const Ce=await pe.json();Ae(Array.isArray(Ce.ollamaApiKeys)?Ce.ollamaApiKeys:[]),r("Ollama settings saved.","success")}catch{r("Failed to save Ollama settings.","error")}finally{nt(!1)}},Rt=async ce=>{he(!0);try{const pe=await fetch("/api/settings/claude-api-key",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({claudeApiKeys:ce})});if(!pe.ok){pe.status===401?r("Session expired. Please log in again.","error"):r("Failed to save Claude API keys.","error");return}const Ce=await pe.json();D(Array.isArray(Ce.claudeApiKeys)?Ce.claudeApiKeys:[]),r("Claude API keys saved.","success")}catch{r("Failed to save Claude API keys.","error")}finally{he(!1)}},Ea=E.useCallback(async()=>{ne(!0);try{const ce=await fetch("/api/settings/ai-models",{credentials:"include"});ce.ok&&N(await ce.json())}catch{}finally{ne(!1)}},[]),Ml=E.useCallback(async(ce,pe)=>{B(!0);try{const Ce={...We,[ce]:pe},Ee=await fetch("/api/settings/ai-models",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(Ce)});Ee.ok?(N(await Ee.json()),r("Model saved.","success")):r("Failed to save model.","error")}catch{r("Failed to save model.","error")}finally{B(!1)}},[We,r]);E.useEffect(()=>{u==="data"&&qe(),u==="system"&&(ma(),va(),Qt(),qt(),xa(),gr(),Me(),Ea()),u==="proxies"&&jn()},[u]),E.useEffect(()=>{u==="system"&&(ma(),va(),Qt(),qt(),xa(),Me(),Ea())},[]);const yr=[{id:"gemini_api_key",name:"Gemini API Key",iconUrl:"https://www.google.com/s2/favicons?domain=gemini.google.com&sz=128",disabled:!1},{id:"anthropic_api_key",name:"Anthropic API Key",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/claude.svg",disabled:!1},{id:"openai_api_key",name:"OpenAI API Key",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/openai.svg",disabled:!1},{id:"ollama_api_key",name:"Ollama API Key",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/ollama.svg",disabled:!1}],vr=[{providerKey:"baserow",name:"Baserow",iconUrl:"https://www.google.com/s2/favicons?domain=baserow.io&sz=128"}],Ui=async ce=>{try{const pe=await fetch("/api/credentials",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(ce)});if(!pe.ok){const Ee=await pe.json().catch(()=>({}));return console.error("[handleAddDbCredential] API error",pe.status,Ee),!1}const Ce=await pe.json();return h(Ee=>[...Ee,Ce]),r("Credential saved.","success"),!0}catch(pe){return console.error("[handleAddDbCredential] fetch error:",pe),!1}},Bt=[{id:"doppelganger_api_key",name:"Tasks API",description:"Manage task API access via `x-api-key` header",icon:"database",value:A,saving:L,loading:O,showCopyButton:!0,readOnly:!0,onSave:async()=>{},onRegenerate:async()=>{await Tl()}}];V.filter(ce=>ce&&ce.trim()).forEach((ce,pe)=>{Bt.push({id:`gemini_api_key_${pe}`,name:"Gemini API Key",description:"Provide an API Key from Google AI Studio for AI features",iconUrl:"https://www.google.com/s2/favicons?domain=gemini.google.com&sz=128",value:ce,saving:F,loading:ae,badge:pe===0?"Primary":"Backup",onSave:async Ce=>{const Ee=[...V];Ee[pe]=Ce,await Zn(Ee)},onDelete:async()=>{const Ce=V.filter((Ee,at)=>at!==pe);await Zn(Ce)}})}),se.filter(ce=>ce&&ce.trim()).forEach((ce,pe)=>{Bt.push({id:`openai_api_key_${pe}`,name:"OpenAI API Key",description:"Provide an API Key from OpenAI for AI features",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/openai.svg",value:ce,saving:X,loading:P,badge:pe===0?"Primary":"Backup",onSave:async Ce=>{const Ee=[...se];Ee[pe]=Ce,await $n(Ee)},onDelete:async()=>{const Ce=se.filter((Ee,at)=>at!==pe);await $n(Ce)}})}),R.filter(ce=>ce&&ce.trim()).forEach((ce,pe)=>{Bt.push({id:`anthropic_api_key_${pe}`,name:"Anthropic API Key",description:"Provide an API Key from Anthropic for AI features",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/claude.svg",value:ce,saving:Y,loading:W,badge:pe===0?"Primary":"Backup",onSave:async Ce=>{const Ee=[...R];Ee[pe]=Ce,await Rt(Ee)},onDelete:async()=>{const Ce=R.filter((Ee,at)=>at!==pe);await Rt(Ce)}})});const kn=g.filter(ce=>ce==="gemini_api_key").length;for(let ce=0;ce<kn;ce++)Bt.push({id:`gemini_api_key_unsaved_${ce}`,name:"Gemini API Key",description:"Provide an API Key from Google AI Studio for AI features",iconUrl:"https://www.google.com/s2/favicons?domain=gemini.google.com&sz=128",value:null,saving:F,loading:ae,startEditing:!0,onSave:async pe=>{const Ce=[...V,pe];await Zn(Ce),C(Ee=>{const at=Ee.indexOf("gemini_api_key");if(at!==-1){const Ht=[...Ee];return Ht.splice(at,1),Ht}return Ee})},onDelete:async()=>{C(pe=>{const Ce=pe.indexOf("gemini_api_key");if(Ce!==-1){const Ee=[...pe];return Ee.splice(Ce,1),Ee}return pe})}});const Qa=g.filter(ce=>ce==="openai_api_key").length;for(let ce=0;ce<Qa;ce++)Bt.push({id:`openai_api_key_unsaved_${ce}`,name:"OpenAI API Key",description:"Provide an API Key from OpenAI for AI features",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/openai.svg",value:null,saving:X,loading:P,startEditing:!0,onSave:async pe=>{const Ce=[...se,pe];await $n(Ce),C(Ee=>{const at=Ee.indexOf("openai_api_key");if(at!==-1){const Ht=[...Ee];return Ht.splice(at,1),Ht}return Ee})},onDelete:async()=>{C(pe=>{const Ce=pe.indexOf("openai_api_key");if(Ce!==-1){const Ee=[...pe];return Ee.splice(Ce,1),Ee}return pe})}});const Nt=g.filter(ce=>ce==="anthropic_api_key").length;for(let ce=0;ce<Nt;ce++)Bt.push({id:`anthropic_api_key_unsaved_${ce}`,name:"Anthropic API Key",description:"Provide an API Key from Anthropic for AI features",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/claude.svg",value:null,saving:Y,loading:W,startEditing:!0,onSave:async pe=>{const Ce=[...R,pe];await Rt(Ce),C(Ee=>{const at=Ee.indexOf("anthropic_api_key");if(at!==-1){const Ht=[...Ee];return Ht.splice(at,1),Ht}return Ee})},onDelete:async()=>{C(pe=>{const Ce=pe.indexOf("anthropic_api_key");if(Ce!==-1){const Ee=[...pe];return Ee.splice(Ce,1),Ee}return pe})}});ke.filter(ce=>ce&&ce.trim()).forEach((ce,pe)=>{Bt.push({id:`ollama_api_key_${pe}`,name:"Ollama",description:"Local Ollama instance base URL",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/ollama.svg",value:ce,saving:Ie,loading:Oe,badge:pe===0?"Primary":"Backup",urlModel:!0,onSave:async Ce=>{const Ee=[...ke];Ee[pe]=Ce,await wt(Ee)},onDelete:async()=>{const Ce=ke.filter((Ee,at)=>at!==pe);await wt(Ce)}})});const Bi=g.filter(ce=>ce==="ollama_api_key").length;for(let ce=0;ce<Bi;ce++)Bt.push({id:`ollama_api_key_unsaved_${ce}`,name:"Ollama",description:"Local Ollama instance base URL",iconUrl:"https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/ollama.svg",value:null,saving:Ie,loading:Oe,startEditing:!0,urlModel:!0,onSave:async pe=>{const Ce=[...ke,pe];await wt(Ce),C(Ee=>{const at=Ee.indexOf("ollama_api_key");if(at!==-1){const Ht=[...Ee];return Ht.splice(at,1),Ht}return Ee})},onDelete:async()=>{C(pe=>{const Ce=pe.indexOf("ollama_api_key");if(Ce!==-1){const Ee=[...pe];return Ee.splice(Ce,1),Ee}return pe})}});return d.forEach(ce=>{Bt.push({id:`db_cred_${ce.id}`,name:ce.name,description:`${ce.provider} · ${ce.config.baseUrl}`,iconUrl:"https://www.google.com/s2/favicons?domain=baserow.io&sz=128",value:ce.config.token||null,saving:!1,loading:p,onSave:async()=>{},readOnly:!0,onDelete:async()=>{(c?await c(`Delete credential "${ce.name}"?`):confirm(`Delete credential "${ce.name}"?`))&&await Fe(ce.id)}})}),l.jsx("main",{className:"flex-1 p-12 overflow-y-auto custom-scrollbar animate-in fade-in duration-500",children:l.jsxs("div",{className:"max-w-3xl mx-auto space-y-8",children:[l.jsx(Ey,{tab:u,onTabChange:f}),u==="system"&&l.jsxs(l.Fragment,{children:[l.jsx(yy,{keys:Bt,availableProviders:yr,onAddProvider:ce=>C(pe=>[...pe,ce]),dbProviders:vr,onAddDbCredential:Ui,onConfirm:c}),l.jsx(Ly,{models:We,loading:me,saving:q,onSave:Ml}),l.jsx(zy,{selection:pt,options:we,loading:Ue,onChange:Oi}),l.jsx(Ry,{version:Qc}),l.jsx(vy,{onClearStorage:i})]}),u==="data"&&l.jsxs(l.Fragment,{children:[l.jsx(_y,{captures:w,loading:j,onRefresh:qe,onDelete:rt}),l.jsx(ky,{cookies:y,originsCount:m.length,loading:j,onClear:()=>i("cookies"),onDelete:pa})]}),u==="proxies"&&l.jsx(Ay,{proxies:J,defaultProxyId:re,includeDefaultInRotation:ve,rotationMode:Se,loading:Ve,onRefresh:jn,onAdd:Sn,onImport:Ol,onUpdate:Nn,onDelete:br,onDeleteMultiple:Di,onSetDefault:Ti,onToggleIncludeDefault:Mi,onRotationModeChange:Dl}),l.jsx("div",{className:"pt-8 flex justify-center border-t border-white/5 mt-8",children:l.jsx(gy,{})})]})})},Fc=({title:i="Loading",subtitle:c})=>l.jsxs("div",{className:"fixed inset-0 z-[80] bg-[#020202] flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",style:{backgroundImage:"radial-gradient(#fff 1px, transparent 1px)",backgroundSize:"40px 40px"}}),l.jsxs("div",{className:"glass-card p-10 rounded-[40px] text-center space-y-4",children:[l.jsx("div",{className:"w-12 h-12 mx-auto rounded-full border border-white/10 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-white/20 border-t-white rounded-full animate-spin"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.4em] text-gray-500",children:i}),c&&l.jsx("p",{className:"text-xs font-mono text-white/80",children:c})]})]})]}),sr=140,Hy=6,Yy=4,qy=({index:i,style:c,data:r})=>{const u=r.items[i];return u?l.jsxs("div",{style:c,onClick:()=>r.navigate(`/executions/${u.id}`),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),r.navigate(`/executions/${u.id}`))},role:"button",tabIndex:0,className:"glass-card w-full rounded-2xl p-5 flex items-center gap-4 text-left hover:bg-white/[0.06] transition-all cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:[l.jsx("div",{className:"w-10 h-10 rounded-2xl bg-white/5 flex items-center justify-center text-gray-400",children:u.source==="api"?l.jsx(ue,{name:"cloud",className:"text-xl"}):l.jsx(ue,{name:"monitor",className:"text-xl"})}),l.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[l.jsx("div",{className:"text-[10px] font-bold text-white uppercase tracking-widest truncate",children:u.taskName||u.mode}),l.jsxs("div",{className:"text-[8px] text-gray-500 uppercase tracking-[0.2em]",children:[new Date(u.timestamp).toLocaleString()," | ",u.source," | ",u.mode," | ",u.status," | ",u.durationMs,"ms"]}),u.url&&l.jsx("div",{className:"text-[9px] text-white/50 truncate font-mono",children:u.url})]}),l.jsx("button",{onClick:f=>{f.stopPropagation(),r.deleteExecution(u.id)},className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-red-500/5 border border-red-500/10 text-red-400 hover:bg-red-500/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50","aria-label":`Delete execution ${u.id}`,children:"Delete"})]}):null},Ky=({onConfirm:i,onNotify:c})=>{const r=Xn(),[u,f]=E.useState([]),[d,h]=E.useState("all"),[p,x]=E.useState(!1),g=E.useCallback(async()=>{x(!0);try{const _=await fetch("/api/executions");if(!_.ok)throw new Error("Failed to load");const m=await _.json();f(Array.isArray(m.executions)?m.executions:[])}catch{f([])}finally{x(!1)}},[]),C=E.useCallback(async()=>{if(!await i("Clear all executions?"))return;(await fetch("/api/executions/clear",{method:"POST"})).ok?(c("Executions cleared.","success"),g()):c("Clear failed.","error")},[g,i,c]),w=E.useCallback(async _=>{if(!await i("Delete this execution?"))return;(await fetch(`/api/executions/${_}`,{method:"DELETE"})).ok?(c("Execution deleted.","success"),f(j=>j.filter(S=>S.id!==_))):c("Delete failed.","error")},[i,c]);E.useEffect(()=>{g()},[g]);const k=E.useMemo(()=>u.filter(_=>d==="all"?!0:_.source===d),[u,d]),y=E.useMemo(()=>({items:k,deleteExecution:w,navigate:r}),[k,w,r]);return l.jsx("main",{className:"flex-1 p-12 overflow-y-auto custom-scrollbar animate-in fade-in duration-500",children:l.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[l.jsxs("div",{className:"flex items-end justify-between",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("h2",{className:"text-2xl font-medium tracking-[0.25em] text-white uppercase",children:"Run History"})}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{role:"tablist",className:"flex bg-white/5 rounded-xl p-1 border border-white/5",children:["all","editor","api"].map(_=>l.jsx("button",{role:"tab","aria-selected":d===_,onClick:()=>h(_),className:`px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-lg transition-all focus:outline-none focus-visible:ring-2 ${d===_?"bg-white text-black focus-visible:ring-blue-500":"text-gray-500 hover:text-white focus-visible:ring-white/50"}`,children:_},_))}),l.jsx("button",{onClick:g,disabled:p,"aria-busy":p,className:"w-10 h-10 rounded-2xl border border-white/10 text-gray-400 hover:text-white hover:bg-white/5 transition-all flex items-center justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 disabled:opacity-50 disabled:cursor-not-allowed",title:"Refresh","aria-label":"Refresh executions",children:l.jsx(ue,{name:"sync",className:`text-xl ${p?"animate-spin":""}`})}),l.jsx("button",{onClick:C,className:"w-10 h-10 rounded-2xl border border-red-500/20 text-red-400 hover:bg-red-500/10 transition-all flex items-center justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",title:"Clear all","aria-label":"Clear all executions",children:l.jsx(ue,{name:"delete",className:"text-xl"})})]})]}),p&&l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"Loading executions..."}),!p&&k.length===0&&l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"No executions found."}),!p&&k.length>0&&l.jsx(xr,{height:Math.min(Math.max(sr,k.length*sr),sr*Hy),itemCount:k.length,itemSize:sr,width:"100%",overscanCount:Yy,itemData:y,className:"custom-scrollbar",children:qy})]})})};function tm(){const[i,c]=E.useState(null);return E.useEffect(()=>{let r=!1;return(async()=>{try{const f=await fetch("/api/headful/status");if(f.ok){const d=await f.json();r||c(!!d.useNovnc)}else r||c(!1)}catch{r||c(!1)}})(),()=>{r=!0}},[]),i}const Iy=i=>{if(!i.result)return null;const c=i.result||{};return{url:i.url||c.url||"",finalUrl:c.final_url||c.finalUrl,html:c.html,data:c.data??c.html??"",screenshotUrl:c.screenshot_url||c.screenshotUrl,logs:c.logs||[],timestamp:new Date(i.timestamp).toLocaleTimeString()}},Gy=({onConfirm:i,onNotify:c})=>{const{id:r}=Hp(),u=Xn(),[f,d]=E.useState(null),[h,p]=E.useState(!1),x=tm();if(E.useEffect(()=>{(async()=>{if(r){p(!0);try{const w=await fetch(`/api/executions/${r}`);if(!w.ok)throw new Error("Failed to load execution");const k=await w.json();d(k.execution||null)}catch{d(null)}finally{p(!1)}}})()},[r]),h)return l.jsx("main",{className:"flex-1 p-12 overflow-y-auto custom-scrollbar animate-in fade-in duration-500",children:l.jsx("div",{className:"max-w-6xl mx-auto text-[9px] text-gray-500 uppercase tracking-widest",children:"Loading execution..."})});if(!f)return l.jsx("main",{className:"flex-1 p-12 overflow-y-auto custom-scrollbar animate-in fade-in duration-500",children:l.jsxs("div",{className:"max-w-6xl mx-auto space-y-6",children:[l.jsx("button",{onClick:()=>u("/executions"),className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all",children:"Back"}),l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"Execution not found."})]})});const g=Iy(f);return l.jsx("main",{className:"flex-1 p-12 overflow-y-auto custom-scrollbar animate-in fade-in duration-500",children:l.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[l.jsxs("div",{className:"flex items-end justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-3xl font-bold tracking-tighter text-white",children:f.taskName||f.mode}),l.jsxs("div",{className:"text-[8px] text-gray-500 uppercase tracking-[0.2em]",children:[new Date(f.timestamp).toLocaleString()," | ",f.source," | ",f.mode," | ",f.status," | ",f.durationMs,"ms"]})]}),l.jsx("button",{onClick:()=>u("/executions"),className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all",children:"Back"})]}),l.jsxs("div",{className:"glass-card rounded-[32px] p-8 flex flex-col min-h-[420px]",children:[l.jsx("div",{className:"flex items-center justify-between border-b border-white/5 pb-4 mb-6",children:l.jsx("span",{className:"text-[8px] font-bold text-gray-500 uppercase tracking-widest",children:"Output"})}),g?l.jsx(Jp,{results:g,isExecuting:!1,onConfirm:i,onNotify:c,fullWidth:!0,useNovnc:x}):l.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest",children:"No output captured."})]})]})})},Vy=360,am=12,rr=Vy+am,Xy=6,Zy=4,$y=({index:i,style:c,data:r})=>{const u=r.captures[i];return u?l.jsx("div",{style:{...c,paddingBottom:am},children:l.jsx(Fp,{capture:u,onDelete:r.onDelete})}):null},Qy=({onConfirm:i,onNotify:c})=>{const r=Xn(),[u,f]=E.useState([]),[d,h]=E.useState(!1),p=async()=>{h(!0);try{const C=await fetch("/api/data/captures"),w=C.ok?await C.json():{captures:[]};f(Array.isArray(w.captures)?w.captures:[])}catch{f([])}finally{h(!1)}},x=E.useCallback(async C=>{if(!await i(`Delete capture ${C}?`))return;(await fetch(`/api/data/captures/${encodeURIComponent(C)}`,{method:"DELETE"})).ok?(f(y=>y.filter(_=>_.name!==C)),c("Capture deleted.","success")):c("Delete failed.","error")},[i,c]);E.useEffect(()=>{p()},[]);const g=E.useMemo(()=>({captures:u,onDelete:x}),[u,x]);return l.jsx("main",{className:"flex-1 p-12 overflow-y-auto custom-scrollbar animate-in fade-in duration-500",children:l.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[l.jsxs("div",{className:"flex items-end justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-2xl font-medium tracking-[0.25em] text-white uppercase",children:"All Captures"}),l.jsx("div",{className:"text-[8px] text-gray-500 uppercase tracking-[0.2em]",children:"Recordings and screenshots from every run"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:p,disabled:d,"aria-busy":d,className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all disabled:opacity-50 inline-flex items-center gap-2",children:[l.jsx(ue,{name:"sync",className:`text-base ${d?"animate-spin":""}`}),"Refresh"]}),l.jsx("button",{onClick:()=>r("/executions"),className:"px-4 py-2 text-[9px] font-bold uppercase tracking-widest rounded-xl bg-white/5 border border-white/10 text-white hover:bg-white/10 transition-all",children:"Executions"})]})]}),l.jsxs("div",{className:"glass-card rounded-[32px] p-8",children:[d&&l.jsxs("div",{className:"text-[9px] text-gray-500 uppercase tracking-widest flex items-center gap-3",children:[l.jsx(ue,{name:"sync",className:"text-base animate-spin"}),"Loading captures..."]}),!d&&u.length===0&&l.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-widest",children:"No captures found."}),!d&&u.length>0&&l.jsx("div",{className:"space-y-4",children:l.jsx(xr,{height:Math.min(Math.max(rr,u.length*rr),rr*Xy),width:"100%",itemCount:u.length,itemSize:rr,overscanCount:Zy,itemData:g,className:"custom-scrollbar",children:$y})})]})]})})},nm=({title:i="Not Found",subtitle:c="The page you requested does not exist.",onBack:r})=>l.jsx("div",{className:"h-full flex items-center justify-center px-10",children:l.jsxs("div",{className:"glass-card w-full max-w-2xl rounded-[40px] border border-white/10 p-10 text-center space-y-6",children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.4em] text-gray-500",children:"404"}),l.jsx("h2",{className:"text-3xl font-bold tracking-tighter text-white",children:i}),l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.25em] text-gray-500",children:c}),r&&l.jsxs("button",{onClick:r,className:"mt-2 inline-flex items-center gap-2 px-6 py-3 rounded-2xl bg-white text-black text-[9px] font-bold uppercase tracking-[0.3em] hover:scale-105 transition-all",children:[l.jsx(ue,{name:"arrow_back",className:"text-base"}),"Back"]})]})}),Fy=({message:i,tone:c,onClose:r})=>{const[u,f]=E.useState(!1);return E.useEffect(()=>{const d=setTimeout(()=>{f(!0)},2500);return()=>clearTimeout(d)},[]),E.useEffect(()=>{if(!u)return;const d=setTimeout(()=>r(),240);return()=>clearTimeout(d)},[u,r]),l.jsx("div",{className:`fixed bottom-6 right-6 z-[220] max-w-sm w-full ${u?"animate-out fade-out slide-out-to-bottom-3 duration-200":"animate-in fade-in slide-in-from-bottom-3 duration-300"}`,children:l.jsxs("div",{role:c==="error"?"alert":"status",className:`glass-card rounded-2xl border border-white/10 p-4 shadow-2xl flex items-start gap-3 ${u?"animate-out fade-out zoom-out-95 duration-200":"animate-in fade-in zoom-in-95 duration-300"}`,children:[l.jsx("div",{className:"mt-0.5",children:c==="error"?l.jsx(ue,{name:"error",className:"text-red-400 text-lg"}):l.jsx(ue,{name:"check_circle",className:"text-emerald-400 text-lg"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-[8px] font-bold uppercase tracking-[0.35em] text-gray-500",children:c==="error"?"Error":"Success"}),l.jsx("p",{className:"mt-1.5 font-mono text-[11px] text-white leading-relaxed break-words",children:i})]}),l.jsx("button",{onClick:()=>f(!0),className:"p-1.5 rounded-lg text-white/40 hover:text-white hover:bg-white/10 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50 shrink-0","aria-label":"Close notification",title:"Close",children:l.jsx(ue,{name:"close",className:"text-base"})})]})})},Py=({request:i,onResolve:c})=>l.jsx("div",{className:"fixed inset-0 z-[201] flex items-center justify-center bg-black/70 backdrop-blur-sm px-6",children:l.jsxs("div",{className:"glass-card w-full max-w-md rounded-[32px] border border-white/10 p-8 text-center shadow-2xl",children:[l.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.4em] text-gray-500",children:i.title??"Confirm"}),l.jsx("p",{className:"mt-4 font-mono text-sm text-white",children:i.message}),l.jsxs("div",{className:"mt-6 flex gap-4",children:[l.jsx("button",{onClick:()=>c(!1),className:"w-full rounded-2xl px-6 py-3 text-[9px] font-bold uppercase tracking-[0.3em] transition-all bg-white/5 border border-white/10 text-gray-300 hover:bg-white/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:i.cancelLabel??"Cancel"}),l.jsx("button",{onClick:()=>c(!0),className:"w-full rounded-2xl px-6 py-3 text-[9px] font-bold uppercase tracking-[0.3em] transition-all bg-white text-black hover:scale-105 shadow-xl shadow-white/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:i.confirmLabel??"Confirm"})]})]})}),Jy=({tasks:i,loadTasks:c,touchTask:r,currentTask:u,setCurrentTask:f,onTaskLoaded:d,...h})=>{const{id:p}=Hp(),x=Xn(),[g,C]=E.useState(!1),[w,k]=E.useState(!1);return E.useEffect(()=>{(async()=>{if(u?.id===p)return;C(!0),k(!1);let _=i;i.length===0&&(_=await c());const m=_.find(b=>String(b.id)===String(p));if(m){const b={...m};(!b.variables||Array.isArray(b.variables))&&(b.variables={}),b.stealth||(b.stealth={allowTypos:!1,idleMovements:!1,overscroll:!1,deadClicks:!1,fatigue:!1,naturalTyping:!1,cursorGlide:!1,randomizeClicks:!1}),b.stealth.cursorGlide===void 0&&(b.stealth.cursorGlide=b.stealth.humanCursor??!1),delete b.stealth.humanCursor,b.stealth.randomizeClicks===void 0&&(b.stealth.randomizeClicks=!1),Array.isArray(b.actions)&&(b.actions=b.actions.map((j,S)=>j&&j.id?j:{...j,id:`act_${Date.now()}_${S}_${Math.floor(Math.random()*1e3)}`})),b.includeShadowDom===void 0&&(b.includeShadowDom=!0),f(b),d?.(b),p&&r(p)}else k(!0);C(!1)})()},[p,i]),w?l.jsx(nm,{title:"Task Not Found",subtitle:"This task does not exist or was deleted.",onBack:()=>x("/dashboard")}):g||!u||String(u.id)!==String(p)?l.jsx(Fc,{title:"Loading Mission Data",subtitle:"Syncing task payload"}):l.jsx(Wp,{currentTask:u,setCurrentTask:f,tasks:i,...h})},Np="doppelganger.seenReleaseNotes_0_8";function Wy(){const[i,c]=E.useState(!1),[r,u]=E.useState(""),[f,d]=E.useState(!0);E.useEffect(()=>{Qc.startsWith("0.8.")&&(localStorage.getItem(Np)||(c(!0),h()))},[]);const h=async()=>{try{const x=await fetch("https://api.github.com/repos/figranium/figranium/releases/tags/v0.8.0");if(x.ok){const g=await x.json();u(g.body||"No release notes available.")}else u("Failed to load release notes. Please check our GitHub repository.")}catch{u("Failed to load release notes. Please check our GitHub repository.")}finally{d(!1)}},p=()=>{c(!1),localStorage.setItem(Np,"true")};return i?l.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-sm px-6",children:l.jsxs("div",{className:"glass-card w-full max-w-2xl max-h-[80vh] flex flex-col rounded-[32px] border border-white/10 p-8 text-left shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"flex justify-between items-center mb-6 shrink-0",children:[l.jsx("h2",{className:"text-lg md:text-2xl font-bold text-white tracking-tight",children:"What's new in v0.8.0"}),l.jsxs("span",{className:"bg-white/10 text-white/70 px-3 py-1 rounded-full text-xs font-mono ml-4 shrink-0",children:["v",Qc]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto pr-2 custom-scrollbar text-sm text-gray-300",children:f?l.jsx("div",{className:"flex justify-center items-center h-32",children:l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white"})}):l.jsx("div",{className:"whitespace-pre-wrap font-mono text-xs",children:r})}),l.jsx("div",{className:"mt-8 flex justify-end shrink-0",children:l.jsx("button",{onClick:p,className:"rounded-2xl px-8 py-3 text-[10px] font-bold uppercase tracking-[0.3em] transition-all bg-white text-black hover:scale-105 shadow-xl shadow-white/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",children:"Got it"})})]})}):null}const ev=(i,c)=>{if(typeof i!="string"||!i)return c;switch(i){case"ALREADY_SETUP":return"An account already exists";case"INVALID":return"Invalid credentials";case"SESSION_SAVE_FAILED":return"Unable to persist your session";default:{const r=i.toLowerCase().replace(/_/g," ");return r.charAt(0).toUpperCase()+r.slice(1)}}};function tv(){const i=Xn(),[c,r]=E.useState(null),[u,f]=E.useState("checking"),[d,h]=E.useState(""),[p,x]=E.useState(!1),g=E.useCallback(async()=>{try{const y=await(await fetch("/api/auth/me",{credentials:"include"})).json();if(y.authenticated)return r(y.user),f("authenticated"),!0;const m=await(await fetch("/api/auth/check-setup",{credentials:"include"})).json();f(m.setupRequired?"setup":"login")}catch{f("login")}return!1},[]);E.useEffect(()=>{g()},[g]);const C=E.useCallback(async(k,y,_,m)=>{if(!k||!y){h("Email and password are required");return}if(u==="setup"&&(!_||y!==m)){h(_?"Passwords do not match":"Name required");return}if(p)return;const b=u==="setup"?"/api/auth/setup":"/api/auth/login",j=u==="setup"?{name:_,email:k,password:y}:{email:k,password:y};x(!0);try{const S=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(j)}),A=await S.json().catch(()=>({}));if(S.ok)h(""),f("checking"),await g()?i("/"):(h("Authentication failed"),f("login"));else{const M=u==="setup"?"Setup failed":"Invalid credentials";h(ev(A?.error,M))}}catch{h("Network error")}finally{x(!1)}},[u,p,i,g]),w=E.useCallback(async k=>{await k("Are you sure you want to log out?")&&(await fetch("/api/auth/logout",{method:"POST",credentials:"include"}),r(null),f("login"),i("/"))},[i]);return{user:c,setUser:r,authStatus:u,setAuthStatus:f,authError:d,authBusy:p,checkAuth:g,handleAuthSubmit:C,logout:w}}function av(i,c,r){const[u,f]=E.useState([]),[d,h]=E.useState(null),p=E.useRef(null);E.useEffect(()=>{p.current=d},[d]);const x=E.useCallback(async()=>{try{const S=[...await(await fetch("/api/tasks",{credentials:"include"})).json()].sort((A,M)=>(M.last_opened||0)-(A.last_opened||0));return f(S),S}catch(b){return console.error("Failed to load tasks",b),[]}},[]),g=E.useCallback(async b=>{try{await fetch(`/api/tasks/${b}/touch`,{method:"POST"}),x()}catch(j){console.error("Failed to touch task",j)}},[x]),C=E.useCallback((b,j)=>{const S=gb();j(!0),h(S),b(null),i("/tasks/new")},[i]),w=E.useCallback((b,j,S)=>{const A={...b};(!A.variables||Array.isArray(A.variables))&&(A.variables={}),A.stealth||(A.stealth={allowTypos:!1,idleMovements:!1,overscroll:!1,deadClicks:!1,fatigue:!1,naturalTyping:!1,cursorGlide:!1,randomizeClicks:!1}),A.stealth.cursorGlide===void 0&&(A.stealth.cursorGlide=A.stealth.humanCursor??!1),delete A.stealth.humanCursor,A.stealth.randomizeClicks===void 0&&(A.stealth.randomizeClicks=!1),A.rotateProxies===void 0&&(A.rotateProxies=!1),A.rotateViewport===void 0&&(A.rotateViewport=!1),A.extractionFormat||(A.extractionFormat="json"),A.includeHtml===void 0&&(A.includeHtml=!1),A.includeShadowDom===void 0&&(A.includeShadowDom=!0),A.disableRecording===void 0&&(A.disableRecording=!1),A.disableRecording=hr(A.disableRecording),A.statelessExecution===void 0&&(A.statelessExecution=!1),A.statelessExecution=hr(A.statelessExecution);const M=Qp(A);h(M),j(M),S(null),i(`/tasks/${b.id}`),b.id&&g(b.id)},[i,g]),k=E.useCallback(async(b,j)=>{await r("Are you sure you want to delete this task?")&&(await fetch(`/api/tasks/${b}`,{method:"DELETE"}),x(),j.includes(b)&&i("/dashboard"))},[r,x,i]),y=E.useCallback(async(b,j,S,A=!1)=>{const M=S||p.current;if(!M)return;const O={...M,last_opened:Date.now()},I=await(await fetch(`/api/tasks${A?"?version=true":""}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})).json();h(I),b(I),x(),j.includes("new")&&i(`/tasks/${I.id}`,{replace:!0})},[i,x]),_=E.useCallback(b=>{let j=u;if(b&&b.length>0&&(j=u.filter(L=>L.id&&b.includes(L.id))),j.length===0){c("No tasks selected to export.","error");return}const S={exportedAt:new Date().toISOString(),tasks:j},A=new Blob([JSON.stringify(S,null,2)],{type:"application/json"}),M=URL.createObjectURL(A),O=document.createElement("a"),U=new Date().toISOString().slice(0,10);O.href=M,O.download=`doppelganger-tasks-${U}.json`,document.body.appendChild(O),O.click(),O.remove(),URL.revokeObjectURL(M),c(`Exported ${j.length} task(s).`,"success")},[u,c]),m=E.useCallback(async b=>{try{const j=await b.text(),S=JSON.parse(j);let A=[];if(Array.isArray(S)?A=S:S&&typeof S=="object"&&(Array.isArray(S.tasks)?A=S.tasks:(S.name||S.actions)&&(A=[S])),A.length===0){c("Invalid import file.","error");return}const M=Date.now(),O=A.map((U,L)=>xb(U,L)).filter(U=>!!U).map((U,L)=>U.id?U:{...U,id:`task_${M}_${L}`});if(O.length===0){c("No tasks to import.","error");return}await Promise.all(O.map(U=>fetch("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)}))),await x(),c(`Imported ${O.length} task(s).`,"success")}catch(j){c(`Import failed: ${j.message||"Unknown error"}`,"error")}},[c,x]);return E.useEffect(()=>{x()},[x]),{tasks:u,setTasks:f,currentTask:d,setCurrentTask:h,loadTasks:x,touchTask:g,createNewTask:C,editTask:w,deleteTask:k,saveTask:y,exportTasks:_,importTasks:m}}const _p=(i,c)=>{const r=String(i||"").trim();if(!r)return"Execution failed.";const u=r.toLowerCase();if(c==="headful"){if(u.includes("missing x server")||u.includes("$display"))return"Headful browser could not start because no display server is available.";if(u.includes("failed to connect to the bus"))return"Headful browser could not start due to missing system services."}let f=r;const d=f.indexOf("--disable-");return d>0&&(f=f.slice(0,d).trim()),f.length>240&&(f=`${f.slice(0,240)}...`),f||"Execution failed."},nv=i=>{const c=String(i||"").toLowerCase();return c.includes("missing x server")||c.includes("$display")||c.includes("platform failed to initialize")||c.includes("no display server")};function lv(i){const[c,r]=E.useState(!1),[u,f]=E.useState(!1),[d,h]=E.useState(null),[p,x]=E.useState(null),g=tm(),C=E.useRef(null),w=async()=>{try{await fetch("/headful/stop",{method:"POST"})}catch(m){console.error("Failed to stop headful session",m)}finally{f(!1)}};return{isExecuting:c,isHeadfulOpen:u,results:d,setResults:h,activeRunId:p,useNovnc:g,runTaskWithSnapshot:async(m,b,j)=>{if(!m||!m.url)return;const S=Qp(m);b&&S!==b&&j(S);const A=`run_${Date.now()}_${Math.floor(Math.random()*1e3)}`;if(x(A),c)return;r(!0),h({url:S.url,logs:[],timestamp:"Running..."});let M=null;try{const O={};Object.entries(S.variables).forEach(([F,z])=>{O[F]=z.value});const U=F=>F.replace(/\\{\$(\w+)\\}/g,(z,se)=>{if(se==="now")return new Date().toISOString();const $=O[se];return $==null||$===""?"":String($)}),L=F=>typeof F!="string"?F:U(F),I=S.mode!=="agent";M={...{...S,url:I?U(S.url||""):S.url||"",selector:I?L(S.selector):S.selector,actions:I?S.actions.map(F=>({...F,selector:L(F.selector),value:L(F.value),key:L(F.key)})):S.actions},taskVariables:O,variables:O,runSource:"editor",taskId:S.id,taskName:S.name,taskSnapshot:S,runId:A};const de=async F=>{const z=new AbortController;C.current=z;const se=await fetch(`/${F}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M),signal:z.signal});if(!se.ok){let $=null;try{$=await se.json()}catch{$=null}const P=new Error($?.details||$?.error||"Request failed");throw P.code=$?.error,P}return se.json()},ae=S.mode==="headful"?"scrape":S.mode,H=await de(ae);h({url:S.url,finalUrl:H.final_url,html:H.html,data:H.data??H.html??null,screenshotUrl:H.screenshot_url,downloads:H.downloads,logs:H.logs||[],timestamp:new Date().toLocaleTimeString()})}catch(O){if(O?.name==="AbortError"){i("Execution stopped.","success"),r(!1);return}if(S?.mode==="headful"&&M&&(O?.code==="HEADFUL_DISPLAY_UNAVAILABLE"||nv(O?.message||String(O))))try{const L=await(async()=>{const I=new AbortController;C.current=I;const V=await fetch("/scrape",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M),signal:I.signal});if(!V.ok){const de=await V.json();throw new Error(de.details||de.error||"Request failed")}return V.json()})();L.logs=["Headful display unavailable; ran headless instead.",...L.logs||[]],h({url:S.url,finalUrl:L.final_url,html:L.html,data:L.data??L.html??null,screenshotUrl:L.screenshot_url,downloads:L.downloads,logs:L.logs||[],timestamp:new Date().toLocaleTimeString()}),r(!1);return}catch(L){const I=_p(L?.message||String(L),S?.mode);i(`Execution crash: ${I}`,"error"),r(!1);return}const U=_p(O?.message||String(O),S?.mode);i(`Execution crash: ${U}`,"error"),S?.mode==="headful"&&r(!1)}finally{C.current=null,r(!1)}},stopTask:async()=>{if(p)try{await fetch("/api/executions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:p})})}catch(m){console.error("Failed to request stop",m)}C.current&&C.current.abort(),r(!1)},openHeadful:async(m,b,j,S)=>{if(u){await w();return}f(!0);try{const A=await fetch("/headful",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:m,targetActionId:b,taskSnapshot:j,variables:S})});if(!A.ok){const M=await A.json().catch(()=>({})),O=M?.details||M?.error||"Failed to start headful session";i(O,"error"),f(!1)}}catch{i("Failed to start headful session","error"),f(!1)}},stopHeadful:w}}function iv(){const[i,c]=E.useState(null),[r,u]=E.useState(null),f=E.useRef(null),d=E.useCallback((x,g="success")=>{c({message:x,tone:g}),g==="success"&&setTimeout(()=>{c(C=>C&&C.message===x?null:C)},2e3)},[]),h=E.useCallback(x=>new Promise(g=>{f.current=g,u(typeof x=="string"?{message:x}:x)}),[]),p=E.useCallback(x=>{const g=f.current;f.current=null,u(null),g&&g(x)},[]);return{centerAlert:i,setCenterAlert:c,centerConfirm:r,showAlert:d,requestConfirm:h,closeConfirm:p}}function sv(){const i=Xn(),c=wn(),{centerAlert:r,setCenterAlert:u,centerConfirm:f,showAlert:d,requestConfirm:h,closeConfirm:p}=iv(),{authStatus:x,authError:g,authBusy:C,handleAuthSubmit:w,logout:k}=tv(),{tasks:y,currentTask:_,setCurrentTask:m,loadTasks:b,touchTask:j,createNewTask:S,editTask:A,deleteTask:M,saveTask:O,exportTasks:U,importTasks:L}=av(i,d,h),{isExecuting:I,isHeadfulOpen:V,results:de,setResults:ae,activeRunId:H,useNovnc:F,runTaskWithSnapshot:z,stopTask:se,openHeadful:$,stopHeadful:P}=lv(d);E.useEffect(()=>{x==="authenticated"&&b()},[x]);const[Z,X]=E.useState(!1),ge=E.useRef(""),[R,D]=E.useState("visual"),[W,te]=E.useState({}),Y="doppelganger.pinnedResults",ke=(re=>re?.id?String(re.id):"new")(_),Ae=_&&W[ke]||null;E.useEffect(()=>{try{const re=localStorage.getItem(Y);if(re){const K=JSON.parse(re);K&&typeof K=="object"&&te(K)}}catch{}},[]),E.useEffect(()=>{try{localStorage.setItem(Y,JSON.stringify(W))}catch{}},[W]),E.useEffect(()=>{!c.pathname.startsWith("/tasks")&&R==="history"&&D("visual")},[c.pathname,R]),E.useEffect(()=>{c.pathname==="/tasks/new"&&!_&&S(ae,X)},[c.pathname]),E.useEffect(()=>{if(!_){X(!1);return}const re=Ci(_);X(re!==ge.current)},[_]),E.useEffect(()=>{if(typeof window>"u")return;const re=K=>{Z&&(K.preventDefault(),K.returnValue="")};return window.addEventListener("beforeunload",re),()=>window.removeEventListener("beforeunload",re)},[Z]);const Oe=E.useCallback(re=>{ge.current=Ci(re),X(!1)},[]),Ke=re=>{_&&te(K=>({...K,[ke]:re}))},Ie=()=>{_&&te(re=>{const K={...re};return delete K[ke],K})},nt=async re=>{if(!await h(`Delete all ${re}?`))return;await fetch(re==="screenshots"?"/api/clear-screenshots":"/api/clear-cookies",{method:"POST"}),d(`${pb(re)} cleared.`,"success")},We=()=>c.pathname.startsWith("/tasks")?"editor":c.pathname==="/settings"?"settings":c.pathname==="/executions"?"executions":c.pathname==="/captures"?"captures":"dashboard",N=E.useCallback(re=>{re==="dashboard"?i("/dashboard"):re==="settings"?i("/settings"):re==="executions"?i("/executions"):re==="captures"&&i("/captures")},[i]),me=E.useCallback(()=>{S(ae,X)},[S,ae,X]),ne=E.useCallback(re=>{A(re,Oe,ae)},[A,Oe,ae]),q=E.useCallback(re=>{M(re,c.pathname)},[M,c.pathname]),B=E.useCallback((re,K)=>O(Oe,c.pathname,re,K),[O,Oe,c.pathname]),J=E.useCallback(()=>{k(h)},[k,h]);E.useEffect(()=>{const re=K=>{const ve=K.target;if(!(ve.tagName==="INPUT"||ve.tagName==="TEXTAREA"||ve.isContentEditable)&&K.altKey)switch(K.key){case"1":K.preventDefault(),N("dashboard");break;case"2":K.preventDefault(),N("settings");break;case"3":K.preventDefault(),N("executions");break;case"4":K.preventDefault(),N("captures");break;case"n":case"N":K.preventDefault(),me();break;case"l":case"L":K.preventDefault(),J();break}};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[N,me,J]);let xe;return x==="login"||x==="setup"?xe=l.jsx(Wg,{status:x,onSubmit:w,error:g,busy:C}):x==="checking"?xe=l.jsx(Fc,{title:"Authenticating",subtitle:"Verifying session state"}):xe=l.jsxs("div",{className:"h-full flex flex-row overflow-hidden bg-[#020202]",children:[l.jsx(Wy,{}),l.jsx(Jg,{onNavigate:N,onNewTask:me,onLogout:J,currentScreen:We()}),l.jsxs(gg,{children:[l.jsx(_a,{path:"/",element:l.jsx(sp,{tasks:y,onNewTask:me,onEditTask:ne,onDeleteTask:q,onExportTasks:U,onImportTasks:L})}),l.jsx(_a,{path:"/dashboard",element:l.jsx(sp,{tasks:y,onNewTask:me,onEditTask:ne,onDeleteTask:q,onExportTasks:U,onImportTasks:L})}),l.jsx(_a,{path:"/tasks/new",element:_?l.jsx(Wp,{currentTask:_,setCurrentTask:m,tasks:y,editorView:R,setEditorView:D,isExecuting:I,onSave:B,onRun:()=>z(_,_,m),onRunSnapshot:re=>z(re||_,_,m),results:de,pinnedResults:Ae,onConfirm:h,onNotify:d,onPinResults:Ke,onUnpinResults:Ie,runId:H,onStop:()=>se(),isHeadfulOpen:V,onOpenHeadful:(re,K,ve,_e)=>$(re,K,ve,_e),onStopHeadful:P,useNovnc:F}):l.jsx(Fc,{title:"Initializing",subtitle:"Preparing task workspace"})}),l.jsx(_a,{path:"/tasks/:id",element:l.jsx(Jy,{tasks:y,loadTasks:b,touchTask:j,currentTask:_,setCurrentTask:m,editorView:R,setEditorView:D,isExecuting:I,onSave:B,onRun:()=>z(_,_,m),onRunSnapshot:re=>z(re||_,_,m),results:de,pinnedResults:Ae,onConfirm:h,onNotify:d,onPinResults:Ke,onUnpinResults:Ie,runId:H,onStop:()=>se(),onTaskLoaded:Oe,isHeadfulOpen:V,onOpenHeadful:(re,K,ve,_e)=>$(re,K,ve,_e),onStopHeadful:P,useNovnc:F})}),l.jsx(_a,{path:"/settings",element:l.jsx(By,{onClearStorage:nt,onConfirm:h,onNotify:d})}),l.jsx(_a,{path:"/executions",element:l.jsx(Ky,{onConfirm:h,onNotify:d})}),l.jsx(_a,{path:"/executions/:id",element:l.jsx(Gy,{onConfirm:h,onNotify:d})}),l.jsx(_a,{path:"/captures",element:l.jsx(Qy,{onConfirm:h,onNotify:d})}),l.jsx(_a,{path:"*",element:l.jsx(nm,{onBack:()=>i("/dashboard")})})]})]}),l.jsxs("div",{className:"h-full",children:[r&&l.jsx(Fy,{message:r.message,tone:r.tone,onClose:()=>u(null)}),f&&l.jsx(Py,{request:f,onResolve:p}),xe]})}v0.createRoot(document.getElementById("root")).render(l.jsx(tt.StrictMode,{children:l.jsx(qg,{children:l.jsx(sv,{})})}));