pikibun 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +0,0 @@
1
- (function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function a(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(c){if(c.ep)return;c.ep=!0;const u=a(c);fetch(c.href,u)}})();function Kb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var od={exports:{}},wr={};var Wg;function Fk(){if(Wg)return wr;Wg=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function a(l,c,u){var d=null;if(u!==void 0&&(d=""+u),c.key!==void 0&&(d=""+c.key),"key"in c){u={};for(var h in c)h!=="key"&&(u[h]=c[h])}else u=c;return c=u.ref,{$$typeof:e,type:l,key:d,ref:c!==void 0?c:null,props:u}}return wr.Fragment=s,wr.jsx=a,wr.jsxs=a,wr}var ey;function Yk(){return ey||(ey=1,od.exports=Fk()),od.exports}var i=Yk(),cd={exports:{}},Ue={};var ty;function Pk(){if(ty)return Ue;ty=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function x(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,T={};function k(R,Q,N){this.props=R,this.context=Q,this.refs=T,this.updater=N||w}k.prototype.isReactComponent={},k.prototype.setState=function(R,Q){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Q,"setState")},k.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function z(){}z.prototype=k.prototype;function A(R,Q,N){this.props=R,this.context=Q,this.refs=T,this.updater=N||w}var I=A.prototype=new z;I.constructor=A,S(I,k.prototype),I.isPureReactComponent=!0;var q=Array.isArray;function _(){}var F={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function ne(R,Q,N){var de=N.ref;return{$$typeof:e,type:R,key:Q,ref:de!==void 0?de:null,props:N}}function B(R,Q){return ne(R.type,Q,R.props)}function H(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function K(R){var Q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(N){return Q[N]})}var re=/\/+/g;function ie(R,Q){return typeof R=="object"&&R!==null&&R.key!=null?K(""+R.key):Q.toString(36)}function G(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(_,_):(R.status="pending",R.then(function(Q){R.status==="pending"&&(R.status="fulfilled",R.value=Q)},function(Q){R.status==="pending"&&(R.status="rejected",R.reason=Q)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function U(R,Q,N,de,ye){var ge=typeof R;(ge==="undefined"||ge==="boolean")&&(R=null);var Me=!1;if(R===null)Me=!0;else switch(ge){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(R.$$typeof){case e:case s:Me=!0;break;case y:return Me=R._init,U(Me(R._payload),Q,N,de,ye)}}if(Me)return ye=ye(R),Me=de===""?"."+ie(R,0):de,q(ye)?(N="",Me!=null&&(N=Me.replace(re,"$&/")+"/"),U(ye,Q,N,"",function(ut){return ut})):ye!=null&&(H(ye)&&(ye=B(ye,N+(ye.key==null||R&&R.key===ye.key?"":(""+ye.key).replace(re,"$&/")+"/")+Me)),Q.push(ye)),1;Me=0;var We=de===""?".":de+":";if(q(R))for(var pe=0;pe<R.length;pe++)de=R[pe],ge=We+ie(de,pe),Me+=U(de,Q,N,ge,ye);else if(pe=x(R),typeof pe=="function")for(R=pe.call(R),pe=0;!(de=R.next()).done;)de=de.value,ge=We+ie(de,pe++),Me+=U(de,Q,N,ge,ye);else if(ge==="object"){if(typeof R.then=="function")return U(G(R),Q,N,de,ye);throw Q=String(R),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return Me}function M(R,Q,N){if(R==null)return R;var de=[],ye=0;return U(R,de,"","",function(ge){return Q.call(N,ge,ye++)}),de}function W(R){if(R._status===-1){var Q=R._result;Q=Q(),Q.then(function(N){(R._status===0||R._status===-1)&&(R._status=1,R._result=N)},function(N){(R._status===0||R._status===-1)&&(R._status=2,R._result=N)}),R._status===-1&&(R._status=0,R._result=Q)}if(R._status===1)return R._result.default;throw R._result}var ee=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},O={map:M,forEach:function(R,Q,N){M(R,function(){Q.apply(this,arguments)},N)},count:function(R){var Q=0;return M(R,function(){Q++}),Q},toArray:function(R){return M(R,function(Q){return Q})||[]},only:function(R){if(!H(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ue.Activity=b,Ue.Children=O,Ue.Component=k,Ue.Fragment=a,Ue.Profiler=c,Ue.PureComponent=A,Ue.StrictMode=l,Ue.Suspense=g,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(R){return F.H.useMemoCache(R)}},Ue.cache=function(R){return function(){return R.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(R,Q,N){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var de=S({},R.props),ye=R.key;if(Q!=null)for(ge in Q.key!==void 0&&(ye=""+Q.key),Q)!oe.call(Q,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&Q.ref===void 0||(de[ge]=Q[ge]);var ge=arguments.length-2;if(ge===1)de.children=N;else if(1<ge){for(var Me=Array(ge),We=0;We<ge;We++)Me[We]=arguments[We+2];de.children=Me}return ne(R.type,ye,de)},Ue.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},Ue.createElement=function(R,Q,N){var de,ye={},ge=null;if(Q!=null)for(de in Q.key!==void 0&&(ge=""+Q.key),Q)oe.call(Q,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ye[de]=Q[de]);var Me=arguments.length-2;if(Me===1)ye.children=N;else if(1<Me){for(var We=Array(Me),pe=0;pe<Me;pe++)We[pe]=arguments[pe+2];ye.children=We}if(R&&R.defaultProps)for(de in Me=R.defaultProps,Me)ye[de]===void 0&&(ye[de]=Me[de]);return ne(R,ge,ye)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(R){return{$$typeof:h,render:R}},Ue.isValidElement=H,Ue.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:W}},Ue.memo=function(R,Q){return{$$typeof:m,type:R,compare:Q===void 0?null:Q}},Ue.startTransition=function(R){var Q=F.T,N={};F.T=N;try{var de=R(),ye=F.S;ye!==null&&ye(N,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(_,ee)}catch(ge){ee(ge)}finally{Q!==null&&N.types!==null&&(Q.types=N.types),F.T=Q}},Ue.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ue.use=function(R){return F.H.use(R)},Ue.useActionState=function(R,Q,N){return F.H.useActionState(R,Q,N)},Ue.useCallback=function(R,Q){return F.H.useCallback(R,Q)},Ue.useContext=function(R){return F.H.useContext(R)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(R,Q){return F.H.useDeferredValue(R,Q)},Ue.useEffect=function(R,Q){return F.H.useEffect(R,Q)},Ue.useEffectEvent=function(R){return F.H.useEffectEvent(R)},Ue.useId=function(){return F.H.useId()},Ue.useImperativeHandle=function(R,Q,N){return F.H.useImperativeHandle(R,Q,N)},Ue.useInsertionEffect=function(R,Q){return F.H.useInsertionEffect(R,Q)},Ue.useLayoutEffect=function(R,Q){return F.H.useLayoutEffect(R,Q)},Ue.useMemo=function(R,Q){return F.H.useMemo(R,Q)},Ue.useOptimistic=function(R,Q){return F.H.useOptimistic(R,Q)},Ue.useReducer=function(R,Q,N){return F.H.useReducer(R,Q,N)},Ue.useRef=function(R){return F.H.useRef(R)},Ue.useState=function(R){return F.H.useState(R)},Ue.useSyncExternalStore=function(R,Q,N){return F.H.useSyncExternalStore(R,Q,N)},Ue.useTransition=function(){return F.H.useTransition()},Ue.version="19.2.0",Ue}var ny;function bh(){return ny||(ny=1,cd.exports=Pk()),cd.exports}var E=bh(),ud={exports:{}},jr={},dd={exports:{}},hd={};var iy;function Vk(){return iy||(iy=1,(function(e){function s(U,M){var W=U.length;U.push(M);e:for(;0<W;){var ee=W-1>>>1,O=U[ee];if(0<c(O,M))U[ee]=M,U[W]=O,W=ee;else break e}}function a(U){return U.length===0?null:U[0]}function l(U){if(U.length===0)return null;var M=U[0],W=U.pop();if(W!==M){U[0]=W;e:for(var ee=0,O=U.length,R=O>>>1;ee<R;){var Q=2*(ee+1)-1,N=U[Q],de=Q+1,ye=U[de];if(0>c(N,W))de<O&&0>c(ye,N)?(U[ee]=ye,U[de]=W,ee=de):(U[ee]=N,U[Q]=W,ee=Q);else if(de<O&&0>c(ye,W))U[ee]=ye,U[de]=W,ee=de;else break e}}return M}function c(U,M){var W=U.sortIndex-M.sortIndex;return W!==0?W:U.id-M.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var g=[],m=[],y=1,b=null,v=3,x=!1,w=!1,S=!1,T=!1,k=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function I(U){for(var M=a(m);M!==null;){if(M.callback===null)l(m);else if(M.startTime<=U)l(m),M.sortIndex=M.expirationTime,s(g,M);else break;M=a(m)}}function q(U){if(S=!1,I(U),!w)if(a(g)!==null)w=!0,_||(_=!0,K());else{var M=a(m);M!==null&&G(q,M.startTime-U)}}var _=!1,F=-1,oe=5,ne=-1;function B(){return T?!0:!(e.unstable_now()-ne<oe)}function H(){if(T=!1,_){var U=e.unstable_now();ne=U;var M=!0;try{e:{w=!1,S&&(S=!1,z(F),F=-1),x=!0;var W=v;try{t:{for(I(U),b=a(g);b!==null&&!(b.expirationTime>U&&B());){var ee=b.callback;if(typeof ee=="function"){b.callback=null,v=b.priorityLevel;var O=ee(b.expirationTime<=U);if(U=e.unstable_now(),typeof O=="function"){b.callback=O,I(U),M=!0;break t}b===a(g)&&l(g),I(U)}else l(g);b=a(g)}if(b!==null)M=!0;else{var R=a(m);R!==null&&G(q,R.startTime-U),M=!1}}break e}finally{b=null,v=W,x=!1}M=void 0}}finally{M?K():_=!1}}}var K;if(typeof A=="function")K=function(){A(H)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=H,K=function(){ie.postMessage(null)}}else K=function(){k(H,0)};function G(U,M){F=k(function(){U(e.unstable_now())},M)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(U){switch(v){case 1:case 2:case 3:var M=3;break;default:M=v}var W=v;v=M;try{return U()}finally{v=W}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(U,M){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var W=v;v=U;try{return M()}finally{v=W}},e.unstable_scheduleCallback=function(U,M,W){var ee=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?ee+W:ee):W=ee,U){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=W+O,U={id:y++,callback:M,priorityLevel:U,startTime:W,expirationTime:O,sortIndex:-1},W>ee?(U.sortIndex=W,s(m,U),a(g)===null&&U===a(m)&&(S?(z(F),F=-1):S=!0,G(q,W-ee))):(U.sortIndex=O,s(g,U),w||x||(w=!0,_||(_=!0,K()))),U},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(U){var M=v;return function(){var W=v;v=M;try{return U.apply(this,arguments)}finally{v=W}}}})(hd)),hd}var sy;function Zk(){return sy||(sy=1,dd.exports=Vk()),dd.exports}var fd={exports:{}},Qt={};var ay;function Qk(){if(ay)return Qt;ay=1;var e=bh();function s(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var l={d:{f:a,r:function(){throw Error(s(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(g,m,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:b==null?null:""+b,children:g,containerInfo:m,implementation:y}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Qt.createPortal=function(g,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(s(299));return u(g,m,null,y)},Qt.flushSync=function(g){var m=d.T,y=l.p;try{if(d.T=null,l.p=2,g)return g()}finally{d.T=m,l.p=y,l.d.f()}},Qt.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,l.d.C(g,m))},Qt.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},Qt.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var y=m.as,b=h(y,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,x=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?l.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:x}):y==="script"&&l.d.X(g,{crossOrigin:b,integrity:v,fetchPriority:x,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Qt.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);l.d.M(g,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&l.d.M(g)},Qt.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,b=h(y,m.crossOrigin);l.d.L(g,y,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Qt.preloadModule=function(g,m){if(typeof g=="string")if(m){var y=h(m.as,m.crossOrigin);l.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else l.d.m(g)},Qt.requestFormReset=function(g){l.d.r(g)},Qt.unstable_batchedUpdates=function(g,m){return g(m)},Qt.useFormState=function(g,m,y){return d.H.useFormState(g,m,y)},Qt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Qt.version="19.2.0",Qt}var ry;function Jb(){if(ry)return fd.exports;ry=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(s){console.error(s)}}return e(),fd.exports=Qk(),fd.exports}var ly;function Xk(){if(ly)return jr;ly=1;var e=Zk(),s=bh(),a=Jb();function l(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,r=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(r=n.return),t=n.return;while(t)}return n.tag===3?r:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function g(t){if(u(t)!==t)throw Error(l(188))}function m(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(l(188));return n!==t?null:t}for(var r=t,o=n;;){var f=r.return;if(f===null)break;var p=f.alternate;if(p===null){if(o=f.return,o!==null){r=o;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===r)return g(f),t;if(p===o)return g(f),n;p=p.sibling}throw Error(l(188))}if(r.return!==o.return)r=f,o=p;else{for(var j=!1,C=f.child;C;){if(C===r){j=!0,r=f,o=p;break}if(C===o){j=!0,o=f,r=p;break}C=C.sibling}if(!j){for(C=p.child;C;){if(C===r){j=!0,r=p,o=f;break}if(C===o){j=!0,o=p,r=f;break}C=C.sibling}if(!j)throw Error(l(189))}}if(r.alternate!==o)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?t:n}function y(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=y(t),n!==null)return n;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),A=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function K(t){return t===null||typeof t!="object"?null:(t=H&&t[H]||t["@@iterator"],typeof t=="function"?t:null)}var re=Symbol.for("react.client.reference");function ie(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===re?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case k:return"Profiler";case T:return"StrictMode";case q:return"Suspense";case _:return"SuspenseList";case ne:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case A:return t.displayName||"Context";case z:return(t._context.displayName||"Context")+".Consumer";case I:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case F:return n=t.displayName||null,n!==null?n:ie(t.type)||"Memo";case oe:n=t._payload,t=t._init;try{return ie(t(n))}catch{}}return null}var G=Array.isArray,U=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},ee=[],O=-1;function R(t){return{current:t}}function Q(t){0>O||(t.current=ee[O],ee[O]=null,O--)}function N(t,n){O++,ee[O]=t.current,t.current=n}var de=R(null),ye=R(null),ge=R(null),Me=R(null);function We(t,n){switch(N(ge,n),N(ye,t),N(de,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?jg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=jg(n),t=kg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Q(de),N(de,t)}function pe(){Q(de),Q(ye),Q(ge)}function ut(t){t.memoizedState!==null&&N(Me,t);var n=de.current,r=kg(n,t.type);n!==r&&(N(ye,t),N(de,r))}function gt(t){ye.current===t&&(Q(de),Q(ye)),Me.current===t&&(Q(Me),yr._currentValue=W)}var Wt,Cn;function kt(t){if(Wt===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);Wt=n&&n[1]||"",Cn=-1<r.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Wt+t+Cn}var In=!1;function Se(t,n){if(!t||In)return"";In=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(X){var Z=X}Reflect.construct(t,[],le)}else{try{le.call()}catch(X){Z=X}t.call(le.prototype)}}else{try{throw Error()}catch(X){Z=X}(le=t())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(X){if(X&&Z&&typeof X.stack=="string")return[X.stack,Z.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),j=p[0],C=p[1];if(j&&C){var D=j.split(`
4
- `),P=C.split(`
5
- `);for(f=o=0;o<D.length&&!D[o].includes("DetermineComponentFrameRoot");)o++;for(;f<P.length&&!P[f].includes("DetermineComponentFrameRoot");)f++;if(o===D.length||f===P.length)for(o=D.length-1,f=P.length-1;1<=o&&0<=f&&D[o]!==P[f];)f--;for(;1<=o&&0<=f;o--,f--)if(D[o]!==P[f]){if(o!==1||f!==1)do if(o--,f--,0>f||D[o]!==P[f]){var te=`
6
- `+D[o].replace(" at new "," at ");return t.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",t.displayName)),te}while(1<=o&&0<=f);break}}}finally{In=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?kt(r):""}function ht(t,n){switch(t.tag){case 26:case 27:case 5:return kt(t.type);case 16:return kt("Lazy");case 13:return t.child!==n&&n!==null?kt("Suspense Fallback"):kt("Suspense");case 19:return kt("SuspenseList");case 0:case 15:return Se(t.type,!1);case 11:return Se(t.type.render,!1);case 1:return Se(t.type,!0);case 31:return kt("Activity");default:return""}}function en(t){try{var n="",r=null;do n+=ht(t,r),r=t,t=t.return;while(t);return n}catch(o){return`
7
- Error generating stack: `+o.message+`
8
- `+o.stack}}var An=Object.prototype.hasOwnProperty,tn=e.unstable_scheduleCallback,$n=e.unstable_cancelCallback,Jn=e.unstable_shouldYield,os=e.unstable_requestPaint,It=e.unstable_now,Ea=e.unstable_getCurrentPriorityLevel,Tn=e.unstable_ImmediatePriority,J=e.unstable_UserBlockingPriority,me=e.unstable_NormalPriority,De=e.unstable_LowPriority,Le=e.unstable_IdlePriority,Lt=e.log,tt=e.unstable_setDisableYieldValue,bt=null,ue=null;function je(t){if(typeof Lt=="function"&&tt(t),ue&&typeof ue.setStrictMode=="function")try{ue.setStrictMode(bt,t)}catch{}}var $e=Math.clz32?Math.clz32:Di,$t=Math.log,Ri=Math.LN2;function Di(t){return t>>>=0,t===0?32:31-($t(t)/Ri|0)|0}var St=256,qt=262144,Rt=4194304;function cs(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Zr(t,n,r){var o=t.pendingLanes;if(o===0)return 0;var f=0,p=t.suspendedLanes,j=t.pingedLanes;t=t.warmLanes;var C=o&134217727;return C!==0?(o=C&~p,o!==0?f=cs(o):(j&=C,j!==0?f=cs(j):r||(r=C&~t,r!==0&&(f=cs(r))))):(C=o&~p,C!==0?f=cs(C):j!==0?f=cs(j):r||(r=o&~t,r!==0&&(f=cs(r)))),f===0?0:n!==0&&n!==f&&(n&p)===0&&(p=f&-f,r=n&-n,p>=r||p===32&&(r&4194048)!==0)?n:f}function za(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Ow(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nf(){var t=Rt;return Rt<<=1,(Rt&62914560)===0&&(Rt=4194304),t}function Xo(t){for(var n=[],r=0;31>r;r++)n.push(t);return n}function Oa(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Rw(t,n,r,o,f,p){var j=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var C=t.entanglements,D=t.expirationTimes,P=t.hiddenUpdates;for(r=j&~r;0<r;){var te=31-$e(r),le=1<<te;C[te]=0,D[te]=-1;var Z=P[te];if(Z!==null)for(P[te]=null,te=0;te<Z.length;te++){var X=Z[te];X!==null&&(X.lane&=-536870913)}r&=~le}o!==0&&sf(t,o,0),p!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=p&~(j&~n))}function sf(t,n,r){t.pendingLanes|=n,t.suspendedLanes&=~n;var o=31-$e(n);t.entangledLanes|=n,t.entanglements[o]=t.entanglements[o]|1073741824|r&261930}function af(t,n){var r=t.entangledLanes|=n;for(t=t.entanglements;r;){var o=31-$e(r),f=1<<o;f&n|t[o]&n&&(t[o]|=n),r&=~f}}function rf(t,n){var r=n&-n;return r=(r&42)!==0?1:Ko(r),(r&(t.suspendedLanes|n))!==0?0:r}function Ko(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Jo(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function lf(){var t=M.p;return t!==0?t:(t=window.event,t===void 0?32:Pg(t.type))}function of(t,n){var r=M.p;try{return M.p=t,n()}finally{M.p=r}}var Mi=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Mi,rn="__reactProps$"+Mi,Us="__reactContainer$"+Mi,Wo="__reactEvents$"+Mi,Dw="__reactListeners$"+Mi,Mw="__reactHandles$"+Mi,cf="__reactResources$"+Mi,Ra="__reactMarker$"+Mi;function ec(t){delete t[Gt],delete t[rn],delete t[Wo],delete t[Dw],delete t[Mw]}function Bs(t){var n=t[Gt];if(n)return n;for(var r=t.parentNode;r;){if(n=r[Us]||r[Gt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(t=zg(t);t!==null;){if(r=t[Gt])return r;t=zg(t)}return n}t=r,r=t.parentNode}return null}function Hs(t){if(t=t[Gt]||t[Us]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Da(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(l(33))}function Is(t){var n=t[cf];return n||(n=t[cf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function _t(t){t[Ra]=!0}var uf=new Set,df={};function us(t,n){$s(t,n),$s(t+"Capture",n)}function $s(t,n){for(df[t]=n,t=0;t<n.length;t++)uf.add(n[t])}var Lw=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),hf={},ff={};function _w(t){return An.call(ff,t)?!0:An.call(hf,t)?!1:Lw.test(t)?ff[t]=!0:(hf[t]=!0,!1)}function Qr(t,n,r){if(_w(n))if(r===null)t.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+r)}}function Xr(t,n,r){if(r===null)t.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+r)}}function li(t,n,r,o){if(o===null)t.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttributeNS(n,r,""+o)}}function Nn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function mf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Uw(t,n,r){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,p=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(j){r=""+j,p.call(this,j)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return r},setValue:function(j){r=""+j},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function tc(t){if(!t._valueTracker){var n=mf(t)?"checked":"value";t._valueTracker=Uw(t,n,""+t[n])}}function pf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var r=n.getValue(),o="";return t&&(o=mf(t)?t.checked?"true":"false":t.value),t=o,t!==r?(n.setValue(t),!0):!1}function Kr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Bw=/[\n"\\]/g;function En(t){return t.replace(Bw,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function nc(t,n,r,o,f,p,j,C){t.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.type=j:t.removeAttribute("type"),n!=null?j==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Nn(n)):t.value!==""+Nn(n)&&(t.value=""+Nn(n)):j!=="submit"&&j!=="reset"||t.removeAttribute("value"),n!=null?ic(t,j,Nn(n)):r!=null?ic(t,j,Nn(r)):o!=null&&t.removeAttribute("value"),f==null&&p!=null&&(t.defaultChecked=!!p),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.name=""+Nn(C):t.removeAttribute("name")}function gf(t,n,r,o,f,p,j,C){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),n!=null||r!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){tc(t);return}r=r!=null?""+Nn(r):"",n=n!=null?""+Nn(n):r,C||n===t.value||(t.value=n),t.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=C?t.checked:!!o,t.defaultChecked=!!o,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(t.name=j),tc(t)}function ic(t,n,r){n==="number"&&Kr(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function qs(t,n,r,o){if(t=t.options,n){n={};for(var f=0;f<r.length;f++)n["$"+r[f]]=!0;for(r=0;r<t.length;r++)f=n.hasOwnProperty("$"+t[r].value),t[r].selected!==f&&(t[r].selected=f),f&&o&&(t[r].defaultSelected=!0)}else{for(r=""+Nn(r),n=null,f=0;f<t.length;f++){if(t[f].value===r){t[f].selected=!0,o&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function yf(t,n,r){if(n!=null&&(n=""+Nn(n),n!==t.value&&(t.value=n),r==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=r!=null?""+Nn(r):""}function bf(t,n,r,o){if(n==null){if(o!=null){if(r!=null)throw Error(l(92));if(G(o)){if(1<o.length)throw Error(l(93));o=o[0]}r=o}r==null&&(r=""),n=r}r=Nn(n),t.defaultValue=r,o=t.textContent,o===r&&o!==""&&o!==null&&(t.value=o),tc(t)}function Gs(t,n){if(n){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=n;return}}t.textContent=n}var Hw=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xf(t,n,r){var o=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?o?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":o?t.setProperty(n,r):typeof r!="number"||r===0||Hw.has(n)?n==="float"?t.cssFloat=r:t[n]=(""+r).trim():t[n]=r+"px"}function vf(t,n,r){if(n!=null&&typeof n!="object")throw Error(l(62));if(t=t.style,r!=null){for(var o in r)!r.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var f in n)o=n[f],n.hasOwnProperty(f)&&r[f]!==o&&xf(t,f,o)}else for(var p in n)n.hasOwnProperty(p)&&xf(t,p,n[p])}function sc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Iw=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),$w=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Jr(t){return $w.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function oi(){}var ac=null;function rc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Fs=null,Ys=null;function wf(t){var n=Hs(t);if(n&&(t=n.stateNode)){var r=t[rn]||null;e:switch(t=n.stateNode,n.type){case"input":if(nc(t,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+En(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var o=r[n];if(o!==t&&o.form===t.form){var f=o[rn]||null;if(!f)throw Error(l(90));nc(o,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<r.length;n++)o=r[n],o.form===t.form&&pf(o)}break e;case"textarea":yf(t,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&qs(t,!!r.multiple,n,!1)}}}var lc=!1;function jf(t,n,r){if(lc)return t(n,r);lc=!0;try{var o=t(n);return o}finally{if(lc=!1,(Fs!==null||Ys!==null)&&(Hl(),Fs&&(n=Fs,t=Ys,Ys=Fs=null,wf(n),t)))for(n=0;n<t.length;n++)wf(t[n])}}function Ma(t,n){var r=t.stateNode;if(r===null)return null;var o=r[rn]||null;if(o===null)return null;r=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(l(231,n,typeof r));return r}var ci=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(ci)try{var La={};Object.defineProperty(La,"passive",{get:function(){oc=!0}}),window.addEventListener("test",La,La),window.removeEventListener("test",La,La)}catch{oc=!1}var Li=null,cc=null,Wr=null;function kf(){if(Wr)return Wr;var t,n=cc,r=n.length,o,f="value"in Li?Li.value:Li.textContent,p=f.length;for(t=0;t<r&&n[t]===f[t];t++);var j=r-t;for(o=1;o<=j&&n[r-o]===f[p-o];o++);return Wr=f.slice(t,1<o?1-o:void 0)}function el(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function tl(){return!0}function Sf(){return!1}function ln(t){function n(r,o,f,p,j){this._reactName=r,this._targetInst=f,this.type=o,this.nativeEvent=p,this.target=j,this.currentTarget=null;for(var C in t)t.hasOwnProperty(C)&&(r=t[C],this[C]=r?r(p):p[C]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?tl:Sf,this.isPropagationStopped=Sf,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=tl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=tl)},persist:function(){},isPersistent:tl}),n}var ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nl=ln(ds),_a=b({},ds,{view:0,detail:0}),qw=ln(_a),uc,dc,Ua,il=b({},_a,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ua&&(Ua&&t.type==="mousemove"?(uc=t.screenX-Ua.screenX,dc=t.screenY-Ua.screenY):dc=uc=0,Ua=t),uc)},movementY:function(t){return"movementY"in t?t.movementY:dc}}),Cf=ln(il),Gw=b({},il,{dataTransfer:0}),Fw=ln(Gw),Yw=b({},_a,{relatedTarget:0}),hc=ln(Yw),Pw=b({},ds,{animationName:0,elapsedTime:0,pseudoElement:0}),Vw=ln(Pw),Zw=b({},ds,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Qw=ln(Zw),Xw=b({},ds,{data:0}),Af=ln(Xw),Kw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jw={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"},Ww={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ej(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Ww[t])?!!n[t]:!1}function fc(){return ej}var tj=b({},_a,{key:function(t){if(t.key){var n=Kw[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=el(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Jw[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(t){return t.type==="keypress"?el(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?el(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),nj=ln(tj),ij=b({},il,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tf=ln(ij),sj=b({},_a,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),aj=ln(sj),rj=b({},ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),lj=ln(rj),oj=b({},il,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),cj=ln(oj),uj=b({},ds,{newState:0,oldState:0}),dj=ln(uj),hj=[9,13,27,32],mc=ci&&"CompositionEvent"in window,Ba=null;ci&&"documentMode"in document&&(Ba=document.documentMode);var fj=ci&&"TextEvent"in window&&!Ba,Nf=ci&&(!mc||Ba&&8<Ba&&11>=Ba),Ef=" ",zf=!1;function Of(t,n){switch(t){case"keyup":return hj.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ps=!1;function mj(t,n){switch(t){case"compositionend":return Rf(n);case"keypress":return n.which!==32?null:(zf=!0,Ef);case"textInput":return t=n.data,t===Ef&&zf?null:t;default:return null}}function pj(t,n){if(Ps)return t==="compositionend"||!mc&&Of(t,n)?(t=kf(),Wr=cc=Li=null,Ps=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Nf&&n.locale!=="ko"?null:n.data;default:return null}}var gj={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 Df(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!gj[t.type]:n==="textarea"}function Mf(t,n,r,o){Fs?Ys?Ys.push(o):Ys=[o]:Fs=o,n=Pl(n,"onChange"),0<n.length&&(r=new nl("onChange","change",null,r,o),t.push({event:r,listeners:n}))}var Ha=null,Ia=null;function yj(t){gg(t,0)}function sl(t){var n=Da(t);if(pf(n))return t}function Lf(t,n){if(t==="change")return n}var _f=!1;if(ci){var pc;if(ci){var gc="oninput"in document;if(!gc){var Uf=document.createElement("div");Uf.setAttribute("oninput","return;"),gc=typeof Uf.oninput=="function"}pc=gc}else pc=!1;_f=pc&&(!document.documentMode||9<document.documentMode)}function Bf(){Ha&&(Ha.detachEvent("onpropertychange",Hf),Ia=Ha=null)}function Hf(t){if(t.propertyName==="value"&&sl(Ia)){var n=[];Mf(n,Ia,t,rc(t)),jf(yj,n)}}function bj(t,n,r){t==="focusin"?(Bf(),Ha=n,Ia=r,Ha.attachEvent("onpropertychange",Hf)):t==="focusout"&&Bf()}function xj(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return sl(Ia)}function vj(t,n){if(t==="click")return sl(n)}function wj(t,n){if(t==="input"||t==="change")return sl(n)}function jj(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var gn=typeof Object.is=="function"?Object.is:jj;function $a(t,n){if(gn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var r=Object.keys(t),o=Object.keys(n);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var f=r[o];if(!An.call(n,f)||!gn(t[f],n[f]))return!1}return!0}function If(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function $f(t,n){var r=If(t);t=0;for(var o;r;){if(r.nodeType===3){if(o=t+r.textContent.length,t<=n&&o>=n)return{node:r,offset:n-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=If(r)}}function qf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?qf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Gf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Kr(t.document);n instanceof t.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)t=n.contentWindow;else break;n=Kr(t.document)}return n}function yc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var kj=ci&&"documentMode"in document&&11>=document.documentMode,Vs=null,bc=null,qa=null,xc=!1;function Ff(t,n,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;xc||Vs==null||Vs!==Kr(o)||(o=Vs,"selectionStart"in o&&yc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),qa&&$a(qa,o)||(qa=o,o=Pl(bc,"onSelect"),0<o.length&&(n=new nl("onSelect","select",null,n,r),t.push({event:n,listeners:o}),n.target=Vs)))}function hs(t,n){var r={};return r[t.toLowerCase()]=n.toLowerCase(),r["Webkit"+t]="webkit"+n,r["Moz"+t]="moz"+n,r}var Zs={animationend:hs("Animation","AnimationEnd"),animationiteration:hs("Animation","AnimationIteration"),animationstart:hs("Animation","AnimationStart"),transitionrun:hs("Transition","TransitionRun"),transitionstart:hs("Transition","TransitionStart"),transitioncancel:hs("Transition","TransitionCancel"),transitionend:hs("Transition","TransitionEnd")},vc={},Yf={};ci&&(Yf=document.createElement("div").style,"AnimationEvent"in window||(delete Zs.animationend.animation,delete Zs.animationiteration.animation,delete Zs.animationstart.animation),"TransitionEvent"in window||delete Zs.transitionend.transition);function fs(t){if(vc[t])return vc[t];if(!Zs[t])return t;var n=Zs[t],r;for(r in n)if(n.hasOwnProperty(r)&&r in Yf)return vc[t]=n[r];return t}var Pf=fs("animationend"),Vf=fs("animationiteration"),Zf=fs("animationstart"),Sj=fs("transitionrun"),Cj=fs("transitionstart"),Aj=fs("transitioncancel"),Qf=fs("transitionend"),Xf=new Map,wc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");wc.push("scrollEnd");function qn(t,n){Xf.set(t,n),us(n,[t])}var al=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},zn=[],Qs=0,jc=0;function rl(){for(var t=Qs,n=jc=Qs=0;n<t;){var r=zn[n];zn[n++]=null;var o=zn[n];zn[n++]=null;var f=zn[n];zn[n++]=null;var p=zn[n];if(zn[n++]=null,o!==null&&f!==null){var j=o.pending;j===null?f.next=f:(f.next=j.next,j.next=f),o.pending=f}p!==0&&Kf(r,f,p)}}function ll(t,n,r,o){zn[Qs++]=t,zn[Qs++]=n,zn[Qs++]=r,zn[Qs++]=o,jc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function kc(t,n,r,o){return ll(t,n,r,o),ol(t)}function ms(t,n){return ll(t,null,null,n),ol(t)}function Kf(t,n,r){t.lanes|=r;var o=t.alternate;o!==null&&(o.lanes|=r);for(var f=!1,p=t.return;p!==null;)p.childLanes|=r,o=p.alternate,o!==null&&(o.childLanes|=r),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(f=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,f&&n!==null&&(f=31-$e(r),t=p.hiddenUpdates,o=t[f],o===null?t[f]=[n]:o.push(n),n.lane=r|536870912),p):null}function ol(t){if(50<ur)throw ur=0,Ru=null,Error(l(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Xs={};function Tj(t,n,r,o){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yn(t,n,r,o){return new Tj(t,n,r,o)}function Sc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ui(t,n){var r=t.alternate;return r===null?(r=yn(t.tag,n,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=n,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&65011712,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,n=t.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r.refCleanup=t.refCleanup,r}function Jf(t,n){t.flags&=65011714;var r=t.alternate;return r===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,t.type=r.type,n=r.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function cl(t,n,r,o,f,p){var j=0;if(o=t,typeof t=="function")Sc(t)&&(j=1);else if(typeof t=="string")j=Rk(t,r,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ne:return t=yn(31,r,n,f),t.elementType=ne,t.lanes=p,t;case S:return ps(r.children,f,p,n);case T:j=8,f|=24;break;case k:return t=yn(12,r,n,f|2),t.elementType=k,t.lanes=p,t;case q:return t=yn(13,r,n,f),t.elementType=q,t.lanes=p,t;case _:return t=yn(19,r,n,f),t.elementType=_,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case A:j=10;break e;case z:j=9;break e;case I:j=11;break e;case F:j=14;break e;case oe:j=16,o=null;break e}j=29,r=Error(l(130,t===null?"null":typeof t,"")),o=null}return n=yn(j,r,n,f),n.elementType=t,n.type=o,n.lanes=p,n}function ps(t,n,r,o){return t=yn(7,t,o,n),t.lanes=r,t}function Cc(t,n,r){return t=yn(6,t,null,n),t.lanes=r,t}function Wf(t){var n=yn(18,null,null,0);return n.stateNode=t,n}function Ac(t,n,r){return n=yn(4,t.children!==null?t.children:[],t.key,n),n.lanes=r,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var em=new WeakMap;function On(t,n){if(typeof t=="object"&&t!==null){var r=em.get(t);return r!==void 0?r:(n={value:t,source:n,stack:en(n)},em.set(t,n),n)}return{value:t,source:n,stack:en(n)}}var Ks=[],Js=0,ul=null,Ga=0,Rn=[],Dn=0,_i=null,Wn=1,ei="";function di(t,n){Ks[Js++]=Ga,Ks[Js++]=ul,ul=t,Ga=n}function tm(t,n,r){Rn[Dn++]=Wn,Rn[Dn++]=ei,Rn[Dn++]=_i,_i=t;var o=Wn;t=ei;var f=32-$e(o)-1;o&=~(1<<f),r+=1;var p=32-$e(n)+f;if(30<p){var j=f-f%5;p=(o&(1<<j)-1).toString(32),o>>=j,f-=j,Wn=1<<32-$e(n)+f|r<<f|o,ei=p+t}else Wn=1<<p|r<<f|o,ei=t}function Tc(t){t.return!==null&&(di(t,1),tm(t,1,0))}function Nc(t){for(;t===ul;)ul=Ks[--Js],Ks[Js]=null,Ga=Ks[--Js],Ks[Js]=null;for(;t===_i;)_i=Rn[--Dn],Rn[Dn]=null,ei=Rn[--Dn],Rn[Dn]=null,Wn=Rn[--Dn],Rn[Dn]=null}function nm(t,n){Rn[Dn++]=Wn,Rn[Dn++]=ei,Rn[Dn++]=_i,Wn=n.id,ei=n.overflow,_i=t}var Ft=null,ft=null,Ze=!1,Ui=null,Mn=!1,Ec=Error(l(519));function Bi(t){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fa(On(n,t)),Ec}function im(t){var n=t.stateNode,r=t.type,o=t.memoizedProps;switch(n[Gt]=t,n[rn]=o,r){case"dialog":Ye("cancel",n),Ye("close",n);break;case"iframe":case"object":case"embed":Ye("load",n);break;case"video":case"audio":for(r=0;r<hr.length;r++)Ye(hr[r],n);break;case"source":Ye("error",n);break;case"img":case"image":case"link":Ye("error",n),Ye("load",n);break;case"details":Ye("toggle",n);break;case"input":Ye("invalid",n),gf(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ye("invalid",n);break;case"textarea":Ye("invalid",n),bf(n,o.value,o.defaultValue,o.children)}r=o.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||o.suppressHydrationWarning===!0||vg(n.textContent,r)?(o.popover!=null&&(Ye("beforetoggle",n),Ye("toggle",n)),o.onScroll!=null&&Ye("scroll",n),o.onScrollEnd!=null&&Ye("scrollend",n),o.onClick!=null&&(n.onclick=oi),n=!0):n=!1,n||Bi(t,!0)}function sm(t){for(Ft=t.return;Ft;)switch(Ft.tag){case 5:case 31:case 13:Mn=!1;return;case 27:case 3:Mn=!0;return;default:Ft=Ft.return}}function Ws(t){if(t!==Ft)return!1;if(!Ze)return sm(t),Ze=!0,!1;var n=t.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||Vu(t.type,t.memoizedProps)),r=!r),r&&ft&&Bi(t),sm(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));ft=Eg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));ft=Eg(t)}else n===27?(n=ft,Ji(t.type)?(t=Ju,Ju=null,ft=t):ft=n):ft=Ft?_n(t.stateNode.nextSibling):null;return!0}function gs(){ft=Ft=null,Ze=!1}function zc(){var t=Ui;return t!==null&&(dn===null?dn=t:dn.push.apply(dn,t),Ui=null),t}function Fa(t){Ui===null?Ui=[t]:Ui.push(t)}var Oc=R(null),ys=null,hi=null;function Hi(t,n,r){N(Oc,n._currentValue),n._currentValue=r}function fi(t){t._currentValue=Oc.current,Q(Oc)}function Rc(t,n,r){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===r)break;t=t.return}}function Dc(t,n,r,o){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var p=f.dependencies;if(p!==null){var j=f.child;p=p.firstContext;e:for(;p!==null;){var C=p;p=f;for(var D=0;D<n.length;D++)if(C.context===n[D]){p.lanes|=r,C=p.alternate,C!==null&&(C.lanes|=r),Rc(p.return,r,t),o||(j=null);break e}p=C.next}}else if(f.tag===18){if(j=f.return,j===null)throw Error(l(341));j.lanes|=r,p=j.alternate,p!==null&&(p.lanes|=r),Rc(j,r,t),j=null}else j=f.child;if(j!==null)j.return=f;else for(j=f;j!==null;){if(j===t){j=null;break}if(f=j.sibling,f!==null){f.return=j.return,j=f;break}j=j.return}f=j}}function ea(t,n,r,o){t=null;for(var f=n,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var j=f.alternate;if(j===null)throw Error(l(387));if(j=j.memoizedProps,j!==null){var C=f.type;gn(f.pendingProps.value,j.value)||(t!==null?t.push(C):t=[C])}}else if(f===Me.current){if(j=f.alternate,j===null)throw Error(l(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(yr):t=[yr])}f=f.return}t!==null&&Dc(n,t,r,o),n.flags|=262144}function dl(t){for(t=t.firstContext;t!==null;){if(!gn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function bs(t){ys=t,hi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Yt(t){return am(ys,t)}function hl(t,n){return ys===null&&bs(t),am(t,n)}function am(t,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},hi===null){if(t===null)throw Error(l(308));hi=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else hi=hi.next=n;return r}var Nj=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(r,o){t.push(o)}};this.abort=function(){n.aborted=!0,t.forEach(function(r){return r()})}},Ej=e.unstable_scheduleCallback,zj=e.unstable_NormalPriority,Tt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new Nj,data:new Map,refCount:0}}function Ya(t){t.refCount--,t.refCount===0&&Ej(zj,function(){t.controller.abort()})}var Pa=null,Lc=0,ta=0,na=null;function Oj(t,n){if(Pa===null){var r=Pa=[];Lc=0,ta=Bu(),na={status:"pending",value:void 0,then:function(o){r.push(o)}}}return Lc++,n.then(rm,rm),n}function rm(){if(--Lc===0&&Pa!==null){na!==null&&(na.status="fulfilled");var t=Pa;Pa=null,ta=0,na=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Rj(t,n){var r=[],o={status:"pending",value:null,reason:null,then:function(f){r.push(f)}};return t.then(function(){o.status="fulfilled",o.value=n;for(var f=0;f<r.length;f++)(0,r[f])(n)},function(f){for(o.status="rejected",o.reason=f,f=0;f<r.length;f++)(0,r[f])(void 0)}),o}var lm=U.S;U.S=function(t,n){Fp=It(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Oj(t,n),lm!==null&&lm(t,n)};var xs=R(null);function _c(){var t=xs.current;return t!==null?t:lt.pooledCache}function fl(t,n){n===null?N(xs,xs.current):N(xs,n.pool)}function om(){var t=_c();return t===null?null:{parent:Tt._currentValue,pool:t}}var ia=Error(l(460)),Uc=Error(l(474)),ml=Error(l(542)),pl={then:function(){}};function cm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function um(t,n,r){switch(r=t[r],r===void 0?t.push(n):r!==n&&(n.then(oi,oi),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,hm(t),t;default:if(typeof n.status=="string")n.then(oi,oi);else{if(t=lt,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=n,t.status="pending",t.then(function(o){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=o}},function(o){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,hm(t),t}throw ws=n,ia}}function vs(t){try{var n=t._init;return n(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(ws=r,ia):r}}var ws=null;function dm(){if(ws===null)throw Error(l(459));var t=ws;return ws=null,t}function hm(t){if(t===ia||t===ml)throw Error(l(483))}var sa=null,Va=0;function gl(t){var n=Va;return Va+=1,sa===null&&(sa=[]),um(sa,t,n)}function Za(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function yl(t,n){throw n.$$typeof===v?Error(l(525)):(t=Object.prototype.toString.call(n),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function fm(t){function n($,L){if(t){var Y=$.deletions;Y===null?($.deletions=[L],$.flags|=16):Y.push(L)}}function r($,L){if(!t)return null;for(;L!==null;)n($,L),L=L.sibling;return null}function o($){for(var L=new Map;$!==null;)$.key!==null?L.set($.key,$):L.set($.index,$),$=$.sibling;return L}function f($,L){return $=ui($,L),$.index=0,$.sibling=null,$}function p($,L,Y){return $.index=Y,t?(Y=$.alternate,Y!==null?(Y=Y.index,Y<L?($.flags|=67108866,L):Y):($.flags|=67108866,L)):($.flags|=1048576,L)}function j($){return t&&$.alternate===null&&($.flags|=67108866),$}function C($,L,Y,se){return L===null||L.tag!==6?(L=Cc(Y,$.mode,se),L.return=$,L):(L=f(L,Y),L.return=$,L)}function D($,L,Y,se){var Ae=Y.type;return Ae===S?te($,L,Y.props.children,se,Y.key):L!==null&&(L.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===oe&&vs(Ae)===L.type)?(L=f(L,Y.props),Za(L,Y),L.return=$,L):(L=cl(Y.type,Y.key,Y.props,null,$.mode,se),Za(L,Y),L.return=$,L)}function P($,L,Y,se){return L===null||L.tag!==4||L.stateNode.containerInfo!==Y.containerInfo||L.stateNode.implementation!==Y.implementation?(L=Ac(Y,$.mode,se),L.return=$,L):(L=f(L,Y.children||[]),L.return=$,L)}function te($,L,Y,se,Ae){return L===null||L.tag!==7?(L=ps(Y,$.mode,se,Ae),L.return=$,L):(L=f(L,Y),L.return=$,L)}function le($,L,Y){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Cc(""+L,$.mode,Y),L.return=$,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case x:return Y=cl(L.type,L.key,L.props,null,$.mode,Y),Za(Y,L),Y.return=$,Y;case w:return L=Ac(L,$.mode,Y),L.return=$,L;case oe:return L=vs(L),le($,L,Y)}if(G(L)||K(L))return L=ps(L,$.mode,Y,null),L.return=$,L;if(typeof L.then=="function")return le($,gl(L),Y);if(L.$$typeof===A)return le($,hl($,L),Y);yl($,L)}return null}function Z($,L,Y,se){var Ae=L!==null?L.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Ae!==null?null:C($,L,""+Y,se);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case x:return Y.key===Ae?D($,L,Y,se):null;case w:return Y.key===Ae?P($,L,Y,se):null;case oe:return Y=vs(Y),Z($,L,Y,se)}if(G(Y)||K(Y))return Ae!==null?null:te($,L,Y,se,null);if(typeof Y.then=="function")return Z($,L,gl(Y),se);if(Y.$$typeof===A)return Z($,L,hl($,Y),se);yl($,Y)}return null}function X($,L,Y,se,Ae){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return $=$.get(Y)||null,C(L,$,""+se,Ae);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case x:return $=$.get(se.key===null?Y:se.key)||null,D(L,$,se,Ae);case w:return $=$.get(se.key===null?Y:se.key)||null,P(L,$,se,Ae);case oe:return se=vs(se),X($,L,Y,se,Ae)}if(G(se)||K(se))return $=$.get(Y)||null,te(L,$,se,Ae,null);if(typeof se.then=="function")return X($,L,Y,gl(se),Ae);if(se.$$typeof===A)return X($,L,Y,hl(L,se),Ae);yl(L,se)}return null}function xe($,L,Y,se){for(var Ae=null,Xe=null,we=L,He=L=0,Ve=null;we!==null&&He<Y.length;He++){we.index>He?(Ve=we,we=null):Ve=we.sibling;var Ke=Z($,we,Y[He],se);if(Ke===null){we===null&&(we=Ve);break}t&&we&&Ke.alternate===null&&n($,we),L=p(Ke,L,He),Xe===null?Ae=Ke:Xe.sibling=Ke,Xe=Ke,we=Ve}if(He===Y.length)return r($,we),Ze&&di($,He),Ae;if(we===null){for(;He<Y.length;He++)we=le($,Y[He],se),we!==null&&(L=p(we,L,He),Xe===null?Ae=we:Xe.sibling=we,Xe=we);return Ze&&di($,He),Ae}for(we=o(we);He<Y.length;He++)Ve=X(we,$,He,Y[He],se),Ve!==null&&(t&&Ve.alternate!==null&&we.delete(Ve.key===null?He:Ve.key),L=p(Ve,L,He),Xe===null?Ae=Ve:Xe.sibling=Ve,Xe=Ve);return t&&we.forEach(function(is){return n($,is)}),Ze&&di($,He),Ae}function Ee($,L,Y,se){if(Y==null)throw Error(l(151));for(var Ae=null,Xe=null,we=L,He=L=0,Ve=null,Ke=Y.next();we!==null&&!Ke.done;He++,Ke=Y.next()){we.index>He?(Ve=we,we=null):Ve=we.sibling;var is=Z($,we,Ke.value,se);if(is===null){we===null&&(we=Ve);break}t&&we&&is.alternate===null&&n($,we),L=p(is,L,He),Xe===null?Ae=is:Xe.sibling=is,Xe=is,we=Ve}if(Ke.done)return r($,we),Ze&&di($,He),Ae;if(we===null){for(;!Ke.done;He++,Ke=Y.next())Ke=le($,Ke.value,se),Ke!==null&&(L=p(Ke,L,He),Xe===null?Ae=Ke:Xe.sibling=Ke,Xe=Ke);return Ze&&di($,He),Ae}for(we=o(we);!Ke.done;He++,Ke=Y.next())Ke=X(we,$,He,Ke.value,se),Ke!==null&&(t&&Ke.alternate!==null&&we.delete(Ke.key===null?He:Ke.key),L=p(Ke,L,He),Xe===null?Ae=Ke:Xe.sibling=Ke,Xe=Ke);return t&&we.forEach(function(Gk){return n($,Gk)}),Ze&&di($,He),Ae}function rt($,L,Y,se){if(typeof Y=="object"&&Y!==null&&Y.type===S&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case x:e:{for(var Ae=Y.key;L!==null;){if(L.key===Ae){if(Ae=Y.type,Ae===S){if(L.tag===7){r($,L.sibling),se=f(L,Y.props.children),se.return=$,$=se;break e}}else if(L.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===oe&&vs(Ae)===L.type){r($,L.sibling),se=f(L,Y.props),Za(se,Y),se.return=$,$=se;break e}r($,L);break}else n($,L);L=L.sibling}Y.type===S?(se=ps(Y.props.children,$.mode,se,Y.key),se.return=$,$=se):(se=cl(Y.type,Y.key,Y.props,null,$.mode,se),Za(se,Y),se.return=$,$=se)}return j($);case w:e:{for(Ae=Y.key;L!==null;){if(L.key===Ae)if(L.tag===4&&L.stateNode.containerInfo===Y.containerInfo&&L.stateNode.implementation===Y.implementation){r($,L.sibling),se=f(L,Y.children||[]),se.return=$,$=se;break e}else{r($,L);break}else n($,L);L=L.sibling}se=Ac(Y,$.mode,se),se.return=$,$=se}return j($);case oe:return Y=vs(Y),rt($,L,Y,se)}if(G(Y))return xe($,L,Y,se);if(K(Y)){if(Ae=K(Y),typeof Ae!="function")throw Error(l(150));return Y=Ae.call(Y),Ee($,L,Y,se)}if(typeof Y.then=="function")return rt($,L,gl(Y),se);if(Y.$$typeof===A)return rt($,L,hl($,Y),se);yl($,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,L!==null&&L.tag===6?(r($,L.sibling),se=f(L,Y),se.return=$,$=se):(r($,L),se=Cc(Y,$.mode,se),se.return=$,$=se),j($)):r($,L)}return function($,L,Y,se){try{Va=0;var Ae=rt($,L,Y,se);return sa=null,Ae}catch(we){if(we===ia||we===ml)throw we;var Xe=yn(29,we,null,$.mode);return Xe.lanes=se,Xe.return=$,Xe}}}var js=fm(!0),mm=fm(!1),Ii=!1;function Bc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function $i(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function qi(t,n,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(et&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=ol(t),Kf(t,null,r),n}return ll(t,o,n,r),ol(t)}function Qa(t,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,af(t,r)}}function Ic(t,n){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var f=null,p=null;if(r=r.firstBaseUpdate,r!==null){do{var j={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};p===null?f=p=j:p=p.next=j,r=r.next}while(r!==null);p===null?f=p=n:p=p.next=n}else f=p=n;r={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=n:t.next=n,r.lastBaseUpdate=n}var $c=!1;function Xa(){if($c){var t=na;if(t!==null)throw t}}function Ka(t,n,r,o){$c=!1;var f=t.updateQueue;Ii=!1;var p=f.firstBaseUpdate,j=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var D=C,P=D.next;D.next=null,j===null?p=P:j.next=P,j=D;var te=t.alternate;te!==null&&(te=te.updateQueue,C=te.lastBaseUpdate,C!==j&&(C===null?te.firstBaseUpdate=P:C.next=P,te.lastBaseUpdate=D))}if(p!==null){var le=f.baseState;j=0,te=P=D=null,C=p;do{var Z=C.lane&-536870913,X=Z!==C.lane;if(X?(Pe&Z)===Z:(o&Z)===Z){Z!==0&&Z===ta&&($c=!0),te!==null&&(te=te.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var xe=t,Ee=C;Z=n;var rt=r;switch(Ee.tag){case 1:if(xe=Ee.payload,typeof xe=="function"){le=xe.call(rt,le,Z);break e}le=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ee.payload,Z=typeof xe=="function"?xe.call(rt,le,Z):xe,Z==null)break e;le=b({},le,Z);break e;case 2:Ii=!0}}Z=C.callback,Z!==null&&(t.flags|=64,X&&(t.flags|=8192),X=f.callbacks,X===null?f.callbacks=[Z]:X.push(Z))}else X={lane:Z,tag:C.tag,payload:C.payload,callback:C.callback,next:null},te===null?(P=te=X,D=le):te=te.next=X,j|=Z;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;X=C,C=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);te===null&&(D=le),f.baseState=D,f.firstBaseUpdate=P,f.lastBaseUpdate=te,p===null&&(f.shared.lanes=0),Vi|=j,t.lanes=j,t.memoizedState=le}}function pm(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function gm(t,n){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)pm(r[t],n)}var aa=R(null),bl=R(0);function ym(t,n){t=ji,N(bl,t),N(aa,n),ji=t|n.baseLanes}function qc(){N(bl,ji),N(aa,aa.current)}function Gc(){ji=bl.current,Q(aa),Q(bl)}var bn=R(null),Ln=null;function Gi(t){var n=t.alternate;N(Ct,Ct.current&1),N(bn,t),Ln===null&&(n===null||aa.current!==null||n.memoizedState!==null)&&(Ln=t)}function Fc(t){N(Ct,Ct.current),N(bn,t),Ln===null&&(Ln=t)}function bm(t){t.tag===22?(N(Ct,Ct.current),N(bn,t),Ln===null&&(Ln=t)):Fi()}function Fi(){N(Ct,Ct.current),N(bn,bn.current)}function xn(t){Q(bn),Ln===t&&(Ln=null),Q(Ct)}var Ct=R(0);function xl(t){for(var n=t;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Xu(r)||Ku(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(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 null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var mi=0,Be=null,st=null,Nt=null,vl=!1,ra=!1,ks=!1,wl=0,Ja=0,la=null,Dj=0;function xt(){throw Error(l(321))}function Yc(t,n){if(n===null)return!1;for(var r=0;r<n.length&&r<t.length;r++)if(!gn(t[r],n[r]))return!1;return!0}function Pc(t,n,r,o,f,p){return mi=p,Be=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,U.H=t===null||t.memoizedState===null?tp:lu,ks=!1,p=r(o,f),ks=!1,ra&&(p=vm(n,r,o,f)),xm(t),p}function xm(t){U.H=tr;var n=st!==null&&st.next!==null;if(mi=0,Nt=st=Be=null,vl=!1,Ja=0,la=null,n)throw Error(l(300));t===null||Et||(t=t.dependencies,t!==null&&dl(t)&&(Et=!0))}function vm(t,n,r,o){Be=t;var f=0;do{if(ra&&(la=null),Ja=0,ra=!1,25<=f)throw Error(l(301));if(f+=1,Nt=st=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}U.H=np,p=n(r,o)}while(ra);return p}function Mj(){var t=U.H,n=t.useState()[0];return n=typeof n.then=="function"?Wa(n):n,t=t.useState()[0],(st!==null?st.memoizedState:null)!==t&&(Be.flags|=1024),n}function Vc(){var t=wl!==0;return wl=0,t}function Zc(t,n,r){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~r}function Qc(t){if(vl){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}vl=!1}mi=0,Nt=st=Be=null,ra=!1,Ja=wl=0,la=null}function nn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nt===null?Be.memoizedState=Nt=t:Nt=Nt.next=t,Nt}function At(){if(st===null){var t=Be.alternate;t=t!==null?t.memoizedState:null}else t=st.next;var n=Nt===null?Be.memoizedState:Nt.next;if(n!==null)Nt=n,st=t;else{if(t===null)throw Be.alternate===null?Error(l(467)):Error(l(310));st=t,t={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},Nt===null?Be.memoizedState=Nt=t:Nt=Nt.next=t}return Nt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wa(t){var n=Ja;return Ja+=1,la===null&&(la=[]),t=um(la,t,n),n=Be,(Nt===null?n.memoizedState:Nt.next)===null&&(n=n.alternate,U.H=n===null||n.memoizedState===null?tp:lu),t}function kl(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Wa(t);if(t.$$typeof===A)return Yt(t)}throw Error(l(438,String(t)))}function Xc(t){var n=null,r=Be.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var o=Be.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=jl(),Be.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(t),o=0;o<t;o++)r[o]=B;return n.index++,r}function pi(t,n){return typeof n=="function"?n(t):n}function Sl(t){var n=At();return Kc(n,st,t)}function Kc(t,n,r){var o=t.queue;if(o===null)throw Error(l(311));o.lastRenderedReducer=r;var f=t.baseQueue,p=o.pending;if(p!==null){if(f!==null){var j=f.next;f.next=p.next,p.next=j}n.baseQueue=f=p,o.pending=null}if(p=t.baseState,f===null)t.memoizedState=p;else{n=f.next;var C=j=null,D=null,P=n,te=!1;do{var le=P.lane&-536870913;if(le!==P.lane?(Pe&le)===le:(mi&le)===le){var Z=P.revertLane;if(Z===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),le===ta&&(te=!0);else if((mi&Z)===Z){P=P.next,Z===ta&&(te=!0);continue}else le={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(C=D=le,j=p):D=D.next=le,Be.lanes|=Z,Vi|=Z;le=P.action,ks&&r(p,le),p=P.hasEagerState?P.eagerState:r(p,le)}else Z={lane:le,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(C=D=Z,j=p):D=D.next=Z,Be.lanes|=le,Vi|=le;P=P.next}while(P!==null&&P!==n);if(D===null?j=p:D.next=C,!gn(p,t.memoizedState)&&(Et=!0,te&&(r=na,r!==null)))throw r;t.memoizedState=p,t.baseState=j,t.baseQueue=D,o.lastRenderedState=p}return f===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Jc(t){var n=At(),r=n.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=t;var o=r.dispatch,f=r.pending,p=n.memoizedState;if(f!==null){r.pending=null;var j=f=f.next;do p=t(p,j.action),j=j.next;while(j!==f);gn(p,n.memoizedState)||(Et=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),r.lastRenderedState=p}return[p,o]}function wm(t,n,r){var o=Be,f=At(),p=Ze;if(p){if(r===void 0)throw Error(l(407));r=r()}else r=n();var j=!gn((st||f).memoizedState,r);if(j&&(f.memoizedState=r,Et=!0),f=f.queue,tu(Sm.bind(null,o,f,t),[t]),f.getSnapshot!==n||j||Nt!==null&&Nt.memoizedState.tag&1){if(o.flags|=2048,oa(9,{destroy:void 0},km.bind(null,o,f,r,n),null),lt===null)throw Error(l(349));p||(mi&127)!==0||jm(o,n,r)}return r}function jm(t,n,r){t.flags|=16384,t={getSnapshot:n,value:r},n=Be.updateQueue,n===null?(n=jl(),Be.updateQueue=n,n.stores=[t]):(r=n.stores,r===null?n.stores=[t]:r.push(t))}function km(t,n,r,o){n.value=r,n.getSnapshot=o,Cm(n)&&Am(t)}function Sm(t,n,r){return r(function(){Cm(n)&&Am(t)})}function Cm(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!gn(t,r)}catch{return!0}}function Am(t){var n=ms(t,2);n!==null&&hn(n,t,2)}function Wc(t){var n=nn();if(typeof t=="function"){var r=t;if(t=r(),ks){je(!0);try{r()}finally{je(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pi,lastRenderedState:t},n}function Tm(t,n,r,o){return t.baseState=r,Kc(t,st,typeof o=="function"?o:pi)}function Lj(t,n,r,o,f){if(Tl(t))throw Error(l(485));if(t=n.action,t!==null){var p={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){p.listeners.push(j)}};U.T!==null?r(!0):p.isTransition=!1,o(p),r=n.pending,r===null?(p.next=n.pending=p,Nm(n,p)):(p.next=r.next,n.pending=r.next=p)}}function Nm(t,n){var r=n.action,o=n.payload,f=t.state;if(n.isTransition){var p=U.T,j={};U.T=j;try{var C=r(f,o),D=U.S;D!==null&&D(j,C),Em(t,n,C)}catch(P){eu(t,n,P)}finally{p!==null&&j.types!==null&&(p.types=j.types),U.T=p}}else try{p=r(f,o),Em(t,n,p)}catch(P){eu(t,n,P)}}function Em(t,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){zm(t,n,o)},function(o){return eu(t,n,o)}):zm(t,n,r)}function zm(t,n,r){n.status="fulfilled",n.value=r,Om(n),t.state=r,n=t.pending,n!==null&&(r=n.next,r===n?t.pending=null:(r=r.next,n.next=r,Nm(t,r)))}function eu(t,n,r){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=r,Om(n),n=n.next;while(n!==o)}t.action=null}function Om(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Rm(t,n){return n}function Dm(t,n){if(Ze){var r=lt.formState;if(r!==null){e:{var o=Be;if(Ze){if(ft){t:{for(var f=ft,p=Mn;f.nodeType!==8;){if(!p){f=null;break t}if(f=_n(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){ft=_n(f.nextSibling),o=f.data==="F!";break e}}Bi(o)}o=!1}o&&(n=r[0])}}return r=nn(),r.memoizedState=r.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rm,lastRenderedState:n},r.queue=o,r=Jm.bind(null,Be,o),o.dispatch=r,o=Wc(!1),p=ru.bind(null,Be,!1,o.queue),o=nn(),f={state:n,dispatch:null,action:t,pending:null},o.queue=f,r=Lj.bind(null,Be,f,p,r),f.dispatch=r,o.memoizedState=t,[n,r,!1]}function Mm(t){var n=At();return Lm(n,st,t)}function Lm(t,n,r){if(n=Kc(t,n,Rm)[0],t=Sl(pi)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=Wa(n)}catch(j){throw j===ia?ml:j}else o=n;n=At();var f=n.queue,p=f.dispatch;return r!==n.memoizedState&&(Be.flags|=2048,oa(9,{destroy:void 0},_j.bind(null,f,r),null)),[o,p,t]}function _j(t,n){t.action=n}function _m(t){var n=At(),r=st;if(r!==null)return Lm(n,r,t);At(),n=n.memoizedState,r=At();var o=r.queue.dispatch;return r.memoizedState=t,[n,o,!1]}function oa(t,n,r,o){return t={tag:t,create:r,deps:o,inst:n,next:null},n=Be.updateQueue,n===null&&(n=jl(),Be.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=t.next=t:(o=r.next,r.next=t,t.next=o,n.lastEffect=t),t}function Um(){return At().memoizedState}function Cl(t,n,r,o){var f=nn();Be.flags|=t,f.memoizedState=oa(1|n,{destroy:void 0},r,o===void 0?null:o)}function Al(t,n,r,o){var f=At();o=o===void 0?null:o;var p=f.memoizedState.inst;st!==null&&o!==null&&Yc(o,st.memoizedState.deps)?f.memoizedState=oa(n,p,r,o):(Be.flags|=t,f.memoizedState=oa(1|n,p,r,o))}function Bm(t,n){Cl(8390656,8,t,n)}function tu(t,n){Al(2048,8,t,n)}function Uj(t){Be.flags|=4;var n=Be.updateQueue;if(n===null)n=jl(),Be.updateQueue=n,n.events=[t];else{var r=n.events;r===null?n.events=[t]:r.push(t)}}function Hm(t){var n=At().memoizedState;return Uj({ref:n,nextImpl:t}),function(){if((et&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function Im(t,n){return Al(4,2,t,n)}function $m(t,n){return Al(4,4,t,n)}function qm(t,n){if(typeof n=="function"){t=t();var r=n(t);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Gm(t,n,r){r=r!=null?r.concat([t]):null,Al(4,4,qm.bind(null,n,t),r)}function nu(){}function Fm(t,n){var r=At();n=n===void 0?null:n;var o=r.memoizedState;return n!==null&&Yc(n,o[1])?o[0]:(r.memoizedState=[t,n],t)}function Ym(t,n){var r=At();n=n===void 0?null:n;var o=r.memoizedState;if(n!==null&&Yc(n,o[1]))return o[0];if(o=t(),ks){je(!0);try{t()}finally{je(!1)}}return r.memoizedState=[o,n],o}function iu(t,n,r){return r===void 0||(mi&1073741824)!==0&&(Pe&261930)===0?t.memoizedState=n:(t.memoizedState=r,t=Pp(),Be.lanes|=t,Vi|=t,r)}function Pm(t,n,r,o){return gn(r,n)?r:aa.current!==null?(t=iu(t,r,o),gn(t,n)||(Et=!0),t):(mi&42)===0||(mi&1073741824)!==0&&(Pe&261930)===0?(Et=!0,t.memoizedState=r):(t=Pp(),Be.lanes|=t,Vi|=t,n)}function Vm(t,n,r,o,f){var p=M.p;M.p=p!==0&&8>p?p:8;var j=U.T,C={};U.T=C,ru(t,!1,n,r);try{var D=f(),P=U.S;if(P!==null&&P(C,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var te=Rj(D,o);er(t,n,te,jn(t))}else er(t,n,o,jn(t))}catch(le){er(t,n,{then:function(){},status:"rejected",reason:le},jn())}finally{M.p=p,j!==null&&C.types!==null&&(j.types=C.types),U.T=j}}function Bj(){}function su(t,n,r,o){if(t.tag!==5)throw Error(l(476));var f=Zm(t).queue;Vm(t,f,n,W,r===null?Bj:function(){return Qm(t),r(o)})}function Zm(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pi,lastRenderedState:W},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pi,lastRenderedState:r},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Qm(t){var n=Zm(t);n.next===null&&(n=t.alternate.memoizedState),er(t,n.next.queue,{},jn())}function au(){return Yt(yr)}function Xm(){return At().memoizedState}function Km(){return At().memoizedState}function Hj(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var r=jn();t=$i(r);var o=qi(n,t,r);o!==null&&(hn(o,n,r),Qa(o,n,r)),n={cache:Mc()},t.payload=n;return}n=n.return}}function Ij(t,n,r){var o=jn();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Tl(t)?Wm(n,r):(r=kc(t,n,r,o),r!==null&&(hn(r,t,o),ep(r,n,o)))}function Jm(t,n,r){var o=jn();er(t,n,r,o)}function er(t,n,r,o){var f={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Tl(t))Wm(n,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var j=n.lastRenderedState,C=p(j,r);if(f.hasEagerState=!0,f.eagerState=C,gn(C,j))return ll(t,n,f,0),lt===null&&rl(),!1}catch{}if(r=kc(t,n,f,o),r!==null)return hn(r,t,o),ep(r,n,o),!0}return!1}function ru(t,n,r,o){if(o={lane:2,revertLane:Bu(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Tl(t)){if(n)throw Error(l(479))}else n=kc(t,r,o,2),n!==null&&hn(n,t,2)}function Tl(t){var n=t.alternate;return t===Be||n!==null&&n===Be}function Wm(t,n){ra=vl=!0;var r=t.pending;r===null?n.next=n:(n.next=r.next,r.next=n),t.pending=n}function ep(t,n,r){if((r&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,af(t,r)}}var tr={readContext:Yt,use:kl,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};tr.useEffectEvent=xt;var tp={readContext:Yt,use:kl,useCallback:function(t,n){return nn().memoizedState=[t,n===void 0?null:n],t},useContext:Yt,useEffect:Bm,useImperativeHandle:function(t,n,r){r=r!=null?r.concat([t]):null,Cl(4194308,4,qm.bind(null,n,t),r)},useLayoutEffect:function(t,n){return Cl(4194308,4,t,n)},useInsertionEffect:function(t,n){Cl(4,2,t,n)},useMemo:function(t,n){var r=nn();n=n===void 0?null:n;var o=t();if(ks){je(!0);try{t()}finally{je(!1)}}return r.memoizedState=[o,n],o},useReducer:function(t,n,r){var o=nn();if(r!==void 0){var f=r(n);if(ks){je(!0);try{r(n)}finally{je(!1)}}}else f=n;return o.memoizedState=o.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},o.queue=t,t=t.dispatch=Ij.bind(null,Be,t),[o.memoizedState,t]},useRef:function(t){var n=nn();return t={current:t},n.memoizedState=t},useState:function(t){t=Wc(t);var n=t.queue,r=Jm.bind(null,Be,n);return n.dispatch=r,[t.memoizedState,r]},useDebugValue:nu,useDeferredValue:function(t,n){var r=nn();return iu(r,t,n)},useTransition:function(){var t=Wc(!1);return t=Vm.bind(null,Be,t.queue,!0,!1),nn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,r){var o=Be,f=nn();if(Ze){if(r===void 0)throw Error(l(407));r=r()}else{if(r=n(),lt===null)throw Error(l(349));(Pe&127)!==0||jm(o,n,r)}f.memoizedState=r;var p={value:r,getSnapshot:n};return f.queue=p,Bm(Sm.bind(null,o,p,t),[t]),o.flags|=2048,oa(9,{destroy:void 0},km.bind(null,o,p,r,n),null),r},useId:function(){var t=nn(),n=lt.identifierPrefix;if(Ze){var r=ei,o=Wn;r=(o&~(1<<32-$e(o)-1)).toString(32)+r,n="_"+n+"R_"+r,r=wl++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=Dj++,n="_"+n+"r_"+r.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:au,useFormState:Dm,useActionState:Dm,useOptimistic:function(t){var n=nn();n.memoizedState=n.baseState=t;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=ru.bind(null,Be,!0,r),r.dispatch=n,[t,n]},useMemoCache:Xc,useCacheRefresh:function(){return nn().memoizedState=Hj.bind(null,Be)},useEffectEvent:function(t){var n=nn(),r={impl:t};return n.memoizedState=r,function(){if((et&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},lu={readContext:Yt,use:kl,useCallback:Fm,useContext:Yt,useEffect:tu,useImperativeHandle:Gm,useInsertionEffect:Im,useLayoutEffect:$m,useMemo:Ym,useReducer:Sl,useRef:Um,useState:function(){return Sl(pi)},useDebugValue:nu,useDeferredValue:function(t,n){var r=At();return Pm(r,st.memoizedState,t,n)},useTransition:function(){var t=Sl(pi)[0],n=At().memoizedState;return[typeof t=="boolean"?t:Wa(t),n]},useSyncExternalStore:wm,useId:Xm,useHostTransitionStatus:au,useFormState:Mm,useActionState:Mm,useOptimistic:function(t,n){var r=At();return Tm(r,st,t,n)},useMemoCache:Xc,useCacheRefresh:Km};lu.useEffectEvent=Hm;var np={readContext:Yt,use:kl,useCallback:Fm,useContext:Yt,useEffect:tu,useImperativeHandle:Gm,useInsertionEffect:Im,useLayoutEffect:$m,useMemo:Ym,useReducer:Jc,useRef:Um,useState:function(){return Jc(pi)},useDebugValue:nu,useDeferredValue:function(t,n){var r=At();return st===null?iu(r,t,n):Pm(r,st.memoizedState,t,n)},useTransition:function(){var t=Jc(pi)[0],n=At().memoizedState;return[typeof t=="boolean"?t:Wa(t),n]},useSyncExternalStore:wm,useId:Xm,useHostTransitionStatus:au,useFormState:_m,useActionState:_m,useOptimistic:function(t,n){var r=At();return st!==null?Tm(r,st,t,n):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:Km};np.useEffectEvent=Hm;function ou(t,n,r,o){n=t.memoizedState,r=r(o,n),r=r==null?n:b({},n,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var cu={enqueueSetState:function(t,n,r){t=t._reactInternals;var o=jn(),f=$i(o);f.payload=n,r!=null&&(f.callback=r),n=qi(t,f,o),n!==null&&(hn(n,t,o),Qa(n,t,o))},enqueueReplaceState:function(t,n,r){t=t._reactInternals;var o=jn(),f=$i(o);f.tag=1,f.payload=n,r!=null&&(f.callback=r),n=qi(t,f,o),n!==null&&(hn(n,t,o),Qa(n,t,o))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var r=jn(),o=$i(r);o.tag=2,n!=null&&(o.callback=n),n=qi(t,o,r),n!==null&&(hn(n,t,r),Qa(n,t,r))}};function ip(t,n,r,o,f,p,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,j):n.prototype&&n.prototype.isPureReactComponent?!$a(r,o)||!$a(f,p):!0}function sp(t,n,r,o){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,o),n.state!==t&&cu.enqueueReplaceState(n,n.state,null)}function Ss(t,n){var r=n;if("ref"in n){r={};for(var o in n)o!=="ref"&&(r[o]=n[o])}if(t=t.defaultProps){r===n&&(r=b({},r));for(var f in t)r[f]===void 0&&(r[f]=t[f])}return r}function ap(t){al(t)}function rp(t){console.error(t)}function lp(t){al(t)}function Nl(t,n){try{var r=t.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function op(t,n,r){try{var o=t.onCaughtError;o(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function uu(t,n,r){return r=$i(r),r.tag=3,r.payload={element:null},r.callback=function(){Nl(t,n)},r}function cp(t){return t=$i(t),t.tag=3,t}function up(t,n,r,o){var f=r.type.getDerivedStateFromError;if(typeof f=="function"){var p=o.value;t.payload=function(){return f(p)},t.callback=function(){op(n,r,o)}}var j=r.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(t.callback=function(){op(n,r,o),typeof f!="function"&&(Zi===null?Zi=new Set([this]):Zi.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function $j(t,n,r,o,f){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=r.alternate,n!==null&&ea(n,r,f,!0),r=bn.current,r!==null){switch(r.tag){case 31:case 13:return Ln===null?Il():r.alternate===null&&vt===0&&(vt=3),r.flags&=-257,r.flags|=65536,r.lanes=f,o===pl?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([o]):n.add(o),Lu(t,o,f)),!1;case 22:return r.flags|=65536,o===pl?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([o]):r.add(o)),Lu(t,o,f)),!1}throw Error(l(435,r.tag))}return Lu(t,o,f),Il(),!1}if(Ze)return n=bn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,o!==Ec&&(t=Error(l(422),{cause:o}),Fa(On(t,r)))):(o!==Ec&&(n=Error(l(423),{cause:o}),Fa(On(n,r))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,o=On(o,r),f=uu(t.stateNode,o,f),Ic(t,f),vt!==4&&(vt=2)),!1;var p=Error(l(520),{cause:o});if(p=On(p,r),cr===null?cr=[p]:cr.push(p),vt!==4&&(vt=2),n===null)return!0;o=On(o,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,t=f&-f,r.lanes|=t,t=uu(r.stateNode,o,t),Ic(r,t),!1;case 1:if(n=r.type,p=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Zi===null||!Zi.has(p))))return r.flags|=65536,f&=-f,r.lanes|=f,f=cp(f),up(f,t,r,o),Ic(r,f),!1}r=r.return}while(r!==null);return!1}var du=Error(l(461)),Et=!1;function Pt(t,n,r,o){n.child=t===null?mm(n,null,r,o):js(n,t.child,r,o)}function dp(t,n,r,o,f){r=r.render;var p=n.ref;if("ref"in o){var j={};for(var C in o)C!=="ref"&&(j[C]=o[C])}else j=o;return bs(n),o=Pc(t,n,r,j,p,f),C=Vc(),t!==null&&!Et?(Zc(t,n,f),gi(t,n,f)):(Ze&&C&&Tc(n),n.flags|=1,Pt(t,n,o,f),n.child)}function hp(t,n,r,o,f){if(t===null){var p=r.type;return typeof p=="function"&&!Sc(p)&&p.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=p,fp(t,n,p,o,f)):(t=cl(r.type,null,o,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!xu(t,f)){var j=p.memoizedProps;if(r=r.compare,r=r!==null?r:$a,r(j,o)&&t.ref===n.ref)return gi(t,n,f)}return n.flags|=1,t=ui(p,o),t.ref=n.ref,t.return=n,n.child=t}function fp(t,n,r,o,f){if(t!==null){var p=t.memoizedProps;if($a(p,o)&&t.ref===n.ref)if(Et=!1,n.pendingProps=o=p,xu(t,f))(t.flags&131072)!==0&&(Et=!0);else return n.lanes=t.lanes,gi(t,n,f)}return hu(t,n,r,o,f)}function mp(t,n,r,o){var f=o.children,p=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|r:r,t!==null){for(o=n.child=t.child,f=0;o!==null;)f=f|o.lanes|o.childLanes,o=o.sibling;o=f&~p}else o=0,n.child=null;return pp(t,n,p,r,o)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&fl(n,p!==null?p.cachePool:null),p!==null?ym(n,p):qc(),bm(n);else return o=n.lanes=536870912,pp(t,n,p!==null?p.baseLanes|r:r,r,o)}else p!==null?(fl(n,p.cachePool),ym(n,p),Fi(),n.memoizedState=null):(t!==null&&fl(n,null),qc(),Fi());return Pt(t,n,f,r),n.child}function nr(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function pp(t,n,r,o,f){var p=_c();return p=p===null?null:{parent:Tt._currentValue,pool:p},n.memoizedState={baseLanes:r,cachePool:p},t!==null&&fl(n,null),qc(),bm(n),t!==null&&ea(t,n,o,!0),n.childLanes=f,null}function El(t,n){return n=Ol({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function gp(t,n,r){return js(n,t.child,null,r),t=El(n,n.pendingProps),t.flags|=2,xn(n),n.memoizedState=null,t}function qj(t,n,r){var o=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(Ze){if(o.mode==="hidden")return t=El(n,o),n.lanes=536870912,nr(null,t);if(Fc(n),(t=ft)?(t=Ng(t,Mn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:_i!==null?{id:Wn,overflow:ei}:null,retryLane:536870912,hydrationErrors:null},r=Wf(t),r.return=n,n.child=r,Ft=n,ft=null)):t=null,t===null)throw Bi(n);return n.lanes=536870912,null}return El(n,o)}var p=t.memoizedState;if(p!==null){var j=p.dehydrated;if(Fc(n),f)if(n.flags&256)n.flags&=-257,n=gp(t,n,r);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(l(558));else if(Et||ea(t,n,r,!1),f=(r&t.childLanes)!==0,Et||f){if(o=lt,o!==null&&(j=rf(o,r),j!==0&&j!==p.retryLane))throw p.retryLane=j,ms(t,j),hn(o,t,j),du;Il(),n=gp(t,n,r)}else t=p.treeContext,ft=_n(j.nextSibling),Ft=n,Ze=!0,Ui=null,Mn=!1,t!==null&&nm(n,t),n=El(n,o),n.flags|=4096;return n}return t=ui(t.child,{mode:o.mode,children:o.children}),t.ref=n.ref,n.child=t,t.return=n,t}function zl(t,n){var r=n.ref;if(r===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(t===null||t.ref!==r)&&(n.flags|=4194816)}}function hu(t,n,r,o,f){return bs(n),r=Pc(t,n,r,o,void 0,f),o=Vc(),t!==null&&!Et?(Zc(t,n,f),gi(t,n,f)):(Ze&&o&&Tc(n),n.flags|=1,Pt(t,n,r,f),n.child)}function yp(t,n,r,o,f,p){return bs(n),n.updateQueue=null,r=vm(n,o,r,f),xm(t),o=Vc(),t!==null&&!Et?(Zc(t,n,p),gi(t,n,p)):(Ze&&o&&Tc(n),n.flags|=1,Pt(t,n,r,p),n.child)}function bp(t,n,r,o,f){if(bs(n),n.stateNode===null){var p=Xs,j=r.contextType;typeof j=="object"&&j!==null&&(p=Yt(j)),p=new r(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=cu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},Bc(n),j=r.contextType,p.context=typeof j=="object"&&j!==null?Yt(j):Xs,p.state=n.memoizedState,j=r.getDerivedStateFromProps,typeof j=="function"&&(ou(n,r,j,o),p.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(j=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),j!==p.state&&cu.enqueueReplaceState(p,p.state,null),Ka(n,o,p,f),Xa(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(t===null){p=n.stateNode;var C=n.memoizedProps,D=Ss(r,C);p.props=D;var P=p.context,te=r.contextType;j=Xs,typeof te=="object"&&te!==null&&(j=Yt(te));var le=r.getDerivedStateFromProps;te=typeof le=="function"||typeof p.getSnapshotBeforeUpdate=="function",C=n.pendingProps!==C,te||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(C||P!==j)&&sp(n,p,o,j),Ii=!1;var Z=n.memoizedState;p.state=Z,Ka(n,o,p,f),Xa(),P=n.memoizedState,C||Z!==P||Ii?(typeof le=="function"&&(ou(n,r,le,o),P=n.memoizedState),(D=Ii||ip(n,r,D,o,Z,P,j))?(te||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=P),p.props=o,p.state=P,p.context=j,o=D):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,Hc(t,n),j=n.memoizedProps,te=Ss(r,j),p.props=te,le=n.pendingProps,Z=p.context,P=r.contextType,D=Xs,typeof P=="object"&&P!==null&&(D=Yt(P)),C=r.getDerivedStateFromProps,(P=typeof C=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(j!==le||Z!==D)&&sp(n,p,o,D),Ii=!1,Z=n.memoizedState,p.state=Z,Ka(n,o,p,f),Xa();var X=n.memoizedState;j!==le||Z!==X||Ii||t!==null&&t.dependencies!==null&&dl(t.dependencies)?(typeof C=="function"&&(ou(n,r,C,o),X=n.memoizedState),(te=Ii||ip(n,r,te,o,Z,X,D)||t!==null&&t.dependencies!==null&&dl(t.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,X,D),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,X,D)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=X),p.props=o,p.state=X,p.context=D,o=te):(typeof p.componentDidUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=1024),o=!1)}return p=o,zl(t,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,t!==null&&o?(n.child=js(n,t.child,null,f),n.child=js(n,null,r,f)):Pt(t,n,r,f),n.memoizedState=p.state,t=n.child):t=gi(t,n,f),t}function xp(t,n,r,o){return gs(),n.flags|=256,Pt(t,n,r,o),n.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mu(t){return{baseLanes:t,cachePool:om()}}function pu(t,n,r){return t=t!==null?t.childLanes&~r:0,n&&(t|=wn),t}function vp(t,n,r){var o=n.pendingProps,f=!1,p=(n.flags&128)!==0,j;if((j=p)||(j=t!==null&&t.memoizedState===null?!1:(Ct.current&2)!==0),j&&(f=!0,n.flags&=-129),j=(n.flags&32)!==0,n.flags&=-33,t===null){if(Ze){if(f?Gi(n):Fi(),(t=ft)?(t=Ng(t,Mn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:_i!==null?{id:Wn,overflow:ei}:null,retryLane:536870912,hydrationErrors:null},r=Wf(t),r.return=n,n.child=r,Ft=n,ft=null)):t=null,t===null)throw Bi(n);return Ku(t)?n.lanes=32:n.lanes=536870912,null}var C=o.children;return o=o.fallback,f?(Fi(),f=n.mode,C=Ol({mode:"hidden",children:C},f),o=ps(o,f,r,null),C.return=n,o.return=n,C.sibling=o,n.child=C,o=n.child,o.memoizedState=mu(r),o.childLanes=pu(t,j,r),n.memoizedState=fu,nr(null,o)):(Gi(n),gu(n,C))}var D=t.memoizedState;if(D!==null&&(C=D.dehydrated,C!==null)){if(p)n.flags&256?(Gi(n),n.flags&=-257,n=yu(t,n,r)):n.memoizedState!==null?(Fi(),n.child=t.child,n.flags|=128,n=null):(Fi(),C=o.fallback,f=n.mode,o=Ol({mode:"visible",children:o.children},f),C=ps(C,f,r,null),C.flags|=2,o.return=n,C.return=n,o.sibling=C,n.child=o,js(n,t.child,null,r),o=n.child,o.memoizedState=mu(r),o.childLanes=pu(t,j,r),n.memoizedState=fu,n=nr(null,o));else if(Gi(n),Ku(C)){if(j=C.nextSibling&&C.nextSibling.dataset,j)var P=j.dgst;j=P,o=Error(l(419)),o.stack="",o.digest=j,Fa({value:o,source:null,stack:null}),n=yu(t,n,r)}else if(Et||ea(t,n,r,!1),j=(r&t.childLanes)!==0,Et||j){if(j=lt,j!==null&&(o=rf(j,r),o!==0&&o!==D.retryLane))throw D.retryLane=o,ms(t,o),hn(j,t,o),du;Xu(C)||Il(),n=yu(t,n,r)}else Xu(C)?(n.flags|=192,n.child=t.child,n=null):(t=D.treeContext,ft=_n(C.nextSibling),Ft=n,Ze=!0,Ui=null,Mn=!1,t!==null&&nm(n,t),n=gu(n,o.children),n.flags|=4096);return n}return f?(Fi(),C=o.fallback,f=n.mode,D=t.child,P=D.sibling,o=ui(D,{mode:"hidden",children:o.children}),o.subtreeFlags=D.subtreeFlags&65011712,P!==null?C=ui(P,C):(C=ps(C,f,r,null),C.flags|=2),C.return=n,o.return=n,o.sibling=C,n.child=o,nr(null,o),o=n.child,C=t.child.memoizedState,C===null?C=mu(r):(f=C.cachePool,f!==null?(D=Tt._currentValue,f=f.parent!==D?{parent:D,pool:D}:f):f=om(),C={baseLanes:C.baseLanes|r,cachePool:f}),o.memoizedState=C,o.childLanes=pu(t,j,r),n.memoizedState=fu,nr(t.child,o)):(Gi(n),r=t.child,t=r.sibling,r=ui(r,{mode:"visible",children:o.children}),r.return=n,r.sibling=null,t!==null&&(j=n.deletions,j===null?(n.deletions=[t],n.flags|=16):j.push(t)),n.child=r,n.memoizedState=null,r)}function gu(t,n){return n=Ol({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Ol(t,n){return t=yn(22,t,null,n),t.lanes=0,t}function yu(t,n,r){return js(n,t.child,null,r),t=gu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function wp(t,n,r){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),Rc(t.return,n,r)}function bu(t,n,r,o,f,p){var j=t.memoizedState;j===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:f,treeForkCount:p}:(j.isBackwards=n,j.rendering=null,j.renderingStartTime=0,j.last=o,j.tail=r,j.tailMode=f,j.treeForkCount=p)}function jp(t,n,r){var o=n.pendingProps,f=o.revealOrder,p=o.tail;o=o.children;var j=Ct.current,C=(j&2)!==0;if(C?(j=j&1|2,n.flags|=128):j&=1,N(Ct,j),Pt(t,n,o,r),o=Ze?Ga:0,!C&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&wp(t,r,n);else if(t.tag===19)wp(t,r,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(r=n.child,f=null;r!==null;)t=r.alternate,t!==null&&xl(t)===null&&(f=r),r=r.sibling;r=f,r===null?(f=n.child,n.child=null):(f=r.sibling,r.sibling=null),bu(n,!1,f,r,p,o);break;case"backwards":case"unstable_legacy-backwards":for(r=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&xl(t)===null){n.child=f;break}t=f.sibling,f.sibling=r,r=f,f=t}bu(n,!0,r,null,p,o);break;case"together":bu(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function gi(t,n,r){if(t!==null&&(n.dependencies=t.dependencies),Vi|=n.lanes,(r&n.childLanes)===0)if(t!==null){if(ea(t,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(l(153));if(n.child!==null){for(t=n.child,r=ui(t,t.pendingProps),n.child=r,r.return=n;t.sibling!==null;)t=t.sibling,r=r.sibling=ui(t,t.pendingProps),r.return=n;r.sibling=null}return n.child}function xu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&dl(t)))}function Gj(t,n,r){switch(n.tag){case 3:We(n,n.stateNode.containerInfo),Hi(n,Tt,t.memoizedState.cache),gs();break;case 27:case 5:ut(n);break;case 4:We(n,n.stateNode.containerInfo);break;case 10:Hi(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Fc(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Gi(n),n.flags|=128,null):(r&n.child.childLanes)!==0?vp(t,n,r):(Gi(n),t=gi(t,n,r),t!==null?t.sibling:null);Gi(n);break;case 19:var f=(t.flags&128)!==0;if(o=(r&n.childLanes)!==0,o||(ea(t,n,r,!1),o=(r&n.childLanes)!==0),f){if(o)return jp(t,n,r);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),N(Ct,Ct.current),o)break;return null;case 22:return n.lanes=0,mp(t,n,r,n.pendingProps);case 24:Hi(n,Tt,t.memoizedState.cache)}return gi(t,n,r)}function kp(t,n,r){if(t!==null)if(t.memoizedProps!==n.pendingProps)Et=!0;else{if(!xu(t,r)&&(n.flags&128)===0)return Et=!1,Gj(t,n,r);Et=(t.flags&131072)!==0}else Et=!1,Ze&&(n.flags&1048576)!==0&&tm(n,Ga,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(t=vs(n.elementType),n.type=t,typeof t=="function")Sc(t)?(o=Ss(t,o),n.tag=1,n=bp(null,n,t,o,r)):(n.tag=0,n=hu(null,n,t,o,r));else{if(t!=null){var f=t.$$typeof;if(f===I){n.tag=11,n=dp(null,n,t,o,r);break e}else if(f===F){n.tag=14,n=hp(null,n,t,o,r);break e}}throw n=ie(t)||t,Error(l(306,n,""))}}return n;case 0:return hu(t,n,n.type,n.pendingProps,r);case 1:return o=n.type,f=Ss(o,n.pendingProps),bp(t,n,o,f,r);case 3:e:{if(We(n,n.stateNode.containerInfo),t===null)throw Error(l(387));o=n.pendingProps;var p=n.memoizedState;f=p.element,Hc(t,n),Ka(n,o,null,r);var j=n.memoizedState;if(o=j.cache,Hi(n,Tt,o),o!==p.cache&&Dc(n,[Tt],r,!0),Xa(),o=j.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:j.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=xp(t,n,o,r);break e}else if(o!==f){f=On(Error(l(424)),n),Fa(f),n=xp(t,n,o,r);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,ft=_n(t.firstChild),Ft=n,Ze=!0,Ui=null,Mn=!0,r=mm(n,null,o,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(gs(),o===f){n=gi(t,n,r);break e}Pt(t,n,o,r)}n=n.child}return n;case 26:return zl(t,n),t===null?(r=Mg(n.type,null,n.pendingProps,null))?n.memoizedState=r:Ze||(r=n.type,t=n.pendingProps,o=Vl(ge.current).createElement(r),o[Gt]=n,o[rn]=t,Vt(o,r,t),_t(o),n.stateNode=o):n.memoizedState=Mg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ut(n),t===null&&Ze&&(o=n.stateNode=Og(n.type,n.pendingProps,ge.current),Ft=n,Mn=!0,f=ft,Ji(n.type)?(Ju=f,ft=_n(o.firstChild)):ft=f),Pt(t,n,n.pendingProps.children,r),zl(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&Ze&&((f=o=ft)&&(o=xk(o,n.type,n.pendingProps,Mn),o!==null?(n.stateNode=o,Ft=n,ft=_n(o.firstChild),Mn=!1,f=!0):f=!1),f||Bi(n)),ut(n),f=n.type,p=n.pendingProps,j=t!==null?t.memoizedProps:null,o=p.children,Vu(f,p)?o=null:j!==null&&Vu(f,j)&&(n.flags|=32),n.memoizedState!==null&&(f=Pc(t,n,Mj,null,null,r),yr._currentValue=f),zl(t,n),Pt(t,n,o,r),n.child;case 6:return t===null&&Ze&&((t=r=ft)&&(r=vk(r,n.pendingProps,Mn),r!==null?(n.stateNode=r,Ft=n,ft=null,t=!0):t=!1),t||Bi(n)),null;case 13:return vp(t,n,r);case 4:return We(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=js(n,null,o,r):Pt(t,n,o,r),n.child;case 11:return dp(t,n,n.type,n.pendingProps,r);case 7:return Pt(t,n,n.pendingProps,r),n.child;case 8:return Pt(t,n,n.pendingProps.children,r),n.child;case 12:return Pt(t,n,n.pendingProps.children,r),n.child;case 10:return o=n.pendingProps,Hi(n,n.type,o.value),Pt(t,n,o.children,r),n.child;case 9:return f=n.type._context,o=n.pendingProps.children,bs(n),f=Yt(f),o=o(f),n.flags|=1,Pt(t,n,o,r),n.child;case 14:return hp(t,n,n.type,n.pendingProps,r);case 15:return fp(t,n,n.type,n.pendingProps,r);case 19:return jp(t,n,r);case 31:return qj(t,n,r);case 22:return mp(t,n,r,n.pendingProps);case 24:return bs(n),o=Yt(Tt),t===null?(f=_c(),f===null&&(f=lt,p=Mc(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=r),f=p),n.memoizedState={parent:o,cache:f},Bc(n),Hi(n,Tt,f)):((t.lanes&r)!==0&&(Hc(t,n),Ka(n,null,null,r),Xa()),f=t.memoizedState,p=n.memoizedState,f.parent!==o?(f={parent:o,cache:o},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Hi(n,Tt,o)):(o=p.cache,Hi(n,Tt,o),o!==f.cache&&Dc(n,[Tt],r,!0))),Pt(t,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function yi(t){t.flags|=4}function vu(t,n,r,o,f){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Xp())t.flags|=8192;else throw ws=pl,Uc}else t.flags&=-16777217}function Sp(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Hg(n))if(Xp())t.flags|=8192;else throw ws=pl,Uc}function Rl(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?nf():536870912,t.lanes|=n,ha|=n)}function ir(t,n){if(!Ze)switch(t.tailMode){case"hidden":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function mt(t){var n=t.alternate!==null&&t.alternate.child===t.child,r=0,o=0;if(n)for(var f=t.child;f!==null;)r|=f.lanes|f.childLanes,o|=f.subtreeFlags&65011712,o|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)r|=f.lanes|f.childLanes,o|=f.subtreeFlags,o|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=o,t.childLanes=r,n}function Fj(t,n,r){var o=n.pendingProps;switch(Nc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(n),null;case 1:return mt(n),null;case 3:return r=n.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),fi(Tt),pe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ws(n)?yi(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,zc())),mt(n),null;case 26:var f=n.type,p=n.memoizedState;return t===null?(yi(n),p!==null?(mt(n),Sp(n,p)):(mt(n),vu(n,f,null,o,r))):p?p!==t.memoizedState?(yi(n),mt(n),Sp(n,p)):(mt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==o&&yi(n),mt(n),vu(n,f,t,o,r)),null;case 27:if(gt(n),r=ge.current,f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&yi(n);else{if(!o){if(n.stateNode===null)throw Error(l(166));return mt(n),null}t=de.current,Ws(n)?im(n):(t=Og(f,o,r),n.stateNode=t,yi(n))}return mt(n),null;case 5:if(gt(n),f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&yi(n);else{if(!o){if(n.stateNode===null)throw Error(l(166));return mt(n),null}if(p=de.current,Ws(n))im(n);else{var j=Vl(ge.current);switch(p){case 1:p=j.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=j.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=j.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?j.createElement("select",{is:o.is}):j.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?j.createElement(f,{is:o.is}):j.createElement(f)}}p[Gt]=n,p[rn]=o;e:for(j=n.child;j!==null;){if(j.tag===5||j.tag===6)p.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===n)break e;for(;j.sibling===null;){if(j.return===null||j.return===n)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}n.stateNode=p;e:switch(Vt(p,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&yi(n)}}return mt(n),vu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,r),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&yi(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(l(166));if(t=ge.current,Ws(n)){if(t=n.stateNode,r=n.memoizedProps,o=null,f=Ft,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}t[Gt]=n,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||vg(t.nodeValue,r)),t||Bi(n,!0)}else t=Vl(t).createTextNode(o),t[Gt]=n,n.stateNode=t}return mt(n),null;case 31:if(r=n.memoizedState,t===null||t.memoizedState!==null){if(o=Ws(n),r!==null){if(t===null){if(!o)throw Error(l(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Gt]=n}else gs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;mt(n),t=!1}else r=zc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return n.flags&256?(xn(n),n):(xn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return mt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=Ws(n),o!==null&&o.dehydrated!==null){if(t===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[Gt]=n}else gs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;mt(n),f=!1}else f=zc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(xn(n),n):(xn(n),null)}return xn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==f&&(o.flags|=2048)),r!==t&&r&&(n.child.flags|=8192),Rl(n,n.updateQueue),mt(n),null);case 4:return pe(),t===null&&qu(n.stateNode.containerInfo),mt(n),null;case 10:return fi(n.type),mt(n),null;case 19:if(Q(Ct),o=n.memoizedState,o===null)return mt(n),null;if(f=(n.flags&128)!==0,p=o.rendering,p===null)if(f)ir(o,!1);else{if(vt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(p=xl(t),p!==null){for(n.flags|=128,ir(o,!1),t=p.updateQueue,n.updateQueue=t,Rl(n,t),n.subtreeFlags=0,t=r,r=n.child;r!==null;)Jf(r,t),r=r.sibling;return N(Ct,Ct.current&1|2),Ze&&di(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&It()>Ul&&(n.flags|=128,f=!0,ir(o,!1),n.lanes=4194304)}else{if(!f)if(t=xl(p),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,Rl(n,t),ir(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!Ze)return mt(n),null}else 2*It()-o.renderingStartTime>Ul&&r!==536870912&&(n.flags|=128,f=!0,ir(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(t=o.last,t!==null?t.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=It(),t.sibling=null,r=Ct.current,N(Ct,f?r&1|2:r&1),Ze&&di(n,o.treeForkCount),t):(mt(n),null);case 22:case 23:return xn(n),Gc(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(r&536870912)!==0&&(n.flags&128)===0&&(mt(n),n.subtreeFlags&6&&(n.flags|=8192)):mt(n),r=n.updateQueue,r!==null&&Rl(n,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==r&&(n.flags|=2048),t!==null&&Q(xs),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),fi(Tt),mt(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function Yj(t,n){switch(Nc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return fi(Tt),pe(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return gt(n),null;case 31:if(n.memoizedState!==null){if(xn(n),n.alternate===null)throw Error(l(340));gs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(xn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));gs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Q(Ct),null;case 4:return pe(),null;case 10:return fi(n.type),null;case 22:case 23:return xn(n),Gc(),t!==null&&Q(xs),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return fi(Tt),null;case 25:return null;default:return null}}function Cp(t,n){switch(Nc(n),n.tag){case 3:fi(Tt),pe();break;case 26:case 27:case 5:gt(n);break;case 4:pe();break;case 31:n.memoizedState!==null&&xn(n);break;case 13:xn(n);break;case 19:Q(Ct);break;case 10:fi(n.type);break;case 22:case 23:xn(n),Gc(),t!==null&&Q(xs);break;case 24:fi(Tt)}}function sr(t,n){try{var r=n.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var f=o.next;r=f;do{if((r.tag&t)===t){o=void 0;var p=r.create,j=r.inst;o=p(),j.destroy=o}r=r.next}while(r!==f)}}catch(C){it(n,n.return,C)}}function Yi(t,n,r){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var p=f.next;o=p;do{if((o.tag&t)===t){var j=o.inst,C=j.destroy;if(C!==void 0){j.destroy=void 0,f=n;var D=r,P=C;try{P()}catch(te){it(f,D,te)}}}o=o.next}while(o!==p)}}catch(te){it(n,n.return,te)}}function Ap(t){var n=t.updateQueue;if(n!==null){var r=t.stateNode;try{gm(n,r)}catch(o){it(t,t.return,o)}}}function Tp(t,n,r){r.props=Ss(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){it(t,n,o)}}function ar(t,n){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(f){it(t,n,f)}}function ti(t,n){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(f){it(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(f){it(t,n,f)}else r.current=null}function Np(t){var n=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(f){it(t,t.return,f)}}function wu(t,n,r){try{var o=t.stateNode;fk(o,t.type,r,n),o[rn]=n}catch(f){it(t,t.return,f)}}function Ep(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ji(t.type)||t.tag===4}function ju(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ep(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ji(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ku(t,n,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(t),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=oi));else if(o!==4&&(o===27&&Ji(t.type)&&(r=t.stateNode,n=null),t=t.child,t!==null))for(ku(t,n,r),t=t.sibling;t!==null;)ku(t,n,r),t=t.sibling}function Dl(t,n,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?r.insertBefore(t,n):r.appendChild(t);else if(o!==4&&(o===27&&Ji(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(Dl(t,n,r),t=t.sibling;t!==null;)Dl(t,n,r),t=t.sibling}function zp(t){var n=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Vt(n,o,r),n[Gt]=t,n[rn]=r}catch(p){it(t,t.return,p)}}var bi=!1,zt=!1,Su=!1,Op=typeof WeakSet=="function"?WeakSet:Set,Ut=null;function Pj(t,n){if(t=t.containerInfo,Yu=eo,t=Gf(t),yc(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var f=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{r.nodeType,p.nodeType}catch{r=null;break e}var j=0,C=-1,D=-1,P=0,te=0,le=t,Z=null;t:for(;;){for(var X;le!==r||f!==0&&le.nodeType!==3||(C=j+f),le!==p||o!==0&&le.nodeType!==3||(D=j+o),le.nodeType===3&&(j+=le.nodeValue.length),(X=le.firstChild)!==null;)Z=le,le=X;for(;;){if(le===t)break t;if(Z===r&&++P===f&&(C=j),Z===p&&++te===o&&(D=j),(X=le.nextSibling)!==null)break;le=Z,Z=le.parentNode}le=X}r=C===-1||D===-1?null:{start:C,end:D}}else r=null}r=r||{start:0,end:0}}else r=null;for(Pu={focusedElem:t,selectionRange:r},eo=!1,Ut=n;Ut!==null;)if(n=Ut,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Ut=t;else for(;Ut!==null;){switch(n=Ut,p=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r<t.length;r++)f=t[r],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,r=n,f=p.memoizedProps,p=p.memoizedState,o=r.stateNode;try{var xe=Ss(r.type,f);t=o.getSnapshotBeforeUpdate(xe,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Ee){it(r,r.return,Ee)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,r=t.nodeType,r===9)Qu(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Qu(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=n.sibling,t!==null){t.return=n.return,Ut=t;break}Ut=n.return}}function Rp(t,n,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:vi(t,r),o&4&&sr(5,r);break;case 1:if(vi(t,r),o&4)if(t=r.stateNode,n===null)try{t.componentDidMount()}catch(j){it(r,r.return,j)}else{var f=Ss(r.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(f,n,t.__reactInternalSnapshotBeforeUpdate)}catch(j){it(r,r.return,j)}}o&64&&Ap(r),o&512&&ar(r,r.return);break;case 3:if(vi(t,r),o&64&&(t=r.updateQueue,t!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{gm(t,n)}catch(j){it(r,r.return,j)}}break;case 27:n===null&&o&4&&zp(r);case 26:case 5:vi(t,r),n===null&&o&4&&Np(r),o&512&&ar(r,r.return);break;case 12:vi(t,r);break;case 31:vi(t,r),o&4&&Lp(t,r);break;case 13:vi(t,r),o&4&&_p(t,r),o&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=tk.bind(null,r),wk(t,r))));break;case 22:if(o=r.memoizedState!==null||bi,!o){n=n!==null&&n.memoizedState!==null||zt,f=bi;var p=zt;bi=o,(zt=n)&&!p?wi(t,r,(r.subtreeFlags&8772)!==0):vi(t,r),bi=f,zt=p}break;case 30:break;default:vi(t,r)}}function Dp(t){var n=t.alternate;n!==null&&(t.alternate=null,Dp(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&ec(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var pt=null,on=!1;function xi(t,n,r){for(r=r.child;r!==null;)Mp(t,n,r),r=r.sibling}function Mp(t,n,r){if(ue&&typeof ue.onCommitFiberUnmount=="function")try{ue.onCommitFiberUnmount(bt,r)}catch{}switch(r.tag){case 26:zt||ti(r,n),xi(t,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:zt||ti(r,n);var o=pt,f=on;Ji(r.type)&&(pt=r.stateNode,on=!1),xi(t,n,r),mr(r.stateNode),pt=o,on=f;break;case 5:zt||ti(r,n);case 6:if(o=pt,f=on,pt=null,xi(t,n,r),pt=o,on=f,pt!==null)if(on)try{(pt.nodeType===9?pt.body:pt.nodeName==="HTML"?pt.ownerDocument.body:pt).removeChild(r.stateNode)}catch(p){it(r,n,p)}else try{pt.removeChild(r.stateNode)}catch(p){it(r,n,p)}break;case 18:pt!==null&&(on?(t=pt,Ag(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),va(t)):Ag(pt,r.stateNode));break;case 4:o=pt,f=on,pt=r.stateNode.containerInfo,on=!0,xi(t,n,r),pt=o,on=f;break;case 0:case 11:case 14:case 15:Yi(2,r,n),zt||Yi(4,r,n),xi(t,n,r);break;case 1:zt||(ti(r,n),o=r.stateNode,typeof o.componentWillUnmount=="function"&&Tp(r,n,o)),xi(t,n,r);break;case 21:xi(t,n,r);break;case 22:zt=(o=zt)||r.memoizedState!==null,xi(t,n,r),zt=o;break;default:xi(t,n,r)}}function Lp(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{va(t)}catch(r){it(n,n.return,r)}}}function _p(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{va(t)}catch(r){it(n,n.return,r)}}function Vj(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Op),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Op),n;default:throw Error(l(435,t.tag))}}function Ml(t,n){var r=Vj(t);n.forEach(function(o){if(!r.has(o)){r.add(o);var f=nk.bind(null,t,o);o.then(f,f)}})}function cn(t,n){var r=n.deletions;if(r!==null)for(var o=0;o<r.length;o++){var f=r[o],p=t,j=n,C=j;e:for(;C!==null;){switch(C.tag){case 27:if(Ji(C.type)){pt=C.stateNode,on=!1;break e}break;case 5:pt=C.stateNode,on=!1;break e;case 3:case 4:pt=C.stateNode.containerInfo,on=!0;break e}C=C.return}if(pt===null)throw Error(l(160));Mp(p,j,f),pt=null,on=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Up(n,t),n=n.sibling}var Gn=null;function Up(t,n){var r=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:cn(n,t),un(t),o&4&&(Yi(3,t,t.return),sr(3,t),Yi(5,t,t.return));break;case 1:cn(n,t),un(t),o&512&&(zt||r===null||ti(r,r.return)),o&64&&bi&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(r=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=r===null?o:r.concat(o))));break;case 26:var f=Gn;if(cn(n,t),un(t),o&512&&(zt||r===null||ti(r,r.return)),o&4){var p=r!==null?r.memoizedState:null;if(o=t.memoizedState,r===null)if(o===null)if(t.stateNode===null){e:{o=t.type,r=t.memoizedProps,f=f.ownerDocument||f;t:switch(o){case"title":p=f.getElementsByTagName("title")[0],(!p||p[Ra]||p[Gt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(o),f.head.insertBefore(p,f.querySelector("head > title"))),Vt(p,o,r),p[Gt]=t,_t(p),o=p;break e;case"link":var j=Ug("link","href",f).get(o+(r.href||""));if(j){for(var C=0;C<j.length;C++)if(p=j[C],p.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&p.getAttribute("rel")===(r.rel==null?null:r.rel)&&p.getAttribute("title")===(r.title==null?null:r.title)&&p.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){j.splice(C,1);break t}}p=f.createElement(o),Vt(p,o,r),f.head.appendChild(p);break;case"meta":if(j=Ug("meta","content",f).get(o+(r.content||""))){for(C=0;C<j.length;C++)if(p=j[C],p.getAttribute("content")===(r.content==null?null:""+r.content)&&p.getAttribute("name")===(r.name==null?null:r.name)&&p.getAttribute("property")===(r.property==null?null:r.property)&&p.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&p.getAttribute("charset")===(r.charSet==null?null:r.charSet)){j.splice(C,1);break t}}p=f.createElement(o),Vt(p,o,r),f.head.appendChild(p);break;default:throw Error(l(468,o))}p[Gt]=t,_t(p),o=p}t.stateNode=o}else Bg(f,t.type,t.stateNode);else t.stateNode=_g(f,o,t.memoizedProps);else p!==o?(p===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):p.count--,o===null?Bg(f,t.type,t.stateNode):_g(f,o,t.memoizedProps)):o===null&&t.stateNode!==null&&wu(t,t.memoizedProps,r.memoizedProps)}break;case 27:cn(n,t),un(t),o&512&&(zt||r===null||ti(r,r.return)),r!==null&&o&4&&wu(t,t.memoizedProps,r.memoizedProps);break;case 5:if(cn(n,t),un(t),o&512&&(zt||r===null||ti(r,r.return)),t.flags&32){f=t.stateNode;try{Gs(f,"")}catch(xe){it(t,t.return,xe)}}o&4&&t.stateNode!=null&&(f=t.memoizedProps,wu(t,f,r!==null?r.memoizedProps:f)),o&1024&&(Su=!0);break;case 6:if(cn(n,t),un(t),o&4){if(t.stateNode===null)throw Error(l(162));o=t.memoizedProps,r=t.stateNode;try{r.nodeValue=o}catch(xe){it(t,t.return,xe)}}break;case 3:if(Xl=null,f=Gn,Gn=Zl(n.containerInfo),cn(n,t),Gn=f,un(t),o&4&&r!==null&&r.memoizedState.isDehydrated)try{va(n.containerInfo)}catch(xe){it(t,t.return,xe)}Su&&(Su=!1,Bp(t));break;case 4:o=Gn,Gn=Zl(t.stateNode.containerInfo),cn(n,t),un(t),Gn=o;break;case 12:cn(n,t),un(t);break;case 31:cn(n,t),un(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ml(t,o)));break;case 13:cn(n,t),un(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(_l=It()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ml(t,o)));break;case 22:f=t.memoizedState!==null;var D=r!==null&&r.memoizedState!==null,P=bi,te=zt;if(bi=P||f,zt=te||D,cn(n,t),zt=te,bi=P,un(t),o&8192)e:for(n=t.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(r===null||D||bi||zt||Cs(t)),r=null,n=t;;){if(n.tag===5||n.tag===26){if(r===null){D=r=n;try{if(p=D.stateNode,f)j=p.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{C=D.stateNode;var le=D.memoizedProps.style,Z=le!=null&&le.hasOwnProperty("display")?le.display:null;C.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(xe){it(D,D.return,xe)}}}else if(n.tag===6){if(r===null){D=n;try{D.stateNode.nodeValue=f?"":D.memoizedProps}catch(xe){it(D,D.return,xe)}}}else if(n.tag===18){if(r===null){D=n;try{var X=D.stateNode;f?Tg(X,!0):Tg(D.stateNode,!1)}catch(xe){it(D,D.return,xe)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=t.updateQueue,o!==null&&(r=o.retryQueue,r!==null&&(o.retryQueue=null,Ml(t,r))));break;case 19:cn(n,t),un(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ml(t,o)));break;case 30:break;case 21:break;default:cn(n,t),un(t)}}function un(t){var n=t.flags;if(n&2){try{for(var r,o=t.return;o!==null;){if(Ep(o)){r=o;break}o=o.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var f=r.stateNode,p=ju(t);Dl(t,p,f);break;case 5:var j=r.stateNode;r.flags&32&&(Gs(j,""),r.flags&=-33);var C=ju(t);Dl(t,C,j);break;case 3:case 4:var D=r.stateNode.containerInfo,P=ju(t);ku(t,P,D);break;default:throw Error(l(161))}}catch(te){it(t,t.return,te)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Bp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Bp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function vi(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Rp(t,n.alternate,n),n=n.sibling}function Cs(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Yi(4,n,n.return),Cs(n);break;case 1:ti(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Tp(n,n.return,r),Cs(n);break;case 27:mr(n.stateNode);case 26:case 5:ti(n,n.return),Cs(n);break;case 22:n.memoizedState===null&&Cs(n);break;case 30:Cs(n);break;default:Cs(n)}t=t.sibling}}function wi(t,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,f=t,p=n,j=p.flags;switch(p.tag){case 0:case 11:case 15:wi(f,p,r),sr(4,p);break;case 1:if(wi(f,p,r),o=p,f=o.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(P){it(o,o.return,P)}if(o=p,f=o.updateQueue,f!==null){var C=o.stateNode;try{var D=f.shared.hiddenCallbacks;if(D!==null)for(f.shared.hiddenCallbacks=null,f=0;f<D.length;f++)pm(D[f],C)}catch(P){it(o,o.return,P)}}r&&j&64&&Ap(p),ar(p,p.return);break;case 27:zp(p);case 26:case 5:wi(f,p,r),r&&o===null&&j&4&&Np(p),ar(p,p.return);break;case 12:wi(f,p,r);break;case 31:wi(f,p,r),r&&j&4&&Lp(f,p);break;case 13:wi(f,p,r),r&&j&4&&_p(f,p);break;case 22:p.memoizedState===null&&wi(f,p,r),ar(p,p.return);break;case 30:break;default:wi(f,p,r)}n=n.sibling}}function Cu(t,n){var r=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==r&&(t!=null&&t.refCount++,r!=null&&Ya(r))}function Au(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ya(t))}function Fn(t,n,r,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Hp(t,n,r,o),n=n.sibling}function Hp(t,n,r,o){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Fn(t,n,r,o),f&2048&&sr(9,n);break;case 1:Fn(t,n,r,o);break;case 3:Fn(t,n,r,o),f&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ya(t)));break;case 12:if(f&2048){Fn(t,n,r,o),t=n.stateNode;try{var p=n.memoizedProps,j=p.id,C=p.onPostCommit;typeof C=="function"&&C(j,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(D){it(n,n.return,D)}}else Fn(t,n,r,o);break;case 31:Fn(t,n,r,o);break;case 13:Fn(t,n,r,o);break;case 23:break;case 22:p=n.stateNode,j=n.alternate,n.memoizedState!==null?p._visibility&2?Fn(t,n,r,o):rr(t,n):p._visibility&2?Fn(t,n,r,o):(p._visibility|=2,ca(t,n,r,o,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Cu(j,n);break;case 24:Fn(t,n,r,o),f&2048&&Au(n.alternate,n);break;default:Fn(t,n,r,o)}}function ca(t,n,r,o,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=t,j=n,C=r,D=o,P=j.flags;switch(j.tag){case 0:case 11:case 15:ca(p,j,C,D,f),sr(8,j);break;case 23:break;case 22:var te=j.stateNode;j.memoizedState!==null?te._visibility&2?ca(p,j,C,D,f):rr(p,j):(te._visibility|=2,ca(p,j,C,D,f)),f&&P&2048&&Cu(j.alternate,j);break;case 24:ca(p,j,C,D,f),f&&P&2048&&Au(j.alternate,j);break;default:ca(p,j,C,D,f)}n=n.sibling}}function rr(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=t,o=n,f=o.flags;switch(o.tag){case 22:rr(r,o),f&2048&&Cu(o.alternate,o);break;case 24:rr(r,o),f&2048&&Au(o.alternate,o);break;default:rr(r,o)}n=n.sibling}}var lr=8192;function ua(t,n,r){if(t.subtreeFlags&lr)for(t=t.child;t!==null;)Ip(t,n,r),t=t.sibling}function Ip(t,n,r){switch(t.tag){case 26:ua(t,n,r),t.flags&lr&&t.memoizedState!==null&&Dk(r,Gn,t.memoizedState,t.memoizedProps);break;case 5:ua(t,n,r);break;case 3:case 4:var o=Gn;Gn=Zl(t.stateNode.containerInfo),ua(t,n,r),Gn=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=lr,lr=16777216,ua(t,n,r),lr=o):ua(t,n,r));break;default:ua(t,n,r)}}function $p(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function or(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];Ut=o,Gp(o,t)}$p(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)qp(t),t=t.sibling}function qp(t){switch(t.tag){case 0:case 11:case 15:or(t),t.flags&2048&&Yi(9,t,t.return);break;case 3:or(t);break;case 12:or(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Ll(t)):or(t);break;default:or(t)}}function Ll(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];Ut=o,Gp(o,t)}$p(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Yi(8,n,n.return),Ll(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,Ll(n));break;default:Ll(n)}t=t.sibling}}function Gp(t,n){for(;Ut!==null;){var r=Ut;switch(r.tag){case 0:case 11:case 15:Yi(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var o=r.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ya(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,Ut=o;else e:for(r=t;Ut!==null;){o=Ut;var f=o.sibling,p=o.return;if(Dp(o),o===r){Ut=null;break e}if(f!==null){f.return=p,Ut=f;break e}Ut=p}}}var Zj={getCacheForType:function(t){var n=Yt(Tt),r=n.data.get(t);return r===void 0&&(r=t(),n.data.set(t,r)),r},cacheSignal:function(){return Yt(Tt).controller.signal}},Qj=typeof WeakMap=="function"?WeakMap:Map,et=0,lt=null,Fe=null,Pe=0,nt=0,vn=null,Pi=!1,da=!1,Tu=!1,ji=0,vt=0,Vi=0,As=0,Nu=0,wn=0,ha=0,cr=null,dn=null,Eu=!1,_l=0,Fp=0,Ul=1/0,Bl=null,Zi=null,Dt=0,Qi=null,fa=null,ki=0,zu=0,Ou=null,Yp=null,ur=0,Ru=null;function jn(){return(et&2)!==0&&Pe!==0?Pe&-Pe:U.T!==null?Bu():lf()}function Pp(){if(wn===0)if((Pe&536870912)===0||Ze){var t=qt;qt<<=1,(qt&3932160)===0&&(qt=262144),wn=t}else wn=536870912;return t=bn.current,t!==null&&(t.flags|=32),wn}function hn(t,n,r){(t===lt&&(nt===2||nt===9)||t.cancelPendingCommit!==null)&&(ma(t,0),Xi(t,Pe,wn,!1)),Oa(t,r),((et&2)===0||t!==lt)&&(t===lt&&((et&2)===0&&(As|=r),vt===4&&Xi(t,Pe,wn,!1)),ni(t))}function Vp(t,n,r){if((et&6)!==0)throw Error(l(327));var o=!r&&(n&127)===0&&(n&t.expiredLanes)===0||za(t,n),f=o?Jj(t,n):Mu(t,n,!0),p=o;do{if(f===0){da&&!o&&Xi(t,n,0,!1);break}else{if(r=t.current.alternate,p&&!Xj(r)){f=Mu(t,n,!1),p=!1;continue}if(f===2){if(p=n,t.errorRecoveryDisabledLanes&p)var j=0;else j=t.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){n=j;e:{var C=t;f=cr;var D=C.current.memoizedState.isDehydrated;if(D&&(ma(C,j).flags|=256),j=Mu(C,j,!1),j!==2){if(Tu&&!D){C.errorRecoveryDisabledLanes|=p,As|=p,f=4;break e}p=dn,dn=f,p!==null&&(dn===null?dn=p:dn.push.apply(dn,p))}f=j}if(p=!1,f!==2)continue}}if(f===1){ma(t,0),Xi(t,n,0,!0);break}e:{switch(o=t,p=f,p){case 0:case 1:throw Error(l(345));case 4:if((n&4194048)!==n)break;case 6:Xi(o,n,wn,!Pi);break e;case 2:dn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=_l+300-It(),10<f)){if(Xi(o,n,wn,!Pi),Zr(o,0,!0)!==0)break e;ki=n,o.timeoutHandle=Sg(Zp.bind(null,o,r,dn,Bl,Eu,n,wn,As,ha,Pi,p,"Throttled",-0,0),f);break e}Zp(o,r,dn,Bl,Eu,n,wn,As,ha,Pi,p,null,-0,0)}}break}while(!0);ni(t)}function Zp(t,n,r,o,f,p,j,C,D,P,te,le,Z,X){if(t.timeoutHandle=-1,le=n.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:oi},Ip(n,p,le);var xe=(p&62914560)===p?_l-It():(p&4194048)===p?Fp-It():0;if(xe=Mk(le,xe),xe!==null){ki=p,t.cancelPendingCommit=xe(ng.bind(null,t,n,p,r,o,f,j,C,D,te,le,null,Z,X)),Xi(t,p,j,!P);return}}ng(t,n,p,r,o,f,j,C,D)}function Xj(t){for(var n=t;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var o=0;o<r.length;o++){var f=r[o],p=f.getSnapshot;f=f.value;try{if(!gn(p(),f))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Xi(t,n,r,o){n&=~Nu,n&=~As,t.suspendedLanes|=n,t.pingedLanes&=~n,o&&(t.warmLanes|=n),o=t.expirationTimes;for(var f=n;0<f;){var p=31-$e(f),j=1<<p;o[p]=-1,f&=~j}r!==0&&sf(t,r,n)}function Hl(){return(et&6)===0?(dr(0),!1):!0}function Du(){if(Fe!==null){if(nt===0)var t=Fe.return;else t=Fe,hi=ys=null,Qc(t),sa=null,Va=0,t=Fe;for(;t!==null;)Cp(t.alternate,t),t=t.return;Fe=null}}function ma(t,n){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,gk(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),ki=0,Du(),lt=t,Fe=r=ui(t.current,null),Pe=n,nt=0,vn=null,Pi=!1,da=za(t,n),Tu=!1,ha=wn=Nu=As=Vi=vt=0,dn=cr=null,Eu=!1,(n&8)!==0&&(n|=n&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=n;0<o;){var f=31-$e(o),p=1<<f;n|=t[f],o&=~p}return ji=n,rl(),r}function Qp(t,n){Be=null,U.H=tr,n===ia||n===ml?(n=dm(),nt=3):n===Uc?(n=dm(),nt=4):nt=n===du?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,vn=n,Fe===null&&(vt=1,Nl(t,On(n,t.current)))}function Xp(){var t=bn.current;return t===null?!0:(Pe&4194048)===Pe?Ln===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?t===Ln:!1}function Kp(){var t=U.H;return U.H=tr,t===null?tr:t}function Jp(){var t=U.A;return U.A=Zj,t}function Il(){vt=4,Pi||(Pe&4194048)!==Pe&&bn.current!==null||(da=!0),(Vi&134217727)===0&&(As&134217727)===0||lt===null||Xi(lt,Pe,wn,!1)}function Mu(t,n,r){var o=et;et|=2;var f=Kp(),p=Jp();(lt!==t||Pe!==n)&&(Bl=null,ma(t,n)),n=!1;var j=vt;e:do try{if(nt!==0&&Fe!==null){var C=Fe,D=vn;switch(nt){case 8:Du(),j=6;break e;case 3:case 2:case 9:case 6:bn.current===null&&(n=!0);var P=nt;if(nt=0,vn=null,pa(t,C,D,P),r&&da){j=0;break e}break;default:P=nt,nt=0,vn=null,pa(t,C,D,P)}}Kj(),j=vt;break}catch(te){Qp(t,te)}while(!0);return n&&t.shellSuspendCounter++,hi=ys=null,et=o,U.H=f,U.A=p,Fe===null&&(lt=null,Pe=0,rl()),j}function Kj(){for(;Fe!==null;)Wp(Fe)}function Jj(t,n){var r=et;et|=2;var o=Kp(),f=Jp();lt!==t||Pe!==n?(Bl=null,Ul=It()+500,ma(t,n)):da=za(t,n);e:do try{if(nt!==0&&Fe!==null){n=Fe;var p=vn;t:switch(nt){case 1:nt=0,vn=null,pa(t,n,p,1);break;case 2:case 9:if(cm(p)){nt=0,vn=null,eg(n);break}n=function(){nt!==2&&nt!==9||lt!==t||(nt=7),ni(t)},p.then(n,n);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:cm(p)?(nt=0,vn=null,eg(n)):(nt=0,vn=null,pa(t,n,p,7));break;case 5:var j=null;switch(Fe.tag){case 26:j=Fe.memoizedState;case 5:case 27:var C=Fe;if(j?Hg(j):C.stateNode.complete){nt=0,vn=null;var D=C.sibling;if(D!==null)Fe=D;else{var P=C.return;P!==null?(Fe=P,$l(P)):Fe=null}break t}}nt=0,vn=null,pa(t,n,p,5);break;case 6:nt=0,vn=null,pa(t,n,p,6);break;case 8:Du(),vt=6;break e;default:throw Error(l(462))}}Wj();break}catch(te){Qp(t,te)}while(!0);return hi=ys=null,U.H=o,U.A=f,et=r,Fe!==null?0:(lt=null,Pe=0,rl(),vt)}function Wj(){for(;Fe!==null&&!Jn();)Wp(Fe)}function Wp(t){var n=kp(t.alternate,t,ji);t.memoizedProps=t.pendingProps,n===null?$l(t):Fe=n}function eg(t){var n=t,r=n.alternate;switch(n.tag){case 15:case 0:n=yp(r,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=yp(r,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:Qc(n);default:Cp(r,n),n=Fe=Jf(n,ji),n=kp(r,n,ji)}t.memoizedProps=t.pendingProps,n===null?$l(t):Fe=n}function pa(t,n,r,o){hi=ys=null,Qc(n),sa=null,Va=0;var f=n.return;try{if($j(t,f,n,r,Pe)){vt=1,Nl(t,On(r,t.current)),Fe=null;return}}catch(p){if(f!==null)throw Fe=f,p;vt=1,Nl(t,On(r,t.current)),Fe=null;return}n.flags&32768?(Ze||o===1?t=!0:da||(Pe&536870912)!==0?t=!1:(Pi=t=!0,(o===2||o===9||o===3||o===6)&&(o=bn.current,o!==null&&o.tag===13&&(o.flags|=16384))),tg(n,t)):$l(n)}function $l(t){var n=t;do{if((n.flags&32768)!==0){tg(n,Pi);return}t=n.return;var r=Fj(n.alternate,n,ji);if(r!==null){Fe=r;return}if(n=n.sibling,n!==null){Fe=n;return}Fe=n=t}while(n!==null);vt===0&&(vt=5)}function tg(t,n){do{var r=Yj(t.alternate,t);if(r!==null){r.flags&=32767,Fe=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(t=t.sibling,t!==null)){Fe=t;return}Fe=t=r}while(t!==null);vt=6,Fe=null}function ng(t,n,r,o,f,p,j,C,D){t.cancelPendingCommit=null;do ql();while(Dt!==0);if((et&6)!==0)throw Error(l(327));if(n!==null){if(n===t.current)throw Error(l(177));if(p=n.lanes|n.childLanes,p|=jc,Rw(t,r,p,j,C,D),t===lt&&(Fe=lt=null,Pe=0),fa=n,Qi=t,ki=r,zu=p,Ou=f,Yp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,ik(me,function(){return lg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=U.T,U.T=null,f=M.p,M.p=2,j=et,et|=4;try{Pj(t,n,r)}finally{et=j,M.p=f,U.T=o}}Dt=1,ig(),sg(),ag()}}function ig(){if(Dt===1){Dt=0;var t=Qi,n=fa,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=U.T,U.T=null;var o=M.p;M.p=2;var f=et;et|=4;try{Up(n,t);var p=Pu,j=Gf(t.containerInfo),C=p.focusedElem,D=p.selectionRange;if(j!==C&&C&&C.ownerDocument&&qf(C.ownerDocument.documentElement,C)){if(D!==null&&yc(C)){var P=D.start,te=D.end;if(te===void 0&&(te=P),"selectionStart"in C)C.selectionStart=P,C.selectionEnd=Math.min(te,C.value.length);else{var le=C.ownerDocument||document,Z=le&&le.defaultView||window;if(Z.getSelection){var X=Z.getSelection(),xe=C.textContent.length,Ee=Math.min(D.start,xe),rt=D.end===void 0?Ee:Math.min(D.end,xe);!X.extend&&Ee>rt&&(j=rt,rt=Ee,Ee=j);var $=$f(C,Ee),L=$f(C,rt);if($&&L&&(X.rangeCount!==1||X.anchorNode!==$.node||X.anchorOffset!==$.offset||X.focusNode!==L.node||X.focusOffset!==L.offset)){var Y=le.createRange();Y.setStart($.node,$.offset),X.removeAllRanges(),Ee>rt?(X.addRange(Y),X.extend(L.node,L.offset)):(Y.setEnd(L.node,L.offset),X.addRange(Y))}}}}for(le=[],X=C;X=X.parentNode;)X.nodeType===1&&le.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<le.length;C++){var se=le[C];se.element.scrollLeft=se.left,se.element.scrollTop=se.top}}eo=!!Yu,Pu=Yu=null}finally{et=f,M.p=o,U.T=r}}t.current=n,Dt=2}}function sg(){if(Dt===2){Dt=0;var t=Qi,n=fa,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=U.T,U.T=null;var o=M.p;M.p=2;var f=et;et|=4;try{Rp(t,n.alternate,n)}finally{et=f,M.p=o,U.T=r}}Dt=3}}function ag(){if(Dt===4||Dt===3){Dt=0,os();var t=Qi,n=fa,r=ki,o=Yp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Dt=5:(Dt=0,fa=Qi=null,rg(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(Zi=null),Jo(r),n=n.stateNode,ue&&typeof ue.onCommitFiberRoot=="function")try{ue.onCommitFiberRoot(bt,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=U.T,f=M.p,M.p=2,U.T=null;try{for(var p=t.onRecoverableError,j=0;j<o.length;j++){var C=o[j];p(C.value,{componentStack:C.stack})}}finally{U.T=n,M.p=f}}(ki&3)!==0&&ql(),ni(t),f=t.pendingLanes,(r&261930)!==0&&(f&42)!==0?t===Ru?ur++:(ur=0,Ru=t):ur=0,dr(0)}}function rg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Ya(n)))}function ql(){return ig(),sg(),ag(),lg()}function lg(){if(Dt!==5)return!1;var t=Qi,n=zu;zu=0;var r=Jo(ki),o=U.T,f=M.p;try{M.p=32>r?32:r,U.T=null,r=Ou,Ou=null;var p=Qi,j=ki;if(Dt=0,fa=Qi=null,ki=0,(et&6)!==0)throw Error(l(331));var C=et;if(et|=4,qp(p.current),Hp(p,p.current,j,r),et=C,dr(0,!1),ue&&typeof ue.onPostCommitFiberRoot=="function")try{ue.onPostCommitFiberRoot(bt,p)}catch{}return!0}finally{M.p=f,U.T=o,rg(t,n)}}function og(t,n,r){n=On(r,n),n=uu(t.stateNode,n,2),t=qi(t,n,2),t!==null&&(Oa(t,2),ni(t))}function it(t,n,r){if(t.tag===3)og(t,t,r);else for(;n!==null;){if(n.tag===3){og(n,t,r);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Zi===null||!Zi.has(o))){t=On(r,t),r=cp(2),o=qi(n,r,2),o!==null&&(up(r,o,n,t),Oa(o,2),ni(o));break}}n=n.return}}function Lu(t,n,r){var o=t.pingCache;if(o===null){o=t.pingCache=new Qj;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(r)||(Tu=!0,f.add(r),t=ek.bind(null,t,n,r),n.then(t,t))}function ek(t,n,r){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,lt===t&&(Pe&r)===r&&(vt===4||vt===3&&(Pe&62914560)===Pe&&300>It()-_l?(et&2)===0&&ma(t,0):Nu|=r,ha===Pe&&(ha=0)),ni(t)}function cg(t,n){n===0&&(n=nf()),t=ms(t,n),t!==null&&(Oa(t,n),ni(t))}function tk(t){var n=t.memoizedState,r=0;n!==null&&(r=n.retryLane),cg(t,r)}function nk(t,n){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,f=t.memoizedState;f!==null&&(r=f.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(l(314))}o!==null&&o.delete(n),cg(t,r)}function ik(t,n){return tn(t,n)}var Gl=null,ga=null,_u=!1,Fl=!1,Uu=!1,Ki=0;function ni(t){t!==ga&&t.next===null&&(ga===null?Gl=ga=t:ga=ga.next=t),Fl=!0,_u||(_u=!0,ak())}function dr(t,n){if(!Uu&&Fl){Uu=!0;do for(var r=!1,o=Gl;o!==null;){if(t!==0){var f=o.pendingLanes;if(f===0)var p=0;else{var j=o.suspendedLanes,C=o.pingedLanes;p=(1<<31-$e(42|t)+1)-1,p&=f&~(j&~C),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(r=!0,fg(o,p))}else p=Pe,p=Zr(o,o===lt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||za(o,p)||(r=!0,fg(o,p));o=o.next}while(r);Uu=!1}}function sk(){ug()}function ug(){Fl=_u=!1;var t=0;Ki!==0&&pk()&&(t=Ki);for(var n=It(),r=null,o=Gl;o!==null;){var f=o.next,p=dg(o,n);p===0?(o.next=null,r===null?Gl=f:r.next=f,f===null&&(ga=r)):(r=o,(t!==0||(p&3)!==0)&&(Fl=!0)),o=f}Dt!==0&&Dt!==5||dr(t),Ki!==0&&(Ki=0)}function dg(t,n){for(var r=t.suspendedLanes,o=t.pingedLanes,f=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var j=31-$e(p),C=1<<j,D=f[j];D===-1?((C&r)===0||(C&o)!==0)&&(f[j]=Ow(C,n)):D<=n&&(t.expiredLanes|=C),p&=~C}if(n=lt,r=Pe,r=Zr(t,t===n?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,r===0||t===n&&(nt===2||nt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&$n(o),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||za(t,r)){if(n=r&-r,n===t.callbackPriority)return n;switch(o!==null&&$n(o),Jo(r)){case 2:case 8:r=J;break;case 32:r=me;break;case 268435456:r=Le;break;default:r=me}return o=hg.bind(null,t),r=tn(r,o),t.callbackPriority=n,t.callbackNode=r,n}return o!==null&&o!==null&&$n(o),t.callbackPriority=2,t.callbackNode=null,2}function hg(t,n){if(Dt!==0&&Dt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(ql()&&t.callbackNode!==r)return null;var o=Pe;return o=Zr(t,t===lt?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Vp(t,o,n),dg(t,It()),t.callbackNode!=null&&t.callbackNode===r?hg.bind(null,t):null)}function fg(t,n){if(ql())return null;Vp(t,n,!0)}function ak(){yk(function(){(et&6)!==0?tn(Tn,sk):ug()})}function Bu(){if(Ki===0){var t=ta;t===0&&(t=St,St<<=1,(St&261888)===0&&(St=256)),Ki=t}return Ki}function mg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Jr(""+t)}function pg(t,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,t.id&&r.setAttribute("form",t.id),n.parentNode.insertBefore(r,n),t=new FormData(t),r.parentNode.removeChild(r),t}function rk(t,n,r,o,f){if(n==="submit"&&r&&r.stateNode===f){var p=mg((f[rn]||null).action),j=o.submitter;j&&(n=(n=j[rn]||null)?mg(n.formAction):j.getAttribute("formAction"),n!==null&&(p=n,j=null));var C=new nl("action","action",null,o,f);t.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ki!==0){var D=j?pg(f,j):new FormData(f);su(r,{pending:!0,data:D,method:f.method,action:p},null,D)}}else typeof p=="function"&&(C.preventDefault(),D=j?pg(f,j):new FormData(f),su(r,{pending:!0,data:D,method:f.method,action:p},p,D))},currentTarget:f}]})}}for(var Hu=0;Hu<wc.length;Hu++){var Iu=wc[Hu],lk=Iu.toLowerCase(),ok=Iu[0].toUpperCase()+Iu.slice(1);qn(lk,"on"+ok)}qn(Pf,"onAnimationEnd"),qn(Vf,"onAnimationIteration"),qn(Zf,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Sj,"onTransitionRun"),qn(Cj,"onTransitionStart"),qn(Aj,"onTransitionCancel"),qn(Qf,"onTransitionEnd"),$s("onMouseEnter",["mouseout","mouseover"]),$s("onMouseLeave",["mouseout","mouseover"]),$s("onPointerEnter",["pointerout","pointerover"]),$s("onPointerLeave",["pointerout","pointerover"]),us("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),us("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),us("onBeforeInput",["compositionend","keypress","textInput","paste"]),us("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),us("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),us("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hr="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(" "),ck=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hr));function gg(t,n){n=(n&4)!==0;for(var r=0;r<t.length;r++){var o=t[r],f=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var j=o.length-1;0<=j;j--){var C=o[j],D=C.instance,P=C.currentTarget;if(C=C.listener,D!==p&&f.isPropagationStopped())break e;p=C,f.currentTarget=P;try{p(f)}catch(te){al(te)}f.currentTarget=null,p=D}else for(j=0;j<o.length;j++){if(C=o[j],D=C.instance,P=C.currentTarget,C=C.listener,D!==p&&f.isPropagationStopped())break e;p=C,f.currentTarget=P;try{p(f)}catch(te){al(te)}f.currentTarget=null,p=D}}}}function Ye(t,n){var r=n[Wo];r===void 0&&(r=n[Wo]=new Set);var o=t+"__bubble";r.has(o)||(yg(n,t,2,!1),r.add(o))}function $u(t,n,r){var o=0;n&&(o|=4),yg(r,t,o,n)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function qu(t){if(!t[Yl]){t[Yl]=!0,uf.forEach(function(r){r!=="selectionchange"&&(ck.has(r)||$u(r,!1,t),$u(r,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Yl]||(n[Yl]=!0,$u("selectionchange",!1,n))}}function yg(t,n,r,o){switch(Pg(n)){case 2:var f=Uk;break;case 8:f=Bk;break;default:f=id}r=f.bind(null,n,r,t),f=void 0,!oc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),o?f!==void 0?t.addEventListener(n,r,{capture:!0,passive:f}):t.addEventListener(n,r,!0):f!==void 0?t.addEventListener(n,r,{passive:f}):t.addEventListener(n,r,!1)}function Gu(t,n,r,o,f){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var j=o.tag;if(j===3||j===4){var C=o.stateNode.containerInfo;if(C===f)break;if(j===4)for(j=o.return;j!==null;){var D=j.tag;if((D===3||D===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;C!==null;){if(j=Bs(C),j===null)return;if(D=j.tag,D===5||D===6||D===26||D===27){o=p=j;continue e}C=C.parentNode}}o=o.return}jf(function(){var P=p,te=rc(r),le=[];e:{var Z=Xf.get(t);if(Z!==void 0){var X=nl,xe=t;switch(t){case"keypress":if(el(r)===0)break e;case"keydown":case"keyup":X=nj;break;case"focusin":xe="focus",X=hc;break;case"focusout":xe="blur",X=hc;break;case"beforeblur":case"afterblur":X=hc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=Cf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=Fw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=aj;break;case Pf:case Vf:case Zf:X=Vw;break;case Qf:X=lj;break;case"scroll":case"scrollend":X=qw;break;case"wheel":X=cj;break;case"copy":case"cut":case"paste":X=Qw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Tf;break;case"toggle":case"beforetoggle":X=dj}var Ee=(n&4)!==0,rt=!Ee&&(t==="scroll"||t==="scrollend"),$=Ee?Z!==null?Z+"Capture":null:Z;Ee=[];for(var L=P,Y;L!==null;){var se=L;if(Y=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||Y===null||$===null||(se=Ma(L,$),se!=null&&Ee.push(fr(L,se,Y))),rt)break;L=L.return}0<Ee.length&&(Z=new X(Z,xe,null,r,te),le.push({event:Z,listeners:Ee}))}}if((n&7)===0){e:{if(Z=t==="mouseover"||t==="pointerover",X=t==="mouseout"||t==="pointerout",Z&&r!==ac&&(xe=r.relatedTarget||r.fromElement)&&(Bs(xe)||xe[Us]))break e;if((X||Z)&&(Z=te.window===te?te:(Z=te.ownerDocument)?Z.defaultView||Z.parentWindow:window,X?(xe=r.relatedTarget||r.toElement,X=P,xe=xe?Bs(xe):null,xe!==null&&(rt=u(xe),Ee=xe.tag,xe!==rt||Ee!==5&&Ee!==27&&Ee!==6)&&(xe=null)):(X=null,xe=P),X!==xe)){if(Ee=Cf,se="onMouseLeave",$="onMouseEnter",L="mouse",(t==="pointerout"||t==="pointerover")&&(Ee=Tf,se="onPointerLeave",$="onPointerEnter",L="pointer"),rt=X==null?Z:Da(X),Y=xe==null?Z:Da(xe),Z=new Ee(se,L+"leave",X,r,te),Z.target=rt,Z.relatedTarget=Y,se=null,Bs(te)===P&&(Ee=new Ee($,L+"enter",xe,r,te),Ee.target=Y,Ee.relatedTarget=rt,se=Ee),rt=se,X&&xe)t:{for(Ee=uk,$=X,L=xe,Y=0,se=$;se;se=Ee(se))Y++;se=0;for(var Ae=L;Ae;Ae=Ee(Ae))se++;for(;0<Y-se;)$=Ee($),Y--;for(;0<se-Y;)L=Ee(L),se--;for(;Y--;){if($===L||L!==null&&$===L.alternate){Ee=$;break t}$=Ee($),L=Ee(L)}Ee=null}else Ee=null;X!==null&&bg(le,Z,X,Ee,!1),xe!==null&&rt!==null&&bg(le,rt,xe,Ee,!0)}}e:{if(Z=P?Da(P):window,X=Z.nodeName&&Z.nodeName.toLowerCase(),X==="select"||X==="input"&&Z.type==="file")var Xe=Lf;else if(Df(Z))if(_f)Xe=wj;else{Xe=xj;var we=bj}else X=Z.nodeName,!X||X.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?P&&sc(P.elementType)&&(Xe=Lf):Xe=vj;if(Xe&&(Xe=Xe(t,P))){Mf(le,Xe,r,te);break e}we&&we(t,Z,P),t==="focusout"&&P&&Z.type==="number"&&P.memoizedProps.value!=null&&ic(Z,"number",Z.value)}switch(we=P?Da(P):window,t){case"focusin":(Df(we)||we.contentEditable==="true")&&(Vs=we,bc=P,qa=null);break;case"focusout":qa=bc=Vs=null;break;case"mousedown":xc=!0;break;case"contextmenu":case"mouseup":case"dragend":xc=!1,Ff(le,r,te);break;case"selectionchange":if(kj)break;case"keydown":case"keyup":Ff(le,r,te)}var He;if(mc)e:{switch(t){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else Ps?Of(t,r)&&(Ve="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(Ve="onCompositionStart");Ve&&(Nf&&r.locale!=="ko"&&(Ps||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&Ps&&(He=kf()):(Li=te,cc="value"in Li?Li.value:Li.textContent,Ps=!0)),we=Pl(P,Ve),0<we.length&&(Ve=new Af(Ve,t,null,r,te),le.push({event:Ve,listeners:we}),He?Ve.data=He:(He=Rf(r),He!==null&&(Ve.data=He)))),(He=fj?mj(t,r):pj(t,r))&&(Ve=Pl(P,"onBeforeInput"),0<Ve.length&&(we=new Af("onBeforeInput","beforeinput",null,r,te),le.push({event:we,listeners:Ve}),we.data=He)),rk(le,t,P,r,te)}gg(le,n)})}function fr(t,n,r){return{instance:t,listener:n,currentTarget:r}}function Pl(t,n){for(var r=n+"Capture",o=[];t!==null;){var f=t,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=Ma(t,r),f!=null&&o.unshift(fr(t,f,p)),f=Ma(t,n),f!=null&&o.push(fr(t,f,p))),t.tag===3)return o;t=t.return}return[]}function uk(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function bg(t,n,r,o,f){for(var p=n._reactName,j=[];r!==null&&r!==o;){var C=r,D=C.alternate,P=C.stateNode;if(C=C.tag,D!==null&&D===o)break;C!==5&&C!==26&&C!==27||P===null||(D=P,f?(P=Ma(r,p),P!=null&&j.unshift(fr(r,P,D))):f||(P=Ma(r,p),P!=null&&j.push(fr(r,P,D)))),r=r.return}j.length!==0&&t.push({event:n,listeners:j})}var dk=/\r\n?/g,hk=/\u0000|\uFFFD/g;function xg(t){return(typeof t=="string"?t:""+t).replace(dk,`
9
- `).replace(hk,"")}function vg(t,n){return n=xg(n),xg(t)===n}function at(t,n,r,o,f,p){switch(r){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Gs(t,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Gs(t,""+o);break;case"className":Xr(t,"class",o);break;case"tabIndex":Xr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Xr(t,r,o);break;case"style":vf(t,o,p);break;case"data":if(n!=="object"){Xr(t,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||r!=="href")){t.removeAttribute(r);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=Jr(""+o),t.setAttribute(r,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(r==="formAction"?(n!=="input"&&at(t,n,"name",f.name,f,null),at(t,n,"formEncType",f.formEncType,f,null),at(t,n,"formMethod",f.formMethod,f,null),at(t,n,"formTarget",f.formTarget,f,null)):(at(t,n,"encType",f.encType,f,null),at(t,n,"method",f.method,f,null),at(t,n,"target",f.target,f,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=Jr(""+o),t.setAttribute(r,o);break;case"onClick":o!=null&&(t.onclick=oi);break;case"onScroll":o!=null&&Ye("scroll",t);break;case"onScrollEnd":o!=null&&Ye("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(l(61));if(r=o.__html,r!=null){if(f.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}r=Jr(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,""+o):t.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,""):t.removeAttribute(r);break;case"capture":case"download":o===!0?t.setAttribute(r,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,o):t.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(r,o):t.removeAttribute(r);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(r):t.setAttribute(r,o);break;case"popover":Ye("beforetoggle",t),Ye("toggle",t),Qr(t,"popover",o);break;case"xlinkActuate":li(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":li(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":li(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":li(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":li(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":li(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":li(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":li(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":li(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Qr(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Iw.get(r)||r,Qr(t,r,o))}}function Fu(t,n,r,o,f,p){switch(r){case"style":vf(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(l(61));if(r=o.__html,r!=null){if(f.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"children":typeof o=="string"?Gs(t,o):(typeof o=="number"||typeof o=="bigint")&&Gs(t,""+o);break;case"onScroll":o!=null&&Ye("scroll",t);break;case"onScrollEnd":o!=null&&Ye("scrollend",t);break;case"onClick":o!=null&&(t.onclick=oi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!df.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(f=r.endsWith("Capture"),n=r.slice(2,f?r.length-7:void 0),p=t[rn]||null,p=p!=null?p[r]:null,typeof p=="function"&&t.removeEventListener(n,p,f),typeof o=="function")){typeof p!="function"&&p!==null&&(r in t?t[r]=null:t.hasAttribute(r)&&t.removeAttribute(r)),t.addEventListener(n,o,f);break e}r in t?t[r]=o:o===!0?t.setAttribute(r,""):Qr(t,r,o)}}}function Vt(t,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",t),Ye("load",t);var o=!1,f=!1,p;for(p in r)if(r.hasOwnProperty(p)){var j=r[p];if(j!=null)switch(p){case"src":o=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:at(t,n,p,j,r,null)}}f&&at(t,n,"srcSet",r.srcSet,r,null),o&&at(t,n,"src",r.src,r,null);return;case"input":Ye("invalid",t);var C=p=j=f=null,D=null,P=null;for(o in r)if(r.hasOwnProperty(o)){var te=r[o];if(te!=null)switch(o){case"name":f=te;break;case"type":j=te;break;case"checked":D=te;break;case"defaultChecked":P=te;break;case"value":p=te;break;case"defaultValue":C=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(l(137,n));break;default:at(t,n,o,te,r,null)}}gf(t,p,C,D,P,j,f,!1);return;case"select":Ye("invalid",t),o=j=p=null;for(f in r)if(r.hasOwnProperty(f)&&(C=r[f],C!=null))switch(f){case"value":p=C;break;case"defaultValue":j=C;break;case"multiple":o=C;default:at(t,n,f,C,r,null)}n=p,r=j,t.multiple=!!o,n!=null?qs(t,!!o,n,!1):r!=null&&qs(t,!!o,r,!0);return;case"textarea":Ye("invalid",t),p=f=o=null;for(j in r)if(r.hasOwnProperty(j)&&(C=r[j],C!=null))switch(j){case"value":o=C;break;case"defaultValue":f=C;break;case"children":p=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(l(91));break;default:at(t,n,j,C,r,null)}bf(t,o,f,p);return;case"option":for(D in r)r.hasOwnProperty(D)&&(o=r[D],o!=null)&&(D==="selected"?t.selected=o&&typeof o!="function"&&typeof o!="symbol":at(t,n,D,o,r,null));return;case"dialog":Ye("beforetoggle",t),Ye("toggle",t),Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":Ye("load",t);break;case"video":case"audio":for(o=0;o<hr.length;o++)Ye(hr[o],t);break;case"image":Ye("error",t),Ye("load",t);break;case"details":Ye("toggle",t);break;case"embed":case"source":case"link":Ye("error",t),Ye("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in r)if(r.hasOwnProperty(P)&&(o=r[P],o!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:at(t,n,P,o,r,null)}return;default:if(sc(n)){for(te in r)r.hasOwnProperty(te)&&(o=r[te],o!==void 0&&Fu(t,n,te,o,r,void 0));return}}for(C in r)r.hasOwnProperty(C)&&(o=r[C],o!=null&&at(t,n,C,o,r,null))}function fk(t,n,r,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,j=null,C=null,D=null,P=null,te=null;for(X in r){var le=r[X];if(r.hasOwnProperty(X)&&le!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":D=le;default:o.hasOwnProperty(X)||at(t,n,X,null,o,le)}}for(var Z in o){var X=o[Z];if(le=r[Z],o.hasOwnProperty(Z)&&(X!=null||le!=null))switch(Z){case"type":p=X;break;case"name":f=X;break;case"checked":P=X;break;case"defaultChecked":te=X;break;case"value":j=X;break;case"defaultValue":C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(l(137,n));break;default:X!==le&&at(t,n,Z,X,o,le)}}nc(t,j,C,D,P,te,p,f);return;case"select":X=j=C=Z=null;for(p in r)if(D=r[p],r.hasOwnProperty(p)&&D!=null)switch(p){case"value":break;case"multiple":X=D;default:o.hasOwnProperty(p)||at(t,n,p,null,o,D)}for(f in o)if(p=o[f],D=r[f],o.hasOwnProperty(f)&&(p!=null||D!=null))switch(f){case"value":Z=p;break;case"defaultValue":C=p;break;case"multiple":j=p;default:p!==D&&at(t,n,f,p,o,D)}n=C,r=j,o=X,Z!=null?qs(t,!!r,Z,!1):!!o!=!!r&&(n!=null?qs(t,!!r,n,!0):qs(t,!!r,r?[]:"",!1));return;case"textarea":X=Z=null;for(C in r)if(f=r[C],r.hasOwnProperty(C)&&f!=null&&!o.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:at(t,n,C,null,o,f)}for(j in o)if(f=o[j],p=r[j],o.hasOwnProperty(j)&&(f!=null||p!=null))switch(j){case"value":Z=f;break;case"defaultValue":X=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==p&&at(t,n,j,f,o,p)}yf(t,Z,X);return;case"option":for(var xe in r)Z=r[xe],r.hasOwnProperty(xe)&&Z!=null&&!o.hasOwnProperty(xe)&&(xe==="selected"?t.selected=!1:at(t,n,xe,null,o,Z));for(D in o)Z=o[D],X=r[D],o.hasOwnProperty(D)&&Z!==X&&(Z!=null||X!=null)&&(D==="selected"?t.selected=Z&&typeof Z!="function"&&typeof Z!="symbol":at(t,n,D,Z,o,X));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in r)Z=r[Ee],r.hasOwnProperty(Ee)&&Z!=null&&!o.hasOwnProperty(Ee)&&at(t,n,Ee,null,o,Z);for(P in o)if(Z=o[P],X=r[P],o.hasOwnProperty(P)&&Z!==X&&(Z!=null||X!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(l(137,n));break;default:at(t,n,P,Z,o,X)}return;default:if(sc(n)){for(var rt in r)Z=r[rt],r.hasOwnProperty(rt)&&Z!==void 0&&!o.hasOwnProperty(rt)&&Fu(t,n,rt,void 0,o,Z);for(te in o)Z=o[te],X=r[te],!o.hasOwnProperty(te)||Z===X||Z===void 0&&X===void 0||Fu(t,n,te,Z,o,X);return}}for(var $ in r)Z=r[$],r.hasOwnProperty($)&&Z!=null&&!o.hasOwnProperty($)&&at(t,n,$,null,o,Z);for(le in o)Z=o[le],X=r[le],!o.hasOwnProperty(le)||Z===X||Z==null&&X==null||at(t,n,le,Z,o,X)}function wg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function mk(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,r=performance.getEntriesByType("resource"),o=0;o<r.length;o++){var f=r[o],p=f.transferSize,j=f.initiatorType,C=f.duration;if(p&&C&&wg(j)){for(j=0,C=f.responseEnd,o+=1;o<r.length;o++){var D=r[o],P=D.startTime;if(P>C)break;var te=D.transferSize,le=D.initiatorType;te&&wg(le)&&(D=D.responseEnd,j+=te*(D<C?1:(C-P)/(D-P)))}if(--o,n+=8*(p+j)/(f.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Yu=null,Pu=null;function Vl(t){return t.nodeType===9?t:t.ownerDocument}function jg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function kg(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function Vu(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Zu=null;function pk(){var t=window.event;return t&&t.type==="popstate"?t===Zu?!1:(Zu=t,!0):(Zu=null,!1)}var Sg=typeof setTimeout=="function"?setTimeout:void 0,gk=typeof clearTimeout=="function"?clearTimeout:void 0,Cg=typeof Promise=="function"?Promise:void 0,yk=typeof queueMicrotask=="function"?queueMicrotask:typeof Cg<"u"?function(t){return Cg.resolve(null).then(t).catch(bk)}:Sg;function bk(t){setTimeout(function(){throw t})}function Ji(t){return t==="head"}function Ag(t,n){var r=n,o=0;do{var f=r.nextSibling;if(t.removeChild(r),f&&f.nodeType===8)if(r=f.data,r==="/$"||r==="/&"){if(o===0){t.removeChild(f),va(n);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")mr(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,mr(r);for(var p=r.firstChild;p;){var j=p.nextSibling,C=p.nodeName;p[Ra]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&p.rel.toLowerCase()==="stylesheet"||r.removeChild(p),p=j}}else r==="body"&&mr(t.ownerDocument.body);r=f}while(r);va(n)}function Tg(t,n){var r=t;t=0;do{var o=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(t===0)break;t--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||t++;r=o}while(r)}function Qu(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Qu(r),ec(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function xk(t,n,r,o){for(;t.nodeType===1;){var f=r;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Ra])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=_n(t.nextSibling),t===null)break}return null}function vk(t,n,r){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=_n(t.nextSibling),t===null))return null;return t}function Ng(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=_n(t.nextSibling),t===null))return null;return t}function Xu(t){return t.data==="$?"||t.data==="$~"}function Ku(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function wk(t,n){var r=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||r.readyState!=="loading")n();else{var o=function(){n(),r.removeEventListener("DOMContentLoaded",o)};r.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function _n(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Ju=null;function Eg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(n===0)return _n(t.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}t=t.nextSibling}return null}function zg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return t;n--}else r!=="/$"&&r!=="/&"||n++}t=t.previousSibling}return null}function Og(t,n,r){switch(n=Vl(r),t){case"html":if(t=n.documentElement,!t)throw Error(l(452));return t;case"head":if(t=n.head,!t)throw Error(l(453));return t;case"body":if(t=n.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function mr(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);ec(t)}var Un=new Map,Rg=new Set;function Zl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Si=M.d;M.d={f:jk,r:kk,D:Sk,C:Ck,L:Ak,m:Tk,X:Ek,S:Nk,M:zk};function jk(){var t=Si.f(),n=Hl();return t||n}function kk(t){var n=Hs(t);n!==null&&n.tag===5&&n.type==="form"?Qm(n):Si.r(t)}var ya=typeof document>"u"?null:document;function Dg(t,n,r){var o=ya;if(o&&typeof n=="string"&&n){var f=En(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof r=="string"&&(f+='[crossorigin="'+r+'"]'),Rg.has(f)||(Rg.add(f),t={rel:t,crossOrigin:r,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),Vt(n,"link",t),_t(n),o.head.appendChild(n)))}}function Sk(t){Si.D(t),Dg("dns-prefetch",t,null)}function Ck(t,n){Si.C(t,n),Dg("preconnect",t,n)}function Ak(t,n,r){Si.L(t,n,r);var o=ya;if(o&&t&&n){var f='link[rel="preload"][as="'+En(n)+'"]';n==="image"&&r&&r.imageSrcSet?(f+='[imagesrcset="'+En(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(f+='[imagesizes="'+En(r.imageSizes)+'"]')):f+='[href="'+En(t)+'"]';var p=f;switch(n){case"style":p=ba(t);break;case"script":p=xa(t)}Un.has(p)||(t=b({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:t,as:n},r),Un.set(p,t),o.querySelector(f)!==null||n==="style"&&o.querySelector(pr(p))||n==="script"&&o.querySelector(gr(p))||(n=o.createElement("link"),Vt(n,"link",t),_t(n),o.head.appendChild(n)))}}function Tk(t,n){Si.m(t,n);var r=ya;if(r&&t){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+En(o)+'"][href="'+En(t)+'"]',p=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=xa(t)}if(!Un.has(p)&&(t=b({rel:"modulepreload",href:t},n),Un.set(p,t),r.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(gr(p)))return}o=r.createElement("link"),Vt(o,"link",t),_t(o),r.head.appendChild(o)}}}function Nk(t,n,r){Si.S(t,n,r);var o=ya;if(o&&t){var f=Is(o).hoistableStyles,p=ba(t);n=n||"default";var j=f.get(p);if(!j){var C={loading:0,preload:null};if(j=o.querySelector(pr(p)))C.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":n},r),(r=Un.get(p))&&Wu(t,r);var D=j=o.createElement("link");_t(D),Vt(D,"link",t),D._p=new Promise(function(P,te){D.onload=P,D.onerror=te}),D.addEventListener("load",function(){C.loading|=1}),D.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Ql(j,n,o)}j={type:"stylesheet",instance:j,count:1,state:C},f.set(p,j)}}}function Ek(t,n){Si.X(t,n);var r=ya;if(r&&t){var o=Is(r).hoistableScripts,f=xa(t),p=o.get(f);p||(p=r.querySelector(gr(f)),p||(t=b({src:t,async:!0},n),(n=Un.get(f))&&ed(t,n),p=r.createElement("script"),_t(p),Vt(p,"link",t),r.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(f,p))}}function zk(t,n){Si.M(t,n);var r=ya;if(r&&t){var o=Is(r).hoistableScripts,f=xa(t),p=o.get(f);p||(p=r.querySelector(gr(f)),p||(t=b({src:t,async:!0,type:"module"},n),(n=Un.get(f))&&ed(t,n),p=r.createElement("script"),_t(p),Vt(p,"link",t),r.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(f,p))}}function Mg(t,n,r,o){var f=(f=ge.current)?Zl(f):null;if(!f)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=ba(r.href),r=Is(f).hoistableStyles,o=r.get(n),o||(o={type:"style",instance:null,count:0,state:null},r.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=ba(r.href);var p=Is(f).hoistableStyles,j=p.get(t);if(j||(f=f.ownerDocument||f,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,j),(p=f.querySelector(pr(t)))&&!p._p&&(j.instance=p,j.state.loading=5),Un.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Un.set(t,r),p||Ok(f,t,r,j.state))),n&&o===null)throw Error(l(528,""));return j}if(n&&o!==null)throw Error(l(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=xa(r),r=Is(f).hoistableScripts,o=r.get(n),o||(o={type:"script",instance:null,count:0,state:null},r.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function ba(t){return'href="'+En(t)+'"'}function pr(t){return'link[rel="stylesheet"]['+t+"]"}function Lg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function Ok(t,n,r,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Vt(n,"link",r),_t(n),t.head.appendChild(n))}function xa(t){return'[src="'+En(t)+'"]'}function gr(t){return"script[async]"+t}function _g(t,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+En(r.href)+'"]');if(o)return n.instance=o,_t(o),o;var f=b({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),_t(o),Vt(o,"style",f),Ql(o,r.precedence,t),n.instance=o;case"stylesheet":f=ba(r.href);var p=t.querySelector(pr(f));if(p)return n.state.loading|=4,n.instance=p,_t(p),p;o=Lg(r),(f=Un.get(f))&&Wu(o,f),p=(t.ownerDocument||t).createElement("link"),_t(p);var j=p;return j._p=new Promise(function(C,D){j.onload=C,j.onerror=D}),Vt(p,"link",o),n.state.loading|=4,Ql(p,r.precedence,t),n.instance=p;case"script":return p=xa(r.src),(f=t.querySelector(gr(p)))?(n.instance=f,_t(f),f):(o=r,(f=Un.get(p))&&(o=b({},r),ed(o,f)),t=t.ownerDocument||t,f=t.createElement("script"),_t(f),Vt(f,"link",o),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Ql(o,r.precedence,t));return n.instance}function Ql(t,n,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,p=f,j=0;j<o.length;j++){var C=o[j];if(C.dataset.precedence===n)p=C;else if(p!==f)break}p?p.parentNode.insertBefore(t,p.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(t,n.firstChild))}function Wu(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function ed(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Xl=null;function Ug(t,n,r){if(Xl===null){var o=new Map,f=Xl=new Map;f.set(r,o)}else f=Xl,o=f.get(r),o||(o=new Map,f.set(r,o));if(o.has(t))return o;for(o.set(t,null),r=r.getElementsByTagName(t),f=0;f<r.length;f++){var p=r[f];if(!(p[Ra]||p[Gt]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var j=p.getAttribute(n)||"";j=t+j;var C=o.get(j);C?C.push(p):o.set(j,[p])}}return o}function Bg(t,n,r){t=t.ownerDocument||t,t.head.insertBefore(r,n==="title"?t.querySelector("head > title"):null)}function Rk(t,n,r){if(r===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Hg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Dk(t,n,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=ba(o.href),p=n.querySelector(pr(f));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Kl.bind(t),n.then(t,t)),r.state.loading|=4,r.instance=p,_t(p);return}p=n.ownerDocument||n,o=Lg(o),(f=Un.get(f))&&Wu(o,f),p=p.createElement("link"),_t(p);var j=p;j._p=new Promise(function(C,D){j.onload=C,j.onerror=D}),Vt(p,"link",o),r.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Kl.bind(t),n.addEventListener("load",r),n.addEventListener("error",r))}}var td=0;function Mk(t,n){return t.stylesheets&&t.count===0&&Wl(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var o=setTimeout(function(){if(t.stylesheets&&Wl(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+n);0<t.imgBytes&&td===0&&(td=62500*mk());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Wl(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>td?50:800)+n);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function Kl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Jl=null;function Wl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Jl=new Map,n.forEach(Lk,t),Jl=null,Kl.call(t))}function Lk(t,n){if(!(n.state.loading&4)){var r=Jl.get(t);if(r)var o=r.get(null);else{r=new Map,Jl.set(t,r);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var j=f[p];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(r.set(j.dataset.precedence,j),o=j)}o&&r.set(null,o)}f=n.instance,j=f.getAttribute("data-precedence"),p=r.get(j)||o,p===o&&r.set(null,f),r.set(j,f),this.count++,o=Kl.bind(this),f.addEventListener("load",o),f.addEventListener("error",o),p?p.parentNode.insertBefore(f,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),n.state.loading|=4}}var yr={$$typeof:A,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function _k(t,n,r,o,f,p,j,C,D){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Xo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xo(0),this.hiddenUpdates=Xo(null),this.identifierPrefix=o,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Ig(t,n,r,o,f,p,j,C,D,P,te,le){return t=new _k(t,n,r,j,D,P,te,le,C),n=1,p===!0&&(n|=24),p=yn(3,null,null,n),t.current=p,p.stateNode=t,n=Mc(),n.refCount++,t.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:r,cache:n},Bc(p),t}function $g(t){return t?(t=Xs,t):Xs}function qg(t,n,r,o,f,p){f=$g(f),o.context===null?o.context=f:o.pendingContext=f,o=$i(n),o.payload={element:r},p=p===void 0?null:p,p!==null&&(o.callback=p),r=qi(t,o,n),r!==null&&(hn(r,t,n),Qa(r,t,n))}function Gg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<n?r:n}}function nd(t,n){Gg(t,n),(t=t.alternate)&&Gg(t,n)}function Fg(t){if(t.tag===13||t.tag===31){var n=ms(t,67108864);n!==null&&hn(n,t,67108864),nd(t,67108864)}}function Yg(t){if(t.tag===13||t.tag===31){var n=jn();n=Ko(n);var r=ms(t,n);r!==null&&hn(r,t,n),nd(t,n)}}var eo=!0;function Uk(t,n,r,o){var f=U.T;U.T=null;var p=M.p;try{M.p=2,id(t,n,r,o)}finally{M.p=p,U.T=f}}function Bk(t,n,r,o){var f=U.T;U.T=null;var p=M.p;try{M.p=8,id(t,n,r,o)}finally{M.p=p,U.T=f}}function id(t,n,r,o){if(eo){var f=sd(o);if(f===null)Gu(t,n,o,to,r),Vg(t,o);else if(Ik(f,t,n,r,o))o.stopPropagation();else if(Vg(t,o),n&4&&-1<Hk.indexOf(t)){for(;f!==null;){var p=Hs(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var j=cs(p.pendingLanes);if(j!==0){var C=p;for(C.pendingLanes|=2,C.entangledLanes|=2;j;){var D=1<<31-$e(j);C.entanglements[1]|=D,j&=~D}ni(p),(et&6)===0&&(Ul=It()+500,dr(0))}}break;case 31:case 13:C=ms(p,2),C!==null&&hn(C,p,2),Hl(),nd(p,2)}if(p=sd(o),p===null&&Gu(t,n,o,to,r),p===f)break;f=p}f!==null&&o.stopPropagation()}else Gu(t,n,o,null,r)}}function sd(t){return t=rc(t),ad(t)}var to=null;function ad(t){if(to=null,t=Bs(t),t!==null){var n=u(t);if(n===null)t=null;else{var r=n.tag;if(r===13){if(t=d(n),t!==null)return t;t=null}else if(r===31){if(t=h(n),t!==null)return t;t=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return to=t,null}function Pg(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ea()){case Tn:return 2;case J:return 8;case me:case De:return 32;case Le:return 268435456;default:return 32}default:return 32}}var rd=!1,Wi=null,es=null,ts=null,br=new Map,xr=new Map,ns=[],Hk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Vg(t,n){switch(t){case"focusin":case"focusout":Wi=null;break;case"dragenter":case"dragleave":es=null;break;case"mouseover":case"mouseout":ts=null;break;case"pointerover":case"pointerout":br.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":xr.delete(n.pointerId)}}function vr(t,n,r,o,f,p){return t===null||t.nativeEvent!==p?(t={blockedOn:n,domEventName:r,eventSystemFlags:o,nativeEvent:p,targetContainers:[f]},n!==null&&(n=Hs(n),n!==null&&Fg(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function Ik(t,n,r,o,f){switch(n){case"focusin":return Wi=vr(Wi,t,n,r,o,f),!0;case"dragenter":return es=vr(es,t,n,r,o,f),!0;case"mouseover":return ts=vr(ts,t,n,r,o,f),!0;case"pointerover":var p=f.pointerId;return br.set(p,vr(br.get(p)||null,t,n,r,o,f)),!0;case"gotpointercapture":return p=f.pointerId,xr.set(p,vr(xr.get(p)||null,t,n,r,o,f)),!0}return!1}function Zg(t){var n=Bs(t.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=d(r),n!==null){t.blockedOn=n,of(t.priority,function(){Yg(r)});return}}else if(n===31){if(n=h(r),n!==null){t.blockedOn=n,of(t.priority,function(){Yg(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function no(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var r=sd(t.nativeEvent);if(r===null){r=t.nativeEvent;var o=new r.constructor(r.type,r);ac=o,r.target.dispatchEvent(o),ac=null}else return n=Hs(r),n!==null&&Fg(n),t.blockedOn=r,!1;n.shift()}return!0}function Qg(t,n,r){no(t)&&r.delete(n)}function $k(){rd=!1,Wi!==null&&no(Wi)&&(Wi=null),es!==null&&no(es)&&(es=null),ts!==null&&no(ts)&&(ts=null),br.forEach(Qg),xr.forEach(Qg)}function io(t,n){t.blockedOn===n&&(t.blockedOn=null,rd||(rd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$k)))}var so=null;function Xg(t){so!==t&&(so=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){so===t&&(so=null);for(var n=0;n<t.length;n+=3){var r=t[n],o=t[n+1],f=t[n+2];if(typeof o!="function"){if(ad(o||r)===null)continue;break}var p=Hs(r);p!==null&&(t.splice(n,3),n-=3,su(p,{pending:!0,data:f,method:r.method,action:o},o,f))}}))}function va(t){function n(D){return io(D,t)}Wi!==null&&io(Wi,t),es!==null&&io(es,t),ts!==null&&io(ts,t),br.forEach(n),xr.forEach(n);for(var r=0;r<ns.length;r++){var o=ns[r];o.blockedOn===t&&(o.blockedOn=null)}for(;0<ns.length&&(r=ns[0],r.blockedOn===null);)Zg(r),r.blockedOn===null&&ns.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var f=r[o],p=r[o+1],j=f[rn]||null;if(typeof p=="function")j||Xg(r);else if(j){var C=null;if(p&&p.hasAttribute("formAction")){if(f=p,j=p[rn]||null)C=j.formAction;else if(ad(f)!==null)continue}else C=j.action;typeof C=="function"?r[o+1]=C:(r.splice(o,3),o-=3),Xg(r)}}}function Kg(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(j){return f=j})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),o||setTimeout(r,20)}function r(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function ld(t){this._internalRoot=t}ao.prototype.render=ld.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(l(409));var r=n.current,o=jn();qg(r,o,t,n,null,null)},ao.prototype.unmount=ld.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;qg(t.current,2,null,t,null,null),Hl(),n[Us]=null}};function ao(t){this._internalRoot=t}ao.prototype.unstable_scheduleHydration=function(t){if(t){var n=lf();t={blockedOn:null,target:t,priority:n};for(var r=0;r<ns.length&&n!==0&&n<ns[r].priority;r++);ns.splice(r,0,t),r===0&&Zg(t)}};var Jg=s.version;if(Jg!=="19.2.0")throw Error(l(527,Jg,"19.2.0"));M.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=m(n),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var qk={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ro=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ro.isDisabled&&ro.supportsFiber)try{bt=ro.inject(qk),ue=ro}catch{}}return jr.createRoot=function(t,n){if(!c(t))throw Error(l(299));var r=!1,o="",f=ap,p=rp,j=lp;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(j=n.onRecoverableError)),n=Ig(t,1,!1,null,null,r,o,null,f,p,j,Kg),t[Us]=n.current,qu(t),new ld(n)},jr.hydrateRoot=function(t,n,r){if(!c(t))throw Error(l(299));var o=!1,f="",p=ap,j=rp,C=lp,D=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(j=r.onCaughtError),r.onRecoverableError!==void 0&&(C=r.onRecoverableError),r.formState!==void 0&&(D=r.formState)),n=Ig(t,1,!0,n,r??null,o,f,D,p,j,C,Kg),n.context=$g(null),r=n.current,o=jn(),o=Ko(o),f=$i(o),f.callback=null,qi(r,f,o),r=o,n.current.lanes=r,Oa(n,r),ni(n),t[Us]=n.current,qu(t),new ao(n)},jr.version="19.2.0",jr}var oy;function Kk(){if(oy)return ud.exports;oy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(s){console.error(s)}}return e(),ud.exports=Xk(),ud.exports}var Wb=Kk();class Pn extends Error{constructor(s,a,l){super(l),this.status=s,this.code=a,this.name="ApiError"}status;code}const Jk={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",408:"Request Timeout",409:"Conflict",413:"Payload Too Large",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",520:"Unknown Error",521:"Web Server Is Down",522:"Connection Timed Out",523:"Origin Is Unreachable",524:"A Timeout Occurred"},cy=200,Wk=e=>e.replace(/<\/?[a-z!][^>]*>/gi," "),e0=e=>e.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&");function Co(e){const s=u=>/<[a-z!/]/i.test(u),a=u=>{const d=e0(u);return s(d)?Wk(d.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi," ")):d};let l=e;if(s(e)){const u=d=>{const h=new RegExp(`<${d}\\b[^>]*>([\\s\\S]*?)</${d}>`,"i").exec(e)?.[1];return h!==void 0&&a(h).trim()?h:void 0};l=u("title")??u("h1")??e}let c=a(l).replace(/[<>]/g,"");return c=c.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"").replace(/\s+/g," ").trim(),c.length>cy?`${c.slice(0,cy-1)}…`:c}function t0(e){if(typeof e=="string")return Co(e);if(!e||typeof e!="object"||Array.isArray(e))return"";const s=e;for(const a of["message","detail","error_description","title","reason"]){const l=s[a];if(typeof l=="string"&&l.trim())return Co(l)}return""}function md(e,s){const a=e.status,l=e.statusText||Jk[a]||"",c=s&&s.toLowerCase()!==l.toLowerCase()&&s!==String(a)?`: "${s}"`:"",u=`HTTP ${a}${l?` ${l}`:""}${c}`;return a===429?new Pn(429,"RATE_LIMITED",`Pikibun is over its request limit right now (${u}). Try again later.`):a===408||a===504||a===522||a===524?new Pn(a,"UPSTREAM_TIMEOUT",`The proxy in front of Pikibun stopped waiting for the server (${u}). The request took too long, but the server may have accepted it and still be working on it: check the result before retrying.`):a===502||a===503||a===520||a===521||a===523?new Pn(a,"BACKEND_UNAVAILABLE",`The proxy in front of Pikibun got no valid answer from the server (${u}). The server may have restarted, crashed or taken too long while handling this request; if it changes something, check the result before retrying.`):e.ok?new Pn(a,"BACKEND_UNAVAILABLE",`The Pikibun API answered with something other than JSON (${u}). Try again later.`):new Pn(a,"REQUEST_FAILED",`The request failed before reaching Pikibun's API (${u}).`)}async function uy(e){if(!(e.headers.get("content-type")??"").includes("application/json")){const g=await e.text().catch(()=>"");throw md(e,Co(g))}if(e.ok)try{return await e.json()}catch(g){throw g instanceof Error&&g.name==="AbortError"?g:new Pn(e.status,"BACKEND_UNAVAILABLE",`The Pikibun API's answer arrived incomplete or garbled (HTTP ${e.status}). The connection may have dropped; if the request changes something, check the result before retrying.`)}const a=await e.text().catch(()=>"");let l;try{l=JSON.parse(a)}catch{throw md(e,Co(a))}const c=l&&typeof l=="object"?l:{},u=c.error,d=typeof u=="string"?u:u&&typeof u=="object"&&typeof u.message=="string"?u.message:void 0,h=u&&typeof u=="object"&&typeof u.code=="string"?u.code:typeof c.code=="string"?c.code:void 0;throw d?new Pn(e.status,h??"REQUEST_FAILED",d):md(e,t0(l))}function n0(e){const s=e.baseUrl??"",a=(l,c)=>(e.fetch??globalThis.fetch)(l,c);return async function(c,u={}){const d=u.method??"GET",h={...u.headers,Accept:"application/json"},g={method:d,headers:h,signal:u.signal};if(g.credentials="same-origin",d!=="GET"){const y=await uy(await a(`${s}/api/auth/csrf`,{credentials:"same-origin",signal:u.signal}));h["x-csrf-token"]=y.csrfToken}u.body!==void 0&&(h["Content-Type"]="application/json",g.body=JSON.stringify(u.body));const m=await a(`${s}${c}`,g);if(!(m.status===204&&m.ok))return await uy(m)}}function Sn(e){return e instanceof Pn?e.message:e instanceof TypeError?"Could not reach Pikibun. Check your connection and try again.":e instanceof Error?e.message:"Something went wrong. Please try again."}const ce=e=>encodeURIComponent(e),he=n0({}),i0={plus:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),settings:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12.2 2h-.4a2 2 0 0 0-2 2v.2a2 2 0 0 1-1 1.7l-.4.3a2 2 0 0 1-2 0l-.2-.1a2 2 0 0 0-2.7.7l-.2.4a2 2 0 0 0 .7 2.7l.2.1a2 2 0 0 1 1 1.7v.6a2 2 0 0 1-1 1.7l-.2.1a2 2 0 0 0-.7 2.7l.2.4a2 2 0 0 0 2.7.7l.2-.1a2 2 0 0 1 2 0l.4.3a2 2 0 0 1 1 1.7v.2a2 2 0 0 0 2 2h.4a2 2 0 0 0 2-2v-.2a2 2 0 0 1 1-1.7l.4-.3a2 2 0 0 1 2 0l.2.1a2 2 0 0 0 2.7-.7l.2-.4a2 2 0 0 0-.7-2.7l-.2-.1a2 2 0 0 1-1-1.7v-.6a2 2 0 0 1 1-1.7l.2-.1a2 2 0 0 0 .7-2.7l-.2-.4a2 2 0 0 0-2.7-.7l-.2.1a2 2 0 0 1-2 0l-.4-.3a2 2 0 0 1-1-1.7V4a2 2 0 0 0-2-2Z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),pencil:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),i.jsx("path",{d:"m15 5 4 4"})]}),more:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"5",r:"1"}),i.jsx("circle",{cx:"12",cy:"12",r:"1"}),i.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),"chevron-right":i.jsx("path",{d:"m9 18 6-6-6-6"}),"chevron-down":i.jsx("path",{d:"m6 9 6 6 6-6"}),"chevron-up":i.jsx("path",{d:"m18 15-6-6-6 6"}),"chevron-left":i.jsx("path",{d:"m15 18-6-6 6-6"}),x:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M18 6 6 18"}),i.jsx("path",{d:"m6 6 12 12"})]}),check:i.jsx("path",{d:"M20 6 9 17l-5-5"}),copy:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"8",y:"8",width:"13",height:"13",rx:"2"}),i.jsx("path",{d:"M4 16V5a2 2 0 0 1 2-2h11"})]}),folder:i.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9l-.8-1.2A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}),file:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),i.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),message:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"}),terminal:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"m4 17 6-6-6-6"}),i.jsx("path",{d:"M12 19h8"})]}),tool:i.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.8-3.8a6 6 0 0 1-7.9 7.9l-6.9 6.9a2.1 2.1 0 0 1-3-3l6.9-6.9a6 6 0 0 1 7.9-7.9Z"}),send:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 19V5"}),i.jsx("path",{d:"m5 12 7-7 7 7"})]}),stop:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"}),"panel-right":i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),i.jsx("path",{d:"M15 3v18"})]}),menu:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]}),info:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4"}),i.jsx("path",{d:"M12 8h.01"})]}),alert:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"m21.7 18-8-14a2 2 0 0 0-3.4 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.7-3Z"}),i.jsx("path",{d:"M12 9v4"}),i.jsx("path",{d:"M12 17h.01"})]}),shield:i.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.7 9a1 1 0 0 1-.6 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.2-2.7a1.2 1.2 0 0 1 1.6 0C14.5 3.8 17 5 19 5a1 1 0 0 1 1 1Z"}),server:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),i.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),i.jsx("path",{d:"M6 6h.01"}),i.jsx("path",{d:"M6 18h.01"})]}),users:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i.jsx("circle",{cx:"9",cy:"7",r:"4"}),i.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.9"}),i.jsx("path",{d:"M16 3.1a4 4 0 0 1 0 7.8"})]}),user:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"8",r:"4"}),i.jsx("path",{d:"M20 21a8 8 0 0 0-16 0"})]}),palette:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"13.5",cy:"6.5",r:".5"}),i.jsx("circle",{cx:"17.5",cy:"10.5",r:".5"}),i.jsx("circle",{cx:"8.5",cy:"7.5",r:".5"}),i.jsx("circle",{cx:"6.5",cy:"12.5",r:".5"}),i.jsx("path",{d:"M12 2a10 10 0 0 0 0 20 1.7 1.7 0 0 0 1.7-1.7c0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1a1.7 1.7 0 0 1 1.6-1.7H16a5.6 5.6 0 0 0 5.6-5.6C21.6 6 17.3 2 12 2Z"})]}),sun:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("path",{d:"M12 2v2"}),i.jsx("path",{d:"M12 20v2"}),i.jsx("path",{d:"m4.9 4.9 1.4 1.4"}),i.jsx("path",{d:"m17.7 17.7 1.4 1.4"}),i.jsx("path",{d:"M2 12h2"}),i.jsx("path",{d:"M20 12h2"}),i.jsx("path",{d:"m6.3 17.7-1.4 1.4"}),i.jsx("path",{d:"m19.1 4.9-1.4 1.4"})]}),moon:i.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"}),sparkle:i.jsx("path",{d:"M9.9 15.5a2 2 0 0 0-1.4-1.4l-6.1-1.6a.5.5 0 0 1 0-1l6.1-1.6a2 2 0 0 0 1.4-1.4l1.6-6.1a.5.5 0 0 1 1 0l1.6 6.1a2 2 0 0 0 1.4 1.4l6.1 1.6a.5.5 0 0 1 0 1l-6.1 1.6a2 2 0 0 0-1.4 1.4l-1.6 6.1a.5.5 0 0 1-1 0Z"}),monitor:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("path",{d:"M8 21h8"}),i.jsx("path",{d:"M12 17v4"})]}),logout:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),i.jsx("path",{d:"m16 17 5-5-5-5"}),i.jsx("path",{d:"M21 12H9"})]}),archive:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"5",rx:"1"}),i.jsx("path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}),i.jsx("path",{d:"M10 12h4"})]}),"git-branch":i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6 3v12"}),i.jsx("circle",{cx:"18",cy:"6",r:"3"}),i.jsx("circle",{cx:"6",cy:"18",r:"3"}),i.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),"git-pull-request":i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),i.jsx("path",{d:"M6 9v12"})]}),lock:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2"}),i.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),globe:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),i.jsx("path",{d:"M2 12h20"})]}),refresh:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.8 9.8 0 0 1 6.7 2.7L21 8"}),i.jsx("path",{d:"M21 3v5h-5"}),i.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.8 9.8 0 0 1-6.7-2.7L3 16"}),i.jsx("path",{d:"M8 16H3v5"})]}),search:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("path",{d:"m21 21-4.3-4.3"})]}),eye:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),trash:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M3 6h18"}),i.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),i.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),external:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M15 3h6v6"}),i.jsx("path",{d:"M10 14 21 3"}),i.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),history:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"}),i.jsx("path",{d:"M3 3v5h5"}),i.jsx("path",{d:"M12 7v5l4 2"})]}),clock:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 6v6l4 2"})]}),image:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),i.jsx("circle",{cx:"9",cy:"9",r:"2"}),i.jsx("path",{d:"m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"})]}),"arrow-down":i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"m19 12-7 7-7-7"})]}),link:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"}),i.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"})]})};function ve({name:e,size:s=16}){return e==="github"?i.jsx(Ao,{size:s}):i.jsx("svg",{className:"icon",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:i0[e]})}const lo="M0 0C-1.6-.4-2.6-1.6-4.2-2.9-6.6-4.8-10.6-4.6-11.8-2.2-12.8-.2-11 2.6-8.2 3.2-5.8 3.7-3 1.6-1.6.6-1 .2-.5.05 0 0Z",dy="M-1 .05C-4-.4-7.6-.6-11.2-1.4M-5-.45-7-2.9M-5-.45-6.8 1.9M-8.2-.85-9.9-3.1M-8.2-.85-9.6 1.6",pd="translate(14.7 16.6) rotate(33) scale(1.15)",gd="translate(17.3 16.6) scale(-1 1) rotate(33) scale(1.15)";function ka({size:e=24}){const s=E.useId().replace(/[^\w-]/g,""),[a,l,c,u]=["sky","ear","body","glow"].map(h=>`${s}${h}`),d=i.jsxs(i.Fragment,{children:[i.jsx("path",{d:lo,transform:pd}),i.jsx("path",{d:lo,transform:gd}),i.jsx("ellipse",{cx:"11.1",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(-25 11.1 22.3)"}),i.jsx("ellipse",{cx:"20.9",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(25 20.9 22.3)"}),i.jsx("ellipse",{cx:"15",cy:"28.5",rx:".85",ry:"1.25"}),i.jsx("ellipse",{cx:"17",cy:"28.5",rx:".85",ry:"1.25"}),i.jsx("ellipse",{cx:"16",cy:"21.6",rx:"4.9",ry:"5.5"})]});return i.jsxs("svg",{className:"logo",width:e,height:e,viewBox:"0 0 32 32","aria-hidden":"true",focusable:"false",children:[i.jsxs("defs",{children:[i.jsxs("radialGradient",{id:a,cx:"50%",cy:"50%",r:"72%",children:[i.jsx("stop",{offset:"0",stopColor:"#2b1454"}),i.jsx("stop",{offset:"1",stopColor:"#110530"})]}),i.jsxs("linearGradient",{id:l,x1:"0",y1:".5",x2:"1",y2:".5",children:[i.jsx("stop",{offset:"0",stopColor:"#fdf0c9"}),i.jsx("stop",{offset:".5",stopColor:"#e2d2f5"}),i.jsx("stop",{offset:".85",stopColor:"#bba6ee"}),i.jsx("stop",{offset:"1",stopColor:"#f2e2cb"})]}),i.jsxs("radialGradient",{id:c,cx:"50%",cy:"74%",r:"70%",children:[i.jsx("stop",{offset:"0",stopColor:"#fdf1d6"}),i.jsx("stop",{offset:".45",stopColor:"#f4e0cd"}),i.jsx("stop",{offset:"1",stopColor:"#b5a3f0"})]}),i.jsx("filter",{id:u,x:"-30%",y:"-30%",width:"160%",height:"160%",children:i.jsx("feGaussianBlur",{stdDeviation:".8"})})]}),i.jsx("rect",{width:"32",height:"32",rx:"9",fill:`url(#${a})`}),i.jsxs("g",{transform:"translate(0 -1.4)",children:[i.jsx("g",{fill:"#fde9c4",opacity:".34",filter:`url(#${u})`,children:d}),i.jsxs("g",{stroke:"#3d1e45",strokeWidth:".5",strokeLinejoin:"round",children:[i.jsx("path",{d:lo,transform:pd,fill:`url(#${l})`}),i.jsx("path",{d:lo,transform:gd,fill:`url(#${l})`}),i.jsx("ellipse",{cx:"11.1",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(-25 11.1 22.3)",fill:"#ebe0f7"}),i.jsx("ellipse",{cx:"20.9",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(25 20.9 22.3)",fill:"#ebe0f7"}),i.jsx("path",{d:"M15.1 26.8v.6M16.9 26.8v.6",fill:"none",stroke:"#f4e0cd",strokeWidth:".6"}),i.jsx("ellipse",{cx:"15",cy:"28.5",rx:".85",ry:"1.25",fill:"#8a64bf"}),i.jsx("ellipse",{cx:"17",cy:"28.5",rx:".85",ry:"1.25",fill:"#8a64bf"}),i.jsx("ellipse",{cx:"16",cy:"21.6",rx:"4.9",ry:"5.5",fill:`url(#${c})`})]}),i.jsxs("g",{fill:"none",stroke:"#a387d8",strokeWidth:".3",strokeLinecap:"round",opacity:".85",children:[i.jsx("path",{d:dy,transform:pd}),i.jsx("path",{d:dy,transform:gd})]}),i.jsx("circle",{cx:"14.25",cy:"20.2",r:".85",fill:"#171412"}),i.jsx("circle",{cx:"17.75",cy:"20.2",r:".85",fill:"#171412"}),i.jsx("circle",{cx:"14.5",cy:"19.92",r:".27",fill:"#fff"}),i.jsx("circle",{cx:"18",cy:"19.92",r:".27",fill:"#fff"}),i.jsx("path",{d:"M15.47 20.85h1.06L16 21.55Z",fill:"#e0725f"})]})]})}function Ao({size:e=16}){return i.jsx("svg",{className:"icon",width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",focusable:"false",children:i.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}var s0=Jb();const oo=4,kr=8;function a0(e,s,a,l){const c=document.documentElement.clientWidth,d=window.innerHeight-e.bottom-oo-kr,h=e.top-oo-kr,g=a==="below"?d:h,m=a==="below"?h:d,y=g>=s.height||g>=m?a:a==="below"?"above":"below",v=Math.max(80,Math.floor(y==="below"?d:h)),x=y==="below"?e.bottom+oo:document.documentElement.clientHeight-e.top+oo,w=l==="end"?e.right-s.width:e.left,S=Math.min(Math.max(kr,w),Math.max(kr,c-kr-s.width));return{edge:x,left:S,maxHeight:v,side:y}}function xh({anchor:e,side:s="below",align:a="start",className:l="",role:c,id:u,label:d,style:h,children:g}){const m=E.useRef(null),[y,b]=E.useState(null);E.useLayoutEffect(()=>{const w=m.current,S=e.current;if(!w||!S)return;let T={width:0,height:0};const k=()=>{const I=w.style.maxHeight;w.style.maxHeight="";const{width:q,height:_}=w.getBoundingClientRect();w.style.maxHeight=I,T={width:q,height:_}},z=()=>b(a0(S.getBoundingClientRect(),T,s,a)),A=()=>{k(),z()};return A(),window.addEventListener("resize",A),document.addEventListener("scroll",z,!0),()=>{window.removeEventListener("resize",A),document.removeEventListener("scroll",z,!0)}},[e,s,a]);const v=y?{position:"fixed",...y.side==="below"?{top:y.edge}:{bottom:y.edge},left:y.left,maxHeight:y.maxHeight}:{position:"fixed",top:0,left:0,opacity:0,pointerEvents:"none"},x=e.current?.closest("dialog[open]")??document.body;return s0.createPortal(i.jsx("div",{ref:m,className:`popover portal ${y?.side??s} ${l}`.trim(),role:c,id:u,"aria-label":d,style:{...v,...h},children:g}),x)}function ex(){return vh()&&Math.min(window.screen.width,window.screen.height)<600}function vh(){return typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches}function tx(){return!ex()}function r0(){const e=window.visualViewport;if(!e||!vh())return;const s=document.documentElement,a=()=>{Math.abs(e.scale-1)>.01||(s.style.setProperty("--viewport-height",`${Math.round(e.height)}px`),s.classList.toggle("short-viewport",e.height<=500),window.scrollY!==0&&document.body.scrollHeight<=e.height+1&&window.scrollTo(0,0))};e.addEventListener("resize",a),e.addEventListener("scroll",a),a()}function qe(e){const[s,a]=E.useState(null),[l,c]=E.useState(!!e),[u,d]=E.useState(""),[h,g]=E.useState(0),m=E.useRef(null),y=E.useCallback(()=>g(b=>b+1),[]);return E.useEffect(()=>{const b=new AbortController;if(m.current!==e&&(a(null),m.current=e),d(""),!e){c(!1);return}return c(!0),he(e,{signal:b.signal}).then(v=>{b.signal.aborted||a(v)}).catch(v=>{b.signal.aborted||d(Sn(v))}).finally(()=>{b.signal.aborted||c(!1)}),()=>b.abort()},[e,h]),{data:s,loading:l,error:u,refresh:y,setData:a}}function Ne(){const[e,s]=E.useState(!1),[a,l]=E.useState(""),[c,u]=E.useState("");async function d(h,g=""){s(!0),l(""),u("");try{await h(),u(g)}catch(m){l(Sn(m))}finally{s(!1)}}return{busy:e,error:a,notice:c,run:d}}function V({variant:e="secondary",size:s="md",icon:a,block:l,className:c,children:u,type:d="button",...h}){const g=a&&!u;return i.jsxs("button",{type:d,className:["btn",e,s!=="md"&&s,l&&"block",g&&"icon-only",c].filter(Boolean).join(" "),...h,children:[a&&i.jsx(ve,{name:a,size:s==="xs"?14:16}),u]})}function Bt({href:e,variant:s="secondary",size:a="md",icon:l,children:c,...u}){return i.jsxs("a",{href:e,className:["btn",s,a!=="md"&&a].filter(Boolean).join(" "),...u,children:[l&&i.jsx(ve,{name:l,size:16}),c]})}function Te({tone:e="neutral",dot:s,children:a}){return i.jsxs("span",{className:`badge ${e==="running"?"info":e}`,children:[s&&i.jsx(as,{tone:e}),i.jsx("span",{className:"badge-label",children:a})]})}function as({tone:e="neutral",label:s,icon:a}){return a?i.jsx("span",{className:`status-icon ${e}`,role:s?"img":void 0,"aria-label":s,"aria-hidden":s?void 0:!0,children:i.jsx(ve,{name:a,size:11})}):i.jsx("span",{className:`dot ${e==="info"?"running":e}`,role:s?"img":void 0,"aria-label":s,"aria-hidden":s?void 0:!0})}function Os({large:e,label:s}){return i.jsx("span",{className:e?"spinner large":"spinner",role:s?"status":void 0,"aria-label":s})}function Ht({children:e="Loading..."}){return i.jsxs("span",{className:"loading-line",role:"status",children:[i.jsx(Os,{}),e]})}function ai(){return i.jsx("div",{className:"page-loading",children:i.jsx(Os,{large:!0,label:"Loading"})})}function ke({variant:e="default",title:s,children:a,actions:l,role:c}){const u=e==="success"?"check":e==="warning"||e==="error"?"alert":"info";return i.jsxs("div",{className:`alert ${e}`,role:c??(e==="error"?"alert":"note"),children:[i.jsx(ve,{name:u,size:16}),i.jsx("div",{className:"alert-title",children:s}),(a||l)&&i.jsxs("div",{className:"alert-body",children:[a,l&&i.jsx("div",{className:"alert-actions",children:l})]})]})}function Ce({error:e,notice:s}){return i.jsxs(i.Fragment,{children:[e&&i.jsx("p",{className:"field-error",role:"alert",children:e}),s&&i.jsx("p",{className:"field-notice",role:"status",children:s})]})}function dt({loading:e,error:s,retry:a,children:l}){return e?i.jsx(Ht,{}):s?i.jsx(ke,{variant:"error",title:"Couldn't load",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:a,children:"Try again"}),children:s}):i.jsx(i.Fragment,{children:l})}function jt({title:e,children:s,action:a}){return i.jsxs("div",{className:"empty-state",children:[i.jsx("div",{children:e}),s&&i.jsx("p",{children:s}),a]})}function Oe({title:e,info:s,action:a,children:l,bare:c}){return i.jsxs("section",{className:"section",children:[i.jsxs("div",{className:"section-header",children:[i.jsx("h2",{className:"section-title",children:e}),s&&i.jsx(Mr,{children:s}),a&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"spacer"}),a]})]}),c?l:i.jsx("div",{className:"card",children:l})]})}function Re({children:e}){return i.jsx("div",{className:"card-body",children:e})}function ae({title:e,hint:s,leading:a,trailing:l,onClick:c,href:u,chevron:d,disabled:h}){const g=i.jsxs(i.Fragment,{children:[a&&i.jsx("span",{className:"row-leading",children:a}),i.jsxs("span",{className:"row-content",children:[i.jsx("span",{className:"row-title",children:e}),s&&i.jsx("span",{className:"row-hint",children:s})]}),(l||d)&&i.jsxs("span",{className:"row-trailing",children:[l,d&&i.jsx(ve,{name:"chevron-right",size:16})]})]});return u?i.jsx("a",{className:"row",href:u,children:g}):c?i.jsx("button",{type:"button",className:"row",onClick:c,disabled:h,children:g}):i.jsx("div",{className:"row",children:g})}function Ca({title:e,hint:s,leading:a,trailing:l,children:c,open:u,plain:d}){return i.jsxs("details",{className:d?"collapsible plain":"collapsible",open:u,children:[i.jsxs("summary",{children:[a&&i.jsx("span",{className:"row-leading",children:a}),i.jsxs("span",{className:"row-content",children:[i.jsx("span",{className:"row-title",children:e}),s&&i.jsx("span",{className:"row-hint",children:s})]}),l&&i.jsx("span",{className:"row-trailing",children:l}),i.jsx("span",{className:"chevron",children:i.jsx(ve,{name:"chevron-right",size:16})})]}),i.jsx("div",{className:"collapsible-body",children:c})]})}function be({label:e,hint:s,error:a,children:l}){return i.jsxs("label",{className:"field",children:[i.jsx("span",{className:"field-label",children:e}),l,s&&i.jsx("span",{className:"field-hint",children:s}),a&&i.jsx("span",{className:"field-error",children:a})]})}function wh(e,s){const a=E.useRef(null);return E.useEffect(()=>{if(!e)return;const l=u=>{const d=u.target;a.current?.contains(d)||d instanceof Element&&d.closest(".popover.portal")||s()},c=u=>{u.key==="Escape"&&s()};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",c)}},[e,s]),a}function Kn({label:e,icon:s="more",items:a,align:l="end",side:c="below",trigger:u,triggerVariant:d="ghost"}){const[h,g]=E.useState(!1),m=E.useCallback(()=>g(!1),[]),y=wh(h,m),b=E.useId();return i.jsxs("div",{className:"menu-anchor",ref:y,children:[u?i.jsx("button",{type:"button",className:`btn ${d} sm`,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":b,onClick:()=>g(v=>!v),children:u}):i.jsx(V,{variant:"ghost",size:"xs",icon:s,"aria-label":e,title:e,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":b,onClick:v=>{v.stopPropagation(),g(x=>!x)}}),h&&i.jsx(xh,{anchor:y,side:c,align:l,role:"menu",id:b,className:"menu-scroll",children:a.map((v,x)=>v==="separator"?i.jsx("div",{className:"menu-separator",role:"separator"},`separator-${x}`):i.jsxs("button",{type:"button",role:"menuitem",className:v.destructive?"menu-item destructive":"menu-item",disabled:v.disabled,onClick:w=>{w.stopPropagation(),g(!1),v.onSelect()},children:[v.icon&&i.jsx(ve,{name:v.icon,size:14}),i.jsxs("span",{className:"menu-text",children:[i.jsx("span",{children:v.label}),v.hint&&i.jsx("span",{className:"menu-hint",children:v.hint})]})]},v.label))})]})}function Zt({value:e,options:s,onChange:a,placeholder:l="Select...",label:c,disabled:u,side:d="below"}){const[h,g]=E.useState(!1),[m,y]=E.useState(""),b=E.useCallback(()=>{g(!1),y("")},[]),v=wh(h,b),x=s.find(S=>S.value===e),w=s.filter(S=>`${S.label} ${S.hint??""}`.toLowerCase().includes(m.trim().toLowerCase()));return i.jsxs("div",{className:"menu-anchor",ref:v,children:[i.jsxs("button",{type:"button",className:"btn ghost sm","aria-label":c,title:c,"aria-haspopup":"listbox","aria-expanded":h,disabled:u,onClick:()=>g(S=>!S),children:[i.jsx("span",{className:"truncate",children:x?.label??l}),i.jsx(ve,{name:"chevron-down",size:14})]}),h&&i.jsxs(xh,{anchor:v,side:d,role:"dialog",label:c,className:"listbox-popover",children:[s.length>7&&i.jsx("input",{className:"input listbox-search",autoFocus:!vh(),placeholder:"Search",value:m,onChange:S=>y(S.target.value),"aria-label":`Search ${c}`}),i.jsx("div",{role:"listbox",className:"listbox",children:w.length?w.map(S=>i.jsxs("button",{type:"button",role:"option","aria-selected":S.value===e,disabled:S.disabled,className:"menu-item",onClick:()=>{a(S.value),b()},children:[i.jsx("span",{className:"truncate",children:S.label}),S.hint&&i.jsx("span",{className:"menu-hint",children:S.hint})]},S.value)):i.jsx("div",{className:"menu-label",children:"No matches"})})]})]})}function Aa({value:e,options:s,onChange:a,size:l="sm",label:c}){return i.jsx("div",{className:l==="xs"?"segmented xs":"segmented",role:"group","aria-label":c,children:s.map(u=>i.jsxs("button",{type:"button","aria-pressed":u.value===e,onClick:()=>a(u.value),title:u.hint,children:[u.icon&&i.jsx(ve,{name:u.icon,size:14}),u.label]},u.value))})}function Mr({children:e,label:s="More information"}){const[a,l]=E.useState(!1),c=E.useCallback(()=>l(!1),[]),u=wh(a,c);return i.jsxs("div",{className:"info-tip menu-anchor",ref:u,children:[i.jsx("button",{type:"button","aria-label":s,"aria-expanded":a,onClick:()=>l(d=>!d),children:i.jsx(ve,{name:"info",size:14})}),a&&i.jsx(xh,{anchor:u,side:"below",role:"note",className:"text menu-scroll",style:{width:320},children:e})]})}function an({open:e,title:s,onClose:a,children:l,footer:c,wide:u}){const d=E.useRef(null);return E.useEffect(()=>{const h=d.current;h&&(e&&!h.open&&h.showModal(),!e&&h.open&&h.close())},[e]),i.jsx("dialog",{ref:d,className:u?"sheet wide":"sheet",onClose:a,onCancel:h=>{h.preventDefault(),a()},children:e&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"sheet-header",children:[i.jsx("h2",{className:"sheet-title",children:s}),i.jsx(V,{variant:"ghost",size:"sm",icon:"x","aria-label":"Close",onClick:a})]}),i.jsx("div",{className:"sheet-content",children:l}),c&&i.jsx("div",{className:"sheet-footer",children:c})]})})}function Ge({title:e,message:s,confirmLabel:a="Confirm",cancelLabel:l="Cancel",destructive:c=!1}){const{promise:u,resolve:d}=Promise.withResolvers(),h=document.createElement("div");document.body.appendChild(h);const g=Wb.createRoot(h),m=b=>{d(b),g.unmount(),h.remove()};function y(){const[b,v]=E.useState(!0),x=w=>{v(!1),m(w)};return i.jsx(an,{open:b,title:e,onClose:()=>x(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{onClick:()=>x(!1),children:l}),i.jsx(V,{variant:c?"destructive":"default",onClick:()=>x(!0),autoFocus:!0,children:a})]}),children:i.jsx("div",{className:"muted",children:s})})}return g.render(i.jsx(y,{})),u}function Uo({title:e,subtitle:s,leading:a,actions:l}){return i.jsxs("header",{className:"screen-header",children:[a,i.jsx("h1",{className:"screen-title",children:e}),s&&i.jsx("span",{className:"screen-subtitle",children:s}),l&&i.jsx("div",{className:"actions",children:l})]})}const hy=["#5b7cfa","#e06c4f","#3fa37a","#b56fd8","#d39b2c","#3e9bc2","#d1577d","#7a8c35","#8a6bd1","#c4703a"];function Ei({name:e,id:s}){let a=0;for(const l of s)a=a*31+l.charCodeAt(0)>>>0;return i.jsx("span",{className:"identity",style:{background:hy[a%hy.length]},"aria-hidden":"true",children:(e.trim()[0]??"?").toUpperCase()})}function Kt({value:e}){const s=new Date(e);return i.jsx("time",{dateTime:e,title:Number.isNaN(s.getTime())?e:s.toLocaleString(),children:Number.isNaN(s.getTime())?e:s.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})})}function Zn({value:e}){const s=new Date(e),a=Math.max(0,(Date.now()-s.getTime())/1e3),l=Number.isNaN(a)?e:a<60?"now":a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:a<7*86400?`${Math.floor(a/86400)}d`:s.toLocaleDateString(void 0,{month:"short",day:"numeric"});return i.jsx("time",{dateTime:e,title:Number.isNaN(s.getTime())?e:s.toLocaleString(),children:l})}function To(e){if(e<1e3)return`${Math.round(e)} ms`;const s=Math.round(e/100);if(s<100)return`${(s/10).toFixed(1)} s`;const a=Math.round(e/1e3);return a<60?`${a} s`:a%60?`${Math.floor(a/60)} min ${a%60} s`:`${a/60} min`}function nx({value:e,label:s="Copy"}){const[a,l]=E.useState(!1);return E.useEffect(()=>{if(!a)return;const c=window.setTimeout(()=>l(!1),1500);return()=>window.clearTimeout(c)},[a]),i.jsx(V,{variant:"ghost",size:"xs",icon:a?"check":"copy","aria-label":a?"Copied":s,title:a?"Copied":s,onClick:()=>{navigator.clipboard.writeText(e).then(()=>l(!0))}})}function Vn({value:e,label:s}){return i.jsxs("div",{className:"copy-field",children:[i.jsx("code",{children:e}),i.jsx(nx,{value:e,label:s})]})}const fy="pikibun.workspace",ix=E.createContext(null);function yt(){const e=E.useContext(ix);if(!e)throw new Error("useApp must be used inside AppProvider");return e}function l0({user:e,setUser:s,signOut:a,children:l}){const c=qe("/api/workspaces"),u=qe("/api/sessions"),[d,h]=E.useState(null),[g,m]=E.useState(()=>{try{return localStorage.getItem(fy)??""}catch{return""}}),y=E.useCallback(k=>{m(k);try{localStorage.setItem(fy,k)}catch{}},[]),b=u.refresh,v=d?.activity==="working"||(u.data?.sessions??[]).some(k=>k.status!=="archived"&&k.activity==="working");E.useEffect(()=>{const k=window.setInterval(()=>{document.hidden||b()},v?1e4:3e4);return()=>window.clearInterval(k)},[b,v]);const x=c.data?.workspaces??[],w=x.find(k=>k.id===g)??x[0]??null,S=E.useMemo(()=>[...u.data?.sessions??[]].sort((k,z)=>z.createdAt.localeCompare(k.createdAt)),[u.data]),T={user:e,setUser:s,signOut:a,workspaces:x,workspacesLoading:c.loading,workspacesError:c.error,refreshWorkspaces:c.refresh,currentWorkspace:w,selectWorkspace:y,sessions:S,sessionsLoading:u.loading&&!u.data,refreshSessions:b,liveActivity:d,setLiveActivity:h};return i.jsx(ix.Provider,{value:T,children:l})}const o0=["profile","appearance","hosts","workspaces","admin"];function Ci(e){if(e)try{return decodeURIComponent(e)}catch{return}}function my(e){const s=e.replace(/^#\/?/,"").split("/").filter(Boolean),[a,l,c]=s;if(a==="s"&&Ci(l))return{name:"session",sessionId:Ci(l)};if(a==="sessions")return{name:"sessions"};if(a==="shared"&&Ci(l))return{name:"shared",token:Ci(l)};if(a==="join"&&Ci(l))return{name:"join",token:Ci(l)};if(a==="w"&&Ci(l)&&c==="new")return{name:"new",workspaceId:Ci(l)};if(a==="settings"){const u=o0.find(h=>h===l)??"profile",d=Ci(c);return d?{name:"settings",section:u,id:d}:{name:"settings",section:u}}return{name:"home"}}function Qe(e){switch(e.name){case"home":return"#/";case"sessions":return"#/sessions";case"new":return`#/w/${encodeURIComponent(e.workspaceId)}/new`;case"session":return`#/s/${encodeURIComponent(e.sessionId)}`;case"settings":return`#/settings/${e.section}${e.id?`/${encodeURIComponent(e.id)}`:""}`;case"shared":return`#/shared/${encodeURIComponent(e.token)}`;case"join":return`#/join/${encodeURIComponent(e.token)}`}}function rs(e){const s=Qe(e);window.location.hash!==s&&(window.location.hash=s)}function jh(){const[e,s]=E.useState(()=>my(window.location.hash));return E.useEffect(()=>{const a=()=>s(my(window.location.hash));return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),e}const Yd="pikibun.pendingInvite";function c0(e){try{sessionStorage.setItem(Yd,e)}catch{}}function u0(){try{const e=sessionStorage.getItem(Yd);return sessionStorage.removeItem(Yd),e}catch{return null}}function d0(e){const[s,a]=E.useState(null),[l,c]=E.useState(!0),[u,d]=E.useState(""),[h,g]=E.useState(0),m=E.useCallback(()=>g(y=>y+1),[]);return E.useEffect(()=>{const y=new AbortController;return c(!0),d(""),he("/api/invite",{headers:{"x-invite-token":e},signal:y.signal}).then(b=>{y.signal.aborted||a(b.invite)}).catch(b=>{y.signal.aborted||(a(null),d(Sn(b)))}).finally(()=>{y.signal.aborted||c(!1)}),()=>y.abort()},[e,h]),{invite:s,setInvite:a,loading:l,error:u,refresh:m}}function kh(){const e=qe("/api/join-requests"),s=Ne(),a=e.data?.requests??[],[l,c]=E.useState(!1);E.useEffect(()=>{e.error?c(!0):e.data&&c(!1)},[e.error,e.data]);async function u(d){s.busy||!await Ge({title:"Withdraw request",message:`Stop waiting to join ${d.workspaceName}? You can ask again while you have a working invite link.`,confirmLabel:"Withdraw",destructive:!0})||s.run(async()=>{await he(`/api/join-requests/${ce(d.workspaceId)}`,{method:"DELETE"}),e.refresh()},"Request withdrawn.")}return!a.length&&!s.notice&&!l?null:i.jsxs(Oe,{title:"Your requests to join",info:"Workspaces you asked to join through an invite link. An owner or admin of each accepts or declines you.",children:[l&&!a.length?i.jsx(Re,{children:i.jsx(ke,{variant:"error",title:"Could not load your requests",actions:i.jsx(V,{size:"sm",disabled:e.loading,onClick:e.refresh,children:e.loading?"Trying...":"Try again"}),children:e.error||"Your requests could not be loaded."})}):a.length?a.map(d=>i.jsx(ae,{title:d.workspaceName,hint:i.jsxs(i.Fragment,{children:["Waiting for approval · asked ",i.jsx(Zn,{value:d.createdAt})]}),trailing:i.jsx(V,{variant:"outline",size:"sm",disabled:s.busy,"aria-label":`Withdraw request to join ${d.workspaceName}`,onClick:()=>{u(d)},children:"Withdraw"})},d.workspaceId)):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:"You aren't waiting to join any workspace"})}),(s.error||s.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...s})})]})}function h0({token:e}){const{refreshWorkspaces:s}=yt(),{invite:a,setInvite:l,loading:c,error:u,refresh:d}=d0(e),h=Ne();E.useEffect(()=>{a?.status==="member"&&s()},[a?.status,s]);function g(){h.busy||h.run(async()=>{l((await he("/api/invite",{method:"POST",body:{token:e}})).invite)})}function m(){h.busy||h.run(async()=>{l((await he("/api/invite",{method:"DELETE",headers:{"x-invite-token":e}})).invite)},"Request withdrawn.")}return c&&!a?i.jsx(ai,{}):i.jsx("div",{className:"welcome",children:i.jsxs("div",{className:"welcome-inner",children:[i.jsx(ka,{size:40}),a?i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:a.workspaceName}),a.status==="none"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"You're invited to join this workspace. Ask to join, and an owner or admin reviews your request and chooses your role. Until they accept you, you can't see or do anything in it."}),i.jsx("div",{className:"actions",children:i.jsx(V,{variant:"default",size:"lg",disabled:h.busy,onClick:g,children:h.busy?"Asking...":"Ask to join"})})]}),a.status==="pending"&&i.jsxs(i.Fragment,{children:[i.jsxs(ke,{variant:"info",title:"Waiting for approval",role:"status",children:["Your request to join was sent. Once an owner or admin of ",a.workspaceName," accepts you, the workspace appears in your sidebar."]}),i.jsxs("div",{className:"actions",children:[i.jsx(V,{disabled:h.busy||c,onClick:d,children:"Check again"}),i.jsx(V,{variant:"ghost",disabled:h.busy,onClick:m,children:"Withdraw request"})]})]}),a.status==="member"&&i.jsxs(i.Fragment,{children:[i.jsxs(ke,{variant:"success",title:"You're a member",role:"status",children:["You're a member of ",a.workspaceName,"."]}),i.jsx("div",{className:"actions",children:i.jsx(Bt,{variant:"default",href:a.workspaceId?Qe({name:"settings",section:"workspaces",id:a.workspaceId}):Qe({name:"home"}),children:"Open workspace"})})]}),i.jsx(Ce,{...h})]}):i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:"Join a workspace"}),i.jsx(ke,{variant:"error",title:"Invite link not available",actions:i.jsx(V,{size:"sm",onClick:d,children:"Try again"}),children:u}),i.jsx("div",{className:"actions",children:i.jsx(Bt,{href:Qe({name:"home"}),children:"Go to Pikibun"})}),i.jsx(kh,{})]})]})})}const f0=["read","ask","write","approve","manage"],m0=["admin","collaborator","member","viewer"],sx=["viewer","member","collaborator","admin"],py={textBytes:256*1024,imageBytes:2*1024*1024},zr=["off","minimal","low","medium","high","xhigh","max"];function p0(e,s){return e.includes(s)||s==="read"&&e.some(a=>f0.includes(a))}const g0=["owner","admin","collaborator","member"],No=["owner","admin"],ax=["collaborator","member","viewer"];function y0(e,s){return No.includes(e)?["read","ask","write","manage"]:s!=="workspace"?[]:b0.includes(e)?["read","ask","write"]:["read"]}function Sh(e,s,a){return e===s||a!==void 0&&No.includes(a)}const b0=["owner","admin","collaborator"],x0=["viewer"];function v0(e){return x0.includes(e)?["read"]:null}function Ir(e){return g0.includes(e??"member")}const Bo={viewer:["read"],member:["read","ask"],collaborator:["read","ask","write"],admin:["read","ask","write","approve","manage"]};function rx(e){const s=new Set(e);return s.size&&s.add("read"),sx.find(a=>{const l=Bo[a];return l.length===s.size&&l.every(c=>s.has(c))})??null}function w0(e,s){const a=s?v0(s):null;return!a||Bo[e].every(l=>a.includes(l))}function j0(e,s){return Bo[e].every(a=>p0(s,a))}new TextEncoder;new TextDecoder("utf-8",{fatal:!0});const Lr={count:4,imageBase64:512*1024,totalBase64:720*1024},yd=1568,k0=32*1024*1024;function lx(e){return e&&!e.capabilities.chatImages?"Update the host's connector (npx pikibun@latest connect) to send images.":void 0}function S0(e){const s=Array.from(e.items??[]).filter(a=>a.kind==="file"&&a.type.startsWith("image/")).map(a=>a.getAsFile()).filter(a=>a!==null);return s.length?s:Array.from(e.files??[]).filter(a=>a.type.startsWith("image/"))}function ox(e,s){const[a,l]=E.useState(()=>(s?.()??[]).map(v=>({id:crypto.randomUUID(),file:v}))),[c,u]=E.useState(""),d=E.useRef(a);d.current=a;function h(v){if(e){u(e);return}const x=v.filter(S=>S.size<=k0),w=x.map(S=>({id:crypto.randomUUID(),file:S}));u(x.length<v.length?"An image larger than 32 MiB can't be attached.":d.current.length+w.length>Lr.count?`A message can carry at most ${Lr.count} images.`:""),w.length&&l(S=>[...S,...w].slice(0,Lr.count))}function g(v){const x=S0(v.clipboardData);x.length&&(!e&&!v.clipboardData.types.includes("text/plain")&&v.preventDefault(),h(x))}function m(v){const x=Array.from(v??[]).filter(w=>w.type.startsWith("image/"));x.length?h(x):v?.length&&u("Only images can be attached.")}function y(v){l(x=>x.filter(w=>w.id!==v)),u("")}function b(v){const x=new Set(v.map(w=>w.id));l(w=>w.filter(S=>!x.has(S.id)))}return{images:a,notice:c,paste:g,pick:m,remove:y,sent:b}}function cx({attachments:e,disabled:s}){const a=E.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx(V,{variant:"ghost",size:"sm",icon:"image",className:"composer-attach","aria-label":"Attach images",title:"Attach images",disabled:s,onClick:()=>a.current?.click()}),i.jsx("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,tabIndex:-1,onChange:l=>{e.pick(l.currentTarget.files),l.currentTarget.value=""}})]})}function ux({attachments:e,disabled:s}){return e.images.length?i.jsx("ul",{className:"composer-attachments","aria-label":"Attached images",children:e.images.map((a,l)=>i.jsxs("li",{className:"composer-attachment",children:[i.jsx(C0,{file:a.file,label:`Image ${l+1}`}),i.jsx(V,{variant:"secondary",size:"xs",icon:"x",className:"composer-attachment-remove","aria-label":`Remove image ${l+1}`,title:"Remove image",disabled:s,onClick:()=>e.remove(a.id)})]},a.id))}):null}function C0({file:e,label:s}){const[a,l]=E.useState("");return E.useEffect(()=>{const c=URL.createObjectURL(e);return l(c),()=>URL.revokeObjectURL(c)},[e]),a?i.jsx("img",{src:a,alt:s}):null}const Ch=new Map;function A0(e,s){s.length&&Ch.set(e,s.map(a=>a.file))}function T0(e){return Ch.get(e)??[]}function N0(e){Ch.delete(e)}const gy=e=>Math.ceil(e/3)*4;async function dx(e){const s=Math.min(Lr.imageBase64,Math.floor(Lr.totalBase64/Math.max(1,e.length))),a=[];for(const l of e)a.push(await E0(l.file,s));return a}async function E0(e,s){let a;try{a=await createImageBitmap(e)}catch{throw new Error("A pasted image can't be read. Copy it again, or paste a PNG or JPEG.")}try{const l=await O0(e);if(l&&l!=="image/webp"&&a.width<=yd&&a.height<=yd&&gy(e.size)<=s)return{mimeType:l,data:await yy(e)};let c=Math.min(1,yd/Math.max(a.width,a.height));for(let u=0;u<6;u++,c*=.75){const d=Math.max(1,Math.round(a.width*c)),h=Math.max(1,Math.round(a.height*c)),g=[...l==="image/png"?[{mimeType:"image/png"}]:[],{mimeType:"image/jpeg",quality:.85},{mimeType:"image/jpeg",quality:.7},{mimeType:"image/jpeg",quality:.55}];for(const{mimeType:m,quality:y}of g){const b=await z0(a,d,h,m,y);if(b&&gy(b.size)<=s)return{mimeType:m,data:await yy(b)}}}throw new Error("A pasted image is too large to send, even scaled down.")}finally{a.close()}}function z0(e,s,a,l,c){const u=document.createElement("canvas");u.width=s,u.height=a;const d=u.getContext("2d");return d?(l==="image/jpeg"&&(d.fillStyle="#fff",d.fillRect(0,0,s,a)),d.imageSmoothingQuality="high",d.drawImage(e,0,0,s,a),new Promise(h=>u.toBlob(h,l,c))):Promise.resolve(null)}async function O0(e){const s=new Uint8Array(await e.slice(0,12).arrayBuffer()),a=(l,c)=>String.fromCharCode(...s.subarray(l,c));if(s[0]===137&&a(1,4)==="PNG")return"image/png";if(s[0]===255&&s[1]===216&&s[2]===255)return"image/jpeg";if(a(0,4)==="GIF8")return"image/gif";if(a(0,4)==="RIFF"&&a(8,12)==="WEBP")return"image/webp"}function yy(e){return new Promise((s,a)=>{const l=new FileReader;l.onload=()=>{const c=String(l.result);s(c.slice(c.indexOf(",")+1))},l.onerror=()=>a(new Error("A pasted image can't be read.")),l.readAsDataURL(e)})}const R0={off:"Off",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Max"},yo={read:{label:"Read only",hint:"Inspect files; edits, commands and commits ask the session owner first"},approval:{label:"Ask before acting",hint:"Edits are automatic; commands, commits, GitHub comments and merges need approval"},auto:{label:"Auto-approve",hint:"Commands, commits, pushes, GitHub comments, issues and merges run immediately as the owner, without asking"}};function Ah(e){return e?.capabilities.automaticGitHub===!0}function D0(e,s){const a=Ah(e)?" GitHub comments and new issues are posted, and pull requests merged, as you without asking too: the agent can merge any pull request of this workspace's github.com repositories that GitHub lets you merge, into its base branch. Branch protection and required checks on GitHub still apply.":" GitHub comments and merges still need approval.";return(s?`Commands, commits and pushes the agent writes will run immediately on ${e.name}, an UNSANDBOXED host: commands run directly on the owner's machine with their full user permissions and network access, and no resource limits. Tools outside the agent won't ask either.`:"Commands, commits and pushes the agent writes will run immediately as you, without asking, as will tools outside the agent and commands on a host without resource limits.")+a+M0(e)}function M0(e){return e.capabilities.hostCommands?e.hostCommandAccess==="auto"?` Its owner granted you automatic host commands, so host_bash also runs OUTSIDE the sandbox on ${e.name} without asking, with access to the owner's host files, credentials and network.`:e.hostCommandAccess==="owner"||!e.capabilities.hostGrants?" On your own host, host_bash also runs OUTSIDE the sandbox without asking, with access to your host files, credentials and network. On someone else's host it still needs their approval.":" On your own host, or one whose owner granted you automatic host commands, host_bash also runs OUTSIDE the sandbox without asking, with access to that host's files, credentials and network. Elsewhere it still needs approval.":""}const by="Update the host's connector (npx pikibun@latest connect) to choose model, reasoning and access",Rs=e=>`${e.provider}
10
- ${e.modelId}`;function Sa(e,s){return s&&e?.models.find(a=>a.provider===s.provider&&a.modelId===s.modelId)}function L0(e){const s=e?.thinkingLevels??[];return s.some(a=>a!=="off")?s:[]}function hx(e,s){if(!s||!e?.length||e.includes(s))return s;const a=zr.indexOf(s);return e.filter(c=>zr.indexOf(c)<=a).sort((c,u)=>zr.indexOf(u)-zr.indexOf(c))[0]??(e.includes("off")?"off":e[0])}function Ho(e,s){const a=e?.thinkingLevels;if(!(!e||!a?.length))return s&&a.includes(s)?s:e.thinkingLevel&&a.includes(e.thinkingLevel)?e.thinkingLevel:hx(a,s)}function _0(e,s){return{...e,model:{provider:s.provider,modelId:s.modelId},thinkingLevel:s.thinkingLevel??hx(s.thinkingLevels,e.thinkingLevel)}}function U0(e,s,a){const l=e?.capabilities.chatOptions?Sa(e,s.model??a):void 0;if(!e||!l)return;const c=Ho(l,s.thinkingLevel??(s.model?void 0:a?.thinkingLevel));return{connectorId:e.id,provider:l.provider,modelId:l.modelId,...c?{thinkingLevel:c}:{}}}function B0(e){if(e)try{const s=JSON.parse(e);if(!s||typeof s.connectorId!="string"||typeof s.provider!="string"||typeof s.modelId!="string")return;const a=zr.includes(s.thinkingLevel)?s.thinkingLevel:void 0;return{connectorId:s.connectorId,provider:s.provider,modelId:s.modelId,...a?{thinkingLevel:a}:{}}}catch{return}}function H0(e,s,a,l=()=>!0){const c=s&&Sa(e,s),u=c&&l(c)?c:Sa(e,a);if(!u)return{access:"auto"};const d=u.thinkingLevels?.length?Ho(u,s?.thinkingLevel):u.thinkingLevel;return{model:{provider:u.provider,modelId:u.modelId},thinkingLevel:d,access:"auto"}}function I0(e,s){const a=!e.entries?.some(c=>c.role==="user"),l=e.access??(s&&a?"auto":"approval");return{model:e.agent&&{provider:e.agent.provider,modelId:e.agent.modelId},thinkingLevel:e.agent?.thinkingLevel,access:l==="auto"&&!s?"approval":l}}function $0(e,s,a){if(!(a!=="submit"||e||s.access==="approval"))return`Still checking this session's host, so "${yo[s.access].label}" can't be applied yet. Try again in a moment.`}function q0(e,s){if(e?.capabilities.chatOptions){if(!e.models.length)return`${e.name} offers no models right now.`;if(s.model&&!Sa(e,s.model))return`${e.name} no longer offers ${s.model.modelId}. Choose another model.`}}function fx(e,s,a){if(!e?.capabilities.chatOptions)return;const l=Sa(e,s.model),c={};l&&(c.model={provider:l.provider,modelId:l.modelId});const u=Ho(l,s.thinkingLevel);return u&&(c.thinkingLevel=u),a==="submit"&&(c.access=s.access),a==="submit"&&s.access==="auto"&&Ah(e)&&(c.autoMerge=!0),c}const mx="pikibun.autoApproveConfirmed";function px(e,s){return e?.autoMerge===!0&&!s}const gx="pikibun.lastChat";function G0(){try{return B0(localStorage.getItem(gx))}catch{return}}function yx(e,s,a){const l=U0(e,s,a);if(l)try{localStorage.setItem(gx,JSON.stringify(l))}catch{}}let bx=!1;function xx(){if(bx)return!0;try{return localStorage.getItem(mx)==="1"}catch{return!1}}async function Th(e,s){const a=await Ge({title:"Auto-approve commands?",message:D0(e,s),confirmLabel:"Enable auto-approve",destructive:!0});if(a&&Ah(e)){bx=!0;try{localStorage.setItem(mx,"1")}catch{}}return a}const xy={read:"eye",approval:"shield",auto:"alert"};function vx({host:e,value:s,onChange:a,owner:l,showAccess:c,unsandboxed:u}){if(!e)return null;if(!e.capabilities.chatOptions)return i.jsx("span",{className:"chat-options-hint truncate",title:by,children:by});const d=Sa(e,s.model),h=L0(d),g=Ho(d,s.thinkingLevel);function m(w){const S=e.models.find(T=>Rs(T)===w);S&&a(_0(s,S))}async function y(w){w==="auto"&&s.access!=="auto"&&!await Th(e,u)||a({...s,access:w})}const v=(l?["read","approval","auto"]:["read","approval"]).map(w=>({label:yo[w].label,icon:xy[w],hint:yo[w].hint,destructive:w==="auto",onSelect:()=>{y(w)}})),x=yo[s.access];return i.jsxs(i.Fragment,{children:[i.jsx(Zt,{label:"Model",side:"above",placeholder:"Model",disabled:!e.models.length,value:s.model&&d?Rs(s.model):"",options:e.models.map(w=>({value:Rs(w),label:w.name,hint:w.provider})),onChange:m}),h.length>0&&i.jsx(Zt,{label:"Reasoning",side:"above",placeholder:"Default",value:g&&h.includes(g)?g:"",options:h.map(w=>({value:w,label:R0[w]})),onChange:w=>a({...s,thinkingLevel:w})}),c&&i.jsx("span",{className:s.access==="auto"?"chat-access auto":"chat-access",title:`Access: ${x.label}`,children:i.jsx(Kn,{label:"Access",align:"end",side:"above",items:v,trigger:i.jsxs(i.Fragment,{children:[i.jsx(ve,{name:xy[s.access],size:14}),i.jsx("span",{className:"truncate",children:x.label})]})})})]})}const Ti=e=>`pikibun.draft.${e}`,bo=new Map;function Pd(e){try{const s=localStorage.getItem(Ti(e));if(s!==null)return s;const a=sessionStorage.getItem(Ti(e));return a===null?"":(localStorage.setItem(Ti(e),a),sessionStorage.removeItem(Ti(e)),a)}catch{return""}}function Io(e,s){try{s?localStorage.setItem(Ti(e),s):localStorage.removeItem(Ti(e))}catch{}}function wx(e,s){try{localStorage.getItem(Ti(e))===s&&localStorage.removeItem(Ti(e))}catch{}for(const a of bo.get(e)??[])a(s)}function jx(e){const[s]=E.useState(()=>Pd(e)),[a,l]=E.useState(s);return E.useEffect(()=>{const c=g=>l(m=>m===g?"":m),u=bo.get(e)??new Set;u.add(c),bo.set(e,u);const d=g=>{g.key===Ti(e)&&g.newValue===null&&g.oldValue&&c(g.oldValue)};window.addEventListener("storage",d);const h=Pd(e);return h!==s&&l(g=>g===s?h:g),()=>{u.delete(c),u.size||bo.delete(e),window.removeEventListener("storage",d)}},[e,s]),E.useEffect(()=>{Io(e,a)},[e,a]),[a,l]}function Gr(e){const[s,a]=E.useState(null),[l,c]=E.useState(!!e),[u,d]=E.useState(""),[h,g]=E.useState(0),m=E.useRef(void 0),y=E.useCallback(()=>g(b=>b+1),[]);return E.useEffect(()=>{const b=new AbortController;let v=!1;if(m.current!==e&&(m.current=e,a(null),c(!!e)),d(""),!e)return()=>b.abort();async function x(){if(!v){v=!0;try{const S=await he(e,{signal:b.signal});b.signal.aborted||(a(S),d(""))}catch(S){b.signal.aborted||d(Sn(S))}finally{v=!1,b.signal.aborted||c(!1)}}}x();const w=window.setInterval(()=>{document.hidden||x()},1e4);return()=>{b.abort(),window.clearInterval(w)}},[e,h]),{data:s,loading:l,error:u,refresh:y}}function kx(e){return e.revokedAt?"Revoked":e.online?e.capabilities.unsandboxed?"Unsandboxed":e.capabilities.sandbox?"Online":"Sandbox unverified":"Offline"}function Nh(e){const s=kx(e);return s==="Online"?"success":s==="Unsandboxed"?"danger":"warning"}function Fr({connector:e}){const s=kx(e);return i.jsx(Te,{tone:Nh(e),dot:s==="Online",children:s})}function $o({connector:e}){const{capabilities:s}=e;return i.jsxs(i.Fragment,{children:[s.unsandboxed&&i.jsx(ke,{variant:"error",role:"note",title:"Unsandboxed host",children:"Agent work runs directly on the owner's machine without isolation: approved commands and commits run as their user, with access to their files, credentials and network, and no resource limits. File tools are confined to the session folder by path checks only."}),i.jsx(Ca,{plain:!0,title:"Host details",hint:s.platform||"Unknown platform",children:i.jsxs("div",{className:"stack small muted",children:[i.jsxs("span",{children:["Platform: ",s.platform||"Unknown",".",!e.online&&" Offline: it must reconnect before work can run."]}),i.jsxs("span",{children:["Sandbox: ",s.unsandboxed?"disabled by the host owner.":s.sandbox?"reported by the host; not a security attestation.":"unverified (not necessarily unavailable); the runner checks isolation when preparing each session."," Production shell limits: ",s.productionShell?"reported; still verified per session.":"not confirmed."]}),(e.config?.gitCredentials||s.gitCredentials)&&i.jsx("span",{children:"Git credentials: offered by the host owner for pushes in their own sessions, where a workspace's push access uses the host's Git credentials."}),s.repositoryCache&&i.jsx("span",{children:"Repository cache: this host fetches repositories into its own cache with the host owner's Git credentials, after Pikibun confirms that the session's owner can read them with their own account."}),e.config?.hostSessions&&s.hostConfig&&!s.unsandboxed&&i.jsx("span",{children:"Sessions on the host: its owner may start sessions that run directly on it, without the sandbox."}),e.config&&s.hostConfig&&i.jsxs("span",{children:["Commands: stopped after ",e.config.commandTimeoutSeconds," seconds",e.config.gpu&&s.gpu?`, with the host's GPU (${s.gpu==="dxg"?"WSL /dev/dxg":"render nodes"})`:"","."]}),s.hostMigration&&i.jsx("span",{children:"Moves: this host accepts sessions moved to it from another connected host."}),i.jsx("span",{children:"The runner verifies prerequisites for every session and stops work that fails. Production shell needs verified CPU, memory, process and storage limits. Without them, only the host's owner can let a command run unlimited, in their own sessions and still inside the sandbox."}),i.jsx("span",{children:"Native Windows is unsupported: use Linux or WSL2 with Pi configured there, or macOS without isolation."})]})})]})}function zi(e){return{id:e.userId,githubLogin:e.githubLogin,role:e.role}}function qo(e){return e.githubLogin||e.id}function Mt(e){return e.githubLogin?`${e.githubLogin}(${e.id})`:e.id}function F0(e){const s=new Map(e.map(a=>[a.id,a]));return a=>s.get(a)??{id:a}}function Vd(e,s=[]){const a=e.trim(),l=/^@?[^\s()]*\s*\(\s*([^\s()]+)\s*\)$/.exec(a);if(l)return l[1];const c=a.replace(/^@/,"").toLowerCase(),u=c?s.filter(d=>d.githubLogin?.toLowerCase()===c):[];return u.length===1?u[0].id:a}function Zd(e,s){return typeof e=="string"?Mt(s(e)):Array.isArray(e)?e.map(a=>Zd(a,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,l])=>[a,Zd(l,s)])):e}function Sx(e){return{list:e,person:F0(e)}}function Cx(e){const{user:s}=yt(),a=qe(e?`/api/workspaces/${ce(e)}/members`:null).data?.members;return E.useMemo(()=>{const l=(a??[]).map(zi);return l.some(c=>c.id===s.id)||l.push({id:s.id,githubLogin:s.githubLogin}),Sx(l)},[a,s.id,s.githubLogin])}const Ax=E.createContext(null);function Y0({people:e,children:s}){return i.jsx(Ax.Provider,{value:e,children:s})}function Eh(){const{user:e}=yt(),s=E.useContext(Ax),a=E.useMemo(()=>Sx([{id:e.id,githubLogin:e.githubLogin}]),[e.id,e.githubLogin]);return s??a}function Ni({id:e,you:s}){const{user:a}=yt(),l=Eh().person(e);return i.jsx("span",{title:Mt(l),children:s&&e===a.id?"you":qo(l)})}const Tx=["github","github-enterprise","gitlab","bitbucket","azure-devops","gitea","git"],Hn={github:"GitHub","github-enterprise":"GitHub Enterprise Server",gitlab:"GitLab",bitbucket:"Bitbucket Cloud","azure-devops":"Azure DevOps",gitea:"Gitea / Forgejo",git:"Git server (HTTPS)"},si={github:{fixed:"github.com",default:"github.com"},"github-enterprise":{fixed:null,default:null},gitlab:{fixed:null,default:"gitlab.com"},bitbucket:{fixed:"bitbucket.org",default:"bitbucket.org"},"azure-devops":{fixed:"dev.azure.com",default:"dev.azure.com"},gitea:{fixed:null,default:null},git:{fixed:null,default:null}};function P0(e){return e!=="git"}const co={github:["github-app","owner-account","host-credentials"],"github-enterprise":["github-app","owner-account","host-credentials"],gitlab:["oauth-refresh","owner-account","host-credentials"],bitbucket:["bitbucket-client-credentials","owner-account","host-credentials"],"azure-devops":["entra-federation","owner-account","host-credentials"],gitea:["oauth-refresh","forgejo-integration","owner-account","host-credentials"],git:["owner-account","host-credentials"]},$r={repositories:5,pickerRepositories:3e3};function zh(){return i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Each session starts with an empty worktree, and its agent clones the workspace repositories it needs with Git, through the session's egress proxy: reads use the session owner's access to the repository and pushes go only to the session's own branches. On a host without a sandbox, the host owner's sessions clone with the host's own Git. Sessions created before sessions cloned keep their pinned snapshots, read-only."}),i.jsx("p",{children:"Binding a repository grants teammates no access to your Git accounts. Tokens stay on the server; only a push with your own account, where a workspace's push access uses it, sends yours to your own host. The operator of the host running a session can see its files and prompts, including private source."}),i.jsxs("p",{className:"muted small",children:["Limit: ",$r.repositories," repositories per workspace."]})]})}function Nx(e){const s=qe(e?`/api/workspaces/${ce(e)}/repositories`:null),a=s.data?s.data.sources??s.data.repositories.length:null;return{repositories:s.data?.repositories??null,sourceCount:a,required:s.data?.required??!0,loading:s.loading,error:s.error,refresh:s.refresh}}function Ex(e=!0){const s=qe(e?"/api/git/accounts":null);return{accounts:s.data?.accounts??null,loading:s.loading,error:s.error,refresh:s.refresh}}function Go(e,s){return s===si[e].default?Hn[e]:`${Hn[e]} (${s})`}function Qd(e){return`${Hn[e.provider]} · ${e.host}${e.organization?`/${e.organization}`:""}`}const vy="pikibun.lastStart",V0=80;function Z0(e,s){try{return e().getItem(s)??""}catch{return""}}function Q0(e,s,a){try{a===null?e().removeItem(s):e().setItem(s,a)}catch{}}function X0(e,s){const a=e.trim().split(`
11
- `)[0]?.trim()??"";return Array.from(a).slice(0,V0).join("").trim()||s}const wy=(e,s)=>e.provider===s.provider&&e.modelId===s.modelId;function K0({workspaceId:e,ownerId:s}){const a=Cx(e);return i.jsx(i.Fragment,{children:Mt(a.person(s))})}function zx({workspaceId:e}){const{workspaces:s,workspacesLoading:a,workspacesError:l,refreshWorkspaces:c,currentWorkspace:u,selectWorkspace:d}=yt(),h=s.find(g=>g.id===e)??null;return E.useEffect(()=>{h&&u?.id!==h.id&&d(h.id)},[h,u?.id,d]),h?Ir(h.role)?i.jsx(J0,{workspace:h},h.id):i.jsx("div",{className:"new-session",children:i.jsx(jt,{title:"You're a viewer in this workspace",action:i.jsx(Bt,{variant:"ghost",href:Qe({name:"sessions"}),children:"View sessions"}),children:"Viewers follow the workspace's shared sessions read-only and can't start sessions. Ask a workspace owner or admin for the member role."})}):a?i.jsx(ai,{}):l?i.jsx("div",{className:"new-session",children:i.jsx(ke,{variant:"error",title:"Unable to load workspaces",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:c,children:"Retry"}),children:l})}):i.jsx("div",{className:"new-session",children:i.jsx(jt,{title:"Workspace not found",action:i.jsx(Bt,{variant:"ghost",href:Qe({name:"sessions"}),children:"View sessions"}),children:"You may no longer be a member of this workspace."})})}function J0({workspace:e}){const{user:s,refreshSessions:a}=yt(),l=`/api/workspaces/${ce(e.id)}`,c=qe(`${l}/models`),u=Gr(`${l}/connectors`),d=Nx(e.id),[h]=E.useState(()=>Z0(()=>localStorage,vy)),[g]=E.useState(G0),[m,y]=E.useState(""),[b,v]=E.useState(""),[x,w]=E.useState("workspace"),[S,T]=E.useState(""),[k,z]=E.useState(!1),A=Ne(),I=E.useRef(null),q=c.data?.models,_=u.data?.connectors,F=E.useMemo(()=>{const Se=new Set((q??[]).map(ht=>ht.connectorId));return(_??[]).filter(ht=>Se.has(ht.id)&&!ht.revokedAt).sort((ht,en)=>+(en.ownerId===s.id)-+(ht.ownerId===s.id))},[_,q,s.id]),oe=h.startsWith("model:")?q?.find(Se=>Se.id===h.slice(6)):void 0,ne=F.find(Se=>Se.id===m)??F.find(Se=>Se.id===oe?.connectorId)??F.find(Se=>Se.online)??F[0],B=ne?.id??"",H=Se=>Se&&ne&&ne.models.some(ht=>wy(ht,Se))?q?.find(ht=>ht.connectorId===ne.id&&wy(ht,Se)):void 0,[K,re]=E.useState(null),ie=H(oe)??ne?.models.map(Se=>H(Se)).find(Boolean),G=K?.key===B?K.value:H0(ne,g,ie,Se=>!!H(Se)),U=H(G.model),M=!!(ne&&ne.ownerId!==s.id),W=!!(ne?.online&&!ne.revokedAt&&U&&(ne.ownerId===s.id||ne.workspaceIds.includes(e.id))),ee=d.repositories,O=!!(ee&&!d.error&&!d.loading&&(d.sourceCount||!d.required)),R=!M||!!(ne&&S===ne.id),Q=!!ne?.hostSessions,N=Q&&k,de=!!(ne?.capabilities.unsandboxed||N),ye=!!(U&&ne&&W&&O&&R&&!A.busy),ge=ox(lx(ne)),Me=E.useRef(!1);E.useEffect(()=>{T("")},[B,ne?.ownerId,ee]),E.useEffect(()=>{z(!1)},[B]),E.useLayoutEffect(()=>{const Se=I.current;Se&&(Se.style.height="auto",Se.style.height=`${Se.scrollHeight}px`)},[b]);async function We(Se){if(Se?.preventDefault(),!ye||!U||!ne||Me.current)return;const ht=b.trim(),en=ge.images,An=fx(ne,G,"submit");if(px(An,xx())&&(Me.current=!0,!await Th(ne,de).finally(()=>{Me.current=!1}))){re({key:B,value:{...G,access:"approval"}});return}A.run(async()=>{const tn=await dx(en),Jn=(await he("/api/sessions",{method:"POST",body:{workspaceId:e.id,modelId:U.id,title:X0(b,U.name),visibility:x,...M?{trustedConnectorId:ne.id}:{},...N?{hostEnvironment:!0}:{}}})).session.id;if(Q0(()=>localStorage,vy,`model:${U.id}`),yx(ne,G),ht||tn.length)try{await he(`/api/sessions/${ce(Jn)}/submit`,{method:"POST",body:{content:ht,requestId:crypto.randomUUID(),...An?{options:An}:{},...tn.length?{images:tn}:{}}})}catch{Io(Jn,ht),A0(Jn,en)}a(),rs({name:"session",sessionId:Jn})})}const[pe]=E.useState(()=>tx()),[ut]=E.useState(()=>!ex());function gt(Se){pe&&Se.key==="Enter"&&!Se.shiftKey&&!Se.nativeEvent.isComposing&&(Se.preventDefault(),We())}const Wt=Qe({name:"settings",section:"workspaces",id:e.id});function Cn(){if(d.error)return i.jsx(ke,{variant:"warning",title:"Unable to load sources",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:d.refresh,children:"Retry"}),children:d.error});if(ee&&!d.sourceCount&&d.required)return i.jsx(ke,{variant:"warning",title:"No sources in this workspace",actions:i.jsx(Bt,{variant:"outline",size:"sm",href:Wt,children:"Add a source"}),children:"Sessions need at least one source, such as a repository or a Notion page. Workspace owners and admins add them in workspace settings."});if(c.error)return i.jsx(ke,{variant:"error",title:"Unable to load models",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:c.refresh,children:"Retry"}),children:c.error});if(!c.loading&&!u.loading&&!u.error&&!F.length)return i.jsx(ke,{variant:"info",title:"No host to chat with yet",actions:i.jsx(Bt,{variant:"outline",size:"sm",href:Qe({name:"settings",section:"hosts"}),children:"Pair a host"}),children:"Pair your own Pi to chat with its models, or ask a workspace member to share their host here."});if(!ne||u.loading||!q)return null;const Se=i.jsx(V,{variant:"outline",size:"sm",onClick:u.refresh,children:"Refresh host status"});return u.error?i.jsx(ke,{variant:"warning",title:"Unable to check host",actions:Se,children:u.error}):U?W?M?i.jsx(ke,{variant:"warning",title:`Hosted by ${ne.ownerName}`,children:i.jsxs("label",{className:"check-row new-session-trust",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:S===ne.id,disabled:A.busy,onChange:ht=>T(ht.target.checked?ne.id:"")}),i.jsxs("span",{children:["I trust ",ne.ownerName,"'s host (",ne.name,") to process this session's prompts and repository files, including private repository snapshots; its operator can read them. Repository access uses my GitHub identity, not the host owner's or a workspace admin's. I remain the session owner."]})]})}):null:i.jsx(ke,{variant:"warning",title:`${ne.name} is unavailable`,actions:Se,children:ne.revokedAt?"This host was revoked.":ne.online?"This host isn't shared with this workspace.":"It must reconnect before work can run."}):i.jsxs(ke,{variant:"warning",title:`No model on ${ne.name}`,actions:Se,children:[ne.name," offers no model you can use in this workspace."]})}const kt=[{label:"Workspace",icon:"globe",hint:"Members can view",onSelect:()=>w("workspace")},{label:"Private",icon:"lock",hint:"You, workspace admins and grants",onSelect:()=>w("private")}],In=[{label:"Sandbox",icon:"shield",hint:"Isolated, with the workspace's network access",onSelect:()=>z(!1)},{label:"On this host",icon:"server",hint:"No sandbox: runs as the host's user",onSelect:()=>z(!0)}];return i.jsxs("div",{className:"new-session",children:[i.jsxs("div",{className:"new-session-hero",children:[i.jsx("h1",{className:"new-session-title",children:"What should we work on?"}),i.jsxs("div",{className:"new-session-subtitle",children:[i.jsx(Ei,{name:e.name,id:e.id}),i.jsx("span",{className:"truncate",children:e.name}),i.jsx(Bt,{variant:"ghost",size:"xs",href:Wt,children:"Workspace settings"})]})]}),Cn(),i.jsx("form",{className:"composer-card",onSubmit:We,"aria-busy":A.busy,children:i.jsxs("fieldset",{disabled:A.busy,children:[i.jsx(ux,{attachments:ge,disabled:A.busy}),i.jsx("textarea",{ref:I,className:"composer-input",rows:2,value:b,onChange:Se=>v(Se.target.value),onKeyDown:gt,onPaste:ge.paste,placeholder:"Describe the task","aria-label":"First message",enterKeyHint:pe?"send":"enter",autoFocus:ut}),ge.notice&&i.jsx("p",{className:"composer-notice",role:"status",children:ge.notice}),i.jsxs("div",{className:"composer-toolbar",children:[i.jsx(cx,{attachments:ge,disabled:A.busy}),i.jsx(Zt,{label:"Host",placeholder:c.loading||u.loading?"Loading...":"Choose a host",disabled:!F.length,value:B,options:F.map(Se=>({value:Se.id,label:Se.name,hint:Se.ownerId===s.id?"Your host":`${Se.ownerName}'s host`})),onChange:y}),i.jsx(Kn,{label:"Visibility",align:"start",items:kt,trigger:i.jsxs(i.Fragment,{children:[i.jsx(ve,{name:x==="workspace"?"globe":"lock",size:14}),x==="workspace"?"Workspace":"Private"]})}),Q&&i.jsx(Kn,{label:"Where it runs",align:"start",items:In,trigger:i.jsxs(i.Fragment,{children:[i.jsx(ve,{name:N?"server":"shield",size:14}),N?"On host":"Sandbox"]})}),i.jsx(Mr,{label:"Who can see and do what",children:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:x==="workspace"?"Workspace members can view prompts, output, tool results, and repository content shown in the transcript. Collaborators can also send messages to it, and the workspace's owner and admins manage it; approving tool calls needs an explicit grant.":"Workspace membership alone does not give access to a private session: only the workspace's owner and admins, who manage every session, and people you give a session role open it."}),i.jsx("p",{children:"You are the session owner; the host owner is a separate role. Viewing never grants access to your Git accounts, and visibility does not share your Pi host or local models."})]})}),i.jsx(vx,{host:ne,value:G,onChange:Se=>re({key:B,value:Se}),owner:!0,showAccess:!0,unsandboxed:de}),i.jsx("span",{className:"spacer"}),A.busy&&i.jsx(Ht,{children:"Preparing repositories..."}),i.jsx(V,{type:"submit",variant:"default",icon:"send",className:"composer-send","aria-label":"Start session",title:"Start session",disabled:!ye})]})]})}),i.jsx(Ce,{error:A.error}),N&&ne&&i.jsxs(ke,{variant:"warning",title:M?`Runs on ${ne.ownerName}'s host, without the sandbox`:"Runs on your host, without the sandbox",children:[M&&i.jsxs(i.Fragment,{children:[ne.ownerName," granted you sessions on ",ne.name,". "]}),"Its commands run on ",ne.name," as its user, with its files, credentials, network and GPU, and no resource limits; the workspace's network access doesn't apply. Approve them as you would commands you run yourself: ",M?`people you share the session with can decide them only if they also hold host commands on ${ne.name}.`:"people you share the session with can't decide them unless you granted them host commands."]}),i.jsx("div",{className:"new-session-meta",children:A.busy?i.jsx("span",{role:"status",children:"Resolving repository commits and downloading snapshots to the Pi host's private session cache. The agent starts once every repository is ready."}):i.jsxs(i.Fragment,{children:[ne&&(u.loading||c.loading?i.jsx(Ht,{children:"Checking host..."}):i.jsxs(i.Fragment,{children:[i.jsx(Fr,{connector:ne}),i.jsx("span",{children:ne.name}),i.jsx("span",{children:"·"}),i.jsx("span",{children:U?.name}),i.jsx("span",{children:"·"}),i.jsxs("span",{children:[M?`Hosted by ${ne.ownerName}`:"Your host",", ",ne.workspaceIds.includes(e.id)?"shared with this workspace":"private"]}),i.jsx(Mr,{label:"Host and model details",children:i.jsxs("div",{className:"stack",children:[i.jsxs("p",{children:["Model: ",U?.name," ",i.jsxs("span",{className:"muted",children:[U?.provider," / ",U?.modelId]})]}),i.jsxs("p",{className:"muted small",children:["Host owner: ",i.jsx(K0,{workspaceId:e.id,ownerId:ne.ownerId}),i.jsx("br",{}),"Connection ID: ",ne.id]}),i.jsx("p",{children:"This creates a new session, not access to the host's personal Pi history or old sessions. Your Git account credentials are not sent to the host; model credentials stay on it."})]})})]})),d.loading?i.jsx(Ht,{children:"Loading repositories..."}):ee&&ee.length>0&&i.jsxs(i.Fragment,{children:[ne&&i.jsx("span",{children:"·"}),i.jsx("span",{children:ee.length===1?"1 repository":`${ee.length} repositories`}),i.jsx(Mr,{label:"Repositories for this session",children:i.jsxs("div",{className:"stack",children:[i.jsx("ul",{children:ee.map(Se=>i.jsxs("li",{children:[i.jsx("strong",{children:Se.fullName})," ",i.jsxs("span",{className:"muted",children:["at ",i.jsx("code",{children:Se.ref})]})]},Se.id))}),i.jsx("p",{children:"Repository access uses your connected Git account as session owner, not the host owner's or an admin's. The agent clones the repositories it needs with Git as it works; where it can't run shell commands, the session starts with an empty worktree."}),i.jsx(zh,{})]})}),i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh repositories",onClick:d.refresh})]})]})}),ne&&!A.busy&&i.jsx($o,{connector:ne})]})}async function W0(e,s){const a=await fetch(e,{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)});if(a.ok)return;const l=await a.json().catch(()=>null);throw new Error(typeof l?.error=="string"?l.error:`Sign-in failed (HTTP ${a.status}). Try again.`)}function e1({signedIn:e,signup:s,inviteToken:a}){const l=s==="open"||s==="invite"&&a!==void 0,[c,u]=E.useState("signin"),[d,h]=E.useState(""),[g,m]=E.useState(""),[y,b]=E.useState(""),[v,x]=E.useState(!1),[w,S]=E.useState(""),T=c==="signup";function k(A){if(A.preventDefault(),T&&g!==y){S("The passwords don't match.");return}x(!0),S("");const I={username:d,password:g};T&&a!==void 0&&(I.inviteToken=a),W0(T?"/api/auth/password/signup":"/api/auth/password/login",I).then(e,q=>{S(q instanceof Error?q.message:"Sign-in failed. Try again."),x(!1)})}function z(){u(T?"signin":"signup"),S(""),b("")}return i.jsxs("form",{className:"password-sign-in",onSubmit:k,children:[i.jsx(be,{label:"Username",hint:T?"3 to 39 letters, digits, - and _. Your user ID is password: and this name; it can't be changed.":void 0,children:i.jsx("input",{className:"input",required:!0,value:d,onChange:A=>h(A.target.value),autoComplete:"username",autoCapitalize:"none",spellCheck:!1,maxLength:60})}),i.jsx(be,{label:"Password",hint:T?"At least 12 characters. A few unrelated words make a good one.":void 0,children:i.jsx("input",{className:"input",type:"password",required:!0,value:g,onChange:A=>m(A.target.value),autoComplete:T?"new-password":"current-password",minLength:T?12:1,maxLength:256})}),T&&i.jsx(be,{label:"Confirm password",children:i.jsx("input",{className:"input",type:"password",required:!0,value:y,onChange:A=>b(A.target.value),autoComplete:"new-password",maxLength:256})}),i.jsx(Ce,{error:w}),i.jsx(V,{type:"submit",variant:"default",size:"lg",block:!0,disabled:v,children:v?T?"Creating account...":"Signing in...":T?"Create account":"Sign in"}),l&&i.jsx(V,{variant:"ghost",size:"sm",onClick:z,disabled:v,children:T?"Have an account? Sign in":"New here? Create an account"}),T&&a!==void 0&&i.jsx("p",{className:"field-hint",children:"Creating an account asks to join the workspace that invited you. An owner or admin accepts you before you can see anything in it."})]})}function Oh({open:e,onClose:s}){const{refreshWorkspaces:a,selectWorkspace:l}=yt(),[c,u]=E.useState(""),d=Ne();function h(g){g.preventDefault(),!(d.busy||!c.trim())&&d.run(async()=>{const m=await he("/api/workspaces",{method:"POST",body:{name:c.trim()}});u(""),a(),l(m.workspace.id),s(),rs({name:"new",workspaceId:m.workspace.id})})}return i.jsx(an,{open:e,title:"New workspace",onClose:()=>{d.busy||s()},footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:d.busy,onClick:s,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"new-workspace-form",disabled:d.busy||!c.trim(),children:d.busy?"Creating...":"Create workspace"})]}),children:i.jsxs("form",{id:"new-workspace-form",className:"stack",onSubmit:h,children:[i.jsx(be,{label:"Name",hint:"A shared home for repositories, people, agents and sessions",children:i.jsx("input",{className:"input",required:!0,autoFocus:!0,maxLength:120,value:c,onChange:g=>u(g.target.value),placeholder:"The field studio"})}),i.jsx(Ce,{error:d.error})]})})}const wt="[redacted]",t1=/^[A-Za-z0-9._~+/=:@%^!#,-]+$/,n1=/^(?:\$\{?[A-Za-z_]|\{\{|\{%|%\(|<[^<>]*>$|\*+$|x{3,}$|\.{3}$|\u2026$|your[_-]|(?:null|none|nil|undefined|true|false|empty)$)/i;function zs(e,s){return!!e&&!e.includes(wt)&&!n1.test(e)&&(!s.command||t1.test(e))}function jy(e){return e.length>=6&&(/^\d+$/.test(e)||/\d/.test(e)&&/[A-Za-z]/.test(e)||/[!@#%^*~]/.test(e)||/^[0-9a-f]{16,}$/i.test(e))}const i1=new Set(["string","text","number","integer","float","double","boolean","bytes","buffer","object","unknown","never","char","varchar","null","none","undefined","true","false","enabled","disabled","required","optional","invalid","valid","incorrect","correct","wrong","missing","empty","blank","expired","hidden","masked","redacted","sensitive","case-sensitive","stored","saved","encrypted","hashed","salted","protected","changed","reset","needed","necessary","mandatory","unset","weak","strong","long","short","ready","same","different","given","provided","supplied","generated","random","unique","default","allowed","accepted","rejected","denied","locked","unlocked","visible","shown","cleared","removed","deleted","updated","unchanged","secure","insecure","safe","unsafe","known","special","important","plain","plaintext","ciphertext","encoded","decoded","password","passwords","passwd","passphrase","pass","secret","token","value","values","credential","credentials","hash","input","data","body","form","user","args","params","options","config","field","entry","item","result","response","request","payload","answer","prompt","match"]);function s1(e){return/^[A-Za-z][A-Za-z-]{3,63}$/.test(e)&&!/^[a-z]+[A-Z]|^[A-Z][a-z]+[A-Z]/.test(e)&&!i1.has(e.toLowerCase())}function a1(e,s){let a=s;for(;e[a]===" "||e[a]===" ";)a++;const l=e[a]??"";return l===`
12
- `||l==="\r"?"":l}const uo=/-----BEGIN ((?:[A-Z0-9]{1,16} ){0,4})PRIVATE KEY( BLOCK)?-----/g,bd=/(?:Proc-Type|DEK-Info|Version|Comment|Hash|Charset): [^\r\n\\]{0,256}/y,r1=/^(?:\r?\n|\\r\\n|\\n)/,l1=/(?:\r?\n|\\r\\n|\\n)[ \t]*$/;function o1(e){if(!e.includes("PRIVATE KEY"))return e;let s="",a=0;uo.lastIndex=0;for(let l=uo.exec(e);l;l=uo.exec(e)){const c=l.index+l[0].length,u=`-----END ${l[1]}PRIVATE KEY${l[2]??""}-----`,d=Math.min(e.length,c+65536);let h=c,g=0,m=!0,y=!1;for(;h<d;){if(e.startsWith(u,h)){y=!0;break}const b=e[h];if(b===`
13
- `||b==="\r"){h++,m=!0;continue}if(b==="\\"&&(e[h+1]==="n"||e[h+1]==="r")){h+=2,m=!0;continue}if((b===" "||b===" ")&&m){h++;continue}if(m&&(bd.lastIndex=h,bd.test(e))){h=bd.lastIndex,m=!1;continue}if(/[A-Za-z0-9+/=]/.test(b)){h++,g++,m=!1;continue}break}if(g&&(y||g>=16)){const b=e.slice(c,h);s+=e.slice(a,c)+(r1.exec(b)?.[0]??"")+wt+(l1.exec(b)?.[0]??""),a=h}uo.lastIndex=y?h+u.length:Math.max(h,c)}return s+e.slice(a)}const c1=String.raw`pass(?:word|wd|phrase)|secret|token|api[_-]?key|(?:access|secret|private|auth|account|encryption|signing|master|session)[_-]?key`,u1=/pass|secret|token|key/i,d1=String.raw`"((?:[^"\\\n\x60$]|\\[^\n]){1,8192})"|'([^'\n]{1,8192})'|\\"((?:[^"\\\n\x60$]|\\[^"\n]){1,8192})\\"`,h1=String.raw`([^\s'"\x60,;&|<>(){}\[\]$\\=][^\s'"\x60,;&|<>(){}\[\]$\\]{0,1023})`,f1=new RegExp(String.raw`(${c1})((?:\\?["'])?)([ \t]{0,16}(?::=|=>|[:=])[ \t]{0,16}|[ \t]{1,16}(?:is|was)[ \t]{1,16})(?:${d1}|${h1})`,"gi"),m1=/^[ \t]+(?:is|was)[ \t]+$/i;function p1(e,s){return e.replace(f1,(a,l,c,u,d,h,g,m,y)=>{let b=d??h??g??m??"",v="";if(m===void 0){if(/^\s|\s$/.test(b))return a}else{/[^.]\.$/.test(b)&&(b=b.slice(0,-1),v=".");const w=a1(e,y+a.length);if(u==="="){if(/[),}\]]/.test(w)?!jy(b):/^\d{1,5}$/.test(b))return a}else{const S=m1.test(u);if(!S&&/[;,)}\]|<>({[=?:&]/.test(w))return a;const T=v!==""||w===""||(S?/[.!?,;)"']/.test(w):w==="#");if(!jy(b)&&!(/^pass/i.test(l)&&T&&s1(b)))return a}}if(!zs(b,s))return a;const x=d!==void 0?`"${wt}"`:h!==void 0?`'${wt}'`:g!==void 0?`\\"${wt}\\"`:wt+v;return l+c+u+x})}const g1=new RegExp(String.raw`(--(?:[A-Za-z0-9]{1,32}-){0,4}(?:pass(?:word|wd|phrase)|secret|token|api-?key|(?:access|secret|private|auth)-key))([ \t]{1,16})(?:"([^"\\\n\x60$]{1,1024})"|'([^'\n]{1,1024})'|([^\s'"\x60,;&|<>(){}\[\]$\\-][^\s'"\x60,;&|<>(){}\[\]$\\]{0,1023}))`,"gi");function y1(e,s){return e.includes("--")?e.replace(g1,(a,l,c,u,d,h)=>zs(u??d??h??"",s)?l+c+(u!==void 0?`"${wt}"`:d!==void 0?`'${wt}'`:wt):a):e}const b1=/(\bcurl\b[^\n]{0,2048}?[ \t])(-u|--user)([ \t]{1,16}|=)(["']?)([^\s:'"\x60;&|<>(){}$\\]{1,256}):([^\s'"\x60;&|<>(){}$\\]{1,1024})\4(?![^\s])/g,x1=/\b(machine[ \t\r\n]{1,64}[^\s]{1,253}[ \t\r\n]{1,64}(?:login[ \t\r\n]{1,64}[^\s]{1,253}[ \t\r\n]{1,64})?password[ \t\r\n]{1,64})([^\s]{1,1024})/g,v1=/\b((?:proxy-)?authorization["']?[ \t]{0,16}[:=][ \t]{0,16}["']?(?:bearer|basic|token|bot|digest|negotiate|apikey|sso-key)[ \t]{1,16})([A-Za-z0-9._~+/=:-]{1,4096})/gi,w1=/\b(bearer[ \t]{1,16})([A-Za-z0-9._~+/-]{16,4096}=*)(?![A-Za-z0-9._~+/=-])/gi,j1=/\b([a-z][a-z0-9+.-]{1,30}:\/\/[^\s:/@?#'"<>[\]]{0,256}:)([^\s@/?#'"<>[\]]{1,1024})(?=@)/gi;function k1(e,s){let a=e;return a.includes("curl")&&(a=a.replace(b1,(l,c,u,d,h,g,m)=>/^\d+$/.test(g)&&/^\d+$/.test(m)||!zs(m,s)?l:`${c}${u}${d}${h}${g}:${wt}${h}`)),a.includes("machine")&&(a=a.replace(x1,(l,c,u)=>zs(u,s)?c+wt:l)),/bearer|authorization|basic|token|digest|negotiate|apikey|sso-key|bot/i.test(a)&&(a=a.replace(v1,(l,c,u)=>zs(u,s)?c+wt:l),a=a.replace(w1,(l,c,u)=>/\d/.test(u)&&zs(u,s)?c+wt:l)),a.includes("://")&&(a=a.replace(j1,(l,c,u)=>zs(u,s)?c+wt:l)),a}const S1=[{pattern:new RegExp("(?<![A-Za-z0-9_])(gh[pousr]_)([A-Za-z0-9]{36,251})(?![A-Za-z0-9_])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(github_pat_)([A-Za-z0-9_]{22,255})(?![A-Za-z0-9_])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(gl(?:pat|dt|rt|ptt|cbt|imt|soat|agent|oas|ffct|ft)-)([A-Za-z0-9_.-]{20,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(xox[abposr]-)([A-Za-z0-9-]{10,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(xapp-)([A-Za-z0-9-]{10,255})","g")},{pattern:/(https:\/\/hooks\.slack\.com\/(?:services|workflows|triggers)\/)([A-Za-z0-9/_-]{16,255})/g},{pattern:/(https:\/\/(?:ptb\.|canary\.)?discord(?:app)?\.com\/api\/webhooks\/[0-9]{1,30}\/)([A-Za-z0-9_-]{20,255})/g},{pattern:new RegExp("(?<![A-Za-z0-9])(AKIA|ASIA|ABIA|ACCA)([A-Z0-9]{16})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(sk-(?:proj-|ant-(?:api|admin)[0-9]{2}-|svcacct-|admin-)?)([A-Za-z0-9_-]{20,255})","g"),digit:!0},{pattern:new RegExp("(?<![A-Za-z0-9_-])(AIza)([0-9A-Za-z_-]{35})(?![A-Za-z0-9_-])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(GOCSPX-)([A-Za-z0-9_-]{28})(?![A-Za-z0-9_-])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])((?:sk|rk)_(?:live|test)_)([A-Za-z0-9]{10,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(whsec_)([A-Za-z0-9+/=]{20,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(npm_)([A-Za-z0-9]{36})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(pypi-)([A-Za-z0-9_-]{50,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(hf_)([A-Za-z0-9]{30,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(SG\\.)([A-Za-z0-9_-]{22}\\.[A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(shp(?:at|ca|pa|ss)_)([a-fA-F0-9]{32})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(do[opr]_v1_)([a-f0-9]{64})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(hv[sb]\\.)([A-Za-z0-9_-]{24,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(dp\\.(?:pt|st|sa|ct|scim|audit)\\.)([A-Za-z0-9]{40,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(lin_api_)([A-Za-z0-9]{40})(?![A-Za-z0-9])","g")}],C1=/gh[pousr]_|github_pat_|gl[a-z]{1,5}-|xox[abposr]-|xapp-|hooks\.slack\.com|discord(?:app)?\.com|A(?:KIA|SIA|BIA|CCA)|sk-|AIza|GOCSPX-|[sr]k_(?:live|test)_|whsec_|npm_|pypi-|hf_|SG\.|shp(?:at|ca|pa|ss)_|do[opr]_v1_|hv[sb]\.|dp\.|lin_api_/,A1=new RegExp("(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{8,1024}\\.eyJ[A-Za-z0-9_-]{8,8192}\\.[A-Za-z0-9_-]{8,1024}(?![A-Za-z0-9_-])","g"),T1=/(#\/shared\/)([A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/g;function N1(e){let s=e;if(C1.test(s))for(const{pattern:a,digit:l}of S1)s=s.replace(a,(c,u,d)=>l&&!/\d/.test(d)?c:u+wt);return s.includes("eyJ")&&(s=s.replace(A1,wt)),s.includes("#/shared/")&&(s=s.replace(T1,`$1${wt}`)),s}function E1(e,s={}){if(typeof e!="string"||!e)return e;let a=s.command?e:o1(e);return a=k1(a,s),u1.test(a)&&(a=y1(p1(a,s),s)),N1(a)}function Xd(e){return JSON.stringify(e??"").includes(wt)}const z1=/^([a-z_]+)\(\{.*\}\)$/s,O1=/^ {0,3}(`{3,}|~{3,})(.*)$/s;function R1(e){const s=[];let a="";for(const l of e.split(`
14
- `)){const c=O1.exec(l);if(a){c&&c[1][0]===a[0]&&c[1].length>=a.length&&!c[2].trim()&&(a=""),s.push({line:l});continue}if(c&&!(c[1][0]==="`"&&c[2].includes("`"))){a=c[1],s.push({line:l});continue}const u=z1.exec(l);s.push(u?{line:l,tool:u[1]}:{line:l})}return s}function Fo(e){const s=[],a=[];for(const{line:l,tool:c}of R1(e))c!==void 0?a.push({name:c,line:l}):s.push(l);return{prose:s.join(`
15
- `),calls:a}}const D1=/^\d{1,15}:\d{1,15}$/;function M1(e){if(D1.test(e.id)){if(e.role==="user")return{entryId:e.id,before:!0};if(!(e.role!=="assistant"||Fo(e.text).calls.length>0))return{entryId:e.id,before:!1}}}function L1(e){return e.rewindable===!0}const _1=/^\[image [^\s\]]+\]$/;function ky(e){return e.text.split(`
16
- `).filter(s=>!_1.test(s)).join(`
17
- `).trim()}function U1(e){return e.role==="assistant"?Fo(e.text).prose.trim():e.text}const Kd={size:50},B1={entries:e=>e.id,approvals:e=>e.id,conversations:e=>e.id,queue:e=>e.submissionId},xd=Object.keys(B1),H1=["entries","approvals","conversations"],Sy={items:2e5},I1=/^[0-9a-f]{32}$/;function Cy(e){return typeof e=="string"&&I1.test(e)}function $1(e){const{entries:s,approvals:a,conversations:l,queue:c,...u}=e;return{fields:u,lists:{entries:s,approvals:a,conversations:l,queue:c}}}function q1(e,s){if(!Array.isArray(s)||s.length>Sy.items)throw new Error("Invalid list patch");const a=[];let l=0;for(const c of s){if(typeof c=="number"){if(!Number.isSafeInteger(c)||c===0||l+Math.abs(c)>e.length)throw new Error("Invalid list patch");if(c>0)for(const u=l+c;l<u;l++)a.push(e[l]);else l-=c}else if(c&&typeof c=="object"&&!Array.isArray(c))a.push(c);else throw new Error("Invalid list patch");if(a.length>Sy.items)throw new Error("Invalid list patch")}return a}function Ox(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const s=e;return!Cy(s.base)||!Cy(s.revision)?!1:s.base===s.revision?s.view===void 0&&s.lists===void 0:!!s.view&&typeof s.view=="object"&&!Array.isArray(s.view)&&!!s.lists&&typeof s.lists=="object"&&!Array.isArray(s.lists)}function G1(e,s){if(!Ox(s))throw new Error("Invalid view patch");if(s.base===s.revision)return e;const a=s.lists,l=s.view;if(xd.some(d=>Object.hasOwn(l,d))||Object.keys(a).some(d=>!xd.includes(d)))throw new Error("Invalid view patch");const c=$1(e),u={...l};for(const d of xd)a[d]!==void 0&&(u[d]=q1(c.lists[d]??[],a[d]));if(H1.some(d=>!Array.isArray(u[d])))throw new Error("Invalid view patch");return u}function Jd(e,s){return(e?.entries??[]).filter(a=>a.conversationId===s)}function F1(e,s,a){const l=new Map;for(const c of a.conversations??[]){const u=c.olderEntries??0;if(u<=0||!c.previousEntryId)continue;const d=Jd(s,c.id),h=Jd(a,c.id)[0]?.id,g=d.findIndex(b=>b.id===h),m=g<0?d:d.slice(0,g),y=[...e.get(c.id)??[],...m];!y.length||y.length>u||y.at(-1).id!==c.previousEntryId||l.set(c.id,y)}return l}function Ay(e,s){if(!s.size)return e;const a=[],l=new Set;for(const c of e.entries){const u=c.conversationId,d=u===void 0?void 0:s.get(u);u!==void 0&&d&&!l.has(u)&&(a.push(...d),l.add(u)),a.push(c)}return{...e,entries:a,conversations:e.conversations.map(c=>{const u=s.get(c.id);if(!u)return c;const{olderEntries:d,previousEntryId:h,...g}=c,m=(c.olderEntries??0)-u.length;return m>0?{...g,olderEntries:m}:g})}}function Ty(e,s,a){return s.get(a)?.[0]?.id??Jd(e,a)[0]?.id}const Eo=["queued","admitting","running"],Sr={activeReopenMs:1e3,idleReopenMs:1e4,firstBackoffMs:2e3,maxBackoffMs:6e4,accessCheckMs:3e4};function Y1(e,s,a){const l=new AbortController,c=`/api/sessions/${ce(e)}`;let u=null,d=()=>{},h=0,g=!1,m=!1,y=!1,b,v=!1,x=null,w,S=new Map;const T=new Map,k=()=>!v&&!l.signal.aborted;function z(H,K){S=F1(S,x,H),x=H,w=typeof K=="string"?K:void 0,g=H.busy||(H.queue??[]).some(re=>Eo.includes(re.status))||H.repositories?.status==="preparing",s.view(Ay(H,S)),s.error("")}async function A(H){const K=x,ie=(K?.conversations?.find(M=>M.id===H)?.olderEntries??0)-(S.get(H)?.length??0),G=K&&Ty(K,S,H);if(!k()||!K||ie<=0||!G)return;const U=`conversation=${encodeURIComponent(H)}&before=${encodeURIComponent(G)}&limit=${Kd.size}`;try{const M=await a.api(`${c}/entries?${U}`,{signal:l.signal});if(!k()||!x||Ty(x,S,H)!==G||!Array.isArray(M?.entries))return;const W=S.get(H)??[],ee=new Map(S);ee.set(H,[...M.entries,...W]),S=ee,s.view(Ay(x,S))}catch(M){k()&&s.error(Sn(M))}}function I(){u?.close(),u=null}function q(){v=!0,x=null,w=void 0,S=new Map,I(),d(),s.session(null),s.view(null),s.status("offline")}async function _(H){if(!k())return;if(y){b=b===!0||H;return}y=!0;let K=!0;try{const re=await a.api(c,{signal:l.signal});if(K=!1,!k()||(s.session(re.session),!H))return;const ie=await a.api(`${c}/view`,{signal:l.signal});k()&&z(ie.view,ie.revision)}catch(re){if(!k())return;s.error(Sn(re)),K&&re instanceof Pn&&[401,403,404].includes(re.status)&&q()}finally{if(y=!1,b!==void 0&&k()){const re=b;b=void 0,_(re)}}}function F(H){if(d(),!k()||a.hidden())return;const K=setTimeout(oe,H);d=()=>clearTimeout(K)}function oe(){if(d(),!k()||a.hidden()||u)return;const H=a.openEvents(`${c}/events?since=${w??""}`);u=H;let K=!1;const re=(ie,G)=>{K=!0,h=0,s.status("online"),z(ie,G)};H.addEventListener("view",ie=>{if(u!==H||!k())return;let G;try{G=JSON.parse(String(ie.data))}catch{return}G?.view&&re(G.view,G.revision)}),H.addEventListener("patch",ie=>{if(u!==H||!k())return;let G;try{G=JSON.parse(String(ie.data))?.patch}catch{return}if(!Ox(G)||!x||G.base!==w){w=void 0;return}let U;try{U=G1(x,G)}catch{w=void 0;return}re(U,G.revision)}),H.addEventListener("error",()=>{if(u!==H||(I(),!k()))return;const ie=m;if(m=!1,K)return F(g||ie?Sr.activeReopenMs:Sr.idleReopenMs);h++,s.status("reconnecting"),_(!0),F(Math.min(Sr.maxBackoffMs,Sr.firstBackoffMs*2**(h-1)))})}const ne=a.onVisibilityChange(()=>{if(k()){if(a.hidden()){d(),I();return}_(!1),oe()}}),B=setInterval(()=>{a.hidden()||_(!1)},Sr.accessCheckMs);return _(!0).then(oe),{refresh(){_(!1),u?m=!0:oe()},loadOlder(H){let K=T.get(H);return K||(K=A(H).finally(()=>T.delete(H)),T.set(H,K)),K},stop(){l.abort(),I(),d(),clearInterval(B),ne()}}}const P1={api:he,openEvents:e=>new EventSource(e,{withCredentials:!0}),hidden:()=>document.hidden,onVisibilityChange(e){return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)}};function V1(e,s){return Y1(e,s,P1)}function Z1(e,s){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const Q1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,K1={};function Ny(e,s){return(K1.jsx?X1:Q1).test(e)}const J1=/[ \t\n\f\r]/g;function W1(e){return typeof e=="object"?e.type==="text"?Ey(e.value):!1:Ey(e)}function Ey(e){return e.replace(J1,"")===""}class Yr{constructor(s,a,l){this.normal=a,this.property=s,l&&(this.space=l)}}Yr.prototype.normal={};Yr.prototype.property={};Yr.prototype.space=void 0;function Rx(e,s){const a={},l={};for(const c of e)Object.assign(a,c.property),Object.assign(l,c.normal);return new Yr(a,l,s)}function Wd(e){return e.toLowerCase()}class pn{constructor(s,a){this.attribute=a,this.property=s}}pn.prototype.attribute="";pn.prototype.booleanish=!1;pn.prototype.boolean=!1;pn.prototype.commaOrSpaceSeparated=!1;pn.prototype.commaSeparated=!1;pn.prototype.defined=!1;pn.prototype.mustUseProperty=!1;pn.prototype.number=!1;pn.prototype.overloadedBoolean=!1;pn.prototype.property="";pn.prototype.spaceSeparated=!1;pn.prototype.space=void 0;let eS=0;const _e=_s(),Ot=_s(),eh=_s(),fe=_s(),ot=_s(),Ds=_s(),kn=_s();function _s(){return 2**++eS}const th=Object.freeze(Object.defineProperty({__proto__:null,boolean:_e,booleanish:Ot,commaOrSpaceSeparated:kn,commaSeparated:Ds,number:fe,overloadedBoolean:eh,spaceSeparated:ot},Symbol.toStringTag,{value:"Module"})),vd=Object.keys(th);class Rh extends pn{constructor(s,a,l,c){let u=-1;if(super(s,a),zy(this,"space",c),typeof l=="number")for(;++u<vd.length;){const d=vd[u];zy(this,vd[u],(l&th[d])===th[d])}}}Rh.prototype.defined=!0;function zy(e,s,a){a&&(e[s]=a)}function Ta(e){const s={},a={};for(const[l,c]of Object.entries(e.properties)){const u=new Rh(l,e.transform(e.attributes||{},l),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),s[l]=u,a[Wd(l)]=l,a[Wd(u.attribute)]=l}return new Yr(s,a,e.space)}const Dx=Ta({properties:{ariaActiveDescendant:null,ariaAtomic:Ot,ariaAutoComplete:null,ariaBusy:Ot,ariaChecked:Ot,ariaColCount:fe,ariaColIndex:fe,ariaColSpan:fe,ariaControls:ot,ariaCurrent:null,ariaDescribedBy:ot,ariaDetails:null,ariaDisabled:Ot,ariaDropEffect:ot,ariaErrorMessage:null,ariaExpanded:Ot,ariaFlowTo:ot,ariaGrabbed:Ot,ariaHasPopup:null,ariaHidden:Ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ot,ariaLevel:fe,ariaLive:null,ariaModal:Ot,ariaMultiLine:Ot,ariaMultiSelectable:Ot,ariaOrientation:null,ariaOwns:ot,ariaPlaceholder:null,ariaPosInSet:fe,ariaPressed:Ot,ariaReadOnly:Ot,ariaRelevant:null,ariaRequired:Ot,ariaRoleDescription:ot,ariaRowCount:fe,ariaRowIndex:fe,ariaRowSpan:fe,ariaSelected:Ot,ariaSetSize:fe,ariaSort:null,ariaValueMax:fe,ariaValueMin:fe,ariaValueNow:fe,ariaValueText:null,role:null},transform(e,s){return s==="role"?s:"aria-"+s.slice(4).toLowerCase()}});function Mx(e,s){return s in e?e[s]:s}function Lx(e,s){return Mx(e,s.toLowerCase())}const tS=Ta({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ds,acceptCharset:ot,accessKey:ot,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alpha:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:ot,autoFocus:_e,autoPlay:_e,blocking:ot,capture:null,charSet:null,checked:_e,cite:null,className:ot,closedBy:null,colorSpace:null,cols:fe,colSpan:fe,command:null,commandFor:null,content:null,contentEditable:Ot,controls:_e,controlsList:ot,coords:fe|Ds,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:eh,draggable:Ot,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:ot,height:fe,hidden:eh,high:fe,href:null,hrefLang:null,htmlFor:ot,httpEquiv:ot,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:ot,itemRef:ot,itemScope:_e,itemType:ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:fe,manifest:null,max:null,maxLength:fe,media:null,method:null,min:null,minLength:fe,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:fe,pattern:null,ping:ot,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:ot,required:_e,reversed:_e,rows:fe,rowSpan:fe,sandbox:ot,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootCustomElementRegistry:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shadowRootSerializable:_e,shape:null,size:fe,sizes:null,slot:null,span:fe,spellCheck:Ot,src:null,srcDoc:null,srcLang:null,srcSet:null,start:fe,step:null,style:null,tabIndex:fe,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:Ot,width:fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ot,axis:null,background:null,bgColor:null,border:fe,borderColor:null,bottomMargin:fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:fe,leftMargin:fe,link:null,longDesc:null,lowSrc:null,marginHeight:fe,marginWidth:fe,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:fe,rules:null,scheme:null,scrolling:Ot,standby:null,summary:null,text:null,topMargin:fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:fe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_e,disablePictureInPicture:_e,disableRemotePlayback:_e,exportParts:Ds,part:ot,prefix:null,property:null,results:fe,security:null,unselectable:null},space:"html",transform:Lx}),nS=Ta({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:kn,accentHeight:fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:fe,amplitude:fe,arabicForm:null,ascent:fe,attributeName:null,attributeType:null,azimuth:fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:fe,by:null,calcMode:null,capHeight:fe,className:ot,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:fe,diffuseConstant:fe,direction:null,display:null,dur:null,divisor:fe,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:fe,enableBackground:null,end:null,event:null,exponent:fe,externalResourcesRequired:null,fill:null,fillOpacity:fe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ds,g2:Ds,glyphName:Ds,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:fe,horizOriginX:fe,horizOriginY:fe,id:null,ideographic:fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:fe,k:fe,k1:fe,k2:fe,k3:fe,k4:fe,kernelMatrix:kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:fe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:fe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:fe,overlineThickness:fe,paintOrder:null,panose1:null,path:null,pathLength:fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:fe,pointsAtY:fe,pointsAtZ:fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kn,rev:kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kn,requiredFeatures:kn,requiredFonts:kn,requiredFormats:kn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:fe,specularExponent:fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:fe,strikethroughThickness:fe,string:null,stroke:null,strokeDashArray:kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:fe,strokeOpacity:fe,strokeWidth:null,style:null,surfaceScale:fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kn,tabIndex:fe,tableValues:null,target:null,targetX:fe,targetY:fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:fe,underlineThickness:fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:fe,values:null,vAlphabetic:fe,vMathematical:fe,vectorEffect:null,vHanging:fe,vIdeographic:fe,version:null,vertAdvY:fe,vertOriginX:fe,vertOriginY:fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mx}),_x=Ta({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,s){return"xlink:"+s.slice(5).toLowerCase()}}),Ux=Ta({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Lx}),Bx=Ta({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,s){return"xml:"+s.slice(3).toLowerCase()}}),iS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},sS=/[A-Z]/g,Oy=/-[a-z]/g,aS=/^data[-\w.:]+$/i;function rS(e,s){const a=Wd(s);let l=s,c=pn;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&aS.test(s)){if(s.charAt(4)==="-"){const u=s.slice(5).replace(Oy,oS);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=s.slice(4);if(!Oy.test(u)){let d=u.replace(sS,lS);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}c=Rh}return new c(l,s)}function lS(e){return"-"+e.toLowerCase()}function oS(e){return e.charAt(1).toUpperCase()}const cS=Rx([Dx,tS,_x,Ux,Bx],"html"),Dh=Rx([Dx,nS,_x,Ux,Bx],"svg");function uS(e){return e.join(" ").trim()}var wa={},wd,Ry;function dS(){if(Ry)return wd;Ry=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,s=/\n/g,a=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g,g=`
18
- `,m="/",y="*",b="",v="comment",x="declaration";function w(T,k){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];k=k||{};var z=1,A=1;function I(ie){var G=ie.match(s);G&&(z+=G.length);var U=ie.lastIndexOf(g);A=~U?ie.length-U:A+ie.length}function q(){var ie={line:z,column:A};return function(G){return G.position=new _(ie),ne(),G}}function _(ie){this.start=ie,this.end={line:z,column:A},this.source=k.source}_.prototype.content=T;function F(ie){var G=new Error(k.source+":"+z+":"+A+": "+ie);if(G.reason=ie,G.filename=k.source,G.line=z,G.column=A,G.source=T,!k.silent)throw G}function oe(ie){var G=ie.exec(T);if(G){var U=G[0];return I(U),T=T.slice(U.length),G}}function ne(){oe(a)}function B(ie){var G;for(ie=ie||[];G=H();)G!==!1&&ie.push(G);return ie}function H(){var ie=q();if(!(m!=T.charAt(0)||y!=T.charAt(1))){for(var G=2;b!=T.charAt(G)&&(y!=T.charAt(G)||m!=T.charAt(G+1));)++G;if(G+=2,b===T.charAt(G-1))return F("End of comment missing");var U=T.slice(2,G-2);return A+=2,I(U),T=T.slice(G),A+=2,ie({type:v,comment:U})}}function K(){var ie=q(),G=oe(l);if(G){if(H(),!oe(c))return F("property missing ':'");var U=oe(u),M=ie({type:x,property:S(G[0].replace(e,b)),value:U?S(U[0].replace(e,b)):b});return oe(d),M}}function re(){var ie=[];B(ie);for(var G;G=K();)G!==!1&&(ie.push(G),B(ie));return ie}return ne(),re()}function S(T){return T?T.replace(h,b):b}return wd=w,wd}var Dy;function hS(){if(Dy)return wa;Dy=1;var e=wa&&wa.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(wa,"__esModule",{value:!0}),wa.default=a;const s=e(dS());function a(l,c){let u=null;if(!l||typeof l!="string")return u;const d=(0,s.default)(l),h=typeof c=="function";return d.forEach(g=>{if(g.type!=="declaration")return;const{property:m,value:y}=g;h?c(m,y,g):y&&(u=u||{},u[m]=y)}),u}return wa}var Cr={},My;function fS(){if(My)return Cr;My=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,s=/-([a-z])/g,a=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(m){return!m||a.test(m)||e.test(m)},d=function(m,y){return y.toUpperCase()},h=function(m,y){return"".concat(y,"-")},g=function(m,y){return y===void 0&&(y={}),u(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(c,h):m=m.replace(l,h),m.replace(s,d))};return Cr.camelCase=g,Cr}var Ar,Ly;function mS(){if(Ly)return Ar;Ly=1;var e=Ar&&Ar.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},s=e(hS()),a=fS();function l(c,u){var d={};return!c||typeof c!="string"||(0,s.default)(c,function(h,g){h&&g&&(d[(0,a.camelCase)(h,u)]=g)}),d}return l.default=l,Ar=l,Ar}var pS=mS();const gS=Kb(pS),Hx=Ix("end"),Mh=Ix("start");function Ix(e){return s;function s(a){const l=a&&a.position&&a.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function yS(e){const s=Mh(e),a=Hx(e);if(s&&a)return{start:s,end:a}}function _r(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?_y(e.position):"start"in e||"end"in e?_y(e):"line"in e||"column"in e?nh(e):""}function nh(e){return Uy(e&&e.line)+":"+Uy(e&&e.column)}function _y(e){return nh(e&&e.start)+"-"+nh(e&&e.end)}function Uy(e){return e&&typeof e=="number"?e:1}class Jt extends Error{constructor(s,a,l){super(),typeof a=="string"&&(l=a,a=void 0);let c="",u={},d=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof s=="string"?c=s:!u.cause&&s&&(d=!0,c=s.message,u.cause=s),!u.ruleId&&!u.source&&typeof l=="string"){const g=l.indexOf(":");g===-1?u.ruleId=l:(u.source=l.slice(0,g),u.ruleId=l.slice(g+1))}if(!u.place&&u.ancestors&&u.ancestors){const g=u.ancestors[u.ancestors.length-1];g&&(u.place=g.position)}const h=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=h?h.line:void 0,this.name=_r(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Jt.prototype.file="";Jt.prototype.name="";Jt.prototype.reason="";Jt.prototype.message="";Jt.prototype.stack="";Jt.prototype.column=void 0;Jt.prototype.line=void 0;Jt.prototype.ancestors=void 0;Jt.prototype.cause=void 0;Jt.prototype.fatal=void 0;Jt.prototype.place=void 0;Jt.prototype.ruleId=void 0;Jt.prototype.source=void 0;const Lh={}.hasOwnProperty,bS=new Map,xS=/[A-Z]/g,vS=new Set(["table","tbody","thead","tfoot","tr"]),wS=new Set(["td","th"]),$x="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jS(e,s){if(!s||s.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=s.filePath||void 0;let l;if(s.development){if(typeof s.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=zS(a,s.jsxDEV)}else{if(typeof s.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof s.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=ES(a,s.jsx,s.jsxs)}const c={Fragment:s.Fragment,ancestors:[],components:s.components||{},create:l,elementAttributeNameCase:s.elementAttributeNameCase||"react",evaluater:s.createEvaluater?s.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:s.ignoreInvalidStyle||!1,passKeys:s.passKeys!==!1,passNode:s.passNode||!1,schema:s.space==="svg"?Dh:cS,stylePropertyNameCase:s.stylePropertyNameCase||"dom",tableCellAlignToStyle:s.tableCellAlignToStyle!==!1},u=qx(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function qx(e,s,a){if(s.type==="element")return kS(e,s,a);if(s.type==="mdxFlowExpression"||s.type==="mdxTextExpression")return SS(e,s);if(s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement")return AS(e,s,a);if(s.type==="mdxjsEsm")return CS(e,s);if(s.type==="root")return TS(e,s,a);if(s.type==="text")return NS(e,s)}function kS(e,s,a){const l=e.schema;let c=l;s.tagName.toLowerCase()==="svg"&&l.space==="html"&&(c=Dh,e.schema=c),e.ancestors.push(s);const u=Fx(e,s.tagName,!1),d=OS(e,s);let h=Uh(e,s);return vS.has(s.tagName)&&(h=h.filter(function(g){return typeof g=="string"?!W1(g):!0})),Gx(e,d,u,s),_h(d,h),e.ancestors.pop(),e.schema=l,e.create(s,u,d,a)}function SS(e,s){if(s.data&&s.data.estree&&e.evaluater){const l=s.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}qr(e,s.position)}function CS(e,s){if(s.data&&s.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(s.data.estree);qr(e,s.position)}function AS(e,s,a){const l=e.schema;let c=l;s.name==="svg"&&l.space==="html"&&(c=Dh,e.schema=c),e.ancestors.push(s);const u=s.name===null?e.Fragment:Fx(e,s.name,!0),d=RS(e,s),h=Uh(e,s);return Gx(e,d,u,s),_h(d,h),e.ancestors.pop(),e.schema=l,e.create(s,u,d,a)}function TS(e,s,a){const l={};return _h(l,Uh(e,s)),e.create(s,e.Fragment,l,a)}function NS(e,s){return s.value}function Gx(e,s,a,l){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(s.node=l)}function _h(e,s){if(s.length>0){const a=s.length>1?s:s[0];a&&(e.children=a)}}function ES(e,s,a){return l;function l(c,u,d,h){const m=Array.isArray(d.children)?a:s;return h?m(u,d,h):m(u,d)}}function zS(e,s){return a;function a(l,c,u,d){const h=Array.isArray(u.children),g=Mh(l);return s(c,u,d,h,{columnNumber:g?g.column-1:void 0,fileName:e,lineNumber:g?g.line:void 0},void 0)}}function OS(e,s){const a={};let l,c;for(c in s.properties)if(c!=="children"&&Lh.call(s.properties,c)){const u=DS(e,c,s.properties[c]);if(u){const[d,h]=u;e.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&wS.has(s.tagName)?l=h:a[d]=h}}if(l){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return a}function RS(e,s){const a={};for(const l of s.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const d=u.expression;d.type;const h=d.properties[0];h.type,Object.assign(a,e.evaluater.evaluateExpression(h.argument))}else qr(e,s.position);else{const c=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const h=l.value.data.estree.body[0];h.type,u=e.evaluater.evaluateExpression(h.expression)}else qr(e,s.position);else u=l.value===null?!0:l.value;a[c]=u}return a}function Uh(e,s){const a=[];let l=-1;const c=e.passKeys?new Map:bS;for(;++l<s.children.length;){const u=s.children[l];let d;if(e.passKeys){const g=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(g){const m=c.get(g)||0;d=g+"-"+m,c.set(g,m+1)}}const h=qx(e,u,d);h!==void 0&&a.push(h)}return a}function DS(e,s,a){const l=rS(e.schema,s);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=l.commaSeparated?Z1(a):uS(a)),l.property==="style"){let c=typeof a=="object"?a:MS(e,String(a));return e.stylePropertyNameCase==="css"&&(c=LS(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&l.space?iS[l.property]||l.property:l.attribute,a]}}function MS(e,s){try{return gS(s,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const l=a,c=new Jt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=$x+"#cannot-parse-style-attribute",c}}function Fx(e,s,a){let l;if(!a)l={type:"Literal",value:s};else if(s.includes(".")){const c=s.split(".");let u=-1,d;for(;++u<c.length;){const h=Ny(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(u&&h.type==="Literal"),optional:!1}:h}l=d}else l=Ny(s)&&!/^[a-z]/.test(s)?{type:"Identifier",name:s}:{type:"Literal",value:s};if(l.type==="Literal"){const c=l.value;return Lh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(l);qr(e)}function qr(e,s){const a=new Jt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:s,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=$x+"#cannot-handle-mdx-estrees-without-createevaluater",a}function LS(e){const s={};let a;for(a in e)Lh.call(e,a)&&(s[_S(a)]=e[a]);return s}function _S(e){let s=e.replace(xS,US);return s.slice(0,3)==="ms-"&&(s="-"+s),s}function US(e){return"-"+e.toLowerCase()}const jd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},BS={};function Bh(e,s){const a=BS,l=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,c=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Yx(e,l,c)}function Yx(e,s,a){if(HS(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(s&&"alt"in e&&e.alt)return e.alt;if("children"in e)return By(e.children,s,a)}return Array.isArray(e)?By(e,s,a):""}function By(e,s,a){const l=[];let c=-1;for(;++c<e.length;)l[c]=Yx(e[c],s,a);return l.join("")}function HS(e){return!!(e&&typeof e=="object")}const Hy=document.createElement("i");function Hh(e){const s="&"+e+";";Hy.innerHTML=s;const a=Hy.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===s?!1:a}function Qn(e,s,a,l){const c=e.length;let u=0,d;if(s<0?s=-s>c?0:c+s:s=s>c?c:s,a=a>0?a:0,l.length<1e4)d=Array.from(l),d.unshift(s,a),e.splice(...d);else for(a&&e.splice(s,a);u<l.length;)d=l.slice(u,u+1e4),d.unshift(s,0),e.splice(...d),u+=1e4,s+=1e4}function Bn(e,s){return e.length>0?(Qn(e,e.length,0,s),e):s}const Iy={}.hasOwnProperty;function Px(e){const s={};let a=-1;for(;++a<e.length;)IS(s,e[a]);return s}function IS(e,s){let a;for(a in s){const c=(Iy.call(e,a)?e[a]:void 0)||(e[a]={}),u=s[a];let d;if(u)for(d in u){Iy.call(c,d)||(c[d]=[]);const h=u[d];$S(c[d],Array.isArray(h)?h:h?[h]:[])}}}function $S(e,s){let a=-1;const l=[];for(;++a<s.length;)(s[a].add==="after"?e:l).push(s[a]);Qn(e,0,0,l)}function Vx(e,s){const a=Number.parseInt(e,s);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=ls(/[A-Za-z]/),Xt=ls(/[\dA-Za-z]/),qS=ls(/[#-'*+\--9=?A-Z^-~]/);function zo(e){return e!==null&&(e<32||e===127)}const ih=ls(/\d/),GS=ls(/[\dA-Fa-f]/),FS=ls(/[!-/:-@[-`{-~]/);function ze(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const Yo=ls(new RegExp("\\p{P}|\\p{S}","u")),Ms=ls(/\s/);function ls(e){return s;function s(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Na(e){const s=[];let a=-1,l=0,c=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&Xt(e.charCodeAt(a+1))&&Xt(e.charCodeAt(a+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const h=e.charCodeAt(a+1);u<56320&&h>56319&&h<57344?(d=String.fromCharCode(u,h),c=1):d="�"}else d=String.fromCharCode(u);d&&(s.push(e.slice(l,a),encodeURIComponent(d)),l=a+c+1,d=""),c&&(a+=c,c=0)}return s.join("")+e.slice(l)}function Je(e,s,a,l){const c=l?l-1:1/0;let u=0;return d;function d(g){return Ie(g)?(e.enter(a),h(g)):s(g)}function h(g){return Ie(g)&&u++<c?(e.consume(g),h):(e.exit(a),s(g))}}function Zx(e,s,a,l,c,u){let d=0;return h;function h(y){return Ie(y)?(e.enter(l),g(y)):m(y)}function g(y){return Ie(y)&&d<u?(e.consume(y),d++,g):(e.exit(l),m(y))}function m(y){return d>=c?s(y):a(y)}}const YS={tokenize:PS};function PS(e){const s=e.attempt(this.parser.constructs.contentInitial,l,c);let a;return s;function l(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Je(e,s,"linePrefix")}function c(h){return e.enter("paragraph"),u(h)}function u(h){const g=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=g),a=g,d(h)}function d(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return ze(h)?(e.consume(h),e.exit("chunkText"),u):(e.consume(h),d)}}let Oo=class{constructor(){this.index=new Map,this.map=[]}add(s,a,l){$y(this,s,a,l,!1)}addBefore(s,a,l){$y(this,s,a,l,!0)}consume(s){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const l=[];for(;a>0;)a-=1,l.push(s.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),s.length=this.map[a][0];l.push(s.slice()),s.length=0;let c=l.pop();for(;c;){for(const u of c)s.push(u);c=l.pop()}this.map.length=0,this.index.clear()}};function $y(e,s,a,l,c){if(a===0&&l.length===0)return;const u=e.index.get(s);if(u){u[1]+=a,c?(l.push(...u[2]),u[2]=l):u[2].push(...l);return}const d=[s,a,l];e.map.push(d),e.index.set(s,d)}const VS={tokenize:ZS},qy={tokenize:QS};function ZS(e){const s=this,a=[];let l=0,c,u,d;return h;function h(A){if(l<a.length){const I=a[l];return s.containerState=I[1],e.attempt(I[0].continuation,g,m)(A)}return m(A)}function g(A){if(l++,s.containerState._closeFlow){s.containerState._closeFlow=void 0,c&&z();const I=s.events.length;let q=I,_;for(;q--;)if(s.events[q][0]==="exit"&&s.events[q][1].type==="chunkFlow"){_=s.events[q][1].end;break}k(l);let F=I;for(;F<s.events.length;)s.events[F][1].end={..._},F++;const oe=new Oo;return oe.add(q+1,0,s.events.slice(I)),oe.add(I,F-I,[]),oe.consume(s.events),m(A)}return h(A)}function m(A){if(l===a.length){if(!c)return v(A);if(c.currentConstruct&&c.currentConstruct.concrete)return w(A);s.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return s.containerState={},e.check(qy,y,b)(A)}function y(A){return c&&z(),k(l),v(A)}function b(A){return s.parser.lazy[s.now().line]=l!==a.length,d=s.now().offset,w(A)}function v(A){return s.containerState={},e.attempt(qy,x,w)(A)}function x(A){return l++,a.push([s.currentConstruct,s.containerState]),v(A)}function w(A){if(A===null){c&&z(),k(0),e.consume(A);return}return c=c||s.parser.flow(s.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),S(A)}function S(A){if(A===null){T(e.exit("chunkFlow"),!0),k(0),e.consume(A);return}return ze(A)?(e.consume(A),T(e.exit("chunkFlow")),l=0,s.interrupt=void 0,h):(e.consume(A),S)}function T(A,I){const q=s.sliceStream(A);if(I&&q.push(null),A.previous=u,u&&(u.next=A),u=A,c.defineSkip(A.start),c.write(q),s.parser.lazy[A.start.line]){let _=c.events.length;for(;_--;)if(c.events[_][1].start.offset<d&&(!c.events[_][1].end||c.events[_][1].end.offset>d))return;const F=s.events.length;let oe=F,ne,B;for(;oe--;)if(s.events[oe][0]==="exit"&&s.events[oe][1].type==="chunkFlow"){if(ne){B=s.events[oe][1].end;break}ne=!0}for(k(l),_=F;_<s.events.length;)s.events[_][1].end={...B},_++;const H=new Oo;H.add(oe+1,0,s.events.slice(F)),H.add(F,_-F,[]),H.consume(s.events)}}function k(A){let I=a.length;for(;I-- >A;){const q=a[I];s.containerState=q[1],q[0].exit.call(s,e)}a.length=A}function z(){c.write([null]),u=void 0,c=void 0,s.containerState._closeFlow=void 0}}function QS(e,s,a){return Je(e,e.attempt(this.parser.constructs.document,s,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ro(e){if(e===null||ct(e)||Ms(e))return 1;if(Yo(e))return 2}function Po(e,s,a){const l=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!l.includes(u)&&(s=u(s,a),l.push(u))}return s}const sh={name:"attention",resolveAll:XS,tokenize:KS};function XS(e,s){let a=-1,l;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){let c=a;for(;c--;)if(e[c][0]==="exit"&&e[c][1].type==="attentionSequence"&&e[c][1]._open&&s.sliceSerialize(e[c][1]).charCodeAt(0)===s.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[c][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[c][1].end.offset-e[c][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;const u=e[c][1].end.offset-e[c][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1,d={...e[c][1].end},h={...e[a][1].start};Gy(d,-u),Gy(h,u);const g={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[c][1].end}},m={type:u>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:h},y={type:u>1?"strongText":"emphasisText",start:{...e[c][1].end},end:{...e[a][1].start}},b={type:u>1?"strong":"emphasis",start:{...g.start},end:{...m.end}};e[c][1].end={...g.start},e[a][1].start={...m.end},l=[],e[c][1].end.offset-e[c][1].start.offset&&(l=Bn(l,[["enter",e[c][1],s],["exit",e[c][1],s]])),l=Bn(l,[["enter",b,s],["enter",g,s],["exit",g,s],["enter",y,s]]),l=Bn(l,Po(s.parser.constructs.insideSpan.null,e.slice(c+1,a),s)),l=Bn(l,[["exit",y,s],["enter",m,s],["exit",m,s],["exit",b,s]]);let v=0;e[a][1].end.offset-e[a][1].start.offset&&(v=2,l=Bn(l,[["enter",e[a][1],s],["exit",e[a][1],s]])),Qn(e,c-1,a-c+3,l),a=c+l.length-v-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function KS(e,s){const a=this.parser.constructs.attentionMarkers.null,l=this.previous,c=Ro(l);let u;return d;function d(g){return u=g,e.enter("attentionSequence"),h(g)}function h(g){if(g===u)return e.consume(g),h;const m=e.exit("attentionSequence"),y=Ro(g),b=!y||y===2&&c||a.includes(g)&&g!==42&&g!==95,v=!c||c===2&&y||a.includes(l)&&l!==42&&l!==95;return m._open=!!(u===42?b:b&&(c||!v)),m._close=!!(u===42?v:v&&(y||!b)),s(g)}}function Gy(e,s){e.column+=s,e.offset+=s,e._bufferIndex+=s}const JS={name:"autolink",tokenize:WS};function WS(e,s,a){let l=0;return c;function c(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(x){return sn(x)?(e.consume(x),d):x===64?a(x):m(x)}function d(x){return x===43||x===45||x===46||Xt(x)?(l=1,h(x)):m(x)}function h(x){return x===58?(e.consume(x),l=0,g):(x===43||x===45||x===46||Xt(x))&&l++<32?(e.consume(x),h):(l=0,m(x))}function g(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),s):x===null||x===32||x===60||zo(x)?a(x):(e.consume(x),g)}function m(x){return x===64?(e.consume(x),y):qS(x)?(e.consume(x),m):a(x)}function y(x){return Xt(x)?b(x):a(x)}function b(x){return x===46?(e.consume(x),l=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),s):v(x)}function v(x){if((x===45||Xt(x))&&l++<63){const w=x===45?v:b;return e.consume(x),w}return a(x)}}const Pr={partial:!0,tokenize:eC};function eC(e,s,a){return l;function l(u){return Ie(u)?Je(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||ze(u)?s(u):a(u)}}const Qx={continuation:{tokenize:nC},exit:iC,name:"blockQuote",tokenize:tC};function tC(e,s,a){const l=this;return c;function c(d){if(d===62){const h=l.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return Ie(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),s):(e.exit("blockQuotePrefix"),s(d))}}function nC(e,s,a){const l=this;return c;function c(d){return Ie(d)?Je(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(Qx,s,a)(d)}}function iC(e){e.exit("blockQuote")}const Xx={name:"characterEscape",tokenize:sC};function sC(e,s,a){return l;function l(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return FS(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),s):a(u)}}const Kx={name:"characterReference",tokenize:aC};function aC(e,s,a){const l=this;let c=0,u,d;return h;function h(b){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),g}function g(b){return b===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(b),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),u=31,d=Xt,y(b))}function m(b){return b===88||b===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(b),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=GS,y):(e.enter("characterReferenceValue"),u=7,d=ih,y(b))}function y(b){if(b===59&&c){const v=e.exit("characterReferenceValue");return d===Xt&&!Hh(l.sliceSerialize(v))?a(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),s)}return d(b)&&c++<u?(e.consume(b),y):a(b)}}const ah={partial:!0,tokenize:rC};function rC(e,s,a){const l=this;return c;function c(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return l.parser.lazy[l.now().line]?a(d):s(d)}}const Fy={concrete:!0,name:"codeFenced",tokenize:lC};function lC(e,s,a){const l=this,c={partial:!0,tokenize:q};let u=0,d=0,h;return g;function g(_){return m(_)}function m(_){const F=l.events[l.events.length-1];return u=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,h=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(_)}function y(_){return _===h?(d++,e.consume(_),y):d<3?a(_):(e.exit("codeFencedFenceSequence"),Ie(_)?Je(e,b,"whitespace")(_):b(_))}function b(_){return _===null||ze(_)?(e.exit("codeFencedFence"),l.interrupt?s(_):e.check(ah,S,I)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===null||ze(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),b(_)):Ie(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Je(e,x,"whitespace")(_)):_===96&&_===h?a(_):(e.consume(_),v)}function x(_){return _===null||ze(_)?b(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(_))}function w(_){return _===null||ze(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),b(_)):_===96&&_===h?a(_):(e.consume(_),w)}function S(_){return e.attempt(c,I,T)(_)}function T(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),k}function k(_){return u>0&&Ie(_)?Je(e,z,"linePrefix",u+1)(_):z(_)}function z(_){return _===null||ze(_)?e.check(ah,S,I)(_):(e.enter("codeFlowValue"),A(_))}function A(_){return _===null||ze(_)?(e.exit("codeFlowValue"),z(_)):(e.consume(_),A)}function I(_){return e.exit("codeFenced"),s(_)}function q(_,F,oe){let ne=0;return B;function B(G){return _.enter("lineEnding"),_.consume(G),_.exit("lineEnding"),H}function H(G){return _.enter("codeFencedFence"),Ie(G)?Je(_,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):K(G)}function K(G){return G===h?(_.enter("codeFencedFenceSequence"),re(G)):oe(G)}function re(G){return G===h?(ne++,_.consume(G),re):ne>=d?(_.exit("codeFencedFenceSequence"),Ie(G)?Je(_,ie,"whitespace")(G):ie(G)):oe(G)}function ie(G){return G===null||ze(G)?(_.exit("codeFencedFence"),F(G)):oe(G)}}}const kd={name:"codeIndented",tokenize:cC},oC={partial:!0,tokenize:uC};function cC(e,s,a){return l;function l(h){return e.enter("codeIndented"),Zx(e,c,a,"linePrefix",4,4)(h)}function c(h){return h===null?d(h):ze(h)?e.attempt(oC,c,d)(h):(e.enter("codeFlowValue"),u(h))}function u(h){return h===null||ze(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),u)}function d(h){return e.exit("codeIndented"),s(h)}}function uC(e,s,a){const l=this;return c;function c(d){return l.parser.lazy[l.now().line]?a(d):ze(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):Zx(e,s,u,"linePrefix",4,4)(d)}function u(d){return ze(d)?c(d):a(d)}}const dC={name:"codeText",previous:fC,resolve:hC,tokenize:mC};function hC(e){let s=e.length-4,a=3,l,c;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[s][1].type==="lineEnding"||e[s][1].type==="space")){for(l=a;++l<s;)if(e[l][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[s][1].type="codeTextPadding",a+=2,s-=2;break}}for(l=a-1,s++;++l<=s;)c===void 0?l!==s&&e[l][1].type!=="lineEnding"&&(c=l):(l===s||e[l][1].type==="lineEnding")&&(e[c][1].type="codeTextData",l!==c+2&&(e[c][1].end=e[l-1][1].end,e.splice(c+2,l-c-2),s-=l-c-2,l=c+2),c=void 0);return e}function fC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function mC(e,s,a){let l=0,c,u;return d;function d(b){return e.enter("codeText"),e.enter("codeTextSequence"),h(b)}function h(b){return b===96?(e.consume(b),l++,h):(e.exit("codeTextSequence"),g(b))}function g(b){return b===null?a(b):b===32?(e.enter("space"),e.consume(b),e.exit("space"),g):b===96?(u=e.enter("codeTextSequence"),c=0,y(b)):ze(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("codeTextData"),m(b))}function m(b){return b===null||b===32||b===96||ze(b)?(e.exit("codeTextData"),g(b)):(e.consume(b),m)}function y(b){return b===96?(e.consume(b),c++,y):c===l?(e.exit("codeTextSequence"),e.exit("codeText"),s(b)):(u.type="codeTextData",m(b))}}class pC{constructor(s){this.left=s?[...s]:[],this.right=[]}get(s){if(s<0||s>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+s+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return s<this.left.length?this.left[s]:this.right[this.right.length-s+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(s,a){const l=a??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(s,l):s>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-s+this.left.length).reverse():this.left.slice(s).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(s,a,l){const c=a||0;this.setCursor(Math.trunc(s));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return l&&Tr(this.left,l),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(s){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(s)}pushMany(s){this.setCursor(Number.POSITIVE_INFINITY),Tr(this.left,s)}unshift(s){this.setCursor(0),this.right.push(s)}unshiftMany(s){this.setCursor(0),Tr(this.right,s.reverse())}setCursor(s){if(!(s===this.left.length||s>this.left.length&&this.right.length===0||s<0&&this.left.length===0))if(s<this.left.length){const a=this.left.splice(s,Number.POSITIVE_INFINITY);Tr(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-s,Number.POSITIVE_INFINITY);Tr(this.left,a.reverse())}}}function Tr(e,s){let a=0;if(s.length<1e4)e.push(...s);else for(;a<s.length;)e.push(...s.slice(a,a+1e4)),a+=1e4}function Jx(e){const s={};let a=-1,l,c,u,d,h,g,m;const y=new pC(e);for(;++a<y.length;){for(;a in s;)a=s[a];if(l=y.get(a),a&&l[1].type==="chunkFlow"&&y.get(a-1)[1].type==="listItemPrefix"&&(g=l[1]._tokenizer.events,u=0,u<g.length&&g[u][1].type==="lineEndingBlank"&&(u+=2),u<g.length&&g[u][1].type==="content"))for(;++u<g.length&&g[u][1].type!=="content";)g[u][1].type==="chunkText"&&(g[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(s,gC(y,a)),a=s[a],m=!0);else if(l[1]._container){for(u=a,c=void 0;u--;)if(d=y.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(c&&(y.get(c)[1].type="lineEndingBlank"),d[1].type="lineEnding",c=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;c&&(l[1].end={...y.get(c)[1].start},h=y.slice(c,a),h.unshift(l),y.splice(c,a-c+1,h))}}return Qn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function gC(e,s){const a=e.get(s)[1],l=e.get(s)[2];let c=s-1;const u=[];let d=a._tokenizer;d||(d=l.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,g=[],m={};let y,b,v=-1,x=a,w=0,S=0;const T=[S];for(;x;){for(;e.get(++c)[1]!==x;);u.push(c),x._tokenizer||(y=l.sliceStream(x),x.next||y.push(null),b&&d.defineSkip(x.start),x._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(y),x._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),b=x,x=x.next}for(x=a;++v<h.length;)h[v][0]==="exit"&&h[v-1][0]==="enter"&&h[v][1].type===h[v-1][1].type&&h[v][1].start.line!==h[v][1].end.line&&(S=v+1,T.push(S),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(d.events=[],x?(x._tokenizer=void 0,x.previous=void 0):T.pop(),v=T.length;v--;){const k=h.slice(T[v],T[v+1]),z=u.pop();g.push([z,z+k.length-1]),e.splice(z,2,k)}for(g.reverse(),v=-1;++v<g.length;)m[w+g[v][0]]=w+g[v][1],w+=g[v][1]-g[v][0]-1;return m}const yC={resolve:xC,tokenize:vC},bC={partial:!0,tokenize:wC};function xC(e){return Jx(e),e}function vC(e,s){let a;return l;function l(h){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),c(h)}function c(h){return h===null?u(h):ze(h)?e.check(bC,d,u)(h):(e.consume(h),c)}function u(h){return e.exit("chunkContent"),e.exit("content"),s(h)}function d(h){return e.consume(h),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,c}}function wC(e,s,a){const l=this;return c;function c(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Je(e,u,"linePrefix")}function u(d){if(d===null||ze(d))return a(d);const h=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?s(d):e.interrupt(l.parser.constructs.flow,a,s)(d)}}function Wx(e,s,a,l,c,u,d,h,g){const m=g||Number.POSITIVE_INFINITY;let y=0;return b;function b(k){return k===60?(e.enter(l),e.enter(c),e.enter(u),e.consume(k),e.exit(u),v):k===null||k===32||k===41||zo(k)?a(k):(e.enter(l),e.enter(d),e.enter(h),e.enter("chunkString",{contentType:"string"}),S(k))}function v(k){return k===62?(e.enter(u),e.consume(k),e.exit(u),e.exit(c),e.exit(l),s):(e.enter(h),e.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(e.exit("chunkString"),e.exit(h),v(k)):k===null||k===60||ze(k)?a(k):(e.consume(k),k===92?w:x)}function w(k){return k===60||k===62||k===92?(e.consume(k),x):x(k)}function S(k){return!y&&(k===null||k===41||ct(k))?(e.exit("chunkString"),e.exit(h),e.exit(d),e.exit(l),s(k)):y<m&&k===40?(e.consume(k),y++,S):k===41?(e.consume(k),y--,S):k===null||k===32||k===40||zo(k)?a(k):(e.consume(k),k===92?T:S)}function T(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function ev(e,s,a,l,c,u){const d=this;let h=0,g;return m;function m(x){return e.enter(l),e.enter(c),e.consume(x),e.exit(c),e.enter(u),y}function y(x){return h>999||x===null||x===91||x===93&&!g||x===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?a(x):x===93?(e.exit(u),e.enter(c),e.consume(x),e.exit(c),e.exit(l),s):ze(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),b(x))}function b(x){return x===null||x===91||x===93||ze(x)||h++>999?(e.exit("chunkString"),y(x)):(e.consume(x),g||(g=!Ie(x)),x===92?v:b)}function v(x){return x===91||x===92||x===93?(e.consume(x),h++,b):b(x)}}function tv(e,s,a,l,c,u){let d;return h;function h(v){return v===34||v===39||v===40?(e.enter(l),e.enter(c),e.consume(v),e.exit(c),d=v===40?41:v,g):a(v)}function g(v){return v===d?(e.enter(c),e.consume(v),e.exit(c),e.exit(l),s):(e.enter(u),m(v))}function m(v){return v===d?(e.exit(u),g(d)):v===null?a(v):ze(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Je(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===d||v===null||ze(v)?(e.exit("chunkString"),m(v)):(e.consume(v),v===92?b:y)}function b(v){return v===d||v===92?(e.consume(v),y):y(v)}}function Ur(e,s){let a;return l;function l(c){return ze(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a=!0,l):Ie(c)?Je(e,l,a?"linePrefix":"lineSuffix")(c):s(c)}}const jC={name:"definition",tokenize:SC},kC={partial:!0,tokenize:CC};function SC(e,s,a){const l=this;let c;return u;function u(x){return e.enter("definition"),d(x)}function d(x){return ev.call(l,e,h,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function h(x){return c=Xn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),g):a(x)}function g(x){return ct(x)?Ur(e,m)(x):m(x)}function m(x){return Wx(e,y,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(kC,b,b)(x)}function b(x){return Ie(x)?Je(e,v,"whitespace")(x):v(x)}function v(x){return x===null||ze(x)?(e.exit("definition"),l.parser.defined.push(c),s(x)):a(x)}}function CC(e,s,a){return l;function l(h){return ct(h)?Ur(e,c)(h):a(h)}function c(h){return tv(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function u(h){return Ie(h)?Je(e,d,"whitespace")(h):d(h)}function d(h){return h===null||ze(h)?s(h):a(h)}}const AC={name:"hardBreakEscape",tokenize:TC};function TC(e,s,a){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return ze(u)?(e.exit("hardBreakEscape"),s(u)):a(u)}}const NC={name:"headingAtx",resolve:EC,tokenize:zC};function EC(e,s){let a=e.length-2,l=3;if(e[l][1].type==="whitespace"&&(l+=2),a-2>l&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(l===a-1||a-4>l&&e[a-2][1].type==="whitespace")&&(a-=l+1===a?2:4),a>l){const c={type:"atxHeadingText",start:e[l][1].start,end:e[a][1].end},u={type:"chunkText",start:e[l][1].start,end:e[a][1].end,contentType:"text"};Qn(e,l,a-l+1,[["enter",c,s],["enter",u,s],["exit",u,s],["exit",c,s]])}return e}function zC(e,s,a){let l=0;return c;function c(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),d(y)}function d(y){return y===35&&l++<6?(e.consume(y),d):y===null||ct(y)?(e.exit("atxHeadingSequence"),h(y)):a(y)}function h(y){return y===35?(e.enter("atxHeadingSequence"),g(y)):y===null||ze(y)?(e.exit("atxHeading"),s(y)):Ie(y)?Je(e,h,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function g(y){return y===35?(e.consume(y),g):(e.exit("atxHeadingSequence"),h(y))}function m(y){return y===null||y===35||ct(y)?(e.exit("atxHeadingText"),h(y)):(e.consume(y),m)}}const OC=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Yy=["pre","script","style","textarea"],RC={concrete:!0,name:"htmlFlow",resolveTo:MC,tokenize:LC},DC={partial:!0,tokenize:_C};function MC(e){let s=e.length;for(;s--&&!(e[s][0]==="enter"&&e[s][1].type==="htmlFlow"););return s>1&&e[s-2][1].type==="linePrefix"&&(e[s][1].start=e[s-2][1].start,e[s+1][1].start=e[s-2][1].start,e.splice(s-2,2)),e}function LC(e,s,a){const l=this;let c,u,d,h,g;return m;function m(N){return y(N)}function y(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),b}function b(N){return N===33?(e.consume(N),v):N===47?(e.consume(N),u=!0,S):N===63?(e.consume(N),c=3,l.interrupt?s:O):sn(N)?(e.consume(N),d=String.fromCharCode(N),T):a(N)}function v(N){return N===45?(e.consume(N),c=2,x):N===91?(e.consume(N),c=5,h=0,w):sn(N)?(e.consume(N),c=4,l.interrupt?s:O):a(N)}function x(N){return N===45?(e.consume(N),l.interrupt?s:O):a(N)}function w(N){const de="CDATA[";return N===de.charCodeAt(h++)?(e.consume(N),h===de.length?l.interrupt?s:K:w):a(N)}function S(N){return sn(N)?(e.consume(N),d=String.fromCharCode(N),T):a(N)}function T(N){if(N===null||N===47||N===62||ct(N)){const de=N===47,ye=d.toLowerCase();return!de&&!u&&Yy.includes(ye)?(c=1,l.interrupt?s(N):K(N)):OC.includes(d.toLowerCase())?(c=6,de?(e.consume(N),k):l.interrupt?s(N):K(N)):(c=7,l.interrupt&&!l.parser.lazy[l.now().line]?a(N):u?z(N):A(N))}return N===45||Xt(N)?(e.consume(N),d+=String.fromCharCode(N),T):a(N)}function k(N){return N===62?(e.consume(N),l.interrupt?s:K):a(N)}function z(N){return Ie(N)?(e.consume(N),z):B(N)}function A(N){return N===47?(e.consume(N),B):N===58||N===95||sn(N)?(e.consume(N),I):Ie(N)?(e.consume(N),A):B(N)}function I(N){return N===45||N===46||N===58||N===95||Xt(N)?(e.consume(N),I):q(N)}function q(N){return N===61?(e.consume(N),_):Ie(N)?(e.consume(N),q):A(N)}function _(N){return N===null||N===60||N===61||N===62||N===96?a(N):N===34||N===39?(e.consume(N),g=N,F):Ie(N)?(e.consume(N),_):oe(N)}function F(N){return N===g?(e.consume(N),g=null,ne):N===null||ze(N)?a(N):(e.consume(N),F)}function oe(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||ct(N)?q(N):(e.consume(N),oe)}function ne(N){return N===47||N===62||Ie(N)?A(N):a(N)}function B(N){return N===62?(e.consume(N),H):a(N)}function H(N){return N===null||ze(N)?K(N):Ie(N)?(e.consume(N),H):a(N)}function K(N){return N===45&&c===2?(e.consume(N),U):N===60&&c===1?(e.consume(N),M):N===62&&c===4?(e.consume(N),R):N===63&&c===3?(e.consume(N),O):N===93&&c===5?(e.consume(N),ee):ze(N)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(DC,Q,re)(N)):N===null||ze(N)?(e.exit("htmlFlowData"),re(N)):(e.consume(N),K)}function re(N){return e.check(ah,ie,Q)(N)}function ie(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),G}function G(N){return N===null||ze(N)?re(N):(e.enter("htmlFlowData"),K(N))}function U(N){return N===45?(e.consume(N),O):K(N)}function M(N){return N===47?(e.consume(N),d="",W):K(N)}function W(N){if(N===62){const de=d.toLowerCase();return Yy.includes(de)?(e.consume(N),R):K(N)}return sn(N)&&d.length<8?(e.consume(N),d+=String.fromCharCode(N),W):K(N)}function ee(N){return N===93?(e.consume(N),O):K(N)}function O(N){return N===62?(e.consume(N),R):N===45&&c===2?(e.consume(N),O):K(N)}function R(N){return N===null||ze(N)?(e.exit("htmlFlowData"),Q(N)):(e.consume(N),R)}function Q(N){return e.exit("htmlFlow"),s(N)}}function _C(e,s,a){return l;function l(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(Pr,s,a)}}const UC={name:"htmlText",tokenize:BC};function BC(e,s,a){const l=this;let c,u,d;return h;function h(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),g}function g(O){return O===33?(e.consume(O),m):O===47?(e.consume(O),q):O===63?(e.consume(O),A):sn(O)?(e.consume(O),oe):a(O)}function m(O){return O===45?(e.consume(O),y):O===91?(e.consume(O),u=0,w):sn(O)?(e.consume(O),z):a(O)}function y(O){return O===45?(e.consume(O),x):a(O)}function b(O){return O===null?a(O):O===45?(e.consume(O),v):ze(O)?(d=b,M(O)):(e.consume(O),b)}function v(O){return O===45?(e.consume(O),x):b(O)}function x(O){return O===62?U(O):O===45?v(O):b(O)}function w(O){const R="CDATA[";return O===R.charCodeAt(u++)?(e.consume(O),u===R.length?S:w):a(O)}function S(O){return O===null?a(O):O===93?(e.consume(O),T):ze(O)?(d=S,M(O)):(e.consume(O),S)}function T(O){return O===93?(e.consume(O),k):S(O)}function k(O){return O===62?U(O):O===93?(e.consume(O),k):S(O)}function z(O){return O===null||O===62?U(O):ze(O)?(d=z,M(O)):(e.consume(O),z)}function A(O){return O===null?a(O):O===63?(e.consume(O),I):ze(O)?(d=A,M(O)):(e.consume(O),A)}function I(O){return O===62?U(O):A(O)}function q(O){return sn(O)?(e.consume(O),_):a(O)}function _(O){return O===45||Xt(O)?(e.consume(O),_):F(O)}function F(O){return ze(O)?(d=F,M(O)):Ie(O)?(e.consume(O),F):U(O)}function oe(O){return O===45||Xt(O)?(e.consume(O),oe):O===47||O===62||ct(O)?ne(O):a(O)}function ne(O){return O===47?(e.consume(O),U):O===58||O===95||sn(O)?(e.consume(O),B):ze(O)?(d=ne,M(O)):Ie(O)?(e.consume(O),ne):U(O)}function B(O){return O===45||O===46||O===58||O===95||Xt(O)?(e.consume(O),B):H(O)}function H(O){return O===61?(e.consume(O),K):ze(O)?(d=H,M(O)):Ie(O)?(e.consume(O),H):ne(O)}function K(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(e.consume(O),c=O,re):ze(O)?(d=K,M(O)):Ie(O)?(e.consume(O),K):(e.consume(O),ie)}function re(O){return O===c?(e.consume(O),c=void 0,G):O===null?a(O):ze(O)?(d=re,M(O)):(e.consume(O),re)}function ie(O){return O===null||O===34||O===39||O===60||O===61||O===96?a(O):O===47||O===62||ct(O)?ne(O):(e.consume(O),ie)}function G(O){return O===47||O===62||ct(O)?ne(O):a(O)}function U(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),s):a(O)}function M(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),W}function W(O){return Ie(O)?Je(e,ee,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):ee(O)}function ee(O){return e.enter("htmlTextData"),d(O)}}const Ih={name:"labelEnd",resolveAll:qC,resolveTo:GC,tokenize:FC},HC={tokenize:YC},IC={tokenize:PC},$C={tokenize:VC};function qC(e){let s=-1;const a=[];for(;++s<e.length;){const l=e[s][1];if(a.push(e[s]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const c=l.type==="labelImage"?4:2;l.type="data",s+=c}}return e.length!==a.length&&Qn(e,0,e.length,a),e}function GC(e,s){let a=e.length,l=0,c,u,d;for(;a--;){const y=e[a][1];if(c){if(y.type==="link"||y.type==="labelLink"&&y._inactive)break;e[a][0]==="enter"&&y.type==="labelLink"&&(y._inactive=!0)}else if(u){if(e[a][0]==="enter"&&(y.type==="labelImage"||y.type==="labelLink")&&!y._balanced&&(c=a,y.type!=="labelLink")){l=2;break}}else y.type==="labelEnd"&&(u=a)}const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},g={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},m={type:"labelText",start:{...e[c+l+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",h,s],["enter",g,s]],d=Bn(d,e.slice(c+1,c+l+3)),d=Bn(d,[["enter",m,s]]),d=Bn(d,Po(s.parser.constructs.insideSpan.null,e.slice(c+l+4,u-3),s)),d=Bn(d,[["exit",m,s],e[u-2],e[u-1],["exit",g,s]]),d=Bn(d,e.slice(u+1)),d=Bn(d,[["exit",h,s]]),Qn(e,c,e.length,d),e}function FC(e,s,a){const l=this,c=l._labelStarts;let u,d;if(c){for(;c.length>0&&c[c.length-1]._balanced;)c.pop();u=c[c.length-1]}return h;function h(v){return u?u._inactive?b(v):(d=l.parser.defined.includes(Xn(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),g):a(v)}function g(v){return v===40?e.attempt(HC,y,d?y:b)(v):v===91?e.attempt(IC,y,d?m:b)(v):d?y(v):b(v)}function m(v){return e.attempt($C,y,b)(v)}function y(v){return c.pop(),s(v)}function b(v){return u._balanced=!0,a(v)}}function YC(e,s,a){return l;function l(b){return e.enter("resource"),e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),c}function c(b){return ct(b)?Ur(e,u)(b):u(b)}function u(b){return b===41?y(b):Wx(e,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return ct(b)?Ur(e,g)(b):y(b)}function h(b){return a(b)}function g(b){return b===34||b===39||b===40?tv(e,m,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):y(b)}function m(b){return ct(b)?Ur(e,y)(b):y(b)}function y(b){return b===41?(e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),e.exit("resource"),s):a(b)}}function PC(e,s,a){const l=this;return c;function c(h){return ev.call(l,e,u,d,"reference","referenceMarker","referenceString")(h)}function u(h){return l.parser.defined.includes(Xn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?s(h):a(h)}function d(h){return a(h)}}function VC(e,s,a){return l;function l(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),s):a(u)}}const ZC={name:"labelStartImage",resolveAll:Ih.resolveAll,tokenize:QC};function QC(e,s,a){const l=this;let c;return u;function u(g){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(g),e.exit("labelImageMarker"),d}function d(g){return g===91?(e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),c=e.exit("labelImage"),h):a(g)}function h(g){return g===94&&"_hiddenFootnoteSupport"in l.parser.constructs?a(g):(l._labelStarts=l._labelStarts||[],l._labelStarts.push(c),s(g))}}const XC={name:"labelStartLink",resolveAll:Ih.resolveAll,tokenize:KC};function KC(e,s,a){const l=this;let c;return u;function u(h){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),c=e.exit("labelLink"),d}function d(h){return h===94&&"_hiddenFootnoteSupport"in l.parser.constructs?a(h):(l._labelStarts=l._labelStarts||[],l._labelStarts.push(c),s(h))}}const Sd={name:"lineEnding",tokenize:JC};function JC(e,s){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Je(e,s,"linePrefix")}}const xo={name:"thematicBreak",tokenize:WC};function WC(e,s,a){let l=0,c;return u;function u(m){return e.enter("thematicBreak"),d(m)}function d(m){return c=m,h(m)}function h(m){return m===c?(e.enter("thematicBreakSequence"),g(m)):l>=3&&(m===null||ze(m))?(e.exit("thematicBreak"),s(m)):a(m)}function g(m){return m===c?(e.consume(m),l++,g):(e.exit("thematicBreakSequence"),Ie(m)?Je(e,h,"whitespace")(m):h(m))}}const fn={continuation:{tokenize:i2},exit:a2,name:"list",tokenize:n2},e2={partial:!0,tokenize:r2},t2={partial:!0,tokenize:s2};function n2(e,s,a){const l=this,c=l.events[l.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,d=0;return h;function h(x){const w=l.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||x===l.containerState.marker:ih(x)){if(l.containerState.type||(l.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(xo,a,m)(x):m(x);if(!l.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),g(x)}return a(x)}function g(x){return ih(x)&&++d<10?(e.consume(x),g):(!l.interrupt||d<2)&&(l.containerState.marker?x===l.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),m(x)):a(x)}function m(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||x,e.check(Pr,l.interrupt?a:y,e.attempt(e2,v,b))}function y(x){return l.containerState.initialBlankLine=!0,u++,v(x)}function b(x){return Ie(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),v):a(x)}function v(x){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,s(x)}}function i2(e,s,a){const l=this;return l.containerState._closeFlow=void 0,e.check(Pr,c,u);function c(h){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Je(e,s,"listItemIndent",l.containerState.size+1)(h)}function u(h){return l.containerState.furtherBlankLines||!Ie(h)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(h)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(t2,s,d)(h))}function d(h){return l.containerState._closeFlow=!0,l.interrupt=void 0,Je(e,e.attempt(fn,s,a),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function s2(e,s,a){const l=this;return Je(e,c,"listItemIndent",l.containerState.size+1);function c(u){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?s(u):a(u)}}function a2(e){e.exit(this.containerState.type)}function r2(e,s,a){const l=this;return Je(e,c,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const d=l.events[l.events.length-1];return!Ie(u)&&d&&d[1].type==="listItemPrefixWhitespace"?s(u):a(u)}}const Py={name:"setextUnderline",resolveTo:l2,tokenize:o2};function l2(e,s){const a=new Oo;let l=e.length,c,u,d;for(;l--;)if(e[l][0]==="enter"){if(e[l][1].type==="content"){c=l;break}e[l][1].type==="paragraph"&&(u=l)}else e[l][1].type==="content"&&a.add(l,1,[]),!d&&e[l][1].type==="definition"&&(d=l);const h={type:"setextHeading",start:{...e[c][1].start},end:{...e[e.length-1][1].end}};return e[u][1].type="setextHeadingText",d?(a.add(u,0,[["enter",h,s]]),a.add(d+1,0,[["exit",e[c][1],s]]),e[c][1].end={...e[d][1].end}):e[c][1]=h,a.add(e.length,0,[["exit",h,s]]),a.consume(e),e}function o2(e,s,a){const l=this;let c;return u;function u(m){let y=l.events.length,b;for(;y--;)if(l.events[y][1].type!=="lineEnding"&&l.events[y][1].type!=="linePrefix"&&l.events[y][1].type!=="content"){b=l.events[y][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||b)?(e.enter("setextHeadingLine"),c=m,d(m)):a(m)}function d(m){return e.enter("setextHeadingLineSequence"),h(m)}function h(m){return m===c?(e.consume(m),h):(e.exit("setextHeadingLineSequence"),Ie(m)?Je(e,g,"lineSuffix")(m):g(m))}function g(m){return m===null||ze(m)?(e.exit("setextHeadingLine"),s(m)):a(m)}}const c2={tokenize:u2};function u2(e){const s=this,a=e.attempt(Pr,l,e.attempt(this.parser.constructs.flowInitial,c,Je(e,e.attempt(this.parser.constructs.flow,c,e.attempt(yC,c)),"linePrefix")));return a;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),s.currentConstruct=void 0,a}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s.currentConstruct=void 0,a}}const d2={resolveAll:iv()},h2=nv("string"),f2=nv("text");function nv(e){return{resolveAll:iv(e==="text"?m2:void 0),tokenize:s};function s(a){const l=this,c=this.parser.constructs[e],u=a.attempt(c,d,h);return d;function d(y){return m(y)?u(y):h(y)}function h(y){if(y===null){a.consume(y);return}return a.enter("data"),a.consume(y),g}function g(y){return m(y)?(a.exit("data"),u(y)):(a.consume(y),g)}function m(y){if(y===null)return!0;const b=c[y];let v=-1;if(b)for(;++v<b.length;){const x=b[v];if(!x.previous||x.previous.call(l,l.previous))return!0}return!1}}}function iv(e){return s;function s(a,l){let c=-1,u;for(;++c<=a.length;)u===void 0?a[c]&&a[c][1].type==="data"&&(u=c,c++):(!a[c]||a[c][1].type!=="data")&&(c!==u+2&&(a[u][1].end=a[c-1][1].end,a.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(a,l):a}}function m2(e,s){const a=new Oo;let l=0;for(;++l<=e.length;)if((l===e.length||e[l][1].type==="lineEnding")&&e[l-1][1].type==="data"){const c=e[l-1][1],u=s.sliceStream(c);let d=u.length,h=-1,g=0,m;for(;d--;){const y=u[d];if(typeof y=="string"){for(h=y.length;y.charCodeAt(h-1)===32;)g++,h--;if(h)break;h=-1}else if(y===-2)m=!0,g++;else if(y!==-1){d++;break}}if(s._contentTypeTextTrailing&&l===e.length&&(g=0),g){const y={type:l===e.length||m||g<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?h:c.start._bufferIndex+h,_index:c.start._index+d,line:c.end.line,column:c.end.column-g,offset:c.end.offset-g},end:{...c.end}};c.end={...y.start},c.start.offset===c.end.offset?Object.assign(c,y):a.add(l,0,[["enter",y,s],["exit",y,s]])}l++}return a.consume(e),e}const p2={42:fn,43:fn,45:fn,48:fn,49:fn,50:fn,51:fn,52:fn,53:fn,54:fn,55:fn,56:fn,57:fn,62:Qx},g2={91:jC},y2={[-2]:kd,[-1]:kd,32:kd},b2={35:NC,42:xo,45:[Py,xo],60:RC,61:Py,95:xo,96:Fy,126:Fy},x2={38:Kx,92:Xx},v2={[-5]:Sd,[-4]:Sd,[-3]:Sd,33:ZC,38:Kx,42:sh,60:[JS,UC],91:XC,92:[AC,Xx],93:Ih,95:sh,96:dC},w2={null:[sh,d2]},j2={null:[42,95]},k2={null:[]},S2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:j2,contentInitial:g2,disable:k2,document:p2,flow:b2,flowInitial:y2,insideSpan:w2,string:x2,text:v2},Symbol.toStringTag,{value:"Module"}));function C2(e,s,a){let l={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const c={},u=[];let d=[],h=[];const g={attempt:F(q),check:F(_),consume:z,enter:A,exit:I,interrupt:F(_,{interrupt:!0})},m={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:v,sliceStream:x,write:b};let y=s.tokenize.call(m,g);return s.resolveAll&&u.push(s),m;function b(H){return d=Bn(d,H),T(),d[d.length-1]!==null?[]:(oe(s,0),m.events=Po(u,m.events,m),m.events)}function v(H,K){return T2(x(H),K)}function x(H){return A2(d,H)}function w(){const{_bufferIndex:H,_index:K,line:re,column:ie,offset:G}=l;return{_bufferIndex:H,_index:K,line:re,column:ie,offset:G}}function S(H){c[H.line]=H.column,B()}function T(){for(;l._index<d.length;){const H=d[l._index];if(typeof H=="string"){const K=l._index;for(l._bufferIndex<0&&(l._bufferIndex=0);l._index===K&&l._bufferIndex<H.length;)k(H.charCodeAt(l._bufferIndex))}else k(H)}}function k(H){y=y(H)}function z(H){ze(H)?(l.line++,l.column=1,l.offset+=H===-3?2:1,B()):H!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===d[l._index].length&&(l._bufferIndex=-1,l._index++)),m.previous=H}function A(H,K){const re=K||{};return re.type=H,re.start=w(),m.events.push(["enter",re,m]),h.push(re),re}function I(H){const K=h.pop();return K.end=w(),m.events.push(["exit",K,m]),K}function q(H,K){oe(H,K.from)}function _(H,K){K.restore()}function F(H,K){return re;function re(ie,G,U){let M,W,ee,O;return Array.isArray(ie)?Q(ie):"tokenize"in ie?Q([ie]):R(ie);function R(ge){return Me;function Me(We){const pe=We!==null&&ge[We],ut=We!==null&&ge.null,gt=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(ut)?ut:ut?[ut]:[]];return Q(gt)(We)}}function Q(ge){return M=ge,W=0,ge.length===0?U:N(ge[W])}function N(ge){return Me;function Me(We){return O=ne(),ee=ge,ge.partial||(m.currentConstruct=ge),ge.name&&m.parser.constructs.disable.null.includes(ge.name)?ye():ge.tokenize.call(K?Object.assign(Object.create(m),K):m,g,de,ye)(We)}}function de(ge){return H(ee,O),G}function ye(ge){return O.restore(),++W<M.length?N(M[W]):U}}}function oe(H,K){H.resolveAll&&!u.includes(H)&&u.push(H),H.resolve&&Qn(m.events,K,m.events.length-K,H.resolve(m.events.slice(K),m)),H.resolveTo&&(m.events=H.resolveTo(m.events,m))}function ne(){const H=w(),K=m.previous,re=m.currentConstruct,ie=m.events.length,G=Array.from(h);return{from:ie,restore:U};function U(){l=H,m.previous=K,m.currentConstruct=re,m.events.length=ie,h=G,B()}}function B(){l.line in c&&l.column<2&&(l.column=c[l.line],l.offset+=c[l.line]-1)}}function A2(e,s){const a=s.start._index,l=s.start._bufferIndex,c=s.end._index,u=s.end._bufferIndex;let d;if(a===c)d=[e[a].slice(l,u)];else{if(d=e.slice(a,c),l>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(l):d.shift()}u>0&&d.push(e[c].slice(0,u))}return d}function T2(e,s){let a=-1;const l=[];let c;for(;++a<e.length;){const u=e[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
19
- `;break}case-3:{d=`\r
20
- `;break}case-2:{d=s?" ":" ";break}case-1:{if(!s&&c)continue;d=" ";break}default:d=String.fromCharCode(u)}c=u===-2,l.push(d)}return l.join("")}function N2(e){const l={constructs:Px([S2,...(e||{}).extensions||[]]),content:c(YS),defined:[],document:c(VS),flow:c(c2),lazy:{},string:c(h2),text:c(f2)};return l;function c(u){return d;function d(h){return C2(l,u,h)}}}function E2(e){for(;!Jx(e););return e}const Vy=/[\0\t\n\r]/g;function z2(){let e=1,s="",a=!0,l;return c;function c(u,d,h){u=s+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u));const g=[];let m=0;for(s="",a&&(u.charCodeAt(0)===65279&&m++,a=void 0);m<u.length;){Vy.lastIndex=m;const y=Vy.exec(u),b=y&&y.index!==void 0?y.index:u.length,v=u.charCodeAt(b);if(!y){s=u.slice(m);break}if(v===10&&m===b&&l)g.push(-3),l=void 0;else switch(l&&(g.push(-5),l=void 0),m<b&&(g.push(u.slice(m,b)),e+=b-m),v){case 0:{g.push(65533),e++;break}case 9:{const x=Math.ceil(e/4)*4;for(g.push(-2);e++<x;)g.push(-1);break}case 10:{g.push(-4),e=1;break}default:l=!0,e=1}m=b+1}return h&&(l&&g.push(-5),s&&g.push(s),g.push(null)),g}}const O2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function R2(e){return e.replace(O2,D2)}function D2(e,s,a){if(s)return s;if(a.charCodeAt(0)===35){const c=a.charCodeAt(1),u=c===120||c===88;return Vx(a.slice(u?2:1),u?16:10)}return Hh(a)||e}const sv={}.hasOwnProperty;function M2(e,s,a){return s&&typeof s=="object"&&(a=s,s=void 0),L2(a)(E2(N2(a).document().write(z2()(e,s,!0))))}function L2(e){const s={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(tn),autolinkProtocol:B,autolinkEmail:B,atxHeading:d(Se),blockQuote:d(gt),characterEscape:B,characterReference:B,codeFenced:d(Wt),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:d(Wt,h),codeText:d(Cn,h),codeTextData:B,data:B,codeFlowValue:B,definition:d(kt),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:d(In),hardBreakEscape:d(ht),hardBreakTrailing:d(ht),htmlFlow:d(en,h),htmlFlowData:B,htmlText:d(en,h),htmlTextData:B,image:d(An),label:h,link:d(tn),listItem:d(Jn),listItemValue:x,listOrdered:d($n,v),listUnordered:d($n),paragraph:d(os),reference:de,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:d(Se),strong:d(It),thematicBreak:d(Tn)},exit:{atxHeading:m(),atxHeadingSequence:_,autolink:m(),autolinkEmail:ut,autolinkProtocol:pe,blockQuote:m(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:Me,characterReference:We,codeFenced:m(k),codeFencedFence:T,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:H,codeIndented:m(z),codeText:m(U),codeTextData:H,data:H,definition:m(),definitionDestinationString:q,definitionLabelString:A,definitionTitleString:I,emphasis:m(),hardBreakEscape:m(re),hardBreakTrailing:m(re),htmlFlow:m(ie),htmlFlowData:H,htmlText:m(G),htmlTextData:H,image:m(W),label:O,labelText:ee,lineEnding:K,link:m(M),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ye,resourceDestinationString:R,resourceTitleString:Q,resource:N,setextHeading:m(ne),setextHeadingLineSequence:oe,setextHeadingText:F,strong:m(),thematicBreak:m()}};av(s,(e||{}).mdastExtensions||[]);const a={};return l;function l(J){let me={type:"root",children:[],position:void 0};const De={stack:[me],tokenStack:[],config:s,enter:g,exit:y,buffer:h,resume:b,data:a},Le=[],Lt=[];let tt=-1;for(;++tt<J.length;)if(Lt.push(J[tt]),J[tt][1].type==="listOrdered"||J[tt][1].type==="listUnordered")if(J[tt][0]==="enter")Le.push(Lt.length-1);else{const bt=Le.pop();u(Lt,bt)}for(J=Lt,tt=-1;++tt<J.length;){const bt=s[J[tt][0]];J[tt][0]==="enter"&&s.beforeEnter.length>0&&c(s.beforeEnter,{...De,sliceSerialize:J[tt][2].sliceSerialize},J[tt][1]),sv.call(bt,J[tt][1].type)&&bt[J[tt][1].type].call({...De,sliceSerialize:J[tt][2].sliceSerialize},J[tt][1]),J[tt][0]==="exit"&&s.afterExit.length>0&&c(s.afterExit,{...De,sliceSerialize:J[tt][2].sliceSerialize},J[tt][1])}if(De.tokenStack.length>0){const bt=De.tokenStack[De.tokenStack.length-1];(bt[1]||Zy).call(De,void 0,bt[0])}for(me.position={start:ss(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:ss(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<s.transforms.length;)me=s.transforms[tt](me)||me;return me}function c(J,me,De){let Le=-1;for(;++Le<J.length;)J[Le].call(me,De)}function u(J,me){const De=J.length-1;let Le=me-1,Lt=-1,tt=!1,bt,ue,je,$e;const $t=[];for(;++Le<=De;){const St=J[Le];switch(St[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{St[0]==="enter"?Lt++:Lt--,$e=void 0;break}case"lineEndingBlank":{St[0]==="enter"&&(bt&&!$e&&!Lt&&!je&&(je=Le),$e=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$e=void 0}if(!Lt&&St[0]==="enter"&&St[1].type==="listItemPrefix"||Lt===-1&&St[0]==="exit"&&(St[1].type==="listUnordered"||St[1].type==="listOrdered")){if(bt){let qt=Le;for(ue=void 0;qt--;){const Rt=J[qt];if(Rt[1].type==="lineEnding"||Rt[1].type==="lineEndingBlank"){if(Rt[0]==="exit")continue;ue&&(J[ue][1].type="lineEndingBlank",tt=!0),Rt[1].type="lineEnding",ue=qt}else if(!(Rt[1].type==="linePrefix"||Rt[1].type==="blockQuotePrefix"||Rt[1].type==="blockQuotePrefixWhitespace"||Rt[1].type==="blockQuoteMarker"||Rt[1].type==="listItemIndent"))break}je&&(!ue||je<ue)&&(bt._spread=!0),bt.end=Object.assign({},ue?J[ue][1].start:St[1].end),$t.push({at:ue||Le,event:["exit",bt,St[2]]})}if(St[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},St[1].start),end:void 0};bt=qt,$t.push({at:Le,event:["enter",qt,St[2]]}),je=void 0,$e=!0}}}const Ri=J.splice(me);let Di=0;for(Le=-1;++Le<Ri.length;){for(;Di<$t.length&&$t[Di].at===me+Le;)J.push($t[Di++].event);J.push(Ri[Le])}J[me][1]._spread=tt}function d(J,me){return De;function De(Le){g.call(this,J(Le),Le),me&&me.call(this,Le)}}function h(){this.stack.push({type:"fragment",children:[]})}function g(J,me,De){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([me,De||void 0]),J.position={start:ss(me.start),end:void 0}}function m(J){return me;function me(De){J&&J.call(this,De),y.call(this,De)}}function y(J,me){const De=this.stack.pop(),Le=this.tokenStack.pop();if(!Le)throw new Error("Cannot close `"+J.type+"` ("+_r({start:J.start,end:J.end})+"): it’s not open");Le[0].type!==J.type&&(me?me.call(this,J,Le[0]):(Le[1]||Zy).call(this,J,Le[0])),De.position.end=ss(J.end)}function b(){return Bh(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function x(J){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function w(){const J=this.resume(),me=this.stack[this.stack.length-1];me.lang=J}function S(){const J=this.resume(),me=this.stack[this.stack.length-1];me.meta=J}function T(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function z(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J.replace(/(\r?\n|\r)$/g,"")}function A(J){const me=this.resume(),De=this.stack[this.stack.length-1];De.label=me,De.identifier=Xn(this.sliceSerialize(J)).toLowerCase()}function I(){const J=this.resume(),me=this.stack[this.stack.length-1];me.title=J}function q(){const J=this.resume(),me=this.stack[this.stack.length-1];me.url=J}function _(J){const me=this.stack[this.stack.length-1];if(!me.depth){const De=this.sliceSerialize(J).length;me.depth=De}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function oe(J){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function ne(){this.data.setextHeadingSlurpLineEnding=void 0}function B(J){const De=this.stack[this.stack.length-1].children;let Le=De[De.length-1];(!Le||Le.type!=="text")&&(Le=Ea(),Le.position={start:ss(J.start),end:void 0},De.push(Le)),this.stack.push(Le)}function H(J){const me=this.stack.pop();me.value+=this.sliceSerialize(J),me.position.end=ss(J.end)}function K(J){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=me.children[me.children.length-1];De.position.end=ss(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&s.canContainEols.includes(me.type)&&(B.call(this,J),H.call(this,J))}function re(){this.data.atHardBreak=!0}function ie(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J}function G(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J}function U(){const J=this.resume(),me=this.stack[this.stack.length-1];me.value=J}function M(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=me,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function W(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=me,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function ee(J){const me=this.sliceSerialize(J),De=this.stack[this.stack.length-2];De.label=R2(me),De.identifier=Xn(me).toLowerCase()}function O(){const J=this.stack[this.stack.length-1],me=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Le=J.children;De.children=Le}else De.alt=me}function R(){const J=this.resume(),me=this.stack[this.stack.length-1];me.url=J}function Q(){const J=this.resume(),me=this.stack[this.stack.length-1];me.title=J}function N(){this.data.inReference=void 0}function de(){this.data.referenceType="collapsed"}function ye(J){const me=this.resume(),De=this.stack[this.stack.length-1];De.label=me,De.identifier=Xn(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function ge(J){this.data.characterReferenceType=J.type}function Me(J){const me=this.sliceSerialize(J),De=this.data.characterReferenceType;let Le;De?(Le=Vx(me,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=Hh(me);const Lt=this.stack[this.stack.length-1];Lt.value+=Le}function We(J){const me=this.stack.pop();me.position.end=ss(J.end)}function pe(J){H.call(this,J);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(J)}function ut(J){H.call(this,J);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(J)}function gt(){return{type:"blockquote",children:[],position:void 0}}function Wt(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Cn(){return{type:"inlineCode",value:"",position:void 0}}function kt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function In(){return{type:"emphasis",children:[],position:void 0}}function Se(){return{type:"heading",depth:0,children:[],position:void 0}}function ht(){return{type:"break",position:void 0}}function en(){return{type:"html",value:"",position:void 0}}function An(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function tn(){return{type:"link",title:null,url:"",children:[],position:void 0}}function $n(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[],position:void 0}}function Jn(J){return{type:"listItem",spread:J._spread,checked:null,children:[],position:void 0}}function os(){return{type:"paragraph",children:[],position:void 0}}function It(){return{type:"strong",children:[],position:void 0}}function Ea(){return{type:"text",value:"",position:void 0}}function Tn(){return{type:"thematicBreak",position:void 0}}}function ss(e){return{line:e.line,column:e.column,offset:e.offset}}function av(e,s){let a=-1;for(;++a<s.length;){const l=s[a];Array.isArray(l)?av(e,l):_2(e,l)}}function _2(e,s){let a;for(a in s)if(sv.call(s,a))switch(a){case"canContainEols":{const l=s[a];l&&e[a].push(...l);break}case"transforms":{const l=s[a];l&&e[a].push(...l);break}case"afterExit":case"beforeEnter":{const l=s[a];l&&e[a].push(l);break}case"enter":case"exit":{const l=s[a];l&&Object.assign(e[a],l);break}}}function Zy(e,s){throw e?new Error("Cannot close `"+e.type+"` ("+_r({start:e.start,end:e.end})+"): a different token (`"+s.type+"`, "+_r({start:s.start,end:s.end})+") is open"):new Error("Cannot close document, a token (`"+s.type+"`, "+_r({start:s.start,end:s.end})+") is still open")}function U2(e){const s=this;s.parser=a;function a(l){return M2(l,{...s.data("settings"),...e,extensions:s.data("micromarkExtensions")||[],mdastExtensions:s.data("fromMarkdownExtensions")||[]})}}function B2(e,s){const a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(s),!0)};return e.patch(s,a),e.applyData(s,a)}function H2(e,s){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(s,a),[e.applyData(s,a),{type:"text",value:`
21
- `}]}function I2(e,s){const a=s.value?s.value+`
22
- `:"",l={},c=s.lang?s.lang.split(/\s+/):[];c.length>0&&(l.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:l,children:[{type:"text",value:a}]};return s.meta&&(u.data={meta:s.meta}),e.patch(s,u),u=e.applyData(s,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(s,u),u}function $2(e,s){const a={type:"element",tagName:"del",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function q2(e,s){const a={type:"element",tagName:"em",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function G2(e,s){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(s.identifier).toUpperCase(),c=Na(l.toLowerCase()),u=e.footnoteOrder.indexOf(l);let d,h=e.footnoteCounts.get(l);h===void 0?(h=0,e.footnoteOrder.push(l),d=e.footnoteOrder.length):d=u+1,h+=1,e.footnoteCounts.set(l,h);const g={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+c,id:a+"fnref-"+c+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(s,g);const m={type:"element",tagName:"sup",properties:{},children:[g]};return e.patch(s,m),e.applyData(s,m)}function F2(e,s){const a={type:"element",tagName:"h"+s.depth,properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function Y2(e,s){if(e.options.allowDangerousHtml){const a={type:"raw",value:s.value};return e.patch(s,a),e.applyData(s,a)}}function rv(e,s){const a=s.referenceType;let l="]";if(a==="collapsed"?l+="[]":a==="full"&&(l+="["+(s.label||s.identifier)+"]"),s.type==="imageReference")return[{type:"text",value:"!["+s.alt+l}];const c=e.all(s),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const d=c[c.length-1];return d&&d.type==="text"?d.value+=l:c.push({type:"text",value:l}),c}function P2(e,s){const a=String(s.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return rv(e,s);const c={src:Na(l.url||""),alt:s.alt};l.title!==null&&l.title!==void 0&&(c.title=l.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(s,u),e.applyData(s,u)}function V2(e,s){const a={src:Na(s.url)};s.alt!==null&&s.alt!==void 0&&(a.alt=s.alt),s.title!==null&&s.title!==void 0&&(a.title=s.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(s,l),e.applyData(s,l)}function Z2(e,s){const a={type:"text",value:s.value.replace(/\r?\n|\r/g," ")};e.patch(s,a);const l={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(s,l),e.applyData(s,l)}function Q2(e,s){const a=String(s.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return rv(e,s);const c={href:Na(l.url||"")};l.title!==null&&l.title!==void 0&&(c.title=l.title);const u={type:"element",tagName:"a",properties:c,children:e.all(s)};return e.patch(s,u),e.applyData(s,u)}function X2(e,s){const a={href:Na(s.url)};s.title!==null&&s.title!==void 0&&(a.title=s.title);const l={type:"element",tagName:"a",properties:a,children:e.all(s)};return e.patch(s,l),e.applyData(s,l)}function K2(e,s,a){const l=e.all(s),c=a?J2(a):lv(s),u={},d=[];if(typeof s.checked=="boolean"){const y=l[0];let b;y&&y.type==="element"&&y.tagName==="p"?b=y:(b={type:"element",tagName:"p",properties:{},children:[]},l.unshift(b)),b.children.length>0&&b.children.unshift({type:"text",value:" "}),b.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:s.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let h=-1;for(;++h<l.length;){const y=l[h];(c||h!==0||y.type!=="element"||y.tagName!=="p")&&d.push({type:"text",value:`
23
- `}),y.type==="element"&&y.tagName==="p"&&!c?d.push(...y.children):d.push(y)}const g=l[l.length-1];g&&(c||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
24
- `});const m={type:"element",tagName:"li",properties:u,children:d};return e.patch(s,m),e.applyData(s,m)}function J2(e){let s=!1;if(e.type==="list"){s=e.spread||!1;const a=e.children;let l=-1;for(;!s&&++l<a.length;)s=lv(a[l])}return s}function lv(e){const s=e.spread;return s??e.children.length>1}function W2(e,s){const a={},l=e.all(s);let c=-1;for(typeof s.start=="number"&&s.start!==1&&(a.start=s.start);++c<l.length;){const d=l[c];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:s.ordered?"ol":"ul",properties:a,children:e.wrap(l,!0)};return e.patch(s,u),e.applyData(s,u)}function eA(e,s){const a={type:"element",tagName:"p",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function tA(e,s){const a={type:"root",children:e.wrap(e.all(s))};return e.patch(s,a),e.applyData(s,a)}function nA(e,s){const a={type:"element",tagName:"strong",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function iA(e,s){const a=e.all(s),l=a.shift(),c=[];if(l){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([l],!0)};e.patch(s.children[0],d),c.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},h=Mh(s.children[1]),g=Hx(s.children[s.children.length-1]);h&&g&&(d.position={start:h,end:g}),c.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(s,u),e.applyData(s,u)}function sA(e,s,a){const l=a?a.children:void 0,u=(l?l.indexOf(s):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,h=d?d.length:s.children.length;let g=-1;const m=[];for(;++g<h;){const b=s.children[g],v={},x=d?d[g]:void 0;x&&(v.align=x);let w={type:"element",tagName:u,properties:v,children:[]};b&&(w.children=e.all(b),e.patch(b,w),w=e.applyData(b,w)),m.push(w)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(s,y),e.applyData(s,y)}function aA(e,s){const a={type:"element",tagName:"td",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}const Qy=9,Xy=32;function rA(e){const s=String(e),a=/\r?\n|\r/g;let l=a.exec(s),c=0;const u=[];for(;l;)u.push(Ky(s.slice(c,l.index),c>0,!0),l[0]),c=l.index+l[0].length,l=a.exec(s);return u.push(Ky(s.slice(c),c>0,!1)),u.join("")}function Ky(e,s,a){let l=0,c=e.length;if(s){let u=e.codePointAt(l);for(;u===Qy||u===Xy;)l++,u=e.codePointAt(l)}if(a){let u=e.codePointAt(c-1);for(;u===Qy||u===Xy;)c--,u=e.codePointAt(c-1)}return c>l?e.slice(l,c):""}function lA(e,s){const a={type:"text",value:rA(String(s.value))};return e.patch(s,a),e.applyData(s,a)}function oA(e,s){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(s,a),e.applyData(s,a)}const cA={blockquote:B2,break:H2,code:I2,delete:$2,emphasis:q2,footnoteReference:G2,heading:F2,html:Y2,imageReference:P2,image:V2,inlineCode:Z2,linkReference:Q2,link:X2,listItem:K2,list:W2,paragraph:eA,root:tA,strong:nA,table:iA,tableCell:aA,tableRow:sA,text:lA,thematicBreak:oA,toml:ho,yaml:ho,definition:ho,footnoteDefinition:ho};function ho(){}const ov=-1,Vo=0,Br=1,Do=2,$h=3,qh=4,Gh=5,Fh=6,cv=7,uv=8,{defineProperty:uA}=Object,dv=typeof self=="object"?self:globalThis,Jy=(e,s)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new dv[e](s)},dA=(e,s)=>{const a=(c,u)=>(e.set(u,c),c),l=c=>{if(e.has(c))return e.get(c);const[u,d]=s[c];switch(u){case Vo:case ov:return a(d,c);case Br:{const h=a([],c);for(const g of d)h.push(l(g));return h}case Do:{const h=a({},c);for(const[g,m]of d){const y=l(g),b=l(m);y==="__proto__"?uA(h,y,{value:b,configurable:!0,enumerable:!0,writable:!0}):h[y]=b}return h}case $h:return a(new Date(d),c);case qh:{const{source:h,flags:g}=d;return a(new RegExp(h,g),c)}case Gh:{const h=a(new Map,c);for(const[g,m]of d)h.set(l(g),l(m));return h}case Fh:{const h=a(new Set,c);for(const g of d)h.add(l(g));return h}case cv:{const{name:h,message:g}=d;return a(typeof dv[h]=="function"?Jy(h,g):new Error(g),c)}case uv:return a(BigInt(d),c);case"BigInt":return a(Object(BigInt(d)),c);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return a(new DataView(h),d)}case"-0":return-0}return a(Jy(u,d),c)};return l},Wy=e=>dA(new Map,e)(0),Es="",{toString:hA}={},{keys:fA,is:mA}=Object,Nr=e=>{const s=typeof e;if(s!=="object"||!e)return[Vo,s];const a=hA.call(e).slice(8,-1);switch(a){case"Array":return[Br,Es];case"Object":return[Do,Es];case"Date":return[$h,Es];case"RegExp":return[qh,Es];case"Map":return[Gh,Es];case"Set":return[Fh,Es];case"DataView":return[Br,a]}return a.includes("Array")?[Br,a]:e instanceof Error?[cv,e.name||"Error"]:[Do,a]},fo=([e,s])=>e===Vo&&(s==="function"||s==="symbol"),pA=(e,s,a,l)=>{const c=(d,h)=>{const g=l.push(d)-1;return a.set(h,g),g},u=d=>{if(a.has(d))return a.get(d);let[h,g]=Nr(d);switch(h){case Vo:{let y=d;switch(g){case"bigint":h=uv,y=d.toString();break;case"number":if(!d&&mA(d,-0))return l.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+g);y=null;break;case"undefined":return c([ov],d)}return c([h,y],d)}case Br:{if(g){let v=d;return g==="DataView"?v=new Uint8Array(d.buffer):g==="ArrayBuffer"&&(v=new Uint8Array(d)),c([g,[...v]],d)}const y=[],b=c([h,y],d);for(const v of d)y.push(u(v));return b}case Do:{if(g)switch(g){case"BigInt":return c([g,d.toString()],d);case"Boolean":case"Number":case"String":return c([g,d.valueOf()],d)}if(s&&"toJSON"in d)return u(d.toJSON());const y=[],b=c([h,y],d);for(const v of fA(d))(e||!fo(Nr(d[v])))&&y.push([u(v),u(d[v])]);return b}case $h:return c([h,isNaN(d.getTime())?Es:d.toISOString()],d);case qh:{const{source:y,flags:b}=d;return c([h,{source:y,flags:b}],d)}case Gh:{const y=[],b=c([h,y],d);for(const[v,x]of d)(e||!(fo(Nr(v))||fo(Nr(x))))&&y.push([u(v),u(x)]);return b}case Fh:{const y=[],b=c([h,y],d);for(const v of d)(e||!fo(Nr(v)))&&y.push(u(v));return b}}const{message:m}=d;return c([h,{name:g,message:m}],d)};return u},eb=(e,{json:s,lossy:a}={})=>{const l=[];return pA(!(s||a),!!s,new Map,l)(e),l},Mo=typeof structuredClone=="function"?(e,s)=>s&&("json"in s||"lossy"in s)?Wy(eb(e,s)):structuredClone(e):(e,s)=>Wy(eb(e,s));function gA(e,s){const a=[{type:"text",value:"↩"}];return s>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(s)}]}),a}function yA(e,s){return"Back to reference "+(e+1)+(s>1?"-"+s:"")}function bA(e){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||gA,l=e.options.footnoteBackLabel||yA,c=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let g=-1;for(;++g<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[g]);if(!m)continue;const y=e.all(m),b=String(m.identifier).toUpperCase(),v=Na(b.toLowerCase());let x=0;const w=[],S=e.footnoteCounts.get(b);for(;S!==void 0&&++x<=S;){w.length>0&&w.push({type:"text",value:" "});let z=typeof a=="string"?a:a(g,x);typeof z=="string"&&(z={type:"text",value:z}),w.push({type:"element",tagName:"a",properties:{href:"#"+s+"fnref-"+v+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(g,x),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const T=y[y.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const z=T.children[T.children.length-1];z&&z.type==="text"?z.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...w)}else y.push(...w);const k={type:"element",tagName:"li",properties:{id:s+"fn-"+v},children:e.wrap(y,!0)};e.patch(m,k),h.push(k)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Mo(d),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
25
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
26
- `}]}}const Zo=(function(e){if(e==null)return jA;if(typeof e=="function")return Qo(e);if(typeof e=="object")return Array.isArray(e)?xA(e):vA(e);if(typeof e=="string")return wA(e);throw new Error("Expected function, string, or object as test")});function xA(e){const s=[];let a=-1;for(;++a<e.length;)s[a]=Zo(e[a]);return Qo(l);function l(...c){let u=-1;for(;++u<s.length;)if(s[u].apply(this,c))return!0;return!1}}function vA(e){const s=e;return Qo(a);function a(l){const c=l;let u;for(u in e)if(c[u]!==s[u])return!1;return!0}}function wA(e){return Qo(s);function s(a){return a&&a.type===e}}function Qo(e){return s;function s(a,l,c){return!!(kA(a)&&e.call(this,a,typeof l=="number"?l:void 0,c||void 0))}}function jA(){return!0}function kA(e){return e!==null&&typeof e=="object"&&"type"in e}const hv=[],SA=!0,rh=!1,CA="skip";function fv(e,s,a,l){let c;typeof s=="function"&&typeof a!="function"?(l=a,a=s):c=s;const u=Zo(c),d=l?-1:1;h(e,void 0,[])();function h(g,m,y){const b=g&&typeof g=="object"?g:{};if(typeof b.type=="string"){const x=typeof b.tagName=="string"?b.tagName:typeof b.name=="string"?b.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(g.type+(x?"<"+x+">":""))+")"})}return v;function v(){let x=hv,w,S,T;if((!s||u(g,m,y[y.length-1]||void 0))&&(x=AA(a(g,y)),x[0]===rh))return x;if("children"in g&&g.children){const k=g;if(k.children&&x[0]!==CA)for(S=(l?k.children.length:-1)+d,T=y.concat(k);S>-1&&S<k.children.length;){const z=k.children[S];if(w=h(z,S,T)(),w[0]===rh)return w;S=typeof w[1]=="number"?w[1]:S+d}}return x}}}function AA(e){return Array.isArray(e)?e:typeof e=="number"?[SA,e]:e==null?hv:[e]}function Yh(e,s,a,l){let c,u,d;typeof s=="function"&&typeof a!="function"?(u=void 0,d=s,c=a):(u=s,d=a,c=l),fv(e,u,h,c);function h(g,m){const y=m[m.length-1],b=y?y.children.indexOf(g):void 0;return d(g,b,y)}}const lh={}.hasOwnProperty,TA={};function NA(e,s){const a=s||TA,l=new Map,c=new Map,u=new Map,d={...cA,...a.handlers},h={all:m,applyData:zA,definitionById:l,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:d,one:g,options:a,patch:EA,wrap:RA};return Yh(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const b=y.type==="definition"?l:c,v=String(y.identifier).toUpperCase();b.has(v)||b.set(v,y)}}),h;function g(y,b){const v=y.type,x=h.handlers[v];if(lh.call(h.handlers,v)&&x)return x(h,y,b);if(h.options.passThrough&&h.options.passThrough.includes(v)){if("children"in y){const{children:S,...T}=y,k=Mo(T);return k.children=h.all(y),k}return Mo(y)}return(h.options.unknownHandler||OA)(h,y,b)}function m(y){const b=[];if("children"in y){const v=y.children;let x=-1;for(;++x<v.length;){const w=h.one(v[x],y);if(w){if(x&&v[x-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=tb(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=tb(S.value))}Array.isArray(w)?b.push(...w):b.push(w)}}}return b}}function EA(e,s){e.position&&(s.position=yS(e))}function zA(e,s){let a=s;if(e&&e.data){const l=e.data.hName,c=e.data.hChildren,u=e.data.hProperties;if(typeof l=="string")if(a.type==="element")a.tagName=l;else{const d="children"in a?a.children:[a];a={type:"element",tagName:l,properties:{},children:d}}a.type==="element"&&u&&Object.assign(a.properties,Mo(u)),"children"in a&&a.children&&c!==null&&c!==void 0&&(a.children=c)}return a}function OA(e,s){const a=s.data||{},l="value"in s&&!(lh.call(a,"hProperties")||lh.call(a,"hChildren"))?{type:"text",value:s.value}:{type:"element",tagName:"div",properties:{},children:e.all(s)};return e.patch(s,l),e.applyData(s,l)}function RA(e,s){const a=[];let l=-1;for(s&&a.push({type:"text",value:`
27
- `});++l<e.length;)l&&a.push({type:"text",value:`
28
- `}),a.push(e[l]);return s&&e.length>0&&a.push({type:"text",value:`
29
- `}),a}function tb(e){let s=0,a=e.charCodeAt(s);for(;a===9||a===32;)s++,a=e.charCodeAt(s);return e.slice(s)}function nb(e,s){const a=NA(e,s),l=a.one(e,void 0),c=bA(a),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
30
- `},c),u}function DA(e,s){return e&&"run"in e?async function(a,l){const c=nb(a,{file:l,...s});await e.run(c,l)}:function(a,l){return nb(a,{file:l,...e||s})}}function ib(e){if(e)throw e}var Cd,sb;function MA(){if(sb)return Cd;sb=1;var e=Object.prototype.hasOwnProperty,s=Object.prototype.toString,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=function(m){return typeof Array.isArray=="function"?Array.isArray(m):s.call(m)==="[object Array]"},u=function(m){if(!m||s.call(m)!=="[object Object]")return!1;var y=e.call(m,"constructor"),b=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!b)return!1;var v;for(v in m);return typeof v>"u"||e.call(m,v)},d=function(m,y){a&&y.name==="__proto__"?a(m,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):m[y.name]=y.newValue},h=function(m,y){if(y==="__proto__")if(e.call(m,y)){if(l)return l(m,y).value}else return;return m[y]};return Cd=function g(){var m,y,b,v,x,w,S=arguments[0],T=1,k=arguments.length,z=!1;for(typeof S=="boolean"&&(z=S,S=arguments[1]||{},T=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});T<k;++T)if(m=arguments[T],m!=null)for(y in m)b=h(S,y),v=h(m,y),S!==v&&(z&&v&&(u(v)||(x=c(v)))?(x?(x=!1,w=b&&c(b)?b:[]):w=b&&u(b)?b:{},d(S,{name:y,newValue:g(z,w,v)})):typeof v<"u"&&d(S,{name:y,newValue:v}));return S},Cd}var LA=MA();const Ad=Kb(LA);function oh(e){if(typeof e!="object"||e===null)return!1;const s=Object.getPrototypeOf(e);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function _A(){const e=[],s={run:a,use:l};return s;function a(...c){let u=-1;const d=c.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...c);function h(g,...m){const y=e[++u];let b=-1;if(g){d(g);return}for(;++b<c.length;)(m[b]===null||m[b]===void 0)&&(m[b]=c[b]);c=m,y?UA(y,h)(...m):d(null,...m)}}function l(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),s}}function UA(e,s){let a;return l;function l(...d){const h=e.length>d.length;let g;h&&d.push(c);try{g=e.apply(this,d)}catch(m){const y=m;if(h&&a)throw y;return c(y)}h||(g&&g.then&&typeof g.then=="function"?g.then(u,c):g instanceof Error?c(g):u(g))}function c(d,...h){a||(a=!0,s(d,...h))}function u(d){c(null,d)}}const ii={basename:BA,dirname:HA,extname:IA,join:$A,sep:"/"};function BA(e,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');Vr(e);let a=0,l=-1,c=e.length,u;if(s===void 0||s.length===0||s.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){a=c+1;break}}else l<0&&(u=!0,l=c+1);return l<0?"":e.slice(a,l)}if(s===e)return"";let d=-1,h=s.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){a=c+1;break}}else d<0&&(u=!0,d=c+1),h>-1&&(e.codePointAt(c)===s.codePointAt(h--)?h<0&&(l=c):(h=-1,l=d));return a===l?l=d:l<0&&(l=e.length),e.slice(a,l)}function HA(e){if(Vr(e),e.length===0)return".";let s=-1,a=e.length,l;for(;--a;)if(e.codePointAt(a)===47){if(l){s=a;break}}else l||(l=!0);return s<0?e.codePointAt(0)===47?"/":".":s===1&&e.codePointAt(0)===47?"//":e.slice(0,s)}function IA(e){Vr(e);let s=e.length,a=-1,l=0,c=-1,u=0,d;for(;s--;){const h=e.codePointAt(s);if(h===47){if(d){l=s+1;break}continue}a<0&&(d=!0,a=s+1),h===46?c<0?c=s:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||a<0||u===0||u===1&&c===a-1&&c===l+1?"":e.slice(c,a)}function $A(...e){let s=-1,a;for(;++s<e.length;)Vr(e[s]),e[s]&&(a=a===void 0?e[s]:a+"/"+e[s]);return a===void 0?".":qA(a)}function qA(e){Vr(e);const s=e.codePointAt(0)===47;let a=GA(e,!s);return a.length===0&&!s&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),s?"/"+a:a}function GA(e,s){let a="",l=0,c=-1,u=0,d=-1,h,g;for(;++d<=e.length;){if(d<e.length)h=e.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(c===d-1||u===1))if(c!==d-1&&u===2){if(a.length<2||l!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(g=a.lastIndexOf("/"),g!==a.length-1){g<0?(a="",l=0):(a=a.slice(0,g),l=a.length-1-a.lastIndexOf("/")),c=d,u=0;continue}}else if(a.length>0){a="",l=0,c=d,u=0;continue}}s&&(a=a.length>0?a+"/..":"..",l=2)}else a.length>0?a+="/"+e.slice(c+1,d):a=e.slice(c+1,d),l=d-c-1;c=d,u=0}else h===46&&u>-1?u++:u=-1}return a}function Vr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const FA={cwd:YA};function YA(){return"/"}function ch(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PA(e){if(typeof e=="string")e=new URL(e);else if(!ch(e)){const s=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw s.code="ERR_INVALID_ARG_TYPE",s}if(e.protocol!=="file:"){const s=new TypeError("The URL must be of scheme file");throw s.code="ERR_INVALID_URL_SCHEME",s}return VA(e)}function VA(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const s=e.pathname;let a=-1;for(;++a<s.length;)if(s.codePointAt(a)===37&&s.codePointAt(a+1)===50){const l=s.codePointAt(a+2);if(l===70||l===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(s)}const Td=["history","path","basename","stem","extname","dirname"];class mv{constructor(s){let a;s?ch(s)?a={path:s}:typeof s=="string"||ZA(s)?a={value:s}:a=s:a={},this.cwd="cwd"in a?"":FA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Td.length;){const u=Td[l];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let c;for(c in a)Td.includes(c)||(this[c]=a[c])}get basename(){return typeof this.path=="string"?ii.basename(this.path):void 0}set basename(s){Ed(s,"basename"),Nd(s,"basename"),this.path=ii.join(this.dirname||"",s)}get dirname(){return typeof this.path=="string"?ii.dirname(this.path):void 0}set dirname(s){ab(this.basename,"dirname"),this.path=ii.join(s||"",this.basename)}get extname(){return typeof this.path=="string"?ii.extname(this.path):void 0}set extname(s){if(Nd(s,"extname"),ab(this.dirname,"extname"),s){if(s.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(s.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ii.join(this.dirname,this.stem+(s||""))}get path(){return this.history[this.history.length-1]}set path(s){ch(s)&&(s=PA(s)),Ed(s,"path"),this.path!==s&&this.history.push(s)}get stem(){return typeof this.path=="string"?ii.basename(this.path,this.extname):void 0}set stem(s){Ed(s,"stem"),Nd(s,"stem"),this.path=ii.join(this.dirname||"",s+(this.extname||""))}fail(s,a,l){const c=this.message(s,a,l);throw c.fatal=!0,c}info(s,a,l){const c=this.message(s,a,l);return c.fatal=void 0,c}message(s,a,l){const c=new Jt(s,a,l);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(s){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(s||void 0).decode(this.value)}}function Nd(e,s){if(e&&e.includes(ii.sep))throw new Error("`"+s+"` cannot be a path: did not expect `"+ii.sep+"`")}function Ed(e,s){if(!e)throw new Error("`"+s+"` cannot be empty")}function ab(e,s){if(!e)throw new Error("Setting `"+s+"` requires `path` to be set too")}function ZA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QA=(function(e){const l=this.constructor.prototype,c=l[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),XA={}.hasOwnProperty;class Ph extends QA{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_A()}copy(){const s=new Ph;let a=-1;for(;++a<this.attachers.length;){const l=this.attachers[a];s.use(...l)}return s.data(Ad(!0,{},this.namespace)),s}data(s,a){return typeof s=="string"?arguments.length===2?(Rd("data",this.frozen),this.namespace[s]=a,this):XA.call(this.namespace,s)&&this.namespace[s]||void 0:s?(Rd("data",this.frozen),this.namespace=s,this):this.namespace}freeze(){if(this.frozen)return this;const s=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const c=a.call(s,...l);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(s){this.freeze();const a=mo(s),l=this.parser||this.Parser;return zd("parse",l),l(String(a),a)}process(s,a){const l=this;return this.freeze(),zd("process",this.parser||this.Parser),Od("process",this.compiler||this.Compiler),a?c(void 0,a):new Promise(c);function c(u,d){const h=mo(s),g=l.parse(h);l.run(g,h,function(y,b,v){if(y||!b||!v)return m(y);const x=b,w=l.stringify(x,v);WA(w)?v.value=w:v.result=w,m(y,v)});function m(y,b){y||!b?d(y):u?u(b):a(void 0,b)}}}processSync(s){let a=!1,l;return this.freeze(),zd("processSync",this.parser||this.Parser),Od("processSync",this.compiler||this.Compiler),this.process(s,c),lb("processSync","process",a),l;function c(u,d){a=!0,ib(u),l=d}}run(s,a,l){rb(s),this.freeze();const c=this.transformers;return!l&&typeof a=="function"&&(l=a,a=void 0),l?u(void 0,l):new Promise(u);function u(d,h){const g=mo(a);c.run(s,g,m);function m(y,b,v){const x=b||s;y?h(y):d?d(x):l(void 0,x,v)}}}runSync(s,a){let l=!1,c;return this.run(s,a,u),lb("runSync","run",l),c;function u(d,h){ib(d),c=h,l=!0}}stringify(s,a){this.freeze();const l=mo(a),c=this.compiler||this.Compiler;return Od("stringify",c),rb(s),c(s,l)}use(s,...a){const l=this.attachers,c=this.namespace;if(Rd("use",this.frozen),s!=null)if(typeof s=="function")g(s,a);else if(typeof s=="object")Array.isArray(s)?h(s):d(s);else throw new TypeError("Expected usable value, not `"+s+"`");return this;function u(m){if(typeof m=="function")g(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...b]=m;g(y,b)}else d(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function d(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(m.plugins),m.settings&&(c.settings=Ad(!0,c.settings,m.settings))}function h(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const b=m[y];u(b)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function g(m,y){let b=-1,v=-1;for(;++b<l.length;)if(l[b][0]===m){v=b;break}if(v===-1)l.push([m,...y]);else if(y.length>0){let[x,...w]=y;const S=l[v][1];oh(S)&&oh(x)&&(x=Ad(!0,S,x)),l[v]=[m,x,...w]}}}}const KA=new Ph().freeze();function zd(e,s){if(typeof s!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Od(e,s){if(typeof s!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Rd(e,s){if(s)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rb(e){if(!oh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lb(e,s,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+s+"` instead")}function mo(e){return JA(e)?e:new mv(e)}function JA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function WA(e){return typeof e=="string"||eT(e)}function eT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const tT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ob=[],cb={allowDangerousHtml:!0},nT=/^(https?|ircs?|mailto|xmpp)$/i,iT=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function sT(e){const s=aT(e),a=rT(e);return lT(s.runSync(s.parse(a),a),e)}function aT(e){const s=e.rehypePlugins||ob,a=e.remarkPlugins||ob,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cb}:cb;return KA().use(U2).use(a).use(DA,l).use(s)}function rT(e){const s=e.children||"",a=new mv;return typeof s=="string"&&(a.value=s),a}function lT(e,s){const a=s.allowedElements,l=s.allowElement,c=s.components,u=s.disallowedElements,d=s.skipHtml,h=s.unwrapDisallowed,g=s.urlTransform||oT;for(const y of iT)Object.hasOwn(s,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+tT+y.id,void 0);return Yh(e,m),jS(e,{Fragment:i.Fragment,components:c,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function m(y,b,v){if(y.type==="raw"&&v&&typeof b=="number")return d?v.children.splice(b,1):v.children[b]={type:"text",value:y.value},b;if(y.type==="element"){let x;for(x in jd)if(Object.hasOwn(jd,x)&&Object.hasOwn(y.properties,x)){const w=y.properties[x],S=jd[x];(S===null||S.includes(y.tagName))&&(y.properties[x]=g(String(w||""),x,y))}}if(y.type==="element"){let x=a?!a.includes(y.tagName):u?u.includes(y.tagName):!1;if(!x&&l&&typeof b=="number"&&(x=!l(y,b,v)),x&&v&&typeof b=="number")return h&&y.children?v.children.splice(b,1,...y.children):v.children.splice(b,1),b}}}function oT(e){const s=e.indexOf(":"),a=e.indexOf("?"),l=e.indexOf("#"),c=e.indexOf("/");return s===-1||c!==-1&&s>c||a!==-1&&s>a||l!==-1&&s>l||nT.test(e.slice(0,s))?e:""}function cT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function pv(e,s,a){const c=Zo((a||{}).ignore||[]),u=uT(s);let d=-1;for(;++d<u.length;)fv(e,"text",h);function h(m,y){let b=-1,v;for(;++b<y.length;){const x=y[b],w=v?v.children:void 0;if(c(x,w?w.indexOf(x):void 0,v))return;v=x}if(v)return g(m,y)}function g(m,y){const b=y[y.length-1],v=u[d][0],x=u[d][1];let w=0;const T=b.children.indexOf(m);let k=!1,z=[];v.lastIndex=0;let A=v.exec(m.value);for(;A;){const q=A.index,_={index:A.index,input:A.input,stack:[...y,m]};let F=x(...A,_);if(typeof F=="string"&&(F=F.length>0?{type:"text",value:F}:void 0),F===!1)v.lastIndex=q+1;else{if(w!==q&&I({type:"text",value:m.value.slice(w,q)}),Array.isArray(F))for(const oe of F)I(oe);else F&&I(F);w=q+A[0].length,k=!0}if(!v.global)break;A=v.exec(m.value)}return k?(w<m.value.length&&I({type:"text",value:m.value.slice(w)}),b.children.splice(T,1,...z)):z=[m],T+z.length;function I(q){const _=z[z.length-1];_&&_.type==="text"&&q.type==="text"?_.value+=q.value:z.push(q)}}}function uT(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const s=[],a=!e[0]||Array.isArray(e[0])?e:[e];let l=-1;for(;++l<a.length;){const c=a[l];s.push([dT(c[0]),hT(c[1])])}return s}function dT(e){return typeof e=="string"?new RegExp(cT(e),"g"):e}function hT(e){return typeof e=="function"?e:function(){return e}}function fT(e){pv(e,[/\r?\n|\r/g,mT])}function mT(){return{type:"break"}}function pT(){return function(e){fT(e)}}function ub(e,s){const a=String(e);if(typeof s!="string")throw new TypeError("Expected character");let l=0,c=a.indexOf(s);for(;c!==-1;)l++,c=a.indexOf(s,c+s.length);return l}const Dd="phrasing",Md=["autolink","link","image","label"];function gT(){return{transforms:[kT],enter:{literalAutolink:bT,literalAutolinkEmail:Ld,literalAutolinkHttp:Ld,literalAutolinkWww:Ld},exit:{literalAutolink:jT,literalAutolinkEmail:wT,literalAutolinkHttp:xT,literalAutolinkWww:vT}}}function yT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Md},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Md},{character:":",before:"[ps]",after:"\\/",inConstruct:Dd,notInConstruct:Md}]}}function bT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ld(e){this.config.enter.autolinkProtocol.call(this,e)}function xT(e){this.config.exit.autolinkProtocol.call(this,e)}function vT(e){this.config.exit.data.call(this,e);const s=this.stack[this.stack.length-1];s.type,s.url="http://"+this.sliceSerialize(e)}function wT(e){this.config.exit.autolinkEmail.call(this,e)}function jT(e){this.exit(e)}function kT(e){pv(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ST],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),CT]],{ignore:["link","linkReference"]})}function ST(e,s,a,l,c){let u="";if(!gv(c)||(/^w/i.test(s)&&(a=s+a,s="",u="http://"),!AT(a)))return!1;const d=TT(a+l);if(!d[0])return!1;const h={type:"link",title:null,url:u+s+d[0],children:[{type:"text",value:s+d[0]}]};return d[1]?[h,{type:"text",value:d[1]}]:h}function CT(e,s,a,l){return!gv(l,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+s+"@"+a,children:[{type:"text",value:s+"@"+a}]}}function AT(e){const s=e.split(".");return!(s.length<2||s[s.length-1]&&(/_/.test(s[s.length-1])||!/[a-zA-Z\d]/.test(s[s.length-1]))||s[s.length-2]&&(/_/.test(s[s.length-2])||!/[a-zA-Z\d]/.test(s[s.length-2])))}function TT(e){const s=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!s)return[e,void 0];e=e.slice(0,s.index);let a=s[0],l=a.indexOf(")");const c=ub(e,"(");let u=ub(e,")");for(;l!==-1&&c>u;)e+=a.slice(0,l+1),a=a.slice(l+1),l=a.indexOf(")"),u++;return[e,a]}function gv(e,s){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Ms(a)||Yo(a))&&(!s||a!==47)}yv.peek=_T;function NT(){this.buffer()}function ET(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function zT(){this.buffer()}function OT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function RT(e){const s=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),a.label=s}function DT(e){this.exit(e)}function MT(e){const s=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),a.label=s}function LT(e){this.exit(e)}function _T(){return"["}function yv(e,s,a,l){const c=a.createTracker(l);let u=c.move("[^");const d=a.enter("footnoteReference"),h=a.enter("reference");return u+=c.move(a.safe(a.associationId(e),{after:"]",before:u})),h(),d(),u+=c.move("]"),u}function UT(){return{enter:{gfmFootnoteCallString:NT,gfmFootnoteCall:ET,gfmFootnoteDefinitionLabelString:zT,gfmFootnoteDefinition:OT},exit:{gfmFootnoteCallString:RT,gfmFootnoteCall:DT,gfmFootnoteDefinitionLabelString:MT,gfmFootnoteDefinition:LT}}}function BT(e){let s=!1;return e&&e.firstLineBlank&&(s=!0),{handlers:{footnoteDefinition:a,footnoteReference:yv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(l,c,u,d){const h=u.createTracker(d);let g=h.move("[^");const m=u.enter("footnoteDefinition"),y=u.enter("label");return g+=h.move(u.safe(u.associationId(l),{before:g,after:"]"})),y(),g+=h.move("]:"),l.children&&l.children.length>0&&(h.shift(4),g+=h.move((s?`
31
- `:" ")+u.indentLines(u.containerFlow(l,h.current()),s?bv:HT))),m(),g}}function HT(e,s,a){return s===0?e:bv(e,s,a)}function bv(e,s,a){return(a?"":" ")+e}const IT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Vh.attention=YT;Vh.peek=PT;function $T(){return{canContainEols:["delete"],enter:{strikethrough:GT},exit:{strikethrough:FT}}}function qT(){return{handlers:{delete:Vh},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:IT}]}}function GT(e){this.enter({type:"delete",children:[],position:void 0},e)}function FT(e){this.exit(e)}function Vh(e,s,a,l){const c=a.createTracker(l),u=a.stack.includes("strikethrough")?"~":"~~",d=a.enter("strikethrough");let h=c.move(u);return h+=a.containerPhrasing(e,{...c.current(),before:h,after:"~"}),h+=c.move(u),d(),h}function YT(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function PT(){return"~"}function VT(e){return e.length}function ZT(e,s){const a=s||{},l=(a.align||[]).concat(),c=a.stringLength||VT,u=[],d=[],h=[],g=[];let m=0,y=-1;for(;++y<e.length;){const S=[],T=[];let k=-1;for(e[y].length>m&&(m=e[y].length);++k<e[y].length;){const z=QT(e[y][k]);if(a.alignDelimiters!==!1){const A=c(z);T[k]=A,(g[k]===void 0||A>g[k])&&(g[k]=A)}S.push(z)}d[y]=S,h[y]=T}let b=-1;if(typeof l=="object"&&"length"in l)for(;++b<m;)u[b]=db(l[b]);else{const S=db(l);for(;++b<m;)u[b]=S}b=-1;const v=[],x=[];for(;++b<m;){const S=u[b];let T="",k="";S===99?(T=":",k=":"):S===108?T=":":S===114&&(k=":");let z=a.alignDelimiters===!1?1:Math.max(1,g[b]-T.length-k.length);const A=T+"-".repeat(z)+k;a.alignDelimiters!==!1&&(z=T.length+z+k.length,z>g[b]&&(g[b]=z),x[b]=z),v[b]=A}d.splice(1,0,v),h.splice(1,0,x),y=-1;const w=[];for(;++y<d.length;){const S=d[y],T=h[y];b=-1;const k=[];for(;++b<m;){const z=S[b]||"";let A="",I="";if(a.alignDelimiters!==!1){const q=g[b]-(T[b]||0),_=u[b];_===114?A=" ".repeat(q):_===99?q%2?(A=" ".repeat(q/2+.5),I=" ".repeat(q/2-.5)):(A=" ".repeat(q/2),I=A):I=" ".repeat(q)}a.delimiterStart!==!1&&!b&&k.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&z==="")&&(a.delimiterStart!==!1||b)&&k.push(" "),a.alignDelimiters!==!1&&k.push(A),k.push(z),a.alignDelimiters!==!1&&k.push(I),a.padding!==!1&&k.push(" "),(a.delimiterEnd!==!1||b!==m-1)&&k.push("|")}w.push(a.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
32
- `)}function QT(e){return e==null?"":String(e)}function db(e){const s=typeof e=="string"?e.codePointAt(0):0;return s===67||s===99?99:s===76||s===108?108:s===82||s===114?114:0}const XT=Zo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function KT(e,s,a,l){const c=a.enter("blockquote"),u=a.createTracker(l);u.move("> "),u.shift(2);const d=a.indentLines(a.containerFlow(e,u.current()),JT);return c(),d}function JT(e,s,a){return">"+(a?"":" ")+e}function WT(e,s){return hb(e,s.inConstruct,!0)&&!hb(e,s.notInConstruct,!1)}function hb(e,s,a){if(typeof s=="string"&&(s=[s]),!s||s.length===0)return a;let l=-1;for(;++l<s.length;)if(e.includes(s[l]))return!0;return!1}function fb(e,s,a,l){let c=-1;for(;++c<a.unsafe.length;){const u=a.unsafe[c];if(u.character===`
33
- `&&!u.before&&!u.after&&WT(a.stack,u))return/[\t ]/.test(l.before)?"":" "}return`\\
34
- `}function eN(e,s){const a=String(e);let l=a.indexOf(s),c=l,u=0,d=0;if(typeof s!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===c?++u>d&&(d=u):u=1,c=l+s.length,l=a.indexOf(s,c);return d}function tN(e,s){return!!(s.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function nN(e){const s=e.options.fence||"`";if(s!=="`"&&s!=="~")throw new Error("Cannot serialize code with `"+s+"` for `options.fence`, expected `` ` `` or `~`");return s}function iN(e,s,a,l){const c=nN(a),u=e.value||"";if(tN(e,a)){const b=a.enter("codeIndented"),v=a.indentLines(u,sN);return b(),v}const d=a.createTracker(l),h=c.repeat(Math.max(eN(u,c)+1,3)),g=a.enter("codeFenced"),m=c==="`"?"GraveAccent":"Tilde";let y=d.move(h);if(e.lang){const b=a.enter(`codeFencedLang${m}`);y+=d.move(a.safe(e.lang,{before:y,after:" ",encode:["`"],...d.current()})),b()}if(e.lang&&e.meta){const b=a.enter(`codeFencedMeta${m}`);y+=d.move(" "),y+=d.move(a.safe(e.meta,{before:y,after:`
35
- `,encode:["`"],...d.current()})),b()}return y+=d.move(`
36
- `),u&&(y+=d.move(u+`
37
- `)),y+=d.move(h),g(),y}function sN(e,s,a){return(a?"":" ")+e}function Zh(e){const s=e.options.quote||'"';if(s!=='"'&&s!=="'")throw new Error("Cannot serialize title with `"+s+"` for `options.quote`, expected `\"`, or `'`");return s}function aN(e,s,a,l){const c=Zh(a),u=c==='"'?"Quote":"Apostrophe",d=a.enter("definition");let h=a.enter("label");const g=a.createTracker(l);let m=g.move("[");return m+=g.move(a.safe(a.associationId(e),{before:m,after:"]",...g.current()})),m+=g.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),m+=g.move("<"),m+=g.move(a.safe(e.url,{before:m,after:">",...g.current()})),m+=g.move(">")):(h=a.enter("destinationRaw"),m+=g.move(a.safe(e.url,{before:m,after:e.title?" ":`
38
- `,...g.current()}))),h(),e.title&&(h=a.enter(`title${u}`),m+=g.move(" "+c),m+=g.move(a.safe(e.title,{before:m,after:c,...g.current()})),m+=g.move(c),h()),d(),m}function rN(e){const s=e.options.emphasis||"*";if(s!=="*"&&s!=="_")throw new Error("Cannot serialize emphasis with `"+s+"` for `options.emphasis`, expected `*`, or `_`");return s}Qh.attention=lN;Qh.peek=oN;function Qh(e,s,a,l){const c=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},l);return c(),u}function lN(e,s){return{construct:"emphasis",markers:rN(s)==="*"?["*","_"]:["_","*"],sizes:[1]}}function oN(e,s,a){return a.options.emphasis||"*"}function cN(e){return"&#x"+e.toString(16).toUpperCase()+";"}function uN(e,s){let a=!1;return Yh(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return a=!0,rh}),!!((!e.depth||e.depth<3)&&Bh(e)&&(s.options.setext||a))}function dN(e,s,a,l){const c=Math.max(Math.min(6,e.depth||1),1),u=a.createTracker(l);if(uN(e,a)){const b=a.enter("headingSetext"),v=a.enter("phrasing"),x=a.containerPhrasing(e,{...u.current(),before:`
39
- `,after:`
40
- `});return v(),b(),x+`
41
- `+(c===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
42
- `))+1))}const d="#".repeat(c),h=a.enter("headingAtx"),g=a.enter("phrasing");u.move(d+" ");let m=a.containerPhrasing(e,{before:"# ",after:`
43
- `,...u.current()});const y=m.charCodeAt(0);return(y===9||y===32)&&(m=cN(y)+m.slice(1)),m=m?d+" "+m:d,a.options.closeAtx&&(m+=" "+d),g(),h(),m}xv.peek=hN;function xv(e){return e.value||""}function hN(){return"<"}vv.peek=fN;function vv(e,s,a,l){const c=Zh(a),u=c==='"'?"Quote":"Apostrophe",d=a.enter("image");let h=a.enter("label");const g=a.createTracker(l);let m=g.move("![");return m+=g.move(a.safe(e.alt,{before:m,after:"]",...g.current()})),m+=g.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),m+=g.move("<"),m+=g.move(a.safe(e.url,{before:m,after:">",...g.current()})),m+=g.move(">")):(h=a.enter("destinationRaw"),m+=g.move(a.safe(e.url,{before:m,after:e.title?" ":")",...g.current()}))),h(),e.title&&(h=a.enter(`title${u}`),m+=g.move(" "+c),m+=g.move(a.safe(e.title,{before:m,after:c,...g.current()})),m+=g.move(c),h()),m+=g.move(")"),d(),m}function fN(){return"!"}wv.peek=mN;function wv(e,s,a,l){const c=e.referenceType,u=a.enter("imageReference");let d=a.enter("label");const h=a.createTracker(l);let g=h.move("![");const m=a.safe(e.alt,{before:g,after:"]",...h.current()});g+=h.move(m+"]["),d();const y=a.stack;a.stack=y.filter(function(v){return v!=="phrasing"}),d=a.enter("reference");const b=a.safe(a.associationId(e),{before:g,after:"]",...h.current()});return d(),a.stack=y,u(),c==="full"||!m||m!==b?g+=h.move(b+"]"):c==="shortcut"?g=g.slice(0,-1):g+=h.move("]"),g}function mN(){return"!"}jv.peek=pN;function jv(e,s,a){let l=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(l);)c+="`";for(/[^\n\r ]/.test(l)&&(/^[\n\r ]/.test(l)&&/[\n\r ]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++u<a.unsafe.length;){const d=a.unsafe[u],h=a.compilePattern(d);if(!d.atBreak)continue;let g;for(;g=h.exec(l);){let m=g.index;l.charCodeAt(m)===10&&l.charCodeAt(m-1)===13&&m--,l=l.slice(0,m)+" "+l.slice(g.index+1)}}return c+l+c}function pN(){return"`"}function kv(e,s){const a=Bh(e);return!!(!s.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Sv.peek=gN;function Sv(e,s,a,l){const c=Zh(a),u=c==='"'?"Quote":"Apostrophe",d=a.createTracker(l);if(kv(e,a)){const y=a.stack;a.stack=y.filter(function(x){return x!=="phrasing"});const b=a.enter("autolink");let v=d.move("<");return v+=d.move(a.containerPhrasing(e,{before:v,after:">",...d.current()})),v+=d.move(">"),b(),a.stack=y,v}const h=a.enter("link");let g=a.enter("label"),m=d.move("[");return m+=d.move(a.containerPhrasing(e,{before:m,after:"](",...d.current()})),m+=d.move("]("),g(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(g=a.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(a.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(g=a.enter("destinationRaw"),m+=d.move(a.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),g(),e.title&&(g=a.enter(`title${u}`),m+=d.move(" "+c),m+=d.move(a.safe(e.title,{before:m,after:c,...d.current()})),m+=d.move(c),g()),m+=d.move(")"),h(),m}function gN(e,s,a){return kv(e,a)?"<":"["}Cv.peek=yN;function Cv(e,s,a,l){const c=e.referenceType,u=a.enter("linkReference");let d=a.enter("label");const h=a.createTracker(l);let g=h.move("[");const m=a.containerPhrasing(e,{before:g,after:"]",...h.current()});g+=h.move(m+"]["),d();const y=a.stack;a.stack=y.filter(function(v){return v!=="phrasing"}),d=a.enter("reference");const b=a.safe(a.associationId(e),{before:g,after:"]",...h.current()});return d(),a.stack=y,u(),c==="full"||!m||m!==b?g+=h.move(b+"]"):c==="shortcut"?g=g.slice(0,-1):g+=h.move("]"),g}function yN(){return"["}function Xh(e){const s=e.options.bullet||"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bullet`, expected `*`, `+`, or `-`");return s}function bN(e){const s=Xh(e),a=e.options.bulletOther;if(!a)return s==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===s)throw new Error("Expected `bullet` (`"+s+"`) and `bulletOther` (`"+a+"`) to be different");return a}function xN(e){const s=e.options.bulletOrdered||".";if(s!=="."&&s!==")")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOrdered`, expected `.` or `)`");return s}function Av(e){const s=e.options.rule||"*";if(s!=="*"&&s!=="-"&&s!=="_")throw new Error("Cannot serialize rules with `"+s+"` for `options.rule`, expected `*`, `-`, or `_`");return s}function vN(e,s,a,l){const c=a.enter("list"),u=a.bulletCurrent;let d=e.ordered?xN(a):Xh(a);const h=e.ordered?d==="."?")":".":bN(a);let g=s&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&y&&(!y.children||!y.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(g=!0),Av(a)===d&&y){let b=-1;for(;++b<e.children.length;){const v=e.children[b];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){g=!0;break}}}}g&&(d=h),a.bulletCurrent=d;const m=a.containerFlow(e,l);return a.bulletLastUsed=d,a.bulletCurrent=u,c(),m}function wN(e){const s=e.options.listItemIndent||"one";if(s!=="tab"&&s!=="one"&&s!=="mixed")throw new Error("Cannot serialize items with `"+s+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return s}function jN(e,s,a,l){const c=wN(a);let u=a.bulletCurrent||Xh(a);s&&s.type==="list"&&s.ordered&&(u=(typeof s.start=="number"&&s.start>-1?s.start:1)+(a.options.incrementListMarker===!1?0:s.children.indexOf(e))+u);let d=u.length+1;(c==="tab"||c==="mixed"&&(s&&s.type==="list"&&s.spread||e.spread))&&(d=Math.ceil(d/4)*4);const h=a.createTracker(l);h.move(u+" ".repeat(d-u.length)),h.shift(d);const g=a.enter("listItem"),m=a.indentLines(a.containerFlow(e,h.current()),y);return g(),m;function y(b,v,x){return v?(x?"":" ".repeat(d))+b:(x?u:u+" ".repeat(d-u.length))+b}}function kN(e,s,a,l){const c=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(e,l);return u(),c(),d}function SN(e,s,a,l){if(!e.children.some(function(h){return XT(h)}))return a.containerFlow(e,l);const u=a.enter("phrasing"),d=a.containerPhrasing(e,l);return u(),d}function CN(e){const s=e.options.strong||"*";if(s!=="*"&&s!=="_")throw new Error("Cannot serialize strong with `"+s+"` for `options.strong`, expected `*`, or `_`");return s}Kh.attention=AN;Kh.peek=TN;function Kh(e,s,a,l){const c=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},l);return c(),u}function AN(e,s){return{construct:"strong",markers:CN(s)==="*"?["*","_"]:["_","*"],sizes:[2]}}function TN(e,s,a){return a.options.strong||"*"}function NN(e,s,a,l){const c=s?s.children:[],u=c.indexOf(e);return a.safe(e.value,{...l,afterNode:c[u+1],beforeNode:c[u-1]})}function EN(e){const s=e.options.ruleRepetition||3;if(s<3)throw new Error("Cannot serialize rules with repetition `"+s+"` for `options.ruleRepetition`, expected `3` or more");return s}function zN(e,s,a){const l=(Av(a)+(a.options.ruleSpaces?" ":"")).repeat(EN(a));return a.options.ruleSpaces?l.slice(0,-1):l}const Tv={blockquote:KT,break:fb,code:iN,definition:aN,emphasis:Qh,hardBreak:fb,heading:dN,html:xv,image:vv,imageReference:wv,inlineCode:jv,link:Sv,linkReference:Cv,list:vN,listItem:jN,paragraph:kN,root:SN,strong:Kh,text:NN,thematicBreak:zN};function ON(){return{enter:{table:RN,tableData:mb,tableHeader:mb,tableRow:MN},exit:{codeText:LN,table:DN,tableData:_d,tableHeader:_d,tableRow:_d}}}function RN(e){const s=e._align;this.enter({type:"table",align:s.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function DN(e){this.exit(e),this.data.inTable=void 0}function MN(e){this.enter({type:"tableRow",children:[]},e)}function _d(e){this.exit(e)}function mb(e){this.enter({type:"tableCell",children:[]},e)}function LN(e){let s=this.resume();this.data.inTable&&(s=s.replace(/\\([\\|])/g,_N));const a=this.stack[this.stack.length-1];a.type,a.value=s,this.exit(e)}function _N(e,s){return s==="|"?s:e}function UN(e){const s=e||{},a=s.tableCellPadding,l=s.tablePipeAlign,c=s.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
44
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:d,tableCell:g,tableRow:h}};function d(x,w,S,T){return m(y(x,S,T),x.align)}function h(x,w,S,T){const k=b(x,S,T),z=m([k]);return z.slice(0,z.indexOf(`
45
- `))}function g(x,w,S,T){const k=S.enter("tableCell"),z=S.enter("phrasing"),A=S.containerPhrasing(x,{...T,before:u,after:u});return z(),k(),A}function m(x,w){return ZT(x,{align:w,alignDelimiters:l,padding:a,stringLength:c})}function y(x,w,S){const T=x.children;let k=-1;const z=[],A=w.enter("table");for(;++k<T.length;)z[k]=b(T[k],w,S);return A(),z}function b(x,w,S){const T=x.children;let k=-1;const z=[],A=w.enter("tableRow");for(;++k<T.length;)z[k]=g(T[k],x,w,S);return A(),z}function v(x,w,S){let T=Tv.inlineCode(x,w,S);return S.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function BN(){return{exit:{taskListCheckValueChecked:pb,taskListCheckValueUnchecked:pb,paragraph:IN}}}function HN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$N}}}function pb(e){const s=this.stack[this.stack.length-2];s.type,s.checked=e.type==="taskListCheckValueChecked"}function IN(e){const s=this.stack[this.stack.length-2];if(s&&s.type==="listItem"&&typeof s.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const l=a.children[0];if(l&&l.type==="text"){const c=s.children;let u=-1,d;for(;++u<c.length;){const h=c[u];if(h.type==="paragraph"){d=h;break}}d===a&&(l.value=l.value.slice(1),l.value.length===0?a.children.shift():a.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,a.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function $N(e,s,a,l){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",h=a.createTracker(l);u&&h.move(d);let g=Tv.listItem(e,s,a,{...l,...h.current()});return u&&(g=g.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),g;function m(y){return y+d}}function qN(){return[gT(),UT(),$T(),ON(),BN()]}function GN(e){return{extensions:[yT(),BT(e),qT(),UN(e),HN()]}}const FN={tokenize:XN,partial:!0},Nv={tokenize:KN,partial:!0},Ev={tokenize:JN,partial:!0},zv={tokenize:WN,partial:!0},YN={tokenize:eE,partial:!0},Ov={name:"wwwAutolink",tokenize:ZN,previous:Dv},Rv={name:"protocolAutolink",tokenize:QN,previous:Mv},Oi={name:"emailAutolink",tokenize:VN,previous:Lv},ri={};function PN(){return{text:ri}}let Ts=48;for(;Ts<123;)ri[Ts]=Oi,Ts++,Ts===58?Ts=65:Ts===91&&(Ts=97);ri[43]=Oi;ri[45]=Oi;ri[46]=Oi;ri[95]=Oi;ri[72]=[Oi,Rv];ri[104]=[Oi,Rv];ri[87]=[Oi,Ov];ri[119]=[Oi,Ov];function VN(e,s,a){const l=this;let c,u;return d;function d(b){return!uh(b)||!Lv.call(l,l.previous)||Jh(l.events)?a(b):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(b))}function h(b){return uh(b)?(e.consume(b),h):b===64?(e.consume(b),g):a(b)}function g(b){return b===46?e.check(YN,y,m)(b):b===45||b===95||Xt(b)?(u=!0,e.consume(b),g):y(b)}function m(b){return e.consume(b),c=!0,g}function y(b){return u&&c&&sn(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),s(b)):a(b)}}function ZN(e,s,a){const l=this;return c;function c(d){return d!==87&&d!==119||!Dv.call(l,l.previous)||Jh(l.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(FN,e.attempt(Nv,e.attempt(Ev,u),a),a)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),s(d)}}function QN(e,s,a){const l=this;let c="",u=!1;return d;function d(b){return(b===72||b===104)&&Mv.call(l,l.previous)&&!Jh(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(b),e.consume(b),h):a(b)}function h(b){if(sn(b)&&c.length<5)return c+=String.fromCodePoint(b),e.consume(b),h;if(b===58){const v=c.toLowerCase();if(v==="http"||v==="https")return e.consume(b),g}return a(b)}function g(b){return b===47?(e.consume(b),u?m:(u=!0,g)):a(b)}function m(b){return b===null||zo(b)||ct(b)||Ms(b)||Yo(b)?a(b):e.attempt(Nv,e.attempt(Ev,y),a)(b)}function y(b){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),s(b)}}function XN(e,s,a){let l=0;return c;function c(d){return(d===87||d===119)&&l<3?(l++,e.consume(d),c):d===46&&l===3?(e.consume(d),u):a(d)}function u(d){return d===null?a(d):s(d)}}function KN(e,s,a){let l,c,u;return d;function d(m){return m===46||m===95?e.check(zv,g,h)(m):m===null||ct(m)||Ms(m)||m!==45&&Yo(m)?g(m):(u=!0,e.consume(m),d)}function h(m){return m===95?l=!0:(c=l,l=void 0),e.consume(m),d}function g(m){return c||l||!u?a(m):s(m)}}function JN(e,s){let a=0,l=0;return c;function c(d){return d===40?(a++,e.consume(d),c):d===41&&l<a?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(zv,s,u)(d):d===null||ct(d)||Ms(d)?s(d):(e.consume(d),c)}function u(d){return d===41&&l++,e.consume(d),c}}function WN(e,s,a){return l;function l(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),l):h===38?(e.consume(h),u):h===93?(e.consume(h),c):h===60||h===null||ct(h)||Ms(h)?s(h):a(h)}function c(h){return h===null||h===40||h===91||ct(h)||Ms(h)?s(h):l(h)}function u(h){return sn(h)?d(h):a(h)}function d(h){return h===59?(e.consume(h),l):sn(h)?(e.consume(h),d):a(h)}}function eE(e,s,a){return l;function l(u){return e.consume(u),c}function c(u){return Xt(u)?a(u):s(u)}}function Dv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ct(e)}function Mv(e){return!sn(e)}function Lv(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||Xt(e)}function Jh(e){let s=e.length,a=!1;for(;s--;){const l=e[s][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){a=!0;break}if(l._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const tE={tokenize:cE,partial:!0};function nE(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rE,continuation:{tokenize:lE},exit:oE}},text:{91:{name:"gfmFootnoteCall",tokenize:aE},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iE,resolveTo:sE}}}}function iE(e,s,a){const l=this;let c=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;c--;){const g=l.events[c][1];if(g.type==="labelImage"){d=g;break}if(g.type==="gfmFootnoteCall"||g.type==="labelLink"||g.type==="label"||g.type==="image"||g.type==="link")break}return h;function h(g){if(!d||!d._balanced)return a(g);const m=Xn(l.sliceSerialize({start:d.end,end:l.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?a(g):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),s(g))}}function sE(e,s){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},h=[e[a+1],e[a+2],["enter",l,s],e[a+3],e[a+4],["enter",c,s],["exit",c,s],["enter",u,s],["enter",d,s],["exit",d,s],["exit",u,s],e[e.length-2],e[e.length-1],["exit",l,s]];return e.splice(a,e.length-a+1,...h),e}function aE(e,s,a){const l=this,c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=0,d;return h;function h(b){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),g}function g(b){return b!==94?a(b):(e.enter("gfmFootnoteCallMarker"),e.consume(b),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(b){if(u>999||b===93&&!d||b===null||b===91||ct(b))return a(b);if(b===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return c.includes(Xn(l.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),s):a(b)}return ct(b)||(d=!0),u++,e.consume(b),b===92?y:m}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,m):m(b)}}function rE(e,s,a){const l=this,c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,d=0,h;return g;function g(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):a(w)}function y(w){if(d>999||w===93&&!h||w===null||w===91||ct(w))return a(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return u=Xn(l.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return ct(w)||(h=!0),d++,e.consume(w),w===92?b:y}function b(w){return w===91||w===92||w===93?(e.consume(w),d++,y):y(w)}function v(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),c.includes(u)||c.push(u),Je(e,x,"gfmFootnoteDefinitionWhitespace")):a(w)}function x(w){return s(w)}}function lE(e,s,a){return e.check(Pr,s,e.attempt(tE,s,a))}function oE(e){e.exit("gfmFootnoteDefinition")}function cE(e,s,a){const l=this;return Je(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?s(u):a(u)}}function uE(e){let a=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:u,resolveAll:c};return a==null&&(a=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function c(d,h){let g=-1;for(;++g<d.length;)if(d[g][0]==="enter"&&d[g][1].type==="strikethroughSequenceTemporary"&&d[g][1]._close){let m=g;for(;m--;)if(d[m][0]==="exit"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._open&&d[g][1].end.offset-d[g][1].start.offset===d[m][1].end.offset-d[m][1].start.offset){d[g][1].type="strikethroughSequence",d[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},d[m][1].start),end:Object.assign({},d[g][1].end)},b={type:"strikethroughText",start:Object.assign({},d[m][1].end),end:Object.assign({},d[g][1].start)},v=[["enter",y,h],["enter",d[m][1],h],["exit",d[m][1],h],["enter",b,h]],x=h.parser.constructs.insideSpan.null;x&&Qn(v,v.length,0,Po(x,d.slice(m+1,g),h)),Qn(v,v.length,0,[["exit",b,h],["enter",d[g][1],h],["exit",d[g][1],h],["exit",y,h]]),Qn(d,m-1,g-m+3,v),g=m+v.length-2;break}}for(g=-1;++g<d.length;)d[g][1].type==="strikethroughSequenceTemporary"&&(d[g][1].type="data");return d}function u(d,h,g){const m=this.previous,y=this.events;let b=0;return v;function v(w){return m===126&&y[y.length-1][1].type!=="characterEscape"?g(w):(d.enter("strikethroughSequenceTemporary"),x(w))}function x(w){const S=Ro(m);if(w===126)return b>1?g(w):(d.consume(w),b++,x);if(b<2&&!a)return g(w);const T=d.exit("strikethroughSequenceTemporary"),k=Ro(w);return T._open=!k||k===2&&!!S,T._close=!S||S===2&&!!k,h(w)}}}class dE{constructor(){this.map=[],this.index=new Map}add(s,a,l){hE(this,s,a,l)}consume(s){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const l=[];for(;a>0;)a-=1,l.push(s.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),s.length=this.map[a][0];l.push(s.slice()),s.length=0;let c=l.pop();for(;c;){for(const u of c)s.push(u);c=l.pop()}this.map.length=0,this.index.clear()}}function hE(e,s,a,l){if(a===0&&l.length===0)return;const c=e.index.get(s);if(c){c[1]+=a,c[2].push(...l);return}const u=[s,a,l];e.map.push(u),e.index.set(s,u)}function fE(e,s){let a=!1;const l=[];for(;s<e.length;){const c=e[s];if(a){if(c[0]==="enter")c[1].type==="tableContent"&&l.push(e[s+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[s-1][1].type==="tableDelimiterMarker"){const u=l.length-1;l[u]=l[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(a=!0);s+=1}return l}function mE(){return{flow:{null:{name:"table",tokenize:pE,resolveAll:gE}}}}function pE(e,s,a){const l=this;let c=0,u=0,d;return h;function h(B){let H=l.events.length-1;for(;H>-1;){const{type:ie}=l.events[H][1];if(ie==="lineEnding"||ie==="linePrefix")H--;else break}const K=H>-1?l.events[H][1].type:null,re=K==="tableHead"||K==="tableRow"?_:g;return re===_&&l.parser.lazy[l.now().line]?a(B):re(B)}function g(B){return e.enter("tableHead"),e.enter("tableRow"),m(B)}function m(B){return B===124||(d=!0,u+=1),y(B)}function y(B){return B===null?a(B):ze(B)?u>1?(u=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),x):a(B):Ie(B)?Je(e,y,"whitespace")(B):(u+=1,d&&(d=!1,c+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),d=!0,y):(e.enter("data"),b(B)))}function b(B){return B===null||B===124||ct(B)?(e.exit("data"),y(B)):(e.consume(B),B===92?v:b)}function v(B){return B===92||B===124?(e.consume(B),b):b(B)}function x(B){return l.interrupt=!1,l.parser.lazy[l.now().line]?a(B):(e.enter("tableDelimiterRow"),d=!1,Ie(B)?Je(e,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):w(B))}function w(B){return B===45||B===58?T(B):B===124?(d=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),S):q(B)}function S(B){return Ie(B)?Je(e,T,"whitespace")(B):T(B)}function T(B){return B===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),k):B===45?(u+=1,k(B)):B===null||ze(B)?I(B):q(B)}function k(B){return B===45?(e.enter("tableDelimiterFiller"),z(B)):q(B)}function z(B){return B===45?(e.consume(B),z):B===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(B))}function A(B){return Ie(B)?Je(e,I,"whitespace")(B):I(B)}function I(B){return B===124?w(B):B===null||ze(B)?!d||c!==u?q(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),s(B)):q(B)}function q(B){return a(B)}function _(B){return e.enter("tableRow"),F(B)}function F(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),F):B===null||ze(B)?(e.exit("tableRow"),s(B)):Ie(B)?Je(e,F,"whitespace")(B):(e.enter("data"),oe(B))}function oe(B){return B===null||B===124||ct(B)?(e.exit("data"),F(B)):(e.consume(B),B===92?ne:oe)}function ne(B){return B===92||B===124?(e.consume(B),oe):oe(B)}}function gE(e,s){let a=-1,l=!0,c=0,u=[0,0,0,0],d=[0,0,0,0],h=!1,g=0,m,y,b;const v=new dE;for(;++a<e.length;){const x=e[a],w=x[1];x[0]==="enter"?w.type==="tableHead"?(h=!1,g!==0&&(gb(v,s,g,m,y),y=void 0,g=0),m={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(a,0,[["enter",m,s]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(l=!0,b=void 0,u=[0,0,0,0],d=[0,a+1,0,0],h&&(h=!1,y={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(a,0,[["enter",y,s]])),c=w.type==="tableDelimiterRow"?2:y?3:1):c&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(l=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],b=po(v,s,u,c,void 0,b),u=[0,0,0,0]),d[2]=a)):w.type==="tableCellDivider"&&(l?l=!1:(u[1]!==0&&(d[0]=d[1],b=po(v,s,u,c,void 0,b)),u=d,d=[u[1],a,0,0])):w.type==="tableHead"?(h=!0,g=a):w.type==="tableRow"||w.type==="tableDelimiterRow"?(g=a,u[1]!==0?(d[0]=d[1],b=po(v,s,u,c,a,b)):d[1]!==0&&(b=po(v,s,d,c,a,b)),c=0):c&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(d[3]=a)}for(g!==0&&gb(v,s,g,m,y),v.consume(s.events),a=-1;++a<s.events.length;){const x=s.events[a];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=fE(s.events,a))}return e}function po(e,s,a,l,c,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",h="tableContent";a[0]!==0&&(u.end=Object.assign({},ja(s.events,a[0])),e.add(a[0],0,[["exit",u,s]]));const g=ja(s.events,a[1]);if(u={type:d,start:Object.assign({},g),end:Object.assign({},g)},e.add(a[1],0,[["enter",u,s]]),a[2]!==0){const m=ja(s.events,a[2]),y=ja(s.events,a[3]),b={type:h,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(a[2],0,[["enter",b,s]]),l!==2){const v=s.events[a[2]],x=s.events[a[3]];if(v[1].end=Object.assign({},x[1].end),v[1].type="chunkText",v[1].contentType="text",a[3]>a[2]+1){const w=a[2]+1,S=a[3]-a[2]-1;e.add(w,S,[])}}e.add(a[3]+1,0,[["exit",b,s]])}return c!==void 0&&(u.end=Object.assign({},ja(s.events,c)),e.add(c,0,[["exit",u,s]]),u=void 0),u}function gb(e,s,a,l,c){const u=[],d=ja(s.events,a);c&&(c.end=Object.assign({},d),u.push(["exit",c,s])),l.end=Object.assign({},d),u.push(["exit",l,s]),e.add(a+1,0,u)}function ja(e,s){const a=e[s],l=a[0]==="enter"?"start":"end";return a[1][l]}const yE={name:"tasklistCheck",tokenize:xE};function bE(){return{text:{91:yE}}}function xE(e,s,a){const l=this;return c;function c(g){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?a(g):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(g),e.exit("taskListCheckMarker"),u)}function u(g){return ct(g)?(e.enter("taskListCheckValueUnchecked"),e.consume(g),e.exit("taskListCheckValueUnchecked"),d):g===88||g===120?(e.enter("taskListCheckValueChecked"),e.consume(g),e.exit("taskListCheckValueChecked"),d):a(g)}function d(g){return g===93?(e.enter("taskListCheckMarker"),e.consume(g),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):a(g)}function h(g){return ze(g)?s(g):Ie(g)?e.check({tokenize:vE},s,a)(g):a(g)}}function vE(e,s,a){return Je(e,l,"whitespace");function l(c){return c===null?a(c):s(c)}}function wE(e){return Px([PN(),nE(),uE(e),mE(),bE()])}const jE={};function kE(e){const s=this,a=e||jE,l=s.data(),c=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);c.push(wE(a)),u.push(qN()),d.push(GN(a))}const SE=[kE,pT],CE={footnoteLabelProperties:{className:["visually-hidden"]}},AE=/^(?:https?|mailto):/i,_v=E.createContext(!1);function Uv({href:e,title:s,children:a}){return i.jsx(_v,{value:!0,children:e&&AE.test(e)?i.jsx("a",{href:e,title:s,target:"_blank",rel:"noopener noreferrer",children:a}):i.jsx("span",{title:s||e||void 0,children:a})})}function TE({src:e,alt:s}){const a=s||e;return E.useContext(_v)?i.jsx(i.Fragment,{children:a}):i.jsx(Uv,{href:e,children:a})}const NE={a:({href:e,title:s,children:a})=>i.jsx(Uv,{href:e,title:s,children:a}),img:({src:e,alt:s})=>i.jsx(TE,{src:typeof e=="string"?e:void 0,alt:s})},Bv=E.memo(function({text:s}){return i.jsx("div",{className:"markdown",children:i.jsx(sT,{remarkPlugins:SE,remarkRehypeOptions:CE,components:NE,children:s})})}),Hv={draft:"Draft",open:"Open",failing:"CI failed",changes_requested:"Changes requested",merged:"Merged",closed:"Closed"},Wh={draft:"neutral",open:"success",failing:"danger",changes_requested:"danger",merged:"merged",closed:"neutral"};function Iv(e){return e.number===void 0?"PR":`#${e.number}`}function EE(e){let s;try{s=new URL(e).pathname.split("/").filter(Boolean).map(decodeURIComponent)}catch{return}const a=s.findIndex(u=>["pull","pulls","-","pull-requests","merge_requests","pullrequest"].includes(u));if(a<2)return;const l=s.slice(0,a),c=l.lastIndexOf("repos");return c>=2&&c===l.length-2&&["projects","users"].includes(l[c-2])?`${l[c-1]}/${l[c+1]}`:l.filter(u=>u!=="_git").join("/")}function dh(e){const s=EE(e.url),a=e.state?`: ${Hv[e.state]}`:"";return s?`Pull request ${Iv(e)} in ${s}${a}`:`${e.url}${a}`}function $v({pull:e}){return e.state?i.jsx("span",{className:`pull-state ${Wh[e.state]}`,children:Hv[e.state]}):null}function qv({pull:e}){return i.jsxs("span",{className:`session-pull${e.state?` ${Wh[e.state]}`:""}`,title:dh(e),children:[i.jsx(ve,{name:"git-pull-request",size:12}),Iv(e),e.state&&i.jsxs(i.Fragment,{children:[" ",i.jsx($v,{pull:e})]})]})}function zE({pull:e}){return i.jsxs("a",{className:`badge session-pull-link${e.state?` ${Wh[e.state]}`:""}`,href:e.url,target:"_blank",rel:"noreferrer",title:dh(e),"aria-label":dh(e),children:[i.jsx(ve,{name:"git-pull-request",size:12}),e.number===void 0?"Pull request":i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"session-pull-prefix",children:"PR "}),"#",e.number]}),e.state&&i.jsxs("span",{className:"session-pull-state",children:[" · ",i.jsx($v,{pull:e})]}),i.jsx(ve,{name:"external",size:12})]})}const yb={queued:"Waiting its turn",authorizing:"Checking access",waiting:"Waiting for another session's fetch",connecting:"Connecting to the Git host",enumerating:"Enumerating objects",counting:"Counting objects",compressing:"Compressing objects",receiving:"Receiving objects",resolving:"Resolving deltas",verifying:"Verifying history",checking:"Checking files","checking-out":"Checking out",done:"Ready"};function OE(e){return Object.hasOwn(yb,e)?yb[e]:"Preparing"}function Or(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function RE(e){if(!Or(e))return"";const s=["B","KiB","MiB","GiB","TiB"];let a=e,l=0;for(;a>=1024&&l<s.length-1;)a/=1024,l++;return`${l&&a<10?a.toFixed(1):Math.round(a)} ${s[l]}`}function Gv(e){return e.phase==="done"?100:typeof e.percent=="number"&&Number.isFinite(e.percent)?Math.min(100,Math.max(0,Math.round(e.percent))):void 0}function DE(e){const s=[OE(e.phase)],a=Gv(e);return a!==void 0&&e.phase!=="done"&&s.push(`${a}%`),Or(e.done)&&Or(e.total)&&e.total>0?s.push(`${e.done.toLocaleString("en-US")} of ${e.total.toLocaleString("en-US")}`):Or(e.done)&&e.done>0&&s.push(e.done.toLocaleString("en-US")),Or(e.bytes)&&e.bytes>0&&s.push(RE(e.bytes)),s.join(" · ")}function ME(e){return e?.repositories?.status==="preparing"}function LE({sessionId:e,preparation:s,canRestart:a,onRestarted:l}){const c=Ne();if(s.status==="failed"){const u=()=>{c.run(async()=>{await he(`/api/sessions/${ce(e)}/restart`,{method:"POST"}),l()})};return i.jsx(ke,{variant:"error",title:"Repositories could not be prepared",actions:a?i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy,onClick:u,children:c.busy?"Restarting...":"Restart session"}):void 0,children:i.jsxs("span",{className:"stack",children:[i.jsx("span",{children:s.error??"The host could not prepare this session's repositories."}),i.jsx("span",{className:"muted small",children:a?"Fix the cause on the host, then restart the session. Queued messages run once the repositories are ready.":"The session owner can restart the session once the cause is fixed."}),i.jsx(Ce,{error:c.error})]})})}return i.jsxs("section",{className:"repository-preparation card","aria-label":"Preparing repositories",children:[i.jsxs("div",{className:"repository-preparation-head",children:[i.jsx(Os,{}),"Preparing repositories"]}),i.jsx("ul",{className:"repository-preparation-items",children:s.items.map(u=>{const d=Gv(u),h=DE(u);return i.jsxs("li",{children:[i.jsxs("div",{className:"repository-preparation-row",children:[i.jsx("code",{children:u.path}),i.jsx("span",{className:"muted small",children:h})]}),i.jsx("progress",{className:"repository-progress",max:100,value:d,"aria-label":`${u.path}: ${h}`})]},u.path)})}),i.jsx("p",{className:"muted small",children:"The first session on a host clones each repository with its full history; later sessions fetch only what changed. Messages sent now run when this is done."})]})}function _E(e){return e.connectorOwnerId!==e.ownerId}function bb(e,s,a=!1){return e.kind==="host.bash"?!0:e.kind==="bash"&&(s.hostEnvironment===!0||a&&_E(s))}function UE(e,s){return e.kind==="host.bash"||e.kind==="bash"&&s.hostEnvironment===!0}function BE(e,s,a){return e.connectorOwnerId!==void 0&&e.connectorOwnerId===a||s?.hostCommandAccess!==void 0}function Fv(e,s){return e.kind==="host.bash"&&s?.capabilities?.hostOwnerDecides===!0}function HE(e,s,a,l,c){const u=s.connectorOwnerId!==void 0&&s.connectorOwnerId===l;return c&&BE(s,a,l)||u&&Fv(e,a)}function IE(e,s){return Fv(e,s)?"Waiting for the host's owner, or a member granted host commands with approve access to this session":"Waiting for the host's owner or a member granted host commands, either with approve access to this session"}const Yv=E.createContext(null),$E=Yv.Provider;function qE(){const e=E.useContext(Yv);return e?i.jsx(V,{variant:"ghost",size:"sm",icon:"menu",className:"nav-button","aria-label":"Open navigation","aria-expanded":e.expanded,onClick:e.open}):null}function GE({session:e,user:s,manages:a,action:l,onChange:c}){const u=e.ownerId===s.id,d=qe(u?`/api/sessions/${ce(e.id)}/link`:null),h=d.data?d.data.link:void 0;async function g(){if(!u||l.busy||e.status==="archived")return!1;if(h)return!0;if(!await Ge({title:"Share with anyone who has the link?",message:"Anyone with the link will be able to view existing and future prompts and output of the shared conversation, including tool output and repository content shown in it, without signing in. They can't send messages, or see side asks, approvals, who sent each message, or the host. The session title and your display name are shown with it. Values that look like passwords, tokens or keys are hidden, but anyone who has the link can pass it on, so check the transcript for other sensitive content first. You can turn the link off at any time.",confirmLabel:"Create link"}))return!1;let b=!1;return await l.run(async()=>{const v=await he(`/api/sessions/${ce(e.id)}/link`,{method:"PUT"});d.setData({link:v.link}),b=!0,c()},"Share link created. Anyone who has it can view the shared conversation."),b}async function m(){!a||l.busy||!await Ge({title:"Turn off the share link?",message:`The link stops working at once, for everyone who has it. Content already viewed or copied can't be recalled. ${u?"Turning link sharing on again creates a new link.":"Only the session's owner can share it by link again, with a new link."}`,confirmLabel:"Turn off link",destructive:!0})||await l.run(async()=>{await he(`/api/sessions/${ce(e.id)}/link`,{method:"DELETE"}),u&&d.setData({link:null}),c()},"Share link turned off. It no longer opens this session.")}return{link:h,linkLoading:d.loading,linkError:d.error,shareLink:g,unshareLink:()=>{m()}}}function Pv(e){return`${e.location==="workspace-database"?" · Workspace database":""}${e.automatic?" · Automatic":""}${e.conversationOnly?" · Conversation only":""}`}function vo(e){return`${e.host.includes(":")?`[${e.host}]`:e.host}:${e.port}/${e.database}`}function xb(e){return e===15?"every 15 minutes":e===60?"every hour":e===360?"every 6 hours":e===1440?"every day":`every ${e} minutes`}function FE(e){if(!e.included)return`The workspace backs up changed sessions ${xb(e.minutes)}, but not yours until you confirm its database under Settings → Workspaces → Session database`;const s=e.error?`The last attempt failed (${e.error}); it is retried within 15 minutes`:e.pending?"Changed since the last one: it is saved once the session is idle and due":"Up to date";return`Saved ${xb(e.minutes)} when the session changed. ${s}`}function YE(e){return e==="workspace-database"?"This workspace keeps its backups in its own database, which this server no longer connects to. The workspace owner can disconnect it in the workspace settings":"This server keeps no session backups: its operator hasn't set up backup storage (STORAGE_URL)"}function PE(e){return e.location==="workspace-database"?"This backup was saved in the workspace's own database, which this server can't use now, so it can't be downloaded or restored":"This backup was saved in the server's backup storage, which isn't set up now (STORAGE_URL), so it can't be downloaded or restored"}const Lo=new Map;function vb(e,s,a){return`session-backup-restore:${JSON.stringify([e,s,a])}`}function wb(e){const s=Lo.get(e);if(s)return s;const a=sessionStorage.getItem(e);if(!a)return;const l=JSON.parse(a);if(!l||typeof l!="object"||!("requestId"in l)||typeof l.requestId!="string"||"title"in l&&typeof l.title!="string"||"targetSessionId"in l&&typeof l.targetSessionId!="string")throw new Error("The saved restore request could not be read. Restore is paused to avoid creating a duplicate session.");const c=l;return Lo.set(e,c),c}function Vv(e,s){return`/api/sessions/${ce(e)}/backups/${ce(s)}/download`}function VE({sourceId:e,ownerId:s,backups:a,latestBackup:l,refreshKey:c,openSession:u}){const d=`/api/sessions/${ce(e)}`,[h,g]=E.useState(""),[m,y]=E.useState(""),[b,v]=E.useState(),[x,w]=E.useState(""),[S,T]=E.useState(""),[k,z]=E.useState(!1),A=E.useRef(!1),I=a.data?.backups.find(ie=>ie.id===h),q=!!I?.unavailable&&!b?.targetSessionId;E.useEffect(()=>{(l||c)&&a.refresh()},[l,c,a.refresh]);function _(ie){if(!k&&(g(ie),w(""),T(""),v(void 0),y(""),!!ie))try{const G=wb(vb(s,e,ie));v(G),y(G?.title??"")}catch(G){T(`Cannot safely resume restore: ${Sn(G)}`)}}async function F(ie){if(ie.preventDefault(),!(!I||A.current||S||q)){A.current=!0,z(!0),w("");try{const G=vb(s,e,I.id);let U=wb(G);if(!U){const ee=m.trim();if(ee.length>200||ee.includes("\0"))throw new Error("Use a title of at most 200 characters with no NUL characters, or leave it blank");U={requestId:crypto.randomUUID(),...ee?{title:ee}:{}},sessionStorage.setItem(G,JSON.stringify(U)),Lo.set(G,U)}if(v(U),U.targetSessionId){u(U.targetSessionId);return}const M=await he(`${d}/backups/${ce(I.id)}/restore`,{method:"POST",body:{requestId:U.requestId,...U.title?{title:U.title}:{}}});if(!M.session?.id||M.session.id===e||M.restore?.status!=="completed"||M.restore.sourceSessionId!==e||M.restore.backupId!==I.id||M.restore.targetSessionId!==M.session.id)throw new Error("The server did not confirm a completed restore into a new session. Retry this same request to resolve its outcome.");const W={...U,targetSessionId:M.session.id};Lo.set(G,W),v(W);try{sessionStorage.setItem(G,JSON.stringify(W))}catch{}u(M.session.id)}catch(G){w(Sn(G))}finally{A.current=!1,z(!1)}}}if(a.loading)return i.jsx(ae,{title:i.jsx(Ht,{children:"Loading backups..."})});if(a.error)return i.jsx(ae,{title:"Unable to load backups",hint:a.error,trailing:i.jsx(V,{variant:"outline",size:"sm",onClick:a.refresh,children:"Try again"})});const oe=a.data?.backups??[],ne=a.data?.enabled!==!1,B=a.data?.workspaceDatabase,H=ne?B&&i.jsx(ae,{leading:i.jsx(ve,{name:"server",size:16}),title:"Saved to the workspace database",hint:B.confirm?`New backups of this session go to ${vo(B)}, which the workspace owner connected. Whoever can read it can read them, including your personal environment values; you confirm before each backup`:B.consented?`New backups of this session go to ${vo(B)}, which the workspace owner connected and you confirmed. Whoever can read it can read them, including your personal environment values`:`New backups of this session go to ${vo(B)}, the database you connected for this workspace`}):i.jsx(ae,{leading:i.jsx(ve,{name:"info",size:16}),title:"Backups are off",hint:YE(a.data?.destination)}),K=ne&&a.data?.automaticBackups,re=K&&i.jsx(ae,{leading:i.jsx(ve,{name:K.error?"info":"refresh",size:16}),title:"Automatic backups",hint:FE(K)});return oe.length?i.jsxs(i.Fragment,{children:[H,re,oe.map(ie=>i.jsxs("div",{className:"backup-item",children:[i.jsx(ae,{leading:i.jsx(ve,{name:"archive",size:16}),title:i.jsx(Kt,{value:ie.createdAt}),hint:`${ie.size} bytes${Pv(ie)}${ie.unavailable?" · Unavailable":""}`,trailing:i.jsx(ve,{name:ie.id===h?"chevron-down":"chevron-right",size:16}),onClick:()=>_(ie.id===h?"":ie.id)}),I?.id===ie.id&&i.jsx("form",{className:"backup-detail",onSubmit:F,children:i.jsxs("fieldset",{disabled:k,className:"stack",children:[i.jsxs("p",{className:"muted small",children:["ID ",i.jsx("code",{children:I.id}),"; SHA-256 ",i.jsx("code",{children:I.sha256})]}),I.unavailable?i.jsx("p",{className:"small",children:PE(I)}):i.jsx("div",{className:"inline",children:i.jsx(Bt,{variant:"outline",size:"sm",icon:"external",href:Vv(e,I.id),children:"Download backup"})}),i.jsx(be,{label:"New session title",hint:"Optional. Restore creates a new private session and never overwrites this one",children:i.jsx("input",{className:"input",autoComplete:"off",maxLength:200,value:m,disabled:!!b||!!S||q,onChange:G=>y(G.target.value)})}),b&&i.jsxs("p",{className:"muted small",children:["Restore request ",i.jsx("code",{children:b.requestId}),". Retrying reuses this request ID and title, so it resolves the same new session instead of creating another."]}),i.jsxs("div",{className:"inline",children:[i.jsx(V,{type:"submit",variant:"secondary",size:"sm",disabled:!!S||q,children:k?"Restoring...":b?.targetSessionId?"Open restored session":b?"Retry same restore":"Restore into new private session"}),k&&i.jsx(Ht,{children:"Waiting for the server to confirm the new session..."})]}),i.jsx(Ce,{error:S||x}),x&&b&&!b.targetSessionId&&i.jsx(ke,{variant:"warning",title:"Outcome not confirmed",children:"Retry the same restore; an error doesn't mean no session was created."}),b?.targetSessionId&&i.jsxs("p",{className:"muted small",role:"status",children:["Restored session: ",i.jsx("code",{children:b.targetSessionId}),". It is private; only its owner, or the workspace's owner or an admin, can change visibility."]})]})})]},ie.id))]}):i.jsxs(i.Fragment,{children:[H,re,ne&&i.jsx(ae,{title:"No backups yet",hint:"Listing and downloading work while the host is offline"})]})}function ZE({session:e,user:s,hosts:a,openSession:l,changed:c}){const u=qe(`/api/workspaces/${ce(e.workspaceId)}/models`),d=qe(`/api/sessions/${ce(e.id)}/migrations`),[h,g]=E.useState(""),[m,y]=E.useState(""),[b,v]=E.useState(""),[x,w]=E.useState(""),[S,T]=E.useState(!1),k=a.data?.connectors??[],z=k.find(H=>H.id===e.connectorId),A=d.data?.migrations.find(H=>H.status==="pending"&&H.sourceSessionId===e.id),I=E.useMemo(()=>(u.data?.models??[]).flatMap(H=>{const K=k.find(re=>re.id===H.connectorId);return!K||K.id===e.connectorId||K.revokedAt||K.capabilities.hostMigration!==!0||!K.models.some(re=>re.provider===H.provider&&re.modelId===H.modelId)?[]:[{model:H,host:K}]}),[u.data,k,e.connectorId]),q=I.find(H=>H.model.id===h),_=!!(q&&q.host.ownerId!==s.id),F=!!(q&&q.host.online&&z?.online&&(!_||b===q.host.id)&&!S);async function oe(H){T(!0),w("");try{const K=await he(`/api/sessions/${ce(e.id)}/migrate`,{method:"POST",body:H});if(K.migration?.status!=="completed"||K.migration.sourceSessionId!==e.id||K.migration.targetSessionId!==K.session?.id)throw new Error("The server did not confirm the move. Retry it to resolve its outcome.");c(),l(K.session.id)}catch(K){w(Sn(K)),d.refresh()}finally{T(!1)}}async function ne(H){if(H.preventDefault(),!q||!F||!await Ge({title:"Move session",message:`Move this session to ${q.host.name} (${q.model.name})? Its conversation, files and history are copied there into a new session, and this one is archived. ${_?`${q.host.name}'s owner can access prompts and files processed on it. `:""}Session grants aren't copied.`,confirmLabel:"Move session"}))return;const re=m.trim();await oe({requestId:crypto.randomUUID(),modelId:q.model.id,...re?{title:re}:{},..._?{trustedConnectorId:q.host.id}:{}})}async function B(){if(!(!A||!await Ge({title:"Cancel move",message:"Cancel this move? This session accepts work again, and the unfinished copy on the other host is archived.",confirmLabel:"Cancel move",cancelLabel:"Keep",destructive:!0}))){T(!0),w("");try{await he(`/api/sessions/${ce(e.id)}/migrations/${ce(A.id)}/cancel`,{method:"POST"}),d.refresh(),c()}catch(K){w(Sn(K))}finally{T(!1)}}}return i.jsxs(Oe,{title:"Move to another host",info:i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Copies this session's conversation, files and history to a model on another connected host, then archives this session. Both hosts must be connected and the session idle. No backup storage is needed."}),i.jsx("p",{children:"The new session keeps the same repositories, visibility and agent instructions, with the tools the new host can carry. Session grants and approvals given for the rest of this session aren't copied."})]}),children:[A?i.jsxs(i.Fragment,{children:[i.jsx(ae,{leading:i.jsx(ve,{name:"refresh",size:16}),title:"Move in progress",hint:i.jsxs(i.Fragment,{children:["To ",k.find(H=>H.id===A.targetConnectorId)?.name??"another host",". This session accepts only reads until the move finishes or is cancelled"]})}),i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"secondary",size:"sm",disabled:S,onClick:()=>{oe({requestId:A.requestId,modelId:A.modelId,...A.title!==null?{title:A.title}:{},trustedConnectorId:A.targetConnectorId})},children:S?"Moving...":"Retry move"}),i.jsx(V,{variant:"outline",size:"sm",disabled:S,onClick:()=>{B()},children:"Cancel move"}),S&&i.jsx(Ht,{children:"Waiting for the other host..."})]})]}):u.loading||d.loading||a.loading?i.jsx(ae,{title:i.jsx(Ht,{children:"Loading hosts..."})}):I.length?i.jsxs("form",{className:"stack",onSubmit:H=>{ne(H)},children:[i.jsx(be,{label:"Model on the new host",children:i.jsxs("select",{className:"input",value:h,disabled:S,onChange:H=>{g(H.target.value),v("")},children:[i.jsx("option",{value:"",children:"Choose a model..."}),I.map(({model:H,host:K})=>i.jsxs("option",{value:H.id,children:[K.name," · ",H.name,K.online?"":" (offline)"]},H.id))]})}),i.jsx(be,{label:"New session title",hint:"Optional. Defaults to this session's title",children:i.jsx("input",{className:"input",autoComplete:"off",maxLength:200,value:m,disabled:S,onChange:H=>y(H.target.value)})}),q&&_&&i.jsxs("label",{className:"inline small",children:[i.jsx("input",{type:"checkbox",checked:b===q.host.id,onChange:H=>v(H.target.checked?q.host.id:"")}),"I understand that ",q.host.name,"'s owner can access this session's prompts and files"]}),q&&!q.host.online&&i.jsxs(ke,{variant:"warning",title:"Host offline",children:[q.host.name," must be connected to receive the session."]}),!z?.online&&i.jsx(ke,{variant:"warning",title:"This session's host is offline",children:"Both hosts must be connected to start a move."}),i.jsxs("div",{className:"inline",children:[i.jsx(V,{type:"submit",variant:"secondary",size:"sm",disabled:!F,children:S?"Moving...":"Move session"}),S&&i.jsx(Ht,{children:"Copying the session to the new host..."})]})]}):i.jsx(ae,{leading:i.jsx(ve,{name:"info",size:16}),title:"No other host available",hint:"Another connected host in this workspace, with an up-to-date connector on Linux, must offer a model here"}),i.jsx(Ce,{error:x||u.error||d.error||a.error})]})}const QE="modulepreload",XE=function(e){return"/"+e},jb={},KE=function(s,a,l){let c=Promise.resolve();if(a&&a.length>0){let g=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");c=g(a.map(m=>{if(m=XE(m),m in jb)return;jb[m]=!0;const y=m.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${b}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":QE,y||(v.as="script"),v.crossOrigin="",v.href=m,h&&v.setAttribute("nonce",h),document.head.appendChild(v),y)return new Promise((x,w)=>{v.addEventListener("load",x),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return s().catch(u)})};let Zv;async function JE(){const{createLowlight:e,common:s}=await KE(async()=>{const{createLowlight:a,common:l}=await import("./index-ZSxhzT-_.js");return{createLowlight:a,common:l}},[]);return e(s)}const kb={makefile:"makefile",gnumakefile:"makefile",gemfile:"ruby",rakefile:"ruby",podfile:"ruby",vagrantfile:"ruby","cmakelists.txt":"plaintext",".bashrc":"bash",".zshrc":"bash",".profile":"bash",".env":"bash",".gitconfig":"ini",".editorconfig":"ini",".npmrc":"ini",pipfile:"ini"},WE={h:"c",hh:"cpp",hxx:"cpp",ipp:"cpp",mdx:"markdown",jsonc:"json",json5:"json",geojson:"json",webmanifest:"json",lock:"plaintext",txt:"plaintext",log:"plaintext",csv:"plaintext",svelte:"xml",vue:"xml",astro:"xml",pyi:"python",pyw:"python",gemspec:"ruby",rake:"ruby",ru:"ruby",kts:"kotlin",gradle:"kotlin",cjs:"javascript",mjs:"javascript",mts:"typescript",cts:"typescript",fish:"bash",ksh:"bash",conf:"ini",cfg:"ini",properties:"ini",env:"bash",pem:"plaintext",tf:"plaintext",proto:"plaintext"},ez=128*1024;function tz(e,s){const a=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(kb[a])return kb[a];if(a.startsWith(".env."))return"bash";if(a.startsWith("dockerfile"))return s("dockerfile")?"dockerfile":"bash";const l=a.lastIndexOf(".");if(l<=0)return null;const c=a.slice(l+1),u=WE[c]??c;return s(u)?u:null}function Qv(e){return e.map((s,a)=>{if(s.type==="text")return s.value;if(s.type!=="element")return null;const l=s.properties?.className;return i.jsx("span",{className:Array.isArray(l)?l.join(" "):void 0,children:Qv(s.children)},a)})}function nz(e,s){const[a,l]=E.useState(null);return E.useEffect(()=>{let c=!0;return sz().then(u=>{c&&l(u)},()=>{Zv=void 0}),()=>{c=!1}},[]),E.useMemo(()=>a?iz(a,e,s):{content:e,language:null},[a,e,s])}function iz(e,s,a){const l=tz(a,c=>e.registered(c));if(!l||l==="plaintext")return{content:s,language:null};if(s.length>ez)return{content:s,language:null,tooLarge:!0};try{return{content:Qv(e.highlight(l,s).children),language:l}}catch{return{content:s,language:null}}}function sz(){return Zv??=JE()}function Xv({text:e,path:s}){const{content:a,language:l,tooLarge:c}=nz(e,s),u=E.useMemo(()=>{const d=e.split(`
46
- `).length-(e.endsWith(`
47
- `)?1:0);return Array.from({length:Math.max(d,1)},(h,g)=>g+1).join(`
48
- `)},[e]);return i.jsxs("div",{className:"stack",children:[i.jsxs("div",{className:"code-view","data-language":l??void 0,children:[i.jsx("pre",{className:"code-gutter","aria-hidden":"true",children:u}),i.jsx("pre",{className:"code-text",children:i.jsx("code",{className:l?`hljs language-${l}`:void 0,children:a})})]}),c&&i.jsx("p",{className:"muted small",children:"Highlighting is off for text over 128 KB."})]})}function az(e,s){return e==="."?s:`${e}/${s}`}function rz(e){const s=e.lastIndexOf("/");return s<0?".":e.slice(0,s)}function wo(e){if(e<1024)return`${e} B`;const s=["KB","MB","GB","TB"];let a=e/1024,l=0;for(;a>=1024&&l<s.length-1;)a/=1024,l++;return`${a<10?a.toFixed(1):Math.round(a)} ${s[l]}`}const lz={directory:"folder",file:"file",symlink:"link",other:"file"};function oz({session:e}){const s=e.permissions??[],[a,l]=E.useState("."),[c,u]=E.useState(null);if(E.useEffect(()=>{l("."),u(null)},[e.id]),e.status==="archived")return i.jsx(jt,{title:"Files unavailable",children:"Archived sessions don't show their files. Unarchive the session to browse them."});if(!s.includes("write"))return i.jsx(jt,{title:"Files unavailable",children:"Browsing the session's files takes the session collaborator role, as collaborators can already have the agent read any of them. Viewers follow the conversation."});const d=h=>{l(h),u(null)};return c?i.jsx(uz,{session:e,path:c,onBack:()=>u(null),onDirectory:d}):i.jsx(cz,{session:e,path:a,onOpen:d,onFile:u})}function Kv(e,s){return`/api/sessions/${ce(e.id)}/files?path=${encodeURIComponent(s)}`}function Jv({path:e,onOpen:s}){const a=e==="."?[]:e.split("/");return i.jsxs("nav",{className:"file-breadcrumbs","aria-label":"Worktree path",children:[i.jsx("button",{type:"button",className:"file-crumb",onClick:()=>s("."),disabled:!a.length,children:"worktree"}),a.map((l,c)=>{const u=a.slice(0,c+1).join("/"),d=c===a.length-1;return i.jsxs("span",{className:"file-crumb-item",children:[i.jsx("span",{className:"muted","aria-hidden":"true",children:"/"}),i.jsx("button",{type:"button",className:"file-crumb",onClick:()=>s(u),disabled:d,"aria-current":d?"location":void 0,children:l})]},u)})]})}function cz({session:e,path:s,onOpen:a,onFile:l}){const c=qe(Kv(e,s)),u=c.data?.files;return E.useEffect(()=>{u?.type==="file"&&l(s)},[u,s,l]),i.jsxs("div",{className:"file-browser",children:[i.jsxs("div",{className:"file-browser-bar",children:[i.jsx(Jv,{path:s,onOpen:a}),i.jsx("span",{className:"spacer"}),i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh files",title:"Refresh",disabled:c.loading,onClick:c.refresh})]}),i.jsx(dt,{loading:c.loading&&!u,error:c.error,retry:c.refresh,children:u?.type==="directory"&&(u.entries.length||s!=="."?i.jsxs("div",{className:"card file-list",children:[s!=="."&&i.jsx(ae,{leading:i.jsx(ve,{name:"chevron-left",size:16}),title:"..",hint:"Parent directory",onClick:()=>a(rz(s))}),u.entries.map(d=>{const h=az(s,d.name);return i.jsx(ae,{leading:i.jsx(ve,{name:lz[d.type],size:16}),title:i.jsxs("span",{className:"file-name",children:[d.name,d.type==="directory"?"/":""]}),hint:d.type==="symlink"?"Symlink":d.type==="other"?"Special file":void 0,trailing:d.size!==void 0?i.jsx("span",{className:"muted small",children:wo(d.size)}):void 0,onClick:d.type==="other"?void 0:()=>d.type==="directory"?a(h):l(h)},d.name)}),!u.entries.length&&i.jsx(ae,{title:"Empty directory"}),u.truncated&&i.jsx(ae,{title:`Showing ${u.entries.length} of ${u.total} entries`,hint:"Directories first, then by name"})]}):i.jsx(jt,{title:"The worktree is empty",children:"The agent clones the session's repositories into it as it works."}))})]})}function uz({session:e,path:s,onBack:a,onDirectory:l}){const c=qe(Kv(e,s)),u=c.data?.files;return E.useEffect(()=>{u?.type==="directory"&&l(s)},[u,s,l]),i.jsxs("div",{className:"file-browser",children:[i.jsxs("div",{className:"file-browser-bar",children:[i.jsx(V,{variant:"ghost",size:"xs",icon:"chevron-left","aria-label":"Back to directory",title:"Back",onClick:a}),i.jsx(Jv,{path:s,onOpen:l}),i.jsx("span",{className:"spacer"}),i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh file",title:"Refresh",disabled:c.loading,onClick:c.refresh})]}),i.jsx(dt,{loading:c.loading&&!u,error:c.error,retry:c.refresh,children:u?.type==="file"&&i.jsxs("div",{className:"stack",children:[i.jsxs("p",{className:"muted small",children:[wo(u.size),u.text!==void 0&&u.truncated?` · showing the first ${wo(py.textBytes)}`:""]}),u.redacted&&i.jsxs(ke,{title:"Secret hidden",children:["Something that looks like a secret is shown as ",i.jsx("code",{children:wt}),", as in the conversation."]}),u.text!==void 0&&(u.text?dz(s)&&!u.truncated?i.jsx(hz,{text:u.text,path:s},s):i.jsx(Xv,{text:u.text,path:s}):i.jsx(jt,{title:"Empty file"})),u.image&&i.jsx(Wv,{src:`data:${u.image.mimeType};base64,${u.image.data}`,path:s},s),u.binary&&i.jsx(jt,{title:u.truncated?"Too large to preview":"No preview",children:u.truncated?`Images up to ${wo(py.imageBytes)} are shown.`:"This isn't a text file or an image."})]})})]})}const dz=e=>/\.svg$/i.test(e);function Wv({src:e,path:s}){const[a,l]=E.useState(null),[c,u]=E.useState(!1),[d,h]=E.useState(!1);return d?i.jsx(jt,{title:"Can't show this image",children:"The browser couldn't decode it."}):i.jsxs("figure",{className:"file-image-view",children:[i.jsx("button",{type:"button",className:c?"file-image-frame actual":"file-image-frame",onClick:()=>u(g=>!g),title:c?"Fit to panel":"Show actual size","aria-label":c?"Fit image to panel":"Show image at actual size",children:i.jsx("img",{className:"file-image",alt:s,src:e,draggable:!1,onLoad:g=>l({width:g.currentTarget.naturalWidth,height:g.currentTarget.naturalHeight}),onError:()=>h(!0)})}),a&&i.jsxs("figcaption",{className:"muted small",children:[a.width," × ",a.height," px · ",c?"actual size":"fit to panel"]})]})}function hz({text:e,path:s}){const[a,l]=E.useState("preview");return i.jsxs("div",{className:"stack",children:[i.jsx(Aa,{size:"xs",label:"SVG view",value:a,onChange:l,options:[{value:"preview",label:"Preview"},{value:"source",label:"Source"}]}),a==="preview"?i.jsx(Wv,{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,path:s}):i.jsx(Xv,{text:e,path:s})]})}const hh=5,fz={"@hourly":"0 * * * *","@daily":"0 0 * * *","@midnight":"0 0 * * *","@weekly":"0 0 * * 0","@monthly":"0 0 1 * *","@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *"},mz=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],pz=["sun","mon","tue","wed","thu","fri","sat"];class Yn extends Error{}function Ud(e,s,a,l,c=0){const u=e.toLowerCase(),d=l?.indexOf(u)??-1;if(d>=0)return d+c;if(!/^\d{1,2}$/.test(e))throw new Yn(`"${e}" is not a valid value.`);const h=Number(e);if(h<s||h>a)throw new Yn(`${h} is outside ${s}-${a}.`);return h}function Er(e,s,a,l,c,u=0){const d=new Set;if(e==="*"||e==="?"){for(let h=s;h<=a;h++)d.add(h);return{values:d,any:!0}}try{for(const h of e.split(",")){const[g,m,y]=h.split("/");if(y!==void 0||!g)throw new Yn(`"${h}" is not a valid entry.`);let b=1;if(m!==void 0){if(!/^\d{1,2}$/.test(m)||Number(m)<1)throw new Yn(`"${m}" is not a valid step.`);b=Number(m)}let v,x;if(g==="*")v=s,x=a;else if(g.includes("-")){const[w,S,T]=g.split("-");if(T!==void 0||!w||!S)throw new Yn(`"${g}" is not a valid range.`);if(v=Ud(w,s,a,c,u),x=Ud(S,s,a,c,u),v>x)throw new Yn(`"${g}" runs backwards.`)}else v=Ud(g,s,a,c,u),x=m===void 0?v:a;for(let w=v;w<=x;w+=b)d.add(w)}}catch(h){throw h instanceof Yn?new Yn(`${l}: ${h.message}`):h}return{values:d,any:!1}}function ew(e){const s=e.trim().replace(/\s+/g," "),l=(fz[s.toLowerCase()]??s).split(" ");if(l.length!==5)throw new Yn("A schedule has five fields: minute, hour, day of month, month and day of week.");const[c,u,d,h,g]=l,m=Er(c,0,59,"Minute"),y=Er(u,0,23,"Hour"),b=Er(d,1,31,"Day of month"),v=Er(h,1,12,"Month",mz,1),x=Er(g,0,7,"Day of week",pz);x.values.delete(7)&&x.values.add(0);const w=[...m.values].sort((S,T)=>S-T);for(let S=0;S<w.length;S++){const T=S+1<w.length?w[S+1]:w[0]+60;if(w.length>1&&T-w[S]<hh)throw new Yn(`Runs must be at least ${hh} minutes apart.`)}return{minutes:m.values,hours:y.values,days:b.values,months:v.values,weekdays:x.values,anyDay:b.any,anyWeekday:x.any}}const Sb=new Map;function tw(e){let s=Sb.get(e);return s||(s=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Sb.set(e,s)),s}function gz(e){if(typeof e!="string"||!e||e.length>64)return!1;try{return tw(e),!0}catch{return!1}}function jo(e,s){const a={};for(const l of tw(s).formatToParts(new Date(e)))l.type!=="literal"&&(a[l.type]=Number(l.value));return Date.UTC(a.year,a.month-1,a.day,a.hour,a.minute,a.second)}function yz(e,s){let a=e-(jo(e,s)-e);return a=e-(jo(a,s)-a),jo(a,s)===e?a:null}function bz(e,s){const a=e.days.has(s.getUTCDate()),l=e.weekdays.has(s.getUTCDay());return e.anyDay&&e.anyWeekday?!0:e.anyDay?l:e.anyWeekday?a:a||l}const Rr=6e4,xz=60*Rr,vz=24*xz;function wz(e,s,a){const l=typeof e=="string"?ew(e):e;let c=Math.floor(jo(a,s)/Rr)*Rr+Rr;const u=c+5*366*vz;for(;c<u;){const d=new Date(c);if(!l.months.has(d.getUTCMonth()+1)){c=Date.UTC(d.getUTCFullYear(),d.getUTCMonth()+1,1);continue}if(!bz(l,d)){c=Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()+1);continue}if(!l.hours.has(d.getUTCHours())){c=Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCHours()+1);continue}if(l.minutes.has(d.getUTCMinutes())){const h=yz(c,s);if(h!==null&&h>a)return h}c+=Rr}return null}const Cb=[{label:"Every hour",cron:"0 * * * *"},{label:"Every day at 09:00",cron:"0 9 * * *"},{label:"Weekdays at 09:00",cron:"0 9 * * 1-5"},{label:"Every Monday at 09:00",cron:"0 9 * * 1"},{label:"First of the month at 09:00",cron:"0 9 1 * *"}],nw={read:"Read-only",approval:"Ask for approval",auto:"Auto-approve"},jz={read:"The agent can look, but changes nothing",approval:"Commands and pushes wait for someone to approve them, as in the chat box",auto:"Commands run without asking, under your auto-approve. Nobody may be watching when it runs"},kz={session_busy:"Skipped: the agent was busy or waiting for an approval",connector_offline:"The host was offline",connector_unavailable:"The host was unavailable",connector_relay_error:"The host didn't answer",forbidden:"You no longer have write access",session_frozen:"The session runs nothing"};function Sz(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Cz(e){const s=Math.max(0,(new Date(e).getTime()-Date.now())/1e3);return s<60?"in under a minute":s<3600?`in ${Math.round(s/60)}m`:s<86400?`in ${Math.round(s/3600)}h`:`in ${Math.round(s/86400)}d`}function Az(e,s){if(!gz(s))return{error:"Unknown time zone.",field:"timeZone"};try{const a=ew(e),l=[];let c=Date.now();for(let u=0;u<3;u++){const d=wz(a,s,c);if(d===null)break;l.push(new Date(d).toISOString()),c=d}return l.length?{runs:l}:{error:"This schedule never comes round.",field:"cron"}}catch(a){return{error:a instanceof Yn?a.message:"Invalid schedule.",field:"cron"}}}function Tz({session:e,changed:s}){const a=`/api/sessions/${ce(e.id)}/schedules`,l=qe(a),{refreshSessions:c}=yt(),u=Ne(),[d,h]=E.useState(null),g=!!l.data?.canManage&&!e.frozen,m=()=>{l.refresh(),c(),s()},y=`${e.nextScheduledAt??""}|${e.activity??""}`,b=E.useRef(y),{refresh:v}=l;E.useEffect(()=>{b.current!==y&&(b.current=y,v())},[y,v]);function x(k){u.run(async()=>{await he(`${a}/${ce(k.id)}`,{method:"PATCH",body:{enabled:!k.enabled}}),m()},k.enabled?`Paused ${k.name}`:`Resumed ${k.name}`)}function w(k){u.run(async()=>{await he(`${a}/${ce(k.id)}/run`,{method:"POST"}),m()},`Sent ${k.name} to the agent`)}async function S(k){await Ge({title:"Delete schedule?",message:`${k.name} stops waking the agent. Messages it already sent stay in the conversation.`,confirmLabel:"Delete",destructive:!0})&&await u.run(async()=>{await he(`${a}/${ce(k.id)}`,{method:"DELETE"}),m()},`Deleted ${k.name}`)}if(d)return i.jsx(Nz,{base:a,schedule:d==="new"?null:d,isOwner:g,onDone:k=>{h(null),k&&m()}});const T=l.data?.schedules??[];return i.jsxs(Oe,{title:i.jsxs(i.Fragment,{children:["Scheduled prompts ",T.length>0&&i.jsx("span",{className:"muted",children:T.length})]}),info:i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"A scheduled prompt sends the agent a message on a schedule, as the session owner, so the session wakes up and works on its own: a nightly check, a weekly report."}),i.jsx("p",{children:"A run that comes while the agent is working or waiting for an approval is skipped, not queued. Runs missed while the host or server was offline aren't caught up. The session's host must be online."}),i.jsx("p",{children:"Only the session owner manages its schedules; everyone who can view the session sees them."})]}),action:i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh schedules",title:"Refresh",disabled:l.loading,onClick:l.refresh}),g&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",onClick:()=>h("new"),children:"New"})]}),bare:!0,children:[i.jsx(dt,{...l,retry:l.refresh,children:T.length?i.jsx("div",{className:"stack",children:T.map(k=>i.jsxs("article",{className:"card schedule-card",children:[i.jsx(ae,{leading:i.jsx(ve,{name:"clock",size:16}),title:k.name,hint:i.jsxs(i.Fragment,{children:[i.jsx("code",{children:k.cron})," · ",k.timeZone," · ",nw[k.access]]}),trailing:k.enabled?k.nextRunAt?i.jsxs(Te,{tone:"info",children:["Next ",Cz(k.nextRunAt)]}):i.jsx(Te,{tone:"warning",children:"Never runs"}):i.jsx(Te,{tone:"neutral",children:"Paused"})}),i.jsxs(Re,{children:[i.jsx("pre",{className:"schedule-content",children:k.content}),i.jsxs("p",{className:"muted small",children:[k.enabled&&k.nextRunAt&&i.jsxs(i.Fragment,{children:["Next run ",i.jsx(Kt,{value:k.nextRunAt}),". "]}),k.lastRunAt?i.jsxs(i.Fragment,{children:["Last run ",i.jsx(Kt,{value:k.lastRunAt}),k.lastError?i.jsxs(i.Fragment,{children:[": ",i.jsx("span",{className:"session-status warning",children:kz[k.lastError]??k.lastError})]}):" sent its message","."]}):"Hasn't run yet."]}),g&&i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>x(k),children:k.enabled?"Pause":"Resume"}),i.jsx(V,{variant:"ghost",size:"sm",disabled:u.busy,title:"Send its message now; its schedule stays as it is",onClick:()=>w(k),children:"Run now"}),i.jsx(V,{variant:"ghost",size:"sm",icon:"pencil",disabled:u.busy,onClick:()=>h(k),children:"Edit"}),i.jsx(V,{variant:"ghost",size:"sm",icon:"trash",disabled:u.busy,"aria-label":`Delete ${k.name}`,title:"Delete",onClick:()=>{S(k)}})]})]})]},k.id))}):i.jsx(jt,{title:"No scheduled prompts",children:g?"Wake the agent with a message every hour, day or week.":"The session owner hasn't scheduled any prompts."})}),i.jsx(Ce,{error:u.error,notice:u.notice})]})}function Nz({base:e,schedule:s,isOwner:a,onDone:l}){const c=Ne(),[u,d]=E.useState(s?.name??""),[h,g]=E.useState(s?.cron??"0 9 * * 1-5"),[m,y]=E.useState(s?.timeZone??Sz()),[b,v]=E.useState(s?.content??""),[x,w]=E.useState(s?.access??"approval"),S=E.useMemo(()=>Az(h,m),[h,m]),T=Cb.find(A=>A.cron===h.trim())?.cron??"",k=a&&b.trim().length>0&&"runs"in S;function z(A){A.preventDefault(),!(!k||c.busy)&&c.run(async()=>{const I={name:u.trim(),cron:h,timeZone:m,content:b,access:x};s?await he(`${e}/${ce(s.id)}`,{method:"PATCH",body:{...I,...I.name?{}:{name:s.name}}}):await he(e,{method:"POST",body:I}),l(!0)})}return i.jsx(Oe,{title:s?"Edit scheduled prompt":"New scheduled prompt",bare:!0,children:i.jsx("form",{className:"card",onSubmit:z,children:i.jsx(Re,{children:i.jsxs("fieldset",{disabled:c.busy,className:"stack",children:[i.jsx(be,{label:"Message",hint:"Sent to the agent as you, as if you typed it in the chat box",children:i.jsx("textarea",{className:"textarea",required:!0,autoFocus:!s,rows:4,value:b,onChange:A=>v(A.target.value),placeholder:"Pull main, run the tests and summarise any failures"})}),i.jsx(be,{label:"Name",hint:"Optional; the message's first line otherwise",children:i.jsx("input",{className:"input",maxLength:100,value:u,onChange:A=>d(A.target.value),placeholder:"Nightly test run"})}),i.jsx(be,{label:"Repeat",children:i.jsxs("select",{className:"select",value:T,onChange:A=>{A.target.value&&g(A.target.value)},children:[Cb.map(A=>i.jsx("option",{value:A.cron,children:A.label},A.cron)),i.jsx("option",{value:"",children:"Custom"})]})}),i.jsx(be,{label:"Cron expression",hint:i.jsxs(i.Fragment,{children:["Minute, hour, day of month, month, day of week, as in crontab: ",i.jsx("code",{children:"*/30 8-18 * * mon-fri"}),". Runs at least ",hh," minutes apart."]}),error:"error"in S&&S.field==="cron"?S.error:void 0,children:i.jsx("input",{className:"input mono",required:!0,spellCheck:!1,autoComplete:"off",value:h,onChange:A=>g(A.target.value)})}),i.jsx(be,{label:"Time zone",hint:"IANA name, such as UTC or Europe/Berlin",error:"error"in S&&S.field==="timeZone"?S.error:void 0,children:i.jsx("input",{className:"input",required:!0,spellCheck:!1,autoComplete:"off",value:m,onChange:A=>y(A.target.value)})}),"runs"in S&&i.jsxs("p",{className:"muted small",children:["Next runs: ",S.runs.map((A,I)=>i.jsxs("span",{children:[I?", ":"",i.jsx(Kt,{value:A})]},A))]}),i.jsx(be,{label:"Access",hint:jz[x],children:i.jsx("select",{className:"select",value:x,onChange:A=>w(A.target.value),children:["approval","read","auto"].map(A=>i.jsx("option",{value:A,children:nw[A]},A))})}),x==="auto"&&i.jsx(ke,{variant:"error",title:"Runs commands unattended",children:"Every command this message's work runs is approved automatically, at times when nobody may be watching."}),i.jsxs("div",{className:"inline",children:[i.jsx(V,{type:"submit",variant:"default",size:"sm",disabled:!k,children:c.busy?"Saving...":s?"Save":"Create schedule"}),i.jsx(V,{variant:"ghost",size:"sm",onClick:()=>l(!1),children:"Cancel"})]}),i.jsx(Ce,{error:c.error}),c.busy&&i.jsx(Ht,{children:"Saving"})]})})})})}const Ez={ask:"Side ask",send:"Message",create:"Opening message",notify:"Notification"},zz={pending:{label:"Will notify",tone:"info"},delivered:{label:"Notified",tone:"success"},failed:{label:"Notification failed",tone:"danger"},expired:{label:"Notification expired",tone:"neutral"}};function Ab({session:e,relation:s}){return i.jsx(ae,{href:Qe({name:"session",sessionId:e.id}),chevron:!0,leading:i.jsx(ve,{name:"link",size:16}),title:i.jsx("span",{className:"truncate",children:e.title}),hint:i.jsxs(i.Fragment,{children:[s," · ",e.status==="archived"?"Archived":e.activity??e.status]})})}function Oz({session:e}){const s=qe(`/api/sessions/${ce(e.id)}/connections`),a=s.data;return a&&!a.parent&&!a.children.length&&!a.messages.length?null:i.jsx(Oe,{title:"Connected sessions",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Agents work with other sessions through the sessions tool, always as the person whose message they work on, with that person's own permissions there."}),i.jsx("p",{children:"Messages they send name this session and their sender in their first line; Pikibun also records each one here. Approvals in another session are decided only by people there."})]}),children:i.jsx(dt,{loading:s.loading,error:s.error,retry:s.refresh,children:a&&i.jsxs(i.Fragment,{children:[a.parent&&i.jsx(Ab,{session:a.parent,relation:"Started this session"}),a.children.map(l=>i.jsx(Ab,{session:l,relation:"Started by this session"},l.id)),a.messages.map(l=>{const c=l.originSessionId===e.id,u=c?l.targetSessionId:l.originSessionId,d=l.notify&&zz[l.notify];return i.jsx(ae,{href:Qe({name:"session",sessionId:u}),leading:i.jsx(ve,{name:c?"send":"message",size:16}),title:i.jsxs("span",{className:"truncate",children:[Ez[l.kind]," ",c?"to":"from"," ",l.otherTitle]}),hint:i.jsxs(i.Fragment,{children:["By ",i.jsx(Ni,{id:l.actorId,you:!0})," · hop ",l.hops," · ",i.jsx(Zn,{value:l.createdAt})]}),trailing:d&&i.jsx(Te,{tone:d.tone,children:d.label})},l.id)})]})})})}function Rz({session:e,user:s,manages:a,backupBlocked:l,onChange:c}){const u=Ne(),[d,h]=E.useState(null),g=e?.ownerId===s.id,m=qe(e&&g&&e.status!=="archived"?`/api/sessions/${ce(e.id)}/backups`:null),y=m.data?.enabled===!1,b=!m.data&&!m.error,v=m.data?.conversationOnlySupported===!1;async function x(){if(!e||!a||u.busy)return;const A=(e.visibility??"private")==="workspace"?"private":"workspace";await Ge(A==="workspace"?{title:"Make session workspace-visible?",message:"All workspace members will be able to view existing and future prompts and output, including tool output, repository content shown in the transcript, and side asks, which may contain sensitive information. This grants viewing only, not direct GitHub access, permission to run tools, or ask/control permissions.",confirmLabel:"Make workspace-visible"}:{title:"Make session private?",message:"Workspace membership will no longer grant viewing access, except to the workspace's owner and admins, who manage every session. Existing explicit grants will remain in effect, and previously viewed or copied content cannot be recalled.",confirmLabel:"Make private"})&&await u.run(async()=>{await he(`/api/sessions/${ce(e.id)}`,{method:"PATCH",body:{visibility:A}}),c()},A==="workspace"?"Session is workspace-visible. Workspace members can view prompts and output.":"Session is private. Existing explicit grants still apply.")}async function w({conversationOnly:A=!1}={}){if(!e||!g||l||y||b||u.busy||A&&v)return;h(null);const I=`/api/sessions/${ce(e.id)}`;let q;try{const{workspaceDatabase:_}=await he(`${I}/backups`);if(_?.confirm){if(!await Ge({title:"Save to the workspace database?",message:`This backup is saved in ${vo(_)}, the database the workspace owner connected. Whoever can read it can read this session: its prompts, output${A?"":" and files"}, and your personal environment values.`,confirmLabel:"Save backup"}))return;q=_.id}}catch{}await u.run(async()=>{const _={...q?{trustedDatabaseId:q}:{},...A?{conversationOnly:!0}:{}},F=await he(`${I}/backup`,{method:"POST",...Object.keys(_).length?{body:_}:{}});h(F.backup),c()},A?"Conversation backup created":"Backup created")}async function S(A){const I=A.trim();if(!e||!a||u.busy||!I)return!1;if(I===e.title)return!0;let q=!1;return await u.run(async()=>{await he(`/api/sessions/${ce(e.id)}`,{method:"PATCH",body:{title:I}}),q=!0,c()},"Session renamed"),q}async function T(){!e||!a||u.busy||e.status==="archived"||!await Ge({title:"Archive session?",message:"The session becomes read-only for everyone and is hidden from the sidebar. Its history stays viewable, and nothing is deleted. Pending approvals can't be decided while it's archived. You can unarchive it later.",confirmLabel:"Archive"})||await u.run(async()=>{await he(`/api/sessions/${ce(e.id)}/archive`,{method:"POST"}),c()},"Session archived")}function k(){!e||!a||u.busy||e.status!=="archived"||u.run(async()=>{await he(`/api/sessions/${ce(e.id)}/unarchive`,{method:"POST"}),c()},e.packed?"Session unarchived, its files unpacked":"Session unarchived")}async function z(){!e||!g||u.busy||e.status!=="archived"||e.packed||!await Ge({title:"Pack this session's files?",message:"Its files on the host become one compressed file, to save the host's disk. Package caches and temporary files in its home folder are left out, and so are the files its clones' .gitignore ignores, such as node_modules: install them again when you need them. Clones keep their branches and uncommitted changes, and are cloned again when the session is unarchived, which unpacks the rest. The conversation stays as it is.",confirmLabel:"Pack files"})||await u.run(async()=>{await he(`/api/sessions/${ce(e.id)}/pack`,{method:"POST"}),c()},"Session files packed")}return{action:u,backup:d,backups:m,backupsOff:y,backupsPending:b,backupBlocked:l,changeVisibility:()=>{x()},createBackup:A=>{w(A)},conversationOnlyOff:v,rename:S,archive:()=>{T()},unarchive:k,pack:()=>{z()}}}const iw={pending:"warning",approved:"info",executing:"running",executed:"success",denied:"neutral",interrupted:"warning",failed:"danger"};function Dz({approval:e}){return i.jsxs(i.Fragment,{children:[e.automatic&&i.jsx(Te,{tone:"warning",children:"Auto-approved"}),i.jsx(Te,{tone:iw[e.status],dot:e.status==="executing",children:e.status})]})}function Tb({calls:e}){return!Array.isArray(e)||!e.length?null:i.jsxs("span",{className:"approval-marks",title:"Ran under the owner's auto-approve access, without a per-command decision",children:[i.jsx(Te,{tone:"warning",children:"Auto-approved"}),e.some(s=>s.unbounded)&&i.jsx(Te,{tone:"warning",children:"No resource limits"}),e.filter(s=>s.status!=="executed").map((s,a)=>i.jsx(Te,{tone:iw[s.status]??"neutral",dot:s.status==="executing",children:e.length>1?`${s.tool}: ${s.status}`:s.status},a))]})}function Mz(e,s){let a=e;if(typeof e=="string")try{a=JSON.parse(e)}catch{return e}return JSON.stringify(Zd(a,s),null,2)??""}function Lz(e){const{tab:s,setTab:a,onClose:l,view:c,audit:u}=e,d=Eh(),h=c?.approvals??[],g=h.filter(m=>m.status==="pending").length;return i.jsxs("aside",{className:"session-panel","aria-label":"Session panel",children:[i.jsxs("div",{className:"session-panel-header",children:[i.jsx(Aa,{size:"xs",label:"Panel",value:s,onChange:a,options:[{value:"details",label:"Details"},{value:"approvals",label:g?`Approvals ${g}`:"Approvals"},{value:"files",label:"Files"},{value:"schedules",label:"Schedules"},{value:"activity",label:"Activity"}]}),i.jsx("span",{className:"spacer"}),i.jsx(V,{variant:"ghost",size:"xs",icon:"x","aria-label":"Close panel",title:"Close panel",onClick:l})]}),i.jsxs("div",{className:"session-panel-body",children:[s==="details"&&i.jsx(Fz,{...e},JSON.stringify([e.session.id,e.session.ownerId,e.user.id,e.session.permissions,e.workspaceRole])),s==="approvals"&&(h.length?i.jsxs("div",{className:"stack",children:[[...h].sort((m,y)=>+(y.status==="pending")-+(m.status==="pending")).map(m=>i.jsx(aw,{approval:m},m.id)),!!c?.olderApprovals&&i.jsx("p",{className:"muted small",children:_z(c.olderApprovals)})]}):c?i.jsx(jt,{title:"No approvals",children:sw}):i.jsx(Ht,{})),s==="files"&&i.jsx(oz,{session:e.session}),s==="schedules"&&i.jsx(Tz,{session:e.session,changed:()=>{u.refresh(),e.refresh()}},e.session.id),s==="activity"&&i.jsx(Oe,{title:"Audit log",action:i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh activity",title:"Refresh",disabled:u.loading,onClick:u.refresh}),bare:!0,children:i.jsx(dt,{...u,retry:u.refresh,children:u.data?.events.length?i.jsx("div",{className:"card",children:u.data.events.map(m=>i.jsx(Ca,{title:m.action,hint:i.jsxs(i.Fragment,{children:[Mt(d.person(m.actorId))," · ",i.jsx(Zn,{value:m.createdAt})]}),children:i.jsx("pre",{children:Mz(m.detail,d.person)})},m.id))}):i.jsx(jt,{title:"No activity"})})})]})]})}const sw="Commands that ran under auto-approve are marked on their tool calls in the conversation.";function _z(e){return`${e} older settled ${e===1?"approval isn't":"approvals aren't"} listed. ${sw}`}function aw({approval:e,children:s}){const{operation:a}=e,l=(u,d)=>i.jsxs(i.Fragment,{children:[" · Allowed by ",i.jsx(Ni,{id:u})," ",d==="session"?"for the rest of the session":"for this call"]}),c=a.kind==="permission"&&e.status==="approved"&&e.decidedBy?l(e.decidedBy,e.scope):i.jsxs(i.Fragment,{children:[e.permission&&l(e.permission.decidedBy,e.permission.scope),e.decidedBy&&i.jsxs(i.Fragment,{children:[" · Decision by ",i.jsx(Ni,{id:e.decidedBy})]})]});return i.jsxs("article",{className:"approval-card card",children:[i.jsxs("div",{className:"approval-head",children:[i.jsx("span",{className:"approval-kind",children:a.kind==="permission"?"Permission":a.kind}),i.jsx("span",{className:"spacer"}),e.unbounded&&i.jsx(Te,{tone:"warning",children:"No resource limits"}),Xd(a)&&i.jsx(Te,{tone:"warning",children:"Secret hidden"}),i.jsx(Dz,{approval:e})]}),a.kind==="permission"?i.jsx(Iz,{request:a,pending:e.status==="pending"}):i.jsxs(i.Fragment,{children:[a.kind==="host.bash"&&i.jsxs(ke,{variant:"error",title:"Runs outside the sandbox",children:["This command runs as the host's OS user with access to their files, credentials and network, without CPU, memory or disk quotas. It runs in this session's files, which the agent can change, so builds, package scripts and Git hooks or settings there can run the agent's code on the host too. Only the host's owner, or a member granted host commands, can approve it. The time limit is ",a.timeoutSeconds," seconds."]}),a.kind==="git.repin"&&i.jsxs(ke,{title:"Creates a new private session",children:["Resolves ",i.jsx("code",{children:a.repository})," at ",i.jsx("code",{children:a.ref}),". Other repository pins stay unchanged. This session's files, commits and conversation stay here; they are not copied. Only the session owner can approve."]}),a.kind==="git.push"&&i.jsx($z,{operation:a}),a.kind==="github.merge"&&i.jsx(Gz,{operation:a}),i.jsx("pre",{children:JSON.stringify(a,null,2)}),e.status==="pending"&&Xd(a)&&i.jsx(rw,{})]}),i.jsxs("p",{className:"muted small",children:["Requested by ",i.jsx(Ni,{id:e.requestedBy})," · ",i.jsx(Kt,{value:e.createdAt}),e.automatic?i.jsx(i.Fragment,{children:" · Ran under the owner's auto-approve access, without a per-command decision"}):c]}),e.result&&i.jsx("pre",{children:e.result}),a.kind==="git.repin"&&e.status==="executed"&&i.jsx(Uz,{result:e.result}),s]})}function Uz({result:e}){try{const s=JSON.parse(e??"null");return typeof s?.sessionId!="string"||!/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/.test(s.sessionId)?null:i.jsx(Bt,{variant:"outline",size:"sm",href:Qe({name:"session",sessionId:s.sessionId}),children:"Open repinned session"})}catch{return null}}const Bz={tool:"A tool this agent doesn't include",write:"A change in a Read-only message","unbounded-shell":"No resource limits: this host has none set up for commands. The command still runs in the sandbox, offline and for at most the host's command time limit, but with no cap on CPU, memory, processes or disk.",audience:"Sharing another session: this session's readers would see what the agent reads from a session they can't open themselves."},Hz=["bash","git_commit","git_push","github_comment","github_merge","github_issue","host_bash","git_repin"];function Iz({request:e,pending:s}){return i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:[i.jsx("code",{children:e.tool})," ",s?"needs the session owner's permission for:":"asked the session owner's permission for:"]}),i.jsx("ul",{className:"permission-needs small",children:e.needs.map(a=>i.jsx("li",{children:Bz[a]},a))}),e.target&&i.jsx("pre",{children:e.target}),s&&Xd(e.target)&&i.jsx(rw,{}),s&&Hz.includes(e.tool)&&i.jsx("p",{className:"muted small",children:"Allowing it doesn't run anything yet: the operation still gets its own approval, unless the message auto-approves."})]})}function rw(){return i.jsxs("p",{className:"small",children:["Something that looks like a secret is shown as ",i.jsx("code",{children:wt}),". Allowing or approving this uses the real value, so make sure it belongs here."]})}function $z({operation:e}){return i.jsxs("dl",{className:"small",children:[i.jsx("dt",{className:"muted",children:"Repository"}),i.jsx("dd",{children:i.jsx("code",{children:e.repository})}),e.directory&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"muted",children:"Clone"}),i.jsx("dd",{children:i.jsxs("code",{children:[e.directory,"/"]})})]}),e.tag!==void 0?i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"muted",children:"New tag"}),i.jsx("dd",{children:i.jsx("code",{children:e.tag})}),i.jsx("dt",{className:"muted",children:"On branch"}),i.jsxs("dd",{children:[i.jsx("code",{children:e.branch})," (not moved)"]})]}):i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"muted",children:"Branch"}),i.jsx("dd",{children:i.jsx("code",{children:e.branch})})]}),i.jsx("dt",{className:"muted",children:"Commit"}),i.jsx("dd",{children:i.jsx("code",{title:e.commit,children:e.commit.slice(0,12)})}),e.pullRequest&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"muted",children:"Pull request"}),i.jsxs("dd",{children:[e.pullRequest.title,e.pullRequest.base?i.jsxs(i.Fragment,{children:[" → ",i.jsx("code",{children:e.pullRequest.base})]}):" → default branch"]})]})]})}const qz={merge:"Merge commit",squash:"Squash and merge",rebase:"Rebase and merge"};function Gz({operation:e}){return i.jsxs("dl",{className:"small",children:[i.jsx("dt",{className:"muted",children:"Pull request"}),i.jsx("dd",{children:i.jsx("a",{href:`https://github.com/${e.repository}/pull/${e.pull}`,target:"_blank",rel:"noreferrer",children:i.jsxs("code",{children:[e.repository,"#",e.pull]})})}),i.jsx("dt",{className:"muted",children:"Head commit"}),i.jsx("dd",{children:i.jsx("code",{title:e.sha,children:e.sha.slice(0,12)})}),i.jsx("dt",{className:"muted",children:"Method"}),i.jsx("dd",{children:qz[e.method]})]})}function Fz({session:e,view:s,user:a,workspaceRole:l,hosts:c,refresh:u,audit:d,actions:h,openSession:g}){const m=e.permissions??[],y=e.ownerId===a.id,b=m.includes("write"),v=Sh(a.id,e.ownerId,l),x=()=>{d.refresh(),u()};return i.jsxs("div",{children:[i.jsx(Pz,{session:e,user:a,hosts:c}),i.jsx(Vz,{session:e,refresh:u}),i.jsx(Xz,{session:e,user:a,workspaceRole:l,actions:h,changed:x}),i.jsx(Yz,{session:e,manages:v,changed:x}),i.jsx(Oz,{session:e}),y&&e.status!=="archived"&&i.jsx(Kz,{session:e,actions:h,openSession:g}),y&&e.status!=="archived"&&!e.frozen&&e.connectorId&&i.jsx(ZE,{session:e,user:a,hosts:c,openSession:g,changed:x}),b&&e.status!=="archived"&&!e.frozen&&i.jsx(Wz,{session:e,changed:x}),y&&i.jsx(Jz,{session:e}),i.jsx(eO,{session:e,view:s,user:a})]})}function Yz({session:e,manages:s,changed:a}){const l=Ne(),c=qe(`/api/workspaces/${ce(e.workspaceId)}/transcripts`),u=e.toolOutput!=="brief",d=s&&e.status!=="archived";function h(m){!d||l.busy||m===u||l.run(async()=>{await he(`/api/sessions/${ce(e.id)}`,{method:"PATCH",body:{toolOutput:m?"full":"brief"}}),a()},m?"Full tool output is on for everyone viewing this session.":"Tool output is brief for everyone viewing this session: one line per tool result.")}const g=c.data?.settings.paging;return i.jsxs(Oe,{title:"Transcript",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"With full tool output on, the transcript shows everything each tool printed. Turned off, each tool result shows only its first line and long tool calls are cut short, for everyone viewing the session, its share link included. Long sessions then load much faster. The host keeps the whole output either way, and the agent still sees all of it. Only the session's owner, or the workspace's owner or an admin, can change this; new sessions start with their workspace's choice, under Settings → Workspaces."}),i.jsx("p",{children:"Whether the transcript loads latest messages first is a workspace setting, under Settings → Workspaces."})]}),children:[i.jsx(ae,{title:"Full tool output",hint:u?"Every tool result in full":"One line per tool result",trailing:d?i.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Full tool output",checked:u,disabled:l.busy,onChange:m=>h(m.target.checked)}):i.jsx(Te,{tone:"neutral",children:u?"On":"Off"})}),i.jsx(ae,{title:"Loading",hint:g===void 0?c.error?"Couldn't check the workspace setting":i.jsx(Ht,{children:"Checking"}):g?"Latest messages first; earlier ones load as you scroll up":"The whole transcript at once"}),(l.error||l.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...l})})]})}function Pz({session:e,user:s,hosts:a}){const l=a.data?.connectors.find(c=>c.id===e.connectorId);return i.jsxs(Oe,{title:"Host",info:i.jsxs("p",{children:["Work runs as the session owner (",i.jsx(Ni,{id:e.ownerId,you:!0}),"), not the host owner. The host operator can access prompts and files processed on it. Sharing a host doesn't change who can view or control this session, and doesn't expose its owner's local history."]}),children:[e.connectorId?i.jsxs(i.Fragment,{children:[i.jsx(ae,{leading:i.jsx(ve,{name:"server",size:16}),title:l?.name??"Pinned host",hint:i.jsxs(i.Fragment,{children:["Hosted by ",l?.ownerName??(e.connectorOwnerId?i.jsx(Ni,{id:e.connectorOwnerId}):"unknown"),e.connectorOwnerId===s.id?" (you)":""]}),trailing:a.loading?i.jsx(Ht,{children:"Checking"}):l?i.jsx(Fr,{connector:l}):e.hostUnsandboxed&&i.jsx(Te,{tone:"danger",children:"Unsandboxed"})}),e.hostEnvironment&&i.jsx(ae,{leading:i.jsx(ve,{name:"server",size:16}),title:"Runs on the host",hint:"No sandbox: its commands run on the host owner's machine, as its user",trailing:i.jsx(Te,{tone:"danger",children:"On host"})}),l&&i.jsx($o,{connector:l}),!a.loading&&!l&&!a.error&&i.jsx(ae,{title:"Host not in your list",hint:"It may be private to its owner, unshared, or revoked. Viewing a session doesn't let you use its host"}),i.jsx(ae,{title:"Connection ID",hint:i.jsx("code",{children:e.connectorId})})]}):i.jsx(ae,{leading:i.jsx(ve,{name:"server",size:16}),title:"Operator-managed session",hint:"No local host is pinned"}),a.error&&i.jsx(Re,{children:i.jsx(Ce,{error:a.error})})]})}function Vz({session:e,refresh:s}){const a=e.repositories??[];return e.repositoryMode==="clone"?i.jsx(Oe,{title:"Repositories",info:i.jsx(zh,{}),bare:!0,children:i.jsxs("div",{className:"card",children:[i.jsx(ae,{leading:i.jsx(ve,{name:"git-branch",size:16}),title:"Cloned on demand",hint:"Nothing is pinned: the agent clones and switches branches as it works"}),i.jsx(ae,{title:"Manage repositories and network access",href:Qe({name:"settings",section:"workspaces",id:e.workspaceId}),chevron:!0})]})}):i.jsx(Oe,{title:i.jsxs(i.Fragment,{children:["Repositories ",i.jsx("span",{className:"muted",children:a.length})]}),info:i.jsx("p",{children:"This session was created before sessions cloned their repositories: it holds snapshots of these commits, pinned when it started, and is read-only."}),action:i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh",onClick:s}),bare:!0,children:i.jsxs("div",{className:"stack",children:[e.status==="error"&&i.jsx(ke,{variant:"error",title:"Snapshots not confirmed",children:"This session is in an error state, so repository snapshots are not confirmed. Check the host, then refresh."}),e.status==="archived"&&i.jsx(ke,{title:"Archived",children:"Pinned files may no longer be on the host."}),i.jsxs("div",{className:"card",children:[a.length?a.map(l=>i.jsx(ae,{leading:i.jsx(ve,{name:"git-branch",size:16}),title:l.fullName,hint:i.jsxs(i.Fragment,{children:[i.jsxs("span",{title:l.commit,children:[l.ref,"@",l.commit.slice(0,7)]})," · ",i.jsxs("code",{children:[l.path,"/"]})]})},l.bindingId)):i.jsx(ae,{title:"No repository pins",hint:e.status==="provisioning"?"None recorded yet. Refresh to check progress":e.status==="error"?"None are available for this session":"This older session has no pinned repositories"}),i.jsx(ae,{title:"Manage repositories for future sessions",href:Qe({name:"settings",section:"workspaces",id:e.workspaceId}),chevron:!0})]})]})})}const ko={viewer:"Viewer",member:"Member",collaborator:"Collaborator",admin:"Admin"},Zz={viewer:"Follows the session: prompts, output and side asks",member:"Viewer, and asks side questions without messaging the agent",collaborator:"Member, and sends messages to the agent and stops its work",admin:"Collaborator, and decides approvals and manages who has access"},Bd={owner:"workspace owner",admin:"workspace admin",collaborator:"workspace collaborator",member:"workspace member",viewer:"workspace viewer"};function fh(e){return e.sessionRole===void 0?rx(e.permissions):e.sessionRole}function Qz(e){const s=fh(e);return s?ko[s]:`Custom (${e.permissions.join(", ")||"none"})`}function Xz({session:e,user:s,workspaceRole:a,actions:l,changed:c}){const u=Ne(),d=Eh(),h=e.permissions??[],g=e.ownerId===s.id,m=Sh(s.id,e.ownerId,a),y=!g&&a&&No.includes(a)?a:null,b=e.visibility??"private",v=!g&&!h.some(N=>N!=="read"),x=rx(h),w=h.includes("manage"),S=e.status==="archived",T=`/api/sessions/${ce(e.id)}`,k=qe(w&&!S?`${T}/grants`:null),[z,A]=E.useState(""),[I,q]=E.useState(null),_=Vd(z,d.list),F=Mt(d.person(_)),oe=_===e.ownerId,ne=k.data?.grants.find(N=>N.userId===_),B=ne?fh(ne):null,H=ne?.workspaceRole??d.person(_).role;function K(N){return j0(N,h)?w0(N,H)?null:"workspace viewers can only be session viewers":"needs permissions you don't hold"}const re=H&&!oe?y0(H,b):[],ie=H!==void 0&&No.includes(H),G=w&&!oe&&!!_&&I!==null&&!K(I)&&I!==B;function U(){return[F!==_&&z.trim()!==F?F:null,H?Bd[H]:null].filter(Boolean).join(" · ")||void 0}function M(N){A(N);const de=Vd(N,d.list),ye=k.data?.grants.find(ge=>ge.userId===de);q(ye?fh(ye):null)}function W(N){N.preventDefault(),!(!G||!I||u.busy)&&u.run(async()=>{await he(`${T}/grants`,{method:"POST",body:{userId:_,role:I}}),k.refresh(),c()},`${F} is now a session ${ko[I].toLowerCase()}`)}async function ee(){!w||oe||!ne||u.busy||!await Ge({title:"Remove session access?",message:ie?`Remove ${F}'s session role? As a ${Bd[H]}, they still manage this session, as they do every session in the workspace.`:b==="workspace"?`Remove ${F}'s session role? They keep what their workspace role gives them while this session is workspace-visible. Making it private removes that.`:`Remove ${F}'s session role? They will no longer be able to open this private session.`,confirmLabel:"Remove access",destructive:!0})||await u.run(async()=>{await he(`${T}/grants/${ce(_)}`,{method:"DELETE"}),M(""),k.refresh(),c()},ie?"Session role removed. As a workspace owner or admin, they still manage this session.":b==="workspace"?"Session role removed. Workspace members can still view this session until it is made private.":"Session role removed")}const O=GE({session:e,user:s,manages:m,action:l.action,onChange:c}),R=O.link,Q=g&&R!==void 0?R!==null:!!e.linkShared;return i.jsxs(Oe,{title:"People",info:i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"The server checks every request. You give a workspace member one of four session roles: a viewer follows the session; a member also asks side questions; a collaborator also sends messages to the agent; an admin also decides approvals and manages who has access. You can only give a role whose permissions you hold, and workspace viewers can only be session viewers. On a workspace-visible session, people also keep what their workspace role gives them there. Visibility doesn't grant GitHub or tool access, share a host, or publish an agent. The owner's access can't be changed."}),i.jsx("p",{children:"The workspace's owner and admins manage every session in it, private ones included: they follow it, message it, rename and archive it, change its visibility and give session roles up to collaborator. Deciding its approvals takes a session role from its owner, since approved operations run as the owner."}),i.jsx("p",{children:"The owner can also share a link: anyone who has it can view the shared conversation without signing in, but not side asks, approvals, who sent each message, or the host. It never grants anything else. The workspace's owner and admins can turn it off."})]}),children:[i.jsx(ae,{leading:i.jsx(ve,{name:"user",size:16}),title:g?"Owner":y?`Workspace ${y}`:x?`Session ${ko[x].toLowerCase()}`:"Custom access",hint:i.jsxs(i.Fragment,{children:["Your permissions: ",h.join(", ")||"none",v?". You can follow committed work but can't ask, submit, approve, manage grants, change visibility, or use backups":y&&!h.includes("approve")?`. As the workspace's ${y}, you manage every session in it; deciding approvals takes a session role from the owner`:""]})}),i.jsx(ae,{leading:i.jsx(ve,{name:b==="workspace"?"globe":"lock",size:16}),title:b==="workspace"?"Workspace-visible":"Private",hint:i.jsxs(i.Fragment,{children:[b==="workspace"?"All workspace members can view existing and future prompts and output, including tool output, repository content in the transcript, and side asks":"Only the owner, the workspace's owner and admins, and people with a session role can view prompts and output",". ",m?b==="workspace"?"Making it private keeps explicit grants and can't recall content already viewed or copied":"Before sharing, check existing prompts, tool output and side asks for secrets":"Only the session owner, or the workspace's owner or an admin, can change visibility"]}),trailing:m&&!S&&i.jsx(V,{variant:"outline",size:"sm",disabled:l.action.busy,onClick:l.changeVisibility,children:b==="workspace"?"Make private":"Make workspace-visible"})}),(g||Q)&&i.jsx(ae,{leading:i.jsx(ve,{name:"link",size:16}),title:Q?"Anyone with the link can view":"Link sharing off",hint:g?Q?"Without signing in, they can follow the shared conversation, but not side asks, approvals, who sent each message, or the host. Turning the link off stops it at once":S?"Archived sessions can't get a new share link":"Create a link that lets anyone who has it view the shared conversation, read-only, without signing in":`The owner shared this session by link: anyone who has it can view the shared conversation without signing in, including messages you send to it. Side asks stay hidden${m?". You can turn the link off, which stops it at once":""}`,trailing:g?Q?i.jsx(V,{variant:"outline",size:"sm",disabled:l.action.busy,onClick:O.unshareLink,children:"Turn off"}):!S&&i.jsx(V,{variant:"outline",size:"sm",disabled:l.action.busy||O.linkLoading,onClick:()=>{O.shareLink()},children:"Create link"}):m&&Q&&i.jsx(V,{variant:"outline",size:"sm",disabled:l.action.busy,onClick:O.unshareLink,children:"Turn off"})}),g&&R&&i.jsx(Re,{children:i.jsx(be,{label:"Share link",hint:i.jsxs(i.Fragment,{children:["Created ",i.jsx(Zn,{value:R.createdAt})]}),children:i.jsx(Vn,{value:R.url,label:"Copy share link"})})}),g&&O.linkError&&i.jsx(Re,{children:i.jsx(Ce,{error:O.linkError})}),w&&!S?i.jsx(Ca,{title:"Session roles",hint:k.data?`${k.data.grants.length} ${k.data.grants.length===1?"person":"people"} with access`:void 0,leading:i.jsx(ve,{name:"users",size:16}),trailing:i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh session roles",title:"Refresh session roles",disabled:k.loading,onClick:N=>{N.preventDefault(),k.refresh()}}),children:i.jsx(dt,{...k,retry:k.refresh,children:k.data&&i.jsx("form",{onSubmit:W,children:i.jsxs("fieldset",{disabled:u.busy,className:"stack",children:[i.jsx(be,{label:"People with access",hint:k.data.grants.length>1?void 0:"Nobody else has a session role yet",children:i.jsxs("select",{className:"select",value:ne?_:"",onChange:N=>M(N.target.value&&Mt(d.person(N.target.value))),children:[i.jsx("option",{value:"",children:"Add someone"}),k.data.grants.map(N=>i.jsxs("option",{value:N.userId,children:[Mt(d.person(N.userId)),": ",N.userId===e.ownerId?"Owner (immutable)":Qz(N)]},N.userId))]})}),i.jsx(be,{label:"Workspace member",hint:oe?"The owner's access is immutable":_?U():void 0,children:i.jsx("input",{className:"input",required:!0,autoComplete:"off",spellCheck:!1,placeholder:"Username or user ID",value:z,onChange:N=>M(N.target.value)})}),i.jsxs("fieldset",{disabled:oe,className:"stack session-permissions",children:[i.jsx("legend",{className:"small muted",children:"Session role"}),sx.map(N=>{const de=K(N);return i.jsxs("label",{className:"check-row",children:[i.jsx("input",{className:"radio",type:"radio",name:"session-role",value:N,checked:I===N,disabled:!!de,onChange:()=>q(N)}),i.jsxs("span",{children:[ko[N],B===N&&i.jsx("span",{className:"muted",children:" (current)"}),de&&i.jsxs("span",{className:"muted",children:[" (",de,")"]}),i.jsxs("span",{className:"muted small session-role-hint",children:[Zz[N]," · ",Bo[N].join(", ")]})]})]},N)})]}),ne&&!oe&&!B&&i.jsxs("p",{className:"muted small",children:[F," has a custom grant (",ne.permissions.join(", "),") from before session roles. Choose a role to replace it."]}),re.length>1&&H&&i.jsxs("p",{className:"muted small",children:["As a ",Bd[H],", ",F," already has ",re.join(", ")," on this ",ie?"session, as on every session in the workspace":"workspace-visible session","; a session role adds to that."]}),i.jsxs("div",{className:"inline",children:[i.jsx(V,{type:"submit",variant:"secondary",size:"sm",disabled:!G,children:u.busy?"Saving...":ne?"Change role":"Give role"}),ne&&!oe&&i.jsx(V,{variant:"outline",size:"sm",onClick:()=>{ee()},children:"Remove access"})]}),b==="workspace"&&i.jsx("p",{className:"muted small",children:"Removing someone's session role doesn't stop workspace members from viewing; make the session private for that. The workspace's owner and admins keep managing it either way."})]})})})}):i.jsx(ae,{leading:i.jsx(ve,{name:"users",size:16}),title:"Session roles",hint:w?"Unarchive the session to manage session roles":"Managing session roles takes the session admin role"}),(u.error||u.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...u})})]})}function Kz({session:e,actions:s,openSession:a}){const[l,c]=E.useState(0),{backup:u}=s;return i.jsxs(Oe,{title:"Backups",info:i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Only the session owner can create, download or restore backups. Backups need the session to be idle."}),i.jsxs("p",{children:["A backup keeps the conversation, the session's files and each clone's local work. ",i.jsx("strong",{children:"Conversation only"})," keeps just the conversation: it's much smaller, and a session restored from it starts with an empty worktree, so the agent clones its repositories again."]}),i.jsx("p",{children:"Restore creates a new private session and never overwrites this one. It doesn't replay approvals or run operations, and needs the original host to be available. Listing and downloading work while offline."}),i.jsx("p",{children:"Backups are saved in the database the workspace owner connected, if there is one, and otherwise in the server's backup storage. A server without backup storage keeps no backups."})]}),action:i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh backups",title:"Refresh backups",onClick:()=>c(d=>d+1)}),i.jsx(V,{variant:"ghost",size:"sm",disabled:s.backupsOff||s.backupsPending||s.backupBlocked||s.conversationOnlyOff||s.action.busy,title:s.backupsOff?"Backups are off":s.conversationOnlyOff?"Update this session's host connector to back up its conversation only":"Back up the conversation without the session's files",onClick:()=>s.createBackup({conversationOnly:!0}),children:"Conversation only"}),i.jsx(V,{variant:"outline",size:"sm",disabled:s.backupsOff||s.backupsPending||s.backupBlocked||s.action.busy,title:s.backupsOff?"Backups are off":void 0,onClick:()=>s.createBackup(),children:s.action.busy?"Working...":"Create backup"})]}),children:[s.backupBlocked&&!s.backupsOff&&i.jsx(ae,{title:"Backup unavailable right now",hint:"Unavailable while work is queued or running, or the live state can't be confirmed"}),u&&i.jsx(ae,{leading:i.jsx(ve,{name:"check",size:16}),title:i.jsxs(i.Fragment,{children:["Backup created ",i.jsx(Kt,{value:u.createdAt})]}),hint:i.jsxs(i.Fragment,{children:[u.size," bytes",Pv(u)," · ID ",i.jsx("code",{children:u.id})," · SHA-256 ",i.jsx("code",{children:u.sha256})]}),trailing:i.jsx(Bt,{variant:"outline",size:"sm",href:Vv(e.id,u.id),children:"Download"})}),i.jsx(VE,{sourceId:e.id,ownerId:e.ownerId,backups:s.backups,latestBackup:u,refreshKey:l,openSession:a})]})}function Jz({session:e}){return i.jsx(Oe,{title:"Export",info:i.jsx("p",{children:"Downloads this session's details, people, approvals, pushes, backup list and activity as JSON, without secrets. The conversation itself is in the session's backups. Only the session owner can export it."}),children:i.jsx(ae,{leading:i.jsx(ve,{name:"archive",size:16}),title:"Session data",hint:"JSON, without secrets",trailing:i.jsx(Bt,{variant:"outline",size:"sm",href:`/api/sessions/${ce(e.id)}/export`,download:!0,children:"Export"})})})}function Wz({session:e,changed:s}){const a=Ne(),[l,c]=E.useState(null),[u,d]=E.useState("bash"),[h,g]=E.useState(""),[m,y]=E.useState(""),[b,v]=E.useState(""),[x,w]=E.useState(""),S=Number(b),T=u==="bash"?!!h.trim():/^[^/\s]+\/[^/\s]+$/.test(m.trim())&&Number.isSafeInteger(S)&&S>0&&!!x.trim();function k(z){if(z.preventDefault(),!T||a.busy)return;const A=u==="bash"?{kind:u,command:h}:{kind:u,repository:m.trim(),issue:S,body:x};c(null),a.run(async()=>{const I=await he(`/api/sessions/${ce(e.id)}/operations`,{method:"POST",body:A});c({id:I.approval.id,status:I.approval.status}),s()},"Operation requested. Review its approval in the session.")}return i.jsx(Oe,{title:"Operation request",info:i.jsx("p",{children:"This only requests the operation; it runs after approval in the session. Don't include passwords, tokens or other secrets."}),children:i.jsx(Re,{children:i.jsx("form",{onSubmit:k,children:i.jsxs("fieldset",{disabled:a.busy,className:"stack",children:[i.jsx(be,{label:"Operation",children:i.jsxs("select",{className:"select",value:u,onChange:z=>d(z.target.value),children:[i.jsx("option",{value:"bash",children:"Bash command"}),i.jsx("option",{value:"github.comment",children:"GitHub comment"})]})}),u==="bash"&&i.jsx(be,{label:"Command",children:i.jsx("textarea",{className:"textarea mono",required:!0,autoComplete:"off",value:h,onChange:z=>g(z.target.value)})}),u==="github.comment"&&i.jsxs(i.Fragment,{children:[i.jsx(be,{label:"Repository",hint:"owner/name",children:i.jsx("input",{className:"input",required:!0,autoComplete:"off",value:m,onChange:z=>y(z.target.value)})}),i.jsx(be,{label:"Issue number",children:i.jsx("input",{className:"input",required:!0,type:"number",min:"1",step:"1",value:b,onChange:z=>v(z.target.value)})}),i.jsx(be,{label:"Comment",children:i.jsx("textarea",{className:"textarea",required:!0,autoComplete:"off",value:x,onChange:z=>w(z.target.value)})})]}),i.jsx("div",{className:"inline",children:i.jsx(V,{type:"submit",variant:"secondary",size:"sm",disabled:!T,children:a.busy?"Requesting...":"Request approval"})}),l&&i.jsxs("p",{className:"muted small",role:"status",children:["Approval ",i.jsx("code",{children:l.id}),": ",l.status]})]})})})})}function eO({session:e,view:s,user:a}){const l=e.visibility??"private";return i.jsxs(Oe,{title:"Access",info:i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:[l==="workspace"?"Workspace-visible: all workspace members can view existing and future prompts and output, including tool output, repository content in the transcript, and side asks.":"Private: only the owner, the workspace's owner and admins, and members with a session role can view prompts and output.",e.linkShared?" Anyone with the session's share link can also view the shared conversation, without signing in.":""," Viewing doesn't grant ask, write, approve or manage permissions, access to Git accounts, or tool use. Only the owner, or the workspace's owner or an admin, can change visibility; it's separate from host sharing and agent publishing."]}),i.jsxs("p",{children:["Values that look like passwords, tokens or keys are shown as ",wt," to everyone, in the transcript, approvals and share links. The agent and the host still see the real values."]})]}),children:[s?i.jsxs(i.Fragment,{children:[i.jsx(ae,{leading:i.jsx(ve,{name:"user",size:16}),title:i.jsxs(i.Fragment,{children:["Runs as ",s.owner.displayName,s.owner.id===a.id?" (you)":""]}),hint:s.owner.githubLogin?`GitHub @${s.owner.githubLogin}`:"No GitHub login connected"}),i.jsx(ae,{leading:i.jsx(ve,{name:"git-branch",size:16}),title:"Commits as",hint:i.jsxs(i.Fragment,{children:[s.owner.gitName," <",s.owner.gitEmail,">"]})})]}):i.jsx(ae,{title:i.jsx(Ht,{children:"Loading identity..."})}),i.jsx(Re,{children:i.jsx(be,{label:"Session ID",children:i.jsx(Vn,{value:e.id,label:"Copy session ID"})})})]})}const lw="Context compaction failed",tO={token_limit:"Pi's summary of the conversation hit its token limit, so the context could not be compacted.",tool_call:"Pi's summarizer tried to call a tool instead of writing a summary, so the context could not be compacted.",no_text:"Pi's summarizer wrote no summary, so the context could not be compacted.",aborted:"Compacting the conversation's context was aborted."};function ow(e,s={}){const a=tO[e]??"The conversation's context could not be compacted.";return s.advice===!1?a:e==="aborted"?`${a} Send the message again to retry.`:`${a} Retrying at the same reasoning level will fail the same way: send the next message with a lower reasoning level, or continue in a new session. The host's owner or an admin can also raise this model's reserve tokens under Settings → Hosts → the host → Compaction (Pi's compaction.reserveTokens).`}function nO(e){const[s,a]=E.useState(null),[l,c]=E.useState(null),[u,d]=E.useState(""),[h,g]=E.useState("connecting"),[m,y]=E.useState(0),b=E.useRef(()=>{}),v=E.useRef(async()=>{}),x=E.useCallback(()=>b.current(),[]),w=E.useCallback(T=>v.current(T),[]),S=E.useCallback(()=>y(T=>T+1),[]);return E.useEffect(()=>{g("connecting");const T=V1(e,{session:a,view:c,error:d,status:g});return b.current=T.refresh,v.current=T.loadOlder,()=>{T.stop(),b.current=()=>{},v.current=async()=>{}}},[e,m]),{session:s,view:l,error:u,status:h,refresh:x,loadOlder:w,reconnect:S}}const Nb="pikibun.sessionPanel",Eb="(min-width: 1100px)";function iO(){const[e,s]=E.useState(()=>{if(!window.matchMedia(Eb).matches)return!1;try{const l=localStorage.getItem(Nb);if(l)return l==="open"}catch{}return!0}),a=E.useCallback(l=>{if(s(l),!!window.matchMedia(Eb).matches)try{localStorage.setItem(Nb,l?"open":"closed")}catch{}},[]);return[e,a]}function sO({provider:e,modelId:s,status:a}){const l=e??"the provider";return a===401||a===403?`The host's Pi credentials for ${l} were rejected. The host owner should check Pi's login or API key, then restart the connector.`:a===429?`Rate limited by ${l}. Try again shortly.`:a!==void 0&&a>=500&&a<600?`${l} is unavailable. Try again shortly.`:`The request to ${[e,s].filter(Boolean).join("/")||"the model"} failed${a?` (HTTP ${a})`:""}`}function zb({role:e,icon:s,label:a,text:l,badges:c,trimmed:u}){return i.jsxs("details",{className:"entry-tool","data-role":e,children:[i.jsxs("summary",{children:[i.jsx(ve,{name:s,size:14}),i.jsx("span",{className:"truncate",children:a}),c,i.jsx(ve,{name:"chevron-right",size:14})]}),i.jsx("pre",{children:l}),u&&i.jsx(aO,{trimmed:u})]})}function aO({trimmed:e}){return i.jsxs("p",{className:"muted small entry-brief",children:["Brief tool output · ",e.lines===1?"1 line":`${e.lines.toLocaleString()} lines`,", ",e.chars.toLocaleString()," characters in full. The session's owner can show full tool output under Details."]})}function rO(e){return e.trimmed&&e.role==="toolResult"&&e.text.trim()?i.jsxs("span",{className:"muted",children:[" · ",e.text]}):null}function Ob({entry:e,actions:s}){const[a,l]=E.useState(!1);E.useEffect(()=>{if(!a)return;const m=window.setTimeout(()=>l(!1),1500);return()=>window.clearTimeout(m)},[a]);const c=U1(e),u=s&&M1(e),d=u&&s?.revert,h=u&&s?.fork;if(!c&&!d&&!h)return null;const g=u?.before?"Go back to before this message":"Go back to this reply";return i.jsxs("span",{className:"entry-actions",role:"toolbar","aria-label":"Message actions",children:[c&&i.jsx(V,{variant:"ghost",size:"xs",icon:a?"check":"copy","aria-label":a?"Copied":"Copy message",title:a?"Copied":"Copy message",onClick:()=>{navigator.clipboard.writeText(c).then(()=>l(!0))}}),d&&i.jsx(V,{variant:"ghost",size:"xs",icon:"history","aria-label":g,title:d.disabled||g,disabled:!!d.disabled,onClick:()=>d.run(e,u)}),h&&i.jsx(V,{variant:"ghost",size:"xs",icon:"git-branch","aria-label":"Fork a new session from here",title:h.disabled||"Fork a new session from here",disabled:!!h.disabled,onClick:()=>h.run(e,u)})]})}function lO({entry:e,userId:s,actions:a}){const l=e.actorId&&i.jsx(Ni,{id:e.actorId,you:!0}),{prose:c,calls:u}=e.role==="assistant"?Fo(e.text):{prose:e.text,calls:[]},d=u.length>0&&`Tool · ${u[0].name}`;if(e.kind==="workspace.run-stopped")return i.jsx("div",{className:"entry-stopped",role:"note",children:i.jsxs("span",{children:["Stopped",l&&i.jsxs(i.Fragment,{children:[" by ",l]})]})});if(e.kind==="workspace.run-crashed")return i.jsx("div",{className:"entry-stopped",role:"note",children:i.jsx("span",{children:e.text})});if(d&&!c.trim()||e.role==="system"||e.role==="toolResult"){const g=d||(e.role==="toolResult"?"Tool result":"System"),m=e.role==="toolResult"&&e.durationMs!==void 0&&i.jsxs(i.Fragment,{children:[" · ",i.jsx("span",{title:"How long the tool ran",children:To(e.durationMs)})]});return i.jsx(zb,{role:e.role,icon:d?"tool":"terminal",label:i.jsxs(i.Fragment,{children:[g,m,l&&i.jsxs(i.Fragment,{children:[" · ",l]}),rO(e)]}),text:e.text,badges:i.jsx(Tb,{calls:e.autoApproved}),trimmed:e.trimmed})}if(e.error)return i.jsxs("div",{className:"entry-error",title:e.kind,children:[e.error.compaction?i.jsx(ke,{variant:"error",title:lw,children:ow(e.error.compaction)}):i.jsx(ke,{variant:"error",title:"Model request failed",children:sO(e.error)}),l&&i.jsxs("div",{className:"entry-actor",children:["by ",l]})]});if(e.role==="user")return i.jsxs("div",{className:"entry-user",title:e.kind,children:[i.jsx("div",{className:"entry-bubble",children:e.text}),i.jsxs("div",{className:"entry-footer",children:[l&&e.actorId!==s&&i.jsxs("span",{className:"entry-actor",children:["by ",l]}),i.jsx(Ob,{entry:e,actions:a})]})]});const h=e.durationMs!==void 0&&i.jsx("span",{title:"How long the model took to reply",children:To(e.durationMs)});return i.jsxs("div",{className:"entry-assistant","data-role":e.role,title:e.kind,children:[i.jsx(Bv,{text:c}),d&&i.jsx(zb,{icon:"tool",label:d,text:u.map(g=>g.line).join(`
49
- `),badges:i.jsx(Tb,{calls:e.autoApproved}),trimmed:e.trimmed}),i.jsxs("div",{className:"entry-footer",children:[(l||h)&&i.jsxs("span",{className:"entry-actor",children:[l&&i.jsxs(i.Fragment,{children:["by ",l]}),l&&h&&" · ",h]}),i.jsx(Ob,{entry:e,actions:a})]})]})}function oO({sessionId:e}){return i.jsx(cO,{id:e},e)}function cO({id:e}){const{user:s,workspaces:a,sessions:l,refreshSessions:c,setLiveActivity:u}=yt(),d=nO(e),h=d.session,g=d.view,m=qe(`/api/sessions/${ce(e)}/audit`),[y,b]=iO(),[v,x]=E.useState("details"),w=h?.permissions??[],S=w.includes("write");w.includes("ask");const T=h?.status==="archived",k=h?.frozen===!0,z=w.includes("approve")&&!T&&!k,A=h?.ownerId===s.id,[I,q]=E.useState(!1),_=Gr(h?.connectorId?`/api/workspaces/${ce(h.workspaceId)}/connectors`:null),F=_.data?.connectors.find(pe=>pe.id===h?.connectorId),oe=F?.online,ne=E.useRef(oe);E.useEffect(()=>{ne.current===!1&&oe&&d.refresh(),ne.current=oe},[oe,d.refresh]);const B=g?.activity;E.useEffect(()=>{u(B?{sessionId:e,activity:B}:null)},[e,B,u]),E.useEffect(()=>()=>{u(null),c()},[u,c]);const H=(g?.queue??[]).filter(pe=>Eo.includes(pe.status)),K=E.useCallback(()=>{d.refresh(),m.refresh(),c()},[d.refresh,m.refresh,c]),re=h?a.find(pe=>pe.id===h.workspaceId)?.role:void 0,ie=!!(h&&Sh(s.id,h.ownerId,re)),G=Rz({session:h,user:s,manages:ie,backupBlocked:T||k||!g||!!d.error||g.busy||H.length>0,onChange:K}),U=E.useCallback(pe=>{c(),rs({name:"session",sessionId:pe})},[c]),M=Ne(),W=h??l.find(pe=>pe.id===e),ee=Cx(W?.workspaceId??null),O=W&&a.find(pe=>pe.id===W.workspaceId)?.name,R=l.find(pe=>pe.id===e)?.pullRequest??h?.pullRequest,Q=h?.visibility??"private",N=d.status==="online"?i.jsx(Te,{tone:"success",dot:!0,children:"Live"}):d.status==="reconnecting"?i.jsx(Te,{tone:"warning",dot:!0,children:"Reconnecting"}):d.status==="offline"?i.jsx(Te,{tone:"danger",dot:!0,children:"Disconnected"}):i.jsx(Te,{tone:"neutral",dot:!0,children:"Connecting"}),de=[{label:"Copy session ID",icon:"copy",onSelect:()=>{navigator.clipboard.writeText(e)}}];h&&ie&&!T&&(de.push({label:"Rename",icon:"pencil",disabled:G.action.busy,onSelect:()=>q(!0)}),de.push({label:Q==="workspace"?"Make private":"Make workspace-visible",icon:Q==="workspace"?"lock":"globe",disabled:G.action.busy,onSelect:G.changeVisibility}),A&&!k&&(de.push({label:"Create backup",icon:"archive",disabled:G.backupsOff||G.backupsPending||G.backupBlocked||G.action.busy,hint:G.backupsOff?"Backups are off":G.backupBlocked?"Session busy":void 0,onSelect:()=>G.createBackup()}),de.push({label:"Back up conversation only",icon:"archive",disabled:G.backupsOff||G.backupsPending||G.backupBlocked||G.conversationOnlyOff||G.action.busy,hint:G.backupsOff?"Backups are off":G.backupBlocked?"Session busy":G.conversationOnlyOff?"Update the host's connector":void 0,onSelect:()=>G.createBackup({conversationOnly:!0})})),de.push({label:"Archive",icon:"archive",disabled:G.action.busy,onSelect:G.archive})),h&&ie&&T&&(de.push({label:"Unarchive",icon:"archive",disabled:G.action.busy||!!h.packed&&!A,onSelect:G.unarchive}),A&&!h.packed&&!k&&!h.hostEnvironment&&de.push({label:"Pack files",icon:"archive",disabled:G.action.busy,onSelect:G.pack})),W&&de.push("separator",{label:"Open in workspace settings",icon:"settings",onSelect:()=>rs({name:"settings",section:"workspaces",id:W.workspaceId})});function ye(pe){if(!h||T||k)return!1;if(bb(pe.operation,h,pe.unbounded))return HE(pe.operation,h,F,s.id,w.includes("approve"));const ut=pe.operation.kind==="permission"||pe.operation.kind==="git.repin";return z&&(!ut||A)}async function ge(pe,ut,gt){if(!ye(pe)||M.busy||!pe.reviewHash||pe.status!=="pending")return;const Wt=pe.operation.kind==="permission"?ut==="deny"?"Not allowed":gt==="session"?"Allowed for the rest of the session":"Allowed for this call":ut==="approve"?"Approval decision recorded":"Operation denied";await M.run(async()=>{await he(`/api/sessions/${ce(e)}/approvals/${ce(pe.id)}`,{method:"POST",body:{decision:ut,reviewHash:pe.reviewHash,...gt?{scope:gt}:{}}}),d.refresh(),m.refresh()},Wt)}const Me=!g&&!!(h&&(h.status==="error"||h.status==="provisioning")),We=Me?i.jsx(Te,{tone:h?.status==="error"?"danger":"running",dot:!0,children:h?.status==="error"?"Not started":"Starting"}):!g&&d.error?i.jsx(Te,{tone:"warning",dot:!0,children:"Unavailable"}):N;return i.jsx(Y0,{people:ee,children:i.jsxs("div",{className:y&&h?`session-screen panel-open${v==="files"?" panel-wide":""}`:"session-screen",children:[i.jsxs("div",{className:"session-pane",children:[i.jsx(Uo,{leading:i.jsx(qE,{}),title:W?.title??"Session",subtitle:O,actions:i.jsxs(i.Fragment,{children:[h&&i.jsxs("span",{className:"session-badges",children:[T?i.jsx(Te,{tone:"neutral",children:"Archived"}):We,h.packed&&i.jsx(Te,{tone:"neutral",children:"Files packed"}),i.jsx(Te,{children:Q==="workspace"?"Workspace-visible":"Private"}),h.linkShared&&i.jsx(Te,{tone:"info",children:"Link shared"})]}),h&&R&&i.jsx(zE,{pull:R}),h&&i.jsx(V,{variant:"ghost",size:"xs",icon:"panel-right","aria-label":"Toggle session panel",title:"Session panel","aria-pressed":y,onClick:()=>b(!y)}),i.jsx(Kn,{label:"Session actions",items:de})]})}),(T||k||h?.cloneUnavailable||d.error&&!Me||G.action.error||G.action.notice)&&i.jsxs("div",{className:"session-alerts",children:[k&&!T&&i.jsx(ke,{title:"Read-only",children:"This session pinned its repositories when it started, which sessions no longer do. Its conversation, approvals and backups stay viewable, but it no longer runs. Start a new session to continue the work."}),h?.cloneUnavailable&&!k&&i.jsx(ke,{variant:"warning",title:"Can't clone repositories",children:h.cloneUnavailable}),T&&i.jsxs(ke,{title:"Archived",actions:ie&&(!h?.packed||A)&&i.jsx(V,{variant:"outline",size:"sm",disabled:G.action.busy,onClick:G.unarchive,children:"Unarchive"}),children:["This session is read-only. ",h?.packed?A?"Its files are packed on its host. Unarchiving unpacks them and clones its repositories again, so its host must be online.":"Its files are packed on its host, so only its owner can unarchive it.":ie?"Unarchive it to continue the work.":"Only its owner, or the workspace's owner or an admin, can unarchive it."]}),d.error&&!Me&&i.jsx(ke,{variant:"error",title:h?"Live updates interrupted":"Unable to open session",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:d.reconnect,children:"Reconnect and check access"}),children:d.error}),i.jsx(Ce,{...G.action})]}),g?h&&i.jsx(dO,{id:e,user:s,session:h,view:g,host:F,stale:!!d.error,refresh:d.refresh,loadOlder:d.loadOlder,openSession:U,pinned:i.jsxs(i.Fragment,{children:[g.repositories&&i.jsx(LE,{sessionId:e,preparation:g.repositories,canRestart:A&&!T&&w.includes("manage"),onRestarted:K}),h.hostUnsandboxed&&(S||z)&&(h.hostEnvironment?i.jsx(ke,{variant:"error",title:"Runs on the host",children:"This session runs directly on its host, without the sandbox. Approved commands and commits execute on the host owner's machine with their full user permissions, network access and no resource limits; only the host owner, or members they granted host commands, decide them."}):i.jsx(ke,{variant:"error",title:"Unsandboxed host",children:"This session's host runs without a sandbox. Approved commands and commits execute directly on the host owner's machine with their full user permissions, network access and no resource limits."})),g.approvals.filter(pe=>pe.status==="pending").map(pe=>{const ut=pe.operation.kind==="permission",gt=UE(pe.operation,h),Wt=bb(pe.operation,h,pe.unbounded),Cn=ut||pe.operation.kind==="git.repin",kt=M.busy||!pe.reviewHash;return i.jsx(aw,{approval:pe,children:ye(pe)?i.jsxs(i.Fragment,{children:[!pe.reviewHash&&i.jsx(ke,{variant:"warning",title:"No verified review commitment",actions:i.jsx(V,{variant:"outline",size:"sm",disabled:M.busy,onClick:d.refresh,children:"Refresh approval"}),children:"Refresh before deciding; the server must bind the displayed operation and requester."}),ut?i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"default",size:"sm",disabled:kt,onClick:()=>{ge(pe,"approve","call")},children:"Allow once"}),!(pe.operation.kind==="permission"&&pe.operation.tool==="host_bash")&&i.jsx(V,{variant:"outline",size:"sm",disabled:kt,onClick:()=>{ge(pe,"approve","session")},title:"Also runs this tool's commands and pushes without asking for the rest of the session; GitHub comments and merges still ask",children:"Allow for this session"}),i.jsx(V,{variant:"outline",size:"sm",disabled:kt,onClick:()=>{ge(pe,"deny")},children:"Deny"})]}):i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"default",size:"sm",disabled:kt,onClick:()=>{ge(pe,"approve")},children:"Approve"}),i.jsx(V,{variant:"outline",size:"sm",disabled:kt,onClick:()=>{ge(pe,"deny")},children:"Deny"}),i.jsxs("span",{className:"muted small",children:["Runs as ",gt?"the host OS user (outside the sandbox)":g.owner.displayName," · each approval covers one exact operation and its arguments"]})]})]}):i.jsx("p",{className:"muted small",children:Wt?IE(pe.operation,F):Cn?"Waiting for the session owner":"Waiting for an authorized approver"})},pe.id)}),i.jsx(Ce,{...M})]})}):d.error?h?i.jsx(hO,{id:e,user:s,session:h,error:d.error,recovered:()=>{d.reconnect(),c()}}):i.jsx("div",{className:"session-transcript"}):i.jsx(ai,{})]}),h&&y&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"session-scrim","aria-label":"Close session panel",onClick:()=>b(!1)}),i.jsx(Lz,{session:h,view:g,user:s,workspaceRole:re,hosts:_,tab:v,setTab:x,onClose:()=>b(!1),refresh:d.refresh,audit:m,actions:G,openSession:U})]}),h&&ie&&i.jsx(uO,{open:I,title:h.title,busy:G.action.busy,onClose:()=>q(!1),onSave:async pe=>{await G.rename(pe)&&q(!1)}})]})})}function uO({open:e,title:s,busy:a,onClose:l,onSave:c}){const[u,d]=E.useState(s);E.useEffect(()=>{e&&d(s)},[e,s]);const h=u.trim();function g(m){m.preventDefault(),h&&!a&&c(h)}return i.jsx(an,{open:e,title:"Rename session",onClose:l,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{variant:"ghost",onClick:l,children:"Cancel"}),i.jsx(V,{type:"submit",form:"rename-session-form",variant:"default",disabled:a||!h,children:a?"Saving...":"Rename"})]}),children:i.jsx("form",{id:"rename-session-form",className:"stack",onSubmit:g,children:i.jsx(be,{label:"Title",children:i.jsx("input",{className:"input",required:!0,autoFocus:!0,maxLength:200,value:u,onChange:m=>d(m.target.value),autoComplete:"off"})})})})}function dO({id:e,user:s,session:a,view:l,host:c,stale:u,refresh:d,loadOlder:h,openSession:g,pinned:m}){const y=a.ownerId===s.id,[b,v]=E.useState(()=>I0(l,y)),[x,w]=E.useState("write"),[S,T]=jx(e),k=ox(lx(c),()=>T0(e));E.useEffect(()=>{N0(e)},[e]);const[z,A]=E.useState(""),I=E.useRef(null),q=E.useRef(!1),_=Ne(),F=Ne(),[oe,ne]=E.useState(null),B=E.useRef(null),H=E.useRef(!0),[K,re]=E.useState(!1),ie=E.useRef(!1),G=E.useRef(void 0),U=a.permissions??[],M=U.includes("write"),W=U.includes("ask"),ee=x==="ask"&&!W?"write":x,O=a.status==="archived",R=a.frozen===!0,Q=!O&&!R&&(ee==="write"?M:W),N=!!(a.hostUnsandboxed||c?.capabilities.unsandboxed),de=l.queue??[],ye=de.filter(ue=>Eo.includes(ue.status)),ge=de.filter(ue=>!Eo.includes(ue.status)).slice(-5).reverse(),Me=!!l.stoppable&&!O&&M&&ye.length>0,We=de.some(ue=>ue.status==="stopping"),pe=l.conversations,ut=pe.filter(ue=>ue.mode==="ask"&&(!ue.actorId||ue.actorId===s.id)),gt=l.entries.filter(ue=>{if(ue.role==="system"&&!ue.text.trim())return!1;const je=pe.find($e=>$e.id===ue.conversationId);return ee==="ask"?je?.mode==="ask"&&(!je.actorId||je.actorId===s.id)&&(!z||ue.conversationId===z):je?.mode!=="ask"}),Wt=gt.at(-1)?.id,Cn=gt[0]?.id,kt=pe.filter(ue=>(ue.olderEntries??0)>0&&(ee==="ask"?ue.mode==="ask"&&(!ue.actorId||ue.actorId===s.id)&&(!z||ue.id===z):ue.mode!=="ask")),In=kt.reduce((ue,je)=>ue+(je.olderEntries??0),0),[Se,ht]=E.useState(!1),en=E.useRef(null);function An(){if(Se||!kt.length)return;const ue=B.current;en.current=ue?{first:Cn,height:ue.scrollHeight,top:ue.scrollTop}:null,ht(!0),Promise.all(kt.map(je=>h(je.id))).finally(()=>ht(!1))}E.useLayoutEffect(()=>{const ue=B.current;ue&&H.current&&(ue.scrollTop=ue.scrollHeight)},[Wt,gt.length]),E.useEffect(()=>{const ue=B.current;if(!ue||typeof ResizeObserver>"u")return;const je=()=>{H.current&&(ue.scrollTop=ue.scrollHeight)},$e=new ResizeObserver(je);return $e.observe(ue),ue.firstElementChild&&$e.observe(ue.firstElementChild),()=>$e.disconnect()},[]);function tn(ue){const je=ue.scrollHeight-ue.scrollTop-ue.clientHeight;H.current=je<80;const $e=je>240;re($t=>$t===$e?$t:$e)}function $n(){ie.current=!1,window.clearTimeout(G.current),G.current=void 0}E.useEffect(()=>()=>window.clearTimeout(G.current),[]);function Jn(){const ue=B.current;ue&&(H.current=!0,ie.current=!0,re(!1),ue.scrollTo({top:ue.scrollHeight,behavior:"smooth"}),window.clearTimeout(G.current),G.current=window.setTimeout(()=>{$n(),B.current&&tn(B.current)},1e3))}function os(){ie.current&&($n(),B.current&&tn(B.current))}E.useLayoutEffect(()=>{H.current=!0,en.current=null;const ue=B.current;ue&&(ue.scrollTop=ue.scrollHeight)},[ee,z]),E.useLayoutEffect(()=>{const ue=B.current,je=en.current;!ue||!je||je.first===Cn||(en.current=null,!(je.first===void 0||!gt.some($e=>$e.id===je.first))&&(ue.scrollTop=je.top+ue.scrollHeight-je.height))},[Cn]);async function It(ue){ue?.preventDefault();const je=k.images;if(!Q||!S.trim()&&!je.length||_.busy||q.current)return;const $e=fx(c,b,ee==="ask"?"ask":"submit"),$t=$0(c,b,ee==="ask"?"ask":"submit")??q0(c,b);if(!$t&&c&&px($e,xx())&&(q.current=!0,!await Th(c,N).finally(()=>{q.current=!1}))){v(Rt=>({...Rt,access:"approval"}));return}ne(null);const Ri=S,Di=`${ee}:${JSON.stringify($e??null)}:${je.map(qt=>qt.id).join(",")}:${Ri}`;I.current?.key!==Di&&(I.current={key:Di,id:crypto.randomUUID()});const St=I.current;H.current=!0,_.run(async()=>{if($t)throw new Error($t);const qt=St.images??=await dx(je),Rt=await he(`/api/sessions/${ce(e)}/${ee==="ask"?"ask":"submit"}`,{method:"POST",body:{content:Ri,requestId:St.id,...$e?{options:$e}:{},...qt.length?{images:qt}:{}}});ne(Rt),$e&&yx(c,b,l.agent),ee==="ask"&&A(Rt.conversationId),wx(e,Ri),k.sent(je),I.current=null,d()})}function Ea(){!Me||F.busy||F.run(async()=>{await he(`/api/sessions/${ce(e)}/stop`,{method:"POST",body:{}}),d()})}const Tn=Ne(),J=l.busy||ye.length>0,De=L1(l)&&ee==="write"&&!O&&!R&&(M||y)?{...M?{revert:{run:Le,disabled:Tn.busy?"Working...":J?"Stop the session's work to go back to an earlier message":void 0}}:{},...y?{fork:{run:Lt,disabled:Tn.busy?"Working...":void 0}}:{}}:void 0;async function Le(ue,je){Tn.busy||!await Ge({title:je.before?"Go back to before this message?":"Go back to this reply?",message:i.jsxs(i.Fragment,{children:[je.before?"This message and everything after it leave":"Everything after this reply leaves"," the shared conversation, for everyone, and the agent continues from there.",je.before&&" The message goes back into your chat box, when it's empty, to edit and send again."," Only the conversation goes back: files, commits and pushes stay as they are."]}),confirmLabel:"Go back",destructive:!0})||Tn.run(async()=>{await he(`/api/sessions/${ce(e)}/revert`,{method:"POST",body:{entryId:je.entryId}}),je.before&&!Pd(e).trim()&&T(ky(ue)),H.current=!0,d()})}async function Lt(ue,je){Tn.busy||!await Ge({title:"Fork a new session from here?",message:i.jsxs(i.Fragment,{children:["A new session of yours starts on the same host and model with this conversation up to ",je.before?"just before this message, which goes into its chat box":"this reply",". This session stays as it is. Like every new session, the fork's worktree starts empty: its agent clones the workspace's repositories again, and only what was pushed is there."]}),confirmLabel:"Fork session"})||Tn.run(async()=>{const $t=await he(`/api/sessions/${ce(e)}/fork`,{method:"POST",body:{entryId:je.entryId}});je.before&&Io($t.session.id,ky(ue)),g($t.session.id)})}const tt=!!S.trim()&&E1(S)!==S,bt=ME(l)?i.jsxs(i.Fragment,{children:[i.jsx(Os,{}),"Preparing repositories...",ye.length>0&&i.jsxs("span",{className:"muted",children:[" · ",ye.length," queued"]})]}):We?i.jsxs(i.Fragment,{children:[i.jsx(Os,{}),"Stopping...",ye.length>0&&i.jsxs("span",{className:"muted",children:[" · ",ye.length," queued"]})]}):l.busy?i.jsxs(i.Fragment,{children:[i.jsx(Os,{}),l.activity==="waiting"?"Waiting for a decision":"Working","...",ye.length>0&&i.jsxs("span",{className:"muted",children:[" · ",ye.length," queued"]})]}):ye.length?i.jsxs(i.Fragment,{children:[ye.length," queued"]}):i.jsx(i.Fragment,{children:"Idle"});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"session-transcript-frame",children:[i.jsx("div",{className:"session-transcript",ref:B,onWheel:os,onTouchStart:os,onKeyDown:os,onScroll:ue=>{const je=ue.currentTarget;if(ie.current)if(je.scrollHeight-je.scrollTop-je.clientHeight<80)$n();else return;tn(je),je.scrollTop<240&&In>0&&An()},"aria-label":ee==="ask"?"Side ask history":"Shared session history",children:i.jsxs("div",{className:"chat-column",children:[In>0&&i.jsx("div",{className:"transcript-earlier",children:i.jsx(V,{variant:"ghost",size:"sm",icon:"chevron-up",disabled:Se,onClick:An,children:Se?"Loading earlier messages...":`Show earlier messages (${In})`})}),gt.length?gt.map(ue=>i.jsx(lO,{entry:ue,userId:s.id,actions:De},ue.id)):i.jsx(jt,{title:ee==="ask"?"A question on the side":"The conversation begins here",children:ee==="ask"?"Ask about the work without changing it":"Committed messages and tool results will appear here"})]})}),K&&i.jsx(V,{variant:"secondary",size:"sm",icon:"arrow-down",className:"jump-to-latest","aria-label":"Jump to the latest message",title:"Jump to the latest message",onClick:Jn})]}),i.jsxs("div",{className:"session-bottom",children:[i.jsx("div",{className:"session-pinned",children:i.jsxs("div",{className:"chat-column stack",children:[m,i.jsxs("details",{className:"queue-line",children:[i.jsxs("summary",{role:"status","aria-live":"polite",children:[bt,i.jsx(ve,{name:"chevron-down",size:14})]}),i.jsxs("div",{className:"queue-detail stack",children:[i.jsx("p",{className:"muted small",children:"Submissions and side asks share one queue; permissions are checked again before work runs. You can leave this page: accepted work continues while the host is online and authorized."}),u&&i.jsx("p",{className:"small",children:"This is the last received queue view; live host status is not confirmed."}),oe&&i.jsxs("p",{className:"small",children:["Last receipt ",i.jsx("code",{children:oe.submissionId})," · ",oe.status,oe.queuePosition!==void 0?` · queue position ${oe.queuePosition}`:""]}),ye.length>0&&i.jsx("ol",{className:"queue-items",children:ye.map((ue,je)=>i.jsxs("li",{children:[i.jsxs("span",{children:[je+1,". ",ue.mode==="ask"?"Read-only side ask":"Shared submission"," · ",ue.status]}),i.jsxs("span",{className:"muted small",children:["By ",i.jsx(Ni,{id:ue.actorId,you:!0})," · Receipt ",i.jsx("code",{children:ue.submissionId})]})]},ue.submissionId))}),ge.length>0&&i.jsx("ul",{className:"queue-items",children:ge.map(ue=>i.jsxs("li",{children:[i.jsxs("span",{children:[ue.status," · ",ue.mode==="ask"?"Side ask":"Shared submission"]}),i.jsxs("span",{className:"muted small",children:["By ",i.jsx(Ni,{id:ue.actorId,you:!0})," · Receipt ",i.jsx("code",{children:ue.submissionId})]})]},ue.submissionId))}),i.jsx("div",{className:"inline",children:i.jsx(V,{variant:"outline",size:"sm",icon:"refresh",onClick:d,children:"Refresh queue"})})]})]})]})}),i.jsxs("div",{className:"chat-column stack",children:[i.jsx(cw,{value:S,onChange:T,onSubmit:It,attachments:k,busy:_.busy,disabled:!Q,onStop:Me?Ea:void 0,stopping:F.busy,label:ee==="ask"?"Ask without making changes":"Continue the shared work",placeholder:Q?ee==="ask"?"Ask without changing anything":"Message the agent":"Read-only",sendLabel:ee==="ask"?"Send side ask":"Submit to session",hintRequired:!Q||ee==="ask",hint:O?"Read-only · this session is archived":R?"Read-only · this session pinned its repositories when it started":Q?ee==="ask"?"Read-only · anyone who can view this session can see side asks":`Runs as ${l.owner.displayName}${l.owner.id===s.id?" (you)":""}`:W?"Read-only · switch to Side ask to ask questions":"Read-only · submitting needs write permission",tools:i.jsxs(i.Fragment,{children:[W&&i.jsx(Aa,{size:"xs",label:"Conversation mode",value:ee,onChange:w,options:[{value:"write",label:"Shared"},{value:"ask",label:"Side ask"}]}),ee==="ask"&&ut.length>0&&i.jsx(Zt,{label:"Side conversation",side:"above",value:z,onChange:A,options:[{value:"",label:"All my side asks"},...ut.map((ue,je)=>({value:ue.id,label:`Side ask ${je+1}`,hint:ue.id.slice(0,8)}))]}),Q&&i.jsx(vx,{host:c,value:b,onChange:v,owner:y,showAccess:ee==="write",unsandboxed:N})]})}),tt&&i.jsxs("p",{className:"muted small",role:"status",children:["This message looks like it holds a secret. Everyone, you included, sees it as ",wt," in the transcript, but the agent and its host receive it as typed."]}),i.jsx(Ce,{error:_.error||F.error||Tn.error})]})]})]})}function cw({value:e,onChange:s,onSubmit:a,attachments:l,onStop:c,stopping:u,busy:d,disabled:h,label:g,placeholder:m,sendLabel:y,hint:b,hintRequired:v,tools:x}){const[w]=E.useState(()=>tx()),S=!!(e.trim()||l?.images.length),T=E.useRef(null);E.useLayoutEffect(()=>{const A=T.current;A&&(A.style.height="auto",A.style.height=`${A.scrollHeight}px`)},[e]);function k(A){A?.preventDefault(),!h&&!d&&S&&a()}function z(A){w&&A.key==="Enter"&&!A.shiftKey&&!A.nativeEvent.isComposing&&k(A)}return i.jsxs("form",{className:"composer",onSubmit:k,children:[l&&i.jsx(ux,{attachments:l,disabled:d||h}),i.jsx("textarea",{ref:T,rows:1,required:!l?.images.length,value:e,disabled:d||h,"aria-label":g,placeholder:m,enterKeyHint:w?"send":"enter",onChange:A=>s(A.target.value),onKeyDown:z,onPaste:l?.paste}),l?.notice&&i.jsx("p",{className:"composer-notice",role:"status",children:l.notice}),i.jsxs("div",{className:"composer-toolbar",children:[(l&&!h||x)&&i.jsxs("span",{className:"composer-tools",children:[l&&!h&&i.jsx(cx,{attachments:l,disabled:d}),x]}),i.jsx("span",{className:v?"composer-hint required":"composer-hint",children:b}),i.jsxs("span",{className:"composer-actions",children:[c&&i.jsx(V,{variant:"outline",size:"sm",icon:"stop",className:"composer-stop","aria-label":u?"Stopping...":"Stop",title:"Stop the running message and those queued",disabled:u,onClick:c}),i.jsx(V,{type:"submit",variant:"default",size:"sm",icon:"send",className:"composer-send","aria-label":d?"Sending...":y,title:y,disabled:d||h||!S})]})]})]})}function hO({id:e,user:s,session:a,error:l,recovered:c}){const[u,d]=jx(e),h=E.useRef(null),g=Ne(),m=a.status==="error"||a.status==="provisioning",y=m&&a.ownerId===s.id&&!!a.permissions?.includes("manage"),b=!!a.permissions?.includes("write");function v(){const S=u;h.current?.content!==S&&(h.current={content:S,id:crypto.randomUUID()});const T=h.current.id;g.run(async()=>{await he(`/api/sessions/${ce(e)}/restart`,{method:"POST"});try{await he(`/api/sessions/${ce(e)}/submit`,{method:"POST",body:{content:S,requestId:T}})}catch(k){throw Io(e,S),c(),k}h.current=null,wx(e,S),c()})}const x=a.status==="error"?"This session didn't start":a.status==="provisioning"?"This session is still starting":"This session can't be reached",w=y?"Send a message to start it again on its host. Your message runs once it's ready.":m?"Only the session owner can start it again.":b?"Messages can be sent once the host is back online.":"The conversation appears once the host is back online.";return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"session-transcript",children:i.jsx("div",{className:"chat-column",children:i.jsx(jt,{title:x,children:i.jsxs("span",{className:"stack",children:[i.jsx("span",{children:w}),m&&l&&i.jsx("span",{className:"muted small",children:l})]})})})}),i.jsx("div",{className:"session-bottom",children:i.jsxs("div",{className:"chat-column stack",children:[i.jsx(cw,{value:u,onChange:d,onSubmit:v,busy:g.busy,disabled:!y,label:"Message the agent",placeholder:y?"Message the agent to start the session again":"Message the agent",sendLabel:y?"Restart and send":"Sending is unavailable",hintRequired:!0,hint:g.busy?"Starting the session and preparing repositories...":y?"Restarts the session, then sends":m?"Only the owner can restart this session":b?"Waiting for the host":"Read-only — submitting needs write permission"}),i.jsx(Ce,{error:g.error})]})})]})}const Rb={working:{tone:"running",label:"In progress"},waiting:{tone:"warning",label:"Needs approval"},failed:{tone:"danger",label:"Failed"},done:{tone:"success",label:"Done"},idle:{tone:"neutral",label:"Idle"}};function uw(e,s=e.activity){return e.status==="archived"?{tone:"neutral",label:"Archived"}:e.status==="provisioning"?{tone:"running",label:"Starting"}:e.status==="error"?{tone:"danger",label:"Not started"}:e.nextScheduledAt&&s!=="working"&&s!=="waiting"&&s!=="failed"?{tone:"info",label:"Scheduled",icon:"clock"}:s&&Object.hasOwn(Rb,s)?Rb[s]:{tone:"success"}}function dw(e){const s=new Set(e.map(h=>h.id)),a=new Map,l=[];for(const h of e){const g=h.parentSessionId;if(g&&s.has(g)&&g!==h.id){const m=a.get(g);m?m.push(h):a.set(g,[h])}else l.push(h)}const c=[],u=new Set,d=(h,g)=>{if(!u.has(h.id)){u.add(h.id),c.push({session:h,depth:g});for(const m of a.get(h.id)??[])d(m,Math.min(g+1,3))}};for(const h of l)d(h,0);for(const h of e)u.has(h.id)||d(h,0);return c}const Db=50;function fO(){const{user:e,sessions:s,sessionsLoading:a,workspaces:l,currentWorkspace:c}=yt(),[u,d]=E.useState(""),[h,g]=E.useState({}),[m,y]=E.useState(!1),[b,v]=E.useState(!1),x=E.useMemo(()=>s.filter(k=>k.status==="archived").length,[s]),w=E.useMemo(()=>{const k=u.trim().toLowerCase(),z=new Map;for(const q of s){if(q.status==="archived"&&!b||k&&!q.title.toLowerCase().includes(k))continue;const _=z.get(q.workspaceId);_?_.push(q):z.set(q.workspaceId,[q])}const A=[c?.id,...l.map(q=>q.id)],I=q=>{const _=A.indexOf(q);return _<0?A.length:_};return[...z.entries()].sort(([q],[_])=>I(q)-I(_)).map(([q,_])=>({id:q,name:l.find(F=>F.id===q)?.name??"Other workspace",sessions:_}))},[s,u,b,l,c?.id]),S=i.jsx(Uo,{title:"Sessions",actions:i.jsxs(i.Fragment,{children:[i.jsx(Mr,{label:"Who can see a session",children:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Private sessions are visible to their owner, the workspace's owner and admins, and people with an explicit grant. Workspace-visible sessions can be viewed by every workspace member."}),i.jsx("p",{children:"Viewing never allows asking, writing, approving or managing; those need separate grants. The workspace's owner and admins manage every session in it, but approve only with a grant. Opening a session keeps its original owner identity and history."}),i.jsx("p",{children:"Only the owner, or the workspace's owner or an admin, can change visibility, which is separate from sharing a host."})]})}),x>0&&i.jsx(V,{variant:"ghost",size:"sm",icon:"archive","aria-pressed":b,onClick:()=>v(k=>!k),children:b?"Hide archived":`Show archived (${x})`}),i.jsx(V,{variant:"outline",size:"sm",onClick:()=>y(!0),children:"Open by ID"})]})}),T=i.jsx(mO,{open:m,onClose:()=>y(!1)});return a?i.jsxs(i.Fragment,{children:[S,i.jsx(ai,{}),T]}):s.length?i.jsxs(i.Fragment,{children:[S,i.jsxs("div",{className:"content-column",children:[i.jsx("input",{className:"input sessions-search",type:"search",value:u,onChange:k=>d(k.target.value),placeholder:"Search sessions","aria-label":"Search sessions by title"}),w.length?w.map(k=>{const z=h[k.id]??Db;return i.jsxs(Oe,{title:i.jsxs("span",{className:"inline",children:[i.jsx(Ei,{name:k.name,id:k.id}),k.name]}),children:[dw(k.sessions).slice(0,z).map(({session:A,depth:I})=>{const q=A.ownerId===e.id,_=!q&&A.permissions?.includes("read")&&A.permissions.every(oe=>oe==="read"),F=uw(A);return i.jsx(ae,{href:Qe({name:"session",sessionId:A.id}),chevron:!0,leading:i.jsx(as,{tone:F.tone,icon:F.icon,label:F.label?void 0:A.status}),title:i.jsxs("span",{className:"truncate",children:[I>0&&i.jsxs("span",{className:"muted","aria-label":"Started by the session above",children:[" ".repeat(I-1),"↳ "]}),A.title]}),hint:i.jsxs(i.Fragment,{children:[F.label&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`session-status ${F.tone}`,children:F.label})," · "]}),A.pullRequest&&i.jsxs(i.Fragment,{children:[i.jsx(qv,{pull:A.pullRequest})," · "]}),q?"Yours":_?"Viewer":"Shared"," · ",A.visibility==="workspace"?"Workspace-visible":"Private"," · ",i.jsx(Zn,{value:A.createdAt})]})},A.id)}),k.sessions.length>z&&i.jsx("div",{className:"sessions-more",children:i.jsx(V,{variant:"ghost",size:"sm",block:!0,onClick:()=>g(A=>({...A,[k.id]:z+Db})),children:"Load more"})})]},k.id)}):i.jsx(jt,{title:!u.trim()&&!b?"All sessions are archived":"No matching sessions"})]}),T]}):i.jsxs(i.Fragment,{children:[S,i.jsx(jt,{title:"No sessions yet",action:c&&i.jsx(Bt,{variant:"ghost",href:Qe({name:"new",workspaceId:c.id}),children:"Start a session"})}),T]})}function mO({open:e,onClose:s}){const[a,l]=E.useState(""),c=Ne();function u(d){d.preventDefault(),!(!a.trim()||c.busy)&&c.run(async()=>{const h=await he(`/api/sessions/${ce(a.trim())}`);s(),l(""),rs({name:"session",sessionId:h.session.id})})}return i.jsx(an,{open:e,title:"Open a session by ID",onClose:s,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{variant:"ghost",onClick:s,children:"Cancel"}),i.jsx(V,{type:"submit",form:"open-session-form",variant:"default",disabled:c.busy||!a.trim(),children:c.busy?"Checking access...":"Open session"})]}),children:i.jsxs("form",{id:"open-session-form",className:"stack",onSubmit:u,children:[i.jsx(be,{label:"Session ID",hint:"Ask the session owner for its ID",children:i.jsx("input",{className:"input",required:!0,autoFocus:!0,value:a,onChange:d=>l(d.target.value),autoComplete:"off"})}),i.jsx(Ce,{error:c.error})]})})}function Ai(e,s,a){return`${e.toLocaleString()} ${e===1?s:a}`}function Hd(e,...s){const a=s.filter(Boolean).join(" ").toLowerCase();return e.toLowerCase().split(/\s+/).filter(Boolean).every(l=>a.includes(l))}function Id({list:e}){return e?.truncated?i.jsx(Re,{children:i.jsxs("span",{className:"muted small",children:["Only the newest ",e.items.length.toLocaleString()," are listed"]})}):null}function pO(){const e=qe("/api/admin/overview"),s=qe("/api/admin/users"),a=qe("/api/admin/workspaces"),l=qe("/api/admin/hosts"),[c,u]=E.useState(""),d=Ne(),h=e.data?.overview;function g(){e.refresh(),s.refresh(),l.refresh()}async function m(w){await Ge({title:"Suspend account",destructive:!0,confirmLabel:"Suspend",message:`Suspend ${Mt(w)}? They're signed out everywhere and can't sign in, their hosts are disconnected, and nobody can open the sessions they own until you unsuspend them. Nothing is deleted.`})&&d.run(async()=>{await he(`/api/admin/users/${ce(w.id)}/suspend`,{method:"POST"}),g()},"Account suspended.")}function y(w){d.run(async()=>{await he(`/api/admin/users/${ce(w.id)}/unsuspend`,{method:"POST"}),g()},"Account unsuspended. They can sign in again and their hosts reconnect.")}const b=(s.data?.items??[]).filter(w=>Hd(c,w.displayName,w.githubLogin,w.id)),v=(a.data?.items??[]).filter(w=>Hd(c,w.name,w.ownerName,w.ownerGithubLogin,w.ownerId,w.id)),x=(l.data?.items??[]).filter(w=>Hd(c,w.name,w.ownerName,w.ownerGithubLogin,w.ownerId,w.id));return i.jsxs(i.Fragment,{children:[i.jsx(Oe,{title:"Overview",info:"Totals for this whole Pikibun server. You administer it because its operator lists your user ID in ADMIN_USER_IDS. Administration shows who uses the server and what they run it on, never what they work on: no session titles, prompts, repositories or credentials.",children:i.jsx(dt,{...e,retry:e.refresh,children:h&&i.jsxs(i.Fragment,{children:[i.jsx(ae,{title:"Accounts",trailing:i.jsxs(i.Fragment,{children:[h.users.toLocaleString(),h.suspendedUsers>0&&i.jsxs(Te,{tone:"danger",children:[h.suspendedUsers.toLocaleString()," suspended"]})]})}),i.jsx(ae,{title:"Workspaces",trailing:h.workspaces.toLocaleString()}),i.jsx(ae,{title:"Hosts",trailing:`${h.onlineHosts.toLocaleString()} online of ${h.hosts.toLocaleString()}`}),i.jsx(ae,{title:"Sessions",trailing:`${h.activeSessions.toLocaleString()} active of ${h.sessions.toLocaleString()}`})]})})}),i.jsx("input",{className:"input admin-filter",type:"search",value:c,onChange:w=>u(w.target.value),placeholder:"Filter by name, username or ID","aria-label":"Filter accounts, workspaces and hosts"}),i.jsx(Oe,{title:"Accounts",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Suspending an account signs it out everywhere, refuses its sign-ins, disconnects its hosts and closes the sessions it owns to everyone, as if it had left its workspaces. Nothing is deleted: unsuspending restores it as it was."}),i.jsx("p",{children:"Administrators can't be suspended here; remove them from ADMIN_USER_IDS first."})]}),children:i.jsxs(dt,{...s,retry:s.refresh,children:[b.length?b.map(w=>i.jsx(ae,{leading:i.jsx(Ei,{name:w.displayName,id:w.id}),title:w.displayName,hint:i.jsxs(i.Fragment,{children:[Mt(w)," · ",Ai(w.workspaces,"workspace","workspaces")," · ",Ai(w.hosts,"host","hosts")," · ",Ai(w.sessions,"session","sessions")," · Joined ",i.jsx(Zn,{value:w.createdAt})]}),trailing:i.jsxs(i.Fragment,{children:[w.instanceAdmin&&i.jsx(Te,{tone:"success",children:"Administrator"}),w.suspendedAt&&i.jsx(Te,{tone:"danger",children:"Suspended"}),!w.instanceAdmin&&i.jsx(Kn,{label:`Actions for ${w.displayName}`,items:[w.suspendedAt?{label:"Unsuspend",icon:"refresh",disabled:d.busy,onSelect:()=>y(w)}:{label:"Suspend",icon:"lock",destructive:!0,disabled:d.busy,onSelect:()=>{m(w)}}]})]})},w.id)):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:c.trim()?"No matching accounts":"No accounts"})}),i.jsx(Id,{list:s.data}),(d.error||d.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...d})})]})}),i.jsx(Oe,{title:"Workspaces",children:i.jsxs(dt,{...a,retry:a.refresh,children:[v.length?v.map(w=>i.jsx(ae,{leading:i.jsx(Ei,{name:w.name,id:w.id}),title:w.name,hint:i.jsxs(i.Fragment,{children:["Owner ",Mt({id:w.ownerId,githubLogin:w.ownerGithubLogin})," · ",Ai(w.members,"member","members")," · ",Ai(w.repositories,"repository","repositories")," · ",Ai(w.hosts,"host","hosts")," · ",Ai(w.sessions,"session","sessions")," · Created ",i.jsx(Zn,{value:w.createdAt})]})},w.id)):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:c.trim()?"No matching workspaces":"No workspaces"})}),i.jsx(Id,{list:a.data})]})}),i.jsx(Oe,{title:"Hosts",info:"Every paired host that hasn't been removed. A suspended account's hosts stay paired but can't connect until it is unsuspended.",children:i.jsxs(dt,{...l,retry:l.refresh,children:[x.length?x.map(w=>{const[S,T]=w.revokedAt?["danger","Revoked"]:w.online?["success","Online"]:["neutral","Offline"];return i.jsx(ae,{leading:i.jsx(as,{tone:S,label:T}),title:w.name,hint:i.jsxs(i.Fragment,{children:[Mt({id:w.ownerId,githubLogin:w.ownerGithubLogin})," · ",Ai(w.workspaces,"workspace","workspaces")," · ",Ai(w.sessions,"session","sessions"),w.lastSeenAt&&i.jsxs(i.Fragment,{children:[" · Last connected ",i.jsx(Zn,{value:w.lastSeenAt})]})]}),trailing:i.jsx(Te,{tone:S,children:T})},w.id)}):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:c.trim()?"No matching hosts":"No hosts"})}),i.jsx(Id,{list:l.data})]})})]})}const hw="pikibun.theme";function fw(){try{const e=localStorage.getItem(hw);return e==="light"||e==="dark"||e==="pikibun"?e:"system"}catch{return"system"}}function mh(e=fw()){if(e==="pikibun"){document.documentElement.dataset.theme="pikibun";return}const s=e==="dark"||e==="system"&&matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.dataset.theme=s?"dark":"light"}function mw(){const[e,s]=E.useState(fw);return E.useEffect(()=>{mh(e);const a=matchMedia("(prefers-color-scheme: dark)"),l=()=>mh();return a.addEventListener("change",l),()=>a.removeEventListener("change",l)},[e]),[e,a=>{try{localStorage.setItem(hw,a)}catch{}s(a)}]}function gO(){const[e,s]=mw();return i.jsx(Oe,{title:"Theme",children:i.jsx(ae,{title:"Color theme",hint:"System follows your device setting",trailing:i.jsx(Aa,{label:"Color theme",value:e,onChange:s,options:[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"pikibun",label:"Pikibun",icon:"sparkle",hint:"Night sky, lavender and cream, after Pikibun"},{value:"system",label:"System",icon:"monitor"}]})})})}const ph={approve:{label:"Approve host commands",hint:"Decides each host command in sessions they can approve"},auto:{label:"Auto-approve host commands",hint:"Also runs the host commands of their own Auto-approve messages without asking"}},Mb=[{value:"never",label:"No expiry",days:0},{value:"1",label:"1 day",days:1},{value:"7",label:"7 days",days:7},{value:"30",label:"30 days",days:30}],Ns="*";function pw(e){return qe(e?`/api/workspaces/${ce(e)}/members`:null)}function yO({connector:e,refresh:s}){const{user:a,workspaces:l}=yt(),c=Ne(),u=e.role==="owner",d=e.admins??[],h=l.filter(z=>(e.connectedWorkspaceIds??e.workspaceIds).includes(z.id)),[g,m]=E.useState(""),y=h.find(z=>z.id===g)??h[0],b=pw(u?y?.id:void 0),v=(b.data?.members??[]).filter(z=>z.userId!==e.ownerId&&!d.some(A=>A.userId===z.userId)),[x,w]=E.useState(""),S=v.find(z=>z.userId===x)??v[0];function T(){S&&(async()=>await Ge({title:`Make ${Mt(zi(S))} an admin?`,message:`They will manage ${e.name}'s sharing: share it with workspaces you both belong to, and grant members host commands there, including themselves. Host commands run on your machine with your files, credentials and network. They will also choose which of its models it offers, to everyone including you. Only you can add admins, revoke or remove the host.`,confirmLabel:"Add admin",destructive:!0})&&await c.run(async()=>{await he(`/api/connectors/${ce(e.id)}/admins/${ce(S.userId)}`,{method:"PUT",body:{}}),s()},"Admin added."))()}function k(z){const A=z===a.id;(async()=>await Ge({title:A?"Stop managing this host?":"Remove this admin?",message:A?"You will no longer manage its sharing. Grants already given stay until someone removes them.":"They will no longer manage its sharing. Grants they gave stay until someone removes them.",confirmLabel:A?"Step down":"Remove admin"})&&await c.run(async()=>{await he(`/api/connectors/${ce(e.id)}/admins/${ce(z)}`,{method:"DELETE"}),s()},A?"You no longer manage this host.":"Admin removed."))()}return i.jsxs(Oe,{title:"Admins",bare:!0,info:"Admins manage this host's sharing for you: its workspace shares and host command grants, and which of its models it offers. They hold no host command access of their own unless a grant gives it to them, and only the owner can add admins, revoke or remove the host.",children:[i.jsxs("div",{className:"card",children:[!d.length&&i.jsx(ae,{title:"No admins",hint:u?"Only you manage this host":void 0}),d.map(z=>i.jsx(ae,{title:z.name||z.userId,hint:i.jsxs(i.Fragment,{children:["Admin since ",i.jsx(Kt,{value:z.createdAt})]}),trailing:(u||z.userId===a.id)&&i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy,onClick:()=>k(z.userId),children:z.userId===a.id?"Step down":"Remove"})},z.userId)),u&&!e.revokedAt&&(h.length?i.jsx(ae,{title:"Add admin",hint:b.loading?"Loading members...":v.length?"A member of a workspace this host is connected to":`No other members in ${y?.name??"this workspace"}`,trailing:i.jsxs(i.Fragment,{children:[h.length>1&&i.jsx(Zt,{label:"Workspace",value:y?.id??"",options:h.map(z=>({value:z.id,label:z.name})),onChange:z=>{m(z),w("")},disabled:c.busy}),v.length>0&&i.jsx(Zt,{label:"Member",value:S?.userId??"",options:v.map(z=>({value:z.userId,label:Mt(zi(z))})),onChange:w,disabled:c.busy}),i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy||!S,onClick:T,children:"Add"})]})}):i.jsx(ae,{title:"Add admin",hint:"Connect the host to a workspace first"}))]}),i.jsx(Ce,{error:c.error,notice:c.notice})]})}function bO(e){return i.jsxs(i.Fragment,{children:[ph[e.level].hint,e.hostSessions?" · may start sessions on the host":"",e.expiresAt?i.jsxs(i.Fragment,{children:[" · expires ",i.jsx(Kt,{value:e.expiresAt})]}):" · no expiry"]})}function xO({connector:e,refresh:s}){const{workspaces:a}=yt(),l=Ne(),c=e.role==="owner",u=e.hostGrants??[],d=new Map(a.map(M=>[M.id,M.name])),h=a.filter(M=>e.workspaceIds.includes(M.id)),[g,m]=E.useState(""),y=h.find(M=>M.id===g)??h[0],b=pw(y?.id),v=(b.data?.members??[]).filter(M=>M.userId!==e.ownerId&&M.role!=="viewer"),[x,w]=E.useState(Ns),[S,T]=E.useState("approve"),k=e.config?.hostSessions===!0&&!e.capabilities.unsandboxed,z=!e.capabilities.productionShell&&!e.capabilities.unsandboxed,A=z&&e.capabilities.unboundedShellGrants===!0,I=c&&u.some(M=>M.hostSessions)&&e.capabilities.hostGrants&&!e.capabilities.hostSessionGrants,[q,_]=E.useState("7"),F=v.find(M=>M.userId===x),oe=F?Mt(zi(F)):`every member of ${y?.name??"the workspace"}`,ne=u.find(M=>M.workspaceId===y?.id&&(M.userId??Ns)===(F?.userId??Ns)),B=`${y?.id??""}:${F?.userId??Ns}`,[H,K]=E.useState(null),re=H?.key===B?H.value:ne?.hostSessions===!0,ie=M=>K({key:B,value:M});function G(){y&&(async()=>{const M=S==="auto",W=c&&re,ee=c&&!re&&ne?.hostSessions===!0;if(!await Ge({title:W?"Grant sessions on the host?":M?"Grant automatic host commands?":"Grant host command approval?",message:(M?`${oe} will be able to run host_bash on ${e.name} OUTSIDE the sandbox without anyone approving each command, whenever they send a message with Auto-approve. Commands run on the owner's machine as its user, with its files, credentials and network, and no resource limits.`:`${oe} will be able to approve host_bash commands on ${e.name}, which run OUTSIDE the sandbox on the owner's machine with its files, credentials and network.`)+(W?` They will also be able to start their own sessions directly on ${e.name}, without the sandbox: every command of those sessions runs as its user${M?", without asking under their Auto-approve":", once approved"}, and their clones use its Git and credentials.`:"")+(A?` As ${e.name} has no resource limits for commands, the shell commands of their own sandboxed sessions will run there without them too${M?", without asking under their Auto-approve":", each once approved like a host command"}.`:"")+(ee?` This replaces their current grant, which includes sessions on the host: they will no longer start sessions directly on ${e.name}, and the next command of any they have there will stop.`:""),confirmLabel:"Grant",destructive:M||W}))return;const O=Mb.find(R=>R.value===q).days;await l.run(async()=>{await he(`/api/connectors/${ce(e.id)}/host-grants/${ce(y.id)}`,{method:"PUT",body:{...F?{userId:F.userId}:{},level:S,...c?{hostSessions:re}:{},...O?{expiresAt:new Date(Date.now()+O*864e5).toISOString()}:{}}}),K(null),s()},"Host command access granted.")})()}function U(M){l.run(async()=>{const W=M.userId?`?userId=${encodeURIComponent(M.userId)}`:"";await he(`/api/connectors/${ce(e.id)}/host-grants/${ce(M.workspaceId)}${W}`,{method:"DELETE"}),s()},"Host command access removed.")}return i.jsxs(Oe,{title:"Host command access",bare:!0,info:"host_bash runs OUTSIDE the sandbox, on this machine as its user. By default only the owner decides those commands. Grant members of a shared workspace the right to approve them, or to run their own without asking under Auto-approve. The owner may also let them start their own sessions directly on the host, without the sandbox. On a host without resource limits, a grant also lets the member's own sandboxed sessions run shell commands without them, decided like host commands. Grants end when they expire, when you remove them, or when the host stops being shared there.",children:[i.jsxs("div",{className:"card",children:[!u.length&&i.jsx(ae,{title:"Only the owner",hint:"No one else decides host commands on this host"}),u.map(M=>i.jsx(ae,{title:i.jsxs(i.Fragment,{children:[M.userId?M.userName??M.userId:"All members"," ",i.jsxs("span",{className:"muted",children:["· ",d.get(M.workspaceId)??M.workspaceId]})]}),hint:bO(M),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Te,{tone:M.level==="auto"?"warning":"neutral",children:M.level==="auto"?"Auto-approve":"Approve"}),M.hostSessions&&i.jsx(Te,{tone:"danger",children:"Sessions on host"}),i.jsx(V,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>U(M),children:"Remove"})]})},`${M.workspaceId}:${M.userId??""}`)),!e.revokedAt&&(h.length?i.jsx(ae,{title:"Grant access",hint:b.loading?"Loading members...":ph[S].hint,trailing:i.jsxs(i.Fragment,{children:[h.length>1&&i.jsx(Zt,{label:"Workspace",value:y?.id??"",options:h.map(M=>({value:M.id,label:M.name})),onChange:M=>{m(M),w(Ns)},disabled:l.busy}),i.jsx(Zt,{label:"Member",value:F?F.userId:Ns,options:[{value:Ns,label:"All members"},...v.map(M=>({value:M.userId,label:Mt(zi(M))}))],onChange:w,disabled:l.busy}),i.jsx(Zt,{label:"Access",value:S,options:["approve","auto"].map(M=>({value:M,label:ph[M].label})),onChange:T,disabled:l.busy}),c&&!e.capabilities.unsandboxed&&i.jsxs("label",{className:"check-row small",title:k?"Their own sessions may run directly on this machine, without the sandbox, as its user":"Turn on Sessions on the host under Configuration for this to apply",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:re,disabled:l.busy,onChange:M=>ie(M.target.checked)}),i.jsx("span",{children:"Sessions on the host"})]}),i.jsx(Zt,{label:"Expires",value:q,options:Mb.map(M=>({value:M.value,label:M.label})),onChange:_,disabled:l.busy}),i.jsx(V,{variant:"outline",size:"sm",disabled:l.busy||!y,onClick:G,children:"Grant"})]})}):i.jsx(ae,{title:"Grant access",hint:"Share the host with a workspace first"}))]}),c&&u.some(M=>M.hostSessions)&&!k&&i.jsx(ae,{title:"Sessions on the host are off",hint:"Grants that include sessions on the host apply only while Configuration → Sessions on the host is on."}),I&&i.jsx(ae,{title:"Update the host's connector",hint:"This host's connector runs only your own sessions on the host: until it is updated (npx pikibun@latest connect), members you granted that get the sandbox."}),!I&&u.length>0&&z&&e.capabilities.hostGrants&&!e.capabilities.unboundedShellGrants&&i.jsx(ae,{title:"Update the host's connector",hint:"This host has no resource limits, and its connector refuses every command of other members' sandboxed sessions: until it is updated (npx pikibun@latest connect), the members you granted host commands can't run commands, or clone, in their own."}),!e.capabilities.hostGrants&&i.jsx(ae,{title:"Update the host's connector",hint:"This host's connector predates grants: until it is updated (npx pikibun@latest connect), only the owner decides its host commands."}),i.jsx(Ce,{error:l.error,notice:l.notice})]})}const gw=Object.freeze({commandTimeoutSeconds:Object.freeze({min:30,max:3600}),compactionTokens:Object.freeze({min:0,max:1e7}),compactionModels:200}),gh=Object.freeze({commandTimeoutSeconds:30,gpu:!1,gitCredentials:!1,repositoryCache:"off",hostSessions:!1,compaction:Object.freeze({})}),vO=Object.freeze(["gitCredentials","repositoryCache","hostSessions"]),yw=["reserveTokens","keepRecentTokens"],wO={reserveTokens:"",keepRecentTokens:""},Lb=e=>({reserveTokens:e?.reserveTokens?.toString()??"",keepRecentTokens:e?.keepRecentTokens?.toString()??""});function $d(e){return{overall:Lb(e),models:Object.fromEntries(Object.entries(e.modelOverrides??{}).map(([s,a])=>[s,Lb(a)]))}}function bw(e){const s=e.trim().replace(/[,_\s]/g,"");if(!s)return null;if(!/^\d{1,9}$/.test(s))return;const a=Number(s);return a<=gw.compactionTokens.max?a:void 0}function _b(e){const s={};for(const a of yw){const l=bw(e[a]);if(l===void 0)return;l!==null&&(s[a]=l)}return s}function jO(e){const s=_b(e.overall);if(!s)return;const a={};for(const l of Object.keys(e.models).sort()){const c=_b(e.models[l]);if(!c)return;Object.keys(c).length&&(a[l]=c)}return Object.keys(a).length?{...s,modelOverrides:a}:s}const qd=(e,s)=>e<s?-1:e>s?1:0,kO=i.jsxs("div",{className:"stack",children:[i.jsxs("p",{children:["Pi summarizes a long conversation once it comes within ",i.jsx("em",{children:"reserve"})," tokens of the model's context window, and keeps the most recent ",i.jsx("em",{children:"keep recent"})," tokens word for word. The summary may use up to 80% of the reserve, thinking included."]}),i.jsx("p",{children:"Counts set here replace those of Pi's settings.json on the host (compaction.reserveTokens, compaction.keepRecentTokens and compaction.modelOverrides); an empty one keeps the host's setting, or the default. A model's own count wins over the one for all models, here or in the host's settings."}),i.jsx("p",{children:"By default a reasoning model reserves a tenth of its context window, from 16K to 64K tokens. If messages fail because Pi's summary hit its token limit, raise the reserve for that model."}),i.jsx("p",{children:"Sessions on the host pick up a change within a minute, from the next message they send after it."})]});function Ub({value:e,onChange:s,disabled:a,label:l}){return i.jsx("span",{className:"token-inputs",children:yw.map(c=>{const u=c==="reserveTokens"?"Reserve":"Keep recent";return i.jsxs("label",{className:"token-field",children:[i.jsx("span",{className:"small muted",children:u}),i.jsx("input",{className:"input token-input",inputMode:"numeric",autoComplete:"off",spellCheck:!1,placeholder:"Host's Pi",value:e[c],disabled:a,"aria-label":`${u} tokens, ${l}`,"aria-invalid":bw(e[c])===void 0||void 0,onChange:d=>s({...e,[c]:d.target.value})})]},c)})})}function SO({connector:e,refresh:s}){const a=e.config?.compaction??{},l=JSON.stringify(a),[c,u]=E.useState(()=>$d(a)),d=E.useRef(l),h=Ne();E.useEffect(()=>{d.current!==l&&(d.current=l,u($d(JSON.parse(l))))},[l]);const g=!!e.role&&!e.revokedAt&&!h.busy,m=jO(c),y=m===void 0||JSON.stringify(m)!==l,b=[...e.models,...e.disabledModels??[]].sort((k,z)=>qd(k.provider,z.provider)||qd(k.modelId,z.modelId)),v=new Set(b.map(k=>`${k.provider}/${k.modelId}`)),x=Object.keys(c.models).filter(k=>!v.has(k)).sort(qd),w=Object.keys(m?.modelOverrides??{}).length;function S(){m&&h.run(async()=>{await he(`/api/connectors/${ce(e.id)}/config`,{method:"PATCH",body:{compaction:m}}),s()},"Compaction saved. Sessions on the host pick it up within a minute.")}const T=k=>{const z=typeof k=="string"?k:`${k.provider}/${k.modelId}`;return i.jsx(ae,{title:typeof k=="string"?k:k.name,hint:typeof k=="string"?"Not offered by this host now":`${k.provider} / ${k.modelId}`,trailing:i.jsx(Ub,{label:z,value:c.models[z]??wO,disabled:!g,onChange:A=>u(I=>({...I,models:{...I.models,[z]:A}}))})},typeof k=="string"?k:Rs(k))};return i.jsx(Oe,{title:"Compaction",bare:!0,info:kO,children:i.jsxs("div",{className:"card",children:[i.jsx(ae,{title:"All models",hint:"Tokens kept free for compaction, and recent tokens kept unsummarized. Empty keeps the host's Pi setting",trailing:i.jsx(Ub,{label:"all models",value:c.overall,disabled:!g,onChange:k=>u(z=>({...z,overall:k}))})}),b.length+x.length>0&&i.jsxs(Ca,{title:"Per model",hint:w?`${w} ${w===1?"model has its":"models have their"} own counts`:"Counts for one model, over those for all models",children:[b.map(T),x.map(T)]}),e.capabilities.hostConfig&&!e.capabilities.compactionConfig&&i.jsx(ae,{title:"Update the host's connector",hint:"This host's connector predates compaction settings in Pikibun and follows its Pi settings alone until it is updated (npx pikibun@latest connect). What you save here applies then."}),(y||h.error||h.notice)&&i.jsx(Re,{children:i.jsxs("div",{className:"stack",children:[i.jsx(Ce,{...h}),!m&&i.jsxs("span",{className:"small muted",children:["Token counts are whole numbers from 0 to ",gw.compactionTokens.max.toLocaleString(),"."]}),y&&i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"default",size:"sm",disabled:h.busy||!m,onClick:S,children:"Save compaction"}),i.jsx(V,{variant:"ghost",size:"sm",disabled:h.busy,onClick:()=>u($d(a)),children:"Discard"})]})]})})]})})}const CO=[30,60,120,300,600,1800,3600];function AO(e){return e%3600===0?e===3600?"1 hour":`${e/3600} hours`:e%60===0?e===60?"1 minute":`${e/60} minutes`:`${e} seconds`}const Bb=Object.keys(gh).filter(e=>e!=="compaction"),Hb={off:"Off",host:"Shared",owner:"Per owner"},Ib={off:"Each session downloads its clones itself",host:"One mirror of each repository, which every session's clones borrow from",owner:"A separate mirror of each repository for each session owner"},TO=i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"How this host runs sessions. Its owner and admins change the command time limit and the GPU; only its owner decides whether it uses its Git credentials, keeps a repository cache or runs their sessions without the sandbox."}),i.jsx("p",{children:"Running sessions pick up a change within a minute. A repository cache change applies when the host's connector next connects."}),i.jsx("p",{children:"A longer time limit also lifts the per-process limits of short commands (25 seconds of CPU, 64 MiB files, 256 open files) so builds fit. Without provisioned resource limits on the host (connect --resources), a command can use the whole machine for that long."})]});function NO({connector:e,refresh:s}){const a=e.role!=="admin",l=e.config??gh,[c,u]=E.useState(l),d=E.useRef(l),h=Ne();E.useEffect(()=>{const T=d.current;d.current=l;const k=Bb.filter(z=>l[z]!==T[z]);k.length&&u(z=>({...z,...Object.fromEntries(k.map(A=>[A,l[A]]))}))},[l.commandTimeoutSeconds,l.gpu,l.gitCredentials,l.repositoryCache,l.hostSessions]);const g=Bb.filter(T=>c[T]!==l[T]&&(a||!vO.includes(T))),m=g.length>0,y=!e.revokedAt&&!h.busy,{unsandboxed:b,gpu:v}=e.capabilities,x=[...new Set([...CO,l.commandTimeoutSeconds])].sort((T,k)=>T-k);function w(){(async()=>c.gitCredentials&&!l.gitCredentials&&!await Ge({title:"Use this host's Git credentials?",message:`Pushes in your own sessions on ${e.name} will use the credentials Git on that machine would use (its credential helpers), wherever a workspace's push access chooses the host's Git credentials. Other members' sessions never use them.`,confirmLabel:"Turn on",destructive:!0})||c.repositoryCache!=="off"&&l.repositoryCache==="off"&&!await Ge({title:"Keep a repository cache on this host?",message:`${e.name} will keep a full mirror of each repository its sessions clone, in its state directory, and their clones will borrow objects from it. It fills the mirrors straight from the repositories' hosts with the credentials Git on that machine would use (its credential helpers), and a session borrows from one only once Pikibun confirms that the session's owner can read the repository with their own account.`,confirmLabel:"Keep a cache"})||c.hostSessions&&!l.hostSessions&&!await Ge({title:"Let your sessions run directly on this host?",message:`When you start a session on ${e.name}, you'll be able to run it without the sandbox. Its commands then run as that machine's user, with its files, credentials, network and GPU, and no resource limits, and only you, or members you granted host commands, decide them. Other members' sessions stay in the sandbox, and so do yours unless you choose otherwise when you start one.`,confirmLabel:"Allow",destructive:!0})||c.gpu&&!l.gpu&&!await Ge({title:"Lend this host's GPU to sandboxed commands?",message:`Shell commands in every session on ${e.name} will be able to use its GPU for rendering and compute. They get its render device only, never the screen, windows or input, but its driver is more of the kernel exposed to them, and they share the GPU with everything else on the machine.`,confirmLabel:"Lend GPU",destructive:!0})||await h.run(async()=>{await he(`/api/connectors/${ce(e.id)}/config`,{method:"PATCH",body:Object.fromEntries(g.map(T=>[T,c[T]]))}),s()},"Configuration saved. Running sessions pick it up within a minute."))()}const S=b?"Commands on an unsandboxed host already run on the machine itself":v?`${v==="dxg"?"WSL GPU (/dev/dxg)":"Linux render nodes (/dev/dri)"}: rendering and compute, never the screen, windows or input`:"No GPU render device found on this host (WSL's /dev/dxg or Linux render nodes)";return i.jsx(Oe,{title:"Configuration",bare:!0,info:TO,children:i.jsxs("div",{className:"card",children:[i.jsx(ae,{title:"Command time limit",hint:b?"How long a shell command may run before it is stopped":"How long a shell command may run in the sandbox before it is stopped",trailing:i.jsx(Zt,{label:"Command time limit",value:String(c.commandTimeoutSeconds),disabled:!y,options:x.map(T=>({value:String(T),label:AO(T),...T===gh.commandTimeoutSeconds?{hint:"Default"}:{}})),onChange:T=>u({...c,commandTimeoutSeconds:Number(T)})})}),i.jsx(ae,{title:"GPU",hint:S,trailing:i.jsxs("label",{className:"check-row small",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:c.gpu,disabled:!y||!c.gpu&&(!v||b),onChange:T=>u({...c,gpu:T.target.checked})}),i.jsx("span",{children:"Lend to sandboxed commands"})]})}),i.jsx(ae,{title:"Git credentials",hint:a?"Pushes in your own sessions may use this machine's Git credential helpers, where a workspace's push access chooses the host's Git credentials":"Only the host's owner changes this",trailing:a?i.jsxs("label",{className:"check-row small",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:c.gitCredentials,disabled:!y,onChange:T=>u({...c,gitCredentials:T.target.checked})}),i.jsx("span",{children:"Use for my pushes"})]}):i.jsx(Te,{tone:l.gitCredentials?"warning":"neutral",children:l.gitCredentials?"On":"Off"})}),i.jsx(ae,{title:"Repository cache",hint:a?`${Ib[c.repositoryCache]}. Applies when the host next connects.`:"Only the host's owner changes this",trailing:a&&y?i.jsx(Aa,{label:"Repository cache",value:c.repositoryCache,onChange:T=>u({...c,repositoryCache:T}),options:["off","host","owner"].map(T=>({value:T,label:Hb[T],hint:Ib[T]}))}):i.jsx(Te,{tone:l.repositoryCache==="off"?"neutral":"success",children:Hb[l.repositoryCache]})}),i.jsx(ae,{title:"Sessions on the host",hint:b?"This host runs every session without the sandbox":a?"You, and members you grant it under Host command access, may start sessions that run directly on this machine, without the sandbox, as its user. Turning it off stops their commands within half a minute":"Only the host's owner changes this",trailing:b?i.jsx(Te,{tone:"danger",children:"Every session"}):a?i.jsxs("label",{className:"check-row small",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:c.hostSessions,disabled:!y,onChange:T=>u({...c,hostSessions:T.target.checked})}),i.jsx("span",{children:"Allow sessions on the host"})]}):i.jsx(Te,{tone:l.hostSessions?"danger":"neutral",children:l.hostSessions?"On":"Off"})}),!e.capabilities.hostConfig&&i.jsx(ae,{title:"Update the host's connector",hint:"This host's connector predates configuration in Pikibun and keeps its connect options until it is updated (npx pikibun@latest connect). What you save here applies then."}),(m||h.error||h.notice)&&i.jsx(Re,{children:i.jsxs("div",{className:"stack",children:[i.jsx(Ce,{...h}),m&&i.jsxs("div",{className:"inline",children:[i.jsx(V,{variant:"default",size:"sm",disabled:h.busy,onClick:w,children:"Save configuration"}),i.jsx(V,{variant:"ghost",size:"sm",disabled:h.busy,onClick:()=>u(l),children:"Discard"})]})]})})]})})}const EO=i.jsx(i.Fragment,{children:"Hosts are the Pis you pair. A paired host is yours, not a workspace's: it runs a dedicated app runtime you can use in every workspace you belong to, and stays private to you until you share it with one. Whoever operates a host sees the prompts and repository files processed on it, including private source, but never receives a GitHub token. Model credentials stay in Pi on the host. Status refreshes every 10 seconds."}),xw=e=>Qe(e?{name:"settings",section:"workspaces",id:e}:{name:"settings",section:"workspaces"});function vw(e,s,a){return`${e} ${e===1?s:a}`}function $b(e,s){return e<s?-1:e>s?1:0}function zO(e){const s=e.disabledModels?.length??0;return`${vw(e.models.length,"model","models")}${s?`, ${s} disabled`:""}`}function OO(e){const s=qe(e?`/api/workspaces/${ce(e.id)}/repositories`:null),a=!s.loading&&!s.error?s.data:null,l=!!(e&&a&&(a.repositories.length||a.sources||!a.required));return{...s,configured:l}}function RO({id:e}){const s=Gr("/api/connectors"),[a,l]=E.useState(!1);if(e)return i.jsx(LO,{id:e,resource:s});const c=s.data?.connectors??[],u=!s.loading&&!s.error&&!c.length,d=i.jsx(V,{variant:u?"default":"outline",size:u?"md":"sm",icon:"plus",onClick:()=>l(!0),children:"Pair a host"});return i.jsxs(i.Fragment,{children:[i.jsx(Oe,{title:"Hosts",info:EO,action:c.length?d:void 0,bare:u,children:i.jsx(dt,{...s,retry:s.refresh,children:u?i.jsx(jt,{title:"No hosts yet",action:d}):c.map(h=>i.jsx(ae,{leading:i.jsx(as,{tone:Nh(h)}),title:h.name,hint:`${h.role==="admin"?`${h.ownerName}'s host, you are an admin · `:""}${zO(h)} · ${h.workspaceIds.length?`Shared with ${vw(h.workspaceIds.length,"workspace","workspaces")}`:"Private"}`,trailing:i.jsx(Fr,{connector:h}),href:Qe({name:"settings",section:"hosts",id:h.id}),chevron:!0},h.id))})}),i.jsx(DO,{}),a&&i.jsx(ww,{onClose:()=>l(!1),refresh:s.refresh})]})}function DO(){const{user:e,workspaces:s}=yt(),[a,l]=E.useState({}),c=E.useCallback((h,g)=>l(m=>m[h]===g?m:{...m,[h]:g}),[]),u=s.every(h=>h.id in a),d=s.reduce((h,g)=>h+(a[g.id]??0),0);return i.jsxs(Oe,{title:"Shared with you",info:"Hosts other members shared into your workspaces. You can run your own sessions on them; their operator sees your prompts and repository files. Agents, session permissions and GitHub credentials are not shared.",children:[s.map(h=>i.jsx(MO,{workspace:h,userId:e.id,report:c},h.id)),u?!d&&i.jsx(ae,{title:"Nothing shared with you",hint:"Hosts members share into your workspaces appear here"}):i.jsx(Re,{children:i.jsx(Ht,{})})]})}function MO({workspace:e,userId:s,report:a}){const l=Gr(`/api/workspaces/${ce(e.id)}/connectors`),c=(l.data?.connectors??[]).filter(d=>d.ownerId!==s),u=l.error?1:c.length;return E.useEffect(()=>{l.loading||a(e.id,u)},[a,e.id,l.loading,u]),l.error?i.jsx(ae,{leading:i.jsx(as,{tone:"danger"}),title:`Unable to load hosts for ${e.name}`,hint:l.error,trailing:i.jsx(V,{variant:"outline",size:"sm",onClick:l.refresh,children:"Try again"})}):i.jsx(i.Fragment,{children:c.map(d=>i.jsxs(Ca,{leading:i.jsx(as,{tone:Nh(d)}),title:d.name,hint:`${d.ownerName} · ${e.name}`,trailing:i.jsx(Fr,{connector:d}),children:[i.jsx($o,{connector:d}),i.jsx("span",{className:"small muted",children:d.models.length?d.models.map(h=>h.name).join(", "):"No models offered"})]},d.id))})}function ww({onClose:e,refresh:s}){const{workspaces:a,currentWorkspace:l}=yt(),[c,u]=E.useState(""),[d,h]=E.useState(null),[g,m]=E.useState(!1),y=Ne(),b=E.useRef(!0);E.useEffect(()=>(b.current=!0,()=>{b.current=!1}),[]),E.useEffect(()=>{if(!d)return;const k=Math.max(0,new Date(d.expiresAt).getTime()-Date.now()),z=window.setTimeout(()=>{h(null),m(!0)},k);return()=>window.clearTimeout(z)},[d]);function v(k){k?.preventDefault(),!(y.busy||!c.trim())&&(h(null),m(!1),y.run(async()=>{const z=await he("/api/connectors/pairings",{method:"POST",body:{name:c.trim()}});b.current&&h(z.pairing)}))}function x(){h(null),s(),e()}const w=l??a[0]??null,S=y.busy?"Creating code...":d?"Create another code":"Create pairing code",T=d?i.jsxs(i.Fragment,{children:[i.jsx(V,{variant:"outline",disabled:y.busy||!c.trim(),onClick:()=>v(),children:S}),i.jsx(V,{variant:"default",onClick:x,children:"Done"})]}):i.jsx(V,{variant:"default",disabled:y.busy||!c.trim(),onClick:()=>v(),children:S});return i.jsx(an,{open:!0,wide:!0,title:"Pair a host",onClose:e,footer:T,children:i.jsxs("div",{className:"stack",children:[i.jsx("form",{onSubmit:v,children:i.jsx(be,{label:"Host name",hint:"The host is yours: you can use it in every workspace you belong to, and it stays private to you until you share it with one",children:i.jsx("input",{className:"input",required:!0,maxLength:120,autoComplete:"off",value:c,onChange:k=>u(k.target.value),placeholder:"My Linux workstation"})})}),i.jsx(Ce,{...y}),g&&i.jsx(ke,{variant:"warning",role:"status",title:"Pairing code expired",children:"The code was cleared. Create a new code to try again."}),d&&i.jsxs("section",{className:"stack","aria-label":"One-time pairing instructions",children:[i.jsxs("span",{role:"status",children:["Code ready. Expires ",i.jsx(Kt,{value:d.expiresAt})]}),i.jsx(be,{label:"Run this on your host",children:i.jsx(Vn,{value:`npx pikibun@latest connect --server ${window.location.origin} --pairing-id ${d.id}`,label:"Copy command"})}),i.jsx(be,{label:"Paste at the hidden prompt, not on the command line",children:i.jsx(Vn,{value:d.code,label:"Copy code"})}),i.jsxs("span",{className:"small muted",children:["Single-use secret: don't share it. It is held only in this page's memory. Hiding it doesn't revoke it; an unused code stays valid until it expires.",w&&i.jsxs(i.Fragment,{children:[" Once the host is online, ",i.jsx("a",{href:Qe({name:"new",workspaceId:w.id}),children:"start a session"})," with one of its models."]})]})]}),i.jsxs(Ca,{plain:!0,title:"Host requirements",children:[i.jsx("span",{className:"small",children:"Linux or WSL2 (native Windows is unsupported) with Node.js 24, Pi configured there with its providers and models, and bubblewrap, Python 3, Git and flock installed."}),i.jsx("span",{className:"small",children:"No app checkout is needed; run from any folder. Session source downloads into private caches. Never paste a token into this page or a command."}),i.jsxs("span",{className:"small",children:["macOS has no sandbox: add ",i.jsx("code",{children:"--unsafe-no-sandbox"})," to run agent work directly on your Mac as your user, with only Git required. The connector asks you to confirm, and Pikibun labels the host Unsandboxed: approved commands run with access to your files, credentials and network, and no resource limits."]})]})]})})}function LO({id:e,resource:s}){const a=s.data?.connectors.find(l=>l.id===e);return i.jsxs(i.Fragment,{children:[i.jsxs("a",{className:"btn ghost sm settings-back",href:Qe({name:"settings",section:"hosts"}),children:[i.jsx(ve,{name:"chevron-left"}),"Hosts"]}),i.jsx(dt,{...s,retry:s.refresh,children:a?i.jsx(_O,{connector:a,refresh:s.refresh},a.id):i.jsx(jt,{title:"Host not found"})})]})}function _O({connector:e,refresh:s}){const{workspaces:a}=yt(),l=Ne(),c=Ne(),[u,d]=E.useState(!1),[h,g]=E.useState(!1),m=new Map(a.map(T=>[T.id,T.name])),y=e.role!=="admin",b=[...new Set([...e.connectedWorkspaceIds??[],...e.workspaceIds])],v=a.filter(T=>!e.workspaceIds.includes(T.id));function x(T){(async()=>await Ge({title:"Stop sharing this host?",message:"Other members' sessions can no longer run work on it in this workspace. It stays connected for your own use; existing session records and visibility are unchanged.",confirmLabel:"Unshare"})&&await l.run(async()=>{await he(`/api/connectors/${ce(e.id)}/shares/${ce(T)}`,{method:"DELETE"}),s()},"Host sharing stopped. Your private connection remains available."))()}function w(){(async()=>await Ge({title:`Permanently remove ${e.name}?`,message:"This permanently removes the host from your list, invalidates its credentials and stops sharing it in all workspaces. Existing sessions and their historical host references remain, but cannot run on this host. Local files are not deleted. To use this machine again, pair it as a new host.",confirmLabel:"Remove permanently",destructive:!0})&&await c.run(async()=>{await he(`/api/connectors/${ce(e.id)}/permanent`,{method:"DELETE"}),rs({name:"settings",section:"hosts"}),s()}))()}function S(){(async()=>await Ge({title:`Revoke ${e.name}?`,message:"This disconnects its runtime and blocks work in every connected workspace, including your own sessions. Pair again to reconnect; existing session records are not deleted.",confirmLabel:"Revoke host",destructive:!0})&&await c.run(async()=>{await he(`/api/connectors/${ce(e.id)}`,{method:"DELETE"}),s()},"Host revoked."))()}return i.jsxs(i.Fragment,{children:[i.jsxs(Oe,{title:"Status",bare:!0,children:[i.jsxs("div",{className:"card",children:[i.jsx(ae,{title:"Status",trailing:i.jsx(Fr,{connector:e})}),y&&!e.online&&i.jsx(ae,{title:e.revokedAt?"Pair again":"Reconnect host",hint:e.revokedAt?"Revoked credentials cannot be reused; create a new pairing":"Restart the saved connection on your host machine",trailing:i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy,onClick:()=>e.revokedAt?g(!0):d(!0),children:e.revokedAt?"Pair again":"Reconnect"})}),i.jsx(ae,{title:"Owner",trailing:e.ownerName}),i.jsx(ae,{title:"Paired",trailing:i.jsx(Kt,{value:e.createdAt})}),e.revokedAt&&i.jsx(ae,{title:"Revoked",trailing:i.jsx(Kt,{value:e.revokedAt})})]}),i.jsx($o,{connector:e})]}),i.jsx(UO,{connector:e,refresh:s}),i.jsxs(Oe,{title:"Sharing",bare:!0,info:"Sharing with a workspace is optional and lets its members run their own sessions on this host; you will see their prompts and repository snapshots. Agents, session permissions and GitHub credentials are not shared, and personal Pi history is never imported.",children:[i.jsxs("div",{className:"card",children:[!b.length&&i.jsx(ae,{title:"Not in any workspace yet",hint:"Create or join a workspace to use this host there"}),b.map(T=>{const k=e.workspaceIds.includes(T);return i.jsx(ae,{title:m.get(T)??T,hint:k?"Shared with members":y?"Private: your use only":"Private: the owner's use only",trailing:k&&!e.revokedAt&&i.jsx(V,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>x(T),children:"Unshare"})},T)}),!e.revokedAt&&(v.length?i.jsx(BO,{connector:e,available:v,busy:l.busy,run:l.run,refresh:s}):!a.length&&i.jsx(ae,{title:"Share with workspace",hint:"Create or join a workspace and configure its repositories before sharing",href:xw(),chevron:!0}))]}),i.jsx(Ce,{error:l.error,notice:l.notice})]}),i.jsx(NO,{connector:e,refresh:s}),e.config&&i.jsx(SO,{connector:e,refresh:s}),e.capabilities.hostCommands&&i.jsx(xO,{connector:e,refresh:s}),i.jsx(yO,{connector:e,refresh:s}),i.jsx(Oe,{title:"Details",children:i.jsx(Re,{children:i.jsx(be,{label:"Connection ID",children:i.jsx(Vn,{value:e.id,label:"Copy connection ID"})})})}),y&&i.jsxs(Oe,{title:"Danger zone",bare:!0,children:[i.jsxs("div",{className:"card",children:[i.jsx(ae,{title:"Revoke host",hint:e.revokedAt?i.jsxs(i.Fragment,{children:["Revoked ",i.jsx(Kt,{value:e.revokedAt})]}):"Disconnects its runtime and blocks work in every connected workspace",trailing:!e.revokedAt&&i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy,onClick:S,children:c.busy?"Revoking...":"Revoke"})}),i.jsx(ae,{title:"Permanently remove host",hint:"Remove from Pikibun and invalidate access. Session history and local files are retained.",trailing:i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy,onClick:w,children:"Remove permanently"})})]}),i.jsx(Ce,{error:c.error,notice:c.notice})]}),h&&i.jsx(ww,{onClose:()=>g(!1),refresh:s}),u&&i.jsx(an,{open:!0,title:`Reconnect ${e.name}`,onClose:()=>d(!1),footer:i.jsx(V,{onClick:()=>{s(),d(!1)},children:"Done"}),children:i.jsxs("div",{className:"stack",children:[i.jsx(ke,{variant:e.online?"success":"warning",title:e.online?"Host is connected":"Start the connection on your host",children:"Pikibun cannot remotely start an offline host. If you use the desktop app, open it on the host and start its connection. For a CLI host, run the command below on the original machine with its saved pairing."}),i.jsx(be,{label:"Run on your host",children:i.jsx(Vn,{value:`npx pikibun@latest connect${e.capabilities.unsandboxed?" --unsafe-no-sandbox":""}`,label:"Copy reconnect command"})}),i.jsx("span",{className:"small muted",children:"Use the same OS user and any original options of the machine's own setup: --state-dir, --resources, --pi-agent-dir and --model. Everything else is this host's Configuration, here. Do not add --pairing-id or --force: the saved credentials preserve this host and its sessions. Stop any existing connector before starting another. Status refreshes every 10 seconds."}),i.jsx("span",{className:"small muted",children:"If the saved pairing is missing, pair a new host instead. A new pairing does not reconnect this host's existing sessions."}),i.jsx(V,{variant:"outline",onClick:s,children:"Refresh status"})]})})]})}function UO({connector:e,refresh:s}){const a=Ne(),l=new Set((e.disabledModels??[]).map(Rs)),c=[...e.models,...e.disabledModels??[]].sort((h,g)=>$b(h.provider,g.provider)||$b(h.modelId,g.modelId)),u=!!e.role&&!e.revokedAt;function d(h,g){a.busy||!u||a.run(async()=>{await he(`/api/connectors/${ce(e.id)}/models`,{method:"PATCH",body:{provider:h.provider,modelId:h.modelId,enabled:g}}),s()},g?`${h.name} enabled.`:`${h.name} disabled. No new session or message can use it.`)}return i.jsxs(Oe,{title:"Models",bare:!0,info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"The models Pi on this host offers. Configure providers and models in Pi on the host; credentials never leave it."}),i.jsx("p",{children:"The owner and admins can disable a model: no session starts from it and no message switches to it, for everyone who uses this host, the owner included, in every workspace. Sessions already on it keep their history and continue on another model."})]}),children:[i.jsx("div",{className:"card",children:c.length?c.map(h=>i.jsx(ae,{title:h.name,hint:`${h.provider} / ${h.modelId}`,trailing:i.jsxs("label",{className:"inline small",title:"Sessions can start from this model and messages can switch to it",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:!l.has(Rs(h)),disabled:!u||a.busy,onChange:g=>d(h,g.target.checked)}),"Enabled"]})},Rs(h))):i.jsx(ae,{title:"No models advertised",hint:"Configure models in Pi on the host"})}),i.jsx(Ce,{error:a.error,notice:a.notice})]})}function BO({connector:e,available:s,busy:a,run:l,refresh:c}){const[u,d]=E.useState(""),h=s.find(b=>b.id===u)??s[0],g=OO(h);async function m(){!g.configured||a||e.capabilities.unsandboxed&&!await Ge({title:"Share an unsandboxed host?",message:`Share an unsandboxed Pi with ${h.name}? Members' approved commands will run directly on your machine as your user, with access to your files, credentials and network, and no resource limits.`,confirmLabel:"Share host",destructive:!0})||await l(async()=>{await he(`/api/connectors/${ce(e.id)}/shares/${ce(h.id)}`,{method:"PUT",body:{}}),c()},"Host shared with workspace. Session visibility and permissions are unchanged; personal Pi history is not imported.")}const y=g.loading?i.jsx(Ht,{children:"Checking repositories..."}):g.error?i.jsx("span",{className:"field-error",children:g.error}):g.configured?`Members of ${h.name} can run their own sessions on this host`:i.jsxs(i.Fragment,{children:["No repositories configured for ",h.name,". Ask an owner or admin to ",i.jsx("a",{href:xw(h.id),children:"bind one"})," before sharing"]});return i.jsx(ae,{title:"Share with workspace",hint:y,trailing:i.jsxs(i.Fragment,{children:[i.jsx(Zt,{label:"Workspace to share with",value:h.id,options:s.map(b=>({value:b.id,label:b.name})),onChange:d,disabled:a}),(g.error||!g.configured)&&!g.loading&&i.jsx(V,{variant:"ghost",size:"sm",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh repositories",disabled:a,onClick:g.refresh}),i.jsx(V,{variant:"outline",size:"sm",disabled:a||!g.configured,onClick:()=>{m()},children:a?"Saving...":"Share"})]})})}const Hr=["notion","google-drive","feishu","dropbox","onedrive","tencent-docs"],mn={notion:"Notion","google-drive":"Google Drive",feishu:"Feishu / Lark",dropbox:"Dropbox",onedrive:"OneDrive / SharePoint","tencent-docs":"Tencent Docs"},qb=["notion","google-drive","feishu"],Gb={documents:20},HO=Tx.filter(e=>e!=="github"),Fb={"github-enterprise":"Fine-grained: Contents and Metadata read (or classic repo); opening pull requests needs Pull requests write, and pushing with your account Contents write (or classic repo)",gitlab:"read_api and read_repository; opening merge requests needs api, and pushing with your account write_repository (or api)",bitbucket:"API token with read:repository:bitbucket and read:user:bitbucket, connected with your Atlassian account email above; agent pushes need this API token (workspace or repository access tokens can browse but cannot pass the push owner check); opening pull requests needs write:pullrequest:bitbucket, and pushing with your account write:repository:bitbucket","azure-devops":"Code (Read); opening pull requests or pushing with your account needs Code (Read & write)",gitea:"read:repository and read:user; opening pull requests or pushing with your account needs write:repository",git:"read access to the repositories; pushing with your account needs write access"},IO="Repositories you bind or pin are read with your Git accounts, and the pull requests your agents ask for are opened with them. Their tokens are encrypted on the server and never sent to other people's hosts. Where a workspace's push access uses the session owner's account, your own host receives yours in memory for each push in your sessions; Pikibun resets your GitHub token when the push ends, so that copy stops working.";function $O(e){if(e==="git")return"Any server over HTTPS, without pull requests";const s=si[e];return s.fixed??(s.default?`${s.default} or self-managed`:"Self-hosted")}function qO(){const{user:e}=yt(),{accounts:s,loading:a,error:l,refresh:c}=Ex(),u=Ne(),[d,h]=E.useState(null);async function g(m){u.busy||!await Ge({title:"Remove Git account",message:`Remove ${Qd(m)} (${m.login})? Its token is deleted from the server. New sessions you own can no longer read repositories through it; existing session snapshots are kept.`,confirmLabel:"Remove",destructive:!0})||u.run(async()=>{await he(`/api/git/accounts/${ce(m.id)}`,{method:"DELETE"}),c()},"Git account removed.")}return i.jsxs("div",{className:"stack",id:"git-accounts",children:[i.jsx("div",{className:"section-header",children:i.jsx("h3",{className:"section-title",children:"Git"})}),i.jsxs("div",{className:"card",children:[e.passwordSignIn?i.jsx(ae,{leading:i.jsx(Ao,{}),title:Hn.github,hint:`${si.github.default} · Repositories on github.com need an account that signs in with GitHub; this account signs in with a password`,trailing:i.jsx(Te,{tone:"warning",children:"Not available"})}):i.jsx(ae,{leading:i.jsx(Ao,{}),title:Hn.github,hint:e.githubConnected?`${si.github.default} · ${e.githubLogin?`@${e.githubLogin} · `:""}signed in`:`${si.github.default} · Not connected`,trailing:e.githubConnected?i.jsx(Te,{tone:"success",children:"Connected"}):i.jsx(Bt,{variant:"outline",size:"sm",href:"/api/auth/github",children:"Sign in"})}),i.jsx(dt,{loading:a&&!s,error:l,retry:c,children:HO.map(m=>{const y=s?.filter(v=>v.provider===m)??[],b=Hn[m];return i.jsxs(E.Fragment,{children:[i.jsx(ae,{leading:i.jsx(ve,{name:"git-branch",size:16}),title:b,hint:`${$O(m)} · ${y.length?`${y.length} connected`:"Not connected"}`,trailing:i.jsxs(i.Fragment,{children:[y.length>0&&i.jsx(Te,{tone:"success",children:"Connected"}),i.jsx(V,{variant:y.length?"ghost":"outline",size:"sm",disabled:u.busy,"aria-label":`Connect ${b}`,onClick:()=>h(m),children:y.length?"Add another":"Connect"})]})}),y.map(v=>i.jsx(ae,{leading:i.jsx("span",{className:"git-account-indent","aria-hidden":!0}),title:`${v.host}${v.organization?`/${v.organization}`:""}`,hint:v.login,trailing:i.jsx(V,{variant:"ghost",size:"sm",disabled:u.busy,"aria-label":`Remove ${Qd(v)}`,onClick:()=>{g(v)},children:"Remove"})},v.id))]},m)})}),(u.error||u.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...u})})]}),i.jsx(jw,{provider:d,close:()=>h(null),added:c})]})}function jw({provider:e,close:s,added:a,save:l,initial:c}){const[u,d]=E.useState(""),[h,g]=E.useState(""),[m,y]=E.useState(""),[b,v]=E.useState(""),x=Ne(),w=e?si[e].fixed:null;E.useEffect(()=>{d(c?.host??(e?si[e].default??"":"")),g(c?.organization??""),y(c?.username??""),v("")},[e,c]);function S(){x.busy||(v(""),s())}function T(A){if(A.preventDefault(),!e||x.busy)return;const I={provider:e,token:b,...w?{}:{host:u.trim()},...e==="azure-devops"?{organization:h.trim()}:{},...(e==="bitbucket"||e==="git")&&m.trim()?{username:m.trim()}:{}};x.run(async()=>{try{l?await l(I):await he("/api/git/accounts",{method:"POST",body:I})}finally{v("")}a(),s()})}const k=!!(e&&b&&(w||u.trim())&&(e!=="azure-devops"||h.trim())&&(e!=="git"||m.trim())),z=!!l;return i.jsx(an,{open:e!==null,title:`Connect ${e?Hn[e]:"Git"}${z?" for the workspace":""}`,onClose:S,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:x.busy,onClick:S,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"git-account-form",disabled:!k||x.busy,children:x.busy?"Verifying...":"Connect"})]}),children:i.jsxs("form",{id:"git-account-form",className:"stack",onSubmit:T,children:[e&&i.jsxs(i.Fragment,{children:[z&&i.jsx("p",{className:"muted small",children:"Use a service account made for this, such as a bot or a deploy user, never your own: every member's sessions read with it. It only reads; pushes keep using each session owner's account or the workspace's push access."}),e==="git"&&i.jsx("p",{className:"muted small",children:"Any Git server that serves smart HTTP over HTTPS (git http-backend, cgit, Gerrit, a forge without its API). There is no repository list and agents can't open pull requests; you add each repository by its clone URL. SSH isn't supported."}),!w&&i.jsx(be,{label:"Host",hint:e==="git"?"The host name in the server's https:// clone URLs, with its port if it has one, for example git.example.com":"HTTPS host name of the instance, without https://, for example git.example.com",children:i.jsx("input",{className:"input",required:!0,value:u,onChange:A=>d(A.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,maxLength:253,placeholder:"git.example.com"})}),e==="azure-devops"&&i.jsx(be,{label:"Organization",hint:"From dev.azure.com/<organization>",children:i.jsx("input",{className:"input",required:!0,value:h,onChange:A=>g(A.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,maxLength:100})}),e==="bitbucket"&&i.jsx(be,{label:"Username or email",hint:"Your Atlassian account email when using an API token (required for agent pushes); leave blank for a workspace or repository access token, which can browse but not push",children:i.jsx("input",{className:"input",value:m,onChange:A=>y(A.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,maxLength:254})}),e==="git"&&i.jsx(be,{label:"User name",hint:z?"The service account's user name over HTTPS":"The user name you clone with over HTTPS",children:i.jsx("input",{className:"input",required:!0,value:m,onChange:A=>y(A.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,maxLength:254})}),i.jsx(be,{label:e==="git"?"Password or token":"Token",hint:z?`Read access to the repositories it will read is enough. ${e==="git"?"Encrypted on the server and checked when a repository reads with it":`Verified with ${Hn[e]}, then encrypted on the server`}`:e==="git"?`Needs ${Fb.git}. Encrypted on the server and checked when you add a repository: a Git server has no account to verify it against`:`Scopes: ${Fb[e]}. Verified with ${Hn[e]}, then encrypted on the server`,children:i.jsx("input",{className:"input",required:!0,type:"password",value:b,onChange:A=>v(A.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1})})]}),i.jsx(Ce,{error:x.error})]})})}const GO=["github-enterprise","gitlab","bitbucket","azure-devops","gitea","git"],kw=["notion","google-drive","feishu"],Yb=20;function FO(e){const s=qe(e?`/api/workspaces/${ce(e)}/connections`:null);return{connections:s.data?.connections??null,loading:s.loading,error:s.error,refresh:s.refresh}}function Dr(e){if(e.family==="document")return mn[e.provider];const s=Go(e.provider,e.host);return e.organization?`${s} · ${e.organization}`:s}function YO(e,s){const a=s.provider==="azure-devops"?s.fullName.split("/")[0].toLowerCase():"";return e?.find(l=>l.family==="git"&&l.provider===s.provider&&l.host===s.host&&l.organization===a)??null}function Pb(e,s){return e?.find(a=>a.family==="document"&&a.provider===s)??null}function Sw({workspaceId:e,sourceId:s,title:a,readAs:l,connection:c,admin:u,action:d,changed:h}){if(!u)return l==="workspace"?i.jsx(Te,{children:"Workspace connection"}):null;function g(m){m===l||d.busy||d.run(async()=>{await he(`/api/workspaces/${ce(e)}/sources/${ce(s)}/read-as`,{method:"PUT",body:{readAs:m}}),h()},m==="workspace"?`${a} now reads with the workspace connection.`:`${a} now reads with each session owner's own account.`)}return i.jsxs("label",{className:"inline small",title:"Which account sessions read this source with",children:["Reads with",i.jsxs("select",{className:"select compact",value:l,disabled:d.busy,"aria-label":`Account ${a} reads with`,onChange:m=>g(m.target.value),children:[i.jsx("option",{value:"members",children:"Members' accounts"}),i.jsx("option",{value:"workspace",disabled:!c&&l!=="workspace",children:c?`Workspace: ${c.name}`:"Workspace (not connected)"})]})]})}function PO({workspaceId:e,admin:s,connections:a,loading:l,error:c,refresh:u,changed:d}){const h=Ne(),[g,m]=E.useState(null),[y,b]=E.useState(null),v=E.useMemo(()=>y?{host:y.host,organization:y.organization,...y.provider==="git"?{username:y.name}:{}}:null,[y]),[x,w]=E.useState(null),S=`/api/workspaces/${ce(e)}/connections`,T=(a?.length??0)>=Yb;async function k(A){h.busy||!await Ge({title:"Remove connection",message:`Remove the workspace's ${Dr(A)} connection (${A.name})? Its secret is deleted from the server.`,confirmLabel:"Remove",destructive:!0})||h.run(async()=>{await he(`${S}/${ce(A.id)}`,{method:"DELETE"}),u(),d()},"Connection removed.")}const z=()=>{u(),d()};return i.jsxs(Oe,{title:"Connections",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Service accounts this workspace reads its sources with, instead of each member's own: a GitLab or Gitea bot, a Git server's deploy user, a Notion integration, a Google service account or a Feishu/Lark app. Connect accounts made for that, never your personal one: every member's sessions read with it."}),i.jsx("p",{children:"A source uses a connection only where an owner or admin sets it to, under Sources; Pikibun reads the source with the connection first. Otherwise sessions read with their owner's own account, as before, and never fall back from one to the other."}),i.jsx("p",{children:"Connections only read. Pushes and pull requests use the session owner's account or the workspace's push access. Secrets are encrypted on the server and never sent to any host; members see only which account it is. github.com repositories, Dropbox, OneDrive and Tencent Docs read with each member's own sign-in."})]}),action:s&&!T&&i.jsx(Kn,{label:"Add connection",triggerVariant:"outline",trigger:i.jsxs(i.Fragment,{children:[i.jsx(ve,{name:"plus",size:16}),"Add connection"]}),items:[...GO.map(A=>({label:Hn[A],onSelect:()=>m(A)})),"separator",...kw.map(A=>({label:mn[A],onSelect:()=>w(A)}))]}),children:[i.jsxs(dt,{loading:l&&!a,error:c,retry:u,children:[a?.length?a.map(A=>i.jsx(ae,{leading:i.jsx(ve,{name:A.family==="git"?"git-branch":"file",size:16}),title:Dr(A),hint:`${A.name} · ${A.sources?`${A.sources} source${A.sources===1?"":"s"} read with it`:"No source reads with it yet"}`,trailing:s&&i.jsxs(i.Fragment,{children:[i.jsx(V,{variant:"ghost",size:"sm",disabled:h.busy,"aria-label":`Replace ${Dr(A)}`,title:"Connect it again with a new secret, keeping the sources that read with it",onClick:()=>A.family==="git"?(b(A),m(A.provider)):w(A.provider),children:"Replace"}),i.jsx(V,{variant:"ghost",size:"sm",disabled:h.busy||A.sources>0,title:A.sources>0?"Switch its sources to members' own accounts first":void 0,"aria-label":`Remove ${Dr(A)}`,onClick:()=>{k(A)},children:"Remove"})]})},A.id)):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:"No connections. Sessions read every source with their owner's own account"})}),(h.error||h.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...h})})]}),s&&T&&i.jsx(Re,{children:i.jsxs("span",{className:"muted small",children:["This workspace has ",Yb," connections, the most it can have. Replace one, or remove one to add another."]})}),s&&i.jsx(jw,{provider:g,close:()=>{m(null),b(null)},added:z,initial:v,save:async A=>{await he(S,{method:"POST",body:{family:"git",...A}})}}),s&&i.jsx(Cw,{provider:x,close:()=>w(null),connected:z,save:async(A,I)=>{await he(S,{method:"POST",body:{family:"document",provider:A,...I}})}})]})}function VO(e=!0){const s=qe(e?"/api/source-accounts":null);return{accounts:s.data?.accounts??null,loading:s.loading,error:s.error,refresh:s.refresh}}function ZO(e){const s=qe(e?`/api/workspaces/${ce(e)}/sources`:null);return{sources:s.data?.sources??null,loading:s.loading,error:s.error,refresh:s.refresh}}const QO={notion:i.jsx(i.Fragment,{children:"Create an internal integration at notion.so/profile/integrations with Read content, and share the pages it may read with it (a page's ••• menu → Connections)."}),"google-drive":i.jsx(i.Fragment,{children:"Create a service account in Google Cloud with the Drive API enabled, download its JSON key, and share the folders and files it may read with the service account's email, as Viewer."}),feishu:i.jsx(i.Fragment,{children:"Create a custom app in the Feishu or Lark developer console with read access to Drive, Docs and Wiki, publish it, and add it to the folders, documents or wiki spaces it may read."}),dropbox:i.jsx(i.Fragment,{children:"Sign in to Dropbox. Sessions read the folders and files under the workspace's Dropbox sources that your account can see."}),onedrive:i.jsx(i.Fragment,{children:"Sign in with your Microsoft account. Sessions read the OneDrive and SharePoint folders and files under the workspace's sources that you can open."}),"tencent-docs":i.jsx(i.Fragment,{children:"Sign in to Tencent Docs. Sessions read the folders and documents under the workspace's Tencent Docs sources that you can open."})},XO={page:"Page",database:"Database",folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",presentation:"Presentation",file:"File",wiki:"Wiki page"};function KO(){const e=qe("/api/source-accounts"),{accounts:s,loading:a,error:l,refresh:c}={accounts:e.data?.accounts??null,loading:e.loading,error:e.error,refresh:e.refresh},u=e.data?.oauth??[],d=Ne(),[h,g]=E.useState(null),[m,y]=E.useState(null);E.useEffect(()=>{const x=new URLSearchParams(window.location.search),w=x.get("source_account");!w||!Hr.includes(w)||(y({kind:w,ok:x.get("result")==="connected",reason:x.get("reason")??""}),window.history.replaceState(null,"",`${window.location.pathname}${window.location.hash}`))},[]);const b=Hr.filter(x=>qb.includes(x)||u.includes(x)||s?.some(w=>w.provider===x));async function v(x,w){d.busy||!await Ge({title:`Disconnect ${mn[x]}`,message:`Disconnect ${mn[x]} (${w})? Its secret is deleted from the server, and sessions you own can no longer read the workspaces' ${mn[x]} sources.`,confirmLabel:"Disconnect",destructive:!0})||d.run(async()=>{await he(`/api/source-accounts/${x}`,{method:"DELETE"}),c()},`${mn[x]} disconnected.`)}return i.jsxs(Oe,{bare:!0,title:"Connected accounts",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Sessions you own work on the workspaces' sources with your own accounts here, through Pikibun."}),i.jsx("p",{children:IO}),i.jsx("p",{children:"Documents are read with your own connections: sign in to a provider, or for Notion, Google Drive and Feishu/Lark paste a secret. Their tokens and secrets are encrypted on the server, refreshed there, and never sent to any host, yours included. Each provider lets its connection read only what you share with it, and sessions read only what lies under the workspace's sources."}),i.jsx("p",{children:"Connecting an account doesn't change how you sign in; viewing a session, sharing a host or publishing an agent never grants access to your accounts."})]}),children:[i.jsx(qO,{}),i.jsxs("div",{className:"stack",id:"document-accounts",children:[i.jsx("div",{className:"section-header",children:i.jsx("h3",{className:"section-title",children:"Documents"})}),i.jsxs("div",{className:"card",children:[i.jsx(dt,{loading:a&&!s,error:l,retry:c,children:b.map(x=>{const w=s?.find(z=>z.provider===x),S=u.includes(x),T=qb.includes(x),k=i.jsxs(i.Fragment,{children:[S&&i.jsx(Bt,{variant:w?"ghost":"outline",size:"sm",href:`/api/source-accounts/${x}/oauth/start`,children:w?"Sign in again":"Sign in"}),T&&i.jsx(V,{variant:w||S?"ghost":"outline",size:"sm",disabled:d.busy,onClick:()=>g(x),children:S?"Paste secret":w?"Replace":"Connect"})]});return i.jsx(ae,{leading:i.jsx(ve,{name:"file",size:16}),title:mn[x],hint:w?`${w.name}${w.method==="oauth"?" · signed in":""}`:"Not connected",trailing:w?i.jsxs(i.Fragment,{children:[i.jsx(Te,{tone:"success",children:"Connected"}),k,i.jsx(V,{variant:"ghost",size:"sm",disabled:d.busy,"aria-label":`Disconnect ${mn[x]}`,onClick:()=>{v(x,w.name)},children:"Disconnect"})]}):k},x)})}),m&&i.jsx(Re,{children:i.jsx(Ce,{...m.ok?{notice:`${mn[m.kind]} connected.`,error:""}:{notice:"",error:`${mn[m.kind]} wasn't connected${m.reason==="access_denied"?": the sign-in was cancelled":m.reason?` (${m.reason})`:""}. Try again.`}})}),(d.error||d.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...d})})]})]}),i.jsx(Cw,{provider:h,close:()=>g(null),connected:c})]})}function Cw({provider:e,close:s,connected:a,save:l}){const[c,u]=E.useState(""),[d,h]=E.useState(""),[g,m]=E.useState("feishu"),y=Ne();function b(){u(""),h(""),m("feishu")}function v(){y.busy||(b(),s())}const x=!!(c.trim()&&(e!=="feishu"||d.trim()));function w(T){if(T.preventDefault(),!e||!x||y.busy)return;const k=e==="notion"?{token:c.trim()}:e==="google-drive"?{key:c}:{appId:d.trim(),appSecret:c.trim(),domain:g};y.run(async()=>{try{l?await l(e,k):await he(`/api/source-accounts/${e}`,{method:"PUT",body:k})}finally{u("")}b(),a(),s()})}const S=e?mn[e]:"";return i.jsx(an,{open:e!==null,title:`Connect ${S}${l?" for the workspace":""}`,onClose:v,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:y.busy,onClick:v,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"source-account-form",disabled:!x||y.busy,children:y.busy?"Verifying...":"Connect"})]}),children:i.jsxs("form",{id:"source-account-form",className:"stack",onSubmit:w,children:[e&&i.jsxs("p",{className:"muted small",children:[QO[e]," Pikibun verifies it with ",S,", then encrypts it on the server."]}),e&&l&&i.jsx("p",{className:"muted small",children:"This is the workspace's connection: every member's sessions read the sources set to it with it. Share with it only what the workspace should read."}),e==="notion"&&i.jsx(be,{label:"Internal integration secret",children:i.jsx("input",{className:"input",required:!0,type:"password",value:c,onChange:T=>u(T.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1,placeholder:"ntn_…"})}),e==="google-drive"&&i.jsx(be,{label:"Service account JSON key",hint:"The whole key file. Only its email and private key are kept",children:i.jsx("textarea",{className:"input",required:!0,rows:6,value:c,onChange:T=>u(T.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1,placeholder:'{"type": "service_account", …}'})}),e==="feishu"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field",children:[i.jsx("span",{className:"field-label",children:"Platform"}),i.jsx(Zt,{label:"Platform",value:g,disabled:y.busy,options:[{value:"feishu",label:"Feishu",hint:"open.feishu.cn"},{value:"lark",label:"Lark",hint:"open.larksuite.com"}],onChange:m})]}),i.jsx(be,{label:"App ID",children:i.jsx("input",{className:"input",required:!0,value:d,onChange:T=>h(T.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1,placeholder:"cli_…"})}),i.jsx(be,{label:"App Secret",children:i.jsx("input",{className:"input",required:!0,type:"password",value:c,onChange:T=>u(T.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1})})]}),i.jsx(Ce,{error:y.error})]})})}function JO({workspaceId:e,workspaceName:s,admin:a,sources:l,loading:c,error:u,refresh:d,changed:h,connections:g}){const m=Ne(),y=VO(a),[b,v]=E.useState(!1),x=Hr.filter(z=>y.accounts?.some(A=>A.provider===z)),w=Hr.filter(z=>Pb(g,z)),S=Hr.filter(z=>x.includes(z)||w.includes(z)),T=(l?.length??0)>=Gb.documents;async function k(z){m.busy||!a||!await Ge({title:"Remove source",message:`Remove ${z.title} (${mn[z.kind]}) from ${s}? Sessions, running ones too, can no longer read it or what is under it.`,confirmLabel:"Remove",destructive:!0})||m.run(async()=>{await he(`/api/workspaces/${ce(e)}/sources/${ce(z.id)}`,{method:"DELETE"}),d(),h()},"Source removed.")}return i.jsxs("div",{className:"stack",children:[i.jsxs("div",{className:"section-header",children:[i.jsx("h3",{className:"section-title",children:"Documents"}),i.jsx("span",{className:"spacer"}),a&&S.length>0&&!T&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",disabled:c||!!u||m.busy,onClick:()=>v(!0),children:"Add document source"})]}),i.jsx("div",{className:"card",children:i.jsxs(dt,{loading:c,error:u,retry:d,children:[l?.length?l.map(z=>i.jsx(ae,{leading:i.jsx(ve,{name:"file",size:16}),title:z.title,hint:i.jsxs(i.Fragment,{children:[mn[z.kind]," · ",XO[z.itemType]," · ",i.jsx("a",{href:z.url,target:"_blank",rel:"noreferrer",children:"Open"})]}),trailing:i.jsxs(i.Fragment,{children:[kw.includes(z.kind)&&i.jsx(Sw,{workspaceId:e,sourceId:z.id,title:z.title,readAs:z.readAs,connection:Pb(g,z.kind),admin:a,action:m,changed:h}),a&&i.jsx(V,{variant:"outline",size:"sm",disabled:m.busy,"aria-label":`Remove ${z.title}`,onClick:()=>{k(z)},children:"Remove"})]})},z.id)):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:"No documents yet. Sessions read a bound Notion page or a folder or document in Google Drive, Dropbox, OneDrive, Feishu/Lark or Tencent Docs, and what is under it, with their owner's own connection"})}),(m.error||m.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...m})})]})}),a&&y.accounts&&!S.length&&i.jsx(ke,{variant:"info",title:"Connect an account to add documents",actions:i.jsx(Bt,{variant:"outline",size:"sm",href:Qe({name:"settings",section:"profile"}),children:"Open profile"}),children:"Pikibun checks each item you add with your own connection to its provider, in Settings → Profile → Connected accounts, or with the workspace's connection under Connections."}),a&&T&&i.jsxs(ke,{variant:"info",title:"Document source limit reached",children:["A workspace has at most ",Gb.documents," document sources. Remove one to add another."]}),a&&S.length>0&&i.jsx(e4,{open:b,kinds:S,own:x,workspaceKinds:w,workspaceId:e,close:()=>v(!1),added:()=>{d(),h()}})]})}const WO={notion:"A page or database link (Share → Copy link). It must be shared with your Notion integration","google-drive":"A folder, file, Google Doc, Sheet or Slides link. It must be shared with your service account",feishu:"A folder, docx document or wiki page link. Your app must be added to it",dropbox:"A folder or file link, or its path in your Dropbox (/Specs). Shared folders must be added to your Dropbox",onedrive:"A OneDrive or SharePoint folder or file link","tencent-docs":"A Tencent Docs folder or document link (docs.qq.com/…)"};function e4({open:e,kinds:s,own:a,workspaceKinds:l,workspaceId:c,close:u,added:d}){const[h,g]=E.useState(""),[m,y]=E.useState(""),[b,v]=E.useState(""),x=Ne(),w=h||(s.length===1?s[0]:""),S=w?[...a.includes(w)?["members"]:[],...l.includes(w)?["workspace"]:[]]:[],T=b&&S.includes(b)?b:S[0]??"members";function k(){x.busy||(y(""),g(""),u())}function z(A){A.preventDefault(),!(!w||!m.trim()||x.busy)&&x.run(async()=>{await he(`/api/workspaces/${ce(c)}/sources`,{method:"POST",body:{kind:w,target:m.trim(),readAs:T}}),y(""),g(""),v(""),d(),u()})}return i.jsx(an,{open:e,title:"Add document source",onClose:k,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:x.busy,onClick:k,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"document-source-form",disabled:!w||!m.trim()||x.busy,children:x.busy?"Checking...":"Add source"})]}),children:i.jsxs("form",{id:"document-source-form",className:"stack",onSubmit:z,children:[i.jsxs("div",{className:"field",children:[i.jsx("span",{className:"field-label",children:"Provider"}),i.jsx(Zt,{label:"Provider",placeholder:"Choose a provider",value:w,disabled:x.busy,options:s.map(A=>({value:A,label:mn[A]})),onChange:g})]}),S.length>1&&i.jsxs("div",{className:"field",children:[i.jsx("span",{className:"field-label",children:"Reads with"}),i.jsx(Zt,{label:"Reads with",value:T,disabled:x.busy,onChange:v,options:[{value:"members",label:"Members' own accounts",hint:"Each session reads with its owner's own account; yours checks the link"},{value:"workspace",label:"Workspace connection",hint:"Every session reads with the workspace's connection, which checks the link"}]})]}),w&&i.jsx(be,{label:"Link",hint:`${WO[w]}. ${T==="workspace"?"Every session reads it with the workspace's connection":"Each session reads it with its owner's own connection"}`,children:i.jsx("input",{className:"input",required:!0,value:m,onChange:A=>y(A.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,placeholder:"https://…"})}),i.jsx(Ce,{error:x.error})]})})}function t4(){const e=qe("/api/me/devices"),s=Ne();async function a(l){s.busy||!await Ge({title:"Sign out this app?",message:`${l.name??"This app"} is signed out at once and has to sign in again to reach your sessions.`,confirmLabel:"Sign out app",destructive:!0})||s.run(async()=>{await he(`/api/me/devices/${ce(l.id)}`,{method:"DELETE"}),e.refresh()},"App signed out.")}return i.jsxs(Oe,{title:"Signed-in apps",info:"The Pikibun apps on your phone, tablet or computer that signed in as you. Each stays signed in for 30 days unless you sign it out here or in the app.",children:[i.jsxs(dt,{...e,retry:e.refresh,children:[e.data&&!e.data.devices.length&&i.jsx(ae,{title:"No apps signed in",hint:"Sign in from the Pikibun app on iPhone, iPad or Mac"}),e.data?.devices.map(l=>i.jsx(ae,{title:l.name??"Unnamed app",hint:i.jsxs(i.Fragment,{children:["Signed in ",i.jsx(Kt,{value:l.createdAt})," · until ",i.jsx(Kt,{value:l.expiresAt})]}),trailing:i.jsx(V,{variant:"outline",size:"sm",disabled:s.busy,onClick:()=>{a(l)},children:"Sign out"})},l.id))]}),i.jsx(Ce,{...s})]})}function n4(){const[e,s]=E.useState(""),[a,l]=E.useState(""),[c,u]=E.useState(""),d=Ne();function h(g){g.preventDefault(),d.run(async()=>{if(a!==c)throw new Error("The new passwords don't match.");await he("/api/me/password",{method:"POST",body:{currentPassword:e,newPassword:a}}),s(""),l(""),u("")},"Password changed. Your other browsers are signed out.")}return i.jsxs("form",{className:"settings-form",onSubmit:h,children:[i.jsx(Oe,{title:"Password",info:"You sign in with your username and this password. Changing it signs out every other browser signed in as you.",children:i.jsxs(Re,{children:[i.jsx(be,{label:"Current password",children:i.jsx("input",{className:"input",type:"password",required:!0,value:e,onChange:g=>s(g.target.value),autoComplete:"current-password",maxLength:256})}),i.jsx(be,{label:"New password",hint:"At least 12 characters.",children:i.jsx("input",{className:"input",type:"password",required:!0,minLength:12,maxLength:256,value:a,onChange:g=>l(g.target.value),autoComplete:"new-password"})}),i.jsx(be,{label:"Confirm new password",children:i.jsx("input",{className:"input",type:"password",required:!0,maxLength:256,value:c,onChange:g=>u(g.target.value),autoComplete:"new-password"})})]})}),i.jsxs("div",{className:"settings-actions",children:[i.jsx(Ce,{...d}),i.jsx("span",{className:"spacer"}),i.jsx(V,{type:"submit",variant:"default",disabled:d.busy,children:d.busy?"Changing...":"Change password"})]})]})}function i4(){const{user:e,setUser:s,signOut:a}=yt(),[l,c]=E.useState(e.displayName),[u,d]=E.useState(e.gitName),[h,g]=E.useState(e.gitEmail),[m,y]=E.useState(()=>Object.entries(e.env).map(([w,S])=>({id:crypto.randomUUID(),key:w,value:S}))),b=Ne();function v(w){w.preventDefault(),b.run(async()=>{const S={};for(const k of m){if(!/^APP_[A-Z0-9_]+$/.test(k.key))throw new Error("Environment names must start with APP_ and contain only uppercase letters, digits, and underscores.");if(Object.hasOwn(S,k.key))throw new Error(`Duplicate environment name: ${k.key}`);S[k.key]=k.value}const T=await he("/api/me",{method:"PATCH",body:{displayName:l,gitName:u,gitEmail:h,env:S}});s(T.user)},"Profile saved. New sessions use your configured identity.")}const x=(w,S)=>y(T=>T.map(k=>k.id===w?{...k,...S}:k));return i.jsxs(i.Fragment,{children:[i.jsxs("form",{className:"settings-form",onSubmit:v,children:[i.jsx(Oe,{title:"Identity",info:"Sessions you own act with this Git identity and your connected Git accounts. New sessions use the saved values.",children:i.jsxs(Re,{children:[i.jsx(be,{label:"Display name",children:i.jsx("input",{className:"input",required:!0,maxLength:120,value:l,onChange:w=>c(w.target.value),autoComplete:"name"})}),i.jsx(be,{label:"Git author name",children:i.jsx("input",{className:"input",required:!0,maxLength:120,value:u,onChange:w=>d(w.target.value)})}),i.jsx(be,{label:"Git author email",children:i.jsx("input",{className:"input",required:!0,type:"email",value:h,onChange:w=>g(w.target.value),autoComplete:"email"})})]})}),i.jsxs(Oe,{title:"Environment",info:"Nonsecret APP_ variables only. They are sent to the host of every session you own. Never put Git tokens, provider keys or other credentials here; model credentials belong in Pi on your host.",action:i.jsx(V,{variant:"outline",size:"sm",icon:"plus",onClick:()=>y(w=>[...w,{id:crypto.randomUUID(),key:"APP_",value:""}]),children:"Add variable"}),children:[!m.length&&i.jsx(ae,{title:"No variables",hint:"Add APP_ variables your sessions need"}),m.map((w,S)=>i.jsx(ae,{title:i.jsxs("span",{className:"env-row",children:[i.jsx("input",{className:"input","aria-label":`Variable ${S+1} name`,required:!0,pattern:"APP_[A-Z0-9_]+",placeholder:"APP_PROJECT",value:w.key,onChange:T=>x(w.id,{key:T.target.value}),autoComplete:"off",spellCheck:!1}),i.jsx("span",{className:"muted",children:"="}),i.jsx("input",{className:"input","aria-label":`Variable ${S+1} value`,value:w.value,onChange:T=>x(w.id,{value:T.target.value}),autoComplete:"off"})]}),trailing:i.jsx(V,{variant:"ghost",size:"sm",icon:"trash","aria-label":`Remove variable ${S+1}`,title:"Remove variable",onClick:()=>y(T=>T.filter(k=>k.id!==w.id))})},w.id))]}),i.jsxs("div",{className:"settings-actions",children:[i.jsx(Ce,{...b}),i.jsx("span",{className:"spacer"}),i.jsx(V,{type:"submit",variant:"default",disabled:b.busy,children:b.busy?"Saving...":"Save profile"})]})]}),i.jsx(KO,{}),e.passwordSignIn&&i.jsx(n4,{}),i.jsx(t4,{}),i.jsx(kh,{}),i.jsxs(Oe,{title:"Account",children:[i.jsx(ae,{title:"User ID",hint:i.jsx("code",{children:Mt(e)}),trailing:i.jsx(nx,{value:e.id,label:"Copy user ID"})}),i.jsx(ae,{title:"Sign out",trailing:i.jsx(V,{variant:"outline",size:"sm",onClick:a,children:"Sign out"})})]})]})}const s4={domains:100},a4={brave:"Brave Search",tavily:"Tavily",searxng:"SearXNG"},Vb={off:"Off",allowlist:"Allowlist",open:"Open"},r4={off:"Sandboxed commands reach only this workspace's repositories",allowlist:"The workspace's repositories, plus the domains below",open:"The workspace's repositories, plus any public host"};function l4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/network-policy`,l=qe(a),c=Ne(),[u,d]=E.useState("off"),[h,g]=E.useState(""),[m,y]=E.useState(!0),[b,v]=E.useState(!1),x=l.data?.policy;E.useEffect(()=>{x&&(d(x.mode),g(x.domains.join(`
50
- `)),y(x.packageRegistries),v(x.webSearch===!0))},[x]);const w=h.split(/[\s,]+/).map(z=>z.trim().toLowerCase()).filter(Boolean),S=!!x&&(u!==x.mode||m!==x.packageRegistries||b!==(x.webSearch===!0)||w.join(`
51
- `)!==x.domains.join(`
52
- `)),T=l.data?.webSearchProvider;function k(){!s||c.busy||c.run(async()=>{await he(a,{method:"PUT",body:{mode:u,domains:w,packageRegistries:m,webSearch:b}}),l.refresh()},"Network access saved. Running sessions pick it up within a minute.")}return i.jsx(Oe,{title:"Network access",info:i.jsxs("div",{className:"stack",children:[!s&&i.jsx("p",{children:"Only workspace owners and admins can change network access."}),i.jsx("p",{children:"Sandboxed shell commands have no direct network. Everything goes through the host's egress proxy: Git reads of this workspace's repositories always work, with the session owner's own account, which never leaves Pikibun."}),i.jsx("p",{children:"This setting decides what else is reachable over HTTPS. Addresses inside the host's own networks are never reachable. Hosts running without the sandbox aren't confined by it."}),i.jsxs("p",{children:["The agent's ",i.jsx("code",{children:"web_fetch"})," tool reads web pages from the host as far as this reaches, on every host. ",i.jsx("code",{children:"web_search"})," searches with the server's search provider, only where web search is on: each query leaves for that provider."]})]}),children:i.jsx(dt,{loading:l.loading,error:l.error,retry:l.refresh,children:x&&i.jsxs(i.Fragment,{children:[i.jsx(ae,{title:"Access",hint:r4[u],trailing:s?i.jsx(Aa,{label:"Network access",value:u,onChange:d,options:["off","allowlist","open"].map(z=>({value:z,label:Vb[z]}))}):i.jsx(Te,{tone:x.mode==="off"?"neutral":"success",children:Vb[x.mode]})}),u==="allowlist"&&i.jsx(Re,{children:i.jsxs("div",{className:"stack",children:[i.jsx(be,{label:"Allowed domains",hint:`One per line, up to ${s4.domains}. *.example.com allows its subdomains.`,children:i.jsx("textarea",{className:"textarea mono",rows:4,disabled:!s,value:h,onChange:z=>g(z.target.value),autoComplete:"off",spellCheck:!1,placeholder:"docs.example.com"})}),i.jsxs("label",{className:"check-row small",title:l.data.packageRegistryDomains.join(", "),children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:m,disabled:!s,onChange:z=>y(z.target.checked)}),i.jsx("span",{children:"Allow package registries (npm, PyPI, crates.io, Go, RubyGems, Maven, NuGet, Packagist)"})]})]})}),i.jsx(ae,{title:"Web search",hint:T?`Agents search the web with web_search, through ${a4[T]??T}. Their queries go to it.`:"This server has no search provider: its operator sets one with WEB_SEARCH.",trailing:s?i.jsxs("label",{className:"check-row small",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:b,disabled:!T&&!b,onChange:z=>v(z.target.checked)}),i.jsx("span",{children:"Allow web search"})]}):i.jsx(Te,{tone:x.webSearch&&T?"success":"neutral",children:x.webSearch&&T?"On":"Off"})}),s&&(S||c.error||c.notice)&&i.jsx(Re,{children:i.jsxs("div",{className:"stack",children:[i.jsx(Ce,{...c}),S&&i.jsx("div",{children:i.jsx(V,{variant:"default",size:"sm",disabled:c.busy,onClick:k,children:"Save network access"})})]})})]})})})}function o4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/transcripts`,l=qe(a),c=Ne(),u=l.data?.settings,d=u?.paging,h=u?u.toolOutput!=="brief":void 0;function g(y){!s||c.busy||y===d||c.run(async()=>{await he(a,{method:"PUT",body:{paging:y}}),l.refresh()},y?"Transcripts load latest messages first. Open sessions switch within a few seconds.":"Transcripts load whole again. Open sessions switch within a few seconds.")}function m(y){!s||c.busy||y===h||c.run(async()=>{await he(a,{method:"PUT",body:{toolOutput:y?"full":"brief"}}),l.refresh()},y?"New sessions start with full tool output. Existing sessions keep theirs.":"New sessions start with brief tool output. Existing sessions keep theirs.")}return i.jsx(Oe,{title:"Transcripts",info:i.jsxs("div",{className:"stack",children:[!s&&i.jsx("p",{children:"Only workspace owners and admins can change these."}),i.jsxs("p",{children:["With latest messages first, a session opens with the newest ",Kd.size," entries of each conversation, and earlier ones load as you scroll up. Long sessions open much faster this way; your browser's find on the page only searches what has loaded."]}),i.jsx("p",{children:"Full tool output sets how new sessions here start: with every tool result in full, or with one line per tool result and long tool calls cut short. Each session's owner can still change their session's under its Details, and changing this leaves existing sessions as they are."}),i.jsx("p",{children:"Hosts still send Pikibun whole transcripts; these change only what reaches each viewer."})]}),children:i.jsxs(dt,{loading:l.loading,error:l.error,retry:l.refresh,children:[d!==void 0&&i.jsx(ae,{title:"Latest messages first",hint:d?`Sessions open with the newest ${Kd.size} entries of each conversation`:"Sessions open with their whole transcript",trailing:s?i.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Load latest messages first",checked:d,disabled:c.busy,onChange:y=>g(y.target.checked)}):i.jsx(Te,{tone:d?"success":"neutral",children:d?"On":"Off"})}),h!==void 0&&i.jsx(ae,{title:"Full tool output",hint:h?"New sessions show every tool result in full":"New sessions show one line per tool result",trailing:s?i.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Full tool output for new sessions",checked:h,disabled:c.busy,onChange:y=>m(y.target.checked)}):i.jsx(Te,{tone:h?"success":"neutral",children:h?"On":"Off"})}),(c.error||c.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...c})})]})})}const yh={"github-app":"GitHub App","entra-federation":"Entra workload identity federation","bitbucket-client-credentials":"Bitbucket OAuth consumer","oauth-refresh":"OAuth app authorized by a bot account","forgejo-integration":"Forgejo authorized integration","owner-account":"Session owner's account","host-credentials":"Host's Git credentials"},c4={github:"the GitHub account they signed in with","github-enterprise":"the GitHub Enterprise token they connected, which needs Contents write (or classic repo)",gitlab:"the GitLab token they connected, which needs write_repository (or api)",bitbucket:"the Bitbucket API token they connected, which needs write:repository:bitbucket","azure-devops":"the Azure DevOps token they connected, which needs Code (Read & write)",gitea:"the Gitea token they connected, which needs write:repository",git:"the Git server account they connected, which needs write access"},u4="api://AzureADTokenExchange";function d4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/push-identities`,l=qe(a),c=Ne(),[u,d]=E.useState(null);async function h(y){await Ge({title:"Remove push identity",message:`Remove the ${Gd(y)} push identity (${yh[y.kind]})? Agents can no longer push to these repositories until another identity is configured.`,confirmLabel:"Remove",destructive:!0})&&c.run(async()=>{await he(`${a}/${ce(y.id)}`,{method:"DELETE"}),l.refresh()},"Push identity removed.")}function g(y){c.run(async()=>{const b=await he(`${a}/${ce(y.id)}/authorize`,{method:"POST"});window.location.assign(b.url)})}const m=l.data;return i.jsxs(Oe,{title:"Push access",info:i.jsxs("div",{className:"stack",children:[!s&&i.jsx("p",{children:"Only workspace owners and admins can manage push identities."}),i.jsx("p",{children:"Agents push with short-lived credentials minted from these workspace app or bot identities, held only in the host's memory. An identity can instead push with the session owner's own account or the host's own Git credentials, for sessions on the owner's own hosts. The session owner must also be able to push to the repository, and to the branch where the Git host reports branch permissions; pull requests are opened as the session owner."}),i.jsxs("p",{children:["Except for GitHub, the minted token carries everything the identity can reach until it expires, and the host running the session receives it. Give bot accounts, OAuth consumers, service principals and integrations access only to this workspace's repositories; for Forgejo integrations, add claim rules on the ",i.jsx("code",{children:"repository"})," and ",i.jsx("code",{children:"ref"})," claims."]}),i.jsx("p",{children:"Secrets are write-only: they are never shown again after saving."})]}),action:s&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d({provider:"github"}),children:"Add identity"}),children:[i.jsxs(dt,{...l,retry:l.refresh,children:[m?.githubApp&&i.jsx(ae,{title:`Operator GitHub App (${m.githubApp.slug})`,hint:"Used for github.com repositories without a workspace GitHub App. Install it on the repositories agents should push to",trailing:i.jsx(Bt,{variant:"outline",size:"sm",href:m.githubApp.installUrl,target:"_blank",rel:"noreferrer",children:"Install"})}),m?.identities.length?m.identities.map(y=>i.jsx(ae,{title:Gd(y),hint:i.jsxs(i.Fragment,{children:[yh[y.kind],y.config.slug?i.jsxs(i.Fragment,{children:[" · ",i.jsx("code",{children:y.config.slug})]}):null,y.config.login?i.jsxs(i.Fragment,{children:[" · bot ",i.jsx("code",{children:y.config.login})]}):null]}),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Te,{tone:y.status==="ready"?"success":"warning",children:y.status==="ready"?"Ready":"Authorization required"}),s&&y.kind==="oauth-refresh"&&i.jsx(V,{variant:"outline",size:"sm",disabled:c.busy,onClick:()=>g(y),children:"Authorize"}),s&&i.jsx(Kn,{label:`Actions for ${Gd(y)}`,items:[{label:"Replace",icon:"refresh",disabled:c.busy,onSelect:()=>d({provider:y.provider,identity:y})},{label:"Remove",icon:"trash",destructive:!0,disabled:c.busy,onSelect:()=>{h(y)}}]})]})},y.id)):!m?.githubApp&&i.jsx(Re,{children:i.jsx("span",{className:"muted",children:s?"No push identities yet. Add one per provider so agents can push":"No push identities yet. Ask a workspace owner or admin to add one"})}),(c.error||c.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...c})})]}),s&&u&&i.jsx(h4,{path:a,oidc:m?.oidc??null,redirectUri:m?.redirectUri??null,initial:u,close:()=>d(null),saved:l.refresh},u.identity?.id??"new")]})}function Gd(e){return`${Go(e.provider,e.host)}${e.scope?` · ${e.scope}`:""}`}function h4({path:e,oidc:s,redirectUri:a,initial:l,close:c,saved:u}){const d=l.identity,[h,g]=E.useState(l.provider),[m,y]=E.useState(d?.kind??co[l.provider][0]),[b,v]=E.useState(d?.host??si[l.provider].default??""),[x,w]=E.useState(d?.scope??""),[S,T]=E.useState(d?{...d.config}:{}),[k,z]=E.useState(""),[A,I]=E.useState(null),q=Ne(),_=si[h].fixed,F=h==="azure-devops"||h==="bitbucket",oe=ee=>S[ee]??"",ne=(ee,O)=>T(R=>({...R,[ee]:O}));function B(ee){g(ee),y(co[ee][0]),v(si[ee].default??""),w(""),T({}),z("")}const H={"github-app":["appId","slug"],"entra-federation":["tenantId","clientId"],"bitbucket-client-credentials":["key"],"oauth-refresh":["clientId"],"forgejo-integration":["audience"],"owner-account":[],"host-credentials":[]},K=m==="github-app"||m==="bitbucket-client-credentials"||m==="oauth-refresh",re=!!((_||b.trim())&&(!F||x.trim())&&H[m].every(ee=>oe(ee).trim())&&(!K||k.trim()));function ie(){q.busy||c()}function G(ee){if(ee.preventDefault(),!re||q.busy)return;const O={provider:h,kind:m,..._?{}:{host:b.trim()},...F?{scope:x.trim()}:{},config:Object.fromEntries(H[m].map(R=>[R,oe(R).trim()])),...K?{secret:m==="github-app"?k:k.trim()}:{}};q.run(async()=>{const R=await he(e,{method:"POST",body:O});z(""),u(),R.identity.kind==="oauth-refresh"?I(R.identity):c()})}function U(ee){q.run(async()=>{const O=await he(`${e}/${ce(ee.id)}/authorize`,{method:"POST"});window.location.assign(O.url)})}const M=(ee,O,R,Q)=>i.jsx(be,{label:O,hint:R,children:i.jsx("input",{className:"input",required:!0,value:oe(ee),onChange:N=>ne(ee,N.target.value),autoComplete:"off",spellCheck:!1,placeholder:Q})}),W=ee=>s?i.jsxs("div",{className:"stack",children:[i.jsx(Vn,{label:"Issuer",value:s.issuer}),i.jsx(Vn,{label:"Subject",value:s.subject}),ee&&i.jsx(Vn,{label:"Audience",value:ee})]}):i.jsx(ke,{variant:"warning",title:"OIDC issuer unavailable",children:"The operator has not configured Pikibun's OIDC signing key, so this identity cannot be used yet."});return i.jsx(an,{open:!0,title:d?"Replace push identity":"Add push identity",onClose:ie,footer:A?i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:q.busy,onClick:c,children:"Later"}),i.jsx(V,{variant:"default",disabled:q.busy,onClick:()=>U(A),children:"Authorize"})]}):i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:q.busy,onClick:ie,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"push-identity-form",disabled:!re||q.busy,children:q.busy?"Verifying...":"Save"})]}),children:A?i.jsxs("div",{className:"stack",children:[i.jsxs("p",{children:["Saved. Sign in to ",Go(A.provider,A.host)," as the bot account, then authorize the OAuth app so Pikibun can mint push tokens."]}),i.jsx(Ce,{error:q.error})]}):i.jsxs("form",{id:"push-identity-form",className:"stack",onSubmit:G,children:[i.jsx(be,{label:"Provider",hint:d?"Saving replaces the identity for the same provider, host and scope":void 0,children:i.jsx("select",{className:"select",value:h,disabled:!!d,onChange:ee=>B(ee.target.value),children:Tx.map(ee=>i.jsx("option",{value:ee,children:Hn[ee]},ee))})}),co[h].length>1&&i.jsx(be,{label:"Identity type",children:i.jsx("select",{className:"select",value:m,onChange:ee=>{y(ee.target.value),T({}),z("")},children:co[h].map(ee=>i.jsx("option",{value:ee,children:yh[ee]},ee))})}),!_&&i.jsx(be,{label:"Host",hint:"Hostname of the instance, for example git.example.com",children:i.jsx("input",{className:"input",required:!0,value:b,disabled:!!d,onChange:ee=>v(ee.target.value),autoComplete:"off",spellCheck:!1,placeholder:"git.example.com"})}),F&&i.jsx(be,{label:h==="azure-devops"?"Azure DevOps organization":"Bitbucket workspace",children:i.jsx("input",{className:"input",required:!0,value:x,disabled:!!d,onChange:ee=>w(ee.target.value),autoComplete:"off",spellCheck:!1})}),m==="github-app"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"muted small",children:"Create a GitHub App with Repository contents read & write and install it on the repositories agents push to."}),M("appId","App ID"),M("slug","App slug","From the app's public URL: github.com/apps/<slug>"),i.jsx(be,{label:"Private key",hint:"PEM file contents. Write-only",children:i.jsx("textarea",{className:"textarea mono",required:!0,value:k,onChange:ee=>z(ee.target.value),autoComplete:"off",spellCheck:!1,placeholder:"-----BEGIN RSA PRIVATE KEY-----"})})]}),m==="entra-federation"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"muted small",children:"Register a Microsoft Entra app, add its service principal to the Azure DevOps organization with Code (Read & write) on the repositories, and add a federated credential with these values:"}),W(u4),M("tenantId","Tenant ID",void 0,"00000000-0000-0000-0000-000000000000"),M("clientId","Client ID",void 0,"00000000-0000-0000-0000-000000000000")]}),m==="bitbucket-client-credentials"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"muted small",children:"Create an OAuth consumer in the Bitbucket workspace settings with the Repositories: Write permission, marked as a private consumer."}),M("key","Key"),i.jsx(be,{label:"Secret",hint:"Write-only",children:i.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:ee=>z(ee.target.value),autoComplete:"new-password"})})]}),m==="oauth-refresh"&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"muted small",children:["Register an OAuth application on the instance (",h==="gitlab"?"scopes write_repository and read_user":"scopes write:repository and read:user, Gitea 1.23 or later",") with this redirect URI. After saving, sign in as a dedicated bot account with push access and authorize it."]}),a?i.jsx(Vn,{label:"Redirect URI",value:a}):i.jsx(ke,{variant:"warning",title:"Redirect URI unavailable",children:"The operator has not configured Pikibun's application origin, so this identity cannot be authorized yet."}),M("clientId","Client ID"),i.jsx(be,{label:"Client secret",hint:"Write-only",children:i.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:ee=>z(ee.target.value),autoComplete:"new-password"})})]}),m==="forgejo-integration"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"muted small",children:"As a bot account with push access (Forgejo 16 or later), create a Generic JWT authorized integration trusting this issuer and subject, then enter its audience."}),W(""),M("audience","Audience")]}),m==="owner-account"&&i.jsxs("p",{className:"muted small",children:["Agents push as the session owner, with ",c4[h]," (Settings → Profile → Connected accounts). Only sessions on the owner's own hosts push this way: the token is sent to that host for each push and held only in its memory. ",h==="github"?"Pikibun resets it when the push ends, so the host's copy stops working while the owner stays connected.":"It stays valid after the push: these tokens can't be reset."]}),m==="host-credentials"&&i.jsx("p",{className:"muted small",children:"Agents push with the Git credentials set up on the host running the session, read through its Git credential helpers (for example gh auth setup-git, the macOS keychain or Git Credential Manager). Only the host's owner pushes this way, in sessions on their own host, once they turn on Git credentials in its configuration (Settings → Hosts)."}),i.jsx(Ce,{error:q.error})]})})}const Aw=[{minutes:null,label:"Off"},{minutes:15,label:"Every 15 minutes"},{minutes:60,label:"Every hour"},{minutes:360,label:"Every 6 hours"},{minutes:1440,label:"Every day"}];function Zb(e){return Aw.find(s=>s.minutes===e)?.label??`Every ${e} minutes`}function f4(e){return e?"session backups are kept in the server's backup storage":"this server keeps no session backups, as it has no backup storage of its own (STORAGE_URL)"}const m4=32*1024*1024,p4={"verify-full":"TLS, server certificate verified",require:"TLS, server certificate not verified",disable:"Unencrypted"};function _o(e){return`${e.host.includes(":")?`[${e.host}]`:e.host}:${e.port}/${e.database}`}function g4(e){const s=e.trim(),a=/^postgres(?:ql)?:\/\//i.exec(s);if(!a)throw new Error("Use a postgres:// or postgresql:// URL.");const l=new URL(`http://${s.slice(a[0].length)}`);if(!l.hostname)throw new Error("The URL has no host.");return{host:l.hostname.replace(/^\[(.*)\]$/,"$1"),port:l.port||"5432",database:decodeURIComponent(l.pathname.replace(/^\//,"")),user:decodeURIComponent(l.username),password:decodeURIComponent(l.password),unencrypted:l.searchParams.get("sslmode")==="disable"}}function y4({workspace:e,owner:s}){const a=`/api/workspaces/${ce(e.id)}/database`,l=qe(a),c=Ne(),[u,d]=E.useState(!1),[h,g]=E.useState(!1),m=l.data,y=m?.database??null;async function b(){!y||c.busy||!await Ge({title:"Disconnect database",message:`Disconnect ${_o(y)}? ${m?.backupStorage?"New session backups go to the server's backup storage again.":"This server has no backup storage of its own, so no new session backups can be saved."} Backups already saved in that database stay there, but can't be downloaded or restored until it is connected again.`,confirmLabel:"Disconnect",destructive:!0})||c.run(async()=>{await he(a,{method:"DELETE"}),l.refresh()},m?.backupStorage?"Database disconnected. New session backups go to the server's backup storage.":"Database disconnected. This server keeps no session backups without one.")}const v=[...m?.available?[{label:"Import dump",icon:"folder",hint:"A session or workspace export",disabled:c.busy,onSelect:()=>g(!0)},{label:"Replace",icon:"refresh",disabled:c.busy,onSelect:()=>d(!0)}]:[],{label:"Disconnect",icon:"trash",destructive:!0,disabled:c.busy,onSelect:()=>{b()}}],x=f4(m?.backupStorage??!1),w=m?.available?s?`No database connected, so ${x}`:`No database connected, so ${x}. Only the workspace owner can connect one`:`Session databases are turned off on this server, so ${x}. The server's operator can turn them on with WORKSPACE_DATABASES=true`;return i.jsxs(Oe,{title:"Session database",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"The workspace owner can connect a Postgres database of their own. Backups of this workspace's sessions are then saved there, with each session's details, instead of in the server's own backup storage (if it has any), and downloads and restores read them back from it."}),i.jsx("p",{children:"Whoever can read that database can read the sessions saved there, private ones and their owners' personal environment values included. Other members confirm the database before each of their backups goes there, and again after it is pointed at another database."}),i.jsx("p",{children:"The owner can also have changed sessions backed up there on their own, once they're idle, on a schedule. Members' sessions take part once their owner confirms the database for all their backups, which also stops it asking before each one; pointing the connection at another database asks again."}),i.jsxs("p",{children:["The owner can also import a session or workspace export into it, adding session details and activity. Pikibun creates the tables ",i.jsx("code",{children:"pikibun_workspaces"}),", ",i.jsx("code",{children:"pikibun_sessions"}),", ",i.jsx("code",{children:"pikibun_session_backups"})," and ",i.jsx("code",{children:"pikibun_audit"})," when they are missing. The password is write-only: it is never shown again after saving."]})]}),action:s&&m?.available&&!y&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d(!0),children:"Connect database"}),children:[i.jsxs(dt,{...l,retry:l.refresh,children:[y?i.jsx(ae,{title:_o(y),hint:i.jsxs(i.Fragment,{children:["User ",i.jsx("code",{children:y.user})," · ",p4[y.tls],y.customCa?" with a custom CA":""]}),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Te,{tone:m?.available?"success":"warning",children:m?.available?"Connected":"Unavailable"}),s&&i.jsx(Kn,{label:"Actions for the session database",items:v})]})}):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:w})}),y&&m?.available&&m.automaticBackups&&i.jsx(b4,{path:a,database:y,owner:s,state:m.automaticBackups,saved:l.refresh}),y&&m&&!m.available&&i.jsx(Re,{children:i.jsxs(ke,{variant:"warning",title:"Workspace databases are turned off",children:["This server no longer connects to workspace databases, so backups of this workspace's sessions can't be created, downloaded or restored. ",m.backupStorage?s?"Disconnect the database to use the server's backup storage again, or ask the server's operator to turn workspace databases on again.":"The workspace owner can disconnect it to use the server's backup storage again.":"The server's operator can turn them on again with WORKSPACE_DATABASES=true."]})}),(c.error||c.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...c})})]}),s&&u&&m?.available&&i.jsx(v4,{path:a,privateHosts:m.privateHosts,existing:y,close:()=>d(!1),saved:l.refresh}),s&&h&&m?.available&&y&&i.jsx(x4,{path:a,database:y,close:()=>g(!1)})]})}function b4({path:e,database:s,owner:a,state:l,saved:c}){const u=Ne();function d(g){const m=g===""?null:Number(g);u.run(async()=>{await he(`${e}/automatic-backups`,{method:"PUT",body:{minutes:m}}),c()},m===null?"Automatic backups turned off.":`Changed sessions are now backed up ${Zb(m).toLowerCase()} at most.`)}async function h(g){g&&!await Ge({title:"Confirm this database",message:`Back up your sessions in ${_o(s)} without asking each time, automatic backups included? Whoever can read it can read them, including your personal environment values. Pikibun asks again if the owner points the connection at another database.`,confirmLabel:"Confirm database"})||u.run(async()=>{await he(`${e}/consent`,g?{method:"PUT",body:{databaseId:s.id}}:{method:"DELETE"}),c()},g?"Database confirmed for your sessions' backups.":"Confirmation withdrawn. Backups of your sessions ask first again, and aren't taken automatically.")}return i.jsxs(i.Fragment,{children:[i.jsx(ae,{title:"Automatic backups",hint:a?"Backs up sessions that changed since their last automatic backup, once they're idle. Members' sessions only once they confirm this database":l.minutes===null?"Off. The workspace owner chooses the schedule":`${Zb(l.minutes)}, for sessions that changed, once they're idle`,trailing:a&&i.jsx("select",{className:"select","aria-label":"Automatic backup schedule",value:l.minutes??"",disabled:u.busy,onChange:g=>d(g.target.value),children:Aw.map(g=>i.jsx("option",{value:g.minutes??"",children:g.label},g.label))})}),!a&&i.jsx(ae,{title:"Your sessions",hint:l.consented?"You confirmed this database: your backups go there without asking, automatic ones included":"You confirm this database before each backup, and your sessions aren't backed up automatically",trailing:i.jsx(V,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>{h(!l.consented)},children:l.consented?"Withdraw":"Confirm database"})}),(u.error||u.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...u})})]})}function x4({path:e,database:s,close:a}){const[l,c]=E.useState(null),[u,d]=E.useState(null),h=Ne();function g(){h.busy||a()}function m(y){y.preventDefault(),!(!l||h.busy)&&(d(null),h.run(async()=>{if(l.size>m4)throw new Error("This dump is larger than 32 MiB. The server's operator can import it with the --import-dump option.");let b;try{b=JSON.parse(await l.text())}catch{throw new Error("This file is not a JSON dump.")}const v=await he(`${e}/import`,{method:"POST",body:b});d(v.imported)}))}return i.jsx(an,{open:!0,title:"Import a dump",onClose:g,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:h.busy,onClick:g,children:u?"Done":"Cancel"}),!u&&i.jsx(V,{variant:"default",type:"submit",form:"workspace-import-form",disabled:!l||h.busy,children:h.busy?"Importing...":"Import"})]}),children:i.jsxs("form",{id:"workspace-import-form",className:"stack",onSubmit:m,children:[i.jsxs("p",{className:"muted small",children:["Adds an export of this workspace, or of one of its sessions, to ",_o(s),": session records and details (grants, approvals, pushes, backups and restores), their activity and the workspace's settings. A record replaces an older one of the same session; activity is added once, so importing a dump again changes nothing. Pikibun itself is unchanged."]}),i.jsx(be,{label:"Dump file",hint:"A JSON export from Pikibun, up to 32 MiB",children:i.jsx("input",{className:"input",type:"file",accept:"application/json,.json",disabled:h.busy,onChange:y=>{c(y.target.files?.[0]??null),d(null)}})}),u&&i.jsxs(ke,{variant:"success",title:"Imported",role:"status",children:[u.sessions," session record",u.sessions===1?"":"s"," (",u.sessionDetails," with details) and ",u.auditEntries," activity entr",u.auditEntries===1?"y":"ies",u.workspaceSettings?", with the workspace's settings,":""," from the ",u.format," export of ",i.jsx(Kt,{value:u.exportedAt}),"."]}),i.jsx(Ce,{error:h.error})]})})}function v4({path:e,privateHosts:s,existing:a,close:l,saved:c}){const[u,d]=E.useState(""),[h,g]=E.useState(""),[m,y]=E.useState(a?.host??""),[b,v]=E.useState(String(a?.port??5432)),[x,w]=E.useState(a?.database??""),[S,T]=E.useState(a?.user??""),[k,z]=E.useState(""),[A,I]=E.useState(a&&(a.tls!=="disable"||s)?a.tls:"verify-full"),[q,_]=E.useState(""),F=Ne(),oe=Number(b),ne=!!(m.trim()&&x.trim()&&S.trim()&&k)&&Number.isInteger(oe)&&oe>=1&&oe<=65535;function B(){F.busy||l()}function H(){try{const re=g4(u);y(re.host),v(re.port),re.database&&w(re.database),re.user&&T(re.user),re.password&&z(re.password),re.unencrypted&&s&&I("disable"),d(""),g("")}catch(re){g(re instanceof Error?re.message:"The connection URL could not be read.")}}function K(re){if(re.preventDefault(),!ne||F.busy)return;const ie={host:m.trim(),port:oe,database:x.trim(),user:S.trim(),password:k,tls:A,...A==="verify-full"&&q.trim()?{caCertificate:q.trim()}:{}};F.run(async()=>{await he(e,{method:"PUT",body:ie}),z(""),c(),l()})}return i.jsx(an,{open:!0,title:a?"Replace session database":"Connect session database",onClose:B,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:F.busy,onClick:B,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"workspace-database-form",disabled:!ne||F.busy,children:F.busy?"Connecting...":"Save"})]}),children:i.jsxs("form",{id:"workspace-database-form",className:"stack",onSubmit:K,children:[i.jsxs("p",{className:"muted small",children:["Pikibun connects when you save, to check the settings and create its tables. From then on, backups of this workspace's sessions are saved in this database",a?"; backups saved before stay where they are":"","."]}),i.jsx(be,{label:"Connection URL",hint:"Optional. Paste a postgres:// URL and fill in the fields below from it; the URL itself isn't sent",children:i.jsx("input",{className:"input",value:u,onChange:re=>d(re.target.value),autoComplete:"off",spellCheck:!1,placeholder:"postgres://user:password@db.example.com:5432/pikibun"})}),i.jsx("div",{className:"inline",children:i.jsx(V,{variant:"outline",size:"sm",disabled:!u.trim()||F.busy,onClick:H,children:"Fill in from URL"})}),i.jsx(Ce,{error:h}),i.jsx(be,{label:"Host",hint:"Host name or IP address, without a scheme or port",children:i.jsx("input",{className:"input",required:!0,value:m,onChange:re=>y(re.target.value),autoComplete:"off",spellCheck:!1,placeholder:"db.example.com"})}),i.jsx(be,{label:"Port",children:i.jsx("input",{className:"input",required:!0,inputMode:"numeric",value:b,onChange:re=>v(re.target.value),autoComplete:"off",spellCheck:!1})}),i.jsx(be,{label:"Database",children:i.jsx("input",{className:"input",required:!0,value:x,onChange:re=>w(re.target.value),autoComplete:"off",spellCheck:!1})}),i.jsx(be,{label:"User",hint:"Needs to create Pikibun's tables, or SELECT, INSERT and UPDATE on them if you create them yourself",children:i.jsx("input",{className:"input",required:!0,value:S,onChange:re=>T(re.target.value),autoComplete:"off",spellCheck:!1})}),i.jsx(be,{label:"Password",hint:"Write-only. Needed every time the connection is saved",children:i.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:re=>z(re.target.value),autoComplete:"new-password"})}),i.jsx(be,{label:"Encryption",hint:s?void 0:"This server only connects to databases on the public internet, always encrypted",children:i.jsxs("select",{className:"select",value:A,onChange:re=>I(re.target.value),children:[i.jsx("option",{value:"verify-full",children:"TLS, verify the server certificate (recommended)"}),i.jsx("option",{value:"require",children:"TLS, don't verify the server certificate"}),s&&i.jsx("option",{value:"disable",children:"Unencrypted, private networks only"})]})}),A==="verify-full"&&i.jsx(be,{label:"CA certificate",hint:a?.customCa?"Paste it again to keep verifying with it: saving replaces the connection's CA certificate":"Optional. PEM certificates of a private CA, such as your cloud provider's bundle. The public roots are used otherwise",children:i.jsx("textarea",{className:"textarea mono",value:q,onChange:re=>_(re.target.value),autoComplete:"off",spellCheck:!1,placeholder:"-----BEGIN CERTIFICATE-----"})}),A==="require"&&i.jsx(ke,{variant:"warning",title:"Certificate not verified",children:"The connection is encrypted, but whoever can intercept it could pose as the database and read the password and the sessions saved there."}),A==="disable"&&i.jsx(ke,{variant:"warning",title:"Unencrypted",children:"The password and the sessions cross the network in the clear. Use this only on a network you trust."}),i.jsx(Ce,{error:F.error})]})})}const Ls={owner:"Owner",admin:"Admin",collaborator:"Collaborator",member:"Member",viewer:"Viewer"},ef={admin:"Collaborator, and manages the workspace: members, models, repositories and settings",collaborator:"Starts sessions, and sends messages to any session shared with the workspace",member:"Starts sessions, and follows other shared sessions read-only unless granted more",viewer:"Follows shared sessions read-only, and can't start sessions"};function w4({id:e}){const{user:s,workspaces:a,workspacesLoading:l,workspacesError:c,refreshWorkspaces:u}=yt(),[d,h]=E.useState(!1),g=i.jsx(Oh,{open:d,onClose:()=>h(!1)});if(e){const m=a.find(y=>y.id===e);return m?i.jsxs(i.Fragment,{children:[i.jsx(Qb,{}),i.jsx(j4,{user:s,workspace:m},m.id)]}):l?i.jsx(ai,{}):i.jsxs(i.Fragment,{children:[i.jsx(Qb,{}),c?i.jsx(ke,{variant:"error",title:"Unable to load workspaces",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:u,children:"Try again"}),children:c}):i.jsx(jt,{title:"Workspace not found"})]})}return l&&!a.length?i.jsx(ai,{}):c&&!a.length?i.jsx(ke,{variant:"error",title:"Unable to load workspaces",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:u,children:"Try again"}),children:c}):a.length?i.jsxs(i.Fragment,{children:[i.jsx(Oe,{title:"Workspaces",info:"A shared home for your repositories, people, agents and sessions",action:i.jsx(V,{variant:"outline",size:"sm",icon:"plus",onClick:()=>h(!0),children:"New workspace"}),children:a.map(m=>i.jsx(ae,{leading:i.jsx(Ei,{name:m.name,id:m.id}),title:m.name,hint:Ls[Tw(m,s)],href:Qe({name:"settings",section:"workspaces",id:m.id}),chevron:!0},m.id))}),g]}):i.jsxs(i.Fragment,{children:[i.jsx(jt,{title:"No workspaces yet",action:i.jsx(V,{variant:"default",icon:"plus",onClick:()=>h(!0),children:"New workspace"})}),g]})}function Qb(){return i.jsxs("a",{className:"btn ghost sm",href:Qe({name:"settings",section:"workspaces"}),children:[i.jsx(ve,{name:"chevron-left",size:16}),"Workspaces"]})}function Tw(e,s){return e.ownerId===s.id?"owner":e.role??"member"}function j4({user:e,workspace:s}){const a=Tw(s,e),l=a==="owner"||a==="admin",c=Nx(s.id),u=ZO(s.id),d=FO(s.id),h=()=>{c.refresh(),u.refresh(),d.refresh()};return i.jsxs(i.Fragment,{children:[i.jsxs(Oe,{title:"General",children:[i.jsx(ae,{title:"Name",trailing:i.jsx("span",{children:s.name})}),i.jsx(ae,{title:"Your role",trailing:i.jsx(Te,{tone:l?"success":"neutral",children:Ls[a]})})]}),Ir(a)&&i.jsx(S4,{user:e,workspace:s,admin:l,sourceCount:c.sourceCount}),i.jsx(C4,{workspace:s,admin:l,...c,connections:d.connections,changed:h,documents:i.jsx(JO,{workspaceId:s.id,workspaceName:s.name,admin:l,...u,connections:d.connections,changed:h})}),i.jsx(PO,{workspaceId:s.id,admin:l,...d,changed:h}),i.jsx(d4,{workspace:s,admin:l}),i.jsx(l4,{workspace:s,admin:l}),i.jsx(o4,{workspace:s,admin:l}),i.jsx(y4,{workspace:s,owner:a==="owner"}),i.jsx(N4,{workspace:s,admin:l,owner:a==="owner"}),l&&i.jsx(k4,{workspace:s})]})}function k4({workspace:e}){return i.jsx(Oe,{title:"Data export",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"Downloads this workspace as JSON: its settings, members, models, published agents, repositories, push access, session database connection and activity, with your own sessions in full and the records of every other session, which owners and admins manage."}),i.jsx("p",{children:"The rest of another member's session, such as its people, approvals and activity, is in its owner's export of it. Secrets are never included, and a session's conversation is in its backups."}),i.jsx("p",{children:"The workspace owner can import exports into the workspace's session database."})]}),children:i.jsx(ae,{title:"Workspace data",hint:"JSON, without secrets",trailing:i.jsx(Bt,{variant:"outline",size:"sm",href:`/api/workspaces/${ce(e.id)}/export`,download:!0,children:"Export"})})})}function S4({user:e,workspace:s,admin:a,sourceCount:l}){const{sessions:c,sessionsLoading:u}=yt(),d=Gr(`/api/workspaces/${ce(s.id)}/connectors`);if(l===null||!d.data||u)return null;const h=[{label:"Add a source",done:l>0,hint:a?void 0:"An owner or admin does this",onClick:()=>document.getElementById("workspace-repositories")?.scrollIntoView({behavior:"smooth"})},{label:"Pair a host",done:d.data.connectors.some(g=>!g.revokedAt&&g.online&&(g.ownerId===e.id||g.workspaceIds.includes(s.id))),link:Qe({name:"settings",section:"hosts"})},{label:"Start a session",done:c.some(g=>g.workspaceId===s.id),link:Qe({name:"new",workspaceId:s.id})}];return h.every(g=>g.done)?null:i.jsx(Oe,{title:"Setup",action:i.jsxs("span",{className:"muted small",children:[h.filter(g=>g.done).length," / ",h.length]}),children:h.map(g=>i.jsx(ae,{leading:i.jsx(as,{tone:g.done?"success":"neutral",label:g.done?"Done":"To do"}),title:g.label,hint:g.done?void 0:g.hint,href:g.done?void 0:g.link,onClick:g.done?void 0:g.onClick,chevron:!g.done},g.label))})}function C4({workspace:e,admin:s,repositories:a,sourceCount:l,loading:c,error:u,refresh:d,documents:h,connections:g,changed:m}){const y=Ne(),b=Ex(s),[v,x]=E.useState(!1),w=(a?.length??0)>=$r.repositories;async function S(I){if(y.busy||!s)return;const q=l===1;await Ge({title:"Remove repository",message:`Remove ${I.fullName} from ${e.name}? Existing sessions keep their pinned snapshots.${q?" With no sources, new sessions, pairing and sharing will be disabled until an owner or admin adds a source.":" This changes new sessions only."}`,confirmLabel:"Remove",destructive:!0})&&y.run(async()=>{await he(`/api/workspaces/${ce(e.id)}/repositories/${ce(I.id)}`,{method:"DELETE"}),d()},"Repository removed. Existing sessions keep their pinned snapshots.")}function T(I,q){y.busy||!s||y.run(async()=>{await he(`/api/workspaces/${ce(e.id)}/repositories/${ce(I.id)}/push-policy`,{method:"PUT",body:{forbidDefaultBranch:!q}}),d()},"Push policy saved.")}function k(I,q){y.busy||!s||y.run(async()=>{await he(`/api/workspaces/${ce(e.id)}/repositories/${ce(I.id)}/lfs`,{method:"PUT",body:{enabled:q}}),d()},q?"Git LFS turned on. New clones download LFS files.":"Git LFS turned off. Clones check out LFS pointer files.")}const z=g?.filter(I=>I.family==="git")??[],A=s&&!!(b.accounts?.length||z.length)&&!w;return i.jsxs(Oe,{bare:!0,title:"Sources",info:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:"What this workspace's sessions work on: Git repositories, which agents clone, and documents (Notion, Google Drive, Dropbox, OneDrive, Feishu/Lark, Tencent Docs), which agents read. Every session in the workspace gets every source, and reads each with its owner's own accounts."}),!s&&i.jsx("p",{children:"Only workspace owners and admins can add or remove sources."}),i.jsx("p",{children:"Changes apply at once, in running sessions too: a removed source can no longer be read, nor a removed repository pushed. To change a ref, remove and re-add the repository."}),i.jsx("p",{children:"Git LFS is off by default, and clones check out LFS pointer files. Turned on, sessions download the repository's LFS files with their owner's own account, where the host has git-lfs installed. Sessions never upload LFS files."}),i.jsx(zh,{})]}),action:A&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",disabled:c||!!u||y.busy,onClick:()=>x(!0),children:"Add repository"}),children:[i.jsxs("div",{className:"stack",id:"workspace-repositories",children:[i.jsx("div",{className:"section-header",children:i.jsx("h3",{className:"section-title",children:"Git repositories"})}),i.jsx("div",{className:"card",children:i.jsxs(dt,{loading:c,error:u,retry:d,children:[a?.length?a.map(I=>i.jsx(ae,{title:I.fullName,hint:i.jsxs(i.Fragment,{children:[Go(I.provider,I.host)," · ",i.jsx("code",{children:I.ref})]}),trailing:i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"inline small",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:!I.forbidDefaultBranchPush,disabled:!s||y.busy,onChange:q=>T(I,q.target.checked)}),"Allow agent pushes to the default branch"]}),i.jsxs("label",{className:"inline small",title:"Sessions download this repository's Git LFS files instead of checking out pointer files",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:I.lfs,disabled:!s||y.busy,onChange:q=>k(I,q.target.checked)}),"Git LFS"]}),I.provider!=="github"&&i.jsx(Sw,{workspaceId:e.id,sourceId:I.id,title:I.fullName,readAs:I.readAs,connection:YO(g,I),admin:s,action:y,changed:m}),i.jsx(Te,{children:I.private?"Private":"Public"}),s&&i.jsx(V,{variant:"outline",size:"sm",disabled:y.busy,"aria-label":`Remove ${I.fullName}`,onClick:()=>{S(I)},children:"Remove"})]})},I.id)):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:s?"No repositories yet":"No repositories yet. Ask a workspace owner or admin to bind one"})}),(y.error||y.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...y})})]})}),s&&b.error&&i.jsx(ke,{variant:"error",title:"Unable to load Git accounts",actions:i.jsx(V,{variant:"outline",size:"sm",onClick:b.refresh,children:"Try again"}),children:b.error}),s&&b.accounts&&!b.accounts.length&&!z.length&&i.jsx(ke,{variant:"warning",title:"No Git accounts connected",actions:i.jsx(Bt,{variant:"outline",size:"sm",href:Qe({name:"settings",section:"profile"}),children:"Open profile"}),children:"Connect GitHub or add a Git account in Settings → Profile before choosing repositories."}),s&&!!b.accounts?.length&&w&&i.jsxs(ke,{variant:"info",title:"Repository limit reached",children:["The workspace has reached its ",$r.repositories,"-repository limit. Remove a binding to choose another."]})]}),h,A&&i.jsx(T4,{open:v,workspace:e,accounts:[...b.accounts??[],...z.map(A4)],repositories:a??[],disabled:c||!!u||y.busy,refresh:d,close:()=>x(!1)})]})}const So="workspace:";function A4(e){return{id:`${So}${e.id}`,provider:e.provider,host:e.host,organization:e.organization,login:e.name,createdAt:e.createdAt}}function T4({open:e,workspace:s,accounts:a,repositories:l,disabled:c,refresh:u,close:d}){const[h,g]=E.useState(""),[m,y]=E.useState(""),[b,v]=E.useState(""),x=a.find(W=>W.id===h)??a[0],w=x?P0(x.provider):!0,S=x?.id.startsWith(So)??!1,T=x?S?`/api/workspaces/${ce(s.id)}/connections/${ce(x.id.slice(So.length))}/repositories`:`/api/git/accounts/${ce(x.id)}/repositories`:null,[k,z]=E.useState(""),[A,I]=E.useState(null),q=Ne(),_=qe(e&&T&&w?T:null),F=Ne(),oe=w?_.data?.repositories.find(W=>W.id===m):A??void 0,ne=W=>l.some(ee=>ee.provider===x?.provider&&ee.host===x.host&&(ee.repositoryId===W.id||ee.fullName.toLowerCase()===W.fullName.toLowerCase())),B=c||F.busy||q.busy||w&&(_.loading||!!_.error)||!x||!oe||ne(oe)||l.length>=$r.repositories,H=x?Hn[x.provider]:"Git";function K(W){y(W),v("")}function re(W){g(W),K(""),z(""),I(null)}function ie(){!x||q.busy||!k.trim()||(I(null),v(""),q.run(async()=>{const W=await he(`${T}?path=${encodeURIComponent(k.trim())}`);I(W.repositories[0]??null)}))}function G(){F.busy||(y(""),v(""),z(""),I(null),d())}function U(W){W.preventDefault(),!(B||!oe||!x)&&F.run(async()=>{await he(`/api/workspaces/${ce(s.id)}/repositories`,{method:"POST",body:{provider:x.provider,host:x.host,repositoryId:oe.id,fullName:oe.fullName,...b.trim()?{ref:b.trim()}:{},...S?{readAs:"workspace"}:{}}}),u(),y(""),v(""),z(""),I(null),d()})}const M=i.jsx(be,{label:"Branch, tag or commit",hint:`Optional. Leave blank to use ${oe?`the default branch, ${oe.defaultBranch}`:"the repository's default branch"}. New sessions pin this ref to a commit; existing sessions never follow branch changes`,children:i.jsx("input",{className:"input",value:b,onChange:W=>v(W.target.value),disabled:c||F.busy||!oe,autoComplete:"off",spellCheck:!1,maxLength:255,placeholder:oe?.defaultBranch??"Repository default branch"})});return i.jsx(an,{open:e,title:"Add repository",onClose:G,footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:F.busy,onClick:G,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"repository-picker-form",disabled:B,children:F.busy?"Binding...":"Bind repository"})]}),children:i.jsxs("form",{id:"repository-picker-form",className:"stack",onSubmit:U,children:[i.jsxs("div",{className:"field",children:[i.jsx("span",{className:"field-label",children:"Account"}),i.jsx(Zt,{label:"Account",placeholder:"Choose an account",value:x?.id??"",disabled:c||F.busy,options:a.map(W=>W.id.startsWith(So)?{value:W.id,label:`Workspace · ${Dr({family:"git",provider:W.provider,host:W.host,organization:W.organization})}`,hint:W.login}:{value:W.id,label:Qd(W),hint:W.login}),onChange:re})]}),S&&i.jsxs("p",{className:"muted small",children:["Sessions read this repository with the workspace's connection (",x?.login,"), not their owner's account. Pushes still use the session owner's account or the workspace's push access"]}),w?i.jsxs("p",{className:"muted small",children:["Only repositories this ",H," account can access are listed. Sessions read them with their owner's own account for the same provider. Never paste a token or clone URL"]}):i.jsxs("p",{className:"muted small",children:["A Git server lists no repositories: enter the one to add. Pikibun reads it with this ",S?"connection":"account"," to check it",S?"":", and sessions read it with their owner's own account for the same server",". Never paste a token"]}),!w&&x&&i.jsxs(i.Fragment,{children:[i.jsx(be,{label:"Clone URL or path",hint:`The repository's https:// clone URL on ${x.host}, or its path there, such as team/project.git`,children:i.jsxs("span",{className:"lookup-row",children:[i.jsx("input",{className:"input",value:k,onChange:W=>{z(W.target.value),I(null)},onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),ie())},disabled:c||F.busy||q.busy,autoComplete:"off",spellCheck:!1,maxLength:600,placeholder:`https://${x.host}/team/project.git`}),i.jsx(V,{variant:"outline",size:"sm",disabled:c||F.busy||q.busy||!k.trim(),onClick:ie,children:q.busy?"Checking...":"Look up"})]})}),A&&i.jsx(ae,{leading:i.jsx(ve,{name:"git-branch",size:16}),title:A.fullName,hint:`${A.private?"Private":"Public"} · default branch ${A.defaultBranch}${ne(A)?" · Already configured":""}`}),i.jsx(Ce,{error:q.error}),A&&M]}),w&&i.jsx(dt,{..._,retry:_.refresh,children:_.data?.repositories.length?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field",children:[i.jsxs("span",{className:"field-label",children:[H," repository"]}),i.jsx(Zt,{label:`${H} repository`,placeholder:"Choose a repository",value:oe?.id??"",disabled:c||F.busy,options:_.data.repositories.map(W=>({value:W.id,label:W.fullName,disabled:ne(W),hint:`${W.private?"Private":"Public"}${ne(W)?" · Already configured":""}`})),onChange:K}),_.data.truncated&&i.jsxs("span",{className:"field-hint",children:["Only the first ",$r.pickerRepositories.toLocaleString()," repositories this account can access are listed"]})]}),M]}):i.jsxs(jt,{title:"No repositories found",children:["Check your ",H," account and organization access"]})}),_.error&&i.jsxs("p",{className:"muted small",children:["Review your ",i.jsx("a",{href:Qe({name:"settings",section:"profile"}),children:"Git accounts"})," and repository access, then retry. An owner or admin with access can also configure this workspace"]}),i.jsx(Ce,{error:F.error})]})})}function N4({workspace:e,admin:s,owner:a}){const l=`/api/workspaces/${ce(e.id)}/members`,c=qe(l),[u,d]=E.useState(!1),[h,g]=E.useState(null),m=Ne();async function y(b){await Ge({title:"Remove member",message:`Remove ${Mt(zi(b))} from this workspace?`,confirmLabel:"Remove",destructive:!0})&&m.run(async()=>{await he(`${l}/${ce(b.userId)}`,{method:"DELETE"}),c.refresh()},"Membership removed.")}return i.jsxs(i.Fragment,{children:[i.jsx(Oe,{title:"Members",info:i.jsxs("div",{className:"stack",children:[!s&&i.jsx("p",{children:"Only workspace owners and admins can manage membership."}),i.jsx("p",{children:"Every role can follow workspace-visible sessions, which shows prompts, tool output and repository content in the transcript."}),i.jsxs("ul",{children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Viewer"}),": follows them read-only and can't start sessions, whatever a session grants."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Member"}),": starts sessions, and follows other people's read-only unless they grant more."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Collaborator"}),": starts sessions, and sends messages to any workspace-visible session."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Admin"}),": a collaborator who also manages the workspace and every session in it, private ones included. Only the owner manages admins."]})]}),i.jsx("p",{children:"Opening someone else's private session takes a session role, except for the owner and admins. Approving tool calls takes one from the session's owner whatever the role."}),i.jsx("p",{children:"Membership never grants GitHub access, tool execution, or use of anyone's private Pi host."})]}),action:s&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d(!0),children:"Add member"}),children:i.jsxs(dt,{...c,retry:c.refresh,children:[c.data?.members.length?c.data.members.map(b=>{const v=zi(b),x=b.displayName||qo(v);return i.jsx(ae,{leading:i.jsx(Ei,{name:x,id:b.userId}),title:x,hint:Mt(v),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Te,{tone:b.role==="owner"||b.role==="admin"?"success":"neutral",children:Ls[b.role]}),s&&b.userId!==e.ownerId&&(a||ax.includes(b.role))&&i.jsx(Kn,{label:`Actions for ${x}`,items:[{label:"Change role",icon:"shield",disabled:m.busy,onSelect:()=>g(b)},{label:"Remove",icon:"trash",destructive:!0,disabled:m.busy,onSelect:()=>{y(b)}}]})]})},b.userId)}):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:"No members to display"})}),(m.error||m.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...m})})]})}),s&&i.jsx(E4,{workspace:e}),s&&i.jsx(z4,{workspace:e,owner:a,accepted:c.refresh}),s&&i.jsx(R4,{open:u,path:l,owner:a,close:()=>d(!1),saved:c.refresh}),s&&h&&i.jsx(O4,{member:h,path:l,owner:a,close:()=>g(null),saved:c.refresh},h.userId)]})}function E4({workspace:e}){const s=`/api/workspaces/${ce(e.id)}/invite-link`,a=qe(s),l=Ne(),c=a.data?.link;function u(){l.busy||l.run(async()=>{a.setData(await he(s,{method:"PUT"}))},"Invite link created. Share it with the people you want to invite.")}async function d(h){l.busy||!await Ge(h?{title:"Replace the invite link?",message:"The current link stops working at once, and a new one replaces it. People already waiting to join stay pending.",confirmLabel:"Replace link",destructive:!0}:{title:"Turn off the invite link?",message:"The link stops working at once, for everyone who has it. People already waiting to join stay pending until you accept or decline them. Turning the link on again creates a new link.",confirmLabel:"Turn off link",destructive:!0})||l.run(async()=>{await he(s,{method:"DELETE"}),a.setData(h?await he(s,{method:"PUT"}):{link:null})},h?"Invite link replaced. The old link no longer works.":"Invite link turned off.")}return i.jsx(Oe,{title:"Invite link",info:i.jsxs("div",{className:"stack",children:[i.jsxs("p",{children:["Share this link with anyone. When someone signed in to this Pikibun server opens it, they can ask to join, and appear under ",i.jsx("strong",{children:"Pending members"}),"."]}),i.jsx("p",{children:"A pending member can't see or do anything in the workspace until an owner or admin accepts them with a role. Anyone with the link can ask, so only accept people you recognize."})]}),action:c?i.jsx(Kn,{label:"Invite link actions",items:[{label:"Replace link",icon:"refresh",disabled:l.busy,onSelect:()=>{d(!0)}},{label:"Turn off link",icon:"trash",destructive:!0,disabled:l.busy,onSelect:()=>{d(!1)}}]}):a.data&&i.jsx(V,{variant:"outline",size:"sm",icon:"plus",disabled:l.busy,onClick:u,children:"Create link"}),children:i.jsxs(dt,{...a,retry:a.refresh,children:[c?i.jsx(Re,{children:i.jsx(be,{label:"Invite link",hint:i.jsxs(i.Fragment,{children:["Created ",i.jsx(Zn,{value:c.createdAt}),". Anyone who opens it can ask to join"]}),children:i.jsx(Vn,{value:c.url,label:"Copy invite link"})})}):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:"No invite link. Create one to let people ask to join"})}),(l.error||l.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...l})})]})})}function z4({workspace:e,owner:s,accepted:a}){const l=`/api/workspaces/${ce(e.id)}/join-requests`,c=qe(l),u=Ne(),[d,h]=E.useState({}),g=tf(s),m=c.data?.requests??[];function y(v,x){if(u.busy)return;const w=d[v.userId]??"member";u.run(async()=>{c.setData(await he(`${l}/${ce(v.userId)}/accept`,{method:"POST",body:{role:w}})),a()},`${x} joined as ${Ls[w].toLowerCase()}.`)}async function b(v,x){u.busy||!await Ge({title:"Decline request",message:`Decline ${x}'s request to join? They can ask again while they have a working invite link.`,confirmLabel:"Decline",destructive:!0})||u.run(async()=>{c.setData(await he(`${l}/${ce(v.userId)}`,{method:"DELETE"}))},"Request declined.")}return i.jsx(Oe,{title:"Pending members",info:i.jsx("p",{children:"People who asked to join through the invite link. Choose a role and accept them, or decline. Until then they can't see or do anything in the workspace."}),action:i.jsx(V,{variant:"ghost",size:"sm",icon:"refresh","aria-label":"Refresh pending members",disabled:c.loading,onClick:c.refresh}),children:i.jsxs(dt,{...c,retry:c.refresh,children:[m.length?m.map(v=>{const x=zi({...v,role:"member"}),w=v.displayName||qo(x),S=d[v.userId]??"member";return i.jsx(ae,{leading:i.jsx(Ei,{name:w,id:v.userId}),title:w,hint:i.jsxs(i.Fragment,{children:[Mt(x)," · asked ",i.jsx(Zn,{value:v.createdAt})]}),trailing:i.jsxs(i.Fragment,{children:[i.jsx("select",{className:"select","aria-label":`Role for ${w}`,value:S,disabled:u.busy,title:ef[S],onChange:T=>h(k=>({...k,[v.userId]:T.target.value})),children:g.map(T=>i.jsx("option",{value:T,children:Ls[T]},T))}),i.jsx(V,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>y(v,w),children:"Accept"}),i.jsx(V,{variant:"ghost",size:"sm",disabled:u.busy,"aria-label":`Decline ${w}`,onClick:()=>{b(v,w)},children:"Decline"})]})},v.userId)}):i.jsx(Re,{children:i.jsx("span",{className:"muted",children:"Nobody is waiting to join"})}),(u.error||u.notice)&&i.jsx(Re,{children:i.jsx(Ce,{...u})})]})})}function tf(e){return m0.filter(s=>e||ax.includes(s))}function O4({member:e,path:s,owner:a,close:l,saved:c}){const u=e.role==="owner"?null:e.role,[d,h]=E.useState(u??"member"),g=tf(a),m=Ne(),y=e.displayName||qo(zi(e));function b(v){v.preventDefault(),!(m.busy||d===u)&&m.run(async()=>{await he(`${s}/${ce(e.userId)}`,{method:"PATCH",body:{role:d}}),c(),l()})}return i.jsx(an,{open:!0,title:`Change role of ${y}`,onClose:()=>{m.busy||l()},footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:m.busy,onClick:l,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"change-role-form",disabled:m.busy||d===u,children:m.busy?"Saving...":"Save"})]}),children:i.jsxs("form",{id:"change-role-form",className:"stack",onSubmit:b,children:[i.jsx(be,{label:"Role",hint:`${ef[d]}. Takes effect at once, in their open sessions too`,children:i.jsx("select",{className:"select",autoFocus:!0,value:d,onChange:v=>h(v.target.value),children:g.map(v=>i.jsxs("option",{value:v,children:[Ls[v],v===u?" (current)":""]},v))})}),i.jsx(Ce,{error:m.error})]})})}function R4({open:e,path:s,owner:a,close:l,saved:c}){const[u,d]=E.useState(""),[h,g]=E.useState("member"),m=tf(a),y=Ne();function b(v){v.preventDefault(),!(y.busy||!u.trim())&&y.run(async()=>{await he(s,{method:"POST",body:{userId:Vd(u),role:h}}),d(""),c(),l()})}return i.jsx(an,{open:e,title:"Add member",onClose:()=>{y.busy||l()},footer:i.jsxs(i.Fragment,{children:[i.jsx(V,{disabled:y.busy,onClick:l,children:"Cancel"}),i.jsx(V,{variant:"default",type:"submit",form:"add-member-form",disabled:y.busy||!u.trim(),children:y.busy?"Saving...":"Save"})]}),children:i.jsxs("form",{id:"add-member-form",className:"stack",onSubmit:b,children:[i.jsx(be,{label:"User ID",hint:"Copy it from their profile. To change an existing member's role, use Change role in their menu",children:i.jsx("input",{className:"input",required:!0,autoFocus:!0,value:u,onChange:v=>d(v.target.value),placeholder:"User ID",autoComplete:"off",spellCheck:!1})}),i.jsx(be,{label:"Role",hint:ef[h],children:i.jsx("select",{className:"select",value:h,onChange:v=>g(v.target.value),children:m.map(v=>i.jsx("option",{value:v,children:Ls[v]},v))})}),i.jsx(Ce,{error:y.error})]})})}const D4=[{id:"profile",label:"Profile",icon:"user"},{id:"hosts",label:"Hosts",icon:"server"},{id:"workspaces",label:"Workspaces",icon:"users"},{id:"appearance",label:"Appearance",icon:"palette"},{id:"admin",label:"Administration",icon:"shield",admin:!0}];function M4({section:e,id:s}){const{user:a}=yt(),l=D4.filter(u=>!u.admin||a.instanceAdmin),c=l.find(u=>u.id===e)??l[0];return i.jsxs("div",{className:"settings-shell",children:[i.jsxs("nav",{className:"settings-list","aria-label":"Settings",children:[i.jsx("div",{className:"settings-list-title",children:"Settings"}),l.map(u=>i.jsxs("a",{className:"nav-item",href:Qe({name:"settings",section:u.id}),"aria-current":u.id===c.id?"page":void 0,children:[i.jsx(ve,{name:u.icon}),i.jsx("span",{className:"label",children:u.label})]},u.id))]}),i.jsxs("div",{className:"settings-detail",children:[i.jsx(Uo,{title:c.label}),i.jsx("div",{className:"content-column",children:c.id==="profile"?i.jsx(i4,{}):c.id==="hosts"?i.jsx(RO,{id:s}):c.id==="workspaces"?i.jsx(w4,{id:s}):c.id==="admin"?i.jsx(pO,{}):i.jsx(gO,{})})]})]})}const go={busyMs:3e3,idleMs:15e3,firstBackoffMs:5e3,maxBackoffMs:6e4};function L4(e){const[s,a]=E.useState({session:null,view:null,error:"",invalid:!1});return E.useEffect(()=>{const l=new AbortController,c={"X-Share-Token":e};let u,d=!1,h=0,g=!1;function m(){if(clearTimeout(u),l.signal.aborted||document.hidden)return;const v=h?Math.min(go.maxBackoffMs,go.firstBackoffMs*2**(h-1)):g?go.busyMs:go.idleMs;u=setTimeout(()=>{y()},v)}async function y(){if(!(l.signal.aborted||d)){d=!0,clearTimeout(u);try{const{session:v}=await he("/api/shared",{signal:l.signal,headers:c});if(l.signal.aborted)return;a(w=>({...w,session:v}));const{view:x}=await he("/api/shared/view",{signal:l.signal,headers:c});if(l.signal.aborted)return;g=x.busy,h=0,a(w=>({...w,view:x,error:""}))}catch(v){if(l.signal.aborted)return;if(v instanceof Pn&&v.status===404&&v.code==="not_found"){a({session:null,view:null,error:"",invalid:!0});return}h++,a(x=>({...x,error:Sn(v)}))}finally{d=!1}m()}}function b(){document.hidden?clearTimeout(u):y()}return document.addEventListener("visibilitychange",b),y(),()=>{l.abort(),clearTimeout(u),document.removeEventListener("visibilitychange",b)}},[e]),s}function _4({provider:e,modelId:s,status:a}){const l=e??"the provider";return a===401||a===403?`The host's Pi credentials for ${l} were rejected.`:a===429?`Rate limited by ${l}.`:a!==void 0&&a>=500&&a<600?`${l} was unavailable.`:`The request to ${[e,s].filter(Boolean).join("/")||"the model"} failed${a?` (HTTP ${a})`:""}`}function Xb({role:e,icon:s,label:a,text:l,trimmed:c}){return i.jsxs("details",{className:"entry-tool","data-role":e,children:[i.jsxs("summary",{children:[i.jsx(ve,{name:s,size:14}),i.jsx("span",{className:"truncate",children:a}),i.jsx(ve,{name:"chevron-right",size:14})]}),i.jsx("pre",{children:l}),c&&i.jsxs("p",{className:"muted small entry-brief",children:["Brief tool output · ",c.lines===1?"1 line":`${c.lines.toLocaleString()} lines`,", ",c.chars.toLocaleString()," characters in full."]})]})}function U4({entry:e}){const{prose:s,calls:a}=e.role==="assistant"?Fo(e.text):{prose:e.text,calls:[]},l=a.length>0&&`Tool · ${a[0].name}`;if(e.kind==="workspace.run-stopped")return i.jsx("div",{className:"entry-stopped",role:"note",children:i.jsx("span",{children:"Stopped"})});if(e.kind==="workspace.run-crashed")return i.jsx("div",{className:"entry-stopped",role:"note",children:i.jsx("span",{children:e.text})});if(l&&!s.trim()||e.role==="system"||e.role==="toolResult"){const u=l||(e.role==="toolResult"?"Tool result":"System"),d=e.role==="toolResult"&&e.durationMs!==void 0&&i.jsxs(i.Fragment,{children:[" · ",i.jsx("span",{title:"How long the tool ran",children:To(e.durationMs)})]}),h=e.trimmed&&e.role==="toolResult"&&e.text.trim()?i.jsxs("span",{className:"muted",children:[" · ",e.text]}):null;return i.jsx(Xb,{role:e.role,icon:l?"tool":"terminal",label:i.jsxs(i.Fragment,{children:[u,d,h]}),text:e.text,trimmed:e.trimmed})}if(e.error)return e.error.compaction?i.jsx("div",{className:"entry-error",title:e.kind,children:i.jsx(ke,{variant:"error",title:lw,children:ow(e.error.compaction,{advice:!1})})}):i.jsx("div",{className:"entry-error",title:e.kind,children:i.jsx(ke,{variant:"error",title:"Model request failed",children:_4(e.error)})});if(e.role==="user")return i.jsx("div",{className:"entry-user",title:e.kind,children:i.jsx("div",{className:"entry-bubble",children:e.text})});const c=e.durationMs!==void 0&&i.jsx("span",{title:"How long the model took to reply",children:To(e.durationMs)});return i.jsxs("div",{className:"entry-assistant","data-role":e.role,title:e.kind,children:[i.jsx(Bv,{text:s}),l&&i.jsx(Xb,{icon:"tool",label:l,text:a.map(u=>u.line).join(`
53
- `),trimmed:e.trimmed}),c&&i.jsx("div",{className:"entry-actor",children:c})]})}function B4({token:e}){const{session:s,view:a,error:l,invalid:c}=L4(e),u=E.useRef(null),d=E.useRef(!0),h=(a?.entries??[]).filter(b=>b.role!=="system"||b.text.trim()),g=h.at(-1)?.id,m=s?.title;if(E.useEffect(()=>{document.title=m?`${m} · Pikibun`:"Shared session · Pikibun"},[m]),E.useLayoutEffect(()=>{const b=u.current;b&&d.current&&(b.scrollTop=b.scrollHeight)},[g,h.length]),c||!s)return!c&&!l?i.jsx(ai,{}):i.jsx("div",{className:"welcome",children:i.jsxs("main",{id:"main-content",className:"welcome-inner",tabIndex:-1,children:[i.jsx(ka,{size:40}),i.jsx("h1",{children:c?"This link doesn't work":"Can't open this session right now"}),c?i.jsx("p",{children:"The session's owner may have turned the link off. Ask them for a new one."}):i.jsxs(ke,{variant:"error",title:"Couldn't load the shared session",children:[l," This page keeps trying."]})]})});const y=l?i.jsx(Te,{tone:"warning",dot:!0,children:"Reconnecting"}):a?a.busy?i.jsx(Te,{tone:"running",dot:!0,children:"Working"}):s.status==="archived"?i.jsx(Te,{tone:"neutral",children:"Archived"}):i.jsx(Te,{tone:"success",dot:!0,children:"Live"}):i.jsx(Te,{tone:"neutral",dot:!0,children:"Connecting"});return i.jsxs("div",{className:"shared-screen",children:[i.jsx(Uo,{leading:i.jsx(ka,{size:22}),title:s.title,subtitle:`Shared by ${s.ownerName}`,actions:i.jsxs("span",{className:"session-badges",children:[y,i.jsx(Te,{children:"Read-only"})]})}),l&&a&&i.jsx("div",{className:"session-alerts",children:i.jsxs(ke,{variant:"warning",role:"status",title:"Can't refresh right now",children:[l," This page keeps trying and shows the last view it received."]})}),i.jsx("main",{id:"main-content",className:"session-transcript",ref:u,tabIndex:-1,"aria-label":"Shared session history",onScroll:b=>{const v=b.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<80},children:i.jsx("div",{className:"chat-column",children:a?h.length?h.map(b=>i.jsx(U4,{entry:b},b.id)):i.jsx(jt,{title:"The conversation begins here",children:"Messages and tool results appear here as the work goes on"}):l?i.jsx(jt,{title:"The conversation isn't available right now",children:"The session's host may be offline. This page keeps trying."}):i.jsx(ai,{})})}),i.jsx("footer",{className:"shared-status",children:i.jsxs("div",{className:"chat-column",children:[a?.busy?i.jsxs(i.Fragment,{children:[i.jsx(Os,{}),"Working..."]}):a?"Idle":null,a&&i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsxs("span",{children:["Read-only, shared by link · Started ",i.jsx(Kt,{value:s.createdAt})]})]})})]})}const Fd=6,Nw="pikibun.collapsedWorkspaces";function H4(){try{return JSON.parse(localStorage.getItem(Nw)??"[]")}catch{return[]}}function I4({workspace:e,sessions:s,route:a,collapsed:l,toggle:c,onNavigate:u}){const{user:d,selectWorkspace:h,liveActivity:g}=yt(),[m,y]=E.useState(!1),b=dw(s),v=m?b:b.slice(0,Fd),x=Qe({name:"new",workspaceId:e.id});return i.jsxs("div",{className:"workspace-group",children:[i.jsxs("div",{className:"workspace-row",children:[i.jsxs("button",{type:"button",className:"nav-item",onClick:c,"aria-expanded":!l,title:e.name,children:[i.jsx(Ei,{name:e.name,id:e.id}),i.jsx("span",{className:"label",children:e.name})]}),i.jsxs("div",{className:"row-actions",children:[Ir(e.role)&&i.jsx("a",{className:"btn ghost xs icon-only",href:x,"aria-label":`New session in ${e.name}`,title:"New session",onClick:()=>{h(e.id),u()},children:i.jsx(ve,{name:"plus",size:14})}),i.jsx(Kn,{label:`${e.name} options`,items:[...Ir(e.role)?[{label:"New session",icon:"plus",onSelect:()=>{h(e.id),window.location.hash=x,u()}}]:[],{label:"Workspace settings",icon:"settings",onSelect:()=>{window.location.hash=Qe({name:"settings",section:"workspaces",id:e.id}),u()}}]})]})]}),!l&&i.jsxs("ul",{children:[v.map(({session:w,depth:S})=>{const T=a.name==="session"&&a.sessionId===w.id,k=w.ownerId===d.id?null:w.permissions?.every(A=>A==="read")?"Viewer":"Shared",z=uw(w,g?.sessionId===w.id?g.activity:void 0);return i.jsx("li",{style:S?{marginLeft:S*12}:void 0,children:i.jsxs("a",{className:"nav-item session-item",href:Qe({name:"session",sessionId:w.id}),"aria-current":T?"page":void 0,onClick:()=>{h(e.id),u()},children:[i.jsx(as,{tone:z.tone,icon:z.icon,label:z.label?void 0:w.status}),i.jsxs("span",{className:"label",children:[i.jsxs("span",{className:"title",children:[S>0&&i.jsx("span",{className:"muted","aria-label":"Started by the session above",children:"↳ "}),w.title]}),(z.label||w.pullRequest||k)&&i.jsx("span",{className:"sub",children:[z.label&&i.jsx("span",{className:`session-status ${z.tone}`,children:z.label},"status"),w.pullRequest&&i.jsx(qv,{pull:w.pullRequest},"pull"),k].filter(Boolean).flatMap((A,I)=>I?[" · ",A]:[A])})]}),i.jsx("span",{className:"meta",children:i.jsx(Zn,{value:w.createdAt})})]})},w.id)}),s.length>Fd&&i.jsx("li",{children:i.jsx("button",{type:"button",className:"nav-item sidebar-more",onClick:()=>y(w=>!w),children:i.jsx("span",{className:"label muted",children:m?"Show less":`Show ${s.length-Fd} more`})})}),!s.length&&i.jsx("li",{children:i.jsx("a",{className:"nav-item session-item",href:x,onClick:()=>{h(e.id),u()},children:i.jsx("span",{className:"label muted",children:"Start a session"})})})]})]})}function $4({route:e,onNavigate:s}){const{user:a,workspaces:l,workspacesLoading:c,workspacesError:u,sessions:d,sessionsLoading:h,currentWorkspace:g}=yt(),[m,y]=E.useState(!1),[b,v]=E.useState(H4);function x(S){v(T=>{const k=T.includes(S)?T.filter(z=>z!==S):[...T,S];try{localStorage.setItem(Nw,JSON.stringify(k))}catch{}return k})}const w=g&&Ir(g.role)?Qe({name:"new",workspaceId:g.id}):void 0;return i.jsxs("aside",{className:"sidebar","aria-label":"Workspaces and sessions",children:[i.jsxs("div",{className:"sidebar-top",children:[i.jsxs("a",{className:"nav-item",href:"#/",onClick:s,children:[i.jsx(ka,{size:20}),i.jsx("span",{className:"label",style:{color:"var(--foreground)",fontWeight:500},children:"Pikibun"})]}),w&&i.jsxs("a",{className:"nav-item",href:w,onClick:s,"aria-current":e.name==="new"?"page":void 0,children:[i.jsx(ve,{name:"plus"}),i.jsx("span",{className:"label",children:"New session"})]}),i.jsxs("a",{className:"nav-item",href:Qe({name:"sessions"}),onClick:s,"aria-current":e.name==="sessions"?"page":void 0,children:[i.jsx(ve,{name:"history"}),i.jsx("span",{className:"label",children:"Sessions"})]})]}),i.jsxs("nav",{className:"sidebar-scroll","aria-label":"Workspaces",children:[c?i.jsx("div",{style:{padding:8},children:i.jsx(Ht,{})}):u?i.jsx("p",{className:"field-error",style:{padding:8},children:u}):l.length?l.map(S=>i.jsx(I4,{workspace:S,route:e,onNavigate:s,sessions:d.filter(T=>T.workspaceId===S.id&&(T.status!=="archived"||e.name==="session"&&e.sessionId===T.id)),collapsed:b.includes(S.id),toggle:()=>x(S.id)},S.id)):i.jsxs("div",{className:"empty-card",children:[i.jsx("div",{className:"title",children:"No workspaces yet"}),i.jsx("div",{className:"description",children:"A workspace groups people, repositories, hosts and sessions."}),i.jsx("button",{type:"button",className:"btn secondary xs",onClick:()=>y(!0),children:"New workspace"})]}),h&&l.length>0&&i.jsx("div",{style:{padding:8},children:i.jsx(Ht,{children:"Loading sessions..."})}),!c&&l.length>0&&i.jsxs("button",{type:"button",className:"nav-item",style:{marginTop:12},onClick:()=>y(!0),children:[i.jsx(ve,{name:"plus",size:14}),i.jsx("span",{className:"label",children:"New workspace"})]})]}),i.jsxs("div",{className:"sidebar-footer",children:[i.jsxs("a",{className:"nav-item host-chip",href:Qe({name:"settings",section:"profile"}),onClick:s,title:a.displayName,children:[i.jsx(Ei,{name:a.displayName,id:a.id}),i.jsx("span",{className:"label",children:a.githubLogin?`@${a.githubLogin}`:a.displayName})]}),i.jsx("a",{className:"btn ghost sm icon-only",href:Qe({name:"settings",section:"hosts"}),onClick:s,"aria-label":"Hosts",title:"Hosts",children:i.jsx(ve,{name:"server"})}),i.jsx("a",{className:"btn ghost sm icon-only",href:Qe({name:"settings",section:"profile"}),onClick:s,"aria-label":"Settings",title:"Settings","aria-current":e.name==="settings"?"page":void 0,children:i.jsx(ve,{name:"settings"})})]}),i.jsx(Oh,{open:m,onClose:()=>{y(!1),s()}})]})}mh();r0();const Ew=i.jsx("a",{href:"#main-content",className:"btn secondary sm skip-link",onClick:e=>{e.preventDefault(),document.getElementById("main-content")?.focus()},children:"Skip to content"});function q4(e){switch(e.name){case"home":return"Pikibun";case"sessions":return"Sessions · Pikibun";case"new":return"New session · Pikibun";case"session":return"Session · Pikibun";case"settings":return"Settings · Pikibun";case"shared":return"Shared session · Pikibun";case"join":return"Join workspace · Pikibun"}}function G4({error:e,retry:s,inviteToken:a}){const l=a!==void 0,c=qe("/api/health"),[u,d]=E.useState(!1),[h,g]=E.useState(""),m=new URLSearchParams(window.location.search).get("error"),y=e||c.error||h||(m?`GitHub sign-in did not complete: ${m.slice(0,300)}`:""),b=c.data?.githubConfigured===!1,v=c.data?.passwordAuth===!0,x=b&&!v,w=c.data?.localServer,S=[...!b&&!w?[c.data?.githubSignup??"open"]:[],...v?[c.data?.passwordSignup??"off"]:[]],T=l||!c.data||S.includes("open")?"":S.includes("invite")?"New here? Open the invite link a workspace owner or admin shared with you to create an account.":"This Pikibun doesn't take new accounts. If you have one, sign in.";async function k(z){if(a!==void 0){z.preventDefault(),d(!0),g("");try{const A=await fetch("/api/auth/github/start",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({inviteToken:a})}),I=await A.json().catch(()=>null);if(!A.ok||typeof I?.url!="string")throw new Error(typeof I?.error=="string"?I.error:`GitHub sign-in could not start (HTTP ${A.status}).`);window.location.assign(I.url)}catch(A){g(A instanceof Error?A.message:"GitHub sign-in could not start."),d(!1)}}}return i.jsxs("div",{className:"welcome",children:[Ew,i.jsxs("main",{id:"main-content",className:"welcome-inner",tabIndex:-1,children:[i.jsx(ka,{size:40}),i.jsx("h1",{children:"Pikibun"}),i.jsx("p",{children:"Run Pi agents on your own machine, and work on them together with your team."}),l&&i.jsx(ke,{variant:"info",title:"You're invited to a workspace",role:"status",children:"Sign in to ask to join it. An owner or admin accepts you before you can see anything in it."}),y&&i.jsx(ke,{variant:"error",title:"Sign-in problem",children:y}),x&&(w?i.jsxs(ke,{variant:"warning",title:"GitHub sign-in is not set up",children:["This Pikibun runs on this computer and needs a GitHub OAuth app of yours to sign you in. Add one where you started it: run ",i.jsx("code",{children:"pikibun serve"})," again in a terminal, which shows how, or use the Pikibun app's Settings."]}):i.jsx(ke,{variant:"warning",title:"GitHub sign-in is not configured",children:"The operator needs to configure the GitHub OAuth app, its callback URL and the server's GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET and VAULT_KEY settings."})),!x&&w&&!w.claimed&&i.jsxs(ke,{variant:"info",title:"Set up this Pikibun",role:"status",children:["This Pikibun runs on this computer and has no owner yet. Sign in with the link ",i.jsx("code",{children:"pikibun serve"})," printed when it started, or from the Pikibun app, which opens it for you: your GitHub account becomes its owner, and the only one that can sign in."]}),i.jsxs("div",{className:"actions",children:[v&&i.jsx(e1,{signedIn:s,signup:c.data?.passwordSignup??"off",inviteToken:a}),v&&!b&&i.jsx("div",{className:"sign-in-divider",role:"separator",children:"or"}),!b&&i.jsxs("a",{className:"btn default lg",href:"/api/auth/github","aria-disabled":u,onClick:z=>{k(z)},children:[i.jsx(Ao,{}),"Continue with GitHub"]}),T&&i.jsx("p",{className:"welcome-footnote",children:T}),(y||x)&&i.jsx(V,{onClick:()=>{s(),c.refresh()},children:"Try again"})]}),i.jsxs("p",{className:"welcome-footnote",children:["Model credentials stay on your host. GitHub tokens stay on the server, or go only to your own hosts when you push with your account.",v&&!b&&" Repositories on github.com need the GitHub sign-in; a password account reaches other Git providers with their tokens."]})]})]})}function F4(){const{workspaces:e,workspacesLoading:s,workspacesError:a,refreshWorkspaces:l,currentWorkspace:c}=yt(),[u,d]=E.useState(!1);return s?i.jsx(ai,{}):a?i.jsx("div",{className:"content-column",children:i.jsx(ke,{variant:"error",title:"Could not load workspaces",actions:i.jsx(V,{size:"sm",onClick:l,children:"Try again"}),children:a})}):c?i.jsx(zx,{workspaceId:c.id},c.id):i.jsxs("div",{className:"welcome",children:[i.jsxs("div",{className:"welcome-inner",children:[i.jsx(ka,{size:40}),i.jsx("h1",{children:"Welcome to Pikibun"}),i.jsx("p",{children:"Create a workspace for your team, add a repository and pair a host to start your first session."}),i.jsx("div",{className:"actions",children:i.jsx(V,{variant:"default",size:"lg",onClick:()=>d(!0),children:"New workspace"})}),i.jsx("p",{className:"welcome-footnote",children:"Joining a team? Open the invite link an owner or admin shared, or ask them to add you with your User ID from Settings."}),i.jsx(kh,{})]}),i.jsx(Oh,{open:u,onClose:()=>d(!1)})]})}function Y4(){const e=jh(),[s,a]=E.useState(!1);E.useEffect(()=>{document.title=q4(e)},[e]),E.useEffect(()=>{document.getElementById("main-content")?.scrollTo({top:0})},[e]),E.useEffect(()=>{const u=u0();u&&e.name!=="join"&&rs({name:"join",token:u})},[]);const l=e.name==="session"?i.jsx(oO,{sessionId:e.sessionId},e.sessionId):e.name==="join"?i.jsx(h0,{token:e.token},e.token):e.name==="new"?i.jsx(zx,{workspaceId:e.workspaceId},e.workspaceId):e.name==="sessions"?i.jsx(fO,{}):e.name==="settings"?i.jsx(M4,{section:e.section,id:e.id},`${e.section}/${e.id??""}`):i.jsx(F4,{}),c=e.name==="session";return i.jsx($E,{value:{open:()=>a(!0),expanded:s},children:i.jsxs("div",{className:`app${s?" sidebar-open":""}${c?" own-header":""}`,children:[Ew,i.jsxs("header",{className:"mobile-header",children:[i.jsx("button",{type:"button",className:"btn ghost sm icon-only","aria-label":"Open navigation","aria-expanded":s,onClick:()=>a(!0),children:i.jsx(ve,{name:"menu"})}),i.jsx("span",{className:"screen-title",children:"Pikibun"})]}),i.jsx($4,{route:e,onNavigate:()=>a(!1)}),i.jsx("div",{className:"scrim",onClick:()=>a(!1),"aria-hidden":"true"}),i.jsx("main",{id:"main-content",className:`main${e.name==="session"?" no-scroll":""}`,tabIndex:-1,children:l})]})})}function P4(){const[e,s]=E.useState(null),[a,l]=E.useState(!0),[c,u]=E.useState(""),[d,h]=E.useState(0);E.useEffect(()=>{const y=new AbortController;return l(!0),u(""),he("/api/me",{signal:y.signal}).then(b=>{y.signal.aborted||s(b.user)}).catch(b=>{y.signal.aborted||(s(null),b instanceof Pn&&b.status===401||u(Sn(b)))}).finally(()=>{y.signal.aborted||l(!1)}),()=>y.abort()},[d]);async function g(){try{await he("/api/auth/logout",{method:"POST"})}catch(y){u(Sn(y));return}s(null),rs({name:"home"})}const m=jh();return E.useEffect(()=>{!a&&!e&&m.name==="join"&&c0(m.token)},[a,e,m]),a?i.jsx(ai,{}):e?i.jsx(l0,{user:e,setUser:s,signOut:()=>{g()},children:i.jsx(Y4,{})},e.id):i.jsx(G4,{error:c,retry:()=>h(y=>y+1),inviteToken:m.name==="join"?m.token:void 0})}function V4(){mw();const e=jh();return e.name==="shared"?i.jsx(B4,{token:e.token},e.token):i.jsx(P4,{})}const zw=document.getElementById("root");if(!zw)throw new Error("Application root is missing.");Wb.createRoot(zw).render(i.jsx(E.StrictMode,{children:i.jsx(V4,{})}));export{Kb as g};