1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-10-09 21:03:17 +02:00
archivr/crates/archivr-server/static/assets/index-D2569HEv.js

49 lines
308 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(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 Qu={exports:{}},Cs={},qu={exports:{}},le={};/**
* @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 ml=Symbol.for("react.element"),wf=Symbol.for("react.portal"),kf=Symbol.for("react.fragment"),jf=Symbol.for("react.strict_mode"),Sf=Symbol.for("react.profiler"),Nf=Symbol.for("react.provider"),_f=Symbol.for("react.context"),Cf=Symbol.for("react.forward_ref"),Ef=Symbol.for("react.suspense"),bf=Symbol.for("react.memo"),Tf=Symbol.for("react.lazy"),ko=Symbol.iterator;function Pf(e){return e===null||typeof e!="object"?null:(e=ko&&e[ko]||e["@@iterator"],typeof e=="function"?e:null)}var Ku={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xu=Object.assign,Ju={};function jr(e,t,n){this.props=e,this.context=t,this.refs=Ju,this.updater=n||Ku}jr.prototype.isReactComponent={};jr.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")};jr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gu(){}Gu.prototype=jr.prototype;function ja(e,t,n){this.props=e,this.context=t,this.refs=Ju,this.updater=n||Ku}var Sa=ja.prototype=new Gu;Sa.constructor=ja;Xu(Sa,jr.prototype);Sa.isPureReactComponent=!0;var jo=Array.isArray,Yu=Object.prototype.hasOwnProperty,Na={current:null},Zu={key:!0,ref:!0,__self:!0,__source:!0};function ec(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)Yu.call(t,r)&&!Zu.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),d=0;d<o;d++)u[d]=arguments[d+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:ml,type:e,key:i,ref:a,props:l,_owner:Na.current}}function Lf(e,t){return{$$typeof:ml,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function _a(e){return typeof e=="object"&&e!==null&&e.$$typeof===ml}function Rf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var So=/\/+/g;function Gs(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Rf(""+e.key):t.toString(36)}function Bl(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 ml:case wf:a=!0}}if(a)return a=e,l=l(a),e=r===""?"."+Gs(a,0):r,jo(l)?(n="",e!=null&&(n=e.replace(So,"$&/")+"/"),Bl(l,t,n,"",function(d){return d})):l!=null&&(_a(l)&&(l=Lf(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(So,"$&/")+"/")+e)),t.push(l)),1;if(a=0,r=r===""?".":r+":",jo(e))for(var o=0;o<e.length;o++){i=e[o];var u=r+Gs(i,o);a+=Bl(i,t,n,u,l)}else if(u=Pf(e),typeof u=="function")for(e=u.call(e),o=0;!(i=e.next()).done;)i=i.value,u=r+Gs(i,o++),a+=Bl(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 jl(e,t,n){if(e==null)return e;var r=[],l=0;return Bl(e,r,"","",function(i){return t.call(n,i,l++)}),r}function zf(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 st={current:null},Ul={transition:null},If={ReactCurrentDispatcher:st,ReactCurrentBatchConfig:Ul,ReactCurrentOwner:Na};function tc(){throw Error("act(...) is not supported in production builds of React.")}le.Children={map:jl,forEach:function(e,t,n){jl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return jl(e,function(){t++}),t},toArray:function(e){return jl(e,function(t){return t})||[]},only:function(e){if(!_a(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};le.Component=jr;le.Fragment=kf;le.Profiler=Sf;le.PureComponent=ja;le.StrictMode=jf;le.Suspense=Ef;le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=If;le.act=tc;le.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=Xu({},e.props),l=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Na.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)Yu.call(t,u)&&!Zu.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 d=0;d<u;d++)o[d]=arguments[d+2];r.children=o}return{$$typeof:ml,type:e.type,key:l,ref:i,props:r,_owner:a}};le.createContext=function(e){return e={$$typeof:_f,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Nf,_context:e},e.Consumer=e};le.createElement=ec;le.createFactory=function(e){var t=ec.bind(null,e);return t.type=e,t};le.createRef=function(){return{current:null}};le.forwardRef=function(e){return{$$typeof:Cf,render:e}};le.isValidElement=_a;le.lazy=function(e){return{$$typeof:Tf,_payload:{_status:-1,_result:e},_init:zf}};le.memo=function(e,t){return{$$typeof:bf,type:e,compare:t===void 0?null:t}};le.startTransition=function(e){var t=Ul.transition;Ul.transition={};try{e()}finally{Ul.transition=t}};le.unstable_act=tc;le.useCallback=function(e,t){return st.current.useCallback(e,t)};le.useContext=function(e){return st.current.useContext(e)};le.useDebugValue=function(){};le.useDeferredValue=function(e){return st.current.useDeferredValue(e)};le.useEffect=function(e,t){return st.current.useEffect(e,t)};le.useId=function(){return st.current.useId()};le.useImperativeHandle=function(e,t,n){return st.current.useImperativeHandle(e,t,n)};le.useInsertionEffect=function(e,t){return st.current.useInsertionEffect(e,t)};le.useLayoutEffect=function(e,t){return st.current.useLayoutEffect(e,t)};le.useMemo=function(e,t){return st.current.useMemo(e,t)};le.useReducer=function(e,t,n){return st.current.useReducer(e,t,n)};le.useRef=function(e){return st.current.useRef(e)};le.useState=function(e){return st.current.useState(e)};le.useSyncExternalStore=function(e,t,n){return st.current.useSyncExternalStore(e,t,n)};le.useTransition=function(){return st.current.useTransition()};le.version="18.3.1";qu.exports=le;var c=qu.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 $f=c,Df=Symbol.for("react.element"),Af=Symbol.for("react.fragment"),Of=Object.prototype.hasOwnProperty,Mf=$f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ff={key:!0,ref:!0,__self:!0,__source:!0};function nc(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)Of.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:Df,type:e,key:i,ref:a,props:l,_owner:Mf.current}}Cs.Fragment=Af;Cs.jsx=nc;Cs.jsxs=nc;Qu.exports=Cs;var s=Qu.exports,rc={exports:{}},vt={},lc={exports:{}},sc={};/**
* @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(A,L){var Q=A.length;A.push(L);e:for(;0<Q;){var V=Q-1>>>1,ee=A[V];if(0<l(ee,L))A[V]=L,A[Q]=ee,Q=V;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var L=A[0],Q=A.pop();if(Q!==L){A[0]=Q;e:for(var V=0,ee=A.length,Ie=ee>>>1;V<Ie;){var te=2*(V+1)-1,Ne=A[te],ue=te+1,be=A[ue];if(0>l(Ne,Q))ue<ee&&0>l(be,Ne)?(A[V]=be,A[ue]=Q,V=ue):(A[V]=Ne,A[te]=Q,V=te);else if(ue<ee&&0>l(be,Q))A[V]=be,A[ue]=Q,V=ue;else break e}}return L}function l(A,L){var Q=A.sortIndex-L.sortIndex;return Q!==0?Q:A.id-L.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=[],d=[],y=1,g=null,h=3,v=!1,x=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(A){for(var L=n(d);L!==null;){if(L.callback===null)r(d);else if(L.startTime<=A)r(d),L.sortIndex=L.expirationTime,t(u,L);else break;L=n(d)}}function k(A){if(S=!1,m(A),!x)if(n(u)!==null)x=!0,Fe(C);else{var L=n(d);L!==null&&we(k,L.startTime-A)}}function C(A,L){x=!1,S&&(S=!1,p(j),j=-1),v=!0;var Q=h;try{for(m(L),g=n(u);g!==null&&(!(g.expirationTime>L)||A&&!J());){var V=g.callback;if(typeof V=="function"){g.callback=null,h=g.priorityLevel;var ee=V(g.expirationTime<=L);L=e.unstable_now(),typeof ee=="function"?g.callback=ee:g===n(u)&&r(u),m(L)}else r(u);g=n(u)}if(g!==null)var Ie=!0;else{var te=n(d);te!==null&&we(k,te.startTime-L),Ie=!1}return Ie}finally{g=null,h=Q,v=!1}}var E=!1,T=null,j=-1,P=5,z=-1;function J(){return!(e.unstable_now()-z<P)}function H(){if(T!==null){var A=e.unstable_now();z=A;var L=!0;try{L=T(!0,A)}finally{L?Y():(E=!1,T=null)}}else E=!1}var Y;if(typeof f=="function")Y=function(){f(H)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,fe=ne.port2;ne.port1.onmessage=H,Y=function(){fe.postMessage(null)}}else Y=function(){N(H,0)};function Fe(A){T=A,E||(E=!0,Y())}function we(A,L){j=N(function(){A(e.unstable_now())},L)}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(A){A.callback=null},e.unstable_continueExecution=function(){x||v||(x=!0,Fe(C))},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(A){switch(h){case 1:case 2:case 3:var L=3;break;default:L=h}var Q=h;h=L;try{return A()}finally{h=Q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(A,L){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var Q=h;h=A;try{return L()}finally{h=Q}},e.unstable_scheduleCallback=function(A,L,Q){var V=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?V+Q:V):Q=V,A){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=Q+ee,A={id:y++,callback:L,priorityLevel:A,startTime:Q,expirationTime:ee,sortIndex:-1},Q>V?(A.sortIndex=Q,t(d,A),n(u)===null&&A===n(d)&&(S?(p(j),j=-1):S=!0,we(k,Q-V))):(A.sortIndex=ee,t(u,A),x||v||(x=!0,Fe(C))),A},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(A){var L=h;return function(){var Q=h;h=L;try{return A.apply(this,arguments)}finally{h=Q}}}})(sc);lc.exports=sc;var Bf=lc.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 Uf=c,yt=Bf;function I(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 ic=new Set,Jr={};function Hn(e,t){mr(e,t),mr(e+"Capture",t)}function mr(e,t){for(Jr[e]=t,e=0;e<t.length;e++)ic.add(t[e])}var en=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ti=Object.prototype.hasOwnProperty,Hf=/^[: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]*$/,No={},_o={};function Wf(e){return Ti.call(_o,e)?!0:Ti.call(No,e)?!1:Hf.test(e)?_o[e]=!0:(No[e]=!0,!1)}function Vf(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 Qf(e,t,n,r){if(t===null||typeof t>"u"||Vf(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 it(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 Xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Xe[e]=new it(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Xe[t]=new it(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Xe[e]=new it(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Xe[e]=new it(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){Xe[e]=new it(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Xe[e]=new it(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Xe[e]=new it(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Xe[e]=new it(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Xe[e]=new it(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ca=/[\-:]([a-z])/g;function Ea(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(Ca,Ea);Xe[t]=new it(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(Ca,Ea);Xe[t]=new it(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(Ca,Ea);Xe[t]=new it(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Xe[e]=new it(e,1,!1,e.toLowerCase(),null,!1,!1)});Xe.xlinkHref=new it("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Xe[e]=new it(e,1,!1,e.toLowerCase(),null,!0,!0)});function ba(e,t,n,r){var l=Xe.hasOwnProperty(t)?Xe[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Qf(t,n,l,r)&&(n=null),r||l===null?Wf(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 ln=Uf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Sl=Symbol.for("react.element"),Jn=Symbol.for("react.portal"),Gn=Symbol.for("react.fragment"),Ta=Symbol.for("react.strict_mode"),Pi=Symbol.for("react.profiler"),ac=Symbol.for("react.provider"),oc=Symbol.for("react.context"),Pa=Symbol.for("react.forward_ref"),Li=Symbol.for("react.suspense"),Ri=Symbol.for("react.suspense_list"),La=Symbol.for("react.memo"),un=Symbol.for("react.lazy"),uc=Symbol.for("react.offscreen"),Co=Symbol.iterator;function Cr(e){return e===null||typeof e!="object"?null:(e=Co&&e[Co]||e["@@iterator"],typeof e=="function"?e:null)}var Ee=Object.assign,Ys;function $r(e){if(Ys===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ys=t&&t[1]||""}return`
`+Ys+e}var Zs=!1;function ei(e,t){if(!e||Zs)return"";Zs=!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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var l=d.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{Zs=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$r(e):""}function qf(e){switch(e.tag){case 5:return $r(e.type);case 16:return $r("Lazy");case 13:return $r("Suspense");case 19:return $r("SuspenseList");case 0:case 2:case 15:return e=ei(e.type,!1),e;case 11:return e=ei(e.type.render,!1),e;case 1:return e=ei(e.type,!0),e;default:return""}}function zi(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 Gn:return"Fragment";case Jn:return"Portal";case Pi:return"Profiler";case Ta:return"StrictMode";case Li:return"Suspense";case Ri:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oc:return(e.displayName||"Context")+".Consumer";case ac:return(e._context.displayName||"Context")+".Provider";case Pa:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case La:return t=e.displayName||null,t!==null?t:zi(e.type)||"Memo";case un:t=e._payload,e=e._init;try{return zi(e(t))}catch{}}return null}function Kf(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 zi(t);case 8:return t===Ta?"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 cc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xf(e){var t=cc(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 Nl(e){e._valueTracker||(e._valueTracker=Xf(e))}function dc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=cc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ts(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 Ii(e,t){var n=t.checked;return Ee({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Eo(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 fc(e,t){t=t.checked,t!=null&&ba(e,"checked",t,!1)}function $i(e,t){fc(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 bo(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"||ts(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dr=Array.isArray;function or(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 Ai(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(I(91));return Ee({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function To(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(I(92));if(Dr(n)){if(1<n.length)throw Error(I(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Sn(n)}}function pc(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 Po(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function hc(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 Oi(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?hc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var _l,mc=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(_l=_l||document.createElement("div"),_l.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=_l.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Gr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Br={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(Br).forEach(function(e){Jf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Br[t]=Br[e]})});function gc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Br.hasOwnProperty(e)&&Br[e]?(""+t).trim():t+"px"}function yc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=gc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Gf=Ee({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 Mi(e,t){if(t){if(Gf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62))}}function Fi(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 Bi=null;function Ra(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,ur=null,cr=null;function Lo(e){if(e=vl(e)){if(typeof Ui!="function")throw Error(I(280));var t=e.stateNode;t&&(t=Ls(t),Ui(e.stateNode,e.type,t))}}function vc(e){ur?cr?cr.push(e):cr=[e]:ur=e}function xc(){if(ur){var e=ur,t=cr;if(cr=ur=null,Lo(e),t)for(e=0;e<t.length;e++)Lo(t[e])}}function wc(e,t){return e(t)}function kc(){}var ti=!1;function jc(e,t,n){if(ti)return e(t,n);ti=!0;try{return wc(e,t,n)}finally{ti=!1,(ur!==null||cr!==null)&&(kc(),xc())}}function Yr(e,t){var n=e.stateNode;if(n===null)return null;var r=Ls(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(I(231,t,typeof n));return n}var Hi=!1;if(en)try{var Er={};Object.defineProperty(Er,"passive",{get:function(){Hi=!0}}),window.addEventListener("test",Er,Er),window.removeEventListener("test",Er,Er)}catch{Hi=!1}function Yf(e,t,n,r,l,i,a,o,u){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(y){this.onError(y)}}var Ur=!1,ns=null,rs=!1,Wi=null,Zf={onError:function(e){Ur=!0,ns=e}};function ep(e,t,n,r,l,i,a,o,u){Ur=!1,ns=null,Yf.apply(Zf,arguments)}function tp(e,t,n,r,l,i,a,o,u){if(ep.apply(this,arguments),Ur){if(Ur){var d=ns;Ur=!1,ns=null}else throw Error(I(198));rs||(rs=!0,Wi=d)}}function Wn(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 Sc(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 Ro(e){if(Wn(e)!==e)throw Error(I(188))}function np(e){var t=e.alternate;if(!t){if(t=Wn(e),t===null)throw Error(I(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 Ro(l),e;if(i===r)return Ro(l),t;i=i.sibling}throw Error(I(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(I(189))}}if(n.alternate!==r)throw Error(I(190))}if(n.tag!==3)throw Error(I(188));return n.stateNode.current===n?e:t}function Nc(e){return e=np(e),e!==null?_c(e):null}function _c(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=_c(e);if(t!==null)return t;e=e.sibling}return null}var Cc=yt.unstable_scheduleCallback,zo=yt.unstable_cancelCallback,rp=yt.unstable_shouldYield,lp=yt.unstable_requestPaint,Le=yt.unstable_now,sp=yt.unstable_getCurrentPriorityLevel,za=yt.unstable_ImmediatePriority,Ec=yt.unstable_UserBlockingPriority,ls=yt.unstable_NormalPriority,ip=yt.unstable_LowPriority,bc=yt.unstable_IdlePriority,Es=null,Qt=null;function ap(e){if(Qt&&typeof Qt.onCommitFiberRoot=="function")try{Qt.onCommitFiberRoot(Es,e,void 0,(e.current.flags&128)===128)}catch{}}var Dt=Math.clz32?Math.clz32:cp,op=Math.log,up=Math.LN2;function cp(e){return e>>>=0,e===0?32:31-(op(e)/up|0)|0}var Cl=64,El=4194304;function Ar(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 ss(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=Ar(o):(i&=a,i!==0&&(r=Ar(i)))}else a=n&~l,a!==0?r=Ar(a):i!==0&&(r=Ar(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-Dt(t),l=1<<n,r|=e[n],t&=~l;return r}function dp(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 fp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Dt(i),o=1<<a,u=l[a];u===-1?(!(o&n)||o&r)&&(l[a]=dp(o,t)):u<=t&&(e.expiredLanes|=o),i&=~o}}function Vi(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Tc(){var e=Cl;return Cl<<=1,!(Cl&4194240)&&(Cl=64),e}function ni(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function gl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Dt(t),e[t]=n}function pp(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-Dt(n),i=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~i}}function Ia(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Dt(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var de=0;function Pc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Lc,$a,Rc,zc,Ic,Qi=!1,bl=[],mn=null,gn=null,yn=null,Zr=new Map,el=new Map,dn=[],hp="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 Io(e,t){switch(e){case"focusin":case"focusout":mn=null;break;case"dragenter":case"dragleave":gn=null;break;case"mouseover":case"mouseout":yn=null;break;case"pointerover":case"pointerout":Zr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":el.delete(t.pointerId)}}function br(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=vl(t),t!==null&&$a(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function mp(e,t,n,r,l){switch(t){case"focusin":return mn=br(mn,e,t,n,r,l),!0;case"dragenter":return gn=br(gn,e,t,n,r,l),!0;case"mouseover":return yn=br(yn,e,t,n,r,l),!0;case"pointerover":var i=l.pointerId;return Zr.set(i,br(Zr.get(i)||null,e,t,n,r,l)),!0;case"gotpointercapture":return i=l.pointerId,el.set(i,br(el.get(i)||null,e,t,n,r,l)),!0}return!1}function $c(e){var t=Rn(e.target);if(t!==null){var n=Wn(t);if(n!==null){if(t=n.tag,t===13){if(t=Sc(n),t!==null){e.blockedOn=t,Ic(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 Hl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=qi(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Bi=r,n.target.dispatchEvent(r),Bi=null}else return t=vl(n),t!==null&&$a(t),e.blockedOn=n,!1;t.shift()}return!0}function $o(e,t,n){Hl(e)&&n.delete(t)}function gp(){Qi=!1,mn!==null&&Hl(mn)&&(mn=null),gn!==null&&Hl(gn)&&(gn=null),yn!==null&&Hl(yn)&&(yn=null),Zr.forEach($o),el.forEach($o)}function Tr(e,t){e.blockedOn===t&&(e.blockedOn=null,Qi||(Qi=!0,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,gp)))}function tl(e){function t(l){return Tr(l,e)}if(0<bl.length){Tr(bl[0],e);for(var n=1;n<bl.length;n++){var r=bl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(mn!==null&&Tr(mn,e),gn!==null&&Tr(gn,e),yn!==null&&Tr(yn,e),Zr.forEach(t),el.forEach(t),n=0;n<dn.length;n++)r=dn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<dn.length&&(n=dn[0],n.blockedOn===null);)$c(n),n.blockedOn===null&&dn.shift()}var dr=ln.ReactCurrentBatchConfig,is=!0;function yp(e,t,n,r){var l=de,i=dr.transition;dr.transition=null;try{de=1,Da(e,t,n,r)}finally{de=l,dr.transition=i}}function vp(e,t,n,r){var l=de,i=dr.transition;dr.transition=null;try{de=4,Da(e,t,n,r)}finally{de=l,dr.transition=i}}function Da(e,t,n,r){if(is){var l=qi(e,t,n,r);if(l===null)fi(e,t,r,as,n),Io(e,r);else if(mp(l,e,t,n,r))r.stopPropagation();else if(Io(e,r),t&4&&-1<hp.indexOf(e)){for(;l!==null;){var i=vl(l);if(i!==null&&Lc(i),i=qi(e,t,n,r),i===null&&fi(e,t,r,as,n),i===l)break;l=i}l!==null&&r.stopPropagation()}else fi(e,t,r,null,n)}}var as=null;function qi(e,t,n,r){if(as=null,e=Ra(r),e=Rn(e),e!==null)if(t=Wn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Sc(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 as=e,null}function Dc(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(sp()){case za:return 1;case Ec:return 4;case ls:case ip:return 16;case bc:return 536870912;default:return 16}default:return 16}}var pn=null,Aa=null,Wl=null;function Ac(){if(Wl)return Wl;var e,t=Aa,n=t.length,r,l="value"in pn?pn.value:pn.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 Wl=l.slice(e,1<r?1-r:void 0)}function Vl(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 Tl(){return!0}function Do(){return!1}function xt(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)?Tl:Do,this.isPropagationStopped=Do,this}return Ee(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=Tl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Tl)},persist:function(){},isPersistent:Tl}),t}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Oa=xt(Sr),yl=Ee({},Sr,{view:0,detail:0}),xp=xt(yl),ri,li,Pr,bs=Ee({},yl,{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"?(ri=e.screenX-Pr.screenX,li=e.screenY-Pr.screenY):li=ri=0,Pr=e),ri)},movementY:function(e){return"movementY"in e?e.movementY:li}}),Ao=xt(bs),wp=Ee({},bs,{dataTransfer:0}),kp=xt(wp),jp=Ee({},yl,{relatedTarget:0}),si=xt(jp),Sp=Ee({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),Np=xt(Sp),_p=Ee({},Sr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Cp=xt(_p),Ep=Ee({},Sr,{data:0}),Oo=xt(Ep),bp={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"},Pp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pp[e])?!!t[e]:!1}function Ma(){return Lp}var Rp=Ee({},yl,{key:function(e){if(e.key){var t=bp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vl(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"?Vl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zp=xt(Rp),Ip=Ee({},bs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mo=xt(Ip),$p=Ee({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ma}),Dp=xt($p),Ap=Ee({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Op=xt(Ap),Mp=Ee({},bs,{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=xt(Mp),Bp=[9,13,27,32],Fa=en&&"CompositionEvent"in window,Hr=null;en&&"documentMode"in document&&(Hr=document.documentMode);var Up=en&&"TextEvent"in window&&!Hr,Oc=en&&(!Fa||Hr&&8<Hr&&11>=Hr),Fo=" ",Bo=!1;function Mc(e,t){switch(e){case"keyup":return Bp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yn=!1;function Hp(e,t){switch(e){case"compositionend":return Fc(t);case"keypress":return t.which!==32?null:(Bo=!0,Fo);case"textInput":return e=t.data,e===Fo&&Bo?null:e;default:return null}}function Wp(e,t){if(Yn)return e==="compositionend"||!Fa&&Mc(e,t)?(e=Ac(),Wl=Aa=pn=null,Yn=!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 Oc&&t.locale!=="ko"?null:t.data;default:return null}}var Vp={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 Uo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Vp[e.type]:t==="textarea"}function Bc(e,t,n,r){vc(r),t=os(t,"onChange"),0<t.length&&(n=new Oa("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Wr=null,nl=null;function Qp(e){Yc(e,0)}function Ts(e){var t=tr(e);if(dc(t))return e}function qp(e,t){if(e==="change")return t}var Uc=!1;if(en){var ii;if(en){var ai="oninput"in document;if(!ai){var Ho=document.createElement("div");Ho.setAttribute("oninput","return;"),ai=typeof Ho.oninput=="function"}ii=ai}else ii=!1;Uc=ii&&(!document.documentMode||9<document.documentMode)}function Wo(){Wr&&(Wr.detachEvent("onpropertychange",Hc),nl=Wr=null)}function Hc(e){if(e.propertyName==="value"&&Ts(nl)){var t=[];Bc(t,nl,e,Ra(e)),jc(Qp,t)}}function Kp(e,t,n){e==="focusin"?(Wo(),Wr=t,nl=n,Wr.attachEvent("onpropertychange",Hc)):e==="focusout"&&Wo()}function Xp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ts(nl)}function Jp(e,t){if(e==="click")return Ts(t)}function Gp(e,t){if(e==="input"||e==="change")return Ts(t)}function Yp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ot=typeof Object.is=="function"?Object.is:Yp;function rl(e,t){if(Ot(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(!Ti.call(t,l)||!Ot(e[l],t[l]))return!1}return!0}function Vo(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qo(e,t){var n=Vo(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=Vo(n)}}function Wc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vc(){for(var e=window,t=ts();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ts(e.document)}return t}function Ba(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 Zp(e){var t=Vc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wc(n.ownerDocument.documentElement,n)){if(r!==null&&Ba(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=Qo(n,i);var a=Qo(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 eh=en&&"documentMode"in document&&11>=document.documentMode,Zn=null,Ki=null,Vr=null,Xi=!1;function qo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xi||Zn==null||Zn!==ts(r)||(r=Zn,"selectionStart"in r&&Ba(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}),Vr&&rl(Vr,r)||(Vr=r,r=os(Ki,"onSelect"),0<r.length&&(t=new Oa("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Zn)))}function Pl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var er={animationend:Pl("Animation","AnimationEnd"),animationiteration:Pl("Animation","AnimationIteration"),animationstart:Pl("Animation","AnimationStart"),transitionend:Pl("Transition","TransitionEnd")},oi={},Qc={};en&&(Qc=document.createElement("div").style,"AnimationEvent"in window||(delete er.animationend.animation,delete er.animationiteration.animation,delete er.animationstart.animation),"TransitionEvent"in window||delete er.transitionend.transition);function Ps(e){if(oi[e])return oi[e];if(!er[e])return e;var t=er[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Qc)return oi[e]=t[n];return e}var qc=Ps("animationend"),Kc=Ps("animationiteration"),Xc=Ps("animationstart"),Jc=Ps("transitionend"),Gc=new Map,Ko="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 _n(e,t){Gc.set(e,t),Hn(t,[e])}for(var ui=0;ui<Ko.length;ui++){var ci=Ko[ui],th=ci.toLowerCase(),nh=ci[0].toUpperCase()+ci.slice(1);_n(th,"on"+nh)}_n(qc,"onAnimationEnd");_n(Kc,"onAnimationIteration");_n(Xc,"onAnimationStart");_n("dblclick","onDoubleClick");_n("focusin","onFocus");_n("focusout","onBlur");_n(Jc,"onTransitionEnd");mr("onMouseEnter",["mouseout","mouseover"]);mr("onMouseLeave",["mouseout","mouseover"]);mr("onPointerEnter",["pointerout","pointerover"]);mr("onPointerLeave",["pointerout","pointerover"]);Hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Hn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Or="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(" "),rh=new Set("cancel close invalid load scroll toggle".split(" ").concat(Or));function Xo(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,tp(r,t,void 0,e),e.currentTarget=null}function Yc(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,d=o.currentTarget;if(o=o.listener,u!==i&&l.isPropagationStopped())break e;Xo(l,o,d),i=u}else for(a=0;a<r.length;a++){if(o=r[a],u=o.instance,d=o.currentTarget,o=o.listener,u!==i&&l.isPropagationStopped())break e;Xo(l,o,d),i=u}}}if(rs)throw e=Wi,rs=!1,Wi=null,e}function ve(e,t){var n=t[ea];n===void 0&&(n=t[ea]=new Set);var r=e+"__bubble";n.has(r)||(Zc(t,e,2,!1),n.add(r))}function di(e,t,n){var r=0;t&&(r|=4),Zc(n,e,r,t)}var Ll="_reactListening"+Math.random().toString(36).slice(2);function ll(e){if(!e[Ll]){e[Ll]=!0,ic.forEach(function(n){n!=="selectionchange"&&(rh.has(n)||di(n,!1,e),di(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ll]||(t[Ll]=!0,di("selectionchange",!1,t))}}function Zc(e,t,n,r){switch(Dc(t)){case 1:var l=yp;break;case 4:l=vp;break;default:l=Da}n=l.bind(null,t,n,e),l=void 0,!Hi||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 fi(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=Rn(o),a===null)return;if(u=a.tag,u===5||u===6){r=i=a;continue e}o=o.parentNode}}r=r.return}jc(function(){var d=i,y=Ra(n),g=[];e:{var h=Gc.get(e);if(h!==void 0){var v=Oa,x=e;switch(e){case"keypress":if(Vl(n)===0)break e;case"keydown":case"keyup":v=zp;break;case"focusin":x="focus",v=si;break;case"focusout":x="blur",v=si;break;case"beforeblur":case"afterblur":v=si;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":v=Ao;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=kp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=Dp;break;case qc:case Kc:case Xc:v=Np;break;case Jc:v=Op;break;case"scroll":v=xp;break;case"wheel":v=Fp;break;case"copy":case"cut":case"paste":v=Cp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=Mo}var S=(t&4)!==0,N=!S&&e==="scroll",p=S?h!==null?h+"Capture":null:h;S=[];for(var f=d,m;f!==null;){m=f;var k=m.stateNode;if(m.tag===5&&k!==null&&(m=k,p!==null&&(k=Yr(f,p),k!=null&&S.push(sl(f,k,m)))),N)break;f=f.return}0<S.length&&(h=new v(h,x,null,n,y),g.push({event:h,listeners:S}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",v=e==="mouseout"||e==="pointerout",h&&n!==Bi&&(x=n.relatedTarget||n.fromElement)&&(Rn(x)||x[tn]))break e;if((v||h)&&(h=y.window===y?y:(h=y.ownerDocument)?h.defaultView||h.parentWindow:window,v?(x=n.relatedTarget||n.toElement,v=d,x=x?Rn(x):null,x!==null&&(N=Wn(x),x!==N||x.tag!==5&&x.tag!==6)&&(x=null)):(v=null,x=d),v!==x)){if(S=Ao,k="onMouseLeave",p="onMouseEnter",f="mouse",(e==="pointerout"||e==="pointerover")&&(S=Mo,k="onPointerLeave",p="onPointerEnter",f="pointer"),N=v==null?h:tr(v),m=x==null?h:tr(x),h=new S(k,f+"leave",v,n,y),h.target=N,h.relatedTarget=m,k=null,Rn(y)===d&&(S=new S(p,f+"enter",x,n,y),S.target=m,S.relatedTarget=N,k=S),N=k,v&&x)t:{for(S=v,p=x,f=0,m=S;m;m=Kn(m))f++;for(m=0,k=p;k;k=Kn(k))m++;for(;0<f-m;)S=Kn(S),f--;for(;0<m-f;)p=Kn(p),m--;for(;f--;){if(S===p||p!==null&&S===p.alternate)break t;S=Kn(S),p=Kn(p)}S=null}else S=null;v!==null&&Jo(g,h,v,S,!1),x!==null&&N!==null&&Jo(g,N,x,S,!0)}}e:{if(h=d?tr(d):window,v=h.nodeName&&h.nodeName.toLowerCase(),v==="select"||v==="input"&&h.type==="file")var C=qp;else if(Uo(h))if(Uc)C=Gp;else{C=Xp;var E=Kp}else(v=h.nodeName)&&v.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(C=Jp);if(C&&(C=C(e,d))){Bc(g,C,n,y);break e}E&&E(e,h,d),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&Di(h,"number",h.value)}switch(E=d?tr(d):window,e){case"focusin":(Uo(E)||E.contentEditable==="true")&&(Zn=E,Ki=d,Vr=null);break;case"focusout":Vr=Ki=Zn=null;break;case"mousedown":Xi=!0;break;case"contextmenu":case"mouseup":case"dragend":Xi=!1,qo(g,n,y);break;case"selectionchange":if(eh)break;case"keydown":case"keyup":qo(g,n,y)}var T;if(Fa)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else Yn?Mc(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(Oc&&n.locale!=="ko"&&(Yn||j!=="onCompositionStart"?j==="onCompositionEnd"&&Yn&&(T=Ac()):(pn=y,Aa="value"in pn?pn.value:pn.textContent,Yn=!0)),E=os(d,j),0<E.length&&(j=new Oo(j,e,null,n,y),g.push({event:j,listeners:E}),T?j.data=T:(T=Fc(n),T!==null&&(j.data=T)))),(T=Up?Hp(e,n):Wp(e,n))&&(d=os(d,"onBeforeInput"),0<d.length&&(y=new Oo("onBeforeInput","beforeinput",null,n,y),g.push({event:y,listeners:d}),y.data=T))}Yc(g,t)})}function sl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function os(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,i=l.stateNode;l.tag===5&&i!==null&&(l=i,i=Yr(e,n),i!=null&&r.unshift(sl(e,i,l)),i=Yr(e,t),i!=null&&r.push(sl(e,i,l))),e=e.return}return r}function Kn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Jo(e,t,n,r,l){for(var i=t._reactName,a=[];n!==null&&n!==r;){var o=n,u=o.alternate,d=o.stateNode;if(u!==null&&u===r)break;o.tag===5&&d!==null&&(o=d,l?(u=Yr(n,i),u!=null&&a.unshift(sl(n,u,o))):l||(u=Yr(n,i),u!=null&&a.push(sl(n,u,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var lh=/\r\n?/g,sh=/\u0000|\uFFFD/g;function Go(e){return(typeof e=="string"?e:""+e).replace(lh,`
`).replace(sh,"")}function Rl(e,t,n){if(t=Go(t),Go(e)!==t&&n)throw Error(I(425))}function us(){}var Ji=null,Gi=null;function Yi(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 Zi=typeof setTimeout=="function"?setTimeout:void 0,ih=typeof clearTimeout=="function"?clearTimeout:void 0,Yo=typeof Promise=="function"?Promise:void 0,ah=typeof queueMicrotask=="function"?queueMicrotask:typeof Yo<"u"?function(e){return Yo.resolve(null).then(e).catch(oh)}:Zi;function oh(e){setTimeout(function(){throw e})}function pi(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),tl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);tl(t)}function vn(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 Zo(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 Nr=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Nr,il="__reactProps$"+Nr,tn="__reactContainer$"+Nr,ea="__reactEvents$"+Nr,uh="__reactListeners$"+Nr,ch="__reactHandles$"+Nr;function Rn(e){var t=e[Vt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[tn]||n[Vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Zo(e);e!==null;){if(n=e[Vt])return n;e=Zo(e)}return t}e=n,n=e.parentNode}return null}function vl(e){return e=e[Vt]||e[tn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function tr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(I(33))}function Ls(e){return e[il]||null}var ta=[],nr=-1;function Cn(e){return{current:e}}function xe(e){0>nr||(e.current=ta[nr],ta[nr]=null,nr--)}function me(e,t){nr++,ta[nr]=e.current,e.current=t}var Nn={},tt=Cn(Nn),ut=Cn(!1),On=Nn;function gr(e,t){var n=e.type.contextTypes;if(!n)return Nn;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 ct(e){return e=e.childContextTypes,e!=null}function cs(){xe(ut),xe(tt)}function eu(e,t,n){if(tt.current!==Nn)throw Error(I(168));me(tt,t),me(ut,n)}function ed(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(I(108,Kf(e)||"Unknown",l));return Ee({},n,r)}function ds(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Nn,On=tt.current,me(tt,e),me(ut,ut.current),!0}function tu(e,t,n){var r=e.stateNode;if(!r)throw Error(I(169));n?(e=ed(e,t,On),r.__reactInternalMemoizedMergedChildContext=e,xe(ut),xe(tt),me(tt,e)):xe(ut),me(ut,n)}var Jt=null,Rs=!1,hi=!1;function td(e){Jt===null?Jt=[e]:Jt.push(e)}function dh(e){Rs=!0,td(e)}function En(){if(!hi&&Jt!==null){hi=!0;var e=0,t=de;try{var n=Jt;for(de=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Jt=null,Rs=!1}catch(l){throw Jt!==null&&(Jt=Jt.slice(e+1)),Cc(za,En),l}finally{de=t,hi=!1}}return null}var rr=[],lr=0,fs=null,ps=0,jt=[],St=0,Mn=null,Gt=1,Yt="";function Pn(e,t){rr[lr++]=ps,rr[lr++]=fs,fs=e,ps=t}function nd(e,t,n){jt[St++]=Gt,jt[St++]=Yt,jt[St++]=Mn,Mn=e;var r=Gt;e=Yt;var l=32-Dt(r)-1;r&=~(1<<l),n+=1;var i=32-Dt(t)+l;if(30<i){var a=l-l%5;i=(r&(1<<a)-1).toString(32),r>>=a,l-=a,Gt=1<<32-Dt(t)+l|n<<l|r,Yt=i+e}else Gt=1<<i|n<<l|r,Yt=e}function Ua(e){e.return!==null&&(Pn(e,1),nd(e,1,0))}function Ha(e){for(;e===fs;)fs=rr[--lr],rr[lr]=null,ps=rr[--lr],rr[lr]=null;for(;e===Mn;)Mn=jt[--St],jt[St]=null,Yt=jt[--St],jt[St]=null,Gt=jt[--St],jt[St]=null}var gt=null,mt=null,Se=!1,$t=null;function rd(e,t){var n=Nt(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 nu(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,gt=e,mt=vn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,gt=e,mt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Mn!==null?{id:Gt,overflow:Yt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Nt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,gt=e,mt=null,!0):!1;default:return!1}}function na(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ra(e){if(Se){var t=mt;if(t){var n=t;if(!nu(e,t)){if(na(e))throw Error(I(418));t=vn(n.nextSibling);var r=gt;t&&nu(e,t)?rd(r,n):(e.flags=e.flags&-4097|2,Se=!1,gt=e)}}else{if(na(e))throw Error(I(418));e.flags=e.flags&-4097|2,Se=!1,gt=e}}}function ru(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;gt=e}function zl(e){if(e!==gt)return!1;if(!Se)return ru(e),Se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Yi(e.type,e.memoizedProps)),t&&(t=mt)){if(na(e))throw ld(),Error(I(418));for(;t;)rd(e,t),t=vn(t.nextSibling)}if(ru(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(I(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){mt=vn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}mt=null}}else mt=gt?vn(e.stateNode.nextSibling):null;return!0}function ld(){for(var e=mt;e;)e=vn(e.nextSibling)}function yr(){mt=gt=null,Se=!1}function Wa(e){$t===null?$t=[e]:$t.push(e)}var fh=ln.ReactCurrentBatchConfig;function Lr(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(I(309));var r=n.stateNode}if(!r)throw Error(I(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(I(284));if(!n._owner)throw Error(I(290,e))}return e}function Il(e,t){throw e=Object.prototype.toString.call(t),Error(I(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lu(e){var t=e._init;return t(e._payload)}function sd(e){function t(p,f){if(e){var m=p.deletions;m===null?(p.deletions=[f],p.flags|=16):m.push(f)}}function n(p,f){if(!e)return null;for(;f!==null;)t(p,f),f=f.sibling;return null}function r(p,f){for(p=new Map;f!==null;)f.key!==null?p.set(f.key,f):p.set(f.index,f),f=f.sibling;return p}function l(p,f){return p=jn(p,f),p.index=0,p.sibling=null,p}function i(p,f,m){return p.index=m,e?(m=p.alternate,m!==null?(m=m.index,m<f?(p.flags|=2,f):m):(p.flags|=2,f)):(p.flags|=1048576,f)}function a(p){return e&&p.alternate===null&&(p.flags|=2),p}function o(p,f,m,k){return f===null||f.tag!==6?(f=ki(m,p.mode,k),f.return=p,f):(f=l(f,m),f.return=p,f)}function u(p,f,m,k){var C=m.type;return C===Gn?y(p,f,m.props.children,k,m.key):f!==null&&(f.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===un&&lu(C)===f.type)?(k=l(f,m.props),k.ref=Lr(p,f,m),k.return=p,k):(k=Yl(m.type,m.key,m.props,null,p.mode,k),k.ref=Lr(p,f,m),k.return=p,k)}function d(p,f,m,k){return f===null||f.tag!==4||f.stateNode.containerInfo!==m.containerInfo||f.stateNode.implementation!==m.implementation?(f=ji(m,p.mode,k),f.return=p,f):(f=l(f,m.children||[]),f.return=p,f)}function y(p,f,m,k,C){return f===null||f.tag!==7?(f=An(m,p.mode,k,C),f.return=p,f):(f=l(f,m),f.return=p,f)}function g(p,f,m){if(typeof f=="string"&&f!==""||typeof f=="number")return f=ki(""+f,p.mode,m),f.return=p,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Sl:return m=Yl(f.type,f.key,f.props,null,p.mode,m),m.ref=Lr(p,null,f),m.return=p,m;case Jn:return f=ji(f,p.mode,m),f.return=p,f;case un:var k=f._init;return g(p,k(f._payload),m)}if(Dr(f)||Cr(f))return f=An(f,p.mode,m,null),f.return=p,f;Il(p,f)}return null}function h(p,f,m,k){var C=f!==null?f.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return C!==null?null:o(p,f,""+m,k);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Sl:return m.key===C?u(p,f,m,k):null;case Jn:return m.key===C?d(p,f,m,k):null;case un:return C=m._init,h(p,f,C(m._payload),k)}if(Dr(m)||Cr(m))return C!==null?null:y(p,f,m,k,null);Il(p,m)}return null}function v(p,f,m,k,C){if(typeof k=="string"&&k!==""||typeof k=="number")return p=p.get(m)||null,o(f,p,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Sl:return p=p.get(k.key===null?m:k.key)||null,u(f,p,k,C);case Jn:return p=p.get(k.key===null?m:k.key)||null,d(f,p,k,C);case un:var E=k._init;return v(p,f,m,E(k._payload),C)}if(Dr(k)||Cr(k))return p=p.get(m)||null,y(f,p,k,C,null);Il(f,k)}return null}function x(p,f,m,k){for(var C=null,E=null,T=f,j=f=0,P=null;T!==null&&j<m.length;j++){T.index>j?(P=T,T=null):P=T.sibling;var z=h(p,T,m[j],k);if(z===null){T===null&&(T=P);break}e&&T&&z.alternate===null&&t(p,T),f=i(z,f,j),E===null?C=z:E.sibling=z,E=z,T=P}if(j===m.length)return n(p,T),Se&&Pn(p,j),C;if(T===null){for(;j<m.length;j++)T=g(p,m[j],k),T!==null&&(f=i(T,f,j),E===null?C=T:E.sibling=T,E=T);return Se&&Pn(p,j),C}for(T=r(p,T);j<m.length;j++)P=v(T,p,j,m[j],k),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?j:P.key),f=i(P,f,j),E===null?C=P:E.sibling=P,E=P);return e&&T.forEach(function(J){return t(p,J)}),Se&&Pn(p,j),C}function S(p,f,m,k){var C=Cr(m);if(typeof C!="function")throw Error(I(150));if(m=C.call(m),m==null)throw Error(I(151));for(var E=C=null,T=f,j=f=0,P=null,z=m.next();T!==null&&!z.done;j++,z=m.next()){T.index>j?(P=T,T=null):P=T.sibling;var J=h(p,T,z.value,k);if(J===null){T===null&&(T=P);break}e&&T&&J.alternate===null&&t(p,T),f=i(J,f,j),E===null?C=J:E.sibling=J,E=J,T=P}if(z.done)return n(p,T),Se&&Pn(p,j),C;if(T===null){for(;!z.done;j++,z=m.next())z=g(p,z.value,k),z!==null&&(f=i(z,f,j),E===null?C=z:E.sibling=z,E=z);return Se&&Pn(p,j),C}for(T=r(p,T);!z.done;j++,z=m.next())z=v(T,p,j,z.value,k),z!==null&&(e&&z.alternate!==null&&T.delete(z.key===null?j:z.key),f=i(z,f,j),E===null?C=z:E.sibling=z,E=z);return e&&T.forEach(function(H){return t(p,H)}),Se&&Pn(p,j),C}function N(p,f,m,k){if(typeof m=="object"&&m!==null&&m.type===Gn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Sl:e:{for(var C=m.key,E=f;E!==null;){if(E.key===C){if(C=m.type,C===Gn){if(E.tag===7){n(p,E.sibling),f=l(E,m.props.children),f.return=p,p=f;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===un&&lu(C)===E.type){n(p,E.sibling),f=l(E,m.props),f.ref=Lr(p,E,m),f.return=p,p=f;break e}n(p,E);break}else t(p,E);E=E.sibling}m.type===Gn?(f=An(m.props.children,p.mode,k,m.key),f.return=p,p=f):(k=Yl(m.type,m.key,m.props,null,p.mode,k),k.ref=Lr(p,f,m),k.return=p,p=k)}return a(p);case Jn:e:{for(E=m.key;f!==null;){if(f.key===E)if(f.tag===4&&f.stateNode.containerInfo===m.containerInfo&&f.stateNode.implementation===m.implementation){n(p,f.sibling),f=l(f,m.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=ji(m,p.mode,k),f.return=p,p=f}return a(p);case un:return E=m._init,N(p,f,E(m._payload),k)}if(Dr(m))return x(p,f,m,k);if(Cr(m))return S(p,f,m,k);Il(p,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,f!==null&&f.tag===6?(n(p,f.sibling),f=l(f,m),f.return=p,p=f):(n(p,f),f=ki(m,p.mode,k),f.return=p,p=f),a(p)):n(p,f)}return N}var vr=sd(!0),id=sd(!1),hs=Cn(null),ms=null,sr=null,Va=null;function Qa(){Va=sr=ms=null}function qa(e){var t=hs.current;xe(hs),e._currentValue=t}function la(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 fr(e,t){ms=e,Va=sr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ot=!0),e.firstContext=null)}function Ct(e){var t=e._currentValue;if(Va!==e)if(e={context:e,memoizedValue:t,next:null},sr===null){if(ms===null)throw Error(I(308));sr=e,ms.dependencies={lanes:0,firstContext:e}}else sr=sr.next=e;return t}var zn=null;function Ka(e){zn===null?zn=[e]:zn.push(e)}function ad(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ka(t)):(n.next=l.next,l.next=n),t.interleaved=n,nn(e,r)}function nn(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 cn=!1;function Xa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function od(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 Zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function xn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,oe&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,nn(e,n)}return l=r.interleaved,l===null?(t.next=t,Ka(r)):(t.next=l.next,l.next=t),r.interleaved=t,nn(e,n)}function Ql(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,Ia(e,n)}}function su(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 gs(e,t,n,r){var l=e.updateQueue;cn=!1;var i=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var u=o,d=u.next;u.next=null,a===null?i=d:a.next=d,a=u;var y=e.alternate;y!==null&&(y=y.updateQueue,o=y.lastBaseUpdate,o!==a&&(o===null?y.firstBaseUpdate=d:o.next=d,y.lastBaseUpdate=u))}if(i!==null){var g=l.baseState;a=0,y=d=u=null,o=i;do{var h=o.lane,v=o.eventTime;if((r&h)===h){y!==null&&(y=y.next={eventTime:v,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var x=e,S=o;switch(h=t,v=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){g=x.call(v,g,h);break e}g=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(v,g,h):x,h==null)break e;g=Ee({},g,h);break e;case 2:cn=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[o]:h.push(o))}else v={eventTime:v,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},y===null?(d=y=v,u=g):y=y.next=v,a|=h;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;h=o,o=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(y===null&&(u=g),l.baseState=u,l.firstBaseUpdate=d,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);Bn|=a,e.lanes=a,e.memoizedState=g}}function iu(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(I(191,l));l.call(r)}}}var xl={},qt=Cn(xl),al=Cn(xl),ol=Cn(xl);function In(e){if(e===xl)throw Error(I(174));return e}function Ja(e,t){switch(me(ol,t),me(al,e),me(qt,xl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Oi(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Oi(t,e)}xe(qt),me(qt,t)}function xr(){xe(qt),xe(al),xe(ol)}function ud(e){In(ol.current);var t=In(qt.current),n=Oi(t,e.type);t!==n&&(me(al,e),me(qt,n))}function Ga(e){al.current===e&&(xe(qt),xe(al))}var _e=Cn(0);function ys(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 mi=[];function Ya(){for(var e=0;e<mi.length;e++)mi[e]._workInProgressVersionPrimary=null;mi.length=0}var ql=ln.ReactCurrentDispatcher,gi=ln.ReactCurrentBatchConfig,Fn=0,Ce=null,Oe=null,He=null,vs=!1,Qr=!1,ul=0,ph=0;function Ye(){throw Error(I(321))}function Za(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ot(e[n],t[n]))return!1;return!0}function eo(e,t,n,r,l,i){if(Fn=i,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ql.current=e===null||e.memoizedState===null?yh:vh,e=n(r,l),Qr){i=0;do{if(Qr=!1,ul=0,25<=i)throw Error(I(301));i+=1,He=Oe=null,t.updateQueue=null,ql.current=xh,e=n(r,l)}while(Qr)}if(ql.current=xs,t=Oe!==null&&Oe.next!==null,Fn=0,He=Oe=Ce=null,vs=!1,t)throw Error(I(300));return e}function to(){var e=ul!==0;return ul=0,e}function Wt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return He===null?Ce.memoizedState=He=e:He=He.next=e,He}function Et(){if(Oe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=He===null?Ce.memoizedState:He.next;if(t!==null)He=t,Oe=e;else{if(e===null)throw Error(I(310));Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},He===null?Ce.memoizedState=He=e:He=He.next=e}return He}function cl(e,t){return typeof t=="function"?t(e):t}function yi(e){var t=Et(),n=t.queue;if(n===null)throw Error(I(311));n.lastRenderedReducer=e;var r=Oe,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,d=i;do{var y=d.lane;if((Fn&y)===y)u!==null&&(u=u.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var g={lane:y,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};u===null?(o=u=g,a=r):u=u.next=g,Ce.lanes|=y,Bn|=y}d=d.next}while(d!==null&&d!==i);u===null?a=r:u.next=o,Ot(r,t.memoizedState)||(ot=!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,Ce.lanes|=i,Bn|=i,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function vi(e){var t=Et(),n=t.queue;if(n===null)throw Error(I(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);Ot(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function cd(){}function dd(e,t){var n=Ce,r=Et(),l=t(),i=!Ot(r.memoizedState,l);if(i&&(r.memoizedState=l,ot=!0),r=r.queue,no(hd.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||He!==null&&He.memoizedState.tag&1){if(n.flags|=2048,dl(9,pd.bind(null,n,r,l,t),void 0,null),We===null)throw Error(I(349));Fn&30||fd(n,t,l)}return l}function fd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function pd(e,t,n,r){t.value=n,t.getSnapshot=r,md(t)&&gd(e)}function hd(e,t,n){return n(function(){md(t)&&gd(e)})}function md(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ot(e,n)}catch{return!0}}function gd(e){var t=nn(e,1);t!==null&&At(t,e,1,-1)}function au(e){var t=Wt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cl,lastRenderedState:e},t.queue=e,e=e.dispatch=gh.bind(null,Ce,e),[t.memoizedState,e]}function dl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.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 yd(){return Et().memoizedState}function Kl(e,t,n,r){var l=Wt();Ce.flags|=e,l.memoizedState=dl(1|t,n,void 0,r===void 0?null:r)}function zs(e,t,n,r){var l=Et();r=r===void 0?null:r;var i=void 0;if(Oe!==null){var a=Oe.memoizedState;if(i=a.destroy,r!==null&&Za(r,a.deps)){l.memoizedState=dl(t,n,i,r);return}}Ce.flags|=e,l.memoizedState=dl(1|t,n,i,r)}function ou(e,t){return Kl(8390656,8,e,t)}function no(e,t){return zs(2048,8,e,t)}function vd(e,t){return zs(4,2,e,t)}function xd(e,t){return zs(4,4,e,t)}function wd(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 kd(e,t,n){return n=n!=null?n.concat([e]):null,zs(4,4,wd.bind(null,t,e),n)}function ro(){}function jd(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Za(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Sd(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Za(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Nd(e,t,n){return Fn&21?(Ot(n,t)||(n=Tc(),Ce.lanes|=n,Bn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ot=!0),e.memoizedState=n)}function hh(e,t){var n=de;de=n!==0&&4>n?n:4,e(!0);var r=gi.transition;gi.transition={};try{e(!1),t()}finally{de=n,gi.transition=r}}function _d(){return Et().memoizedState}function mh(e,t,n){var r=kn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cd(e))Ed(t,n);else if(n=ad(e,t,n,r),n!==null){var l=lt();At(n,e,r,l),bd(n,t,r)}}function gh(e,t,n){var r=kn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cd(e))Ed(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,Ot(o,a)){var u=t.interleaved;u===null?(l.next=l,Ka(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=ad(e,t,l,r),n!==null&&(l=lt(),At(n,e,r,l),bd(n,t,r))}}function Cd(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function Ed(e,t){Qr=vs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ia(e,n)}}var xs={readContext:Ct,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useInsertionEffect:Ye,useLayoutEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useMutableSource:Ye,useSyncExternalStore:Ye,useId:Ye,unstable_isNewReconciler:!1},yh={readContext:Ct,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:ou,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Kl(4194308,4,wd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Kl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Kl(4,2,e,t)},useMemo:function(e,t){var n=Wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=mh.bind(null,Ce,e),[r.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:au,useDebugValue:ro,useDeferredValue:function(e){return Wt().memoizedState=e},useTransition:function(){var e=au(!1),t=e[0];return e=hh.bind(null,e[1]),Wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ce,l=Wt();if(Se){if(n===void 0)throw Error(I(407));n=n()}else{if(n=t(),We===null)throw Error(I(349));Fn&30||fd(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,ou(hd.bind(null,r,i,e),[e]),r.flags|=2048,dl(9,pd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Wt(),t=We.identifierPrefix;if(Se){var n=Yt,r=Gt;n=(r&~(1<<32-Dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ul++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ph++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},vh={readContext:Ct,useCallback:jd,useContext:Ct,useEffect:no,useImperativeHandle:kd,useInsertionEffect:vd,useLayoutEffect:xd,useMemo:Sd,useReducer:yi,useRef:yd,useState:function(){return yi(cl)},useDebugValue:ro,useDeferredValue:function(e){var t=Et();return Nd(t,Oe.memoizedState,e)},useTransition:function(){var e=yi(cl)[0],t=Et().memoizedState;return[e,t]},useMutableSource:cd,useSyncExternalStore:dd,useId:_d,unstable_isNewReconciler:!1},xh={readContext:Ct,useCallback:jd,useContext:Ct,useEffect:no,useImperativeHandle:kd,useInsertionEffect:vd,useLayoutEffect:xd,useMemo:Sd,useReducer:vi,useRef:yd,useState:function(){return vi(cl)},useDebugValue:ro,useDeferredValue:function(e){var t=Et();return Oe===null?t.memoizedState=e:Nd(t,Oe.memoizedState,e)},useTransition:function(){var e=vi(cl)[0],t=Et().memoizedState;return[e,t]},useMutableSource:cd,useSyncExternalStore:dd,useId:_d,unstable_isNewReconciler:!1};function zt(e,t){if(e&&e.defaultProps){t=Ee({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function sa(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ee({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={isMounted:function(e){return(e=e._reactInternals)?Wn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=lt(),l=kn(e),i=Zt(r,l);i.payload=t,n!=null&&(i.callback=n),t=xn(e,i,l),t!==null&&(At(t,e,l,r),Ql(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=lt(),l=kn(e),i=Zt(r,l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=xn(e,i,l),t!==null&&(At(t,e,l,r),Ql(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=lt(),r=kn(e),l=Zt(n,r);l.tag=2,t!=null&&(l.callback=t),t=xn(e,l,r),t!==null&&(At(t,e,r,n),Ql(t,e,r))}};function uu(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?!rl(n,r)||!rl(l,i):!0}function Td(e,t,n){var r=!1,l=Nn,i=t.contextType;return typeof i=="object"&&i!==null?i=Ct(i):(l=ct(t)?On:tt.current,r=t.contextTypes,i=(r=r!=null)?gr(e,l):Nn),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Is,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function cu(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&&Is.enqueueReplaceState(t,t.state,null)}function ia(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},Xa(e);var i=t.contextType;typeof i=="object"&&i!==null?l.context=Ct(i):(i=ct(t)?On:tt.current,l.context=gr(e,i)),l.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(sa(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&&Is.enqueueReplaceState(l,l.state,null),gs(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function wr(e,t){try{var n="",r=t;do n+=qf(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 xi(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function aa(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var wh=typeof WeakMap=="function"?WeakMap:Map;function Pd(e,t,n){n=Zt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ks||(ks=!0,ya=r),aa(e,t)},n}function Ld(e,t,n){n=Zt(-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(){aa(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){aa(e,t),typeof r!="function"&&(wn===null?wn=new Set([this]):wn.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function du(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new wh;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 fu(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 pu(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=Zt(-1,1),t.tag=2,xn(n,t,1))),n.lanes|=1),e)}var kh=ln.ReactCurrentOwner,ot=!1;function rt(e,t,n,r){t.child=e===null?id(t,null,n,r):vr(t,e.child,n,r)}function hu(e,t,n,r,l){n=n.render;var i=t.ref;return fr(t,l),r=eo(e,t,n,r,i,l),n=to(),e!==null&&!ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,rn(e,t,l)):(Se&&n&&Ua(t),t.flags|=1,rt(e,t,r,l),t.child)}function mu(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!fo(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=Yl(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:rl,n(a,r)&&e.ref===t.ref)return rn(e,t,l)}return t.flags|=1,e=jn(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(rl(i,r)&&e.ref===t.ref)if(ot=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(ot=!0);else return t.lanes=e.lanes,rn(e,t,l)}return oa(e,t,n,r,l)}function zd(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},me(ar,pt),pt|=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,me(ar,pt),pt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,me(ar,pt),pt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,me(ar,pt),pt|=r;return rt(e,t,l,n),t.child}function Id(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function oa(e,t,n,r,l){var i=ct(n)?On:tt.current;return i=gr(t,i),fr(t,l),n=eo(e,t,n,r,i,l),r=to(),e!==null&&!ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,rn(e,t,l)):(Se&&r&&Ua(t),t.flags|=1,rt(e,t,n,l),t.child)}function gu(e,t,n,r,l){if(ct(n)){var i=!0;ds(t)}else i=!1;if(fr(t,l),t.stateNode===null)Xl(e,t),Td(t,n,r),ia(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Ct(d):(d=ct(n)?On:tt.current,d=gr(t,d));var y=n.getDerivedStateFromProps,g=typeof y=="function"||typeof a.getSnapshotBeforeUpdate=="function";g||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==d)&&cu(t,a,r,d),cn=!1;var h=t.memoizedState;a.state=h,gs(t,r,a,l),u=t.memoizedState,o!==r||h!==u||ut.current||cn?(typeof y=="function"&&(sa(t,n,y,r),u=t.memoizedState),(o=cn||uu(t,n,o,r,h,u,d))?(g||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=d,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,od(e,t),o=t.memoizedProps,d=t.type===t.elementType?o:zt(t.type,o),a.props=d,g=t.pendingProps,h=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=Ct(u):(u=ct(n)?On:tt.current,u=gr(t,u));var v=n.getDerivedStateFromProps;(y=typeof v=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==g||h!==u)&&cu(t,a,r,u),cn=!1,h=t.memoizedState,a.state=h,gs(t,r,a,l);var x=t.memoizedState;o!==g||h!==x||ut.current||cn?(typeof v=="function"&&(sa(t,n,v,r),x=t.memoizedState),(d=cn||uu(t,n,d,r,h,x,u)||!1)?(y||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,x,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,x,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),a.props=r,a.state=x,a.context=u,r=d):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return ua(e,t,n,r,i,l)}function ua(e,t,n,r,l,i){Id(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&tu(t,n,!1),rn(e,t,i);r=t.stateNode,kh.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=vr(t,e.child,null,i),t.child=vr(t,null,o,i)):rt(e,t,o,i),t.memoizedState=r.state,l&&tu(t,n,!0),t.child}function $d(e){var t=e.stateNode;t.pendingContext?eu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&eu(e,t.context,!1),Ja(e,t.containerInfo)}function yu(e,t,n,r,l){return yr(),Wa(l),t.flags|=256,rt(e,t,n,r),t.child}var ca={dehydrated:null,treeContext:null,retryLane:0};function da(e){return{baseLanes:e,cachePool:null,transitions:null}}function Dd(e,t,n){var r=t.pendingProps,l=_e.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),me(_e,l&1),e===null)return ra(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=As(a,r,0,null),e=An(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=da(n),t.memoizedState=ca,e):lo(t,a));if(l=e.memoizedState,l!==null&&(o=l.dehydrated,o!==null))return jh(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=jn(l,u),r.subtreeFlags=l.subtreeFlags&14680064),o!==null?i=jn(o,i):(i=An(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?da(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=ca,r}return i=e.child,e=i.sibling,r=jn(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 lo(e,t){return t=As({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function $l(e,t,n,r){return r!==null&&Wa(r),vr(t,e.child,null,n),e=lo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jh(e,t,n,r,l,i,a){if(n)return t.flags&256?(t.flags&=-257,r=xi(Error(I(422))),$l(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=As({mode:"visible",children:r.children},l,0,null),i=An(i,l,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&vr(t,e.child,null,a),t.child.memoizedState=da(a),t.memoizedState=ca,i);if(!(t.mode&1))return $l(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(I(419)),r=xi(i,r,void 0),$l(e,t,a,r)}if(o=(a&e.childLanes)!==0,ot||o){if(r=We,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,nn(e,l),At(r,e,l,-1))}return co(),r=xi(Error(I(421))),$l(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=$h.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,mt=vn(l.nextSibling),gt=t,Se=!0,$t=null,e!==null&&(jt[St++]=Gt,jt[St++]=Yt,jt[St++]=Mn,Gt=e.id,Yt=e.overflow,Mn=t),t=lo(t,r.children),t.flags|=4096,t)}function vu(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),la(e.return,t,n)}function wi(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 Ad(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(rt(e,t,r.children,n),r=_e.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&&vu(e,n,t);else if(e.tag===19)vu(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(me(_e,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&&ys(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),wi(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&&ys(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}wi(t,!0,n,null,i);break;case"together":wi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Xl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function rn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Bn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(I(153));if(t.child!==null){for(e=t.child,n=jn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=jn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Sh(e,t,n){switch(t.tag){case 3:$d(t),yr();break;case 5:ud(t);break;case 1:ct(t.type)&&ds(t);break;case 4:Ja(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;me(hs,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(me(_e,_e.current&1),t.flags|=128,null):n&t.child.childLanes?Dd(e,t,n):(me(_e,_e.current&1),e=rn(e,t,n),e!==null?e.sibling:null);me(_e,_e.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ad(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),me(_e,_e.current),r)break;return null;case 22:case 23:return t.lanes=0,zd(e,t,n)}return rn(e,t,n)}var Od,fa,Md,Fd;Od=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}};fa=function(){};Md=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,In(qt.current);var i=null;switch(n){case"input":l=Ii(e,l),r=Ii(e,r),i=[];break;case"select":l=Ee({},l,{value:void 0}),r=Ee({},r,{value:void 0}),i=[];break;case"textarea":l=Ai(e,l),r=Ai(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=us)}Mi(n,r);var a;n=null;for(d in l)if(!r.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var o=l[d];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Jr.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var u=r[d];if(o=l!=null?l[d]:void 0,r.hasOwnProperty(d)&&u!==o&&(u!=null||o!=null))if(d==="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(d,n)),n=u;else d==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(i=i||[]).push(d,u)):d==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(d,""+u):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Jr.hasOwnProperty(d)?(u!=null&&d==="onScroll"&&ve("scroll",e),i||o===u||(i=[])):(i=i||[]).push(d,u))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};Fd=function(e,t,n,r){n!==r&&(t.flags|=4)};function Rr(e,t){if(!Se)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 Ze(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 Nh(e,t,n){var r=t.pendingProps;switch(Ha(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return ct(t.type)&&cs(),Ze(t),null;case 3:return r=t.stateNode,xr(),xe(ut),xe(tt),Ya(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(zl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,$t!==null&&(wa($t),$t=null))),fa(e,t),Ze(t),null;case 5:Ga(t);var l=In(ol.current);if(n=t.type,e!==null&&t.stateNode!=null)Md(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(I(166));return Ze(t),null}if(e=In(qt.current),zl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Vt]=t,r[il]=i,e=(t.mode&1)!==0,n){case"dialog":ve("cancel",r),ve("close",r);break;case"iframe":case"object":case"embed":ve("load",r);break;case"video":case"audio":for(l=0;l<Or.length;l++)ve(Or[l],r);break;case"source":ve("error",r);break;case"img":case"image":case"link":ve("error",r),ve("load",r);break;case"details":ve("toggle",r);break;case"input":Eo(r,i),ve("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ve("invalid",r);break;case"textarea":To(r,i),ve("invalid",r)}Mi(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&&Rl(r.textContent,o,e),l=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&Rl(r.textContent,o,e),l=["children",""+o]):Jr.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&ve("scroll",r)}switch(n){case"input":Nl(r),bo(r,i,!0);break;case"textarea":Nl(r),Po(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=us)}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=hc(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[Vt]=t,e[il]=r,Od(e,t,!1,!1),t.stateNode=e;e:{switch(a=Fi(n,r),n){case"dialog":ve("cancel",e),ve("close",e),l=r;break;case"iframe":case"object":case"embed":ve("load",e),l=r;break;case"video":case"audio":for(l=0;l<Or.length;l++)ve(Or[l],e);l=r;break;case"source":ve("error",e),l=r;break;case"img":case"image":case"link":ve("error",e),ve("load",e),l=r;break;case"details":ve("toggle",e),l=r;break;case"input":Eo(e,r),l=Ii(e,r),ve("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=Ee({},r,{value:void 0}),ve("invalid",e);break;case"textarea":To(e,r),l=Ai(e,r),ve("invalid",e);break;default:l=r}Mi(n,l),o=l;for(i in o)if(o.hasOwnProperty(i)){var u=o[i];i==="style"?yc(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&mc(e,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Gr(e,u):typeof u=="number"&&Gr(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Jr.hasOwnProperty(i)?u!=null&&i==="onScroll"&&ve("scroll",e):u!=null&&ba(e,i,u,a))}switch(n){case"input":Nl(e),bo(e,r,!1);break;case"textarea":Nl(e),Po(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?or(e,!!r.multiple,i,!1):r.defaultValue!=null&&or(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=us)}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 Ze(t),null;case 6:if(e&&t.stateNode!=null)Fd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(I(166));if(n=In(ol.current),In(qt.current),zl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Vt]=t,(i=r.nodeValue!==n)&&(e=gt,e!==null))switch(e.tag){case 3:Rl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Rl(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Vt]=t,t.stateNode=r}return Ze(t),null;case 13:if(xe(_e),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Se&&mt!==null&&t.mode&1&&!(t.flags&128))ld(),yr(),t.flags|=98560,i=!1;else if(i=zl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(I(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(I(317));i[Vt]=t}else yr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ze(t),i=!1}else $t!==null&&(wa($t),$t=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||_e.current&1?Me===0&&(Me=3):co())),t.updateQueue!==null&&(t.flags|=4),Ze(t),null);case 4:return xr(),fa(e,t),e===null&&ll(t.stateNode.containerInfo),Ze(t),null;case 10:return qa(t.type._context),Ze(t),null;case 17:return ct(t.type)&&cs(),Ze(t),null;case 19:if(xe(_e),i=t.memoizedState,i===null)return Ze(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Rr(i,!1);else{if(Me!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ys(e),a!==null){for(t.flags|=128,Rr(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 me(_e,_e.current&1|2),t.child}e=e.sibling}i.tail!==null&&Le()>kr&&(t.flags|=128,r=!0,Rr(i,!1),t.lanes=4194304)}else{if(!r)if(e=ys(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Se)return Ze(t),null}else 2*Le()-i.renderingStartTime>kr&&n!==1073741824&&(t.flags|=128,r=!0,Rr(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=Le(),t.sibling=null,n=_e.current,me(_e,r?n&1|2:n&1),t):(Ze(t),null);case 22:case 23:return uo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?pt&1073741824&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),null;case 24:return null;case 25:return null}throw Error(I(156,t.tag))}function _h(e,t){switch(Ha(t),t.tag){case 1:return ct(t.type)&&cs(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xr(),xe(ut),xe(tt),Ya(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ga(t),null;case 13:if(xe(_e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(I(340));yr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xe(_e),null;case 4:return xr(),null;case 10:return qa(t.type._context),null;case 22:case 23:return uo(),null;case 24:return null;default:return null}}var Dl=!1,et=!1,Ch=typeof WeakSet=="function"?WeakSet:Set,W=null;function ir(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(e,t,r)}else n.current=null}function pa(e,t,n){try{n()}catch(r){Pe(e,t,r)}}var xu=!1;function Eh(e,t){if(Ji=is,e=Vc(),Ba(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,d=0,y=0,g=e,h=null;t:for(;;){for(var v;g!==n||l!==0&&g.nodeType!==3||(o=a+l),g!==i||r!==0&&g.nodeType!==3||(u=a+r),g.nodeType===3&&(a+=g.nodeValue.length),(v=g.firstChild)!==null;)h=g,g=v;for(;;){if(g===e)break t;if(h===n&&++d===l&&(o=a),h===i&&++y===r&&(u=a),(v=g.nextSibling)!==null)break;g=h,h=g.parentNode}g=v}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Gi={focusedElem:e,selectionRange:n},is=!1,W=t;W!==null;)if(t=W,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,N=x.memoizedState,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:zt(t.type,S),N);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(k){Pe(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return x=xu,xu=!1,x}function qr(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&&pa(t,n,i)}l=l.next}while(l!==r)}}function $s(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 ha(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 Bd(e){var t=e.alternate;t!==null&&(e.alternate=null,Bd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vt],delete t[il],delete t[ea],delete t[uh],delete t[ch])),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 Ud(e){return e.tag===5||e.tag===3||e.tag===4}function wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ud(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 ma(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=us));else if(r!==4&&(e=e.child,e!==null))for(ma(e,t,n),e=e.sibling;e!==null;)ma(e,t,n),e=e.sibling}function ga(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(ga(e,t,n),e=e.sibling;e!==null;)ga(e,t,n),e=e.sibling}var qe=null,It=!1;function on(e,t,n){for(n=n.child;n!==null;)Hd(e,t,n),n=n.sibling}function Hd(e,t,n){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(Es,n)}catch{}switch(n.tag){case 5:et||ir(n,t);case 6:var r=qe,l=It;qe=null,on(e,t,n),qe=r,It=l,qe!==null&&(It?(e=qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):qe.removeChild(n.stateNode));break;case 18:qe!==null&&(It?(e=qe,n=n.stateNode,e.nodeType===8?pi(e.parentNode,n):e.nodeType===1&&pi(e,n),tl(e)):pi(qe,n.stateNode));break;case 4:r=qe,l=It,qe=n.stateNode.containerInfo,It=!0,on(e,t,n),qe=r,It=l;break;case 0:case 11:case 14:case 15:if(!et&&(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)&&pa(n,t,a),l=l.next}while(l!==r)}on(e,t,n);break;case 1:if(!et&&(ir(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Pe(n,t,o)}on(e,t,n);break;case 21:on(e,t,n);break;case 22:n.mode&1?(et=(r=et)||n.memoizedState!==null,on(e,t,n),et=r):on(e,t,n);break;default:on(e,t,n)}}function ku(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ch),t.forEach(function(r){var l=Dh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Rt(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:qe=o.stateNode,It=!1;break e;case 3:qe=o.stateNode.containerInfo,It=!0;break e;case 4:qe=o.stateNode.containerInfo,It=!0;break e}o=o.return}if(qe===null)throw Error(I(160));Hd(i,a,l),qe=null,It=!1;var u=l.alternate;u!==null&&(u.return=null),l.return=null}catch(d){Pe(l,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Wd(t,e),t=t.sibling}function Wd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rt(t,e),Ut(e),r&4){try{qr(3,e,e.return),$s(3,e)}catch(S){Pe(e,e.return,S)}try{qr(5,e,e.return)}catch(S){Pe(e,e.return,S)}}break;case 1:Rt(t,e),Ut(e),r&512&&n!==null&&ir(n,n.return);break;case 5:if(Rt(t,e),Ut(e),r&512&&n!==null&&ir(n,n.return),e.flags&32){var l=e.stateNode;try{Gr(l,"")}catch(S){Pe(e,e.return,S)}}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&&fc(l,i),Fi(o,a);var d=Fi(o,i);for(a=0;a<u.length;a+=2){var y=u[a],g=u[a+1];y==="style"?yc(l,g):y==="dangerouslySetInnerHTML"?mc(l,g):y==="children"?Gr(l,g):ba(l,y,g,d)}switch(o){case"input":$i(l,i);break;case"textarea":pc(l,i);break;case"select":var h=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!i.multiple;var v=i.value;v!=null?or(l,!!i.multiple,v,!1):h!==!!i.multiple&&(i.defaultValue!=null?or(l,!!i.multiple,i.defaultValue,!0):or(l,!!i.multiple,i.multiple?[]:"",!1))}l[il]=i}catch(S){Pe(e,e.return,S)}}break;case 6:if(Rt(t,e),Ut(e),r&4){if(e.stateNode===null)throw Error(I(162));l=e.stateNode,i=e.memoizedProps;try{l.nodeValue=i}catch(S){Pe(e,e.return,S)}}break;case 3:if(Rt(t,e),Ut(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{tl(t.containerInfo)}catch(S){Pe(e,e.return,S)}break;case 4:Rt(t,e),Ut(e);break;case 13:Rt(t,e),Ut(e),l=e.child,l.flags&8192&&(i=l.memoizedState!==null,l.stateNode.isHidden=i,!i||l.alternate!==null&&l.alternate.memoizedState!==null||(ao=Le())),r&4&&ku(e);break;case 22:if(y=n!==null&&n.memoizedState!==null,e.mode&1?(et=(d=et)||y,Rt(t,e),et=d):Rt(t,e),Ut(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!y&&e.mode&1)for(W=e,y=e.child;y!==null;){for(g=W=y;W!==null;){switch(h=W,v=h.child,h.tag){case 0:case 11:case 14:case 15:qr(4,h,h.return);break;case 1:ir(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(S){Pe(r,n,S)}}break;case 5:ir(h,h.return);break;case 22:if(h.memoizedState!==null){Su(g);continue}}v!==null?(v.return=h,W=v):Su(g)}y=y.sibling}e:for(y=null,g=e;;){if(g.tag===5){if(y===null){y=g;try{l=g.stateNode,d?(i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=g.stateNode,u=g.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=gc("display",a))}catch(S){Pe(e,e.return,S)}}}else if(g.tag===6){if(y===null)try{g.stateNode.nodeValue=d?"":g.memoizedProps}catch(S){Pe(e,e.return,S)}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===e)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===e)break e;for(;g.sibling===null;){if(g.return===null||g.return===e)break e;y===g&&(y=null),g=g.return}y===g&&(y=null),g.sibling.return=g.return,g=g.sibling}}break;case 19:Rt(t,e),Ut(e),r&4&&ku(e);break;case 21:break;default:Rt(t,e),Ut(e)}}function Ut(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Ud(n)){var r=n;break e}n=n.return}throw Error(I(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(Gr(l,""),r.flags&=-33);var i=wu(e);ga(e,i,l);break;case 3:case 4:var a=r.stateNode.containerInfo,o=wu(e);ma(e,o,a);break;default:throw Error(I(161))}}catch(u){Pe(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function bh(e,t,n){W=e,Vd(e)}function Vd(e,t,n){for(var r=(e.mode&1)!==0;W!==null;){var l=W,i=l.child;if(l.tag===22&&r){var a=l.memoizedState!==null||Dl;if(!a){var o=l.alternate,u=o!==null&&o.memoizedState!==null||et;o=Dl;var d=et;if(Dl=a,(et=u)&&!d)for(W=l;W!==null;)a=W,u=a.child,a.tag===22&&a.memoizedState!==null?Nu(l):u!==null?(u.return=a,W=u):Nu(l);for(;i!==null;)W=i,Vd(i),i=i.sibling;W=l,Dl=o,et=d}ju(e)}else l.subtreeFlags&8772&&i!==null?(i.return=l,W=i):ju(e)}}function ju(e){for(;W!==null;){var t=W;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:et||$s(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!et)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:zt(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&iu(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}iu(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 d=t.alternate;if(d!==null){var y=d.memoizedState;if(y!==null){var g=y.dehydrated;g!==null&&tl(g)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(I(163))}et||t.flags&512&&ha(t)}catch(h){Pe(t,t.return,h)}}if(t===e){W=null;break}if(n=t.sibling,n!==null){n.return=t.return,W=n;break}W=t.return}}function Su(e){for(;W!==null;){var t=W;if(t===e){W=null;break}var n=t.sibling;if(n!==null){n.return=t.return,W=n;break}W=t.return}}function Nu(e){for(;W!==null;){var t=W;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{$s(4,t)}catch(u){Pe(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(u){Pe(t,l,u)}}var i=t.return;try{ha(t)}catch(u){Pe(t,i,u)}break;case 5:var a=t.return;try{ha(t)}catch(u){Pe(t,a,u)}}}catch(u){Pe(t,t.return,u)}if(t===e){W=null;break}var o=t.sibling;if(o!==null){o.return=t.return,W=o;break}W=t.return}}var Th=Math.ceil,ws=ln.ReactCurrentDispatcher,so=ln.ReactCurrentOwner,_t=ln.ReactCurrentBatchConfig,oe=0,We=null,ze=null,Ke=0,pt=0,ar=Cn(0),Me=0,fl=null,Bn=0,Ds=0,io=0,Kr=null,at=null,ao=0,kr=1/0,Xt=null,ks=!1,ya=null,wn=null,Al=!1,hn=null,js=0,Xr=0,va=null,Jl=-1,Gl=0;function lt(){return oe&6?Le():Jl!==-1?Jl:Jl=Le()}function kn(e){return e.mode&1?oe&2&&Ke!==0?Ke&-Ke:fh.transition!==null?(Gl===0&&(Gl=Tc()),Gl):(e=de,e!==0||(e=window.event,e=e===void 0?16:Dc(e.type)),e):1}function At(e,t,n,r){if(50<Xr)throw Xr=0,va=null,Error(I(185));gl(e,n,r),(!(oe&2)||e!==We)&&(e===We&&(!(oe&2)&&(Ds|=n),Me===4&&fn(e,Ke)),dt(e,r),n===1&&oe===0&&!(t.mode&1)&&(kr=Le()+500,Rs&&En()))}function dt(e,t){var n=e.callbackNode;fp(e,t);var r=ss(e,e===We?Ke:0);if(r===0)n!==null&&zo(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&zo(n),t===1)e.tag===0?dh(_u.bind(null,e)):td(_u.bind(null,e)),ah(function(){!(oe&6)&&En()}),n=null;else{switch(Pc(r)){case 1:n=za;break;case 4:n=Ec;break;case 16:n=ls;break;case 536870912:n=bc;break;default:n=ls}n=Zd(n,Qd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Qd(e,t){if(Jl=-1,Gl=0,oe&6)throw Error(I(327));var n=e.callbackNode;if(pr()&&e.callbackNode!==n)return null;var r=ss(e,e===We?Ke:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ss(e,r);else{t=r;var l=oe;oe|=2;var i=Kd();(We!==e||Ke!==t)&&(Xt=null,kr=Le()+500,Dn(e,t));do try{Rh();break}catch(o){qd(e,o)}while(!0);Qa(),ws.current=i,oe=l,ze!==null?t=0:(We=null,Ke=0,t=Me)}if(t!==0){if(t===2&&(l=Vi(e),l!==0&&(r=l,t=xa(e,l))),t===1)throw n=fl,Dn(e,0),fn(e,r),dt(e,Le()),n;if(t===6)fn(e,r);else{if(l=e.current.alternate,!(r&30)&&!Ph(l)&&(t=Ss(e,r),t===2&&(i=Vi(e),i!==0&&(r=i,t=xa(e,i))),t===1))throw n=fl,Dn(e,0),fn(e,r),dt(e,Le()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(I(345));case 2:Ln(e,at,Xt);break;case 3:if(fn(e,r),(r&130023424)===r&&(t=ao+500-Le(),10<t)){if(ss(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){lt(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Zi(Ln.bind(null,e,at,Xt),t);break}Ln(e,at,Xt);break;case 4:if(fn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var a=31-Dt(r);i=1<<a,a=t[a],a>l&&(l=a),r&=~i}if(r=l,r=Le()-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=Zi(Ln.bind(null,e,at,Xt),r);break}Ln(e,at,Xt);break;case 5:Ln(e,at,Xt);break;default:throw Error(I(329))}}}return dt(e,Le()),e.callbackNode===n?Qd.bind(null,e):null}function xa(e,t){var n=Kr;return e.current.memoizedState.isDehydrated&&(Dn(e,t).flags|=256),e=Ss(e,t),e!==2&&(t=at,at=n,t!==null&&wa(t)),e}function wa(e){at===null?at=e:at.push.apply(at,e)}function Ph(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(!Ot(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 fn(e,t){for(t&=~io,t&=~Ds,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Dt(t),r=1<<n;e[n]=-1,t&=~r}}function _u(e){if(oe&6)throw Error(I(327));pr();var t=ss(e,0);if(!(t&1))return dt(e,Le()),null;var n=Ss(e,t);if(e.tag!==0&&n===2){var r=Vi(e);r!==0&&(t=r,n=xa(e,r))}if(n===1)throw n=fl,Dn(e,0),fn(e,t),dt(e,Le()),n;if(n===6)throw Error(I(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ln(e,at,Xt),dt(e,Le()),null}function oo(e,t){var n=oe;oe|=1;try{return e(t)}finally{oe=n,oe===0&&(kr=Le()+500,Rs&&En())}}function Un(e){hn!==null&&hn.tag===0&&!(oe&6)&&pr();var t=oe;oe|=1;var n=_t.transition,r=de;try{if(_t.transition=null,de=1,e)return e()}finally{de=r,_t.transition=n,oe=t,!(oe&6)&&En()}}function uo(){pt=ar.current,xe(ar)}function Dn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ih(n)),ze!==null)for(n=ze.return;n!==null;){var r=n;switch(Ha(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&cs();break;case 3:xr(),xe(ut),xe(tt),Ya();break;case 5:Ga(r);break;case 4:xr();break;case 13:xe(_e);break;case 19:xe(_e);break;case 10:qa(r.type._context);break;case 22:case 23:uo()}n=n.return}if(We=e,ze=e=jn(e.current,null),Ke=pt=t,Me=0,fl=null,io=Ds=Bn=0,at=Kr=null,zn!==null){for(t=0;t<zn.length;t++)if(n=zn[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}zn=null}return e}function qd(e,t){do{var n=ze;try{if(Qa(),ql.current=xs,vs){for(var r=Ce.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}vs=!1}if(Fn=0,He=Oe=Ce=null,Qr=!1,ul=0,so.current=null,n===null||n.return===null){Me=1,fl=t,ze=null;break}e:{var i=e,a=n.return,o=n,u=t;if(t=Ke,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var d=u,y=o,g=y.tag;if(!(y.mode&1)&&(g===0||g===11||g===15)){var h=y.alternate;h?(y.updateQueue=h.updateQueue,y.memoizedState=h.memoizedState,y.lanes=h.lanes):(y.updateQueue=null,y.memoizedState=null)}var v=fu(a);if(v!==null){v.flags&=-257,pu(v,a,o,i,t),v.mode&1&&du(i,d,t),t=v,u=d;var x=t.updateQueue;if(x===null){var S=new Set;S.add(u),t.updateQueue=S}else x.add(u);break e}else{if(!(t&1)){du(i,d,t),co();break e}u=Error(I(426))}}else if(Se&&o.mode&1){var N=fu(a);if(N!==null){!(N.flags&65536)&&(N.flags|=256),pu(N,a,o,i,t),Wa(wr(u,o));break e}}i=u=wr(u,o),Me!==4&&(Me=2),Kr===null?Kr=[i]:Kr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var p=Pd(i,u,t);su(i,p);break e;case 1:o=u;var f=i.type,m=i.stateNode;if(!(i.flags&128)&&(typeof f.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(wn===null||!wn.has(m)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=Ld(i,o,t);su(i,k);break e}}i=i.return}while(i!==null)}Jd(n)}catch(C){t=C,ze===n&&n!==null&&(ze=n=n.return);continue}break}while(!0)}function Kd(){var e=ws.current;return ws.current=xs,e===null?xs:e}function co(){(Me===0||Me===3||Me===2)&&(Me=4),We===null||!(Bn&268435455)&&!(Ds&268435455)||fn(We,Ke)}function Ss(e,t){var n=oe;oe|=2;var r=Kd();(We!==e||Ke!==t)&&(Xt=null,Dn(e,t));do try{Lh();break}catch(l){qd(e,l)}while(!0);if(Qa(),oe=n,ws.current=r,ze!==null)throw Error(I(261));return We=null,Ke=0,Me}function Lh(){for(;ze!==null;)Xd(ze)}function Rh(){for(;ze!==null&&!rp();)Xd(ze)}function Xd(e){var t=Yd(e.alternate,e,pt);e.memoizedProps=e.pendingProps,t===null?Jd(e):ze=t,so.current=null}function Jd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_h(n,t),n!==null){n.flags&=32767,ze=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Me=6,ze=null;return}}else if(n=Nh(n,t,pt),n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Me===0&&(Me=5)}function Ln(e,t,n){var r=de,l=_t.transition;try{_t.transition=null,de=1,zh(e,t,n,r)}finally{_t.transition=l,de=r}return null}function zh(e,t,n,r){do pr();while(hn!==null);if(oe&6)throw Error(I(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(I(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(pp(e,i),e===We&&(ze=We=null,Ke=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Al||(Al=!0,Zd(ls,function(){return pr(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=_t.transition,_t.transition=null;var a=de;de=1;var o=oe;oe|=4,so.current=null,Eh(e,n),Wd(n,e),Zp(Gi),is=!!Ji,Gi=Ji=null,e.current=n,bh(n),lp(),oe=o,de=a,_t.transition=i}else e.current=n;if(Al&&(Al=!1,hn=e,js=l),i=e.pendingLanes,i===0&&(wn=null),ap(n.stateNode),dt(e,Le()),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(ks)throw ks=!1,e=ya,ya=null,e;return js&1&&e.tag!==0&&pr(),i=e.pendingLanes,i&1?e===va?Xr++:(Xr=0,va=e):Xr=0,En(),null}function pr(){if(hn!==null){var e=Pc(js),t=_t.transition,n=de;try{if(_t.transition=null,de=16>e?16:e,hn===null)var r=!1;else{if(e=hn,hn=null,js=0,oe&6)throw Error(I(331));var l=oe;for(oe|=4,W=e.current;W!==null;){var i=W,a=i.child;if(W.flags&16){var o=i.deletions;if(o!==null){for(var u=0;u<o.length;u++){var d=o[u];for(W=d;W!==null;){var y=W;switch(y.tag){case 0:case 11:case 15:qr(8,y,i)}var g=y.child;if(g!==null)g.return=y,W=g;else for(;W!==null;){y=W;var h=y.sibling,v=y.return;if(Bd(y),y===d){W=null;break}if(h!==null){h.return=v,W=h;break}W=v}}}var x=i.alternate;if(x!==null){var S=x.child;if(S!==null){x.child=null;do{var N=S.sibling;S.sibling=null,S=N}while(S!==null)}}W=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,W=a;else e:for(;W!==null;){if(i=W,i.flags&2048)switch(i.tag){case 0:case 11:case 15:qr(9,i,i.return)}var p=i.sibling;if(p!==null){p.return=i.return,W=p;break e}W=i.return}}var f=e.current;for(W=f;W!==null;){a=W;var m=a.child;if(a.subtreeFlags&2064&&m!==null)m.return=a,W=m;else e:for(a=f;W!==null;){if(o=W,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:$s(9,o)}}catch(C){Pe(o,o.return,C)}if(o===a){W=null;break e}var k=o.sibling;if(k!==null){k.return=o.return,W=k;break e}W=o.return}}if(oe=l,En(),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(Es,e)}catch{}r=!0}return r}finally{de=n,_t.transition=t}}return!1}function Cu(e,t,n){t=wr(n,t),t=Pd(e,t,1),e=xn(e,t,1),t=lt(),e!==null&&(gl(e,1,t),dt(e,t))}function Pe(e,t,n){if(e.tag===3)Cu(e,e,n);else for(;t!==null;){if(t.tag===3){Cu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(wn===null||!wn.has(r))){e=wr(n,e),e=Ld(t,e,1),t=xn(t,e,1),e=lt(),t!==null&&(gl(t,1,e),dt(t,e));break}}t=t.return}}function Ih(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=lt(),e.pingedLanes|=e.suspendedLanes&n,We===e&&(Ke&n)===n&&(Me===4||Me===3&&(Ke&130023424)===Ke&&500>Le()-ao?Dn(e,0):io|=n),dt(e,t)}function Gd(e,t){t===0&&(e.mode&1?(t=El,El<<=1,!(El&130023424)&&(El=4194304)):t=1);var n=lt();e=nn(e,t),e!==null&&(gl(e,t,n),dt(e,n))}function $h(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gd(e,n)}function Dh(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(I(314))}r!==null&&r.delete(t),Gd(e,n)}var Yd;Yd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ut.current)ot=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ot=!1,Sh(e,t,n);ot=!!(e.flags&131072)}else ot=!1,Se&&t.flags&1048576&&nd(t,ps,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Xl(e,t),e=t.pendingProps;var l=gr(t,tt.current);fr(t,n),l=eo(null,t,r,e,l,n);var i=to();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,ct(r)?(i=!0,ds(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Xa(t),l.updater=Is,t.stateNode=l,l._reactInternals=t,ia(t,r,e,n),t=ua(null,t,r,!0,i,n)):(t.tag=0,Se&&i&&Ua(t),rt(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Xl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Oh(r),e=zt(r,e),l){case 0:t=oa(null,t,r,e,n);break e;case 1:t=gu(null,t,r,e,n);break e;case 11:t=hu(null,t,r,e,n);break e;case 14:t=mu(null,t,r,zt(r.type,e),n);break e}throw Error(I(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:zt(r,l),oa(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:zt(r,l),gu(e,t,r,l,n);case 3:e:{if($d(t),e===null)throw Error(I(387));r=t.pendingProps,i=t.memoizedState,l=i.element,od(e,t),gs(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=wr(Error(I(423)),t),t=yu(e,t,r,n,l);break e}else if(r!==l){l=wr(Error(I(424)),t),t=yu(e,t,r,n,l);break e}else for(mt=vn(t.stateNode.containerInfo.firstChild),gt=t,Se=!0,$t=null,n=id(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(yr(),r===l){t=rn(e,t,n);break e}rt(e,t,r,n)}t=t.child}return t;case 5:return ud(t),e===null&&ra(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Yi(r,l)?a=null:i!==null&&Yi(r,i)&&(t.flags|=32),Id(e,t),rt(e,t,a,n),t.child;case 6:return e===null&&ra(t),null;case 13:return Dd(e,t,n);case 4:return Ja(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vr(t,null,r,n):rt(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:zt(r,l),hu(e,t,r,l,n);case 7:return rt(e,t,t.pendingProps,n),t.child;case 8:return rt(e,t,t.pendingProps.children,n),t.child;case 12:return rt(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,me(hs,r._currentValue),r._currentValue=a,i!==null)if(Ot(i.value,a)){if(i.children===l.children&&!ut.current){t=rn(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=Zt(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var y=d.pending;y===null?u.next=u:(u.next=y.next,y.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),la(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(I(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),la(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}rt(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,fr(t,n),l=Ct(l),r=r(l),t.flags|=1,rt(e,t,r,n),t.child;case 14:return r=t.type,l=zt(r,t.pendingProps),l=zt(r.type,l),mu(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:zt(r,l),Xl(e,t),t.tag=1,ct(r)?(e=!0,ds(t)):e=!1,fr(t,n),Td(t,r,l),ia(t,r,l,n),ua(null,t,r,!0,e,n);case 19:return Ad(e,t,n);case 22:return zd(e,t,n)}throw Error(I(156,t.tag))};function Zd(e,t){return Cc(e,t)}function Ah(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 Nt(e,t,n,r){return new Ah(e,t,n,r)}function fo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oh(e){if(typeof e=="function")return fo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pa)return 11;if(e===La)return 14}return 2}function jn(e,t){var n=e.alternate;return n===null?(n=Nt(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 Yl(e,t,n,r,l,i){var a=2;if(r=e,typeof e=="function")fo(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Gn:return An(n.children,l,i,t);case Ta:a=8,l|=8;break;case Pi:return e=Nt(12,n,t,l|2),e.elementType=Pi,e.lanes=i,e;case Li:return e=Nt(13,n,t,l),e.elementType=Li,e.lanes=i,e;case Ri:return e=Nt(19,n,t,l),e.elementType=Ri,e.lanes=i,e;case uc:return As(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ac:a=10;break e;case oc:a=9;break e;case Pa:a=11;break e;case La:a=14;break e;case un:a=16,r=null;break e}throw Error(I(130,e==null?e:typeof e,""))}return t=Nt(a,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function An(e,t,n,r){return e=Nt(7,e,r,t),e.lanes=n,e}function As(e,t,n,r){return e=Nt(22,e,r,t),e.elementType=uc,e.lanes=n,e.stateNode={isHidden:!1},e}function ki(e,t,n){return e=Nt(6,e,null,t),e.lanes=n,e}function ji(e,t,n){return t=Nt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Mh(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=ni(0),this.expirationTimes=ni(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ni(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function po(e,t,n,r,l,i,a,o,u){return e=new Mh(e,t,n,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Nt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xa(i),e}function Fh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Jn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function ef(e){if(!e)return Nn;e=e._reactInternals;e:{if(Wn(e)!==e||e.tag!==1)throw Error(I(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ct(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(I(171))}if(e.tag===1){var n=e.type;if(ct(n))return ed(e,n,t)}return t}function tf(e,t,n,r,l,i,a,o,u){return e=po(n,r,!0,e,l,i,a,o,u),e.context=ef(null),n=e.current,r=lt(),l=kn(n),i=Zt(r,l),i.callback=t??null,xn(n,i,l),e.current.lanes=l,gl(e,l,r),dt(e,r),e}function Os(e,t,n,r){var l=t.current,i=lt(),a=kn(l);return n=ef(n),t.context===null?t.context=n:t.pendingContext=n,t=Zt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=xn(l,t,a),e!==null&&(At(e,l,a,i),Ql(e,l,a)),a}function Ns(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 Eu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ho(e,t){Eu(e,t),(e=e.alternate)&&Eu(e,t)}function Bh(){return null}var nf=typeof reportError=="function"?reportError:function(e){console.error(e)};function mo(e){this._internalRoot=e}Ms.prototype.render=mo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(I(409));Os(e,t,null,null)};Ms.prototype.unmount=mo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Un(function(){Os(null,e,null,null)}),t[tn]=null}};function Ms(e){this._internalRoot=e}Ms.prototype.unstable_scheduleHydration=function(e){if(e){var t=zc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<dn.length&&t!==0&&t<dn[n].priority;n++);dn.splice(n,0,e),n===0&&$c(e)}};function go(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Fs(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bu(){}function Uh(e,t,n,r,l){if(l){if(typeof r=="function"){var i=r;r=function(){var d=Ns(a);i.call(d)}}var a=tf(t,r,e,0,null,!1,!1,"",bu);return e._reactRootContainer=a,e[tn]=a.current,ll(e.nodeType===8?e.parentNode:e),Un(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var o=r;r=function(){var d=Ns(u);o.call(d)}}var u=po(e,0,!1,null,null,!1,!1,"",bu);return e._reactRootContainer=u,e[tn]=u.current,ll(e.nodeType===8?e.parentNode:e),Un(function(){Os(t,u,n,r)}),u}function Bs(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=Ns(a);o.call(u)}}Os(t,a,e,l)}else a=Uh(n,t,e,l,r);return Ns(a)}Lc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ar(t.pendingLanes);n!==0&&(Ia(t,n|1),dt(t,Le()),!(oe&6)&&(kr=Le()+500,En()))}break;case 13:Un(function(){var r=nn(e,1);if(r!==null){var l=lt();At(r,e,1,l)}}),ho(e,1)}};$a=function(e){if(e.tag===13){var t=nn(e,134217728);if(t!==null){var n=lt();At(t,e,134217728,n)}ho(e,134217728)}};Rc=function(e){if(e.tag===13){var t=kn(e),n=nn(e,t);if(n!==null){var r=lt();At(n,e,t,r)}ho(e,t)}};zc=function(){return de};Ic=function(e,t){var n=de;try{return de=e,t()}finally{de=n}};Ui=function(e,t,n){switch(t){case"input":if($i(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=Ls(r);if(!l)throw Error(I(90));dc(r),$i(r,l)}}}break;case"textarea":pc(e,n);break;case"select":t=n.value,t!=null&&or(e,!!n.multiple,t,!1)}};wc=oo;kc=Un;var Hh={usingClientEntryPoint:!1,Events:[vl,tr,Ls,vc,xc,oo]},zr={findFiberByHostInstance:Rn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Wh={bundleType:zr.bundleType,version:zr.version,rendererPackageName:zr.rendererPackageName,rendererConfig:zr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ln.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Nc(e),e===null?null:e.stateNode},findFiberByHostInstance:zr.findFiberByHostInstance||Bh,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 Ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ol.isDisabled&&Ol.supportsFiber)try{Es=Ol.inject(Wh),Qt=Ol}catch{}}vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hh;vt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!go(t))throw Error(I(200));return Fh(e,t,null,n)};vt.createRoot=function(e,t){if(!go(e))throw Error(I(299));var n=!1,r="",l=nf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=po(e,1,!1,null,null,n,!1,r,l),e[tn]=t.current,ll(e.nodeType===8?e.parentNode:e),new mo(t)};vt.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(I(188)):(e=Object.keys(e).join(","),Error(I(268,e)));return e=Nc(t),e=e===null?null:e.stateNode,e};vt.flushSync=function(e){return Un(e)};vt.hydrate=function(e,t,n){if(!Fs(t))throw Error(I(200));return Bs(null,e,t,!0,n)};vt.hydrateRoot=function(e,t,n){if(!go(e))throw Error(I(405));var r=n!=null&&n.hydratedSources||null,l=!1,i="",a=nf;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=tf(t,null,e,1,n??null,l,!1,i,a),e[tn]=t.current,ll(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 Ms(t)};vt.render=function(e,t,n){if(!Fs(t))throw Error(I(200));return Bs(null,e,t,!1,n)};vt.unmountComponentAtNode=function(e){if(!Fs(e))throw Error(I(40));return e._reactRootContainer?(Un(function(){Bs(null,null,e,!1,function(){e._reactRootContainer=null,e[tn]=null})}),!0):!1};vt.unstable_batchedUpdates=oo;vt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Fs(n))throw Error(I(200));if(e==null||e._reactInternals===void 0)throw Error(I(38));return Bs(e,t,n,!1,r)};vt.version="18.3.1-next-f1338f8080-20240426";function rf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rf)}catch(e){console.error(e)}}rf(),rc.exports=vt;var Vh=rc.exports,lf,Tu=Vh;lf=Tu.createRoot,Tu.hydrateRoot;async function Re(e,t){const n=await fetch(e,t);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}async function Pu(){return Re("/api/archives")}async function Lu(e,t=null){const n=t?`/api/archives/${e}/entries?collection=${encodeURIComponent(t)}`:`/api/archives/${e}/entries`;return Re(n)}async function Qh(e,t,n,r=null){const l=new URLSearchParams;return t&&l.set("q",t),n&&l.set("tag",n),r&&l.set("collection",r),Re(`/api/archives/${e}/entries/search?${l}`)}async function Mr(e,t){return Re(`/api/archives/${e}/entries/${t}`)}async function qh(e,t,{signal:n}={}){return Re(`/api/archives/${e}/entries/${t}/summary`,{signal:n})}async function Kh(e,t,{provider:n,force:r=!1,includeImages:l=!1,signal:i}={}){const a=await fetch(`/api/archives/${e}/entries/${t}/summary`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,force:r,include_images:l}),signal:i});if(!a.ok){const o=await a.text();let u=o.trim();try{u=JSON.parse(o).error||u}catch{}throw new Error(u||`Summary request failed (${a.status})`)}return a.json()}async function Xh(e,{signal:t}={}){const n=await fetch(e,{credentials:"same-origin",signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.text()}async function Jh(e,t){return Re(`/api/archives/${e}/entries/${t}/children`)}function Gh(e,t,n){return Promise.all(n.map(r=>Re(`/api/archives/${e}/entries/${t}/artifacts/${r}`)))}async function Yh(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 Zh(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 Ml(e,t){return Re(`/api/archives/${e}/entries/${t}/tags`)}async function Ru(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 em(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 zu(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 tm(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 nm(e,t){const n=await fetch(`/api/archives/${e}/tags/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(await n.text())}async function rm(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 lm(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 Si(e){return Re(`/api/archives/${e}/runs`)}async function Fl(e){return Re(`/api/archives/${e}/tags`)}async function sm(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(()=>({})),o=new Error(a.error||`HTTP ${i.status}`);throw o.status=i.status,o}return i.json()}async function im(e,{title:t,body:n,mime:r="text/markdown"}){const l={title:t,body:n};r&&r!=="text/markdown"&&(l.mime=r);const i=await fetch(`/api/archives/${e}/captures/text`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!i.ok){const a=await i.json().catch(()=>({})),o=new Error(a.error||`HTTP ${i.status}`);throw o.status=i.status,o}return i.json()}async function am(e,t){return Re(`/api/archives/${e}/captures/probe?locator=${encodeURIComponent(t)}`)}async function om(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 sf(e,t){return Re(`/api/archives/${e}/capture_jobs/${t}`)}async function um(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function cm(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 dm(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 fm(){await fetch("/api/auth/logout",{method:"POST"})}async function pm(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function hm(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 mm(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 gm(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 ym(){return Re("/api/auth/tokens")}async function vm(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 xm(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function yo(){return Re("/api/admin/instance-settings")}async function Zl(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 wm(){return Re("/api/admin/users")}async function km(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 jm(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 Sm(){return Re("/api/admin/roles")}async function Nm(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 vo(e){return Re(`/api/archives/${e}/collections`)}async function _m(e,t,n,r=2,l=!0){const i=await fetch(`/api/archives/${e}/collections`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,slug:n,default_visibility_bits:r,requires_auth:l})});if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||i.statusText)}return i.json()}async function Cm(e,t){return Re(`/api/archives/${e}/collections/${t}`)}async function ka(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 Em(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 bm(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 Iu(e,t){return Re(`/api/archives/${e}/entries/${t}/collections`)}async function Ni(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 Tm(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 Pm(e){return Re(`/api/archives/${e}/blob-cleanup`)}async function Lm(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 zm(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/artifacts/${n}/media-token`,{method:"POST"});if(!r.ok)throw new Error(`media-token ${r.status}`);return r.json()}async function Im(){return Re("/api/admin/cookie-rules")}async function $m(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 Dm(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}`)}}function Om(e,t,n){let r;return{promise:new Promise((i,a)=>{const o=new FormData;o.append("file",t),r=new XMLHttpRequest,r.open("POST",`/api/archives/${e}/uploads`),r.upload.addEventListener("progress",u=>{u.lengthComputable&&n&&n(Math.round(u.loaded/u.total*100))}),r.addEventListener("load",()=>{if(r.status>=200&&r.status<300)try{i(JSON.parse(r.responseText))}catch{a(new Error("Invalid server response"))}else{let u=`Upload failed (${r.status})`;try{u=JSON.parse(r.responseText).message||u}catch{}a(new Error(u))}}),r.addEventListener("error",()=>a(new Error("Network error during upload"))),r.addEventListener("abort",()=>a(new Error("Upload cancelled"))),r.send(o)}),abort:()=>r==null?void 0:r.abort()}}async function _i(e,t){try{await fetch(`/api/archives/${e}/uploads`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({locator:t})})}catch{}}const Mm=window.fetch;window.fetch=async(...e)=>{var n;const t=await Mm(...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 Fm({onLogin:e}){const[t,n]=c.useState(""),[r,l]=c.useState(""),[i,a]=c.useState(null),[o,u]=c.useState(!1);async function d(y){y.preventDefault(),a(null),u(!0);try{const g=await dm(t,r);e(g)}catch(g){a(g.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:d,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 Bm({onComplete:e}){const[t,n]=c.useState(""),[r,l]=c.useState(""),[i,a]=c.useState(""),[o,u]=c.useState(null),[d,y]=c.useState(!1);async function g(h){if(h.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 cm(t,r),e()}catch(v){u(v.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:g,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:h=>n(h.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:h=>l(h.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:h=>a(h.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:d,children:d?"Creating account…":"Create account"})]})]})})}function Um({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i,collections:a,selectedCollectionUid:o,onCollectionChange:u,isPublicSession:d,onSignInClick:y}){const{currentUser:g,setCurrentUser:h}=c.useContext(Hs)??{},[v,x]=c.useState(!1);async function S(){x(!0),await fm(),h(null),window.location.reload()}const N=a.find(m=>m.slug==="_default_"),p=!d||!!N&&!N.requires_auth,f=a.filter(m=>m.slug!=="_default_").filter(m=>!d||!m.requires_auth);return s.jsxs("header",{className:"topbar",children:[s.jsx("div",{className:"brand",children:"Archivr"}),s.jsxs("div",{className:"switchers",children:[!d&&s.jsx("div",{className:"switcher",children:s.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>s.jsx("option",{value:m.id,children:m.label},m.id))})}),f.length>0&&s.jsx("div",{className:"switcher",children:s.jsxs("select",{"aria-label":"Select collection",value:o??"",onChange:m=>u(m.target.value||null),children:[p&&s.jsx("option",{value:"",children:"All entries"}),f.map(m=>s.jsx("option",{value:m.collection_uid,children:m.name},m.collection_uid))]})})]}),d?s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{flex:1}}),s.jsx("button",{className:"logout-btn",onClick:y,children:"Sign in"})]}):s.jsxs(s.Fragment,{children:[s.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","tags","collections","runs","admin","settings"].map(m=>s.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),s.jsx("button",{className:"capture-button",onClick:i,children:"Capture"}),g&&s.jsxs("div",{className:"user-menu",children:[s.jsx("span",{className:"user-name",children:g.display_name||g.username}),s.jsx("button",{className:"logout-btn",onClick:S,disabled:v,children:v?"Logging out…":"Log out"})]})]})]})}let pl=1;function af(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/")||/^[a-z0-9_-]{11}$/i.test(l))}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 $n(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("spotify:")){const r=n.slice(8);return r.startsWith("album:")||r.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")||l==="open.spotify.com"&&(r.pathname.startsWith("/album/")||r.pathname.startsWith("/playlist/")))return!0}catch{}return!1}function Xn(e=""){return{id:pl++,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 Hm(e){return{id:pl++,kind:"file",filename:e,uploadProgress:0,uploadStatus:"uploading",uploadLocator:null,uploadError:null,locator:"",quality:"best",probeState:"idle",probeQualities:null,probeHasAudio:!1,playlistProbeState:"idle",playlistInfo:null,playlistItems:null,playlistQuality:null,playlistExpanded:!1,syncEnabled:!1,error:null,status:"idle"}}function Wm(){return{id:pl++,kind:"text",title:"",body:"",mime:"text/markdown",locator:"",quality:"best",probeState:"idle",probeQualities:null,probeHasAudio:!1,playlistProbeState:"idle",playlistInfo:null,playlistItems:null,playlistQuality:null,playlistExpanded:!1,syncEnabled:!1,error:null,status:"idle"}}function Vm(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 $u(e){return Array.isArray(e.playlistItems)&&e.playlistItems.some(t=>t.quality===null)}function Qm({open:e,archiveId:t,onClose:n,onCaptured:r,onToast:l,onJobStarted:i,onJobSettled:a,activeJobs:o=[]}){const u=c.useRef(null),d=c.useRef(!0),y=c.useRef(new Map),g=c.useRef(new Map),h=c.useRef(new Map),v=c.useRef(t);c.useEffect(()=>{v.current=t},[t]);const x=c.useRef(null),[S,N]=c.useState(!1),p=c.useRef([]),f=c.useRef(!1),m=c.useRef(new Map),k=c.useRef(r),C=c.useRef(l);c.useEffect(()=>{k.current=r},[r]),c.useEffect(()=>{C.current=l},[l]);const E=c.useRef(i),T=c.useRef(a);c.useEffect(()=>{E.current=i},[i]),c.useEffect(()=>{T.current=a},[a]);const[j,P]=c.useState(()=>{try{const w=JSON.parse(sessionStorage.getItem("captureItems")||"null");if(Array.isArray(w)&&w.length>0){const U=w.filter(O=>!O.status||O.status==="idle");if(U.length>0)return U.forEach(O=>{O.id>=pl&&(pl=O.id+1)}),U.map(O=>({...Xn(O.locator),...O}))}}catch{}return[Xn()]});c.useEffect(()=>{sessionStorage.setItem("captureItems",JSON.stringify(j.filter(w=>w.kind!=="file")))},[j]),c.useEffect(()=>{p.current=j},[j]);const[z,J]=c.useState(!1),[H,Y]=c.useState(null),[ne,fe]=c.useState(null),[Fe,we]=c.useState(!0),[A,L]=c.useState(!0),[Q,V]=c.useState(!0);c.useEffect(()=>{yo().then(w=>{fe(w),we(w.cookie_ext_enabled??!0),L(w.modal_closer_enabled??!0)}).catch(()=>fe({}))},[]);const ee=H!==null?H:(ne==null?void 0:ne.ublock_enabled)??!0,[Ie,te]=c.useState(!1);c.useEffect(()=>{["captureDialogLocator","captureDialogError","captureDialogBusy","captureDialogJobStatus","captureDialogJobUid"].forEach(w=>sessionStorage.removeItem(w)),o.forEach(w=>{w.jobUid&&!y.current.has(w.jobUid)&&Ne(w.id,w.jobUid,w.locator,w.archiveId,null)})},[]),c.useEffect(()=>{const w=u.current;if(!w)return;const U=()=>{if(g.current.forEach(O=>clearTimeout(O)),g.current.clear(),!f.current){const O=v.current;p.current.forEach($=>{var F;$.kind==="file"&&($.uploadStatus==="uploading"?((F=m.current.get($.id))==null||F(),m.current.delete($.id)):$.uploadStatus==="done"&&$.uploadLocator&&_i(O,$.uploadLocator).catch(()=>{}))})}f.current=!1,n()};return w.addEventListener("close",U),()=>w.removeEventListener("close",U)},[n]),c.useEffect(()=>{const w=u.current;w&&(e?(d.current||P([Xn()]),d.current=!1,w.open||w.showModal()):(g.current.forEach(U=>clearTimeout(U)),g.current.clear(),w.open&&w.close()))},[e]),c.useEffect(()=>()=>{y.current.forEach(w=>clearInterval(w)),g.current.forEach(w=>clearTimeout(w))},[]);function Ne(w,U,O,$,F=null){if(y.current.has(U))return;const B=setInterval(async()=>{var ge,ce,je,pe;try{const Ue=await sf($,U);if(Ue.status==="completed"){clearInterval(y.current.get(U)),y.current.delete(U),await Promise.resolve((ge=k.current)==null?void 0:ge.call(k)),(ce=T.current)==null||ce.call(T,w);try{const ie=Ue.notes_json?JSON.parse(Ue.notes_json):null;if(ie!=null&&ie.ublock_skipped||ie!=null&&ie.cookie_ext_skipped){const wt=ie.ublock_skipped&&ie.cookie_ext_skipped?"Captured without ad-blocking or cookie-consent extension. Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config.":ie.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.";C.current(wt,O,"warning"),ue(F,"warning",O)}else F||C.current(null,O,"success"),ue(F,"archived")}catch{F||C.current(null,O,"success"),ue(F,"archived")}}else if(Ue.status==="failed"){clearInterval(y.current.get(U)),y.current.delete(U),(je=T.current)==null||je.call(T,w);const ie=Ue.error_text||"Capture failed.";C.current(ie,O),ue(F,"failed",O)}}catch(Ue){clearInterval(y.current.get(U)),y.current.delete(U),(pe=T.current)==null||pe.call(T,w);const ie=Ue.message||"Network error";C.current(ie,O),ue(F,"failed",O)}},500);y.current.set(U,B)}function ue(w,U,O=null){if(!w)return;const $=h.current.get(w);if(!$||(U==="archived"||U==="warning"?($.archived++,U==="warning"&&($.warnings++,O&&$.warningLocators.push(O))):($.failed++,O&&$.failedLocators.push(O)),$.archived+$.failed<$.total))return;h.current.delete(w);const{archived:F,warnings:B,failed:ge,failedLocators:ce,warningLocators:je}=$;let pe;if(F===0)pe=`${ge} failed`;else{const wt=B>0?`${F} archived (${B} with warnings)`:`${F} archived`;pe=ge>0?`${wt}, ${ge} failed`:wt}const Ue=F===0?"error":ge>0||B>0?"warning":"success",ie=[];ce.length>0&&ie.push(`Failed:
${ce.map(wt=>` ${wt}`).join(`
`)}`),je.length>0&&ie.push(`With warnings:
${je.map(wt=>` ${wt}`).join(`
`)}`);const ft=ie.length>0?ie.join(`
`):null;C.current(ft,null,Ue,pe)}async function be(w,U){var je,pe,Ue;const O=v.current,$=((je=crypto.randomUUID)==null?void 0:je.call(crypto))??`job-${Date.now()}-${Math.random()}`;if(w.type==="text"){try{const ie=await im(O,{title:w.title,body:w.body,mime:w.mime}),ft=`text:${w.title}`;(pe=E.current)==null||pe.call(E,{id:$,jobUid:ie.job_uid,locator:ft,archiveId:O}),Ne($,ie.job_uid,ft,O,U)}catch(ie){const ft=ie.message||"Submission failed.";C.current(ft,`text:${w.title}`),ue(U,"failed",`text:${w.title}`)}return}const F=w.locator,B=w.quality,ge=w.extraExtensions||{},ce={ublock_enabled:ee,reader_mode:Ie,cookie_ext_enabled:Fe,modal_closer_enabled:A,via_freedium:Q,...ge};try{const ie=await sm(O,F,B,ce);(Ue=E.current)==null||Ue.call(E,{id:$,jobUid:ie.job_uid,locator:F,archiveId:O}),Ne($,ie.job_uid,F,O,U)}catch(ie){const ft=ie.message||"Submission failed.";C.current(ft,F),ue(U,"failed",F),F.startsWith("file://")&&ie.status&&_i(O,F).catch(()=>{})}}function Mt(){var $,F;if(j.some(B=>B.kind==="file"&&B.uploadStatus==="uploading"))return;const w=j.filter(B=>B.kind==="file"?B.uploadStatus==="done"&&B.uploadLocator:B.kind==="text"?B.title.trim()&&B.body.trim():B.locator.trim());if(w.length===0||w.some(B=>B.kind!=="file"&&B.kind!=="text"&&$u(B))||w.some(B=>B.kind!=="file"&&B.kind!=="text"&&(B.probeState==="probing"||$n(B.locator)&&B.playlistProbeState!=="done"))||w.some(B=>B.kind!=="file"&&B.kind!=="text"&&Array.isArray(B.playlistItems)&&B.playlistItems.length===0))return;const U=w.length>1?(($=crypto.randomUUID)==null?void 0:$.call(crypto))??`batch-${Date.now()}`:null;U&&h.current.set(U,{total:w.length,archived:0,warnings:0,failed:0,failedLocators:[],warningLocators:[]});const O=w.map(B=>B.kind==="file"?{type:"file",locator:B.uploadLocator,quality:"best",extraExtensions:{}}:B.kind==="text"?{type:"text",title:B.title.trim(),body:B.body.trim(),mime:B.mime}:{type:"url",locator:B.locator.trim(),quality:B.playlistItems!==null?null:B.quality||"best",extraExtensions:B.playlistItems!==null?{per_item_quality:Object.fromEntries(B.playlistItems.map(ge=>[ge.id,ge.quality])),sync:B.syncEnabled}:{}});f.current=!0,P([Xn()]),(F=u.current)==null||F.close(),O.forEach(B=>be(B,U))}function Ft(){P(w=>[...w,Xn()])}function bt(w){var O;clearTimeout(g.current.get(w)),g.current.delete(w);const U=p.current.find($=>$.id===w);(U==null?void 0:U.kind)==="file"&&(U.uploadStatus==="uploading"?((O=m.current.get(w))==null||O(),m.current.delete(w)):U.uploadStatus==="done"&&U.uploadLocator&&_i(v.current,U.uploadLocator).catch(()=>{})),P($=>{const F=$.filter(B=>B.id!==w);return F.length===0?[Xn()]:F})}function Ve(w,U){if(clearTimeout(g.current.get(w)),P(O=>O.map($=>$.id===w?{...$,locator:U,probeState:"idle",probeQualities:null,probeHasAudio:!1,quality:"best",playlistProbeState:"idle",playlistInfo:null,playlistItems:null,playlistQuality:null,playlistExpanded:!1}:$)),af(U)){const O=setTimeout(async()=>{g.current.delete(w),P($=>$.map(F=>F.id===w?{...F,probeState:"probing"}:F));try{const $=await am(v.current,U.trim());P(F=>F.map(B=>{if(B.id!==w||B.locator!==U)return B;const ge=$.qualities??[],ce=$.has_audio??!1,je=ge.length===0&&ce?"audio":"best";return{...B,probeState:"done",probeQualities:ge,probeHasAudio:ce,quality:je}}))}catch{P($=>$.map(F=>F.id===w?{...F,probeState:"idle",probeQualities:null}:F))}},600);g.current.set(w,O)}else if($n(U)){const O=setTimeout(async()=>{g.current.delete(w),P($=>$.map(F=>F.id===w?{...F,playlistProbeState:"probing"}:F));try{const $=await om(v.current,U.trim());P(F=>F.map(B=>B.id!==w||B.locator!==U?B:{...B,playlistProbeState:"done",playlistInfo:$,playlistItems:$.items.map(ge=>({...ge,quality:null})),playlistQuality:null}))}catch{P($=>$.map(F=>F.id===w?{...F,playlistProbeState:"error"}:F))}},800);g.current.set(w,O)}}function nt(w,U){P(O=>O.map($=>$.id===w?{...$,quality:U}:$))}function Je(w,U){P(O=>O.map($=>{if($.id!==w)return $;const F=Vm(U,$.playlistItems);return{...$,playlistQuality:U,playlistItems:F}}))}function Be(w,U,O){P($=>$.map(F=>F.id!==w?F:{...F,playlistItems:F.playlistItems.map(B=>B.id===U?{...B,quality:O}:B)}))}function Tt(w){P(U=>U.map(O=>O.id===w?{...O,playlistExpanded:!O.playlistExpanded}:O))}function M(w,U){P(O=>O.map($=>$.id===w?{...$,syncEnabled:U}:$))}function X(w,U){P(O=>O.map($=>$.id!==w?$:{...$,playlistItems:$.playlistItems.filter(F=>F.id!==U)}))}function ke(w){const U=Array.from(w);U.length!==0&&U.forEach(O=>{const $=Hm(O.name);P(ce=>ce.length===1&&!ce[0].kind&&!ce[0].locator.trim()?[$]:[...ce,$]);const F=v.current,{promise:B,abort:ge}=Om(F,O,ce=>{P(je=>je.map(pe=>pe.id===$.id?{...pe,uploadProgress:ce}:pe))});m.current.set($.id,ge),B.then(ce=>{m.current.delete($.id),P(je=>je.map(pe=>pe.id===$.id?{...pe,uploadStatus:"done",uploadLocator:ce.locator,uploadProgress:100}:pe))}).catch(ce=>{m.current.delete($.id),ce.message!=="Upload cancelled"&&P(je=>je.map(pe=>pe.id===$.id?{...pe,uploadStatus:"error",uploadError:ce.message}:pe))})})}function Qe(w){w.preventDefault(),w.stopPropagation(),w.dataTransfer.types.includes("Files")&&N(!0)}function Pt(w){w.currentTarget.contains(w.relatedTarget)||N(!1)}function Ge(w){w.preventDefault(),w.stopPropagation(),N(!1),ke(w.dataTransfer.files)}function bn(w){ke(w.target.files),w.target.value=""}const Lt=j.some(w=>w.kind==="file"&&w.uploadStatus==="uploading"),Bt=j.filter(w=>w.kind==="file"?w.uploadStatus==="done"&&w.uploadLocator:w.kind==="text"?w.title.trim()&&w.body.trim():w.locator.trim()).length,$e=j.some(w=>w.kind!=="file"&&w.kind!=="text"&&$u(w)),Vn=j.some(w=>w.kind!=="file"&&w.kind!=="text"&&Array.isArray(w.playlistItems)&&w.playlistItems.length===0),Kt=j.some(w=>w.kind!=="file"&&w.kind!=="text"&&(w.probeState==="probing"||$n(w.locator)&&w.playlistProbeState!=="done"));return s.jsx("dialog",{ref:u,className:`capture-dialog${S?" capture-dialog--dragover":""}`,onDragOver:Qe,onDragLeave:Pt,onDrop:Ge,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 w;return(w=u.current)==null?void 0:w.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:j.map((w,U)=>w.kind==="file"?s.jsx(Km,{item:w,onRemove:()=>bt(w.id)},w.id):w.kind==="text"?s.jsx(Xm,{item:w,autoFocus:U===j.length-1,onTitleChange:O=>P($=>$.map(F=>F.id===w.id?{...F,title:O}:F)),onBodyChange:O=>P($=>$.map(F=>F.id===w.id?{...F,body:O}:F)),onMimeChange:O=>P($=>$.map(F=>F.id===w.id?{...F,mime:O}:F)),onRemove:()=>bt(w.id),onSubmit:Mt},w.id):s.jsx(qm,{item:w,autoFocus:U===j.length-1,onLocatorChange:O=>Ve(w.id,O),onQualityChange:O=>nt(w.id,O),onRemove:()=>bt(w.id),onSubmit:Mt,onPlaylistQualityChange:O=>Je(w.id,O),onPlaylistItemQualityChange:(O,$)=>Be(w.id,O,$),onPlaylistToggle:()=>Tt(w.id),onSyncChange:O=>M(w.id,O),onPlaylistItemDelete:O=>X(w.id,O)},w.id))}),s.jsx("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:bn,"aria-hidden":"true",tabIndex:-1}),s.jsxs("div",{className:"capture-add-row-group",children:[s.jsxs("button",{type:"button",className:"capture-add-row",onClick:Ft,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 URL"]}),s.jsxs("button",{type:"button",className:"capture-add-row capture-add-file",onClick:()=>{var w;return(w=x.current)==null?void 0:w.click()},children:[s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1.5"}),s.jsx("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"5.5"}),s.jsx("line",{x1:"5.5",y1:"8",x2:"10.5",y2:"8"}),s.jsx("line",{x1:"5.5",y1:"10.5",x2:"8.5",y2:"10.5"})]}),"Upload file"]}),s.jsxs("button",{type:"button",className:"capture-add-row capture-add-text",onClick:()=>P(w=>[...w,Wm()]),children:[s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M2 3h12M2 7h12M2 11h8"})}),"Add text"]})]}),s.jsxs("div",{className:"capture-advanced",children:[s.jsxs("button",{type:"button",className:"capture-advanced-toggle",onClick:()=>J(w=>!w),"aria-expanded":z,children:[s.jsx("svg",{className:`capture-chevron${z?" 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"]}),z&&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":ee,className:`ext-toggle ext-toggle--sm${ee?" ext-toggle--on":""}`,onClick:()=>Y(w=>w===null?!ee:!w),"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"}),!(ne!=null&&ne.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":Fe,className:`ext-toggle ext-toggle--sm${Fe?" ext-toggle--on":""}`,onClick:()=>we(w=>!w),"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":Ie,className:`ext-toggle ext-toggle--sm${Ie?" ext-toggle--on":""}`,onClick:()=>te(w=>!w),"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":A,className:`ext-toggle ext-toggle--sm${A?" ext-toggle--on":""}`,onClick:()=>L(w=>!w),"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":Q,className:`ext-toggle ext-toggle--sm${Q?" ext-toggle--on":""}`,onClick:()=>V(w=>!w),"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:Mt,disabled:Bt===0||$e||Kt||Vn||Lt,children:Bt>1?`Archive ${Bt}`:"Archive"}),s.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var w;return(w=u.current)==null?void 0:w.close()},children:"Cancel"})]})]})})}function qm({item:e,autoFocus:t,onLocatorChange:n,onQualityChange:r,onRemove:l,onSubmit:i,onPlaylistQualityChange:a,onPlaylistItemQualityChange:o,onPlaylistToggle:u,onSyncChange:d,onPlaylistItemDelete:y}){const g=c.useRef(null);c.useEffect(()=>{var x;t&&((x=g.current)==null||x.focus())},[t]);const h=(()=>{if($n(e.locator)){if(e.playlistProbeState==="probing")return s.jsx("span",{className:"capture-quality-probing","aria-label":"Probing playlist…",children:"…"});if(e.playlistProbeState==="done"){const x=[...new Set(e.playlistItems.flatMap(p=>p.qualities.map(f=>parseInt(f))))].sort((p,f)=>f-p),S=e.playlistItems.every(p=>p.has_audio),N=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"}),x.map(p=>s.jsxs("option",{value:`${p}p`,children:[p,"p"]},p)),S&&s.jsx("option",{value:"audio",children:"Audio only"})]}),N>0&&s.jsxs("span",{className:"capture-conflict-badge",children:[N," 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(!af(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 x=e.probeQualities??[],S=e.probeHasAudio??!1;return x.length===0&&!S?s.jsx("span",{className:"capture-quality-hint",children:"No media detected"}):x.length===0&&S?s.jsx("select",{className:"capture-quality",value:"audio",onChange:N=>r(N.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:N=>r(N.target.value),"aria-label":"Video quality",children:[s.jsx("option",{value:"best",children:"Best quality"}),x.map(N=>s.jsx("option",{value:N,children:N},N)),S&&s.jsx("option",{value:"audio",children:"Audio only"})]})}return null})(),v=$n(e.locator)&&e.playlistProbeState==="done"?s.jsxs("label",{className:"capture-sync-row",children:[s.jsx("input",{type:"checkbox",checked:e.syncEnabled,onChange:x=>d(x.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:[$n(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?"▲":"▼"}):null,s.jsx("input",{ref:g,className:"capture-input",type:"text",placeholder:"https://… · yt:ID · ytm:ID · tweet:ID · x:ID",value:e.locator,onChange:x=>n(x.target.value),onKeyDown:x=>{x.key==="Enter"&&i()},autoComplete:"off",spellCheck:!1}),h,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}),$n(e.locator)&&e.playlistProbeState==="done"&&e.playlistExpanded?s.jsxs("div",{className:"capture-playlist-items",children:[e.playlistItems.map(x=>s.jsxs("div",{className:`capture-playlist-item${x.quality===null?" capture-playlist-item--conflict":""}`,children:[s.jsx("span",{className:"capture-playlist-item-title",children:x.title||x.url}),s.jsxs("select",{className:"capture-item-quality",value:x.quality??"",onChange:S=>o(x.id,S.target.value),"aria-label":`Quality for ${x.title||x.url}`,children:[x.quality===null&&s.jsx("option",{value:"",disabled:!0,children:"Choose…"}),s.jsx("option",{value:"best",children:"Best quality"}),x.qualities.map(S=>s.jsx("option",{value:S,children:S},S)),x.has_audio&&s.jsx("option",{value:"audio",children:"Audio only"})]}),x.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 ${x.title||x.url}`,onClick:()=>y(x.id),children:"×"})]},x.id)),v]}):v]})}function Km({item:e,onRemove:t}){const n=e.uploadStatus==="uploading",r=e.uploadStatus==="done",l=e.uploadStatus==="error";return s.jsxs("div",{className:"capture-row",children:[s.jsxs("div",{className:"capture-row-main",children:[s.jsx("span",{className:"capture-file-icon","aria-hidden":"true",children:s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",style:{width:14,height:14},children:[s.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1.5"}),s.jsx("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"5.5"}),s.jsx("line",{x1:"5.5",y1:"8",x2:"10.5",y2:"8"}),s.jsx("line",{x1:"5.5",y1:"10.5",x2:"8.5",y2:"10.5"})]})}),s.jsx("span",{className:`capture-file-name${l?" capture-file-name--error":""}`,children:e.filename}),n&&s.jsxs("span",{className:"capture-file-progress-wrap","aria-label":`Uploading ${e.uploadProgress}%`,children:[s.jsx("span",{className:"capture-file-progress-bar",children:s.jsx("span",{className:"capture-file-progress-fill",style:{width:`${e.uploadProgress}%`}})}),s.jsxs("span",{className:"capture-file-progress-pct",children:[e.uploadProgress,"%"]})]}),r&&s.jsx("span",{className:"capture-file-badge capture-file-badge--done","aria-label":"Upload complete",children:s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{width:11,height:11},children:s.jsx("polyline",{points:"3 8.5 6.5 12 13 5"})})}),l&&s.jsx("span",{className:"capture-file-badge capture-file-badge--error",children:"!"}),s.jsx("button",{type:"button",className:"capture-row-action capture-row-remove",onClick:t,"aria-label":"Remove",disabled:n,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"})]})})]}),l&&s.jsx("p",{className:"capture-row-error",children:e.uploadError||"Upload failed"})]})}function Xm({item:e,autoFocus:t,onTitleChange:n,onBodyChange:r,onMimeChange:l,onRemove:i,onSubmit:a}){const o=c.useRef(null);return c.useEffect(()=>{var u;t&&((u=o.current)==null||u.focus())},[t]),s.jsx("div",{className:"capture-row capture-text-row",children:s.jsxs("div",{className:"capture-row-main",children:[s.jsx("span",{className:"capture-text-icon","aria-hidden":"true",children:s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",style:{width:14,height:14},children:s.jsx("path",{d:"M2 3h12M2 7h12M2 11h8"})})}),s.jsxs("div",{className:"capture-text-inputs",children:[s.jsx("input",{ref:o,className:"capture-text-input capture-text-title",type:"text",placeholder:"Title",value:e.title,onChange:u=>n(u.target.value),maxLength:500}),s.jsx("textarea",{className:"capture-text-input capture-text-body",placeholder:"Body (markdown or plain text)",value:e.body,onChange:u=>r(u.target.value),rows:6}),s.jsx("div",{className:"capture-text-footer",children:s.jsxs("select",{className:"capture-text-mime",value:e.mime,onChange:u=>l(u.target.value),children:[s.jsx("option",{value:"text/markdown",children:"Markdown"}),s.jsx("option",{value:"text/plain",children:"Plain text"})]})})]}),s.jsx("button",{type:"button",className:"capture-row-action capture-row-remove",onClick:i,"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"})]})})]})})}const Jm=["list=","/playlist/","/channel/","yt:playlist:","yt:channel:","ytm:playlist:","spotify:playlist:","spotify:album:"];function Gm(e){const t=e.toLowerCase();return Jm.some(n=>t.includes(n))}function Ym(e){return e.length>80?`${e.slice(0,79)}…`:e}function Zm({locator:e=""}){const t=String(e),n=Gm(t);return s.jsxs("div",{className:"in-progress-entry-row",role:"status","aria-live":"polite",children:[s.jsx("span",{className:"cap-spinner in-progress-entry-row__spinner","aria-hidden":"true"}),s.jsx("span",{className:"in-progress-entry-row__locator",title:t,children:Ym(t)}),s.jsxs("span",{className:"in-progress-entry-row__status",children:["Archiving…",n&&s.jsx("span",{className:"in-progress-entry-row__kind",children:"(playlist)"})]})]})}function hl(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 eg(e){return e&&e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&apos;/g,"'")}function ht(e){return eg(e)??""}function xo(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 Du={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 Us(e){return Du[e]??Du.other}function of(e){return e.split("/").map(t=>t?t.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"").join("/")}function tg({entry:e,index:t,onRowClick:n,selectedUids:r}){const l=(r==null?void 0:r.size)===1&&r.has(e.entry_uid),i=(r==null?void 0:r.size)>=2&&r.has(e.entry_uid),a=["child-entry-row",t%2===0?"child-entry-row--light":"child-entry-row--dark",l&&"is-selected",i&&"is-multi-selected"].filter(Boolean).join(" ");return s.jsxs("div",{className:a,tabIndex:0,"data-entry-uid":e.entry_uid,onMouseDown:o=>{o.shiftKey&&o.preventDefault()},onClick:o=>n(e,o),onKeyDown:o=>{o.key==="Enter"&&n(e,o)},children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:xo(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[s.jsx("span",{className:"source-icon",children:s.jsx("span",{dangerouslySetInnerHTML:{__html:Us(e.source_kind)}})}),s.jsx("span",{className:"entry-title",children:ht(e.title)||ht(e.entry_uid)})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"type-pill",children:ht(e.entity_kind)})}),s.jsx("div",{className:"col-size",children:s.jsx("span",{className:"size-total",children:hl(e.total_artifact_bytes)})}),s.jsx("div",{className:"url-cell col-url",children:ht(e.original_url)})]})}function ng({entry:e,archiveId:t,rowIndex:n,isSelected:r,isMultiSelected:l,onRowClick:i,selectedUids:a,deletedUids:o,isPublicSession:u}){const[d,y]=c.useState(!1),[g,h]=c.useState(!1),[v,x]=c.useState(null),[S,N]=c.useState(!1),f=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!d?s.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>y(!0),style:{objectFit:"contain"}}):s.jsx("span",{dangerouslySetInnerHTML:{__html:Us(e.source_kind)}}),m=r||l,k=e.child_count>0&&!u;function C(j){j.stopPropagation(),i(e,{ctrlKey:!0,metaKey:!1,shiftKey:!1,preventDefault(){}})}async function E(j){if(j.stopPropagation(),g){h(!1);return}if(h(!0),v===null&&!S){N(!0);try{const P=await Jh(t,e.entry_uid);x(P)}catch{x([])}finally{N(!1)}}}const T=["entry-row-outer",n%2===0?"entry-row-outer--light":"entry-row-outer--dark",r&&"is-selected",l&&"is-multi-selected"].filter(Boolean).join(" ");return s.jsxs("div",{className:T,"data-entry-uid":e.entry_uid,children:[s.jsxs("div",{className:"entry-row-main",tabIndex:0,onMouseDown:j=>{j.shiftKey&&j.preventDefault()},onClick:j=>i(e,j),onKeyDown:j=>{j.key==="Enter"&&i(e,j)},children:[s.jsx("div",{className:"col-check",children:s.jsx("button",{type:"button",className:`row-checkbox${m?" is-checked":""}`,"aria-pressed":m,"aria-label":m?"Deselect entry":"Select entry",onClick:C,onKeyDown:j=>j.stopPropagation()})}),s.jsx("div",{className:"col-added",children:xo(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[k&&s.jsx("button",{type:"button",className:`entry-expand-btn${g?" is-expanded":""}`,"aria-label":g?"Collapse children":`Expand ${e.child_count} items`,"aria-expanded":g,onClick:E,onKeyDown:j=>j.stopPropagation()}),s.jsx("span",{className:"source-icon",children:f}),s.jsx("span",{className:"entry-title",children:ht(e.title)||ht(e.entry_uid)}),k&&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:ht(e.entity_kind)})}),s.jsxs("div",{className:"col-size",children:[s.jsx("span",{className:"size-total",children:hl(e.total_artifact_bytes)}),e.cached_bytes>0&&e.cacheable_bytes>0&&s.jsxs("span",{className:"size-cached-pct",title:`${hl(e.cached_bytes)} already on disk from an earlier entry`,children:[Math.round(e.cached_bytes/e.cacheable_bytes*100),"% cached"]})]}),s.jsx("div",{className:"url-cell col-url",children:ht(e.original_url)})]}),g&&s.jsxs(s.Fragment,{children:[S&&s.jsx("div",{className:"child-entries-loading",children:"Loading…"}),s.jsx("div",{className:"child-entries","aria-label":`${e.child_count} child entries`,children:v&&v.filter(j=>!(o!=null&&o.has(j.entry_uid))).map((j,P)=>s.jsx(tg,{entry:j,index:P,onRowClick:i,selectedUids:a},j.entry_uid))})]})]})}function rg({entries:e,selectedUids:t,onRowClick:n,archiveId:r,pendingCaptures:l=[],deletedUids:i,isPublicSession:a}){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(o=>o.archiveId===r).reverse().map(o=>s.jsx(Zm,{locator:o.locator},o.id)),e.map((o,u)=>s.jsx(ng,{entry:o,rowIndex:u,archiveId:r,isSelected:t.size===1&&t.has(o.entry_uid),isMultiSelected:t.size>=2&&t.has(o.entry_uid),onRowClick:n,selectedUids:t,deletedUids:i,isPublicSession:a},o.entry_uid))]})]})})}function lg(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 sg({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 ig({runs:e}){const[t,n]=c.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:lg(l.started_at)}),s.jsxs("td",{children:[s.jsx(sg,{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 ag=4;function og({archives:e}){const{currentUser:t}=c.useContext(Hs)??{},n=t&&(t.role_bits&ag)!==0,[r,l]=c.useState("users"),[i,a]=c.useState([]),[o,u]=c.useState([]),[d,y]=c.useState(!1),[g,h]=c.useState(null),[v,x]=c.useState(""),[S,N]=c.useState(""),[p,f]=c.useState(""),[m,k]=c.useState(null),[C,E]=c.useState(!1),[T,j]=c.useState(""),[P,z]=c.useState(""),[J,H]=c.useState(null),[Y,ne]=c.useState(!1),fe=c.useCallback(async()=>{if(n){y(!0),h(null);try{const[L,Q]=await Promise.all([wm(),Sm()]);a(L),u(Q)}catch(L){h(L.message)}finally{y(!1)}}},[n]);c.useEffect(()=>{fe()},[fe]);async function Fe(L){const Q=L.status==="active"?"disabled":"active";try{await jm(L.user_uid,Q),a(V=>V.map(ee=>ee.user_uid===L.user_uid?{...ee,status:Q}:ee))}catch(V){h(V.message)}}async function we(L){if(L.preventDefault(),!v.trim()||!S){k("Username and password required");return}E(!0),k(null);try{await km(v.trim(),S,p.trim()||void 0),x(""),N(""),f(""),await fe()}catch(Q){k(Q.message)}finally{E(!1)}}async function A(L){if(L.preventDefault(),!T.trim()||!P.trim()){H("Slug and name required");return}ne(!0),H(null);try{await Nm(T.trim(),P.trim()),j(""),z(""),await fe()}catch(Q){H(Q.message)}finally{ne(!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"})]}),g&&s.jsx("div",{className:"form-msg form-msg--err",children:g}),r==="users"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Users"}),d?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(L=>s.jsxs("tr",{className:L.status==="disabled"?"admin-row-disabled":"",children:[s.jsx("td",{children:L.username}),s.jsx("td",{className:"muted",children:L.email||"—"}),s.jsx("td",{children:L.role_slugs.join(", ")||"—"}),s.jsx("td",{children:s.jsx("span",{className:`status-badge status-${L.status}`,children:L.status})}),s.jsx("td",{children:s.jsx("button",{className:"admin-action-btn",onClick:()=>Fe(L),children:L.status==="active"?"Ban":"Unban"})})]},L.user_uid))})]}),s.jsx("h3",{children:"Create User"}),s.jsxs("form",{className:"admin-form",onSubmit:we,children:[s.jsx("input",{className:"admin-input",placeholder:"Username",value:v,onChange:L=>x(L.target.value),required:!0}),s.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:S,onChange:L=>N(L.target.value),required:!0}),s.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:L=>f(L.target.value)}),m&&s.jsx("div",{className:"form-msg form-msg--err",children:m}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:C,children:C?"Creating…":"Create User"})]})]}),r==="roles"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Roles"}),d?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(L=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{children:L.slug})}),s.jsx("td",{children:L.name}),s.jsx("td",{children:L.level}),s.jsx("td",{children:L.bit_position}),s.jsx("td",{children:L.is_builtin?"✓":""})]},L.role_uid))})]}),s.jsx("h3",{children:"Create Custom Role"}),s.jsxs("form",{className:"admin-form",onSubmit:A,children:[s.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:T,onChange:L=>j(L.target.value),required:!0}),s.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:P,onChange:L=>z(L.target.value),required:!0}),J&&s.jsx("div",{className:"form-msg form-msg--err",children:J}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:Y,children:Y?"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(L=>s.jsxs("div",{className:"admin-archive",children:[s.jsx("strong",{children:L.label}),s.jsx("div",{className:"muted",children:L.archive_path})]},L.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(L=>s.jsxs("div",{className:"admin-archive",children:[s.jsx("strong",{children:L.label}),s.jsx("div",{className:"muted",children:L.archive_path})]},L.id))})]})}function uf({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(uf,{node:r,onPick:t},r.tag.tag_uid))})})]})}function Au({title:e,tagNodes:t,excludeUid:n,onPick:r,onCancel:l}){c.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(uf,{node:o,onPick:r},o.tag.tag_uid))}):s.jsx("p",{className:"tag-picker-empty",children:"No other tags available."})]})]})})}function cf({parentPath:e,archiveId:t,onDone:n,onCancel:r}){const[l,i]=c.useState(""),a=c.useRef(!1);async function o(){const u=l.trim();if(!u){r();return}const d=e?`${e}/${u}`:`/${u}`;try{await rm(t,d),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 df({node:e,archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u,moveSelectMode:d,onMoveSourceSelect:y,pendingCreateParentUid:g,onCreateDone:h,onCreateCancel:v}){var J;const x=n===e.tag.full_path,[S,N]=c.useState(!1),[p,f]=c.useState(""),m=c.useRef(!1);function k(){if(S)return;if(d){y(e);return}const H=x?null:e.tag.full_path;r(H),l("archive")}function C(H){H.stopPropagation(),!d&&(f(e.tag.slug),N(!0))}async function E(){const H=p.trim();if(!H||H===e.tag.slug){N(!1);return}try{const Y=await tm(t,e.tag.tag_uid,H);i(e.tag.full_path,Y.full_path),o()}catch{}finally{N(!1)}}async function T(H){var ne;H.stopPropagation();const Y=((ne=e.children)==null?void 0:ne.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(Y))try{await nm(t,e.tag.tag_uid),a(e.tag.full_path),o()}catch{}}const j={archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u,moveSelectMode:d,onMoveSourceSelect:y,pendingCreateParentUid:g,onCreateDone:h,onCreateCancel:v},P=g===e.tag.tag_uid,z=((J=e.children)==null?void 0:J.length)>0;return s.jsxs("li",{children:[s.jsxs("div",{className:`tag-node-row${d?" tag-node-row--move-select":""}`,children:[S?s.jsx("input",{className:"tag-rename-input",autoFocus:!0,value:p,onChange:H=>f(H.target.value),onKeyDown:H=>{H.key==="Enter"&&H.currentTarget.blur(),H.key==="Escape"&&(m.current=!0,H.currentTarget.blur())},onBlur:()=>{m.current?(m.current=!1,N(!1)):E()}}):s.jsxs("button",{className:`tag-node-btn${x?" is-active":""}${d?" tag-node-btn--move-select":""}`,title:d?`Select "${e.tag.full_path}" to move`:e.tag.full_path,onClick:k,onDoubleClick:d?void 0:C,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)`}),!d&&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:H=>{H.stopPropagation(),C(H)},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"})})]}),!S&&!d&&s.jsx("button",{className:"remove tag-node-delete",title:`Delete "${e.tag.full_path}"`,onClick:T,"aria-label":`Delete "${e.tag.full_path}"`,children:"×"})]}),(z||P)&&s.jsx("div",{className:"tag-children",children:s.jsxs("ul",{className:"tag-tree-list",children:[e.children.map(H=>s.jsx(df,{node:H,...j},H.tag.tag_uid)),P&&s.jsx("li",{children:s.jsx(cf,{parentPath:e.tag.full_path,archiveId:t,onDone:h,onCancel:v})})]})})]})}function ug({archiveId:e,tagNodes:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u}){const[d,y]=c.useState(null),[g,h]=c.useState(null);function v(){y("select-source"),h(null)}function x(){y(null),h(null)}c.useEffect(()=>{if(d!=="select-source")return;function Y(ne){ne.key==="Escape"&&(ne.preventDefault(),ne.stopPropagation(),x())}return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[d]);function S(Y){h(Y),y("select-dest")}async function N(Y){const ne=g.tag.full_path,fe=g.tag.tag_uid,Fe=(Y==null?void 0:Y.tag_uid)??null;x();try{const we=await lm(e,fe,Fe);i(ne,we.full_path),o()}catch(we){alert(we.message||"Move failed")}}const[p,f]=c.useState(null),[m,k]=c.useState(void 0);function C(){f("select-parent"),k(void 0)}function E(){f(null),k(void 0)}function T(Y){k(Y??null),f("input")}function j(){f(null),k(void 0),o()}const P=d==="select-source",z=p==="input"?m?m.tag_uid:"__root__":void 0,J={archiveId:e,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u,moveSelectMode:P,onMoveSourceSelect:S,pendingCreateParentUid:z,onCreateDone:j,onCreateCancel:E},H=z==="__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:P?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:x,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:C,title:"Create a new tag",disabled:!!p||!!d,children:"+ New"}),s.jsx("button",{className:"tag-tree-action-btn",onClick:v,title:"Move a tag to a different parent",disabled:!!p||!!d||t.length===0,children:"Move"})]})]})}),t.length===0&&!H?s.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):s.jsxs("ul",{className:"tag-tree-list",children:[t.map(Y=>s.jsx(df,{node:Y,...J},Y.tag.tag_uid)),H&&s.jsx("li",{children:s.jsx(cf,{parentPath:null,archiveId:e,onDone:j,onCancel:E})})]})]}),p==="select-parent"&&s.jsx(Au,{title:"Create tag under…",tagNodes:t,excludeUid:null,onPick:T,onCancel:E}),d==="select-dest"&&g&&s.jsx(Au,{title:`Move "${g.tag.slug}" under…`,tagNodes:t,excludeUid:g.tag.tag_uid,onPick:N,onCancel:x})]})}const Fr=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],cg=e=>{var t;return((t=Fr.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function dg({archiveId:e}){const[t,n]=c.useState([]),[r,l]=c.useState(!1),[i,a]=c.useState(null),[o,u]=c.useState(null),[d,y]=c.useState(null),[g,h]=c.useState(!1),[v,x]=c.useState(null),[S,N]=c.useState(""),[p,f]=c.useState(""),[m,k]=c.useState(2),[C,E]=c.useState(!1),[T,j]=c.useState(!0),[P,z]=c.useState(null),[J,H]=c.useState(""),[Y,ne]=c.useState(2),[fe,Fe]=c.useState(!1),[we,A]=c.useState(null),[L,Q]=c.useState(!1),[V,ee]=c.useState(""),Ie=c.useRef(null),te=t.find(M=>M.collection_uid===o)??null,Ne=(te==null?void 0:te.slug)==="_default_",ue=c.useCallback(async()=>{if(e){l(!0),a(null);try{const M=await vo(e);n(M)}catch(M){a(M.message)}finally{l(!1)}}},[e]),be=c.useCallback(async M=>{if(!M){y(null);return}h(!0),x(null);try{const X=await Cm(e,M);y(X)}catch(X){x(X.message)}finally{h(!1)}},[e]);c.useEffect(()=>{ue()},[ue]),c.useEffect(()=>{be(o)},[o,be]),c.useEffect(()=>{L&&Ie.current&&Ie.current.focus()},[L]),c.useEffect(()=>{d!=null&&ne(d.default_visibility_bits)},[d]);async function Mt(M){M.preventDefault();const X=S.trim(),ke=p.trim();if(!(!X||!ke)){E(!0),z(null);try{const Qe=await _m(e,X,ke,m,T);N(""),f(""),k(2),j(!0),await ue(),u(Qe.collection_uid)}catch(Qe){z(Qe.message)}finally{E(!1)}}}async function Ft(){const M=V.trim();if(!M||!te){Q(!1);return}try{await Ni(e,te.collection_uid,{name:M}),await ue(),y(X=>X&&{...X,name:M})}catch(X){a(X.message)}finally{Q(!1)}}async function bt(M){if(te)try{await Ni(e,te.collection_uid,{default_visibility_bits:M}),await ue(),y(X=>X&&{...X,default_visibility_bits:M})}catch(X){a(X.message)}}async function Ve(M){if(te)try{await Ni(e,te.collection_uid,{requires_auth:M}),await ue(),y(X=>X&&{...X,requires_auth:M})}catch(X){a(X.message)}}async function nt(){if(te&&window.confirm(`Delete collection "${te.name}"? Entries will not be deleted.`))try{await Tm(e,te.collection_uid),u(null),y(null),await ue()}catch(M){a(M.message)}}async function Je(M){M.preventDefault();const X=J.trim();if(!(!X||!te)){Fe(!0),A(null);try{await ka(e,te.collection_uid,X,Y),H(""),await be(te.collection_uid)}catch(ke){A(ke.message)}finally{Fe(!1)}}}async function Be(M){if(te)try{await Em(e,te.collection_uid,M),await be(te.collection_uid)}catch(X){x(X.message)}}async function Tt(M,X){if(te)try{await bm(e,te.collection_uid,M,X),y(ke=>ke&&{...ke,entries:ke.entries.map(Qe=>Qe.entry_uid===M?{...Qe,collection_visibility_bits:X}:Qe)})}catch(ke){x(ke.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(M=>s.jsxs("button",{className:`coll-sidebar-row${o===M.collection_uid?" is-active":""}`,onClick:()=>u(M.collection_uid),children:[s.jsx("span",{className:"coll-row-name",children:M.name}),s.jsx("span",{className:"coll-row-meta",children:cg(M.default_visibility_bits)})]},M.collection_uid)),t.length===0&&!r&&s.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),te?s.jsxs("div",{className:"coll-detail",children:[s.jsxs("div",{className:"coll-detail-header",children:[L?s.jsx("input",{ref:Ie,className:"coll-rename-input",value:V,onChange:M=>ee(M.target.value),onBlur:Ft,onKeyDown:M=>{M.key==="Enter"&&Ft(),M.key==="Escape"&&Q(!1)}}):s.jsxs("h3",{className:`coll-detail-name${Ne?"":" coll-detail-name--editable"}`,title:Ne?void 0:"Click to rename",onClick:()=>{Ne||(ee(te.name),Q(!0))},children:[(d==null?void 0:d.name)??te.name,!Ne&&s.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!Ne&&s.jsx("button",{className:"coll-delete-btn",onClick:nt,title:"Delete collection",children:"Delete"})]}),s.jsxs("div",{className:"coll-detail-vis",children:[s.jsx("span",{className:"coll-vis-label",children:"Entries' default visibility"}),s.jsx("select",{className:"coll-vis-select",value:(d==null?void 0:d.default_visibility_bits)??te.default_visibility_bits,onChange:M=>bt(Number(M.target.value)),children:Fr.map(M=>s.jsx("option",{value:M.value,children:M.label},M.value))})]}),s.jsxs("div",{className:"coll-detail-vis",children:[s.jsx("span",{className:"coll-vis-label",children:"Collection access"}),s.jsxs("label",{className:"coll-auth-label",children:[s.jsx("input",{type:"checkbox",checked:!!((d==null?void 0:d.requires_auth)??te.requires_auth),onChange:M=>Ve(M.target.checked)})," Require authentication to view"]})]}),s.jsxs("div",{className:"coll-entries-section",children:[s.jsx("div",{className:"coll-section-heading",children:"Entries"}),g&&s.jsx("div",{className:"muted",children:"Loading…"}),v&&s.jsx("div",{className:"collections-error",children:v}),!g&&d&&(d.entries.length===0?s.jsx("div",{className:"muted",children:"No entries in this collection."}):s.jsx("ul",{className:"coll-entries-list",children:d.entries.map(M=>s.jsxs("li",{className:"coll-entry-row",children:[s.jsxs("div",{className:"coll-entry-info",children:[s.jsx("span",{className:"coll-entry-title",children:M.title||M.entry_uid}),s.jsx("span",{className:"coll-entry-kind muted",children:M.source_kind})]}),s.jsxs("div",{className:"coll-entry-actions",children:[s.jsx("select",{className:"coll-entry-vis-select",value:M.collection_visibility_bits,onChange:X=>Tt(M.entry_uid,Number(X.target.value)),children:Fr.map(X=>s.jsx("option",{value:X.value,children:X.label},X.value))}),!Ne&&s.jsx("button",{className:"coll-entry-remove",onClick:()=>Be(M.entry_uid),title:"Remove from collection",children:"×"})]})]},M.entry_uid))}))]}),!Ne&&s.jsxs("form",{className:"coll-add-entry-form",onSubmit:Je,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:J,onChange:M=>H(M.target.value),placeholder:"entry_uid",required:!0}),s.jsx("select",{className:"coll-vis-select",value:Y,onChange:M=>ne(Number(M.target.value)),children:Fr.map(M=>s.jsx("option",{value:M.value,children:M.label},M.value))}),s.jsx("button",{className:"coll-add-btn",type:"submit",disabled:fe,children:fe?"…":"Add"})]}),we&&s.jsx("div",{className:"collections-error",style:{marginTop:4},children:we})]})]}):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:Mt,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:S,onChange:M=>{N(M.target.value),p||f(M.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:M=>f(M.target.value),placeholder:"my-collection",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Entries' default visibility"}),s.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:m,onChange:M=>k(Number(M.target.value)),children:Fr.map(M=>s.jsx("option",{value:M.value,children:M.label},M.value))})]}),s.jsx("div",{className:"form-field",children:s.jsxs("label",{className:"form-label",children:[s.jsx("input",{type:"checkbox",checked:T,onChange:M=>j(M.target.checked)})," Require authentication to view"]})}),P&&s.jsx("div",{className:"collections-error",children:P}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:C,children:C?"Creating…":"Create collection"})]})]})]}):s.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const fg=4;function pg({tab:e,onTabChange:t,archiveId:n}){const{currentUser:r,setCurrentUser:l}=c.useContext(Hs)??{},i=r&&(r.role_bits&fg)!==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(hg,{currentUser:r,setCurrentUser:l}),e==="tokens"&&s.jsx(mg,{}),e==="instance"&&i&&s.jsx(gg,{}),e==="cookies"&&i&&s.jsx(vg,{}),e==="extensions"&&i&&s.jsx(xg,{}),e==="storage"&&i&&s.jsx(yg,{archiveId:n})]})}function hg({currentUser:e,setCurrentUser:t}){const[n,r]=c.useState((e==null?void 0:e.display_name)??""),[l,i]=c.useState(!1),[a,o]=c.useState(null),[u,d]=c.useState(""),[y,g]=c.useState(""),[h,v]=c.useState(""),[x,S]=c.useState(!1),[N,p]=c.useState(null);async function f(k){k.preventDefault(),i(!0),o(null);try{await hm(n),t(C=>({...C,display_name:n||null})),o({ok:!0,text:"Saved."})}catch(C){o({ok:!1,text:C.message})}finally{i(!1)}}async function m(k){if(k.preventDefault(),y!==h){p({ok:!1,text:"Passwords do not match."});return}S(!0),p(null);try{await gm(u,y),d(""),g(""),v(""),p({ok:!0,text:"Password changed."})}catch(C){p({ok:!1,text:C.message})}finally{S(!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:f,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 C=k.target.checked;try{await mm({humanize_slugs:C}),t(E=>({...E,humanize_slugs:C}))}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:m,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=>d(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=>g(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:h,onChange:k=>v(k.target.value),required:!0})]}),N&&s.jsx("div",{className:`form-msg form-msg--${N.ok?"ok":"err"}`,children:N.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Changing…":"Change Password"})]})]})]})}function mg(){const[e,t]=c.useState([]),[n,r]=c.useState(!0),[l,i]=c.useState(null),[a,o]=c.useState(""),[u,d]=c.useState(!1),[y,g]=c.useState(null),h=c.useCallback(async()=>{r(!0),i(null);try{t(await ym())}catch(S){i(S.message)}finally{r(!1)}},[]);c.useEffect(()=>{h()},[h]);async function v(S){if(S.preventDefault(),!!a.trim()){d(!0);try{const N=await vm(a.trim());g(N),o(""),h()}catch(N){i(N.message)}finally{d(!1)}}}async function x(S){try{await xm(S),t(N=>N.filter(p=>p.token_uid!==S))}catch(N){i(N.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:()=>g(null),children:"Dismiss"})]}),s.jsxs("form",{className:"token-create-row",onSubmit:v,children:[s.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:a,onChange:S=>o(S.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(S=>s.jsxs("div",{className:"token-row",children:[s.jsxs("div",{className:"token-row-info",children:[s.jsx("strong",{children:S.name}),s.jsxs("div",{className:"muted",children:["Created ",S.created_at.slice(0,10),S.last_used_at&&` · Last used ${S.last_used_at.slice(0,10)}`]})]}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>x(S.token_uid),children:"Revoke"})]},S.token_uid))]})]})})}function gg(){const[e,t]=c.useState(null),[n,r]=c.useState(!0),[l,i]=c.useState(null),[a,o]=c.useState(!1),[u,d]=c.useState(null);c.useEffect(()=>{(async()=>{try{t(await yo())}catch(g){i(g.message)}finally{r(!1)}})()},[]);async function y(g){g.preventDefault(),o(!0),d(null);try{await Zl(e),d({ok:!0,text:"Saved."})}catch(h){d({ok:!1,text:h.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(([g,h])=>s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:!!e[g],onChange:v=>t(x=>({...x,[g]:v.target.checked}))}),h]},g)),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:g=>t(h=>({...h,default_entry_visibility:Number(g.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 Ci(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 yg({archiveId:e}){const[t,n]=c.useState("idle"),[r,l]=c.useState(null),[i,a]=c.useState(null),[o,u]=c.useState(null);function d(){n("idle"),l(null),a(null),u(null)}async function y(){n("scanning"),u(null),l(null);try{const v=await Pm(e);l(v),n("scanned")}catch(v){u(v.message),n("error")}}async function g(){n("deleting"),u(null);try{const v=await Lm(e);a(v),n("done")}catch(v){u(v.message),n("error")}}const h=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&&h&&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:d,children:"Done"})]}),t==="scanned"&&r&&!h&&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:Ci(r.total_bytes)})," recoverable."]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsxs("button",{className:"btn-danger",onClick:g,children:["Delete (",Ci(r.total_bytes),")"]}),s.jsx("button",{className:"btn-ghost",onClick:d,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:Ci(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:d,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:d,children:"Try again"})]})]})})}function vg(){const[e,t]=c.useState(null),[n,r]=c.useState(!0),[l,i]=c.useState(null),[a,o]=c.useState("global"),[u,d]=c.useState(""),[y,g]=c.useState("{}"),[h,v]=c.useState(null),[x,S]=c.useState(!1),[N,p]=c.useState({});c.useEffect(()=>{f()},[]);async function f(){r(!0),i(null);try{t(await Im())}catch(j){i(j.message)}finally{r(!1)}}async function m(j){j.preventDefault();try{JSON.parse(y)}catch{v({ok:!1,text:'cookies must be valid JSON, e.g. {"session": "abc"}'});return}S(!0),v(null);try{await $m(a==="global"?null:u.trim(),a,y),d(""),g("{}"),o("global"),v({ok:!0,text:"Rule added."}),await f()}catch(P){v({ok:!1,text:P.message})}finally{S(!1)}}async function k(j){try{await Am(j),await f()}catch(P){i(P.message)}}function C(j){p(P=>({...P,[j.rule_uid]:{cookiesInput:j.cookies_json,saving:!1,msg:null}}))}function E(j){p(P=>{const z={...P};return delete z[j],z})}async function T(j){const P=N[j.rule_uid];try{JSON.parse(P.cookiesInput)}catch{p(z=>({...z,[j.rule_uid]:{...z[j.rule_uid],msg:{ok:!1,text:"Invalid JSON"}}}));return}p(z=>({...z,[j.rule_uid]:{...z[j.rule_uid],saving:!0,msg:null}}));try{await Dm(j.rule_uid,{cookies_json:P.cookiesInput}),E(j.rule_uid),await f()}catch(z){p(J=>({...J,[j.rule_uid]:{...J[j.rule_uid],saving:!1,msg:{ok:!1,text:z.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(j=>{const P=N[j.rule_uid],z=j.url_pattern?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted",children:[j.pattern_kind,":"]})," ",s.jsx("code",{children:j.url_pattern})]}):s.jsx("span",{className:"muted",children:"global (all URLs)"});return s.jsxs("tr",{children:[s.jsx("td",{children:z}),s.jsx("td",{children:P?s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:12,width:"100%",minHeight:60},value:P.cookiesInput,onChange:J=>p(H=>({...H,[j.rule_uid]:{...H[j.rule_uid],cookiesInput:J.target.value}}))}),P.msg&&s.jsx("div",{className:`form-msg form-msg--${P.msg.ok?"ok":"err"}`,children:P.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:P.saving,onClick:()=>T(j),children:P.saving?"Saving…":"Save"}),s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>E(j.rule_uid),children:"Cancel"})]})]}):s.jsx("code",{style:{fontSize:12,wordBreak:"break-all"},children:j.cookies_json})}),s.jsx("td",{children:!P&&s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>C(j),children:"Edit"}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"2px 8px"},onClick:()=>k(j.rule_uid),children:"Del"})]})})]},j.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:m,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:j=>o(j.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:j=>d(j.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:j=>g(j.target.value),placeholder:'{"SESSION": "abc123", "token": "xyz"}',required:!0})]}),h&&s.jsx("div",{className:`form-msg form-msg--${h.ok?"ok":"err"}`,children:h.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Adding…":"Add Rule"})]})]})})}function xg(){const[e,t]=c.useState(null),[n,r]=c.useState(!0),[l,i]=c.useState(!1),[a,o]=c.useState(null);c.useEffect(()=>{(async()=>{try{t(await yo())}catch(N){o({ok:!1,text:N.message})}finally{r(!1)}})()},[]);async function u(N){i(!0),o(null);try{await Zl({ublock_enabled:N}),t(p=>({...p,ublock_enabled:N})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}async function d(N){i(!0),o(null);try{await Zl({cookie_ext_enabled:N}),t(p=>({...p,cookie_ext_enabled:N})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}async function y(N){i(!0),o(null);try{await Zl({modal_closer_enabled:N}),t(p=>({...p,modal_closer_enabled:N})),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 g=(e==null?void 0:e.ublock_ext_available)??!1,h=(e==null?void 0:e.ublock_enabled)??!0,v=(e==null?void 0:e.cookie_ext_available)??!1,x=(e==null?void 0:e.cookie_ext_enabled)??!0,S=(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)."}),!g&&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":h,className:`ext-toggle${h?" ext-toggle--on":""}`,onClick:()=>u(!h),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."}),!v&&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":x,className:`ext-toggle${x?" ext-toggle--on":""}`,onClick:()=>d(!x),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":S,className:`ext-toggle${S?" ext-toggle--on":""}`,onClick:()=>y(!S),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 Ou={0:"Private",1:"Public",2:"Users only",3:"Public"},es=[{value:"anthropic_http",label:"Anthropic API"},{value:"openai_compatible",label:"OpenAI-compatible API"},{value:"claude_cli",label:"Claude CLI"},{value:"codex_cli",label:"Codex CLI"}],wg=Object.fromEntries(es.map(e=>[e.value,e.label])),Mu="archivr:summary:provider",kg=1500,ff="This entry can’t be summarized yet.",pf="It doesn’t contain archived text that a summary provider can read. Summaries currently support text notes, web pages, X posts and threads, and X Articles. Video, audio, and image-only entries need a transcript or text source.",Fu=`${ff}
${pf}`;function jg(e){if(!e)return null;try{const t=JSON.parse(e);if(t&&typeof t=="object")return{tldr:typeof t.tldr=="string"?t.tldr:"",summary:typeof t.summary=="string"?t.summary:"",tags:Array.isArray(t.tags)?t.tags.filter(n=>typeof n=="string"):[]}}catch{}return{tldr:"",summary:e,tags:[]}}const Sg=()=>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 Ng({archiveId:e,selectedEntry:t,selectedUids:n,selectedEntries:r,detail:l,onTagFilterSet:i,tagNodes:a,onTagsRefresh:o,onEntryTitleChange:u,onEntryDeleted:d,onBulkDeleted:y,humanizeTags:g,onDetailRefresh:h,onOpenPreview:v,onPlay:x,isPublicSession:S}){var De,ye,qn;const[N,p]=c.useState([]),[f,m]=c.useState(""),[k,C]=c.useState([]),[E,T]=c.useState(""),j=c.useRef(0),P=c.useRef(!1),[z,J]=c.useState(!1),[H,Y]=c.useState(""),[ne,fe]=c.useState("idle"),[Fe,we]=c.useState(""),A=c.useRef(null),[L,Q]=c.useState(!1);c.useEffect(()=>{Q(!1)},[(De=l==null?void 0:l.summary)==null?void 0:De.entry_uid]);const[V,ee]=c.useState(null),[Ie,te]=c.useState(""),[Ne,ue]=c.useState(!1),[be,Mt]=c.useState(()=>{try{return sessionStorage.getItem(Mu)||es[0].value}catch{return es[0].value}}),[Ft,bt]=c.useState(!1),Ve=c.useRef(null),nt=c.useRef(null),Je=c.useRef(null),Be=c.useRef(null),Tt=e&&(t!=null&&t.entry_uid)?`${e}:${t.entry_uid}`:null;Be.current=Tt;const M=(n==null?void 0:n.size)>=2,[X,ke]=c.useState(""),[Qe,Pt]=c.useState("idle"),[Ge,bn]=c.useState(""),[Lt,Bt]=c.useState([]),[$e,Vn]=c.useState(""),[Kt,w]=c.useState("idle"),[U,O]=c.useState(""),[$,F]=c.useState("idle"),[B,ge]=c.useState(""),[ce,je]=c.useState("idle"),[pe,Ue]=c.useState("");c.useEffect(()=>{const b=++j.current;if(A.current&&(clearInterval(A.current),A.current=null),fe("idle"),we(""),!t||!e){p([]),C([]);return}if(S){p([]),C([]);return}J(!1),Y(""),P.current=!1,p([]),Promise.all([Ml(e,t.entry_uid),Iu(e,t.entry_uid)]).then(([K,re])=>{b===j.current&&(p(K),C(re))}).catch(()=>{})},[t,e,S]),c.useEffect(()=>()=>{clearInterval(A.current)},[]),c.useLayoutEffect(()=>{var K,re,se;clearInterval(Ve.current),Ve.current=null,(K=nt.current)==null||K.abort(),nt.current=null,(re=Je.current)==null||re.abort(),Je.current=null;const b=((se=l==null?void 0:l.summary)==null?void 0:se.entry_uid)===(t==null?void 0:t.entry_uid);ee(b?l.latest_summary??null:null),te(""),ue(!1),bt(!1)},[e,t==null?void 0:t.entry_uid,(ye=l==null?void 0:l.summary)==null?void 0:ye.entry_uid]);const ie=V==null?void 0:V.status;c.useEffect(()=>{var an;if(clearInterval(Ve.current),Ve.current=null,ie!=="pending"&&ie!=="running"||!e||!((an=l==null?void 0:l.summary)!=null&&an.entry_uid))return;const b=l.summary.entry_uid,K=`${e}:${b}`;if(Tt!==K)return;const re=new AbortController;nt.current=re;const kt=setInterval(async()=>{var he;try{const Tn=await qh(e,b,{signal:re.signal});if(re.signal.aborted||Be.current!==K)return;ee(Tn.summary??null);const Js=(he=Tn.summary)==null?void 0:he.status;Js!=="pending"&&Js!=="running"&&(clearInterval(kt),Ve.current===kt&&(Ve.current=null),ue(!1),Js==="completed"&&Be.current===K&&(h==null||h()))}catch{if(re.signal.aborted||Be.current!==K)return}},kg);return Ve.current=kt,()=>{clearInterval(kt),Ve.current===kt&&(Ve.current=null),re.abort(),nt.current===re&&(nt.current=null)}},[ie,e,t==null?void 0:t.entry_uid,(qn=l==null?void 0:l.summary)==null?void 0:qn.entry_uid,Tt]),c.useEffect(()=>()=>{var b,K;clearInterval(Ve.current),(b=nt.current)==null||b.abort(),(K=Je.current)==null||K.abort()},[]);async function ft(b=!1){var kt,an;if(!e||!((kt=l==null?void 0:l.summary)!=null&&kt.entry_uid)||Ne)return;const K=l.summary.entry_uid,re=`${e}:${K}`;if(Be.current!==re)return;const se=new AbortController;(an=Je.current)==null||an.abort(),Je.current=se,ue(!0),te("");try{const he=await Kh(e,K,{provider:be,force:b,includeImages:Ft,signal:se.signal});if(se.signal.aborted||Be.current!==re)return;he.status==="completed"?(ee(he),ue(!1),Be.current===re&&(h==null||h())):ee({...he??{},status:"pending"})}catch(he){if(se.signal.aborted||Be.current!==re)return;te(he.message||"Summary request failed"),ue(!1)}finally{Je.current===se&&(Je.current=null)}}function wt(b){Mt(b),b==="claude_cli"&&bt(!1);try{sessionStorage.setItem(Mu,b)}catch{}}c.useEffect(()=>{if(!e){Bt([]);return}vo(e).then(Bt).catch(()=>Bt([]))},[e]),c.useEffect(()=>{ke(""),Pt("idle"),bn(""),Vn(""),w("idle"),O(""),F("idle"),ge(""),je("idle"),Ue("")},[n]);async function Ws(){const b=n.size;if(!window.confirm(`Delete ${b} entr${b===1?"y":"ies"}? This cannot be undone.`))return;F("running");const K=new Set;for(const re of n)try{await zu(e,re),K.add(re)}catch{}F("idle"),y==null||y(K)}async function wl(){const b=X.trim();if(b){Pt("running"),bn("");try{for(const K of n)await Ru(e,K,b);ke(""),Pt("done"),o==null||o(),setTimeout(()=>Pt("idle"),1800)}catch(K){bn(K.message),Pt("error")}}}async function Vs(){if(!$e)return;w("running"),O("");const b=[],K=Lt.find(re=>re.collection_uid===$e);for(const re of n)try{await ka(e,$e,re,(K==null?void 0:K.default_visibility_bits)??2)}catch{b.push(re)}b.length>0?(O(`Failed for ${b.length} entr${b.length===1?"y":"ies"}.`),w("error")):(w("done"),setTimeout(()=>w("idle"),1800))}async function Qn(){if(!B||!t)return;je("running"),Ue("");const b=Lt.find(K=>K.collection_uid===B);try{await ka(e,B,t.entry_uid,(b==null?void 0:b.default_visibility_bits)??2),je("done"),ge("");const K=await Iu(e,t.entry_uid);C(K),setTimeout(()=>je("idle"),1800)}catch(K){Ue(K.message),je("error")}}async function _r(){const b=H.trim()||null;try{await Zh(e,t.entry_uid,b),u==null||u(t.entry_uid,b)}catch{}finally{J(!1)}}async function sn(){const b=f.trim();if(!(!b||!t))try{await Ru(e,t.entry_uid,b),m(""),T("");const K=await Ml(e,t.entry_uid);p(K),o()}catch(K){T(K.message)}}async function kl(b){try{await em(e,t.entry_uid,b);const K=await Ml(e,t.entry_uid);p(K),o()}catch{}}async function Qs(){if(!(!t||!e)&&window.confirm("Delete this entry? This cannot be undone."))try{await zu(e,t.entry_uid),d==null||d(t.entry_uid)}catch{}}async function qs(){if(!t||!e||ne==="running")return;const b=j.current,K=t.entry_uid;fe("running"),we("");try{const{job_uid:re}=await Rm(e,K);if(j.current!==b)return;A.current=setInterval(async()=>{try{const se=await sf(e,re);if(se.status==="completed"){if(clearInterval(A.current),A.current=null,j.current!==b)return;fe("done");const kt=await Ml(e,K);if(j.current!==b)return;p(kt),h==null||h()}else if(se.status==="failed"){if(clearInterval(A.current),A.current=null,j.current!==b)return;fe("error"),we(se.error_text||"Re-archive failed.")}}catch{if(clearInterval(A.current),A.current=null,j.current!==b)return;fe("error"),we("Network error while polling.")}},500)}catch(re){if(j.current!==b)return;fe("error"),we(re.message||"Failed to start re-archive.")}}const Ks=l?[["Added",xo(l.summary.archived_at)],["Source",l.summary.source_kind],["Type",l.summary.entity_kind],["Visibility",Ou[l.summary.visibility]??l.summary.visibility],["Root",l.structured_root_relpath]]:[],Xs=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),_=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv","pdf","html","htm","md","markdown","txt","jpg","jpeg","png","gif","webp","avif","svg","bmp"]),R=l?l.artifacts.findIndex(b=>b.artifact_role==="primary_media"):-1,D=R>=0?l.artifacts[R]:null,q=D?D.relpath.split(".").pop().toLowerCase():"",G=D&&Xs.has(q),ae=R>=0&&t?`/api/archives/${e}/entries/${t.entry_uid}/artifacts/${R}`:null,Te=l&&!G&&(l.summary.entity_kind==="tweet"||l.summary.entity_kind==="tweet_thread"||D&&_.has(q));return s.jsxs("aside",{className:"context-rail",children:[s.jsx("div",{className:"rail-eyebrow",children:"Context"}),M?S?s.jsxs("p",{className:"bulk-count",children:[s.jsx("span",{className:"bulk-count-num",children:n.size})," entries selected"]}):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"}),Ge&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:Ge}),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:X,onChange:b=>ke(b.target.value),onKeyDown:b=>{b.key==="Enter"&&wl()}}),s.jsx("button",{className:"tag-add-btn",onClick:wl,disabled:Qe==="running"||!X.trim(),children:Qe==="running"?"…":Qe==="done"?"✓":"Add"})]})]}),Lt.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:$e,onChange:b=>Vn(b.target.value),children:[s.jsx("option",{value:"",children:"Pick a collection…"}),Lt.filter(b=>b.slug!=="_default_").map(b=>s.jsx("option",{value:b.collection_uid,children:b.name},b.collection_uid))]}),s.jsx("button",{className:"tag-add-btn",onClick:Vs,disabled:!$e||Kt==="running",children:Kt==="running"?"…":Kt==="done"?"✓":Kt==="error"?"!":"Add"})]}),U&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"6px 0 0"},children:U})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:Ws,disabled:$==="running",children:$==="running"?"Deleting…":`Delete ${n.size} entr${n.size===1?"y":"ies"}`})})]}):t?l?s.jsxs(s.Fragment,{children:[S?s.jsx("h2",{className:"rail-title",children:ht(l.summary.title)||ht(l.summary.entry_uid)}):z?s.jsx("input",{className:"rail-title-input",autoFocus:!0,value:H,onChange:b=>Y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur(),b.key==="Escape"&&(P.current=!0,b.currentTarget.blur())},onBlur:()=>{P.current?J(!1):_r(),P.current=!1}}):s.jsxs("h2",{className:"rail-title rail-title--editable",title:"Click to rename",onClick:()=>{Y(l.summary.title??""),J(!0)},children:[ht(l.summary.title)||ht(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:Us(l.summary.source_kind)}}),s.jsx("span",{className:"u-text",children:l.summary.original_url}),s.jsx("span",{className:"ext",children:s.jsx(Sg,{})})]}),G&&x&&s.jsx("button",{className:"rail-preview-btn",onClick:()=>x(ae,t),children:"▶ Play"}),Te&&v&&s.jsx("button",{className:"rail-preview-btn",onClick:v,children:"Preview"}),(()=>{const b=(V==null?void 0:V.status)==="completed"?jg(V.summary_text):null,K=(V==null?void 0:V.status)==="pending"||(V==null?void 0:V.status)==="running",re=(V==null?void 0:V.status)==="failed"&&V.error_text===Fu||Ie===Fu;return S&&!b?null:s.jsxs("div",{className:"rail-section rail-summary",children:[s.jsx("div",{className:"rail-section-heading",children:"Summary"}),b&&s.jsxs("div",{className:"rail-summary-body",children:[b.tldr&&s.jsx("p",{className:"rail-summary-tldr",children:b.tldr}),b.summary&&s.jsx("p",{className:"rail-summary-text",children:b.summary}),b.tags.length>0&&s.jsx("div",{className:"rail-summary-tags",children:b.tags.map(se=>s.jsx("span",{className:"rail-summary-tag",children:se},se))}),s.jsxs("p",{className:"rail-summary-provider",children:[wg[V.provider_kind]||V.provider_kind,V.resolved_model||V.provider_model?` · ${V.resolved_model||V.provider_model}`:""]})]}),K&&s.jsxs("p",{className:"rail-summary-status",children:[s.jsx("span",{className:"rail-summary-spinner","aria-hidden":"true"}),"Generating…"]}),re&&!S&&s.jsxs("div",{className:"rail-summary-info",role:"status",children:[s.jsx("p",{className:"rail-summary-info__heading",children:ff}),s.jsx("p",{className:"rail-summary-info__detail",children:pf})]}),(V==null?void 0:V.status)==="failed"&&V.error_text&&!re&&!S&&s.jsx("p",{className:"form-msg form-msg--err rail-summary-error",children:V.error_text}),Ie&&!re&&s.jsx("p",{className:"form-msg form-msg--err rail-summary-error",children:Ie}),!S&&!K&&s.jsxs("div",{className:"rail-summary-controls",children:[s.jsx("select",{className:"rail-summary-select",value:be,onChange:se=>wt(se.target.value),"aria-label":"Summary provider",children:es.map(se=>s.jsx("option",{value:se.value,children:se.label},se.value))}),s.jsxs("div",{className:`rail-summary-image-option${be==="claude_cli"?" rail-summary-image-option--disabled":""}`,children:[s.jsxs("label",{className:"rail-summary-image-option__label",children:[s.jsx("input",{type:"checkbox",checked:Ft,disabled:be==="claude_cli",onChange:se=>bt(se.target.checked)}),"Include attached images"]}),s.jsx("p",{className:"rail-summary-image-option__note",children:be==="claude_cli"?"Claude CLI cannot attach local images. Choose an HTTP provider or Codex CLI.":"Selected archived images are sent to the chosen provider. Up to 4 supported images (5 MiB each, 12 MiB total) can be attached; unsupported or oversized artifacts are skipped."})]}),s.jsx("button",{className:"rail-rearchive-btn",onClick:()=>ft(!!b),disabled:Ne,children:Ne?"…":b?"Regenerate":"Generate"})]})]})})(),s.jsx("div",{className:"meta-list",children:Ks.filter(([,b])=>b!=null&&b!=="").map(([b,K])=>s.jsxs("div",{className:"meta-item",children:[s.jsx("span",{className:"meta-k",children:b}),s.jsx("span",{className:`meta-v${b==="Root"?" mono":""}`,children:ht(K)})]},b))}),l.artifacts.length>0&&(()=>{const b=l.artifacts.map((he,Tn)=>({...he,_idx:Tn})),K=b.filter(he=>he.artifact_role==="font"),re=b.filter(he=>he.artifact_role!=="font"),se=K.reduce((he,Tn)=>he+(Tn.byte_size||0),0),kt=l.summary.entry_uid,an=he=>s.jsx("li",{children:s.jsxs("a",{href:`/api/archives/${e}/entries/${kt}/artifacts/${he._idx}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[s.jsx("span",{className:"artifact-name",children:he.artifact_role==="font"?he.relpath.split("/").pop():he.artifact_role.replace(/_/g," ")}),s.jsx("span",{className:"artifact-size",children:he.byte_size!=null?hl(he.byte_size):"—"})]})},he._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:[re.map(an),K.length>0&&s.jsxs("li",{className:"artifact-group",children:[s.jsxs("button",{type:"button",className:"artifact-group-header artifact-link","aria-expanded":L,onClick:()=>Q(he=>!he),children:[s.jsxs("span",{className:"artifact-name",children:[s.jsx("span",{"aria-hidden":"true",className:`artifact-group-chevron${L?" open":""}`,children:"›"}),` fonts (${K.length})`]}),s.jsx("span",{className:"artifact-size",children:hl(se)})]}),L&&s.jsx("ul",{className:"artifact-list artifact-group-body",children:K.map(an)})]})]})]})})()]}):s.jsx("p",{className:"tags-empty",children:"Loading\\u2026"}):s.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&!M&&!S&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Tags"}),N.length===0?s.jsx("p",{className:"tags-empty",children:"No tags yet."}):s.jsx("div",{className:"tags-wrap",children:N.map(b=>s.jsxs("span",{className:"tag-pill",title:b.full_path,children:[g?of(b.full_path):b.full_path,s.jsx("button",{className:"remove",title:`Remove tag ${b.full_path}`,onClick:()=>kl(b.tag_uid),children:"×"})]},b.tag_uid))}),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:f,onChange:b=>m(b.target.value),onKeyDown:b=>{b.key==="Enter"&&sn()}}),s.jsx("button",{className:"tag-add-btn",onClick:sn,children:"Add"})]})]}),(k.length>0||Lt.filter(b=>b.slug!=="_default_").length>0)&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Collections"}),k.map(b=>s.jsxs("div",{className:"coll-row",children:[s.jsx("span",{className:"coll-name",children:b.name}),s.jsx("span",{className:"vis-badge",children:Ou[b.visibility_bits]??`bits:${b.visibility_bits}`})]},b.collection_uid)),Lt.filter(b=>b.slug!=="_default_").length>0&&s.jsxs("div",{className:"bulk-coll-row",style:{marginTop:8},children:[s.jsxs("select",{className:"bulk-coll-select",value:B,onChange:b=>ge(b.target.value),children:[s.jsx("option",{value:"",children:"Add to collection…"}),Lt.filter(b=>b.slug!=="_default_").map(b=>s.jsx("option",{value:b.collection_uid,children:b.name},b.collection_uid))]}),s.jsx("button",{className:"tag-add-btn",onClick:Qn,disabled:!B||ce==="running",children:ce==="running"?"…":ce==="done"?"✓":ce==="error"?"!":"Add"})]}),pe&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"4px 0 0"},children:pe})]}),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:qs,disabled:ne==="running",children:ne==="running"?"Re-archiving…":"Re-archive"}),ne==="done"&&s.jsx("p",{className:"form-msg form-msg--ok",style:{marginTop:"6px"},children:"Re-archived successfully."}),ne==="error"&&s.jsx("p",{className:"form-msg form-msg--err",style:{marginTop:"6px"},children:Fe})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:Qs,children:"Delete entry"})})]})]})}const _g=/\/api\/archives\/([^/]+)\/entries\/([^/]+)\/artifacts\/(\d+)/;function Cg(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M5 17H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2"}),s.jsx("polygon",{points:"12 15 17 21 7 21 12 15"})]})}function Eg({src:e,contentType:t="video/mp4"}){const n=c.useRef(null),[r,l]=c.useState(null),[i,a]=c.useState(!1),[o,u]=c.useState(!1);c.useEffect(()=>{if(!e){l(null);return}const g=e.match(_g);if(!g){l(e);return}let h=!1;return l(null),zm(g[1],g[2],parseInt(g[3],10)).then(({url:v})=>{h||l(v)}).catch(()=>{h||l(e)}),()=>{h=!0}},[e]),c.useEffect(()=>{n.current&&n.current.load()},[r]),c.useEffect(()=>{u(typeof HTMLVideoElement<"u"&&"webkitShowPlaybackTargetPicker"in HTMLVideoElement.prototype)},[]),c.useEffect(()=>{var h;const g=v=>{if(v)try{cast.framework.CastContext.getInstance().setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a(!0)}catch{}};if((h=window.cast)!=null&&h.framework)g(!0);else if(window.__onGCastApiAvailable=g,!document.querySelector('script[src*="cast_sender"]')){const v=document.createElement("script");v.src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",document.head.appendChild(v)}},[]),c.useEffect(()=>{if(!i||!r)return;const g=cast.framework.CastContext.getInstance(),{CastContextEventType:h,SessionState:v}=cast.framework,x=N=>{if(!N)return;const p=new chrome.cast.media.MediaInfo(window.location.origin+r,t);N.loadMedia(new chrome.cast.media.LoadRequest(p)).catch(()=>{})};x(g.getCurrentSession());const S=N=>{(N.sessionState===v.SESSION_STARTED||N.sessionState===v.SESSION_RESUMED)&&x(g.getCurrentSession())};return g.addEventListener(h.SESSION_STATE_CHANGED,S),()=>g.removeEventListener(h.SESSION_STATE_CHANGED,S)},[i,r,t]);const d=()=>{var g,h;(h=(g=n.current)==null?void 0:g.webkitShowPlaybackTargetPicker)==null||h.call(g)},y=i||o;return s.jsx("div",{className:"preview-video-wrap",style:{position:"relative"},children:e?s.jsxs(s.Fragment,{children:[r?s.jsxs("video",{ref:n,controls:!0,autoPlay:!1,playsInline:!0,"x-webkit-airplay":"allow",style:{width:"100%",maxHeight:"100%",display:"block"},children:[s.jsx("source",{src:r}),"Your browser does not support the video element."]}):s.jsx("div",{className:"video-tv-loading","aria-label":"Loading video…"}),y&&r&&s.jsxs("div",{className:"video-tv-controls",children:[o&&s.jsx("button",{className:"video-tv-btn",title:"AirPlay to device","aria-label":"AirPlay to device",onClick:d,children:s.jsx(Cg,{})}),i&&s.jsx("google-cast-launcher",{className:"video-tv-btn",title:"Cast to TV"})]})]}):s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No video available"})})}function Bu({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 bg({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 hf(e){return e?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e*1e3)):""}function Uu(e){return!e||!e.includes("&")?e:e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&apos;/g,"'")}const Z={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"}},Ae={bg:"#000000",border:"#2f3336",text:"#e7e9ea",dim:"#71767b",accent:"#1d9bf0",codeBg:"#16181c"},Ei={article:{background:Ae.bg,color:Ae.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:Ae.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:Ae.border,flexShrink:0},aAuthorName:{fontSize:"15px",fontWeight:"700",color:Ae.text,lineHeight:"1.3"},aAuthorSub:{fontSize:"15px",color:Ae.dim,lineHeight:"1.3"},aDivider:{border:"none",borderTop:`1px solid ${Ae.border}`,margin:"0"},aBody:{padding:"4px 16px 0"},bH1:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:Ae.text,lineHeight:"36px",margin:"24px 0 10px"},bH2:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:Ae.text,lineHeight:"36px",margin:"24px 0 10px"},bP:{fontSize:"17px",color:Ae.text,lineHeight:"1.5",marginBottom:"16px",marginTop:"0"},bSpacer:{height:"6px",display:"block"},bQuote:{borderLeft:`3px solid ${Ae.border}`,padding:"2px 14px",margin:"14px 0",color:Ae.dim,fontSize:"17px",lineHeight:"1.5"},bHr:{border:"none",borderTop:`1px solid ${Ae.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:Ae.text,lineHeight:"1.5",marginBottom:"6px"},bTweet:{display:"flex",alignItems:"center",gap:"12px",border:`1px solid ${Ae.border}`,borderRadius:"12px",padding:"14px 16px",margin:"14px 0",color:Ae.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:Ae.text,background:"transparent"},iCode:{fontFamily:"ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace",fontSize:"0.875em",background:Ae.codeBg,padding:"2px 6px",borderRadius:"4px",color:"#e6edf3"},link:{color:Ae.accent,textDecoration:"none"}};function Tg(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 hr(e,t,n){return e&&n[e]?n[e]:t||null}function mf(){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 wo(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 gf(e,t){const n=e.expanded_url||e.url||e.text||"",r=e.display_url||e.expanded_url||e.url||e.text||"",l=wo(e,t,e.url,e.text,e.display_url,e.expanded_url);return!l||!n?null:{...l,kind:"url",href:n,display:r}}function yf(e,t){const n=e.screen_name||e.name||e.text||"",r=n?`@${n}`:null,l=wo(e,t,r);return!l||!n?null:{...l,kind:"mention",screen_name:n}}const Hu=/https?:\/\/[^\s<>"'\])]+/g,Pg=/[.,;:!?)()]+$/;function _s(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(Pg,"");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 Lg(e,t,n=[]){if(!e)return null;const r=[...(t.urls||[]).map(o=>gf(o,e)).filter(Boolean),...(t.user_mentions||[]).map(o=>yf(o,e)).filter(Boolean)];if(r.length===0&&n.length===0)return _s(Uu(e),Z.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(([d,y])=>d<=o&&y>=u),a=[...l].sort((o,u)=>o-u);return a.slice(0,-1).map((o,u)=>{const d=a[u+1];if(i(o,d))return null;const y=e.slice(o,d),g=r.filter(x=>x.s<=o&&x.e>=d),h=g.find(x=>x.kind==="url");if(h)return s.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer",style:Z.link,children:h.display||y},u);const v=g.find(x=>x.kind==="mention");return v?s.jsx("a",{href:`https://x.com/${v.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:Z.link,children:y},u):s.jsx("span",{children:_s(Uu(y),Z.link)},u)}).filter(o=>o!==null)}function Rg(e,t,n,r,l=Z){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 d=gf(u,e);d&&i.push(d)}for(const u of r){const d=yf(u,e);d&&i.push(d)}if(i.length===0)return _s(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,d)=>u-d);return o.slice(0,-1).map((u,d)=>{const y=o[d+1],g=i.filter(N=>N.s<=u&&N.e>=y),h=e.slice(u,y);let v;if(h.includes(`
`)){const N=h.split(`
`);v=N.flatMap((p,f)=>f<N.length-1?[p,s.jsx("br",{},f)]:[p])}else v=h;g.some(N=>N.kind==="style"&&N.style==="Code")&&(v=s.jsx("code",{style:l.iCode,children:v})),g.some(N=>N.kind==="style"&&N.style==="Bold")&&(v=s.jsx("strong",{children:v})),g.some(N=>N.kind==="style"&&N.style==="Italic")&&(v=s.jsx("em",{children:v})),g.some(N=>N.kind==="style"&&N.style==="Underline")&&(v=s.jsx("u",{children:v})),g.some(N=>N.kind==="style"&&N.style==="Strikethrough")&&(v=s.jsx("s",{children:v}));const x=g.find(N=>N.kind==="url");if(x){const N=/^https?:\/\/t\.co\//i.test(v);v=s.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",style:l.link,children:N?x.display:v})}const S=g.find(N=>N.kind==="mention");return S&&(v=s.jsx("a",{href:`https://x.com/${S.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:l.link,children:v})),s.jsx("span",{children:typeof v=="string"?_s(v,l.link):v},d)})}function zg(e,t,n){const r=(n==null?void 0:n.st)||Z,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=hr(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:d=>{var y;!d.metaKey&&!d.ctrlKey&&(d.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(mf,{}),"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 bi(e,t,n,r){const l=(r==null?void 0:r.st)||Z,i=e.type||"",a=e.text||"",o=e.inline_style_ranges||[],u=e.data||{},d=Rg(a,o,u.urls||[],u.mentions||[],l);switch(i){case"header-one":return s.jsx("h1",{style:l.bH1,children:d},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(mf,{}),"View post on X"]},t):s.jsx("h2",{style:l.bH2,children:d},t)}case"unstyled":return a.trim()?s.jsx("p",{style:l.bP,children:d},t):s.jsx("span",{style:l.bSpacer},t);case"blockquote":return s.jsx("blockquote",{style:l.bQuote,children:d},t);case"unordered-list-item":case"ordered-list-item":return s.jsx("li",{style:l.bLi,children:d},t);case"atomic":return s.jsx("span",{children:zg(e,n,r)},t);default:return a?s.jsx("p",{style:l.bP,children:d},t):null}}function Ig(e,t,n){const r=(n==null?void 0:n.st)||Z,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(bi(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(bi(e[i],i,t,n)),i++;l.push(s.jsx("ol",{style:r.bOl,children:u},`ol-${o}`))}else l.push(bi(a,i,t,n)),i++}return l}function $g({article:e,tweetAuthor:t,artifactMap:n,fullPage:r,onXArticle:l}){const[i,a]=c.useState(null);c.useEffect(()=>{r&&(l==null||l(!0))},[r,l]);const o=r?Ei:Z,u=e.cover_media||{},d=e.author||t||{},y=e.first_published_at_secs?hf(e.first_published_at_secs):"",h=[d.screen_name?`@${d.screen_name}`:"",y].filter(Boolean).join(" · "),v=hr(u.local_path,u.url,n),x=hr(d.avatar_local_path,d.avatar_url,n),S=s.jsxs(s.Fragment,{children:[i&&s.jsx(vf,{items:[{src:i,alt:""}],startIndex:0,onClose:()=>a(null)}),v&&s.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:N=>{!N.metaKey&&!N.ctrlKey&&(N.preventDefault(),a(v))},children:s.jsx("img",{src:v,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:[x?s.jsx("img",{src:x,style:o.aAvatar,alt:d.name||""}):s.jsx("div",{style:o.aAvatarPh}),s.jsxs("div",{children:[s.jsx("div",{style:o.aAuthorName,children:d.name||d.screen_name||"Unknown"}),h&&s.jsx("div",{style:o.aAuthorSub,children:h})]})]})]}),s.jsx("hr",{style:o.aDivider}),s.jsx("div",{style:o.aBody,children:Ig(e.blocks||[],n,{onImgClick:a,st:o})})]});return r?s.jsx("div",{style:Ei.article,children:s.jsx("div",{style:Ei.articleInner,children:S})}):s.jsx("div",{style:Z.article,children:S})}function Dg({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:Z.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 vf({items:e,startIndex:t,onClose:n}){const[r,l]=c.useState(t);c.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:Z.lightboxBackdrop,onClick:n,children:s.jsxs("div",{style:Z.lightboxContent,onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{style:Z.lightboxToolbar,children:[e.length>1&&s.jsxs("span",{style:Z.lightboxCounter,children:[r+1," / ",e.length]}),s.jsx("a",{href:i.src,target:"_blank",rel:"noopener noreferrer",style:Z.lightboxLink,title:"Open in new tab",children:"↗"}),s.jsx("button",{style:Z.lightboxBtn,onClick:n,"aria-label":"Close",children:"×"})]}),s.jsx("img",{src:i.src,alt:i.alt||"",style:Z.lightboxImg}),e.length>1&&s.jsxs("div",{style:Z.lightboxNav,children:[s.jsx("button",{style:Z.lightboxNavBtn,onClick:()=>l(a=>Math.max(a-1,0)),disabled:r===0,children:"‹"}),s.jsx("button",{style:Z.lightboxNavBtn,onClick:()=>l(a=>Math.min(a+1,e.length-1)),disabled:r===e.length-1,children:"›"})]})]})})}function Wu({tweet:e,isInThread:t,isLast:n,artifactMap:r}){var f,m;const[l,i]=c.useState(null),a=e.author||{},o=e.created_at_secs?hf(e.created_at_secs):"",u=e.entities||{},d=hr(a.avatar_local_path,a.avatar_url,r),y=t&&!n,g=e.is_quote_status===!0,h=t?Z.tweetRowThread:Z.tweetRow,v=e.full_text||"",x=((m=(f=e.extended_entities)==null?void 0:f.media)!=null&&m.length?e.extended_entities.media:u.media)||[],S=[],N=[];for(const k of x)if(k.type==="photo"){const C=hr(k.local_path,k.media_url_https,r);C&&S.push({kind:"photo",src:C,alt:k.alt_text||""})}else if(k.type==="video"||k.type==="animated_gif"){const C=k.local_path&&r[k.local_path]||(()=>{var T,j;return(j=(((T=k.video_info)==null?void 0:T.variants)||[]).filter(P=>P.content_type==="video/mp4").sort((P,z)=>(z.bitrate||0)-(P.bitrate||0))[0])==null?void 0:j.url})();C&&N.push({kind:k.type==="animated_gif"?"gif":"video",src:C})}const p=[];for(const k of x){if(!k.url||!(k.type==="photo"?S.some(T=>T.src===hr(k.local_path,k.media_url_https,r)):N.length>0))continue;const E=wo(k,v,k.url);E&&p.push([E.s,E.e])}return s.jsxs(s.Fragment,{children:[l!==null&&s.jsx(vf,{items:S,startIndex:l,onClose:()=>i(null)}),s.jsxs("div",{style:h,children:[s.jsxs("div",{style:Z.leftCol,children:[d?s.jsx("img",{src:d,style:Z.avatar,alt:a.name||""}):s.jsx("div",{style:Z.avatarPh}),y&&s.jsx("div",{style:Z.threadLine})]}),s.jsxs("div",{style:Z.rightCol,children:[s.jsxs("div",{style:Z.authorRow,children:[s.jsx("span",{style:Z.authorName,children:a.name||a.screen_name||"Unknown"}),a.screen_name&&s.jsxs("span",{style:Z.authorHandle,children:["@",a.screen_name]}),o&&s.jsxs("span",{style:Z.datePart,children:["· ",o]}),g&&s.jsx("span",{style:Z.qtBadge,title:"Quote tweet",children:"↻ QT"})]}),s.jsx("div",{style:Z.tweetText,children:Lg(v,u,p)}),S.length>0&&s.jsx("div",{style:Z.mediaGrid,children:s.jsx(Dg,{photos:S,onOpen:k=>i(k)})}),N.map((k,C)=>s.jsx("div",{style:Z.mediaGrid,children:s.jsx("video",{src:k.src,style:Z.mediaVideo,controls:!0,loop:k.kind==="gif",muted:k.kind==="gif",autoPlay:k.kind==="gif"})},C)),(e.retweet_count>0||e.favorite_count>0)&&s.jsxs("div",{style:Z.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 Ag({archiveId:e,entryUid:t,artifacts:n,entityKind:r,fullPage:l,onXArticle:i}){const[a,o]=c.useState(!0),[u,d]=c.useState(null),[y,g]=c.useState([]);if(c.useEffect(()=>{if(o(!0),d(null),g([]),!n||!e||!t){o(!1);return}const x=n.map((N,p)=>({...N,index:p})).filter(N=>N.artifact_role==="raw_tweet_json");if(x.length===0){d("No tweet data found."),o(!1);return}let S=!1;return Gh(e,t,x.map(N=>N.index)).then(async N=>{if(S)return;const p=/https?:\/\/t\.co\/[A-Za-z0-9]+/g,f=T=>{var P;const j=T.full_text||"";return(((P=T.entities)==null?void 0:P.urls)||[]).map(z=>{var J;if(z.fromIndex!=null&&z.toIndex!=null)return[z.fromIndex,z.toIndex];if(((J=z.indices)==null?void 0:J.length)===2)return[z.indices[0],z.indices[1]];if(z.url){const H=j.indexOf(z.url);if(H!==-1)return[H,H+z.url.length]}return null}).filter(Boolean)},m=(T,j,P)=>T.some(([z,J])=>z<=j&&J>=P),k=new Set;for(const T of N){const j=T.full_text||"",P=f(T);let z;for(p.lastIndex=0;(z=p.exec(j))!==null;)m(P,z.index,z.index+z[0].length)||k.add(z[0])}const C=k.size>0?await Yh([...k]).catch(()=>({})):{},E=N.map(T=>{var H;const j=T.full_text||"",P=f(T),z=[];let J;for(p.lastIndex=0;(J=p.exec(j))!==null;){const Y=J[0],ne=C[Y];ne&&ne!==Y&&!m(P,J.index,J.index+Y.length)&&z.push({url:Y,expanded_url:ne,display_url:(()=>{try{const fe=new URL(ne);return fe.hostname+(fe.pathname.length>1?"/…":"")}catch{return ne}})(),fromIndex:J.index,toIndex:J.index+Y.length})}return z.length===0?T:{...T,entities:{...T.entities||{},urls:[...((H=T.entities)==null?void 0:H.urls)||[],...z]}}});S||g(E)}).catch(N=>{S||d(N.message||"Failed to load tweet.")}).finally(()=>{S||o(!1)}),()=>{S=!0}},[e,t,n]),a)return s.jsx("div",{style:Z.loading,children:"Loading…"});if(u)return s.jsxs("div",{style:Z.error,children:["Error: ",u]});if(y.length===0)return null;const h=Tg(e,t,n);if(r==="tweet_thread")return s.jsx("div",{style:Z.threadOuter,children:y.map((x,S)=>s.jsx(Wu,{tweet:x,isInThread:!0,isLast:S===y.length-1,artifactMap:h},x.id||S))});const v=y[0];return v.is_article&&v.article?s.jsx($g,{article:v.article,tweetAuthor:v.author,artifactMap:h,fullPage:l,onXArticle:i}):s.jsx("div",{style:Z.card,children:s.jsx(Wu,{tweet:v,isInThread:!1,isLast:!0,artifactMap:h})})}function Og({src:e,mime:t,title:n}){const[r,l]=c.useState(null),[i,a]=c.useState(null);return c.useEffect(()=>{const o=new AbortController;return l(null),a(null),Xh(e,{signal:o.signal}).then(l).catch(u=>{u.name!=="AbortError"&&a(u.message||String(u))}),()=>o.abort()},[e]),i?s.jsxs("div",{className:"text-preview text-preview--error",children:["Failed to load text: ",i]}):r===null?s.jsx("div",{className:"text-preview text-preview--loading",children:"Loading…"}):s.jsxs("div",{className:"text-preview",children:[n&&s.jsx("h1",{className:"text-preview__title",children:n}),s.jsx("pre",{className:"text-preview__body",children:r}),t&&s.jsx("div",{className:"text-preview__mime",children:t})]})}const Mg=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv"]),Fg=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),Bg=new Set(["jpg","jpeg","png","gif","webp","avif","svg","bmp"]),Ug=new Set(["md","markdown","txt"]),Hg={mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",mkv:"video/x-matroska",avi:"video/x-msvideo",m4v:"video/mp4",ogv:"video/ogg"};function xf({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 v=s.jsx(Ag,{archiveId:e,entryUid:o,artifacts:a,entityKind:u,fullPage:r,onXArticle:l});return r?v:s.jsx("div",{className:"preview-tweet-wrap",children:v})}const d=a.findIndex(v=>v.artifact_role==="primary_media");if(d===-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((v,x)=>s.jsxs("li",{children:[v.artifact_role,": ",v.relpath]},x))})]});const y=a[d],g=`/api/archives/${e}/entries/${o}/artifacts/${d}`,h=y.relpath.split(".").pop().toLowerCase();return Mg.has(h)?s.jsx("div",{className:"preview-panel",children:s.jsx(Eg,{src:g,contentType:Hg[h]||"video/mp4"})}):Fg.has(h)?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:g,controls:!0,style:{marginTop:"8px",width:"100%",maxWidth:"400px"}})]}):h==="pdf"?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:s.jsx(Bu,{src:g,type:"pdf",title:i.title,originalUrl:i.original_url})}):h==="html"||h==="htm"?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:s.jsx(Bu,{src:g,type:"page",title:i.title,originalUrl:i.original_url})}):Ug.has(h)?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0,overflow:"auto"},children:s.jsx(Og,{src:g,mime:y.mime_type,title:i.title})}):Bg.has(h)?s.jsx("div",{className:"preview-panel",style:{height:"100%"},children:s.jsx(bg,{src:g,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((v,x)=>s.jsxs("li",{children:[v.artifact_role,": ",v.relpath]},x))})]})}function Wg({archiveId:e,entry:t,detail:n,onClose:r}){var l,i;return c.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(xf,{archiveId:e,entry:t,detail:n})})]})})}function Vu(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 Vg({entry:e,src:t,archiveId:n,onClose:r}){const l=c.useRef(null),[i,a]=c.useState(!1),[o,u]=c.useState(0),[d,y]=c.useState(NaN),[g,h]=c.useState(1);c.useEffect(()=>{!l.current||!t||(l.current.load(),u(0),y(NaN),a(!1))},[t]),c.useEffect(()=>{l.current&&(l.current.volume=g)},[g]);function v(){const f=l.current;f&&(i?f.pause():f.play().catch(()=>{}))}function x(f){const m=l.current;if(!m||!isFinite(d))return;const k=Number(f.target.value);m.currentTime=k,u(k)}function S(f){h(Number(f.target.value))}const N=(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 f;return u(((f=l.current)==null?void 0:f.currentTime)??0)},onLoadedMetadata:()=>{var f;return y(((f=l.current)==null?void 0:f.duration)??NaN)},onDurationChange:()=>{var f;return y(((f=l.current)==null?void 0:f.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:Us(p)}}),s.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.85rem",color:"var(--ink)"},title:N,children:N})]}),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:v,"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:Vu(o)}),s.jsx("input",{type:"range",min:0,max:isFinite(d)?d:0,step:.1,value:isFinite(o)?o:0,onChange:x,"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:Vu(d)})]}),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:g,onChange:S,"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 Qg({archiveId:e,entryUid:t}){var h,v;const[n,r]=c.useState(null),[l,i]=c.useState(!0),[a,o]=c.useState(null),[u,d]=c.useState(!1);c.useEffect(()=>{if(!u)return;const x=document.documentElement,S=document.body,N=x.style.colorScheme,p=S.style.background;return x.style.colorScheme="dark",S.style.background="#000",()=>{x.style.colorScheme=N,S.style.background=p}},[u]),c.useEffect(()=>{d(!1),Mr(e,t).then(x=>{r(x),i(!1)}).catch(x=>{o((x==null?void 0:x.message)||"Failed to load entry"),i(!1)})},[e,t]);const y=((h=n==null?void 0:n.summary)==null?void 0:h.title)||t,g=(v=n==null?void 0:n.summary)==null?void 0:v.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}),g&&s.jsx("a",{href:g,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(xf,{archiveId:e,entry:n.summary,detail:n,fullPage:!0,onXArticle:d})]})]})}const qg=7e3;function Kg({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(Jg,{toast:r,onDismiss:t,onIgnoreUblock:n},r.id))}):null}function Xg(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 Jg({toast:e,onDismiss:t,onIgnoreUblock:n}){const[r,l]=c.useState(!1),i=e.type==="warning",a=e.type==="success";c.useEffect(()=>{if(r)return;const u=setTimeout(()=>t(e.id),qg);return()=>clearTimeout(u)},[r,e.id,t]);const o=Xg(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 Hs=c.createContext(null),Gg=["archive","tags","collections","runs","admin","settings"],Yg=["profile","tokens","instance","cookies","extensions","storage"],Ir=(()=>{const e=window.location.pathname.match(/^\/preview\/([^/]+)\/([^/]+)/);return e?{archiveId:e[1],entryUid:e[2]}:null})();function Ht(){const e=window.location.pathname.split("/").filter(Boolean),t=Gg.includes(e[0])?e[0]:"archive",n=t==="settings"&&Yg.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,o=t==="archive"?r.get("collection")??null:null,u=o==="main"?null:o,d=r.get("archive")??null;return{view:t,settingsTab:n,q:l,tag:i,entry:a,collection:u,archive:d}}function Zg(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function ey(){const[e,t]=c.useState("loading"),[n,r]=c.useState(null);c.useEffect(()=>{(async()=>{var D,q,G;if(await um()){t("setup");return}const R=await pm();if(!R){const{collection:ae,archive:Te}=Ht();try{const De=await Pu(),ye=Te?((D=De.find(qn=>qn.id===Te))==null?void 0:D.id)??((q=De[0])==null?void 0:q.id):(G=De[0])==null?void 0:G.id;if(ye){await Lu(ye,ae),i(De),o(ye),d(ae),t("authenticated");return}}catch{}t("login");return}r(R),t("authenticated")})()},[]),c.useEffect(()=>{const _=()=>{n&&(r(null),t("login"))};return window.addEventListener("auth:expired",_),()=>window.removeEventListener("auth:expired",_)},[n]),c.useEffect(()=>{const _=()=>{const{view:R,settingsTab:D,q,tag:G,entry:ae,collection:Te}=Ht();P(R),J(D),Y(q),T(G),p(ae),m(null),C(ae?new Set([ae]):new Set),d(Te)};return window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)},[]);const[l,i]=c.useState([]),[a,o]=c.useState(null),[u,d]=c.useState(()=>Ht().collection),[y,g]=c.useState([]),[h,v]=c.useState([]),[x,S]=c.useState(()=>new Set),[N,p]=c.useState(()=>Ht().entry),[f,m]=c.useState(null),[k,C]=c.useState(()=>{const _=Ht().entry;return _?new Set([_]):new Set}),[E,T]=c.useState(()=>Ht().tag),[j,P]=c.useState(()=>Ht().view),[z,J]=c.useState(()=>Ht().settingsTab),[H,Y]=c.useState(()=>Ht().q),[ne,fe]=c.useState(""),[Fe,we]=c.useState(!1),[A,L]=c.useState([]),[Q,V]=c.useState([]),[ee,Ie]=c.useState(()=>sessionStorage.getItem("captureDialogOpen")==="true"),[te,Ne]=c.useState([]),ue=c.useRef(0),[be,Mt]=c.useState(()=>{try{const _=JSON.parse(sessionStorage.getItem("pendingCaptures")||"[]");if(Array.isArray(_))return _}catch{}return[]});c.useEffect(()=>{sessionStorage.setItem("pendingCaptures",JSON.stringify(be))},[be]);const[Ft,bt]=c.useState(()=>sessionStorage.getItem("ublockWarningIgnored")==="true"),[Ve,nt]=c.useState(null),Je=c.useRef(0),Be=c.useRef(null),Tt=c.useRef(!1),M=c.useRef(!0),X=c.useRef(null),ke=c.useRef(0),Qe=c.useRef(new Map),Pt=(n==null?void 0:n.humanize_slugs)??!1;c.useEffect(()=>{const _=++Je.current;nt(null),!(!f||!a)&&Mr(a,f.entry_uid).then(R=>{_===Je.current&&nt(R)}).catch(()=>{})},[f,a]),c.useEffect(()=>{sessionStorage.setItem("captureDialogOpen",ee)},[ee]);const Ge=c.useCallback(async(_,R,D,q)=>{if(_){we(!0);try{let G;R||D?G=await Qh(_,R,D,q):G=await Lu(_,q),v(G),C(ae=>{if(ae.size<2)return ae;const Te=new Set(G.map(ye=>ye.entry_uid)),De=new Set([...ae].filter(ye=>Te.has(ye)));return De.size===ae.size?ae:De}),fe(G.length===0?"No results":`${G.length} result${G.length===1?"":"s"}`)}catch{v([]),fe("Search failed. Try again.")}finally{we(!1)}}},[]);c.useEffect(()=>{e==="authenticated"&&(a||Pu().then(_=>{if(i(_),_.length>0){const{archive:R}=Ht(),D=R?_.find(q=>q.id===R):null;o((D==null?void 0:D.id)??_[0].id)}}))},[e,a]),c.useEffect(()=>{if(!a)return;const _=!n;if(M.current){M.current=!1;const D=[];_||(D.push(Si(a).then(L)),D.push(Fl(a).then(V))),D.length&&Promise.all(D);return}T(null),m(null),p(null),C(new Set),d(null);const R=[Ge(a,"",null,null)];_||(R.push(Si(a).then(L)),R.push(Fl(a).then(V))),Promise.all(R)},[a,n]),c.useEffect(()=>{if(a===null)return;const _=setTimeout(()=>{Ge(a,H,E,u)},300);return()=>clearTimeout(_)},[H,a,u]),c.useEffect(()=>{a!==null&&(E!==null&&P("archive"),Ge(a,H,E,u))},[E,a,u]);const bn=c.useCallback(_=>{o(_),d(null);const R=new URLSearchParams(window.location.search);R.set("archive",_),R.delete("collection");const D=R.toString();history.replaceState(null,"",window.location.pathname+(D?"?"+D:""))},[]);c.useEffect(()=>{if(!a){g([]);return}vo(a).then(g).catch(()=>g([]))},[a]);const Lt=c.useCallback(_=>{if(!n){const q=_?y.find(G=>G.collection_uid===_):y.find(G=>G.slug==="_default_");if(q!=null&&q.requires_auth){t("login");return}}d(_),m(null),p(null),C(new Set),Ge(a,H,E,_);const R=new URLSearchParams(window.location.search);_?(R.set("collection",_),R.set("archive",a)):(R.delete("collection"),a&&R.set("archive",a));const D=R.toString();history.replaceState(null,"",window.location.pathname+(D?"?"+D:""))},[a,H,E,n,y,Ge]),Bt=c.useCallback(_=>{P(_),_==="tags"&&a&&Fl(a).then(V)},[a]);c.useEffect(()=>{if(Ir)return;const _=Zg(j,z);window.location.pathname!==_&&history.pushState(null,"",_+window.location.search)},[j,z]);const $e=c.useCallback(_=>{p(_?_.entry_uid:null),m(_)},[]),Vn=c.useCallback((_,R)=>{if(Qe.current.set(_.entry_uid,_),++ke.current,R.shiftKey&&X.current!==null){R.preventDefault();const D=[...document.querySelectorAll("#entries-body [data-entry-uid]")],q=D.findIndex(ye=>ye.dataset.entryUid===X.current),G=D.findIndex(ye=>ye.dataset.entryUid===_.entry_uid);if(q===-1||G===-1){X.current=_.entry_uid,C(new Set([_.entry_uid])),$e(_);return}const ae=Math.min(q,G),Te=Math.max(q,G),De=new Set(D.slice(ae,Te+1).map(ye=>ye.dataset.entryUid));C(De),De.size===1&&$e(_)}else if(R.ctrlKey||R.metaKey){X.current=_.entry_uid;const D=new Set(k);if(D.has(_.entry_uid)?D.delete(_.entry_uid):D.add(_.entry_uid),C(D),D.size===0)$e(null);else if(D.size===1){const[q]=D,G=Qe.current.get(q)??h.find(ae=>ae.entry_uid===q)??null;if(G)$e(G);else{const ae=++ke.current;Mr(a,q).then(Te=>{ae===ke.current&&(Te!=null&&Te.summary)&&$e(Te.summary)}).catch(()=>{})}}else $e(null)}else X.current=_.entry_uid,C(new Set([_.entry_uid])),$e(_)},[h,k,$e,a]),Kt=c.useCallback(_=>{T(_)},[]),w=c.useCallback(()=>{T(null)},[]),U=c.useCallback(()=>{a&&Fl(a).then(V)},[a]),O=c.useCallback((_,R)=>{E===_?T(R):E!=null&&E.startsWith(_+"/")&&T(R+E.slice(_.length))},[E]),$=c.useCallback(_=>{(E===_||E!=null&&E.startsWith(_+"/"))&&T(null)},[E]),F=c.useCallback((_,R)=>{v(D=>D.map(q=>q.entry_uid===_?{...q,title:R}:q)),m(D=>D&&D.entry_uid===_?{...D,title:R}:D),nt(D=>D&&D.summary.entry_uid===_?{...D,summary:{...D.summary,title:R}}:D)},[]),B=c.useCallback(()=>{if(!a||!f)return;const _=++Je.current;Mr(a,f.entry_uid).then(R=>{_===Je.current&&nt(R)}).catch(()=>{})},[a,f]),ge=c.useCallback(_=>{const R=h.some(D=>D.entry_uid===_);S(D=>{const q=new Set(D);return q.add(_),q}),v(D=>D.filter(q=>q.entry_uid!==_)),m(D=>(D==null?void 0:D.entry_uid)===_?null:D),p(D=>D===_?null:D),C(D=>{const q=new Set(D);return q.delete(_),q}),R||Ge(a,H,E,u)},[h,a,H,E,u,Ge]),ce=c.useCallback(_=>{const R=new Set(h.map(q=>q.entry_uid)),D=[..._].some(q=>!R.has(q));S(q=>{const G=new Set(q);return _.forEach(ae=>G.add(ae)),G}),v(q=>q.filter(G=>!_.has(G.entry_uid))),C(new Set),m(null),p(null),D&&Ge(a,H,E,u)},[h,a,H,E,u,Ge]);c.useEffect(()=>{if(k.size>=2)p(null),m(null);else if(k.size===1){const[_]=k;p(_)}else p(null),m(null)},[k]);const je=c.useMemo(()=>h.filter(_=>k.has(_.entry_uid)),[h,k]);c.useEffect(()=>{if(!N||f)return;const _=h.find(R=>R.entry_uid===N);_&&m(_)},[h,N,f]),c.useEffect(()=>{if(Ir)return;const _=new URLSearchParams(window.location.search).get("archive"),R=new URLSearchParams;H&&R.set("q",H),j==="archive"&&E&&R.set("tag",E),j==="archive"&&N&&R.set("entry",N),j==="archive"&&u?(R.set("collection",u),a&&R.set("archive",a)):_&&a&&R.set("archive",a);const D=R.toString(),q=window.location.pathname+(D?"?"+D:"");window.location.pathname+window.location.search!==q&&history.replaceState(null,"",q)},[H,E,N,u,a,j]),c.useEffect(()=>{const _=R=>{var ae,Te,De,ye;const D=R.key==="/"&&!R.metaKey&&!R.ctrlKey&&!R.altKey,q=(R.metaKey||R.ctrlKey)&&R.key==="k";if(!D&&!q)return;const G=(ae=document.activeElement)==null?void 0:ae.tagName;D&&(G==="INPUT"||G==="TEXTAREA"||G==="SELECT")||D&&((Te=document.activeElement)!=null&&Te.isContentEditable)||(R.preventDefault(),j==="archive"?((De=Be.current)==null||De.focus(),(ye=Be.current)==null||ye.select()):(Tt.current=!0,P("archive")))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[j]),c.useEffect(()=>{const _=R=>{var K,re;if(R.metaKey||R.ctrlKey||R.altKey||R.key!=="j"&&R.key!=="k")return;const D=(K=document.activeElement)==null?void 0:K.tagName;if(D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||(re=document.activeElement)!=null&&re.isContentEditable)return;const q=[...document.querySelectorAll("#entries-body [data-entry-uid]")];if(q.length===0)return;const[G]=k.size===1?k:[null],ae=G?q.findIndex(se=>se.dataset.entryUid===G):-1,Te=R.key==="j"?Math.min(ae+1,q.length-1):Math.max(ae-1,0);if(Te===ae&&ae!==-1)return;const De=q[Te<0?0:Te],ye=De.dataset.entryUid;X.current=ye;const qn=++ke.current;C(new Set([ye]));const b=Qe.current.get(ye)??h.find(se=>se.entry_uid===ye)??null;b?$e(b):Mr(a,ye).then(se=>{qn===ke.current&&(se!=null&&se.summary)&&$e(se.summary)}).catch(()=>{}),De.scrollIntoView({block:"nearest"}),R.preventDefault()};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[k,h,$e,a]),c.useEffect(()=>{j==="archive"&&Tt.current&&(Tt.current=!1,requestAnimationFrame(()=>{var _,R;(_=Be.current)==null||_.focus(),(R=Be.current)==null||R.select()}))},[j]);const pe=c.useCallback(()=>{Ie(!0)},[]),Ue=c.useCallback(()=>{Ie(!1)},[]),ie=c.useCallback(()=>{if(a)return Promise.allSettled([Ge(a,H,E,u),Si(a).then(L)])},[a,H,E,u,Ge]),ft=c.useCallback((_,R,D="error",q=null)=>{if(D==="warning"&&Ft&&R)return;const G=++ue.current;Ne(ae=>[...ae,{id:G,text:_,locator:R,type:D,headline:q}])},[Ft]),wt=c.useCallback(_=>{Ne(R=>R.filter(D=>D.id!==_))},[]),Ws=c.useCallback(()=>{sessionStorage.setItem("ublockWarningIgnored","true"),bt(!0),Ne(_=>_.filter(R=>!(R.type==="warning"&&R.locator)))},[]),wl=c.useCallback(_=>{Mt(R=>[...R,_])},[]),Vs=c.useCallback(_=>{Mt(R=>R.filter(D=>D.id!==_))},[]),[Qn,_r]=c.useState(null),[sn,kl]=c.useState(null),Qs=c.useCallback(()=>{f&&_r(f.entry_uid)},[f]),qs=c.useCallback(()=>_r(null),[]),Ks=c.useCallback((_,R)=>{kl({src:_,entry:R})},[]),Xs=c.useCallback(()=>kl(null),[]);return c.useEffect(()=>{_r(null)},[f]),c.useEffect(()=>{const _=R=>{var q,G,ae;if(R.key!=="Escape"||ee||Qn)return;const D=(q=document.activeElement)==null?void 0:q.tagName;D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||k.size>0&&(R.preventDefault(),C(new Set),(ae=(G=document.activeElement)==null?void 0:G.blur)==null||ae.call(G))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[ee,Qn,k]),c.useEffect(()=>(document.body.classList.toggle("has-audio-bar",!!sn),()=>document.body.classList.remove("has-audio-bar")),[sn]),Ir?s.jsx(Qg,{archiveId:Ir.archiveId,entryUid:Ir.entryUid}):e==="loading"?s.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?s.jsx(Bm,{onComplete:()=>t("login")}):e==="login"?s.jsx(Fm,{onLogin:_=>{r(_),t("authenticated")}}):s.jsx(Hs.Provider,{value:{currentUser:n,setCurrentUser:r},children:s.jsxs(s.Fragment,{children:[s.jsx(Um,{archives:l,archiveId:a,onArchiveChange:bn,view:j,onViewChange:Bt,onCaptureClick:pe,collections:y,selectedCollectionUid:u,onCollectionChange:Lt,isPublicSession:!n,onSignInClick:()=>t("login")}),s.jsxs("main",{className:"app-shell",children:[s.jsxs("div",{className:"workspace",children:[j==="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:Be,className:"search-input",type:"search","aria-label":"Search archive","aria-busy":Fe,placeholder:"Search titles, URLs, types, tags…",value:H,onChange:_=>Y(_.target.value)}),s.jsx("span",{className:"kbd",children:"⌘K"})]}),s.jsxs("span",{className:"result-count",children:[ne&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:ne.split(" ")[0]})," ",ne.split(" ").slice(1).join(" ")]}),E&&s.jsxs("button",{className:"tag-filter-badge",onClick:w,children:["× ",Pt?of(E):E]})]})]}),j==="archive"&&s.jsx(rg,{entries:h,selectedUids:k,onRowClick:Vn,archiveId:a,pendingCaptures:be,deletedUids:x,isPublicSession:!n}),j==="runs"&&s.jsx(ig,{runs:A}),j==="admin"&&s.jsx(og,{archives:l}),j==="tags"&&s.jsx(ug,{archiveId:a,tagNodes:Q,tagFilter:E,onTagFilterSet:Kt,onViewChange:Bt,onTagRenamed:O,onTagDeleted:$,onTagsRefresh:U,humanizeTags:Pt}),j==="collections"&&s.jsx(dg,{archiveId:a}),j==="settings"&&s.jsx(pg,{tab:z,onTabChange:J,archiveId:a})]}),s.jsx(Ng,{archiveId:a,selectedEntry:f,selectedUids:k,selectedEntries:je,detail:Ve,onTagFilterSet:Kt,tagNodes:Q,onTagsRefresh:U,onEntryTitleChange:F,onEntryDeleted:ge,onBulkDeleted:ce,humanizeTags:Pt,onDetailRefresh:B,onOpenPreview:Qs,onPlay:Ks,isPublicSession:!n})]}),Qn&&f&&f.entry_uid===Qn&&s.jsx(Wg,{archiveId:a,entry:f,detail:Ve,onClose:qs}),sn&&s.jsx(Vg,{entry:sn.entry,src:sn.src,archiveId:a,onClose:Xs}),s.jsx(Qm,{open:ee,archiveId:a,onClose:Ue,onCaptured:ie,onToast:ft,activeJobs:be,onJobStarted:wl,onJobSettled:Vs}),s.jsx(Kg,{toasts:te,onDismiss:wt,onIgnoreUblock:Ws})]})})}lf(document.getElementById("root")).render(s.jsx(c.StrictMode,{children:s.jsx(ey,{})}));