mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 03:05:32 +02:00
CaptureDialog.jsx: - Placeholder no longer appears on idle playlist rows (only during probing); chevron shows only after probe completes — no left-padding while the user is still typing - Per-video delete button added to expanded playlist list; removes item from playlistItems so its ID is absent from per_item_quality on submit - anyEmptyPlaylist guard: Archive button disabled + handleArchive early- return when all videos have been deleted (empty map would otherwise silently download everything) styles.css: - Selection stroke switched from outline to box-shadow:inset everywhere (entry-row-outer, child-entry-row, legacy flat-div selector) — guaranteed inside element bounds, no layout interference - URL cell overflow only on :hover; removed is-selected .url-cell rule that was expanding child URLs when their parent was selected - Playlist items redesign: separator lines instead of background fills, amber left-border for conflicts, thin scrollbar, tighter padding - Remove button: opacity 0.3 always-visible baseline; full opacity on hover/:focus-visible; forced to 1 on coarse-pointer (touch) devices
47 lines
282 KiB
JavaScript
47 lines
282 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();var yu={exports:{}},os={},vu={exports:{}},Z={};/**
|
||
* @license React
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Jr=Symbol.for("react.element"),Vd=Symbol.for("react.portal"),Qd=Symbol.for("react.fragment"),Kd=Symbol.for("react.strict_mode"),qd=Symbol.for("react.profiler"),Xd=Symbol.for("react.provider"),Jd=Symbol.for("react.context"),Yd=Symbol.for("react.forward_ref"),Gd=Symbol.for("react.suspense"),Zd=Symbol.for("react.memo"),ef=Symbol.for("react.lazy"),Xa=Symbol.iterator;function tf(e){return e===null||typeof e!="object"?null:(e=Xa&&e[Xa]||e["@@iterator"],typeof e=="function"?e:null)}var xu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},wu=Object.assign,ku={};function rr(e,t,n){this.props=e,this.context=t,this.refs=ku,this.updater=n||xu}rr.prototype.isReactComponent={};rr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};rr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ju(){}ju.prototype=rr.prototype;function Gi(e,t,n){this.props=e,this.context=t,this.refs=ku,this.updater=n||xu}var Zi=Gi.prototype=new ju;Zi.constructor=Gi;wu(Zi,rr.prototype);Zi.isPureReactComponent=!0;var Ja=Array.isArray,Su=Object.prototype.hasOwnProperty,ea={current:null},Nu={key:!0,ref:!0,__self:!0,__source:!0};function _u(e,t,n){var r,l={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)Su.call(t,r)&&!Nu.hasOwnProperty(r)&&(l[r]=t[r]);var o=arguments.length-2;if(o===1)l.children=n;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];l.children=u}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)l[r]===void 0&&(l[r]=o[r]);return{$$typeof:Jr,type:e,key:i,ref:a,props:l,_owner:ea.current}}function nf(e,t){return{$$typeof:Jr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ta(e){return typeof e=="object"&&e!==null&&e.$$typeof===Jr}function rf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ya=/\/+/g;function Ts(e,t){return typeof e=="object"&&e!==null&&e.key!=null?rf(""+e.key):t.toString(36)}function Nl(e,t,n,r,l){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Jr:case Vd:a=!0}}if(a)return a=e,l=l(a),e=r===""?"."+Ts(a,0):r,Ja(l)?(n="",e!=null&&(n=e.replace(Ya,"$&/")+"/"),Nl(l,t,n,"",function(c){return c})):l!=null&&(ta(l)&&(l=nf(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(Ya,"$&/")+"/")+e)),t.push(l)),1;if(a=0,r=r===""?".":r+":",Ja(e))for(var o=0;o<e.length;o++){i=e[o];var u=r+Ts(i,o);a+=Nl(i,t,n,u,l)}else if(u=tf(e),typeof u=="function")for(e=u.call(e),o=0;!(i=e.next()).done;)i=i.value,u=r+Ts(i,o++),a+=Nl(i,t,n,u,l);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function sl(e,t,n){if(e==null)return e;var r=[],l=0;return Nl(e,r,"","",function(i){return t.call(n,i,l++)}),r}function lf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var qe={current:null},_l={transition:null},sf={ReactCurrentDispatcher:qe,ReactCurrentBatchConfig:_l,ReactCurrentOwner:ea};function Cu(){throw Error("act(...) is not supported in production builds of React.")}Z.Children={map:sl,forEach:function(e,t,n){sl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sl(e,function(){t++}),t},toArray:function(e){return sl(e,function(t){return t})||[]},only:function(e){if(!ta(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Z.Component=rr;Z.Fragment=Qd;Z.Profiler=qd;Z.PureComponent=Gi;Z.StrictMode=Kd;Z.Suspense=Gd;Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sf;Z.act=Cu;Z.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=wu({},e.props),l=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=ea.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)Su.call(t,u)&&!Nu.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:Jr,type:e.type,key:l,ref:i,props:r,_owner:a}};Z.createContext=function(e){return e={$$typeof:Jd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Xd,_context:e},e.Consumer=e};Z.createElement=_u;Z.createFactory=function(e){var t=_u.bind(null,e);return t.type=e,t};Z.createRef=function(){return{current:null}};Z.forwardRef=function(e){return{$$typeof:Yd,render:e}};Z.isValidElement=ta;Z.lazy=function(e){return{$$typeof:ef,_payload:{_status:-1,_result:e},_init:lf}};Z.memo=function(e,t){return{$$typeof:Zd,type:e,compare:t===void 0?null:t}};Z.startTransition=function(e){var t=_l.transition;_l.transition={};try{e()}finally{_l.transition=t}};Z.unstable_act=Cu;Z.useCallback=function(e,t){return qe.current.useCallback(e,t)};Z.useContext=function(e){return qe.current.useContext(e)};Z.useDebugValue=function(){};Z.useDeferredValue=function(e){return qe.current.useDeferredValue(e)};Z.useEffect=function(e,t){return qe.current.useEffect(e,t)};Z.useId=function(){return qe.current.useId()};Z.useImperativeHandle=function(e,t,n){return qe.current.useImperativeHandle(e,t,n)};Z.useInsertionEffect=function(e,t){return qe.current.useInsertionEffect(e,t)};Z.useLayoutEffect=function(e,t){return qe.current.useLayoutEffect(e,t)};Z.useMemo=function(e,t){return qe.current.useMemo(e,t)};Z.useReducer=function(e,t,n){return qe.current.useReducer(e,t,n)};Z.useRef=function(e){return qe.current.useRef(e)};Z.useState=function(e){return qe.current.useState(e)};Z.useSyncExternalStore=function(e,t,n){return qe.current.useSyncExternalStore(e,t,n)};Z.useTransition=function(){return qe.current.useTransition()};Z.version="18.3.1";vu.exports=Z;var f=vu.exports;/**
|
||
* @license React
|
||
* react-jsx-runtime.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var af=f,of=Symbol.for("react.element"),uf=Symbol.for("react.fragment"),cf=Object.prototype.hasOwnProperty,df=af.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ff={key:!0,ref:!0,__self:!0,__source:!0};function Eu(e,t,n){var r,l={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)cf.call(t,r)&&!ff.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:of,type:e,key:i,ref:a,props:l,_owner:df.current}}os.Fragment=uf;os.jsx=Eu;os.jsxs=Eu;yu.exports=os;var s=yu.exports,Tu={exports:{}},ot={},bu={exports:{}},Pu={};/**
|
||
* @license React
|
||
* scheduler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/(function(e){function t(R,T){var M=R.length;R.push(T);e:for(;0<M;){var J=M-1>>>1,U=R[J];if(0<l(U,T))R[J]=T,R[M]=U,M=J;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var T=R[0],M=R.pop();if(M!==T){R[0]=M;e:for(var J=0,U=R.length,ge=U>>>1;J<ge;){var ce=2*(J+1)-1,$e=R[ce],we=ce+1,Pe=R[we];if(0>l($e,M))we<U&&0>l(Pe,$e)?(R[J]=Pe,R[we]=M,J=we):(R[J]=$e,R[ce]=M,J=ce);else if(we<U&&0>l(Pe,M))R[J]=Pe,R[we]=M,J=we;else break e}}return T}function l(R,T){var M=R.sortIndex-T.sortIndex;return M!==0?M:R.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],y=1,h=null,m=3,x=!1,v=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(R){for(var T=n(c);T!==null;){if(T.callback===null)r(c);else if(T.startTime<=R)r(c),T.sortIndex=T.expirationTime,t(u,T);else break;T=n(c)}}function k(R){if(w=!1,g(R),!v)if(n(u)!==null)v=!0,se(_);else{var T=n(c);T!==null&&te(k,T.startTime-R)}}function _(R,T){v=!1,w&&(w=!1,p(N),N=-1),x=!0;var M=m;try{for(g(T),h=n(u);h!==null&&(!(h.expirationTime>T)||R&&!V());){var J=h.callback;if(typeof J=="function"){h.callback=null,m=h.priorityLevel;var U=J(h.expirationTime<=T);T=e.unstable_now(),typeof U=="function"?h.callback=U:h===n(u)&&r(u),g(T)}else r(u);h=n(u)}if(h!==null)var ge=!0;else{var ce=n(c);ce!==null&&te(k,ce.startTime-T),ge=!1}return ge}finally{h=null,m=M,x=!1}}var b=!1,E=null,N=-1,I=5,P=-1;function V(){return!(e.unstable_now()-P<I)}function B(){if(E!==null){var R=e.unstable_now();P=R;var T=!0;try{T=E(!0,R)}finally{T?Q():(b=!1,E=null)}}else b=!1}var Q;if(typeof d=="function")Q=function(){d(B)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ue=G.port2;G.port1.onmessage=B,Q=function(){ue.postMessage(null)}}else Q=function(){j(B,0)};function se(R){E=R,b||(b=!0,Q())}function te(R,T){N=j(function(){R(e.unstable_now())},T)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){v||x||(v=!0,se(_))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var T=3;break;default:T=m}var M=m;m=T;try{return R()}finally{m=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,T){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var M=m;m=R;try{return T()}finally{m=M}},e.unstable_scheduleCallback=function(R,T,M){var J=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?J+M:J):M=J,R){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=M+U,R={id:y++,callback:T,priorityLevel:R,startTime:M,expirationTime:U,sortIndex:-1},M>J?(R.sortIndex=M,t(c,R),n(u)===null&&R===n(c)&&(w?(p(N),N=-1):w=!0,te(k,M-J))):(R.sortIndex=U,t(u,R),v||x||(v=!0,se(_))),R},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(R){var T=m;return function(){var M=m;m=T;try{return R.apply(this,arguments)}finally{m=M}}}})(Pu);bu.exports=Pu;var pf=bu.exports;/**
|
||
* @license React
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var hf=f,at=pf;function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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."}var Lu=new Set,zr={};function _n(e,t){Jn(e,t),Jn(e+"Capture",t)}function Jn(e,t){for(zr[e]=t,e=0;e<t.length;e++)Lu.add(t[e])}var Mt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),li=Object.prototype.hasOwnProperty,mf=/^[: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]*$/,Ga={},Za={};function gf(e){return li.call(Za,e)?!0:li.call(Ga,e)?!1:mf.test(e)?Za[e]=!0:(Ga[e]=!0,!1)}function yf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function vf(e,t,n,r){if(t===null||typeof t>"u"||yf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Xe(e,t,n,r,l,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ie[e]=new Xe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ie[t]=new Xe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ie[e]=new Xe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ie[e]=new Xe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ie[e]=new Xe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ie[e]=new Xe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ie[e]=new Xe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ie[e]=new Xe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ie[e]=new Xe(e,5,!1,e.toLowerCase(),null,!1,!1)});var na=/[\-:]([a-z])/g;function ra(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(na,ra);Ie[t]=new Xe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(na,ra);Ie[t]=new Xe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(na,ra);Ie[t]=new Xe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ie[e]=new Xe(e,1,!1,e.toLowerCase(),null,!1,!1)});Ie.xlinkHref=new Xe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ie[e]=new Xe(e,1,!1,e.toLowerCase(),null,!0,!0)});function la(e,t,n,r){var l=Ie.hasOwnProperty(t)?Ie[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(vf(t,n,l,r)&&(n=null),r||l===null?gf(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=n===null?l.type===3?!1:"":n:(t=l.attributeName,r=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ut=hf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,il=Symbol.for("react.element"),Ln=Symbol.for("react.portal"),zn=Symbol.for("react.fragment"),sa=Symbol.for("react.strict_mode"),si=Symbol.for("react.profiler"),zu=Symbol.for("react.provider"),Ru=Symbol.for("react.context"),ia=Symbol.for("react.forward_ref"),ii=Symbol.for("react.suspense"),ai=Symbol.for("react.suspense_list"),aa=Symbol.for("react.memo"),Vt=Symbol.for("react.lazy"),Iu=Symbol.for("react.offscreen"),eo=Symbol.iterator;function ur(e){return e===null||typeof e!="object"?null:(e=eo&&e[eo]||e["@@iterator"],typeof e=="function"?e:null)}var me=Object.assign,bs;function vr(e){if(bs===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);bs=t&&t[1]||""}return`
|
||
`+bs+e}var Ps=!1;function Ls(e,t){if(!e||Ps)return"";Ps=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var l=c.stack.split(`
|
||
`),i=r.stack.split(`
|
||
`),a=l.length-1,o=i.length-1;1<=a&&0<=o&&l[a]!==i[o];)o--;for(;1<=a&&0<=o;a--,o--)if(l[a]!==i[o]){if(a!==1||o!==1)do if(a--,o--,0>o||l[a]!==i[o]){var u=`
|
||
`+l[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{Ps=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?vr(e):""}function xf(e){switch(e.tag){case 5:return vr(e.type);case 16:return vr("Lazy");case 13:return vr("Suspense");case 19:return vr("SuspenseList");case 0:case 2:case 15:return e=Ls(e.type,!1),e;case 11:return e=Ls(e.type.render,!1),e;case 1:return e=Ls(e.type,!0),e;default:return""}}function oi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case zn:return"Fragment";case Ln:return"Portal";case si:return"Profiler";case sa:return"StrictMode";case ii:return"Suspense";case ai:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ru:return(e.displayName||"Context")+".Consumer";case zu:return(e._context.displayName||"Context")+".Provider";case ia:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case aa:return t=e.displayName||null,t!==null?t:oi(e.type)||"Memo";case Vt:t=e._payload,e=e._init;try{return oi(e(t))}catch{}}return null}function wf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oi(t);case 8:return t===sa?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function sn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $u(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kf(e){var t=$u(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function al(e){e._valueTracker||(e._valueTracker=kf(e))}function Du(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$u(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ol(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ui(e,t){var n=t.checked;return me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function to(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=sn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ou(e,t){t=t.checked,t!=null&&la(e,"checked",t,!1)}function ci(e,t){Ou(e,t);var n=sn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?di(e,t.type,n):t.hasOwnProperty("defaultValue")&&di(e,t.type,sn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function no(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function di(e,t,n){(t!=="number"||Ol(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var xr=Array.isArray;function Un(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&r&&(e[n].defaultSelected=!0)}else{for(n=""+sn(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,r&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function fi(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(L(91));return me({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ro(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(L(92));if(xr(n)){if(1<n.length)throw Error(L(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:sn(n)}}function Au(e,t){var n=sn(t.value),r=sn(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function lo(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Mu(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function pi(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Mu(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ol,Fu=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ol=ol||document.createElement("div"),ol.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ol.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Rr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Sr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},jf=["Webkit","ms","Moz","O"];Object.keys(Sr).forEach(function(e){jf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Sr[t]=Sr[e]})});function Bu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Sr.hasOwnProperty(e)&&Sr[e]?(""+t).trim():t+"px"}function Hu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Bu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Sf=me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function hi(e,t){if(t){if(Sf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function mi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gi=null;function oa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yi=null,Wn=null,Vn=null;function so(e){if(e=Zr(e)){if(typeof yi!="function")throw Error(L(280));var t=e.stateNode;t&&(t=ps(t),yi(e.stateNode,e.type,t))}}function Uu(e){Wn?Vn?Vn.push(e):Vn=[e]:Wn=e}function Wu(){if(Wn){var e=Wn,t=Vn;if(Vn=Wn=null,so(e),t)for(e=0;e<t.length;e++)so(t[e])}}function Vu(e,t){return e(t)}function Qu(){}var zs=!1;function Ku(e,t,n){if(zs)return e(t,n);zs=!0;try{return Vu(e,t,n)}finally{zs=!1,(Wn!==null||Vn!==null)&&(Qu(),Wu())}}function Ir(e,t){var n=e.stateNode;if(n===null)return null;var r=ps(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(L(231,t,typeof n));return n}var vi=!1;if(Mt)try{var cr={};Object.defineProperty(cr,"passive",{get:function(){vi=!0}}),window.addEventListener("test",cr,cr),window.removeEventListener("test",cr,cr)}catch{vi=!1}function Nf(e,t,n,r,l,i,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(y){this.onError(y)}}var Nr=!1,Al=null,Ml=!1,xi=null,_f={onError:function(e){Nr=!0,Al=e}};function Cf(e,t,n,r,l,i,a,o,u){Nr=!1,Al=null,Nf.apply(_f,arguments)}function Ef(e,t,n,r,l,i,a,o,u){if(Cf.apply(this,arguments),Nr){if(Nr){var c=Al;Nr=!1,Al=null}else throw Error(L(198));Ml||(Ml=!0,xi=c)}}function Cn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function qu(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 io(e){if(Cn(e)!==e)throw Error(L(188))}function Tf(e){var t=e.alternate;if(!t){if(t=Cn(e),t===null)throw Error(L(188));return t!==e?null:e}for(var n=e,r=t;;){var l=n.return;if(l===null)break;var i=l.alternate;if(i===null){if(r=l.return,r!==null){n=r;continue}break}if(l.child===i.child){for(i=l.child;i;){if(i===n)return io(l),e;if(i===r)return io(l),t;i=i.sibling}throw Error(L(188))}if(n.return!==r.return)n=l,r=i;else{for(var a=!1,o=l.child;o;){if(o===n){a=!0,n=l,r=i;break}if(o===r){a=!0,r=l,n=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===n){a=!0,n=i,r=l;break}if(o===r){a=!0,r=i,n=l;break}o=o.sibling}if(!a)throw Error(L(189))}}if(n.alternate!==r)throw Error(L(190))}if(n.tag!==3)throw Error(L(188));return n.stateNode.current===n?e:t}function Xu(e){return e=Tf(e),e!==null?Ju(e):null}function Ju(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ju(e);if(t!==null)return t;e=e.sibling}return null}var Yu=at.unstable_scheduleCallback,ao=at.unstable_cancelCallback,bf=at.unstable_shouldYield,Pf=at.unstable_requestPaint,xe=at.unstable_now,Lf=at.unstable_getCurrentPriorityLevel,ua=at.unstable_ImmediatePriority,Gu=at.unstable_UserBlockingPriority,Fl=at.unstable_NormalPriority,zf=at.unstable_LowPriority,Zu=at.unstable_IdlePriority,us=null,Pt=null;function Rf(e){if(Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(us,e,void 0,(e.current.flags&128)===128)}catch{}}var Nt=Math.clz32?Math.clz32:Df,If=Math.log,$f=Math.LN2;function Df(e){return e>>>=0,e===0?32:31-(If(e)/$f|0)|0}var ul=64,cl=4194304;function wr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~l;o!==0?r=wr(o):(i&=a,i!==0&&(r=wr(i)))}else a=n&~l,a!==0?r=wr(a):i!==0&&(r=wr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Nt(t),l=1<<n,r|=e[n],t&=~l;return r}function Of(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Nt(i),o=1<<a,u=l[a];u===-1?(!(o&n)||o&r)&&(l[a]=Of(o,t)):u<=t&&(e.expiredLanes|=o),i&=~o}}function wi(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ec(){var e=ul;return ul<<=1,!(ul&4194240)&&(ul=64),e}function Rs(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Nt(t),e[t]=n}function Mf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-Nt(n),i=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~i}}function ca(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Nt(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var le=0;function tc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var nc,da,rc,lc,sc,ki=!1,dl=[],Yt=null,Gt=null,Zt=null,$r=new Map,Dr=new Map,Kt=[],Ff="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 submit".split(" ");function oo(e,t){switch(e){case"focusin":case"focusout":Yt=null;break;case"dragenter":case"dragleave":Gt=null;break;case"mouseover":case"mouseout":Zt=null;break;case"pointerover":case"pointerout":$r.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dr.delete(t.pointerId)}}function dr(e,t,n,r,l,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[l]},t!==null&&(t=Zr(t),t!==null&&da(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Bf(e,t,n,r,l){switch(t){case"focusin":return Yt=dr(Yt,e,t,n,r,l),!0;case"dragenter":return Gt=dr(Gt,e,t,n,r,l),!0;case"mouseover":return Zt=dr(Zt,e,t,n,r,l),!0;case"pointerover":var i=l.pointerId;return $r.set(i,dr($r.get(i)||null,e,t,n,r,l)),!0;case"gotpointercapture":return i=l.pointerId,Dr.set(i,dr(Dr.get(i)||null,e,t,n,r,l)),!0}return!1}function ic(e){var t=hn(e.target);if(t!==null){var n=Cn(t);if(n!==null){if(t=n.tag,t===13){if(t=qu(n),t!==null){e.blockedOn=t,sc(e.priority,function(){rc(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ji(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);gi=r,n.target.dispatchEvent(r),gi=null}else return t=Zr(n),t!==null&&da(t),e.blockedOn=n,!1;t.shift()}return!0}function uo(e,t,n){Cl(e)&&n.delete(t)}function Hf(){ki=!1,Yt!==null&&Cl(Yt)&&(Yt=null),Gt!==null&&Cl(Gt)&&(Gt=null),Zt!==null&&Cl(Zt)&&(Zt=null),$r.forEach(uo),Dr.forEach(uo)}function fr(e,t){e.blockedOn===t&&(e.blockedOn=null,ki||(ki=!0,at.unstable_scheduleCallback(at.unstable_NormalPriority,Hf)))}function Or(e){function t(l){return fr(l,e)}if(0<dl.length){fr(dl[0],e);for(var n=1;n<dl.length;n++){var r=dl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Yt!==null&&fr(Yt,e),Gt!==null&&fr(Gt,e),Zt!==null&&fr(Zt,e),$r.forEach(t),Dr.forEach(t),n=0;n<Kt.length;n++)r=Kt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Kt.length&&(n=Kt[0],n.blockedOn===null);)ic(n),n.blockedOn===null&&Kt.shift()}var Qn=Ut.ReactCurrentBatchConfig,Hl=!0;function Uf(e,t,n,r){var l=le,i=Qn.transition;Qn.transition=null;try{le=1,fa(e,t,n,r)}finally{le=l,Qn.transition=i}}function Wf(e,t,n,r){var l=le,i=Qn.transition;Qn.transition=null;try{le=4,fa(e,t,n,r)}finally{le=l,Qn.transition=i}}function fa(e,t,n,r){if(Hl){var l=ji(e,t,n,r);if(l===null)Us(e,t,r,Ul,n),oo(e,r);else if(Bf(l,e,t,n,r))r.stopPropagation();else if(oo(e,r),t&4&&-1<Ff.indexOf(e)){for(;l!==null;){var i=Zr(l);if(i!==null&&nc(i),i=ji(e,t,n,r),i===null&&Us(e,t,r,Ul,n),i===l)break;l=i}l!==null&&r.stopPropagation()}else Us(e,t,r,null,n)}}var Ul=null;function ji(e,t,n,r){if(Ul=null,e=oa(r),e=hn(e),e!==null)if(t=Cn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=qu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ul=e,null}function ac(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Lf()){case ua:return 1;case Gu:return 4;case Fl:case zf:return 16;case Zu:return 536870912;default:return 16}default:return 16}}var Xt=null,pa=null,El=null;function oc(){if(El)return El;var e,t=pa,n=t.length,r,l="value"in Xt?Xt.value:Xt.textContent,i=l.length;for(e=0;e<n&&t[e]===l[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===l[i-r];r++);return El=l.slice(e,1<r?1-r:void 0)}function Tl(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 fl(){return!0}function co(){return!1}function ut(e){function t(n,r,l,i,a){this._reactName=n,this._targetInst=l,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?fl:co,this.isPropagationStopped=co,this}return me(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=fl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=fl)},persist:function(){},isPersistent:fl}),t}var lr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ha=ut(lr),Gr=me({},lr,{view:0,detail:0}),Vf=ut(Gr),Is,$s,pr,cs=me({},Gr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ma,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!==pr&&(pr&&e.type==="mousemove"?(Is=e.screenX-pr.screenX,$s=e.screenY-pr.screenY):$s=Is=0,pr=e),Is)},movementY:function(e){return"movementY"in e?e.movementY:$s}}),fo=ut(cs),Qf=me({},cs,{dataTransfer:0}),Kf=ut(Qf),qf=me({},Gr,{relatedTarget:0}),Ds=ut(qf),Xf=me({},lr,{animationName:0,elapsedTime:0,pseudoElement:0}),Jf=ut(Xf),Yf=me({},lr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Gf=ut(Yf),Zf=me({},lr,{data:0}),po=ut(Zf),ep={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tp={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"},np={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=np[e])?!!t[e]:!1}function ma(){return rp}var lp=me({},Gr,{key:function(e){if(e.key){var t=ep[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Tl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?tp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ma,charCode:function(e){return e.type==="keypress"?Tl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),sp=ut(lp),ip=me({},cs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ho=ut(ip),ap=me({},Gr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ma}),op=ut(ap),up=me({},lr,{propertyName:0,elapsedTime:0,pseudoElement:0}),cp=ut(up),dp=me({},cs,{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}),fp=ut(dp),pp=[9,13,27,32],ga=Mt&&"CompositionEvent"in window,_r=null;Mt&&"documentMode"in document&&(_r=document.documentMode);var hp=Mt&&"TextEvent"in window&&!_r,uc=Mt&&(!ga||_r&&8<_r&&11>=_r),mo=" ",go=!1;function cc(e,t){switch(e){case"keyup":return pp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rn=!1;function mp(e,t){switch(e){case"compositionend":return dc(t);case"keypress":return t.which!==32?null:(go=!0,mo);case"textInput":return e=t.data,e===mo&&go?null:e;default:return null}}function gp(e,t){if(Rn)return e==="compositionend"||!ga&&cc(e,t)?(e=oc(),El=pa=Xt=null,Rn=!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 uc&&t.locale!=="ko"?null:t.data;default:return null}}var yp={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 yo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!yp[e.type]:t==="textarea"}function fc(e,t,n,r){Uu(r),t=Wl(t,"onChange"),0<t.length&&(n=new ha("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Cr=null,Ar=null;function vp(e){Sc(e,0)}function ds(e){var t=Dn(e);if(Du(t))return e}function xp(e,t){if(e==="change")return t}var pc=!1;if(Mt){var Os;if(Mt){var As="oninput"in document;if(!As){var vo=document.createElement("div");vo.setAttribute("oninput","return;"),As=typeof vo.oninput=="function"}Os=As}else Os=!1;pc=Os&&(!document.documentMode||9<document.documentMode)}function xo(){Cr&&(Cr.detachEvent("onpropertychange",hc),Ar=Cr=null)}function hc(e){if(e.propertyName==="value"&&ds(Ar)){var t=[];fc(t,Ar,e,oa(e)),Ku(vp,t)}}function wp(e,t,n){e==="focusin"?(xo(),Cr=t,Ar=n,Cr.attachEvent("onpropertychange",hc)):e==="focusout"&&xo()}function kp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ds(Ar)}function jp(e,t){if(e==="click")return ds(t)}function Sp(e,t){if(e==="input"||e==="change")return ds(t)}function Np(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ct=typeof Object.is=="function"?Object.is:Np;function Mr(e,t){if(Ct(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var l=n[r];if(!li.call(t,l)||!Ct(e[l],t[l]))return!1}return!0}function wo(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ko(e,t){var n=wo(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=wo(n)}}function mc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?mc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gc(){for(var e=window,t=Ol();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ol(e.document)}return t}function ya(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function _p(e){var t=gc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&mc(n.ownerDocument.documentElement,n)){if(r!==null&&ya(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=ko(n,i);var a=ko(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Cp=Mt&&"documentMode"in document&&11>=document.documentMode,In=null,Si=null,Er=null,Ni=!1;function jo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ni||In==null||In!==Ol(r)||(r=In,"selectionStart"in r&&ya(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Er&&Mr(Er,r)||(Er=r,r=Wl(Si,"onSelect"),0<r.length&&(t=new ha("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=In)))}function pl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var $n={animationend:pl("Animation","AnimationEnd"),animationiteration:pl("Animation","AnimationIteration"),animationstart:pl("Animation","AnimationStart"),transitionend:pl("Transition","TransitionEnd")},Ms={},yc={};Mt&&(yc=document.createElement("div").style,"AnimationEvent"in window||(delete $n.animationend.animation,delete $n.animationiteration.animation,delete $n.animationstart.animation),"TransitionEvent"in window||delete $n.transitionend.transition);function fs(e){if(Ms[e])return Ms[e];if(!$n[e])return e;var t=$n[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in yc)return Ms[e]=t[n];return e}var vc=fs("animationend"),xc=fs("animationiteration"),wc=fs("animationstart"),kc=fs("transitionend"),jc=new Map,So="abort auxClick 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(" ");function on(e,t){jc.set(e,t),_n(t,[e])}for(var Fs=0;Fs<So.length;Fs++){var Bs=So[Fs],Ep=Bs.toLowerCase(),Tp=Bs[0].toUpperCase()+Bs.slice(1);on(Ep,"on"+Tp)}on(vc,"onAnimationEnd");on(xc,"onAnimationIteration");on(wc,"onAnimationStart");on("dblclick","onDoubleClick");on("focusin","onFocus");on("focusout","onBlur");on(kc,"onTransitionEnd");Jn("onMouseEnter",["mouseout","mouseover"]);Jn("onMouseLeave",["mouseout","mouseover"]);Jn("onPointerEnter",["pointerout","pointerover"]);Jn("onPointerLeave",["pointerout","pointerover"]);_n("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));_n("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));_n("onBeforeInput",["compositionend","keypress","textInput","paste"]);_n("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));_n("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));_n("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kr="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(" "),bp=new Set("cancel close invalid load scroll toggle".split(" ").concat(kr));function No(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Ef(r,t,void 0,e),e.currentTarget=null}function Sc(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],l=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==i&&l.isPropagationStopped())break e;No(l,o,c),i=u}else for(a=0;a<r.length;a++){if(o=r[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==i&&l.isPropagationStopped())break e;No(l,o,c),i=u}}}if(Ml)throw e=xi,Ml=!1,xi=null,e}function ae(e,t){var n=t[bi];n===void 0&&(n=t[bi]=new Set);var r=e+"__bubble";n.has(r)||(Nc(t,e,2,!1),n.add(r))}function Hs(e,t,n){var r=0;t&&(r|=4),Nc(n,e,r,t)}var hl="_reactListening"+Math.random().toString(36).slice(2);function Fr(e){if(!e[hl]){e[hl]=!0,Lu.forEach(function(n){n!=="selectionchange"&&(bp.has(n)||Hs(n,!1,e),Hs(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[hl]||(t[hl]=!0,Hs("selectionchange",!1,t))}}function Nc(e,t,n,r){switch(ac(t)){case 1:var l=Uf;break;case 4:l=Wf;break;default:l=fa}n=l.bind(null,t,n,e),l=void 0,!vi||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),r?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function Us(e,t,n,r,l){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===l||o.nodeType===8&&o.parentNode===l)break;if(a===4)for(a=r.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===l||u.nodeType===8&&u.parentNode===l))return;a=a.return}for(;o!==null;){if(a=hn(o),a===null)return;if(u=a.tag,u===5||u===6){r=i=a;continue e}o=o.parentNode}}r=r.return}Ku(function(){var c=i,y=oa(n),h=[];e:{var m=jc.get(e);if(m!==void 0){var x=ha,v=e;switch(e){case"keypress":if(Tl(n)===0)break e;case"keydown":case"keyup":x=sp;break;case"focusin":v="focus",x=Ds;break;case"focusout":v="blur",x=Ds;break;case"beforeblur":case"afterblur":x=Ds;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":x=fo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=Kf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=op;break;case vc:case xc:case wc:x=Jf;break;case kc:x=cp;break;case"scroll":x=Vf;break;case"wheel":x=fp;break;case"copy":case"cut":case"paste":x=Gf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=ho}var w=(t&4)!==0,j=!w&&e==="scroll",p=w?m!==null?m+"Capture":null:m;w=[];for(var d=c,g;d!==null;){g=d;var k=g.stateNode;if(g.tag===5&&k!==null&&(g=k,p!==null&&(k=Ir(d,p),k!=null&&w.push(Br(d,k,g)))),j)break;d=d.return}0<w.length&&(m=new x(m,v,null,n,y),h.push({event:m,listeners:w}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",m&&n!==gi&&(v=n.relatedTarget||n.fromElement)&&(hn(v)||v[Ft]))break e;if((x||m)&&(m=y.window===y?y:(m=y.ownerDocument)?m.defaultView||m.parentWindow:window,x?(v=n.relatedTarget||n.toElement,x=c,v=v?hn(v):null,v!==null&&(j=Cn(v),v!==j||v.tag!==5&&v.tag!==6)&&(v=null)):(x=null,v=c),x!==v)){if(w=fo,k="onMouseLeave",p="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(w=ho,k="onPointerLeave",p="onPointerEnter",d="pointer"),j=x==null?m:Dn(x),g=v==null?m:Dn(v),m=new w(k,d+"leave",x,n,y),m.target=j,m.relatedTarget=g,k=null,hn(y)===c&&(w=new w(p,d+"enter",v,n,y),w.target=g,w.relatedTarget=j,k=w),j=k,x&&v)t:{for(w=x,p=v,d=0,g=w;g;g=bn(g))d++;for(g=0,k=p;k;k=bn(k))g++;for(;0<d-g;)w=bn(w),d--;for(;0<g-d;)p=bn(p),g--;for(;d--;){if(w===p||p!==null&&w===p.alternate)break t;w=bn(w),p=bn(p)}w=null}else w=null;x!==null&&_o(h,m,x,w,!1),v!==null&&j!==null&&_o(h,j,v,w,!0)}}e:{if(m=c?Dn(c):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var _=xp;else if(yo(m))if(pc)_=Sp;else{_=kp;var b=wp}else(x=m.nodeName)&&x.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(_=jp);if(_&&(_=_(e,c))){fc(h,_,n,y);break e}b&&b(e,m,c),e==="focusout"&&(b=m._wrapperState)&&b.controlled&&m.type==="number"&&di(m,"number",m.value)}switch(b=c?Dn(c):window,e){case"focusin":(yo(b)||b.contentEditable==="true")&&(In=b,Si=c,Er=null);break;case"focusout":Er=Si=In=null;break;case"mousedown":Ni=!0;break;case"contextmenu":case"mouseup":case"dragend":Ni=!1,jo(h,n,y);break;case"selectionchange":if(Cp)break;case"keydown":case"keyup":jo(h,n,y)}var E;if(ga)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else Rn?cc(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(uc&&n.locale!=="ko"&&(Rn||N!=="onCompositionStart"?N==="onCompositionEnd"&&Rn&&(E=oc()):(Xt=y,pa="value"in Xt?Xt.value:Xt.textContent,Rn=!0)),b=Wl(c,N),0<b.length&&(N=new po(N,e,null,n,y),h.push({event:N,listeners:b}),E?N.data=E:(E=dc(n),E!==null&&(N.data=E)))),(E=hp?mp(e,n):gp(e,n))&&(c=Wl(c,"onBeforeInput"),0<c.length&&(y=new po("onBeforeInput","beforeinput",null,n,y),h.push({event:y,listeners:c}),y.data=E))}Sc(h,t)})}function Br(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wl(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,i=l.stateNode;l.tag===5&&i!==null&&(l=i,i=Ir(e,n),i!=null&&r.unshift(Br(e,i,l)),i=Ir(e,t),i!=null&&r.push(Br(e,i,l))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function _o(e,t,n,r,l){for(var i=t._reactName,a=[];n!==null&&n!==r;){var o=n,u=o.alternate,c=o.stateNode;if(u!==null&&u===r)break;o.tag===5&&c!==null&&(o=c,l?(u=Ir(n,i),u!=null&&a.unshift(Br(n,u,o))):l||(u=Ir(n,i),u!=null&&a.push(Br(n,u,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Pp=/\r\n?/g,Lp=/\u0000|\uFFFD/g;function Co(e){return(typeof e=="string"?e:""+e).replace(Pp,`
|
||
`).replace(Lp,"")}function ml(e,t,n){if(t=Co(t),Co(e)!==t&&n)throw Error(L(425))}function Vl(){}var _i=null,Ci=null;function Ei(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ti=typeof setTimeout=="function"?setTimeout:void 0,zp=typeof clearTimeout=="function"?clearTimeout:void 0,Eo=typeof Promise=="function"?Promise:void 0,Rp=typeof queueMicrotask=="function"?queueMicrotask:typeof Eo<"u"?function(e){return Eo.resolve(null).then(e).catch(Ip)}:Ti;function Ip(e){setTimeout(function(){throw e})}function Ws(e,t){var n=t,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(r===0){e.removeChild(l),Or(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);Or(t)}function en(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==="$?")break;if(t==="/$")return null}}return e}function To(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var sr=Math.random().toString(36).slice(2),bt="__reactFiber$"+sr,Hr="__reactProps$"+sr,Ft="__reactContainer$"+sr,bi="__reactEvents$"+sr,$p="__reactListeners$"+sr,Dp="__reactHandles$"+sr;function hn(e){var t=e[bt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=To(e);e!==null;){if(n=e[bt])return n;e=To(e)}return t}e=n,n=e.parentNode}return null}function Zr(e){return e=e[bt]||e[Ft],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Dn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(L(33))}function ps(e){return e[Hr]||null}var Pi=[],On=-1;function un(e){return{current:e}}function oe(e){0>On||(e.current=Pi[On],Pi[On]=null,On--)}function ie(e,t){On++,Pi[On]=e.current,e.current=t}var an={},Fe=un(an),et=un(!1),wn=an;function Yn(e,t){var n=e.type.contextTypes;if(!n)return an;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function tt(e){return e=e.childContextTypes,e!=null}function Ql(){oe(et),oe(Fe)}function bo(e,t,n){if(Fe.current!==an)throw Error(L(168));ie(Fe,t),ie(et,n)}function _c(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(L(108,wf(e)||"Unknown",l));return me({},n,r)}function Kl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,wn=Fe.current,ie(Fe,e),ie(et,et.current),!0}function Po(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=_c(e,t,wn),r.__reactInternalMemoizedMergedChildContext=e,oe(et),oe(Fe),ie(Fe,e)):oe(et),ie(et,n)}var $t=null,hs=!1,Vs=!1;function Cc(e){$t===null?$t=[e]:$t.push(e)}function Op(e){hs=!0,Cc(e)}function cn(){if(!Vs&&$t!==null){Vs=!0;var e=0,t=le;try{var n=$t;for(le=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$t=null,hs=!1}catch(l){throw $t!==null&&($t=$t.slice(e+1)),Yu(ua,cn),l}finally{le=t,Vs=!1}}return null}var An=[],Mn=0,ql=null,Xl=0,ft=[],pt=0,kn=null,Dt=1,Ot="";function fn(e,t){An[Mn++]=Xl,An[Mn++]=ql,ql=e,Xl=t}function Ec(e,t,n){ft[pt++]=Dt,ft[pt++]=Ot,ft[pt++]=kn,kn=e;var r=Dt;e=Ot;var l=32-Nt(r)-1;r&=~(1<<l),n+=1;var i=32-Nt(t)+l;if(30<i){var a=l-l%5;i=(r&(1<<a)-1).toString(32),r>>=a,l-=a,Dt=1<<32-Nt(t)+l|n<<l|r,Ot=i+e}else Dt=1<<i|n<<l|r,Ot=e}function va(e){e.return!==null&&(fn(e,1),Ec(e,1,0))}function xa(e){for(;e===ql;)ql=An[--Mn],An[Mn]=null,Xl=An[--Mn],An[Mn]=null;for(;e===kn;)kn=ft[--pt],ft[pt]=null,Ot=ft[--pt],ft[pt]=null,Dt=ft[--pt],ft[pt]=null}var it=null,st=null,de=!1,jt=null;function Tc(e,t){var n=ht(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Lo(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,it=e,st=en(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,it=e,st=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=kn!==null?{id:Dt,overflow:Ot}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ht(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,it=e,st=null,!0):!1;default:return!1}}function Li(e){return(e.mode&1)!==0&&(e.flags&128)===0}function zi(e){if(de){var t=st;if(t){var n=t;if(!Lo(e,t)){if(Li(e))throw Error(L(418));t=en(n.nextSibling);var r=it;t&&Lo(e,t)?Tc(r,n):(e.flags=e.flags&-4097|2,de=!1,it=e)}}else{if(Li(e))throw Error(L(418));e.flags=e.flags&-4097|2,de=!1,it=e}}}function zo(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;it=e}function gl(e){if(e!==it)return!1;if(!de)return zo(e),de=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ei(e.type,e.memoizedProps)),t&&(t=st)){if(Li(e))throw bc(),Error(L(418));for(;t;)Tc(e,t),t=en(t.nextSibling)}if(zo(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){st=en(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}st=null}}else st=it?en(e.stateNode.nextSibling):null;return!0}function bc(){for(var e=st;e;)e=en(e.nextSibling)}function Gn(){st=it=null,de=!1}function wa(e){jt===null?jt=[e]:jt.push(e)}var Ap=Ut.ReactCurrentBatchConfig;function hr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(L(309));var r=n.stateNode}if(!r)throw Error(L(147,e));var l=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var o=l.refs;a===null?delete o[i]:o[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(L(284));if(!n._owner)throw Error(L(290,e))}return e}function yl(e,t){throw e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ro(e){var t=e._init;return t(e._payload)}function Pc(e){function t(p,d){if(e){var g=p.deletions;g===null?(p.deletions=[d],p.flags|=16):g.push(d)}}function n(p,d){if(!e)return null;for(;d!==null;)t(p,d),d=d.sibling;return null}function r(p,d){for(p=new Map;d!==null;)d.key!==null?p.set(d.key,d):p.set(d.index,d),d=d.sibling;return p}function l(p,d){return p=ln(p,d),p.index=0,p.sibling=null,p}function i(p,d,g){return p.index=g,e?(g=p.alternate,g!==null?(g=g.index,g<d?(p.flags|=2,d):g):(p.flags|=2,d)):(p.flags|=1048576,d)}function a(p){return e&&p.alternate===null&&(p.flags|=2),p}function o(p,d,g,k){return d===null||d.tag!==6?(d=Gs(g,p.mode,k),d.return=p,d):(d=l(d,g),d.return=p,d)}function u(p,d,g,k){var _=g.type;return _===zn?y(p,d,g.props.children,k,g.key):d!==null&&(d.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Vt&&Ro(_)===d.type)?(k=l(d,g.props),k.ref=hr(p,d,g),k.return=p,k):(k=$l(g.type,g.key,g.props,null,p.mode,k),k.ref=hr(p,d,g),k.return=p,k)}function c(p,d,g,k){return d===null||d.tag!==4||d.stateNode.containerInfo!==g.containerInfo||d.stateNode.implementation!==g.implementation?(d=Zs(g,p.mode,k),d.return=p,d):(d=l(d,g.children||[]),d.return=p,d)}function y(p,d,g,k,_){return d===null||d.tag!==7?(d=xn(g,p.mode,k,_),d.return=p,d):(d=l(d,g),d.return=p,d)}function h(p,d,g){if(typeof d=="string"&&d!==""||typeof d=="number")return d=Gs(""+d,p.mode,g),d.return=p,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case il:return g=$l(d.type,d.key,d.props,null,p.mode,g),g.ref=hr(p,null,d),g.return=p,g;case Ln:return d=Zs(d,p.mode,g),d.return=p,d;case Vt:var k=d._init;return h(p,k(d._payload),g)}if(xr(d)||ur(d))return d=xn(d,p.mode,g,null),d.return=p,d;yl(p,d)}return null}function m(p,d,g,k){var _=d!==null?d.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return _!==null?null:o(p,d,""+g,k);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case il:return g.key===_?u(p,d,g,k):null;case Ln:return g.key===_?c(p,d,g,k):null;case Vt:return _=g._init,m(p,d,_(g._payload),k)}if(xr(g)||ur(g))return _!==null?null:y(p,d,g,k,null);yl(p,g)}return null}function x(p,d,g,k,_){if(typeof k=="string"&&k!==""||typeof k=="number")return p=p.get(g)||null,o(d,p,""+k,_);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case il:return p=p.get(k.key===null?g:k.key)||null,u(d,p,k,_);case Ln:return p=p.get(k.key===null?g:k.key)||null,c(d,p,k,_);case Vt:var b=k._init;return x(p,d,g,b(k._payload),_)}if(xr(k)||ur(k))return p=p.get(g)||null,y(d,p,k,_,null);yl(d,k)}return null}function v(p,d,g,k){for(var _=null,b=null,E=d,N=d=0,I=null;E!==null&&N<g.length;N++){E.index>N?(I=E,E=null):I=E.sibling;var P=m(p,E,g[N],k);if(P===null){E===null&&(E=I);break}e&&E&&P.alternate===null&&t(p,E),d=i(P,d,N),b===null?_=P:b.sibling=P,b=P,E=I}if(N===g.length)return n(p,E),de&&fn(p,N),_;if(E===null){for(;N<g.length;N++)E=h(p,g[N],k),E!==null&&(d=i(E,d,N),b===null?_=E:b.sibling=E,b=E);return de&&fn(p,N),_}for(E=r(p,E);N<g.length;N++)I=x(E,p,N,g[N],k),I!==null&&(e&&I.alternate!==null&&E.delete(I.key===null?N:I.key),d=i(I,d,N),b===null?_=I:b.sibling=I,b=I);return e&&E.forEach(function(V){return t(p,V)}),de&&fn(p,N),_}function w(p,d,g,k){var _=ur(g);if(typeof _!="function")throw Error(L(150));if(g=_.call(g),g==null)throw Error(L(151));for(var b=_=null,E=d,N=d=0,I=null,P=g.next();E!==null&&!P.done;N++,P=g.next()){E.index>N?(I=E,E=null):I=E.sibling;var V=m(p,E,P.value,k);if(V===null){E===null&&(E=I);break}e&&E&&V.alternate===null&&t(p,E),d=i(V,d,N),b===null?_=V:b.sibling=V,b=V,E=I}if(P.done)return n(p,E),de&&fn(p,N),_;if(E===null){for(;!P.done;N++,P=g.next())P=h(p,P.value,k),P!==null&&(d=i(P,d,N),b===null?_=P:b.sibling=P,b=P);return de&&fn(p,N),_}for(E=r(p,E);!P.done;N++,P=g.next())P=x(E,p,N,P.value,k),P!==null&&(e&&P.alternate!==null&&E.delete(P.key===null?N:P.key),d=i(P,d,N),b===null?_=P:b.sibling=P,b=P);return e&&E.forEach(function(B){return t(p,B)}),de&&fn(p,N),_}function j(p,d,g,k){if(typeof g=="object"&&g!==null&&g.type===zn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case il:e:{for(var _=g.key,b=d;b!==null;){if(b.key===_){if(_=g.type,_===zn){if(b.tag===7){n(p,b.sibling),d=l(b,g.props.children),d.return=p,p=d;break e}}else if(b.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Vt&&Ro(_)===b.type){n(p,b.sibling),d=l(b,g.props),d.ref=hr(p,b,g),d.return=p,p=d;break e}n(p,b);break}else t(p,b);b=b.sibling}g.type===zn?(d=xn(g.props.children,p.mode,k,g.key),d.return=p,p=d):(k=$l(g.type,g.key,g.props,null,p.mode,k),k.ref=hr(p,d,g),k.return=p,p=k)}return a(p);case Ln:e:{for(b=g.key;d!==null;){if(d.key===b)if(d.tag===4&&d.stateNode.containerInfo===g.containerInfo&&d.stateNode.implementation===g.implementation){n(p,d.sibling),d=l(d,g.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=Zs(g,p.mode,k),d.return=p,p=d}return a(p);case Vt:return b=g._init,j(p,d,b(g._payload),k)}if(xr(g))return v(p,d,g,k);if(ur(g))return w(p,d,g,k);yl(p,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,g),d.return=p,p=d):(n(p,d),d=Gs(g,p.mode,k),d.return=p,p=d),a(p)):n(p,d)}return j}var Zn=Pc(!0),Lc=Pc(!1),Jl=un(null),Yl=null,Fn=null,ka=null;function ja(){ka=Fn=Yl=null}function Sa(e){var t=Jl.current;oe(Jl),e._currentValue=t}function Ri(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Kn(e,t){Yl=e,ka=Fn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ze=!0),e.firstContext=null)}function gt(e){var t=e._currentValue;if(ka!==e)if(e={context:e,memoizedValue:t,next:null},Fn===null){if(Yl===null)throw Error(L(308));Fn=e,Yl.dependencies={lanes:0,firstContext:e}}else Fn=Fn.next=e;return t}var mn=null;function Na(e){mn===null?mn=[e]:mn.push(e)}function zc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Na(t)):(n.next=l.next,l.next=n),t.interleaved=n,Bt(e,r)}function Bt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Qt=!1;function _a(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Rc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function At(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ee&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Bt(e,n)}return l=r.interleaved,l===null?(t.next=t,Na(r)):(t.next=l.next,l.next=t),r.interleaved=t,Bt(e,n)}function bl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ca(e,n)}}function Io(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Gl(e,t,n,r){var l=e.updateQueue;Qt=!1;var i=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?i=c:a.next=c,a=u;var y=e.alternate;y!==null&&(y=y.updateQueue,o=y.lastBaseUpdate,o!==a&&(o===null?y.firstBaseUpdate=c:o.next=c,y.lastBaseUpdate=u))}if(i!==null){var h=l.baseState;a=0,y=c=u=null,o=i;do{var m=o.lane,x=o.eventTime;if((r&m)===m){y!==null&&(y=y.next={eventTime:x,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var v=e,w=o;switch(m=t,x=n,w.tag){case 1:if(v=w.payload,typeof v=="function"){h=v.call(x,h,m);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=w.payload,m=typeof v=="function"?v.call(x,h,m):v,m==null)break e;h=me({},h,m);break e;case 2:Qt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[o]:m.push(o))}else x={eventTime:x,lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},y===null?(c=y=x,u=h):y=y.next=x,a|=m;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;m=o,o=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(y===null&&(u=h),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=y,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Sn|=a,e.lanes=a,e.memoizedState=h}}function $o(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],l=r.callback;if(l!==null){if(r.callback=null,r=n,typeof l!="function")throw Error(L(191,l));l.call(r)}}}var el={},Lt=un(el),Ur=un(el),Wr=un(el);function gn(e){if(e===el)throw Error(L(174));return e}function Ca(e,t){switch(ie(Wr,t),ie(Ur,e),ie(Lt,el),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pi(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=pi(t,e)}oe(Lt),ie(Lt,t)}function er(){oe(Lt),oe(Ur),oe(Wr)}function Ic(e){gn(Wr.current);var t=gn(Lt.current),n=pi(t,e.type);t!==n&&(ie(Ur,e),ie(Lt,n))}function Ea(e){Ur.current===e&&(oe(Lt),oe(Ur))}var pe=un(0);function Zl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Qs=[];function Ta(){for(var e=0;e<Qs.length;e++)Qs[e]._workInProgressVersionPrimary=null;Qs.length=0}var Pl=Ut.ReactCurrentDispatcher,Ks=Ut.ReactCurrentBatchConfig,jn=0,he=null,Ce=null,Te=null,es=!1,Tr=!1,Vr=0,Mp=0;function Oe(){throw Error(L(321))}function ba(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ct(e[n],t[n]))return!1;return!0}function Pa(e,t,n,r,l,i){if(jn=i,he=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Pl.current=e===null||e.memoizedState===null?Up:Wp,e=n(r,l),Tr){i=0;do{if(Tr=!1,Vr=0,25<=i)throw Error(L(301));i+=1,Te=Ce=null,t.updateQueue=null,Pl.current=Vp,e=n(r,l)}while(Tr)}if(Pl.current=ts,t=Ce!==null&&Ce.next!==null,jn=0,Te=Ce=he=null,es=!1,t)throw Error(L(300));return e}function La(){var e=Vr!==0;return Vr=0,e}function Tt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Te===null?he.memoizedState=Te=e:Te=Te.next=e,Te}function yt(){if(Ce===null){var e=he.alternate;e=e!==null?e.memoizedState:null}else e=Ce.next;var t=Te===null?he.memoizedState:Te.next;if(t!==null)Te=t,Ce=e;else{if(e===null)throw Error(L(310));Ce=e,e={memoizedState:Ce.memoizedState,baseState:Ce.baseState,baseQueue:Ce.baseQueue,queue:Ce.queue,next:null},Te===null?he.memoizedState=Te=e:Te=Te.next=e}return Te}function Qr(e,t){return typeof t=="function"?t(e):t}function qs(e){var t=yt(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=Ce,l=r.baseQueue,i=n.pending;if(i!==null){if(l!==null){var a=l.next;l.next=i.next,i.next=a}r.baseQueue=l=i,n.pending=null}if(l!==null){i=l.next,r=r.baseState;var o=a=null,u=null,c=i;do{var y=c.lane;if((jn&y)===y)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var h={lane:y,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=h,a=r):u=u.next=h,he.lanes|=y,Sn|=y}c=c.next}while(c!==null&&c!==i);u===null?a=r:u.next=o,Ct(r,t.memoizedState)||(Ze=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){l=e;do i=l.lane,he.lanes|=i,Sn|=i,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xs(e){var t=yt(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=n.dispatch,l=n.pending,i=t.memoizedState;if(l!==null){n.pending=null;var a=l=l.next;do i=e(i,a.action),a=a.next;while(a!==l);Ct(i,t.memoizedState)||(Ze=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function $c(){}function Dc(e,t){var n=he,r=yt(),l=t(),i=!Ct(r.memoizedState,l);if(i&&(r.memoizedState=l,Ze=!0),r=r.queue,za(Mc.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Te!==null&&Te.memoizedState.tag&1){if(n.flags|=2048,Kr(9,Ac.bind(null,n,r,l,t),void 0,null),be===null)throw Error(L(349));jn&30||Oc(n,t,l)}return l}function Oc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=he.updateQueue,t===null?(t={lastEffect:null,stores:null},he.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ac(e,t,n,r){t.value=n,t.getSnapshot=r,Fc(t)&&Bc(e)}function Mc(e,t,n){return n(function(){Fc(t)&&Bc(e)})}function Fc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ct(e,n)}catch{return!0}}function Bc(e){var t=Bt(e,1);t!==null&&_t(t,e,1,-1)}function Do(e){var t=Tt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qr,lastRenderedState:e},t.queue=e,e=e.dispatch=Hp.bind(null,he,e),[t.memoizedState,e]}function Kr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=he.updateQueue,t===null?(t={lastEffect:null,stores:null},he.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Hc(){return yt().memoizedState}function Ll(e,t,n,r){var l=Tt();he.flags|=e,l.memoizedState=Kr(1|t,n,void 0,r===void 0?null:r)}function ms(e,t,n,r){var l=yt();r=r===void 0?null:r;var i=void 0;if(Ce!==null){var a=Ce.memoizedState;if(i=a.destroy,r!==null&&ba(r,a.deps)){l.memoizedState=Kr(t,n,i,r);return}}he.flags|=e,l.memoizedState=Kr(1|t,n,i,r)}function Oo(e,t){return Ll(8390656,8,e,t)}function za(e,t){return ms(2048,8,e,t)}function Uc(e,t){return ms(4,2,e,t)}function Wc(e,t){return ms(4,4,e,t)}function Vc(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qc(e,t,n){return n=n!=null?n.concat([e]):null,ms(4,4,Vc.bind(null,t,e),n)}function Ra(){}function Kc(e,t){var n=yt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ba(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function qc(e,t){var n=yt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ba(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Xc(e,t,n){return jn&21?(Ct(n,t)||(n=ec(),he.lanes|=n,Sn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ze=!0),e.memoizedState=n)}function Fp(e,t){var n=le;le=n!==0&&4>n?n:4,e(!0);var r=Ks.transition;Ks.transition={};try{e(!1),t()}finally{le=n,Ks.transition=r}}function Jc(){return yt().memoizedState}function Bp(e,t,n){var r=rn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Yc(e))Gc(t,n);else if(n=zc(e,t,n,r),n!==null){var l=Ke();_t(n,e,r,l),Zc(n,t,r)}}function Hp(e,t,n){var r=rn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Yc(e))Gc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(l.hasEagerState=!0,l.eagerState=o,Ct(o,a)){var u=t.interleaved;u===null?(l.next=l,Na(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=zc(e,t,l,r),n!==null&&(l=Ke(),_t(n,e,r,l),Zc(n,t,r))}}function Yc(e){var t=e.alternate;return e===he||t!==null&&t===he}function Gc(e,t){Tr=es=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Zc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ca(e,n)}}var ts={readContext:gt,useCallback:Oe,useContext:Oe,useEffect:Oe,useImperativeHandle:Oe,useInsertionEffect:Oe,useLayoutEffect:Oe,useMemo:Oe,useReducer:Oe,useRef:Oe,useState:Oe,useDebugValue:Oe,useDeferredValue:Oe,useTransition:Oe,useMutableSource:Oe,useSyncExternalStore:Oe,useId:Oe,unstable_isNewReconciler:!1},Up={readContext:gt,useCallback:function(e,t){return Tt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:Oo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ll(4194308,4,Vc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ll(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ll(4,2,e,t)},useMemo:function(e,t){var n=Tt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Tt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Bp.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=Tt();return e={current:e},t.memoizedState=e},useState:Do,useDebugValue:Ra,useDeferredValue:function(e){return Tt().memoizedState=e},useTransition:function(){var e=Do(!1),t=e[0];return e=Fp.bind(null,e[1]),Tt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=he,l=Tt();if(de){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),be===null)throw Error(L(349));jn&30||Oc(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Oo(Mc.bind(null,r,i,e),[e]),r.flags|=2048,Kr(9,Ac.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Tt(),t=be.identifierPrefix;if(de){var n=Ot,r=Dt;n=(r&~(1<<32-Nt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Vr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Mp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Wp={readContext:gt,useCallback:Kc,useContext:gt,useEffect:za,useImperativeHandle:Qc,useInsertionEffect:Uc,useLayoutEffect:Wc,useMemo:qc,useReducer:qs,useRef:Hc,useState:function(){return qs(Qr)},useDebugValue:Ra,useDeferredValue:function(e){var t=yt();return Xc(t,Ce.memoizedState,e)},useTransition:function(){var e=qs(Qr)[0],t=yt().memoizedState;return[e,t]},useMutableSource:$c,useSyncExternalStore:Dc,useId:Jc,unstable_isNewReconciler:!1},Vp={readContext:gt,useCallback:Kc,useContext:gt,useEffect:za,useImperativeHandle:Qc,useInsertionEffect:Uc,useLayoutEffect:Wc,useMemo:qc,useReducer:Xs,useRef:Hc,useState:function(){return Xs(Qr)},useDebugValue:Ra,useDeferredValue:function(e){var t=yt();return Ce===null?t.memoizedState=e:Xc(t,Ce.memoizedState,e)},useTransition:function(){var e=Xs(Qr)[0],t=yt().memoizedState;return[e,t]},useMutableSource:$c,useSyncExternalStore:Dc,useId:Jc,unstable_isNewReconciler:!1};function wt(e,t){if(e&&e.defaultProps){t=me({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ii(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:me({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var gs={isMounted:function(e){return(e=e._reactInternals)?Cn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ke(),l=rn(e),i=At(r,l);i.payload=t,n!=null&&(i.callback=n),t=tn(e,i,l),t!==null&&(_t(t,e,l,r),bl(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ke(),l=rn(e),i=At(r,l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=tn(e,i,l),t!==null&&(_t(t,e,l,r),bl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ke(),r=rn(e),l=At(n,r);l.tag=2,t!=null&&(l.callback=t),t=tn(e,l,r),t!==null&&(_t(t,e,r,n),bl(t,e,r))}};function Ao(e,t,n,r,l,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Mr(n,r)||!Mr(l,i):!0}function ed(e,t,n){var r=!1,l=an,i=t.contextType;return typeof i=="object"&&i!==null?i=gt(i):(l=tt(t)?wn:Fe.current,r=t.contextTypes,i=(r=r!=null)?Yn(e,l):an),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=gs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function Mo(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&gs.enqueueReplaceState(t,t.state,null)}function $i(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},_a(e);var i=t.contextType;typeof i=="object"&&i!==null?l.context=gt(i):(i=tt(t)?wn:Fe.current,l.context=Yn(e,i)),l.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ii(e,t,i,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&gs.enqueueReplaceState(l,l.state,null),Gl(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function tr(e,t){try{var n="",r=t;do n+=xf(r),r=r.return;while(r);var l=n}catch(i){l=`
|
||
Error generating stack: `+i.message+`
|
||
`+i.stack}return{value:e,source:t,stack:l,digest:null}}function Js(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Di(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Qp=typeof WeakMap=="function"?WeakMap:Map;function td(e,t,n){n=At(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rs||(rs=!0,Qi=r),Di(e,t)},n}function nd(e,t,n){n=At(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Di(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Di(e,t),typeof r!="function"&&(nn===null?nn=new Set([this]):nn.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Fo(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Qp;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=ih.bind(null,e,t,n),t.then(e,e))}function Bo(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ho(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=At(-1,1),t.tag=2,tn(n,t,1))),n.lanes|=1),e)}var Kp=Ut.ReactCurrentOwner,Ze=!1;function Qe(e,t,n,r){t.child=e===null?Lc(t,null,n,r):Zn(t,e.child,n,r)}function Uo(e,t,n,r,l){n=n.render;var i=t.ref;return Kn(t,l),r=Pa(e,t,n,r,i,l),n=La(),e!==null&&!Ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Ht(e,t,l)):(de&&n&&va(t),t.flags|=1,Qe(e,t,r,l),t.child)}function Wo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Ba(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,rd(e,t,i,r,l)):(e=$l(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Mr,n(a,r)&&e.ref===t.ref)return Ht(e,t,l)}return t.flags|=1,e=ln(i,r),e.ref=t.ref,e.return=t,t.child=e}function rd(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(Mr(i,r)&&e.ref===t.ref)if(Ze=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(Ze=!0);else return t.lanes=e.lanes,Ht(e,t,l)}return Oi(e,t,n,r,l)}function ld(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ie(Hn,lt),lt|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ie(Hn,lt),lt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ie(Hn,lt),lt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ie(Hn,lt),lt|=r;return Qe(e,t,l,n),t.child}function sd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Oi(e,t,n,r,l){var i=tt(n)?wn:Fe.current;return i=Yn(t,i),Kn(t,l),n=Pa(e,t,n,r,i,l),r=La(),e!==null&&!Ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Ht(e,t,l)):(de&&r&&va(t),t.flags|=1,Qe(e,t,n,l),t.child)}function Vo(e,t,n,r,l){if(tt(n)){var i=!0;Kl(t)}else i=!1;if(Kn(t,l),t.stateNode===null)zl(e,t),ed(t,n,r),$i(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=gt(c):(c=tt(n)?wn:Fe.current,c=Yn(t,c));var y=n.getDerivedStateFromProps,h=typeof y=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==c)&&Mo(t,a,r,c),Qt=!1;var m=t.memoizedState;a.state=m,Gl(t,r,a,l),u=t.memoizedState,o!==r||m!==u||et.current||Qt?(typeof y=="function"&&(Ii(t,n,y,r),u=t.memoizedState),(o=Qt||Ao(t,n,o,r,m,u,c))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Rc(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:wt(t.type,o),a.props=c,h=t.pendingProps,m=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=gt(u):(u=tt(n)?wn:Fe.current,u=Yn(t,u));var x=n.getDerivedStateFromProps;(y=typeof x=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==h||m!==u)&&Mo(t,a,r,u),Qt=!1,m=t.memoizedState,a.state=m,Gl(t,r,a,l);var v=t.memoizedState;o!==h||m!==v||et.current||Qt?(typeof x=="function"&&(Ii(t,n,x,r),v=t.memoizedState),(c=Qt||Ao(t,n,c,r,m,v,u)||!1)?(y||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,v,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,v,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),a.props=r,a.state=v,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Ai(e,t,n,r,i,l)}function Ai(e,t,n,r,l,i){sd(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&Po(t,n,!1),Ht(e,t,i);r=t.stateNode,Kp.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Zn(t,e.child,null,i),t.child=Zn(t,null,o,i)):Qe(e,t,o,i),t.memoizedState=r.state,l&&Po(t,n,!0),t.child}function id(e){var t=e.stateNode;t.pendingContext?bo(e,t.pendingContext,t.pendingContext!==t.context):t.context&&bo(e,t.context,!1),Ca(e,t.containerInfo)}function Qo(e,t,n,r,l){return Gn(),wa(l),t.flags|=256,Qe(e,t,n,r),t.child}var Mi={dehydrated:null,treeContext:null,retryLane:0};function Fi(e){return{baseLanes:e,cachePool:null,transitions:null}}function ad(e,t,n){var r=t.pendingProps,l=pe.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(l&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),ie(pe,l&1),e===null)return zi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=xs(a,r,0,null),e=xn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Fi(n),t.memoizedState=Mi,e):Ia(t,a));if(l=e.memoizedState,l!==null&&(o=l.dehydrated,o!==null))return qp(e,t,a,r,o,l,n);if(i){i=r.fallback,a=t.mode,l=e.child,o=l.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=ln(l,u),r.subtreeFlags=l.subtreeFlags&14680064),o!==null?i=ln(o,i):(i=xn(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?Fi(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Mi,r}return i=e.child,e=i.sibling,r=ln(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ia(e,t){return t=xs({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function vl(e,t,n,r){return r!==null&&wa(r),Zn(t,e.child,null,n),e=Ia(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qp(e,t,n,r,l,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Js(Error(L(422))),vl(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=xs({mode:"visible",children:r.children},l,0,null),i=xn(i,l,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Zn(t,e.child,null,a),t.child.memoizedState=Fi(a),t.memoizedState=Mi,i);if(!(t.mode&1))return vl(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(L(419)),r=Js(i,r,void 0),vl(e,t,a,r)}if(o=(a&e.childLanes)!==0,Ze||o){if(r=be,r!==null){switch(a&-a){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|a)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,Bt(e,l),_t(r,e,l,-1))}return Fa(),r=Js(Error(L(421))),vl(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=ah.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,st=en(l.nextSibling),it=t,de=!0,jt=null,e!==null&&(ft[pt++]=Dt,ft[pt++]=Ot,ft[pt++]=kn,Dt=e.id,Ot=e.overflow,kn=t),t=Ia(t,r.children),t.flags|=4096,t)}function Ko(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ri(e.return,t,n)}function Ys(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function od(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(Qe(e,t,r.children,n),r=pe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ko(e,n,t);else if(e.tag===19)Ko(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ie(pe,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Zl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Ys(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Zl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Ys(t,!0,n,null,i);break;case"together":Ys(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function zl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ht(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Sn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,n=ln(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ln(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Xp(e,t,n){switch(t.tag){case 3:id(t),Gn();break;case 5:Ic(t);break;case 1:tt(t.type)&&Kl(t);break;case 4:Ca(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;ie(Jl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ie(pe,pe.current&1),t.flags|=128,null):n&t.child.childLanes?ad(e,t,n):(ie(pe,pe.current&1),e=Ht(e,t,n),e!==null?e.sibling:null);ie(pe,pe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return od(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),ie(pe,pe.current),r)break;return null;case 22:case 23:return t.lanes=0,ld(e,t,n)}return Ht(e,t,n)}var ud,Bi,cd,dd;ud=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Bi=function(){};cd=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,gn(Lt.current);var i=null;switch(n){case"input":l=ui(e,l),r=ui(e,r),i=[];break;case"select":l=me({},l,{value:void 0}),r=me({},r,{value:void 0}),i=[];break;case"textarea":l=fi(e,l),r=fi(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Vl)}hi(n,r);var a;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var o=l[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(zr.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var u=r[c];if(o=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(i||(i=[]),i.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(i=i||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(zr.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&ae("scroll",e),i||o===u||(i=[])):(i=i||[]).push(c,u))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};dd=function(e,t,n,r){n!==r&&(t.flags|=4)};function mr(e,t){if(!de)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ae(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Jp(e,t,n){var r=t.pendingProps;switch(xa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ae(t),null;case 1:return tt(t.type)&&Ql(),Ae(t),null;case 3:return r=t.stateNode,er(),oe(et),oe(Fe),Ta(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(gl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jt!==null&&(Xi(jt),jt=null))),Bi(e,t),Ae(t),null;case 5:Ea(t);var l=gn(Wr.current);if(n=t.type,e!==null&&t.stateNode!=null)cd(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ae(t),null}if(e=gn(Lt.current),gl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[bt]=t,r[Hr]=i,e=(t.mode&1)!==0,n){case"dialog":ae("cancel",r),ae("close",r);break;case"iframe":case"object":case"embed":ae("load",r);break;case"video":case"audio":for(l=0;l<kr.length;l++)ae(kr[l],r);break;case"source":ae("error",r);break;case"img":case"image":case"link":ae("error",r),ae("load",r);break;case"details":ae("toggle",r);break;case"input":to(r,i),ae("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ae("invalid",r);break;case"textarea":ro(r,i),ae("invalid",r)}hi(n,i),l=null;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];a==="children"?typeof o=="string"?r.textContent!==o&&(i.suppressHydrationWarning!==!0&&ml(r.textContent,o,e),l=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&ml(r.textContent,o,e),l=["children",""+o]):zr.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&ae("scroll",r)}switch(n){case"input":al(r),no(r,i,!0);break;case"textarea":al(r),lo(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Vl)}r=l,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Mu(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[bt]=t,e[Hr]=r,ud(e,t,!1,!1),t.stateNode=e;e:{switch(a=mi(n,r),n){case"dialog":ae("cancel",e),ae("close",e),l=r;break;case"iframe":case"object":case"embed":ae("load",e),l=r;break;case"video":case"audio":for(l=0;l<kr.length;l++)ae(kr[l],e);l=r;break;case"source":ae("error",e),l=r;break;case"img":case"image":case"link":ae("error",e),ae("load",e),l=r;break;case"details":ae("toggle",e),l=r;break;case"input":to(e,r),l=ui(e,r),ae("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=me({},r,{value:void 0}),ae("invalid",e);break;case"textarea":ro(e,r),l=fi(e,r),ae("invalid",e);break;default:l=r}hi(n,l),o=l;for(i in o)if(o.hasOwnProperty(i)){var u=o[i];i==="style"?Hu(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Fu(e,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Rr(e,u):typeof u=="number"&&Rr(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(zr.hasOwnProperty(i)?u!=null&&i==="onScroll"&&ae("scroll",e):u!=null&&la(e,i,u,a))}switch(n){case"input":al(e),no(e,r,!1);break;case"textarea":al(e),lo(e);break;case"option":r.value!=null&&e.setAttribute("value",""+sn(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Un(e,!!r.multiple,i,!1):r.defaultValue!=null&&Un(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Vl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ae(t),null;case 6:if(e&&t.stateNode!=null)dd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(n=gn(Wr.current),gn(Lt.current),gl(t)){if(r=t.stateNode,n=t.memoizedProps,r[bt]=t,(i=r.nodeValue!==n)&&(e=it,e!==null))switch(e.tag){case 3:ml(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ml(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[bt]=t,t.stateNode=r}return Ae(t),null;case 13:if(oe(pe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(de&&st!==null&&t.mode&1&&!(t.flags&128))bc(),Gn(),t.flags|=98560,i=!1;else if(i=gl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(L(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(L(317));i[bt]=t}else Gn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ae(t),i=!1}else jt!==null&&(Xi(jt),jt=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||pe.current&1?Ee===0&&(Ee=3):Fa())),t.updateQueue!==null&&(t.flags|=4),Ae(t),null);case 4:return er(),Bi(e,t),e===null&&Fr(t.stateNode.containerInfo),Ae(t),null;case 10:return Sa(t.type._context),Ae(t),null;case 17:return tt(t.type)&&Ql(),Ae(t),null;case 19:if(oe(pe),i=t.memoizedState,i===null)return Ae(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)mr(i,!1);else{if(Ee!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Zl(e),a!==null){for(t.flags|=128,mr(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ie(pe,pe.current&1|2),t.child}e=e.sibling}i.tail!==null&&xe()>nr&&(t.flags|=128,r=!0,mr(i,!1),t.lanes=4194304)}else{if(!r)if(e=Zl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!de)return Ae(t),null}else 2*xe()-i.renderingStartTime>nr&&n!==1073741824&&(t.flags|=128,r=!0,mr(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=xe(),t.sibling=null,n=pe.current,ie(pe,r?n&1|2:n&1),t):(Ae(t),null);case 22:case 23:return Ma(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?lt&1073741824&&(Ae(t),t.subtreeFlags&6&&(t.flags|=8192)):Ae(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Yp(e,t){switch(xa(t),t.tag){case 1:return tt(t.type)&&Ql(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return er(),oe(et),oe(Fe),Ta(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ea(t),null;case 13:if(oe(pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));Gn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(pe),null;case 4:return er(),null;case 10:return Sa(t.type._context),null;case 22:case 23:return Ma(),null;case 24:return null;default:return null}}var xl=!1,Me=!1,Gp=typeof WeakSet=="function"?WeakSet:Set,A=null;function Bn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ve(e,t,r)}else n.current=null}function Hi(e,t,n){try{n()}catch(r){ve(e,t,r)}}var qo=!1;function Zp(e,t){if(_i=Hl,e=gc(),ya(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,y=0,h=e,m=null;t:for(;;){for(var x;h!==n||l!==0&&h.nodeType!==3||(o=a+l),h!==i||r!==0&&h.nodeType!==3||(u=a+r),h.nodeType===3&&(a+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++c===l&&(o=a),m===i&&++y===r&&(u=a),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ci={focusedElem:e,selectionRange:n},Hl=!1,A=t;A!==null;)if(t=A,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,A=e;else for(;A!==null;){t=A;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,j=v.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?w:wt(t.type,w),j);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(k){ve(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,A=e;break}A=t.return}return v=qo,qo=!1,v}function br(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Hi(t,n,i)}l=l.next}while(l!==r)}}function ys(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ui(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function fd(e){var t=e.alternate;t!==null&&(e.alternate=null,fd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bt],delete t[Hr],delete t[bi],delete t[$p],delete t[Dp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function pd(e){return e.tag===5||e.tag===3||e.tag===4}function Xo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vl));else if(r!==4&&(e=e.child,e!==null))for(Wi(e,t,n),e=e.sibling;e!==null;)Wi(e,t,n),e=e.sibling}function Vi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Vi(e,t,n),e=e.sibling;e!==null;)Vi(e,t,n),e=e.sibling}var ze=null,kt=!1;function Wt(e,t,n){for(n=n.child;n!==null;)hd(e,t,n),n=n.sibling}function hd(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(us,n)}catch{}switch(n.tag){case 5:Me||Bn(n,t);case 6:var r=ze,l=kt;ze=null,Wt(e,t,n),ze=r,kt=l,ze!==null&&(kt?(e=ze,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ze.removeChild(n.stateNode));break;case 18:ze!==null&&(kt?(e=ze,n=n.stateNode,e.nodeType===8?Ws(e.parentNode,n):e.nodeType===1&&Ws(e,n),Or(e)):Ws(ze,n.stateNode));break;case 4:r=ze,l=kt,ze=n.stateNode.containerInfo,kt=!0,Wt(e,t,n),ze=r,kt=l;break;case 0:case 11:case 14:case 15:if(!Me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Hi(n,t,a),l=l.next}while(l!==r)}Wt(e,t,n);break;case 1:if(!Me&&(Bn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){ve(n,t,o)}Wt(e,t,n);break;case 21:Wt(e,t,n);break;case 22:n.mode&1?(Me=(r=Me)||n.memoizedState!==null,Wt(e,t,n),Me=r):Wt(e,t,n);break;default:Wt(e,t,n)}}function Jo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Gp),t.forEach(function(r){var l=oh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function xt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];try{var i=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:ze=o.stateNode,kt=!1;break e;case 3:ze=o.stateNode.containerInfo,kt=!0;break e;case 4:ze=o.stateNode.containerInfo,kt=!0;break e}o=o.return}if(ze===null)throw Error(L(160));hd(i,a,l),ze=null,kt=!1;var u=l.alternate;u!==null&&(u.return=null),l.return=null}catch(c){ve(l,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)md(t,e),t=t.sibling}function md(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(xt(t,e),Et(e),r&4){try{br(3,e,e.return),ys(3,e)}catch(w){ve(e,e.return,w)}try{br(5,e,e.return)}catch(w){ve(e,e.return,w)}}break;case 1:xt(t,e),Et(e),r&512&&n!==null&&Bn(n,n.return);break;case 5:if(xt(t,e),Et(e),r&512&&n!==null&&Bn(n,n.return),e.flags&32){var l=e.stateNode;try{Rr(l,"")}catch(w){ve(e,e.return,w)}}if(r&4&&(l=e.stateNode,l!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&Ou(l,i),mi(o,a);var c=mi(o,i);for(a=0;a<u.length;a+=2){var y=u[a],h=u[a+1];y==="style"?Hu(l,h):y==="dangerouslySetInnerHTML"?Fu(l,h):y==="children"?Rr(l,h):la(l,y,h,c)}switch(o){case"input":ci(l,i);break;case"textarea":Au(l,i);break;case"select":var m=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!i.multiple;var x=i.value;x!=null?Un(l,!!i.multiple,x,!1):m!==!!i.multiple&&(i.defaultValue!=null?Un(l,!!i.multiple,i.defaultValue,!0):Un(l,!!i.multiple,i.multiple?[]:"",!1))}l[Hr]=i}catch(w){ve(e,e.return,w)}}break;case 6:if(xt(t,e),Et(e),r&4){if(e.stateNode===null)throw Error(L(162));l=e.stateNode,i=e.memoizedProps;try{l.nodeValue=i}catch(w){ve(e,e.return,w)}}break;case 3:if(xt(t,e),Et(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Or(t.containerInfo)}catch(w){ve(e,e.return,w)}break;case 4:xt(t,e),Et(e);break;case 13:xt(t,e),Et(e),l=e.child,l.flags&8192&&(i=l.memoizedState!==null,l.stateNode.isHidden=i,!i||l.alternate!==null&&l.alternate.memoizedState!==null||(Oa=xe())),r&4&&Jo(e);break;case 22:if(y=n!==null&&n.memoizedState!==null,e.mode&1?(Me=(c=Me)||y,xt(t,e),Me=c):xt(t,e),Et(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!y&&e.mode&1)for(A=e,y=e.child;y!==null;){for(h=A=y;A!==null;){switch(m=A,x=m.child,m.tag){case 0:case 11:case 14:case 15:br(4,m,m.return);break;case 1:Bn(m,m.return);var v=m.stateNode;if(typeof v.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(w){ve(r,n,w)}}break;case 5:Bn(m,m.return);break;case 22:if(m.memoizedState!==null){Go(h);continue}}x!==null?(x.return=m,A=x):Go(h)}y=y.sibling}e:for(y=null,h=e;;){if(h.tag===5){if(y===null){y=h;try{l=h.stateNode,c?(i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=h.stateNode,u=h.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=Bu("display",a))}catch(w){ve(e,e.return,w)}}}else if(h.tag===6){if(y===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(w){ve(e,e.return,w)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;y===h&&(y=null),h=h.return}y===h&&(y=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:xt(t,e),Et(e),r&4&&Jo(e);break;case 21:break;default:xt(t,e),Et(e)}}function Et(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(pd(n)){var r=n;break e}n=n.return}throw Error(L(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(Rr(l,""),r.flags&=-33);var i=Xo(e);Vi(e,i,l);break;case 3:case 4:var a=r.stateNode.containerInfo,o=Xo(e);Wi(e,o,a);break;default:throw Error(L(161))}}catch(u){ve(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function eh(e,t,n){A=e,gd(e)}function gd(e,t,n){for(var r=(e.mode&1)!==0;A!==null;){var l=A,i=l.child;if(l.tag===22&&r){var a=l.memoizedState!==null||xl;if(!a){var o=l.alternate,u=o!==null&&o.memoizedState!==null||Me;o=xl;var c=Me;if(xl=a,(Me=u)&&!c)for(A=l;A!==null;)a=A,u=a.child,a.tag===22&&a.memoizedState!==null?Zo(l):u!==null?(u.return=a,A=u):Zo(l);for(;i!==null;)A=i,gd(i),i=i.sibling;A=l,xl=o,Me=c}Yo(e)}else l.subtreeFlags&8772&&i!==null?(i.return=l,A=i):Yo(e)}}function Yo(e){for(;A!==null;){var t=A;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Me||ys(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Me)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:wt(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&$o(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}$o(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var y=c.memoizedState;if(y!==null){var h=y.dehydrated;h!==null&&Or(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(L(163))}Me||t.flags&512&&Ui(t)}catch(m){ve(t,t.return,m)}}if(t===e){A=null;break}if(n=t.sibling,n!==null){n.return=t.return,A=n;break}A=t.return}}function Go(e){for(;A!==null;){var t=A;if(t===e){A=null;break}var n=t.sibling;if(n!==null){n.return=t.return,A=n;break}A=t.return}}function Zo(e){for(;A!==null;){var t=A;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ys(4,t)}catch(u){ve(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(u){ve(t,l,u)}}var i=t.return;try{Ui(t)}catch(u){ve(t,i,u)}break;case 5:var a=t.return;try{Ui(t)}catch(u){ve(t,a,u)}}}catch(u){ve(t,t.return,u)}if(t===e){A=null;break}var o=t.sibling;if(o!==null){o.return=t.return,A=o;break}A=t.return}}var th=Math.ceil,ns=Ut.ReactCurrentDispatcher,$a=Ut.ReactCurrentOwner,mt=Ut.ReactCurrentBatchConfig,ee=0,be=null,ke=null,Re=0,lt=0,Hn=un(0),Ee=0,qr=null,Sn=0,vs=0,Da=0,Pr=null,Ge=null,Oa=0,nr=1/0,It=null,rs=!1,Qi=null,nn=null,wl=!1,Jt=null,ls=0,Lr=0,Ki=null,Rl=-1,Il=0;function Ke(){return ee&6?xe():Rl!==-1?Rl:Rl=xe()}function rn(e){return e.mode&1?ee&2&&Re!==0?Re&-Re:Ap.transition!==null?(Il===0&&(Il=ec()),Il):(e=le,e!==0||(e=window.event,e=e===void 0?16:ac(e.type)),e):1}function _t(e,t,n,r){if(50<Lr)throw Lr=0,Ki=null,Error(L(185));Yr(e,n,r),(!(ee&2)||e!==be)&&(e===be&&(!(ee&2)&&(vs|=n),Ee===4&&qt(e,Re)),nt(e,r),n===1&&ee===0&&!(t.mode&1)&&(nr=xe()+500,hs&&cn()))}function nt(e,t){var n=e.callbackNode;Af(e,t);var r=Bl(e,e===be?Re:0);if(r===0)n!==null&&ao(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ao(n),t===1)e.tag===0?Op(eu.bind(null,e)):Cc(eu.bind(null,e)),Rp(function(){!(ee&6)&&cn()}),n=null;else{switch(tc(r)){case 1:n=ua;break;case 4:n=Gu;break;case 16:n=Fl;break;case 536870912:n=Zu;break;default:n=Fl}n=Nd(n,yd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function yd(e,t){if(Rl=-1,Il=0,ee&6)throw Error(L(327));var n=e.callbackNode;if(qn()&&e.callbackNode!==n)return null;var r=Bl(e,e===be?Re:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ss(e,r);else{t=r;var l=ee;ee|=2;var i=xd();(be!==e||Re!==t)&&(It=null,nr=xe()+500,vn(e,t));do try{lh();break}catch(o){vd(e,o)}while(!0);ja(),ns.current=i,ee=l,ke!==null?t=0:(be=null,Re=0,t=Ee)}if(t!==0){if(t===2&&(l=wi(e),l!==0&&(r=l,t=qi(e,l))),t===1)throw n=qr,vn(e,0),qt(e,r),nt(e,xe()),n;if(t===6)qt(e,r);else{if(l=e.current.alternate,!(r&30)&&!nh(l)&&(t=ss(e,r),t===2&&(i=wi(e),i!==0&&(r=i,t=qi(e,i))),t===1))throw n=qr,vn(e,0),qt(e,r),nt(e,xe()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(L(345));case 2:pn(e,Ge,It);break;case 3:if(qt(e,r),(r&130023424)===r&&(t=Oa+500-xe(),10<t)){if(Bl(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){Ke(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Ti(pn.bind(null,e,Ge,It),t);break}pn(e,Ge,It);break;case 4:if(qt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var a=31-Nt(r);i=1<<a,a=t[a],a>l&&(l=a),r&=~i}if(r=l,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*th(r/1960))-r,10<r){e.timeoutHandle=Ti(pn.bind(null,e,Ge,It),r);break}pn(e,Ge,It);break;case 5:pn(e,Ge,It);break;default:throw Error(L(329))}}}return nt(e,xe()),e.callbackNode===n?yd.bind(null,e):null}function qi(e,t){var n=Pr;return e.current.memoizedState.isDehydrated&&(vn(e,t).flags|=256),e=ss(e,t),e!==2&&(t=Ge,Ge=n,t!==null&&Xi(t)),e}function Xi(e){Ge===null?Ge=e:Ge.push.apply(Ge,e)}function nh(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var l=n[r],i=l.getSnapshot;l=l.value;try{if(!Ct(i(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 qt(e,t){for(t&=~Da,t&=~vs,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Nt(t),r=1<<n;e[n]=-1,t&=~r}}function eu(e){if(ee&6)throw Error(L(327));qn();var t=Bl(e,0);if(!(t&1))return nt(e,xe()),null;var n=ss(e,t);if(e.tag!==0&&n===2){var r=wi(e);r!==0&&(t=r,n=qi(e,r))}if(n===1)throw n=qr,vn(e,0),qt(e,t),nt(e,xe()),n;if(n===6)throw Error(L(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,pn(e,Ge,It),nt(e,xe()),null}function Aa(e,t){var n=ee;ee|=1;try{return e(t)}finally{ee=n,ee===0&&(nr=xe()+500,hs&&cn())}}function Nn(e){Jt!==null&&Jt.tag===0&&!(ee&6)&&qn();var t=ee;ee|=1;var n=mt.transition,r=le;try{if(mt.transition=null,le=1,e)return e()}finally{le=r,mt.transition=n,ee=t,!(ee&6)&&cn()}}function Ma(){lt=Hn.current,oe(Hn)}function vn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,zp(n)),ke!==null)for(n=ke.return;n!==null;){var r=n;switch(xa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ql();break;case 3:er(),oe(et),oe(Fe),Ta();break;case 5:Ea(r);break;case 4:er();break;case 13:oe(pe);break;case 19:oe(pe);break;case 10:Sa(r.type._context);break;case 22:case 23:Ma()}n=n.return}if(be=e,ke=e=ln(e.current,null),Re=lt=t,Ee=0,qr=null,Da=vs=Sn=0,Ge=Pr=null,mn!==null){for(t=0;t<mn.length;t++)if(n=mn[t],r=n.interleaved,r!==null){n.interleaved=null;var l=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=l,r.next=a}n.pending=r}mn=null}return e}function vd(e,t){do{var n=ke;try{if(ja(),Pl.current=ts,es){for(var r=he.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}es=!1}if(jn=0,Te=Ce=he=null,Tr=!1,Vr=0,$a.current=null,n===null||n.return===null){Ee=1,qr=t,ke=null;break}e:{var i=e,a=n.return,o=n,u=t;if(t=Re,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,y=o,h=y.tag;if(!(y.mode&1)&&(h===0||h===11||h===15)){var m=y.alternate;m?(y.updateQueue=m.updateQueue,y.memoizedState=m.memoizedState,y.lanes=m.lanes):(y.updateQueue=null,y.memoizedState=null)}var x=Bo(a);if(x!==null){x.flags&=-257,Ho(x,a,o,i,t),x.mode&1&&Fo(i,c,t),t=x,u=c;var v=t.updateQueue;if(v===null){var w=new Set;w.add(u),t.updateQueue=w}else v.add(u);break e}else{if(!(t&1)){Fo(i,c,t),Fa();break e}u=Error(L(426))}}else if(de&&o.mode&1){var j=Bo(a);if(j!==null){!(j.flags&65536)&&(j.flags|=256),Ho(j,a,o,i,t),wa(tr(u,o));break e}}i=u=tr(u,o),Ee!==4&&(Ee=2),Pr===null?Pr=[i]:Pr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var p=td(i,u,t);Io(i,p);break e;case 1:o=u;var d=i.type,g=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(nn===null||!nn.has(g)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=nd(i,o,t);Io(i,k);break e}}i=i.return}while(i!==null)}kd(n)}catch(_){t=_,ke===n&&n!==null&&(ke=n=n.return);continue}break}while(!0)}function xd(){var e=ns.current;return ns.current=ts,e===null?ts:e}function Fa(){(Ee===0||Ee===3||Ee===2)&&(Ee=4),be===null||!(Sn&268435455)&&!(vs&268435455)||qt(be,Re)}function ss(e,t){var n=ee;ee|=2;var r=xd();(be!==e||Re!==t)&&(It=null,vn(e,t));do try{rh();break}catch(l){vd(e,l)}while(!0);if(ja(),ee=n,ns.current=r,ke!==null)throw Error(L(261));return be=null,Re=0,Ee}function rh(){for(;ke!==null;)wd(ke)}function lh(){for(;ke!==null&&!bf();)wd(ke)}function wd(e){var t=Sd(e.alternate,e,lt);e.memoizedProps=e.pendingProps,t===null?kd(e):ke=t,$a.current=null}function kd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Yp(n,t),n!==null){n.flags&=32767,ke=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ee=6,ke=null;return}}else if(n=Jp(n,t,lt),n!==null){ke=n;return}if(t=t.sibling,t!==null){ke=t;return}ke=t=e}while(t!==null);Ee===0&&(Ee=5)}function pn(e,t,n){var r=le,l=mt.transition;try{mt.transition=null,le=1,sh(e,t,n,r)}finally{mt.transition=l,le=r}return null}function sh(e,t,n,r){do qn();while(Jt!==null);if(ee&6)throw Error(L(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(L(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Mf(e,i),e===be&&(ke=be=null,Re=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||wl||(wl=!0,Nd(Fl,function(){return qn(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=mt.transition,mt.transition=null;var a=le;le=1;var o=ee;ee|=4,$a.current=null,Zp(e,n),md(n,e),_p(Ci),Hl=!!_i,Ci=_i=null,e.current=n,eh(n),Pf(),ee=o,le=a,mt.transition=i}else e.current=n;if(wl&&(wl=!1,Jt=e,ls=l),i=e.pendingLanes,i===0&&(nn=null),Rf(n.stateNode),nt(e,xe()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],r(l.value,{componentStack:l.stack,digest:l.digest});if(rs)throw rs=!1,e=Qi,Qi=null,e;return ls&1&&e.tag!==0&&qn(),i=e.pendingLanes,i&1?e===Ki?Lr++:(Lr=0,Ki=e):Lr=0,cn(),null}function qn(){if(Jt!==null){var e=tc(ls),t=mt.transition,n=le;try{if(mt.transition=null,le=16>e?16:e,Jt===null)var r=!1;else{if(e=Jt,Jt=null,ls=0,ee&6)throw Error(L(331));var l=ee;for(ee|=4,A=e.current;A!==null;){var i=A,a=i.child;if(A.flags&16){var o=i.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for(A=c;A!==null;){var y=A;switch(y.tag){case 0:case 11:case 15:br(8,y,i)}var h=y.child;if(h!==null)h.return=y,A=h;else for(;A!==null;){y=A;var m=y.sibling,x=y.return;if(fd(y),y===c){A=null;break}if(m!==null){m.return=x,A=m;break}A=x}}}var v=i.alternate;if(v!==null){var w=v.child;if(w!==null){v.child=null;do{var j=w.sibling;w.sibling=null,w=j}while(w!==null)}}A=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,A=a;else e:for(;A!==null;){if(i=A,i.flags&2048)switch(i.tag){case 0:case 11:case 15:br(9,i,i.return)}var p=i.sibling;if(p!==null){p.return=i.return,A=p;break e}A=i.return}}var d=e.current;for(A=d;A!==null;){a=A;var g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,A=g;else e:for(a=d;A!==null;){if(o=A,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:ys(9,o)}}catch(_){ve(o,o.return,_)}if(o===a){A=null;break e}var k=o.sibling;if(k!==null){k.return=o.return,A=k;break e}A=o.return}}if(ee=l,cn(),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(us,e)}catch{}r=!0}return r}finally{le=n,mt.transition=t}}return!1}function tu(e,t,n){t=tr(n,t),t=td(e,t,1),e=tn(e,t,1),t=Ke(),e!==null&&(Yr(e,1,t),nt(e,t))}function ve(e,t,n){if(e.tag===3)tu(e,e,n);else for(;t!==null;){if(t.tag===3){tu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(nn===null||!nn.has(r))){e=tr(n,e),e=nd(t,e,1),t=tn(t,e,1),e=Ke(),t!==null&&(Yr(t,1,e),nt(t,e));break}}t=t.return}}function ih(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ke(),e.pingedLanes|=e.suspendedLanes&n,be===e&&(Re&n)===n&&(Ee===4||Ee===3&&(Re&130023424)===Re&&500>xe()-Oa?vn(e,0):Da|=n),nt(e,t)}function jd(e,t){t===0&&(e.mode&1?(t=cl,cl<<=1,!(cl&130023424)&&(cl=4194304)):t=1);var n=Ke();e=Bt(e,t),e!==null&&(Yr(e,t,n),nt(e,n))}function ah(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jd(e,n)}function oh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),jd(e,n)}var Sd;Sd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||et.current)Ze=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ze=!1,Xp(e,t,n);Ze=!!(e.flags&131072)}else Ze=!1,de&&t.flags&1048576&&Ec(t,Xl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zl(e,t),e=t.pendingProps;var l=Yn(t,Fe.current);Kn(t,n),l=Pa(null,t,r,e,l,n);var i=La();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,tt(r)?(i=!0,Kl(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,_a(t),l.updater=gs,t.stateNode=l,l._reactInternals=t,$i(t,r,e,n),t=Ai(null,t,r,!0,i,n)):(t.tag=0,de&&i&&va(t),Qe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=ch(r),e=wt(r,e),l){case 0:t=Oi(null,t,r,e,n);break e;case 1:t=Vo(null,t,r,e,n);break e;case 11:t=Uo(null,t,r,e,n);break e;case 14:t=Wo(null,t,r,wt(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:wt(r,l),Oi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:wt(r,l),Vo(e,t,r,l,n);case 3:e:{if(id(t),e===null)throw Error(L(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Rc(e,t),Gl(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=tr(Error(L(423)),t),t=Qo(e,t,r,n,l);break e}else if(r!==l){l=tr(Error(L(424)),t),t=Qo(e,t,r,n,l);break e}else for(st=en(t.stateNode.containerInfo.firstChild),it=t,de=!0,jt=null,n=Lc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gn(),r===l){t=Ht(e,t,n);break e}Qe(e,t,r,n)}t=t.child}return t;case 5:return Ic(t),e===null&&zi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Ei(r,l)?a=null:i!==null&&Ei(r,i)&&(t.flags|=32),sd(e,t),Qe(e,t,a,n),t.child;case 6:return e===null&&zi(t),null;case 13:return ad(e,t,n);case 4:return Ca(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Zn(t,null,r,n):Qe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:wt(r,l),Uo(e,t,r,l,n);case 7:return Qe(e,t,t.pendingProps,n),t.child;case 8:return Qe(e,t,t.pendingProps.children,n),t.child;case 12:return Qe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,a=l.value,ie(Jl,r._currentValue),r._currentValue=a,i!==null)if(Ct(i.value,a)){if(i.children===l.children&&!et.current){t=Ht(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=At(-1,n&-n),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var y=c.pending;y===null?u.next=u:(u.next=y.next,y.next=u),c.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Ri(i.return,n,t),o.lanes|=n;break}u=u.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(L(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Ri(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Qe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Kn(t,n),l=gt(l),r=r(l),t.flags|=1,Qe(e,t,r,n),t.child;case 14:return r=t.type,l=wt(r,t.pendingProps),l=wt(r.type,l),Wo(e,t,r,l,n);case 15:return rd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:wt(r,l),zl(e,t),t.tag=1,tt(r)?(e=!0,Kl(t)):e=!1,Kn(t,n),ed(t,r,l),$i(t,r,l,n),Ai(null,t,r,!0,e,n);case 19:return od(e,t,n);case 22:return ld(e,t,n)}throw Error(L(156,t.tag))};function Nd(e,t){return Yu(e,t)}function uh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ht(e,t,n,r){return new uh(e,t,n,r)}function Ba(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ch(e){if(typeof e=="function")return Ba(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ia)return 11;if(e===aa)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=ht(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function $l(e,t,n,r,l,i){var a=2;if(r=e,typeof e=="function")Ba(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case zn:return xn(n.children,l,i,t);case sa:a=8,l|=8;break;case si:return e=ht(12,n,t,l|2),e.elementType=si,e.lanes=i,e;case ii:return e=ht(13,n,t,l),e.elementType=ii,e.lanes=i,e;case ai:return e=ht(19,n,t,l),e.elementType=ai,e.lanes=i,e;case Iu:return xs(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case zu:a=10;break e;case Ru:a=9;break e;case ia:a=11;break e;case aa:a=14;break e;case Vt:a=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=ht(a,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function xn(e,t,n,r){return e=ht(7,e,r,t),e.lanes=n,e}function xs(e,t,n,r){return e=ht(22,e,r,t),e.elementType=Iu,e.lanes=n,e.stateNode={isHidden:!1},e}function Gs(e,t,n){return e=ht(6,e,null,t),e.lanes=n,e}function Zs(e,t,n){return t=ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rs(0),this.expirationTimes=Rs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rs(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ha(e,t,n,r,l,i,a,o,u){return e=new dh(e,t,n,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ht(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_a(i),e}function fh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ln,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function _d(e){if(!e)return an;e=e._reactInternals;e:{if(Cn(e)!==e||e.tag!==1)throw Error(L(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(L(171))}if(e.tag===1){var n=e.type;if(tt(n))return _c(e,n,t)}return t}function Cd(e,t,n,r,l,i,a,o,u){return e=Ha(n,r,!0,e,l,i,a,o,u),e.context=_d(null),n=e.current,r=Ke(),l=rn(n),i=At(r,l),i.callback=t??null,tn(n,i,l),e.current.lanes=l,Yr(e,l,r),nt(e,r),e}function ws(e,t,n,r){var l=t.current,i=Ke(),a=rn(l);return n=_d(n),t.context===null?t.context=n:t.pendingContext=n,t=At(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=tn(l,t,a),e!==null&&(_t(e,l,a,i),bl(e,l,a)),a}function is(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function nu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ua(e,t){nu(e,t),(e=e.alternate)&&nu(e,t)}function ph(){return null}var Ed=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wa(e){this._internalRoot=e}ks.prototype.render=Wa.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));ws(e,t,null,null)};ks.prototype.unmount=Wa.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nn(function(){ws(null,e,null,null)}),t[Ft]=null}};function ks(e){this._internalRoot=e}ks.prototype.unstable_scheduleHydration=function(e){if(e){var t=lc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kt.length&&t!==0&&t<Kt[n].priority;n++);Kt.splice(n,0,e),n===0&&ic(e)}};function Va(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function js(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function ru(){}function hh(e,t,n,r,l){if(l){if(typeof r=="function"){var i=r;r=function(){var c=is(a);i.call(c)}}var a=Cd(t,r,e,0,null,!1,!1,"",ru);return e._reactRootContainer=a,e[Ft]=a.current,Fr(e.nodeType===8?e.parentNode:e),Nn(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var o=r;r=function(){var c=is(u);o.call(c)}}var u=Ha(e,0,!1,null,null,!1,!1,"",ru);return e._reactRootContainer=u,e[Ft]=u.current,Fr(e.nodeType===8?e.parentNode:e),Nn(function(){ws(t,u,n,r)}),u}function Ss(e,t,n,r,l){var i=n._reactRootContainer;if(i){var a=i;if(typeof l=="function"){var o=l;l=function(){var u=is(a);o.call(u)}}ws(t,a,e,l)}else a=hh(n,t,e,l,r);return is(a)}nc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wr(t.pendingLanes);n!==0&&(ca(t,n|1),nt(t,xe()),!(ee&6)&&(nr=xe()+500,cn()))}break;case 13:Nn(function(){var r=Bt(e,1);if(r!==null){var l=Ke();_t(r,e,1,l)}}),Ua(e,1)}};da=function(e){if(e.tag===13){var t=Bt(e,134217728);if(t!==null){var n=Ke();_t(t,e,134217728,n)}Ua(e,134217728)}};rc=function(e){if(e.tag===13){var t=rn(e),n=Bt(e,t);if(n!==null){var r=Ke();_t(n,e,t,r)}Ua(e,t)}};lc=function(){return le};sc=function(e,t){var n=le;try{return le=e,t()}finally{le=n}};yi=function(e,t,n){switch(t){case"input":if(ci(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var l=ps(r);if(!l)throw Error(L(90));Du(r),ci(r,l)}}}break;case"textarea":Au(e,n);break;case"select":t=n.value,t!=null&&Un(e,!!n.multiple,t,!1)}};Vu=Aa;Qu=Nn;var mh={usingClientEntryPoint:!1,Events:[Zr,Dn,ps,Uu,Wu,Aa]},gr={findFiberByHostInstance:hn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gh={bundleType:gr.bundleType,version:gr.version,rendererPackageName:gr.rendererPackageName,rendererConfig:gr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ut.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Xu(e),e===null?null:e.stateNode},findFiberByHostInstance:gr.findFiberByHostInstance||ph,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kl.isDisabled&&kl.supportsFiber)try{us=kl.inject(gh),Pt=kl}catch{}}ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mh;ot.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Va(t))throw Error(L(200));return fh(e,t,null,n)};ot.createRoot=function(e,t){if(!Va(e))throw Error(L(299));var n=!1,r="",l=Ed;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=Ha(e,1,!1,null,null,n,!1,r,l),e[Ft]=t.current,Fr(e.nodeType===8?e.parentNode:e),new Wa(t)};ot.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=Xu(t),e=e===null?null:e.stateNode,e};ot.flushSync=function(e){return Nn(e)};ot.hydrate=function(e,t,n){if(!js(t))throw Error(L(200));return Ss(null,e,t,!0,n)};ot.hydrateRoot=function(e,t,n){if(!Va(e))throw Error(L(405));var r=n!=null&&n.hydratedSources||null,l=!1,i="",a=Ed;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Cd(t,null,e,1,n??null,l,!1,i,a),e[Ft]=t.current,Fr(e),r)for(e=0;e<r.length;e++)n=r[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new ks(t)};ot.render=function(e,t,n){if(!js(t))throw Error(L(200));return Ss(null,e,t,!1,n)};ot.unmountComponentAtNode=function(e){if(!js(e))throw Error(L(40));return e._reactRootContainer?(Nn(function(){Ss(null,null,e,!1,function(){e._reactRootContainer=null,e[Ft]=null})}),!0):!1};ot.unstable_batchedUpdates=Aa;ot.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!js(n))throw Error(L(200));if(e==null||e._reactInternals===void 0)throw Error(L(38));return Ss(e,t,n,!1,r)};ot.version="18.3.1-next-f1338f8080-20240426";function Td(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Td)}catch(e){console.error(e)}}Td(),Tu.exports=ot;var yh=Tu.exports,bd,lu=yh;bd=lu.createRoot,lu.hydrateRoot;async function je(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function vh(){return je("/api/archives")}async function xh(e){return je(`/api/archives/${e}/entries`)}async function wh(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),je(`/api/archives/${e}/entries/search?${r}`)}async function Ji(e,t){return je(`/api/archives/${e}/entries/${t}`)}async function kh(e,t){return je(`/api/archives/${e}/entries/${t}/children`)}function jh(e,t,n){return Promise.all(n.map(r=>je(`/api/archives/${e}/entries/${t}/artifacts/${r}`)))}async function Sh(e){if(!e||e.length===0)return{};const t=await fetch("/api/util/resolve-tco",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return t.ok?t.json():{}}async function Nh(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n??null})});if(!r.ok)throw new Error(await r.text())}async function jl(e,t){return je(`/api/archives/${e}/entries/${t}/tags`)}async function su(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag_path:n})});if(!r.ok)throw new Error(`Failed to add tag (${r.status})`)}async function _h(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`Remove failed (${r.status})`)}async function iu(e,t){const n=await fetch(`/api/archives/${e}/entries/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`Delete failed (${n.status})`)}async function Ch(e,t,n){const r=await fetch(`/api/archives/${e}/tags/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n})});if(!r.ok)throw new Error(await r.text());return r.json()}async function Eh(e,t){const n=await fetch(`/api/archives/${e}/tags/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(await n.text())}async function Th(e,t){const n=await fetch(`/api/archives/${e}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!n.ok)throw new Error(await n.text());return n.json()}async function bh(e,t,n){const r=await fetch(`/api/archives/${e}/tags/${t}/move`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent_uid:n??null})});if(!r.ok)throw new Error(await r.text());return r.json()}async function ei(e){return je(`/api/archives/${e}/runs`)}async function Sl(e){return je(`/api/archives/${e}/tags`)}async function Ph(e,t,n=null,r=null){const l={locator:t};n&&n!=="best"&&(l.quality=n),r&&(typeof r.ublock_enabled=="boolean"&&(l.ublock_enabled=r.ublock_enabled),typeof r.reader_mode=="boolean"&&(l.reader_mode=r.reader_mode),typeof r.cookie_ext_enabled=="boolean"&&(l.cookie_ext_enabled=r.cookie_ext_enabled),typeof r.modal_closer_enabled=="boolean"&&(l.modal_closer_enabled=r.modal_closer_enabled),typeof r.via_freedium=="boolean"&&(l.via_freedium=r.via_freedium),r.per_item_quality&&typeof r.per_item_quality=="object"&&Object.keys(r.per_item_quality).length>0&&(l.per_item_quality=r.per_item_quality),r.sync===!0&&(l.sync=!0));const i=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!i.ok){const a=await i.json().catch(()=>({}));throw new Error(a.error||`HTTP ${i.status}`)}return i.json()}async function Lh(e,t){return je(`/api/archives/${e}/captures/probe?locator=${encodeURIComponent(t)}`)}async function zh(e,t){const n=await fetch(`/api/archives/${e}/captures/probe-playlist`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locator:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function Pd(e,t){return je(`/api/archives/${e}/capture_jobs/${t}`)}async function Rh(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function Ih(e,t){const n=await fetch("/api/auth/setup",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Setup failed");return n.json()}async function $h(e,t){const n=await fetch("/api/auth/login",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Login failed");return n.json()}async function Dh(){await fetch("/api/auth/logout",{method:"POST"})}async function Oh(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function Ah(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display_name:e})});if(!t.ok)throw new Error(await t.text())}async function Mh(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function Fh(e,t){const n=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_password:e,new_password:t})});if(!n.ok){let r=await n.text();try{r=JSON.parse(r).error??r}catch{}throw new Error(r)}}async function Bh(){return je("/api/auth/tokens")}async function Hh(e){const t=await fetch("/api/auth/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw new Error(await t.text());return t.json()}async function Uh(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function Qa(){return je("/api/admin/instance-settings")}async function Dl(e){const t=await fetch("/api/admin/instance-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function Wh(){return je("/api/admin/users")}async function Vh(e,t,n){const r=await fetch("/api/admin/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:n||void 0})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error||`HTTP ${r.status}`)}return r.json()}async function Qh(e,t){const n=await fetch(`/api/admin/users/${e}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function Kh(){return je("/api/admin/roles")}async function qh(e,t){const n=await fetch("/api/admin/roles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,name:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function Ld(e){return je(`/api/archives/${e}/collections`)}async function Xh(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,slug:n,default_visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}return l.json()}async function Jh(e,t){return je(`/api/archives/${e}/collections/${t}`)}async function zd(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections/${t}/entries`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({entry_uid:n,visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Yh(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"DELETE"});if(!r.ok){const l=await r.json().catch(()=>({error:r.statusText}));throw new Error(l.error||r.statusText)}}async function Gh(e,t,n,r){const l=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Zh(e,t){return je(`/api/archives/${e}/entries/${t}/collections`)}async function au(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error??r.statusText)}}async function em(e,t){const n=await fetch(`/api/archives/${e}/collections/${t}`,{method:"DELETE"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??n.statusText)}}async function tm(e){return je(`/api/archives/${e}/blob-cleanup`)}async function nm(e){const t=await fetch(`/api/archives/${e}/blob-cleanup`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error??t.statusText)}return t.json()}async function rm(e,t){const n=await fetch(`/api/archives/${e}/entries/${t}/rearchive`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.message||`rearchive failed: ${n.status}`)}return n.json()}async function lm(){return je("/api/admin/cookie-rules")}async function sm(e,t,n){const r=await fetch("/api/admin/cookie-rules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url_pattern:e||null,pattern_kind:t,cookies_json:n})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.message||`HTTP ${r.status}`)}return r.json()}async function im(e,t){const n=await fetch(`/api/admin/cookie-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.message||`HTTP ${n.status}`)}}async function am(e){const t=await fetch(`/api/admin/cookie-rules/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message||`HTTP ${t.status}`)}}const om=window.fetch;window.fetch=async(...e)=>{var n;const t=await om(...e);return t.status===401&&((typeof e[0]=="string"?e[0]:((n=e[0])==null?void 0:n.url)??"").includes("/api/auth/")||window.dispatchEvent(new CustomEvent("auth:expired"))),t};function um({onLogin:e}){const[t,n]=f.useState(""),[r,l]=f.useState(""),[i,a]=f.useState(null),[o,u]=f.useState(!1);async function c(y){y.preventDefault(),a(null),u(!0);try{const h=await $h(t,r);e(h)}catch(h){a(h.message)}finally{u(!1)}}return s.jsx("div",{className:"login-page",children:s.jsxs("div",{className:"login-card",children:[s.jsx("h1",{className:"login-brand",children:"Archivr"}),s.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),s.jsxs("form",{onSubmit:c,children:[s.jsxs("div",{className:"login-field",children:[s.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),s.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:y=>n(y.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),s.jsxs("div",{className:"login-field",children:[s.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),s.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:y=>l(y.target.value),required:!0,autoComplete:"current-password"})]}),i&&s.jsx("p",{className:"login-error",children:i}),s.jsx("button",{className:"login-submit",type:"submit",disabled:o,children:o?"Signing in…":"Sign in"})]})]})})}function cm({onComplete:e}){const[t,n]=f.useState(""),[r,l]=f.useState(""),[i,a]=f.useState(""),[o,u]=f.useState(null),[c,y]=f.useState(!1);async function h(m){if(m.preventDefault(),r!==i){u("Passwords do not match");return}if(r.length<8){u("Password must be at least 8 characters");return}u(null),y(!0);try{await Ih(t,r),e()}catch(x){u(x.message)}finally{y(!1)}}return s.jsx("div",{className:"setup-page",children:s.jsxs("div",{className:"setup-card",children:[s.jsx("h1",{className:"setup-brand",children:"Archivr"}),s.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),s.jsxs("form",{onSubmit:h,children:[s.jsxs("div",{className:"setup-field",children:[s.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),s.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:m=>n(m.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),s.jsxs("div",{className:"setup-field",children:[s.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),s.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:m=>l(m.target.value),required:!0,autoComplete:"new-password"})]}),s.jsxs("div",{className:"setup-field",children:[s.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),s.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:i,onChange:m=>a(m.target.value),required:!0,autoComplete:"new-password"})]}),o&&s.jsx("p",{className:"setup-error",children:o}),s.jsx("button",{className:"setup-submit",type:"submit",disabled:c,children:c?"Creating account…":"Create account"})]})]})})}function dm({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:a,setCurrentUser:o}=f.useContext(_s)??{},[u,c]=f.useState(!1);async function y(){c(!0),await Dh(),o(null),window.location.reload()}return s.jsxs("header",{className:"topbar",children:[s.jsx("div",{className:"brand",children:"Archivr"}),s.jsx("div",{className:"switcher",children:s.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:h=>n(h.target.value),children:e.map(h=>s.jsx("option",{value:h.id,children:h.label},h.id))})}),s.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","tags","collections","runs","admin","settings"].map(h=>s.jsx("button",{className:`nav-link${r===h?" is-active":""}`,onClick:()=>l(h),children:h.charAt(0).toUpperCase()+h.slice(1)},h))}),s.jsx("button",{className:"capture-button",onClick:i,children:"Capture"}),a&&s.jsxs("div",{className:"user-menu",children:[s.jsx("span",{className:"user-name",children:a.display_name||a.username}),s.jsx("button",{className:"logout-btn",onClick:y,disabled:u,children:u?"Logging out…":"Log out"})]})]})}let Yi=1;function Rd(e){const t=e.trim(),n=t.toLowerCase();for(const r of["yt:","youtube:"])if(n.startsWith(r)){const l=n.slice(r.length);return l.startsWith("video/")||l.startsWith("short/")||l.startsWith("shorts/")}if(n.startsWith("ytm:"))return!n.slice(4).startsWith("playlist/");for(const r of["x:","twitter:","tweet:"])if(n.startsWith(r))return n.slice(r.length).startsWith("media:");if(n.startsWith("spotify:"))return!1;if(n.startsWith("instagram:")||n.startsWith("facebook:")||n.startsWith("tiktok:")||n.startsWith("reddit:")||n.startsWith("snapchat:"))return!0;if(n.startsWith("http://")||n.startsWith("https://")){if(/^https?:\/\/music\.youtube\.com\/watch/.test(n)||/^https?:\/\/(?:www\.)?(?:youtu\.be\/[0-9A-Za-z_-]+|youtube\.com\/watch\?v=[0-9A-Za-z_-]+|youtube\.com\/shorts\/[0-9A-Za-z_-]+)/.test(t)||n.startsWith("https://x.com/")||n.startsWith("http://x.com/")||/^https?:\/\/(?:www\.)?instagram\.com\//.test(n)||/^https?:\/\/(?:www\.)?facebook\.com\//.test(n)||n.startsWith("https://fb.watch/")||n.startsWith("http://fb.watch/")||/^https?:\/\/(?:www\.)?tiktok\.com\//.test(n)||/^https?:\/\/(?:www\.)?reddit\.com\//.test(n)||n.startsWith("https://redd.it/")||n.startsWith("http://redd.it/")||/^https?:\/\/(?:www\.)?snapchat\.com\//.test(n))return!0;if(n.startsWith("https://open.spotify.com/")||n.startsWith("http://open.spotify.com/"))return!1}return!1}function yn(e){const t=e.trim(),n=t.toLowerCase();for(const r of["yt:","youtube:"])if(n.startsWith(r)){const l=n.slice(r.length);return l.startsWith("playlist/")||l.startsWith("@")||l.startsWith("channel/")||l.startsWith("c/")||l.startsWith("user/")}if(n.startsWith("ytm:"))return n.slice(4).startsWith("playlist/");if(n.startsWith("http://")||n.startsWith("https://"))try{const r=new URL(t),l=r.hostname;if((l==="youtube.com"||l==="www.youtube.com")&&(r.pathname==="/playlist"&&r.searchParams.has("list")||r.pathname.startsWith("/@")||r.pathname.startsWith("/channel/")||r.pathname.startsWith("/c/")||r.pathname.startsWith("/user/"))||l==="music.youtube.com"&&r.pathname==="/playlist"&&r.searchParams.has("list"))return!0}catch{}return!1}function Pn(e=""){return{id:Yi++,locator:e,quality:"best",probeState:"idle",probeQualities:null,probeHasAudio:!1,status:"idle",error:null,jobUid:null,archiveId:null,playlistProbeState:"idle",playlistInfo:null,playlistItems:null,playlistQuality:null,playlistExpanded:!1,syncEnabled:!1}}function fm(e,t){return e==="best"?t.map(n=>({...n,quality:"best"})):e==="audio"?t.map(n=>n.has_audio?{...n,quality:"audio"}:n.quality!==null?n:{...n,quality:null}):t.map(n=>n.qualities.includes(e)?{...n,quality:e}:n.quality!==null?n:{...n,quality:null})}function ou(e){return Array.isArray(e.playlistItems)&&e.playlistItems.some(t=>t.quality===null)}function pm({open:e,archiveId:t,onClose:n,onCaptured:r,onToast:l,onJobStarted:i,onJobSettled:a,activeJobs:o=[]}){const u=f.useRef(null),c=f.useRef(!0),y=f.useRef(new Map),h=f.useRef(new Map),m=f.useRef(new Map),x=f.useRef(t);f.useEffect(()=>{x.current=t},[t]);const v=f.useRef(r),w=f.useRef(l);f.useEffect(()=>{v.current=r},[r]),f.useEffect(()=>{w.current=l},[l]);const j=f.useRef(i),p=f.useRef(a);f.useEffect(()=>{j.current=i},[i]),f.useEffect(()=>{p.current=a},[a]);const[d,g]=f.useState(()=>{try{const S=JSON.parse(sessionStorage.getItem("captureItems")||"null");if(Array.isArray(S)&&S.length>0){const H=S.filter(D=>!D.status||D.status==="idle");if(H.length>0)return H.forEach(D=>{D.id>=Yi&&(Yi=D.id+1)}),H.map(D=>({...Pn(D.locator),...D}))}}catch{}return[Pn()]});f.useEffect(()=>{sessionStorage.setItem("captureItems",JSON.stringify(d))},[d]);const[k,_]=f.useState(!1),[b,E]=f.useState(null),[N,I]=f.useState(null),[P,V]=f.useState(!0),[B,Q]=f.useState(!0),[G,ue]=f.useState(!0);f.useEffect(()=>{Qa().then(S=>{I(S),V(S.cookie_ext_enabled??!0),Q(S.modal_closer_enabled??!0)}).catch(()=>I({}))},[]);const se=b!==null?b:(N==null?void 0:N.ublock_enabled)??!0,[te,R]=f.useState(!1);f.useEffect(()=>{["captureDialogLocator","captureDialogError","captureDialogBusy","captureDialogJobStatus","captureDialogJobUid"].forEach(S=>sessionStorage.removeItem(S)),o.forEach(S=>{S.jobUid&&!y.current.has(S.jobUid)&&T(S.id,S.jobUid,S.locator,S.archiveId,null)})},[]),f.useEffect(()=>{const S=u.current;if(!S)return;const H=()=>{h.current.forEach(D=>clearTimeout(D)),h.current.clear(),n()};return S.addEventListener("close",H),()=>S.removeEventListener("close",H)},[n]),f.useEffect(()=>{const S=u.current;S&&(e?(c.current||g([Pn()]),c.current=!1,S.open||S.showModal()):(h.current.forEach(H=>clearTimeout(H)),h.current.clear(),S.open&&S.close()))},[e]),f.useEffect(()=>()=>{y.current.forEach(S=>clearInterval(S)),h.current.forEach(S=>clearTimeout(S))},[]);function T(S,H,D,F,W=null){if(y.current.has(H))return;const K=setInterval(async()=>{var fe,Le,Ye,He;try{const Ue=await Pd(F,H);if(Ue.status==="completed"){clearInterval(y.current.get(H)),y.current.delete(H),await Promise.resolve((fe=v.current)==null?void 0:fe.call(v)),(Le=p.current)==null||Le.call(p,S);try{const ye=Ue.notes_json?JSON.parse(Ue.notes_json):null;if(ye!=null&&ye.ublock_skipped||ye!=null&&ye.cookie_ext_skipped){const We=ye.ublock_skipped&&ye.cookie_ext_skipped?"Captured without ad-blocking or cookie-consent extension. Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config.":ye.ublock_skipped?"Captured without ad-blocking. ARCHIVR_UBLOCK=true but ARCHIVR_UBLOCK_EXT is not set or the path is invalid.":"Captured without cookie-consent extension. ARCHIVR_COOKIE_EXT is not set or the path is invalid.";w.current(We,D,"warning"),M(W,"warning",D)}else W||w.current(null,D,"success"),M(W,"archived")}catch{W||w.current(null,D,"success"),M(W,"archived")}}else if(Ue.status==="failed"){clearInterval(y.current.get(H)),y.current.delete(H),(Ye=p.current)==null||Ye.call(p,S);const ye=Ue.error_text||"Capture failed.";w.current(ye,D),M(W,"failed",D)}}catch(Ue){clearInterval(y.current.get(H)),y.current.delete(H),(He=p.current)==null||He.call(p,S);const ye=Ue.message||"Network error";w.current(ye,D),M(W,"failed",D)}},500);y.current.set(H,K)}function M(S,H,D=null){if(!S)return;const F=m.current.get(S);if(!F||(H==="archived"||H==="warning"?(F.archived++,H==="warning"&&(F.warnings++,D&&F.warningLocators.push(D))):(F.failed++,D&&F.failedLocators.push(D)),F.archived+F.failed<F.total))return;m.current.delete(S);const{archived:W,warnings:K,failed:fe,failedLocators:Le,warningLocators:Ye}=F;let He;if(W===0)He=`${fe} failed`;else{const We=K>0?`${W} archived (${K} with warnings)`:`${W} archived`;He=fe>0?`${We}, ${fe} failed`:We}const Ue=W===0?"error":fe>0||K>0?"warning":"success",ye=[];Le.length>0&&ye.push(`Failed:
|
||
${Le.map(We=>` ${We}`).join(`
|
||
`)}`),Ye.length>0&&ye.push(`With warnings:
|
||
${Ye.map(We=>` ${We}`).join(`
|
||
`)}`);const Rt=ye.length>0?ye.join(`
|
||
`):null;w.current(Rt,null,Ue,He)}async function J(S,H,D,F={}){var Le,Ye;const W=x.current,K=((Le=crypto.randomUUID)==null?void 0:Le.call(crypto))??`job-${Date.now()}-${Math.random()}`,fe={ublock_enabled:se,reader_mode:te,cookie_ext_enabled:P,modal_closer_enabled:B,via_freedium:G,...F};try{const He=await Ph(W,S,H,fe);(Ye=j.current)==null||Ye.call(j,{id:K,jobUid:He.job_uid,locator:S,archiveId:W}),T(K,He.job_uid,S,W,D)}catch(He){const Ue=He.message||"Submission failed.";w.current(Ue,S),M(D,"failed",S)}}function U(){var F,W;const S=d.filter(K=>K.locator.trim());if(S.length===0||S.some(K=>ou(K))||S.some(K=>K.probeState==="probing"||yn(K.locator)&&K.playlistProbeState!=="done")||S.some(K=>Array.isArray(K.playlistItems)&&K.playlistItems.length===0))return;const H=S.length>1?((F=crypto.randomUUID)==null?void 0:F.call(crypto))??`batch-${Date.now()}`:null;H&&m.current.set(H,{total:S.length,archived:0,warnings:0,failed:0,failedLocators:[],warningLocators:[]});const D=S.map(K=>({locator:K.locator.trim(),quality:K.playlistItems!==null?null:K.quality||"best",extraExtensions:K.playlistItems!==null?{per_item_quality:Object.fromEntries(K.playlistItems.map(fe=>[fe.id,fe.quality])),sync:K.syncEnabled}:{}}));g([Pn()]),(W=u.current)==null||W.close(),D.forEach(({locator:K,quality:fe,extraExtensions:Le})=>J(K,fe,H,Le))}function ge(){g(S=>[...S,Pn()])}function ce(S){clearTimeout(h.current.get(S)),h.current.delete(S),g(H=>{const D=H.filter(F=>F.id!==S);return D.length===0?[Pn()]:D})}function $e(S,H){if(clearTimeout(h.current.get(S)),g(D=>D.map(F=>F.id===S?{...F,locator:H,probeState:"idle",probeQualities:null,probeHasAudio:!1,quality:"best",playlistProbeState:"idle",playlistInfo:null,playlistItems:null,playlistQuality:null,playlistExpanded:!1}:F)),Rd(H)){const D=setTimeout(async()=>{h.current.delete(S),g(F=>F.map(W=>W.id===S?{...W,probeState:"probing"}:W));try{const F=await Lh(x.current,H.trim());g(W=>W.map(K=>{if(K.id!==S||K.locator!==H)return K;const fe=F.qualities??[],Le=F.has_audio??!1,Ye=fe.length===0&&Le?"audio":"best";return{...K,probeState:"done",probeQualities:fe,probeHasAudio:Le,quality:Ye}}))}catch{g(F=>F.map(W=>W.id===S?{...W,probeState:"idle",probeQualities:null}:W))}},600);h.current.set(S,D)}else if(yn(H)){const D=setTimeout(async()=>{h.current.delete(S),g(F=>F.map(W=>W.id===S?{...W,playlistProbeState:"probing"}:W));try{const F=await zh(x.current,H.trim());g(W=>W.map(K=>K.id!==S||K.locator!==H?K:{...K,playlistProbeState:"done",playlistInfo:F,playlistItems:F.items.map(fe=>({...fe,quality:null})),playlistQuality:null}))}catch{g(F=>F.map(W=>W.id===S?{...W,playlistProbeState:"error"}:W))}},800);h.current.set(S,D)}}function we(S,H){g(D=>D.map(F=>F.id===S?{...F,quality:H}:F))}function Pe(S,H){g(D=>D.map(F=>{if(F.id!==S)return F;const W=fm(H,F.playlistItems);return{...F,playlistQuality:H,playlistItems:W}}))}function rt(S,H,D){g(F=>F.map(W=>W.id!==S?W:{...W,playlistItems:W.playlistItems.map(K=>K.id===H?{...K,quality:D}:K)}))}function ct(S){g(H=>H.map(D=>D.id===S?{...D,playlistExpanded:!D.playlistExpanded}:D))}function zt(S,H){g(D=>D.map(F=>F.id===S?{...F,syncEnabled:H}:F))}function Je(S,H){g(D=>D.map(F=>F.id!==S?F:{...F,playlistItems:F.playlistItems.filter(W=>W.id!==H)}))}const Be=d.filter(S=>S.locator.trim()).length,z=d.some(S=>ou(S)),Y=d.some(S=>Array.isArray(S.playlistItems)&&S.playlistItems.length===0),Se=d.some(S=>S.probeState==="probing"||yn(S.locator)&&S.playlistProbeState!=="done");return s.jsx("dialog",{ref:u,className:"capture-dialog",children:s.jsxs("div",{className:"capture-dialog-inner",children:[s.jsxs("div",{className:"capture-dialog-header",children:[s.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),s.jsx("button",{type:"button",className:"capture-dialog-close",onClick:()=>{var S;return(S=u.current)==null?void 0:S.close()},"aria-label":"Close",children:s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("line",{x1:"3",y1:"3",x2:"13",y2:"13"}),s.jsx("line",{x1:"13",y1:"3",x2:"3",y2:"13"})]})})]}),s.jsx("div",{className:"capture-rows",children:d.map((S,H)=>s.jsx(hm,{item:S,autoFocus:H===d.length-1,onLocatorChange:D=>$e(S.id,D),onQualityChange:D=>we(S.id,D),onRemove:()=>ce(S.id),onSubmit:U,onPlaylistQualityChange:D=>Pe(S.id,D),onPlaylistItemQualityChange:(D,F)=>rt(S.id,D,F),onPlaylistToggle:()=>ct(S.id),onSyncChange:D=>zt(S.id,D),onPlaylistItemDelete:D=>Je(S.id,D)},S.id))}),s.jsxs("button",{type:"button",className:"capture-add-row",onClick:ge,children:[s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"14"}),s.jsx("line",{x1:"2",y1:"8",x2:"14",y2:"8"})]}),"Add another"]}),s.jsxs("div",{className:"capture-advanced",children:[s.jsxs("button",{type:"button",className:"capture-advanced-toggle",onClick:()=>_(S=>!S),"aria-expanded":k,children:[s.jsx("svg",{className:`capture-chevron${k?" capture-chevron--open":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"4 6 8 10 12 6"})}),"Advanced options"]}),k&&s.jsxs("div",{className:"capture-advanced-panel",children:[s.jsxs("label",{className:"capture-ext-row",children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"uBlock Origin Lite"}),s.jsx("span",{className:"capture-ext-desc",children:"Block ads during this capture"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":se,className:`ext-toggle ext-toggle--sm${se?" ext-toggle--on":""}`,onClick:()=>E(S=>S===null?!se:!S),"aria-label":"Toggle uBlock for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Block cookie banners"}),s.jsx("span",{className:"capture-ext-desc",children:"Dismiss cookie consent banners during this capture"}),!(N!=null&&N.cookie_ext_available)&&s.jsxs("span",{className:"capture-ext-hint",children:["Not configured — set ",s.jsx("code",{children:"ARCHIVR_COOKIE_EXT"})]})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":P,className:`ext-toggle ext-toggle--sm${P?" ext-toggle--on":""}`,onClick:()=>V(S=>!S),"aria-label":"Toggle cookie banner blocking for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Reader mode"}),s.jsx("span",{className:"capture-ext-desc",children:"Distil to article text via Readability (off by default)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":te,className:`ext-toggle ext-toggle--sm${te?" ext-toggle--on":""}`,onClick:()=>R(S=>!S),"aria-label":"Toggle reader mode for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Close modals and dialogs"}),s.jsx("span",{className:"capture-ext-desc",children:"Auto-dismiss cookie banners and overlays during this capture"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":B,className:`ext-toggle ext-toggle--sm${B?" ext-toggle--on":""}`,onClick:()=>Q(S=>!S),"aria-label":"Toggle modal closer for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Freedium mirror"}),s.jsx("span",{className:"capture-ext-desc",children:"Route paywalled articles through a Freedium mirror (Medium, NYT, WaPo, etc.)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":G,className:`ext-toggle ext-toggle--sm${G?" ext-toggle--on":""}`,onClick:()=>ue(S=>!S),"aria-label":"Toggle Freedium mirror for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]})]})]}),s.jsxs("div",{className:"capture-actions",children:[s.jsx("button",{type:"button",className:"capture-submit",onClick:U,disabled:Be===0||z||Se||Y,children:Be>1?`Archive ${Be}`:"Archive"}),s.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var S;return(S=u.current)==null?void 0:S.close()},children:"Cancel"})]})]})})}function hm({item:e,autoFocus:t,onLocatorChange:n,onQualityChange:r,onRemove:l,onSubmit:i,onPlaylistQualityChange:a,onPlaylistItemQualityChange:o,onPlaylistToggle:u,onSyncChange:c,onPlaylistItemDelete:y}){const h=f.useRef(null);f.useEffect(()=>{var v;t&&((v=h.current)==null||v.focus())},[t]);const m=(()=>{if(yn(e.locator)){if(e.playlistProbeState==="probing")return s.jsx("span",{className:"capture-quality-probing","aria-label":"Probing playlist…",children:"…"});if(e.playlistProbeState==="done"){const v=[...new Set(e.playlistItems.flatMap(p=>p.qualities.map(d=>parseInt(d))))].sort((p,d)=>d-p),w=e.playlistItems.every(p=>p.has_audio),j=e.playlistItems.filter(p=>p.quality===null).length;return s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"capture-quality",value:e.playlistQuality??"",onChange:p=>a(p.target.value),"aria-label":"Playlist quality",children:[!e.playlistQuality&&s.jsx("option",{value:"",disabled:!0,children:"Select quality…"}),s.jsx("option",{value:"best",children:"Best quality"}),v.map(p=>s.jsxs("option",{value:`${p}p`,children:[p,"p"]},p)),w&&s.jsx("option",{value:"audio",children:"Audio only"})]}),j>0&&s.jsxs("span",{className:"capture-conflict-badge",children:[j," need selection"]})]})}return e.playlistProbeState==="error"?s.jsx("span",{className:"capture-quality-hint capture-quality-hint--error",children:"Probe failed — edit URL to retry"}):null}if(!Rd(e.locator))return null;if(e.probeState==="probing")return s.jsx("span",{className:"capture-quality-probing","aria-label":"Checking available qualities",children:"…"});if(e.probeState==="done"){const v=e.probeQualities??[],w=e.probeHasAudio??!1;return v.length===0&&!w?s.jsx("span",{className:"capture-quality-hint",children:"No media detected"}):v.length===0&&w?s.jsx("select",{className:"capture-quality",value:"audio",onChange:j=>r(j.target.value),"aria-label":"Video quality",children:s.jsx("option",{value:"audio",children:"Audio only"})}):s.jsxs("select",{className:"capture-quality",value:e.quality||"best",onChange:j=>r(j.target.value),"aria-label":"Video quality",children:[s.jsx("option",{value:"best",children:"Best quality"}),v.map(j=>s.jsx("option",{value:j,children:j},j)),w&&s.jsx("option",{value:"audio",children:"Audio only"})]})}return null})(),x=yn(e.locator)&&e.playlistProbeState==="done"?s.jsxs("label",{className:"capture-sync-row",children:[s.jsx("input",{type:"checkbox",checked:e.syncEnabled,onChange:v=>c(v.target.checked)}),s.jsx("span",{children:"Sync — skip already-archived videos"})]}):null;return s.jsxs("div",{className:"capture-row",children:[s.jsxs("div",{className:"capture-row-main",children:[yn(e.locator)?e.playlistProbeState==="done"?s.jsx("button",{type:"button",className:"capture-playlist-toggle capture-playlist-toggle--left",onClick:u,"aria-label":e.playlistExpanded?"Collapse video list":"Expand video list","aria-expanded":e.playlistExpanded,children:e.playlistExpanded?"▲":"▼"}):e.playlistProbeState==="probing"?s.jsx("span",{className:"capture-playlist-toggle-placeholder","aria-hidden":"true"}):null:null,s.jsx("input",{ref:h,className:"capture-input",type:"text",placeholder:"https://… · yt:ID · ytm:ID · tweet:ID · x:ID",value:e.locator,onChange:v=>n(v.target.value),onKeyDown:v=>{v.key==="Enter"&&i()},autoComplete:"off",spellCheck:!1}),m,s.jsx("button",{type:"button",className:"capture-row-action capture-row-remove",onClick:l,"aria-label":"Remove",children:s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("line",{x1:"3",y1:"3",x2:"13",y2:"13"}),s.jsx("line",{x1:"13",y1:"3",x2:"3",y2:"13"})]})})]}),e.error&&s.jsx("p",{className:"capture-row-error",children:e.error}),yn(e.locator)&&e.playlistProbeState==="done"&&e.playlistExpanded?s.jsxs("div",{className:"capture-playlist-items",children:[e.playlistItems.map(v=>s.jsxs("div",{className:`capture-playlist-item${v.quality===null?" capture-playlist-item--conflict":""}`,children:[s.jsx("span",{className:"capture-playlist-item-title",children:v.title||v.url}),s.jsxs("select",{className:"capture-item-quality",value:v.quality??"",onChange:w=>o(v.id,w.target.value),"aria-label":`Quality for ${v.title||v.url}`,children:[v.quality===null&&s.jsx("option",{value:"",disabled:!0,children:"Choose…"}),s.jsx("option",{value:"best",children:"Best quality"}),v.qualities.map(w=>s.jsx("option",{value:w,children:w},w)),v.has_audio&&s.jsx("option",{value:"audio",children:"Audio only"})]}),v.quality===null&&s.jsx("span",{className:"capture-playlist-conflict-badge",children:"Choose quality"}),s.jsx("button",{type:"button",className:"capture-playlist-item-remove","aria-label":`Remove ${v.title||v.url}`,onClick:()=>y(v.id),children:"×"})]},v.id)),x]}):x]})}function mm(){return s.jsxs("div",{className:"skeleton-row",children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:s.jsx("span",{className:"skeleton-cell",style:{width:108,height:13}})}),s.jsxs("div",{className:"col-title",style:{gap:"0.42em",display:"flex",alignItems:"center"},children:[s.jsx("span",{className:"skeleton-cell",style:{width:14,height:14,borderRadius:"50%",flexShrink:0}}),s.jsx("span",{className:"skeleton-cell",style:{width:"58%",height:13}})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"skeleton-cell",style:{width:58,height:20,borderRadius:99}})}),s.jsx("div",{className:"col-size",children:s.jsx("span",{className:"skeleton-cell",style:{width:44,height:12}})}),s.jsx("div",{className:"col-url",children:s.jsx("span",{className:"skeleton-cell",style:{width:"65%",height:12}})})]})}function Xr(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function gm(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}function St(e){return gm(e)??""}function Ka(e){if(!e)return"";const t=new Date(e);if(isNaN(t))return e;const n=r=>String(r).padStart(2,"0");return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`}const uu={youtube:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FF0000" d="M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1C24 15.9 24 12 24 12s0-3.9-.5-5.8z"/><polygon fill="#fff" points="9.6,15.6 15.8,12 9.6,8.4"/></svg>',youtube_music:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0000"/><polygon fill="#fff" points="9.6,15.6 15.8,12 9.6,8.4"/></svg>',spotify:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1DB954"/><path fill="#fff" d="M17.9 10.9c-3.2-1.9-8.5-2.1-11.6-1.1-.5.1-1-.2-1.1-.6-.1-.5.2-1 .6-1.1 3.5-1.1 9.4-.9 13 1.3.4.2.6.8.3 1.2-.2.5-.8.6-1.2.3zm-.1 2.9c-.2.4-.7.5-1.1.3-2.7-1.6-6.7-2.1-9.9-1.1-.4.1-.9-.1-1-.5-.1-.4.1-.9.5-1 3.6-1.1 8-.5 11.1 1.3.4.2.5.7.4 1zm-1.3 2.8c-.2.3-.6.4-.9.2-2.3-1.4-5.2-1.7-8.6-.9-.3.1-.7-.1-.8-.5-.1-.3.1-.7.4-.8 3.7-.9 7-.5 9.6 1 .4.2.5.6.3.9z"/></svg>',x:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.2 2h3.3l-7.2 8.2L23 22h-6.6l-5.2-6.8L5 22H1.7l7.7-8.8L1 2h6.8l4.7 6.2zm-1.1 18h1.8L6.9 3.9H5z"/></svg>',instagram:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="ig" x1="0%" y1="100%" x2="100%" y2="0%"><stop offset="0%" stop-color="#f09433"/><stop offset="25%" stop-color="#e6683c"/><stop offset="50%" stop-color="#dc2743"/><stop offset="75%" stop-color="#cc2366"/><stop offset="100%" stop-color="#bc1888"/></linearGradient></defs><rect width="24" height="24" rx="5" fill="url(#ig)"/><rect x="2.5" y="2.5" width="19" height="19" rx="4" fill="none" stroke="#fff" stroke-width="1.5"/><circle cx="12" cy="12" r="4" fill="none" stroke="#fff" stroke-width="1.5"/><circle cx="17.5" cy="6.5" r="1" fill="#fff"/></svg>',facebook:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect width="24" height="24" rx="4" fill="#1877F2"/><path fill="#fff" d="M16 8h-2c-.6 0-1 .4-1 1v2h3l-.4 3H13v8h-3v-8H8v-3h2V9a4 4 0 0 1 4-4h2v3z"/></svg>',tiktok:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19.6 5.4a4.8 4.8 0 0 1-4.8-4.8h-3v14.7a2 2 0 1 1-2-2l.1-3a5 5 0 1 0 4.9 5V8.4a8 8 0 0 0 4.8 1.6V6.7a4.8 4.8 0 0 1-0-.2l0 0 .1.9z" fill="#000"/><path d="M18.6 4.4a4.8 4.8 0 0 1-4.8-4.8h-3v14.7a2 2 0 1 1-2-2l.1-3a5 5 0 1 0 4.9 5V7.4a8 8 0 0 0 4.8 1.6V5.7" fill="none" stroke="#69C9D0" stroke-width="1.5"/></svg>',reddit:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF4500"/><path fill="#fff" d="M20 12a2 2 0 0 0-2-2 2 2 0 0 0-1.3.5c-1.3-.9-3-.9-4.6-.9l.8-3.7 2.6.5a1.4 1.4 0 1 0 1.4-1.3 1.4 1.4 0 0 0-1.3.8l-2.9-.5a.3.3 0 0 0-.4.3l-.9 4.1c-1.6 0-3.1.1-4.3.9A2 2 0 0 0 4 12a2 2 0 0 0 1 1.7 3.3 3.3 0 0 0 0 .5c0 2.6 3 4.8 6.8 4.8s6.8-2.1 6.8-4.8a3.3 3.3 0 0 0 0-.5A2 2 0 0 0 20 12zm-13.6 1a1.1 1.1 0 1 1 1.1 1.1A1.1 1.1 0 0 1 6.4 13zm6.2 3.1a3.5 3.5 0 0 1-2.3.7 3.5 3.5 0 0 1-2.3-.7.3.3 0 0 1 .4-.4 3 3 0 0 0 1.9.5 3 3 0 0 0 1.9-.5.3.3 0 0 1 .4.4zm-.3-2a1.1 1.1 0 1 1 1.1-1.1A1.1 1.1 0 0 1 12.3 14.1z"/></svg>',snapchat:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect width="24" height="24" rx="4" fill="#FFFC00"/><path d="M12 3.5c-2.4 0-4.4 2-4.4 4.4v1.3l-.8.1c-.3 0-.5.2-.5.5s.3.5.6.6c.3.1.5.3.5.8 0 .3-.1.5-.3.7-.6.8-1.5 1.3-2.2 1.4-.1.7.7 1 1.7 1.2.1.6.3.8.8.8.6 0 1.1.4 2.7.4 1.5 0 2.1-.4 2.7-.4.5 0 .7-.2.8-.8 1-.2 1.8-.5 1.7-1.2-.7-.1-1.6-.6-2.2-1.4-.2-.2-.3-.4-.3-.7 0-.5.2-.7.5-.8.3-.1.6-.3.6-.6s-.2-.5-.5-.5l-.8-.1V7.9C16.4 5.5 14.4 3.5 12 3.5z"/></svg>',local:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="#666" stroke-width="1.5" stroke-linejoin="round" d="M4 4h7l2 2h7v14H4z"/></svg>',web:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="none" stroke="#555" stroke-width="1.5"/><ellipse cx="12" cy="12" rx="4" ry="10" fill="none" stroke="#555" stroke-width="1.5"/><line x1="2" y1="9" x2="22" y2="9" stroke="#555" stroke-width="1.5"/><line x1="2" y1="15" x2="22" y2="15" stroke="#555" stroke-width="1.5"/></svg>',other:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="none" stroke="#999" stroke-width="1.5"/><text x="12" y="16" text-anchor="middle" font-size="12" fill="#999">?</text></svg>'};function Ns(e){return uu[e]??uu.other}function Id(e){return e.split("/").map(t=>t?t.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"").join("/")}function ym({entry:e,onRowClick:t,selectedUids:n}){const r=(n==null?void 0:n.size)===1&&n.has(e.entry_uid),l=(n==null?void 0:n.size)>=2&&n.has(e.entry_uid),i=["child-entry-row",r&&"is-selected",l&&"is-multi-selected"].filter(Boolean).join(" ");return s.jsxs("div",{className:i,tabIndex:0,"data-entry-uid":e.entry_uid,onMouseDown:a=>{a.shiftKey&&a.preventDefault()},onClick:a=>t(e,a),onKeyDown:a=>{a.key==="Enter"&&t(e,a)},children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:Ka(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[s.jsx("span",{className:"source-icon",children:s.jsx("span",{dangerouslySetInnerHTML:{__html:Ns(e.source_kind)}})}),s.jsx("span",{className:"entry-title",children:St(e.title)||St(e.entry_uid)})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"type-pill",children:St(e.entity_kind)})}),s.jsx("div",{className:"col-size",children:s.jsx("span",{className:"size-total",children:Xr(e.total_artifact_bytes)})}),s.jsx("div",{className:"url-cell col-url",children:St(e.original_url)})]})}function vm({entry:e,archiveId:t,isSelected:n,isMultiSelected:r,onRowClick:l,selectedUids:i}){const[a,o]=f.useState(!1),[u,c]=f.useState(!1),[y,h]=f.useState(null),[m,x]=f.useState(!1),w=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!a?s.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>o(!0),style:{objectFit:"contain"}}):s.jsx("span",{dangerouslySetInnerHTML:{__html:Ns(e.source_kind)}}),j=n||r,p=e.child_count>0;function d(_){_.stopPropagation(),l(e,{ctrlKey:!0,metaKey:!1,shiftKey:!1,preventDefault(){}})}async function g(_){if(_.stopPropagation(),u){c(!1);return}if(c(!0),y===null&&!m){x(!0);try{const b=await kh(t,e.entry_uid);h(b)}catch{h([])}finally{x(!1)}}}const k=["entry-row-outer",n&&"is-selected",r&&"is-multi-selected"].filter(Boolean).join(" ");return s.jsxs("div",{className:k,"data-entry-uid":e.entry_uid,children:[s.jsxs("div",{className:"entry-row-main",tabIndex:0,onMouseDown:_=>{_.shiftKey&&_.preventDefault()},onClick:_=>l(e,_),onKeyDown:_=>{_.key==="Enter"&&l(e,_)},children:[s.jsx("div",{className:"col-check",children:s.jsx("button",{type:"button",className:`row-checkbox${j?" is-checked":""}`,"aria-pressed":j,"aria-label":j?"Deselect entry":"Select entry",onClick:d,onKeyDown:_=>_.stopPropagation()})}),s.jsx("div",{className:"col-added",children:Ka(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[p&&s.jsx("button",{type:"button",className:`entry-expand-btn${u?" is-expanded":""}`,"aria-label":u?"Collapse children":`Expand ${e.child_count} items`,"aria-expanded":u,onClick:g,onKeyDown:_=>_.stopPropagation()}),s.jsx("span",{className:"source-icon",children:w}),s.jsx("span",{className:"entry-title",children:St(e.title)||St(e.entry_uid)}),p&&s.jsx("span",{className:"child-count-badge","aria-hidden":"true",children:e.child_count})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"type-pill",children:St(e.entity_kind)})}),s.jsxs("div",{className:"col-size",children:[s.jsx("span",{className:"size-total",children:Xr(e.total_artifact_bytes)}),e.cached_bytes>0&&e.total_artifact_bytes>0&&s.jsxs("span",{className:"size-cached-pct",title:`${Xr(e.cached_bytes)} already on disk from an earlier entry`,children:[Math.round(e.cached_bytes/e.total_artifact_bytes*100),"% cached"]})]}),s.jsx("div",{className:"url-cell col-url",children:St(e.original_url)})]}),u&&s.jsxs("div",{className:"child-entries","aria-label":`${e.child_count} child entries`,children:[m&&s.jsx("div",{className:"child-entries-loading",children:"Loading…"}),y&&y.map(_=>s.jsx(ym,{entry:_,onRowClick:l,selectedUids:i},_.entry_uid))]})]})}function xm({entries:e,selectedUids:t,onRowClick:n,archiveId:r,pendingCaptures:l=[]}){return s.jsx("section",{id:"archive-view",className:"view is-active",children:s.jsxs("div",{className:"entry-table",children:[s.jsxs("div",{className:"entry-header-row",children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:"Added"}),s.jsx("div",{className:"col-title",children:"Title"}),s.jsx("div",{className:"col-type",children:"Type"}),s.jsx("div",{className:"col-size",children:"Size"}),s.jsx("div",{className:"col-url",children:"Original URL"})]}),s.jsxs("div",{id:"entries-body",children:[l.filter(i=>i.archiveId===r).reverse().map(i=>s.jsx(mm,{},i.id)),e.map(i=>s.jsx(vm,{entry:i,archiveId:r,isSelected:t.size===1&&t.has(i.entry_uid),isMultiSelected:t.size>=2&&t.has(i.entry_uid),onRowClick:n,selectedUids:t},i.entry_uid))]})]})})}function wm(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function km({status:e}){const t=e==="completed"?"run-status--completed":e==="failed"?"run-status--failed":e==="in_progress"?"run-status--in-progress":"",n=e?e.replace(/_/g," "):"—";return s.jsx("span",{className:`run-status ${t}`,children:n})}function jm({runs:e}){const[t,n]=f.useState(null);function r(l){n(i=>i===l?null:l)}return s.jsx("section",{id:"runs-view",className:"view is-active",children:s.jsxs("table",{className:"entry-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Requested"}),s.jsx("th",{children:"Completed"}),s.jsx("th",{children:"Failed"})]})}),s.jsx("tbody",{children:e.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map(l=>{const i=l.status==="failed"&&l.error_summary,a=t===l.run_uid;return[s.jsxs("tr",{className:i?"run-row run-row--failed":"run-row",onClick:i?()=>r(l.run_uid):void 0,title:i?a?"Click to hide error":"Click to view error":void 0,children:[s.jsx("td",{children:wm(l.started_at)}),s.jsxs("td",{children:[s.jsx(km,{status:l.status}),i&&s.jsx("span",{className:"run-expand-hint","aria-hidden":"true",children:a?"▴":"▾"})]}),s.jsx("td",{children:l.requested_count??"—"}),s.jsx("td",{children:l.completed_count??"—"}),s.jsx("td",{children:l.failed_count??"—"})]},l.run_uid),i&&a&&s.jsx("tr",{className:"run-error-row",children:s.jsx("td",{colSpan:5,children:s.jsx("pre",{className:"run-error-detail",children:l.error_summary})})},`${l.run_uid}-detail`)]})})]})})}const Sm=4;function Nm({archives:e}){const{currentUser:t}=f.useContext(_s)??{},n=t&&(t.role_bits&Sm)!==0,[r,l]=f.useState("users"),[i,a]=f.useState([]),[o,u]=f.useState([]),[c,y]=f.useState(!1),[h,m]=f.useState(null),[x,v]=f.useState(""),[w,j]=f.useState(""),[p,d]=f.useState(""),[g,k]=f.useState(null),[_,b]=f.useState(!1),[E,N]=f.useState(""),[I,P]=f.useState(""),[V,B]=f.useState(null),[Q,G]=f.useState(!1),ue=f.useCallback(async()=>{if(n){y(!0),m(null);try{const[T,M]=await Promise.all([Wh(),Kh()]);a(T),u(M)}catch(T){m(T.message)}finally{y(!1)}}},[n]);f.useEffect(()=>{ue()},[ue]);async function se(T){const M=T.status==="active"?"disabled":"active";try{await Qh(T.user_uid,M),a(J=>J.map(U=>U.user_uid===T.user_uid?{...U,status:M}:U))}catch(J){m(J.message)}}async function te(T){if(T.preventDefault(),!x.trim()||!w){k("Username and password required");return}b(!0),k(null);try{await Vh(x.trim(),w,p.trim()||void 0),v(""),j(""),d(""),await ue()}catch(M){k(M.message)}finally{b(!1)}}async function R(T){if(T.preventDefault(),!E.trim()||!I.trim()){B("Slug and name required");return}G(!0),B(null);try{await qh(E.trim(),I.trim()),N(""),P(""),await ue()}catch(M){B(M.message)}finally{G(!1)}}return n?s.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[s.jsx("h1",{children:"Admin"}),s.jsxs("div",{className:"view-tabs",children:[s.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),s.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),s.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),h&&s.jsx("div",{className:"form-msg form-msg--err",children:h}),r==="users"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Users"}),c?s.jsx("p",{className:"muted",children:"Loading…"}):s.jsxs("table",{className:"admin-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Username"}),s.jsx("th",{children:"Email"}),s.jsx("th",{children:"Roles"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:i.map(T=>s.jsxs("tr",{className:T.status==="disabled"?"admin-row-disabled":"",children:[s.jsx("td",{children:T.username}),s.jsx("td",{className:"muted",children:T.email||"—"}),s.jsx("td",{children:T.role_slugs.join(", ")||"—"}),s.jsx("td",{children:s.jsx("span",{className:`status-badge status-${T.status}`,children:T.status})}),s.jsx("td",{children:s.jsx("button",{className:"admin-action-btn",onClick:()=>se(T),children:T.status==="active"?"Ban":"Unban"})})]},T.user_uid))})]}),s.jsx("h3",{children:"Create User"}),s.jsxs("form",{className:"admin-form",onSubmit:te,children:[s.jsx("input",{className:"admin-input",placeholder:"Username",value:x,onChange:T=>v(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:w,onChange:T=>j(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:T=>d(T.target.value)}),g&&s.jsx("div",{className:"form-msg form-msg--err",children:g}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:_,children:_?"Creating…":"Create User"})]})]}),r==="roles"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Roles"}),c?s.jsx("p",{className:"muted",children:"Loading…"}):s.jsxs("table",{className:"admin-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Slug"}),s.jsx("th",{children:"Name"}),s.jsx("th",{children:"Level"}),s.jsx("th",{children:"Bit"}),s.jsx("th",{children:"Built-in"})]})}),s.jsx("tbody",{children:o.map(T=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{children:T.slug})}),s.jsx("td",{children:T.name}),s.jsx("td",{children:T.level}),s.jsx("td",{children:T.bit_position}),s.jsx("td",{children:T.is_builtin?"✓":""})]},T.role_uid))})]}),s.jsx("h3",{children:"Create Custom Role"}),s.jsxs("form",{className:"admin-form",onSubmit:R,children:[s.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:E,onChange:T=>N(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:I,onChange:T=>P(T.target.value),required:!0}),V&&s.jsx("div",{className:"form-msg form-msg--err",children:V}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:Q,children:Q?"Creating…":"Create Role"})]})]}),r==="archives"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Mounted Archives"}),s.jsx("div",{className:"admin-list",children:e.map(T=>s.jsxs("div",{className:"admin-archive",children:[s.jsx("strong",{children:T.label}),s.jsx("div",{className:"muted",children:T.archive_path})]},T.id))})]})]}):s.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[s.jsx("h1",{children:"Admin"}),s.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),s.jsx("h2",{children:"Mounted Archives"}),s.jsx("div",{className:"admin-list",children:e.map(T=>s.jsxs("div",{className:"admin-archive",children:[s.jsx("strong",{children:T.label}),s.jsx("div",{className:"muted",children:T.archive_path})]},T.id))})]})}function $d({node:e,onPick:t}){var n;return s.jsxs("li",{children:[s.jsx("button",{className:"tag-picker-node-btn",title:e.tag.full_path,onClick:()=>t(e.tag),children:e.tag.slug}),((n=e.children)==null?void 0:n.length)>0&&s.jsx("div",{className:"tag-children",children:s.jsx("ul",{className:"tag-tree-list",children:e.children.map(r=>s.jsx($d,{node:r,onPick:t},r.tag.tag_uid))})})]})}function cu({title:e,tagNodes:t,excludeUid:n,onPick:r,onCancel:l}){f.useEffect(()=>{function o(u){u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),l())}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[l]);function i(o){return o.filter(u=>u.tag.tag_uid!==n).map(u=>({...u,children:i(u.children)}))}const a=n?i(t):t;return s.jsx("div",{className:"tag-picker-backdrop",onClick:o=>{o.target===o.currentTarget&&l()},children:s.jsxs("div",{className:"tag-picker-modal",role:"dialog","aria-modal":"true",children:[s.jsxs("div",{className:"tag-picker-header",children:[s.jsx("span",{className:"tag-picker-title",children:e}),s.jsx("button",{className:"tag-picker-close",onClick:l,title:"Cancel","aria-label":"Cancel",children:"×"})]}),s.jsxs("div",{className:"tag-picker-body",children:[s.jsx("button",{className:"tag-picker-root-btn",onClick:()=>r(null),title:"Place at root level (no parent)",children:"↑ Root tag (no parent)"}),a.length>0?s.jsx("ul",{className:"tag-tree-list tag-picker-tree",children:a.map(o=>s.jsx($d,{node:o,onPick:r},o.tag.tag_uid))}):s.jsx("p",{className:"tag-picker-empty",children:"No other tags available."})]})]})})}function Dd({parentPath:e,archiveId:t,onDone:n,onCancel:r}){const[l,i]=f.useState(""),a=f.useRef(!1);async function o(){const u=l.trim();if(!u){r();return}const c=e?`${e}/${u}`:`/${u}`;try{await Th(t,c),n()}catch(y){alert(y.message||"Create failed"),r()}}return s.jsx("input",{className:"tag-rename-input",autoFocus:!0,placeholder:"tag name",value:l,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur(),u.key==="Escape"&&(a.current=!0,u.currentTarget.blur())},onBlur:()=>{a.current?(a.current=!1,r()):o()}})}function Od({node:e,archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u,moveSelectMode:c,onMoveSourceSelect:y,pendingCreateParentUid:h,onCreateDone:m,onCreateCancel:x}){var V;const v=n===e.tag.full_path,[w,j]=f.useState(!1),[p,d]=f.useState(""),g=f.useRef(!1);function k(){if(w)return;if(c){y(e);return}const B=v?null:e.tag.full_path;r(B),l("archive")}function _(B){B.stopPropagation(),!c&&(d(e.tag.slug),j(!0))}async function b(){const B=p.trim();if(!B||B===e.tag.slug){j(!1);return}try{const Q=await Ch(t,e.tag.tag_uid,B);i(e.tag.full_path,Q.full_path),o()}catch{}finally{j(!1)}}async function E(B){var G;B.stopPropagation();const Q=((G=e.children)==null?void 0:G.length)>0?`Delete tag "${e.tag.full_path}" and all its child tags? This cannot be undone.`:`Delete tag "${e.tag.full_path}"? This cannot be undone.`;if(window.confirm(Q))try{await Eh(t,e.tag.tag_uid),a(e.tag.full_path),o()}catch{}}const N={archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u,moveSelectMode:c,onMoveSourceSelect:y,pendingCreateParentUid:h,onCreateDone:m,onCreateCancel:x},I=h===e.tag.tag_uid,P=((V=e.children)==null?void 0:V.length)>0;return s.jsxs("li",{children:[s.jsxs("div",{className:`tag-node-row${c?" tag-node-row--move-select":""}`,children:[w?s.jsx("input",{className:"tag-rename-input",autoFocus:!0,value:p,onChange:B=>d(B.target.value),onKeyDown:B=>{B.key==="Enter"&&B.currentTarget.blur(),B.key==="Escape"&&(g.current=!0,B.currentTarget.blur())},onBlur:()=>{g.current?(g.current=!1,j(!1)):b()}}):s.jsxs("button",{className:`tag-node-btn${v?" is-active":""}${c?" tag-node-btn--move-select":""}`,title:c?`Select "${e.tag.full_path}" to move`:e.tag.full_path,onClick:k,onDoubleClick:c?void 0:_,children:[s.jsx("span",{className:"tag-node-label",children:u?e.tag.name:e.tag.slug}),s.jsx("span",{className:"tag-node-count",children:e.children.length===0?`(${e.entry_count})`:`(${e.entry_count}) (${e.subtree_count} Total)`}),!c&&s.jsx("svg",{className:"edit-icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",title:"Rename tag",onClick:B=>{B.stopPropagation(),_(B)},children:s.jsx("path",{d:"M11.5 2.5a1.5 1.5 0 0 1 2 2L5 13l-3 1 1-3 8.5-8.5z"})})]}),!w&&!c&&s.jsx("button",{className:"remove tag-node-delete",title:`Delete "${e.tag.full_path}"`,onClick:E,"aria-label":`Delete "${e.tag.full_path}"`,children:"×"})]}),(P||I)&&s.jsx("div",{className:"tag-children",children:s.jsxs("ul",{className:"tag-tree-list",children:[e.children.map(B=>s.jsx(Od,{node:B,...N},B.tag.tag_uid)),I&&s.jsx("li",{children:s.jsx(Dd,{parentPath:e.tag.full_path,archiveId:t,onDone:m,onCancel:x})})]})})]})}function _m({archiveId:e,tagNodes:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u}){const[c,y]=f.useState(null),[h,m]=f.useState(null);function x(){y("select-source"),m(null)}function v(){y(null),m(null)}f.useEffect(()=>{if(c!=="select-source")return;function Q(G){G.key==="Escape"&&(G.preventDefault(),G.stopPropagation(),v())}return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[c]);function w(Q){m(Q),y("select-dest")}async function j(Q){const G=h.tag.full_path,ue=h.tag.tag_uid,se=(Q==null?void 0:Q.tag_uid)??null;v();try{const te=await bh(e,ue,se);i(G,te.full_path),o()}catch(te){alert(te.message||"Move failed")}}const[p,d]=f.useState(null),[g,k]=f.useState(void 0);function _(){d("select-parent"),k(void 0)}function b(){d(null),k(void 0)}function E(Q){k(Q??null),d("input")}function N(){d(null),k(void 0),o()}const I=c==="select-source",P=p==="input"?g?g.tag_uid:"__root__":void 0,V={archiveId:e,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u,moveSelectMode:I,onMoveSourceSelect:w,pendingCreateParentUid:P,onCreateDone:N,onCreateCancel:b},B=P==="__root__";return s.jsxs("section",{id:"tags-view",className:"view is-active",children:[s.jsxs("div",{className:"tag-tree",children:[s.jsx("div",{className:"tag-tree-header",children:I?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"tag-tree-title tag-tree-title--move",children:"Select a tag to move"}),s.jsx("button",{className:"tag-tree-action-btn tag-tree-action-btn--cancel",onClick:v,children:"Cancel"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"tag-tree-title",children:"Tags"}),n&&s.jsxs("span",{className:"tag-tree-active",title:n,children:["Filtering: ",n]}),s.jsxs("div",{className:"tag-tree-actions",children:[s.jsx("button",{className:"tag-tree-action-btn",onClick:_,title:"Create a new tag",disabled:!!p||!!c,children:"+ New"}),s.jsx("button",{className:"tag-tree-action-btn",onClick:x,title:"Move a tag to a different parent",disabled:!!p||!!c||t.length===0,children:"Move"})]})]})}),t.length===0&&!B?s.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):s.jsxs("ul",{className:"tag-tree-list",children:[t.map(Q=>s.jsx(Od,{node:Q,...V},Q.tag.tag_uid)),B&&s.jsx("li",{children:s.jsx(Dd,{parentPath:null,archiveId:e,onDone:N,onCancel:b})})]})]}),p==="select-parent"&&s.jsx(cu,{title:"Create tag under…",tagNodes:t,excludeUid:null,onPick:E,onCancel:b}),c==="select-dest"&&h&&s.jsx(cu,{title:`Move "${h.tag.slug}" under…`,tagNodes:t,excludeUid:h.tag.tag_uid,onPick:j,onCancel:v})]})}const jr=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],Cm=e=>{var t;return((t=jr.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Em({archiveId:e}){const[t,n]=f.useState([]),[r,l]=f.useState(!1),[i,a]=f.useState(null),[o,u]=f.useState(null),[c,y]=f.useState(null),[h,m]=f.useState(!1),[x,v]=f.useState(null),[w,j]=f.useState(""),[p,d]=f.useState(""),[g,k]=f.useState(2),[_,b]=f.useState(!1),[E,N]=f.useState(null),[I,P]=f.useState(""),[V,B]=f.useState(2),[Q,G]=f.useState(!1),[ue,se]=f.useState(null),[te,R]=f.useState(!1),[T,M]=f.useState(""),J=f.useRef(null),U=t.find(z=>z.collection_uid===o)??null,ge=(U==null?void 0:U.slug)==="_default_",ce=f.useCallback(async()=>{if(e){l(!0),a(null);try{const z=await Ld(e);n(z)}catch(z){a(z.message)}finally{l(!1)}}},[e]),$e=f.useCallback(async z=>{if(!z){y(null);return}m(!0),v(null);try{const Y=await Jh(e,z);y(Y)}catch(Y){v(Y.message)}finally{m(!1)}},[e]);f.useEffect(()=>{ce()},[ce]),f.useEffect(()=>{$e(o)},[o,$e]),f.useEffect(()=>{te&&J.current&&J.current.focus()},[te]);async function we(z){z.preventDefault();const Y=w.trim(),Se=p.trim();if(!(!Y||!Se)){b(!0),N(null);try{const S=await Xh(e,Y,Se,g);j(""),d(""),k(2),await ce(),u(S.collection_uid)}catch(S){N(S.message)}finally{b(!1)}}}async function Pe(){const z=T.trim();if(!z||!U){R(!1);return}try{await au(e,U.collection_uid,{name:z}),await ce(),y(Y=>Y&&{...Y,name:z})}catch(Y){a(Y.message)}finally{R(!1)}}async function rt(z){if(U)try{await au(e,U.collection_uid,{default_visibility_bits:z}),await ce(),y(Y=>Y&&{...Y,default_visibility_bits:z})}catch(Y){a(Y.message)}}async function ct(){if(U&&window.confirm(`Delete collection "${U.name}"? Entries will not be deleted.`))try{await em(e,U.collection_uid),u(null),y(null),await ce()}catch(z){a(z.message)}}async function zt(z){z.preventDefault();const Y=I.trim();if(!(!Y||!U)){G(!0),se(null);try{await zd(e,U.collection_uid,Y,V),P(""),await $e(U.collection_uid)}catch(Se){se(Se.message)}finally{G(!1)}}}async function Je(z){if(U)try{await Yh(e,U.collection_uid,z),await $e(U.collection_uid)}catch(Y){v(Y.message)}}async function Be(z,Y){if(U)try{await Gh(e,U.collection_uid,z,Y),y(Se=>Se&&{...Se,entries:Se.entries.map(S=>S.entry_uid===z?{...S,collection_visibility_bits:Y}:S)})}catch(Se){v(Se.message)}}return e?s.jsxs("div",{className:"collections-view",children:[s.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&s.jsx("div",{className:"muted",children:"Loading…"}),i&&s.jsxs("div",{className:"collections-error",children:[i," ",s.jsx("button",{onClick:()=>a(null),className:"coll-dismiss",children:"×"})]}),s.jsxs("div",{className:"collections-layout",children:[s.jsxs("div",{className:"collections-sidebar",children:[t.map(z=>s.jsxs("button",{className:`coll-sidebar-row${o===z.collection_uid?" is-active":""}`,onClick:()=>u(z.collection_uid),children:[s.jsx("span",{className:"coll-row-name",children:z.name}),s.jsx("span",{className:"coll-row-meta",children:Cm(z.default_visibility_bits)})]},z.collection_uid)),t.length===0&&!r&&s.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),U?s.jsxs("div",{className:"coll-detail",children:[s.jsxs("div",{className:"coll-detail-header",children:[te?s.jsx("input",{ref:J,className:"coll-rename-input",value:T,onChange:z=>M(z.target.value),onBlur:Pe,onKeyDown:z=>{z.key==="Enter"&&Pe(),z.key==="Escape"&&R(!1)}}):s.jsxs("h3",{className:`coll-detail-name${ge?"":" coll-detail-name--editable"}`,title:ge?void 0:"Click to rename",onClick:()=>{ge||(M(U.name),R(!0))},children:[(c==null?void 0:c.name)??U.name,!ge&&s.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!ge&&s.jsx("button",{className:"coll-delete-btn",onClick:ct,title:"Delete collection",children:"Delete"})]}),s.jsxs("div",{className:"coll-detail-vis",children:[s.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),s.jsx("select",{className:"coll-vis-select",value:(c==null?void 0:c.default_visibility_bits)??U.default_visibility_bits,onChange:z=>rt(Number(z.target.value)),disabled:ge,children:jr.map(z=>s.jsx("option",{value:z.value,children:z.label},z.value))})]}),s.jsxs("div",{className:"coll-entries-section",children:[s.jsx("div",{className:"coll-section-heading",children:"Entries"}),h&&s.jsx("div",{className:"muted",children:"Loading…"}),x&&s.jsx("div",{className:"collections-error",children:x}),!h&&c&&(c.entries.length===0?s.jsx("div",{className:"muted",children:"No entries in this collection."}):s.jsx("ul",{className:"coll-entries-list",children:c.entries.map(z=>s.jsxs("li",{className:"coll-entry-row",children:[s.jsxs("div",{className:"coll-entry-info",children:[s.jsx("span",{className:"coll-entry-title",children:z.title||z.entry_uid}),s.jsx("span",{className:"coll-entry-kind muted",children:z.source_kind})]}),s.jsxs("div",{className:"coll-entry-actions",children:[s.jsx("select",{className:"coll-entry-vis-select",value:z.collection_visibility_bits,onChange:Y=>Be(z.entry_uid,Number(Y.target.value)),children:jr.map(Y=>s.jsx("option",{value:Y.value,children:Y.label},Y.value))}),!ge&&s.jsx("button",{className:"coll-entry-remove",onClick:()=>Je(z.entry_uid),title:"Remove from collection",children:"×"})]})]},z.entry_uid))}))]}),!ge&&s.jsxs("form",{className:"coll-add-entry-form",onSubmit:zt,children:[s.jsx("div",{className:"coll-section-heading",children:"Add entry"}),s.jsxs("div",{className:"coll-add-entry-row",children:[s.jsx("input",{className:"coll-add-entry-input",type:"text",value:I,onChange:z=>P(z.target.value),placeholder:"entry_uid",required:!0}),s.jsx("select",{className:"coll-vis-select",value:V,onChange:z=>B(Number(z.target.value)),children:jr.map(z=>s.jsx("option",{value:z.value,children:z.label},z.value))}),s.jsx("button",{className:"coll-add-btn",type:"submit",disabled:Q,children:Q?"…":"Add"})]}),ue&&s.jsx("div",{className:"collections-error",style:{marginTop:4},children:ue})]})]}):s.jsx("div",{className:"coll-detail coll-detail--empty",children:s.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),s.jsxs("details",{className:"coll-create-details",children:[s.jsx("summary",{children:"+ Create collection"}),s.jsxs("form",{className:"coll-create-form",onSubmit:we,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),s.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:w,onChange:z=>{j(z.target.value),p||d(z.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),s.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:p,onChange:z=>d(z.target.value),placeholder:"my-collection",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),s.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:g,onChange:z=>k(Number(z.target.value)),children:jr.map(z=>s.jsx("option",{value:z.value,children:z.label},z.value))})]}),E&&s.jsx("div",{className:"collections-error",children:E}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:_,children:_?"Creating…":"Create collection"})]})]})]}):s.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const Tm=4;function bm({tab:e,onTabChange:t,archiveId:n}){const{currentUser:r,setCurrentUser:l}=f.useContext(_s)??{},i=r&&(r.role_bits&Tm)!==0,a=["profile","tokens",...i?["instance","cookies","extensions","storage"]:[]],o={profile:"Profile",tokens:"API Tokens",instance:"Instance",cookies:"Cookies",extensions:"Extensions",storage:"Storage"};return s.jsxs("section",{className:"admin-view",children:[s.jsx("h1",{children:"Settings"}),s.jsx("div",{className:"view-tabs",children:a.map(u=>s.jsx("button",{className:`view-tab${e===u?" is-active":""}`,onClick:()=>t(u),children:o[u]},u))}),e==="profile"&&s.jsx(Pm,{currentUser:r,setCurrentUser:l}),e==="tokens"&&s.jsx(Lm,{}),e==="instance"&&i&&s.jsx(zm,{}),e==="cookies"&&i&&s.jsx(Im,{}),e==="extensions"&&i&&s.jsx($m,{}),e==="storage"&&i&&s.jsx(Rm,{archiveId:n})]})}function Pm({currentUser:e,setCurrentUser:t}){const[n,r]=f.useState((e==null?void 0:e.display_name)??""),[l,i]=f.useState(!1),[a,o]=f.useState(null),[u,c]=f.useState(""),[y,h]=f.useState(""),[m,x]=f.useState(""),[v,w]=f.useState(!1),[j,p]=f.useState(null);async function d(k){k.preventDefault(),i(!0),o(null);try{await Ah(n),t(_=>({..._,display_name:n||null})),o({ok:!0,text:"Saved."})}catch(_){o({ok:!1,text:_.message})}finally{i(!1)}}async function g(k){if(k.preventDefault(),y!==m){p({ok:!1,text:"Passwords do not match."});return}w(!0),p(null);try{await Fh(u,y),c(""),h(""),x(""),p({ok:!0,text:"Password changed."})}catch(_){p({ok:!1,text:_.message})}finally{w(!1)}}return s.jsxs("div",{style:{maxWidth:440},children:[s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Display Name"}),s.jsxs("form",{onSubmit:d,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),s.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:k=>r(k.target.value)})]}),a&&s.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Display Preferences"}),s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:(e==null?void 0:e.humanize_slugs)??!1,onChange:async k=>{const _=k.target.checked;try{await Mh({humanize_slugs:_}),t(b=>({...b,humanize_slugs:_}))}catch{}}}),s.jsx("span",{className:"form-label",style:{margin:0},children:"Humanize tag display"})]}),s.jsx("p",{className:"muted",style:{fontSize:13,margin:"4px 0 0"},children:'When on, tag paths show as "X / Articles" instead of "x/articles".'})]}),s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Change Password"}),s.jsxs("form",{onSubmit:g,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),s.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:u,onChange:k=>c(k.target.value),required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),s.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:y,onChange:k=>h(k.target.value),required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),s.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:m,onChange:k=>x(k.target.value),required:!0})]}),j&&s.jsx("div",{className:`form-msg form-msg--${j.ok?"ok":"err"}`,children:j.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:v,children:v?"Changing…":"Change Password"})]})]})]})}function Lm(){const[e,t]=f.useState([]),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,o]=f.useState(""),[u,c]=f.useState(!1),[y,h]=f.useState(null),m=f.useCallback(async()=>{r(!0),i(null);try{t(await Bh())}catch(w){i(w.message)}finally{r(!1)}},[]);f.useEffect(()=>{m()},[m]);async function x(w){if(w.preventDefault(),!!a.trim()){c(!0);try{const j=await Hh(a.trim());h(j),o(""),m()}catch(j){i(j.message)}finally{c(!1)}}}async function v(w){try{await Uh(w),t(j=>j.filter(p=>p.token_uid!==w))}catch(j){i(j.message)}}return s.jsx("div",{style:{maxWidth:600},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"API Tokens"}),y&&s.jsxs("div",{className:"token-banner",children:[s.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",s.jsx("code",{children:y.raw_token}),s.jsx("button",{className:"token-dismiss",onClick:()=>h(null),children:"Dismiss"})]}),s.jsxs("form",{className:"token-create-row",onSubmit:x,children:[s.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:a,onChange:w=>o(w.target.value),required:!0}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:u,children:u?"Creating…":"Create token"})]}),l&&s.jsx("div",{className:"form-msg form-msg--err",children:l}),n?s.jsx("div",{className:"muted",children:"Loading…"}):s.jsxs("div",{children:[e.length===0&&s.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(w=>s.jsxs("div",{className:"token-row",children:[s.jsxs("div",{className:"token-row-info",children:[s.jsx("strong",{children:w.name}),s.jsxs("div",{className:"muted",children:["Created ",w.created_at.slice(0,10),w.last_used_at&&` · Last used ${w.last_used_at.slice(0,10)}`]})]}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>v(w.token_uid),children:"Revoke"})]},w.token_uid))]})]})})}function zm(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,o]=f.useState(!1),[u,c]=f.useState(null);f.useEffect(()=>{(async()=>{try{t(await Qa())}catch(h){i(h.message)}finally{r(!1)}})()},[]);async function y(h){h.preventDefault(),o(!0),c(null);try{await Dl(e),c({ok:!0,text:"Saved."})}catch(m){c({ok:!1,text:m.message})}finally{o(!1)}}return n?s.jsx("div",{className:"muted",children:"Loading…"}):l?s.jsx("div",{className:"form-msg form-msg--err",children:l}):e?s.jsx("div",{style:{maxWidth:440},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Instance Settings"}),s.jsxs("form",{onSubmit:y,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([h,m])=>s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:!!e[h],onChange:x=>t(v=>({...v,[h]:x.target.checked}))}),m]},h)),s.jsxs("div",{className:"form-field",style:{marginTop:4},children:[s.jsx("label",{className:"form-label",children:"Default entry visibility"}),s.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:h=>t(m=>({...m,default_entry_visibility:Number(h.target.value)})),children:[s.jsx("option",{value:0,children:"Private"}),s.jsx("option",{value:2,children:"Unlisted"}),s.jsx("option",{value:3,children:"Public"})]})]}),u&&s.jsx("div",{className:`form-msg form-msg--${u.ok?"ok":"err"}`,children:u.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Saving…":"Save Settings"})]})]})}):null}function ti(e){if(e===0)return"0 B";const t=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,n)).toFixed(n===0?0:1)} ${t[n]}`}function Rm({archiveId:e}){const[t,n]=f.useState("idle"),[r,l]=f.useState(null),[i,a]=f.useState(null),[o,u]=f.useState(null);function c(){n("idle"),l(null),a(null),u(null)}async function y(){n("scanning"),u(null),l(null);try{const x=await tm(e);l(x),n("scanned")}catch(x){u(x.message),n("error")}}async function h(){n("deleting"),u(null);try{const x=await nm(e);a(x),n("done")}catch(x){u(x.message),n("error")}}const m=r&&r.deletable_files===0&&r.orphaned_blob_rows===0;return s.jsx("div",{style:{maxWidth:440},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Orphan Cleanup"}),s.jsxs("p",{className:"muted",style:{marginBottom:16},children:["Scan for blob files and database records that are no longer referenced by any archive entry and safely delete them."," ",s.jsx("strong",{children:"Cleanup is blocked while captures are running."})]}),!e&&s.jsx("div",{className:"muted",children:"No archive selected."}),e&&t==="idle"&&s.jsx("button",{className:"btn-ghost",onClick:y,children:"Scan for orphaned blobs"}),t==="scanning"&&s.jsx("div",{className:"muted",children:"Scanning…"}),t==="scanned"&&r&&m&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"form-msg form-msg--ok",children:"Archive is clean — nothing to remove."}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Done"})]}),t==="scanned"&&r&&!m&&s.jsxs("div",{children:[s.jsxs("div",{style:{marginBottom:14,lineHeight:1.6},children:["Found ",s.jsx("strong",{children:r.deletable_files})," unreferenced file",r.deletable_files!==1?"s":""," ","and ",s.jsx("strong",{children:r.orphaned_blob_rows})," orphaned DB record",r.orphaned_blob_rows!==1?"s":""," ","— ",s.jsx("strong",{children:ti(r.total_bytes)})," recoverable."]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsxs("button",{className:"btn-danger",onClick:h,children:["Delete (",ti(r.total_bytes),")"]}),s.jsx("button",{className:"btn-ghost",onClick:c,children:"Cancel"})]})]}),t==="deleting"&&s.jsx("div",{className:"muted",children:"Deleting…"}),t==="done"&&i&&s.jsxs("div",{children:[s.jsxs("div",{className:"form-msg form-msg--ok",children:["Freed ",s.jsx("strong",{children:ti(i.freed_bytes)})," ","— removed ",i.deleted_files," file",i.deleted_files!==1?"s":""," ","and ",i.deleted_blob_rows," DB record",i.deleted_blob_rows!==1?"s":"","."]}),i.errors&&i.errors.length>0&&s.jsxs("div",{className:"form-msg form-msg--err",style:{marginTop:6},children:[i.errors.length," file",i.errors.length!==1?"s":""," could not be deleted."]}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Scan again"})]}),t==="error"&&s.jsxs("div",{children:[s.jsx("div",{className:"form-msg form-msg--err",children:o}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Try again"})]})]})})}function Im(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,o]=f.useState("global"),[u,c]=f.useState(""),[y,h]=f.useState("{}"),[m,x]=f.useState(null),[v,w]=f.useState(!1),[j,p]=f.useState({});f.useEffect(()=>{d()},[]);async function d(){r(!0),i(null);try{t(await lm())}catch(N){i(N.message)}finally{r(!1)}}async function g(N){N.preventDefault();try{JSON.parse(y)}catch{x({ok:!1,text:'cookies must be valid JSON, e.g. {"session": "abc"}'});return}w(!0),x(null);try{await sm(a==="global"?null:u.trim(),a,y),c(""),h("{}"),o("global"),x({ok:!0,text:"Rule added."}),await d()}catch(I){x({ok:!1,text:I.message})}finally{w(!1)}}async function k(N){try{await am(N),await d()}catch(I){i(I.message)}}function _(N){p(I=>({...I,[N.rule_uid]:{cookiesInput:N.cookies_json,saving:!1,msg:null}}))}function b(N){p(I=>{const P={...I};return delete P[N],P})}async function E(N){const I=j[N.rule_uid];try{JSON.parse(I.cookiesInput)}catch{p(P=>({...P,[N.rule_uid]:{...P[N.rule_uid],msg:{ok:!1,text:"Invalid JSON"}}}));return}p(P=>({...P,[N.rule_uid]:{...P[N.rule_uid],saving:!0,msg:null}}));try{await im(N.rule_uid,{cookies_json:I.cookiesInput}),b(N.rule_uid),await d()}catch(P){p(V=>({...V,[N.rule_uid]:{...V[N.rule_uid],saving:!1,msg:{ok:!1,text:P.message}}}))}}return n?s.jsx("div",{className:"muted",children:"Loading…"}):l?s.jsx("div",{className:"form-msg form-msg--err",children:l}):s.jsx("div",{style:{maxWidth:560},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Cookie Rules"}),s.jsx("p",{className:"muted",style:{marginBottom:12},children:"Cookies are injected into every capture network request (yt-dlp, HTTP downloads, web-page snapshots). Global rules apply to all URLs; wildcard and regex rules apply only to matching URLs."}),e&&e.length>0?s.jsxs("table",{className:"data-table",style:{width:"100%",marginBottom:16},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Pattern"}),s.jsx("th",{children:"Cookies"}),s.jsx("th",{style:{width:100},children:"Actions"})]})}),s.jsx("tbody",{children:e.map(N=>{const I=j[N.rule_uid],P=N.url_pattern?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted",children:[N.pattern_kind,":"]})," ",s.jsx("code",{children:N.url_pattern})]}):s.jsx("span",{className:"muted",children:"global (all URLs)"});return s.jsxs("tr",{children:[s.jsx("td",{children:P}),s.jsx("td",{children:I?s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:12,width:"100%",minHeight:60},value:I.cookiesInput,onChange:V=>p(B=>({...B,[N.rule_uid]:{...B[N.rule_uid],cookiesInput:V.target.value}}))}),I.msg&&s.jsx("div",{className:`form-msg form-msg--${I.msg.ok?"ok":"err"}`,children:I.msg.text}),s.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[s.jsx("button",{className:"btn-primary",style:{fontSize:12,padding:"2px 8px"},disabled:I.saving,onClick:()=>E(N),children:I.saving?"Saving…":"Save"}),s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>b(N.rule_uid),children:"Cancel"})]})]}):s.jsx("code",{style:{fontSize:12,wordBreak:"break-all"},children:N.cookies_json})}),s.jsx("td",{children:!I&&s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>_(N),children:"Edit"}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"2px 8px"},onClick:()=>k(N.rule_uid),children:"Del"})]})})]},N.rule_uid)})})]}):s.jsx("p",{className:"muted",style:{marginBottom:16},children:"No cookie rules defined."}),s.jsx("h3",{style:{marginBottom:8},children:"Add Rule"}),s.jsxs("form",{onSubmit:g,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",children:"Pattern type"}),s.jsxs("select",{className:"field-input",value:a,onChange:N=>o(N.target.value),children:[s.jsx("option",{value:"global",children:"Global (all URLs)"}),s.jsx("option",{value:"wildcard",children:"Wildcard (e.g. *.youtube.com)"}),s.jsx("option",{value:"regex",children:"Regex (matched against full URL)"})]})]}),a!=="global"&&s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",children:a==="wildcard"?"URL/hostname pattern":"Regex pattern"}),s.jsx("input",{className:"field-input",type:"text",value:u,onChange:N=>c(N.target.value),placeholder:a==="wildcard"?"*.youtube.com or https://example.com/*":".*\\.youtube\\.com.*",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",children:"Cookies (JSON object)"}),s.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:13,minHeight:70},value:y,onChange:N=>h(N.target.value),placeholder:'{"SESSION": "abc123", "token": "xyz"}',required:!0})]}),m&&s.jsx("div",{className:`form-msg form-msg--${m.ok?"ok":"err"}`,children:m.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:v,children:v?"Adding…":"Add Rule"})]})]})})}function $m(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(!1),[a,o]=f.useState(null);f.useEffect(()=>{(async()=>{try{t(await Qa())}catch(j){o({ok:!1,text:j.message})}finally{r(!1)}})()},[]);async function u(j){i(!0),o(null);try{await Dl({ublock_enabled:j}),t(p=>({...p,ublock_enabled:j})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}async function c(j){i(!0),o(null);try{await Dl({cookie_ext_enabled:j}),t(p=>({...p,cookie_ext_enabled:j})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}async function y(j){i(!0),o(null);try{await Dl({modal_closer_enabled:j}),t(p=>({...p,modal_closer_enabled:j})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}if(n)return s.jsx("div",{className:"muted",children:"Loading\\u2026"});const h=(e==null?void 0:e.ublock_ext_available)??!1,m=(e==null?void 0:e.ublock_enabled)??!0,x=(e==null?void 0:e.cookie_ext_available)??!1,v=(e==null?void 0:e.cookie_ext_enabled)??!0,w=(e==null?void 0:e.modal_closer_enabled)??!0;return s.jsx("div",{children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Extensions"}),s.jsx("p",{className:"form-hint",style:{marginBottom:20},children:"Extensions run inside the browser during WebPage captures and can block ads, accept cookie banners, and more. Changes take effect on the next capture."}),s.jsxs("div",{className:"ext-grid",children:[s.jsx("div",{className:"ext-card",children:s.jsxs("div",{className:"ext-card-header",children:[s.jsxs("div",{className:"ext-card-info",children:[s.jsx("span",{className:"ext-card-name",children:"uBlock Origin Lite"}),s.jsx("span",{className:"ext-card-desc",children:"Blocks ads, trackers, and other page clutter during archiving via Chrome’s declarativeNetRequest API (Manifest V3)."}),!h&&s.jsxs("span",{className:"ext-card-hint",children:["Not configured — set ",s.jsx("code",{children:"ARCHIVR_UBLOCK_EXT"})," to the unpacked extension directory to enable."]})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":m,className:`ext-toggle${m?" ext-toggle--on":""}`,onClick:()=>u(!m),disabled:l,"aria-label":"Toggle uBlock Origin Lite",children:s.jsx("span",{className:"ext-toggle-knob"})})]})}),s.jsx("div",{className:"ext-card",children:s.jsxs("div",{className:"ext-card-header",children:[s.jsxs("div",{className:"ext-card-info",children:[s.jsx("span",{className:"ext-card-name",children:"I Still Don’t Care About Cookies"}),s.jsx("span",{className:"ext-card-desc",children:"Dismiss cookie consent banners during archiving."}),!x&&s.jsxs("span",{className:"ext-card-hint",children:["Not configured — set ",s.jsx("code",{children:"ARCHIVR_COOKIE_EXT"})," to the unpacked extension directory to enable."]})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":v,className:`ext-toggle${v?" ext-toggle--on":""}`,onClick:()=>c(!v),disabled:l,"aria-label":"Toggle I Still Don't Care About Cookies",children:s.jsx("span",{className:"ext-toggle-knob"})})]})}),s.jsx("div",{className:"ext-card",children:s.jsxs("div",{className:"ext-card-header",children:[s.jsxs("div",{className:"ext-card-info",children:[s.jsx("span",{className:"ext-card-name",children:"Modal & Dialog Closer"}),s.jsx("span",{className:"ext-card-desc",children:"Auto-dismiss cookie banners, consent overlays, and other modal dialogs before a WebPage capture is taken. Implemented as an injected browser script; no external extension required."})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":w,className:`ext-toggle${w?" ext-toggle--on":""}`,onClick:()=>y(!w),disabled:l,"aria-label":"Toggle Modal and Dialog Closer",children:s.jsx("span",{className:"ext-toggle-knob"})})]})})]}),a&&s.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text})]})})}const du={0:"Private",1:"Public",2:"Users only",3:"Public"},Dm=()=>s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function Om({archiveId:e,selectedEntry:t,selectedUids:n,selectedEntries:r,detail:l,onTagFilterSet:i,tagNodes:a,onTagsRefresh:o,onEntryTitleChange:u,onEntryDeleted:c,onBulkDeleted:y,humanizeTags:h,onDetailRefresh:m,onOpenPreview:x,onPlay:v}){var rl;const[w,j]=f.useState([]),[p,d]=f.useState(""),[g,k]=f.useState([]),[_,b]=f.useState(""),E=f.useRef(0),N=f.useRef(!1),[I,P]=f.useState(!1),[V,B]=f.useState(""),[Q,G]=f.useState("idle"),[ue,se]=f.useState(""),te=f.useRef(null),[R,T]=f.useState(!1);f.useEffect(()=>{T(!1)},[(rl=l==null?void 0:l.summary)==null?void 0:rl.entry_uid]);const M=(n==null?void 0:n.size)>=2,[J,U]=f.useState(""),[ge,ce]=f.useState("idle"),[$e,we]=f.useState(""),[Pe,rt]=f.useState([]),[ct,zt]=f.useState(""),[Je,Be]=f.useState("idle"),[z,Y]=f.useState(""),[Se,S]=f.useState("idle");f.useEffect(()=>{const $=++E.current;if(te.current&&(clearInterval(te.current),te.current=null),G("idle"),se(""),!t||!e){j([]),k([]);return}P(!1),B(""),N.current=!1,j([]),Promise.all([jl(e,t.entry_uid),Zh(e,t.entry_uid)]).then(([ne,Ve])=>{$===E.current&&(j(ne),k(Ve))}).catch(()=>{})},[t,e]),f.useEffect(()=>()=>{clearInterval(te.current)},[]),f.useEffect(()=>{if(!M||!e){rt([]);return}Ld(e).then(rt).catch(()=>rt([]))},[M,e]),f.useEffect(()=>{U(""),ce("idle"),we(""),zt(""),Be("idle"),Y(""),S("idle")},[n]);async function H(){const $=n.size;if(!window.confirm(`Delete ${$} entr${$===1?"y":"ies"}? This cannot be undone.`))return;S("running");const ne=new Set;for(const Ve of n)try{await iu(e,Ve),ne.add(Ve)}catch{}S("idle"),y==null||y(ne)}async function D(){const $=J.trim();if($){ce("running"),we("");try{for(const ne of n)await su(e,ne,$);U(""),ce("done"),o==null||o(),setTimeout(()=>ce("idle"),1800)}catch(ne){we(ne.message),ce("error")}}}async function F(){if(!ct)return;Be("running"),Y("");const $=[];for(const ne of n)try{await zd(e,ct,ne)}catch{$.push(ne)}$.length>0?(Y(`Failed for ${$.length} entr${$.length===1?"y":"ies"}.`),Be("error")):(Be("done"),setTimeout(()=>Be("idle"),1800))}async function W(){const $=V.trim()||null;try{await Nh(e,t.entry_uid,$),u==null||u(t.entry_uid,$)}catch{}finally{P(!1)}}async function K(){const $=p.trim();if(!(!$||!t))try{await su(e,t.entry_uid,$),d(""),b("");const ne=await jl(e,t.entry_uid);j(ne),o()}catch(ne){b(ne.message)}}async function fe($){try{await _h(e,t.entry_uid,$);const ne=await jl(e,t.entry_uid);j(ne),o()}catch{}}async function Le(){if(!(!t||!e)&&window.confirm("Delete this entry? This cannot be undone."))try{await iu(e,t.entry_uid),c==null||c(t.entry_uid)}catch{}}async function Ye(){if(!t||!e||Q==="running")return;const $=E.current,ne=t.entry_uid;G("running"),se("");try{const{job_uid:Ve}=await rm(e,ne);if(E.current!==$)return;te.current=setInterval(async()=>{try{const vt=await Pd(e,Ve);if(vt.status==="completed"){if(clearInterval(te.current),te.current=null,E.current!==$)return;G("done");const En=await jl(e,ne);if(E.current!==$)return;j(En),m==null||m()}else if(vt.status==="failed"){if(clearInterval(te.current),te.current=null,E.current!==$)return;G("error"),se(vt.error_text||"Re-archive failed.")}}catch{if(clearInterval(te.current),te.current=null,E.current!==$)return;G("error"),se("Network error while polling.")}},500)}catch(Ve){if(E.current!==$)return;G("error"),se(Ve.message||"Failed to start re-archive.")}}const He=l?[["Added",Ka(l.summary.archived_at)],["Source",l.summary.source_kind],["Type",l.summary.entity_kind],["Visibility",du[l.summary.visibility]??l.summary.visibility],["Root",l.structured_root_relpath]]:[],Ue=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),ye=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv","pdf","html","htm","jpg","jpeg","png","gif","webp","avif","svg","bmp"]),Rt=l?l.artifacts.findIndex($=>$.artifact_role==="primary_media"):-1,We=Rt>=0?l.artifacts[Rt]:null,tl=We?We.relpath.split(".").pop().toLowerCase():"",nl=We&&Ue.has(tl),Cs=Rt>=0&&t?`/api/archives/${e}/entries/${t.entry_uid}/artifacts/${Rt}`:null,Es=l&&!nl&&(l.summary.entity_kind==="tweet"||l.summary.entity_kind==="tweet_thread"||We&&ye.has(tl));return s.jsxs("aside",{className:"context-rail",children:[s.jsx("div",{className:"rail-eyebrow",children:"Context"}),M?s.jsxs("div",{className:"bulk-panel",children:[s.jsxs("p",{className:"bulk-count",children:[s.jsx("span",{className:"bulk-count-num",children:n.size})," entries selected"]}),s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Assign tag"}),$e&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:$e}),s.jsxs("div",{className:"tag-input-wrap",children:[s.jsx("span",{className:"hash",children:"/"}),s.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:J,onChange:$=>U($.target.value),onKeyDown:$=>{$.key==="Enter"&&D()}}),s.jsx("button",{className:"tag-add-btn",onClick:D,disabled:ge==="running"||!J.trim(),children:ge==="running"?"…":ge==="done"?"✓":"Add"})]})]}),Pe.length>0&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Add to collection"}),s.jsxs("div",{className:"bulk-coll-row",children:[s.jsxs("select",{className:"bulk-coll-select",value:ct,onChange:$=>zt($.target.value),children:[s.jsx("option",{value:"",children:"Pick a collection…"}),Pe.map($=>s.jsx("option",{value:$.collection_uid,children:$.name},$.collection_uid))]}),s.jsx("button",{className:"tag-add-btn",onClick:F,disabled:!ct||Je==="running",children:Je==="running"?"…":Je==="done"?"✓":Je==="error"?"!":"Add"})]}),z&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"6px 0 0"},children:z})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:H,disabled:Se==="running",children:Se==="running"?"Deleting…":`Delete ${n.size} entr${n.size===1?"y":"ies"}`})})]}):t?l?s.jsxs(s.Fragment,{children:[I?s.jsx("input",{className:"rail-title-input",autoFocus:!0,value:V,onChange:$=>B($.target.value),onKeyDown:$=>{$.key==="Enter"&&$.currentTarget.blur(),$.key==="Escape"&&(N.current=!0,$.currentTarget.blur())},onBlur:()=>{N.current?P(!1):W(),N.current=!1}}):s.jsxs("h2",{className:"rail-title rail-title--editable",title:"Click to rename",onClick:()=>{B(l.summary.title??""),P(!0)},children:[St(l.summary.title)||St(l.summary.entry_uid),s.jsx("svg",{className:"edit-icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M11.5 2.5a1.5 1.5 0 0 1 2 2L5 13l-3 1 1-3 8.5-8.5z"})})]}),l.summary.original_url&&s.jsxs("a",{className:"url-tile",href:l.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Ns(l.summary.source_kind)}}),s.jsx("span",{className:"u-text",children:l.summary.original_url}),s.jsx("span",{className:"ext",children:s.jsx(Dm,{})})]}),nl&&v&&s.jsx("button",{className:"rail-preview-btn",onClick:()=>v(Cs,t),children:"▶ Play"}),Es&&x&&s.jsx("button",{className:"rail-preview-btn",onClick:x,children:"Preview"}),s.jsx("div",{className:"meta-list",children:He.filter(([,$])=>$!=null&&$!=="").map(([$,ne])=>s.jsxs("div",{className:"meta-item",children:[s.jsx("span",{className:"meta-k",children:$}),s.jsx("span",{className:`meta-v${$==="Root"?" mono":""}`,children:St(ne)})]},$))}),l.artifacts.length>0&&(()=>{const $=l.artifacts.map((Ne,ir)=>({...Ne,_idx:ir})),ne=$.filter(Ne=>Ne.artifact_role==="font"),Ve=$.filter(Ne=>Ne.artifact_role!=="font"),vt=ne.reduce((Ne,ir)=>Ne+(ir.byte_size||0),0),En=l.summary.entry_uid,ll=Ne=>s.jsx("li",{children:s.jsxs("a",{href:`/api/archives/${e}/entries/${En}/artifacts/${Ne._idx}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[s.jsx("span",{className:"artifact-name",children:Ne.artifact_role==="font"?Ne.relpath.split("/").pop():Ne.artifact_role.replace(/_/g," ")}),s.jsx("span",{className:"artifact-size",children:Ne.byte_size!=null?Xr(Ne.byte_size):"—"})]})},Ne._idx);return s.jsxs("div",{className:"rail-section",children:[s.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",s.jsx("span",{className:"num",children:l.artifacts.length})]}),s.jsxs("ul",{className:"artifact-list",children:[Ve.map(ll),ne.length>0&&s.jsxs("li",{className:"artifact-group",children:[s.jsxs("button",{type:"button",className:"artifact-group-header artifact-link","aria-expanded":R,onClick:()=>T(Ne=>!Ne),children:[s.jsxs("span",{className:"artifact-name",children:[s.jsx("span",{"aria-hidden":"true",className:`artifact-group-chevron${R?" open":""}`,children:"›"}),` fonts (${ne.length})`]}),s.jsx("span",{className:"artifact-size",children:Xr(vt)})]}),R&&s.jsx("ul",{className:"artifact-list artifact-group-body",children:ne.map(ll)})]})]})]})})()]}):s.jsx("p",{className:"tags-empty",children:"Loading\\u2026"}):s.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&!M&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Tags"}),w.length===0?s.jsx("p",{className:"tags-empty",children:"No tags yet."}):s.jsx("div",{className:"tags-wrap",children:w.map($=>s.jsxs("span",{className:"tag-pill",title:$.full_path,children:[h?Id($.full_path):$.full_path,s.jsx("button",{className:"remove",title:`Remove tag ${$.full_path}`,onClick:()=>fe($.tag_uid),children:"×"})]},$.tag_uid))}),_&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:_}),s.jsxs("div",{className:"tag-input-wrap",children:[s.jsx("span",{className:"hash",children:"/"}),s.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:p,onChange:$=>d($.target.value),onKeyDown:$=>{$.key==="Enter"&&K()}}),s.jsx("button",{className:"tag-add-btn",onClick:K,children:"Add"})]})]}),g.length>0&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Collections"}),g.map($=>s.jsxs("div",{className:"coll-row",children:[s.jsx("span",{className:"coll-name",children:$.collection_uid}),s.jsx("span",{className:"vis-badge",children:du[$.visibility_bits]??`bits:${$.visibility_bits}`})]},$.collection_uid))]}),l&&(l.summary.entity_kind==="tweet"||l.summary.entity_kind==="tweet_thread")&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Actions"}),s.jsx("button",{className:"rail-rearchive-btn",onClick:Ye,disabled:Q==="running",children:Q==="running"?"Re-archiving…":"Re-archive"}),Q==="done"&&s.jsx("p",{className:"form-msg form-msg--ok",style:{marginTop:"6px"},children:"Re-archived successfully."}),Q==="error"&&s.jsx("p",{className:"form-msg form-msg--err",style:{marginTop:"6px"},children:ue})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:Le,children:"Delete entry"})})]})]})}function Am({src:e}){const t=f.useRef(null);return f.useEffect(()=>{t.current&&t.current.load()},[e]),s.jsx("div",{className:"preview-video-wrap",style:{background:"#111",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:"240px"},children:e?s.jsxs("video",{ref:t,controls:!0,autoPlay:!1,style:{width:"100%",maxHeight:"100%",display:"block"},children:[s.jsx("source",{src:e}),"Your browser does not support the video element."]}):s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No video available"})})}function fu({src:e,type:t,title:n,originalUrl:r}){const l=r||e,i=n||null;return s.jsxs("div",{className:"preview-iframe-wrap",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[s.jsxs("div",{className:"preview-iframe-toolbar",style:{display:"flex",flexDirection:"column",gap:"2px",padding:"6px 12px",borderBottom:"1px solid var(--line-soft)",background:"var(--paper-2)",flexShrink:0},children:[i&&s.jsx("span",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--ink)",fontFamily:"var(--sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.78rem",color:"var(--muted)",fontFamily:"var(--sans)"},children:l}),s.jsx("a",{href:e,target:"_blank",rel:"noreferrer noopener",style:{fontSize:"0.78rem",color:"var(--accent)",textDecoration:"none",whiteSpace:"nowrap",fontFamily:"var(--sans)",flexShrink:0},children:t==="pdf"?"Open PDF ↗":"Open in new tab ↗"})]})]}),s.jsx("iframe",{src:e,sandbox:"allow-same-origin allow-popups",allow:"autoplay 'none'",referrerPolicy:"no-referrer",style:{flex:1,border:"none",width:"100%",minHeight:0},title:i||(t==="pdf"?"PDF preview":"Page preview")})]})}function Mm({src:e,alt:t}){return s.jsx("div",{className:"preview-image-wrap",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",background:"var(--paper-2)",overflow:"hidden"},children:s.jsx("a",{href:e,target:"_blank",rel:"noreferrer noopener",style:{display:"contents"},children:s.jsx("img",{src:e,alt:t||"",style:{objectFit:"contain",maxHeight:"100%",maxWidth:"100%",display:"block",cursor:"pointer"}})})})}function Ad(e){return e?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e*1e3)):""}function pu(e){return!e||!e.includes("&")?e:e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}const X={card:{background:"var(--paper)",border:"1px solid var(--line)",borderRadius:"12px",overflow:"hidden",maxWidth:"560px",margin:"0 auto",fontFamily:'var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)'},threadOuter:{border:"1px solid var(--line)",borderRadius:"12px",overflow:"hidden",maxWidth:"560px",margin:"0 auto",background:"var(--paper)",fontFamily:'var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)'},tweetRow:{display:"flex",gap:"10px",padding:"10px 12px"},tweetRowThread:{display:"flex",gap:"10px",padding:"10px 12px 0"},leftCol:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0,width:"36px"},rightCol:{flex:1,minWidth:0,paddingBottom:"8px"},avatar:{width:"36px",height:"36px",borderRadius:"50%",objectFit:"cover",flexShrink:0,display:"block"},avatarPh:{width:"36px",height:"36px",borderRadius:"50%",background:"var(--line)",flexShrink:0},threadLine:{flex:1,width:"2px",background:"var(--line-soft, var(--line))",margin:"4px 0",minHeight:"12px",borderRadius:"1px"},authorRow:{display:"flex",alignItems:"baseline",gap:"4px",flexWrap:"wrap",marginBottom:"4px",lineHeight:"1.3"},authorName:{fontWeight:"700",fontSize:"14px",color:"var(--ink)"},authorHandle:{fontSize:"13px",color:"var(--muted)"},datePart:{fontSize:"13px",color:"var(--muted)"},tweetText:{fontSize:"14px",lineHeight:"1.5",color:"var(--ink)",whiteSpace:"pre-line",marginBottom:"8px",wordBreak:"break-word"},stats:{display:"flex",gap:"12px",fontSize:"13px",color:"var(--muted)"},link:{color:"var(--accent)",textDecoration:"none"},loading:{padding:"24px 16px",textAlign:"center",color:"var(--muted)",fontSize:"14px"},error:{padding:"24px 16px",textAlign:"center",color:"var(--alert)",fontSize:"14px"},mediaGrid:{marginBottom:"8px",borderRadius:"10px",overflow:"hidden",border:"1px solid var(--line)"},mediaImg:{display:"block",width:"100%",objectFit:"cover",maxHeight:"260px"},mediaVideo:{display:"block",width:"100%",maxHeight:"260px",background:"#000"},article:{maxWidth:"560px",margin:"0 auto",border:"1px solid var(--line)",borderRadius:"12px",overflow:"hidden",background:"var(--paper)",fontFamily:'var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)'},aCover:{width:"100%",display:"block",objectFit:"cover",maxHeight:"280px"},aMeta:{padding:"10px 14px 0"},aTweetTitle:{fontSize:"20px",fontWeight:"800",letterSpacing:"-0.3px",color:"var(--ink)",lineHeight:"1.3",marginBottom:"8px"},aAuthorRow:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},aAvatar:{width:"36px",height:"36px",borderRadius:"50%",objectFit:"cover",flexShrink:0,display:"block"},aAvatarPh:{width:"36px",height:"36px",borderRadius:"50%",background:"var(--line)",flexShrink:0},aAuthorName:{fontSize:"14px",fontWeight:"700",color:"var(--ink)",lineHeight:"1.3"},aAuthorSub:{fontSize:"13px",color:"var(--muted)",lineHeight:"1.3"},aDivider:{border:"none",borderTop:"1px solid var(--line)",margin:"0"},aBody:{padding:"4px 14px 16px"},bH1:{fontSize:"22px",fontWeight:"800",letterSpacing:"-0.4px",color:"var(--ink)",lineHeight:"1.25",margin:"16px 0 6px"},bH2:{fontSize:"18px",fontWeight:"700",letterSpacing:"-0.2px",color:"var(--ink)",lineHeight:"1.3",margin:"14px 0 4px"},bP:{fontSize:"15px",color:"var(--ink)",lineHeight:"1.65",marginBottom:"12px",marginTop:"0"},bSpacer:{height:"4px",display:"block"},bQuote:{borderLeft:"3px solid var(--line)",padding:"2px 12px",margin:"12px 0",color:"var(--muted)",fontSize:"15px",lineHeight:"1.6"},bHr:{border:"none",borderTop:"1px solid var(--line)",margin:"14px 0"},bImg:{width:"100%",display:"block",borderRadius:"8px",margin:"12px 0"},bUl:{margin:"8px 0 12px",paddingLeft:"24px"},bOl:{margin:"8px 0 12px",paddingLeft:"24px"},bLi:{fontSize:"15px",color:"var(--ink)",lineHeight:"1.6",marginBottom:"4px"},bTweet:{display:"flex",alignItems:"center",gap:"10px",border:"1px solid var(--line)",borderRadius:"10px",padding:"10px 14px",margin:"12px 0",color:"var(--muted)",fontSize:"14px",textDecoration:"none"},bMdPre:{borderRadius:"8px",margin:"10px 0",overflow:"auto",background:"var(--paper-3, var(--field))",padding:"12px 14px"},bMdCode:{fontFamily:"ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace",fontSize:"12px",lineHeight:"1.6",color:"var(--ink)",background:"transparent",display:"block"},iCode:{fontFamily:"ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace",fontSize:"0.875em",background:"var(--paper-3, var(--field))",padding:"1px 5px",borderRadius:"4px",color:"var(--ink)"},qtBadge:{fontSize:"11px",color:"var(--muted)",display:"inline-flex",alignItems:"center",gap:"2px",marginLeft:"4px",letterSpacing:"0.03em",flexShrink:0},lightboxBackdrop:{position:"fixed",inset:0,zIndex:500,background:"rgba(0,0,0,0.92)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},lightboxContent:{display:"flex",flexDirection:"column",alignItems:"center",gap:"10px",maxWidth:"90vw",maxHeight:"90vh"},lightboxToolbar:{display:"flex",alignItems:"center",gap:"10px",alignSelf:"flex-end"},lightboxImg:{maxWidth:"88vw",maxHeight:"80vh",objectFit:"contain",borderRadius:"6px",display:"block"},lightboxNav:{display:"flex",gap:"12px",alignItems:"center"},lightboxNavBtn:{background:"rgba(255,255,255,0.18)",border:"none",color:"#fff",fontSize:"20px",cursor:"pointer",borderRadius:"50%",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,flexShrink:0},lightboxBtn:{background:"rgba(255,255,255,0.18)",border:"none",color:"#fff",fontSize:"16px",cursor:"pointer",borderRadius:"50%",width:"30px",height:"30px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,flexShrink:0},lightboxLink:{color:"rgba(255,255,255,0.7)",textDecoration:"none",fontSize:"14px"},lightboxCounter:{color:"rgba(255,255,255,0.6)",fontSize:"13px"}},_e={bg:"#000000",border:"#2f3336",text:"#e7e9ea",dim:"#71767b",accent:"#1d9bf0",codeBg:"#16181c"},ni={article:{background:_e.bg,color:_e.text,minHeight:"100%",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},articleInner:{maxWidth:"598px",margin:"0 auto",paddingBottom:"80px"},aCover:{width:"100%",display:"block",objectFit:"cover",maxHeight:"420px"},aMeta:{padding:"20px 16px 0"},aTweetTitle:{fontSize:"34px",fontWeight:"800",letterSpacing:"-0.5px",color:_e.text,lineHeight:"44px",marginBottom:"16px"},aAuthorRow:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},aAvatar:{width:"40px",height:"40px",borderRadius:"50%",objectFit:"cover",flexShrink:0,display:"block"},aAvatarPh:{width:"40px",height:"40px",borderRadius:"50%",background:_e.border,flexShrink:0},aAuthorName:{fontSize:"15px",fontWeight:"700",color:_e.text,lineHeight:"1.3"},aAuthorSub:{fontSize:"15px",color:_e.dim,lineHeight:"1.3"},aDivider:{border:"none",borderTop:`1px solid ${_e.border}`,margin:"0"},aBody:{padding:"4px 16px 0"},bH1:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:_e.text,lineHeight:"36px",margin:"24px 0 10px"},bH2:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:_e.text,lineHeight:"36px",margin:"24px 0 10px"},bP:{fontSize:"17px",color:_e.text,lineHeight:"1.5",marginBottom:"16px",marginTop:"0"},bSpacer:{height:"6px",display:"block"},bQuote:{borderLeft:`3px solid ${_e.border}`,padding:"2px 14px",margin:"14px 0",color:_e.dim,fontSize:"17px",lineHeight:"1.5"},bHr:{border:"none",borderTop:`1px solid ${_e.border}`,margin:"28px 0"},bImg:{width:"100%",display:"block",borderRadius:"12px",margin:"16px 0"},bUl:{margin:"10px 0 16px",paddingLeft:"28px"},bOl:{margin:"10px 0 16px",paddingLeft:"28px"},bLi:{fontSize:"17px",color:_e.text,lineHeight:"1.5",marginBottom:"6px"},bTweet:{display:"flex",alignItems:"center",gap:"12px",border:`1px solid ${_e.border}`,borderRadius:"12px",padding:"14px 16px",margin:"14px 0",color:_e.dim,fontSize:"15px",textDecoration:"none"},bMdPre:{borderRadius:"12px",margin:"12px 0",overflow:"auto",background:"#1e2029"},bMdCode:{fontFamily:"ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace",fontSize:"13px",lineHeight:"1.65",padding:"18px 20px",display:"block",color:_e.text,background:"transparent"},iCode:{fontFamily:"ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace",fontSize:"0.875em",background:_e.codeBg,padding:"2px 6px",borderRadius:"4px",color:"#e6edf3"},link:{color:_e.accent,textDecoration:"none"}};function Fm(e,t,n){const r={};return n&&n.forEach((l,i)=>{l.relpath&&(r[l.relpath]=`/api/archives/${e}/entries/${t}/artifacts/${i}`)}),r}function Xn(e,t,n){return e&&n[e]?n[e]:t||null}function Md(){return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{flexShrink:0,color:"var(--ink)"},children:s.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.748l7.73-8.835L1.254 2.25H8.08l4.259 5.63L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z"})})}function qa(e,t,...n){var r;if(e.fromIndex!=null&&e.toIndex!=null)return{s:e.fromIndex,e:e.toIndex};if(((r=e.indices)==null?void 0:r.length)===2)return{s:e.indices[0],e:e.indices[1]};if(t)for(const l of n){if(!l)continue;const i=t.indexOf(l);if(i!==-1)return{s:i,e:i+l.length}}return null}function Fd(e,t){const n=e.expanded_url||e.url||e.text||"",r=e.display_url||e.expanded_url||e.url||e.text||"",l=qa(e,t,e.url,e.text,e.display_url,e.expanded_url);return!l||!n?null:{...l,kind:"url",href:n,display:r}}function Bd(e,t){const n=e.screen_name||e.name||e.text||"",r=n?`@${n}`:null,l=qa(e,t,r);return!l||!n?null:{...l,kind:"mention",screen_name:n}}const hu=/https?:\/\/[^\s<>"'\])]+/g,Bm=/[.,;:!?)()]+$/;function as(e,t){const n=[];let r=0,l;for(hu.lastIndex=0;(l=hu.exec(e))!==null;){l.index>r&&n.push(e.slice(r,l.index));let i=l[0].replace(Bm,"");n.push(s.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:t,children:i},l.index));const a=l[0].slice(i.length);a&&n.push(a),r=l.index+l[0].length}return r===0?e:(r<e.length&&n.push(e.slice(r)),n)}function Hm(e,t,n=[]){if(!e)return null;const r=[...(t.urls||[]).map(o=>Fd(o,e)).filter(Boolean),...(t.user_mentions||[]).map(o=>Bd(o,e)).filter(Boolean)];if(r.length===0&&n.length===0)return as(pu(e),X.link);const l=new Set([0,e.length]);for(const o of r)o.s>=0&&o.s<=e.length&&l.add(o.s),o.e>=0&&o.e<=e.length&&l.add(o.e);for(const[o,u]of n)o>=0&&o<=e.length&&l.add(o),u>=0&&u<=e.length&&l.add(u);const i=(o,u)=>n.some(([c,y])=>c<=o&&y>=u),a=[...l].sort((o,u)=>o-u);return a.slice(0,-1).map((o,u)=>{const c=a[u+1];if(i(o,c))return null;const y=e.slice(o,c),h=r.filter(v=>v.s<=o&&v.e>=c),m=h.find(v=>v.kind==="url");if(m)return s.jsx("a",{href:m.href,target:"_blank",rel:"noopener noreferrer",style:X.link,children:m.display||y},u);const x=h.find(v=>v.kind==="mention");return x?s.jsx("a",{href:`https://x.com/${x.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:X.link,children:y},u):s.jsx("span",{children:as(pu(y),X.link)},u)}).filter(o=>o!==null)}function Um(e,t,n,r,l=X){if(!e)return null;t=t||[],n=n||[],r=r||[];const i=[];for(const u of t)u.length>0&&i.push({s:u.offset,e:u.offset+u.length,kind:"style",style:u.style});for(const u of n){const c=Fd(u,e);c&&i.push(c)}for(const u of r){const c=Bd(u,e);c&&i.push(c)}if(i.length===0)return as(e,l.link);const a=new Set([0,e.length]);for(const u of i)u.s>=0&&u.s<=e.length&&a.add(u.s),u.e>=0&&u.e<=e.length&&a.add(u.e);const o=[...a].sort((u,c)=>u-c);return o.slice(0,-1).map((u,c)=>{const y=o[c+1],h=i.filter(j=>j.s<=u&&j.e>=y),m=e.slice(u,y);let x;if(m.includes(`
|
||
`)){const j=m.split(`
|
||
`);x=j.flatMap((p,d)=>d<j.length-1?[p,s.jsx("br",{},d)]:[p])}else x=m;h.some(j=>j.kind==="style"&&j.style==="Code")&&(x=s.jsx("code",{style:l.iCode,children:x})),h.some(j=>j.kind==="style"&&j.style==="Bold")&&(x=s.jsx("strong",{children:x})),h.some(j=>j.kind==="style"&&j.style==="Italic")&&(x=s.jsx("em",{children:x})),h.some(j=>j.kind==="style"&&j.style==="Underline")&&(x=s.jsx("u",{children:x})),h.some(j=>j.kind==="style"&&j.style==="Strikethrough")&&(x=s.jsx("s",{children:x}));const v=h.find(j=>j.kind==="url");if(v){const j=/^https?:\/\/t\.co\//i.test(x);x=s.jsx("a",{href:v.href,target:"_blank",rel:"noopener noreferrer",style:l.link,children:j?v.display:x})}const w=h.find(j=>j.kind==="mention");return w&&(x=s.jsx("a",{href:`https://x.com/${w.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:l.link,children:x})),s.jsx("span",{children:typeof x=="string"?as(x,l.link):x},c)})}function Wm(e,t,n){const r=(n==null?void 0:n.st)||X,l=e.resolved_entities||[];return l.length===0?null:l.map((i,a)=>{var o;switch(i.type){case"divider":return s.jsx("hr",{style:r.bHr},a);case"media":{const u=Xn(i.local_path,i.url,t);return u?s.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:c=>{var y;!c.metaKey&&!c.ctrlKey&&(c.preventDefault(),(y=n==null?void 0:n.onImgClick)==null||y.call(n,u))},children:s.jsx("img",{src:u,style:r.bImg,loading:"lazy",alt:""})},a):null}case"tweet":return i.tweet_id?s.jsxs("a",{href:`https://x.com/i/status/${i.tweet_id}`,target:"_blank",rel:"noopener noreferrer",style:r.bTweet,children:[s.jsx(Md,{}),"View post on X"]},a):null;case"link":return i.url?s.jsx("p",{style:r.bP,children:s.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",style:r.link,children:i.url})},a):null;case"markdown":{const u=i.markdown??((o=i.data)==null?void 0:o.markdown)??"";return s.jsx("pre",{style:r.bMdPre,children:s.jsx("code",{style:r.bMdCode,children:u})},a)}case"emoji":return i.url?s.jsx("img",{src:i.url,alt:"",style:{height:"1.2em",verticalAlign:"middle",margin:"0 1px"}},a):null;default:return null}})}function ri(e,t,n,r){const l=(r==null?void 0:r.st)||X,i=e.type||"",a=e.text||"",o=e.inline_style_ranges||[],u=e.data||{},c=Um(a,o,u.urls||[],u.mentions||[],l);switch(i){case"header-one":return s.jsx("h1",{style:l.bH1,children:c},t);case"header-two":{const y=a.match(/(?:x\.com|twitter\.com)\/i\/status\/(\d+)/);return y?s.jsxs("a",{href:`https://x.com/i/status/${y[1]}`,target:"_blank",rel:"noopener noreferrer",style:l.bTweet,children:[s.jsx(Md,{}),"View post on X"]},t):s.jsx("h2",{style:l.bH2,children:c},t)}case"unstyled":return a.trim()?s.jsx("p",{style:l.bP,children:c},t):s.jsx("span",{style:l.bSpacer},t);case"blockquote":return s.jsx("blockquote",{style:l.bQuote,children:c},t);case"unordered-list-item":case"ordered-list-item":return s.jsx("li",{style:l.bLi,children:c},t);case"atomic":return s.jsx("span",{children:Wm(e,n,r)},t);default:return a?s.jsx("p",{style:l.bP,children:c},t):null}}function Vm(e,t,n){const r=(n==null?void 0:n.st)||X,l=[];let i=0;for(;i<e.length;){const a=e[i];if(a.type==="unordered-list-item"){const o=i,u=[];for(;i<e.length&&e[i].type==="unordered-list-item";)u.push(ri(e[i],i,t,n)),i++;l.push(s.jsx("ul",{style:r.bUl,children:u},`ul-${o}`))}else if(a.type==="ordered-list-item"){const o=i,u=[];for(;i<e.length&&e[i].type==="ordered-list-item";)u.push(ri(e[i],i,t,n)),i++;l.push(s.jsx("ol",{style:r.bOl,children:u},`ol-${o}`))}else l.push(ri(a,i,t,n)),i++}return l}function Qm({article:e,tweetAuthor:t,artifactMap:n,fullPage:r,onXArticle:l}){const[i,a]=f.useState(null);f.useEffect(()=>{r&&(l==null||l(!0))},[r,l]);const o=r?ni:X,u=e.cover_media||{},c=e.author||t||{},y=e.first_published_at_secs?Ad(e.first_published_at_secs):"",m=[c.screen_name?`@${c.screen_name}`:"",y].filter(Boolean).join(" · "),x=Xn(u.local_path,u.url,n),v=Xn(c.avatar_local_path,c.avatar_url,n),w=s.jsxs(s.Fragment,{children:[i&&s.jsx(Hd,{items:[{src:i,alt:""}],startIndex:0,onClose:()=>a(null)}),x&&s.jsx("a",{href:x,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:j=>{!j.metaKey&&!j.ctrlKey&&(j.preventDefault(),a(x))},children:s.jsx("img",{src:x,style:o.aCover,alt:"Article cover"})}),s.jsxs("div",{style:o.aMeta,children:[e.title&&s.jsx("div",{style:o.aTweetTitle,children:e.title}),s.jsxs("div",{style:o.aAuthorRow,children:[v?s.jsx("img",{src:v,style:o.aAvatar,alt:c.name||""}):s.jsx("div",{style:o.aAvatarPh}),s.jsxs("div",{children:[s.jsx("div",{style:o.aAuthorName,children:c.name||c.screen_name||"Unknown"}),m&&s.jsx("div",{style:o.aAuthorSub,children:m})]})]})]}),s.jsx("hr",{style:o.aDivider}),s.jsx("div",{style:o.aBody,children:Vm(e.blocks||[],n,{onImgClick:a,st:o})})]});return r?s.jsx("div",{style:ni.article,children:s.jsx("div",{style:ni.articleInner,children:w})}):s.jsx("div",{style:X.article,children:w})}function Km({photos:e,onOpen:t}){const n=e.length;if(n===0)return null;if(n===1)return s.jsx("a",{href:e[0].src,target:"_blank",rel:"noopener noreferrer",style:{display:"block"},onClick:l=>{!l.metaKey&&!l.ctrlKey&&(l.preventDefault(),t(0))},children:s.jsx("img",{src:e[0].src,alt:e[0].alt||"",style:X.mediaImg,loading:"lazy"})});const r=n<=2?"180px":"140px";return s.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gridTemplateRows:n===2?r:`${r} ${r}`,gap:"2px"},children:e.map((l,i)=>s.jsx("a",{href:l.src,target:"_blank",rel:"noopener noreferrer",style:{display:"block",overflow:"hidden",gridRow:n===3&&i===0?"span 2":void 0},onClick:a=>{!a.metaKey&&!a.ctrlKey&&(a.preventDefault(),t(i))},children:s.jsx("img",{src:l.src,alt:l.alt||"",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},i))})}function Hd({items:e,startIndex:t,onClose:n}){const[r,l]=f.useState(t);f.useEffect(()=>{const a=o=>{(o.key==="Escape"||o.key==="ArrowLeft"||o.key==="ArrowRight")&&(o.stopPropagation(),o.preventDefault()),o.key==="Escape"&&n(),o.key==="ArrowRight"&&l(u=>Math.min(u+1,e.length-1)),o.key==="ArrowLeft"&&l(u=>Math.max(u-1,0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[n,e.length]);const i=e[r];return s.jsx("div",{style:X.lightboxBackdrop,onClick:n,children:s.jsxs("div",{style:X.lightboxContent,onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{style:X.lightboxToolbar,children:[e.length>1&&s.jsxs("span",{style:X.lightboxCounter,children:[r+1," / ",e.length]}),s.jsx("a",{href:i.src,target:"_blank",rel:"noopener noreferrer",style:X.lightboxLink,title:"Open in new tab",children:"↗"}),s.jsx("button",{style:X.lightboxBtn,onClick:n,"aria-label":"Close",children:"×"})]}),s.jsx("img",{src:i.src,alt:i.alt||"",style:X.lightboxImg}),e.length>1&&s.jsxs("div",{style:X.lightboxNav,children:[s.jsx("button",{style:X.lightboxNavBtn,onClick:()=>l(a=>Math.max(a-1,0)),disabled:r===0,children:"‹"}),s.jsx("button",{style:X.lightboxNavBtn,onClick:()=>l(a=>Math.min(a+1,e.length-1)),disabled:r===e.length-1,children:"›"})]})]})})}function mu({tweet:e,isInThread:t,isLast:n,artifactMap:r}){var d,g;const[l,i]=f.useState(null),a=e.author||{},o=e.created_at_secs?Ad(e.created_at_secs):"",u=e.entities||{},c=Xn(a.avatar_local_path,a.avatar_url,r),y=t&&!n,h=e.is_quote_status===!0,m=t?X.tweetRowThread:X.tweetRow,x=e.full_text||"",v=((g=(d=e.extended_entities)==null?void 0:d.media)!=null&&g.length?e.extended_entities.media:u.media)||[],w=[],j=[];for(const k of v)if(k.type==="photo"){const _=Xn(k.local_path,k.media_url_https,r);_&&w.push({kind:"photo",src:_,alt:k.alt_text||""})}else if(k.type==="video"||k.type==="animated_gif"){const _=k.local_path&&r[k.local_path]||(()=>{var E,N;return(N=(((E=k.video_info)==null?void 0:E.variants)||[]).filter(I=>I.content_type==="video/mp4").sort((I,P)=>(P.bitrate||0)-(I.bitrate||0))[0])==null?void 0:N.url})();_&&j.push({kind:k.type==="animated_gif"?"gif":"video",src:_})}const p=[];for(const k of v){if(!k.url||!(k.type==="photo"?w.some(E=>E.src===Xn(k.local_path,k.media_url_https,r)):j.length>0))continue;const b=qa(k,x,k.url);b&&p.push([b.s,b.e])}return s.jsxs(s.Fragment,{children:[l!==null&&s.jsx(Hd,{items:w,startIndex:l,onClose:()=>i(null)}),s.jsxs("div",{style:m,children:[s.jsxs("div",{style:X.leftCol,children:[c?s.jsx("img",{src:c,style:X.avatar,alt:a.name||""}):s.jsx("div",{style:X.avatarPh}),y&&s.jsx("div",{style:X.threadLine})]}),s.jsxs("div",{style:X.rightCol,children:[s.jsxs("div",{style:X.authorRow,children:[s.jsx("span",{style:X.authorName,children:a.name||a.screen_name||"Unknown"}),a.screen_name&&s.jsxs("span",{style:X.authorHandle,children:["@",a.screen_name]}),o&&s.jsxs("span",{style:X.datePart,children:["· ",o]}),h&&s.jsx("span",{style:X.qtBadge,title:"Quote tweet",children:"↻ QT"})]}),s.jsx("div",{style:X.tweetText,children:Hm(x,u,p)}),w.length>0&&s.jsx("div",{style:X.mediaGrid,children:s.jsx(Km,{photos:w,onOpen:k=>i(k)})}),j.map((k,_)=>s.jsx("div",{style:X.mediaGrid,children:s.jsx("video",{src:k.src,style:X.mediaVideo,controls:!0,loop:k.kind==="gif",muted:k.kind==="gif",autoPlay:k.kind==="gif"})},_)),(e.retweet_count>0||e.favorite_count>0)&&s.jsxs("div",{style:X.stats,children:[e.favorite_count>0&&s.jsxs("span",{children:["❤️ ",e.favorite_count.toLocaleString()]}),e.retweet_count>0&&s.jsxs("span",{children:["🔁 ",e.retweet_count.toLocaleString()]})]})]})]})]})}function qm({archiveId:e,entryUid:t,artifacts:n,entityKind:r,fullPage:l,onXArticle:i}){const[a,o]=f.useState(!0),[u,c]=f.useState(null),[y,h]=f.useState([]);if(f.useEffect(()=>{if(o(!0),c(null),h([]),!n||!e||!t){o(!1);return}const v=n.map((j,p)=>({...j,index:p})).filter(j=>j.artifact_role==="raw_tweet_json");if(v.length===0){c("No tweet data found."),o(!1);return}let w=!1;return jh(e,t,v.map(j=>j.index)).then(async j=>{if(w)return;const p=/https?:\/\/t\.co\/[A-Za-z0-9]+/g,d=E=>{var I;const N=E.full_text||"";return(((I=E.entities)==null?void 0:I.urls)||[]).map(P=>{var V;if(P.fromIndex!=null&&P.toIndex!=null)return[P.fromIndex,P.toIndex];if(((V=P.indices)==null?void 0:V.length)===2)return[P.indices[0],P.indices[1]];if(P.url){const B=N.indexOf(P.url);if(B!==-1)return[B,B+P.url.length]}return null}).filter(Boolean)},g=(E,N,I)=>E.some(([P,V])=>P<=N&&V>=I),k=new Set;for(const E of j){const N=E.full_text||"",I=d(E);let P;for(p.lastIndex=0;(P=p.exec(N))!==null;)g(I,P.index,P.index+P[0].length)||k.add(P[0])}const _=k.size>0?await Sh([...k]).catch(()=>({})):{},b=j.map(E=>{var B;const N=E.full_text||"",I=d(E),P=[];let V;for(p.lastIndex=0;(V=p.exec(N))!==null;){const Q=V[0],G=_[Q];G&&G!==Q&&!g(I,V.index,V.index+Q.length)&&P.push({url:Q,expanded_url:G,display_url:(()=>{try{const ue=new URL(G);return ue.hostname+(ue.pathname.length>1?"/…":"")}catch{return G}})(),fromIndex:V.index,toIndex:V.index+Q.length})}return P.length===0?E:{...E,entities:{...E.entities||{},urls:[...((B=E.entities)==null?void 0:B.urls)||[],...P]}}});w||h(b)}).catch(j=>{w||c(j.message||"Failed to load tweet.")}).finally(()=>{w||o(!1)}),()=>{w=!0}},[e,t,n]),a)return s.jsx("div",{style:X.loading,children:"Loading…"});if(u)return s.jsxs("div",{style:X.error,children:["Error: ",u]});if(y.length===0)return null;const m=Fm(e,t,n);if(r==="tweet_thread")return s.jsx("div",{style:X.threadOuter,children:y.map((v,w)=>s.jsx(mu,{tweet:v,isInThread:!0,isLast:w===y.length-1,artifactMap:m},v.id||w))});const x=y[0];return x.is_article&&x.article?s.jsx(Qm,{article:x.article,tweetAuthor:x.author,artifactMap:m,fullPage:l,onXArticle:i}):s.jsx("div",{style:X.card,children:s.jsx(mu,{tweet:x,isInThread:!1,isLast:!0,artifactMap:m})})}const Xm=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv"]),Jm=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),Ym=new Set(["jpg","jpeg","png","gif","webp","avif","svg","bmp"]);function Ud({archiveId:e,entry:t,detail:n,fullPage:r,onXArticle:l}){if(!t)return s.jsx("div",{className:"preview-panel preview-panel--empty",children:s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"Select an entry to preview"})});if(!n)return s.jsx("div",{className:"preview-panel preview-panel--loading",children:s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"Loading…"})});const{summary:i,artifacts:a}=n,o=i.entry_uid,u=i.entity_kind;if(u==="tweet"||u==="tweet_thread"){const x=s.jsx(qm,{archiveId:e,entryUid:o,artifacts:a,entityKind:u,fullPage:r,onXArticle:l});return r?x:s.jsx("div",{className:"preview-tweet-wrap",children:x})}const c=a.findIndex(x=>x.artifact_role==="primary_media");if(c===-1)return s.jsxs("div",{className:"preview-panel preview-panel--no-preview",children:[s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No preview available"}),a.length>0&&s.jsx("ul",{style:{marginTop:"12px",paddingLeft:"20px",fontSize:"0.8rem",color:"var(--muted-2)",fontFamily:"var(--sans)"},children:a.map((x,v)=>s.jsxs("li",{children:[x.artifact_role,": ",x.relpath]},v))})]});const y=a[c],h=`/api/archives/${e}/entries/${o}/artifacts/${c}`,m=y.relpath.split(".").pop().toLowerCase();return Xm.has(m)?s.jsx("div",{className:"preview-panel",children:s.jsx(Am,{src:h})}):Jm.has(m)?s.jsxs("div",{className:"preview-panel preview-panel--audio",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"24px",fontFamily:"var(--sans)"},children:[s.jsx("span",{style:{fontSize:"2rem"},children:"🎵"}),s.jsx("span",{style:{color:"var(--ink)",fontSize:"0.95rem",fontWeight:600},children:i.title||o}),s.jsx("audio",{src:h,controls:!0,style:{marginTop:"8px",width:"100%",maxWidth:"400px"}})]}):m==="pdf"?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:s.jsx(fu,{src:h,type:"pdf",title:i.title,originalUrl:i.original_url})}):m==="html"||m==="htm"?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:s.jsx(fu,{src:h,type:"page",title:i.title,originalUrl:i.original_url})}):Ym.has(m)?s.jsx("div",{className:"preview-panel",style:{height:"100%"},children:s.jsx(Mm,{src:h,alt:i.title||"Image"})}):s.jsxs("div",{className:"preview-panel preview-panel--no-preview",children:[s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No preview available"}),s.jsx("ul",{style:{marginTop:"12px",paddingLeft:"20px",fontSize:"0.8rem",color:"var(--muted-2)",fontFamily:"var(--sans)"},children:a.map((x,v)=>s.jsxs("li",{children:[x.artifact_role,": ",x.relpath]},v))})]})}function Gm({archiveId:e,entry:t,detail:n,onClose:r}){var l,i;return f.useEffect(()=>{const a=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),s.jsx("div",{className:"preview-modal-backdrop",onClick:r,children:s.jsxs("div",{className:`preview-modal${((l=n==null?void 0:n.summary)==null?void 0:l.entity_kind)==="tweet"||((i=n==null?void 0:n.summary)==null?void 0:i.entity_kind)==="tweet_thread"?"":" preview-modal--full"}`,onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{className:"preview-modal-header",children:[s.jsx("span",{className:"preview-modal-title",children:(t==null?void 0:t.title)||(t==null?void 0:t.entry_uid)||"Preview"}),s.jsx("a",{className:"preview-modal-newtab",href:`/preview/${e}/${t==null?void 0:t.entry_uid}`,target:"_blank",rel:"noopener noreferrer",title:"Open in new tab",children:"↗"}),s.jsx("button",{className:"preview-modal-close",onClick:r,"aria-label":"Close preview",children:"×"})]}),s.jsx("div",{className:"preview-modal-body",children:s.jsx(Ud,{archiveId:e,entry:t,detail:n})})]})})}function gu(e){if(!isFinite(e)||isNaN(e))return"--:--";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}function Zm({entry:e,src:t,archiveId:n,onClose:r}){const l=f.useRef(null),[i,a]=f.useState(!1),[o,u]=f.useState(0),[c,y]=f.useState(NaN),[h,m]=f.useState(1);f.useEffect(()=>{!l.current||!t||(l.current.load(),u(0),y(NaN),a(!1))},[t]),f.useEffect(()=>{l.current&&(l.current.volume=h)},[h]);function x(){const d=l.current;d&&(i?d.pause():d.play().catch(()=>{}))}function v(d){const g=l.current;if(!g||!isFinite(c))return;const k=Number(d.target.value);g.currentTime=k,u(k)}function w(d){m(Number(d.target.value))}const j=(e==null?void 0:e.title)||(e==null?void 0:e.entry_uid)||"Unknown",p=(e==null?void 0:e.source_kind)||"other";return s.jsxs(s.Fragment,{children:[s.jsx("audio",{ref:l,src:t||void 0,preload:"auto",onPlay:()=>a(!0),onPause:()=>a(!1),onEnded:()=>a(!1),onTimeUpdate:()=>{var d;return u(((d=l.current)==null?void 0:d.currentTime)??0)},onLoadedMetadata:()=>{var d;return y(((d=l.current)==null?void 0:d.duration)??NaN)},onDurationChange:()=>{var d;return y(((d=l.current)==null?void 0:d.duration)??NaN)},style:{display:"none"}}),s.jsxs("div",{className:"audio-bar",style:{position:"fixed",bottom:0,left:0,right:0,zIndex:100,background:"var(--paper-3)",borderTop:"1px solid var(--line)",display:"flex",alignItems:"center",gap:"16px",padding:"0 16px",height:"56px",fontFamily:"var(--sans)"},children:[s.jsxs("div",{className:"audio-bar-info",style:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:"0 1 220px",overflow:"hidden"},children:[s.jsx("span",{className:"source-icon",style:{flexShrink:0,width:"18px",height:"18px",display:"flex",alignItems:"center"},dangerouslySetInnerHTML:{__html:Ns(p)}}),s.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.85rem",color:"var(--ink)"},title:j,children:j})]}),s.jsxs("div",{className:"audio-bar-controls",style:{display:"flex",alignItems:"center",gap:"10px",flex:"1 1 0",minWidth:0},children:[s.jsx("button",{onClick:x,"aria-label":i?"Pause":"Play",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--ink)",flexShrink:0,fontSize:"1.2rem",lineHeight:1},children:i?"⏸":"▶"}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:gu(o)}),s.jsx("input",{type:"range",min:0,max:isFinite(c)?c:0,step:.1,value:isFinite(o)?o:0,onChange:v,"aria-label":"Seek",style:{flex:1,minWidth:0,accentColor:"var(--accent)"}}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:gu(c)})]}),s.jsxs("div",{className:"audio-bar-right",style:{display:"flex",alignItems:"center",gap:"8px",flex:"0 1 160px"},children:[s.jsx("span",{style:{fontSize:"0.85rem",color:"var(--muted)",flexShrink:0},children:"🔊"}),s.jsx("input",{type:"range",min:0,max:1,step:.01,value:h,onChange:w,"aria-label":"Volume",style:{width:"80px",accentColor:"var(--accent)"}}),s.jsx("button",{onClick:r,"aria-label":"Close audio player",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--muted)",fontSize:"1rem",lineHeight:1,marginLeft:"4px"},children:"✕"})]})]})]})}function eg({archiveId:e,entryUid:t}){var m,x;const[n,r]=f.useState(null),[l,i]=f.useState(!0),[a,o]=f.useState(null),[u,c]=f.useState(!1);f.useEffect(()=>{if(!u)return;const v=document.documentElement,w=document.body,j=v.style.colorScheme,p=w.style.background;return v.style.colorScheme="dark",w.style.background="#000",()=>{v.style.colorScheme=j,w.style.background=p}},[u]),f.useEffect(()=>{c(!1),Ji(e,t).then(v=>{r(v),i(!1)}).catch(v=>{o((v==null?void 0:v.message)||"Failed to load entry"),i(!1)})},[e,t]);const y=((m=n==null?void 0:n.summary)==null?void 0:m.title)||t,h=(x=n==null?void 0:n.summary)==null?void 0:x.original_url;return s.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",background:u?"#000":"var(--paper)",fontFamily:"var(--sans)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:u?"8px 12px":"10px 16px",borderBottom:u?"none":"1px solid var(--line)",flexShrink:0,position:u?"sticky":"relative",top:0,zIndex:20,background:u?"rgba(0,0,0,0.82)":"var(--paper-2)",backdropFilter:u?"blur(12px)":"none",WebkitBackdropFilter:u?"blur(12px)":"none"},children:[s.jsx("a",{href:"/",style:{color:u?"#1d9bf0":"var(--accent)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"← Archive"}),s.jsx("span",{style:{flex:1,fontSize:"14px",fontWeight:600,color:u?"#e7e9ea":"var(--ink)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),h&&s.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",style:{color:u?"#71767b":"var(--muted)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"Original ↗"})]}),s.jsxs("div",{style:u?{flex:1}:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column"},children:[l&&s.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--muted)",fontSize:"14px"},children:"Loading…"}),a&&s.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--alert)",fontSize:"14px"},children:a}),n&&s.jsx(Ud,{archiveId:e,entry:n.summary,detail:n,fullPage:!0,onXArticle:c})]})]})}const tg=7e3;function ng({toasts:e,onDismiss:t,onIgnoreUblock:n}){return e.length?s.jsx("div",{className:"toast-stack",role:"log","aria-live":"polite","aria-label":"Notifications",children:e.map(r=>s.jsx(lg,{toast:r,onDismiss:t,onIgnoreUblock:n},r.id))}):null}function rg(e){if(!e)return null;if(e.length<=52)return e;try{const{hostname:t,pathname:n,search:r}=new URL(e),l=n.split("/").filter(Boolean),i=(l[l.length-1]??"")+r,a=i?`${t}/…/${i}`:t;return a.length<=56?a:a.slice(0,53)+"…"}catch{return"…"+e.slice(-51)}}function lg({toast:e,onDismiss:t,onIgnoreUblock:n}){const[r,l]=f.useState(!1),i=e.type==="warning",a=e.type==="success";f.useEffect(()=>{if(r)return;const u=setTimeout(()=>t(e.id),tg);return()=>clearTimeout(u)},[r,e.id,t]);const o=rg(e.locator);return a?s.jsx("div",{className:"toast toast--success",role:"alert","aria-atomic":"true",children:s.jsxs("div",{className:"toast-top",children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"✓"}),s.jsxs("div",{className:"toast-body",children:[s.jsx("span",{className:"toast-headline",children:e.headline||"Archived"}),o&&s.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),s.jsx("div",{className:"toast-btns",children:s.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})})]})}):i?s.jsxs("div",{className:"toast toast--warning",role:"alert","aria-atomic":"true",children:[s.jsxs("div",{className:"toast-top",children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"⚠"}),s.jsxs("div",{className:"toast-body",children:[s.jsx("span",{className:"toast-headline",children:e.headline||"Archived with warnings"}),o&&s.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),s.jsxs("div",{className:"toast-btns",children:[e.text&&s.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(u=>!u),"aria-expanded":r,children:r?"Hide":"Details"}),e.locator&&s.jsx("button",{type:"button",className:"toast-view-btn toast-ignore-btn",onClick:()=>{n==null||n(),t(e.id)},children:"Ignore"}),s.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})]})]}),r&&s.jsx("p",{className:"toast-warning-detail",children:e.text||"The page was captured but one or more browser extensions were unavailable (ad-blocking or cookie-consent). Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config."})]}):s.jsxs("div",{className:"toast toast--error",role:"alert","aria-atomic":"true",children:[s.jsxs("div",{className:"toast-top",children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"✕"}),s.jsxs("div",{className:"toast-body",children:[s.jsx("span",{className:"toast-headline",children:e.headline||"Capture failed"}),o&&s.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),s.jsxs("div",{className:"toast-btns",children:[e.text&&s.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(u=>!u),children:r?"Hide":"View error"}),s.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})]})]}),r&&e.text&&s.jsx("pre",{className:"toast-error-detail",children:e.text})]})}const _s=f.createContext(null),yr=(()=>{const e=window.location.pathname.match(/^\/preview\/([^/]+)\/([^/]+)/);return e?{archiveId:e[1],entryUid:e[2]}:null})(),sg=["archive","tags","collections","runs","admin","settings"],ig=["profile","tokens","instance","cookies","extensions","storage"];function dn(){const e=window.location.pathname.split("/").filter(Boolean),t=sg.includes(e[0])?e[0]:"archive",n=t==="settings"&&ig.includes(e[1])?e[1]:"profile",r=new URLSearchParams(window.location.search),l=r.get("q")??"",i=t==="archive"?r.get("tag")??null:null,a=t==="archive"?r.get("entry")??null:null;return{view:t,settingsTab:n,q:l,tag:i,entry:a}}function ag(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function og(){const[e,t]=f.useState("loading"),[n,r]=f.useState(null);f.useEffect(()=>{(async()=>{if(await Rh()){t("setup");return}const O=await Oh();if(!O){t("login");return}r(O),t("authenticated")})()},[]),f.useEffect(()=>{const C=()=>{r(null),t("login")};return window.addEventListener("auth:expired",C),()=>window.removeEventListener("auth:expired",C)},[]),f.useEffect(()=>{const C=()=>{const{view:O,settingsTab:q,q:re,tag:De,entry:dt}=dn();g(O),_(q),E(re),p(De),h(dt),x(null),w(dt?new Set([dt]):new Set)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[]);const[l,i]=f.useState([]),[a,o]=f.useState(null),[u,c]=f.useState([]),[y,h]=f.useState(()=>dn().entry),[m,x]=f.useState(null),[v,w]=f.useState(()=>{const C=dn().entry;return C?new Set([C]):new Set}),[j,p]=f.useState(()=>dn().tag),[d,g]=f.useState(()=>dn().view),[k,_]=f.useState(()=>dn().settingsTab),[b,E]=f.useState(()=>dn().q),[N,I]=f.useState(""),[P,V]=f.useState(!1),[B,Q]=f.useState([]),[G,ue]=f.useState([]),[se,te]=f.useState(()=>sessionStorage.getItem("captureDialogOpen")==="true"),[R,T]=f.useState([]),M=f.useRef(0),[J,U]=f.useState(()=>{try{const C=JSON.parse(sessionStorage.getItem("pendingCaptures")||"[]");if(Array.isArray(C))return C}catch{}return[]});f.useEffect(()=>{sessionStorage.setItem("pendingCaptures",JSON.stringify(J))},[J]);const[ge,ce]=f.useState(()=>sessionStorage.getItem("ublockWarningIgnored")==="true"),[$e,we]=f.useState(null),Pe=f.useRef(0),rt=f.useRef(null),ct=f.useRef(!1),zt=f.useRef(!0),Je=f.useRef(null),Be=(n==null?void 0:n.humanize_slugs)??!1;f.useEffect(()=>{const C=++Pe.current;we(null),!(!m||!a)&&Ji(a,m.entry_uid).then(O=>{C===Pe.current&&we(O)}).catch(()=>{})},[m,a]),f.useEffect(()=>{sessionStorage.setItem("captureDialogOpen",se)},[se]);const z=f.useCallback(async(C,O,q)=>{if(C){V(!0);try{let re;O||q?re=await wh(C,O,q):re=await xh(C),c(re),w(De=>{if(De.size<2)return De;const dt=new Set(re.map(Tn=>Tn.entry_uid)),ar=new Set([...De].filter(Tn=>dt.has(Tn)));return ar.size===De.size?De:ar}),I(re.length===0?"No results":`${re.length} result${re.length===1?"":"s"}`)}catch{c([]),I("Search failed. Try again.")}finally{V(!1)}}},[]);f.useEffect(()=>{e==="authenticated"&&vh().then(C=>{if(i(C),C.length>0){const O=C[0].id;o(O)}})},[e]),f.useEffect(()=>{if(a){if(zt.current){zt.current=!1,Promise.all([ei(a).then(Q),Sl(a).then(ue)]);return}p(null),x(null),h(null),w(new Set),Promise.all([z(a,"",null),ei(a).then(Q),Sl(a).then(ue)])}},[a]),f.useEffect(()=>{if(a===null)return;const C=setTimeout(()=>{z(a,b,j)},300);return()=>clearTimeout(C)},[b,a]),f.useEffect(()=>{a!==null&&(j!==null&&g("archive"),z(a,b,j))},[j,a]);const Y=f.useCallback(C=>{o(C)},[]),Se=f.useCallback(C=>{g(C),C==="tags"&&a&&Sl(a).then(ue)},[a]);f.useEffect(()=>{if(yr)return;const C=ag(d,k);window.location.pathname!==C&&history.pushState(null,"",C+window.location.search)},[d,k]);const S=f.useCallback(C=>{h(C?C.entry_uid:null),x(C)},[]),H=f.useCallback((C,O)=>{if(O.shiftKey&&Je.current!==null){O.preventDefault();const q=u.findIndex(or=>or.entry_uid===Je.current),re=u.findIndex(or=>or.entry_uid===C.entry_uid);if(q===-1||re===-1){Je.current=C.entry_uid,w(new Set([C.entry_uid])),S(C);return}const De=Math.min(q,re),dt=Math.max(q,re),ar=u.slice(De,dt+1),Tn=new Set(ar.map(or=>or.entry_uid));w(Tn),Tn.size===1&&S(ar[0])}else O.ctrlKey||O.metaKey?(Je.current=C.entry_uid,w(q=>{const re=new Set(q);return re.has(C.entry_uid)?re.delete(C.entry_uid):re.add(C.entry_uid),re})):(Je.current=C.entry_uid,w(new Set([C.entry_uid])),S(C))},[u,S]),D=f.useCallback(C=>{p(C)},[]),F=f.useCallback(()=>{p(null)},[]),W=f.useCallback(()=>{a&&Sl(a).then(ue)},[a]),K=f.useCallback((C,O)=>{j===C?p(O):j!=null&&j.startsWith(C+"/")&&p(O+j.slice(C.length))},[j]),fe=f.useCallback(C=>{(j===C||j!=null&&j.startsWith(C+"/"))&&p(null)},[j]),Le=f.useCallback((C,O)=>{c(q=>q.map(re=>re.entry_uid===C?{...re,title:O}:re)),x(q=>q&&q.entry_uid===C?{...q,title:O}:q),we(q=>q&&q.summary.entry_uid===C?{...q,summary:{...q.summary,title:O}}:q)},[]),Ye=f.useCallback(()=>{if(!a||!m)return;const C=++Pe.current;Ji(a,m.entry_uid).then(O=>{C===Pe.current&&we(O)}).catch(()=>{})},[a,m]),He=f.useCallback(C=>{c(O=>O.filter(q=>q.entry_uid!==C)),x(O=>(O==null?void 0:O.entry_uid)===C?null:O),h(O=>O===C?null:O),w(O=>{const q=new Set(O);return q.delete(C),q})},[]),Ue=f.useCallback(C=>{c(O=>O.filter(q=>!C.has(q.entry_uid))),w(new Set),x(null),h(null)},[]);f.useEffect(()=>{if(v.size>=2)h(null),x(null);else if(v.size===1){const[C]=v;h(C)}else h(null),x(null)},[v]);const ye=f.useMemo(()=>u.filter(C=>v.has(C.entry_uid)),[u,v]);f.useEffect(()=>{if(!y||m)return;const C=u.find(O=>O.entry_uid===y);C&&x(C)},[u,y,m]),f.useEffect(()=>{if(yr)return;const C=new URLSearchParams;b&&C.set("q",b),d==="archive"&&j&&C.set("tag",j),d==="archive"&&y&&C.set("entry",y);const O=C.toString(),q=window.location.pathname+(O?"?"+O:"");window.location.pathname+window.location.search!==q&&history.replaceState(null,"",q)},[b,j,y,d]),f.useEffect(()=>{const C=O=>{var q,re;(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),d==="archive"?((q=rt.current)==null||q.focus(),(re=rt.current)==null||re.select()):(ct.current=!0,g("archive")))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[d]),f.useEffect(()=>{d==="archive"&&ct.current&&(ct.current=!1,requestAnimationFrame(()=>{var C,O;(C=rt.current)==null||C.focus(),(O=rt.current)==null||O.select()}))},[d]);const Rt=f.useCallback(()=>{te(!0)},[]),We=f.useCallback(()=>{te(!1)},[]),tl=f.useCallback(()=>{if(a)return Promise.allSettled([z(a,b,j),ei(a).then(Q)])},[a,b,j,z]),nl=f.useCallback((C,O,q="error",re=null)=>{if(q==="warning"&&ge&&O)return;const De=++M.current;T(dt=>[...dt,{id:De,text:C,locator:O,type:q,headline:re}])},[ge]),Cs=f.useCallback(C=>{T(O=>O.filter(q=>q.id!==C))},[]),Es=f.useCallback(()=>{sessionStorage.setItem("ublockWarningIgnored","true"),ce(!0),T(C=>C.filter(O=>!(O.type==="warning"&&O.locator)))},[]),rl=f.useCallback(C=>{U(O=>[...O,C])},[]),$=f.useCallback(C=>{U(O=>O.filter(q=>q.id!==C))},[]),[ne,Ve]=f.useState(null),[vt,En]=f.useState(null),ll=f.useCallback(()=>{m&&Ve(m.entry_uid)},[m]),Ne=f.useCallback(()=>Ve(null),[]),ir=f.useCallback((C,O)=>{En({src:C,entry:O})},[]),Wd=f.useCallback(()=>En(null),[]);return f.useEffect(()=>{Ve(null)},[m]),f.useEffect(()=>{const C=O=>{var re,De,dt;if(O.key!=="Escape"||se||ne)return;const q=(re=document.activeElement)==null?void 0:re.tagName;q==="INPUT"||q==="TEXTAREA"||q==="SELECT"||v.size>0&&(O.preventDefault(),w(new Set),(dt=(De=document.activeElement)==null?void 0:De.blur)==null||dt.call(De))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[se,ne,v]),f.useEffect(()=>(document.body.classList.toggle("has-audio-bar",!!vt),()=>document.body.classList.remove("has-audio-bar")),[vt]),e==="loading"?s.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?s.jsx(cm,{onComplete:()=>t("login")}):e==="login"?s.jsx(um,{onLogin:C=>{r(C),t("authenticated")}}):yr?s.jsx(eg,{archiveId:yr.archiveId,entryUid:yr.entryUid}):s.jsx(_s.Provider,{value:{currentUser:n,setCurrentUser:r},children:s.jsxs(s.Fragment,{children:[s.jsx(dm,{archives:l,archiveId:a,onArchiveChange:Y,view:d,onViewChange:Se,onCaptureClick:Rt}),s.jsxs("main",{className:"app-shell",children:[s.jsxs("div",{className:"workspace",children:[d==="archive"&&s.jsxs("div",{className:"toolbar",children:[s.jsxs("div",{className:"search-field",children:[s.jsx("span",{className:"ico","aria-hidden":"true",children:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"11",cy:"11",r:"7"}),s.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),s.jsx("input",{ref:rt,className:"search-input",type:"search","aria-label":"Search archive","aria-busy":P,placeholder:"Search titles, URLs, types, tags…",value:b,onChange:C=>E(C.target.value)}),s.jsx("span",{className:"kbd",children:"⌘K"})]}),s.jsxs("span",{className:"result-count",children:[N&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:N.split(" ")[0]})," ",N.split(" ").slice(1).join(" ")]}),j&&s.jsxs("button",{className:"tag-filter-badge",onClick:F,children:["× ",Be?Id(j):j]})]})]}),d==="archive"&&s.jsx(xm,{entries:u,selectedUids:v,onRowClick:H,archiveId:a,pendingCaptures:J}),d==="runs"&&s.jsx(jm,{runs:B}),d==="admin"&&s.jsx(Nm,{archives:l}),d==="tags"&&s.jsx(_m,{archiveId:a,tagNodes:G,tagFilter:j,onTagFilterSet:D,onViewChange:Se,onTagRenamed:K,onTagDeleted:fe,onTagsRefresh:W,humanizeTags:Be}),d==="collections"&&s.jsx(Em,{archiveId:a}),d==="settings"&&s.jsx(bm,{tab:k,onTabChange:_,archiveId:a})]}),s.jsx(Om,{archiveId:a,selectedEntry:m,selectedUids:v,selectedEntries:ye,detail:$e,onTagFilterSet:D,tagNodes:G,onTagsRefresh:W,onEntryTitleChange:Le,onEntryDeleted:He,onBulkDeleted:Ue,humanizeTags:Be,onDetailRefresh:Ye,onOpenPreview:ll,onPlay:ir})]}),ne&&m&&m.entry_uid===ne&&s.jsx(Gm,{archiveId:a,entry:m,detail:$e,onClose:Ne}),vt&&s.jsx(Zm,{entry:vt.entry,src:vt.src,archiveId:a,onClose:Wd}),s.jsx(pm,{open:se,archiveId:a,onClose:We,onCaptured:tl,onToast:nl,activeJobs:J,onJobStarted:rl,onJobSettled:$}),s.jsx(ng,{toasts:R,onDismiss:Cs,onIgnoreUblock:Es})]})})}bd(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(og,{})}));
|