mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
* feat: entry previews (video, tweet, article, iframe, image, audio bar)
- Add PreviewPanel dispatch hub routing by entity_kind + artifact extension
- VideoPreview: HTML5 <video> for YouTube/Instagram/TikTok/Reddit/X posts
- TweetPreview: tweet card, thread, and X article renderer (ported from x-article-renderer)
- IframePreview: sandboxed iframe for SingleFile web pages and PDFs
- ImagePreview: image viewer with click-to-open-fullsize
- AudioBar: persistent fixed-bottom player (Spotify-style) that survives entry navigation
- Lift entryDetail to App.jsx, shared between PreviewPanel and ContextRail
- 3-column layout (workspace | 300px preview | 340px rail) when preview active
- Stale-guard fixes: seq incremented before early returns in all async effects
- handleRearchive: capture startSeq/entryUid at call time, guard every async resume
- TweetPreview: reset loading/error/tweets before early-return branches
* feat: entry previews — tweet/thread/article/video/audio/image/iframe/pdf
- PreviewModal: modal overlay with new-tab link (↗) and keyboard close
- PreviewPanel: routes by entity_kind + primary_media extension to the
correct viewer (tweet/video/audio/pdf/html/image/fallback)
- TweetPreview: full X-style tweet, thread, and article renderer with
local artifact map for archived media (CDN fallback)
- AudioBar: persistent fixed bottom player, triggered via ContextRail
Play button; body.has-audio-bar pads content above it
- VideoPreview, IframePreview, ImagePreview: inline viewers
- PreviewPage: standalone /preview/:archiveId/:entryUid route
- ContextRail: Play/Preview buttons; isAudio/isPreviewable detection
- App.jsx: preview modal state, currentAudio state, preview route guard,
has-audio-bar body class effect
- routes.rs: CSP updated (media-src self blob https; frame-ancestors self;
Google Fonts + external images/scripts whitelisted)
- styles.css: preview modal, tweet-wrap scroll (min-height:0), audio bar
body padding, newtab button, preview panel flex layout
* style: tighten article/tweet preview spacing
- aMeta padding: 14px → 10px
- article title marginBottom: 10px → 8px
- aAuthorRow marginBottom: 10px → 8px
- bH1 top margin: 20px → 16px
- bH2 top margin: 18px → 14px
- bHr margin: 20px → 14px
- .preview-tweet-wrap padding: 20px → 12px (already committed)
More content visible above the fold in both modal and standalone views.
* feat: tweet/article preview quality pass
HTML entities: decode > < & etc. on sliced segments only
(entity offsets index the stored string; decoding before slicing shifts them)
Image lightbox: click any tweet/thread/article image to open full-screen
viewer; cmd+click follows <a> to open in new tab; arrow-key + ‹ › nav;
Escape closes; 1/N counter; ↗ open-in-new-tab link
Multi-image grid: 2 photos → side-by-side (180px rows); 3 → left spans
both rows; 4 → 2×2 (140px rows); single image unchanged
Empty media grid ghost: build photos/videoItems arrays first, render
.mediaGrid div only when at least one item resolved (advisory: never gate
on raw media.length when map items can all return null)
QT indicator: ↻ QT badge on tweet.is_quote_status === true entries
Modal shrinks for short content: height: 88vh → max-height: 88vh;
.preview-modal-body gets max-height: calc(88vh - 52px) so long threads
still scroll (advisory: don't rely on flex:1 once parent has no fixed height)
Video scrollbar leak: .preview-modal-body overflow: auto → hidden; each
child (tweet-wrap, video-wrap, iframe) manages its own scroll surface
Styled thin scrollbar on .preview-tweet-wrap (matches workspace rail)
ArticleRenderer: cover image and body images are lightbox-clickable;
opts thread through renderBlocksJSX → renderBlockJSX → renderAtomicJSX
* fix: move artifact fetch to api.js; stop Escape propagation from lightbox
- Export fetchEntryArtifacts(archiveId, entryUid, indices) from api.js
using Promise.all + getJson (follows project convention: all /api calls
go through api.js, never inline fetch in components)
- TweetPreview: import fetchEntryArtifacts, replace inline Promise.all
- MediaLightbox keydown handler: stopPropagation + preventDefault for
Escape/ArrowLeft/ArrowRight so the parent PreviewModal window listener
does not also fire and close the modal behind the lightbox
* fix: iframe/page preview height chain and toolbar UX
Problem: changing .preview-modal from height to max-height broke iframe
previews - <iframe style='flex:1'> needs a concrete ancestor height, which
max-height alone doesn't supply when content is shorter than the cap.
Fix - CSS:
.preview-modal--full { height: 88vh } applied to non-tweet modals
.preview-modal--full .preview-modal-body { max-height: none }
.preview-iframe-toolbar span: remove text-transform/letter-spacing
(was uppercasing the URL/title in shouty caps)
Fix - PreviewModal: className adds --full when entity_kind is not
tweet/tweet_thread; tweet previews keep shrink-to-fit behavior.
Fix - PreviewPanel: pass title + original_url from summary to IframePreview
for both HTML and PDF; wrappers use flex:1/minHeight:0 not height:100%.
Fix - IframePreview:
- Accept title + originalUrl props; show originalUrl in toolbar (falls
back to artifact src only when original_url absent); show title above
URL when available
- flex:1 + minHeight:0 instead of height:100% on the wrap div
- Single unified layout for page + pdf (both just show the iframe)
* feat: expand t.co links; linkify bare URLs in tweet and article text
Frontend:
- resolveEntityBounds: try multiple candidate strings in order (u.url
first, since that's the t.co short URL that appears in full_text)
- normalizeUrlAnn: multi-candidate search; href = expanded > url,
display = display_url > expanded > url
- linkifyText(): regex linkifier for entity-less bare URLs; trims
trailing punctuation [.,;:!?)] before linking; used in both
renderTweetTextJSX and renderInlineJSX including their early-return
paths (anns.length === 0) that previously bypassed linkification
- renderInlineJSX: fix mention href mention.name → screen_name;
replace t.co segment text with url.display when entity covers it
Scraper (vendor/twitter/scrape_user_tweet_contents.py):
- extract_tweet_data: when note_tweet text is used, pull urls/mentions/
hashtags/symbols from note_result.entity_set (correct indices for the
note text); keep media from legacy.entities (no note media downloads)
* feat: server-side t.co resolver + frontend augmentation
Server (routes.rs):
POST /api/util/resolve-tco — unauthenticated, accepts JSON array of
https://t.co/<alphanumeric> URLs only (strict regex validation, no SSRF
via input), capped at 50 per batch, 3 s timeout, redirect(Policy::none)
so the server only ever touches t.co itself. HEAD first, GET fallback if
HEAD returns no Location. Location sanitized to http/https only —
javascript:/data:/etc. fall back to the original t.co.
api.js:
resolveTcoUrls(urls) — project-convention wrapper for the new endpoint.
Returns {} on failure (callers degrade gracefully to bare t.co links).
TweetPreview.jsx:
After tweet data loads, per-tweet range-based coverage detection:
builds covered [start,end) from existing entity fromIndex/toIndex or
indices fallback, then finds regex matches whose span is NOT covered.
Resolves unique uncovered t.co URLs via resolveTcoUrls(), synthesises
one entity per occurrence (with exact fromIndex/toIndex so normalizeUrlAnn
gets correct bounds even for duplicate t.co URLs in the same tweet).
Augments entities.urls before setTweets() so all rendering paths
see expanded URLs.
* feat: suppress rendered media attachment URLs from tweet text
renderTweetTextJSX now accepts skipSpans=[] as third param.
Skip-span boundaries are added to the pts split set so a trailing
media t.co inside a plain segment still gets isolated and suppressed—
not re-linked by linkifyText. Early return only when both anns and
skipSpans are empty.
TweetCard computes mediaSkipSpans after building photos/videoItems:
for each rawMedia item whose src resolved (photo src match; any video),
resolveEntityBounds(m, ft, m.url) gives the precise [s,e] span using
indices/fromIndex first, indexOf fallback—then the span is passed to
renderTweetTextJSX so the t.co attachment URL is silently dropped.
47 lines
256 KiB
JavaScript
47 lines
256 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();var $o={exports:{}},Tl={},Ao={exports:{}},K={};/**
|
||
* @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 kr=Symbol.for("react.element"),xd=Symbol.for("react.portal"),wd=Symbol.for("react.fragment"),kd=Symbol.for("react.strict_mode"),jd=Symbol.for("react.profiler"),Sd=Symbol.for("react.provider"),Nd=Symbol.for("react.context"),_d=Symbol.for("react.forward_ref"),Cd=Symbol.for("react.suspense"),Ed=Symbol.for("react.memo"),Td=Symbol.for("react.lazy"),va=Symbol.iterator;function Pd(e){return e===null||typeof e!="object"?null:(e=va&&e[va]||e["@@iterator"],typeof e=="function"?e:null)}var Fo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Mo=Object.assign,Bo={};function Rn(e,t,n){this.props=e,this.context=t,this.refs=Bo,this.updater=n||Fo}Rn.prototype.isReactComponent={};Rn.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")};Rn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Uo(){}Uo.prototype=Rn.prototype;function yi(e,t,n){this.props=e,this.context=t,this.refs=Bo,this.updater=n||Fo}var xi=yi.prototype=new Uo;xi.constructor=yi;Mo(xi,Rn.prototype);xi.isPureReactComponent=!0;var ya=Array.isArray,Ho=Object.prototype.hasOwnProperty,wi={current:null},Wo={key:!0,ref:!0,__self:!0,__source:!0};function Vo(e,t,n){var r,l={},s=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)Ho.call(t,r)&&!Wo.hasOwnProperty(r)&&(l[r]=t[r]);var o=arguments.length-2;if(o===1)l.children=n;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];l.children=u}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)l[r]===void 0&&(l[r]=o[r]);return{$$typeof:kr,type:e,key:s,ref:a,props:l,_owner:wi.current}}function Ld(e,t){return{$$typeof:kr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ki(e){return typeof e=="object"&&e!==null&&e.$$typeof===kr}function Rd(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var xa=/\/+/g;function Ql(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Rd(""+e.key):t.toString(36)}function Vr(e,t,n,r,l){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case kr:case xd:a=!0}}if(a)return a=e,l=l(a),e=r===""?"."+Ql(a,0):r,ya(l)?(n="",e!=null&&(n=e.replace(xa,"$&/")+"/"),Vr(l,t,n,"",function(c){return c})):l!=null&&(ki(l)&&(l=Ld(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(xa,"$&/")+"/")+e)),t.push(l)),1;if(a=0,r=r===""?".":r+":",ya(e))for(var o=0;o<e.length;o++){s=e[o];var u=r+Ql(s,o);a+=Vr(s,t,n,u,l)}else if(u=Pd(e),typeof u=="function")for(e=u.call(e),o=0;!(s=e.next()).done;)s=s.value,u=r+Ql(s,o++),a+=Vr(s,t,n,u,l);else if(s==="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 Cr(e,t,n){if(e==null)return e;var r=[],l=0;return Vr(e,r,"","",function(s){return t.call(n,s,l++)}),r}function zd(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 Le={current:null},Qr={transition:null},Dd={ReactCurrentDispatcher:Le,ReactCurrentBatchConfig:Qr,ReactCurrentOwner:wi};function Qo(){throw Error("act(...) is not supported in production builds of React.")}K.Children={map:Cr,forEach:function(e,t,n){Cr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Cr(e,function(){t++}),t},toArray:function(e){return Cr(e,function(t){return t})||[]},only:function(e){if(!ki(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};K.Component=Rn;K.Fragment=wd;K.Profiler=jd;K.PureComponent=yi;K.StrictMode=kd;K.Suspense=Cd;K.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dd;K.act=Qo;K.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=Mo({},e.props),l=e.key,s=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,a=wi.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)Ho.call(t,u)&&!Wo.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:kr,type:e.type,key:l,ref:s,props:r,_owner:a}};K.createContext=function(e){return e={$$typeof:Nd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Sd,_context:e},e.Consumer=e};K.createElement=Vo;K.createFactory=function(e){var t=Vo.bind(null,e);return t.type=e,t};K.createRef=function(){return{current:null}};K.forwardRef=function(e){return{$$typeof:_d,render:e}};K.isValidElement=ki;K.lazy=function(e){return{$$typeof:Td,_payload:{_status:-1,_result:e},_init:zd}};K.memo=function(e,t){return{$$typeof:Ed,type:e,compare:t===void 0?null:t}};K.startTransition=function(e){var t=Qr.transition;Qr.transition={};try{e()}finally{Qr.transition=t}};K.unstable_act=Qo;K.useCallback=function(e,t){return Le.current.useCallback(e,t)};K.useContext=function(e){return Le.current.useContext(e)};K.useDebugValue=function(){};K.useDeferredValue=function(e){return Le.current.useDeferredValue(e)};K.useEffect=function(e,t){return Le.current.useEffect(e,t)};K.useId=function(){return Le.current.useId()};K.useImperativeHandle=function(e,t,n){return Le.current.useImperativeHandle(e,t,n)};K.useInsertionEffect=function(e,t){return Le.current.useInsertionEffect(e,t)};K.useLayoutEffect=function(e,t){return Le.current.useLayoutEffect(e,t)};K.useMemo=function(e,t){return Le.current.useMemo(e,t)};K.useReducer=function(e,t,n){return Le.current.useReducer(e,t,n)};K.useRef=function(e){return Le.current.useRef(e)};K.useState=function(e){return Le.current.useState(e)};K.useSyncExternalStore=function(e,t,n){return Le.current.useSyncExternalStore(e,t,n)};K.useTransition=function(){return Le.current.useTransition()};K.version="18.3.1";Ao.exports=K;var p=Ao.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 Id=p,bd=Symbol.for("react.element"),Od=Symbol.for("react.fragment"),$d=Object.prototype.hasOwnProperty,Ad=Id.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Fd={key:!0,ref:!0,__self:!0,__source:!0};function Ko(e,t,n){var r,l={},s=null,a=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)$d.call(t,r)&&!Fd.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:bd,type:e,key:s,ref:a,props:l,_owner:Ad.current}}Tl.Fragment=Od;Tl.jsx=Ko;Tl.jsxs=Ko;$o.exports=Tl;var i=$o.exports,Xo={exports:{}},Ue={},Jo={exports:{}},Go={};/**
|
||
* @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(z,_){var B=z.length;z.push(_);e:for(;0<B;){var N=B-1>>>1,C=z[N];if(0<l(C,_))z[N]=_,z[B]=C,B=N;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var _=z[0],B=z.pop();if(B!==_){z[0]=B;e:for(var N=0,C=z.length,F=C>>>1;N<F;){var M=2*(N+1)-1,U=z[M],Y=M+1,Q=z[Y];if(0>l(U,B))Y<C&&0>l(Q,U)?(z[N]=Q,z[Y]=B,N=Y):(z[N]=U,z[M]=B,N=M);else if(Y<C&&0>l(Q,B))z[N]=Q,z[Y]=B,N=Y;else break e}}return _}function l(z,_){var B=z.sortIndex-_.sortIndex;return B!==0?B:z.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],g=1,m=null,f=3,k=!1,y=!1,w=!1,R=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(z){for(var _=n(c);_!==null;){if(_.callback===null)r(c);else if(_.startTime<=z)r(c),_.sortIndex=_.expirationTime,t(u,_);else break;_=n(c)}}function x(z){if(w=!1,v(z),!y)if(n(u)!==null)y=!0,Ee(j);else{var _=n(c);_!==null&&ye(x,_.startTime-z)}}function j(z,_){y=!1,w&&(w=!1,h(S),S=-1),k=!0;var B=f;try{for(v(_),m=n(u);m!==null&&(!(m.expirationTime>_)||z&&!H());){var N=m.callback;if(typeof N=="function"){m.callback=null,f=m.priorityLevel;var C=N(m.expirationTime<=_);_=e.unstable_now(),typeof C=="function"?m.callback=C:m===n(u)&&r(u),v(_)}else r(u);m=n(u)}if(m!==null)var F=!0;else{var M=n(c);M!==null&&ye(x,M.startTime-_),F=!1}return F}finally{m=null,f=B,k=!1}}var T=!1,E=null,S=-1,b=5,I=-1;function H(){return!(e.unstable_now()-I<b)}function ee(){if(E!==null){var z=e.unstable_now();I=z;var _=!0;try{_=E(!0,z)}finally{_?Z():(T=!1,E=null)}}else T=!1}var Z;if(typeof d=="function")Z=function(){d(ee)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,je=te.port2;te.port1.onmessage=ee,Z=function(){je.postMessage(null)}}else Z=function(){R(ee,0)};function Ee(z){E=z,T||(T=!0,Z())}function ye(z,_){S=R(function(){z(e.unstable_now())},_)}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(z){z.callback=null},e.unstable_continueExecution=function(){y||k||(y=!0,Ee(j))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(z){switch(f){case 1:case 2:case 3:var _=3;break;default:_=f}var B=f;f=_;try{return z()}finally{f=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,_){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=f;f=z;try{return _()}finally{f=B}},e.unstable_scheduleCallback=function(z,_,B){var N=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?N+B:N):B=N,z){case 1:var C=-1;break;case 2:C=250;break;case 5:C=1073741823;break;case 4:C=1e4;break;default:C=5e3}return C=B+C,z={id:g++,callback:_,priorityLevel:z,startTime:B,expirationTime:C,sortIndex:-1},B>N?(z.sortIndex=B,t(c,z),n(u)===null&&z===n(c)&&(w?(h(S),S=-1):w=!0,ye(x,B-N))):(z.sortIndex=C,t(u,z),y||k||(y=!0,Ee(j))),z},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(z){var _=f;return function(){var B=f;f=_;try{return z.apply(this,arguments)}finally{f=B}}}})(Go);Jo.exports=Go;var Md=Jo.exports;/**
|
||
* @license React
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Bd=p,Be=Md;function P(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 Yo=new Set,lr={};function tn(e,t){Nn(e,t),Nn(e+"Capture",t)}function Nn(e,t){for(lr[e]=t,e=0;e<t.length;e++)Yo.add(t[e])}var vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),js=Object.prototype.hasOwnProperty,Ud=/^[: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]*$/,wa={},ka={};function Hd(e){return js.call(ka,e)?!0:js.call(wa,e)?!1:Ud.test(e)?ka[e]=!0:(wa[e]=!0,!1)}function Wd(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 Vd(e,t,n,r){if(t===null||typeof t>"u"||Wd(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 Re(e,t,n,r,l,s,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=s,this.removeEmptyString=a}var ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ke[e]=new Re(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ke[t]=new Re(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ke[e]=new Re(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ke[e]=new Re(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){ke[e]=new Re(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ke[e]=new Re(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ke[e]=new Re(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ke[e]=new Re(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ke[e]=new Re(e,5,!1,e.toLowerCase(),null,!1,!1)});var ji=/[\-:]([a-z])/g;function Si(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(ji,Si);ke[t]=new Re(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(ji,Si);ke[t]=new Re(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(ji,Si);ke[t]=new Re(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ke[e]=new Re(e,1,!1,e.toLowerCase(),null,!1,!1)});ke.xlinkHref=new Re("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ke[e]=new Re(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ni(e,t,n,r){var l=ke.hasOwnProperty(t)?ke[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Vd(t,n,l,r)&&(n=null),r||l===null?Hd(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 kt=Bd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Er=Symbol.for("react.element"),ln=Symbol.for("react.portal"),sn=Symbol.for("react.fragment"),_i=Symbol.for("react.strict_mode"),Ss=Symbol.for("react.profiler"),qo=Symbol.for("react.provider"),Zo=Symbol.for("react.context"),Ci=Symbol.for("react.forward_ref"),Ns=Symbol.for("react.suspense"),_s=Symbol.for("react.suspense_list"),Ei=Symbol.for("react.memo"),St=Symbol.for("react.lazy"),eu=Symbol.for("react.offscreen"),ja=Symbol.iterator;function bn(e){return e===null||typeof e!="object"?null:(e=ja&&e[ja]||e["@@iterator"],typeof e=="function"?e:null)}var ue=Object.assign,Kl;function Wn(e){if(Kl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Kl=t&&t[1]||""}return`
|
||
`+Kl+e}var Xl=!1;function Jl(e,t){if(!e||Xl)return"";Xl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var l=c.stack.split(`
|
||
`),s=r.stack.split(`
|
||
`),a=l.length-1,o=s.length-1;1<=a&&0<=o&&l[a]!==s[o];)o--;for(;1<=a&&0<=o;a--,o--)if(l[a]!==s[o]){if(a!==1||o!==1)do if(a--,o--,0>o||l[a]!==s[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{Xl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Wn(e):""}function Qd(e){switch(e.tag){case 5:return Wn(e.type);case 16:return Wn("Lazy");case 13:return Wn("Suspense");case 19:return Wn("SuspenseList");case 0:case 2:case 15:return e=Jl(e.type,!1),e;case 11:return e=Jl(e.type.render,!1),e;case 1:return e=Jl(e.type,!0),e;default:return""}}function Cs(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 sn:return"Fragment";case ln:return"Portal";case Ss:return"Profiler";case _i:return"StrictMode";case Ns:return"Suspense";case _s:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Zo:return(e.displayName||"Context")+".Consumer";case qo:return(e._context.displayName||"Context")+".Provider";case Ci:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ei:return t=e.displayName||null,t!==null?t:Cs(e.type)||"Memo";case St:t=e._payload,e=e._init;try{return Cs(e(t))}catch{}}return null}function Kd(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 Cs(t);case 8:return t===_i?"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 $t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xd(e){var t=tu(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,s.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 Tr(e){e._valueTracker||(e._valueTracker=Xd(e))}function nu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=tu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function rl(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 Es(e,t){var n=t.checked;return ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Sa(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=$t(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 ru(e,t){t=t.checked,t!=null&&Ni(e,"checked",t,!1)}function Ts(e,t){ru(e,t);var n=$t(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")?Ps(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ps(e,t.type,$t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Na(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 Ps(e,t,n){(t!=="number"||rl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Vn=Array.isArray;function vn(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=""+$t(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 Ls(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(P(91));return ue({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function _a(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(P(92));if(Vn(n)){if(1<n.length)throw Error(P(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:$t(n)}}function lu(e,t){var n=$t(t.value),r=$t(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 Ca(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function su(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 Rs(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?su(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Pr,iu=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(Pr=Pr||document.createElement("div"),Pr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Pr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function sr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jn={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},Jd=["Webkit","ms","Moz","O"];Object.keys(Jn).forEach(function(e){Jd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Jn[t]=Jn[e]})});function au(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Jn.hasOwnProperty(e)&&Jn[e]?(""+t).trim():t+"px"}function ou(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=au(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Gd=ue({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 zs(e,t){if(t){if(Gd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(P(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(P(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(P(61))}if(t.style!=null&&typeof t.style!="object")throw Error(P(62))}}function Ds(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 Is=null;function Ti(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bs=null,yn=null,xn=null;function Ea(e){if(e=Nr(e)){if(typeof bs!="function")throw Error(P(280));var t=e.stateNode;t&&(t=Dl(t),bs(e.stateNode,e.type,t))}}function uu(e){yn?xn?xn.push(e):xn=[e]:yn=e}function cu(){if(yn){var e=yn,t=xn;if(xn=yn=null,Ea(e),t)for(e=0;e<t.length;e++)Ea(t[e])}}function du(e,t){return e(t)}function fu(){}var Gl=!1;function pu(e,t,n){if(Gl)return e(t,n);Gl=!0;try{return du(e,t,n)}finally{Gl=!1,(yn!==null||xn!==null)&&(fu(),cu())}}function ir(e,t){var n=e.stateNode;if(n===null)return null;var r=Dl(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(P(231,t,typeof n));return n}var Os=!1;if(vt)try{var On={};Object.defineProperty(On,"passive",{get:function(){Os=!0}}),window.addEventListener("test",On,On),window.removeEventListener("test",On,On)}catch{Os=!1}function Yd(e,t,n,r,l,s,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(g){this.onError(g)}}var Gn=!1,ll=null,sl=!1,$s=null,qd={onError:function(e){Gn=!0,ll=e}};function Zd(e,t,n,r,l,s,a,o,u){Gn=!1,ll=null,Yd.apply(qd,arguments)}function ef(e,t,n,r,l,s,a,o,u){if(Zd.apply(this,arguments),Gn){if(Gn){var c=ll;Gn=!1,ll=null}else throw Error(P(198));sl||(sl=!0,$s=c)}}function nn(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 hu(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 Ta(e){if(nn(e)!==e)throw Error(P(188))}function tf(e){var t=e.alternate;if(!t){if(t=nn(e),t===null)throw Error(P(188));return t!==e?null:e}for(var n=e,r=t;;){var l=n.return;if(l===null)break;var s=l.alternate;if(s===null){if(r=l.return,r!==null){n=r;continue}break}if(l.child===s.child){for(s=l.child;s;){if(s===n)return Ta(l),e;if(s===r)return Ta(l),t;s=s.sibling}throw Error(P(188))}if(n.return!==r.return)n=l,r=s;else{for(var a=!1,o=l.child;o;){if(o===n){a=!0,n=l,r=s;break}if(o===r){a=!0,r=l,n=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===n){a=!0,n=s,r=l;break}if(o===r){a=!0,r=s,n=l;break}o=o.sibling}if(!a)throw Error(P(189))}}if(n.alternate!==r)throw Error(P(190))}if(n.tag!==3)throw Error(P(188));return n.stateNode.current===n?e:t}function mu(e){return e=tf(e),e!==null?gu(e):null}function gu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=gu(e);if(t!==null)return t;e=e.sibling}return null}var vu=Be.unstable_scheduleCallback,Pa=Be.unstable_cancelCallback,nf=Be.unstable_shouldYield,rf=Be.unstable_requestPaint,de=Be.unstable_now,lf=Be.unstable_getCurrentPriorityLevel,Pi=Be.unstable_ImmediatePriority,yu=Be.unstable_UserBlockingPriority,il=Be.unstable_NormalPriority,sf=Be.unstable_LowPriority,xu=Be.unstable_IdlePriority,Pl=null,ut=null;function af(e){if(ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(Pl,e,void 0,(e.current.flags&128)===128)}catch{}}var rt=Math.clz32?Math.clz32:cf,of=Math.log,uf=Math.LN2;function cf(e){return e>>>=0,e===0?32:31-(of(e)/uf|0)|0}var Lr=64,Rr=4194304;function Qn(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 al(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~l;o!==0?r=Qn(o):(s&=a,s!==0&&(r=Qn(s)))}else a=n&~l,a!==0?r=Qn(a):s!==0&&(r=Qn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&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-rt(t),l=1<<n,r|=e[n],t&=~l;return r}function df(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 ff(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,s=e.pendingLanes;0<s;){var a=31-rt(s),o=1<<a,u=l[a];u===-1?(!(o&n)||o&r)&&(l[a]=df(o,t)):u<=t&&(e.expiredLanes|=o),s&=~o}}function As(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function wu(){var e=Lr;return Lr<<=1,!(Lr&4194240)&&(Lr=64),e}function Yl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function jr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-rt(t),e[t]=n}function pf(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-rt(n),s=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~s}}function Li(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-rt(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var q=0;function ku(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var ju,Ri,Su,Nu,_u,Fs=!1,zr=[],Pt=null,Lt=null,Rt=null,ar=new Map,or=new Map,_t=[],hf="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 La(e,t){switch(e){case"focusin":case"focusout":Pt=null;break;case"dragenter":case"dragleave":Lt=null;break;case"mouseover":case"mouseout":Rt=null;break;case"pointerover":case"pointerout":ar.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":or.delete(t.pointerId)}}function $n(e,t,n,r,l,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[l]},t!==null&&(t=Nr(t),t!==null&&Ri(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function mf(e,t,n,r,l){switch(t){case"focusin":return Pt=$n(Pt,e,t,n,r,l),!0;case"dragenter":return Lt=$n(Lt,e,t,n,r,l),!0;case"mouseover":return Rt=$n(Rt,e,t,n,r,l),!0;case"pointerover":var s=l.pointerId;return ar.set(s,$n(ar.get(s)||null,e,t,n,r,l)),!0;case"gotpointercapture":return s=l.pointerId,or.set(s,$n(or.get(s)||null,e,t,n,r,l)),!0}return!1}function Cu(e){var t=Wt(e.target);if(t!==null){var n=nn(t);if(n!==null){if(t=n.tag,t===13){if(t=hu(n),t!==null){e.blockedOn=t,_u(e.priority,function(){Su(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 Kr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ms(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Is=r,n.target.dispatchEvent(r),Is=null}else return t=Nr(n),t!==null&&Ri(t),e.blockedOn=n,!1;t.shift()}return!0}function Ra(e,t,n){Kr(e)&&n.delete(t)}function gf(){Fs=!1,Pt!==null&&Kr(Pt)&&(Pt=null),Lt!==null&&Kr(Lt)&&(Lt=null),Rt!==null&&Kr(Rt)&&(Rt=null),ar.forEach(Ra),or.forEach(Ra)}function An(e,t){e.blockedOn===t&&(e.blockedOn=null,Fs||(Fs=!0,Be.unstable_scheduleCallback(Be.unstable_NormalPriority,gf)))}function ur(e){function t(l){return An(l,e)}if(0<zr.length){An(zr[0],e);for(var n=1;n<zr.length;n++){var r=zr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Pt!==null&&An(Pt,e),Lt!==null&&An(Lt,e),Rt!==null&&An(Rt,e),ar.forEach(t),or.forEach(t),n=0;n<_t.length;n++)r=_t[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<_t.length&&(n=_t[0],n.blockedOn===null);)Cu(n),n.blockedOn===null&&_t.shift()}var wn=kt.ReactCurrentBatchConfig,ol=!0;function vf(e,t,n,r){var l=q,s=wn.transition;wn.transition=null;try{q=1,zi(e,t,n,r)}finally{q=l,wn.transition=s}}function yf(e,t,n,r){var l=q,s=wn.transition;wn.transition=null;try{q=4,zi(e,t,n,r)}finally{q=l,wn.transition=s}}function zi(e,t,n,r){if(ol){var l=Ms(e,t,n,r);if(l===null)as(e,t,r,ul,n),La(e,r);else if(mf(l,e,t,n,r))r.stopPropagation();else if(La(e,r),t&4&&-1<hf.indexOf(e)){for(;l!==null;){var s=Nr(l);if(s!==null&&ju(s),s=Ms(e,t,n,r),s===null&&as(e,t,r,ul,n),s===l)break;l=s}l!==null&&r.stopPropagation()}else as(e,t,r,null,n)}}var ul=null;function Ms(e,t,n,r){if(ul=null,e=Ti(r),e=Wt(e),e!==null)if(t=nn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=hu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ul=e,null}function Eu(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(lf()){case Pi:return 1;case yu:return 4;case il:case sf:return 16;case xu:return 536870912;default:return 16}default:return 16}}var Et=null,Di=null,Xr=null;function Tu(){if(Xr)return Xr;var e,t=Di,n=t.length,r,l="value"in Et?Et.value:Et.textContent,s=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[s-r];r++);return Xr=l.slice(e,1<r?1-r:void 0)}function Jr(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 Dr(){return!0}function za(){return!1}function He(e){function t(n,r,l,s,a){this._reactName=n,this._targetInst=l,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Dr:za,this.isPropagationStopped=za,this}return ue(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=Dr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),t}var zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ii=He(zn),Sr=ue({},zn,{view:0,detail:0}),xf=He(Sr),ql,Zl,Fn,Ll=ue({},Sr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bi,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!==Fn&&(Fn&&e.type==="mousemove"?(ql=e.screenX-Fn.screenX,Zl=e.screenY-Fn.screenY):Zl=ql=0,Fn=e),ql)},movementY:function(e){return"movementY"in e?e.movementY:Zl}}),Da=He(Ll),wf=ue({},Ll,{dataTransfer:0}),kf=He(wf),jf=ue({},Sr,{relatedTarget:0}),es=He(jf),Sf=ue({},zn,{animationName:0,elapsedTime:0,pseudoElement:0}),Nf=He(Sf),_f=ue({},zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Cf=He(_f),Ef=ue({},zn,{data:0}),Ia=He(Ef),Tf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pf={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"},Lf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Rf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Lf[e])?!!t[e]:!1}function bi(){return Rf}var zf=ue({},Sr,{key:function(e){if(e.key){var t=Tf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Jr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Pf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bi,charCode:function(e){return e.type==="keypress"?Jr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Df=He(zf),If=ue({},Ll,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ba=He(If),bf=ue({},Sr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bi}),Of=He(bf),$f=ue({},zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Af=He($f),Ff=ue({},Ll,{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}),Mf=He(Ff),Bf=[9,13,27,32],Oi=vt&&"CompositionEvent"in window,Yn=null;vt&&"documentMode"in document&&(Yn=document.documentMode);var Uf=vt&&"TextEvent"in window&&!Yn,Pu=vt&&(!Oi||Yn&&8<Yn&&11>=Yn),Oa=" ",$a=!1;function Lu(e,t){switch(e){case"keyup":return Bf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ru(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var an=!1;function Hf(e,t){switch(e){case"compositionend":return Ru(t);case"keypress":return t.which!==32?null:($a=!0,Oa);case"textInput":return e=t.data,e===Oa&&$a?null:e;default:return null}}function Wf(e,t){if(an)return e==="compositionend"||!Oi&&Lu(e,t)?(e=Tu(),Xr=Di=Et=null,an=!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 Pu&&t.locale!=="ko"?null:t.data;default:return null}}var Vf={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 Aa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Vf[e.type]:t==="textarea"}function zu(e,t,n,r){uu(r),t=cl(t,"onChange"),0<t.length&&(n=new Ii("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var qn=null,cr=null;function Qf(e){Hu(e,0)}function Rl(e){var t=cn(e);if(nu(t))return e}function Kf(e,t){if(e==="change")return t}var Du=!1;if(vt){var ts;if(vt){var ns="oninput"in document;if(!ns){var Fa=document.createElement("div");Fa.setAttribute("oninput","return;"),ns=typeof Fa.oninput=="function"}ts=ns}else ts=!1;Du=ts&&(!document.documentMode||9<document.documentMode)}function Ma(){qn&&(qn.detachEvent("onpropertychange",Iu),cr=qn=null)}function Iu(e){if(e.propertyName==="value"&&Rl(cr)){var t=[];zu(t,cr,e,Ti(e)),pu(Qf,t)}}function Xf(e,t,n){e==="focusin"?(Ma(),qn=t,cr=n,qn.attachEvent("onpropertychange",Iu)):e==="focusout"&&Ma()}function Jf(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rl(cr)}function Gf(e,t){if(e==="click")return Rl(t)}function Yf(e,t){if(e==="input"||e==="change")return Rl(t)}function qf(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var st=typeof Object.is=="function"?Object.is:qf;function dr(e,t){if(st(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(!js.call(t,l)||!st(e[l],t[l]))return!1}return!0}function Ba(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ua(e,t){var n=Ba(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=Ba(n)}}function bu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ou(){for(var e=window,t=rl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=rl(e.document)}return t}function $i(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 Zf(e){var t=Ou(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&bu(n.ownerDocument.documentElement,n)){if(r!==null&&$i(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,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=Ua(n,s);var a=Ua(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(),s>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 ep=vt&&"documentMode"in document&&11>=document.documentMode,on=null,Bs=null,Zn=null,Us=!1;function Ha(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Us||on==null||on!==rl(r)||(r=on,"selectionStart"in r&&$i(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}),Zn&&dr(Zn,r)||(Zn=r,r=cl(Bs,"onSelect"),0<r.length&&(t=new Ii("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=on)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var un={animationend:Ir("Animation","AnimationEnd"),animationiteration:Ir("Animation","AnimationIteration"),animationstart:Ir("Animation","AnimationStart"),transitionend:Ir("Transition","TransitionEnd")},rs={},$u={};vt&&($u=document.createElement("div").style,"AnimationEvent"in window||(delete un.animationend.animation,delete un.animationiteration.animation,delete un.animationstart.animation),"TransitionEvent"in window||delete un.transitionend.transition);function zl(e){if(rs[e])return rs[e];if(!un[e])return e;var t=un[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $u)return rs[e]=t[n];return e}var Au=zl("animationend"),Fu=zl("animationiteration"),Mu=zl("animationstart"),Bu=zl("transitionend"),Uu=new Map,Wa="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 Ft(e,t){Uu.set(e,t),tn(t,[e])}for(var ls=0;ls<Wa.length;ls++){var ss=Wa[ls],tp=ss.toLowerCase(),np=ss[0].toUpperCase()+ss.slice(1);Ft(tp,"on"+np)}Ft(Au,"onAnimationEnd");Ft(Fu,"onAnimationIteration");Ft(Mu,"onAnimationStart");Ft("dblclick","onDoubleClick");Ft("focusin","onFocus");Ft("focusout","onBlur");Ft(Bu,"onTransitionEnd");Nn("onMouseEnter",["mouseout","mouseover"]);Nn("onMouseLeave",["mouseout","mouseover"]);Nn("onPointerEnter",["pointerout","pointerover"]);Nn("onPointerLeave",["pointerout","pointerover"]);tn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));tn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));tn("onBeforeInput",["compositionend","keypress","textInput","paste"]);tn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));tn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));tn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kn="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(" "),rp=new Set("cancel close invalid load scroll toggle".split(" ").concat(Kn));function Va(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,ef(r,t,void 0,e),e.currentTarget=null}function Hu(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 s=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==s&&l.isPropagationStopped())break e;Va(l,o,c),s=u}else for(a=0;a<r.length;a++){if(o=r[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==s&&l.isPropagationStopped())break e;Va(l,o,c),s=u}}}if(sl)throw e=$s,sl=!1,$s=null,e}function re(e,t){var n=t[Ks];n===void 0&&(n=t[Ks]=new Set);var r=e+"__bubble";n.has(r)||(Wu(t,e,2,!1),n.add(r))}function is(e,t,n){var r=0;t&&(r|=4),Wu(n,e,r,t)}var br="_reactListening"+Math.random().toString(36).slice(2);function fr(e){if(!e[br]){e[br]=!0,Yo.forEach(function(n){n!=="selectionchange"&&(rp.has(n)||is(n,!1,e),is(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[br]||(t[br]=!0,is("selectionchange",!1,t))}}function Wu(e,t,n,r){switch(Eu(t)){case 1:var l=vf;break;case 4:l=yf;break;default:l=zi}n=l.bind(null,t,n,e),l=void 0,!Os||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 as(e,t,n,r,l){var s=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=Wt(o),a===null)return;if(u=a.tag,u===5||u===6){r=s=a;continue e}o=o.parentNode}}r=r.return}pu(function(){var c=s,g=Ti(n),m=[];e:{var f=Uu.get(e);if(f!==void 0){var k=Ii,y=e;switch(e){case"keypress":if(Jr(n)===0)break e;case"keydown":case"keyup":k=Df;break;case"focusin":y="focus",k=es;break;case"focusout":y="blur",k=es;break;case"beforeblur":case"afterblur":k=es;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":k=Da;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":k=kf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":k=Of;break;case Au:case Fu:case Mu:k=Nf;break;case Bu:k=Af;break;case"scroll":k=xf;break;case"wheel":k=Mf;break;case"copy":case"cut":case"paste":k=Cf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":k=ba}var w=(t&4)!==0,R=!w&&e==="scroll",h=w?f!==null?f+"Capture":null:f;w=[];for(var d=c,v;d!==null;){v=d;var x=v.stateNode;if(v.tag===5&&x!==null&&(v=x,h!==null&&(x=ir(d,h),x!=null&&w.push(pr(d,x,v)))),R)break;d=d.return}0<w.length&&(f=new k(f,y,null,n,g),m.push({event:f,listeners:w}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",k=e==="mouseout"||e==="pointerout",f&&n!==Is&&(y=n.relatedTarget||n.fromElement)&&(Wt(y)||y[yt]))break e;if((k||f)&&(f=g.window===g?g:(f=g.ownerDocument)?f.defaultView||f.parentWindow:window,k?(y=n.relatedTarget||n.toElement,k=c,y=y?Wt(y):null,y!==null&&(R=nn(y),y!==R||y.tag!==5&&y.tag!==6)&&(y=null)):(k=null,y=c),k!==y)){if(w=Da,x="onMouseLeave",h="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(w=ba,x="onPointerLeave",h="onPointerEnter",d="pointer"),R=k==null?f:cn(k),v=y==null?f:cn(y),f=new w(x,d+"leave",k,n,g),f.target=R,f.relatedTarget=v,x=null,Wt(g)===c&&(w=new w(h,d+"enter",y,n,g),w.target=v,w.relatedTarget=R,x=w),R=x,k&&y)t:{for(w=k,h=y,d=0,v=w;v;v=rn(v))d++;for(v=0,x=h;x;x=rn(x))v++;for(;0<d-v;)w=rn(w),d--;for(;0<v-d;)h=rn(h),v--;for(;d--;){if(w===h||h!==null&&w===h.alternate)break t;w=rn(w),h=rn(h)}w=null}else w=null;k!==null&&Qa(m,f,k,w,!1),y!==null&&R!==null&&Qa(m,R,y,w,!0)}}e:{if(f=c?cn(c):window,k=f.nodeName&&f.nodeName.toLowerCase(),k==="select"||k==="input"&&f.type==="file")var j=Kf;else if(Aa(f))if(Du)j=Yf;else{j=Jf;var T=Xf}else(k=f.nodeName)&&k.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(j=Gf);if(j&&(j=j(e,c))){zu(m,j,n,g);break e}T&&T(e,f,c),e==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&Ps(f,"number",f.value)}switch(T=c?cn(c):window,e){case"focusin":(Aa(T)||T.contentEditable==="true")&&(on=T,Bs=c,Zn=null);break;case"focusout":Zn=Bs=on=null;break;case"mousedown":Us=!0;break;case"contextmenu":case"mouseup":case"dragend":Us=!1,Ha(m,n,g);break;case"selectionchange":if(ep)break;case"keydown":case"keyup":Ha(m,n,g)}var E;if(Oi)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else an?Lu(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(Pu&&n.locale!=="ko"&&(an||S!=="onCompositionStart"?S==="onCompositionEnd"&&an&&(E=Tu()):(Et=g,Di="value"in Et?Et.value:Et.textContent,an=!0)),T=cl(c,S),0<T.length&&(S=new Ia(S,e,null,n,g),m.push({event:S,listeners:T}),E?S.data=E:(E=Ru(n),E!==null&&(S.data=E)))),(E=Uf?Hf(e,n):Wf(e,n))&&(c=cl(c,"onBeforeInput"),0<c.length&&(g=new Ia("onBeforeInput","beforeinput",null,n,g),m.push({event:g,listeners:c}),g.data=E))}Hu(m,t)})}function pr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function cl(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,s=l.stateNode;l.tag===5&&s!==null&&(l=s,s=ir(e,n),s!=null&&r.unshift(pr(e,s,l)),s=ir(e,t),s!=null&&r.push(pr(e,s,l))),e=e.return}return r}function rn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qa(e,t,n,r,l){for(var s=t._reactName,a=[];n!==null&&n!==r;){var o=n,u=o.alternate,c=o.stateNode;if(u!==null&&u===r)break;o.tag===5&&c!==null&&(o=c,l?(u=ir(n,s),u!=null&&a.unshift(pr(n,u,o))):l||(u=ir(n,s),u!=null&&a.push(pr(n,u,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var lp=/\r\n?/g,sp=/\u0000|\uFFFD/g;function Ka(e){return(typeof e=="string"?e:""+e).replace(lp,`
|
||
`).replace(sp,"")}function Or(e,t,n){if(t=Ka(t),Ka(e)!==t&&n)throw Error(P(425))}function dl(){}var Hs=null,Ws=null;function Vs(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 Qs=typeof setTimeout=="function"?setTimeout:void 0,ip=typeof clearTimeout=="function"?clearTimeout:void 0,Xa=typeof Promise=="function"?Promise:void 0,ap=typeof queueMicrotask=="function"?queueMicrotask:typeof Xa<"u"?function(e){return Xa.resolve(null).then(e).catch(op)}:Qs;function op(e){setTimeout(function(){throw e})}function os(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),ur(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);ur(t)}function zt(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 Ja(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 Dn=Math.random().toString(36).slice(2),ot="__reactFiber$"+Dn,hr="__reactProps$"+Dn,yt="__reactContainer$"+Dn,Ks="__reactEvents$"+Dn,up="__reactListeners$"+Dn,cp="__reactHandles$"+Dn;function Wt(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ja(e);e!==null;){if(n=e[ot])return n;e=Ja(e)}return t}e=n,n=e.parentNode}return null}function Nr(e){return e=e[ot]||e[yt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function cn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(P(33))}function Dl(e){return e[hr]||null}var Xs=[],dn=-1;function Mt(e){return{current:e}}function le(e){0>dn||(e.current=Xs[dn],Xs[dn]=null,dn--)}function ne(e,t){dn++,Xs[dn]=e.current,e.current=t}var At={},Ce=Mt(At),Ie=Mt(!1),Gt=At;function _n(e,t){var n=e.type.contextTypes;if(!n)return At;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function be(e){return e=e.childContextTypes,e!=null}function fl(){le(Ie),le(Ce)}function Ga(e,t,n){if(Ce.current!==At)throw Error(P(168));ne(Ce,t),ne(Ie,n)}function Vu(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(P(108,Kd(e)||"Unknown",l));return ue({},n,r)}function pl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||At,Gt=Ce.current,ne(Ce,e),ne(Ie,Ie.current),!0}function Ya(e,t,n){var r=e.stateNode;if(!r)throw Error(P(169));n?(e=Vu(e,t,Gt),r.__reactInternalMemoizedMergedChildContext=e,le(Ie),le(Ce),ne(Ce,e)):le(Ie),ne(Ie,n)}var pt=null,Il=!1,us=!1;function Qu(e){pt===null?pt=[e]:pt.push(e)}function dp(e){Il=!0,Qu(e)}function Bt(){if(!us&&pt!==null){us=!0;var e=0,t=q;try{var n=pt;for(q=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}pt=null,Il=!1}catch(l){throw pt!==null&&(pt=pt.slice(e+1)),vu(Pi,Bt),l}finally{q=t,us=!1}}return null}var fn=[],pn=0,hl=null,ml=0,Ke=[],Xe=0,Yt=null,ht=1,mt="";function Ut(e,t){fn[pn++]=ml,fn[pn++]=hl,hl=e,ml=t}function Ku(e,t,n){Ke[Xe++]=ht,Ke[Xe++]=mt,Ke[Xe++]=Yt,Yt=e;var r=ht;e=mt;var l=32-rt(r)-1;r&=~(1<<l),n+=1;var s=32-rt(t)+l;if(30<s){var a=l-l%5;s=(r&(1<<a)-1).toString(32),r>>=a,l-=a,ht=1<<32-rt(t)+l|n<<l|r,mt=s+e}else ht=1<<s|n<<l|r,mt=e}function Ai(e){e.return!==null&&(Ut(e,1),Ku(e,1,0))}function Fi(e){for(;e===hl;)hl=fn[--pn],fn[pn]=null,ml=fn[--pn],fn[pn]=null;for(;e===Yt;)Yt=Ke[--Xe],Ke[Xe]=null,mt=Ke[--Xe],Ke[Xe]=null,ht=Ke[--Xe],Ke[Xe]=null}var Me=null,Fe=null,ie=!1,nt=null;function Xu(e,t){var n=Je(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 qa(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,Me=e,Fe=zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Me=e,Fe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Yt!==null?{id:ht,overflow:mt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Je(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Me=e,Fe=null,!0):!1;default:return!1}}function Js(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Gs(e){if(ie){var t=Fe;if(t){var n=t;if(!qa(e,t)){if(Js(e))throw Error(P(418));t=zt(n.nextSibling);var r=Me;t&&qa(e,t)?Xu(r,n):(e.flags=e.flags&-4097|2,ie=!1,Me=e)}}else{if(Js(e))throw Error(P(418));e.flags=e.flags&-4097|2,ie=!1,Me=e}}}function Za(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Me=e}function $r(e){if(e!==Me)return!1;if(!ie)return Za(e),ie=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Vs(e.type,e.memoizedProps)),t&&(t=Fe)){if(Js(e))throw Ju(),Error(P(418));for(;t;)Xu(e,t),t=zt(t.nextSibling)}if(Za(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(P(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Fe=zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Fe=null}}else Fe=Me?zt(e.stateNode.nextSibling):null;return!0}function Ju(){for(var e=Fe;e;)e=zt(e.nextSibling)}function Cn(){Fe=Me=null,ie=!1}function Mi(e){nt===null?nt=[e]:nt.push(e)}var fp=kt.ReactCurrentBatchConfig;function Mn(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(P(309));var r=n.stateNode}if(!r)throw Error(P(147,e));var l=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(a){var o=l.refs;a===null?delete o[s]:o[s]=a},t._stringRef=s,t)}if(typeof e!="string")throw Error(P(284));if(!n._owner)throw Error(P(290,e))}return e}function Ar(e,t){throw e=Object.prototype.toString.call(t),Error(P(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function eo(e){var t=e._init;return t(e._payload)}function Gu(e){function t(h,d){if(e){var v=h.deletions;v===null?(h.deletions=[d],h.flags|=16):v.push(d)}}function n(h,d){if(!e)return null;for(;d!==null;)t(h,d),d=d.sibling;return null}function r(h,d){for(h=new Map;d!==null;)d.key!==null?h.set(d.key,d):h.set(d.index,d),d=d.sibling;return h}function l(h,d){return h=Ot(h,d),h.index=0,h.sibling=null,h}function s(h,d,v){return h.index=v,e?(v=h.alternate,v!==null?(v=v.index,v<d?(h.flags|=2,d):v):(h.flags|=2,d)):(h.flags|=1048576,d)}function a(h){return e&&h.alternate===null&&(h.flags|=2),h}function o(h,d,v,x){return d===null||d.tag!==6?(d=gs(v,h.mode,x),d.return=h,d):(d=l(d,v),d.return=h,d)}function u(h,d,v,x){var j=v.type;return j===sn?g(h,d,v.props.children,x,v.key):d!==null&&(d.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===St&&eo(j)===d.type)?(x=l(d,v.props),x.ref=Mn(h,d,v),x.return=h,x):(x=nl(v.type,v.key,v.props,null,h.mode,x),x.ref=Mn(h,d,v),x.return=h,x)}function c(h,d,v,x){return d===null||d.tag!==4||d.stateNode.containerInfo!==v.containerInfo||d.stateNode.implementation!==v.implementation?(d=vs(v,h.mode,x),d.return=h,d):(d=l(d,v.children||[]),d.return=h,d)}function g(h,d,v,x,j){return d===null||d.tag!==7?(d=Jt(v,h.mode,x,j),d.return=h,d):(d=l(d,v),d.return=h,d)}function m(h,d,v){if(typeof d=="string"&&d!==""||typeof d=="number")return d=gs(""+d,h.mode,v),d.return=h,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Er:return v=nl(d.type,d.key,d.props,null,h.mode,v),v.ref=Mn(h,null,d),v.return=h,v;case ln:return d=vs(d,h.mode,v),d.return=h,d;case St:var x=d._init;return m(h,x(d._payload),v)}if(Vn(d)||bn(d))return d=Jt(d,h.mode,v,null),d.return=h,d;Ar(h,d)}return null}function f(h,d,v,x){var j=d!==null?d.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return j!==null?null:o(h,d,""+v,x);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Er:return v.key===j?u(h,d,v,x):null;case ln:return v.key===j?c(h,d,v,x):null;case St:return j=v._init,f(h,d,j(v._payload),x)}if(Vn(v)||bn(v))return j!==null?null:g(h,d,v,x,null);Ar(h,v)}return null}function k(h,d,v,x,j){if(typeof x=="string"&&x!==""||typeof x=="number")return h=h.get(v)||null,o(d,h,""+x,j);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Er:return h=h.get(x.key===null?v:x.key)||null,u(d,h,x,j);case ln:return h=h.get(x.key===null?v:x.key)||null,c(d,h,x,j);case St:var T=x._init;return k(h,d,v,T(x._payload),j)}if(Vn(x)||bn(x))return h=h.get(v)||null,g(d,h,x,j,null);Ar(d,x)}return null}function y(h,d,v,x){for(var j=null,T=null,E=d,S=d=0,b=null;E!==null&&S<v.length;S++){E.index>S?(b=E,E=null):b=E.sibling;var I=f(h,E,v[S],x);if(I===null){E===null&&(E=b);break}e&&E&&I.alternate===null&&t(h,E),d=s(I,d,S),T===null?j=I:T.sibling=I,T=I,E=b}if(S===v.length)return n(h,E),ie&&Ut(h,S),j;if(E===null){for(;S<v.length;S++)E=m(h,v[S],x),E!==null&&(d=s(E,d,S),T===null?j=E:T.sibling=E,T=E);return ie&&Ut(h,S),j}for(E=r(h,E);S<v.length;S++)b=k(E,h,S,v[S],x),b!==null&&(e&&b.alternate!==null&&E.delete(b.key===null?S:b.key),d=s(b,d,S),T===null?j=b:T.sibling=b,T=b);return e&&E.forEach(function(H){return t(h,H)}),ie&&Ut(h,S),j}function w(h,d,v,x){var j=bn(v);if(typeof j!="function")throw Error(P(150));if(v=j.call(v),v==null)throw Error(P(151));for(var T=j=null,E=d,S=d=0,b=null,I=v.next();E!==null&&!I.done;S++,I=v.next()){E.index>S?(b=E,E=null):b=E.sibling;var H=f(h,E,I.value,x);if(H===null){E===null&&(E=b);break}e&&E&&H.alternate===null&&t(h,E),d=s(H,d,S),T===null?j=H:T.sibling=H,T=H,E=b}if(I.done)return n(h,E),ie&&Ut(h,S),j;if(E===null){for(;!I.done;S++,I=v.next())I=m(h,I.value,x),I!==null&&(d=s(I,d,S),T===null?j=I:T.sibling=I,T=I);return ie&&Ut(h,S),j}for(E=r(h,E);!I.done;S++,I=v.next())I=k(E,h,S,I.value,x),I!==null&&(e&&I.alternate!==null&&E.delete(I.key===null?S:I.key),d=s(I,d,S),T===null?j=I:T.sibling=I,T=I);return e&&E.forEach(function(ee){return t(h,ee)}),ie&&Ut(h,S),j}function R(h,d,v,x){if(typeof v=="object"&&v!==null&&v.type===sn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Er:e:{for(var j=v.key,T=d;T!==null;){if(T.key===j){if(j=v.type,j===sn){if(T.tag===7){n(h,T.sibling),d=l(T,v.props.children),d.return=h,h=d;break e}}else if(T.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===St&&eo(j)===T.type){n(h,T.sibling),d=l(T,v.props),d.ref=Mn(h,T,v),d.return=h,h=d;break e}n(h,T);break}else t(h,T);T=T.sibling}v.type===sn?(d=Jt(v.props.children,h.mode,x,v.key),d.return=h,h=d):(x=nl(v.type,v.key,v.props,null,h.mode,x),x.ref=Mn(h,d,v),x.return=h,h=x)}return a(h);case ln:e:{for(T=v.key;d!==null;){if(d.key===T)if(d.tag===4&&d.stateNode.containerInfo===v.containerInfo&&d.stateNode.implementation===v.implementation){n(h,d.sibling),d=l(d,v.children||[]),d.return=h,h=d;break e}else{n(h,d);break}else t(h,d);d=d.sibling}d=vs(v,h.mode,x),d.return=h,h=d}return a(h);case St:return T=v._init,R(h,d,T(v._payload),x)}if(Vn(v))return y(h,d,v,x);if(bn(v))return w(h,d,v,x);Ar(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,d!==null&&d.tag===6?(n(h,d.sibling),d=l(d,v),d.return=h,h=d):(n(h,d),d=gs(v,h.mode,x),d.return=h,h=d),a(h)):n(h,d)}return R}var En=Gu(!0),Yu=Gu(!1),gl=Mt(null),vl=null,hn=null,Bi=null;function Ui(){Bi=hn=vl=null}function Hi(e){var t=gl.current;le(gl),e._currentValue=t}function Ys(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function kn(e,t){vl=e,Bi=hn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(De=!0),e.firstContext=null)}function Ye(e){var t=e._currentValue;if(Bi!==e)if(e={context:e,memoizedValue:t,next:null},hn===null){if(vl===null)throw Error(P(308));hn=e,vl.dependencies={lanes:0,firstContext:e}}else hn=hn.next=e;return t}var Vt=null;function Wi(e){Vt===null?Vt=[e]:Vt.push(e)}function qu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Wi(t)):(n.next=l.next,l.next=n),t.interleaved=n,xt(e,r)}function xt(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 Nt=!1;function Vi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zu(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 gt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Dt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,xt(e,n)}return l=r.interleaved,l===null?(t.next=t,Wi(r)):(t.next=l.next,l.next=t),r.interleaved=t,xt(e,n)}function Gr(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,Li(e,n)}}function to(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=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};s===null?l=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,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 yl(e,t,n,r){var l=e.updateQueue;Nt=!1;var s=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?s=c:a.next=c,a=u;var g=e.alternate;g!==null&&(g=g.updateQueue,o=g.lastBaseUpdate,o!==a&&(o===null?g.firstBaseUpdate=c:o.next=c,g.lastBaseUpdate=u))}if(s!==null){var m=l.baseState;a=0,g=c=u=null,o=s;do{var f=o.lane,k=o.eventTime;if((r&f)===f){g!==null&&(g=g.next={eventTime:k,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=e,w=o;switch(f=t,k=n,w.tag){case 1:if(y=w.payload,typeof y=="function"){m=y.call(k,m,f);break e}m=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,f=typeof y=="function"?y.call(k,m,f):y,f==null)break e;m=ue({},m,f);break e;case 2:Nt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=l.effects,f===null?l.effects=[o]:f.push(o))}else k={eventTime:k,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},g===null?(c=g=k,u=m):g=g.next=k,a|=f;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;f=o,o=f.next,f.next=null,l.lastBaseUpdate=f,l.shared.pending=null}}while(!0);if(g===null&&(u=m),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=g,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Zt|=a,e.lanes=a,e.memoizedState=m}}function no(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(P(191,l));l.call(r)}}}var _r={},ct=Mt(_r),mr=Mt(_r),gr=Mt(_r);function Qt(e){if(e===_r)throw Error(P(174));return e}function Qi(e,t){switch(ne(gr,t),ne(mr,e),ne(ct,_r),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Rs(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Rs(t,e)}le(ct),ne(ct,t)}function Tn(){le(ct),le(mr),le(gr)}function ec(e){Qt(gr.current);var t=Qt(ct.current),n=Rs(t,e.type);t!==n&&(ne(mr,e),ne(ct,n))}function Ki(e){mr.current===e&&(le(ct),le(mr))}var ae=Mt(0);function xl(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 cs=[];function Xi(){for(var e=0;e<cs.length;e++)cs[e]._workInProgressVersionPrimary=null;cs.length=0}var Yr=kt.ReactCurrentDispatcher,ds=kt.ReactCurrentBatchConfig,qt=0,oe=null,pe=null,ge=null,wl=!1,er=!1,vr=0,pp=0;function Se(){throw Error(P(321))}function Ji(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!st(e[n],t[n]))return!1;return!0}function Gi(e,t,n,r,l,s){if(qt=s,oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Yr.current=e===null||e.memoizedState===null?vp:yp,e=n(r,l),er){s=0;do{if(er=!1,vr=0,25<=s)throw Error(P(301));s+=1,ge=pe=null,t.updateQueue=null,Yr.current=xp,e=n(r,l)}while(er)}if(Yr.current=kl,t=pe!==null&&pe.next!==null,qt=0,ge=pe=oe=null,wl=!1,t)throw Error(P(300));return e}function Yi(){var e=vr!==0;return vr=0,e}function at(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ge===null?oe.memoizedState=ge=e:ge=ge.next=e,ge}function qe(){if(pe===null){var e=oe.alternate;e=e!==null?e.memoizedState:null}else e=pe.next;var t=ge===null?oe.memoizedState:ge.next;if(t!==null)ge=t,pe=e;else{if(e===null)throw Error(P(310));pe=e,e={memoizedState:pe.memoizedState,baseState:pe.baseState,baseQueue:pe.baseQueue,queue:pe.queue,next:null},ge===null?oe.memoizedState=ge=e:ge=ge.next=e}return ge}function yr(e,t){return typeof t=="function"?t(e):t}function fs(e){var t=qe(),n=t.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=e;var r=pe,l=r.baseQueue,s=n.pending;if(s!==null){if(l!==null){var a=l.next;l.next=s.next,s.next=a}r.baseQueue=l=s,n.pending=null}if(l!==null){s=l.next,r=r.baseState;var o=a=null,u=null,c=s;do{var g=c.lane;if((qt&g)===g)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var m={lane:g,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=m,a=r):u=u.next=m,oe.lanes|=g,Zt|=g}c=c.next}while(c!==null&&c!==s);u===null?a=r:u.next=o,st(r,t.memoizedState)||(De=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){l=e;do s=l.lane,oe.lanes|=s,Zt|=s,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ps(e){var t=qe(),n=t.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=e;var r=n.dispatch,l=n.pending,s=t.memoizedState;if(l!==null){n.pending=null;var a=l=l.next;do s=e(s,a.action),a=a.next;while(a!==l);st(s,t.memoizedState)||(De=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function tc(){}function nc(e,t){var n=oe,r=qe(),l=t(),s=!st(r.memoizedState,l);if(s&&(r.memoizedState=l,De=!0),r=r.queue,qi(sc.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||ge!==null&&ge.memoizedState.tag&1){if(n.flags|=2048,xr(9,lc.bind(null,n,r,l,t),void 0,null),ve===null)throw Error(P(349));qt&30||rc(n,t,l)}return l}function rc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=oe.updateQueue,t===null?(t={lastEffect:null,stores:null},oe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function lc(e,t,n,r){t.value=n,t.getSnapshot=r,ic(t)&&ac(e)}function sc(e,t,n){return n(function(){ic(t)&&ac(e)})}function ic(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!st(e,n)}catch{return!0}}function ac(e){var t=xt(e,1);t!==null&<(t,e,1,-1)}function ro(e){var t=at();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:e},t.queue=e,e=e.dispatch=gp.bind(null,oe,e),[t.memoizedState,e]}function xr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=oe.updateQueue,t===null?(t={lastEffect:null,stores:null},oe.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 oc(){return qe().memoizedState}function qr(e,t,n,r){var l=at();oe.flags|=e,l.memoizedState=xr(1|t,n,void 0,r===void 0?null:r)}function bl(e,t,n,r){var l=qe();r=r===void 0?null:r;var s=void 0;if(pe!==null){var a=pe.memoizedState;if(s=a.destroy,r!==null&&Ji(r,a.deps)){l.memoizedState=xr(t,n,s,r);return}}oe.flags|=e,l.memoizedState=xr(1|t,n,s,r)}function lo(e,t){return qr(8390656,8,e,t)}function qi(e,t){return bl(2048,8,e,t)}function uc(e,t){return bl(4,2,e,t)}function cc(e,t){return bl(4,4,e,t)}function dc(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 fc(e,t,n){return n=n!=null?n.concat([e]):null,bl(4,4,dc.bind(null,t,e),n)}function Zi(){}function pc(e,t){var n=qe();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ji(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hc(e,t){var n=qe();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ji(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function mc(e,t,n){return qt&21?(st(n,t)||(n=wu(),oe.lanes|=n,Zt|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,De=!0),e.memoizedState=n)}function hp(e,t){var n=q;q=n!==0&&4>n?n:4,e(!0);var r=ds.transition;ds.transition={};try{e(!1),t()}finally{q=n,ds.transition=r}}function gc(){return qe().memoizedState}function mp(e,t,n){var r=bt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vc(e))yc(t,n);else if(n=qu(e,t,n,r),n!==null){var l=Pe();lt(n,e,r,l),xc(n,t,r)}}function gp(e,t,n){var r=bt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vc(e))yc(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,n);if(l.hasEagerState=!0,l.eagerState=o,st(o,a)){var u=t.interleaved;u===null?(l.next=l,Wi(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=qu(e,t,l,r),n!==null&&(l=Pe(),lt(n,e,r,l),xc(n,t,r))}}function vc(e){var t=e.alternate;return e===oe||t!==null&&t===oe}function yc(e,t){er=wl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Li(e,n)}}var kl={readContext:Ye,useCallback:Se,useContext:Se,useEffect:Se,useImperativeHandle:Se,useInsertionEffect:Se,useLayoutEffect:Se,useMemo:Se,useReducer:Se,useRef:Se,useState:Se,useDebugValue:Se,useDeferredValue:Se,useTransition:Se,useMutableSource:Se,useSyncExternalStore:Se,useId:Se,unstable_isNewReconciler:!1},vp={readContext:Ye,useCallback:function(e,t){return at().memoizedState=[e,t===void 0?null:t],e},useContext:Ye,useEffect:lo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,qr(4194308,4,dc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qr(4194308,4,e,t)},useInsertionEffect:function(e,t){return qr(4,2,e,t)},useMemo:function(e,t){var n=at();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=at();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=mp.bind(null,oe,e),[r.memoizedState,e]},useRef:function(e){var t=at();return e={current:e},t.memoizedState=e},useState:ro,useDebugValue:Zi,useDeferredValue:function(e){return at().memoizedState=e},useTransition:function(){var e=ro(!1),t=e[0];return e=hp.bind(null,e[1]),at().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=oe,l=at();if(ie){if(n===void 0)throw Error(P(407));n=n()}else{if(n=t(),ve===null)throw Error(P(349));qt&30||rc(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,lo(sc.bind(null,r,s,e),[e]),r.flags|=2048,xr(9,lc.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=at(),t=ve.identifierPrefix;if(ie){var n=mt,r=ht;n=(r&~(1<<32-rt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=pp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},yp={readContext:Ye,useCallback:pc,useContext:Ye,useEffect:qi,useImperativeHandle:fc,useInsertionEffect:uc,useLayoutEffect:cc,useMemo:hc,useReducer:fs,useRef:oc,useState:function(){return fs(yr)},useDebugValue:Zi,useDeferredValue:function(e){var t=qe();return mc(t,pe.memoizedState,e)},useTransition:function(){var e=fs(yr)[0],t=qe().memoizedState;return[e,t]},useMutableSource:tc,useSyncExternalStore:nc,useId:gc,unstable_isNewReconciler:!1},xp={readContext:Ye,useCallback:pc,useContext:Ye,useEffect:qi,useImperativeHandle:fc,useInsertionEffect:uc,useLayoutEffect:cc,useMemo:hc,useReducer:ps,useRef:oc,useState:function(){return ps(yr)},useDebugValue:Zi,useDeferredValue:function(e){var t=qe();return pe===null?t.memoizedState=e:mc(t,pe.memoizedState,e)},useTransition:function(){var e=ps(yr)[0],t=qe().memoizedState;return[e,t]},useMutableSource:tc,useSyncExternalStore:nc,useId:gc,unstable_isNewReconciler:!1};function et(e,t){if(e&&e.defaultProps){t=ue({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ue({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ol={isMounted:function(e){return(e=e._reactInternals)?nn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Pe(),l=bt(e),s=gt(r,l);s.payload=t,n!=null&&(s.callback=n),t=Dt(e,s,l),t!==null&&(lt(t,e,l,r),Gr(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Pe(),l=bt(e),s=gt(r,l);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Dt(e,s,l),t!==null&&(lt(t,e,l,r),Gr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pe(),r=bt(e),l=gt(n,r);l.tag=2,t!=null&&(l.callback=t),t=Dt(e,l,r),t!==null&&(lt(t,e,r,n),Gr(t,e,r))}};function so(e,t,n,r,l,s,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,a):t.prototype&&t.prototype.isPureReactComponent?!dr(n,r)||!dr(l,s):!0}function wc(e,t,n){var r=!1,l=At,s=t.contextType;return typeof s=="object"&&s!==null?s=Ye(s):(l=be(t)?Gt:Ce.current,r=t.contextTypes,s=(r=r!=null)?_n(e,l):At),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ol,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=s),t}function io(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&&Ol.enqueueReplaceState(t,t.state,null)}function Zs(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},Vi(e);var s=t.contextType;typeof s=="object"&&s!==null?l.context=Ye(s):(s=be(t)?Gt:Ce.current,l.context=_n(e,s)),l.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(qs(e,t,s,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&&Ol.enqueueReplaceState(l,l.state,null),yl(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Pn(e,t){try{var n="",r=t;do n+=Qd(r),r=r.return;while(r);var l=n}catch(s){l=`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}return{value:e,source:t,stack:l,digest:null}}function hs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ei(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var wp=typeof WeakMap=="function"?WeakMap:Map;function kc(e,t,n){n=gt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Sl||(Sl=!0,ci=r),ei(e,t)},n}function jc(e,t,n){n=gt(-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(){ei(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){ei(e,t),typeof r!="function"&&(It===null?It=new Set([this]):It.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function ao(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new wp;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=Ip.bind(null,e,t,n),t.then(e,e))}function oo(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 uo(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=gt(-1,1),t.tag=2,Dt(n,t,1))),n.lanes|=1),e)}var kp=kt.ReactCurrentOwner,De=!1;function Te(e,t,n,r){t.child=e===null?Yu(t,null,n,r):En(t,e.child,n,r)}function co(e,t,n,r,l){n=n.render;var s=t.ref;return kn(t,l),r=Gi(e,t,n,r,s,l),n=Yi(),e!==null&&!De?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,wt(e,t,l)):(ie&&n&&Ai(t),t.flags|=1,Te(e,t,r,l),t.child)}function fo(e,t,n,r,l){if(e===null){var s=n.type;return typeof s=="function"&&!aa(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Sc(e,t,s,r,l)):(e=nl(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&l)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:dr,n(a,r)&&e.ref===t.ref)return wt(e,t,l)}return t.flags|=1,e=Ot(s,r),e.ref=t.ref,e.return=t,t.child=e}function Sc(e,t,n,r,l){if(e!==null){var s=e.memoizedProps;if(dr(s,r)&&e.ref===t.ref)if(De=!1,t.pendingProps=r=s,(e.lanes&l)!==0)e.flags&131072&&(De=!0);else return t.lanes=e.lanes,wt(e,t,l)}return ti(e,t,n,r,l)}function Nc(e,t,n){var r=t.pendingProps,l=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ne(gn,Ae),Ae|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ne(gn,Ae),Ae|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ne(gn,Ae),Ae|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,ne(gn,Ae),Ae|=r;return Te(e,t,l,n),t.child}function _c(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ti(e,t,n,r,l){var s=be(n)?Gt:Ce.current;return s=_n(t,s),kn(t,l),n=Gi(e,t,n,r,s,l),r=Yi(),e!==null&&!De?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,wt(e,t,l)):(ie&&r&&Ai(t),t.flags|=1,Te(e,t,n,l),t.child)}function po(e,t,n,r,l){if(be(n)){var s=!0;pl(t)}else s=!1;if(kn(t,l),t.stateNode===null)Zr(e,t),wc(t,n,r),Zs(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=Ye(c):(c=be(n)?Gt:Ce.current,c=_n(t,c));var g=n.getDerivedStateFromProps,m=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function";m||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==c)&&io(t,a,r,c),Nt=!1;var f=t.memoizedState;a.state=f,yl(t,r,a,l),u=t.memoizedState,o!==r||f!==u||Ie.current||Nt?(typeof g=="function"&&(qs(t,n,g,r),u=t.memoizedState),(o=Nt||so(t,n,o,r,f,u,c))?(m||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Zu(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:et(t.type,o),a.props=c,m=t.pendingProps,f=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=Ye(u):(u=be(n)?Gt:Ce.current,u=_n(t,u));var k=n.getDerivedStateFromProps;(g=typeof k=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==m||f!==u)&&io(t,a,r,u),Nt=!1,f=t.memoizedState,a.state=f,yl(t,r,a,l);var y=t.memoizedState;o!==m||f!==y||Ie.current||Nt?(typeof k=="function"&&(qs(t,n,k,r),y=t.memoizedState),(c=Nt||so(t,n,c,r,f,y,u)||!1)?(g||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return ni(e,t,n,r,s,l)}function ni(e,t,n,r,l,s){_c(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&Ya(t,n,!1),wt(e,t,s);r=t.stateNode,kp.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=En(t,e.child,null,s),t.child=En(t,null,o,s)):Te(e,t,o,s),t.memoizedState=r.state,l&&Ya(t,n,!0),t.child}function Cc(e){var t=e.stateNode;t.pendingContext?Ga(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ga(e,t.context,!1),Qi(e,t.containerInfo)}function ho(e,t,n,r,l){return Cn(),Mi(l),t.flags|=256,Te(e,t,n,r),t.child}var ri={dehydrated:null,treeContext:null,retryLane:0};function li(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ec(e,t,n){var r=t.pendingProps,l=ae.current,s=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(l&2)!==0),o?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),ne(ae,l&1),e===null)return Gs(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,s?(r=t.mode,s=t.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=Fl(a,r,0,null),e=Jt(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=li(n),t.memoizedState=ri,e):ea(t,a));if(l=e.memoizedState,l!==null&&(o=l.dehydrated,o!==null))return jp(e,t,a,r,o,l,n);if(s){s=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=Ot(l,u),r.subtreeFlags=l.subtreeFlags&14680064),o!==null?s=Ot(o,s):(s=Jt(s,a,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,a=e.child.memoizedState,a=a===null?li(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=e.childLanes&~n,t.memoizedState=ri,r}return s=e.child,e=s.sibling,r=Ot(s,{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 ea(e,t){return t=Fl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Fr(e,t,n,r){return r!==null&&Mi(r),En(t,e.child,null,n),e=ea(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jp(e,t,n,r,l,s,a){if(n)return t.flags&256?(t.flags&=-257,r=hs(Error(P(422))),Fr(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,l=t.mode,r=Fl({mode:"visible",children:r.children},l,0,null),s=Jt(s,l,a,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&En(t,e.child,null,a),t.child.memoizedState=li(a),t.memoizedState=ri,s);if(!(t.mode&1))return Fr(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var o=r.dgst;return r=o,s=Error(P(419)),r=hs(s,r,void 0),Fr(e,t,a,r)}if(o=(a&e.childLanes)!==0,De||o){if(r=ve,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!==s.retryLane&&(s.retryLane=l,xt(e,l),lt(r,e,l,-1))}return ia(),r=hs(Error(P(421))),Fr(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=bp.bind(null,e),l._reactRetry=t,null):(e=s.treeContext,Fe=zt(l.nextSibling),Me=t,ie=!0,nt=null,e!==null&&(Ke[Xe++]=ht,Ke[Xe++]=mt,Ke[Xe++]=Yt,ht=e.id,mt=e.overflow,Yt=t),t=ea(t,r.children),t.flags|=4096,t)}function mo(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ys(e.return,t,n)}function ms(e,t,n,r,l){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=l)}function Tc(e,t,n){var r=t.pendingProps,l=r.revealOrder,s=r.tail;if(Te(e,t,r.children,n),r=ae.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&&mo(e,n,t);else if(e.tag===19)mo(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(ne(ae,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&&xl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ms(t,!1,l,n,s);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&xl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ms(t,!0,n,null,s);break;case"together":ms(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Zr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function wt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zt|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(P(153));if(t.child!==null){for(e=t.child,n=Ot(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ot(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Sp(e,t,n){switch(t.tag){case 3:Cc(t),Cn();break;case 5:ec(t);break;case 1:be(t.type)&&pl(t);break;case 4:Qi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;ne(gl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ne(ae,ae.current&1),t.flags|=128,null):n&t.child.childLanes?Ec(e,t,n):(ne(ae,ae.current&1),e=wt(e,t,n),e!==null?e.sibling:null);ne(ae,ae.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Tc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),ne(ae,ae.current),r)break;return null;case 22:case 23:return t.lanes=0,Nc(e,t,n)}return wt(e,t,n)}var Pc,si,Lc,Rc;Pc=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}};si=function(){};Lc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Qt(ct.current);var s=null;switch(n){case"input":l=Es(e,l),r=Es(e,r),s=[];break;case"select":l=ue({},l,{value:void 0}),r=ue({},r,{value:void 0}),s=[];break;case"textarea":l=Ls(e,l),r=Ls(e,r),s=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=dl)}zs(n,r);var a;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var o=l[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(lr.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var u=r[c];if(o=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(s||(s=[]),s.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(s=s||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(s=s||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(lr.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&re("scroll",e),s||o===u||(s=[])):(s=s||[]).push(c,u))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};Rc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Bn(e,t){if(!ie)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 Ne(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 Np(e,t,n){var r=t.pendingProps;switch(Fi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ne(t),null;case 1:return be(t.type)&&fl(),Ne(t),null;case 3:return r=t.stateNode,Tn(),le(Ie),le(Ce),Xi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&($r(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,nt!==null&&(pi(nt),nt=null))),si(e,t),Ne(t),null;case 5:Ki(t);var l=Qt(gr.current);if(n=t.type,e!==null&&t.stateNode!=null)Lc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(P(166));return Ne(t),null}if(e=Qt(ct.current),$r(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[ot]=t,r[hr]=s,e=(t.mode&1)!==0,n){case"dialog":re("cancel",r),re("close",r);break;case"iframe":case"object":case"embed":re("load",r);break;case"video":case"audio":for(l=0;l<Kn.length;l++)re(Kn[l],r);break;case"source":re("error",r);break;case"img":case"image":case"link":re("error",r),re("load",r);break;case"details":re("toggle",r);break;case"input":Sa(r,s),re("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},re("invalid",r);break;case"textarea":_a(r,s),re("invalid",r)}zs(n,s),l=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];a==="children"?typeof o=="string"?r.textContent!==o&&(s.suppressHydrationWarning!==!0&&Or(r.textContent,o,e),l=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&Or(r.textContent,o,e),l=["children",""+o]):lr.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&re("scroll",r)}switch(n){case"input":Tr(r),Na(r,s,!0);break;case"textarea":Tr(r),Ca(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=dl)}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=su(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[ot]=t,e[hr]=r,Pc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Ds(n,r),n){case"dialog":re("cancel",e),re("close",e),l=r;break;case"iframe":case"object":case"embed":re("load",e),l=r;break;case"video":case"audio":for(l=0;l<Kn.length;l++)re(Kn[l],e);l=r;break;case"source":re("error",e),l=r;break;case"img":case"image":case"link":re("error",e),re("load",e),l=r;break;case"details":re("toggle",e),l=r;break;case"input":Sa(e,r),l=Es(e,r),re("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=ue({},r,{value:void 0}),re("invalid",e);break;case"textarea":_a(e,r),l=Ls(e,r),re("invalid",e);break;default:l=r}zs(n,l),o=l;for(s in o)if(o.hasOwnProperty(s)){var u=o[s];s==="style"?ou(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&iu(e,u)):s==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&sr(e,u):typeof u=="number"&&sr(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(lr.hasOwnProperty(s)?u!=null&&s==="onScroll"&&re("scroll",e):u!=null&&Ni(e,s,u,a))}switch(n){case"input":Tr(e),Na(e,r,!1);break;case"textarea":Tr(e),Ca(e);break;case"option":r.value!=null&&e.setAttribute("value",""+$t(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?vn(e,!!r.multiple,s,!1):r.defaultValue!=null&&vn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=dl)}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 Ne(t),null;case 6:if(e&&t.stateNode!=null)Rc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(P(166));if(n=Qt(gr.current),Qt(ct.current),$r(t)){if(r=t.stateNode,n=t.memoizedProps,r[ot]=t,(s=r.nodeValue!==n)&&(e=Me,e!==null))switch(e.tag){case 3:Or(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Or(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ot]=t,t.stateNode=r}return Ne(t),null;case 13:if(le(ae),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ie&&Fe!==null&&t.mode&1&&!(t.flags&128))Ju(),Cn(),t.flags|=98560,s=!1;else if(s=$r(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(P(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(P(317));s[ot]=t}else Cn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ne(t),s=!1}else nt!==null&&(pi(nt),nt=null),s=!0;if(!s)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||ae.current&1?he===0&&(he=3):ia())),t.updateQueue!==null&&(t.flags|=4),Ne(t),null);case 4:return Tn(),si(e,t),e===null&&fr(t.stateNode.containerInfo),Ne(t),null;case 10:return Hi(t.type._context),Ne(t),null;case 17:return be(t.type)&&fl(),Ne(t),null;case 19:if(le(ae),s=t.memoizedState,s===null)return Ne(t),null;if(r=(t.flags&128)!==0,a=s.rendering,a===null)if(r)Bn(s,!1);else{if(he!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=xl(e),a!==null){for(t.flags|=128,Bn(s,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,e=a.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ne(ae,ae.current&1|2),t.child}e=e.sibling}s.tail!==null&&de()>Ln&&(t.flags|=128,r=!0,Bn(s,!1),t.lanes=4194304)}else{if(!r)if(e=xl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!ie)return Ne(t),null}else 2*de()-s.renderingStartTime>Ln&&n!==1073741824&&(t.flags|=128,r=!0,Bn(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=de(),t.sibling=null,n=ae.current,ne(ae,r?n&1|2:n&1),t):(Ne(t),null);case 22:case 23:return sa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ae&1073741824&&(Ne(t),t.subtreeFlags&6&&(t.flags|=8192)):Ne(t),null;case 24:return null;case 25:return null}throw Error(P(156,t.tag))}function _p(e,t){switch(Fi(t),t.tag){case 1:return be(t.type)&&fl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Tn(),le(Ie),le(Ce),Xi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ki(t),null;case 13:if(le(ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(P(340));Cn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(ae),null;case 4:return Tn(),null;case 10:return Hi(t.type._context),null;case 22:case 23:return sa(),null;case 24:return null;default:return null}}var Mr=!1,_e=!1,Cp=typeof WeakSet=="function"?WeakSet:Set,$=null;function mn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(e,t,r)}else n.current=null}function ii(e,t,n){try{n()}catch(r){ce(e,t,r)}}var go=!1;function Ep(e,t){if(Hs=ol,e=Ou(),$i(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,g=0,m=e,f=null;t:for(;;){for(var k;m!==n||l!==0&&m.nodeType!==3||(o=a+l),m!==s||r!==0&&m.nodeType!==3||(u=a+r),m.nodeType===3&&(a+=m.nodeValue.length),(k=m.firstChild)!==null;)f=m,m=k;for(;;){if(m===e)break t;if(f===n&&++c===l&&(o=a),f===s&&++g===r&&(u=a),(k=m.nextSibling)!==null)break;m=f,f=m.parentNode}m=k}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ws={focusedElem:e,selectionRange:n},ol=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,R=y.memoizedState,h=t.stateNode,d=h.getSnapshotBeforeUpdate(t.elementType===t.type?w:et(t.type,w),R);h.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(P(163))}}catch(x){ce(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return y=go,go=!1,y}function tr(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 s=l.destroy;l.destroy=void 0,s!==void 0&&ii(t,n,s)}l=l.next}while(l!==r)}}function $l(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ai(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function zc(e){var t=e.alternate;t!==null&&(e.alternate=null,zc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ot],delete t[hr],delete t[Ks],delete t[up],delete t[cp])),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 Dc(e){return e.tag===5||e.tag===3||e.tag===4}function vo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dc(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 oi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=dl));else if(r!==4&&(e=e.child,e!==null))for(oi(e,t,n),e=e.sibling;e!==null;)oi(e,t,n),e=e.sibling}function ui(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ui(e,t,n),e=e.sibling;e!==null;)ui(e,t,n),e=e.sibling}var xe=null,tt=!1;function jt(e,t,n){for(n=n.child;n!==null;)Ic(e,t,n),n=n.sibling}function Ic(e,t,n){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(Pl,n)}catch{}switch(n.tag){case 5:_e||mn(n,t);case 6:var r=xe,l=tt;xe=null,jt(e,t,n),xe=r,tt=l,xe!==null&&(tt?(e=xe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xe.removeChild(n.stateNode));break;case 18:xe!==null&&(tt?(e=xe,n=n.stateNode,e.nodeType===8?os(e.parentNode,n):e.nodeType===1&&os(e,n),ur(e)):os(xe,n.stateNode));break;case 4:r=xe,l=tt,xe=n.stateNode.containerInfo,tt=!0,jt(e,t,n),xe=r,tt=l;break;case 0:case 11:case 14:case 15:if(!_e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&ii(n,t,a),l=l.next}while(l!==r)}jt(e,t,n);break;case 1:if(!_e&&(mn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){ce(n,t,o)}jt(e,t,n);break;case 21:jt(e,t,n);break;case 22:n.mode&1?(_e=(r=_e)||n.memoizedState!==null,jt(e,t,n),_e=r):jt(e,t,n);break;default:jt(e,t,n)}}function yo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Cp),t.forEach(function(r){var l=Op.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];try{var s=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:xe=o.stateNode,tt=!1;break e;case 3:xe=o.stateNode.containerInfo,tt=!0;break e;case 4:xe=o.stateNode.containerInfo,tt=!0;break e}o=o.return}if(xe===null)throw Error(P(160));Ic(s,a,l),xe=null,tt=!1;var u=l.alternate;u!==null&&(u.return=null),l.return=null}catch(c){ce(l,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)bc(t,e),t=t.sibling}function bc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ze(t,e),it(e),r&4){try{tr(3,e,e.return),$l(3,e)}catch(w){ce(e,e.return,w)}try{tr(5,e,e.return)}catch(w){ce(e,e.return,w)}}break;case 1:Ze(t,e),it(e),r&512&&n!==null&&mn(n,n.return);break;case 5:if(Ze(t,e),it(e),r&512&&n!==null&&mn(n,n.return),e.flags&32){var l=e.stateNode;try{sr(l,"")}catch(w){ce(e,e.return,w)}}if(r&4&&(l=e.stateNode,l!=null)){var s=e.memoizedProps,a=n!==null?n.memoizedProps:s,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&s.type==="radio"&&s.name!=null&&ru(l,s),Ds(o,a);var c=Ds(o,s);for(a=0;a<u.length;a+=2){var g=u[a],m=u[a+1];g==="style"?ou(l,m):g==="dangerouslySetInnerHTML"?iu(l,m):g==="children"?sr(l,m):Ni(l,g,m,c)}switch(o){case"input":Ts(l,s);break;case"textarea":lu(l,s);break;case"select":var f=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!s.multiple;var k=s.value;k!=null?vn(l,!!s.multiple,k,!1):f!==!!s.multiple&&(s.defaultValue!=null?vn(l,!!s.multiple,s.defaultValue,!0):vn(l,!!s.multiple,s.multiple?[]:"",!1))}l[hr]=s}catch(w){ce(e,e.return,w)}}break;case 6:if(Ze(t,e),it(e),r&4){if(e.stateNode===null)throw Error(P(162));l=e.stateNode,s=e.memoizedProps;try{l.nodeValue=s}catch(w){ce(e,e.return,w)}}break;case 3:if(Ze(t,e),it(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ur(t.containerInfo)}catch(w){ce(e,e.return,w)}break;case 4:Ze(t,e),it(e);break;case 13:Ze(t,e),it(e),l=e.child,l.flags&8192&&(s=l.memoizedState!==null,l.stateNode.isHidden=s,!s||l.alternate!==null&&l.alternate.memoizedState!==null||(ra=de())),r&4&&yo(e);break;case 22:if(g=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(c=_e)||g,Ze(t,e),_e=c):Ze(t,e),it(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!g&&e.mode&1)for($=e,g=e.child;g!==null;){for(m=$=g;$!==null;){switch(f=$,k=f.child,f.tag){case 0:case 11:case 14:case 15:tr(4,f,f.return);break;case 1:mn(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(w){ce(r,n,w)}}break;case 5:mn(f,f.return);break;case 22:if(f.memoizedState!==null){wo(m);continue}}k!==null?(k.return=f,$=k):wo(m)}g=g.sibling}e:for(g=null,m=e;;){if(m.tag===5){if(g===null){g=m;try{l=m.stateNode,c?(s=l.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(o=m.stateNode,u=m.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=au("display",a))}catch(w){ce(e,e.return,w)}}}else if(m.tag===6){if(g===null)try{m.stateNode.nodeValue=c?"":m.memoizedProps}catch(w){ce(e,e.return,w)}}else if((m.tag!==22&&m.tag!==23||m.memoizedState===null||m===e)&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===e)break e;for(;m.sibling===null;){if(m.return===null||m.return===e)break e;g===m&&(g=null),m=m.return}g===m&&(g=null),m.sibling.return=m.return,m=m.sibling}}break;case 19:Ze(t,e),it(e),r&4&&yo(e);break;case 21:break;default:Ze(t,e),it(e)}}function it(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Dc(n)){var r=n;break e}n=n.return}throw Error(P(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(sr(l,""),r.flags&=-33);var s=vo(e);ui(e,s,l);break;case 3:case 4:var a=r.stateNode.containerInfo,o=vo(e);oi(e,o,a);break;default:throw Error(P(161))}}catch(u){ce(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Tp(e,t,n){$=e,Oc(e)}function Oc(e,t,n){for(var r=(e.mode&1)!==0;$!==null;){var l=$,s=l.child;if(l.tag===22&&r){var a=l.memoizedState!==null||Mr;if(!a){var o=l.alternate,u=o!==null&&o.memoizedState!==null||_e;o=Mr;var c=_e;if(Mr=a,(_e=u)&&!c)for($=l;$!==null;)a=$,u=a.child,a.tag===22&&a.memoizedState!==null?ko(l):u!==null?(u.return=a,$=u):ko(l);for(;s!==null;)$=s,Oc(s),s=s.sibling;$=l,Mr=o,_e=c}xo(e)}else l.subtreeFlags&8772&&s!==null?(s.return=l,$=s):xo(e)}}function xo(e){for(;$!==null;){var t=$;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:_e||$l(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!_e)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:et(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&no(t,s,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}no(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var g=c.memoizedState;if(g!==null){var m=g.dehydrated;m!==null&&ur(m)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}_e||t.flags&512&&ai(t)}catch(f){ce(t,t.return,f)}}if(t===e){$=null;break}if(n=t.sibling,n!==null){n.return=t.return,$=n;break}$=t.return}}function wo(e){for(;$!==null;){var t=$;if(t===e){$=null;break}var n=t.sibling;if(n!==null){n.return=t.return,$=n;break}$=t.return}}function ko(e){for(;$!==null;){var t=$;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{$l(4,t)}catch(u){ce(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(u){ce(t,l,u)}}var s=t.return;try{ai(t)}catch(u){ce(t,s,u)}break;case 5:var a=t.return;try{ai(t)}catch(u){ce(t,a,u)}}}catch(u){ce(t,t.return,u)}if(t===e){$=null;break}var o=t.sibling;if(o!==null){o.return=t.return,$=o;break}$=t.return}}var Pp=Math.ceil,jl=kt.ReactCurrentDispatcher,ta=kt.ReactCurrentOwner,Ge=kt.ReactCurrentBatchConfig,G=0,ve=null,fe=null,we=0,Ae=0,gn=Mt(0),he=0,wr=null,Zt=0,Al=0,na=0,nr=null,ze=null,ra=0,Ln=1/0,ft=null,Sl=!1,ci=null,It=null,Br=!1,Tt=null,Nl=0,rr=0,di=null,el=-1,tl=0;function Pe(){return G&6?de():el!==-1?el:el=de()}function bt(e){return e.mode&1?G&2&&we!==0?we&-we:fp.transition!==null?(tl===0&&(tl=wu()),tl):(e=q,e!==0||(e=window.event,e=e===void 0?16:Eu(e.type)),e):1}function lt(e,t,n,r){if(50<rr)throw rr=0,di=null,Error(P(185));jr(e,n,r),(!(G&2)||e!==ve)&&(e===ve&&(!(G&2)&&(Al|=n),he===4&&Ct(e,we)),Oe(e,r),n===1&&G===0&&!(t.mode&1)&&(Ln=de()+500,Il&&Bt()))}function Oe(e,t){var n=e.callbackNode;ff(e,t);var r=al(e,e===ve?we:0);if(r===0)n!==null&&Pa(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Pa(n),t===1)e.tag===0?dp(jo.bind(null,e)):Qu(jo.bind(null,e)),ap(function(){!(G&6)&&Bt()}),n=null;else{switch(ku(r)){case 1:n=Pi;break;case 4:n=yu;break;case 16:n=il;break;case 536870912:n=xu;break;default:n=il}n=Wc(n,$c.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function $c(e,t){if(el=-1,tl=0,G&6)throw Error(P(327));var n=e.callbackNode;if(jn()&&e.callbackNode!==n)return null;var r=al(e,e===ve?we:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=_l(e,r);else{t=r;var l=G;G|=2;var s=Fc();(ve!==e||we!==t)&&(ft=null,Ln=de()+500,Xt(e,t));do try{zp();break}catch(o){Ac(e,o)}while(!0);Ui(),jl.current=s,G=l,fe!==null?t=0:(ve=null,we=0,t=he)}if(t!==0){if(t===2&&(l=As(e),l!==0&&(r=l,t=fi(e,l))),t===1)throw n=wr,Xt(e,0),Ct(e,r),Oe(e,de()),n;if(t===6)Ct(e,r);else{if(l=e.current.alternate,!(r&30)&&!Lp(l)&&(t=_l(e,r),t===2&&(s=As(e),s!==0&&(r=s,t=fi(e,s))),t===1))throw n=wr,Xt(e,0),Ct(e,r),Oe(e,de()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(P(345));case 2:Ht(e,ze,ft);break;case 3:if(Ct(e,r),(r&130023424)===r&&(t=ra+500-de(),10<t)){if(al(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){Pe(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Qs(Ht.bind(null,e,ze,ft),t);break}Ht(e,ze,ft);break;case 4:if(Ct(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var a=31-rt(r);s=1<<a,a=t[a],a>l&&(l=a),r&=~s}if(r=l,r=de()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Pp(r/1960))-r,10<r){e.timeoutHandle=Qs(Ht.bind(null,e,ze,ft),r);break}Ht(e,ze,ft);break;case 5:Ht(e,ze,ft);break;default:throw Error(P(329))}}}return Oe(e,de()),e.callbackNode===n?$c.bind(null,e):null}function fi(e,t){var n=nr;return e.current.memoizedState.isDehydrated&&(Xt(e,t).flags|=256),e=_l(e,t),e!==2&&(t=ze,ze=n,t!==null&&pi(t)),e}function pi(e){ze===null?ze=e:ze.push.apply(ze,e)}function Lp(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],s=l.getSnapshot;l=l.value;try{if(!st(s(),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 Ct(e,t){for(t&=~na,t&=~Al,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-rt(t),r=1<<n;e[n]=-1,t&=~r}}function jo(e){if(G&6)throw Error(P(327));jn();var t=al(e,0);if(!(t&1))return Oe(e,de()),null;var n=_l(e,t);if(e.tag!==0&&n===2){var r=As(e);r!==0&&(t=r,n=fi(e,r))}if(n===1)throw n=wr,Xt(e,0),Ct(e,t),Oe(e,de()),n;if(n===6)throw Error(P(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ht(e,ze,ft),Oe(e,de()),null}function la(e,t){var n=G;G|=1;try{return e(t)}finally{G=n,G===0&&(Ln=de()+500,Il&&Bt())}}function en(e){Tt!==null&&Tt.tag===0&&!(G&6)&&jn();var t=G;G|=1;var n=Ge.transition,r=q;try{if(Ge.transition=null,q=1,e)return e()}finally{q=r,Ge.transition=n,G=t,!(G&6)&&Bt()}}function sa(){Ae=gn.current,le(gn)}function Xt(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ip(n)),fe!==null)for(n=fe.return;n!==null;){var r=n;switch(Fi(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&fl();break;case 3:Tn(),le(Ie),le(Ce),Xi();break;case 5:Ki(r);break;case 4:Tn();break;case 13:le(ae);break;case 19:le(ae);break;case 10:Hi(r.type._context);break;case 22:case 23:sa()}n=n.return}if(ve=e,fe=e=Ot(e.current,null),we=Ae=t,he=0,wr=null,na=Al=Zt=0,ze=nr=null,Vt!==null){for(t=0;t<Vt.length;t++)if(n=Vt[t],r=n.interleaved,r!==null){n.interleaved=null;var l=r.next,s=n.pending;if(s!==null){var a=s.next;s.next=l,r.next=a}n.pending=r}Vt=null}return e}function Ac(e,t){do{var n=fe;try{if(Ui(),Yr.current=kl,wl){for(var r=oe.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}wl=!1}if(qt=0,ge=pe=oe=null,er=!1,vr=0,ta.current=null,n===null||n.return===null){he=1,wr=t,fe=null;break}e:{var s=e,a=n.return,o=n,u=t;if(t=we,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,g=o,m=g.tag;if(!(g.mode&1)&&(m===0||m===11||m===15)){var f=g.alternate;f?(g.updateQueue=f.updateQueue,g.memoizedState=f.memoizedState,g.lanes=f.lanes):(g.updateQueue=null,g.memoizedState=null)}var k=oo(a);if(k!==null){k.flags&=-257,uo(k,a,o,s,t),k.mode&1&&ao(s,c,t),t=k,u=c;var y=t.updateQueue;if(y===null){var w=new Set;w.add(u),t.updateQueue=w}else y.add(u);break e}else{if(!(t&1)){ao(s,c,t),ia();break e}u=Error(P(426))}}else if(ie&&o.mode&1){var R=oo(a);if(R!==null){!(R.flags&65536)&&(R.flags|=256),uo(R,a,o,s,t),Mi(Pn(u,o));break e}}s=u=Pn(u,o),he!==4&&(he=2),nr===null?nr=[s]:nr.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var h=kc(s,u,t);to(s,h);break e;case 1:o=u;var d=s.type,v=s.stateNode;if(!(s.flags&128)&&(typeof d.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(It===null||!It.has(v)))){s.flags|=65536,t&=-t,s.lanes|=t;var x=jc(s,o,t);to(s,x);break e}}s=s.return}while(s!==null)}Bc(n)}catch(j){t=j,fe===n&&n!==null&&(fe=n=n.return);continue}break}while(!0)}function Fc(){var e=jl.current;return jl.current=kl,e===null?kl:e}function ia(){(he===0||he===3||he===2)&&(he=4),ve===null||!(Zt&268435455)&&!(Al&268435455)||Ct(ve,we)}function _l(e,t){var n=G;G|=2;var r=Fc();(ve!==e||we!==t)&&(ft=null,Xt(e,t));do try{Rp();break}catch(l){Ac(e,l)}while(!0);if(Ui(),G=n,jl.current=r,fe!==null)throw Error(P(261));return ve=null,we=0,he}function Rp(){for(;fe!==null;)Mc(fe)}function zp(){for(;fe!==null&&!nf();)Mc(fe)}function Mc(e){var t=Hc(e.alternate,e,Ae);e.memoizedProps=e.pendingProps,t===null?Bc(e):fe=t,ta.current=null}function Bc(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_p(n,t),n!==null){n.flags&=32767,fe=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{he=6,fe=null;return}}else if(n=Np(n,t,Ae),n!==null){fe=n;return}if(t=t.sibling,t!==null){fe=t;return}fe=t=e}while(t!==null);he===0&&(he=5)}function Ht(e,t,n){var r=q,l=Ge.transition;try{Ge.transition=null,q=1,Dp(e,t,n,r)}finally{Ge.transition=l,q=r}return null}function Dp(e,t,n,r){do jn();while(Tt!==null);if(G&6)throw Error(P(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(P(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(pf(e,s),e===ve&&(fe=ve=null,we=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Br||(Br=!0,Wc(il,function(){return jn(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Ge.transition,Ge.transition=null;var a=q;q=1;var o=G;G|=4,ta.current=null,Ep(e,n),bc(n,e),Zf(Ws),ol=!!Hs,Ws=Hs=null,e.current=n,Tp(n),rf(),G=o,q=a,Ge.transition=s}else e.current=n;if(Br&&(Br=!1,Tt=e,Nl=l),s=e.pendingLanes,s===0&&(It=null),af(n.stateNode),Oe(e,de()),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(Sl)throw Sl=!1,e=ci,ci=null,e;return Nl&1&&e.tag!==0&&jn(),s=e.pendingLanes,s&1?e===di?rr++:(rr=0,di=e):rr=0,Bt(),null}function jn(){if(Tt!==null){var e=ku(Nl),t=Ge.transition,n=q;try{if(Ge.transition=null,q=16>e?16:e,Tt===null)var r=!1;else{if(e=Tt,Tt=null,Nl=0,G&6)throw Error(P(331));var l=G;for(G|=4,$=e.current;$!==null;){var s=$,a=s.child;if($.flags&16){var o=s.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for($=c;$!==null;){var g=$;switch(g.tag){case 0:case 11:case 15:tr(8,g,s)}var m=g.child;if(m!==null)m.return=g,$=m;else for(;$!==null;){g=$;var f=g.sibling,k=g.return;if(zc(g),g===c){$=null;break}if(f!==null){f.return=k,$=f;break}$=k}}}var y=s.alternate;if(y!==null){var w=y.child;if(w!==null){y.child=null;do{var R=w.sibling;w.sibling=null,w=R}while(w!==null)}}$=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,$=a;else e:for(;$!==null;){if(s=$,s.flags&2048)switch(s.tag){case 0:case 11:case 15:tr(9,s,s.return)}var h=s.sibling;if(h!==null){h.return=s.return,$=h;break e}$=s.return}}var d=e.current;for($=d;$!==null;){a=$;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,$=v;else e:for(a=d;$!==null;){if(o=$,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:$l(9,o)}}catch(j){ce(o,o.return,j)}if(o===a){$=null;break e}var x=o.sibling;if(x!==null){x.return=o.return,$=x;break e}$=o.return}}if(G=l,Bt(),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(Pl,e)}catch{}r=!0}return r}finally{q=n,Ge.transition=t}}return!1}function So(e,t,n){t=Pn(n,t),t=kc(e,t,1),e=Dt(e,t,1),t=Pe(),e!==null&&(jr(e,1,t),Oe(e,t))}function ce(e,t,n){if(e.tag===3)So(e,e,n);else for(;t!==null;){if(t.tag===3){So(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(It===null||!It.has(r))){e=Pn(n,e),e=jc(t,e,1),t=Dt(t,e,1),e=Pe(),t!==null&&(jr(t,1,e),Oe(t,e));break}}t=t.return}}function Ip(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Pe(),e.pingedLanes|=e.suspendedLanes&n,ve===e&&(we&n)===n&&(he===4||he===3&&(we&130023424)===we&&500>de()-ra?Xt(e,0):na|=n),Oe(e,t)}function Uc(e,t){t===0&&(e.mode&1?(t=Rr,Rr<<=1,!(Rr&130023424)&&(Rr=4194304)):t=1);var n=Pe();e=xt(e,t),e!==null&&(jr(e,t,n),Oe(e,n))}function bp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Uc(e,n)}function Op(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(P(314))}r!==null&&r.delete(t),Uc(e,n)}var Hc;Hc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ie.current)De=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return De=!1,Sp(e,t,n);De=!!(e.flags&131072)}else De=!1,ie&&t.flags&1048576&&Ku(t,ml,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Zr(e,t),e=t.pendingProps;var l=_n(t,Ce.current);kn(t,n),l=Gi(null,t,r,e,l,n);var s=Yi();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,be(r)?(s=!0,pl(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Vi(t),l.updater=Ol,t.stateNode=l,l._reactInternals=t,Zs(t,r,e,n),t=ni(null,t,r,!0,s,n)):(t.tag=0,ie&&s&&Ai(t),Te(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Zr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Ap(r),e=et(r,e),l){case 0:t=ti(null,t,r,e,n);break e;case 1:t=po(null,t,r,e,n);break e;case 11:t=co(null,t,r,e,n);break e;case 14:t=fo(null,t,r,et(r.type,e),n);break e}throw Error(P(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:et(r,l),ti(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:et(r,l),po(e,t,r,l,n);case 3:e:{if(Cc(t),e===null)throw Error(P(387));r=t.pendingProps,s=t.memoizedState,l=s.element,Zu(e,t),yl(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=Pn(Error(P(423)),t),t=ho(e,t,r,n,l);break e}else if(r!==l){l=Pn(Error(P(424)),t),t=ho(e,t,r,n,l);break e}else for(Fe=zt(t.stateNode.containerInfo.firstChild),Me=t,ie=!0,nt=null,n=Yu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cn(),r===l){t=wt(e,t,n);break e}Te(e,t,r,n)}t=t.child}return t;case 5:return ec(t),e===null&&Gs(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,a=l.children,Vs(r,l)?a=null:s!==null&&Vs(r,s)&&(t.flags|=32),_c(e,t),Te(e,t,a,n),t.child;case 6:return e===null&&Gs(t),null;case 13:return Ec(e,t,n);case 4:return Qi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=En(t,null,r,n):Te(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:et(r,l),co(e,t,r,l,n);case 7:return Te(e,t,t.pendingProps,n),t.child;case 8:return Te(e,t,t.pendingProps.children,n),t.child;case 12:return Te(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,a=l.value,ne(gl,r._currentValue),r._currentValue=a,s!==null)if(st(s.value,a)){if(s.children===l.children&&!Ie.current){t=wt(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=gt(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var g=c.pending;g===null?u.next=u:(u.next=g.next,g.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ys(s.return,n,t),o.lanes|=n;break}u=u.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(P(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Ys(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Te(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,kn(t,n),l=Ye(l),r=r(l),t.flags|=1,Te(e,t,r,n),t.child;case 14:return r=t.type,l=et(r,t.pendingProps),l=et(r.type,l),fo(e,t,r,l,n);case 15:return Sc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:et(r,l),Zr(e,t),t.tag=1,be(r)?(e=!0,pl(t)):e=!1,kn(t,n),wc(t,r,l),Zs(t,r,l,n),ni(null,t,r,!0,e,n);case 19:return Tc(e,t,n);case 22:return Nc(e,t,n)}throw Error(P(156,t.tag))};function Wc(e,t){return vu(e,t)}function $p(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Je(e,t,n,r){return new $p(e,t,n,r)}function aa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ap(e){if(typeof e=="function")return aa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ci)return 11;if(e===Ei)return 14}return 2}function Ot(e,t){var n=e.alternate;return n===null?(n=Je(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function nl(e,t,n,r,l,s){var a=2;if(r=e,typeof e=="function")aa(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case sn:return Jt(n.children,l,s,t);case _i:a=8,l|=8;break;case Ss:return e=Je(12,n,t,l|2),e.elementType=Ss,e.lanes=s,e;case Ns:return e=Je(13,n,t,l),e.elementType=Ns,e.lanes=s,e;case _s:return e=Je(19,n,t,l),e.elementType=_s,e.lanes=s,e;case eu:return Fl(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qo:a=10;break e;case Zo:a=9;break e;case Ci:a=11;break e;case Ei:a=14;break e;case St:a=16,r=null;break e}throw Error(P(130,e==null?e:typeof e,""))}return t=Je(a,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Jt(e,t,n,r){return e=Je(7,e,r,t),e.lanes=n,e}function Fl(e,t,n,r){return e=Je(22,e,r,t),e.elementType=eu,e.lanes=n,e.stateNode={isHidden:!1},e}function gs(e,t,n){return e=Je(6,e,null,t),e.lanes=n,e}function vs(e,t,n){return t=Je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Fp(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=Yl(0),this.expirationTimes=Yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function oa(e,t,n,r,l,s,a,o,u){return e=new Fp(e,t,n,o,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Je(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vi(s),e}function Mp(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ln,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Vc(e){if(!e)return At;e=e._reactInternals;e:{if(nn(e)!==e||e.tag!==1)throw Error(P(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(be(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(P(171))}if(e.tag===1){var n=e.type;if(be(n))return Vu(e,n,t)}return t}function Qc(e,t,n,r,l,s,a,o,u){return e=oa(n,r,!0,e,l,s,a,o,u),e.context=Vc(null),n=e.current,r=Pe(),l=bt(n),s=gt(r,l),s.callback=t??null,Dt(n,s,l),e.current.lanes=l,jr(e,l,r),Oe(e,r),e}function Ml(e,t,n,r){var l=t.current,s=Pe(),a=bt(l);return n=Vc(n),t.context===null?t.context=n:t.pendingContext=n,t=gt(s,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Dt(l,t,a),e!==null&&(lt(e,l,a,s),Gr(e,l,a)),a}function Cl(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 No(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ua(e,t){No(e,t),(e=e.alternate)&&No(e,t)}function Bp(){return null}var Kc=typeof reportError=="function"?reportError:function(e){console.error(e)};function ca(e){this._internalRoot=e}Bl.prototype.render=ca.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(P(409));Ml(e,t,null,null)};Bl.prototype.unmount=ca.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;en(function(){Ml(null,e,null,null)}),t[yt]=null}};function Bl(e){this._internalRoot=e}Bl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Nu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<_t.length&&t!==0&&t<_t[n].priority;n++);_t.splice(n,0,e),n===0&&Cu(e)}};function da(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ul(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function _o(){}function Up(e,t,n,r,l){if(l){if(typeof r=="function"){var s=r;r=function(){var c=Cl(a);s.call(c)}}var a=Qc(t,r,e,0,null,!1,!1,"",_o);return e._reactRootContainer=a,e[yt]=a.current,fr(e.nodeType===8?e.parentNode:e),en(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var o=r;r=function(){var c=Cl(u);o.call(c)}}var u=oa(e,0,!1,null,null,!1,!1,"",_o);return e._reactRootContainer=u,e[yt]=u.current,fr(e.nodeType===8?e.parentNode:e),en(function(){Ml(t,u,n,r)}),u}function Hl(e,t,n,r,l){var s=n._reactRootContainer;if(s){var a=s;if(typeof l=="function"){var o=l;l=function(){var u=Cl(a);o.call(u)}}Ml(t,a,e,l)}else a=Up(n,t,e,l,r);return Cl(a)}ju=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Qn(t.pendingLanes);n!==0&&(Li(t,n|1),Oe(t,de()),!(G&6)&&(Ln=de()+500,Bt()))}break;case 13:en(function(){var r=xt(e,1);if(r!==null){var l=Pe();lt(r,e,1,l)}}),ua(e,1)}};Ri=function(e){if(e.tag===13){var t=xt(e,134217728);if(t!==null){var n=Pe();lt(t,e,134217728,n)}ua(e,134217728)}};Su=function(e){if(e.tag===13){var t=bt(e),n=xt(e,t);if(n!==null){var r=Pe();lt(n,e,t,r)}ua(e,t)}};Nu=function(){return q};_u=function(e,t){var n=q;try{return q=e,t()}finally{q=n}};bs=function(e,t,n){switch(t){case"input":if(Ts(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=Dl(r);if(!l)throw Error(P(90));nu(r),Ts(r,l)}}}break;case"textarea":lu(e,n);break;case"select":t=n.value,t!=null&&vn(e,!!n.multiple,t,!1)}};du=la;fu=en;var Hp={usingClientEntryPoint:!1,Events:[Nr,cn,Dl,uu,cu,la]},Un={findFiberByHostInstance:Wt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Wp={bundleType:Un.bundleType,version:Un.version,rendererPackageName:Un.rendererPackageName,rendererConfig:Un.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:kt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=mu(e),e===null?null:e.stateNode},findFiberByHostInstance:Un.findFiberByHostInstance||Bp,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 Ur=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ur.isDisabled&&Ur.supportsFiber)try{Pl=Ur.inject(Wp),ut=Ur}catch{}}Ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hp;Ue.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!da(t))throw Error(P(200));return Mp(e,t,null,n)};Ue.createRoot=function(e,t){if(!da(e))throw Error(P(299));var n=!1,r="",l=Kc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=oa(e,1,!1,null,null,n,!1,r,l),e[yt]=t.current,fr(e.nodeType===8?e.parentNode:e),new ca(t)};Ue.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(P(188)):(e=Object.keys(e).join(","),Error(P(268,e)));return e=mu(t),e=e===null?null:e.stateNode,e};Ue.flushSync=function(e){return en(e)};Ue.hydrate=function(e,t,n){if(!Ul(t))throw Error(P(200));return Hl(null,e,t,!0,n)};Ue.hydrateRoot=function(e,t,n){if(!da(e))throw Error(P(405));var r=n!=null&&n.hydratedSources||null,l=!1,s="",a=Kc;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Qc(t,null,e,1,n??null,l,!1,s,a),e[yt]=t.current,fr(e),r)for(e=0;e<r.length;e++)n=r[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new Bl(t)};Ue.render=function(e,t,n){if(!Ul(t))throw Error(P(200));return Hl(null,e,t,!1,n)};Ue.unmountComponentAtNode=function(e){if(!Ul(e))throw Error(P(40));return e._reactRootContainer?(en(function(){Hl(null,null,e,!1,function(){e._reactRootContainer=null,e[yt]=null})}),!0):!1};Ue.unstable_batchedUpdates=la;Ue.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ul(n))throw Error(P(200));if(e==null||e._reactInternals===void 0)throw Error(P(38));return Hl(e,t,n,!1,r)};Ue.version="18.3.1-next-f1338f8080-20240426";function Xc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Xc)}catch(e){console.error(e)}}Xc(),Xo.exports=Ue;var Vp=Xo.exports,Jc,Co=Vp;Jc=Co.createRoot,Co.hydrateRoot;async function me(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function Qp(){return me("/api/archives")}async function Kp(e){return me(`/api/archives/${e}/entries`)}async function Xp(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),me(`/api/archives/${e}/entries/search?${r}`)}async function hi(e,t){return me(`/api/archives/${e}/entries/${t}`)}function Jp(e,t,n){return Promise.all(n.map(r=>me(`/api/archives/${e}/entries/${t}/artifacts/${r}`)))}async function Gp(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 Yp(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 Hr(e,t){return me(`/api/archives/${e}/entries/${t}/tags`)}async function qp(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 Zp(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 eh(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 th(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 nh(e,t){const n=await fetch(`/api/archives/${e}/tags/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(await n.text())}async function Eo(e){return me(`/api/archives/${e}/runs`)}async function ys(e){return me(`/api/archives/${e}/tags`)}async function rh(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));const s=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error(a.error||`HTTP ${s.status}`)}return s.json()}async function lh(e,t){return me(`/api/archives/${e}/captures/probe?locator=${encodeURIComponent(t)}`)}async function Gc(e,t){return me(`/api/archives/${e}/capture_jobs/${t}`)}async function sh(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function ih(e,t){const n=await fetch("/api/auth/setup",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Setup failed");return n.json()}async function ah(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 oh(){await fetch("/api/auth/logout",{method:"POST"})}async function uh(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function ch(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 dh(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function fh(e,t){const n=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_password:e,new_password:t})});if(!n.ok){let r=await n.text();try{r=JSON.parse(r).error??r}catch{}throw new Error(r)}}async function ph(){return me("/api/auth/tokens")}async function hh(e){const t=await fetch("/api/auth/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw new Error(await t.text());return t.json()}async function mh(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function fa(){return me("/api/admin/instance-settings")}async function mi(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 gh(){return me("/api/admin/users")}async function vh(e,t,n){const r=await fetch("/api/admin/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:n||void 0})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error||`HTTP ${r.status}`)}return r.json()}async function yh(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 xh(){return me("/api/admin/roles")}async function wh(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 kh(e){return me(`/api/archives/${e}/collections`)}async function jh(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,slug:n,default_visibility_bits:r})});if(!l.ok){const s=await l.json().catch(()=>({error:l.statusText}));throw new Error(s.error||l.statusText)}return l.json()}async function Sh(e,t){return me(`/api/archives/${e}/collections/${t}`)}async function Nh(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 s=await l.json().catch(()=>({error:l.statusText}));throw new Error(s.error||l.statusText)}}async function _h(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 Ch(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 s=await l.json().catch(()=>({error:l.statusText}));throw new Error(s.error||l.statusText)}}async function Eh(e,t){return me(`/api/archives/${e}/entries/${t}/collections`)}async function To(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 Th(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 Ph(e){return me(`/api/archives/${e}/blob-cleanup`)}async function Lh(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 Rh(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 zh(){return me("/api/admin/cookie-rules")}async function Dh(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 Ih(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 bh(e){const t=await fetch(`/api/admin/cookie-rules/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message||`HTTP ${t.status}`)}}const Oh=window.fetch;window.fetch=async(...e)=>{var n;const t=await Oh(...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 $h({onLogin:e}){const[t,n]=p.useState(""),[r,l]=p.useState(""),[s,a]=p.useState(null),[o,u]=p.useState(!1);async function c(g){g.preventDefault(),a(null),u(!0);try{const m=await ah(t,r);e(m)}catch(m){a(m.message)}finally{u(!1)}}return i.jsx("div",{className:"login-page",children:i.jsxs("div",{className:"login-card",children:[i.jsx("h1",{className:"login-brand",children:"Archivr"}),i.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),i.jsxs("form",{onSubmit:c,children:[i.jsxs("div",{className:"login-field",children:[i.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),i.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:g=>n(g.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),i.jsxs("div",{className:"login-field",children:[i.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),i.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:g=>l(g.target.value),required:!0,autoComplete:"current-password"})]}),s&&i.jsx("p",{className:"login-error",children:s}),i.jsx("button",{className:"login-submit",type:"submit",disabled:o,children:o?"Signing in…":"Sign in"})]})]})})}function Ah({onComplete:e}){const[t,n]=p.useState(""),[r,l]=p.useState(""),[s,a]=p.useState(""),[o,u]=p.useState(null),[c,g]=p.useState(!1);async function m(f){if(f.preventDefault(),r!==s){u("Passwords do not match");return}if(r.length<8){u("Password must be at least 8 characters");return}u(null),g(!0);try{await ih(t,r),e()}catch(k){u(k.message)}finally{g(!1)}}return i.jsx("div",{className:"setup-page",children:i.jsxs("div",{className:"setup-card",children:[i.jsx("h1",{className:"setup-brand",children:"Archivr"}),i.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),i.jsxs("form",{onSubmit:m,children:[i.jsxs("div",{className:"setup-field",children:[i.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),i.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:f=>n(f.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),i.jsxs("div",{className:"setup-field",children:[i.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),i.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:f=>l(f.target.value),required:!0,autoComplete:"new-password"})]}),i.jsxs("div",{className:"setup-field",children:[i.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),i.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:s,onChange:f=>a(f.target.value),required:!0,autoComplete:"new-password"})]}),o&&i.jsx("p",{className:"setup-error",children:o}),i.jsx("button",{className:"setup-submit",type:"submit",disabled:c,children:c?"Creating account…":"Create account"})]})]})})}function Fh({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:s}){const{currentUser:a,setCurrentUser:o}=p.useContext(Wl)??{},[u,c]=p.useState(!1);async function g(){c(!0),await oh(),o(null),window.location.reload()}return i.jsxs("header",{className:"topbar",children:[i.jsx("div",{className:"brand",children:"Archivr"}),i.jsx("div",{className:"switcher",children:i.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>i.jsx("option",{value:m.id,children:m.label},m.id))})}),i.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","tags","collections","runs","admin","settings"].map(m=>i.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),i.jsx("button",{className:"capture-button",onClick:s,children:"Capture"}),a&&i.jsxs("div",{className:"user-menu",children:[i.jsx("span",{className:"user-name",children:a.display_name||a.username}),i.jsx("button",{className:"logout-btn",onClick:g,disabled:u,children:u?"Logging out…":"Log out"})]})]})}let gi=1;function Yc(e){const t=e.trim(),n=t.toLowerCase();for(const r of["yt:","youtube:"])if(n.startsWith(r)){const l=n.slice(r.length);return l.startsWith("video/")||l.startsWith("short/")||l.startsWith("shorts/")}if(n.startsWith("ytm:"))return!n.slice(4).startsWith("playlist/");for(const r of["x:","twitter:","tweet:"])if(n.startsWith(r))return n.slice(r.length).startsWith("media:");if(n.startsWith("spotify:"))return!1;if(n.startsWith("instagram:")||n.startsWith("facebook:")||n.startsWith("tiktok:")||n.startsWith("reddit:")||n.startsWith("snapchat:"))return!0;if(n.startsWith("http://")||n.startsWith("https://")){if(/^https?:\/\/music\.youtube\.com\/watch/.test(n)||/^https?:\/\/(?:www\.)?(?:youtu\.be\/[0-9A-Za-z_-]+|youtube\.com\/watch\?v=[0-9A-Za-z_-]+|youtube\.com\/shorts\/[0-9A-Za-z_-]+)/.test(t)||n.startsWith("https://x.com/")||n.startsWith("http://x.com/")||/^https?:\/\/(?:www\.)?instagram\.com\//.test(n)||/^https?:\/\/(?:www\.)?facebook\.com\//.test(n)||n.startsWith("https://fb.watch/")||n.startsWith("http://fb.watch/")||/^https?:\/\/(?:www\.)?tiktok\.com\//.test(n)||/^https?:\/\/(?:www\.)?reddit\.com\//.test(n)||n.startsWith("https://redd.it/")||n.startsWith("http://redd.it/")||/^https?:\/\/(?:www\.)?snapchat\.com\//.test(n))return!0;if(n.startsWith("https://open.spotify.com/")||n.startsWith("http://open.spotify.com/"))return!1}return!1}function Hn(e=""){return{id:gi++,locator:e,quality:"best",probeState:"idle",probeQualities:null,probeHasAudio:!1,status:"idle",error:null,jobUid:null,archiveId:null}}function Po(e){return e.some(t=>t.status==="submitting"||t.status==="running")}function Mh({open:e,archiveId:t,onClose:n,onCaptured:r,onToast:l}){const s=p.useRef(null),a=p.useRef(!0),o=p.useRef(new Map),u=p.useRef(new Map),c=p.useRef(new Map),g=p.useRef(t);p.useEffect(()=>{g.current=t},[t]);const m=p.useRef(r),f=p.useRef(l);p.useEffect(()=>{m.current=r},[r]),p.useEffect(()=>{f.current=l},[l]);const[k,y]=p.useState(()=>{try{const N=JSON.parse(sessionStorage.getItem("captureItems")||"null");if(Array.isArray(N)&&N.length>0)return N.forEach(C=>{C.id>=gi&&(gi=C.id+1)}),N}catch{}return[Hn()]});p.useEffect(()=>{sessionStorage.setItem("captureItems",JSON.stringify(k))},[k]);const[w,R]=p.useState(!1),[h,d]=p.useState(null),[v,x]=p.useState(null),[j,T]=p.useState(!0);p.useEffect(()=>{fa().then(N=>{x(N),T(N.cookie_ext_enabled??!0)}).catch(()=>x({}))},[]);const E=h!==null?h:(v==null?void 0:v.ublock_enabled)??!0,[S,b]=p.useState(!1);p.useEffect(()=>{["captureDialogLocator","captureDialogError","captureDialogBusy","captureDialogJobStatus","captureDialogJobUid"].forEach(N=>sessionStorage.removeItem(N)),y(N=>N.map(C=>C.status==="submitting"?{...C,status:"idle",error:null}:C)),k.forEach(N=>{N.status==="running"&&N.jobUid&&N.archiveId&&!o.current.has(N.jobUid)&&I(N.id,N.jobUid,N.locator,N.archiveId)})},[]),p.useEffect(()=>{const N=s.current;if(!N)return;const C=()=>{u.current.forEach(F=>clearTimeout(F)),u.current.clear(),n()};return N.addEventListener("close",C),()=>N.removeEventListener("close",C)},[n]),p.useEffect(()=>{const N=s.current;N&&(e?(!a.current&&!Po(k)&&y([Hn()]),a.current=!1,N.open||N.showModal()):(u.current.forEach(C=>clearTimeout(C)),u.current.clear(),N.open&&N.close()))},[e]),p.useEffect(()=>()=>{o.current.forEach(N=>clearInterval(N)),u.current.forEach(N=>clearTimeout(N))},[]);function I(N,C,F,M,U=null){if(o.current.has(C))return;const Y=setInterval(async()=>{try{const Q=await Gc(M,C);if(Q.status==="completed"){clearInterval(o.current.get(C)),o.current.delete(C),y(J=>J.map(L=>L.id===N?{...L,status:"completed"}:L)),setTimeout(()=>{y(J=>{const L=J.filter(X=>X.id!==N);return L.length===0?[Hn()]:L})},1400),m.current();try{const J=Q.notes_json?JSON.parse(Q.notes_json):null;if(J!=null&&J.ublock_skipped||J!=null&&J.cookie_ext_skipped){const X=J.ublock_skipped&&J.cookie_ext_skipped?"Captured without ad-blocking or cookie-consent extension. Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config.":J.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.";f.current(X,F,"warning"),H(U,"warning",F)}else U||f.current(null,F,"success"),H(U,"archived")}catch{U||f.current(null,F,"success"),H(U,"archived")}}else if(Q.status==="failed"){clearInterval(o.current.get(C)),o.current.delete(C);const J=Q.error_text||"Capture failed.";y(L=>L.map(X=>X.id===N?{...X,status:"failed",error:J}:X)),f.current(J,F),H(U,"failed",F)}}catch(Q){clearInterval(o.current.get(C)),o.current.delete(C);const J=Q.message||"Network error";y(L=>L.map(X=>X.id===N?{...X,status:"failed",error:J}:X)),f.current(J,F),H(U,"failed",F)}},500);o.current.set(C,Y)}function H(N,C,F=null){if(!N)return;const M=c.current.get(N);if(!M||(C==="archived"||C==="warning"?(M.archived++,C==="warning"&&(M.warnings++,F&&M.warningLocators.push(F))):(M.failed++,F&&M.failedLocators.push(F)),M.archived+M.failed<M.total))return;c.current.delete(N);const{archived:U,warnings:Y,failed:Q,failedLocators:J,warningLocators:L}=M;let X;if(U===0)X=`${Q} failed`;else{const W=Y>0?`${U} archived (${Y} with warnings)`:`${U} archived`;X=Q>0?`${W}, ${Q} failed`:W}const We=U===0?"error":Q>0||Y>0?"warning":"success",Ve=[];J.length>0&&Ve.push(`Failed:
|
||
${J.map(W=>` ${W}`).join(`
|
||
`)}`),L.length>0&&Ve.push(`With warnings:
|
||
${L.map(W=>` ${W}`).join(`
|
||
`)}`);const D=Ve.length>0?Ve.join(`
|
||
`):null;f.current(D,null,We,X)}async function ee(N,C=null){if(!N.locator.trim())return;const F=t,M=N.locator.trim(),U=N.quality||"best";y(Y=>Y.map(Q=>Q.id===N.id?{...Q,status:"submitting",error:null}:Q));try{const Q=await rh(F,M,U,{ublock_enabled:E,reader_mode:S,cookie_ext_enabled:j});y(J=>J.map(L=>L.id===N.id?{...L,status:"running",jobUid:Q.job_uid,archiveId:F}:L)),I(N.id,Q.job_uid,M,F,C)}catch(Y){const Q=Y.message||"Submission failed.";y(J=>J.map(L=>L.id===N.id?{...L,status:"failed",error:Q}:L)),f.current(Q,M),H(C,"failed",M)}}function Z(){var F,M;const N=k.filter(U=>U.status==="idle"&&U.locator.trim());if(N.length===0)return;const C=N.length>1?((F=crypto.randomUUID)==null?void 0:F.call(crypto))??`batch-${Date.now()}`:null;C&&c.current.set(C,{total:N.length,archived:0,warnings:0,failed:0,failedLocators:[],warningLocators:[]}),N.forEach(U=>ee(U,C)),(M=s.current)==null||M.close()}function te(){y(N=>[...N,Hn()])}function je(N){clearTimeout(u.current.get(N)),u.current.delete(N),y(C=>{const F=C.filter(M=>M.id!==N);return F.length===0?[Hn()]:F})}function Ee(N){y(C=>C.map(F=>F.id===N?{...F,status:"idle",error:null}:F))}function ye(N,C){if(clearTimeout(u.current.get(N)),y(M=>M.map(U=>U.id===N?{...U,locator:C,probeState:"idle",probeQualities:null,probeHasAudio:!1,quality:"best"}:U)),!Yc(C))return;const F=setTimeout(async()=>{u.current.delete(N),y(M=>M.map(U=>U.id===N?{...U,probeState:"probing"}:U));try{const M=await lh(g.current,C.trim());y(U=>U.map(Y=>{if(Y.id!==N||Y.locator!==C)return Y;const Q=M.qualities??[],J=M.has_audio??!1,L=Q.length===0&&J?"audio":"best";return{...Y,probeState:"done",probeQualities:Q,probeHasAudio:J,quality:L}}))}catch{y(M=>M.map(U=>U.id===N?{...U,probeState:"idle",probeQualities:null}:U))}},600);u.current.set(N,F)}function z(N,C){y(F=>F.map(M=>M.id===N?{...M,quality:C}:M))}const _=k.filter(N=>N.status==="idle"&&N.locator.trim()).length,B=Po(k);return i.jsx("dialog",{ref:s,className:"capture-dialog",children:i.jsxs("div",{className:"capture-dialog-inner",children:[i.jsxs("div",{className:"capture-dialog-header",children:[i.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),i.jsx("button",{type:"button",className:"capture-dialog-close",onClick:()=>{var N;return(N=s.current)==null?void 0:N.close()},"aria-label":"Close",children:i.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[i.jsx("line",{x1:"3",y1:"3",x2:"13",y2:"13"}),i.jsx("line",{x1:"13",y1:"3",x2:"3",y2:"13"})]})})]}),i.jsx("div",{className:"capture-rows",children:k.map((N,C)=>i.jsx(Bh,{item:N,autoFocus:C===k.length-1&&N.status==="idle",onLocatorChange:F=>ye(N.id,F),onQualityChange:F=>z(N.id,F),onRemove:()=>je(N.id),onReset:()=>Ee(N.id),onSubmit:Z},N.id))}),i.jsxs("button",{type:"button",className:"capture-add-row",onClick:te,children:[i.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[i.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"14"}),i.jsx("line",{x1:"2",y1:"8",x2:"14",y2:"8"})]}),"Add another"]}),i.jsxs("div",{className:"capture-advanced",children:[i.jsxs("button",{type:"button",className:"capture-advanced-toggle",onClick:()=>R(N=>!N),"aria-expanded":w,children:[i.jsx("svg",{className:`capture-chevron${w?" capture-chevron--open":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"4 6 8 10 12 6"})}),"Advanced options"]}),w&&i.jsxs("div",{className:"capture-advanced-panel",children:[i.jsxs("label",{className:"capture-ext-row",children:[i.jsxs("span",{className:"capture-ext-label",children:[i.jsx("span",{className:"capture-ext-name",children:"uBlock Origin Lite"}),i.jsx("span",{className:"capture-ext-desc",children:"Block ads during this capture"})]}),i.jsx("button",{type:"button",role:"switch","aria-checked":E,className:`ext-toggle ext-toggle--sm${E?" ext-toggle--on":""}`,onClick:()=>d(N=>N===null?!E:!N),"aria-label":"Toggle uBlock for this capture",children:i.jsx("span",{className:"ext-toggle-knob"})})]}),i.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[i.jsxs("span",{className:"capture-ext-label",children:[i.jsx("span",{className:"capture-ext-name",children:"Block cookie banners"}),i.jsx("span",{className:"capture-ext-desc",children:"Dismiss cookie consent banners during this capture"}),!(v!=null&&v.cookie_ext_available)&&i.jsxs("span",{className:"capture-ext-hint",children:["Not configured — set ",i.jsx("code",{children:"ARCHIVR_COOKIE_EXT"})]})]}),i.jsx("button",{type:"button",role:"switch","aria-checked":j,className:`ext-toggle ext-toggle--sm${j?" ext-toggle--on":""}`,onClick:()=>T(N=>!N),"aria-label":"Toggle cookie banner blocking for this capture",children:i.jsx("span",{className:"ext-toggle-knob"})})]}),i.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[i.jsxs("span",{className:"capture-ext-label",children:[i.jsx("span",{className:"capture-ext-name",children:"Reader mode"}),i.jsx("span",{className:"capture-ext-desc",children:"Distil to article text via Readability (off by default)"})]}),i.jsx("button",{type:"button",role:"switch","aria-checked":S,className:`ext-toggle ext-toggle--sm${S?" ext-toggle--on":""}`,onClick:()=>b(N=>!N),"aria-label":"Toggle reader mode for this capture",children:i.jsx("span",{className:"ext-toggle-knob"})})]})]})]}),i.jsxs("div",{className:"capture-actions",children:[i.jsx("button",{type:"button",className:"capture-submit",onClick:Z,disabled:_===0,children:_>1?`Archive ${_}`:"Archive"}),i.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var N;return(N=s.current)==null?void 0:N.close()},children:B?"Close":"Cancel"})]})]})})}function Bh({item:e,autoFocus:t,onLocatorChange:n,onQualityChange:r,onRemove:l,onReset:s,onSubmit:a}){const o=p.useRef(null),u=e.status==="submitting"||e.status==="running";p.useEffect(()=>{var g;t&&e.status==="idle"&&((g=o.current)==null||g.focus())},[t]);const c=(()=>{if(e.status==="completed"||u||!Yc(e.locator))return null;if(e.probeState==="probing")return i.jsx("span",{className:"capture-quality-probing","aria-label":"Checking available qualities",children:"…"});if(e.probeState==="done"){const g=e.probeQualities??[],m=e.probeHasAudio??!1;return g.length===0&&!m?i.jsx("span",{className:"capture-quality-hint",children:"No media detected"}):g.length===0&&m?i.jsx("select",{className:"capture-quality",value:"audio",onChange:f=>r(f.target.value),"aria-label":"Video quality",children:i.jsx("option",{value:"audio",children:"Audio only"})}):i.jsxs("select",{className:"capture-quality",value:e.quality||"best",onChange:f=>r(f.target.value),"aria-label":"Video quality",children:[i.jsx("option",{value:"best",children:"Best quality"}),g.map(f=>i.jsx("option",{value:f,children:f},f)),m&&i.jsx("option",{value:"audio",children:"Audio only"})]})}return null})();return i.jsxs("div",{className:`capture-row capture-row--${e.status}`,children:[i.jsxs("div",{className:"capture-row-main",children:[i.jsx(Uh,{status:e.status}),i.jsx("input",{ref:o,className:"capture-input",type:"text",placeholder:"https://… · yt:ID · ytm:ID · tweet:ID · x:ID",value:e.locator,onChange:g=>n(g.target.value),onKeyDown:g=>{g.key==="Enter"&&a()},disabled:u||e.status==="completed",autoComplete:"off",spellCheck:!1}),c,e.status==="failed"&&i.jsx("button",{type:"button",className:"capture-row-action",onClick:s,title:"Retry",children:i.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M13 2.5A7 7 0 1 1 6.5 1"}),i.jsx("polyline",{points:"6.5 1 4 3.5 6.5 6"})]})}),!u&&e.status!=="completed"&&e.status!=="failed"&&i.jsx("button",{type:"button",className:"capture-row-action capture-row-remove",onClick:l,"aria-label":"Remove",children:i.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[i.jsx("line",{x1:"3",y1:"3",x2:"13",y2:"13"}),i.jsx("line",{x1:"13",y1:"3",x2:"3",y2:"13"})]})})]}),e.error&&i.jsx("p",{className:"capture-row-error",children:e.error})]})}function Uh({status:e}){return e==="submitting"||e==="running"?i.jsx("span",{className:"cap-dot cap-dot--running","aria-label":"Running",children:i.jsx("span",{className:"cap-spinner"})}):e==="completed"?i.jsx("span",{className:"cap-dot cap-dot--ok","aria-label":"Done",children:"✓"}):e==="failed"?i.jsx("span",{className:"cap-dot cap-dot--err","aria-label":"Failed",children:"✕"}):i.jsx("span",{className:"cap-dot cap-dot--idle","aria-hidden":"true"})}function vi(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 Hh(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}function Kt(e){return Hh(e)??""}function qc(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 Lo={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 pa(e){return Lo[e]??Lo.other}function Zc(e){return e.split("/").map(t=>t?t.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"").join("/")}function Wh({entry:e,archiveId:t,isSelected:n,onSelect:r}){const[l,s]=p.useState(!1),o=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!l?i.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>s(!0),style:{objectFit:"contain"}}):i.jsx("span",{dangerouslySetInnerHTML:{__html:pa(e.source_kind)}});return i.jsxs("div",{className:n?"is-selected":void 0,tabIndex:0,"data-entry-uid":e.entry_uid,onClick:r,onKeyDown:u=>{u.key==="Enter"&&r()},children:[i.jsx("div",{className:"col-added",children:qc(e.archived_at)}),i.jsxs("div",{className:"col-title",children:[i.jsx("span",{className:"source-icon",children:o}),i.jsx("span",{className:"entry-title",children:Kt(e.title)||Kt(e.entry_uid)})]}),i.jsx("div",{className:"col-type",children:i.jsx("span",{className:"type-pill",children:Kt(e.entity_kind)})}),i.jsxs("div",{className:"col-size",children:[i.jsx("span",{className:"size-total",children:vi(e.total_artifact_bytes)}),e.cached_bytes>0&&e.total_artifact_bytes>0&&i.jsxs("span",{className:"size-cached-pct",title:`${vi(e.cached_bytes)} already on disk from an earlier entry`,children:[Math.round(e.cached_bytes/e.total_artifact_bytes*100),"% cached"]})]}),i.jsx("div",{className:"url-cell col-url",children:Kt(e.original_url)})]})}function Vh({entries:e,selectedEntryUid:t,onSelectEntry:n,archiveId:r}){return i.jsx("section",{id:"archive-view",className:"view is-active",children:i.jsxs("div",{className:"entry-table",children:[i.jsxs("div",{className:"entry-header-row",children:[i.jsx("div",{className:"col-added",children:"Added"}),i.jsx("div",{className:"col-title",children:"Title"}),i.jsx("div",{className:"col-type",children:"Type"}),i.jsx("div",{className:"col-size",children:"Size"}),i.jsx("div",{className:"col-url",children:"Original URL"})]}),i.jsx("div",{id:"entries-body",children:e.map(l=>i.jsx(Wh,{entry:l,archiveId:r,isSelected:l.entry_uid===t,onSelect:()=>n(l)},l.entry_uid))})]})})}function Qh(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 Kh({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 i.jsx("span",{className:`run-status ${t}`,children:n})}function Xh({runs:e}){const[t,n]=p.useState(null);function r(l){n(s=>s===l?null:l)}return i.jsx("section",{id:"runs-view",className:"view is-active",children:i.jsxs("table",{className:"entry-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Started"}),i.jsx("th",{children:"Status"}),i.jsx("th",{children:"Requested"}),i.jsx("th",{children:"Completed"}),i.jsx("th",{children:"Failed"})]})}),i.jsx("tbody",{children:e.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map(l=>{const s=l.status==="failed"&&l.error_summary,a=t===l.run_uid;return[i.jsxs("tr",{className:s?"run-row run-row--failed":"run-row",onClick:s?()=>r(l.run_uid):void 0,title:s?a?"Click to hide error":"Click to view error":void 0,children:[i.jsx("td",{children:Qh(l.started_at)}),i.jsxs("td",{children:[i.jsx(Kh,{status:l.status}),s&&i.jsx("span",{className:"run-expand-hint","aria-hidden":"true",children:a?"▴":"▾"})]}),i.jsx("td",{children:l.requested_count??"—"}),i.jsx("td",{children:l.completed_count??"—"}),i.jsx("td",{children:l.failed_count??"—"})]},l.run_uid),s&&a&&i.jsx("tr",{className:"run-error-row",children:i.jsx("td",{colSpan:5,children:i.jsx("pre",{className:"run-error-detail",children:l.error_summary})})},`${l.run_uid}-detail`)]})})]})})}const Jh=4;function Gh({archives:e}){const{currentUser:t}=p.useContext(Wl)??{},n=t&&(t.role_bits&Jh)!==0,[r,l]=p.useState("users"),[s,a]=p.useState([]),[o,u]=p.useState([]),[c,g]=p.useState(!1),[m,f]=p.useState(null),[k,y]=p.useState(""),[w,R]=p.useState(""),[h,d]=p.useState(""),[v,x]=p.useState(null),[j,T]=p.useState(!1),[E,S]=p.useState(""),[b,I]=p.useState(""),[H,ee]=p.useState(null),[Z,te]=p.useState(!1),je=p.useCallback(async()=>{if(n){g(!0),f(null);try{const[_,B]=await Promise.all([gh(),xh()]);a(_),u(B)}catch(_){f(_.message)}finally{g(!1)}}},[n]);p.useEffect(()=>{je()},[je]);async function Ee(_){const B=_.status==="active"?"disabled":"active";try{await yh(_.user_uid,B),a(N=>N.map(C=>C.user_uid===_.user_uid?{...C,status:B}:C))}catch(N){f(N.message)}}async function ye(_){if(_.preventDefault(),!k.trim()||!w){x("Username and password required");return}T(!0),x(null);try{await vh(k.trim(),w,h.trim()||void 0),y(""),R(""),d(""),await je()}catch(B){x(B.message)}finally{T(!1)}}async function z(_){if(_.preventDefault(),!E.trim()||!b.trim()){ee("Slug and name required");return}te(!0),ee(null);try{await wh(E.trim(),b.trim()),S(""),I(""),await je()}catch(B){ee(B.message)}finally{te(!1)}}return n?i.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[i.jsx("h1",{children:"Admin"}),i.jsxs("div",{className:"view-tabs",children:[i.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),i.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),i.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),m&&i.jsx("div",{className:"form-msg form-msg--err",children:m}),r==="users"&&i.jsxs("div",{className:"admin-section",children:[i.jsx("h2",{children:"Users"}),c?i.jsx("p",{className:"muted",children:"Loading…"}):i.jsxs("table",{className:"admin-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Username"}),i.jsx("th",{children:"Email"}),i.jsx("th",{children:"Roles"}),i.jsx("th",{children:"Status"}),i.jsx("th",{children:"Actions"})]})}),i.jsx("tbody",{children:s.map(_=>i.jsxs("tr",{className:_.status==="disabled"?"admin-row-disabled":"",children:[i.jsx("td",{children:_.username}),i.jsx("td",{className:"muted",children:_.email||"—"}),i.jsx("td",{children:_.role_slugs.join(", ")||"—"}),i.jsx("td",{children:i.jsx("span",{className:`status-badge status-${_.status}`,children:_.status})}),i.jsx("td",{children:i.jsx("button",{className:"admin-action-btn",onClick:()=>Ee(_),children:_.status==="active"?"Ban":"Unban"})})]},_.user_uid))})]}),i.jsx("h3",{children:"Create User"}),i.jsxs("form",{className:"admin-form",onSubmit:ye,children:[i.jsx("input",{className:"admin-input",placeholder:"Username",value:k,onChange:_=>y(_.target.value),required:!0}),i.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:w,onChange:_=>R(_.target.value),required:!0}),i.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:h,onChange:_=>d(_.target.value)}),v&&i.jsx("div",{className:"form-msg form-msg--err",children:v}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create User"})]})]}),r==="roles"&&i.jsxs("div",{className:"admin-section",children:[i.jsx("h2",{children:"Roles"}),c?i.jsx("p",{className:"muted",children:"Loading…"}):i.jsxs("table",{className:"admin-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Slug"}),i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Level"}),i.jsx("th",{children:"Bit"}),i.jsx("th",{children:"Built-in"})]})}),i.jsx("tbody",{children:o.map(_=>i.jsxs("tr",{children:[i.jsx("td",{children:i.jsx("code",{children:_.slug})}),i.jsx("td",{children:_.name}),i.jsx("td",{children:_.level}),i.jsx("td",{children:_.bit_position}),i.jsx("td",{children:_.is_builtin?"✓":""})]},_.role_uid))})]}),i.jsx("h3",{children:"Create Custom Role"}),i.jsxs("form",{className:"admin-form",onSubmit:z,children:[i.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:E,onChange:_=>S(_.target.value),required:!0}),i.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:b,onChange:_=>I(_.target.value),required:!0}),H&&i.jsx("div",{className:"form-msg form-msg--err",children:H}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:Z,children:Z?"Creating…":"Create Role"})]})]}),r==="archives"&&i.jsxs("div",{className:"admin-section",children:[i.jsx("h2",{children:"Mounted Archives"}),i.jsx("div",{className:"admin-list",children:e.map(_=>i.jsxs("div",{className:"admin-archive",children:[i.jsx("strong",{children:_.label}),i.jsx("div",{className:"muted",children:_.archive_path})]},_.id))})]})]}):i.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[i.jsx("h1",{children:"Admin"}),i.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),i.jsx("h2",{children:"Mounted Archives"}),i.jsx("div",{className:"admin-list",children:e.map(_=>i.jsxs("div",{className:"admin-archive",children:[i.jsx("strong",{children:_.label}),i.jsx("div",{className:"muted",children:_.archive_path})]},_.id))})]})}function ed({node:e,archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:s,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u}){var x;const c=n===e.tag.full_path,[g,m]=p.useState(!1),[f,k]=p.useState(""),y=p.useRef(!1);function w(){if(g)return;const j=c?null:e.tag.full_path;r(j),l("archive")}function R(j){j.stopPropagation(),k(e.tag.slug),m(!0)}async function h(){const j=f.trim();if(!j||j===e.tag.slug){m(!1);return}try{const T=await th(t,e.tag.tag_uid,j);s(e.tag.full_path,T.full_path),o()}catch{}finally{m(!1)}}async function d(j){var E;j.stopPropagation();const T=((E=e.children)==null?void 0:E.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(T))try{await nh(t,e.tag.tag_uid),a(e.tag.full_path),o()}catch{}}const v={archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:s,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u};return i.jsxs("li",{children:[i.jsxs("div",{className:"tag-node-row",children:[g?i.jsx("input",{className:"tag-rename-input",autoFocus:!0,value:f,onChange:j=>k(j.target.value),onKeyDown:j=>{j.key==="Enter"&&j.currentTarget.blur(),j.key==="Escape"&&(y.current=!0,j.currentTarget.blur())},onBlur:()=>{y.current?(y.current=!1,m(!1)):h()}}):i.jsxs("button",{className:`tag-node-btn${c?" is-active":""}`,title:e.tag.full_path,onClick:w,onDoubleClick:R,children:[u?e.tag.name:e.tag.slug,i.jsx("svg",{className:"edit-icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",onClick:j=>{j.stopPropagation(),R(j)},children:i.jsx("path",{d:"M11.5 2.5a1.5 1.5 0 0 1 2 2L5 13l-3 1 1-3 8.5-8.5z"})})]}),i.jsx("button",{className:"remove tag-node-delete",title:`Delete tag ${e.tag.full_path}`,onClick:d,"aria-label":`Delete tag ${e.tag.full_path}`,children:"×"})]}),((x=e.children)==null?void 0:x.length)>0&&i.jsx("div",{className:"tag-children",children:i.jsx("ul",{className:"tag-tree-list",children:e.children.map(j=>i.jsx(ed,{node:j,...v},j.tag.tag_uid))})})]})}function Yh({archiveId:e,tagNodes:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:s,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u}){return i.jsx("section",{id:"tags-view",className:"view is-active",children:i.jsxs("div",{className:"tag-tree",children:[i.jsxs("div",{className:"tag-tree-header",children:[i.jsx("span",{className:"tag-tree-title",children:"Tags"}),n&&i.jsxs("span",{className:"tag-tree-active",children:["Filtering: ",n]})]}),t.length===0?i.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):i.jsx("ul",{className:"tag-tree-list",children:t.map(c=>i.jsx(ed,{node:c,archiveId:e,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:s,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u},c.tag.tag_uid))})]})})}const Xn=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],qh=e=>{var t;return((t=Xn.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Zh({archiveId:e}){const[t,n]=p.useState([]),[r,l]=p.useState(!1),[s,a]=p.useState(null),[o,u]=p.useState(null),[c,g]=p.useState(null),[m,f]=p.useState(!1),[k,y]=p.useState(null),[w,R]=p.useState(""),[h,d]=p.useState(""),[v,x]=p.useState(2),[j,T]=p.useState(!1),[E,S]=p.useState(null),[b,I]=p.useState(""),[H,ee]=p.useState(2),[Z,te]=p.useState(!1),[je,Ee]=p.useState(null),[ye,z]=p.useState(!1),[_,B]=p.useState(""),N=p.useRef(null),C=t.find(D=>D.collection_uid===o)??null,F=(C==null?void 0:C.slug)==="_default_",M=p.useCallback(async()=>{if(e){l(!0),a(null);try{const D=await kh(e);n(D)}catch(D){a(D.message)}finally{l(!1)}}},[e]),U=p.useCallback(async D=>{if(!D){g(null);return}f(!0),y(null);try{const W=await Sh(e,D);g(W)}catch(W){y(W.message)}finally{f(!1)}},[e]);p.useEffect(()=>{M()},[M]),p.useEffect(()=>{U(o)},[o,U]),p.useEffect(()=>{ye&&N.current&&N.current.focus()},[ye]);async function Y(D){D.preventDefault();const W=w.trim(),$e=h.trim();if(!(!W||!$e)){T(!0),S(null);try{const dt=await jh(e,W,$e,v);R(""),d(""),x(2),await M(),u(dt.collection_uid)}catch(dt){S(dt.message)}finally{T(!1)}}}async function Q(){const D=_.trim();if(!D||!C){z(!1);return}try{await To(e,C.collection_uid,{name:D}),await M(),g(W=>W&&{...W,name:D})}catch(W){a(W.message)}finally{z(!1)}}async function J(D){if(C)try{await To(e,C.collection_uid,{default_visibility_bits:D}),await M(),g(W=>W&&{...W,default_visibility_bits:D})}catch(W){a(W.message)}}async function L(){if(C&&window.confirm(`Delete collection "${C.name}"? Entries will not be deleted.`))try{await Th(e,C.collection_uid),u(null),g(null),await M()}catch(D){a(D.message)}}async function X(D){D.preventDefault();const W=b.trim();if(!(!W||!C)){te(!0),Ee(null);try{await Nh(e,C.collection_uid,W,H),I(""),await U(C.collection_uid)}catch($e){Ee($e.message)}finally{te(!1)}}}async function We(D){if(C)try{await _h(e,C.collection_uid,D),await U(C.collection_uid)}catch(W){y(W.message)}}async function Ve(D,W){if(C)try{await Ch(e,C.collection_uid,D,W),g($e=>$e&&{...$e,entries:$e.entries.map(dt=>dt.entry_uid===D?{...dt,collection_visibility_bits:W}:dt)})}catch($e){y($e.message)}}return e?i.jsxs("div",{className:"collections-view",children:[i.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&i.jsx("div",{className:"muted",children:"Loading…"}),s&&i.jsxs("div",{className:"collections-error",children:[s," ",i.jsx("button",{onClick:()=>a(null),className:"coll-dismiss",children:"×"})]}),i.jsxs("div",{className:"collections-layout",children:[i.jsxs("div",{className:"collections-sidebar",children:[t.map(D=>i.jsxs("button",{className:`coll-sidebar-row${o===D.collection_uid?" is-active":""}`,onClick:()=>u(D.collection_uid),children:[i.jsx("span",{className:"coll-row-name",children:D.name}),i.jsx("span",{className:"coll-row-meta",children:qh(D.default_visibility_bits)})]},D.collection_uid)),t.length===0&&!r&&i.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),C?i.jsxs("div",{className:"coll-detail",children:[i.jsxs("div",{className:"coll-detail-header",children:[ye?i.jsx("input",{ref:N,className:"coll-rename-input",value:_,onChange:D=>B(D.target.value),onBlur:Q,onKeyDown:D=>{D.key==="Enter"&&Q(),D.key==="Escape"&&z(!1)}}):i.jsxs("h3",{className:`coll-detail-name${F?"":" coll-detail-name--editable"}`,title:F?void 0:"Click to rename",onClick:()=>{F||(B(C.name),z(!0))},children:[(c==null?void 0:c.name)??C.name,!F&&i.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!F&&i.jsx("button",{className:"coll-delete-btn",onClick:L,title:"Delete collection",children:"Delete"})]}),i.jsxs("div",{className:"coll-detail-vis",children:[i.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),i.jsx("select",{className:"coll-vis-select",value:(c==null?void 0:c.default_visibility_bits)??C.default_visibility_bits,onChange:D=>J(Number(D.target.value)),disabled:F,children:Xn.map(D=>i.jsx("option",{value:D.value,children:D.label},D.value))})]}),i.jsxs("div",{className:"coll-entries-section",children:[i.jsx("div",{className:"coll-section-heading",children:"Entries"}),m&&i.jsx("div",{className:"muted",children:"Loading…"}),k&&i.jsx("div",{className:"collections-error",children:k}),!m&&c&&(c.entries.length===0?i.jsx("div",{className:"muted",children:"No entries in this collection."}):i.jsx("ul",{className:"coll-entries-list",children:c.entries.map(D=>i.jsxs("li",{className:"coll-entry-row",children:[i.jsxs("div",{className:"coll-entry-info",children:[i.jsx("span",{className:"coll-entry-title",children:D.title||D.entry_uid}),i.jsx("span",{className:"coll-entry-kind muted",children:D.source_kind})]}),i.jsxs("div",{className:"coll-entry-actions",children:[i.jsx("select",{className:"coll-entry-vis-select",value:D.collection_visibility_bits,onChange:W=>Ve(D.entry_uid,Number(W.target.value)),children:Xn.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value))}),!F&&i.jsx("button",{className:"coll-entry-remove",onClick:()=>We(D.entry_uid),title:"Remove from collection",children:"×"})]})]},D.entry_uid))}))]}),!F&&i.jsxs("form",{className:"coll-add-entry-form",onSubmit:X,children:[i.jsx("div",{className:"coll-section-heading",children:"Add entry"}),i.jsxs("div",{className:"coll-add-entry-row",children:[i.jsx("input",{className:"coll-add-entry-input",type:"text",value:b,onChange:D=>I(D.target.value),placeholder:"entry_uid",required:!0}),i.jsx("select",{className:"coll-vis-select",value:H,onChange:D=>ee(Number(D.target.value)),children:Xn.map(D=>i.jsx("option",{value:D.value,children:D.label},D.value))}),i.jsx("button",{className:"coll-add-btn",type:"submit",disabled:Z,children:Z?"…":"Add"})]}),je&&i.jsx("div",{className:"collections-error",style:{marginTop:4},children:je})]})]}):i.jsx("div",{className:"coll-detail coll-detail--empty",children:i.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),i.jsxs("details",{className:"coll-create-details",children:[i.jsx("summary",{children:"+ Create collection"}),i.jsxs("form",{className:"coll-create-form",onSubmit:Y,children:[i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),i.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:w,onChange:D=>{R(D.target.value),h||d(D.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),i.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:h,onChange:D=>d(D.target.value),placeholder:"my-collection",required:!0})]}),i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),i.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:v,onChange:D=>x(Number(D.target.value)),children:Xn.map(D=>i.jsx("option",{value:D.value,children:D.label},D.value))})]}),E&&i.jsx("div",{className:"collections-error",children:E}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create collection"})]})]})]}):i.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const em=4;function tm({tab:e,onTabChange:t,archiveId:n}){const{currentUser:r,setCurrentUser:l}=p.useContext(Wl)??{},s=r&&(r.role_bits&em)!==0,a=["profile","tokens",...s?["instance","cookies","extensions","storage"]:[]],o={profile:"Profile",tokens:"API Tokens",instance:"Instance",cookies:"Cookies",extensions:"Extensions",storage:"Storage"};return i.jsxs("section",{className:"admin-view",children:[i.jsx("h1",{children:"Settings"}),i.jsx("div",{className:"view-tabs",children:a.map(u=>i.jsx("button",{className:`view-tab${e===u?" is-active":""}`,onClick:()=>t(u),children:o[u]},u))}),e==="profile"&&i.jsx(nm,{currentUser:r,setCurrentUser:l}),e==="tokens"&&i.jsx(rm,{}),e==="instance"&&s&&i.jsx(lm,{}),e==="cookies"&&s&&i.jsx(im,{}),e==="extensions"&&s&&i.jsx(am,{}),e==="storage"&&s&&i.jsx(sm,{archiveId:n})]})}function nm({currentUser:e,setCurrentUser:t}){const[n,r]=p.useState((e==null?void 0:e.display_name)??""),[l,s]=p.useState(!1),[a,o]=p.useState(null),[u,c]=p.useState(""),[g,m]=p.useState(""),[f,k]=p.useState(""),[y,w]=p.useState(!1),[R,h]=p.useState(null);async function d(x){x.preventDefault(),s(!0),o(null);try{await ch(n),t(j=>({...j,display_name:n||null})),o({ok:!0,text:"Saved."})}catch(j){o({ok:!1,text:j.message})}finally{s(!1)}}async function v(x){if(x.preventDefault(),g!==f){h({ok:!1,text:"Passwords do not match."});return}w(!0),h(null);try{await fh(u,g),c(""),m(""),k(""),h({ok:!0,text:"Password changed."})}catch(j){h({ok:!1,text:j.message})}finally{w(!1)}}return i.jsxs("div",{style:{maxWidth:440},children:[i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Display Name"}),i.jsxs("form",{onSubmit:d,children:[i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),i.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:x=>r(x.target.value)})]}),a&&i.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Display Preferences"}),i.jsxs("label",{className:"checkbox-row",children:[i.jsx("input",{type:"checkbox",checked:(e==null?void 0:e.humanize_slugs)??!1,onChange:async x=>{const j=x.target.checked;try{await dh({humanize_slugs:j}),t(T=>({...T,humanize_slugs:j}))}catch{}}}),i.jsx("span",{className:"form-label",style:{margin:0},children:"Humanize tag display"})]}),i.jsx("p",{className:"muted",style:{fontSize:13,margin:"4px 0 0"},children:'When on, tag paths show as "X / Articles" instead of "x/articles".'})]}),i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Change Password"}),i.jsxs("form",{onSubmit:v,children:[i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),i.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:u,onChange:x=>c(x.target.value),required:!0})]}),i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),i.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:g,onChange:x=>m(x.target.value),required:!0})]}),i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),i.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:f,onChange:x=>k(x.target.value),required:!0})]}),R&&i.jsx("div",{className:`form-msg form-msg--${R.ok?"ok":"err"}`,children:R.text}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:y,children:y?"Changing…":"Change Password"})]})]})]})}function rm(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[l,s]=p.useState(null),[a,o]=p.useState(""),[u,c]=p.useState(!1),[g,m]=p.useState(null),f=p.useCallback(async()=>{r(!0),s(null);try{t(await ph())}catch(w){s(w.message)}finally{r(!1)}},[]);p.useEffect(()=>{f()},[f]);async function k(w){if(w.preventDefault(),!!a.trim()){c(!0);try{const R=await hh(a.trim());m(R),o(""),f()}catch(R){s(R.message)}finally{c(!1)}}}async function y(w){try{await mh(w),t(R=>R.filter(h=>h.token_uid!==w))}catch(R){s(R.message)}}return i.jsx("div",{style:{maxWidth:600},children:i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"API Tokens"}),g&&i.jsxs("div",{className:"token-banner",children:[i.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",i.jsx("code",{children:g.raw_token}),i.jsx("button",{className:"token-dismiss",onClick:()=>m(null),children:"Dismiss"})]}),i.jsxs("form",{className:"token-create-row",onSubmit:k,children:[i.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:a,onChange:w=>o(w.target.value),required:!0}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:u,children:u?"Creating…":"Create token"})]}),l&&i.jsx("div",{className:"form-msg form-msg--err",children:l}),n?i.jsx("div",{className:"muted",children:"Loading…"}):i.jsxs("div",{children:[e.length===0&&i.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(w=>i.jsxs("div",{className:"token-row",children:[i.jsxs("div",{className:"token-row-info",children:[i.jsx("strong",{children:w.name}),i.jsxs("div",{className:"muted",children:["Created ",w.created_at.slice(0,10),w.last_used_at&&` · Last used ${w.last_used_at.slice(0,10)}`]})]}),i.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>y(w.token_uid),children:"Revoke"})]},w.token_uid))]})]})})}function lm(){const[e,t]=p.useState(null),[n,r]=p.useState(!0),[l,s]=p.useState(null),[a,o]=p.useState(!1),[u,c]=p.useState(null);p.useEffect(()=>{(async()=>{try{t(await fa())}catch(m){s(m.message)}finally{r(!1)}})()},[]);async function g(m){m.preventDefault(),o(!0),c(null);try{await mi(e),c({ok:!0,text:"Saved."})}catch(f){c({ok:!1,text:f.message})}finally{o(!1)}}return n?i.jsx("div",{className:"muted",children:"Loading…"}):l?i.jsx("div",{className:"form-msg form-msg--err",children:l}):e?i.jsx("div",{style:{maxWidth:440},children:i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Instance Settings"}),i.jsxs("form",{onSubmit:g,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([m,f])=>i.jsxs("label",{className:"checkbox-row",children:[i.jsx("input",{type:"checkbox",checked:!!e[m],onChange:k=>t(y=>({...y,[m]:k.target.checked}))}),f]},m)),i.jsxs("div",{className:"form-field",style:{marginTop:4},children:[i.jsx("label",{className:"form-label",children:"Default entry visibility"}),i.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:m=>t(f=>({...f,default_entry_visibility:Number(m.target.value)})),children:[i.jsx("option",{value:0,children:"Private"}),i.jsx("option",{value:2,children:"Unlisted"}),i.jsx("option",{value:3,children:"Public"})]})]}),u&&i.jsx("div",{className:`form-msg form-msg--${u.ok?"ok":"err"}`,children:u.text}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Saving…":"Save Settings"})]})]})}):null}function xs(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 sm({archiveId:e}){const[t,n]=p.useState("idle"),[r,l]=p.useState(null),[s,a]=p.useState(null),[o,u]=p.useState(null);function c(){n("idle"),l(null),a(null),u(null)}async function g(){n("scanning"),u(null),l(null);try{const k=await Ph(e);l(k),n("scanned")}catch(k){u(k.message),n("error")}}async function m(){n("deleting"),u(null);try{const k=await Lh(e);a(k),n("done")}catch(k){u(k.message),n("error")}}const f=r&&r.deletable_files===0&&r.orphaned_blob_rows===0;return i.jsx("div",{style:{maxWidth:440},children:i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Orphan Cleanup"}),i.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."," ",i.jsx("strong",{children:"Cleanup is blocked while captures are running."})]}),!e&&i.jsx("div",{className:"muted",children:"No archive selected."}),e&&t==="idle"&&i.jsx("button",{className:"btn-ghost",onClick:g,children:"Scan for orphaned blobs"}),t==="scanning"&&i.jsx("div",{className:"muted",children:"Scanning…"}),t==="scanned"&&r&&f&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"form-msg form-msg--ok",children:"Archive is clean — nothing to remove."}),i.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Done"})]}),t==="scanned"&&r&&!f&&i.jsxs("div",{children:[i.jsxs("div",{style:{marginBottom:14,lineHeight:1.6},children:["Found ",i.jsx("strong",{children:r.deletable_files})," unreferenced file",r.deletable_files!==1?"s":""," ","and ",i.jsx("strong",{children:r.orphaned_blob_rows})," orphaned DB record",r.orphaned_blob_rows!==1?"s":""," ","— ",i.jsx("strong",{children:xs(r.total_bytes)})," recoverable."]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{className:"btn-danger",onClick:m,children:["Delete (",xs(r.total_bytes),")"]}),i.jsx("button",{className:"btn-ghost",onClick:c,children:"Cancel"})]})]}),t==="deleting"&&i.jsx("div",{className:"muted",children:"Deleting…"}),t==="done"&&s&&i.jsxs("div",{children:[i.jsxs("div",{className:"form-msg form-msg--ok",children:["Freed ",i.jsx("strong",{children:xs(s.freed_bytes)})," ","— removed ",s.deleted_files," file",s.deleted_files!==1?"s":""," ","and ",s.deleted_blob_rows," DB record",s.deleted_blob_rows!==1?"s":"","."]}),s.errors&&s.errors.length>0&&i.jsxs("div",{className:"form-msg form-msg--err",style:{marginTop:6},children:[s.errors.length," file",s.errors.length!==1?"s":""," could not be deleted."]}),i.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Scan again"})]}),t==="error"&&i.jsxs("div",{children:[i.jsx("div",{className:"form-msg form-msg--err",children:o}),i.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Try again"})]})]})})}function im(){const[e,t]=p.useState(null),[n,r]=p.useState(!0),[l,s]=p.useState(null),[a,o]=p.useState("global"),[u,c]=p.useState(""),[g,m]=p.useState("{}"),[f,k]=p.useState(null),[y,w]=p.useState(!1),[R,h]=p.useState({});p.useEffect(()=>{d()},[]);async function d(){r(!0),s(null);try{t(await zh())}catch(S){s(S.message)}finally{r(!1)}}async function v(S){S.preventDefault();try{JSON.parse(g)}catch{k({ok:!1,text:'cookies must be valid JSON, e.g. {"session": "abc"}'});return}w(!0),k(null);try{await Dh(a==="global"?null:u.trim(),a,g),c(""),m("{}"),o("global"),k({ok:!0,text:"Rule added."}),await d()}catch(b){k({ok:!1,text:b.message})}finally{w(!1)}}async function x(S){try{await bh(S),await d()}catch(b){s(b.message)}}function j(S){h(b=>({...b,[S.rule_uid]:{cookiesInput:S.cookies_json,saving:!1,msg:null}}))}function T(S){h(b=>{const I={...b};return delete I[S],I})}async function E(S){const b=R[S.rule_uid];try{JSON.parse(b.cookiesInput)}catch{h(I=>({...I,[S.rule_uid]:{...I[S.rule_uid],msg:{ok:!1,text:"Invalid JSON"}}}));return}h(I=>({...I,[S.rule_uid]:{...I[S.rule_uid],saving:!0,msg:null}}));try{await Ih(S.rule_uid,{cookies_json:b.cookiesInput}),T(S.rule_uid),await d()}catch(I){h(H=>({...H,[S.rule_uid]:{...H[S.rule_uid],saving:!1,msg:{ok:!1,text:I.message}}}))}}return n?i.jsx("div",{className:"muted",children:"Loading…"}):l?i.jsx("div",{className:"form-msg form-msg--err",children:l}):i.jsx("div",{style:{maxWidth:560},children:i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Cookie Rules"}),i.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?i.jsxs("table",{className:"data-table",style:{width:"100%",marginBottom:16},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Pattern"}),i.jsx("th",{children:"Cookies"}),i.jsx("th",{style:{width:100},children:"Actions"})]})}),i.jsx("tbody",{children:e.map(S=>{const b=R[S.rule_uid],I=S.url_pattern?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"muted",children:[S.pattern_kind,":"]})," ",i.jsx("code",{children:S.url_pattern})]}):i.jsx("span",{className:"muted",children:"global (all URLs)"});return i.jsxs("tr",{children:[i.jsx("td",{children:I}),i.jsx("td",{children:b?i.jsxs(i.Fragment,{children:[i.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:12,width:"100%",minHeight:60},value:b.cookiesInput,onChange:H=>h(ee=>({...ee,[S.rule_uid]:{...ee[S.rule_uid],cookiesInput:H.target.value}}))}),b.msg&&i.jsx("div",{className:`form-msg form-msg--${b.msg.ok?"ok":"err"}`,children:b.msg.text}),i.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[i.jsx("button",{className:"btn-primary",style:{fontSize:12,padding:"2px 8px"},disabled:b.saving,onClick:()=>E(S),children:b.saving?"Saving…":"Save"}),i.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>T(S.rule_uid),children:"Cancel"})]})]}):i.jsx("code",{style:{fontSize:12,wordBreak:"break-all"},children:S.cookies_json})}),i.jsx("td",{children:!b&&i.jsxs("div",{style:{display:"flex",gap:6},children:[i.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>j(S),children:"Edit"}),i.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"2px 8px"},onClick:()=>x(S.rule_uid),children:"Del"})]})})]},S.rule_uid)})})]}):i.jsx("p",{className:"muted",style:{marginBottom:16},children:"No cookie rules defined."}),i.jsx("h3",{style:{marginBottom:8},children:"Add Rule"}),i.jsxs("form",{onSubmit:v,children:[i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",children:"Pattern type"}),i.jsxs("select",{className:"field-input",value:a,onChange:S=>o(S.target.value),children:[i.jsx("option",{value:"global",children:"Global (all URLs)"}),i.jsx("option",{value:"wildcard",children:"Wildcard (e.g. *.youtube.com)"}),i.jsx("option",{value:"regex",children:"Regex (matched against full URL)"})]})]}),a!=="global"&&i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",children:a==="wildcard"?"URL/hostname pattern":"Regex pattern"}),i.jsx("input",{className:"field-input",type:"text",value:u,onChange:S=>c(S.target.value),placeholder:a==="wildcard"?"*.youtube.com or https://example.com/*":".*\\.youtube\\.com.*",required:!0})]}),i.jsxs("div",{className:"form-field",children:[i.jsx("label",{className:"form-label",children:"Cookies (JSON object)"}),i.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:13,minHeight:70},value:g,onChange:S=>m(S.target.value),placeholder:'{"SESSION": "abc123", "token": "xyz"}',required:!0})]}),f&&i.jsx("div",{className:`form-msg form-msg--${f.ok?"ok":"err"}`,children:f.text}),i.jsx("button",{className:"btn-primary",type:"submit",disabled:y,children:y?"Adding…":"Add Rule"})]})]})})}function am(){const[e,t]=p.useState(null),[n,r]=p.useState(!0),[l,s]=p.useState(!1),[a,o]=p.useState(null);p.useEffect(()=>{(async()=>{try{t(await fa())}catch(y){o({ok:!1,text:y.message})}finally{r(!1)}})()},[]);async function u(y){s(!0),o(null);try{await mi({ublock_enabled:y}),t(w=>({...w,ublock_enabled:y})),o({ok:!0,text:"Saved."})}catch(w){o({ok:!1,text:w.message})}finally{s(!1)}}async function c(y){s(!0),o(null);try{await mi({cookie_ext_enabled:y}),t(w=>({...w,cookie_ext_enabled:y})),o({ok:!0,text:"Saved."})}catch(w){o({ok:!1,text:w.message})}finally{s(!1)}}if(n)return i.jsx("div",{className:"muted",children:"Loading\\u2026"});const g=(e==null?void 0:e.ublock_ext_available)??!1,m=(e==null?void 0:e.ublock_enabled)??!0,f=(e==null?void 0:e.cookie_ext_available)??!1,k=(e==null?void 0:e.cookie_ext_enabled)??!0;return i.jsx("div",{style:{maxWidth:560},children:i.jsxs("div",{className:"form-section",children:[i.jsx("h2",{children:"Extensions"}),i.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."}),i.jsx("div",{className:"ext-card",children:i.jsxs("div",{className:"ext-card-header",children:[i.jsxs("div",{className:"ext-card-info",children:[i.jsx("span",{className:"ext-card-name",children:"uBlock Origin Lite"}),i.jsx("span",{className:"ext-card-desc",children:"Blocks ads, trackers, and other page clutter during archiving via Chrome’s declarativeNetRequest API (Manifest V3)."}),!g&&i.jsxs("span",{className:"ext-card-hint",children:["Not configured — set ",i.jsx("code",{children:"ARCHIVR_UBLOCK_EXT"})," to the unpacked extension directory to enable."]})]}),i.jsx("button",{type:"button",role:"switch","aria-checked":m,className:`ext-toggle${m?" ext-toggle--on":""}`,onClick:()=>u(!m),disabled:l,"aria-label":"Toggle uBlock Origin Lite",children:i.jsx("span",{className:"ext-toggle-knob"})})]})}),i.jsx("div",{className:"ext-card",children:i.jsxs("div",{className:"ext-card-header",children:[i.jsxs("div",{className:"ext-card-info",children:[i.jsx("span",{className:"ext-card-name",children:"I Still Don’t Care About Cookies"}),i.jsx("span",{className:"ext-card-desc",children:"Dismiss cookie consent banners during archiving."}),!f&&i.jsxs("span",{className:"ext-card-hint",children:["Not configured — set ",i.jsx("code",{children:"ARCHIVR_COOKIE_EXT"})," to the unpacked extension directory to enable."]})]}),i.jsx("button",{type:"button",role:"switch","aria-checked":k,className:`ext-toggle${k?" ext-toggle--on":""}`,onClick:()=>c(!k),disabled:l,"aria-label":"Toggle I Still Don't Care About Cookies",children:i.jsx("span",{className:"ext-toggle-knob"})})]})}),a&&i.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text})]})})}const Ro={0:"Private",1:"Public",2:"Users only",3:"Public"},om=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function um({archiveId:e,selectedEntry:t,detail:n,onTagFilterSet:r,tagNodes:l,onTagsRefresh:s,onEntryTitleChange:a,onEntryDeleted:o,humanizeTags:u,onDetailRefresh:c,onOpenPreview:g,onPlay:m}){const[f,k]=p.useState([]),[y,w]=p.useState(""),[R,h]=p.useState([]),[d,v]=p.useState(""),x=p.useRef(0),j=p.useRef(!1),[T,E]=p.useState(!1),[S,b]=p.useState(""),[I,H]=p.useState("idle"),[ee,Z]=p.useState(""),te=p.useRef(null);p.useEffect(()=>{const L=++x.current;if(te.current&&(clearInterval(te.current),te.current=null),H("idle"),Z(""),!t||!e){k([]),h([]);return}E(!1),b(""),j.current=!1,k([]),Promise.all([Hr(e,t.entry_uid),Eh(e,t.entry_uid)]).then(([X,We])=>{L===x.current&&(k(X),h(We))}).catch(()=>{})},[t,e]),p.useEffect(()=>()=>{clearInterval(te.current)},[]);async function je(){const L=S.trim()||null;try{await Yp(e,t.entry_uid,L),a==null||a(t.entry_uid,L)}catch{}finally{E(!1)}}async function Ee(){const L=y.trim();if(!(!L||!t))try{await qp(e,t.entry_uid,L),w(""),v("");const X=await Hr(e,t.entry_uid);k(X),s()}catch(X){v(X.message)}}async function ye(L){try{await Zp(e,t.entry_uid,L);const X=await Hr(e,t.entry_uid);k(X),s()}catch{}}async function z(){if(!(!t||!e)&&window.confirm("Delete this entry? This cannot be undone."))try{await eh(e,t.entry_uid),o==null||o(t.entry_uid)}catch{}}async function _(){if(!t||!e||I==="running")return;const L=x.current,X=t.entry_uid;H("running"),Z("");try{const{job_uid:We}=await Rh(e,X);if(x.current!==L)return;te.current=setInterval(async()=>{try{const Ve=await Gc(e,We);if(Ve.status==="completed"){if(clearInterval(te.current),te.current=null,x.current!==L)return;H("done");const D=await Hr(e,X);if(x.current!==L)return;k(D),c==null||c()}else if(Ve.status==="failed"){if(clearInterval(te.current),te.current=null,x.current!==L)return;H("error"),Z(Ve.error_text||"Re-archive failed.")}}catch{if(clearInterval(te.current),te.current=null,x.current!==L)return;H("error"),Z("Network error while polling.")}},500)}catch(We){if(x.current!==L)return;H("error"),Z(We.message||"Failed to start re-archive.")}}const B=n?[["Added",qc(n.summary.archived_at)],["Source",n.summary.source_kind],["Type",n.summary.entity_kind],["Visibility",Ro[n.summary.visibility]??n.summary.visibility],["Root",n.structured_root_relpath]]:[],N=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),C=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv","pdf","html","htm","jpg","jpeg","png","gif","webp","avif","svg","bmp"]),F=n?n.artifacts.findIndex(L=>L.artifact_role==="primary_media"):-1,M=F>=0?n.artifacts[F]:null,U=M?M.relpath.split(".").pop().toLowerCase():"",Y=M&&N.has(U),Q=F>=0&&t?`/api/archives/${e}/entries/${t.entry_uid}/artifacts/${F}`:null,J=n&&!Y&&(n.summary.entity_kind==="tweet"||n.summary.entity_kind==="tweet_thread"||M&&C.has(U));return i.jsxs("aside",{className:"context-rail",children:[i.jsx("div",{className:"rail-eyebrow",children:"Context"}),t?n?i.jsxs(i.Fragment,{children:[T?i.jsx("input",{className:"rail-title-input",autoFocus:!0,value:S,onChange:L=>b(L.target.value),onKeyDown:L=>{L.key==="Enter"&&L.currentTarget.blur(),L.key==="Escape"&&(j.current=!0,L.currentTarget.blur())},onBlur:()=>{j.current?E(!1):je(),j.current=!1}}):i.jsxs("h2",{className:"rail-title rail-title--editable",title:"Click to rename",onClick:()=>{b(n.summary.title??""),E(!0)},children:[Kt(n.summary.title)||Kt(n.summary.entry_uid),i.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:i.jsx("path",{d:"M11.5 2.5a1.5 1.5 0 0 1 2 2L5 13l-3 1 1-3 8.5-8.5z"})})]}),n.summary.original_url&&i.jsxs("a",{className:"url-tile",href:n.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[i.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:pa(n.summary.source_kind)}}),i.jsx("span",{className:"u-text",children:n.summary.original_url}),i.jsx("span",{className:"ext",children:i.jsx(om,{})})]}),Y&&m&&i.jsx("button",{className:"rail-preview-btn",onClick:()=>m(Q,t),children:"▶ Play"}),J&&g&&i.jsx("button",{className:"rail-preview-btn",onClick:g,children:"Preview"}),i.jsx("div",{className:"meta-list",children:B.filter(([,L])=>L!=null&&L!=="").map(([L,X])=>i.jsxs("div",{className:"meta-item",children:[i.jsx("span",{className:"meta-k",children:L}),i.jsx("span",{className:`meta-v${L==="Root"?" mono":""}`,children:Kt(X)})]},L))}),n.artifacts.length>0&&i.jsxs("div",{className:"rail-section",children:[i.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",i.jsx("span",{className:"num",children:n.artifacts.length})]}),i.jsx("ul",{className:"artifact-list",children:n.artifacts.map((L,X)=>i.jsx("li",{children:i.jsxs("a",{href:`/api/archives/${e}/entries/${n.summary.entry_uid}/artifacts/${X}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[i.jsx("span",{className:"artifact-name",children:L.artifact_role.replace(/_/g," ")}),i.jsx("span",{className:"artifact-size",children:L.byte_size!=null?vi(L.byte_size):"—"})]})},X))})]})]}):i.jsx("p",{className:"tags-empty",children:"Loading…"}):i.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"rail-section",children:[i.jsx("div",{className:"rail-section-heading",children:"Tags"}),f.length===0?i.jsx("p",{className:"tags-empty",children:"No tags yet."}):i.jsx("div",{className:"tags-wrap",children:f.map(L=>i.jsxs("span",{className:"tag-pill",title:L.full_path,children:[u?Zc(L.full_path):L.full_path,i.jsx("button",{className:"remove",title:`Remove tag ${L.full_path}`,onClick:()=>ye(L.tag_uid),children:"×"})]},L.tag_uid))}),d&&i.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:d}),i.jsxs("div",{className:"tag-input-wrap",children:[i.jsx("span",{className:"hash",children:"/"}),i.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:y,onChange:L=>w(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Ee()}}),i.jsx("button",{className:"tag-add-btn",onClick:Ee,children:"Add"})]})]}),R.length>0&&i.jsxs("div",{className:"rail-section",children:[i.jsx("div",{className:"rail-section-heading",children:"Collections"}),R.map(L=>i.jsxs("div",{className:"coll-row",children:[i.jsx("span",{className:"coll-name",children:L.collection_uid}),i.jsx("span",{className:"vis-badge",children:Ro[L.visibility_bits]??`bits:${L.visibility_bits}`})]},L.collection_uid))]}),n&&(n.summary.entity_kind==="tweet"||n.summary.entity_kind==="tweet_thread")&&i.jsxs("div",{className:"rail-section",children:[i.jsx("div",{className:"rail-section-heading",children:"Actions"}),i.jsx("button",{className:"rail-rearchive-btn",onClick:_,disabled:I==="running",children:I==="running"?"Re-archiving…":"Re-archive"}),I==="done"&&i.jsx("p",{className:"form-msg form-msg--ok",style:{marginTop:"6px"},children:"Re-archived successfully."}),I==="error"&&i.jsx("p",{className:"form-msg form-msg--err",style:{marginTop:"6px"},children:ee})]}),i.jsx("div",{className:"rail-delete-zone",children:i.jsx("button",{className:"rail-delete-btn",onClick:z,children:"Delete entry"})})]})]})}function cm({src:e}){const t=p.useRef(null);return p.useEffect(()=>{t.current&&t.current.load()},[e]),i.jsx("div",{className:"preview-video-wrap",style:{background:"#111",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:"240px"},children:e?i.jsxs("video",{ref:t,controls:!0,autoPlay:!1,style:{width:"100%",maxHeight:"100%",display:"block"},children:[i.jsx("source",{src:e}),"Your browser does not support the video element."]}):i.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No video available"})})}function zo({src:e,type:t,title:n,originalUrl:r}){const l=r||e,s=n||null;return i.jsxs("div",{className:"preview-iframe-wrap",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[i.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:[s&&i.jsx("span",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--ink)",fontFamily:"var(--sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.78rem",color:"var(--muted)",fontFamily:"var(--sans)"},children:l}),i.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 ↗"})]})]}),i.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:s||(t==="pdf"?"PDF preview":"Page preview")})]})}function dm({src:e,alt:t}){return i.jsx("div",{className:"preview-image-wrap",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",background:"var(--paper-2)",overflow:"hidden"},children:i.jsx("a",{href:e,target:"_blank",rel:"noreferrer noopener",style:{display:"contents"},children:i.jsx("img",{src:e,alt:t||"",style:{objectFit:"contain",maxHeight:"100%",maxWidth:"100%",display:"block",cursor:"pointer"}})})})}function td(e){return e?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e*1e3)):""}function Do(e){return!e||!e.includes("&")?e:e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}const O={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"}};function fm(e,t,n){const r={};return n&&n.forEach((l,s)=>{l.relpath&&(r[l.relpath]=`/api/archives/${e}/entries/${t}/artifacts/${s}`)}),r}function Sn(e,t,n){return e&&n[e]?n[e]:t||null}function nd(){return i.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{flexShrink:0,color:"var(--ink)"},children:i.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 ha(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 s=t.indexOf(l);if(s!==-1)return{s,e:s+l.length}}return null}function rd(e,t){const n=e.expanded_url||e.url||e.text||"",r=e.display_url||e.expanded_url||e.url||e.text||"",l=ha(e,t,e.url,e.text,e.display_url,e.expanded_url);return!l||!n?null:{...l,kind:"url",href:n,display:r}}function ld(e,t){const n=e.screen_name||e.name||e.text||"",r=n?`@${n}`:null,l=ha(e,t,r);return!l||!n?null:{...l,kind:"mention",screen_name:n}}const Io=/https?:\/\/[^\s<>"'\])]+/g,pm=/[.,;:!?)()]+$/;function El(e,t){const n=[];let r=0,l;for(Io.lastIndex=0;(l=Io.exec(e))!==null;){l.index>r&&n.push(e.slice(r,l.index));let s=l[0].replace(pm,"");n.push(i.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:t,children:s},l.index));const a=l[0].slice(s.length);a&&n.push(a),r=l.index+l[0].length}return r===0?e:(r<e.length&&n.push(e.slice(r)),n)}function hm(e,t,n=[]){if(!e)return null;const r=[...(t.urls||[]).map(o=>rd(o,e)).filter(Boolean),...(t.user_mentions||[]).map(o=>ld(o,e)).filter(Boolean)];if(r.length===0&&n.length===0)return El(Do(e),O.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 s=(o,u)=>n.some(([c,g])=>c<=o&&g>=u),a=[...l].sort((o,u)=>o-u);return a.slice(0,-1).map((o,u)=>{const c=a[u+1];if(s(o,c))return null;const g=e.slice(o,c),m=r.filter(y=>y.s<=o&&y.e>=c),f=m.find(y=>y.kind==="url");if(f)return i.jsx("a",{href:f.href,target:"_blank",rel:"noopener noreferrer",style:O.link,children:f.display||g},u);const k=m.find(y=>y.kind==="mention");return k?i.jsx("a",{href:`https://x.com/${k.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:O.link,children:g},u):i.jsx("span",{children:El(Do(g),O.link)},u)}).filter(o=>o!==null)}function mm(e,t,n,r){if(!e)return null;t=t||[],n=n||[],r=r||[];const l=[];for(const o of t)o.length>0&&l.push({s:o.offset,e:o.offset+o.length,kind:"style",style:o.style});for(const o of n){const u=rd(o,e);u&&l.push(u)}for(const o of r){const u=ld(o,e);u&&l.push(u)}if(l.length===0)return El(e,O.link);const s=new Set([0,e.length]);for(const o of l)o.s>=0&&o.s<=e.length&&s.add(o.s),o.e>=0&&o.e<=e.length&&s.add(o.e);const a=[...s].sort((o,u)=>o-u);return a.slice(0,-1).map((o,u)=>{const c=a[u+1],g=l.filter(w=>w.s<=o&&w.e>=c),m=e.slice(o,c);let f;if(m.includes(`
|
||
`)){const w=m.split(`
|
||
`);f=w.flatMap((R,h)=>h<w.length-1?[R,i.jsx("br",{},h)]:[R])}else f=m;g.some(w=>w.kind==="style"&&w.style==="Code")&&(f=i.jsx("code",{style:O.iCode,children:f})),g.some(w=>w.kind==="style"&&w.style==="Bold")&&(f=i.jsx("strong",{children:f})),g.some(w=>w.kind==="style"&&w.style==="Italic")&&(f=i.jsx("em",{children:f})),g.some(w=>w.kind==="style"&&w.style==="Underline")&&(f=i.jsx("u",{children:f})),g.some(w=>w.kind==="style"&&w.style==="Strikethrough")&&(f=i.jsx("s",{children:f}));const k=g.find(w=>w.kind==="url");if(k){const w=/^https?:\/\/t\.co\//i.test(f);f=i.jsx("a",{href:k.href,target:"_blank",rel:"noopener noreferrer",style:O.link,children:w?k.display:f})}const y=g.find(w=>w.kind==="mention");return y&&(f=i.jsx("a",{href:`https://x.com/${y.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:O.link,children:f})),i.jsx("span",{children:typeof f=="string"?El(f,O.link):f},u)})}function gm(e,t,n){const r=e.resolved_entities||[];return r.length===0?null:r.map((l,s)=>{var a;switch(l.type){case"divider":return i.jsx("hr",{style:O.bHr},s);case"media":{const o=Sn(l.local_path,l.url,t);return o?i.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:u=>{var c;!u.metaKey&&!u.ctrlKey&&(u.preventDefault(),(c=n==null?void 0:n.onImgClick)==null||c.call(n,o))},children:i.jsx("img",{src:o,style:O.bImg,loading:"lazy",alt:""})},s):null}case"tweet":return l.tweet_id?i.jsxs("a",{href:`https://x.com/i/status/${l.tweet_id}`,target:"_blank",rel:"noopener noreferrer",style:O.bTweet,children:[i.jsx(nd,{}),"View post on X"]},s):null;case"link":return l.url?i.jsx("p",{style:O.bP,children:i.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",style:O.link,children:l.url})},s):null;case"markdown":{const o=l.markdown??((a=l.data)==null?void 0:a.markdown)??"";return i.jsx("pre",{style:O.bMdPre,children:i.jsx("code",{style:O.bMdCode,children:o})},s)}case"emoji":return l.url?i.jsx("img",{src:l.url,alt:"",style:{height:"1.2em",verticalAlign:"middle",margin:"0 1px"}},s):null;default:return null}})}function ws(e,t,n,r){const l=e.type||"",s=e.text||"",a=e.inline_style_ranges||[],o=e.data||{},u=mm(s,a,o.urls||[],o.mentions||[]);switch(l){case"header-one":return i.jsx("h1",{style:O.bH1,children:u},t);case"header-two":{const c=s.match(/(?:x\.com|twitter\.com)\/i\/status\/(\d+)/);return c?i.jsxs("a",{href:`https://x.com/i/status/${c[1]}`,target:"_blank",rel:"noopener noreferrer",style:O.bTweet,children:[i.jsx(nd,{}),"View post on X"]},t):i.jsx("h2",{style:O.bH2,children:u},t)}case"unstyled":return s.trim()?i.jsx("p",{style:O.bP,children:u},t):i.jsx("span",{style:O.bSpacer},t);case"blockquote":return i.jsx("blockquote",{style:O.bQuote,children:u},t);case"unordered-list-item":case"ordered-list-item":return i.jsx("li",{style:O.bLi,children:u},t);case"atomic":return i.jsx("span",{children:gm(e,n,r)},t);default:return s?i.jsx("p",{style:O.bP,children:u},t):null}}function vm(e,t,n){const r=[];let l=0;for(;l<e.length;){const s=e[l];if(s.type==="unordered-list-item"){const a=l,o=[];for(;l<e.length&&e[l].type==="unordered-list-item";)o.push(ws(e[l],l,t,n)),l++;r.push(i.jsx("ul",{style:O.bUl,children:o},`ul-${a}`))}else if(s.type==="ordered-list-item"){const a=l,o=[];for(;l<e.length&&e[l].type==="ordered-list-item";)o.push(ws(e[l],l,t,n)),l++;r.push(i.jsx("ol",{style:O.bOl,children:o},`ol-${a}`))}else r.push(ws(s,l,t,n)),l++}return r}function ym({article:e,tweetAuthor:t,artifactMap:n}){const[r,l]=p.useState(null),s=e.cover_media||{},a=e.author||t||{},o=e.first_published_at_secs?td(e.first_published_at_secs):"",c=[a.screen_name?`@${a.screen_name}`:"",o].filter(Boolean).join(" · "),g=Sn(s.local_path,s.url,n),m=Sn(a.avatar_local_path,a.avatar_url,n);return i.jsxs("div",{style:O.article,children:[r&&i.jsx(sd,{items:[{src:r,alt:""}],startIndex:0,onClose:()=>l(null)}),g&&i.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:f=>{!f.metaKey&&!f.ctrlKey&&(f.preventDefault(),l(g))},children:i.jsx("img",{src:g,style:O.aCover,alt:"Article cover"})}),i.jsxs("div",{style:O.aMeta,children:[e.title&&i.jsx("div",{style:O.aTweetTitle,children:e.title}),i.jsxs("div",{style:O.aAuthorRow,children:[m?i.jsx("img",{src:m,style:O.aAvatar,alt:a.name||""}):i.jsx("div",{style:O.aAvatarPh}),i.jsxs("div",{children:[i.jsx("div",{style:O.aAuthorName,children:a.name||a.screen_name||"Unknown"}),c&&i.jsx("div",{style:O.aAuthorSub,children:c})]})]})]}),i.jsx("hr",{style:O.aDivider}),i.jsx("div",{style:O.aBody,children:vm(e.blocks||[],n,{onImgClick:l})})]})}function xm({photos:e,onOpen:t}){const n=e.length;if(n===0)return null;if(n===1)return i.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:i.jsx("img",{src:e[0].src,alt:e[0].alt||"",style:O.mediaImg,loading:"lazy"})});const r=n<=2?"180px":"140px";return i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gridTemplateRows:n===2?r:`${r} ${r}`,gap:"2px"},children:e.map((l,s)=>i.jsx("a",{href:l.src,target:"_blank",rel:"noopener noreferrer",style:{display:"block",overflow:"hidden",gridRow:n===3&&s===0?"span 2":void 0},onClick:a=>{!a.metaKey&&!a.ctrlKey&&(a.preventDefault(),t(s))},children:i.jsx("img",{src:l.src,alt:l.alt||"",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},s))})}function sd({items:e,startIndex:t,onClose:n}){const[r,l]=p.useState(t);p.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 s=e[r];return i.jsx("div",{style:O.lightboxBackdrop,onClick:n,children:i.jsxs("div",{style:O.lightboxContent,onClick:a=>a.stopPropagation(),children:[i.jsxs("div",{style:O.lightboxToolbar,children:[e.length>1&&i.jsxs("span",{style:O.lightboxCounter,children:[r+1," / ",e.length]}),i.jsx("a",{href:s.src,target:"_blank",rel:"noopener noreferrer",style:O.lightboxLink,title:"Open in new tab",children:"↗"}),i.jsx("button",{style:O.lightboxBtn,onClick:n,"aria-label":"Close",children:"×"})]}),i.jsx("img",{src:s.src,alt:s.alt||"",style:O.lightboxImg}),e.length>1&&i.jsxs("div",{style:O.lightboxNav,children:[i.jsx("button",{style:O.lightboxNavBtn,onClick:()=>l(a=>Math.max(a-1,0)),disabled:r===0,children:"‹"}),i.jsx("button",{style:O.lightboxNavBtn,onClick:()=>l(a=>Math.min(a+1,e.length-1)),disabled:r===e.length-1,children:"›"})]})]})})}function bo({tweet:e,isInThread:t,isLast:n,artifactMap:r}){var d,v;const[l,s]=p.useState(null),a=e.author||{},o=e.created_at_secs?td(e.created_at_secs):"",u=e.entities||{},c=Sn(a.avatar_local_path,a.avatar_url,r),g=t&&!n,m=e.is_quote_status===!0,f=t?O.tweetRowThread:O.tweetRow,k=e.full_text||"",y=((v=(d=e.extended_entities)==null?void 0:d.media)!=null&&v.length?e.extended_entities.media:u.media)||[],w=[],R=[];for(const x of y)if(x.type==="photo"){const j=Sn(x.local_path,x.media_url_https,r);j&&w.push({kind:"photo",src:j,alt:x.alt_text||""})}else if(x.type==="video"||x.type==="animated_gif"){const j=x.local_path&&r[x.local_path]||(()=>{var E,S;return(S=(((E=x.video_info)==null?void 0:E.variants)||[]).filter(b=>b.content_type==="video/mp4").sort((b,I)=>(I.bitrate||0)-(b.bitrate||0))[0])==null?void 0:S.url})();j&&R.push({kind:x.type==="animated_gif"?"gif":"video",src:j})}const h=[];for(const x of y){if(!x.url||!(x.type==="photo"?w.some(E=>E.src===Sn(x.local_path,x.media_url_https,r)):R.length>0))continue;const T=ha(x,k,x.url);T&&h.push([T.s,T.e])}return i.jsxs(i.Fragment,{children:[l!==null&&i.jsx(sd,{items:w,startIndex:l,onClose:()=>s(null)}),i.jsxs("div",{style:f,children:[i.jsxs("div",{style:O.leftCol,children:[c?i.jsx("img",{src:c,style:O.avatar,alt:a.name||""}):i.jsx("div",{style:O.avatarPh}),g&&i.jsx("div",{style:O.threadLine})]}),i.jsxs("div",{style:O.rightCol,children:[i.jsxs("div",{style:O.authorRow,children:[i.jsx("span",{style:O.authorName,children:a.name||a.screen_name||"Unknown"}),a.screen_name&&i.jsxs("span",{style:O.authorHandle,children:["@",a.screen_name]}),o&&i.jsxs("span",{style:O.datePart,children:["· ",o]}),m&&i.jsx("span",{style:O.qtBadge,title:"Quote tweet",children:"↻ QT"})]}),i.jsx("div",{style:O.tweetText,children:hm(k,u,h)}),w.length>0&&i.jsx("div",{style:O.mediaGrid,children:i.jsx(xm,{photos:w,onOpen:x=>s(x)})}),R.map((x,j)=>i.jsx("div",{style:O.mediaGrid,children:i.jsx("video",{src:x.src,style:O.mediaVideo,controls:!0,loop:x.kind==="gif",muted:x.kind==="gif",autoPlay:x.kind==="gif"})},j)),(e.retweet_count>0||e.favorite_count>0)&&i.jsxs("div",{style:O.stats,children:[e.favorite_count>0&&i.jsxs("span",{children:["❤️ ",e.favorite_count.toLocaleString()]}),e.retweet_count>0&&i.jsxs("span",{children:["🔁 ",e.retweet_count.toLocaleString()]})]})]})]})]})}function wm({archiveId:e,entryUid:t,artifacts:n,entityKind:r}){const[l,s]=p.useState(!0),[a,o]=p.useState(null),[u,c]=p.useState([]);if(p.useEffect(()=>{if(s(!0),o(null),c([]),!n||!e||!t){s(!1);return}const f=n.map((y,w)=>({...y,index:w})).filter(y=>y.artifact_role==="raw_tweet_json");if(f.length===0){o("No tweet data found."),s(!1);return}let k=!1;return Jp(e,t,f.map(y=>y.index)).then(async y=>{if(k)return;const w=/https?:\/\/t\.co\/[A-Za-z0-9]+/g,R=j=>{var E;const T=j.full_text||"";return(((E=j.entities)==null?void 0:E.urls)||[]).map(S=>{var b;if(S.fromIndex!=null&&S.toIndex!=null)return[S.fromIndex,S.toIndex];if(((b=S.indices)==null?void 0:b.length)===2)return[S.indices[0],S.indices[1]];if(S.url){const I=T.indexOf(S.url);if(I!==-1)return[I,I+S.url.length]}return null}).filter(Boolean)},h=(j,T,E)=>j.some(([S,b])=>S<=T&&b>=E),d=new Set;for(const j of y){const T=j.full_text||"",E=R(j);let S;for(w.lastIndex=0;(S=w.exec(T))!==null;)h(E,S.index,S.index+S[0].length)||d.add(S[0])}const v=d.size>0?await Gp([...d]).catch(()=>({})):{},x=y.map(j=>{var I;const T=j.full_text||"",E=R(j),S=[];let b;for(w.lastIndex=0;(b=w.exec(T))!==null;){const H=b[0],ee=v[H];ee&&ee!==H&&!h(E,b.index,b.index+H.length)&&S.push({url:H,expanded_url:ee,display_url:(()=>{try{const Z=new URL(ee);return Z.hostname+(Z.pathname.length>1?"/…":"")}catch{return ee}})(),fromIndex:b.index,toIndex:b.index+H.length})}return S.length===0?j:{...j,entities:{...j.entities||{},urls:[...((I=j.entities)==null?void 0:I.urls)||[],...S]}}});k||c(x)}).catch(y=>{k||o(y.message||"Failed to load tweet.")}).finally(()=>{k||s(!1)}),()=>{k=!0}},[e,t,n]),l)return i.jsx("div",{style:O.loading,children:"Loading…"});if(a)return i.jsxs("div",{style:O.error,children:["Error: ",a]});if(u.length===0)return null;const g=fm(e,t,n);if(r==="tweet_thread")return i.jsx("div",{style:O.threadOuter,children:u.map((f,k)=>i.jsx(bo,{tweet:f,isInThread:!0,isLast:k===u.length-1,artifactMap:g},f.id||k))});const m=u[0];return m.is_article&&m.article?i.jsx(ym,{article:m.article,tweetAuthor:m.author,artifactMap:g}):i.jsx("div",{style:O.card,children:i.jsx(bo,{tweet:m,isInThread:!1,isLast:!0,artifactMap:g})})}const km=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv"]),jm=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),Sm=new Set(["jpg","jpeg","png","gif","webp","avif","svg","bmp"]);function id({archiveId:e,entry:t,detail:n}){if(!t)return i.jsx("div",{className:"preview-panel preview-panel--empty",children:i.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"Select an entry to preview"})});if(!n)return i.jsx("div",{className:"preview-panel preview-panel--loading",children:i.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"Loading…"})});const{summary:r,artifacts:l}=n,s=r.entry_uid,a=r.entity_kind;if(a==="tweet"||a==="tweet_thread")return i.jsx("div",{className:"preview-tweet-wrap",children:i.jsx(wm,{archiveId:e,entryUid:s,artifacts:l,entityKind:a})});const o=l.findIndex(m=>m.artifact_role==="primary_media");if(o===-1)return i.jsxs("div",{className:"preview-panel preview-panel--no-preview",children:[i.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No preview available"}),l.length>0&&i.jsx("ul",{style:{marginTop:"12px",paddingLeft:"20px",fontSize:"0.8rem",color:"var(--muted-2)",fontFamily:"var(--sans)"},children:l.map((m,f)=>i.jsxs("li",{children:[m.artifact_role,": ",m.relpath]},f))})]});const u=l[o],c=`/api/archives/${e}/entries/${s}/artifacts/${o}`,g=u.relpath.split(".").pop().toLowerCase();return km.has(g)?i.jsx("div",{className:"preview-panel",children:i.jsx(cm,{src:c})}):jm.has(g)?i.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:[i.jsx("span",{style:{fontSize:"2rem"},children:"🎵"}),i.jsx("span",{style:{color:"var(--ink)",fontSize:"0.95rem",fontWeight:600},children:r.title||s}),i.jsx("audio",{src:c,controls:!0,style:{marginTop:"8px",width:"100%",maxWidth:"400px"}})]}):g==="pdf"?i.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:i.jsx(zo,{src:c,type:"pdf",title:r.title,originalUrl:r.original_url})}):g==="html"||g==="htm"?i.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:i.jsx(zo,{src:c,type:"page",title:r.title,originalUrl:r.original_url})}):Sm.has(g)?i.jsx("div",{className:"preview-panel",style:{height:"100%"},children:i.jsx(dm,{src:c,alt:r.title||"Image"})}):i.jsxs("div",{className:"preview-panel preview-panel--no-preview",children:[i.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No preview available"}),i.jsx("ul",{style:{marginTop:"12px",paddingLeft:"20px",fontSize:"0.8rem",color:"var(--muted-2)",fontFamily:"var(--sans)"},children:l.map((m,f)=>i.jsxs("li",{children:[m.artifact_role,": ",m.relpath]},f))})]})}function Nm({archiveId:e,entry:t,detail:n,onClose:r}){var l,s;return p.useEffect(()=>{const a=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),i.jsx("div",{className:"preview-modal-backdrop",onClick:r,children:i.jsxs("div",{className:`preview-modal${((l=n==null?void 0:n.summary)==null?void 0:l.entity_kind)==="tweet"||((s=n==null?void 0:n.summary)==null?void 0:s.entity_kind)==="tweet_thread"?"":" preview-modal--full"}`,onClick:a=>a.stopPropagation(),children:[i.jsxs("div",{className:"preview-modal-header",children:[i.jsx("span",{className:"preview-modal-title",children:(t==null?void 0:t.title)||(t==null?void 0:t.entry_uid)||"Preview"}),i.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:"↗"}),i.jsx("button",{className:"preview-modal-close",onClick:r,"aria-label":"Close preview",children:"×"})]}),i.jsx("div",{className:"preview-modal-body",children:i.jsx(id,{archiveId:e,entry:t,detail:n})})]})})}function Oo(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 _m({entry:e,src:t,archiveId:n,onClose:r}){const l=p.useRef(null),[s,a]=p.useState(!1),[o,u]=p.useState(0),[c,g]=p.useState(NaN),[m,f]=p.useState(1);p.useEffect(()=>{!l.current||!t||(l.current.load(),u(0),g(NaN),a(!1))},[t]),p.useEffect(()=>{l.current&&(l.current.volume=m)},[m]);function k(){const d=l.current;d&&(s?d.pause():d.play().catch(()=>{}))}function y(d){const v=l.current;if(!v||!isFinite(c))return;const x=Number(d.target.value);v.currentTime=x,u(x)}function w(d){f(Number(d.target.value))}const R=(e==null?void 0:e.title)||(e==null?void 0:e.entry_uid)||"Unknown",h=(e==null?void 0:e.source_kind)||"other";return i.jsxs(i.Fragment,{children:[i.jsx("audio",{ref:l,src:t||void 0,preload:"auto",onPlay:()=>a(!0),onPause:()=>a(!1),onEnded:()=>a(!1),onTimeUpdate:()=>{var d;return u(((d=l.current)==null?void 0:d.currentTime)??0)},onLoadedMetadata:()=>{var d;return g(((d=l.current)==null?void 0:d.duration)??NaN)},onDurationChange:()=>{var d;return g(((d=l.current)==null?void 0:d.duration)??NaN)},style:{display:"none"}}),i.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:[i.jsxs("div",{className:"audio-bar-info",style:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:"0 1 220px",overflow:"hidden"},children:[i.jsx("span",{className:"source-icon",style:{flexShrink:0,width:"18px",height:"18px",display:"flex",alignItems:"center"},dangerouslySetInnerHTML:{__html:pa(h)}}),i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.85rem",color:"var(--ink)"},title:R,children:R})]}),i.jsxs("div",{className:"audio-bar-controls",style:{display:"flex",alignItems:"center",gap:"10px",flex:"1 1 0",minWidth:0},children:[i.jsx("button",{onClick:k,"aria-label":s?"Pause":"Play",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--ink)",flexShrink:0,fontSize:"1.2rem",lineHeight:1},children:s?"⏸":"▶"}),i.jsx("span",{style:{fontSize:"0.75rem",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:Oo(o)}),i.jsx("input",{type:"range",min:0,max:isFinite(c)?c:0,step:.1,value:isFinite(o)?o:0,onChange:y,"aria-label":"Seek",style:{flex:1,minWidth:0,accentColor:"var(--accent)"}}),i.jsx("span",{style:{fontSize:"0.75rem",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:Oo(c)})]}),i.jsxs("div",{className:"audio-bar-right",style:{display:"flex",alignItems:"center",gap:"8px",flex:"0 1 160px"},children:[i.jsx("span",{style:{fontSize:"0.85rem",color:"var(--muted)",flexShrink:0},children:"🔊"}),i.jsx("input",{type:"range",min:0,max:1,step:.01,value:m,onChange:w,"aria-label":"Volume",style:{width:"80px",accentColor:"var(--accent)"}}),i.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 Cm({archiveId:e,entryUid:t}){var g,m;const[n,r]=p.useState(null),[l,s]=p.useState(!0),[a,o]=p.useState(null);p.useEffect(()=>{hi(e,t).then(f=>{r(f),s(!1)}).catch(f=>{o((f==null?void 0:f.message)||"Failed to load entry"),s(!1)})},[e,t]);const u=((g=n==null?void 0:n.summary)==null?void 0:g.title)||t,c=(m=n==null?void 0:n.summary)==null?void 0:m.original_url;return i.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",background:"var(--paper)",fontFamily:"var(--sans)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",borderBottom:"1px solid var(--line)",flexShrink:0,background:"var(--paper-2)"},children:[i.jsx("a",{href:"/",style:{color:"var(--accent)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"← Archive"}),i.jsx("span",{style:{flex:1,fontSize:"14px",fontWeight:600,color:"var(--ink)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u}),c&&i.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--muted)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"Original ↗"})]}),i.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column"},children:[l&&i.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--muted)",fontSize:"14px"},children:"Loading…"}),a&&i.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--alert)",fontSize:"14px"},children:a}),n&&i.jsx(id,{archiveId:e,entry:n.summary,detail:n})]})]})}const Em=7e3;function Tm({toasts:e,onDismiss:t,onIgnoreUblock:n}){return e.length?i.jsx("div",{className:"toast-stack",role:"log","aria-live":"polite","aria-label":"Notifications",children:e.map(r=>i.jsx(Lm,{toast:r,onDismiss:t,onIgnoreUblock:n},r.id))}):null}function Pm(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),s=(l[l.length-1]??"")+r,a=s?`${t}/…/${s}`:t;return a.length<=56?a:a.slice(0,53)+"…"}catch{return"…"+e.slice(-51)}}function Lm({toast:e,onDismiss:t,onIgnoreUblock:n}){const[r,l]=p.useState(!1),s=e.type==="warning",a=e.type==="success";p.useEffect(()=>{if(r)return;const u=setTimeout(()=>t(e.id),Em);return()=>clearTimeout(u)},[r,e.id,t]);const o=Pm(e.locator);return a?i.jsx("div",{className:"toast toast--success",role:"alert","aria-atomic":"true",children:i.jsxs("div",{className:"toast-top",children:[i.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"✓"}),i.jsxs("div",{className:"toast-body",children:[i.jsx("span",{className:"toast-headline",children:e.headline||"Archived"}),o&&i.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),i.jsx("div",{className:"toast-btns",children:i.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})})]})}):s?i.jsxs("div",{className:"toast toast--warning",role:"alert","aria-atomic":"true",children:[i.jsxs("div",{className:"toast-top",children:[i.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"⚠"}),i.jsxs("div",{className:"toast-body",children:[i.jsx("span",{className:"toast-headline",children:e.headline||"Archived with warnings"}),o&&i.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),i.jsxs("div",{className:"toast-btns",children:[e.text&&i.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(u=>!u),"aria-expanded":r,children:r?"Hide":"Details"}),e.locator&&i.jsx("button",{type:"button",className:"toast-view-btn toast-ignore-btn",onClick:()=>{n==null||n(),t(e.id)},children:"Ignore"}),i.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})]})]}),r&&i.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."})]}):i.jsxs("div",{className:"toast toast--error",role:"alert","aria-atomic":"true",children:[i.jsxs("div",{className:"toast-top",children:[i.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"✕"}),i.jsxs("div",{className:"toast-body",children:[i.jsx("span",{className:"toast-headline",children:e.headline||"Capture failed"}),o&&i.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),i.jsxs("div",{className:"toast-btns",children:[e.text&&i.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(u=>!u),children:r?"Hide":"View error"}),i.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})]})]}),r&&e.text&&i.jsx("pre",{className:"toast-error-detail",children:e.text})]})}const Wl=p.createContext(null),Wr=(()=>{const e=window.location.pathname.match(/^\/preview\/([^/]+)\/([^/]+)/);return e?{archiveId:e[1],entryUid:e[2]}:null})(),Rm=["archive","tags","collections","runs","admin","settings"],zm=["profile","tokens","instance","storage"];function ks(){const e=window.location.pathname.split("/").filter(Boolean),t=Rm.includes(e[0])?e[0]:"archive",n=t==="settings"&&zm.includes(e[1])?e[1]:"profile";return{view:t,settingsTab:n}}function Dm(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function Im(){const[e,t]=p.useState("loading"),[n,r]=p.useState(null);p.useEffect(()=>{(async()=>{if(await sh()){t("setup");return}const V=await uh();if(!V){t("login");return}r(V),t("authenticated")})()},[]),p.useEffect(()=>{const A=()=>{r(null),t("login")};return window.addEventListener("auth:expired",A),()=>window.removeEventListener("auth:expired",A)},[]),p.useEffect(()=>{const A=()=>{const{view:V,settingsTab:se}=ks();h(V),v(se)};return window.addEventListener("popstate",A),()=>window.removeEventListener("popstate",A)},[]);const[l,s]=p.useState([]),[a,o]=p.useState(null),[u,c]=p.useState([]),[g,m]=p.useState(null),[f,k]=p.useState(null),[y,w]=p.useState(null),[R,h]=p.useState(()=>ks().view),[d,v]=p.useState(()=>ks().settingsTab),[x,j]=p.useState(""),[T,E]=p.useState(""),[S,b]=p.useState(!1),[I,H]=p.useState([]),[ee,Z]=p.useState([]),[te,je]=p.useState(()=>sessionStorage.getItem("captureDialogOpen")==="true"),[Ee,ye]=p.useState([]),z=p.useRef(0),[_,B]=p.useState(()=>sessionStorage.getItem("ublockWarningIgnored")==="true"),[N,C]=p.useState(null),F=p.useRef(0),M=(n==null?void 0:n.humanize_slugs)??!1;p.useEffect(()=>{const A=++F.current;C(null),!(!f||!a)&&hi(a,f.entry_uid).then(V=>{A===F.current&&C(V)}).catch(()=>{})},[f,a]),p.useEffect(()=>{sessionStorage.setItem("captureDialogOpen",te)},[te]);const U=p.useCallback(async(A,V,se)=>{if(A){b(!0);try{let Qe;V||se?Qe=await Xp(A,V,se):Qe=await Kp(A),c(Qe),E(Qe.length===0?"No results":`${Qe.length} result${Qe.length===1?"":"s"}`)}catch{c([]),E("Search failed. Try again.")}finally{b(!1)}}},[]);p.useEffect(()=>{e==="authenticated"&&Qp().then(A=>{if(s(A),A.length>0){const V=A[0].id;o(V)}})},[e]),p.useEffect(()=>{a&&(w(null),k(null),m(null),Promise.all([U(a,"",null),Eo(a).then(H),ys(a).then(Z)]))},[a]),p.useEffect(()=>{if(a===null)return;const A=setTimeout(()=>{U(a,x,y)},300);return()=>clearTimeout(A)},[x,a]),p.useEffect(()=>{a!==null&&(y!==null&&h("archive"),U(a,x,y))},[y,a]);const Y=p.useCallback(A=>{o(A)},[]),Q=p.useCallback(A=>{h(A),A==="tags"&&a&&ys(a).then(Z)},[a]);p.useEffect(()=>{if(Wr)return;const A=Dm(R,d);window.location.pathname!==A&&history.pushState(null,"",A)},[R,d]);const J=p.useCallback(A=>{m(A?A.entry_uid:null),k(A)},[]),L=p.useCallback(A=>{w(A)},[]),X=p.useCallback(()=>{w(null)},[]),We=p.useCallback(()=>{a&&ys(a).then(Z)},[a]),Ve=p.useCallback((A,V)=>{y===A?w(V):y!=null&&y.startsWith(A+"/")&&w(V+y.slice(A.length))},[y]),D=p.useCallback(A=>{(y===A||y!=null&&y.startsWith(A+"/"))&&w(null)},[y]),W=p.useCallback((A,V)=>{c(se=>se.map(Qe=>Qe.entry_uid===A?{...Qe,title:V}:Qe)),k(se=>se&&se.entry_uid===A?{...se,title:V}:se),C(se=>se&&se.summary.entry_uid===A?{...se,summary:{...se.summary,title:V}}:se)},[]),$e=p.useCallback(()=>{if(!a||!f)return;const A=++F.current;hi(a,f.entry_uid).then(V=>{A===F.current&&C(V)}).catch(()=>{})},[a,f]),dt=p.useCallback(A=>{c(V=>V.filter(se=>se.entry_uid!==A)),k(V=>(V==null?void 0:V.entry_uid)===A?null:V),m(V=>V===A?null:V)},[]),ad=p.useCallback(()=>{je(!0)},[]),od=p.useCallback(()=>{je(!1)},[]),ud=p.useCallback(()=>{a&&Promise.all([U(a,x,y),Eo(a).then(H)])},[a,x,y,U]),cd=p.useCallback((A,V,se="error",Qe=null)=>{if(se==="warning"&&_&&V)return;const vd=++z.current;ye(yd=>[...yd,{id:vd,text:A,locator:V,type:se,headline:Qe}])},[_]),dd=p.useCallback(A=>{ye(V=>V.filter(se=>se.id!==A))},[]),fd=p.useCallback(()=>{sessionStorage.setItem("ublockWarningIgnored","true"),B(!0),ye(A=>A.filter(V=>!(V.type==="warning"&&V.locator)))},[]),[ma,Vl]=p.useState(null),[In,ga]=p.useState(null),pd=p.useCallback(()=>{f&&Vl(f.entry_uid)},[f]),hd=p.useCallback(()=>Vl(null),[]),md=p.useCallback((A,V)=>{ga({src:A,entry:V})},[]),gd=p.useCallback(()=>ga(null),[]);return p.useEffect(()=>{Vl(null)},[f]),p.useEffect(()=>(document.body.classList.toggle("has-audio-bar",!!In),()=>document.body.classList.remove("has-audio-bar")),[In]),e==="loading"?i.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?i.jsx(Ah,{onComplete:()=>t("login")}):e==="login"?i.jsx($h,{onLogin:A=>{r(A),t("authenticated")}}):Wr?i.jsx(Cm,{archiveId:Wr.archiveId,entryUid:Wr.entryUid}):i.jsx(Wl.Provider,{value:{currentUser:n,setCurrentUser:r},children:i.jsxs(i.Fragment,{children:[i.jsx(Fh,{archives:l,archiveId:a,onArchiveChange:Y,view:R,onViewChange:Q,onCaptureClick:ad}),i.jsxs("main",{className:"app-shell",children:[i.jsxs("div",{className:"workspace",children:[R==="archive"&&i.jsxs("div",{className:"toolbar",children:[i.jsxs("div",{className:"search-field",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),i.jsx("input",{className:"search-input",type:"search","aria-label":"Search archive","aria-busy":S,placeholder:"Search titles, URLs, types, tags…",value:x,onChange:A=>j(A.target.value)}),i.jsx("span",{className:"kbd",children:"⌘K"})]}),i.jsxs("span",{className:"result-count",children:[T&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:T.split(" ")[0]})," ",T.split(" ").slice(1).join(" ")]}),y&&i.jsxs("button",{className:"tag-filter-badge",onClick:X,children:["× ",M?Zc(y):y]})]})]}),R==="archive"&&i.jsx(Vh,{entries:u,selectedEntryUid:g,onSelectEntry:J,archiveId:a,tagFilter:y,onClearTagFilter:X,searchQuery:x,onSearchChange:j,resultCount:T,searchBusy:S}),R==="runs"&&i.jsx(Xh,{runs:I}),R==="admin"&&i.jsx(Gh,{archives:l}),R==="tags"&&i.jsx(Yh,{archiveId:a,tagNodes:ee,tagFilter:y,onTagFilterSet:L,onViewChange:Q,onTagRenamed:Ve,onTagDeleted:D,onTagsRefresh:We,humanizeTags:M}),R==="collections"&&i.jsx(Zh,{archiveId:a}),R==="settings"&&i.jsx(tm,{tab:d,onTabChange:v,archiveId:a})]}),i.jsx(um,{archiveId:a,selectedEntry:f,detail:N,onTagFilterSet:L,tagNodes:ee,onTagsRefresh:We,onEntryTitleChange:W,onEntryDeleted:dt,humanizeTags:M,onDetailRefresh:$e,onOpenPreview:pd,onPlay:md})]}),ma&&f&&f.entry_uid===ma&&i.jsx(Nm,{archiveId:a,entry:f,detail:N,onClose:hd}),In&&i.jsx(_m,{entry:In.entry,src:In.src,archiveId:a,onClose:gd}),i.jsx(Mh,{open:te,archiveId:a,onClose:od,onCaptured:ud,onToast:cd}),i.jsx(Tm,{toasts:Ee,onDismiss:dd,onIgnoreUblock:fd})]})})}Jc(document.getElementById("root")).render(i.jsx(p.StrictMode,{children:i.jsx(Im,{})}));
|