pikibun 0.20.0 → 0.22.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.
- package/README.md +15 -6
- package/dist/chunks/{chunk-BVKSJ7PV.js → chunk-KOZ2NZL7.js} +4590 -3062
- package/dist/chunks/{cli-W7LFSBCE.js → cli-OGQRYOKN.js} +2523 -1644
- package/dist/cli.js +114 -5
- package/dist/migrations/postgres/0038_workspace_attachments.sql +11 -0
- package/dist/migrations/postgres/0039_extensions.sql +54 -0
- package/dist/migrations/postgres/0040_child_session_settings.sql +12 -0
- package/dist/migrations/postgres/0040_host_builtin_extensions.sql +5 -0
- package/dist/migrations/postgres/0040_notifications.sql +47 -0
- package/dist/migrations/postgres/0041_piki_extensions.sql +32 -0
- package/dist/migrations/postgres/0042_default_extensions.sql +23 -0
- package/dist/migrations/postgres/0043_host_required_extensions.sql +6 -0
- package/dist/migrations/sqlite/0045_workspace_attachments.sql +9 -0
- package/dist/migrations/sqlite/0046_extensions.sql +52 -0
- package/dist/migrations/sqlite/0047_child_session_settings.sql +10 -0
- package/dist/migrations/sqlite/0047_host_builtin_extensions.sql +3 -0
- package/dist/migrations/sqlite/0047_notifications.sql +45 -0
- package/dist/migrations/sqlite/0048_piki_extensions.sql +30 -0
- package/dist/migrations/sqlite/0049_default_extensions.sql +22 -0
- package/dist/migrations/sqlite/0050_host_required_extensions.sql +4 -0
- package/dist/web/assets/index-BdJ_-50H.js +62 -0
- package/dist/web/assets/{index-CnOXvi_D.js → index-ClW_3YVo.js} +1 -1
- package/dist/web/assets/index-DR-JFaOB.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +61 -0
- package/npm-shrinkwrap.json +3 -2
- package/package.json +2 -1
- package/dist/web/assets/index-BTJ7REap.css +0 -1
- package/dist/web/assets/index-D8LT-Xr6.js +0 -58
|
@@ -1,58 +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 ib(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gd={exports:{}},Ar={};var ry;function Kk(){if(ry)return Ar;ry=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 Ar.Fragment=s,Ar.jsx=a,Ar.jsxs=a,Ar}var ly;function Jk(){return ly||(ly=1,gd.exports=Kk()),gd.exports}var i=Jk(),yd={exports:{}},Ue={};var oy;function Wk(){if(oy)return Ue;oy=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"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),v=Symbol.iterator;function b(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,A={};function k(R,Q,E){this.props=R,this.context=Q,this.refs=A,this.updater=E||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 N(R,Q,E){this.props=R,this.context=Q,this.refs=A,this.updater=E||w}var M=N.prototype=new z;M.constructor=N,S(M,k.prototype),M.isPureReactComponent=!0;var H=Array.isArray;function L(){}var P={H:null,A:null,T:null,S:null},ue=Object.prototype.hasOwnProperty;function se(R,Q,E){var J=E.ref;return{$$typeof:e,type:R,key:Q,ref:J!==void 0?J:null,props:E}}function $(R,Q){return se(R.type,Q,R.props)}function I(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function X(R){var Q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(E){return Q[E]})}var le=/\/+/g;function te(R,Q){return typeof R=="object"&&R!==null&&R.key!=null?X(""+R.key):Q.toString(36)}function F(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(L,L):(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 B(R,Q,E,J,be){var ye=typeof R;(ye==="undefined"||ye==="boolean")&&(R=null);var Me=!1;if(R===null)Me=!0;else switch(ye){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,B(Me(R._payload),Q,E,J,be)}}if(Me)return be=be(R),Me=J===""?"."+te(R,0):J,H(be)?(E="",Me!=null&&(E=Me.replace(le,"$&/")+"/"),B(be,Q,E,"",function(ht){return ht})):be!=null&&(I(be)&&(be=$(be,E+(be.key==null||R&&R.key===be.key?"":(""+be.key).replace(le,"$&/")+"/")+Me)),Q.push(be)),1;Me=0;var Xe=J===""?".":J+":";if(H(R))for(var de=0;de<R.length;de++)J=R[de],ye=Xe+te(J,de),Me+=B(J,Q,E,ye,be);else if(de=b(R),typeof de=="function")for(R=de.call(R),de=0;!(J=R.next()).done;)J=J.value,ye=Xe+te(J,de++),Me+=B(J,Q,E,ye,be);else if(ye==="object"){if(typeof R.then=="function")return B(F(R),Q,E,J,be);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 U(R,Q,E){if(R==null)return R;var J=[],be=0;return B(R,J,"","",function(ye){return Q.call(E,ye,be++)}),J}function ee(R){if(R._status===-1){var Q=R._result;Q=Q(),Q.then(function(E){(R._status===0||R._status===-1)&&(R._status=1,R._result=E)},function(E){(R._status===0||R._status===-1)&&(R._status=2,R._result=E)}),R._status===-1&&(R._status=0,R._result=Q)}if(R._status===1)return R._result.default;throw R._result}var re=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:U,forEach:function(R,Q,E){U(R,function(){Q.apply(this,arguments)},E)},count:function(R){var Q=0;return U(R,function(){Q++}),Q},toArray:function(R){return U(R,function(Q){return Q})||[]},only:function(R){if(!I(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ue.Activity=x,Ue.Children=O,Ue.Component=k,Ue.Fragment=a,Ue.Profiler=c,Ue.PureComponent=N,Ue.StrictMode=l,Ue.Suspense=p,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(R){return P.H.useMemoCache(R)}},Ue.cache=function(R){return function(){return R.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(R,Q,E){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var J=S({},R.props),be=R.key;if(Q!=null)for(ye in Q.key!==void 0&&(be=""+Q.key),Q)!ue.call(Q,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&Q.ref===void 0||(J[ye]=Q[ye]);var ye=arguments.length-2;if(ye===1)J.children=E;else if(1<ye){for(var Me=Array(ye),Xe=0;Xe<ye;Xe++)Me[Xe]=arguments[Xe+2];J.children=Me}return se(R.type,be,J)},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,E){var J,be={},ye=null;if(Q!=null)for(J in Q.key!==void 0&&(ye=""+Q.key),Q)ue.call(Q,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(be[J]=Q[J]);var Me=arguments.length-2;if(Me===1)be.children=E;else if(1<Me){for(var Xe=Array(Me),de=0;de<Me;de++)Xe[de]=arguments[de+2];be.children=Xe}if(R&&R.defaultProps)for(J in Me=R.defaultProps,Me)be[J]===void 0&&(be[J]=Me[J]);return se(R,ye,be)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(R){return{$$typeof:h,render:R}},Ue.isValidElement=I,Ue.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:ee}},Ue.memo=function(R,Q){return{$$typeof:m,type:R,compare:Q===void 0?null:Q}},Ue.startTransition=function(R){var Q=P.T,E={};P.T=E;try{var J=R(),be=P.S;be!==null&&be(E,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(L,re)}catch(ye){re(ye)}finally{Q!==null&&E.types!==null&&(Q.types=E.types),P.T=Q}},Ue.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Ue.use=function(R){return P.H.use(R)},Ue.useActionState=function(R,Q,E){return P.H.useActionState(R,Q,E)},Ue.useCallback=function(R,Q){return P.H.useCallback(R,Q)},Ue.useContext=function(R){return P.H.useContext(R)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(R,Q){return P.H.useDeferredValue(R,Q)},Ue.useEffect=function(R,Q){return P.H.useEffect(R,Q)},Ue.useEffectEvent=function(R){return P.H.useEffectEvent(R)},Ue.useId=function(){return P.H.useId()},Ue.useImperativeHandle=function(R,Q,E){return P.H.useImperativeHandle(R,Q,E)},Ue.useInsertionEffect=function(R,Q){return P.H.useInsertionEffect(R,Q)},Ue.useLayoutEffect=function(R,Q){return P.H.useLayoutEffect(R,Q)},Ue.useMemo=function(R,Q){return P.H.useMemo(R,Q)},Ue.useOptimistic=function(R,Q){return P.H.useOptimistic(R,Q)},Ue.useReducer=function(R,Q,E){return P.H.useReducer(R,Q,E)},Ue.useRef=function(R){return P.H.useRef(R)},Ue.useState=function(R){return P.H.useState(R)},Ue.useSyncExternalStore=function(R,Q,E){return P.H.useSyncExternalStore(R,Q,E)},Ue.useTransition=function(){return P.H.useTransition()},Ue.version="19.2.0",Ue}var cy;function Ah(){return cy||(cy=1,yd.exports=Wk()),yd.exports}var T=Ah(),xd={exports:{}},Tr={},bd={exports:{}},vd={};var uy;function e0(){return uy||(uy=1,(function(e){function s(B,U){var ee=B.length;B.push(U);e:for(;0<ee;){var re=ee-1>>>1,O=B[re];if(0<c(O,U))B[re]=U,B[ee]=O,ee=re;else break e}}function a(B){return B.length===0?null:B[0]}function l(B){if(B.length===0)return null;var U=B[0],ee=B.pop();if(ee!==U){B[0]=ee;e:for(var re=0,O=B.length,R=O>>>1;re<R;){var Q=2*(re+1)-1,E=B[Q],J=Q+1,be=B[J];if(0>c(E,ee))J<O&&0>c(be,E)?(B[re]=be,B[J]=ee,re=J):(B[re]=E,B[Q]=ee,re=Q);else if(J<O&&0>c(be,ee))B[re]=be,B[J]=ee,re=J;else break e}}return U}function c(B,U){var ee=B.sortIndex-U.sortIndex;return ee!==0?ee:B.id-U.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 p=[],m=[],y=1,x=null,v=3,b=!1,w=!1,S=!1,A=!1,k=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function M(B){for(var U=a(m);U!==null;){if(U.callback===null)l(m);else if(U.startTime<=B)l(m),U.sortIndex=U.expirationTime,s(p,U);else break;U=a(m)}}function H(B){if(S=!1,M(B),!w)if(a(p)!==null)w=!0,L||(L=!0,X());else{var U=a(m);U!==null&&F(H,U.startTime-B)}}var L=!1,P=-1,ue=5,se=-1;function $(){return A?!0:!(e.unstable_now()-se<ue)}function I(){if(A=!1,L){var B=e.unstable_now();se=B;var U=!0;try{e:{w=!1,S&&(S=!1,z(P),P=-1),b=!0;var ee=v;try{t:{for(M(B),x=a(p);x!==null&&!(x.expirationTime>B&&$());){var re=x.callback;if(typeof re=="function"){x.callback=null,v=x.priorityLevel;var O=re(x.expirationTime<=B);if(B=e.unstable_now(),typeof O=="function"){x.callback=O,M(B),U=!0;break t}x===a(p)&&l(p),M(B)}else l(p);x=a(p)}if(x!==null)U=!0;else{var R=a(m);R!==null&&F(H,R.startTime-B),U=!1}}break e}finally{x=null,v=ee,b=!1}U=void 0}}finally{U?X():L=!1}}}var X;if(typeof N=="function")X=function(){N(I)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,te=le.port2;le.port1.onmessage=I,X=function(){te.postMessage(null)}}else X=function(){k(I,0)};function F(B,U){P=k(function(){B(e.unstable_now())},U)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ue=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(B){switch(v){case 1:case 2:case 3:var U=3;break;default:U=v}var ee=v;v=U;try{return B()}finally{v=ee}},e.unstable_requestPaint=function(){A=!0},e.unstable_runWithPriority=function(B,U){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ee=v;v=B;try{return U()}finally{v=ee}},e.unstable_scheduleCallback=function(B,U,ee){var re=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?re+ee:re):ee=re,B){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=ee+O,B={id:y++,callback:U,priorityLevel:B,startTime:ee,expirationTime:O,sortIndex:-1},ee>re?(B.sortIndex=ee,s(m,B),a(p)===null&&B===a(m)&&(S?(z(P),P=-1):S=!0,F(H,ee-re))):(B.sortIndex=O,s(p,B),w||b||(w=!0,L||(L=!0,X()))),B},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(B){var U=v;return function(){var ee=v;v=U;try{return B.apply(this,arguments)}finally{v=ee}}}})(vd)),vd}var dy;function t0(){return dy||(dy=1,bd.exports=e0()),bd.exports}var wd={exports:{}},Xt={};var hy;function n0(){if(hy)return Xt;hy=1;var e=Ah();function s(p){var m="https://react.dev/errors/"+p;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 #"+p+"; 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(p,m,y){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:x==null?null:""+x,children:p,containerInfo:m,implementation:y}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Xt.createPortal=function(p,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(p,m,null,y)},Xt.flushSync=function(p){var m=d.T,y=l.p;try{if(d.T=null,l.p=2,p)return p()}finally{d.T=m,l.p=y,l.d.f()}},Xt.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,l.d.C(p,m))},Xt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Xt.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var y=m.as,x=h(y,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,b=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?l.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:x,integrity:v,fetchPriority:b}):y==="script"&&l.d.X(p,{crossOrigin:x,integrity:v,fetchPriority:b,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Xt.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);l.d.M(p,{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(p)},Xt.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,x=h(y,m.crossOrigin);l.d.L(p,y,{crossOrigin:x,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})}},Xt.preloadModule=function(p,m){if(typeof p=="string")if(m){var y=h(m.as,m.crossOrigin);l.d.m(p,{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(p)},Xt.requestFormReset=function(p){l.d.r(p)},Xt.unstable_batchedUpdates=function(p,m){return p(m)},Xt.useFormState=function(p,m,y){return d.H.useFormState(p,m,y)},Xt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Xt.version="19.2.0",Xt}var fy;function sb(){if(fy)return wd.exports;fy=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(),wd.exports=n0(),wd.exports}var my;function i0(){if(my)return Tr;my=1;var e=t0(),s=Ah(),a=sb();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 p(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 g=f.alternate;if(g===null){if(o=f.return,o!==null){r=o;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===r)return p(f),t;if(g===o)return p(f),n;g=g.sibling}throw Error(l(188))}if(r.return!==o.return)r=f,o=g;else{for(var j=!1,C=f.child;C;){if(C===r){j=!0,r=f,o=g;break}if(C===o){j=!0,o=f,r=g;break}C=C.sibling}if(!j){for(C=g.child;C;){if(C===r){j=!0,r=g,o=f;break}if(C===o){j=!0,o=g,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 x=Object.assign,v=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),N=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),ue=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function X(t){return t===null||typeof t!="object"?null:(t=I&&t[I]||t["@@iterator"],typeof t=="function"?t:null)}var le=Symbol.for("react.client.reference");function te(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===le?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case k:return"Profiler";case A:return"StrictMode";case H:return"Suspense";case L:return"SuspenseList";case se:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case N:return t.displayName||"Context";case z:return(t._context.displayName||"Context")+".Consumer";case M:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return n=t.displayName||null,n!==null?n:te(t.type)||"Memo";case ue:n=t._payload,t=t._init;try{return te(t(n))}catch{}}return null}var F=Array.isArray,B=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},re=[],O=-1;function R(t){return{current:t}}function Q(t){0>O||(t.current=re[O],re[O]=null,O--)}function E(t,n){O++,re[O]=t.current,t.current=n}var J=R(null),be=R(null),ye=R(null),Me=R(null);function Xe(t,n){switch(E(ye,n),E(be,t),E(J,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Eg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Eg(n),t=zg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Q(J),E(J,t)}function de(){Q(J),Q(be),Q(ye)}function ht(t){t.memoizedState!==null&&E(Me,t);var n=J.current,r=zg(n,t.type);n!==r&&(E(be,t),E(J,r))}function Lt(t){be.current===t&&(Q(J),Q(be)),Me.current===t&&(Q(Me),jr._currentValue=ee)}var Zt,Wt;function yt(t){if(Zt===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);Zt=n&&n[1]||"",Wt=-1<r.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Zt+t+Wt}var Gn=!1;function Ne(t,n){if(!t||Gn)return"";Gn=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(K){var Z=K}Reflect.construct(t,[],oe)}else{try{oe.call()}catch(K){Z=K}t.call(oe.prototype)}}else{try{throw Error()}catch(K){Z=K}(oe=t())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(K){if(K&&Z&&typeof K.stack=="string")return[K.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 g=o.DetermineComponentFrameRoot(),j=g[0],C=g[1];if(j&&C){var D=j.split(`
|
|
4
|
-
`),V=C.split(`
|
|
5
|
-
`);for(f=o=0;o<D.length&&!D[o].includes("DetermineComponentFrameRoot");)o++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(o===D.length||f===V.length)for(o=D.length-1,f=V.length-1;1<=o&&0<=f&&D[o]!==V[f];)f--;for(;1<=o&&0<=f;o--,f--)if(D[o]!==V[f]){if(o!==1||f!==1)do if(o--,f--,0>f||D[o]!==V[f]){var ne=`
|
|
6
|
-
`+D[o].replace(" at new "," at ");return t.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",t.displayName)),ne}while(1<=o&&0<=f);break}}}finally{Gn=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?yt(r):""}function et(t,n){switch(t.tag){case 26:case 27:case 5:return yt(t.type);case 16:return yt("Lazy");case 13:return t.child!==n&&n!==null?yt("Suspense Fallback"):yt("Suspense");case 19:return yt("SuspenseList");case 0:case 15:return Ne(t.type,!1);case 11:return Ne(t.type.render,!1);case 1:return Ne(t.type,!0);case 31:return yt("Activity");default:return""}}function Nn(t){try{var n="",r=null;do n+=et(t,r),r=t,t=t.return;while(t);return n}catch(o){return`
|
|
7
|
-
Error generating stack: `+o.message+`
|
|
8
|
-
`+o.stack}}var yn=Object.prototype.hasOwnProperty,en=e.unstable_scheduleCallback,Fn=e.unstable_cancelCallback,En=e.unstable_shouldYield,Gs=e.unstable_requestPaint,Tt=e.unstable_now,Fs=e.unstable_getCurrentPriorityLevel,Ui=e.unstable_ImmediatePriority,W=e.unstable_UserBlockingPriority,pe=e.unstable_NormalPriority,De=e.unstable_LowPriority,Le=e.unstable_IdlePriority,_t=e.log,tt=e.unstable_setDisableYieldValue,st=null,ft=null;function tn(t){if(typeof _t=="function"&&tt(t),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(st,t)}catch{}}var St=Math.clz32?Math.clz32:fs,ui=Math.log,Ps=Math.LN2;function fs(t){return t>>>=0,t===0?32:31-(ui(t)/Ps|0)|0}var Nt=256,he=262144,we=4194304;function mt(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 rn(t,n,r){var o=t.pendingLanes;if(o===0)return 0;var f=0,g=t.suspendedLanes,j=t.pingedLanes;t=t.warmLanes;var C=o&134217727;return C!==0?(o=C&~g,o!==0?f=mt(o):(j&=C,j!==0?f=mt(j):r||(r=C&~t,r!==0&&(f=mt(r))))):(C=o&~g,C!==0?f=mt(C):j!==0?f=mt(j):r||(r=o&~t,r!==0&&(f=mt(r)))),f===0?0:n!==0&&n!==f&&(n&g)===0&&(g=f&-f,r=n&-n,g>=r||g===32&&(r&4194048)!==0)?n:f}function di(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function tl(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 _a(){var t=we;return we<<=1,(we&62914560)===0&&(we=4194304),t}function hi(t){for(var n=[],r=0;31>r;r++)n.push(t);return n}function ei(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Hw(t,n,r,o,f,g){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,V=t.hiddenUpdates;for(r=j&~r;0<r;){var ne=31-St(r),oe=1<<ne;C[ne]=0,D[ne]=-1;var Z=V[ne];if(Z!==null)for(V[ne]=null,ne=0;ne<Z.length;ne++){var K=Z[ne];K!==null&&(K.lane&=-536870913)}r&=~oe}o!==0&&df(t,o,0),g!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=g&~(j&~n))}function df(t,n,r){t.pendingLanes|=n,t.suspendedLanes&=~n;var o=31-St(n);t.entangledLanes|=n,t.entanglements[o]=t.entanglements[o]|1073741824|r&261930}function hf(t,n){var r=t.entangledLanes|=n;for(t=t.entanglements;r;){var o=31-St(r),f=1<<o;f&n|t[o]&n&&(t[o]|=n),r&=~f}}function ff(t,n){var r=n&-n;return r=(r&42)!==0?1:ac(r),(r&(t.suspendedLanes|n))!==0?0:r}function ac(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 rc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function mf(){var t=U.p;return t!==0?t:(t=window.event,t===void 0?32:Wg(t.type))}function pf(t,n){var r=U.p;try{return U.p=t,n()}finally{U.p=r}}var Bi=Math.random().toString(36).slice(2),qt="__reactFiber$"+Bi,ln="__reactProps$"+Bi,Ys="__reactContainer$"+Bi,lc="__reactEvents$"+Bi,$w="__reactListeners$"+Bi,Iw="__reactHandles$"+Bi,gf="__reactResources$"+Bi,Ua="__reactMarker$"+Bi;function oc(t){delete t[qt],delete t[ln],delete t[lc],delete t[$w],delete t[Iw]}function Vs(t){var n=t[qt];if(n)return n;for(var r=t.parentNode;r;){if(n=r[Ys]||r[qt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(t=Ug(t);t!==null;){if(r=t[qt])return r;t=Ug(t)}return n}t=r,r=t.parentNode}return null}function Zs(t){if(t=t[qt]||t[Ys]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Ba(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(l(33))}function Xs(t){var n=t[gf];return n||(n=t[gf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ht(t){t[Ua]=!0}var yf=new Set,xf={};function ms(t,n){Qs(t,n),Qs(t+"Capture",n)}function Qs(t,n){for(xf[t]=n,t=0;t<n.length;t++)yf.add(n[t])}var qw=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]*$"),bf={},vf={};function Gw(t){return yn.call(vf,t)?!0:yn.call(bf,t)?!1:qw.test(t)?vf[t]=!0:(bf[t]=!0,!1)}function nl(t,n,r){if(Gw(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 il(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 fi(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 zn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Fw(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,g=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(j){r=""+j,g.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 cc(t){if(!t._valueTracker){var n=wf(t)?"checked":"value";t._valueTracker=Fw(t,n,""+t[n])}}function jf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var r=n.getValue(),o="";return t&&(o=wf(t)?t.checked?"true":"false":t.value),t=o,t!==r?(n.setValue(t),!0):!1}function sl(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 Pw=/[\n"\\]/g;function On(t){return t.replace(Pw,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function uc(t,n,r,o,f,g,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=""+zn(n)):t.value!==""+zn(n)&&(t.value=""+zn(n)):j!=="submit"&&j!=="reset"||t.removeAttribute("value"),n!=null?dc(t,j,zn(n)):r!=null?dc(t,j,zn(r)):o!=null&&t.removeAttribute("value"),f==null&&g!=null&&(t.defaultChecked=!!g),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.name=""+zn(C):t.removeAttribute("name")}function kf(t,n,r,o,f,g,j,C){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),n!=null||r!=null){if(!(g!=="submit"&&g!=="reset"||n!=null)){cc(t);return}r=r!=null?""+zn(r):"",n=n!=null?""+zn(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),cc(t)}function dc(t,n,r){n==="number"&&sl(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function Ks(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=""+zn(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 Sf(t,n,r){if(n!=null&&(n=""+zn(n),n!==t.value&&(t.value=n),r==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=r!=null?""+zn(r):""}function Cf(t,n,r,o){if(n==null){if(o!=null){if(r!=null)throw Error(l(92));if(F(o)){if(1<o.length)throw Error(l(93));o=o[0]}r=o}r==null&&(r=""),n=r}r=zn(n),t.defaultValue=r,o=t.textContent,o===r&&o!==""&&o!==null&&(t.value=o),cc(t)}function Js(t,n){if(n){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=n;return}}t.textContent=n}var Yw=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 Af(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||Yw.has(n)?n==="float"?t.cssFloat=r:t[n]=(""+r).trim():t[n]=r+"px"}function Tf(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&&Af(t,f,o)}else for(var g in n)n.hasOwnProperty(g)&&Af(t,g,n[g])}function hc(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 Vw=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"]]),Zw=/^[\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 al(t){return Zw.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function mi(){}var fc=null;function mc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ws=null,ea=null;function Nf(t){var n=Zs(t);if(n&&(t=n.stateNode)){var r=t[ln]||null;e:switch(t=n.stateNode,n.type){case"input":if(uc(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="'+On(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var o=r[n];if(o!==t&&o.form===t.form){var f=o[ln]||null;if(!f)throw Error(l(90));uc(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&&jf(o)}break e;case"textarea":Sf(t,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&Ks(t,!!r.multiple,n,!1)}}}var pc=!1;function Ef(t,n,r){if(pc)return t(n,r);pc=!0;try{var o=t(n);return o}finally{if(pc=!1,(Ws!==null||ea!==null)&&(Yl(),Ws&&(n=Ws,t=ea,ea=Ws=null,Nf(n),t)))for(n=0;n<t.length;n++)Nf(t[n])}}function Ha(t,n){var r=t.stateNode;if(r===null)return null;var o=r[ln]||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 pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gc=!1;if(pi)try{var $a={};Object.defineProperty($a,"passive",{get:function(){gc=!0}}),window.addEventListener("test",$a,$a),window.removeEventListener("test",$a,$a)}catch{gc=!1}var Hi=null,yc=null,rl=null;function zf(){if(rl)return rl;var t,n=yc,r=n.length,o,f="value"in Hi?Hi.value:Hi.textContent,g=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[g-o];o++);return rl=f.slice(t,1<o?1-o:void 0)}function ll(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 ol(){return!0}function Of(){return!1}function on(t){function n(r,o,f,g,j){this._reactName=r,this._targetInst=f,this.type=o,this.nativeEvent=g,this.target=j,this.currentTarget=null;for(var C in t)t.hasOwnProperty(C)&&(r=t[C],this[C]=r?r(g):g[C]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?ol:Of,this.isPropagationStopped=Of,this}return x(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=ol)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ol)},persist:function(){},isPersistent:ol}),n}var ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cl=on(ps),Ia=x({},ps,{view:0,detail:0}),Xw=on(Ia),xc,bc,qa,ul=x({},Ia,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,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!==qa&&(qa&&t.type==="mousemove"?(xc=t.screenX-qa.screenX,bc=t.screenY-qa.screenY):bc=xc=0,qa=t),xc)},movementY:function(t){return"movementY"in t?t.movementY:bc}}),Rf=on(ul),Qw=x({},ul,{dataTransfer:0}),Kw=on(Qw),Jw=x({},Ia,{relatedTarget:0}),vc=on(Jw),Ww=x({},ps,{animationName:0,elapsedTime:0,pseudoElement:0}),ej=on(Ww),tj=x({},ps,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),nj=on(tj),ij=x({},ps,{data:0}),Df=on(ij),sj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aj={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"},rj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lj(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=rj[t])?!!n[t]:!1}function wc(){return lj}var oj=x({},Ia,{key:function(t){if(t.key){var n=sj[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=ll(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?aj[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wc,charCode:function(t){return t.type==="keypress"?ll(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ll(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),cj=on(oj),uj=x({},ul,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mf=on(uj),dj=x({},Ia,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),hj=on(dj),fj=x({},ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),mj=on(fj),pj=x({},ul,{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}),gj=on(pj),yj=x({},ps,{newState:0,oldState:0}),xj=on(yj),bj=[9,13,27,32],jc=pi&&"CompositionEvent"in window,Ga=null;pi&&"documentMode"in document&&(Ga=document.documentMode);var vj=pi&&"TextEvent"in window&&!Ga,Lf=pi&&(!jc||Ga&&8<Ga&&11>=Ga),_f=" ",Uf=!1;function Bf(t,n){switch(t){case"keyup":return bj.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ta=!1;function wj(t,n){switch(t){case"compositionend":return Hf(n);case"keypress":return n.which!==32?null:(Uf=!0,_f);case"textInput":return t=n.data,t===_f&&Uf?null:t;default:return null}}function jj(t,n){if(ta)return t==="compositionend"||!jc&&Bf(t,n)?(t=zf(),rl=yc=Hi=null,ta=!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 Lf&&n.locale!=="ko"?null:n.data;default:return null}}var kj={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 $f(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!kj[t.type]:n==="textarea"}function If(t,n,r,o){Ws?ea?ea.push(o):ea=[o]:Ws=o,n=Wl(n,"onChange"),0<n.length&&(r=new cl("onChange","change",null,r,o),t.push({event:r,listeners:n}))}var Fa=null,Pa=null;function Sj(t){kg(t,0)}function dl(t){var n=Ba(t);if(jf(n))return t}function qf(t,n){if(t==="change")return n}var Gf=!1;if(pi){var kc;if(pi){var Sc="oninput"in document;if(!Sc){var Ff=document.createElement("div");Ff.setAttribute("oninput","return;"),Sc=typeof Ff.oninput=="function"}kc=Sc}else kc=!1;Gf=kc&&(!document.documentMode||9<document.documentMode)}function Pf(){Fa&&(Fa.detachEvent("onpropertychange",Yf),Pa=Fa=null)}function Yf(t){if(t.propertyName==="value"&&dl(Pa)){var n=[];If(n,Pa,t,mc(t)),Ef(Sj,n)}}function Cj(t,n,r){t==="focusin"?(Pf(),Fa=n,Pa=r,Fa.attachEvent("onpropertychange",Yf)):t==="focusout"&&Pf()}function Aj(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return dl(Pa)}function Tj(t,n){if(t==="click")return dl(n)}function Nj(t,n){if(t==="input"||t==="change")return dl(n)}function Ej(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var xn=typeof Object.is=="function"?Object.is:Ej;function Ya(t,n){if(xn(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(!yn.call(n,f)||!xn(t[f],n[f]))return!1}return!0}function Vf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Zf(t,n){var r=Vf(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=Vf(r)}}function Xf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Xf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Qf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=sl(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=sl(t.document)}return n}function Cc(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 zj=pi&&"documentMode"in document&&11>=document.documentMode,na=null,Ac=null,Va=null,Tc=!1;function Kf(t,n,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Tc||na==null||na!==sl(o)||(o=na,"selectionStart"in o&&Cc(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}),Va&&Ya(Va,o)||(Va=o,o=Wl(Ac,"onSelect"),0<o.length&&(n=new cl("onSelect","select",null,n,r),t.push({event:n,listeners:o}),n.target=na)))}function gs(t,n){var r={};return r[t.toLowerCase()]=n.toLowerCase(),r["Webkit"+t]="webkit"+n,r["Moz"+t]="moz"+n,r}var ia={animationend:gs("Animation","AnimationEnd"),animationiteration:gs("Animation","AnimationIteration"),animationstart:gs("Animation","AnimationStart"),transitionrun:gs("Transition","TransitionRun"),transitionstart:gs("Transition","TransitionStart"),transitioncancel:gs("Transition","TransitionCancel"),transitionend:gs("Transition","TransitionEnd")},Nc={},Jf={};pi&&(Jf=document.createElement("div").style,"AnimationEvent"in window||(delete ia.animationend.animation,delete ia.animationiteration.animation,delete ia.animationstart.animation),"TransitionEvent"in window||delete ia.transitionend.transition);function ys(t){if(Nc[t])return Nc[t];if(!ia[t])return t;var n=ia[t],r;for(r in n)if(n.hasOwnProperty(r)&&r in Jf)return Nc[t]=n[r];return t}var Wf=ys("animationend"),em=ys("animationiteration"),tm=ys("animationstart"),Oj=ys("transitionrun"),Rj=ys("transitionstart"),Dj=ys("transitioncancel"),nm=ys("transitionend"),im=new Map,Ec="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(" ");Ec.push("scrollEnd");function Pn(t,n){im.set(t,n),ms(n,[t])}var hl=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)},Rn=[],sa=0,zc=0;function fl(){for(var t=sa,n=zc=sa=0;n<t;){var r=Rn[n];Rn[n++]=null;var o=Rn[n];Rn[n++]=null;var f=Rn[n];Rn[n++]=null;var g=Rn[n];if(Rn[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}g!==0&&sm(r,f,g)}}function ml(t,n,r,o){Rn[sa++]=t,Rn[sa++]=n,Rn[sa++]=r,Rn[sa++]=o,zc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Oc(t,n,r,o){return ml(t,n,r,o),pl(t)}function xs(t,n){return ml(t,null,null,n),pl(t)}function sm(t,n,r){t.lanes|=r;var o=t.alternate;o!==null&&(o.lanes|=r);for(var f=!1,g=t.return;g!==null;)g.childLanes|=r,o=g.alternate,o!==null&&(o.childLanes|=r),g.tag===22&&(t=g.stateNode,t===null||t._visibility&1||(f=!0)),t=g,g=g.return;return t.tag===3?(g=t.stateNode,f&&n!==null&&(f=31-St(r),t=g.hiddenUpdates,o=t[f],o===null?t[f]=[n]:o.push(n),n.lane=r|536870912),g):null}function pl(t){if(50<pr)throw pr=0,$u=null,Error(l(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var aa={};function Mj(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 bn(t,n,r,o){return new Mj(t,n,r,o)}function Rc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function gi(t,n){var r=t.alternate;return r===null?(r=bn(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 am(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 gl(t,n,r,o,f,g){var j=0;if(o=t,typeof t=="function")Rc(t)&&(j=1);else if(typeof t=="string")j=Hk(t,r,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case se:return t=bn(31,r,n,f),t.elementType=se,t.lanes=g,t;case S:return bs(r.children,f,g,n);case A:j=8,f|=24;break;case k:return t=bn(12,r,n,f|2),t.elementType=k,t.lanes=g,t;case H:return t=bn(13,r,n,f),t.elementType=H,t.lanes=g,t;case L:return t=bn(19,r,n,f),t.elementType=L,t.lanes=g,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:j=10;break e;case z:j=9;break e;case M:j=11;break e;case P:j=14;break e;case ue:j=16,o=null;break e}j=29,r=Error(l(130,t===null?"null":typeof t,"")),o=null}return n=bn(j,r,n,f),n.elementType=t,n.type=o,n.lanes=g,n}function bs(t,n,r,o){return t=bn(7,t,o,n),t.lanes=r,t}function Dc(t,n,r){return t=bn(6,t,null,n),t.lanes=r,t}function rm(t){var n=bn(18,null,null,0);return n.stateNode=t,n}function Mc(t,n,r){return n=bn(4,t.children!==null?t.children:[],t.key,n),n.lanes=r,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var lm=new WeakMap;function Dn(t,n){if(typeof t=="object"&&t!==null){var r=lm.get(t);return r!==void 0?r:(n={value:t,source:n,stack:Nn(n)},lm.set(t,n),n)}return{value:t,source:n,stack:Nn(n)}}var ra=[],la=0,yl=null,Za=0,Mn=[],Ln=0,$i=null,ti=1,ni="";function yi(t,n){ra[la++]=Za,ra[la++]=yl,yl=t,Za=n}function om(t,n,r){Mn[Ln++]=ti,Mn[Ln++]=ni,Mn[Ln++]=$i,$i=t;var o=ti;t=ni;var f=32-St(o)-1;o&=~(1<<f),r+=1;var g=32-St(n)+f;if(30<g){var j=f-f%5;g=(o&(1<<j)-1).toString(32),o>>=j,f-=j,ti=1<<32-St(n)+f|r<<f|o,ni=g+t}else ti=1<<g|r<<f|o,ni=t}function Lc(t){t.return!==null&&(yi(t,1),om(t,1,0))}function _c(t){for(;t===yl;)yl=ra[--la],ra[la]=null,Za=ra[--la],ra[la]=null;for(;t===$i;)$i=Mn[--Ln],Mn[Ln]=null,ni=Mn[--Ln],Mn[Ln]=null,ti=Mn[--Ln],Mn[Ln]=null}function cm(t,n){Mn[Ln++]=ti,Mn[Ln++]=ni,Mn[Ln++]=$i,ti=n.id,ni=n.overflow,$i=t}var Gt=null,pt=null,Ve=!1,Ii=null,_n=!1,Uc=Error(l(519));function qi(t){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xa(Dn(n,t)),Uc}function um(t){var n=t.stateNode,r=t.type,o=t.memoizedProps;switch(n[qt]=t,n[ln]=o,r){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(r=0;r<yr.length;r++)Fe(yr[r],n);break;case"source":Fe("error",n);break;case"img":case"image":case"link":Fe("error",n),Fe("load",n);break;case"details":Fe("toggle",n);break;case"input":Fe("invalid",n),kf(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Fe("invalid",n);break;case"textarea":Fe("invalid",n),Cf(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||Tg(n.textContent,r)?(o.popover!=null&&(Fe("beforetoggle",n),Fe("toggle",n)),o.onScroll!=null&&Fe("scroll",n),o.onScrollEnd!=null&&Fe("scrollend",n),o.onClick!=null&&(n.onclick=mi),n=!0):n=!1,n||qi(t,!0)}function dm(t){for(Gt=t.return;Gt;)switch(Gt.tag){case 5:case 31:case 13:_n=!1;return;case 27:case 3:_n=!0;return;default:Gt=Gt.return}}function oa(t){if(t!==Gt)return!1;if(!Ve)return dm(t),Ve=!0,!1;var n=t.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||td(t.type,t.memoizedProps)),r=!r),r&&pt&&qi(t),dm(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));pt=_g(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));pt=_g(t)}else n===27?(n=pt,ns(t.type)?(t=rd,rd=null,pt=t):pt=n):pt=Gt?Bn(t.stateNode.nextSibling):null;return!0}function vs(){pt=Gt=null,Ve=!1}function Bc(){var t=Ii;return t!==null&&(hn===null?hn=t:hn.push.apply(hn,t),Ii=null),t}function Xa(t){Ii===null?Ii=[t]:Ii.push(t)}var Hc=R(null),ws=null,xi=null;function Gi(t,n,r){E(Hc,n._currentValue),n._currentValue=r}function bi(t){t._currentValue=Hc.current,Q(Hc)}function $c(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 Ic(t,n,r,o){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var g=f.dependencies;if(g!==null){var j=f.child;g=g.firstContext;e:for(;g!==null;){var C=g;g=f;for(var D=0;D<n.length;D++)if(C.context===n[D]){g.lanes|=r,C=g.alternate,C!==null&&(C.lanes|=r),$c(g.return,r,t),o||(j=null);break e}g=C.next}}else if(f.tag===18){if(j=f.return,j===null)throw Error(l(341));j.lanes|=r,g=j.alternate,g!==null&&(g.lanes|=r),$c(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 ca(t,n,r,o){t=null;for(var f=n,g=!1;f!==null;){if(!g){if((f.flags&524288)!==0)g=!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;xn(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(jr):t=[jr])}f=f.return}t!==null&&Ic(n,t,r,o),n.flags|=262144}function xl(t){for(t=t.firstContext;t!==null;){if(!xn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function js(t){ws=t,xi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Ft(t){return hm(ws,t)}function bl(t,n){return ws===null&&js(t),hm(t,n)}function hm(t,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},xi===null){if(t===null)throw Error(l(308));xi=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else xi=xi.next=n;return r}var Lj=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()})}},_j=e.unstable_scheduleCallback,Uj=e.unstable_NormalPriority,Et={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qc(){return{controller:new Lj,data:new Map,refCount:0}}function Qa(t){t.refCount--,t.refCount===0&&_j(Uj,function(){t.controller.abort()})}var Ka=null,Gc=0,ua=0,da=null;function Bj(t,n){if(Ka===null){var r=Ka=[];Gc=0,ua=Yu(),da={status:"pending",value:void 0,then:function(o){r.push(o)}}}return Gc++,n.then(fm,fm),n}function fm(){if(--Gc===0&&Ka!==null){da!==null&&(da.status="fulfilled");var t=Ka;Ka=null,ua=0,da=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Hj(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 mm=B.S;B.S=function(t,n){Kp=Tt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Bj(t,n),mm!==null&&mm(t,n)};var ks=R(null);function Fc(){var t=ks.current;return t!==null?t:ot.pooledCache}function vl(t,n){n===null?E(ks,ks.current):E(ks,n.pool)}function pm(){var t=Fc();return t===null?null:{parent:Et._currentValue,pool:t}}var ha=Error(l(460)),Pc=Error(l(474)),wl=Error(l(542)),jl={then:function(){}};function gm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ym(t,n,r){switch(r=t[r],r===void 0?t.push(n):r!==n&&(n.then(mi,mi),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,bm(t),t;default:if(typeof n.status=="string")n.then(mi,mi);else{if(t=ot,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,bm(t),t}throw Cs=n,ha}}function Ss(t){try{var n=t._init;return n(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Cs=r,ha):r}}var Cs=null;function xm(){if(Cs===null)throw Error(l(459));var t=Cs;return Cs=null,t}function bm(t){if(t===ha||t===wl)throw Error(l(483))}var fa=null,Ja=0;function kl(t){var n=Ja;return Ja+=1,fa===null&&(fa=[]),ym(fa,t,n)}function Wa(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Sl(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 vm(t){function n(q,_){if(t){var Y=q.deletions;Y===null?(q.deletions=[_],q.flags|=16):Y.push(_)}}function r(q,_){if(!t)return null;for(;_!==null;)n(q,_),_=_.sibling;return null}function o(q){for(var _=new Map;q!==null;)q.key!==null?_.set(q.key,q):_.set(q.index,q),q=q.sibling;return _}function f(q,_){return q=gi(q,_),q.index=0,q.sibling=null,q}function g(q,_,Y){return q.index=Y,t?(Y=q.alternate,Y!==null?(Y=Y.index,Y<_?(q.flags|=67108866,_):Y):(q.flags|=67108866,_)):(q.flags|=1048576,_)}function j(q){return t&&q.alternate===null&&(q.flags|=67108866),q}function C(q,_,Y,ae){return _===null||_.tag!==6?(_=Dc(Y,q.mode,ae),_.return=q,_):(_=f(_,Y),_.return=q,_)}function D(q,_,Y,ae){var ze=Y.type;return ze===S?ne(q,_,Y.props.children,ae,Y.key):_!==null&&(_.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===ue&&Ss(ze)===_.type)?(_=f(_,Y.props),Wa(_,Y),_.return=q,_):(_=gl(Y.type,Y.key,Y.props,null,q.mode,ae),Wa(_,Y),_.return=q,_)}function V(q,_,Y,ae){return _===null||_.tag!==4||_.stateNode.containerInfo!==Y.containerInfo||_.stateNode.implementation!==Y.implementation?(_=Mc(Y,q.mode,ae),_.return=q,_):(_=f(_,Y.children||[]),_.return=q,_)}function ne(q,_,Y,ae,ze){return _===null||_.tag!==7?(_=bs(Y,q.mode,ae,ze),_.return=q,_):(_=f(_,Y),_.return=q,_)}function oe(q,_,Y){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Dc(""+_,q.mode,Y),_.return=q,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case b:return Y=gl(_.type,_.key,_.props,null,q.mode,Y),Wa(Y,_),Y.return=q,Y;case w:return _=Mc(_,q.mode,Y),_.return=q,_;case ue:return _=Ss(_),oe(q,_,Y)}if(F(_)||X(_))return _=bs(_,q.mode,Y,null),_.return=q,_;if(typeof _.then=="function")return oe(q,kl(_),Y);if(_.$$typeof===N)return oe(q,bl(q,_),Y);Sl(q,_)}return null}function Z(q,_,Y,ae){var ze=_!==null?_.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return ze!==null?null:C(q,_,""+Y,ae);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case b:return Y.key===ze?D(q,_,Y,ae):null;case w:return Y.key===ze?V(q,_,Y,ae):null;case ue:return Y=Ss(Y),Z(q,_,Y,ae)}if(F(Y)||X(Y))return ze!==null?null:ne(q,_,Y,ae,null);if(typeof Y.then=="function")return Z(q,_,kl(Y),ae);if(Y.$$typeof===N)return Z(q,_,bl(q,Y),ae);Sl(q,Y)}return null}function K(q,_,Y,ae,ze){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return q=q.get(Y)||null,C(_,q,""+ae,ze);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:return q=q.get(ae.key===null?Y:ae.key)||null,D(_,q,ae,ze);case w:return q=q.get(ae.key===null?Y:ae.key)||null,V(_,q,ae,ze);case ue:return ae=Ss(ae),K(q,_,Y,ae,ze)}if(F(ae)||X(ae))return q=q.get(Y)||null,ne(_,q,ae,ze,null);if(typeof ae.then=="function")return K(q,_,Y,kl(ae),ze);if(ae.$$typeof===N)return K(q,_,Y,bl(_,ae),ze);Sl(_,ae)}return null}function je(q,_,Y,ae){for(var ze=null,Qe=null,Se=_,He=_=0,Ye=null;Se!==null&&He<Y.length;He++){Se.index>He?(Ye=Se,Se=null):Ye=Se.sibling;var Ke=Z(q,Se,Y[He],ae);if(Ke===null){Se===null&&(Se=Ye);break}t&&Se&&Ke.alternate===null&&n(q,Se),_=g(Ke,_,He),Qe===null?ze=Ke:Qe.sibling=Ke,Qe=Ke,Se=Ye}if(He===Y.length)return r(q,Se),Ve&&yi(q,He),ze;if(Se===null){for(;He<Y.length;He++)Se=oe(q,Y[He],ae),Se!==null&&(_=g(Se,_,He),Qe===null?ze=Se:Qe.sibling=Se,Qe=Se);return Ve&&yi(q,He),ze}for(Se=o(Se);He<Y.length;He++)Ye=K(Se,q,He,Y[He],ae),Ye!==null&&(t&&Ye.alternate!==null&&Se.delete(Ye.key===null?He:Ye.key),_=g(Ye,_,He),Qe===null?ze=Ye:Qe.sibling=Ye,Qe=Ye);return t&&Se.forEach(function(ls){return n(q,ls)}),Ve&&yi(q,He),ze}function Oe(q,_,Y,ae){if(Y==null)throw Error(l(151));for(var ze=null,Qe=null,Se=_,He=_=0,Ye=null,Ke=Y.next();Se!==null&&!Ke.done;He++,Ke=Y.next()){Se.index>He?(Ye=Se,Se=null):Ye=Se.sibling;var ls=Z(q,Se,Ke.value,ae);if(ls===null){Se===null&&(Se=Ye);break}t&&Se&&ls.alternate===null&&n(q,Se),_=g(ls,_,He),Qe===null?ze=ls:Qe.sibling=ls,Qe=ls,Se=Ye}if(Ke.done)return r(q,Se),Ve&&yi(q,He),ze;if(Se===null){for(;!Ke.done;He++,Ke=Y.next())Ke=oe(q,Ke.value,ae),Ke!==null&&(_=g(Ke,_,He),Qe===null?ze=Ke:Qe.sibling=Ke,Qe=Ke);return Ve&&yi(q,He),ze}for(Se=o(Se);!Ke.done;He++,Ke=Y.next())Ke=K(Se,q,He,Ke.value,ae),Ke!==null&&(t&&Ke.alternate!==null&&Se.delete(Ke.key===null?He:Ke.key),_=g(Ke,_,He),Qe===null?ze=Ke:Qe.sibling=Ke,Qe=Ke);return t&&Se.forEach(function(Qk){return n(q,Qk)}),Ve&&yi(q,He),ze}function lt(q,_,Y,ae){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 b:e:{for(var ze=Y.key;_!==null;){if(_.key===ze){if(ze=Y.type,ze===S){if(_.tag===7){r(q,_.sibling),ae=f(_,Y.props.children),ae.return=q,q=ae;break e}}else if(_.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===ue&&Ss(ze)===_.type){r(q,_.sibling),ae=f(_,Y.props),Wa(ae,Y),ae.return=q,q=ae;break e}r(q,_);break}else n(q,_);_=_.sibling}Y.type===S?(ae=bs(Y.props.children,q.mode,ae,Y.key),ae.return=q,q=ae):(ae=gl(Y.type,Y.key,Y.props,null,q.mode,ae),Wa(ae,Y),ae.return=q,q=ae)}return j(q);case w:e:{for(ze=Y.key;_!==null;){if(_.key===ze)if(_.tag===4&&_.stateNode.containerInfo===Y.containerInfo&&_.stateNode.implementation===Y.implementation){r(q,_.sibling),ae=f(_,Y.children||[]),ae.return=q,q=ae;break e}else{r(q,_);break}else n(q,_);_=_.sibling}ae=Mc(Y,q.mode,ae),ae.return=q,q=ae}return j(q);case ue:return Y=Ss(Y),lt(q,_,Y,ae)}if(F(Y))return je(q,_,Y,ae);if(X(Y)){if(ze=X(Y),typeof ze!="function")throw Error(l(150));return Y=ze.call(Y),Oe(q,_,Y,ae)}if(typeof Y.then=="function")return lt(q,_,kl(Y),ae);if(Y.$$typeof===N)return lt(q,_,bl(q,Y),ae);Sl(q,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,_!==null&&_.tag===6?(r(q,_.sibling),ae=f(_,Y),ae.return=q,q=ae):(r(q,_),ae=Dc(Y,q.mode,ae),ae.return=q,q=ae),j(q)):r(q,_)}return function(q,_,Y,ae){try{Ja=0;var ze=lt(q,_,Y,ae);return fa=null,ze}catch(Se){if(Se===ha||Se===wl)throw Se;var Qe=bn(29,Se,null,q.mode);return Qe.lanes=ae,Qe.return=q,Qe}}}var As=vm(!0),wm=vm(!1),Fi=!1;function Yc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vc(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 Pi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Yi(t,n,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(We&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=pl(t),sm(t,null,r),n}return ml(t,o,n,r),pl(t)}function er(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,hf(t,r)}}function Zc(t,n){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var f=null,g=null;if(r=r.firstBaseUpdate,r!==null){do{var j={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};g===null?f=g=j:g=g.next=j,r=r.next}while(r!==null);g===null?f=g=n:g=g.next=n}else f=g=n;r={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:g,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 Xc=!1;function tr(){if(Xc){var t=da;if(t!==null)throw t}}function nr(t,n,r,o){Xc=!1;var f=t.updateQueue;Fi=!1;var g=f.firstBaseUpdate,j=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var D=C,V=D.next;D.next=null,j===null?g=V:j.next=V,j=D;var ne=t.alternate;ne!==null&&(ne=ne.updateQueue,C=ne.lastBaseUpdate,C!==j&&(C===null?ne.firstBaseUpdate=V:C.next=V,ne.lastBaseUpdate=D))}if(g!==null){var oe=f.baseState;j=0,ne=V=D=null,C=g;do{var Z=C.lane&-536870913,K=Z!==C.lane;if(K?(Pe&Z)===Z:(o&Z)===Z){Z!==0&&Z===ua&&(Xc=!0),ne!==null&&(ne=ne.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var je=t,Oe=C;Z=n;var lt=r;switch(Oe.tag){case 1:if(je=Oe.payload,typeof je=="function"){oe=je.call(lt,oe,Z);break e}oe=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Oe.payload,Z=typeof je=="function"?je.call(lt,oe,Z):je,Z==null)break e;oe=x({},oe,Z);break e;case 2:Fi=!0}}Z=C.callback,Z!==null&&(t.flags|=64,K&&(t.flags|=8192),K=f.callbacks,K===null?f.callbacks=[Z]:K.push(Z))}else K={lane:Z,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ne===null?(V=ne=K,D=oe):ne=ne.next=K,j|=Z;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;K=C,C=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);ne===null&&(D=oe),f.baseState=D,f.firstBaseUpdate=V,f.lastBaseUpdate=ne,g===null&&(f.shared.lanes=0),Ki|=j,t.lanes=j,t.memoizedState=oe}}function jm(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function km(t,n){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)jm(r[t],n)}var ma=R(null),Cl=R(0);function Sm(t,n){t=Ni,E(Cl,t),E(ma,n),Ni=t|n.baseLanes}function Qc(){E(Cl,Ni),E(ma,ma.current)}function Kc(){Ni=Cl.current,Q(ma),Q(Cl)}var vn=R(null),Un=null;function Vi(t){var n=t.alternate;E(Ct,Ct.current&1),E(vn,t),Un===null&&(n===null||ma.current!==null||n.memoizedState!==null)&&(Un=t)}function Jc(t){E(Ct,Ct.current),E(vn,t),Un===null&&(Un=t)}function Cm(t){t.tag===22?(E(Ct,Ct.current),E(vn,t),Un===null&&(Un=t)):Zi()}function Zi(){E(Ct,Ct.current),E(vn,vn.current)}function wn(t){Q(vn),Un===t&&(Un=null),Q(Ct)}var Ct=R(0);function Al(t){for(var n=t;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||sd(r)||ad(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 vi=0,Be=null,at=null,zt=null,Tl=!1,pa=!1,Ts=!1,Nl=0,ir=0,ga=null,$j=0;function wt(){throw Error(l(321))}function Wc(t,n){if(n===null)return!1;for(var r=0;r<n.length&&r<t.length;r++)if(!xn(t[r],n[r]))return!1;return!0}function eu(t,n,r,o,f,g){return vi=g,Be=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=t===null||t.memoizedState===null?op:pu,Ts=!1,g=r(o,f),Ts=!1,pa&&(g=Tm(n,r,o,f)),Am(t),g}function Am(t){B.H=rr;var n=at!==null&&at.next!==null;if(vi=0,zt=at=Be=null,Tl=!1,ir=0,ga=null,n)throw Error(l(300));t===null||Ot||(t=t.dependencies,t!==null&&xl(t)&&(Ot=!0))}function Tm(t,n,r,o){Be=t;var f=0;do{if(pa&&(ga=null),ir=0,pa=!1,25<=f)throw Error(l(301));if(f+=1,zt=at=null,t.updateQueue!=null){var g=t.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}B.H=cp,g=n(r,o)}while(pa);return g}function Ij(){var t=B.H,n=t.useState()[0];return n=typeof n.then=="function"?sr(n):n,t=t.useState()[0],(at!==null?at.memoizedState:null)!==t&&(Be.flags|=1024),n}function tu(){var t=Nl!==0;return Nl=0,t}function nu(t,n,r){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~r}function iu(t){if(Tl){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Tl=!1}vi=0,zt=at=Be=null,pa=!1,ir=Nl=0,ga=null}function nn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?Be.memoizedState=zt=t:zt=zt.next=t,zt}function At(){if(at===null){var t=Be.alternate;t=t!==null?t.memoizedState:null}else t=at.next;var n=zt===null?Be.memoizedState:zt.next;if(n!==null)zt=n,at=t;else{if(t===null)throw Be.alternate===null?Error(l(467)):Error(l(310));at=t,t={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},zt===null?Be.memoizedState=zt=t:zt=zt.next=t}return zt}function El(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sr(t){var n=ir;return ir+=1,ga===null&&(ga=[]),t=ym(ga,t,n),n=Be,(zt===null?n.memoizedState:zt.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?op:pu),t}function zl(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return sr(t);if(t.$$typeof===N)return Ft(t)}throw Error(l(438,String(t)))}function su(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=El(),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]=$;return n.index++,r}function wi(t,n){return typeof n=="function"?n(t):n}function Ol(t){var n=At();return au(n,at,t)}function au(t,n,r){var o=t.queue;if(o===null)throw Error(l(311));o.lastRenderedReducer=r;var f=t.baseQueue,g=o.pending;if(g!==null){if(f!==null){var j=f.next;f.next=g.next,g.next=j}n.baseQueue=f=g,o.pending=null}if(g=t.baseState,f===null)t.memoizedState=g;else{n=f.next;var C=j=null,D=null,V=n,ne=!1;do{var oe=V.lane&-536870913;if(oe!==V.lane?(Pe&oe)===oe:(vi&oe)===oe){var Z=V.revertLane;if(Z===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),oe===ua&&(ne=!0);else if((vi&Z)===Z){V=V.next,Z===ua&&(ne=!0);continue}else oe={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},D===null?(C=D=oe,j=g):D=D.next=oe,Be.lanes|=Z,Ki|=Z;oe=V.action,Ts&&r(g,oe),g=V.hasEagerState?V.eagerState:r(g,oe)}else Z={lane:oe,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},D===null?(C=D=Z,j=g):D=D.next=Z,Be.lanes|=oe,Ki|=oe;V=V.next}while(V!==null&&V!==n);if(D===null?j=g:D.next=C,!xn(g,t.memoizedState)&&(Ot=!0,ne&&(r=da,r!==null)))throw r;t.memoizedState=g,t.baseState=j,t.baseQueue=D,o.lastRenderedState=g}return f===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function ru(t){var n=At(),r=n.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=t;var o=r.dispatch,f=r.pending,g=n.memoizedState;if(f!==null){r.pending=null;var j=f=f.next;do g=t(g,j.action),j=j.next;while(j!==f);xn(g,n.memoizedState)||(Ot=!0),n.memoizedState=g,n.baseQueue===null&&(n.baseState=g),r.lastRenderedState=g}return[g,o]}function Nm(t,n,r){var o=Be,f=At(),g=Ve;if(g){if(r===void 0)throw Error(l(407));r=r()}else r=n();var j=!xn((at||f).memoizedState,r);if(j&&(f.memoizedState=r,Ot=!0),f=f.queue,cu(Om.bind(null,o,f,t),[t]),f.getSnapshot!==n||j||zt!==null&&zt.memoizedState.tag&1){if(o.flags|=2048,ya(9,{destroy:void 0},zm.bind(null,o,f,r,n),null),ot===null)throw Error(l(349));g||(vi&127)!==0||Em(o,n,r)}return r}function Em(t,n,r){t.flags|=16384,t={getSnapshot:n,value:r},n=Be.updateQueue,n===null?(n=El(),Be.updateQueue=n,n.stores=[t]):(r=n.stores,r===null?n.stores=[t]:r.push(t))}function zm(t,n,r,o){n.value=r,n.getSnapshot=o,Rm(n)&&Dm(t)}function Om(t,n,r){return r(function(){Rm(n)&&Dm(t)})}function Rm(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!xn(t,r)}catch{return!0}}function Dm(t){var n=xs(t,2);n!==null&&fn(n,t,2)}function lu(t){var n=nn();if(typeof t=="function"){var r=t;if(t=r(),Ts){tn(!0);try{r()}finally{tn(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:t},n}function Mm(t,n,r,o){return t.baseState=r,au(t,at,typeof o=="function"?o:wi)}function qj(t,n,r,o,f){if(Ml(t))throw Error(l(485));if(t=n.action,t!==null){var g={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){g.listeners.push(j)}};B.T!==null?r(!0):g.isTransition=!1,o(g),r=n.pending,r===null?(g.next=n.pending=g,Lm(n,g)):(g.next=r.next,n.pending=r.next=g)}}function Lm(t,n){var r=n.action,o=n.payload,f=t.state;if(n.isTransition){var g=B.T,j={};B.T=j;try{var C=r(f,o),D=B.S;D!==null&&D(j,C),_m(t,n,C)}catch(V){ou(t,n,V)}finally{g!==null&&j.types!==null&&(g.types=j.types),B.T=g}}else try{g=r(f,o),_m(t,n,g)}catch(V){ou(t,n,V)}}function _m(t,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){Um(t,n,o)},function(o){return ou(t,n,o)}):Um(t,n,r)}function Um(t,n,r){n.status="fulfilled",n.value=r,Bm(n),t.state=r,n=t.pending,n!==null&&(r=n.next,r===n?t.pending=null:(r=r.next,n.next=r,Lm(t,r)))}function ou(t,n,r){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=r,Bm(n),n=n.next;while(n!==o)}t.action=null}function Bm(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Hm(t,n){return n}function $m(t,n){if(Ve){var r=ot.formState;if(r!==null){e:{var o=Be;if(Ve){if(pt){t:{for(var f=pt,g=_n;f.nodeType!==8;){if(!g){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}g=f.data,f=g==="F!"||g==="F"?f:null}if(f){pt=Bn(f.nextSibling),o=f.data==="F!";break e}}qi(o)}o=!1}o&&(n=r[0])}}return r=nn(),r.memoizedState=r.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hm,lastRenderedState:n},r.queue=o,r=ap.bind(null,Be,o),o.dispatch=r,o=lu(!1),g=mu.bind(null,Be,!1,o.queue),o=nn(),f={state:n,dispatch:null,action:t,pending:null},o.queue=f,r=qj.bind(null,Be,f,g,r),f.dispatch=r,o.memoizedState=t,[n,r,!1]}function Im(t){var n=At();return qm(n,at,t)}function qm(t,n,r){if(n=au(t,n,Hm)[0],t=Ol(wi)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=sr(n)}catch(j){throw j===ha?wl:j}else o=n;n=At();var f=n.queue,g=f.dispatch;return r!==n.memoizedState&&(Be.flags|=2048,ya(9,{destroy:void 0},Gj.bind(null,f,r),null)),[o,g,t]}function Gj(t,n){t.action=n}function Gm(t){var n=At(),r=at;if(r!==null)return qm(n,r,t);At(),n=n.memoizedState,r=At();var o=r.queue.dispatch;return r.memoizedState=t,[n,o,!1]}function ya(t,n,r,o){return t={tag:t,create:r,deps:o,inst:n,next:null},n=Be.updateQueue,n===null&&(n=El(),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 Fm(){return At().memoizedState}function Rl(t,n,r,o){var f=nn();Be.flags|=t,f.memoizedState=ya(1|n,{destroy:void 0},r,o===void 0?null:o)}function Dl(t,n,r,o){var f=At();o=o===void 0?null:o;var g=f.memoizedState.inst;at!==null&&o!==null&&Wc(o,at.memoizedState.deps)?f.memoizedState=ya(n,g,r,o):(Be.flags|=t,f.memoizedState=ya(1|n,g,r,o))}function Pm(t,n){Rl(8390656,8,t,n)}function cu(t,n){Dl(2048,8,t,n)}function Fj(t){Be.flags|=4;var n=Be.updateQueue;if(n===null)n=El(),Be.updateQueue=n,n.events=[t];else{var r=n.events;r===null?n.events=[t]:r.push(t)}}function Ym(t){var n=At().memoizedState;return Fj({ref:n,nextImpl:t}),function(){if((We&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function Vm(t,n){return Dl(4,2,t,n)}function Zm(t,n){return Dl(4,4,t,n)}function Xm(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 Qm(t,n,r){r=r!=null?r.concat([t]):null,Dl(4,4,Xm.bind(null,n,t),r)}function uu(){}function Km(t,n){var r=At();n=n===void 0?null:n;var o=r.memoizedState;return n!==null&&Wc(n,o[1])?o[0]:(r.memoizedState=[t,n],t)}function Jm(t,n){var r=At();n=n===void 0?null:n;var o=r.memoizedState;if(n!==null&&Wc(n,o[1]))return o[0];if(o=t(),Ts){tn(!0);try{t()}finally{tn(!1)}}return r.memoizedState=[o,n],o}function du(t,n,r){return r===void 0||(vi&1073741824)!==0&&(Pe&261930)===0?t.memoizedState=n:(t.memoizedState=r,t=Wp(),Be.lanes|=t,Ki|=t,r)}function Wm(t,n,r,o){return xn(r,n)?r:ma.current!==null?(t=du(t,r,o),xn(t,n)||(Ot=!0),t):(vi&42)===0||(vi&1073741824)!==0&&(Pe&261930)===0?(Ot=!0,t.memoizedState=r):(t=Wp(),Be.lanes|=t,Ki|=t,n)}function ep(t,n,r,o,f){var g=U.p;U.p=g!==0&&8>g?g:8;var j=B.T,C={};B.T=C,mu(t,!1,n,r);try{var D=f(),V=B.S;if(V!==null&&V(C,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var ne=Hj(D,o);ar(t,n,ne,Sn(t))}else ar(t,n,o,Sn(t))}catch(oe){ar(t,n,{then:function(){},status:"rejected",reason:oe},Sn())}finally{U.p=g,j!==null&&C.types!==null&&(j.types=C.types),B.T=j}}function Pj(){}function hu(t,n,r,o){if(t.tag!==5)throw Error(l(476));var f=tp(t).queue;ep(t,f,n,ee,r===null?Pj:function(){return np(t),r(o)})}function tp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:ee},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:r},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function np(t){var n=tp(t);n.next===null&&(n=t.alternate.memoizedState),ar(t,n.next.queue,{},Sn())}function fu(){return Ft(jr)}function ip(){return At().memoizedState}function sp(){return At().memoizedState}function Yj(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var r=Sn();t=Pi(r);var o=Yi(n,t,r);o!==null&&(fn(o,n,r),er(o,n,r)),n={cache:qc()},t.payload=n;return}n=n.return}}function Vj(t,n,r){var o=Sn();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ml(t)?rp(n,r):(r=Oc(t,n,r,o),r!==null&&(fn(r,t,o),lp(r,n,o)))}function ap(t,n,r){var o=Sn();ar(t,n,r,o)}function ar(t,n,r,o){var f={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Ml(t))rp(n,f);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var j=n.lastRenderedState,C=g(j,r);if(f.hasEagerState=!0,f.eagerState=C,xn(C,j))return ml(t,n,f,0),ot===null&&fl(),!1}catch{}if(r=Oc(t,n,f,o),r!==null)return fn(r,t,o),lp(r,n,o),!0}return!1}function mu(t,n,r,o){if(o={lane:2,revertLane:Yu(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ml(t)){if(n)throw Error(l(479))}else n=Oc(t,r,o,2),n!==null&&fn(n,t,2)}function Ml(t){var n=t.alternate;return t===Be||n!==null&&n===Be}function rp(t,n){pa=Tl=!0;var r=t.pending;r===null?n.next=n:(n.next=r.next,r.next=n),t.pending=n}function lp(t,n,r){if((r&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,hf(t,r)}}var rr={readContext:Ft,use:zl,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};rr.useEffectEvent=wt;var op={readContext:Ft,use:zl,useCallback:function(t,n){return nn().memoizedState=[t,n===void 0?null:n],t},useContext:Ft,useEffect:Pm,useImperativeHandle:function(t,n,r){r=r!=null?r.concat([t]):null,Rl(4194308,4,Xm.bind(null,n,t),r)},useLayoutEffect:function(t,n){return Rl(4194308,4,t,n)},useInsertionEffect:function(t,n){Rl(4,2,t,n)},useMemo:function(t,n){var r=nn();n=n===void 0?null:n;var o=t();if(Ts){tn(!0);try{t()}finally{tn(!1)}}return r.memoizedState=[o,n],o},useReducer:function(t,n,r){var o=nn();if(r!==void 0){var f=r(n);if(Ts){tn(!0);try{r(n)}finally{tn(!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=Vj.bind(null,Be,t),[o.memoizedState,t]},useRef:function(t){var n=nn();return t={current:t},n.memoizedState=t},useState:function(t){t=lu(t);var n=t.queue,r=ap.bind(null,Be,n);return n.dispatch=r,[t.memoizedState,r]},useDebugValue:uu,useDeferredValue:function(t,n){var r=nn();return du(r,t,n)},useTransition:function(){var t=lu(!1);return t=ep.bind(null,Be,t.queue,!0,!1),nn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,r){var o=Be,f=nn();if(Ve){if(r===void 0)throw Error(l(407));r=r()}else{if(r=n(),ot===null)throw Error(l(349));(Pe&127)!==0||Em(o,n,r)}f.memoizedState=r;var g={value:r,getSnapshot:n};return f.queue=g,Pm(Om.bind(null,o,g,t),[t]),o.flags|=2048,ya(9,{destroy:void 0},zm.bind(null,o,g,r,n),null),r},useId:function(){var t=nn(),n=ot.identifierPrefix;if(Ve){var r=ni,o=ti;r=(o&~(1<<32-St(o)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Nl++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=$j++,n="_"+n+"r_"+r.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:fu,useFormState:$m,useActionState:$m,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=mu.bind(null,Be,!0,r),r.dispatch=n,[t,n]},useMemoCache:su,useCacheRefresh:function(){return nn().memoizedState=Yj.bind(null,Be)},useEffectEvent:function(t){var n=nn(),r={impl:t};return n.memoizedState=r,function(){if((We&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},pu={readContext:Ft,use:zl,useCallback:Km,useContext:Ft,useEffect:cu,useImperativeHandle:Qm,useInsertionEffect:Vm,useLayoutEffect:Zm,useMemo:Jm,useReducer:Ol,useRef:Fm,useState:function(){return Ol(wi)},useDebugValue:uu,useDeferredValue:function(t,n){var r=At();return Wm(r,at.memoizedState,t,n)},useTransition:function(){var t=Ol(wi)[0],n=At().memoizedState;return[typeof t=="boolean"?t:sr(t),n]},useSyncExternalStore:Nm,useId:ip,useHostTransitionStatus:fu,useFormState:Im,useActionState:Im,useOptimistic:function(t,n){var r=At();return Mm(r,at,t,n)},useMemoCache:su,useCacheRefresh:sp};pu.useEffectEvent=Ym;var cp={readContext:Ft,use:zl,useCallback:Km,useContext:Ft,useEffect:cu,useImperativeHandle:Qm,useInsertionEffect:Vm,useLayoutEffect:Zm,useMemo:Jm,useReducer:ru,useRef:Fm,useState:function(){return ru(wi)},useDebugValue:uu,useDeferredValue:function(t,n){var r=At();return at===null?du(r,t,n):Wm(r,at.memoizedState,t,n)},useTransition:function(){var t=ru(wi)[0],n=At().memoizedState;return[typeof t=="boolean"?t:sr(t),n]},useSyncExternalStore:Nm,useId:ip,useHostTransitionStatus:fu,useFormState:Gm,useActionState:Gm,useOptimistic:function(t,n){var r=At();return at!==null?Mm(r,at,t,n):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:su,useCacheRefresh:sp};cp.useEffectEvent=Ym;function gu(t,n,r,o){n=t.memoizedState,r=r(o,n),r=r==null?n:x({},n,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var yu={enqueueSetState:function(t,n,r){t=t._reactInternals;var o=Sn(),f=Pi(o);f.payload=n,r!=null&&(f.callback=r),n=Yi(t,f,o),n!==null&&(fn(n,t,o),er(n,t,o))},enqueueReplaceState:function(t,n,r){t=t._reactInternals;var o=Sn(),f=Pi(o);f.tag=1,f.payload=n,r!=null&&(f.callback=r),n=Yi(t,f,o),n!==null&&(fn(n,t,o),er(n,t,o))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var r=Sn(),o=Pi(r);o.tag=2,n!=null&&(o.callback=n),n=Yi(t,o,r),n!==null&&(fn(n,t,r),er(n,t,r))}};function up(t,n,r,o,f,g,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,g,j):n.prototype&&n.prototype.isPureReactComponent?!Ya(r,o)||!Ya(f,g):!0}function dp(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&&yu.enqueueReplaceState(n,n.state,null)}function Ns(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=x({},r));for(var f in t)r[f]===void 0&&(r[f]=t[f])}return r}function hp(t){hl(t)}function fp(t){console.error(t)}function mp(t){hl(t)}function Ll(t,n){try{var r=t.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function pp(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 xu(t,n,r){return r=Pi(r),r.tag=3,r.payload={element:null},r.callback=function(){Ll(t,n)},r}function gp(t){return t=Pi(t),t.tag=3,t}function yp(t,n,r,o){var f=r.type.getDerivedStateFromError;if(typeof f=="function"){var g=o.value;t.payload=function(){return f(g)},t.callback=function(){pp(n,r,o)}}var j=r.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(t.callback=function(){pp(n,r,o),typeof f!="function"&&(Ji===null?Ji=new Set([this]):Ji.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function Zj(t,n,r,o,f){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=r.alternate,n!==null&&ca(n,r,f,!0),r=vn.current,r!==null){switch(r.tag){case 31:case 13:return Un===null?Vl():r.alternate===null&&jt===0&&(jt=3),r.flags&=-257,r.flags|=65536,r.lanes=f,o===jl?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([o]):n.add(o),Gu(t,o,f)),!1;case 22:return r.flags|=65536,o===jl?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)),Gu(t,o,f)),!1}throw Error(l(435,r.tag))}return Gu(t,o,f),Vl(),!1}if(Ve)return n=vn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,o!==Uc&&(t=Error(l(422),{cause:o}),Xa(Dn(t,r)))):(o!==Uc&&(n=Error(l(423),{cause:o}),Xa(Dn(n,r))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,o=Dn(o,r),f=xu(t.stateNode,o,f),Zc(t,f),jt!==4&&(jt=2)),!1;var g=Error(l(520),{cause:o});if(g=Dn(g,r),mr===null?mr=[g]:mr.push(g),jt!==4&&(jt=2),n===null)return!0;o=Dn(o,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,t=f&-f,r.lanes|=t,t=xu(r.stateNode,o,t),Zc(r,t),!1;case 1:if(n=r.type,g=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Ji===null||!Ji.has(g))))return r.flags|=65536,f&=-f,r.lanes|=f,f=gp(f),yp(f,t,r,o),Zc(r,f),!1}r=r.return}while(r!==null);return!1}var bu=Error(l(461)),Ot=!1;function Pt(t,n,r,o){n.child=t===null?wm(n,null,r,o):As(n,t.child,r,o)}function xp(t,n,r,o,f){r=r.render;var g=n.ref;if("ref"in o){var j={};for(var C in o)C!=="ref"&&(j[C]=o[C])}else j=o;return js(n),o=eu(t,n,r,j,g,f),C=tu(),t!==null&&!Ot?(nu(t,n,f),ji(t,n,f)):(Ve&&C&&Lc(n),n.flags|=1,Pt(t,n,o,f),n.child)}function bp(t,n,r,o,f){if(t===null){var g=r.type;return typeof g=="function"&&!Rc(g)&&g.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=g,vp(t,n,g,o,f)):(t=gl(r.type,null,o,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(g=t.child,!Tu(t,f)){var j=g.memoizedProps;if(r=r.compare,r=r!==null?r:Ya,r(j,o)&&t.ref===n.ref)return ji(t,n,f)}return n.flags|=1,t=gi(g,o),t.ref=n.ref,t.return=n,n.child=t}function vp(t,n,r,o,f){if(t!==null){var g=t.memoizedProps;if(Ya(g,o)&&t.ref===n.ref)if(Ot=!1,n.pendingProps=o=g,Tu(t,f))(t.flags&131072)!==0&&(Ot=!0);else return n.lanes=t.lanes,ji(t,n,f)}return vu(t,n,r,o,f)}function wp(t,n,r,o){var f=o.children,g=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(g=g!==null?g.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&~g}else o=0,n.child=null;return jp(t,n,g,r,o)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&vl(n,g!==null?g.cachePool:null),g!==null?Sm(n,g):Qc(),Cm(n);else return o=n.lanes=536870912,jp(t,n,g!==null?g.baseLanes|r:r,r,o)}else g!==null?(vl(n,g.cachePool),Sm(n,g),Zi(),n.memoizedState=null):(t!==null&&vl(n,null),Qc(),Zi());return Pt(t,n,f,r),n.child}function lr(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function jp(t,n,r,o,f){var g=Fc();return g=g===null?null:{parent:Et._currentValue,pool:g},n.memoizedState={baseLanes:r,cachePool:g},t!==null&&vl(n,null),Qc(),Cm(n),t!==null&&ca(t,n,o,!0),n.childLanes=f,null}function _l(t,n){return n=Bl({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function kp(t,n,r){return As(n,t.child,null,r),t=_l(n,n.pendingProps),t.flags|=2,wn(n),n.memoizedState=null,t}function Xj(t,n,r){var o=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(Ve){if(o.mode==="hidden")return t=_l(n,o),n.lanes=536870912,lr(null,t);if(Jc(n),(t=pt)?(t=Lg(t,_n),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:$i!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},r=rm(t),r.return=n,n.child=r,Gt=n,pt=null)):t=null,t===null)throw qi(n);return n.lanes=536870912,null}return _l(n,o)}var g=t.memoizedState;if(g!==null){var j=g.dehydrated;if(Jc(n),f)if(n.flags&256)n.flags&=-257,n=kp(t,n,r);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(l(558));else if(Ot||ca(t,n,r,!1),f=(r&t.childLanes)!==0,Ot||f){if(o=ot,o!==null&&(j=ff(o,r),j!==0&&j!==g.retryLane))throw g.retryLane=j,xs(t,j),fn(o,t,j),bu;Vl(),n=kp(t,n,r)}else t=g.treeContext,pt=Bn(j.nextSibling),Gt=n,Ve=!0,Ii=null,_n=!1,t!==null&&cm(n,t),n=_l(n,o),n.flags|=4096;return n}return t=gi(t.child,{mode:o.mode,children:o.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Ul(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 vu(t,n,r,o,f){return js(n),r=eu(t,n,r,o,void 0,f),o=tu(),t!==null&&!Ot?(nu(t,n,f),ji(t,n,f)):(Ve&&o&&Lc(n),n.flags|=1,Pt(t,n,r,f),n.child)}function Sp(t,n,r,o,f,g){return js(n),n.updateQueue=null,r=Tm(n,o,r,f),Am(t),o=tu(),t!==null&&!Ot?(nu(t,n,g),ji(t,n,g)):(Ve&&o&&Lc(n),n.flags|=1,Pt(t,n,r,g),n.child)}function Cp(t,n,r,o,f){if(js(n),n.stateNode===null){var g=aa,j=r.contextType;typeof j=="object"&&j!==null&&(g=Ft(j)),g=new r(o,g),n.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=yu,n.stateNode=g,g._reactInternals=n,g=n.stateNode,g.props=o,g.state=n.memoizedState,g.refs={},Yc(n),j=r.contextType,g.context=typeof j=="object"&&j!==null?Ft(j):aa,g.state=n.memoizedState,j=r.getDerivedStateFromProps,typeof j=="function"&&(gu(n,r,j,o),g.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(j=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),j!==g.state&&yu.enqueueReplaceState(g,g.state,null),nr(n,o,g,f),tr(),g.state=n.memoizedState),typeof g.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(t===null){g=n.stateNode;var C=n.memoizedProps,D=Ns(r,C);g.props=D;var V=g.context,ne=r.contextType;j=aa,typeof ne=="object"&&ne!==null&&(j=Ft(ne));var oe=r.getDerivedStateFromProps;ne=typeof oe=="function"||typeof g.getSnapshotBeforeUpdate=="function",C=n.pendingProps!==C,ne||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(C||V!==j)&&dp(n,g,o,j),Fi=!1;var Z=n.memoizedState;g.state=Z,nr(n,o,g,f),tr(),V=n.memoizedState,C||Z!==V||Fi?(typeof oe=="function"&&(gu(n,r,oe,o),V=n.memoizedState),(D=Fi||up(n,r,D,o,Z,V,j))?(ne||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(n.flags|=4194308)):(typeof g.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=V),g.props=o,g.state=V,g.context=j,o=D):(typeof g.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{g=n.stateNode,Vc(t,n),j=n.memoizedProps,ne=Ns(r,j),g.props=ne,oe=n.pendingProps,Z=g.context,V=r.contextType,D=aa,typeof V=="object"&&V!==null&&(D=Ft(V)),C=r.getDerivedStateFromProps,(V=typeof C=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(j!==oe||Z!==D)&&dp(n,g,o,D),Fi=!1,Z=n.memoizedState,g.state=Z,nr(n,o,g,f),tr();var K=n.memoizedState;j!==oe||Z!==K||Fi||t!==null&&t.dependencies!==null&&xl(t.dependencies)?(typeof C=="function"&&(gu(n,r,C,o),K=n.memoizedState),(ne=Fi||up(n,r,ne,o,Z,K,D)||t!==null&&t.dependencies!==null&&xl(t.dependencies))?(V||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(o,K,D),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(o,K,D)),typeof g.componentDidUpdate=="function"&&(n.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof g.componentDidUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=K),g.props=o,g.state=K,g.context=D,o=ne):(typeof g.componentDidUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&Z===t.memoizedState||(n.flags|=1024),o=!1)}return g=o,Ul(t,n),o=(n.flags&128)!==0,g||o?(g=n.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:g.render(),n.flags|=1,t!==null&&o?(n.child=As(n,t.child,null,f),n.child=As(n,null,r,f)):Pt(t,n,r,f),n.memoizedState=g.state,t=n.child):t=ji(t,n,f),t}function Ap(t,n,r,o){return vs(),n.flags|=256,Pt(t,n,r,o),n.child}var wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ju(t){return{baseLanes:t,cachePool:pm()}}function ku(t,n,r){return t=t!==null?t.childLanes&~r:0,n&&(t|=kn),t}function Tp(t,n,r){var o=n.pendingProps,f=!1,g=(n.flags&128)!==0,j;if((j=g)||(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(Ve){if(f?Vi(n):Zi(),(t=pt)?(t=Lg(t,_n),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:$i!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},r=rm(t),r.return=n,n.child=r,Gt=n,pt=null)):t=null,t===null)throw qi(n);return ad(t)?n.lanes=32:n.lanes=536870912,null}var C=o.children;return o=o.fallback,f?(Zi(),f=n.mode,C=Bl({mode:"hidden",children:C},f),o=bs(o,f,r,null),C.return=n,o.return=n,C.sibling=o,n.child=C,o=n.child,o.memoizedState=ju(r),o.childLanes=ku(t,j,r),n.memoizedState=wu,lr(null,o)):(Vi(n),Su(n,C))}var D=t.memoizedState;if(D!==null&&(C=D.dehydrated,C!==null)){if(g)n.flags&256?(Vi(n),n.flags&=-257,n=Cu(t,n,r)):n.memoizedState!==null?(Zi(),n.child=t.child,n.flags|=128,n=null):(Zi(),C=o.fallback,f=n.mode,o=Bl({mode:"visible",children:o.children},f),C=bs(C,f,r,null),C.flags|=2,o.return=n,C.return=n,o.sibling=C,n.child=o,As(n,t.child,null,r),o=n.child,o.memoizedState=ju(r),o.childLanes=ku(t,j,r),n.memoizedState=wu,n=lr(null,o));else if(Vi(n),ad(C)){if(j=C.nextSibling&&C.nextSibling.dataset,j)var V=j.dgst;j=V,o=Error(l(419)),o.stack="",o.digest=j,Xa({value:o,source:null,stack:null}),n=Cu(t,n,r)}else if(Ot||ca(t,n,r,!1),j=(r&t.childLanes)!==0,Ot||j){if(j=ot,j!==null&&(o=ff(j,r),o!==0&&o!==D.retryLane))throw D.retryLane=o,xs(t,o),fn(j,t,o),bu;sd(C)||Vl(),n=Cu(t,n,r)}else sd(C)?(n.flags|=192,n.child=t.child,n=null):(t=D.treeContext,pt=Bn(C.nextSibling),Gt=n,Ve=!0,Ii=null,_n=!1,t!==null&&cm(n,t),n=Su(n,o.children),n.flags|=4096);return n}return f?(Zi(),C=o.fallback,f=n.mode,D=t.child,V=D.sibling,o=gi(D,{mode:"hidden",children:o.children}),o.subtreeFlags=D.subtreeFlags&65011712,V!==null?C=gi(V,C):(C=bs(C,f,r,null),C.flags|=2),C.return=n,o.return=n,o.sibling=C,n.child=o,lr(null,o),o=n.child,C=t.child.memoizedState,C===null?C=ju(r):(f=C.cachePool,f!==null?(D=Et._currentValue,f=f.parent!==D?{parent:D,pool:D}:f):f=pm(),C={baseLanes:C.baseLanes|r,cachePool:f}),o.memoizedState=C,o.childLanes=ku(t,j,r),n.memoizedState=wu,lr(t.child,o)):(Vi(n),r=t.child,t=r.sibling,r=gi(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 Su(t,n){return n=Bl({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Bl(t,n){return t=bn(22,t,null,n),t.lanes=0,t}function Cu(t,n,r){return As(n,t.child,null,r),t=Su(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Np(t,n,r){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),$c(t.return,n,r)}function Au(t,n,r,o,f,g){var j=t.memoizedState;j===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:f,treeForkCount:g}:(j.isBackwards=n,j.rendering=null,j.renderingStartTime=0,j.last=o,j.tail=r,j.tailMode=f,j.treeForkCount=g)}function Ep(t,n,r){var o=n.pendingProps,f=o.revealOrder,g=o.tail;o=o.children;var j=Ct.current,C=(j&2)!==0;if(C?(j=j&1|2,n.flags|=128):j&=1,E(Ct,j),Pt(t,n,o,r),o=Ve?Za:0,!C&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Np(t,r,n);else if(t.tag===19)Np(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&&Al(t)===null&&(f=r),r=r.sibling;r=f,r===null?(f=n.child,n.child=null):(f=r.sibling,r.sibling=null),Au(n,!1,f,r,g,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&&Al(t)===null){n.child=f;break}t=f.sibling,f.sibling=r,r=f,f=t}Au(n,!0,r,null,g,o);break;case"together":Au(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function ji(t,n,r){if(t!==null&&(n.dependencies=t.dependencies),Ki|=n.lanes,(r&n.childLanes)===0)if(t!==null){if(ca(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=gi(t,t.pendingProps),n.child=r,r.return=n;t.sibling!==null;)t=t.sibling,r=r.sibling=gi(t,t.pendingProps),r.return=n;r.sibling=null}return n.child}function Tu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&xl(t)))}function Qj(t,n,r){switch(n.tag){case 3:Xe(n,n.stateNode.containerInfo),Gi(n,Et,t.memoizedState.cache),vs();break;case 27:case 5:ht(n);break;case 4:Xe(n,n.stateNode.containerInfo);break;case 10:Gi(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Jc(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Vi(n),n.flags|=128,null):(r&n.child.childLanes)!==0?Tp(t,n,r):(Vi(n),t=ji(t,n,r),t!==null?t.sibling:null);Vi(n);break;case 19:var f=(t.flags&128)!==0;if(o=(r&n.childLanes)!==0,o||(ca(t,n,r,!1),o=(r&n.childLanes)!==0),f){if(o)return Ep(t,n,r);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),E(Ct,Ct.current),o)break;return null;case 22:return n.lanes=0,wp(t,n,r,n.pendingProps);case 24:Gi(n,Et,t.memoizedState.cache)}return ji(t,n,r)}function zp(t,n,r){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ot=!0;else{if(!Tu(t,r)&&(n.flags&128)===0)return Ot=!1,Qj(t,n,r);Ot=(t.flags&131072)!==0}else Ot=!1,Ve&&(n.flags&1048576)!==0&&om(n,Za,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(t=Ss(n.elementType),n.type=t,typeof t=="function")Rc(t)?(o=Ns(t,o),n.tag=1,n=Cp(null,n,t,o,r)):(n.tag=0,n=vu(null,n,t,o,r));else{if(t!=null){var f=t.$$typeof;if(f===M){n.tag=11,n=xp(null,n,t,o,r);break e}else if(f===P){n.tag=14,n=bp(null,n,t,o,r);break e}}throw n=te(t)||t,Error(l(306,n,""))}}return n;case 0:return vu(t,n,n.type,n.pendingProps,r);case 1:return o=n.type,f=Ns(o,n.pendingProps),Cp(t,n,o,f,r);case 3:e:{if(Xe(n,n.stateNode.containerInfo),t===null)throw Error(l(387));o=n.pendingProps;var g=n.memoizedState;f=g.element,Vc(t,n),nr(n,o,null,r);var j=n.memoizedState;if(o=j.cache,Gi(n,Et,o),o!==g.cache&&Ic(n,[Et],r,!0),tr(),o=j.element,g.isDehydrated)if(g={element:o,isDehydrated:!1,cache:j.cache},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){n=Ap(t,n,o,r);break e}else if(o!==f){f=Dn(Error(l(424)),n),Xa(f),n=Ap(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,pt=Bn(t.firstChild),Gt=n,Ve=!0,Ii=null,_n=!0,r=wm(n,null,o,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(vs(),o===f){n=ji(t,n,r);break e}Pt(t,n,o,r)}n=n.child}return n;case 26:return Ul(t,n),t===null?(r=Ig(n.type,null,n.pendingProps,null))?n.memoizedState=r:Ve||(r=n.type,t=n.pendingProps,o=eo(ye.current).createElement(r),o[qt]=n,o[ln]=t,Yt(o,r,t),Ht(o),n.stateNode=o):n.memoizedState=Ig(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ht(n),t===null&&Ve&&(o=n.stateNode=Bg(n.type,n.pendingProps,ye.current),Gt=n,_n=!0,f=pt,ns(n.type)?(rd=f,pt=Bn(o.firstChild)):pt=f),Pt(t,n,n.pendingProps.children,r),Ul(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&Ve&&((f=o=pt)&&(o=Ak(o,n.type,n.pendingProps,_n),o!==null?(n.stateNode=o,Gt=n,pt=Bn(o.firstChild),_n=!1,f=!0):f=!1),f||qi(n)),ht(n),f=n.type,g=n.pendingProps,j=t!==null?t.memoizedProps:null,o=g.children,td(f,g)?o=null:j!==null&&td(f,j)&&(n.flags|=32),n.memoizedState!==null&&(f=eu(t,n,Ij,null,null,r),jr._currentValue=f),Ul(t,n),Pt(t,n,o,r),n.child;case 6:return t===null&&Ve&&((t=r=pt)&&(r=Tk(r,n.pendingProps,_n),r!==null?(n.stateNode=r,Gt=n,pt=null,t=!0):t=!1),t||qi(n)),null;case 13:return Tp(t,n,r);case 4:return Xe(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=As(n,null,o,r):Pt(t,n,o,r),n.child;case 11:return xp(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,Gi(n,n.type,o.value),Pt(t,n,o.children,r),n.child;case 9:return f=n.type._context,o=n.pendingProps.children,js(n),f=Ft(f),o=o(f),n.flags|=1,Pt(t,n,o,r),n.child;case 14:return bp(t,n,n.type,n.pendingProps,r);case 15:return vp(t,n,n.type,n.pendingProps,r);case 19:return Ep(t,n,r);case 31:return Xj(t,n,r);case 22:return wp(t,n,r,n.pendingProps);case 24:return js(n),o=Ft(Et),t===null?(f=Fc(),f===null&&(f=ot,g=qc(),f.pooledCache=g,g.refCount++,g!==null&&(f.pooledCacheLanes|=r),f=g),n.memoizedState={parent:o,cache:f},Yc(n),Gi(n,Et,f)):((t.lanes&r)!==0&&(Vc(t,n),nr(n,null,null,r),tr()),f=t.memoizedState,g=n.memoizedState,f.parent!==o?(f={parent:o,cache:o},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),Gi(n,Et,o)):(o=g.cache,Gi(n,Et,o),o!==f.cache&&Ic(n,[Et],r,!0))),Pt(t,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function ki(t){t.flags|=4}function Nu(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(ig())t.flags|=8192;else throw Cs=jl,Pc}else t.flags&=-16777217}function Op(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Yg(n))if(ig())t.flags|=8192;else throw Cs=jl,Pc}function Hl(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?_a():536870912,t.lanes|=n,wa|=n)}function or(t,n){if(!Ve)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 gt(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 Kj(t,n,r){var o=n.pendingProps;switch(_c(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(n),null;case 1:return gt(n),null;case 3:return r=n.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),bi(Et),de(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(oa(n)?ki(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Bc())),gt(n),null;case 26:var f=n.type,g=n.memoizedState;return t===null?(ki(n),g!==null?(gt(n),Op(n,g)):(gt(n),Nu(n,f,null,o,r))):g?g!==t.memoizedState?(ki(n),gt(n),Op(n,g)):(gt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==o&&ki(n),gt(n),Nu(n,f,t,o,r)),null;case 27:if(Lt(n),r=ye.current,f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&ki(n);else{if(!o){if(n.stateNode===null)throw Error(l(166));return gt(n),null}t=J.current,oa(n)?um(n):(t=Bg(f,o,r),n.stateNode=t,ki(n))}return gt(n),null;case 5:if(Lt(n),f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&ki(n);else{if(!o){if(n.stateNode===null)throw Error(l(166));return gt(n),null}if(g=J.current,oa(n))um(n);else{var j=eo(ye.current);switch(g){case 1:g=j.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:g=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":g=j.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":g=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":g=j.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof o.is=="string"?j.createElement("select",{is:o.is}):j.createElement("select"),o.multiple?g.multiple=!0:o.size&&(g.size=o.size);break;default:g=typeof o.is=="string"?j.createElement(f,{is:o.is}):j.createElement(f)}}g[qt]=n,g[ln]=o;e:for(j=n.child;j!==null;){if(j.tag===5||j.tag===6)g.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=g;e:switch(Yt(g,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&&ki(n)}}return gt(n),Nu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,r),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&ki(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(l(166));if(t=ye.current,oa(n)){if(t=n.stateNode,r=n.memoizedProps,o=null,f=Gt,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}t[qt]=n,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||Tg(t.nodeValue,r)),t||qi(n,!0)}else t=eo(t).createTextNode(o),t[qt]=n,n.stateNode=t}return gt(n),null;case 31:if(r=n.memoizedState,t===null||t.memoizedState!==null){if(o=oa(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[qt]=n}else vs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;gt(n),t=!1}else r=Bc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return n.flags&256?(wn(n),n):(wn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return gt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=oa(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[qt]=n}else vs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;gt(n),f=!1}else f=Bc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(wn(n),n):(wn(n),null)}return wn(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),g=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(g=o.memoizedState.cachePool.pool),g!==f&&(o.flags|=2048)),r!==t&&r&&(n.child.flags|=8192),Hl(n,n.updateQueue),gt(n),null);case 4:return de(),t===null&&Qu(n.stateNode.containerInfo),gt(n),null;case 10:return bi(n.type),gt(n),null;case 19:if(Q(Ct),o=n.memoizedState,o===null)return gt(n),null;if(f=(n.flags&128)!==0,g=o.rendering,g===null)if(f)or(o,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(g=Al(t),g!==null){for(n.flags|=128,or(o,!1),t=g.updateQueue,n.updateQueue=t,Hl(n,t),n.subtreeFlags=0,t=r,r=n.child;r!==null;)am(r,t),r=r.sibling;return E(Ct,Ct.current&1|2),Ve&&yi(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&Tt()>Fl&&(n.flags|=128,f=!0,or(o,!1),n.lanes=4194304)}else{if(!f)if(t=Al(g),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,Hl(n,t),or(o,!0),o.tail===null&&o.tailMode==="hidden"&&!g.alternate&&!Ve)return gt(n),null}else 2*Tt()-o.renderingStartTime>Fl&&r!==536870912&&(n.flags|=128,f=!0,or(o,!1),n.lanes=4194304);o.isBackwards?(g.sibling=n.child,n.child=g):(t=o.last,t!==null?t.sibling=g:n.child=g,o.last=g)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Tt(),t.sibling=null,r=Ct.current,E(Ct,f?r&1|2:r&1),Ve&&yi(n,o.treeForkCount),t):(gt(n),null);case 22:case 23:return wn(n),Kc(),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&&(gt(n),n.subtreeFlags&6&&(n.flags|=8192)):gt(n),r=n.updateQueue,r!==null&&Hl(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(ks),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),bi(Et),gt(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function Jj(t,n){switch(_c(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return bi(Et),de(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Lt(n),null;case 31:if(n.memoizedState!==null){if(wn(n),n.alternate===null)throw Error(l(340));vs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(wn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));vs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Q(Ct),null;case 4:return de(),null;case 10:return bi(n.type),null;case 22:case 23:return wn(n),Kc(),t!==null&&Q(ks),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return bi(Et),null;case 25:return null;default:return null}}function Rp(t,n){switch(_c(n),n.tag){case 3:bi(Et),de();break;case 26:case 27:case 5:Lt(n);break;case 4:de();break;case 31:n.memoizedState!==null&&wn(n);break;case 13:wn(n);break;case 19:Q(Ct);break;case 10:bi(n.type);break;case 22:case 23:wn(n),Kc(),t!==null&&Q(ks);break;case 24:bi(Et)}}function cr(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 g=r.create,j=r.inst;o=g(),j.destroy=o}r=r.next}while(r!==f)}}catch(C){it(n,n.return,C)}}function Xi(t,n,r){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var g=f.next;o=g;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,V=C;try{V()}catch(ne){it(f,D,ne)}}}o=o.next}while(o!==g)}}catch(ne){it(n,n.return,ne)}}function Dp(t){var n=t.updateQueue;if(n!==null){var r=t.stateNode;try{km(n,r)}catch(o){it(t,t.return,o)}}}function Mp(t,n,r){r.props=Ns(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){it(t,n,o)}}function ur(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 ii(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 Lp(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 Eu(t,n,r){try{var o=t.stateNode;vk(o,t.type,r,n),o[ln]=n}catch(f){it(t,t.return,f)}}function _p(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ns(t.type)||t.tag===4}function zu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_p(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&&ns(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 Ou(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=mi));else if(o!==4&&(o===27&&ns(t.type)&&(r=t.stateNode,n=null),t=t.child,t!==null))for(Ou(t,n,r),t=t.sibling;t!==null;)Ou(t,n,r),t=t.sibling}function $l(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&&ns(t.type)&&(r=t.stateNode),t=t.child,t!==null))for($l(t,n,r),t=t.sibling;t!==null;)$l(t,n,r),t=t.sibling}function Up(t){var n=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Yt(n,o,r),n[qt]=t,n[ln]=r}catch(g){it(t,t.return,g)}}var Si=!1,Rt=!1,Ru=!1,Bp=typeof WeakSet=="function"?WeakSet:Set,$t=null;function Wj(t,n){if(t=t.containerInfo,Wu=lo,t=Qf(t),Cc(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,g=o.focusNode;o=o.focusOffset;try{r.nodeType,g.nodeType}catch{r=null;break e}var j=0,C=-1,D=-1,V=0,ne=0,oe=t,Z=null;t:for(;;){for(var K;oe!==r||f!==0&&oe.nodeType!==3||(C=j+f),oe!==g||o!==0&&oe.nodeType!==3||(D=j+o),oe.nodeType===3&&(j+=oe.nodeValue.length),(K=oe.firstChild)!==null;)Z=oe,oe=K;for(;;){if(oe===t)break t;if(Z===r&&++V===f&&(C=j),Z===g&&++ne===o&&(D=j),(K=oe.nextSibling)!==null)break;oe=Z,Z=oe.parentNode}oe=K}r=C===-1||D===-1?null:{start:C,end:D}}else r=null}r=r||{start:0,end:0}}else r=null;for(ed={focusedElem:t,selectionRange:r},lo=!1,$t=n;$t!==null;)if(n=$t,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,$t=t;else for(;$t!==null;){switch(n=$t,g=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&&g!==null){t=void 0,r=n,f=g.memoizedProps,g=g.memoizedState,o=r.stateNode;try{var je=Ns(r.type,f);t=o.getSnapshotBeforeUpdate(je,g),o.__reactInternalSnapshotBeforeUpdate=t}catch(Oe){it(r,r.return,Oe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,r=t.nodeType,r===9)id(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":id(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,$t=t;break}$t=n.return}}function Hp(t,n,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:Ai(t,r),o&4&&cr(5,r);break;case 1:if(Ai(t,r),o&4)if(t=r.stateNode,n===null)try{t.componentDidMount()}catch(j){it(r,r.return,j)}else{var f=Ns(r.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(f,n,t.__reactInternalSnapshotBeforeUpdate)}catch(j){it(r,r.return,j)}}o&64&&Dp(r),o&512&&ur(r,r.return);break;case 3:if(Ai(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{km(t,n)}catch(j){it(r,r.return,j)}}break;case 27:n===null&&o&4&&Up(r);case 26:case 5:Ai(t,r),n===null&&o&4&&Lp(r),o&512&&ur(r,r.return);break;case 12:Ai(t,r);break;case 31:Ai(t,r),o&4&&qp(t,r);break;case 13:Ai(t,r),o&4&&Gp(t,r),o&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=ok.bind(null,r),Nk(t,r))));break;case 22:if(o=r.memoizedState!==null||Si,!o){n=n!==null&&n.memoizedState!==null||Rt,f=Si;var g=Rt;Si=o,(Rt=n)&&!g?Ti(t,r,(r.subtreeFlags&8772)!==0):Ai(t,r),Si=f,Rt=g}break;case 30:break;default:Ai(t,r)}}function $p(t){var n=t.alternate;n!==null&&(t.alternate=null,$p(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&oc(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 xt=null,cn=!1;function Ci(t,n,r){for(r=r.child;r!==null;)Ip(t,n,r),r=r.sibling}function Ip(t,n,r){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(st,r)}catch{}switch(r.tag){case 26:Rt||ii(r,n),Ci(t,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Rt||ii(r,n);var o=xt,f=cn;ns(r.type)&&(xt=r.stateNode,cn=!1),Ci(t,n,r),br(r.stateNode),xt=o,cn=f;break;case 5:Rt||ii(r,n);case 6:if(o=xt,f=cn,xt=null,Ci(t,n,r),xt=o,cn=f,xt!==null)if(cn)try{(xt.nodeType===9?xt.body:xt.nodeName==="HTML"?xt.ownerDocument.body:xt).removeChild(r.stateNode)}catch(g){it(r,n,g)}else try{xt.removeChild(r.stateNode)}catch(g){it(r,n,g)}break;case 18:xt!==null&&(cn?(t=xt,Dg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),Ea(t)):Dg(xt,r.stateNode));break;case 4:o=xt,f=cn,xt=r.stateNode.containerInfo,cn=!0,Ci(t,n,r),xt=o,cn=f;break;case 0:case 11:case 14:case 15:Xi(2,r,n),Rt||Xi(4,r,n),Ci(t,n,r);break;case 1:Rt||(ii(r,n),o=r.stateNode,typeof o.componentWillUnmount=="function"&&Mp(r,n,o)),Ci(t,n,r);break;case 21:Ci(t,n,r);break;case 22:Rt=(o=Rt)||r.memoizedState!==null,Ci(t,n,r),Rt=o;break;default:Ci(t,n,r)}}function qp(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ea(t)}catch(r){it(n,n.return,r)}}}function Gp(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ea(t)}catch(r){it(n,n.return,r)}}function ek(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Bp),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Bp),n;default:throw Error(l(435,t.tag))}}function Il(t,n){var r=ek(t);n.forEach(function(o){if(!r.has(o)){r.add(o);var f=ck.bind(null,t,o);o.then(f,f)}})}function un(t,n){var r=n.deletions;if(r!==null)for(var o=0;o<r.length;o++){var f=r[o],g=t,j=n,C=j;e:for(;C!==null;){switch(C.tag){case 27:if(ns(C.type)){xt=C.stateNode,cn=!1;break e}break;case 5:xt=C.stateNode,cn=!1;break e;case 3:case 4:xt=C.stateNode.containerInfo,cn=!0;break e}C=C.return}if(xt===null)throw Error(l(160));Ip(g,j,f),xt=null,cn=!1,g=f.alternate,g!==null&&(g.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Fp(n,t),n=n.sibling}var Yn=null;function Fp(t,n){var r=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:un(n,t),dn(t),o&4&&(Xi(3,t,t.return),cr(3,t),Xi(5,t,t.return));break;case 1:un(n,t),dn(t),o&512&&(Rt||r===null||ii(r,r.return)),o&64&&Si&&(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=Yn;if(un(n,t),dn(t),o&512&&(Rt||r===null||ii(r,r.return)),o&4){var g=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":g=f.getElementsByTagName("title")[0],(!g||g[Ua]||g[qt]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=f.createElement(o),f.head.insertBefore(g,f.querySelector("head > title"))),Yt(g,o,r),g[qt]=t,Ht(g),o=g;break e;case"link":var j=Fg("link","href",f).get(o+(r.href||""));if(j){for(var C=0;C<j.length;C++)if(g=j[C],g.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&g.getAttribute("rel")===(r.rel==null?null:r.rel)&&g.getAttribute("title")===(r.title==null?null:r.title)&&g.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){j.splice(C,1);break t}}g=f.createElement(o),Yt(g,o,r),f.head.appendChild(g);break;case"meta":if(j=Fg("meta","content",f).get(o+(r.content||""))){for(C=0;C<j.length;C++)if(g=j[C],g.getAttribute("content")===(r.content==null?null:""+r.content)&&g.getAttribute("name")===(r.name==null?null:r.name)&&g.getAttribute("property")===(r.property==null?null:r.property)&&g.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&g.getAttribute("charset")===(r.charSet==null?null:r.charSet)){j.splice(C,1);break t}}g=f.createElement(o),Yt(g,o,r),f.head.appendChild(g);break;default:throw Error(l(468,o))}g[qt]=t,Ht(g),o=g}t.stateNode=o}else Pg(f,t.type,t.stateNode);else t.stateNode=Gg(f,o,t.memoizedProps);else g!==o?(g===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):g.count--,o===null?Pg(f,t.type,t.stateNode):Gg(f,o,t.memoizedProps)):o===null&&t.stateNode!==null&&Eu(t,t.memoizedProps,r.memoizedProps)}break;case 27:un(n,t),dn(t),o&512&&(Rt||r===null||ii(r,r.return)),r!==null&&o&4&&Eu(t,t.memoizedProps,r.memoizedProps);break;case 5:if(un(n,t),dn(t),o&512&&(Rt||r===null||ii(r,r.return)),t.flags&32){f=t.stateNode;try{Js(f,"")}catch(je){it(t,t.return,je)}}o&4&&t.stateNode!=null&&(f=t.memoizedProps,Eu(t,f,r!==null?r.memoizedProps:f)),o&1024&&(Ru=!0);break;case 6:if(un(n,t),dn(t),o&4){if(t.stateNode===null)throw Error(l(162));o=t.memoizedProps,r=t.stateNode;try{r.nodeValue=o}catch(je){it(t,t.return,je)}}break;case 3:if(io=null,f=Yn,Yn=to(n.containerInfo),un(n,t),Yn=f,dn(t),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Ea(n.containerInfo)}catch(je){it(t,t.return,je)}Ru&&(Ru=!1,Pp(t));break;case 4:o=Yn,Yn=to(t.stateNode.containerInfo),un(n,t),dn(t),Yn=o;break;case 12:un(n,t),dn(t);break;case 31:un(n,t),dn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Il(t,o)));break;case 13:un(n,t),dn(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Gl=Tt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Il(t,o)));break;case 22:f=t.memoizedState!==null;var D=r!==null&&r.memoizedState!==null,V=Si,ne=Rt;if(Si=V||f,Rt=ne||D,un(n,t),Rt=ne,Si=V,dn(t),o&8192)e:for(n=t.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(r===null||D||Si||Rt||Es(t)),r=null,n=t;;){if(n.tag===5||n.tag===26){if(r===null){D=r=n;try{if(g=D.stateNode,f)j=g.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{C=D.stateNode;var oe=D.memoizedProps.style,Z=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;C.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(je){it(D,D.return,je)}}}else if(n.tag===6){if(r===null){D=n;try{D.stateNode.nodeValue=f?"":D.memoizedProps}catch(je){it(D,D.return,je)}}}else if(n.tag===18){if(r===null){D=n;try{var K=D.stateNode;f?Mg(K,!0):Mg(D.stateNode,!1)}catch(je){it(D,D.return,je)}}}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,Il(t,r))));break;case 19:un(n,t),dn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Il(t,o)));break;case 30:break;case 21:break;default:un(n,t),dn(t)}}function dn(t){var n=t.flags;if(n&2){try{for(var r,o=t.return;o!==null;){if(_p(o)){r=o;break}o=o.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var f=r.stateNode,g=zu(t);$l(t,g,f);break;case 5:var j=r.stateNode;r.flags&32&&(Js(j,""),r.flags&=-33);var C=zu(t);$l(t,C,j);break;case 3:case 4:var D=r.stateNode.containerInfo,V=zu(t);Ou(t,V,D);break;default:throw Error(l(161))}}catch(ne){it(t,t.return,ne)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Pp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Pp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Ai(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Hp(t,n.alternate,n),n=n.sibling}function Es(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Xi(4,n,n.return),Es(n);break;case 1:ii(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Mp(n,n.return,r),Es(n);break;case 27:br(n.stateNode);case 26:case 5:ii(n,n.return),Es(n);break;case 22:n.memoizedState===null&&Es(n);break;case 30:Es(n);break;default:Es(n)}t=t.sibling}}function Ti(t,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,f=t,g=n,j=g.flags;switch(g.tag){case 0:case 11:case 15:Ti(f,g,r),cr(4,g);break;case 1:if(Ti(f,g,r),o=g,f=o.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){it(o,o.return,V)}if(o=g,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++)jm(D[f],C)}catch(V){it(o,o.return,V)}}r&&j&64&&Dp(g),ur(g,g.return);break;case 27:Up(g);case 26:case 5:Ti(f,g,r),r&&o===null&&j&4&&Lp(g),ur(g,g.return);break;case 12:Ti(f,g,r);break;case 31:Ti(f,g,r),r&&j&4&&qp(f,g);break;case 13:Ti(f,g,r),r&&j&4&&Gp(f,g);break;case 22:g.memoizedState===null&&Ti(f,g,r),ur(g,g.return);break;case 30:break;default:Ti(f,g,r)}n=n.sibling}}function Du(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&&Qa(r))}function Mu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Qa(t))}function Vn(t,n,r,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Yp(t,n,r,o),n=n.sibling}function Yp(t,n,r,o){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Vn(t,n,r,o),f&2048&&cr(9,n);break;case 1:Vn(t,n,r,o);break;case 3:Vn(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&&Qa(t)));break;case 12:if(f&2048){Vn(t,n,r,o),t=n.stateNode;try{var g=n.memoizedProps,j=g.id,C=g.onPostCommit;typeof C=="function"&&C(j,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(D){it(n,n.return,D)}}else Vn(t,n,r,o);break;case 31:Vn(t,n,r,o);break;case 13:Vn(t,n,r,o);break;case 23:break;case 22:g=n.stateNode,j=n.alternate,n.memoizedState!==null?g._visibility&2?Vn(t,n,r,o):dr(t,n):g._visibility&2?Vn(t,n,r,o):(g._visibility|=2,xa(t,n,r,o,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Du(j,n);break;case 24:Vn(t,n,r,o),f&2048&&Mu(n.alternate,n);break;default:Vn(t,n,r,o)}}function xa(t,n,r,o,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var g=t,j=n,C=r,D=o,V=j.flags;switch(j.tag){case 0:case 11:case 15:xa(g,j,C,D,f),cr(8,j);break;case 23:break;case 22:var ne=j.stateNode;j.memoizedState!==null?ne._visibility&2?xa(g,j,C,D,f):dr(g,j):(ne._visibility|=2,xa(g,j,C,D,f)),f&&V&2048&&Du(j.alternate,j);break;case 24:xa(g,j,C,D,f),f&&V&2048&&Mu(j.alternate,j);break;default:xa(g,j,C,D,f)}n=n.sibling}}function dr(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:dr(r,o),f&2048&&Du(o.alternate,o);break;case 24:dr(r,o),f&2048&&Mu(o.alternate,o);break;default:dr(r,o)}n=n.sibling}}var hr=8192;function ba(t,n,r){if(t.subtreeFlags&hr)for(t=t.child;t!==null;)Vp(t,n,r),t=t.sibling}function Vp(t,n,r){switch(t.tag){case 26:ba(t,n,r),t.flags&hr&&t.memoizedState!==null&&$k(r,Yn,t.memoizedState,t.memoizedProps);break;case 5:ba(t,n,r);break;case 3:case 4:var o=Yn;Yn=to(t.stateNode.containerInfo),ba(t,n,r),Yn=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=hr,hr=16777216,ba(t,n,r),hr=o):ba(t,n,r));break;default:ba(t,n,r)}}function Zp(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 fr(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];$t=o,Qp(o,t)}Zp(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xp(t),t=t.sibling}function Xp(t){switch(t.tag){case 0:case 11:case 15:fr(t),t.flags&2048&&Xi(9,t,t.return);break;case 3:fr(t);break;case 12:fr(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,ql(t)):fr(t);break;default:fr(t)}}function ql(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];$t=o,Qp(o,t)}Zp(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Xi(8,n,n.return),ql(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,ql(n));break;default:ql(n)}t=t.sibling}}function Qp(t,n){for(;$t!==null;){var r=$t;switch(r.tag){case 0:case 11:case 15:Xi(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:Qa(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,$t=o;else e:for(r=t;$t!==null;){o=$t;var f=o.sibling,g=o.return;if($p(o),o===r){$t=null;break e}if(f!==null){f.return=g,$t=f;break e}$t=g}}}var tk={getCacheForType:function(t){var n=Ft(Et),r=n.data.get(t);return r===void 0&&(r=t(),n.data.set(t,r)),r},cacheSignal:function(){return Ft(Et).controller.signal}},nk=typeof WeakMap=="function"?WeakMap:Map,We=0,ot=null,Ge=null,Pe=0,nt=0,jn=null,Qi=!1,va=!1,Lu=!1,Ni=0,jt=0,Ki=0,zs=0,_u=0,kn=0,wa=0,mr=null,hn=null,Uu=!1,Gl=0,Kp=0,Fl=1/0,Pl=null,Ji=null,Ut=0,Wi=null,ja=null,Ei=0,Bu=0,Hu=null,Jp=null,pr=0,$u=null;function Sn(){return(We&2)!==0&&Pe!==0?Pe&-Pe:B.T!==null?Yu():mf()}function Wp(){if(kn===0)if((Pe&536870912)===0||Ve){var t=he;he<<=1,(he&3932160)===0&&(he=262144),kn=t}else kn=536870912;return t=vn.current,t!==null&&(t.flags|=32),kn}function fn(t,n,r){(t===ot&&(nt===2||nt===9)||t.cancelPendingCommit!==null)&&(ka(t,0),es(t,Pe,kn,!1)),ei(t,r),((We&2)===0||t!==ot)&&(t===ot&&((We&2)===0&&(zs|=r),jt===4&&es(t,Pe,kn,!1)),si(t))}function eg(t,n,r){if((We&6)!==0)throw Error(l(327));var o=!r&&(n&127)===0&&(n&t.expiredLanes)===0||di(t,n),f=o?ak(t,n):qu(t,n,!0),g=o;do{if(f===0){va&&!o&&es(t,n,0,!1);break}else{if(r=t.current.alternate,g&&!ik(r)){f=qu(t,n,!1),g=!1;continue}if(f===2){if(g=n,t.errorRecoveryDisabledLanes&g)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=mr;var D=C.current.memoizedState.isDehydrated;if(D&&(ka(C,j).flags|=256),j=qu(C,j,!1),j!==2){if(Lu&&!D){C.errorRecoveryDisabledLanes|=g,zs|=g,f=4;break e}g=hn,hn=f,g!==null&&(hn===null?hn=g:hn.push.apply(hn,g))}f=j}if(g=!1,f!==2)continue}}if(f===1){ka(t,0),es(t,n,0,!0);break}e:{switch(o=t,g=f,g){case 0:case 1:throw Error(l(345));case 4:if((n&4194048)!==n)break;case 6:es(o,n,kn,!Qi);break e;case 2:hn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=Gl+300-Tt(),10<f)){if(es(o,n,kn,!Qi),rn(o,0,!0)!==0)break e;Ei=n,o.timeoutHandle=Og(tg.bind(null,o,r,hn,Pl,Uu,n,kn,zs,wa,Qi,g,"Throttled",-0,0),f);break e}tg(o,r,hn,Pl,Uu,n,kn,zs,wa,Qi,g,null,-0,0)}}break}while(!0);si(t)}function tg(t,n,r,o,f,g,j,C,D,V,ne,oe,Z,K){if(t.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:mi},Vp(n,g,oe);var je=(g&62914560)===g?Gl-Tt():(g&4194048)===g?Kp-Tt():0;if(je=Ik(oe,je),je!==null){Ei=g,t.cancelPendingCommit=je(cg.bind(null,t,n,g,r,o,f,j,C,D,ne,oe,null,Z,K)),es(t,g,j,!V);return}}cg(t,n,g,r,o,f,j,C,D)}function ik(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],g=f.getSnapshot;f=f.value;try{if(!xn(g(),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 es(t,n,r,o){n&=~_u,n&=~zs,t.suspendedLanes|=n,t.pingedLanes&=~n,o&&(t.warmLanes|=n),o=t.expirationTimes;for(var f=n;0<f;){var g=31-St(f),j=1<<g;o[g]=-1,f&=~j}r!==0&&df(t,r,n)}function Yl(){return(We&6)===0?(gr(0),!1):!0}function Iu(){if(Ge!==null){if(nt===0)var t=Ge.return;else t=Ge,xi=ws=null,iu(t),fa=null,Ja=0,t=Ge;for(;t!==null;)Rp(t.alternate,t),t=t.return;Ge=null}}function ka(t,n){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,kk(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),Ei=0,Iu(),ot=t,Ge=r=gi(t.current,null),Pe=n,nt=0,jn=null,Qi=!1,va=di(t,n),Lu=!1,wa=kn=_u=zs=Ki=jt=0,hn=mr=null,Uu=!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-St(o),g=1<<f;n|=t[f],o&=~g}return Ni=n,fl(),r}function ng(t,n){Be=null,B.H=rr,n===ha||n===wl?(n=xm(),nt=3):n===Pc?(n=xm(),nt=4):nt=n===bu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,jn=n,Ge===null&&(jt=1,Ll(t,Dn(n,t.current)))}function ig(){var t=vn.current;return t===null?!0:(Pe&4194048)===Pe?Un===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?t===Un:!1}function sg(){var t=B.H;return B.H=rr,t===null?rr:t}function ag(){var t=B.A;return B.A=tk,t}function Vl(){jt=4,Qi||(Pe&4194048)!==Pe&&vn.current!==null||(va=!0),(Ki&134217727)===0&&(zs&134217727)===0||ot===null||es(ot,Pe,kn,!1)}function qu(t,n,r){var o=We;We|=2;var f=sg(),g=ag();(ot!==t||Pe!==n)&&(Pl=null,ka(t,n)),n=!1;var j=jt;e:do try{if(nt!==0&&Ge!==null){var C=Ge,D=jn;switch(nt){case 8:Iu(),j=6;break e;case 3:case 2:case 9:case 6:vn.current===null&&(n=!0);var V=nt;if(nt=0,jn=null,Sa(t,C,D,V),r&&va){j=0;break e}break;default:V=nt,nt=0,jn=null,Sa(t,C,D,V)}}sk(),j=jt;break}catch(ne){ng(t,ne)}while(!0);return n&&t.shellSuspendCounter++,xi=ws=null,We=o,B.H=f,B.A=g,Ge===null&&(ot=null,Pe=0,fl()),j}function sk(){for(;Ge!==null;)rg(Ge)}function ak(t,n){var r=We;We|=2;var o=sg(),f=ag();ot!==t||Pe!==n?(Pl=null,Fl=Tt()+500,ka(t,n)):va=di(t,n);e:do try{if(nt!==0&&Ge!==null){n=Ge;var g=jn;t:switch(nt){case 1:nt=0,jn=null,Sa(t,n,g,1);break;case 2:case 9:if(gm(g)){nt=0,jn=null,lg(n);break}n=function(){nt!==2&&nt!==9||ot!==t||(nt=7),si(t)},g.then(n,n);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:gm(g)?(nt=0,jn=null,lg(n)):(nt=0,jn=null,Sa(t,n,g,7));break;case 5:var j=null;switch(Ge.tag){case 26:j=Ge.memoizedState;case 5:case 27:var C=Ge;if(j?Yg(j):C.stateNode.complete){nt=0,jn=null;var D=C.sibling;if(D!==null)Ge=D;else{var V=C.return;V!==null?(Ge=V,Zl(V)):Ge=null}break t}}nt=0,jn=null,Sa(t,n,g,5);break;case 6:nt=0,jn=null,Sa(t,n,g,6);break;case 8:Iu(),jt=6;break e;default:throw Error(l(462))}}rk();break}catch(ne){ng(t,ne)}while(!0);return xi=ws=null,B.H=o,B.A=f,We=r,Ge!==null?0:(ot=null,Pe=0,fl(),jt)}function rk(){for(;Ge!==null&&!En();)rg(Ge)}function rg(t){var n=zp(t.alternate,t,Ni);t.memoizedProps=t.pendingProps,n===null?Zl(t):Ge=n}function lg(t){var n=t,r=n.alternate;switch(n.tag){case 15:case 0:n=Sp(r,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=Sp(r,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:iu(n);default:Rp(r,n),n=Ge=am(n,Ni),n=zp(r,n,Ni)}t.memoizedProps=t.pendingProps,n===null?Zl(t):Ge=n}function Sa(t,n,r,o){xi=ws=null,iu(n),fa=null,Ja=0;var f=n.return;try{if(Zj(t,f,n,r,Pe)){jt=1,Ll(t,Dn(r,t.current)),Ge=null;return}}catch(g){if(f!==null)throw Ge=f,g;jt=1,Ll(t,Dn(r,t.current)),Ge=null;return}n.flags&32768?(Ve||o===1?t=!0:va||(Pe&536870912)!==0?t=!1:(Qi=t=!0,(o===2||o===9||o===3||o===6)&&(o=vn.current,o!==null&&o.tag===13&&(o.flags|=16384))),og(n,t)):Zl(n)}function Zl(t){var n=t;do{if((n.flags&32768)!==0){og(n,Qi);return}t=n.return;var r=Kj(n.alternate,n,Ni);if(r!==null){Ge=r;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=t}while(n!==null);jt===0&&(jt=5)}function og(t,n){do{var r=Jj(t.alternate,t);if(r!==null){r.flags&=32767,Ge=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(t=t.sibling,t!==null)){Ge=t;return}Ge=t=r}while(t!==null);jt=6,Ge=null}function cg(t,n,r,o,f,g,j,C,D){t.cancelPendingCommit=null;do Xl();while(Ut!==0);if((We&6)!==0)throw Error(l(327));if(n!==null){if(n===t.current)throw Error(l(177));if(g=n.lanes|n.childLanes,g|=zc,Hw(t,r,g,j,C,D),t===ot&&(Ge=ot=null,Pe=0),ja=n,Wi=t,Ei=r,Bu=g,Hu=f,Jp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,uk(pe,function(){return mg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=B.T,B.T=null,f=U.p,U.p=2,j=We,We|=4;try{Wj(t,n,r)}finally{We=j,U.p=f,B.T=o}}Ut=1,ug(),dg(),hg()}}function ug(){if(Ut===1){Ut=0;var t=Wi,n=ja,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=B.T,B.T=null;var o=U.p;U.p=2;var f=We;We|=4;try{Fp(n,t);var g=ed,j=Qf(t.containerInfo),C=g.focusedElem,D=g.selectionRange;if(j!==C&&C&&C.ownerDocument&&Xf(C.ownerDocument.documentElement,C)){if(D!==null&&Cc(C)){var V=D.start,ne=D.end;if(ne===void 0&&(ne=V),"selectionStart"in C)C.selectionStart=V,C.selectionEnd=Math.min(ne,C.value.length);else{var oe=C.ownerDocument||document,Z=oe&&oe.defaultView||window;if(Z.getSelection){var K=Z.getSelection(),je=C.textContent.length,Oe=Math.min(D.start,je),lt=D.end===void 0?Oe:Math.min(D.end,je);!K.extend&&Oe>lt&&(j=lt,lt=Oe,Oe=j);var q=Zf(C,Oe),_=Zf(C,lt);if(q&&_&&(K.rangeCount!==1||K.anchorNode!==q.node||K.anchorOffset!==q.offset||K.focusNode!==_.node||K.focusOffset!==_.offset)){var Y=oe.createRange();Y.setStart(q.node,q.offset),K.removeAllRanges(),Oe>lt?(K.addRange(Y),K.extend(_.node,_.offset)):(Y.setEnd(_.node,_.offset),K.addRange(Y))}}}}for(oe=[],K=C;K=K.parentNode;)K.nodeType===1&&oe.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<oe.length;C++){var ae=oe[C];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}lo=!!Wu,ed=Wu=null}finally{We=f,U.p=o,B.T=r}}t.current=n,Ut=2}}function dg(){if(Ut===2){Ut=0;var t=Wi,n=ja,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=B.T,B.T=null;var o=U.p;U.p=2;var f=We;We|=4;try{Hp(t,n.alternate,n)}finally{We=f,U.p=o,B.T=r}}Ut=3}}function hg(){if(Ut===4||Ut===3){Ut=0,Gs();var t=Wi,n=ja,r=Ei,o=Jp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ut=5:(Ut=0,ja=Wi=null,fg(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(Ji=null),rc(r),n=n.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(st,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=B.T,f=U.p,U.p=2,B.T=null;try{for(var g=t.onRecoverableError,j=0;j<o.length;j++){var C=o[j];g(C.value,{componentStack:C.stack})}}finally{B.T=n,U.p=f}}(Ei&3)!==0&&Xl(),si(t),f=t.pendingLanes,(r&261930)!==0&&(f&42)!==0?t===$u?pr++:(pr=0,$u=t):pr=0,gr(0)}}function fg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Qa(n)))}function Xl(){return ug(),dg(),hg(),mg()}function mg(){if(Ut!==5)return!1;var t=Wi,n=Bu;Bu=0;var r=rc(Ei),o=B.T,f=U.p;try{U.p=32>r?32:r,B.T=null,r=Hu,Hu=null;var g=Wi,j=Ei;if(Ut=0,ja=Wi=null,Ei=0,(We&6)!==0)throw Error(l(331));var C=We;if(We|=4,Xp(g.current),Yp(g,g.current,j,r),We=C,gr(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(st,g)}catch{}return!0}finally{U.p=f,B.T=o,fg(t,n)}}function pg(t,n,r){n=Dn(r,n),n=xu(t.stateNode,n,2),t=Yi(t,n,2),t!==null&&(ei(t,2),si(t))}function it(t,n,r){if(t.tag===3)pg(t,t,r);else for(;n!==null;){if(n.tag===3){pg(n,t,r);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Ji===null||!Ji.has(o))){t=Dn(r,t),r=gp(2),o=Yi(n,r,2),o!==null&&(yp(r,o,n,t),ei(o,2),si(o));break}}n=n.return}}function Gu(t,n,r){var o=t.pingCache;if(o===null){o=t.pingCache=new nk;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)||(Lu=!0,f.add(r),t=lk.bind(null,t,n,r),n.then(t,t))}function lk(t,n,r){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,ot===t&&(Pe&r)===r&&(jt===4||jt===3&&(Pe&62914560)===Pe&&300>Tt()-Gl?(We&2)===0&&ka(t,0):_u|=r,wa===Pe&&(wa=0)),si(t)}function gg(t,n){n===0&&(n=_a()),t=xs(t,n),t!==null&&(ei(t,n),si(t))}function ok(t){var n=t.memoizedState,r=0;n!==null&&(r=n.retryLane),gg(t,r)}function ck(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),gg(t,r)}function uk(t,n){return en(t,n)}var Ql=null,Ca=null,Fu=!1,Kl=!1,Pu=!1,ts=0;function si(t){t!==Ca&&t.next===null&&(Ca===null?Ql=Ca=t:Ca=Ca.next=t),Kl=!0,Fu||(Fu=!0,hk())}function gr(t,n){if(!Pu&&Kl){Pu=!0;do for(var r=!1,o=Ql;o!==null;){if(t!==0){var f=o.pendingLanes;if(f===0)var g=0;else{var j=o.suspendedLanes,C=o.pingedLanes;g=(1<<31-St(42|t)+1)-1,g&=f&~(j&~C),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(r=!0,vg(o,g))}else g=Pe,g=rn(o,o===ot?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(g&3)===0||di(o,g)||(r=!0,vg(o,g));o=o.next}while(r);Pu=!1}}function dk(){yg()}function yg(){Kl=Fu=!1;var t=0;ts!==0&&jk()&&(t=ts);for(var n=Tt(),r=null,o=Ql;o!==null;){var f=o.next,g=xg(o,n);g===0?(o.next=null,r===null?Ql=f:r.next=f,f===null&&(Ca=r)):(r=o,(t!==0||(g&3)!==0)&&(Kl=!0)),o=f}Ut!==0&&Ut!==5||gr(t),ts!==0&&(ts=0)}function xg(t,n){for(var r=t.suspendedLanes,o=t.pingedLanes,f=t.expirationTimes,g=t.pendingLanes&-62914561;0<g;){var j=31-St(g),C=1<<j,D=f[j];D===-1?((C&r)===0||(C&o)!==0)&&(f[j]=tl(C,n)):D<=n&&(t.expiredLanes|=C),g&=~C}if(n=ot,r=Pe,r=rn(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&&Fn(o),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||di(t,r)){if(n=r&-r,n===t.callbackPriority)return n;switch(o!==null&&Fn(o),rc(r)){case 2:case 8:r=W;break;case 32:r=pe;break;case 268435456:r=Le;break;default:r=pe}return o=bg.bind(null,t),r=en(r,o),t.callbackPriority=n,t.callbackNode=r,n}return o!==null&&o!==null&&Fn(o),t.callbackPriority=2,t.callbackNode=null,2}function bg(t,n){if(Ut!==0&&Ut!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(Xl()&&t.callbackNode!==r)return null;var o=Pe;return o=rn(t,t===ot?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(eg(t,o,n),xg(t,Tt()),t.callbackNode!=null&&t.callbackNode===r?bg.bind(null,t):null)}function vg(t,n){if(Xl())return null;eg(t,n,!0)}function hk(){Sk(function(){(We&6)!==0?en(Ui,dk):yg()})}function Yu(){if(ts===0){var t=ua;t===0&&(t=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),ts=t}return ts}function wg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:al(""+t)}function jg(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 fk(t,n,r,o,f){if(n==="submit"&&r&&r.stateNode===f){var g=wg((f[ln]||null).action),j=o.submitter;j&&(n=(n=j[ln]||null)?wg(n.formAction):j.getAttribute("formAction"),n!==null&&(g=n,j=null));var C=new cl("action","action",null,o,f);t.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(ts!==0){var D=j?jg(f,j):new FormData(f);hu(r,{pending:!0,data:D,method:f.method,action:g},null,D)}}else typeof g=="function"&&(C.preventDefault(),D=j?jg(f,j):new FormData(f),hu(r,{pending:!0,data:D,method:f.method,action:g},g,D))},currentTarget:f}]})}}for(var Vu=0;Vu<Ec.length;Vu++){var Zu=Ec[Vu],mk=Zu.toLowerCase(),pk=Zu[0].toUpperCase()+Zu.slice(1);Pn(mk,"on"+pk)}Pn(Wf,"onAnimationEnd"),Pn(em,"onAnimationIteration"),Pn(tm,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(Oj,"onTransitionRun"),Pn(Rj,"onTransitionStart"),Pn(Dj,"onTransitionCancel"),Pn(nm,"onTransitionEnd"),Qs("onMouseEnter",["mouseout","mouseover"]),Qs("onMouseLeave",["mouseout","mouseover"]),Qs("onPointerEnter",["pointerout","pointerover"]),Qs("onPointerLeave",["pointerout","pointerover"]),ms("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ms("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ms("onBeforeInput",["compositionend","keypress","textInput","paste"]),ms("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ms("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ms("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yr="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(" "),gk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yr));function kg(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 g=void 0;if(n)for(var j=o.length-1;0<=j;j--){var C=o[j],D=C.instance,V=C.currentTarget;if(C=C.listener,D!==g&&f.isPropagationStopped())break e;g=C,f.currentTarget=V;try{g(f)}catch(ne){hl(ne)}f.currentTarget=null,g=D}else for(j=0;j<o.length;j++){if(C=o[j],D=C.instance,V=C.currentTarget,C=C.listener,D!==g&&f.isPropagationStopped())break e;g=C,f.currentTarget=V;try{g(f)}catch(ne){hl(ne)}f.currentTarget=null,g=D}}}}function Fe(t,n){var r=n[lc];r===void 0&&(r=n[lc]=new Set);var o=t+"__bubble";r.has(o)||(Sg(n,t,2,!1),r.add(o))}function Xu(t,n,r){var o=0;n&&(o|=4),Sg(r,t,o,n)}var Jl="_reactListening"+Math.random().toString(36).slice(2);function Qu(t){if(!t[Jl]){t[Jl]=!0,yf.forEach(function(r){r!=="selectionchange"&&(gk.has(r)||Xu(r,!1,t),Xu(r,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Jl]||(n[Jl]=!0,Xu("selectionchange",!1,n))}}function Sg(t,n,r,o){switch(Wg(n)){case 2:var f=Fk;break;case 8:f=Pk;break;default:f=dd}r=f.bind(null,n,r,t),f=void 0,!gc||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 Ku(t,n,r,o,f){var g=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=Vs(C),j===null)return;if(D=j.tag,D===5||D===6||D===26||D===27){o=g=j;continue e}C=C.parentNode}}o=o.return}Ef(function(){var V=g,ne=mc(r),oe=[];e:{var Z=im.get(t);if(Z!==void 0){var K=cl,je=t;switch(t){case"keypress":if(ll(r)===0)break e;case"keydown":case"keyup":K=cj;break;case"focusin":je="focus",K=vc;break;case"focusout":je="blur",K=vc;break;case"beforeblur":case"afterblur":K=vc;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":K=Rf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Kw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=hj;break;case Wf:case em:case tm:K=ej;break;case nm:K=mj;break;case"scroll":case"scrollend":K=Xw;break;case"wheel":K=gj;break;case"copy":case"cut":case"paste":K=nj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Mf;break;case"toggle":case"beforetoggle":K=xj}var Oe=(n&4)!==0,lt=!Oe&&(t==="scroll"||t==="scrollend"),q=Oe?Z!==null?Z+"Capture":null:Z;Oe=[];for(var _=V,Y;_!==null;){var ae=_;if(Y=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||Y===null||q===null||(ae=Ha(_,q),ae!=null&&Oe.push(xr(_,ae,Y))),lt)break;_=_.return}0<Oe.length&&(Z=new K(Z,je,null,r,ne),oe.push({event:Z,listeners:Oe}))}}if((n&7)===0){e:{if(Z=t==="mouseover"||t==="pointerover",K=t==="mouseout"||t==="pointerout",Z&&r!==fc&&(je=r.relatedTarget||r.fromElement)&&(Vs(je)||je[Ys]))break e;if((K||Z)&&(Z=ne.window===ne?ne:(Z=ne.ownerDocument)?Z.defaultView||Z.parentWindow:window,K?(je=r.relatedTarget||r.toElement,K=V,je=je?Vs(je):null,je!==null&&(lt=u(je),Oe=je.tag,je!==lt||Oe!==5&&Oe!==27&&Oe!==6)&&(je=null)):(K=null,je=V),K!==je)){if(Oe=Rf,ae="onMouseLeave",q="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(Oe=Mf,ae="onPointerLeave",q="onPointerEnter",_="pointer"),lt=K==null?Z:Ba(K),Y=je==null?Z:Ba(je),Z=new Oe(ae,_+"leave",K,r,ne),Z.target=lt,Z.relatedTarget=Y,ae=null,Vs(ne)===V&&(Oe=new Oe(q,_+"enter",je,r,ne),Oe.target=Y,Oe.relatedTarget=lt,ae=Oe),lt=ae,K&&je)t:{for(Oe=yk,q=K,_=je,Y=0,ae=q;ae;ae=Oe(ae))Y++;ae=0;for(var ze=_;ze;ze=Oe(ze))ae++;for(;0<Y-ae;)q=Oe(q),Y--;for(;0<ae-Y;)_=Oe(_),ae--;for(;Y--;){if(q===_||_!==null&&q===_.alternate){Oe=q;break t}q=Oe(q),_=Oe(_)}Oe=null}else Oe=null;K!==null&&Cg(oe,Z,K,Oe,!1),je!==null&<!==null&&Cg(oe,lt,je,Oe,!0)}}e:{if(Z=V?Ba(V):window,K=Z.nodeName&&Z.nodeName.toLowerCase(),K==="select"||K==="input"&&Z.type==="file")var Qe=qf;else if($f(Z))if(Gf)Qe=Nj;else{Qe=Aj;var Se=Cj}else K=Z.nodeName,!K||K.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?V&&hc(V.elementType)&&(Qe=qf):Qe=Tj;if(Qe&&(Qe=Qe(t,V))){If(oe,Qe,r,ne);break e}Se&&Se(t,Z,V),t==="focusout"&&V&&Z.type==="number"&&V.memoizedProps.value!=null&&dc(Z,"number",Z.value)}switch(Se=V?Ba(V):window,t){case"focusin":($f(Se)||Se.contentEditable==="true")&&(na=Se,Ac=V,Va=null);break;case"focusout":Va=Ac=na=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,Kf(oe,r,ne);break;case"selectionchange":if(zj)break;case"keydown":case"keyup":Kf(oe,r,ne)}var He;if(jc)e:{switch(t){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else ta?Bf(t,r)&&(Ye="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(Ye="onCompositionStart");Ye&&(Lf&&r.locale!=="ko"&&(ta||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&ta&&(He=zf()):(Hi=ne,yc="value"in Hi?Hi.value:Hi.textContent,ta=!0)),Se=Wl(V,Ye),0<Se.length&&(Ye=new Df(Ye,t,null,r,ne),oe.push({event:Ye,listeners:Se}),He?Ye.data=He:(He=Hf(r),He!==null&&(Ye.data=He)))),(He=vj?wj(t,r):jj(t,r))&&(Ye=Wl(V,"onBeforeInput"),0<Ye.length&&(Se=new Df("onBeforeInput","beforeinput",null,r,ne),oe.push({event:Se,listeners:Ye}),Se.data=He)),fk(oe,t,V,r,ne)}kg(oe,n)})}function xr(t,n,r){return{instance:t,listener:n,currentTarget:r}}function Wl(t,n){for(var r=n+"Capture",o=[];t!==null;){var f=t,g=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||g===null||(f=Ha(t,r),f!=null&&o.unshift(xr(t,f,g)),f=Ha(t,n),f!=null&&o.push(xr(t,f,g))),t.tag===3)return o;t=t.return}return[]}function yk(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Cg(t,n,r,o,f){for(var g=n._reactName,j=[];r!==null&&r!==o;){var C=r,D=C.alternate,V=C.stateNode;if(C=C.tag,D!==null&&D===o)break;C!==5&&C!==26&&C!==27||V===null||(D=V,f?(V=Ha(r,g),V!=null&&j.unshift(xr(r,V,D))):f||(V=Ha(r,g),V!=null&&j.push(xr(r,V,D)))),r=r.return}j.length!==0&&t.push({event:n,listeners:j})}var xk=/\r\n?/g,bk=/\u0000|\uFFFD/g;function Ag(t){return(typeof t=="string"?t:""+t).replace(xk,`
|
|
9
|
-
`).replace(bk,"")}function Tg(t,n){return n=Ag(n),Ag(t)===n}function rt(t,n,r,o,f,g){switch(r){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Js(t,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Js(t,""+o);break;case"className":il(t,"class",o);break;case"tabIndex":il(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":il(t,r,o);break;case"style":Tf(t,o,g);break;case"data":if(n!=="object"){il(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=al(""+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 g=="function"&&(r==="formAction"?(n!=="input"&&rt(t,n,"name",f.name,f,null),rt(t,n,"formEncType",f.formEncType,f,null),rt(t,n,"formMethod",f.formMethod,f,null),rt(t,n,"formTarget",f.formTarget,f,null)):(rt(t,n,"encType",f.encType,f,null),rt(t,n,"method",f.method,f,null),rt(t,n,"target",f.target,f,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=al(""+o),t.setAttribute(r,o);break;case"onClick":o!=null&&(t.onclick=mi);break;case"onScroll":o!=null&&Fe("scroll",t);break;case"onScrollEnd":o!=null&&Fe("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=al(""+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":Fe("beforetoggle",t),Fe("toggle",t),nl(t,"popover",o);break;case"xlinkActuate":fi(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":fi(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":fi(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":fi(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":fi(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":fi(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":fi(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":fi(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":fi(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":nl(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=Vw.get(r)||r,nl(t,r,o))}}function Ju(t,n,r,o,f,g){switch(r){case"style":Tf(t,o,g);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"?Js(t,o):(typeof o=="number"||typeof o=="bigint")&&Js(t,""+o);break;case"onScroll":o!=null&&Fe("scroll",t);break;case"onScrollEnd":o!=null&&Fe("scrollend",t);break;case"onClick":o!=null&&(t.onclick=mi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xf.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(f=r.endsWith("Capture"),n=r.slice(2,f?r.length-7:void 0),g=t[ln]||null,g=g!=null?g[r]:null,typeof g=="function"&&t.removeEventListener(n,g,f),typeof o=="function")){typeof g!="function"&&g!==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,""):nl(t,r,o)}}}function Yt(t,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",t),Fe("load",t);var o=!1,f=!1,g;for(g in r)if(r.hasOwnProperty(g)){var j=r[g];if(j!=null)switch(g){case"src":o=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:rt(t,n,g,j,r,null)}}f&&rt(t,n,"srcSet",r.srcSet,r,null),o&&rt(t,n,"src",r.src,r,null);return;case"input":Fe("invalid",t);var C=g=j=f=null,D=null,V=null;for(o in r)if(r.hasOwnProperty(o)){var ne=r[o];if(ne!=null)switch(o){case"name":f=ne;break;case"type":j=ne;break;case"checked":D=ne;break;case"defaultChecked":V=ne;break;case"value":g=ne;break;case"defaultValue":C=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(l(137,n));break;default:rt(t,n,o,ne,r,null)}}kf(t,g,C,D,V,j,f,!1);return;case"select":Fe("invalid",t),o=j=g=null;for(f in r)if(r.hasOwnProperty(f)&&(C=r[f],C!=null))switch(f){case"value":g=C;break;case"defaultValue":j=C;break;case"multiple":o=C;default:rt(t,n,f,C,r,null)}n=g,r=j,t.multiple=!!o,n!=null?Ks(t,!!o,n,!1):r!=null&&Ks(t,!!o,r,!0);return;case"textarea":Fe("invalid",t),g=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":g=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(l(91));break;default:rt(t,n,j,C,r,null)}Cf(t,o,f,g);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":rt(t,n,D,o,r,null));return;case"dialog":Fe("beforetoggle",t),Fe("toggle",t),Fe("cancel",t),Fe("close",t);break;case"iframe":case"object":Fe("load",t);break;case"video":case"audio":for(o=0;o<yr.length;o++)Fe(yr[o],t);break;case"image":Fe("error",t),Fe("load",t);break;case"details":Fe("toggle",t);break;case"embed":case"source":case"link":Fe("error",t),Fe("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(V in r)if(r.hasOwnProperty(V)&&(o=r[V],o!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:rt(t,n,V,o,r,null)}return;default:if(hc(n)){for(ne in r)r.hasOwnProperty(ne)&&(o=r[ne],o!==void 0&&Ju(t,n,ne,o,r,void 0));return}}for(C in r)r.hasOwnProperty(C)&&(o=r[C],o!=null&&rt(t,n,C,o,r,null))}function vk(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,g=null,j=null,C=null,D=null,V=null,ne=null;for(K in r){var oe=r[K];if(r.hasOwnProperty(K)&&oe!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":D=oe;default:o.hasOwnProperty(K)||rt(t,n,K,null,o,oe)}}for(var Z in o){var K=o[Z];if(oe=r[Z],o.hasOwnProperty(Z)&&(K!=null||oe!=null))switch(Z){case"type":g=K;break;case"name":f=K;break;case"checked":V=K;break;case"defaultChecked":ne=K;break;case"value":j=K;break;case"defaultValue":C=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(l(137,n));break;default:K!==oe&&rt(t,n,Z,K,o,oe)}}uc(t,j,C,D,V,ne,g,f);return;case"select":K=j=C=Z=null;for(g in r)if(D=r[g],r.hasOwnProperty(g)&&D!=null)switch(g){case"value":break;case"multiple":K=D;default:o.hasOwnProperty(g)||rt(t,n,g,null,o,D)}for(f in o)if(g=o[f],D=r[f],o.hasOwnProperty(f)&&(g!=null||D!=null))switch(f){case"value":Z=g;break;case"defaultValue":C=g;break;case"multiple":j=g;default:g!==D&&rt(t,n,f,g,o,D)}n=C,r=j,o=K,Z!=null?Ks(t,!!r,Z,!1):!!o!=!!r&&(n!=null?Ks(t,!!r,n,!0):Ks(t,!!r,r?[]:"",!1));return;case"textarea":K=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:rt(t,n,C,null,o,f)}for(j in o)if(f=o[j],g=r[j],o.hasOwnProperty(j)&&(f!=null||g!=null))switch(j){case"value":Z=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==g&&rt(t,n,j,f,o,g)}Sf(t,Z,K);return;case"option":for(var je in r)Z=r[je],r.hasOwnProperty(je)&&Z!=null&&!o.hasOwnProperty(je)&&(je==="selected"?t.selected=!1:rt(t,n,je,null,o,Z));for(D in o)Z=o[D],K=r[D],o.hasOwnProperty(D)&&Z!==K&&(Z!=null||K!=null)&&(D==="selected"?t.selected=Z&&typeof Z!="function"&&typeof Z!="symbol":rt(t,n,D,Z,o,K));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 Oe in r)Z=r[Oe],r.hasOwnProperty(Oe)&&Z!=null&&!o.hasOwnProperty(Oe)&&rt(t,n,Oe,null,o,Z);for(V in o)if(Z=o[V],K=r[V],o.hasOwnProperty(V)&&Z!==K&&(Z!=null||K!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(l(137,n));break;default:rt(t,n,V,Z,o,K)}return;default:if(hc(n)){for(var lt in r)Z=r[lt],r.hasOwnProperty(lt)&&Z!==void 0&&!o.hasOwnProperty(lt)&&Ju(t,n,lt,void 0,o,Z);for(ne in o)Z=o[ne],K=r[ne],!o.hasOwnProperty(ne)||Z===K||Z===void 0&&K===void 0||Ju(t,n,ne,Z,o,K);return}}for(var q in r)Z=r[q],r.hasOwnProperty(q)&&Z!=null&&!o.hasOwnProperty(q)&&rt(t,n,q,null,o,Z);for(oe in o)Z=o[oe],K=r[oe],!o.hasOwnProperty(oe)||Z===K||Z==null&&K==null||rt(t,n,oe,Z,o,K)}function Ng(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wk(){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],g=f.transferSize,j=f.initiatorType,C=f.duration;if(g&&C&&Ng(j)){for(j=0,C=f.responseEnd,o+=1;o<r.length;o++){var D=r[o],V=D.startTime;if(V>C)break;var ne=D.transferSize,oe=D.initiatorType;ne&&Ng(oe)&&(D=D.responseEnd,j+=ne*(D<C?1:(C-V)/(D-V)))}if(--o,n+=8*(g+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 Wu=null,ed=null;function eo(t){return t.nodeType===9?t:t.ownerDocument}function Eg(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 zg(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 td(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 nd=null;function jk(){var t=window.event;return t&&t.type==="popstate"?t===nd?!1:(nd=t,!0):(nd=null,!1)}var Og=typeof setTimeout=="function"?setTimeout:void 0,kk=typeof clearTimeout=="function"?clearTimeout:void 0,Rg=typeof Promise=="function"?Promise:void 0,Sk=typeof queueMicrotask=="function"?queueMicrotask:typeof Rg<"u"?function(t){return Rg.resolve(null).then(t).catch(Ck)}:Og;function Ck(t){setTimeout(function(){throw t})}function ns(t){return t==="head"}function Dg(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),Ea(n);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")br(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,br(r);for(var g=r.firstChild;g;){var j=g.nextSibling,C=g.nodeName;g[Ua]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&g.rel.toLowerCase()==="stylesheet"||r.removeChild(g),g=j}}else r==="body"&&br(t.ownerDocument.body);r=f}while(r);Ea(n)}function Mg(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 id(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":id(r),oc(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function Ak(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[Ua])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(g=t.getAttribute("rel"),g==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(g!==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(g=t.getAttribute("src"),(g!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&g&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var g=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===g)return t}else return t;if(t=Bn(t.nextSibling),t===null)break}return null}function Tk(t,n,r){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Bn(t.nextSibling),t===null))return null;return t}function Lg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Bn(t.nextSibling),t===null))return null;return t}function sd(t){return t.data==="$?"||t.data==="$~"}function ad(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Nk(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 Bn(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 rd=null;function _g(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(n===0)return Bn(t.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}t=t.nextSibling}return null}function Ug(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 Bg(t,n,r){switch(n=eo(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 br(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);oc(t)}var Hn=new Map,Hg=new Set;function to(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var zi=U.d;U.d={f:Ek,r:zk,D:Ok,C:Rk,L:Dk,m:Mk,X:_k,S:Lk,M:Uk};function Ek(){var t=zi.f(),n=Yl();return t||n}function zk(t){var n=Zs(t);n!==null&&n.tag===5&&n.type==="form"?np(n):zi.r(t)}var Aa=typeof document>"u"?null:document;function $g(t,n,r){var o=Aa;if(o&&typeof n=="string"&&n){var f=On(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof r=="string"&&(f+='[crossorigin="'+r+'"]'),Hg.has(f)||(Hg.add(f),t={rel:t,crossOrigin:r,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),Yt(n,"link",t),Ht(n),o.head.appendChild(n)))}}function Ok(t){zi.D(t),$g("dns-prefetch",t,null)}function Rk(t,n){zi.C(t,n),$g("preconnect",t,n)}function Dk(t,n,r){zi.L(t,n,r);var o=Aa;if(o&&t&&n){var f='link[rel="preload"][as="'+On(n)+'"]';n==="image"&&r&&r.imageSrcSet?(f+='[imagesrcset="'+On(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(f+='[imagesizes="'+On(r.imageSizes)+'"]')):f+='[href="'+On(t)+'"]';var g=f;switch(n){case"style":g=Ta(t);break;case"script":g=Na(t)}Hn.has(g)||(t=x({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:t,as:n},r),Hn.set(g,t),o.querySelector(f)!==null||n==="style"&&o.querySelector(vr(g))||n==="script"&&o.querySelector(wr(g))||(n=o.createElement("link"),Yt(n,"link",t),Ht(n),o.head.appendChild(n)))}}function Mk(t,n){zi.m(t,n);var r=Aa;if(r&&t){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+On(o)+'"][href="'+On(t)+'"]',g=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Na(t)}if(!Hn.has(g)&&(t=x({rel:"modulepreload",href:t},n),Hn.set(g,t),r.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(wr(g)))return}o=r.createElement("link"),Yt(o,"link",t),Ht(o),r.head.appendChild(o)}}}function Lk(t,n,r){zi.S(t,n,r);var o=Aa;if(o&&t){var f=Xs(o).hoistableStyles,g=Ta(t);n=n||"default";var j=f.get(g);if(!j){var C={loading:0,preload:null};if(j=o.querySelector(vr(g)))C.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":n},r),(r=Hn.get(g))&&ld(t,r);var D=j=o.createElement("link");Ht(D),Yt(D,"link",t),D._p=new Promise(function(V,ne){D.onload=V,D.onerror=ne}),D.addEventListener("load",function(){C.loading|=1}),D.addEventListener("error",function(){C.loading|=2}),C.loading|=4,no(j,n,o)}j={type:"stylesheet",instance:j,count:1,state:C},f.set(g,j)}}}function _k(t,n){zi.X(t,n);var r=Aa;if(r&&t){var o=Xs(r).hoistableScripts,f=Na(t),g=o.get(f);g||(g=r.querySelector(wr(f)),g||(t=x({src:t,async:!0},n),(n=Hn.get(f))&&od(t,n),g=r.createElement("script"),Ht(g),Yt(g,"link",t),r.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},o.set(f,g))}}function Uk(t,n){zi.M(t,n);var r=Aa;if(r&&t){var o=Xs(r).hoistableScripts,f=Na(t),g=o.get(f);g||(g=r.querySelector(wr(f)),g||(t=x({src:t,async:!0,type:"module"},n),(n=Hn.get(f))&&od(t,n),g=r.createElement("script"),Ht(g),Yt(g,"link",t),r.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},o.set(f,g))}}function Ig(t,n,r,o){var f=(f=ye.current)?to(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=Ta(r.href),r=Xs(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=Ta(r.href);var g=Xs(f).hoistableStyles,j=g.get(t);if(j||(f=f.ownerDocument||f,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,j),(g=f.querySelector(vr(t)))&&!g._p&&(j.instance=g,j.state.loading=5),Hn.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},Hn.set(t,r),g||Bk(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=Na(r),r=Xs(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 Ta(t){return'href="'+On(t)+'"'}function vr(t){return'link[rel="stylesheet"]['+t+"]"}function qg(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function Bk(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}),Yt(n,"link",r),Ht(n),t.head.appendChild(n))}function Na(t){return'[src="'+On(t)+'"]'}function wr(t){return"script[async]"+t}function Gg(t,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+On(r.href)+'"]');if(o)return n.instance=o,Ht(o),o;var f=x({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Ht(o),Yt(o,"style",f),no(o,r.precedence,t),n.instance=o;case"stylesheet":f=Ta(r.href);var g=t.querySelector(vr(f));if(g)return n.state.loading|=4,n.instance=g,Ht(g),g;o=qg(r),(f=Hn.get(f))&&ld(o,f),g=(t.ownerDocument||t).createElement("link"),Ht(g);var j=g;return j._p=new Promise(function(C,D){j.onload=C,j.onerror=D}),Yt(g,"link",o),n.state.loading|=4,no(g,r.precedence,t),n.instance=g;case"script":return g=Na(r.src),(f=t.querySelector(wr(g)))?(n.instance=f,Ht(f),f):(o=r,(f=Hn.get(g))&&(o=x({},r),od(o,f)),t=t.ownerDocument||t,f=t.createElement("script"),Ht(f),Yt(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,no(o,r.precedence,t));return n.instance}function no(t,n,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,g=f,j=0;j<o.length;j++){var C=o[j];if(C.dataset.precedence===n)g=C;else if(g!==f)break}g?g.parentNode.insertBefore(t,g.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(t,n.firstChild))}function ld(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function od(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var io=null;function Fg(t,n,r){if(io===null){var o=new Map,f=io=new Map;f.set(r,o)}else f=io,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 g=r[f];if(!(g[Ua]||g[qt]||t==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var j=g.getAttribute(n)||"";j=t+j;var C=o.get(j);C?C.push(g):o.set(j,[g])}}return o}function Pg(t,n,r){t=t.ownerDocument||t,t.head.insertBefore(r,n==="title"?t.querySelector("head > title"):null)}function Hk(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 Yg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function $k(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=Ta(o.href),g=n.querySelector(vr(f));if(g){n=g._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=so.bind(t),n.then(t,t)),r.state.loading|=4,r.instance=g,Ht(g);return}g=n.ownerDocument||n,o=qg(o),(f=Hn.get(f))&&ld(o,f),g=g.createElement("link"),Ht(g);var j=g;j._p=new Promise(function(C,D){j.onload=C,j.onerror=D}),Yt(g,"link",o),r.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=so.bind(t),n.addEventListener("load",r),n.addEventListener("error",r))}}var cd=0;function Ik(t,n){return t.stylesheets&&t.count===0&&ro(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var o=setTimeout(function(){if(t.stylesheets&&ro(t,t.stylesheets),t.unsuspend){var g=t.unsuspend;t.unsuspend=null,g()}},6e4+n);0<t.imgBytes&&cd===0&&(cd=62500*wk());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ro(t,t.stylesheets),t.unsuspend)){var g=t.unsuspend;t.unsuspend=null,g()}},(t.imgBytes>cd?50:800)+n);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function so(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var ao=null;function ro(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,ao=new Map,n.forEach(qk,t),ao=null,so.call(t))}function qk(t,n){if(!(n.state.loading&4)){var r=ao.get(t);if(r)var o=r.get(null);else{r=new Map,ao.set(t,r);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<f.length;g++){var j=f[g];(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"),g=r.get(j)||o,g===o&&r.set(null,f),r.set(j,f),this.count++,o=so.bind(this),f.addEventListener("load",o),f.addEventListener("error",o),g?g.parentNode.insertBefore(f,g.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),n.state.loading|=4}}var jr={$$typeof:N,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Gk(t,n,r,o,f,g,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=hi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hi(0),this.hiddenUpdates=hi(null),this.identifierPrefix=o,this.onUncaughtError=f,this.onCaughtError=g,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Vg(t,n,r,o,f,g,j,C,D,V,ne,oe){return t=new Gk(t,n,r,j,D,V,ne,oe,C),n=1,g===!0&&(n|=24),g=bn(3,null,null,n),t.current=g,g.stateNode=t,n=qc(),n.refCount++,t.pooledCache=n,n.refCount++,g.memoizedState={element:o,isDehydrated:r,cache:n},Yc(g),t}function Zg(t){return t?(t=aa,t):aa}function Xg(t,n,r,o,f,g){f=Zg(f),o.context===null?o.context=f:o.pendingContext=f,o=Pi(n),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Yi(t,o,n),r!==null&&(fn(r,t,n),er(r,t,n))}function Qg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<n?r:n}}function ud(t,n){Qg(t,n),(t=t.alternate)&&Qg(t,n)}function Kg(t){if(t.tag===13||t.tag===31){var n=xs(t,67108864);n!==null&&fn(n,t,67108864),ud(t,67108864)}}function Jg(t){if(t.tag===13||t.tag===31){var n=Sn();n=ac(n);var r=xs(t,n);r!==null&&fn(r,t,n),ud(t,n)}}var lo=!0;function Fk(t,n,r,o){var f=B.T;B.T=null;var g=U.p;try{U.p=2,dd(t,n,r,o)}finally{U.p=g,B.T=f}}function Pk(t,n,r,o){var f=B.T;B.T=null;var g=U.p;try{U.p=8,dd(t,n,r,o)}finally{U.p=g,B.T=f}}function dd(t,n,r,o){if(lo){var f=hd(o);if(f===null)Ku(t,n,o,oo,r),ey(t,o);else if(Vk(f,t,n,r,o))o.stopPropagation();else if(ey(t,o),n&4&&-1<Yk.indexOf(t)){for(;f!==null;){var g=Zs(f);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var j=mt(g.pendingLanes);if(j!==0){var C=g;for(C.pendingLanes|=2,C.entangledLanes|=2;j;){var D=1<<31-St(j);C.entanglements[1]|=D,j&=~D}si(g),(We&6)===0&&(Fl=Tt()+500,gr(0))}}break;case 31:case 13:C=xs(g,2),C!==null&&fn(C,g,2),Yl(),ud(g,2)}if(g=hd(o),g===null&&Ku(t,n,o,oo,r),g===f)break;f=g}f!==null&&o.stopPropagation()}else Ku(t,n,o,null,r)}}function hd(t){return t=mc(t),fd(t)}var oo=null;function fd(t){if(oo=null,t=Vs(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 oo=t,null}function Wg(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(Fs()){case Ui:return 2;case W:return 8;case pe:case De:return 32;case Le:return 268435456;default:return 32}default:return 32}}var md=!1,is=null,ss=null,as=null,kr=new Map,Sr=new Map,rs=[],Yk="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 ey(t,n){switch(t){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":ss=null;break;case"mouseover":case"mouseout":as=null;break;case"pointerover":case"pointerout":kr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sr.delete(n.pointerId)}}function Cr(t,n,r,o,f,g){return t===null||t.nativeEvent!==g?(t={blockedOn:n,domEventName:r,eventSystemFlags:o,nativeEvent:g,targetContainers:[f]},n!==null&&(n=Zs(n),n!==null&&Kg(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function Vk(t,n,r,o,f){switch(n){case"focusin":return is=Cr(is,t,n,r,o,f),!0;case"dragenter":return ss=Cr(ss,t,n,r,o,f),!0;case"mouseover":return as=Cr(as,t,n,r,o,f),!0;case"pointerover":var g=f.pointerId;return kr.set(g,Cr(kr.get(g)||null,t,n,r,o,f)),!0;case"gotpointercapture":return g=f.pointerId,Sr.set(g,Cr(Sr.get(g)||null,t,n,r,o,f)),!0}return!1}function ty(t){var n=Vs(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,pf(t.priority,function(){Jg(r)});return}}else if(n===31){if(n=h(r),n!==null){t.blockedOn=n,pf(t.priority,function(){Jg(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 co(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var r=hd(t.nativeEvent);if(r===null){r=t.nativeEvent;var o=new r.constructor(r.type,r);fc=o,r.target.dispatchEvent(o),fc=null}else return n=Zs(r),n!==null&&Kg(n),t.blockedOn=r,!1;n.shift()}return!0}function ny(t,n,r){co(t)&&r.delete(n)}function Zk(){md=!1,is!==null&&co(is)&&(is=null),ss!==null&&co(ss)&&(ss=null),as!==null&&co(as)&&(as=null),kr.forEach(ny),Sr.forEach(ny)}function uo(t,n){t.blockedOn===n&&(t.blockedOn=null,md||(md=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Zk)))}var ho=null;function iy(t){ho!==t&&(ho=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ho===t&&(ho=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(fd(o||r)===null)continue;break}var g=Zs(r);g!==null&&(t.splice(n,3),n-=3,hu(g,{pending:!0,data:f,method:r.method,action:o},o,f))}}))}function Ea(t){function n(D){return uo(D,t)}is!==null&&uo(is,t),ss!==null&&uo(ss,t),as!==null&&uo(as,t),kr.forEach(n),Sr.forEach(n);for(var r=0;r<rs.length;r++){var o=rs[r];o.blockedOn===t&&(o.blockedOn=null)}for(;0<rs.length&&(r=rs[0],r.blockedOn===null);)ty(r),r.blockedOn===null&&rs.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var f=r[o],g=r[o+1],j=f[ln]||null;if(typeof g=="function")j||iy(r);else if(j){var C=null;if(g&&g.hasAttribute("formAction")){if(f=g,j=g[ln]||null)C=j.formAction;else if(fd(f)!==null)continue}else C=j.action;typeof C=="function"?r[o+1]=C:(r.splice(o,3),o-=3),iy(r)}}}function sy(){function t(g){g.canIntercept&&g.info==="react-transition"&&g.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 g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.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 pd(t){this._internalRoot=t}fo.prototype.render=pd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(l(409));var r=n.current,o=Sn();Xg(r,o,t,n,null,null)},fo.prototype.unmount=pd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Xg(t.current,2,null,t,null,null),Yl(),n[Ys]=null}};function fo(t){this._internalRoot=t}fo.prototype.unstable_scheduleHydration=function(t){if(t){var n=mf();t={blockedOn:null,target:t,priority:n};for(var r=0;r<rs.length&&n!==0&&n<rs[r].priority;r++);rs.splice(r,0,t),r===0&&ty(t)}};var ay=s.version;if(ay!=="19.2.0")throw Error(l(527,ay,"19.2.0"));U.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 Xk={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mo.isDisabled&&mo.supportsFiber)try{st=mo.inject(Xk),ft=mo}catch{}}return Tr.createRoot=function(t,n){if(!c(t))throw Error(l(299));var r=!1,o="",f=hp,g=fp,j=mp;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&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(j=n.onRecoverableError)),n=Vg(t,1,!1,null,null,r,o,null,f,g,j,sy),t[Ys]=n.current,Qu(t),new pd(n)},Tr.hydrateRoot=function(t,n,r){if(!c(t))throw Error(l(299));var o=!1,f="",g=hp,j=fp,C=mp,D=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(g=r.onUncaughtError),r.onCaughtError!==void 0&&(j=r.onCaughtError),r.onRecoverableError!==void 0&&(C=r.onRecoverableError),r.formState!==void 0&&(D=r.formState)),n=Vg(t,1,!0,n,r??null,o,f,D,g,j,C,sy),n.context=Zg(null),r=n.current,o=Sn(),o=ac(o),f=Pi(o),f.callback=null,Yi(r,f,o),r=o,n.current.lanes=r,ei(n,r),si(n),t[Ys]=n.current,Qu(t),new fo(n)},Tr.version="19.2.0",Tr}var py;function s0(){if(py)return xd.exports;py=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(),xd.exports=i0(),xd.exports}var ab=s0();class Xn extends Error{constructor(s,a,l){super(l),this.status=s,this.code=a,this.name="ApiError"}status;code}const a0={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"},gy=200,r0=e=>e.replace(/<\/?[a-z!][^>]*>/gi," "),l0=e=>e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&");function Mo(e){const s=u=>/<[a-z!/]/i.test(u),a=u=>{const d=l0(u);return s(d)?r0(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>gy?`${c.slice(0,gy-1)}…`:c}function o0(e){if(typeof e=="string")return Mo(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 Mo(l)}return""}function jd(e,s){const a=e.status,l=e.statusText||a0[a]||"",c=s&&s.toLowerCase()!==l.toLowerCase()&&s!==String(a)?`: "${s}"`:"",u=`HTTP ${a}${l?` ${l}`:""}${c}`;return a===429?new Xn(429,"RATE_LIMITED",`Pikibun is over its request limit right now (${u}). Try again later.`):a===408||a===504||a===522||a===524?new Xn(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 Xn(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 Xn(a,"BACKEND_UNAVAILABLE",`The Pikibun API answered with something other than JSON (${u}). Try again later.`):new Xn(a,"REQUEST_FAILED",`The request failed before reaching Pikibun's API (${u}).`)}async function yy(e){if(!(e.headers.get("content-type")??"").includes("application/json")){const p=await e.text().catch(()=>"");throw jd(e,Mo(p))}if(e.ok)try{return await e.json()}catch(p){throw p instanceof Error&&p.name==="AbortError"?p:new Xn(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 jd(e,Mo(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 Xn(e.status,h??"REQUEST_FAILED",d):jd(e,o0(l))}function c0(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"},p={method:d,headers:h,signal:u.signal};if(p.credentials="same-origin",d!=="GET"){const y=await yy(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",p.body=JSON.stringify(u.body));const m=await a(`${s}${c}`,p);if(!(m.status===204&&m.ok))return await yy(m)}}function Tn(e){return e instanceof Xn?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),fe=c0({}),u0={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 ke({name:e,size:s=16}){return e==="github"?i.jsx(Lo,{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:u0[e]})}const po="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",xy="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",kd="translate(14.7 16.6) rotate(33) scale(1.15)",Sd="translate(17.3 16.6) scale(-1 1) rotate(33) scale(1.15)";function Ra({size:e=24}){const s=T.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:po,transform:kd}),i.jsx("path",{d:po,transform:Sd}),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:po,transform:kd,fill:`url(#${l})`}),i.jsx("path",{d:po,transform:Sd,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:xy,transform:kd}),i.jsx("path",{d:xy,transform:Sd})]}),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 Lo({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 d0=sb();const go=4,Nr=8;function h0(e,s,a,l){const c=document.documentElement.clientWidth,d=window.innerHeight-e.bottom-go-Nr,h=e.top-go-Nr,p=a==="below"?d:h,m=a==="below"?h:d,y=p>=s.height||p>=m?a:a==="below"?"above":"below",v=Math.max(80,Math.floor(y==="below"?d:h)),b=y==="below"?e.bottom+go:document.documentElement.clientHeight-e.top+go,w=l==="end"?e.right-s.width:e.left,S=Math.min(Math.max(Nr,w),Math.max(Nr,c-Nr-s.width));return{edge:b,left:S,maxHeight:v,side:y}}function Th({anchor:e,side:s="below",align:a="start",className:l="",role:c,id:u,label:d,style:h,children:p}){const m=T.useRef(null),[y,x]=T.useState(null);T.useLayoutEffect(()=>{const w=m.current,S=e.current;if(!w||!S)return;let A={width:0,height:0};const k=()=>{const M=w.style.maxHeight;w.style.maxHeight="";const{width:H,height:L}=w.getBoundingClientRect();w.style.maxHeight=M,A={width:H,height:L}},z=()=>x(h0(S.getBoundingClientRect(),A,s,a)),N=()=>{k(),z()};return N(),window.addEventListener("resize",N),document.addEventListener("scroll",z,!0),()=>{window.removeEventListener("resize",N),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"},b=e.current?.closest("dialog[open]")??document.body;return d0.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:p}),b)}function rb(){return Nh()&&Math.min(window.screen.width,window.screen.height)<600}function Nh(){return typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches}function lb(){return!rb()}function f0(){const e=window.visualViewport;if(!e||!Nh())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 Ie(e){const[s,a]=T.useState(null),[l,c]=T.useState(!!e),[u,d]=T.useState(""),[h,p]=T.useState(0),m=T.useRef(null),y=T.useCallback(()=>p(x=>x+1),[]);return T.useEffect(()=>{const x=new AbortController;if(m.current!==e&&(a(null),m.current=e),d(""),!e){c(!1);return}return c(!0),fe(e,{signal:x.signal}).then(v=>{x.signal.aborted||a(v)}).catch(v=>{x.signal.aborted||d(Tn(v))}).finally(()=>{x.signal.aborted||c(!1)}),()=>x.abort()},[e,h]),{data:s,loading:l,error:u,refresh:y,setData:a}}function Ce(){const[e,s]=T.useState(!1),[a,l]=T.useState(""),[c,u]=T.useState("");async function d(h,p=""){s(!0),l(""),u("");try{await h(),u(p)}catch(m){l(Tn(m))}finally{s(!1)}}return{busy:e,error:a,notice:c,run:d}}function G({variant:e="secondary",size:s="md",icon:a,block:l,className:c,children:u,type:d="button",...h}){const p=a&&!u;return i.jsxs("button",{type:d,className:["btn",e,s!=="md"&&s,l&&"block",p&&"icon-only",c].filter(Boolean).join(" "),...h,children:[a&&i.jsx(ke,{name:a,size:s==="xs"?14:16}),u]})}function It({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(ke,{name:l,size:16}),c]})}function Ae({tone:e="neutral",dot:s,children:a}){return i.jsxs("span",{className:`badge ${e==="running"?"info":e}`,children:[s&&i.jsx(cs,{tone:e}),i.jsx("span",{className:"badge-label",children:a})]})}function cs({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(ke,{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 Ls({large:e,label:s}){return i.jsx("span",{className:e?"spinner large":"spinner",role:s?"status":void 0,"aria-label":s})}function Bt({children:e="Loading..."}){return i.jsxs("span",{className:"loading-line",role:"status",children:[i.jsx(Ls,{}),e]})}function oi(){return i.jsx("div",{className:"page-loading",children:i.jsx(Ls,{large:!0,label:"Loading"})})}function xe({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(ke,{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 ve({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 ut({loading:e,error:s,retry:a,children:l}){return e?i.jsx(Bt,{}):s?i.jsx(xe,{variant:"error",title:"Couldn't load",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:a,children:"Try again"}),children:s}):i.jsx(i.Fragment,{children:l})}function bt({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 Te({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(Hr,{children:s}),a&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"spacer"}),a]})]}),c?l:i.jsx("div",{className:"card",children:l})]})}function Ee({children:e}){return i.jsx("div",{className:"card-body",children:e})}function ie({title:e,hint:s,leading:a,trailing:l,onClick:c,href:u,chevron:d,disabled:h}){const p=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(ke,{name:"chevron-right",size:16})]})]});return u?i.jsx("a",{className:"row",href:u,children:p}):c?i.jsx("button",{type:"button",className:"row",onClick:c,disabled:h,children:p}):i.jsx("div",{className:"row",children:p})}function us({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(ke,{name:"chevron-right",size:16})})]}),i.jsx("div",{className:"collapsible-body",children:c})]})}function ge({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 Eh(e,s){const a=T.useRef(null);return T.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 Wn({label:e,icon:s="more",items:a,align:l="end",side:c="below",trigger:u,triggerVariant:d="ghost"}){const[h,p]=T.useState(!1),m=T.useCallback(()=>p(!1),[]),y=Eh(h,m),x=T.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":x,onClick:()=>p(v=>!v),children:u}):i.jsx(G,{variant:"ghost",size:"xs",icon:s,"aria-label":e,title:e,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":x,onClick:v=>{v.stopPropagation(),p(b=>!b)}}),h&&i.jsx(Th,{anchor:y,side:c,align:l,role:"menu",id:x,className:"menu-scroll",children:a.map((v,b)=>v==="separator"?i.jsx("div",{className:"menu-separator",role:"separator"},`separator-${b}`):i.jsxs("button",{type:"button",role:"menuitem",className:v.destructive?"menu-item destructive":"menu-item",disabled:v.disabled,onClick:w=>{w.stopPropagation(),p(!1),v.onSelect()},children:[v.icon&&i.jsx(ke,{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 Vt({value:e,options:s,onChange:a,placeholder:l="Select...",label:c,disabled:u,side:d="below"}){const[h,p]=T.useState(!1),[m,y]=T.useState(""),x=T.useCallback(()=>{p(!1),y("")},[]),v=Eh(h,x),b=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:()=>p(S=>!S),children:[i.jsx("span",{className:"truncate",children:b?.label??l}),i.jsx(ke,{name:"chevron-down",size:14})]}),h&&i.jsxs(Th,{anchor:v,side:d,role:"dialog",label:c,className:"listbox-popover",children:[s.length>7&&i.jsx("input",{className:"input listbox-search",autoFocus:!Nh(),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),x()},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 Is({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(ke,{name:u.icon,size:14}),u.label]},u.value))})}function Hr({children:e,label:s="More information"}){const[a,l]=T.useState(!1),c=T.useCallback(()=>l(!1),[]),u=Eh(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(ke,{name:"info",size:14})}),a&&i.jsx(Th,{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=T.useRef(null);return T.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(G,{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 qe({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 p=ab.createRoot(h),m=x=>{d(x),p.unmount(),h.remove()};function y(){const[x,v]=T.useState(!0),b=w=>{v(!1),m(w)};return i.jsx(an,{open:x,title:e,onClose:()=>b(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(G,{onClick:()=>b(!1),children:l}),i.jsx(G,{variant:c?"destructive":"default",onClick:()=>b(!0),autoFocus:!0,children:a})]}),children:i.jsx("div",{className:"muted",children:s})})}return p.render(i.jsx(y,{})),u}function Zo({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 by=["#5b7cfa","#e06c4f","#3fa37a","#b56fd8","#d39b2c","#3e9bc2","#d1577d","#7a8c35","#8a6bd1","#c4703a"];function Mi({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:by[a%by.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 Qn({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 _o(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 ob({value:e,label:s="Copy"}){const[a,l]=T.useState(!1);return T.useEffect(()=>{if(!a)return;const c=window.setTimeout(()=>l(!1),1500);return()=>window.clearTimeout(c)},[a]),i.jsx(G,{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 In({value:e,label:s}){return i.jsxs("div",{className:"copy-field",children:[i.jsx("code",{children:e}),i.jsx(ob,{value:e,label:s})]})}const vy="pikibun.workspace",cb=T.createContext(null);function vt(){const e=T.useContext(cb);if(!e)throw new Error("useApp must be used inside AppProvider");return e}function m0({user:e,setUser:s,signOut:a,children:l}){const c=Ie("/api/workspaces"),u=Ie("/api/sessions"),[d,h]=T.useState(null),[p,m]=T.useState(()=>{try{return localStorage.getItem(vy)??""}catch{return""}}),y=T.useCallback(k=>{m(k);try{localStorage.setItem(vy,k)}catch{}},[]),x=u.refresh,v=d?.activity==="working"||(u.data?.sessions??[]).some(k=>k.status!=="archived"&&k.activity==="working");T.useEffect(()=>{const k=window.setInterval(()=>{document.hidden||x()},v?1e4:3e4);return()=>window.clearInterval(k)},[x,v]);const b=c.data?.workspaces??[],w=b.find(k=>k.id===p)??b[0]??null,S=T.useMemo(()=>[...u.data?.sessions??[]].sort((k,z)=>z.createdAt.localeCompare(k.createdAt)),[u.data]),A={user:e,setUser:s,signOut:a,workspaces:b,workspacesLoading:c.loading,workspacesError:c.error,refreshWorkspaces:c.refresh,currentWorkspace:w,selectWorkspace:y,sessions:S,sessionsLoading:u.loading&&!u.data,refreshSessions:x,liveActivity:d,setLiveActivity:h};return i.jsx(cb.Provider,{value:A,children:l})}const p0=["profile","appearance","hosts","desktop","workspaces","admin"];function Oi(e){if(e)try{return decodeURIComponent(e)}catch{return}}function wy(e){const s=e.replace(/^#\/?/,"").split("/").filter(Boolean),[a,l,c]=s;if(a==="s"&&Oi(l))return{name:"session",sessionId:Oi(l)};if(a==="sessions")return{name:"sessions"};if(a==="shared"&&Oi(l))return{name:"shared",token:Oi(l)};if(a==="join"&&Oi(l))return{name:"join",token:Oi(l)};if(a==="w"&&Oi(l)&&c==="new")return{name:"new",workspaceId:Oi(l)};if(a==="settings"){const u=p0.find(h=>h===l)??"profile",d=Oi(c);return d?{name:"settings",section:u,id:d}:{name:"settings",section:u}}return{name:"home"}}function Ze(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 ds(e){const s=Ze(e);window.location.hash!==s&&(window.location.hash=s)}function zh(){const[e,s]=T.useState(()=>wy(window.location.hash));return T.useEffect(()=>{const a=()=>s(wy(window.location.hash));return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),e}const Wd="pikibun.pendingInvite";function g0(e){try{sessionStorage.setItem(Wd,e)}catch{}}function y0(){try{const e=sessionStorage.getItem(Wd);return sessionStorage.removeItem(Wd),e}catch{return null}}function x0(e){const[s,a]=T.useState(null),[l,c]=T.useState(!0),[u,d]=T.useState(""),[h,p]=T.useState(0),m=T.useCallback(()=>p(y=>y+1),[]);return T.useEffect(()=>{const y=new AbortController;return c(!0),d(""),fe("/api/invite",{headers:{"x-invite-token":e},signal:y.signal}).then(x=>{y.signal.aborted||a(x.invite)}).catch(x=>{y.signal.aborted||(a(null),d(Tn(x)))}).finally(()=>{y.signal.aborted||c(!1)}),()=>y.abort()},[e,h]),{invite:s,setInvite:a,loading:l,error:u,refresh:m}}function Oh(){const e=Ie("/api/join-requests"),s=Ce(),a=e.data?.requests??[],[l,c]=T.useState(!1);T.useEffect(()=>{e.error?c(!0):e.data&&c(!1)},[e.error,e.data]);async function u(d){s.busy||!await qe({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 fe(`/api/join-requests/${ce(d.workspaceId)}`,{method:"DELETE"}),e.refresh()},"Request withdrawn.")}return!a.length&&!s.notice&&!l?null:i.jsxs(Te,{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(Ee,{children:i.jsx(xe,{variant:"error",title:"Could not load your requests",actions:i.jsx(G,{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(ie,{title:d.workspaceName,hint:i.jsxs(i.Fragment,{children:["Waiting for approval · asked ",i.jsx(Qn,{value:d.createdAt})]}),trailing:i.jsx(G,{variant:"outline",size:"sm",disabled:s.busy,"aria-label":`Withdraw request to join ${d.workspaceName}`,onClick:()=>{u(d)},children:"Withdraw"})},d.workspaceId)):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:"You aren't waiting to join any workspace"})}),(s.error||s.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...s})})]})}function b0({token:e}){const{refreshWorkspaces:s}=vt(),{invite:a,setInvite:l,loading:c,error:u,refresh:d}=x0(e),h=Ce();T.useEffect(()=>{a?.status==="member"&&s()},[a?.status,s]);function p(){h.busy||h.run(async()=>{l((await fe("/api/invite",{method:"POST",body:{token:e}})).invite)})}function m(){h.busy||h.run(async()=>{l((await fe("/api/invite",{method:"DELETE",headers:{"x-invite-token":e}})).invite)},"Request withdrawn.")}return c&&!a?i.jsx(oi,{}):i.jsx("div",{className:"welcome",children:i.jsxs("div",{className:"welcome-inner",children:[i.jsx(Ra,{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(G,{variant:"default",size:"lg",disabled:h.busy,onClick:p,children:h.busy?"Asking...":"Ask to join"})})]}),a.status==="pending"&&i.jsxs(i.Fragment,{children:[i.jsxs(xe,{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(G,{disabled:h.busy||c,onClick:d,children:"Check again"}),i.jsx(G,{variant:"ghost",disabled:h.busy,onClick:m,children:"Withdraw request"})]})]}),a.status==="member"&&i.jsxs(i.Fragment,{children:[i.jsxs(xe,{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(It,{variant:"default",href:a.workspaceId?Ze({name:"settings",section:"workspaces",id:a.workspaceId}):Ze({name:"home"}),children:"Open workspace"})})]}),i.jsx(ve,{...h})]}):i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:"Join a workspace"}),i.jsx(xe,{variant:"error",title:"Invite link not available",actions:i.jsx(G,{size:"sm",onClick:d,children:"Try again"}),children:u}),i.jsx("div",{className:"actions",children:i.jsx(It,{href:Ze({name:"home"}),children:"Go to Pikibun"})}),i.jsx(Oh,{})]})]})})}const v0=["read","ask","write","approve","manage"],w0=["admin","collaborator","member","viewer"],ub=["viewer","member","collaborator","admin"],jy={textBytes:256*1024,imageBytes:2*1024*1024},Lr=["off","minimal","low","medium","high","xhigh","max"];function j0(e,s){return e.includes(s)||s==="read"&&e.some(a=>v0.includes(a))}const k0=["owner","admin","collaborator","member"],Uo=["owner","admin"],db=["collaborator","member","viewer"];function S0(e,s){return Uo.includes(e)?["read","ask","write","manage"]:s!=="workspace"?[]:C0.includes(e)?["read","ask","write"]:["read"]}function Rh(e,s,a){return e===s||a!==void 0&&Uo.includes(a)}const C0=["owner","admin","collaborator"],A0=["viewer"];function T0(e){return A0.includes(e)?["read"]:null}function Pr(e){return k0.includes(e??"member")}const Xo={viewer:["read"],member:["read","ask"],collaborator:["read","ask","write"],admin:["read","ask","write","approve","manage"]};function hb(e){const s=new Set(e);return s.size&&s.add("read"),ub.find(a=>{const l=Xo[a];return l.length===s.size&&l.every(c=>s.has(c))})??null}function N0(e,s){const a=s?T0(s):null;return!a||Xo[e].every(l=>a.includes(l))}function E0(e,s){return Xo[e].every(a=>j0(s,a))}new TextEncoder;new TextDecoder("utf-8",{fatal:!0});const $r={count:4,imageBase64:512*1024,totalBase64:720*1024},Cd=1568,z0=32*1024*1024;function fb(e){return e&&!e.capabilities.chatImages?"Update the host's connector (npx pikibun@latest connect) to send images.":void 0}function O0(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 mb(e,s){const[a,l]=T.useState(()=>(s?.()??[]).map(v=>({id:crypto.randomUUID(),file:v}))),[c,u]=T.useState(""),d=T.useRef(a);d.current=a;function h(v){if(e){u(e);return}const b=v.filter(S=>S.size<=z0),w=b.map(S=>({id:crypto.randomUUID(),file:S}));u(b.length<v.length?"An image larger than 32 MiB can't be attached.":d.current.length+w.length>$r.count?`A message can carry at most ${$r.count} images.`:""),w.length&&l(S=>[...S,...w].slice(0,$r.count))}function p(v){const b=O0(v.clipboardData);b.length&&(!e&&!v.clipboardData.types.includes("text/plain")&&v.preventDefault(),h(b))}function m(v){const b=Array.from(v??[]).filter(w=>w.type.startsWith("image/"));b.length?h(b):v?.length&&u("Only images can be attached.")}function y(v){l(b=>b.filter(w=>w.id!==v)),u("")}function x(v){const b=new Set(v.map(w=>w.id));l(w=>w.filter(S=>!b.has(S.id)))}return{images:a,notice:c,paste:p,pick:m,remove:y,sent:x,add:h}}function pb({attachments:e,disabled:s}){const a=T.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx(G,{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 gb({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(R0,{file:a.file,label:`Image ${l+1}`}),i.jsx(G,{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 R0({file:e,label:s}){const[a,l]=T.useState("");return T.useEffect(()=>{const c=URL.createObjectURL(e);return l(c),()=>URL.revokeObjectURL(c)},[e]),a?i.jsx("img",{src:a,alt:s}):null}const Yr=new Map;function D0(e,s){s.length&&Yr.set(e,s.map(a=>a.file))}const So=new Map;function M0(e,s){const a=T.useRef(s);a.current=s,T.useEffect(()=>{const l=c=>a.current.add(c);return So.set(e,l),()=>{So.get(e)===l&&So.delete(e)}},[e])}function L0(e,s){if(!s.length)return;const a=So.get(e);a?a([...s]):Yr.set(e,[...Yr.get(e)??[],...s])}function _0(e){return Yr.get(e)??[]}function U0(e){Yr.delete(e)}function B0(e){return e.map(s=>{const a=atob(s.data),l=new Uint8Array(a.length);for(let c=0;c<a.length;c++)l[c]=a.charCodeAt(c);return new Blob([l],{type:s.mimeType})})}const ky=e=>Math.ceil(e/3)*4;async function yb(e){const s=Math.min($r.imageBase64,Math.floor($r.totalBase64/Math.max(1,e.length))),a=[];for(const l of e)a.push(await H0(l.file,s));return a}async function H0(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 I0(e);if(l&&l!=="image/webp"&&a.width<=Cd&&a.height<=Cd&&ky(e.size)<=s)return{mimeType:l,data:await Sy(e)};let c=Math.min(1,Cd/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)),p=[...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 p){const x=await $0(a,d,h,m,y);if(x&&ky(x.size)<=s)return{mimeType:m,data:await Sy(x)}}}throw new Error("A pasted image is too large to send, even scaled down.")}finally{a.close()}}function $0(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 I0(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 Sy(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 q0={off:"Off",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Max"},Co={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 Dh(e){return e?.capabilities.automaticGitHub===!0}function G0(e,s){const a=Dh(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+F0(e)}function F0(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 Cy="Update the host's connector (npx pikibun@latest connect) to choose model, reasoning and access",_s=e=>`${e.provider}
|
|
10
|
-
${e.modelId}`;function Da(e,s){return s&&e?.models.find(a=>a.provider===s.provider&&a.modelId===s.modelId)}function P0(e){const s=e?.thinkingLevels??[];return s.some(a=>a!=="off")?s:[]}function xb(e,s){if(!s||!e?.length||e.includes(s))return s;const a=Lr.indexOf(s);return e.filter(c=>Lr.indexOf(c)<=a).sort((c,u)=>Lr.indexOf(u)-Lr.indexOf(c))[0]??(e.includes("off")?"off":e[0])}function Qo(e,s){const a=e?.thinkingLevels;if(!(!e||!a?.length))return s&&a.includes(s)?s:e.thinkingLevel&&a.includes(e.thinkingLevel)?e.thinkingLevel:xb(a,s)}function Y0(e,s){return{...e,model:{provider:s.provider,modelId:s.modelId},thinkingLevel:s.thinkingLevel??xb(s.thinkingLevels,e.thinkingLevel)}}function V0(e,s,a){const l=e?.capabilities.chatOptions?Da(e,s.model??a):void 0;if(!e||!l)return;const c=Qo(l,s.thinkingLevel??(s.model?void 0:a?.thinkingLevel));return{connectorId:e.id,provider:l.provider,modelId:l.modelId,...c?{thinkingLevel:c}:{}}}function Z0(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=Lr.includes(s.thinkingLevel)?s.thinkingLevel:void 0;return{connectorId:s.connectorId,provider:s.provider,modelId:s.modelId,...a?{thinkingLevel:a}:{}}}catch{return}}function X0(e,s,a,l=()=>!0){const c=s&&Da(e,s),u=c&&l(c)?c:Da(e,a);if(!u)return{access:"auto"};const d=u.thinkingLevels?.length?Qo(u,s?.thinkingLevel):u.thinkingLevel;return{model:{provider:u.provider,modelId:u.modelId},thinkingLevel:d,access:"auto"}}function Q0(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 K0(e,s,a){if(!(a!=="submit"||e||s.access==="approval"))return`Still checking this session's host, so "${Co[s.access].label}" can't be applied yet. Try again in a moment.`}function J0(e,s){if(e?.capabilities.chatOptions){if(!e.models.length)return`${e.name} offers no models right now.`;if(s.model&&!Da(e,s.model))return`${e.name} no longer offers ${s.model.modelId}. Choose another model.`}}function bb(e,s,a){if(!e?.capabilities.chatOptions)return;const l=Da(e,s.model),c={};l&&(c.model={provider:l.provider,modelId:l.modelId});const u=Qo(l,s.thinkingLevel);return u&&(c.thinkingLevel=u),a==="submit"&&(c.access=s.access),a==="submit"&&s.access==="auto"&&Dh(e)&&(c.autoMerge=!0),c}const vb="pikibun.autoApproveConfirmed";function wb(e,s){return e?.autoMerge===!0&&!s}const jb="pikibun.lastChat";function W0(){try{return Z0(localStorage.getItem(jb))}catch{return}}function kb(e,s,a){const l=V0(e,s,a);if(l)try{localStorage.setItem(jb,JSON.stringify(l))}catch{}}let Sb=!1;function Cb(){if(Sb)return!0;try{return localStorage.getItem(vb)==="1"}catch{return!1}}async function Mh(e,s){const a=await qe({title:"Auto-approve commands?",message:G0(e,s),confirmLabel:"Enable auto-approve",destructive:!0});if(a&&Dh(e)){Sb=!0;try{localStorage.setItem(vb,"1")}catch{}}return a}const Ay={read:"eye",approval:"shield",auto:"alert"};function Ab({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:Cy,children:Cy});const d=Da(e,s.model),h=P0(d),p=Qo(d,s.thinkingLevel);function m(w){const S=e.models.find(A=>_s(A)===w);S&&a(Y0(s,S))}async function y(w){w==="auto"&&s.access!=="auto"&&!await Mh(e,u)||a({...s,access:w})}const v=(l?["read","approval","auto"]:["read","approval"]).map(w=>({label:Co[w].label,icon:Ay[w],hint:Co[w].hint,destructive:w==="auto",onSelect:()=>{y(w)}})),b=Co[s.access];return i.jsxs(i.Fragment,{children:[i.jsx(Vt,{label:"Model",side:"above",placeholder:"Model",disabled:!e.models.length,value:s.model&&d?_s(s.model):"",options:e.models.map(w=>({value:_s(w),label:w.name,hint:w.provider})),onChange:m}),h.length>0&&i.jsx(Vt,{label:"Reasoning",side:"above",placeholder:"Default",value:p&&h.includes(p)?p:"",options:h.map(w=>({value:w,label:q0[w]})),onChange:w=>a({...s,thinkingLevel:w})}),c&&i.jsx("span",{className:s.access==="auto"?"chat-access auto":"chat-access",title:`Access: ${b.label}`,children:i.jsx(Wn,{label:"Access",align:"end",side:"above",items:v,trigger:i.jsxs(i.Fragment,{children:[i.jsx(ke,{name:Ay[s.access],size:14}),i.jsx("span",{className:"truncate",children:b.label})]})})})]})}const Di=e=>`pikibun.draft.${e}`,Ao=new Map;function Bo(e){try{const s=localStorage.getItem(Di(e));if(s!==null)return s;const a=sessionStorage.getItem(Di(e));return a===null?"":(localStorage.setItem(Di(e),a),sessionStorage.removeItem(Di(e)),a)}catch{return""}}function Xr(e,s){try{s?localStorage.setItem(Di(e),s):localStorage.removeItem(Di(e))}catch{}}function Tb(e,s){try{localStorage.getItem(Di(e))===s&&localStorage.removeItem(Di(e))}catch{}for(const a of Ao.get(e)??[])a(s)}const To=new Map;function e1(e,s){const a=c=>c.trim()?`${c}
|
|
11
|
-
|
|
12
|
-
${s}`:s,l=To.get(e);if(l?.size)for(const c of l)c(a);else Xr(e,a(Bo(e)))}function Nb(e){const[s]=T.useState(()=>Bo(e)),[a,l]=T.useState(s);return T.useEffect(()=>{const c=y=>l(x=>x===y?"":x),u=Ao.get(e)??new Set;u.add(c),Ao.set(e,u);const d=y=>l(y),h=To.get(e)??new Set;h.add(d),To.set(e,h);const p=y=>{y.key===Di(e)&&y.newValue===null&&y.oldValue&&c(y.oldValue)};window.addEventListener("storage",p);const m=Bo(e);return m!==s&&l(y=>y===s?m:y),()=>{u.delete(c),u.size||Ao.delete(e),h.delete(d),h.size||To.delete(e),window.removeEventListener("storage",p)}},[e,s]),T.useEffect(()=>{Xr(e,a)},[e,a]),[a,l]}function Qr(e){const[s,a]=T.useState(null),[l,c]=T.useState(!!e),[u,d]=T.useState(""),[h,p]=T.useState(0),m=T.useRef(void 0),y=T.useCallback(()=>p(x=>x+1),[]);return T.useEffect(()=>{const x=new AbortController;let v=!1;if(m.current!==e&&(m.current=e,a(null),c(!!e)),d(""),!e)return()=>x.abort();async function b(){if(!v){v=!0;try{const S=await fe(e,{signal:x.signal});x.signal.aborted||(a(S),d(""))}catch(S){x.signal.aborted||d(Tn(S))}finally{v=!1,x.signal.aborted||c(!1)}}}b();const w=window.setInterval(()=>{document.hidden||b()},1e4);return()=>{x.abort(),window.clearInterval(w)}},[e,h]),{data:s,loading:l,error:u,refresh:y}}function Eb(e){return e.revokedAt?"Revoked":e.online?e.capabilities.unsandboxed?"Unsandboxed":e.capabilities.sandbox?"Online":"Sandbox unverified":"Offline"}function Lh(e){const s=Eb(e);return s==="Online"?"success":s==="Unsandboxed"?"danger":"warning"}function Kr({connector:e}){const s=Eb(e);return i.jsx(Ae,{tone:Lh(e),dot:s==="Online",children:s})}function Ko({connector:e}){const{capabilities:s}=e;return i.jsxs(i.Fragment,{children:[s.unsandboxed&&i.jsx(xe,{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(us,{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 Li(e){return{id:e.userId,githubLogin:e.githubLogin,role:e.role}}function Us(e){return e.githubLogin||e.id}function Mt(e){return e.githubLogin?`${e.githubLogin}(${e.id})`:e.id}function t1(e){const s=new Map(e.map(a=>[a.id,a]));return a=>s.get(a)??{id:a}}function eh(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 th(e,s){return typeof e=="string"?Mt(s(e)):Array.isArray(e)?e.map(a=>th(a,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,l])=>[a,th(l,s)])):e}function zb(e){return{list:e,person:t1(e)}}function Ob(e){const{user:s}=vt(),a=Ie(e?`/api/workspaces/${ce(e)}/members`:null).data?.members;return T.useMemo(()=>{const l=(a??[]).map(Li);return l.some(c=>c.id===s.id)||l.push({id:s.id,githubLogin:s.githubLogin}),zb(l)},[a,s.id,s.githubLogin])}const Rb=T.createContext(null);function n1({people:e,children:s}){return i.jsx(Rb.Provider,{value:e,children:s})}function _h(){const{user:e}=vt(),s=T.useContext(Rb),a=T.useMemo(()=>zb([{id:e.id,githubLogin:e.githubLogin}]),[e.id,e.githubLogin]);return s??a}function ri({id:e,you:s}){const{user:a}=vt(),l=_h().person(e);return i.jsx("span",{title:Mt(l),children:s&&e===a.id?"you":Us(l)})}const Db=["github","github-enterprise","gitlab","bitbucket","azure-devops","gitea","git"],qn={github:"GitHub","github-enterprise":"GitHub Enterprise Server",gitlab:"GitLab",bitbucket:"Bitbucket Cloud","azure-devops":"Azure DevOps",gitea:"Gitea / Forgejo",git:"Git server (HTTPS)"},li={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 i1(e){return e!=="git"}const yo={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"]},Vr={repositories:5,pickerRepositories:3e3};function Uh(){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: ",Vr.repositories," repositories per workspace."]})]})}function Mb(e){const s=Ie(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 Lb(e=!0){const s=Ie(e?"/api/git/accounts":null);return{accounts:s.data?.accounts??null,loading:s.loading,error:s.error,refresh:s.refresh}}function Jo(e,s){return s===li[e].default?qn[e]:`${qn[e]} (${s})`}function nh(e){return`${qn[e.provider]} · ${e.host}${e.organization?`/${e.organization}`:""}`}const Ty="pikibun.lastStart",s1=80;function a1(e,s){try{return e().getItem(s)??""}catch{return""}}function r1(e,s,a){try{a===null?e().removeItem(s):e().setItem(s,a)}catch{}}function l1(e,s){const a=e.trim().split(`
|
|
13
|
-
`)[0]?.trim()??"";return Array.from(a).slice(0,s1).join("").trim()||s}const Ny=(e,s)=>e.provider===s.provider&&e.modelId===s.modelId;function o1({workspaceId:e,ownerId:s}){const a=Ob(e);return i.jsx(i.Fragment,{children:Mt(a.person(s))})}function _b({workspaceId:e}){const{workspaces:s,workspacesLoading:a,workspacesError:l,refreshWorkspaces:c,currentWorkspace:u,selectWorkspace:d}=vt(),h=s.find(p=>p.id===e)??null;return T.useEffect(()=>{h&&u?.id!==h.id&&d(h.id)},[h,u?.id,d]),h?Pr(h.role)?i.jsx(c1,{workspace:h},h.id):i.jsx("div",{className:"new-session",children:i.jsx(bt,{title:"You're a viewer in this workspace",action:i.jsx(It,{variant:"ghost",href:Ze({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(oi,{}):l?i.jsx("div",{className:"new-session",children:i.jsx(xe,{variant:"error",title:"Unable to load workspaces",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:c,children:"Retry"}),children:l})}):i.jsx("div",{className:"new-session",children:i.jsx(bt,{title:"Workspace not found",action:i.jsx(It,{variant:"ghost",href:Ze({name:"sessions"}),children:"View sessions"}),children:"You may no longer be a member of this workspace."})})}function c1({workspace:e}){const{user:s,refreshSessions:a}=vt(),l=`/api/workspaces/${ce(e.id)}`,c=Ie(`${l}/models`),u=Qr(`${l}/connectors`),d=Mb(e.id),[h]=T.useState(()=>a1(()=>localStorage,Ty)),[p]=T.useState(W0),[m,y]=T.useState(""),[x,v]=T.useState(""),[b,w]=T.useState("workspace"),[S,A]=T.useState(""),[k,z]=T.useState(!1),N=Ce(),M=T.useRef(null),H=c.data?.models,L=u.data?.connectors,P=T.useMemo(()=>{const Ne=new Set((H??[]).map(et=>et.connectorId));return(L??[]).filter(et=>Ne.has(et.id)&&!et.revokedAt).sort((et,Nn)=>+(Nn.ownerId===s.id)-+(et.ownerId===s.id))},[L,H,s.id]),ue=h.startsWith("model:")?H?.find(Ne=>Ne.id===h.slice(6)):void 0,se=P.find(Ne=>Ne.id===m)??P.find(Ne=>Ne.id===ue?.connectorId)??P.find(Ne=>Ne.online)??P[0],$=se?.id??"",I=Ne=>Ne&&se&&se.models.some(et=>Ny(et,Ne))?H?.find(et=>et.connectorId===se.id&&Ny(et,Ne)):void 0,[X,le]=T.useState(null),te=I(ue)??se?.models.map(Ne=>I(Ne)).find(Boolean),F=X?.key===$?X.value:X0(se,p,te,Ne=>!!I(Ne)),B=I(F.model),U=!!(se&&se.ownerId!==s.id),ee=!!(se?.online&&!se.revokedAt&&B&&(se.ownerId===s.id||se.workspaceIds.includes(e.id))),re=d.repositories,O=!!(re&&!d.error&&!d.loading&&(d.sourceCount||!d.required)),R=!U||!!(se&&S===se.id),Q=!!se?.hostSessions,E=Q&&k,J=!!(se?.capabilities.unsandboxed||E),be=!!(B&&se&&ee&&O&&R&&!N.busy),ye=mb(fb(se)),Me=T.useRef(!1);T.useEffect(()=>{A("")},[$,se?.ownerId,re]),T.useEffect(()=>{z(!1)},[$]),T.useLayoutEffect(()=>{const Ne=M.current;Ne&&(Ne.style.height="auto",Ne.style.height=`${Ne.scrollHeight}px`)},[x]);async function Xe(Ne){if(Ne?.preventDefault(),!be||!B||!se||Me.current)return;const et=x.trim(),Nn=ye.images,yn=bb(se,F,"submit");if(wb(yn,Cb())&&(Me.current=!0,!await Mh(se,J).finally(()=>{Me.current=!1}))){le({key:$,value:{...F,access:"approval"}});return}N.run(async()=>{const en=await yb(Nn),En=(await fe("/api/sessions",{method:"POST",body:{workspaceId:e.id,modelId:B.id,title:l1(x,B.name),visibility:b,...U?{trustedConnectorId:se.id}:{},...E?{hostEnvironment:!0}:{}}})).session.id;if(r1(()=>localStorage,Ty,`model:${B.id}`),kb(se,F),et||en.length)try{await fe(`/api/sessions/${ce(En)}/submit`,{method:"POST",body:{content:et,requestId:crypto.randomUUID(),...yn?{options:yn}:{},...en.length?{images:en}:{}}})}catch{Xr(En,et),D0(En,Nn)}a(),ds({name:"session",sessionId:En})})}const[de]=T.useState(()=>lb()),[ht]=T.useState(()=>!rb());function Lt(Ne){de&&Ne.key==="Enter"&&!Ne.shiftKey&&!Ne.nativeEvent.isComposing&&(Ne.preventDefault(),Xe())}const Zt=Ze({name:"settings",section:"workspaces",id:e.id});function Wt(){if(d.error)return i.jsx(xe,{variant:"warning",title:"Unable to load sources",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:d.refresh,children:"Retry"}),children:d.error});if(re&&!d.sourceCount&&d.required)return i.jsx(xe,{variant:"warning",title:"No sources in this workspace",actions:i.jsx(It,{variant:"outline",size:"sm",href:Zt,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(xe,{variant:"error",title:"Unable to load models",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:c.refresh,children:"Retry"}),children:c.error});if(!c.loading&&!u.loading&&!u.error&&!P.length)return i.jsx(xe,{variant:"info",title:"No host to chat with yet",actions:i.jsx(It,{variant:"outline",size:"sm",href:Ze({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(!se||u.loading||!H)return null;const Ne=i.jsx(G,{variant:"outline",size:"sm",onClick:u.refresh,children:"Refresh host status"});return u.error?i.jsx(xe,{variant:"warning",title:"Unable to check host",actions:Ne,children:u.error}):B?ee?U?i.jsx(xe,{variant:"warning",title:`Hosted by ${se.ownerName}`,children:i.jsxs("label",{className:"check-row new-session-trust",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:S===se.id,disabled:N.busy,onChange:et=>A(et.target.checked?se.id:"")}),i.jsxs("span",{children:["I trust ",se.ownerName,"'s host (",se.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(xe,{variant:"warning",title:`${se.name} is unavailable`,actions:Ne,children:se.revokedAt?"This host was revoked.":se.online?"This host isn't shared with this workspace.":"It must reconnect before work can run."}):i.jsxs(xe,{variant:"warning",title:`No model on ${se.name}`,actions:Ne,children:[se.name," offers no model you can use in this workspace."]})}const yt=[{label:"Workspace",icon:"globe",hint:"Members can view",onSelect:()=>w("workspace")},{label:"Private",icon:"lock",hint:"You, workspace admins and grants",onSelect:()=>w("private")}],Gn=[{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(Mi,{name:e.name,id:e.id}),i.jsx("span",{className:"truncate",children:e.name}),i.jsx(It,{variant:"ghost",size:"xs",href:Zt,children:"Workspace settings"})]})]}),Wt(),i.jsx("form",{className:"composer-card",onSubmit:Xe,"aria-busy":N.busy,children:i.jsxs("fieldset",{disabled:N.busy,children:[i.jsx(gb,{attachments:ye,disabled:N.busy}),i.jsx("textarea",{ref:M,className:"composer-input",rows:2,value:x,onChange:Ne=>v(Ne.target.value),onKeyDown:Lt,onPaste:ye.paste,placeholder:"Describe the task","aria-label":"First message",enterKeyHint:de?"send":"enter",autoFocus:ht}),ye.notice&&i.jsx("p",{className:"composer-notice",role:"status",children:ye.notice}),i.jsxs("div",{className:"composer-toolbar",children:[i.jsx(pb,{attachments:ye,disabled:N.busy}),i.jsx(Vt,{label:"Host",placeholder:c.loading||u.loading?"Loading...":"Choose a host",disabled:!P.length,value:$,options:P.map(Ne=>({value:Ne.id,label:Ne.name,hint:Ne.ownerId===s.id?"Your host":`${Ne.ownerName}'s host`})),onChange:y}),i.jsx(Wn,{label:"Visibility",align:"start",items:yt,trigger:i.jsxs(i.Fragment,{children:[i.jsx(ke,{name:b==="workspace"?"globe":"lock",size:14}),b==="workspace"?"Workspace":"Private"]})}),Q&&i.jsx(Wn,{label:"Where it runs",align:"start",items:Gn,trigger:i.jsxs(i.Fragment,{children:[i.jsx(ke,{name:E?"server":"shield",size:14}),E?"On host":"Sandbox"]})}),i.jsx(Hr,{label:"Who can see and do what",children:i.jsxs("div",{className:"stack",children:[i.jsx("p",{children:b==="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(Ab,{host:se,value:F,onChange:Ne=>le({key:$,value:Ne}),owner:!0,showAccess:!0,unsandboxed:J}),i.jsx("span",{className:"spacer"}),N.busy&&i.jsx(Bt,{children:"Preparing repositories..."}),i.jsx(G,{type:"submit",variant:"default",icon:"send",className:"composer-send","aria-label":"Start session",title:"Start session",disabled:!be})]})]})}),i.jsx(ve,{error:N.error}),E&&se&&i.jsxs(xe,{variant:"warning",title:U?`Runs on ${se.ownerName}'s host, without the sandbox`:"Runs on your host, without the sandbox",children:[U&&i.jsxs(i.Fragment,{children:[se.ownerName," granted you sessions on ",se.name,". "]}),"Its commands run on ",se.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: ",U?`people you share the session with can decide them only if they also hold host commands on ${se.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:N.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:[se&&(u.loading||c.loading?i.jsx(Bt,{children:"Checking host..."}):i.jsxs(i.Fragment,{children:[i.jsx(Kr,{connector:se}),i.jsx("span",{children:se.name}),i.jsx("span",{children:"·"}),i.jsx("span",{children:B?.name}),i.jsx("span",{children:"·"}),i.jsxs("span",{children:[U?`Hosted by ${se.ownerName}`:"Your host",", ",se.workspaceIds.includes(e.id)?"shared with this workspace":"private"]}),i.jsx(Hr,{label:"Host and model details",children:i.jsxs("div",{className:"stack",children:[i.jsxs("p",{children:["Model: ",B?.name," ",i.jsxs("span",{className:"muted",children:[B?.provider," / ",B?.modelId]})]}),i.jsxs("p",{className:"muted small",children:["Host owner: ",i.jsx(o1,{workspaceId:e.id,ownerId:se.ownerId}),i.jsx("br",{}),"Connection ID: ",se.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(Bt,{children:"Loading repositories..."}):re&&re.length>0&&i.jsxs(i.Fragment,{children:[se&&i.jsx("span",{children:"·"}),i.jsx("span",{children:re.length===1?"1 repository":`${re.length} repositories`}),i.jsx(Hr,{label:"Repositories for this session",children:i.jsxs("div",{className:"stack",children:[i.jsx("ul",{children:re.map(Ne=>i.jsxs("li",{children:[i.jsx("strong",{children:Ne.fullName})," ",i.jsxs("span",{className:"muted",children:["at ",i.jsx("code",{children:Ne.ref})]})]},Ne.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(Uh,{})]})}),i.jsx(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh repositories",onClick:d.refresh})]})]})}),se&&!N.busy&&i.jsx(Ko,{connector:se})]})}async function u1(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 d1({signedIn:e,signup:s,inviteToken:a}){const l=s==="open"||s==="invite"&&a!==void 0,[c,u]=T.useState("signin"),[d,h]=T.useState(""),[p,m]=T.useState(""),[y,x]=T.useState(""),[v,b]=T.useState(!1),[w,S]=T.useState(""),A=c==="signup";function k(N){if(N.preventDefault(),A&&p!==y){S("The passwords don't match.");return}b(!0),S("");const M={username:d,password:p};A&&a!==void 0&&(M.inviteToken=a),u1(A?"/api/auth/password/signup":"/api/auth/password/login",M).then(e,H=>{S(H instanceof Error?H.message:"Sign-in failed. Try again."),b(!1)})}function z(){u(A?"signin":"signup"),S(""),x("")}return i.jsxs("form",{className:"password-sign-in",onSubmit:k,children:[i.jsx(ge,{label:"Username",hint:A?"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:N=>h(N.target.value),autoComplete:"username",autoCapitalize:"none",spellCheck:!1,maxLength:60})}),i.jsx(ge,{label:"Password",hint:A?"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:p,onChange:N=>m(N.target.value),autoComplete:A?"new-password":"current-password",minLength:A?12:1,maxLength:256})}),A&&i.jsx(ge,{label:"Confirm password",children:i.jsx("input",{className:"input",type:"password",required:!0,value:y,onChange:N=>x(N.target.value),autoComplete:"new-password",maxLength:256})}),i.jsx(ve,{error:w}),i.jsx(G,{type:"submit",variant:"default",size:"lg",block:!0,disabled:v,children:v?A?"Creating account...":"Signing in...":A?"Create account":"Sign in"}),l&&i.jsx(G,{variant:"ghost",size:"sm",onClick:z,disabled:v,children:A?"Have an account? Sign in":"New here? Create an account"}),A&&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 Bh({open:e,onClose:s}){const{refreshWorkspaces:a,selectWorkspace:l}=vt(),[c,u]=T.useState(""),d=Ce();function h(p){p.preventDefault(),!(d.busy||!c.trim())&&d.run(async()=>{const m=await fe("/api/workspaces",{method:"POST",body:{name:c.trim()}});u(""),a(),l(m.workspace.id),s(),ds({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(G,{disabled:d.busy,onClick:s,children:"Cancel"}),i.jsx(G,{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(ge,{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:p=>u(p.target.value),placeholder:"The field studio"})}),i.jsx(ve,{error:d.error})]})})}const kt="[redacted]",h1=/^[A-Za-z0-9._~+/=:@%^!#,-]+$/,f1=/^(?:\$\{?[A-Za-z_]|\{\{|\{%|%\(|<[^<>]*>$|\*+$|x{3,}$|\.{3}$|\u2026$|your[_-]|(?:null|none|nil|undefined|true|false|empty)$)/i;function Ms(e,s){return!!e&&!e.includes(kt)&&!f1.test(e)&&(!s.command||h1.test(e))}function Ey(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 m1=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 p1(e){return/^[A-Za-z][A-Za-z-]{3,63}$/.test(e)&&!/^[a-z]+[A-Z]|^[A-Z][a-z]+[A-Z]/.test(e)&&!m1.has(e.toLowerCase())}function g1(e,s){let a=s;for(;e[a]===" "||e[a]===" ";)a++;const l=e[a]??"";return l===`
|
|
14
|
-
`||l==="\r"?"":l}const xo=/-----BEGIN ((?:[A-Z0-9]{1,16} ){0,4})PRIVATE KEY( BLOCK)?-----/g,Ad=/(?:Proc-Type|DEK-Info|Version|Comment|Hash|Charset): [^\r\n\\]{0,256}/y,y1=/^(?:\r?\n|\\r\\n|\\n)/,x1=/(?:\r?\n|\\r\\n|\\n)[ \t]*$/;function b1(e){if(!e.includes("PRIVATE KEY"))return e;let s="",a=0;xo.lastIndex=0;for(let l=xo.exec(e);l;l=xo.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,p=0,m=!0,y=!1;for(;h<d;){if(e.startsWith(u,h)){y=!0;break}const x=e[h];if(x===`
|
|
15
|
-
`||x==="\r"){h++,m=!0;continue}if(x==="\\"&&(e[h+1]==="n"||e[h+1]==="r")){h+=2,m=!0;continue}if((x===" "||x===" ")&&m){h++;continue}if(m&&(Ad.lastIndex=h,Ad.test(e))){h=Ad.lastIndex,m=!1;continue}if(/[A-Za-z0-9+/=]/.test(x)){h++,p++,m=!1;continue}break}if(p&&(y||p>=16)){const x=e.slice(c,h);s+=e.slice(a,c)+(y1.exec(x)?.[0]??"")+kt+(x1.exec(x)?.[0]??""),a=h}xo.lastIndex=y?h+u.length:Math.max(h,c)}return s+e.slice(a)}const v1=String.raw`pass(?:word|wd|phrase)|secret|token|api[_-]?key|(?:access|secret|private|auth|account|encryption|signing|master|session)[_-]?key`,w1=/pass|secret|token|key/i,j1=String.raw`"((?:[^"\\\n\x60$]|\\[^\n]){1,8192})"|'([^'\n]{1,8192})'|\\"((?:[^"\\\n\x60$]|\\[^"\n]){1,8192})\\"`,k1=String.raw`([^\s'"\x60,;&|<>(){}\[\]$\\=][^\s'"\x60,;&|<>(){}\[\]$\\]{0,1023})`,S1=new RegExp(String.raw`(${v1})((?:\\?["'])?)([ \t]{0,16}(?::=|=>|[:=])[ \t]{0,16}|[ \t]{1,16}(?:is|was)[ \t]{1,16})(?:${j1}|${k1})`,"gi"),C1=/^[ \t]+(?:is|was)[ \t]+$/i;function A1(e,s){return e.replace(S1,(a,l,c,u,d,h,p,m,y)=>{let x=d??h??p??m??"",v="";if(m===void 0){if(/^\s|\s$/.test(x))return a}else{/[^.]\.$/.test(x)&&(x=x.slice(0,-1),v=".");const w=g1(e,y+a.length);if(u==="="){if(/[),}\]]/.test(w)?!Ey(x):/^\d{1,5}$/.test(x))return a}else{const S=C1.test(u);if(!S&&/[;,)}\]|<>({[=?:&]/.test(w))return a;const A=v!==""||w===""||(S?/[.!?,;)"']/.test(w):w==="#");if(!Ey(x)&&!(/^pass/i.test(l)&&A&&p1(x)))return a}}if(!Ms(x,s))return a;const b=d!==void 0?`"${kt}"`:h!==void 0?`'${kt}'`:p!==void 0?`\\"${kt}\\"`:kt+v;return l+c+u+b})}const T1=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 N1(e,s){return e.includes("--")?e.replace(T1,(a,l,c,u,d,h)=>Ms(u??d??h??"",s)?l+c+(u!==void 0?`"${kt}"`:d!==void 0?`'${kt}'`:kt):a):e}const E1=/(\bcurl\b[^\n]{0,2048}?[ \t])(-u|--user)([ \t]{1,16}|=)(["']?)([^\s:'"\x60;&|<>(){}$\\]{1,256}):([^\s'"\x60;&|<>(){}$\\]{1,1024})\4(?![^\s])/g,z1=/\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,O1=/\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,R1=/\b(bearer[ \t]{1,16})([A-Za-z0-9._~+/-]{16,4096}=*)(?![A-Za-z0-9._~+/=-])/gi,D1=/\b([a-z][a-z0-9+.-]{1,30}:\/\/[^\s:/@?#'"<>[\]]{0,256}:)([^\s@/?#'"<>[\]]{1,1024})(?=@)/gi;function M1(e,s){let a=e;return a.includes("curl")&&(a=a.replace(E1,(l,c,u,d,h,p,m)=>/^\d+$/.test(p)&&/^\d+$/.test(m)||!Ms(m,s)?l:`${c}${u}${d}${h}${p}:${kt}${h}`)),a.includes("machine")&&(a=a.replace(z1,(l,c,u)=>Ms(u,s)?c+kt:l)),/bearer|authorization|basic|token|digest|negotiate|apikey|sso-key|bot/i.test(a)&&(a=a.replace(O1,(l,c,u)=>Ms(u,s)?c+kt:l),a=a.replace(R1,(l,c,u)=>/\d/.test(u)&&Ms(u,s)?c+kt:l)),a.includes("://")&&(a=a.replace(D1,(l,c,u)=>Ms(u,s)?c+kt:l)),a}const L1=[{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")}],_1=/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_/,U1=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"),B1=/(#\/shared\/)([A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/g;function H1(e){let s=e;if(_1.test(s))for(const{pattern:a,digit:l}of L1)s=s.replace(a,(c,u,d)=>l&&!/\d/.test(d)?c:u+kt);return s.includes("eyJ")&&(s=s.replace(U1,kt)),s.includes("#/shared/")&&(s=s.replace(B1,`$1${kt}`)),s}function $1(e,s={}){if(typeof e!="string"||!e)return e;let a=s.command?e:b1(e);return a=M1(a,s),w1.test(a)&&(a=N1(A1(a,s),s)),H1(a)}function ih(e){return JSON.stringify(e??"").includes(kt)}const I1=/^([a-z_]+)\(\{.*\}\)$/s,q1=/^ {0,3}(`{3,}|~{3,})(.*)$/s;function G1(e){const s=[];let a="";for(const l of e.split(`
|
|
16
|
-
`)){const c=q1.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=I1.exec(l);s.push(u?{line:l,tool:u[1]}:{line:l})}return s}function Wo(e){const s=[],a=[];for(const{line:l,tool:c}of G1(e))c!==void 0?a.push({name:c,line:l}):s.push(l);return{prose:s.join(`
|
|
17
|
-
`),calls:a}}const F1=/^\d{1,15}:\d{1,15}$/;function P1(e){if(F1.test(e.id)){if(e.role==="user")return{entryId:e.id,before:!0};if(!(e.role!=="assistant"||Wo(e.text).calls.length>0))return{entryId:e.id,before:!1}}}function Y1(e){return e.rewindable===!0}const V1=/^\[image [^\s\]]+\]$/;function zy(e){return e.text.split(`
|
|
18
|
-
`).filter(s=>!V1.test(s)).join(`
|
|
19
|
-
`).trim()}function Z1(e){return e.role==="assistant"?Wo(e.text).prose.trim():e.text}const sh={size:50},X1={entries:e=>e.id,approvals:e=>e.id,conversations:e=>e.id,queue:e=>e.submissionId},Td=Object.keys(X1),Q1=["entries","approvals","conversations"],Oy={items:2e5},K1=/^[0-9a-f]{32}$/;function Ry(e){return typeof e=="string"&&K1.test(e)}function J1(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 W1(e,s){if(!Array.isArray(s)||s.length>Oy.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>Oy.items)throw new Error("Invalid list patch")}return a}function Ub(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const s=e;return!Ry(s.base)||!Ry(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 eS(e,s){if(!Ub(s))throw new Error("Invalid view patch");if(s.base===s.revision)return e;const a=s.lists,l=s.view;if(Td.some(d=>Object.hasOwn(l,d))||Object.keys(a).some(d=>!Td.includes(d)))throw new Error("Invalid view patch");const c=J1(e),u={...l};for(const d of Td)a[d]!==void 0&&(u[d]=W1(c.lists[d]??[],a[d]));if(Q1.some(d=>!Array.isArray(u[d])))throw new Error("Invalid view patch");return u}function ah(e,s){return(e?.entries??[]).filter(a=>a.conversationId===s)}function tS(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=ah(s,c.id),h=ah(a,c.id)[0]?.id,p=d.findIndex(x=>x.id===h),m=p<0?d:d.slice(0,p),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 Dy(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,...p}=c,m=(c.olderEntries??0)-u.length;return m>0?{...p,olderEntries:m}:p})}}function My(e,s,a){return s.get(a)?.[0]?.id??ah(e,a)[0]?.id}const Ho=["queued","admitting","running"],Er={activeReopenMs:1e3,idleReopenMs:1e4,firstBackoffMs:2e3,maxBackoffMs:6e4,accessCheckMs:3e4};function nS(e,s,a){const l=new AbortController,c=`/api/sessions/${ce(e)}`;let u=null,d=()=>{},h=0,p=!1,m=!1,y=!1,x,v=!1,b=null,w,S=new Map;const A=new Map,k=()=>!v&&!l.signal.aborted;function z(I,X){S=tS(S,b,I),b=I,w=typeof X=="string"?X:void 0,p=I.busy||(I.queue??[]).some(le=>Ho.includes(le.status))||I.repositories?.status==="preparing",s.view(Dy(I,S)),s.error("")}async function N(I){const X=b,te=(X?.conversations?.find(U=>U.id===I)?.olderEntries??0)-(S.get(I)?.length??0),F=X&&My(X,S,I);if(!k()||!X||te<=0||!F)return;const B=`conversation=${encodeURIComponent(I)}&before=${encodeURIComponent(F)}&limit=${sh.size}`;try{const U=await a.api(`${c}/entries?${B}`,{signal:l.signal});if(!k()||!b||My(b,S,I)!==F||!Array.isArray(U?.entries))return;const ee=S.get(I)??[],re=new Map(S);re.set(I,[...U.entries,...ee]),S=re,s.view(Dy(b,S))}catch(U){k()&&s.error(Tn(U))}}function M(){u?.close(),u=null}function H(){v=!0,b=null,w=void 0,S=new Map,M(),d(),s.session(null),s.view(null),s.status("offline")}async function L(I){if(!k())return;if(y){x=x===!0||I;return}y=!0;let X=!0;try{const le=await a.api(c,{signal:l.signal});if(X=!1,!k()||(s.session(le.session),!I))return;const te=await a.api(`${c}/view`,{signal:l.signal});k()&&z(te.view,te.revision)}catch(le){if(!k())return;s.error(Tn(le)),X&&le instanceof Xn&&[401,403,404].includes(le.status)&&H()}finally{if(y=!1,x!==void 0&&k()){const le=x;x=void 0,L(le)}}}function P(I){if(d(),!k()||a.hidden())return;const X=setTimeout(ue,I);d=()=>clearTimeout(X)}function ue(){if(d(),!k()||a.hidden()||u)return;const I=a.openEvents(`${c}/events?since=${w??""}`);u=I;let X=!1;const le=(te,F)=>{X=!0,h=0,s.status("online"),z(te,F)};I.addEventListener("view",te=>{if(u!==I||!k())return;let F;try{F=JSON.parse(String(te.data))}catch{return}F?.view&&le(F.view,F.revision)}),I.addEventListener("patch",te=>{if(u!==I||!k())return;let F;try{F=JSON.parse(String(te.data))?.patch}catch{return}if(!Ub(F)||!b||F.base!==w){w=void 0;return}let B;try{B=eS(b,F)}catch{w=void 0;return}le(B,F.revision)}),I.addEventListener("error",()=>{if(u!==I||(M(),!k()))return;const te=m;if(m=!1,X)return P(p||te?Er.activeReopenMs:Er.idleReopenMs);h++,s.status("reconnecting"),L(!0),P(Math.min(Er.maxBackoffMs,Er.firstBackoffMs*2**(h-1)))})}const se=a.onVisibilityChange(()=>{if(k()){if(a.hidden()){d(),M();return}L(!1),ue()}}),$=setInterval(()=>{a.hidden()||L(!1)},Er.accessCheckMs);return L(!0).then(ue),{refresh(){L(!1),u?m=!0:ue()},loadOlder(I){let X=A.get(I);return X||(X=N(I).finally(()=>A.delete(I)),A.set(I,X)),X},stop(){l.abort(),M(),d(),clearInterval($),se()}}}const iS={api:fe,openEvents:e=>new EventSource(e,{withCredentials:!0}),hidden:()=>document.hidden,onVisibilityChange(e){return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)}};function sS(e,s){return nS(e,s,iS)}function aS(e,s){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const rS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oS={};function Ly(e,s){return(oS.jsx?lS:rS).test(e)}const cS=/[ \t\n\f\r]/g;function uS(e){return typeof e=="object"?e.type==="text"?_y(e.value):!1:_y(e)}function _y(e){return e.replace(cS,"")===""}class Jr{constructor(s,a,l){this.normal=a,this.property=s,l&&(this.space=l)}}Jr.prototype.normal={};Jr.prototype.property={};Jr.prototype.space=void 0;function Bb(e,s){const a={},l={};for(const c of e)Object.assign(a,c.property),Object.assign(l,c.normal);return new Jr(a,l,s)}function rh(e){return e.toLowerCase()}class gn{constructor(s,a){this.attribute=a,this.property=s}}gn.prototype.attribute="";gn.prototype.booleanish=!1;gn.prototype.boolean=!1;gn.prototype.commaOrSpaceSeparated=!1;gn.prototype.commaSeparated=!1;gn.prototype.defined=!1;gn.prototype.mustUseProperty=!1;gn.prototype.number=!1;gn.prototype.overloadedBoolean=!1;gn.prototype.property="";gn.prototype.spaceSeparated=!1;gn.prototype.space=void 0;let dS=0;const _e=qs(),Dt=qs(),lh=qs(),me=qs(),ct=qs(),Bs=qs(),Cn=qs();function qs(){return 2**++dS}const oh=Object.freeze(Object.defineProperty({__proto__:null,boolean:_e,booleanish:Dt,commaOrSpaceSeparated:Cn,commaSeparated:Bs,number:me,overloadedBoolean:lh,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),Nd=Object.keys(oh);class Hh extends gn{constructor(s,a,l,c){let u=-1;if(super(s,a),Uy(this,"space",c),typeof l=="number")for(;++u<Nd.length;){const d=Nd[u];Uy(this,Nd[u],(l&oh[d])===oh[d])}}}Hh.prototype.defined=!0;function Uy(e,s,a){a&&(e[s]=a)}function Ma(e){const s={},a={};for(const[l,c]of Object.entries(e.properties)){const u=new Hh(l,e.transform(e.attributes||{},l),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),s[l]=u,a[rh(l)]=l,a[rh(u.attribute)]=l}return new Jr(s,a,e.space)}const Hb=Ma({properties:{ariaActiveDescendant:null,ariaAtomic:Dt,ariaAutoComplete:null,ariaBusy:Dt,ariaChecked:Dt,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:Dt,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:Dt,ariaFlowTo:ct,ariaGrabbed:Dt,ariaHasPopup:null,ariaHidden:Dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:me,ariaLive:null,ariaModal:Dt,ariaMultiLine:Dt,ariaMultiSelectable:Dt,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:Dt,ariaReadOnly:Dt,ariaRelevant:null,ariaRequired:Dt,ariaRoleDescription:ct,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:Dt,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,s){return s==="role"?s:"aria-"+s.slice(4).toLowerCase()}});function $b(e,s){return s in e?e[s]:s}function Ib(e,s){return $b(e,s.toLowerCase())}const hS=Ma({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Bs,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alpha:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:ct,autoFocus:_e,autoPlay:_e,blocking:ct,capture:null,charSet:null,checked:_e,cite:null,className:ct,closedBy:null,colorSpace:null,cols:me,colSpan:me,command:null,commandFor:null,content:null,contentEditable:Dt,controls:_e,controlsList:ct,coords:me|Bs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:lh,draggable:Dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:ct,height:me,hidden:lh,high:me,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:ct,itemRef:ct,itemScope:_e,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,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:me,pattern:null,ping:ct,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:ct,required:_e,reversed:_e,rows:me,rowSpan:me,sandbox:ct,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootCustomElementRegistry:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shadowRootSerializable:_e,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:Dt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:Dt,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,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:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:Dt,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_e,disablePictureInPicture:_e,disableRemotePlayback:_e,exportParts:Bs,part:ct,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:Ib}),fS=Ma({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:Cn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:ct,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:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,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:Bs,g2:Bs,glyphName:Bs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:Cn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,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:me,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:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Cn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Cn,rev:Cn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Cn,requiredFeatures:Cn,requiredFonts:Cn,requiredFormats:Cn,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:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:Cn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Cn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Cn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$b}),qb=Ma({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()}}),Gb=Ma({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ib}),Fb=Ma({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,s){return"xml:"+s.slice(3).toLowerCase()}}),mS={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"},pS=/[A-Z]/g,By=/-[a-z]/g,gS=/^data[-\w.:]+$/i;function yS(e,s){const a=rh(s);let l=s,c=gn;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&gS.test(s)){if(s.charAt(4)==="-"){const u=s.slice(5).replace(By,bS);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=s.slice(4);if(!By.test(u)){let d=u.replace(pS,xS);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}c=Hh}return new c(l,s)}function xS(e){return"-"+e.toLowerCase()}function bS(e){return e.charAt(1).toUpperCase()}const vS=Bb([Hb,hS,qb,Gb,Fb],"html"),$h=Bb([Hb,fS,qb,Gb,Fb],"svg");function wS(e){return e.join(" ").trim()}var za={},Ed,Hy;function jS(){if(Hy)return Ed;Hy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,s=/\n/g,a=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g,p=`
|
|
20
|
-
`,m="/",y="*",x="",v="comment",b="declaration";function w(A,k){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];k=k||{};var z=1,N=1;function M(te){var F=te.match(s);F&&(z+=F.length);var B=te.lastIndexOf(p);N=~B?te.length-B:N+te.length}function H(){var te={line:z,column:N};return function(F){return F.position=new L(te),se(),F}}function L(te){this.start=te,this.end={line:z,column:N},this.source=k.source}L.prototype.content=A;function P(te){var F=new Error(k.source+":"+z+":"+N+": "+te);if(F.reason=te,F.filename=k.source,F.line=z,F.column=N,F.source=A,!k.silent)throw F}function ue(te){var F=te.exec(A);if(F){var B=F[0];return M(B),A=A.slice(B.length),F}}function se(){ue(a)}function $(te){var F;for(te=te||[];F=I();)F!==!1&&te.push(F);return te}function I(){var te=H();if(!(m!=A.charAt(0)||y!=A.charAt(1))){for(var F=2;x!=A.charAt(F)&&(y!=A.charAt(F)||m!=A.charAt(F+1));)++F;if(F+=2,x===A.charAt(F-1))return P("End of comment missing");var B=A.slice(2,F-2);return N+=2,M(B),A=A.slice(F),N+=2,te({type:v,comment:B})}}function X(){var te=H(),F=ue(l);if(F){if(I(),!ue(c))return P("property missing ':'");var B=ue(u),U=te({type:b,property:S(F[0].replace(e,x)),value:B?S(B[0].replace(e,x)):x});return ue(d),U}}function le(){var te=[];$(te);for(var F;F=X();)F!==!1&&(te.push(F),$(te));return te}return se(),le()}function S(A){return A?A.replace(h,x):x}return Ed=w,Ed}var $y;function kS(){if($y)return za;$y=1;var e=za&&za.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(za,"__esModule",{value:!0}),za.default=a;const s=e(jS());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(p=>{if(p.type!=="declaration")return;const{property:m,value:y}=p;h?c(m,y,p):y&&(u=u||{},u[m]=y)}),u}return za}var zr={},Iy;function SS(){if(Iy)return zr;Iy=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.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,"-")},p=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 zr.camelCase=p,zr}var Or,qy;function CS(){if(qy)return Or;qy=1;var e=Or&&Or.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},s=e(kS()),a=SS();function l(c,u){var d={};return!c||typeof c!="string"||(0,s.default)(c,function(h,p){h&&p&&(d[(0,a.camelCase)(h,u)]=p)}),d}return l.default=l,Or=l,Or}var AS=CS();const TS=ib(AS),Pb=Yb("end"),Ih=Yb("start");function Yb(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 NS(e){const s=Ih(e),a=Pb(e);if(s&&a)return{start:s,end:a}}function Ir(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Gy(e.position):"start"in e||"end"in e?Gy(e):"line"in e||"column"in e?ch(e):""}function ch(e){return Fy(e&&e.line)+":"+Fy(e&&e.column)}function Gy(e){return ch(e&&e.start)+"-"+ch(e&&e.end)}function Fy(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 p=l.indexOf(":");p===-1?u.ruleId=l:(u.source=l.slice(0,p),u.ruleId=l.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.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=Ir(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 qh={}.hasOwnProperty,ES=new Map,zS=/[A-Z]/g,OS=new Set(["table","tbody","thead","tfoot","tr"]),RS=new Set(["td","th"]),Vb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DS(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=IS(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=$S(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"?$h:vS,stylePropertyNameCase:s.stylePropertyNameCase||"dom",tableCellAlignToStyle:s.tableCellAlignToStyle!==!1},u=Zb(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function Zb(e,s,a){if(s.type==="element")return MS(e,s,a);if(s.type==="mdxFlowExpression"||s.type==="mdxTextExpression")return LS(e,s);if(s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement")return US(e,s,a);if(s.type==="mdxjsEsm")return _S(e,s);if(s.type==="root")return BS(e,s,a);if(s.type==="text")return HS(e,s)}function MS(e,s,a){const l=e.schema;let c=l;s.tagName.toLowerCase()==="svg"&&l.space==="html"&&(c=$h,e.schema=c),e.ancestors.push(s);const u=Qb(e,s.tagName,!1),d=qS(e,s);let h=Fh(e,s);return OS.has(s.tagName)&&(h=h.filter(function(p){return typeof p=="string"?!uS(p):!0})),Xb(e,d,u,s),Gh(d,h),e.ancestors.pop(),e.schema=l,e.create(s,u,d,a)}function LS(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)}Zr(e,s.position)}function _S(e,s){if(s.data&&s.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(s.data.estree);Zr(e,s.position)}function US(e,s,a){const l=e.schema;let c=l;s.name==="svg"&&l.space==="html"&&(c=$h,e.schema=c),e.ancestors.push(s);const u=s.name===null?e.Fragment:Qb(e,s.name,!0),d=GS(e,s),h=Fh(e,s);return Xb(e,d,u,s),Gh(d,h),e.ancestors.pop(),e.schema=l,e.create(s,u,d,a)}function BS(e,s,a){const l={};return Gh(l,Fh(e,s)),e.create(s,e.Fragment,l,a)}function HS(e,s){return s.value}function Xb(e,s,a,l){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(s.node=l)}function Gh(e,s){if(s.length>0){const a=s.length>1?s:s[0];a&&(e.children=a)}}function $S(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 IS(e,s){return a;function a(l,c,u,d){const h=Array.isArray(u.children),p=Ih(l);return s(c,u,d,h,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function qS(e,s){const a={};let l,c;for(c in s.properties)if(c!=="children"&&qh.call(s.properties,c)){const u=FS(e,c,s.properties[c]);if(u){const[d,h]=u;e.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&RS.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 GS(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 Zr(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 Zr(e,s.position);else u=l.value===null?!0:l.value;a[c]=u}return a}function Fh(e,s){const a=[];let l=-1;const c=e.passKeys?new Map:ES;for(;++l<s.children.length;){const u=s.children[l];let d;if(e.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const m=c.get(p)||0;d=p+"-"+m,c.set(p,m+1)}}const h=Zb(e,u,d);h!==void 0&&a.push(h)}return a}function FS(e,s,a){const l=yS(e.schema,s);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=l.commaSeparated?aS(a):wS(a)),l.property==="style"){let c=typeof a=="object"?a:PS(e,String(a));return e.stylePropertyNameCase==="css"&&(c=YS(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&l.space?mS[l.property]||l.property:l.attribute,a]}}function PS(e,s){try{return TS(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=Vb+"#cannot-parse-style-attribute",c}}function Qb(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=Ly(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=Ly(s)&&!/^[a-z]/.test(s)?{type:"Identifier",name:s}:{type:"Literal",value:s};if(l.type==="Literal"){const c=l.value;return qh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(l);Zr(e)}function Zr(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=Vb+"#cannot-handle-mdx-estrees-without-createevaluater",a}function YS(e){const s={};let a;for(a in e)qh.call(e,a)&&(s[VS(a)]=e[a]);return s}function VS(e){let s=e.replace(zS,ZS);return s.slice(0,3)==="ms-"&&(s="-"+s),s}function ZS(e){return"-"+e.toLowerCase()}const zd={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"]},XS={};function Ph(e,s){const a=XS,l=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,c=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Kb(e,l,c)}function Kb(e,s,a){if(QS(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 Py(e.children,s,a)}return Array.isArray(e)?Py(e,s,a):""}function Py(e,s,a){const l=[];let c=-1;for(;++c<e.length;)l[c]=Kb(e[c],s,a);return l.join("")}function QS(e){return!!(e&&typeof e=="object")}const Yy=document.createElement("i");function Yh(e){const s="&"+e+";";Yy.innerHTML=s;const a=Yy.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===s?!1:a}function Kn(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 $n(e,s){return e.length>0?(Kn(e,e.length,0,s),e):s}const Vy={}.hasOwnProperty;function Jb(e){const s={};let a=-1;for(;++a<e.length;)KS(s,e[a]);return s}function KS(e,s){let a;for(a in s){const c=(Vy.call(e,a)?e[a]:void 0)||(e[a]={}),u=s[a];let d;if(u)for(d in u){Vy.call(c,d)||(c[d]=[]);const h=u[d];JS(c[d],Array.isArray(h)?h:h?[h]:[])}}}function JS(e,s){let a=-1;const l=[];for(;++a<s.length;)(s[a].add==="after"?e:l).push(s[a]);Kn(e,0,0,l)}function Wb(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 Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=hs(/[A-Za-z]/),Qt=hs(/[\dA-Za-z]/),WS=hs(/[#-'*+\--9=?A-Z^-~]/);function $o(e){return e!==null&&(e<32||e===127)}const uh=hs(/\d/),eC=hs(/[\dA-Fa-f]/),tC=hs(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function dt(e){return e!==null&&(e<0||e===32)}function $e(e){return e===-2||e===-1||e===32}const ec=hs(new RegExp("\\p{P}|\\p{S}","u")),Hs=hs(/\s/);function hs(e){return s;function s(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function La(e){const s=[];let a=-1,l=0,c=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&Qt(e.charCodeAt(a+1))&&Qt(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(p){return $e(p)?(e.enter(a),h(p)):s(p)}function h(p){return $e(p)&&u++<c?(e.consume(p),h):(e.exit(a),s(p))}}function ev(e,s,a,l,c,u){let d=0;return h;function h(y){return $e(y)?(e.enter(l),p(y)):m(y)}function p(y){return $e(y)&&d<u?(e.consume(y),d++,p):(e.exit(l),m(y))}function m(y){return d>=c?s(y):a(y)}}const nC={tokenize:iC};function iC(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 p=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=p),a=p,d(h)}function d(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Re(h)?(e.consume(h),e.exit("chunkText"),u):(e.consume(h),d)}}let Io=class{constructor(){this.index=new Map,this.map=[]}add(s,a,l){Zy(this,s,a,l,!1)}addBefore(s,a,l){Zy(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 Zy(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 sC={tokenize:aC},Xy={tokenize:rC};function aC(e){const s=this,a=[];let l=0,c,u,d;return h;function h(N){if(l<a.length){const M=a[l];return s.containerState=M[1],e.attempt(M[0].continuation,p,m)(N)}return m(N)}function p(N){if(l++,s.containerState._closeFlow){s.containerState._closeFlow=void 0,c&&z();const M=s.events.length;let H=M,L;for(;H--;)if(s.events[H][0]==="exit"&&s.events[H][1].type==="chunkFlow"){L=s.events[H][1].end;break}k(l);let P=M;for(;P<s.events.length;)s.events[P][1].end={...L},P++;const ue=new Io;return ue.add(H+1,0,s.events.slice(M)),ue.add(M,P-M,[]),ue.consume(s.events),m(N)}return h(N)}function m(N){if(l===a.length){if(!c)return v(N);if(c.currentConstruct&&c.currentConstruct.concrete)return w(N);s.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return s.containerState={},e.check(Xy,y,x)(N)}function y(N){return c&&z(),k(l),v(N)}function x(N){return s.parser.lazy[s.now().line]=l!==a.length,d=s.now().offset,w(N)}function v(N){return s.containerState={},e.attempt(Xy,b,w)(N)}function b(N){return l++,a.push([s.currentConstruct,s.containerState]),v(N)}function w(N){if(N===null){c&&z(),k(0),e.consume(N);return}return c=c||s.parser.flow(s.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),S(N)}function S(N){if(N===null){A(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return Re(N)?(e.consume(N),A(e.exit("chunkFlow")),l=0,s.interrupt=void 0,h):(e.consume(N),S)}function A(N,M){const H=s.sliceStream(N);if(M&&H.push(null),N.previous=u,u&&(u.next=N),u=N,c.defineSkip(N.start),c.write(H),s.parser.lazy[N.start.line]){let L=c.events.length;for(;L--;)if(c.events[L][1].start.offset<d&&(!c.events[L][1].end||c.events[L][1].end.offset>d))return;const P=s.events.length;let ue=P,se,$;for(;ue--;)if(s.events[ue][0]==="exit"&&s.events[ue][1].type==="chunkFlow"){if(se){$=s.events[ue][1].end;break}se=!0}for(k(l),L=P;L<s.events.length;)s.events[L][1].end={...$},L++;const I=new Io;I.add(ue+1,0,s.events.slice(P)),I.add(P,L-P,[]),I.consume(s.events)}}function k(N){let M=a.length;for(;M-- >N;){const H=a[M];s.containerState=H[1],H[0].exit.call(s,e)}a.length=N}function z(){c.write([null]),u=void 0,c=void 0,s.containerState._closeFlow=void 0}}function rC(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 qo(e){if(e===null||dt(e)||Hs(e))return 1;if(ec(e))return 2}function tc(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 dh={name:"attention",resolveAll:lC,tokenize:oC};function lC(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};Qy(d,-u),Qy(h,u);const p={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}},x={type:u>1?"strong":"emphasis",start:{...p.start},end:{...m.end}};e[c][1].end={...p.start},e[a][1].start={...m.end},l=[],e[c][1].end.offset-e[c][1].start.offset&&(l=$n(l,[["enter",e[c][1],s],["exit",e[c][1],s]])),l=$n(l,[["enter",x,s],["enter",p,s],["exit",p,s],["enter",y,s]]),l=$n(l,tc(s.parser.constructs.insideSpan.null,e.slice(c+1,a),s)),l=$n(l,[["exit",y,s],["enter",m,s],["exit",m,s],["exit",x,s]]);let v=0;e[a][1].end.offset-e[a][1].start.offset&&(v=2,l=$n(l,[["enter",e[a][1],s],["exit",e[a][1],s]])),Kn(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 oC(e,s){const a=this.parser.constructs.attentionMarkers.null,l=this.previous,c=qo(l);let u;return d;function d(p){return u=p,e.enter("attentionSequence"),h(p)}function h(p){if(p===u)return e.consume(p),h;const m=e.exit("attentionSequence"),y=qo(p),x=!y||y===2&&c||a.includes(p)&&p!==42&&p!==95,v=!c||c===2&&y||a.includes(l)&&l!==42&&l!==95;return m._open=!!(u===42?x:x&&(c||!v)),m._close=!!(u===42?v:v&&(y||!x)),s(p)}}function Qy(e,s){e.column+=s,e.offset+=s,e._bufferIndex+=s}const cC={name:"autolink",tokenize:uC};function uC(e,s,a){let l=0;return c;function c(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(b){return sn(b)?(e.consume(b),d):b===64?a(b):m(b)}function d(b){return b===43||b===45||b===46||Qt(b)?(l=1,h(b)):m(b)}function h(b){return b===58?(e.consume(b),l=0,p):(b===43||b===45||b===46||Qt(b))&&l++<32?(e.consume(b),h):(l=0,m(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),s):b===null||b===32||b===60||$o(b)?a(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),y):WS(b)?(e.consume(b),m):a(b)}function y(b){return Qt(b)?x(b):a(b)}function x(b){return b===46?(e.consume(b),l=0,y):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),s):v(b)}function v(b){if((b===45||Qt(b))&&l++<63){const w=b===45?v:x;return e.consume(b),w}return a(b)}}const Wr={partial:!0,tokenize:dC};function dC(e,s,a){return l;function l(u){return $e(u)?Je(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||Re(u)?s(u):a(u)}}const tv={continuation:{tokenize:fC},exit:mC,name:"blockQuote",tokenize:hC};function hC(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 $e(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),s):(e.exit("blockQuotePrefix"),s(d))}}function fC(e,s,a){const l=this;return c;function c(d){return $e(d)?Je(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(tv,s,a)(d)}}function mC(e){e.exit("blockQuote")}const nv={name:"characterEscape",tokenize:pC};function pC(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 tC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),s):a(u)}}const iv={name:"characterReference",tokenize:gC};function gC(e,s,a){const l=this;let c=0,u,d;return h;function h(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),p}function p(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),u=31,d=Qt,y(x))}function m(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=eC,y):(e.enter("characterReferenceValue"),u=7,d=uh,y(x))}function y(x){if(x===59&&c){const v=e.exit("characterReferenceValue");return d===Qt&&!Yh(l.sliceSerialize(v))?a(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),s)}return d(x)&&c++<u?(e.consume(x),y):a(x)}}const hh={partial:!0,tokenize:yC};function yC(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 Ky={concrete:!0,name:"codeFenced",tokenize:xC};function xC(e,s,a){const l=this,c={partial:!0,tokenize:H};let u=0,d=0,h;return p;function p(L){return m(L)}function m(L){const P=l.events[l.events.length-1];return u=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,h=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(L)}function y(L){return L===h?(d++,e.consume(L),y):d<3?a(L):(e.exit("codeFencedFenceSequence"),$e(L)?Je(e,x,"whitespace")(L):x(L))}function x(L){return L===null||Re(L)?(e.exit("codeFencedFence"),l.interrupt?s(L):e.check(hh,S,M)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(L))}function v(L){return L===null||Re(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(L)):$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Je(e,b,"whitespace")(L)):L===96&&L===h?a(L):(e.consume(L),v)}function b(L){return L===null||Re(L)?x(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(L))}function w(L){return L===null||Re(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(L)):L===96&&L===h?a(L):(e.consume(L),w)}function S(L){return e.attempt(c,M,A)(L)}function A(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),k}function k(L){return u>0&&$e(L)?Je(e,z,"linePrefix",u+1)(L):z(L)}function z(L){return L===null||Re(L)?e.check(hh,S,M)(L):(e.enter("codeFlowValue"),N(L))}function N(L){return L===null||Re(L)?(e.exit("codeFlowValue"),z(L)):(e.consume(L),N)}function M(L){return e.exit("codeFenced"),s(L)}function H(L,P,ue){let se=0;return $;function $(F){return L.enter("lineEnding"),L.consume(F),L.exit("lineEnding"),I}function I(F){return L.enter("codeFencedFence"),$e(F)?Je(L,X,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):X(F)}function X(F){return F===h?(L.enter("codeFencedFenceSequence"),le(F)):ue(F)}function le(F){return F===h?(se++,L.consume(F),le):se>=d?(L.exit("codeFencedFenceSequence"),$e(F)?Je(L,te,"whitespace")(F):te(F)):ue(F)}function te(F){return F===null||Re(F)?(L.exit("codeFencedFence"),P(F)):ue(F)}}}const Od={name:"codeIndented",tokenize:vC},bC={partial:!0,tokenize:wC};function vC(e,s,a){return l;function l(h){return e.enter("codeIndented"),ev(e,c,a,"linePrefix",4,4)(h)}function c(h){return h===null?d(h):Re(h)?e.attempt(bC,c,d)(h):(e.enter("codeFlowValue"),u(h))}function u(h){return h===null||Re(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),u)}function d(h){return e.exit("codeIndented"),s(h)}}function wC(e,s,a){const l=this;return c;function c(d){return l.parser.lazy[l.now().line]?a(d):Re(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):ev(e,s,u,"linePrefix",4,4)(d)}function u(d){return Re(d)?c(d):a(d)}}const jC={name:"codeText",previous:SC,resolve:kC,tokenize:CC};function kC(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 SC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function CC(e,s,a){let l=0,c,u;return d;function d(x){return e.enter("codeText"),e.enter("codeTextSequence"),h(x)}function h(x){return x===96?(e.consume(x),l++,h):(e.exit("codeTextSequence"),p(x))}function p(x){return x===null?a(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),p):x===96?(u=e.enter("codeTextSequence"),c=0,y(x)):Re(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(x))}function m(x){return x===null||x===32||x===96||Re(x)?(e.exit("codeTextData"),p(x)):(e.consume(x),m)}function y(x){return x===96?(e.consume(x),c++,y):c===l?(e.exit("codeTextSequence"),e.exit("codeText"),s(x)):(u.type="codeTextData",m(x))}}class AC{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&&Rr(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),Rr(this.left,s)}unshift(s){this.setCursor(0),this.right.push(s)}unshiftMany(s){this.setCursor(0),Rr(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);Rr(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-s,Number.POSITIVE_INFINITY);Rr(this.left,a.reverse())}}}function Rr(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 sv(e){const s={};let a=-1,l,c,u,d,h,p,m;const y=new AC(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"&&(p=l[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(s,TC(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 Kn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function TC(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,p=[],m={};let y,x,v=-1,b=a,w=0,S=0;const A=[S];for(;b;){for(;e.get(++c)[1]!==b;);u.push(c),b._tokenizer||(y=l.sliceStream(b),b.next||y.push(null),x&&d.defineSkip(b.start),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(y),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),x=b,b=b.next}for(b=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,A.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(d.events=[],b?(b._tokenizer=void 0,b.previous=void 0):A.pop(),v=A.length;v--;){const k=h.slice(A[v],A[v+1]),z=u.pop();p.push([z,z+k.length-1]),e.splice(z,2,k)}for(p.reverse(),v=-1;++v<p.length;)m[w+p[v][0]]=w+p[v][1],w+=p[v][1]-p[v][0]-1;return m}const NC={resolve:zC,tokenize:OC},EC={partial:!0,tokenize:RC};function zC(e){return sv(e),e}function OC(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):Re(h)?e.check(EC,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 RC(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||Re(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 av(e,s,a,l,c,u,d,h,p){const m=p||Number.POSITIVE_INFINITY;let y=0;return x;function x(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||$o(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"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(h),v(k)):k===null||k===60||Re(k)?a(k):(e.consume(k),k===92?w:b)}function w(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function S(k){return!y&&(k===null||k===41||dt(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||$o(k)?a(k):(e.consume(k),k===92?A:S)}function A(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function rv(e,s,a,l,c,u){const d=this;let h=0,p;return m;function m(b){return e.enter(l),e.enter(c),e.consume(b),e.exit(c),e.enter(u),y}function y(b){return h>999||b===null||b===91||b===93&&!p||b===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?a(b):b===93?(e.exit(u),e.enter(c),e.consume(b),e.exit(c),e.exit(l),s):Re(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||b===91||b===93||Re(b)||h++>999?(e.exit("chunkString"),y(b)):(e.consume(b),p||(p=!$e(b)),b===92?v:x)}function v(b){return b===91||b===92||b===93?(e.consume(b),h++,x):x(b)}}function lv(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,p):a(v)}function p(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),p(d)):v===null?a(v):Re(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||Re(v)?(e.exit("chunkString"),m(v)):(e.consume(v),v===92?x:y)}function x(v){return v===d||v===92?(e.consume(v),y):y(v)}}function qr(e,s){let a;return l;function l(c){return Re(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a=!0,l):$e(c)?Je(e,l,a?"linePrefix":"lineSuffix")(c):s(c)}}const DC={name:"definition",tokenize:LC},MC={partial:!0,tokenize:_C};function LC(e,s,a){const l=this;let c;return u;function u(b){return e.enter("definition"),d(b)}function d(b){return rv.call(l,e,h,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return c=Jn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):a(b)}function p(b){return dt(b)?qr(e,m)(b):m(b)}function m(b){return av(e,y,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function y(b){return e.attempt(MC,x,x)(b)}function x(b){return $e(b)?Je(e,v,"whitespace")(b):v(b)}function v(b){return b===null||Re(b)?(e.exit("definition"),l.parser.defined.push(c),s(b)):a(b)}}function _C(e,s,a){return l;function l(h){return dt(h)?qr(e,c)(h):a(h)}function c(h){return lv(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function u(h){return $e(h)?Je(e,d,"whitespace")(h):d(h)}function d(h){return h===null||Re(h)?s(h):a(h)}}const UC={name:"hardBreakEscape",tokenize:BC};function BC(e,s,a){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return Re(u)?(e.exit("hardBreakEscape"),s(u)):a(u)}}const HC={name:"headingAtx",resolve:$C,tokenize:IC};function $C(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"};Kn(e,l,a-l+1,[["enter",c,s],["enter",u,s],["exit",u,s],["exit",c,s]])}return e}function IC(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||dt(y)?(e.exit("atxHeadingSequence"),h(y)):a(y)}function h(y){return y===35?(e.enter("atxHeadingSequence"),p(y)):y===null||Re(y)?(e.exit("atxHeading"),s(y)):$e(y)?Je(e,h,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function p(y){return y===35?(e.consume(y),p):(e.exit("atxHeadingSequence"),h(y))}function m(y){return y===null||y===35||dt(y)?(e.exit("atxHeadingText"),h(y)):(e.consume(y),m)}}const qC=["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"],Jy=["pre","script","style","textarea"],GC={concrete:!0,name:"htmlFlow",resolveTo:PC,tokenize:YC},FC={partial:!0,tokenize:VC};function PC(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 YC(e,s,a){const l=this;let c,u,d,h,p;return m;function m(E){return y(E)}function y(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),x}function x(E){return E===33?(e.consume(E),v):E===47?(e.consume(E),u=!0,S):E===63?(e.consume(E),c=3,l.interrupt?s:O):sn(E)?(e.consume(E),d=String.fromCharCode(E),A):a(E)}function v(E){return E===45?(e.consume(E),c=2,b):E===91?(e.consume(E),c=5,h=0,w):sn(E)?(e.consume(E),c=4,l.interrupt?s:O):a(E)}function b(E){return E===45?(e.consume(E),l.interrupt?s:O):a(E)}function w(E){const J="CDATA[";return E===J.charCodeAt(h++)?(e.consume(E),h===J.length?l.interrupt?s:X:w):a(E)}function S(E){return sn(E)?(e.consume(E),d=String.fromCharCode(E),A):a(E)}function A(E){if(E===null||E===47||E===62||dt(E)){const J=E===47,be=d.toLowerCase();return!J&&!u&&Jy.includes(be)?(c=1,l.interrupt?s(E):X(E)):qC.includes(d.toLowerCase())?(c=6,J?(e.consume(E),k):l.interrupt?s(E):X(E)):(c=7,l.interrupt&&!l.parser.lazy[l.now().line]?a(E):u?z(E):N(E))}return E===45||Qt(E)?(e.consume(E),d+=String.fromCharCode(E),A):a(E)}function k(E){return E===62?(e.consume(E),l.interrupt?s:X):a(E)}function z(E){return $e(E)?(e.consume(E),z):$(E)}function N(E){return E===47?(e.consume(E),$):E===58||E===95||sn(E)?(e.consume(E),M):$e(E)?(e.consume(E),N):$(E)}function M(E){return E===45||E===46||E===58||E===95||Qt(E)?(e.consume(E),M):H(E)}function H(E){return E===61?(e.consume(E),L):$e(E)?(e.consume(E),H):N(E)}function L(E){return E===null||E===60||E===61||E===62||E===96?a(E):E===34||E===39?(e.consume(E),p=E,P):$e(E)?(e.consume(E),L):ue(E)}function P(E){return E===p?(e.consume(E),p=null,se):E===null||Re(E)?a(E):(e.consume(E),P)}function ue(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||dt(E)?H(E):(e.consume(E),ue)}function se(E){return E===47||E===62||$e(E)?N(E):a(E)}function $(E){return E===62?(e.consume(E),I):a(E)}function I(E){return E===null||Re(E)?X(E):$e(E)?(e.consume(E),I):a(E)}function X(E){return E===45&&c===2?(e.consume(E),B):E===60&&c===1?(e.consume(E),U):E===62&&c===4?(e.consume(E),R):E===63&&c===3?(e.consume(E),O):E===93&&c===5?(e.consume(E),re):Re(E)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(FC,Q,le)(E)):E===null||Re(E)?(e.exit("htmlFlowData"),le(E)):(e.consume(E),X)}function le(E){return e.check(hh,te,Q)(E)}function te(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),F}function F(E){return E===null||Re(E)?le(E):(e.enter("htmlFlowData"),X(E))}function B(E){return E===45?(e.consume(E),O):X(E)}function U(E){return E===47?(e.consume(E),d="",ee):X(E)}function ee(E){if(E===62){const J=d.toLowerCase();return Jy.includes(J)?(e.consume(E),R):X(E)}return sn(E)&&d.length<8?(e.consume(E),d+=String.fromCharCode(E),ee):X(E)}function re(E){return E===93?(e.consume(E),O):X(E)}function O(E){return E===62?(e.consume(E),R):E===45&&c===2?(e.consume(E),O):X(E)}function R(E){return E===null||Re(E)?(e.exit("htmlFlowData"),Q(E)):(e.consume(E),R)}function Q(E){return e.exit("htmlFlow"),s(E)}}function VC(e,s,a){return l;function l(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(Wr,s,a)}}const ZC={name:"htmlText",tokenize:XC};function XC(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),p}function p(O){return O===33?(e.consume(O),m):O===47?(e.consume(O),H):O===63?(e.consume(O),N):sn(O)?(e.consume(O),ue):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),b):a(O)}function x(O){return O===null?a(O):O===45?(e.consume(O),v):Re(O)?(d=x,U(O)):(e.consume(O),x)}function v(O){return O===45?(e.consume(O),b):x(O)}function b(O){return O===62?B(O):O===45?v(O):x(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),A):Re(O)?(d=S,U(O)):(e.consume(O),S)}function A(O){return O===93?(e.consume(O),k):S(O)}function k(O){return O===62?B(O):O===93?(e.consume(O),k):S(O)}function z(O){return O===null||O===62?B(O):Re(O)?(d=z,U(O)):(e.consume(O),z)}function N(O){return O===null?a(O):O===63?(e.consume(O),M):Re(O)?(d=N,U(O)):(e.consume(O),N)}function M(O){return O===62?B(O):N(O)}function H(O){return sn(O)?(e.consume(O),L):a(O)}function L(O){return O===45||Qt(O)?(e.consume(O),L):P(O)}function P(O){return Re(O)?(d=P,U(O)):$e(O)?(e.consume(O),P):B(O)}function ue(O){return O===45||Qt(O)?(e.consume(O),ue):O===47||O===62||dt(O)?se(O):a(O)}function se(O){return O===47?(e.consume(O),B):O===58||O===95||sn(O)?(e.consume(O),$):Re(O)?(d=se,U(O)):$e(O)?(e.consume(O),se):B(O)}function $(O){return O===45||O===46||O===58||O===95||Qt(O)?(e.consume(O),$):I(O)}function I(O){return O===61?(e.consume(O),X):Re(O)?(d=I,U(O)):$e(O)?(e.consume(O),I):se(O)}function X(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(e.consume(O),c=O,le):Re(O)?(d=X,U(O)):$e(O)?(e.consume(O),X):(e.consume(O),te)}function le(O){return O===c?(e.consume(O),c=void 0,F):O===null?a(O):Re(O)?(d=le,U(O)):(e.consume(O),le)}function te(O){return O===null||O===34||O===39||O===60||O===61||O===96?a(O):O===47||O===62||dt(O)?se(O):(e.consume(O),te)}function F(O){return O===47||O===62||dt(O)?se(O):a(O)}function B(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),s):a(O)}function U(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),ee}function ee(O){return $e(O)?Je(e,re,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):re(O)}function re(O){return e.enter("htmlTextData"),d(O)}}const Vh={name:"labelEnd",resolveAll:WC,resolveTo:e2,tokenize:t2},QC={tokenize:n2},KC={tokenize:i2},JC={tokenize:s2};function WC(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&&Kn(e,0,e.length,a),e}function e2(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}},p={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",p,s]],d=$n(d,e.slice(c+1,c+l+3)),d=$n(d,[["enter",m,s]]),d=$n(d,tc(s.parser.constructs.insideSpan.null,e.slice(c+l+4,u-3),s)),d=$n(d,[["exit",m,s],e[u-2],e[u-1],["exit",p,s]]),d=$n(d,e.slice(u+1)),d=$n(d,[["exit",h,s]]),Kn(e,c,e.length,d),e}function t2(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?x(v):(d=l.parser.defined.includes(Jn(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),p):a(v)}function p(v){return v===40?e.attempt(QC,y,d?y:x)(v):v===91?e.attempt(KC,y,d?m:x)(v):d?y(v):x(v)}function m(v){return e.attempt(JC,y,x)(v)}function y(v){return c.pop(),s(v)}function x(v){return u._balanced=!0,a(v)}}function n2(e,s,a){return l;function l(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),c}function c(x){return dt(x)?qr(e,u)(x):u(x)}function u(x){return x===41?y(x):av(e,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function d(x){return dt(x)?qr(e,p)(x):y(x)}function h(x){return a(x)}function p(x){return x===34||x===39||x===40?lv(e,m,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):y(x)}function m(x){return dt(x)?qr(e,y)(x):y(x)}function y(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),s):a(x)}}function i2(e,s,a){const l=this;return c;function c(h){return rv.call(l,e,u,d,"reference","referenceMarker","referenceString")(h)}function u(h){return l.parser.defined.includes(Jn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?s(h):a(h)}function d(h){return a(h)}}function s2(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 a2={name:"labelStartImage",resolveAll:Vh.resolveAll,tokenize:r2};function r2(e,s,a){const l=this;let c;return u;function u(p){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(p),e.exit("labelImageMarker"),d}function d(p){return p===91?(e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),c=e.exit("labelImage"),h):a(p)}function h(p){return p===94&&"_hiddenFootnoteSupport"in l.parser.constructs?a(p):(l._labelStarts=l._labelStarts||[],l._labelStarts.push(c),s(p))}}const l2={name:"labelStartLink",resolveAll:Vh.resolveAll,tokenize:o2};function o2(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 Rd={name:"lineEnding",tokenize:c2};function c2(e,s){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Je(e,s,"linePrefix")}}const No={name:"thematicBreak",tokenize:u2};function u2(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"),p(m)):l>=3&&(m===null||Re(m))?(e.exit("thematicBreak"),s(m)):a(m)}function p(m){return m===c?(e.consume(m),l++,p):(e.exit("thematicBreakSequence"),$e(m)?Je(e,h,"whitespace")(m):h(m))}}const mn={continuation:{tokenize:m2},exit:g2,name:"list",tokenize:f2},d2={partial:!0,tokenize:y2},h2={partial:!0,tokenize:p2};function f2(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(b){const w=l.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||b===l.containerState.marker:uh(b)){if(l.containerState.type||(l.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(No,a,m)(b):m(b);if(!l.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return a(b)}function p(b){return uh(b)&&++d<10?(e.consume(b),p):(!l.interrupt||d<2)&&(l.containerState.marker?b===l.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):a(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||b,e.check(Wr,l.interrupt?a:y,e.attempt(d2,v,x))}function y(b){return l.containerState.initialBlankLine=!0,u++,v(b)}function x(b){return $e(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):a(b)}function v(b){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,s(b)}}function m2(e,s,a){const l=this;return l.containerState._closeFlow=void 0,e.check(Wr,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||!$e(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(h2,s,d)(h))}function d(h){return l.containerState._closeFlow=!0,l.interrupt=void 0,Je(e,e.attempt(mn,s,a),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function p2(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 g2(e){e.exit(this.containerState.type)}function y2(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!$e(u)&&d&&d[1].type==="listItemPrefixWhitespace"?s(u):a(u)}}const Wy={name:"setextUnderline",resolveTo:x2,tokenize:b2};function x2(e,s){const a=new Io;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 b2(e,s,a){const l=this;let c;return u;function u(m){let y=l.events.length,x;for(;y--;)if(l.events[y][1].type!=="lineEnding"&&l.events[y][1].type!=="linePrefix"&&l.events[y][1].type!=="content"){x=l.events[y][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||x)?(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"),$e(m)?Je(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||Re(m)?(e.exit("setextHeadingLine"),s(m)):a(m)}}const v2={tokenize:w2};function w2(e){const s=this,a=e.attempt(Wr,l,e.attempt(this.parser.constructs.flowInitial,c,Je(e,e.attempt(this.parser.constructs.flow,c,e.attempt(NC,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 j2={resolveAll:cv()},k2=ov("string"),S2=ov("text");function ov(e){return{resolveAll:cv(e==="text"?C2: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),p}function p(y){return m(y)?(a.exit("data"),u(y)):(a.consume(y),p)}function m(y){if(y===null)return!0;const x=c[y];let v=-1;if(x)for(;++v<x.length;){const b=x[v];if(!b.previous||b.previous.call(l,l.previous))return!0}return!1}}}function cv(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 C2(e,s){const a=new Io;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,p=0,m;for(;d--;){const y=u[d];if(typeof y=="string"){for(h=y.length;y.charCodeAt(h-1)===32;)p++,h--;if(h)break;h=-1}else if(y===-2)m=!0,p++;else if(y!==-1){d++;break}}if(s._contentTypeTextTrailing&&l===e.length&&(p=0),p){const y={type:l===e.length||m||p<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?h:c.start._bufferIndex+h,_index:c.start._index+d,line:c.end.line,column:c.end.column-p,offset:c.end.offset-p},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 A2={42:mn,43:mn,45:mn,48:mn,49:mn,50:mn,51:mn,52:mn,53:mn,54:mn,55:mn,56:mn,57:mn,62:tv},T2={91:DC},N2={[-2]:Od,[-1]:Od,32:Od},E2={35:HC,42:No,45:[Wy,No],60:GC,61:Wy,95:No,96:Ky,126:Ky},z2={38:iv,92:nv},O2={[-5]:Rd,[-4]:Rd,[-3]:Rd,33:a2,38:iv,42:dh,60:[cC,ZC],91:l2,92:[UC,nv],93:Vh,95:dh,96:jC},R2={null:[dh,j2]},D2={null:[42,95]},M2={null:[]},L2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D2,contentInitial:T2,disable:M2,document:A2,flow:E2,flowInitial:N2,insideSpan:R2,string:z2,text:O2},Symbol.toStringTag,{value:"Module"}));function _2(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 p={attempt:P(H),check:P(L),consume:z,enter:N,exit:M,interrupt:P(L,{interrupt:!0})},m={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:x};let y=s.tokenize.call(m,p);return s.resolveAll&&u.push(s),m;function x(I){return d=$n(d,I),A(),d[d.length-1]!==null?[]:(ue(s,0),m.events=tc(u,m.events,m),m.events)}function v(I,X){return B2(b(I),X)}function b(I){return U2(d,I)}function w(){const{_bufferIndex:I,_index:X,line:le,column:te,offset:F}=l;return{_bufferIndex:I,_index:X,line:le,column:te,offset:F}}function S(I){c[I.line]=I.column,$()}function A(){for(;l._index<d.length;){const I=d[l._index];if(typeof I=="string"){const X=l._index;for(l._bufferIndex<0&&(l._bufferIndex=0);l._index===X&&l._bufferIndex<I.length;)k(I.charCodeAt(l._bufferIndex))}else k(I)}}function k(I){y=y(I)}function z(I){Re(I)?(l.line++,l.column=1,l.offset+=I===-3?2:1,$()):I!==-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=I}function N(I,X){const le=X||{};return le.type=I,le.start=w(),m.events.push(["enter",le,m]),h.push(le),le}function M(I){const X=h.pop();return X.end=w(),m.events.push(["exit",X,m]),X}function H(I,X){ue(I,X.from)}function L(I,X){X.restore()}function P(I,X){return le;function le(te,F,B){let U,ee,re,O;return Array.isArray(te)?Q(te):"tokenize"in te?Q([te]):R(te);function R(ye){return Me;function Me(Xe){const de=Xe!==null&&ye[Xe],ht=Xe!==null&&ye.null,Lt=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(ht)?ht:ht?[ht]:[]];return Q(Lt)(Xe)}}function Q(ye){return U=ye,ee=0,ye.length===0?B:E(ye[ee])}function E(ye){return Me;function Me(Xe){return O=se(),re=ye,ye.partial||(m.currentConstruct=ye),ye.name&&m.parser.constructs.disable.null.includes(ye.name)?be():ye.tokenize.call(X?Object.assign(Object.create(m),X):m,p,J,be)(Xe)}}function J(ye){return I(re,O),F}function be(ye){return O.restore(),++ee<U.length?E(U[ee]):B}}}function ue(I,X){I.resolveAll&&!u.includes(I)&&u.push(I),I.resolve&&Kn(m.events,X,m.events.length-X,I.resolve(m.events.slice(X),m)),I.resolveTo&&(m.events=I.resolveTo(m.events,m))}function se(){const I=w(),X=m.previous,le=m.currentConstruct,te=m.events.length,F=Array.from(h);return{from:te,restore:B};function B(){l=I,m.previous=X,m.currentConstruct=le,m.events.length=te,h=F,$()}}function $(){l.line in c&&l.column<2&&(l.column=c[l.line],l.offset+=c[l.line]-1)}}function U2(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 B2(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=`
|
|
21
|
-
`;break}case-3:{d=`\r
|
|
22
|
-
`;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 H2(e){const l={constructs:Jb([L2,...(e||{}).extensions||[]]),content:c(nC),defined:[],document:c(sC),flow:c(v2),lazy:{},string:c(k2),text:c(S2)};return l;function c(u){return d;function d(h){return _2(l,u,h)}}}function $2(e){for(;!sv(e););return e}const ex=/[\0\t\n\r]/g;function I2(){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 p=[];let m=0;for(s="",a&&(u.charCodeAt(0)===65279&&m++,a=void 0);m<u.length;){ex.lastIndex=m;const y=ex.exec(u),x=y&&y.index!==void 0?y.index:u.length,v=u.charCodeAt(x);if(!y){s=u.slice(m);break}if(v===10&&m===x&&l)p.push(-3),l=void 0;else switch(l&&(p.push(-5),l=void 0),m<x&&(p.push(u.slice(m,x)),e+=x-m),v){case 0:{p.push(65533),e++;break}case 9:{const b=Math.ceil(e/4)*4;for(p.push(-2);e++<b;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:l=!0,e=1}m=x+1}return h&&(l&&p.push(-5),s&&p.push(s),p.push(null)),p}}const q2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function G2(e){return e.replace(q2,F2)}function F2(e,s,a){if(s)return s;if(a.charCodeAt(0)===35){const c=a.charCodeAt(1),u=c===120||c===88;return Wb(a.slice(u?2:1),u?16:10)}return Yh(a)||e}const uv={}.hasOwnProperty;function P2(e,s,a){return s&&typeof s=="object"&&(a=s,s=void 0),Y2(a)($2(H2(a).document().write(I2()(e,s,!0))))}function Y2(e){const s={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(en),autolinkProtocol:$,autolinkEmail:$,atxHeading:d(Ne),blockQuote:d(Lt),characterEscape:$,characterReference:$,codeFenced:d(Zt),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:d(Zt,h),codeText:d(Wt,h),codeTextData:$,data:$,codeFlowValue:$,definition:d(yt),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:d(Gn),hardBreakEscape:d(et),hardBreakTrailing:d(et),htmlFlow:d(Nn,h),htmlFlowData:$,htmlText:d(Nn,h),htmlTextData:$,image:d(yn),label:h,link:d(en),listItem:d(En),listItemValue:b,listOrdered:d(Fn,v),listUnordered:d(Fn),paragraph:d(Gs),reference:J,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:d(Ne),strong:d(Tt),thematicBreak:d(Ui)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:ht,autolinkProtocol:de,blockQuote:m(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:Me,characterReference:Xe,codeFenced:m(k),codeFencedFence:A,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:I,codeIndented:m(z),codeText:m(B),codeTextData:I,data:I,definition:m(),definitionDestinationString:H,definitionLabelString:N,definitionTitleString:M,emphasis:m(),hardBreakEscape:m(le),hardBreakTrailing:m(le),htmlFlow:m(te),htmlFlowData:I,htmlText:m(F),htmlTextData:I,image:m(ee),label:O,labelText:re,lineEnding:X,link:m(U),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:be,resourceDestinationString:R,resourceTitleString:Q,resource:E,setextHeading:m(se),setextHeadingLineSequence:ue,setextHeadingText:P,strong:m(),thematicBreak:m()}};dv(s,(e||{}).mdastExtensions||[]);const a={};return l;function l(W){let pe={type:"root",children:[],position:void 0};const De={stack:[pe],tokenStack:[],config:s,enter:p,exit:y,buffer:h,resume:x,data:a},Le=[],_t=[];let tt=-1;for(;++tt<W.length;)if(_t.push(W[tt]),W[tt][1].type==="listOrdered"||W[tt][1].type==="listUnordered")if(W[tt][0]==="enter")Le.push(_t.length-1);else{const st=Le.pop();u(_t,st)}for(W=_t,tt=-1;++tt<W.length;){const st=s[W[tt][0]];W[tt][0]==="enter"&&s.beforeEnter.length>0&&c(s.beforeEnter,{...De,sliceSerialize:W[tt][2].sliceSerialize},W[tt][1]),uv.call(st,W[tt][1].type)&&st[W[tt][1].type].call({...De,sliceSerialize:W[tt][2].sliceSerialize},W[tt][1]),W[tt][0]==="exit"&&s.afterExit.length>0&&c(s.afterExit,{...De,sliceSerialize:W[tt][2].sliceSerialize},W[tt][1])}if(De.tokenStack.length>0){const st=De.tokenStack[De.tokenStack.length-1];(st[1]||tx).call(De,void 0,st[0])}for(pe.position={start:os(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:os(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<s.transforms.length;)pe=s.transforms[tt](pe)||pe;return pe}function c(W,pe,De){let Le=-1;for(;++Le<W.length;)W[Le].call(pe,De)}function u(W,pe){const De=W.length-1;let Le=pe-1,_t=-1,tt=!1,st,ft,tn,St;const ui=[];for(;++Le<=De;){const Nt=W[Le];switch(Nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Nt[0]==="enter"?_t++:_t--,St=void 0;break}case"lineEndingBlank":{Nt[0]==="enter"&&(st&&!St&&!_t&&!tn&&(tn=Le),St=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:St=void 0}if(!_t&&Nt[0]==="enter"&&Nt[1].type==="listItemPrefix"||_t===-1&&Nt[0]==="exit"&&(Nt[1].type==="listUnordered"||Nt[1].type==="listOrdered")){if(st){let he=Le;for(ft=void 0;he--;){const we=W[he];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;ft&&(W[ft][1].type="lineEndingBlank",tt=!0),we[1].type="lineEnding",ft=he}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}tn&&(!ft||tn<ft)&&(st._spread=!0),st.end=Object.assign({},ft?W[ft][1].start:Nt[1].end),ui.push({at:ft||Le,event:["exit",st,Nt[2]]})}if(Nt[1].type==="listItemPrefix"){const he={type:"listItem",_spread:!1,start:Object.assign({},Nt[1].start),end:void 0};st=he,ui.push({at:Le,event:["enter",he,Nt[2]]}),tn=void 0,St=!0}}}const Ps=W.splice(pe);let fs=0;for(Le=-1;++Le<Ps.length;){for(;fs<ui.length&&ui[fs].at===pe+Le;)W.push(ui[fs++].event);W.push(Ps[Le])}W[pe][1]._spread=tt}function d(W,pe){return De;function De(Le){p.call(this,W(Le),Le),pe&&pe.call(this,Le)}}function h(){this.stack.push({type:"fragment",children:[]})}function p(W,pe,De){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([pe,De||void 0]),W.position={start:os(pe.start),end:void 0}}function m(W){return pe;function pe(De){W&&W.call(this,De),y.call(this,De)}}function y(W,pe){const De=this.stack.pop(),Le=this.tokenStack.pop();if(!Le)throw new Error("Cannot close `"+W.type+"` ("+Ir({start:W.start,end:W.end})+"): it’s not open");Le[0].type!==W.type&&(pe?pe.call(this,W,Le[0]):(Le[1]||tx).call(this,W,Le[0])),De.position.end=os(W.end)}function x(){return Ph(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function b(W){if(this.data.expectingFirstListItemValue){const pe=this.stack[this.stack.length-2];pe.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function w(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.lang=W}function S(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.meta=W}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function z(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.value=W.replace(/(\r?\n|\r)$/g,"")}function N(W){const pe=this.resume(),De=this.stack[this.stack.length-1];De.label=pe,De.identifier=Jn(this.sliceSerialize(W)).toLowerCase()}function M(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.title=W}function H(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.url=W}function L(W){const pe=this.stack[this.stack.length-1];if(!pe.depth){const De=this.sliceSerialize(W).length;pe.depth=De}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function ue(W){const pe=this.stack[this.stack.length-1];pe.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function se(){this.data.setextHeadingSlurpLineEnding=void 0}function $(W){const De=this.stack[this.stack.length-1].children;let Le=De[De.length-1];(!Le||Le.type!=="text")&&(Le=Fs(),Le.position={start:os(W.start),end:void 0},De.push(Le)),this.stack.push(Le)}function I(W){const pe=this.stack.pop();pe.value+=this.sliceSerialize(W),pe.position.end=os(W.end)}function X(W){const pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=pe.children[pe.children.length-1];De.position.end=os(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&s.canContainEols.includes(pe.type)&&($.call(this,W),I.call(this,W))}function le(){this.data.atHardBreak=!0}function te(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.value=W}function F(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.value=W}function B(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.value=W}function U(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=pe,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function ee(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=pe,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function re(W){const pe=this.sliceSerialize(W),De=this.stack[this.stack.length-2];De.label=G2(pe),De.identifier=Jn(pe).toLowerCase()}function O(){const W=this.stack[this.stack.length-1],pe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Le=W.children;De.children=Le}else De.alt=pe}function R(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.url=W}function Q(){const W=this.resume(),pe=this.stack[this.stack.length-1];pe.title=W}function E(){this.data.inReference=void 0}function J(){this.data.referenceType="collapsed"}function be(W){const pe=this.resume(),De=this.stack[this.stack.length-1];De.label=pe,De.identifier=Jn(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function ye(W){this.data.characterReferenceType=W.type}function Me(W){const pe=this.sliceSerialize(W),De=this.data.characterReferenceType;let Le;De?(Le=Wb(pe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=Yh(pe);const _t=this.stack[this.stack.length-1];_t.value+=Le}function Xe(W){const pe=this.stack.pop();pe.position.end=os(W.end)}function de(W){I.call(this,W);const pe=this.stack[this.stack.length-1];pe.url=this.sliceSerialize(W)}function ht(W){I.call(this,W);const pe=this.stack[this.stack.length-1];pe.url="mailto:"+this.sliceSerialize(W)}function Lt(){return{type:"blockquote",children:[],position:void 0}}function Zt(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Wt(){return{type:"inlineCode",value:"",position:void 0}}function yt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function Gn(){return{type:"emphasis",children:[],position:void 0}}function Ne(){return{type:"heading",depth:0,children:[],position:void 0}}function et(){return{type:"break",position:void 0}}function Nn(){return{type:"html",value:"",position:void 0}}function yn(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function en(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Fn(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[],position:void 0}}function En(W){return{type:"listItem",spread:W._spread,checked:null,children:[],position:void 0}}function Gs(){return{type:"paragraph",children:[],position:void 0}}function Tt(){return{type:"strong",children:[],position:void 0}}function Fs(){return{type:"text",value:"",position:void 0}}function Ui(){return{type:"thematicBreak",position:void 0}}}function os(e){return{line:e.line,column:e.column,offset:e.offset}}function dv(e,s){let a=-1;for(;++a<s.length;){const l=s[a];Array.isArray(l)?dv(e,l):V2(e,l)}}function V2(e,s){let a;for(a in s)if(uv.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 tx(e,s){throw e?new Error("Cannot close `"+e.type+"` ("+Ir({start:e.start,end:e.end})+"): a different token (`"+s.type+"`, "+Ir({start:s.start,end:s.end})+") is open"):new Error("Cannot close document, a token (`"+s.type+"`, "+Ir({start:s.start,end:s.end})+") is still open")}function Z2(e){const s=this;s.parser=a;function a(l){return P2(l,{...s.data("settings"),...e,extensions:s.data("micromarkExtensions")||[],mdastExtensions:s.data("fromMarkdownExtensions")||[]})}}function X2(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 Q2(e,s){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(s,a),[e.applyData(s,a),{type:"text",value:`
|
|
23
|
-
`}]}function K2(e,s){const a=s.value?s.value+`
|
|
24
|
-
`:"",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 J2(e,s){const a={type:"element",tagName:"del",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function W2(e,s){const a={type:"element",tagName:"em",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function eA(e,s){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(s.identifier).toUpperCase(),c=La(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 p={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,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(s,m),e.applyData(s,m)}function tA(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 nA(e,s){if(e.options.allowDangerousHtml){const a={type:"raw",value:s.value};return e.patch(s,a),e.applyData(s,a)}}function hv(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 iA(e,s){const a=String(s.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return hv(e,s);const c={src:La(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 sA(e,s){const a={src:La(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 aA(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 rA(e,s){const a=String(s.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return hv(e,s);const c={href:La(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 lA(e,s){const a={href:La(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 oA(e,s,a){const l=e.all(s),c=a?cA(a):fv(s),u={},d=[];if(typeof s.checked=="boolean"){const y=l[0];let x;y&&y.type==="element"&&y.tagName==="p"?x=y:(x={type:"element",tagName:"p",properties:{},children:[]},l.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.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:`
|
|
25
|
-
`}),y.type==="element"&&y.tagName==="p"&&!c?d.push(...y.children):d.push(y)}const p=l[l.length-1];p&&(c||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
|
|
26
|
-
`});const m={type:"element",tagName:"li",properties:u,children:d};return e.patch(s,m),e.applyData(s,m)}function cA(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=fv(a[l])}return s}function fv(e){const s=e.spread;return s??e.children.length>1}function uA(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 dA(e,s){const a={type:"element",tagName:"p",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function hA(e,s){const a={type:"root",children:e.wrap(e.all(s))};return e.patch(s,a),e.applyData(s,a)}function fA(e,s){const a={type:"element",tagName:"strong",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function mA(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=Ih(s.children[1]),p=Pb(s.children[s.children.length-1]);h&&p&&(d.position={start:h,end:p}),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 pA(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 p=-1;const m=[];for(;++p<h;){const x=s.children[p],v={},b=d?d[p]:void 0;b&&(v.align=b);let w={type:"element",tagName:u,properties:v,children:[]};x&&(w.children=e.all(x),e.patch(x,w),w=e.applyData(x,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 gA(e,s){const a={type:"element",tagName:"td",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}const nx=9,ix=32;function yA(e){const s=String(e),a=/\r?\n|\r/g;let l=a.exec(s),c=0;const u=[];for(;l;)u.push(sx(s.slice(c,l.index),c>0,!0),l[0]),c=l.index+l[0].length,l=a.exec(s);return u.push(sx(s.slice(c),c>0,!1)),u.join("")}function sx(e,s,a){let l=0,c=e.length;if(s){let u=e.codePointAt(l);for(;u===nx||u===ix;)l++,u=e.codePointAt(l)}if(a){let u=e.codePointAt(c-1);for(;u===nx||u===ix;)c--,u=e.codePointAt(c-1)}return c>l?e.slice(l,c):""}function xA(e,s){const a={type:"text",value:yA(String(s.value))};return e.patch(s,a),e.applyData(s,a)}function bA(e,s){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(s,a),e.applyData(s,a)}const vA={blockquote:X2,break:Q2,code:K2,delete:J2,emphasis:W2,footnoteReference:eA,heading:tA,html:nA,imageReference:iA,image:sA,inlineCode:aA,linkReference:rA,link:lA,listItem:oA,list:uA,paragraph:dA,root:hA,strong:fA,table:mA,tableCell:gA,tableRow:pA,text:xA,thematicBreak:bA,toml:bo,yaml:bo,definition:bo,footnoteDefinition:bo};function bo(){}const mv=-1,nc=0,Gr=1,Go=2,Zh=3,Xh=4,Qh=5,Kh=6,pv=7,gv=8,{defineProperty:wA}=Object,yv=typeof self=="object"?self:globalThis,ax=(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 yv[e](s)},jA=(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 nc:case mv:return a(d,c);case Gr:{const h=a([],c);for(const p of d)h.push(l(p));return h}case Go:{const h=a({},c);for(const[p,m]of d){const y=l(p),x=l(m);y==="__proto__"?wA(h,y,{value:x,configurable:!0,enumerable:!0,writable:!0}):h[y]=x}return h}case Zh:return a(new Date(d),c);case Xh:{const{source:h,flags:p}=d;return a(new RegExp(h,p),c)}case Qh:{const h=a(new Map,c);for(const[p,m]of d)h.set(l(p),l(m));return h}case Kh:{const h=a(new Set,c);for(const p of d)h.add(l(p));return h}case pv:{const{name:h,message:p}=d;return a(typeof yv[h]=="function"?ax(h,p):new Error(p),c)}case gv: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(ax(u,d),c)};return l},rx=e=>jA(new Map,e)(0),Ds="",{toString:kA}={},{keys:SA,is:CA}=Object,Dr=e=>{const s=typeof e;if(s!=="object"||!e)return[nc,s];const a=kA.call(e).slice(8,-1);switch(a){case"Array":return[Gr,Ds];case"Object":return[Go,Ds];case"Date":return[Zh,Ds];case"RegExp":return[Xh,Ds];case"Map":return[Qh,Ds];case"Set":return[Kh,Ds];case"DataView":return[Gr,a]}return a.includes("Array")?[Gr,a]:e instanceof Error?[pv,e.name||"Error"]:[Go,a]},vo=([e,s])=>e===nc&&(s==="function"||s==="symbol"),AA=(e,s,a,l)=>{const c=(d,h)=>{const p=l.push(d)-1;return a.set(h,p),p},u=d=>{if(a.has(d))return a.get(d);let[h,p]=Dr(d);switch(h){case nc:{let y=d;switch(p){case"bigint":h=gv,y=d.toString();break;case"number":if(!d&&CA(d,-0))return l.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);y=null;break;case"undefined":return c([mv],d)}return c([h,y],d)}case Gr:{if(p){let v=d;return p==="DataView"?v=new Uint8Array(d.buffer):p==="ArrayBuffer"&&(v=new Uint8Array(d)),c([p,[...v]],d)}const y=[],x=c([h,y],d);for(const v of d)y.push(u(v));return x}case Go:{if(p)switch(p){case"BigInt":return c([p,d.toString()],d);case"Boolean":case"Number":case"String":return c([p,d.valueOf()],d)}if(s&&"toJSON"in d)return u(d.toJSON());const y=[],x=c([h,y],d);for(const v of SA(d))(e||!vo(Dr(d[v])))&&y.push([u(v),u(d[v])]);return x}case Zh:return c([h,isNaN(d.getTime())?Ds:d.toISOString()],d);case Xh:{const{source:y,flags:x}=d;return c([h,{source:y,flags:x}],d)}case Qh:{const y=[],x=c([h,y],d);for(const[v,b]of d)(e||!(vo(Dr(v))||vo(Dr(b))))&&y.push([u(v),u(b)]);return x}case Kh:{const y=[],x=c([h,y],d);for(const v of d)(e||!vo(Dr(v)))&&y.push(u(v));return x}}const{message:m}=d;return c([h,{name:p,message:m}],d)};return u},lx=(e,{json:s,lossy:a}={})=>{const l=[];return AA(!(s||a),!!s,new Map,l)(e),l},Fo=typeof structuredClone=="function"?(e,s)=>s&&("json"in s||"lossy"in s)?rx(lx(e,s)):structuredClone(e):(e,s)=>rx(lx(e,s));function TA(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 NA(e,s){return"Back to reference "+(e+1)+(s>1?"-"+s:"")}function EA(e){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||TA,l=e.options.footnoteBackLabel||NA,c=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const y=e.all(m),x=String(m.identifier).toUpperCase(),v=La(x.toLowerCase());let b=0;const w=[],S=e.footnoteCounts.get(x);for(;S!==void 0&&++b<=S;){w.length>0&&w.push({type:"text",value:" "});let z=typeof a=="string"?a:a(p,b);typeof z=="string"&&(z={type:"text",value:z}),w.push({type:"element",tagName:"a",properties:{href:"#"+s+"fnref-"+v+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(p,b),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const A=y[y.length-1];if(A&&A.type==="element"&&A.tagName==="p"){const z=A.children[A.children.length-1];z&&z.type==="text"?z.value+=" ":A.children.push({type:"text",value:" "}),A.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:{...Fo(d),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
27
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
28
|
-
`}]}}const ic=(function(e){if(e==null)return DA;if(typeof e=="function")return sc(e);if(typeof e=="object")return Array.isArray(e)?zA(e):OA(e);if(typeof e=="string")return RA(e);throw new Error("Expected function, string, or object as test")});function zA(e){const s=[];let a=-1;for(;++a<e.length;)s[a]=ic(e[a]);return sc(l);function l(...c){let u=-1;for(;++u<s.length;)if(s[u].apply(this,c))return!0;return!1}}function OA(e){const s=e;return sc(a);function a(l){const c=l;let u;for(u in e)if(c[u]!==s[u])return!1;return!0}}function RA(e){return sc(s);function s(a){return a&&a.type===e}}function sc(e){return s;function s(a,l,c){return!!(MA(a)&&e.call(this,a,typeof l=="number"?l:void 0,c||void 0))}}function DA(){return!0}function MA(e){return e!==null&&typeof e=="object"&&"type"in e}const xv=[],LA=!0,fh=!1,_A="skip";function bv(e,s,a,l){let c;typeof s=="function"&&typeof a!="function"?(l=a,a=s):c=s;const u=ic(c),d=l?-1:1;h(e,void 0,[])();function h(p,m,y){const x=p&&typeof p=="object"?p:{};if(typeof x.type=="string"){const b=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return v;function v(){let b=xv,w,S,A;if((!s||u(p,m,y[y.length-1]||void 0))&&(b=UA(a(p,y)),b[0]===fh))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==_A)for(S=(l?k.children.length:-1)+d,A=y.concat(k);S>-1&&S<k.children.length;){const z=k.children[S];if(w=h(z,S,A)(),w[0]===fh)return w;S=typeof w[1]=="number"?w[1]:S+d}}return b}}}function UA(e){return Array.isArray(e)?e:typeof e=="number"?[LA,e]:e==null?xv:[e]}function Jh(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),bv(e,u,h,c);function h(p,m){const y=m[m.length-1],x=y?y.children.indexOf(p):void 0;return d(p,x,y)}}const mh={}.hasOwnProperty,BA={};function HA(e,s){const a=s||BA,l=new Map,c=new Map,u=new Map,d={...vA,...a.handlers},h={all:m,applyData:IA,definitionById:l,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:d,one:p,options:a,patch:$A,wrap:GA};return Jh(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const x=y.type==="definition"?l:c,v=String(y.identifier).toUpperCase();x.has(v)||x.set(v,y)}}),h;function p(y,x){const v=y.type,b=h.handlers[v];if(mh.call(h.handlers,v)&&b)return b(h,y,x);if(h.options.passThrough&&h.options.passThrough.includes(v)){if("children"in y){const{children:S,...A}=y,k=Fo(A);return k.children=h.all(y),k}return Fo(y)}return(h.options.unknownHandler||qA)(h,y,x)}function m(y){const x=[];if("children"in y){const v=y.children;let b=-1;for(;++b<v.length;){const w=h.one(v[b],y);if(w){if(b&&v[b-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=ox(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=ox(S.value))}Array.isArray(w)?x.push(...w):x.push(w)}}}return x}}function $A(e,s){e.position&&(s.position=NS(e))}function IA(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,Fo(u)),"children"in a&&a.children&&c!==null&&c!==void 0&&(a.children=c)}return a}function qA(e,s){const a=s.data||{},l="value"in s&&!(mh.call(a,"hProperties")||mh.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 GA(e,s){const a=[];let l=-1;for(s&&a.push({type:"text",value:`
|
|
29
|
-
`});++l<e.length;)l&&a.push({type:"text",value:`
|
|
30
|
-
`}),a.push(e[l]);return s&&e.length>0&&a.push({type:"text",value:`
|
|
31
|
-
`}),a}function ox(e){let s=0,a=e.charCodeAt(s);for(;a===9||a===32;)s++,a=e.charCodeAt(s);return e.slice(s)}function cx(e,s){const a=HA(e,s),l=a.one(e,void 0),c=EA(a),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
32
|
-
`},c),u}function FA(e,s){return e&&"run"in e?async function(a,l){const c=cx(a,{file:l,...s});await e.run(c,l)}:function(a,l){return cx(a,{file:l,...e||s})}}function ux(e){if(e)throw e}var Dd,dx;function PA(){if(dx)return Dd;dx=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"),x=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!x)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 Dd=function p(){var m,y,x,v,b,w,S=arguments[0],A=1,k=arguments.length,z=!1;for(typeof S=="boolean"&&(z=S,S=arguments[1]||{},A=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});A<k;++A)if(m=arguments[A],m!=null)for(y in m)x=h(S,y),v=h(m,y),S!==v&&(z&&v&&(u(v)||(b=c(v)))?(b?(b=!1,w=x&&c(x)?x:[]):w=x&&u(x)?x:{},d(S,{name:y,newValue:p(z,w,v)})):typeof v<"u"&&d(S,{name:y,newValue:v}));return S},Dd}var YA=PA();const Md=ib(YA);function ph(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 VA(){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(p,...m){const y=e[++u];let x=-1;if(p){d(p);return}for(;++x<c.length;)(m[x]===null||m[x]===void 0)&&(m[x]=c[x]);c=m,y?ZA(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 ZA(e,s){let a;return l;function l(...d){const h=e.length>d.length;let p;h&&d.push(c);try{p=e.apply(this,d)}catch(m){const y=m;if(h&&a)throw y;return c(y)}h||(p&&p.then&&typeof p.then=="function"?p.then(u,c):p instanceof Error?c(p):u(p))}function c(d,...h){a||(a=!0,s(d,...h))}function u(d){c(null,d)}}const ai={basename:XA,dirname:QA,extname:KA,join:JA,sep:"/"};function XA(e,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');el(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 QA(e){if(el(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 KA(e){el(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 JA(...e){let s=-1,a;for(;++s<e.length;)el(e[s]),e[s]&&(a=a===void 0?e[s]:a+"/"+e[s]);return a===void 0?".":WA(a)}function WA(e){el(e);const s=e.codePointAt(0)===47;let a=eT(e,!s);return a.length===0&&!s&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),s?"/"+a:a}function eT(e,s){let a="",l=0,c=-1,u=0,d=-1,h,p;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(p=a.lastIndexOf("/"),p!==a.length-1){p<0?(a="",l=0):(a=a.slice(0,p),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 el(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const tT={cwd:nT};function nT(){return"/"}function gh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function iT(e){if(typeof e=="string")e=new URL(e);else if(!gh(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 sT(e)}function sT(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 Ld=["history","path","basename","stem","extname","dirname"];class vv{constructor(s){let a;s?gh(s)?a={path:s}:typeof s=="string"||aT(s)?a={value:s}:a=s:a={},this.cwd="cwd"in a?"":tT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Ld.length;){const u=Ld[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)Ld.includes(c)||(this[c]=a[c])}get basename(){return typeof this.path=="string"?ai.basename(this.path):void 0}set basename(s){Ud(s,"basename"),_d(s,"basename"),this.path=ai.join(this.dirname||"",s)}get dirname(){return typeof this.path=="string"?ai.dirname(this.path):void 0}set dirname(s){hx(this.basename,"dirname"),this.path=ai.join(s||"",this.basename)}get extname(){return typeof this.path=="string"?ai.extname(this.path):void 0}set extname(s){if(_d(s,"extname"),hx(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=ai.join(this.dirname,this.stem+(s||""))}get path(){return this.history[this.history.length-1]}set path(s){gh(s)&&(s=iT(s)),Ud(s,"path"),this.path!==s&&this.history.push(s)}get stem(){return typeof this.path=="string"?ai.basename(this.path,this.extname):void 0}set stem(s){Ud(s,"stem"),_d(s,"stem"),this.path=ai.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 _d(e,s){if(e&&e.includes(ai.sep))throw new Error("`"+s+"` cannot be a path: did not expect `"+ai.sep+"`")}function Ud(e,s){if(!e)throw new Error("`"+s+"` cannot be empty")}function hx(e,s){if(!e)throw new Error("Setting `"+s+"` requires `path` to be set too")}function aT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rT=(function(e){const l=this.constructor.prototype,c=l[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),lT={}.hasOwnProperty;class Wh extends rT{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=VA()}copy(){const s=new Wh;let a=-1;for(;++a<this.attachers.length;){const l=this.attachers[a];s.use(...l)}return s.data(Md(!0,{},this.namespace)),s}data(s,a){return typeof s=="string"?arguments.length===2?($d("data",this.frozen),this.namespace[s]=a,this):lT.call(this.namespace,s)&&this.namespace[s]||void 0:s?($d("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=wo(s),l=this.parser||this.Parser;return Bd("parse",l),l(String(a),a)}process(s,a){const l=this;return this.freeze(),Bd("process",this.parser||this.Parser),Hd("process",this.compiler||this.Compiler),a?c(void 0,a):new Promise(c);function c(u,d){const h=wo(s),p=l.parse(h);l.run(p,h,function(y,x,v){if(y||!x||!v)return m(y);const b=x,w=l.stringify(b,v);uT(w)?v.value=w:v.result=w,m(y,v)});function m(y,x){y||!x?d(y):u?u(x):a(void 0,x)}}}processSync(s){let a=!1,l;return this.freeze(),Bd("processSync",this.parser||this.Parser),Hd("processSync",this.compiler||this.Compiler),this.process(s,c),mx("processSync","process",a),l;function c(u,d){a=!0,ux(u),l=d}}run(s,a,l){fx(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 p=wo(a);c.run(s,p,m);function m(y,x,v){const b=x||s;y?h(y):d?d(b):l(void 0,b,v)}}}runSync(s,a){let l=!1,c;return this.run(s,a,u),mx("runSync","run",l),c;function u(d,h){ux(d),c=h,l=!0}}stringify(s,a){this.freeze();const l=wo(a),c=this.compiler||this.Compiler;return Hd("stringify",c),fx(s),c(s,l)}use(s,...a){const l=this.attachers,c=this.namespace;if($d("use",this.frozen),s!=null)if(typeof s=="function")p(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")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...x]=m;p(y,x)}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=Md(!0,c.settings,m.settings))}function h(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const x=m[y];u(x)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,y){let x=-1,v=-1;for(;++x<l.length;)if(l[x][0]===m){v=x;break}if(v===-1)l.push([m,...y]);else if(y.length>0){let[b,...w]=y;const S=l[v][1];ph(S)&&ph(b)&&(b=Md(!0,S,b)),l[v]=[m,b,...w]}}}}const oT=new Wh().freeze();function Bd(e,s){if(typeof s!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Hd(e,s){if(typeof s!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $d(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 fx(e){if(!ph(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function mx(e,s,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+s+"` instead")}function wo(e){return cT(e)?e:new vv(e)}function cT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function uT(e){return typeof e=="string"||dT(e)}function dT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",px=[],gx={allowDangerousHtml:!0},fT=/^(https?|ircs?|mailto|xmpp)$/i,mT=[{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 pT(e){const s=gT(e),a=yT(e);return xT(s.runSync(s.parse(a),a),e)}function gT(e){const s=e.rehypePlugins||px,a=e.remarkPlugins||px,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...gx}:gx;return oT().use(Z2).use(a).use(FA,l).use(s)}function yT(e){const s=e.children||"",a=new vv;return typeof s=="string"&&(a.value=s),a}function xT(e,s){const a=s.allowedElements,l=s.allowElement,c=s.components,u=s.disallowedElements,d=s.skipHtml,h=s.unwrapDisallowed,p=s.urlTransform||bT;for(const y of mT)Object.hasOwn(s,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+hT+y.id,void 0);return Jh(e,m),DS(e,{Fragment:i.Fragment,components:c,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function m(y,x,v){if(y.type==="raw"&&v&&typeof x=="number")return d?v.children.splice(x,1):v.children[x]={type:"text",value:y.value},x;if(y.type==="element"){let b;for(b in zd)if(Object.hasOwn(zd,b)&&Object.hasOwn(y.properties,b)){const w=y.properties[b],S=zd[b];(S===null||S.includes(y.tagName))&&(y.properties[b]=p(String(w||""),b,y))}}if(y.type==="element"){let b=a?!a.includes(y.tagName):u?u.includes(y.tagName):!1;if(!b&&l&&typeof x=="number"&&(b=!l(y,x,v)),b&&v&&typeof x=="number")return h&&y.children?v.children.splice(x,1,...y.children):v.children.splice(x,1),x}}}function bT(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||fT.test(e.slice(0,s))?e:""}function vT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wv(e,s,a){const c=ic((a||{}).ignore||[]),u=wT(s);let d=-1;for(;++d<u.length;)bv(e,"text",h);function h(m,y){let x=-1,v;for(;++x<y.length;){const b=y[x],w=v?v.children:void 0;if(c(b,w?w.indexOf(b):void 0,v))return;v=b}if(v)return p(m,y)}function p(m,y){const x=y[y.length-1],v=u[d][0],b=u[d][1];let w=0;const A=x.children.indexOf(m);let k=!1,z=[];v.lastIndex=0;let N=v.exec(m.value);for(;N;){const H=N.index,L={index:N.index,input:N.input,stack:[...y,m]};let P=b(...N,L);if(typeof P=="string"&&(P=P.length>0?{type:"text",value:P}:void 0),P===!1)v.lastIndex=H+1;else{if(w!==H&&M({type:"text",value:m.value.slice(w,H)}),Array.isArray(P))for(const ue of P)M(ue);else P&&M(P);w=H+N[0].length,k=!0}if(!v.global)break;N=v.exec(m.value)}return k?(w<m.value.length&&M({type:"text",value:m.value.slice(w)}),x.children.splice(A,1,...z)):z=[m],A+z.length;function M(H){const L=z[z.length-1];L&&L.type==="text"&&H.type==="text"?L.value+=H.value:z.push(H)}}}function wT(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([jT(c[0]),kT(c[1])])}return s}function jT(e){return typeof e=="string"?new RegExp(vT(e),"g"):e}function kT(e){return typeof e=="function"?e:function(){return e}}function ST(e){wv(e,[/\r?\n|\r/g,CT])}function CT(){return{type:"break"}}function AT(){return function(e){ST(e)}}function yx(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 Id="phrasing",qd=["autolink","link","image","label"];function TT(){return{transforms:[MT],enter:{literalAutolink:ET,literalAutolinkEmail:Gd,literalAutolinkHttp:Gd,literalAutolinkWww:Gd},exit:{literalAutolink:DT,literalAutolinkEmail:RT,literalAutolinkHttp:zT,literalAutolinkWww:OT}}}function NT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Id,notInConstruct:qd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Id,notInConstruct:qd},{character:":",before:"[ps]",after:"\\/",inConstruct:Id,notInConstruct:qd}]}}function ET(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Gd(e){this.config.enter.autolinkProtocol.call(this,e)}function zT(e){this.config.exit.autolinkProtocol.call(this,e)}function OT(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 RT(e){this.config.exit.autolinkEmail.call(this,e)}function DT(e){this.exit(e)}function MT(e){wv(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),_T]],{ignore:["link","linkReference"]})}function LT(e,s,a,l,c){let u="";if(!jv(c)||(/^w/i.test(s)&&(a=s+a,s="",u="http://"),!UT(a)))return!1;const d=BT(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 _T(e,s,a,l){return!jv(l,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+s+"@"+a,children:[{type:"text",value:s+"@"+a}]}}function UT(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 BT(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=yx(e,"(");let u=yx(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 jv(e,s){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Hs(a)||ec(a))&&(!s||a!==47)}kv.peek=VT;function HT(){this.buffer()}function $T(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function IT(){this.buffer()}function qT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function GT(e){const s=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),a.label=s}function FT(e){this.exit(e)}function PT(e){const s=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),a.label=s}function YT(e){this.exit(e)}function VT(){return"["}function kv(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 ZT(){return{enter:{gfmFootnoteCallString:HT,gfmFootnoteCall:$T,gfmFootnoteDefinitionLabelString:IT,gfmFootnoteDefinition:qT},exit:{gfmFootnoteCallString:GT,gfmFootnoteCall:FT,gfmFootnoteDefinitionLabelString:PT,gfmFootnoteDefinition:YT}}}function XT(e){let s=!1;return e&&e.firstLineBlank&&(s=!0),{handlers:{footnoteDefinition:a,footnoteReference:kv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(l,c,u,d){const h=u.createTracker(d);let p=h.move("[^");const m=u.enter("footnoteDefinition"),y=u.enter("label");return p+=h.move(u.safe(u.associationId(l),{before:p,after:"]"})),y(),p+=h.move("]:"),l.children&&l.children.length>0&&(h.shift(4),p+=h.move((s?`
|
|
33
|
-
`:" ")+u.indentLines(u.containerFlow(l,h.current()),s?Sv:QT))),m(),p}}function QT(e,s,a){return s===0?e:Sv(e,s,a)}function Sv(e,s,a){return(a?"":" ")+e}const KT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ef.attention=nN;ef.peek=iN;function JT(){return{canContainEols:["delete"],enter:{strikethrough:eN},exit:{strikethrough:tN}}}function WT(){return{handlers:{delete:ef},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KT}]}}function eN(e){this.enter({type:"delete",children:[],position:void 0},e)}function tN(e){this.exit(e)}function ef(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 nN(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function iN(){return"~"}function sN(e){return e.length}function aN(e,s){const a=s||{},l=(a.align||[]).concat(),c=a.stringLength||sN,u=[],d=[],h=[],p=[];let m=0,y=-1;for(;++y<e.length;){const S=[],A=[];let k=-1;for(e[y].length>m&&(m=e[y].length);++k<e[y].length;){const z=rN(e[y][k]);if(a.alignDelimiters!==!1){const N=c(z);A[k]=N,(p[k]===void 0||N>p[k])&&(p[k]=N)}S.push(z)}d[y]=S,h[y]=A}let x=-1;if(typeof l=="object"&&"length"in l)for(;++x<m;)u[x]=xx(l[x]);else{const S=xx(l);for(;++x<m;)u[x]=S}x=-1;const v=[],b=[];for(;++x<m;){const S=u[x];let A="",k="";S===99?(A=":",k=":"):S===108?A=":":S===114&&(k=":");let z=a.alignDelimiters===!1?1:Math.max(1,p[x]-A.length-k.length);const N=A+"-".repeat(z)+k;a.alignDelimiters!==!1&&(z=A.length+z+k.length,z>p[x]&&(p[x]=z),b[x]=z),v[x]=N}d.splice(1,0,v),h.splice(1,0,b),y=-1;const w=[];for(;++y<d.length;){const S=d[y],A=h[y];x=-1;const k=[];for(;++x<m;){const z=S[x]||"";let N="",M="";if(a.alignDelimiters!==!1){const H=p[x]-(A[x]||0),L=u[x];L===114?N=" ".repeat(H):L===99?H%2?(N=" ".repeat(H/2+.5),M=" ".repeat(H/2-.5)):(N=" ".repeat(H/2),M=N):M=" ".repeat(H)}a.delimiterStart!==!1&&!x&&k.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&z==="")&&(a.delimiterStart!==!1||x)&&k.push(" "),a.alignDelimiters!==!1&&k.push(N),k.push(z),a.alignDelimiters!==!1&&k.push(M),a.padding!==!1&&k.push(" "),(a.delimiterEnd!==!1||x!==m-1)&&k.push("|")}w.push(a.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
|
|
34
|
-
`)}function rN(e){return e==null?"":String(e)}function xx(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 lN=ic(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function oN(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()),cN);return c(),d}function cN(e,s,a){return">"+(a?"":" ")+e}function uN(e,s){return bx(e,s.inConstruct,!0)&&!bx(e,s.notInConstruct,!1)}function bx(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 vx(e,s,a,l){let c=-1;for(;++c<a.unsafe.length;){const u=a.unsafe[c];if(u.character===`
|
|
35
|
-
`&&!u.before&&!u.after&&uN(a.stack,u))return/[\t ]/.test(l.before)?"":" "}return`\\
|
|
36
|
-
`}function dN(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 hN(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 fN(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 mN(e,s,a,l){const c=fN(a),u=e.value||"";if(hN(e,a)){const x=a.enter("codeIndented"),v=a.indentLines(u,pN);return x(),v}const d=a.createTracker(l),h=c.repeat(Math.max(dN(u,c)+1,3)),p=a.enter("codeFenced"),m=c==="`"?"GraveAccent":"Tilde";let y=d.move(h);if(e.lang){const x=a.enter(`codeFencedLang${m}`);y+=d.move(a.safe(e.lang,{before:y,after:" ",encode:["`"],...d.current()})),x()}if(e.lang&&e.meta){const x=a.enter(`codeFencedMeta${m}`);y+=d.move(" "),y+=d.move(a.safe(e.meta,{before:y,after:`
|
|
37
|
-
`,encode:["`"],...d.current()})),x()}return y+=d.move(`
|
|
38
|
-
`),u&&(y+=d.move(u+`
|
|
39
|
-
`)),y+=d.move(h),p(),y}function pN(e,s,a){return(a?"":" ")+e}function tf(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 gN(e,s,a,l){const c=tf(a),u=c==='"'?"Quote":"Apostrophe",d=a.enter("definition");let h=a.enter("label");const p=a.createTracker(l);let m=p.move("[");return m+=p.move(a.safe(a.associationId(e),{before:m,after:"]",...p.current()})),m+=p.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(a.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(h=a.enter("destinationRaw"),m+=p.move(a.safe(e.url,{before:m,after:e.title?" ":`
|
|
40
|
-
`,...p.current()}))),h(),e.title&&(h=a.enter(`title${u}`),m+=p.move(" "+c),m+=p.move(a.safe(e.title,{before:m,after:c,...p.current()})),m+=p.move(c),h()),d(),m}function yN(e){const s=e.options.emphasis||"*";if(s!=="*"&&s!=="_")throw new Error("Cannot serialize emphasis with `"+s+"` for `options.emphasis`, expected `*`, or `_`");return s}nf.attention=xN;nf.peek=bN;function nf(e,s,a,l){const c=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},l);return c(),u}function xN(e,s){return{construct:"emphasis",markers:yN(s)==="*"?["*","_"]:["_","*"],sizes:[1]}}function bN(e,s,a){return a.options.emphasis||"*"}function vN(e){return"&#x"+e.toString(16).toUpperCase()+";"}function wN(e,s){let a=!1;return Jh(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return a=!0,fh}),!!((!e.depth||e.depth<3)&&Ph(e)&&(s.options.setext||a))}function jN(e,s,a,l){const c=Math.max(Math.min(6,e.depth||1),1),u=a.createTracker(l);if(wN(e,a)){const x=a.enter("headingSetext"),v=a.enter("phrasing"),b=a.containerPhrasing(e,{...u.current(),before:`
|
|
41
|
-
`,after:`
|
|
42
|
-
`});return v(),x(),b+`
|
|
43
|
-
`+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
44
|
-
`))+1))}const d="#".repeat(c),h=a.enter("headingAtx"),p=a.enter("phrasing");u.move(d+" ");let m=a.containerPhrasing(e,{before:"# ",after:`
|
|
45
|
-
`,...u.current()});const y=m.charCodeAt(0);return(y===9||y===32)&&(m=vN(y)+m.slice(1)),m=m?d+" "+m:d,a.options.closeAtx&&(m+=" "+d),p(),h(),m}Cv.peek=kN;function Cv(e){return e.value||""}function kN(){return"<"}Av.peek=SN;function Av(e,s,a,l){const c=tf(a),u=c==='"'?"Quote":"Apostrophe",d=a.enter("image");let h=a.enter("label");const p=a.createTracker(l);let m=p.move("![");return m+=p.move(a.safe(e.alt,{before:m,after:"]",...p.current()})),m+=p.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(a.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(h=a.enter("destinationRaw"),m+=p.move(a.safe(e.url,{before:m,after:e.title?" ":")",...p.current()}))),h(),e.title&&(h=a.enter(`title${u}`),m+=p.move(" "+c),m+=p.move(a.safe(e.title,{before:m,after:c,...p.current()})),m+=p.move(c),h()),m+=p.move(")"),d(),m}function SN(){return"!"}Tv.peek=CN;function Tv(e,s,a,l){const c=e.referenceType,u=a.enter("imageReference");let d=a.enter("label");const h=a.createTracker(l);let p=h.move("![");const m=a.safe(e.alt,{before:p,after:"]",...h.current()});p+=h.move(m+"]["),d();const y=a.stack;a.stack=y.filter(function(v){return v!=="phrasing"}),d=a.enter("reference");const x=a.safe(a.associationId(e),{before:p,after:"]",...h.current()});return d(),a.stack=y,u(),c==="full"||!m||m!==x?p+=h.move(x+"]"):c==="shortcut"?p=p.slice(0,-1):p+=h.move("]"),p}function CN(){return"!"}Nv.peek=AN;function Nv(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 p;for(;p=h.exec(l);){let m=p.index;l.charCodeAt(m)===10&&l.charCodeAt(m-1)===13&&m--,l=l.slice(0,m)+" "+l.slice(p.index+1)}}return c+l+c}function AN(){return"`"}function Ev(e,s){const a=Ph(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))}zv.peek=TN;function zv(e,s,a,l){const c=tf(a),u=c==='"'?"Quote":"Apostrophe",d=a.createTracker(l);if(Ev(e,a)){const y=a.stack;a.stack=y.filter(function(b){return b!=="phrasing"});const x=a.enter("autolink");let v=d.move("<");return v+=d.move(a.containerPhrasing(e,{before:v,after:">",...d.current()})),v+=d.move(">"),x(),a.stack=y,v}const h=a.enter("link");let p=a.enter("label"),m=d.move("[");return m+=d.move(a.containerPhrasing(e,{before:m,after:"](",...d.current()})),m+=d.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=a.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(a.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(p=a.enter("destinationRaw"),m+=d.move(a.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),p(),e.title&&(p=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),p()),m+=d.move(")"),h(),m}function TN(e,s,a){return Ev(e,a)?"<":"["}Ov.peek=NN;function Ov(e,s,a,l){const c=e.referenceType,u=a.enter("linkReference");let d=a.enter("label");const h=a.createTracker(l);let p=h.move("[");const m=a.containerPhrasing(e,{before:p,after:"]",...h.current()});p+=h.move(m+"]["),d();const y=a.stack;a.stack=y.filter(function(v){return v!=="phrasing"}),d=a.enter("reference");const x=a.safe(a.associationId(e),{before:p,after:"]",...h.current()});return d(),a.stack=y,u(),c==="full"||!m||m!==x?p+=h.move(x+"]"):c==="shortcut"?p=p.slice(0,-1):p+=h.move("]"),p}function NN(){return"["}function sf(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 EN(e){const s=sf(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 zN(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 Rv(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 ON(e,s,a,l){const c=a.enter("list"),u=a.bulletCurrent;let d=e.ordered?zN(a):sf(a);const h=e.ordered?d==="."?")":".":EN(a);let p=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&&(p=!0),Rv(a)===d&&y){let x=-1;for(;++x<e.children.length;){const v=e.children[x];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(d=h),a.bulletCurrent=d;const m=a.containerFlow(e,l);return a.bulletLastUsed=d,a.bulletCurrent=u,c(),m}function RN(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 DN(e,s,a,l){const c=RN(a);let u=a.bulletCurrent||sf(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 p=a.enter("listItem"),m=a.indentLines(a.containerFlow(e,h.current()),y);return p(),m;function y(x,v,b){return v?(b?"":" ".repeat(d))+x:(b?u:u+" ".repeat(d-u.length))+x}}function MN(e,s,a,l){const c=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(e,l);return u(),c(),d}function LN(e,s,a,l){if(!e.children.some(function(h){return lN(h)}))return a.containerFlow(e,l);const u=a.enter("phrasing"),d=a.containerPhrasing(e,l);return u(),d}function _N(e){const s=e.options.strong||"*";if(s!=="*"&&s!=="_")throw new Error("Cannot serialize strong with `"+s+"` for `options.strong`, expected `*`, or `_`");return s}af.attention=UN;af.peek=BN;function af(e,s,a,l){const c=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},l);return c(),u}function UN(e,s){return{construct:"strong",markers:_N(s)==="*"?["*","_"]:["_","*"],sizes:[2]}}function BN(e,s,a){return a.options.strong||"*"}function HN(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 $N(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 IN(e,s,a){const l=(Rv(a)+(a.options.ruleSpaces?" ":"")).repeat($N(a));return a.options.ruleSpaces?l.slice(0,-1):l}const Dv={blockquote:oN,break:vx,code:mN,definition:gN,emphasis:nf,hardBreak:vx,heading:jN,html:Cv,image:Av,imageReference:Tv,inlineCode:Nv,link:zv,linkReference:Ov,list:ON,listItem:DN,paragraph:MN,root:LN,strong:af,text:HN,thematicBreak:IN};function qN(){return{enter:{table:GN,tableData:wx,tableHeader:wx,tableRow:PN},exit:{codeText:YN,table:FN,tableData:Fd,tableHeader:Fd,tableRow:Fd}}}function GN(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 FN(e){this.exit(e),this.data.inTable=void 0}function PN(e){this.enter({type:"tableRow",children:[]},e)}function Fd(e){this.exit(e)}function wx(e){this.enter({type:"tableCell",children:[]},e)}function YN(e){let s=this.resume();this.data.inTable&&(s=s.replace(/\\([\\|])/g,VN));const a=this.stack[this.stack.length-1];a.type,a.value=s,this.exit(e)}function VN(e,s){return s==="|"?s:e}function ZN(e){const s=e||{},a=s.tableCellPadding,l=s.tablePipeAlign,c=s.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
46
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:d,tableCell:p,tableRow:h}};function d(b,w,S,A){return m(y(b,S,A),b.align)}function h(b,w,S,A){const k=x(b,S,A),z=m([k]);return z.slice(0,z.indexOf(`
|
|
47
|
-
`))}function p(b,w,S,A){const k=S.enter("tableCell"),z=S.enter("phrasing"),N=S.containerPhrasing(b,{...A,before:u,after:u});return z(),k(),N}function m(b,w){return aN(b,{align:w,alignDelimiters:l,padding:a,stringLength:c})}function y(b,w,S){const A=b.children;let k=-1;const z=[],N=w.enter("table");for(;++k<A.length;)z[k]=x(A[k],w,S);return N(),z}function x(b,w,S){const A=b.children;let k=-1;const z=[],N=w.enter("tableRow");for(;++k<A.length;)z[k]=p(A[k],b,w,S);return N(),z}function v(b,w,S){let A=Dv.inlineCode(b,w,S);return S.stack.includes("tableCell")&&(A=A.replace(/\|/g,"\\$&")),A}}function XN(){return{exit:{taskListCheckValueChecked:jx,taskListCheckValueUnchecked:jx,paragraph:KN}}}function QN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:JN}}}function jx(e){const s=this.stack[this.stack.length-2];s.type,s.checked=e.type==="taskListCheckValueChecked"}function KN(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 JN(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 p=Dv.listItem(e,s,a,{...l,...h.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),p;function m(y){return y+d}}function WN(){return[TT(),ZT(),JT(),qN(),XN()]}function eE(e){return{extensions:[NT(),XT(e),WT(),ZN(e),QN()]}}const tE={tokenize:lE,partial:!0},Mv={tokenize:oE,partial:!0},Lv={tokenize:cE,partial:!0},_v={tokenize:uE,partial:!0},nE={tokenize:dE,partial:!0},Uv={name:"wwwAutolink",tokenize:aE,previous:Hv},Bv={name:"protocolAutolink",tokenize:rE,previous:$v},_i={name:"emailAutolink",tokenize:sE,previous:Iv},ci={};function iE(){return{text:ci}}let Os=48;for(;Os<123;)ci[Os]=_i,Os++,Os===58?Os=65:Os===91&&(Os=97);ci[43]=_i;ci[45]=_i;ci[46]=_i;ci[95]=_i;ci[72]=[_i,Bv];ci[104]=[_i,Bv];ci[87]=[_i,Uv];ci[119]=[_i,Uv];function sE(e,s,a){const l=this;let c,u;return d;function d(x){return!yh(x)||!Iv.call(l,l.previous)||rf(l.events)?a(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(x))}function h(x){return yh(x)?(e.consume(x),h):x===64?(e.consume(x),p):a(x)}function p(x){return x===46?e.check(nE,y,m)(x):x===45||x===95||Qt(x)?(u=!0,e.consume(x),p):y(x)}function m(x){return e.consume(x),c=!0,p}function y(x){return u&&c&&sn(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),s(x)):a(x)}}function aE(e,s,a){const l=this;return c;function c(d){return d!==87&&d!==119||!Hv.call(l,l.previous)||rf(l.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(tE,e.attempt(Mv,e.attempt(Lv,u),a),a)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),s(d)}}function rE(e,s,a){const l=this;let c="",u=!1;return d;function d(x){return(x===72||x===104)&&$v.call(l,l.previous)&&!rf(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(x),e.consume(x),h):a(x)}function h(x){if(sn(x)&&c.length<5)return c+=String.fromCodePoint(x),e.consume(x),h;if(x===58){const v=c.toLowerCase();if(v==="http"||v==="https")return e.consume(x),p}return a(x)}function p(x){return x===47?(e.consume(x),u?m:(u=!0,p)):a(x)}function m(x){return x===null||$o(x)||dt(x)||Hs(x)||ec(x)?a(x):e.attempt(Mv,e.attempt(Lv,y),a)(x)}function y(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),s(x)}}function lE(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 oE(e,s,a){let l,c,u;return d;function d(m){return m===46||m===95?e.check(_v,p,h)(m):m===null||dt(m)||Hs(m)||m!==45&&ec(m)?p(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 p(m){return c||l||!u?a(m):s(m)}}function cE(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(_v,s,u)(d):d===null||dt(d)||Hs(d)?s(d):(e.consume(d),c)}function u(d){return d===41&&l++,e.consume(d),c}}function uE(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||dt(h)||Hs(h)?s(h):a(h)}function c(h){return h===null||h===40||h===91||dt(h)||Hs(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 dE(e,s,a){return l;function l(u){return e.consume(u),c}function c(u){return Qt(u)?a(u):s(u)}}function Hv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dt(e)}function $v(e){return!sn(e)}function Iv(e){return!(e===47||yh(e))}function yh(e){return e===43||e===45||e===46||e===95||Qt(e)}function rf(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 hE={tokenize:vE,partial:!0};function fE(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:yE,continuation:{tokenize:xE},exit:bE}},text:{91:{name:"gfmFootnoteCall",tokenize:gE},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:mE,resolveTo:pE}}}}function mE(e,s,a){const l=this;let c=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;c--;){const p=l.events[c][1];if(p.type==="labelImage"){d=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return h;function h(p){if(!d||!d._balanced)return a(p);const m=Jn(l.sliceSerialize({start:d.end,end:l.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?a(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),s(p))}}function pE(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 gE(e,s,a){const l=this,c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=0,d;return h;function h(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),p}function p(x){return x!==94?a(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(x){if(u>999||x===93&&!d||x===null||x===91||dt(x))return a(x);if(x===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return c.includes(Jn(l.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),s):a(x)}return dt(x)||(d=!0),u++,e.consume(x),x===92?y:m}function y(x){return x===91||x===92||x===93?(e.consume(x),u++,m):m(x)}}function yE(e,s,a){const l=this,c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,d=0,h;return p;function p(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||dt(w))return a(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return u=Jn(l.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return dt(w)||(h=!0),d++,e.consume(w),w===92?x:y}function x(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,b,"gfmFootnoteDefinitionWhitespace")):a(w)}function b(w){return s(w)}}function xE(e,s,a){return e.check(Wr,s,e.attempt(hE,s,a))}function bE(e){e.exit("gfmFootnoteDefinition")}function vE(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 wE(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 p=-1;for(;++p<d.length;)if(d[p][0]==="enter"&&d[p][1].type==="strikethroughSequenceTemporary"&&d[p][1]._close){let m=p;for(;m--;)if(d[m][0]==="exit"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._open&&d[p][1].end.offset-d[p][1].start.offset===d[m][1].end.offset-d[m][1].start.offset){d[p][1].type="strikethroughSequence",d[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},d[m][1].start),end:Object.assign({},d[p][1].end)},x={type:"strikethroughText",start:Object.assign({},d[m][1].end),end:Object.assign({},d[p][1].start)},v=[["enter",y,h],["enter",d[m][1],h],["exit",d[m][1],h],["enter",x,h]],b=h.parser.constructs.insideSpan.null;b&&Kn(v,v.length,0,tc(b,d.slice(m+1,p),h)),Kn(v,v.length,0,[["exit",x,h],["enter",d[p][1],h],["exit",d[p][1],h],["exit",y,h]]),Kn(d,m-1,p-m+3,v),p=m+v.length-2;break}}for(p=-1;++p<d.length;)d[p][1].type==="strikethroughSequenceTemporary"&&(d[p][1].type="data");return d}function u(d,h,p){const m=this.previous,y=this.events;let x=0;return v;function v(w){return m===126&&y[y.length-1][1].type!=="characterEscape"?p(w):(d.enter("strikethroughSequenceTemporary"),b(w))}function b(w){const S=qo(m);if(w===126)return x>1?p(w):(d.consume(w),x++,b);if(x<2&&!a)return p(w);const A=d.exit("strikethroughSequenceTemporary"),k=qo(w);return A._open=!k||k===2&&!!S,A._close=!S||S===2&&!!k,h(w)}}}class jE{constructor(){this.map=[],this.index=new Map}add(s,a,l){kE(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 kE(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 SE(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 CE(){return{flow:{null:{name:"table",tokenize:AE,resolveAll:TE}}}}function AE(e,s,a){const l=this;let c=0,u=0,d;return h;function h($){let I=l.events.length-1;for(;I>-1;){const{type:te}=l.events[I][1];if(te==="lineEnding"||te==="linePrefix")I--;else break}const X=I>-1?l.events[I][1].type:null,le=X==="tableHead"||X==="tableRow"?L:p;return le===L&&l.parser.lazy[l.now().line]?a($):le($)}function p($){return e.enter("tableHead"),e.enter("tableRow"),m($)}function m($){return $===124||(d=!0,u+=1),y($)}function y($){return $===null?a($):Re($)?u>1?(u=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),b):a($):$e($)?Je(e,y,"whitespace")($):(u+=1,d&&(d=!1,c+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),d=!0,y):(e.enter("data"),x($)))}function x($){return $===null||$===124||dt($)?(e.exit("data"),y($)):(e.consume($),$===92?v:x)}function v($){return $===92||$===124?(e.consume($),x):x($)}function b($){return l.interrupt=!1,l.parser.lazy[l.now().line]?a($):(e.enter("tableDelimiterRow"),d=!1,$e($)?Je(e,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):w($))}function w($){return $===45||$===58?A($):$===124?(d=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),S):H($)}function S($){return $e($)?Je(e,A,"whitespace")($):A($)}function A($){return $===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),k):$===45?(u+=1,k($)):$===null||Re($)?M($):H($)}function k($){return $===45?(e.enter("tableDelimiterFiller"),z($)):H($)}function z($){return $===45?(e.consume($),z):$===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N($))}function N($){return $e($)?Je(e,M,"whitespace")($):M($)}function M($){return $===124?w($):$===null||Re($)?!d||c!==u?H($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),s($)):H($)}function H($){return a($)}function L($){return e.enter("tableRow"),P($)}function P($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),P):$===null||Re($)?(e.exit("tableRow"),s($)):$e($)?Je(e,P,"whitespace")($):(e.enter("data"),ue($))}function ue($){return $===null||$===124||dt($)?(e.exit("data"),P($)):(e.consume($),$===92?se:ue)}function se($){return $===92||$===124?(e.consume($),ue):ue($)}}function TE(e,s){let a=-1,l=!0,c=0,u=[0,0,0,0],d=[0,0,0,0],h=!1,p=0,m,y,x;const v=new jE;for(;++a<e.length;){const b=e[a],w=b[1];b[0]==="enter"?w.type==="tableHead"?(h=!1,p!==0&&(kx(v,s,p,m,y),y=void 0,p=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,x=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],x=jo(v,s,u,c,void 0,x),u=[0,0,0,0]),d[2]=a)):w.type==="tableCellDivider"&&(l?l=!1:(u[1]!==0&&(d[0]=d[1],x=jo(v,s,u,c,void 0,x)),u=d,d=[u[1],a,0,0])):w.type==="tableHead"?(h=!0,p=a):w.type==="tableRow"||w.type==="tableDelimiterRow"?(p=a,u[1]!==0?(d[0]=d[1],x=jo(v,s,u,c,a,x)):d[1]!==0&&(x=jo(v,s,d,c,a,x)),c=0):c&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(d[3]=a)}for(p!==0&&kx(v,s,p,m,y),v.consume(s.events),a=-1;++a<s.events.length;){const b=s.events[a];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=SE(s.events,a))}return e}function jo(e,s,a,l,c,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",h="tableContent";a[0]!==0&&(u.end=Object.assign({},Oa(s.events,a[0])),e.add(a[0],0,[["exit",u,s]]));const p=Oa(s.events,a[1]);if(u={type:d,start:Object.assign({},p),end:Object.assign({},p)},e.add(a[1],0,[["enter",u,s]]),a[2]!==0){const m=Oa(s.events,a[2]),y=Oa(s.events,a[3]),x={type:h,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(a[2],0,[["enter",x,s]]),l!==2){const v=s.events[a[2]],b=s.events[a[3]];if(v[1].end=Object.assign({},b[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",x,s]])}return c!==void 0&&(u.end=Object.assign({},Oa(s.events,c)),e.add(c,0,[["exit",u,s]]),u=void 0),u}function kx(e,s,a,l,c){const u=[],d=Oa(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 Oa(e,s){const a=e[s],l=a[0]==="enter"?"start":"end";return a[1][l]}const NE={name:"tasklistCheck",tokenize:zE};function EE(){return{text:{91:NE}}}function zE(e,s,a){const l=this;return c;function c(p){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?a(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),u)}function u(p){return dt(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),d):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),d):a(p)}function d(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):a(p)}function h(p){return Re(p)?s(p):$e(p)?e.check({tokenize:OE},s,a)(p):a(p)}}function OE(e,s,a){return Je(e,l,"whitespace");function l(c){return c===null?a(c):s(c)}}function RE(e){return Jb([iE(),fE(),wE(e),CE(),EE()])}const DE={};function ME(e){const s=this,a=e||DE,l=s.data(),c=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);c.push(RE(a)),u.push(WN()),d.push(eE(a))}const LE=[ME,AT],_E={footnoteLabelProperties:{className:["visually-hidden"]}},UE=/^(?:https?|mailto):/i,qv=T.createContext(!1);function Gv({href:e,title:s,children:a}){return i.jsx(qv,{value:!0,children:e&&UE.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 BE({src:e,alt:s}){const a=s||e;return T.useContext(qv)?i.jsx(i.Fragment,{children:a}):i.jsx(Gv,{href:e,children:a})}const HE={a:({href:e,title:s,children:a})=>i.jsx(Gv,{href:e,title:s,children:a}),img:({src:e,alt:s})=>i.jsx(BE,{src:typeof e=="string"?e:void 0,alt:s})},Fv=T.memo(function({text:s}){return i.jsx("div",{className:"markdown",children:i.jsx(pT,{remarkPlugins:LE,remarkRehypeOptions:_E,components:HE,children:s})})}),Pv={draft:"Draft",open:"Open",failing:"CI failed",changes_requested:"Changes requested",merged:"Merged",closed:"Closed"},lf={draft:"neutral",open:"success",failing:"danger",changes_requested:"danger",merged:"merged",closed:"neutral"};function Yv(e){return e.number===void 0?"PR":`#${e.number}`}function $E(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 xh(e){const s=$E(e.url),a=e.state?`: ${Pv[e.state]}`:"";return s?`Pull request ${Yv(e)} in ${s}${a}`:`${e.url}${a}`}function Vv({pull:e}){return e.state?i.jsx("span",{className:`pull-state ${lf[e.state]}`,children:Pv[e.state]}):null}function Zv({pull:e}){return i.jsxs("span",{className:`session-pull${e.state?` ${lf[e.state]}`:""}`,title:xh(e),children:[i.jsx(ke,{name:"git-pull-request",size:12}),Yv(e),e.state&&i.jsxs(i.Fragment,{children:[" ",i.jsx(Vv,{pull:e})]})]})}function IE({pull:e}){return i.jsxs("a",{className:`badge session-pull-link${e.state?` ${lf[e.state]}`:""}`,href:e.url,target:"_blank",rel:"noreferrer",title:xh(e),"aria-label":xh(e),children:[i.jsx(ke,{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(Vv,{pull:e})]}),i.jsx(ke,{name:"external",size:12})]})}const Sx={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 qE(e){return Object.hasOwn(Sx,e)?Sx[e]:"Preparing"}function _r(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function GE(e){if(!_r(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 Xv(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 FE(e){const s=[qE(e.phase)],a=Xv(e);return a!==void 0&&e.phase!=="done"&&s.push(`${a}%`),_r(e.done)&&_r(e.total)&&e.total>0?s.push(`${e.done.toLocaleString("en-US")} of ${e.total.toLocaleString("en-US")}`):_r(e.done)&&e.done>0&&s.push(e.done.toLocaleString("en-US")),_r(e.bytes)&&e.bytes>0&&s.push(GE(e.bytes)),s.join(" · ")}function PE(e){return e?.repositories?.status==="preparing"}function YE({sessionId:e,preparation:s,canRestart:a,onRestarted:l}){const c=Ce();if(s.status==="failed"){const u=()=>{c.run(async()=>{await fe(`/api/sessions/${ce(e)}/restart`,{method:"POST"}),l()})};return i.jsx(xe,{variant:"error",title:"Repositories could not be prepared",actions:a?i.jsx(G,{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(ve,{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(Ls,{}),"Preparing repositories"]}),i.jsx("ul",{className:"repository-preparation-items",children:s.items.map(u=>{const d=Xv(u),h=FE(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 VE(e){return e.connectorOwnerId!==e.ownerId}function bh(e,s,a=!1){return e.kind==="host.bash"?!0:e.kind==="bash"&&(s.hostEnvironment===!0||a&&VE(s))}function ZE(e,s,a=!1){return e.kind==="bash"?!a&&!bh(e,s,a):e.kind==="git.push"||e.kind==="github.comment"||e.kind==="github.issue"}function XE(e,s){return e.kind==="host.bash"||e.kind==="bash"&&s.hostEnvironment===!0}function QE(e,s,a,l){return s.ownerId===l&&e.requestedBy!==s.ownerId&&s.requesterAutoApprove===!0&&(a===void 0||a.capabilities.requesterAutoApprove===!0)&&ZE(e.operation,s,e.unbounded===!0)}function KE(e,s,a){return e.connectorOwnerId!==void 0&&e.connectorOwnerId===a||s?.hostCommandAccess!==void 0}function Qv(e,s){return e.kind==="host.bash"&&s?.capabilities?.hostOwnerDecides===!0}function JE(e,s,a,l,c){const u=s.connectorOwnerId!==void 0&&s.connectorOwnerId===l;return c&&KE(s,a,l)||u&&Qv(e,a)}function WE(e,s){return Qv(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 Kv=T.createContext(null),ez=Kv.Provider;function tz(){const e=T.useContext(Kv);return e?i.jsx(G,{variant:"ghost",size:"sm",icon:"menu",className:"nav-button","aria-label":"Open navigation","aria-expanded":e.expanded,onClick:e.open}):null}function nz({session:e,user:s,manages:a,action:l,onChange:c}){const u=e.ownerId===s.id,d=Ie(u?`/api/sessions/${ce(e.id)}/link`:null),h=d.data?d.data.link:void 0;async function p(){if(!u||l.busy||e.status==="archived")return!1;if(h)return!0;if(!await qe({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 x=!1;return await l.run(async()=>{const v=await fe(`/api/sessions/${ce(e.id)}/link`,{method:"PUT"});d.setData({link:v.link}),x=!0,c()},"Share link created. Anyone who has it can view the shared conversation."),x}async function m(){!a||l.busy||!await qe({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 fe(`/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:p,unshareLink:()=>{m()}}}function Jv(e){return`${e.location==="workspace-database"?" · Workspace database":""}${e.automatic?" · Automatic":""}${e.conversationOnly?" · Conversation only":""}`}function Eo(e){return`${e.host.includes(":")?`[${e.host}]`:e.host}:${e.port}/${e.database}`}function Cx(e){return e===15?"every 15 minutes":e===60?"every hour":e===360?"every 6 hours":e===1440?"every day":`every ${e} minutes`}function iz(e){if(!e.included)return`The workspace backs up changed sessions ${Cx(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 ${Cx(e.minutes)} when the session changed. ${s}`}function sz(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 az(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 Po=new Map;function Ax(e,s,a){return`session-backup-restore:${JSON.stringify([e,s,a])}`}function Tx(e){const s=Po.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 Po.set(e,c),c}function Wv(e,s){return`/api/sessions/${ce(e)}/backups/${ce(s)}/download`}function rz({sourceId:e,ownerId:s,backups:a,latestBackup:l,refreshKey:c,openSession:u}){const d=`/api/sessions/${ce(e)}`,[h,p]=T.useState(""),[m,y]=T.useState(""),[x,v]=T.useState(),[b,w]=T.useState(""),[S,A]=T.useState(""),[k,z]=T.useState(!1),N=T.useRef(!1),M=a.data?.backups.find(te=>te.id===h),H=!!M?.unavailable&&!x?.targetSessionId;T.useEffect(()=>{(l||c)&&a.refresh()},[l,c,a.refresh]);function L(te){if(!k&&(p(te),w(""),A(""),v(void 0),y(""),!!te))try{const F=Tx(Ax(s,e,te));v(F),y(F?.title??"")}catch(F){A(`Cannot safely resume restore: ${Tn(F)}`)}}async function P(te){if(te.preventDefault(),!(!M||N.current||S||H)){N.current=!0,z(!0),w("");try{const F=Ax(s,e,M.id);let B=Tx(F);if(!B){const re=m.trim();if(re.length>200||re.includes("\0"))throw new Error("Use a title of at most 200 characters with no NUL characters, or leave it blank");B={requestId:crypto.randomUUID(),...re?{title:re}:{}},sessionStorage.setItem(F,JSON.stringify(B)),Po.set(F,B)}if(v(B),B.targetSessionId){u(B.targetSessionId);return}const U=await fe(`${d}/backups/${ce(M.id)}/restore`,{method:"POST",body:{requestId:B.requestId,...B.title?{title:B.title}:{}}});if(!U.session?.id||U.session.id===e||U.restore?.status!=="completed"||U.restore.sourceSessionId!==e||U.restore.backupId!==M.id||U.restore.targetSessionId!==U.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 ee={...B,targetSessionId:U.session.id};Po.set(F,ee),v(ee);try{sessionStorage.setItem(F,JSON.stringify(ee))}catch{}u(U.session.id)}catch(F){w(Tn(F))}finally{N.current=!1,z(!1)}}}if(a.loading)return i.jsx(ie,{title:i.jsx(Bt,{children:"Loading backups..."})});if(a.error)return i.jsx(ie,{title:"Unable to load backups",hint:a.error,trailing:i.jsx(G,{variant:"outline",size:"sm",onClick:a.refresh,children:"Try again"})});const ue=a.data?.backups??[],se=a.data?.enabled!==!1,$=a.data?.workspaceDatabase,I=se?$&&i.jsx(ie,{leading:i.jsx(ke,{name:"server",size:16}),title:"Saved to the workspace database",hint:$.confirm?`New backups of this session go to ${Eo($)}, which the workspace owner connected. Whoever can read it can read them, including your personal environment values; you confirm before each backup`:$.consented?`New backups of this session go to ${Eo($)}, 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 ${Eo($)}, the database you connected for this workspace`}):i.jsx(ie,{leading:i.jsx(ke,{name:"info",size:16}),title:"Backups are off",hint:sz(a.data?.destination)}),X=se&&a.data?.automaticBackups,le=X&&i.jsx(ie,{leading:i.jsx(ke,{name:X.error?"info":"refresh",size:16}),title:"Automatic backups",hint:iz(X)});return ue.length?i.jsxs(i.Fragment,{children:[I,le,ue.map(te=>i.jsxs("div",{className:"backup-item",children:[i.jsx(ie,{leading:i.jsx(ke,{name:"archive",size:16}),title:i.jsx(Kt,{value:te.createdAt}),hint:`${te.size} bytes${Jv(te)}${te.unavailable?" · Unavailable":""}`,trailing:i.jsx(ke,{name:te.id===h?"chevron-down":"chevron-right",size:16}),onClick:()=>L(te.id===h?"":te.id)}),M?.id===te.id&&i.jsx("form",{className:"backup-detail",onSubmit:P,children:i.jsxs("fieldset",{disabled:k,className:"stack",children:[i.jsxs("p",{className:"muted small",children:["ID ",i.jsx("code",{children:M.id}),"; SHA-256 ",i.jsx("code",{children:M.sha256})]}),M.unavailable?i.jsx("p",{className:"small",children:az(M)}):i.jsx("div",{className:"inline",children:i.jsx(It,{variant:"outline",size:"sm",icon:"external",href:Wv(e,M.id),children:"Download backup"})}),i.jsx(ge,{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:!!x||!!S||H,onChange:F=>y(F.target.value)})}),x&&i.jsxs("p",{className:"muted small",children:["Restore request ",i.jsx("code",{children:x.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(G,{type:"submit",variant:"secondary",size:"sm",disabled:!!S||H,children:k?"Restoring...":x?.targetSessionId?"Open restored session":x?"Retry same restore":"Restore into new private session"}),k&&i.jsx(Bt,{children:"Waiting for the server to confirm the new session..."})]}),i.jsx(ve,{error:S||b}),b&&x&&!x.targetSessionId&&i.jsx(xe,{variant:"warning",title:"Outcome not confirmed",children:"Retry the same restore; an error doesn't mean no session was created."}),x?.targetSessionId&&i.jsxs("p",{className:"muted small",role:"status",children:["Restored session: ",i.jsx("code",{children:x.targetSessionId}),". It is private; only its owner, or the workspace's owner or an admin, can change visibility."]})]})})]},te.id))]}):i.jsxs(i.Fragment,{children:[I,le,se&&i.jsx(ie,{title:"No backups yet",hint:"Listing and downloading work while the host is offline"})]})}function lz({session:e,user:s,hosts:a,openSession:l,changed:c}){const u=Ie(`/api/workspaces/${ce(e.workspaceId)}/models`),d=Ie(`/api/sessions/${ce(e.id)}/migrations`),[h,p]=T.useState(""),[m,y]=T.useState(""),[x,v]=T.useState(""),[b,w]=T.useState(""),[S,A]=T.useState(!1),k=a.data?.connectors??[],z=k.find(I=>I.id===e.connectorId),N=d.data?.migrations.find(I=>I.status==="pending"&&I.sourceSessionId===e.id),M=T.useMemo(()=>(u.data?.models??[]).flatMap(I=>{const X=k.find(le=>le.id===I.connectorId);return!X||X.id===e.connectorId||X.revokedAt||X.capabilities.hostMigration!==!0||!X.models.some(le=>le.provider===I.provider&&le.modelId===I.modelId)?[]:[{model:I,host:X}]}),[u.data,k,e.connectorId]),H=M.find(I=>I.model.id===h),L=!!(H&&H.host.ownerId!==s.id),P=!!(H&&H.host.online&&z?.online&&(!L||x===H.host.id)&&!S);async function ue(I){A(!0),w("");try{const X=await fe(`/api/sessions/${ce(e.id)}/migrate`,{method:"POST",body:I});if(X.migration?.status!=="completed"||X.migration.sourceSessionId!==e.id||X.migration.targetSessionId!==X.session?.id)throw new Error("The server did not confirm the move. Retry it to resolve its outcome.");c(),l(X.session.id)}catch(X){w(Tn(X)),d.refresh()}finally{A(!1)}}async function se(I){if(I.preventDefault(),!H||!P||!await qe({title:"Move session",message:`Move this session to ${H.host.name} (${H.model.name})? Its conversation, files and history are copied there into a new session, and this one is archived. ${L?`${H.host.name}'s owner can access prompts and files processed on it. `:""}Session grants aren't copied.`,confirmLabel:"Move session"}))return;const le=m.trim();await ue({requestId:crypto.randomUUID(),modelId:H.model.id,...le?{title:le}:{},...L?{trustedConnectorId:H.host.id}:{}})}async function $(){if(!(!N||!await qe({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}))){A(!0),w("");try{await fe(`/api/sessions/${ce(e.id)}/migrations/${ce(N.id)}/cancel`,{method:"POST"}),d.refresh(),c()}catch(X){w(Tn(X))}finally{A(!1)}}}return i.jsxs(Te,{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:[N?i.jsxs(i.Fragment,{children:[i.jsx(ie,{leading:i.jsx(ke,{name:"refresh",size:16}),title:"Move in progress",hint:i.jsxs(i.Fragment,{children:["To ",k.find(I=>I.id===N.targetConnectorId)?.name??"another host",". This session accepts only reads until the move finishes or is cancelled"]})}),i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"secondary",size:"sm",disabled:S,onClick:()=>{ue({requestId:N.requestId,modelId:N.modelId,...N.title!==null?{title:N.title}:{},trustedConnectorId:N.targetConnectorId})},children:S?"Moving...":"Retry move"}),i.jsx(G,{variant:"outline",size:"sm",disabled:S,onClick:()=>{$()},children:"Cancel move"}),S&&i.jsx(Bt,{children:"Waiting for the other host..."})]})]}):u.loading||d.loading||a.loading?i.jsx(ie,{title:i.jsx(Bt,{children:"Loading hosts..."})}):M.length?i.jsxs("form",{className:"stack",onSubmit:I=>{se(I)},children:[i.jsx(ge,{label:"Model on the new host",children:i.jsxs("select",{className:"input",value:h,disabled:S,onChange:I=>{p(I.target.value),v("")},children:[i.jsx("option",{value:"",children:"Choose a model..."}),M.map(({model:I,host:X})=>i.jsxs("option",{value:I.id,children:[X.name," · ",I.name,X.online?"":" (offline)"]},I.id))]})}),i.jsx(ge,{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:I=>y(I.target.value)})}),H&&L&&i.jsxs("label",{className:"inline small",children:[i.jsx("input",{type:"checkbox",checked:x===H.host.id,onChange:I=>v(I.target.checked?H.host.id:"")}),"I understand that ",H.host.name,"'s owner can access this session's prompts and files"]}),H&&!H.host.online&&i.jsxs(xe,{variant:"warning",title:"Host offline",children:[H.host.name," must be connected to receive the session."]}),!z?.online&&i.jsx(xe,{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(G,{type:"submit",variant:"secondary",size:"sm",disabled:!P,children:S?"Moving...":"Move session"}),S&&i.jsx(Bt,{children:"Copying the session to the new host..."})]})]}):i.jsx(ie,{leading:i.jsx(ke,{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(ve,{error:b||u.error||d.error||a.error})]})}const oz="modulepreload",cz=function(e){return"/"+e},Nx={},uz=function(s,a,l){let c=Promise.resolve();if(a&&a.length>0){let p=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");c=p(a.map(m=>{if(m=cz(m),m in Nx)return;Nx[m]=!0;const y=m.endsWith(".css"),x=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":oz,y||(v.as="script"),v.crossOrigin="",v.href=m,h&&v.setAttribute("nonce",h),document.head.appendChild(v),y)return new Promise((b,w)=>{v.addEventListener("load",b),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 ew;async function dz(){const{createLowlight:e,common:s}=await uz(async()=>{const{createLowlight:a,common:l}=await import("./index-CnOXvi_D.js");return{createLowlight:a,common:l}},[]);return e(s)}const Ex={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"},hz={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"},fz=128*1024;function mz(e,s){const a=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(Ex[a])return Ex[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=hz[c]??c;return s(u)?u:null}function tw(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:tw(s.children)},a)})}function pz(e,s){const[a,l]=T.useState(null);return T.useEffect(()=>{let c=!0;return yz().then(u=>{c&&l(u)},()=>{ew=void 0}),()=>{c=!1}},[]),T.useMemo(()=>a?gz(a,e,s):{content:e,language:null},[a,e,s])}function gz(e,s,a){const l=mz(a,c=>e.registered(c));if(!l||l==="plaintext")return{content:s,language:null};if(s.length>fz)return{content:s,language:null,tooLarge:!0};try{return{content:tw(e.highlight(l,s).children),language:l}}catch{return{content:s,language:null}}}function yz(){return ew??=dz()}function nw({text:e,path:s}){const{content:a,language:l,tooLarge:c}=pz(e,s),u=T.useMemo(()=>{const d=e.split(`
|
|
48
|
-
`).length-(e.endsWith(`
|
|
49
|
-
`)?1:0);return Array.from({length:Math.max(d,1)},(h,p)=>p+1).join(`
|
|
50
|
-
`)},[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 xz(e,s){return e==="."?s:`${e}/${s}`}function bz(e){const s=e.lastIndexOf("/");return s<0?".":e.slice(0,s)}function zo(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 vz={directory:"folder",file:"file",symlink:"link",other:"file"};function wz({session:e}){const s=e.permissions??[],[a,l]=T.useState("."),[c,u]=T.useState(null);if(T.useEffect(()=>{l("."),u(null)},[e.id]),e.status==="archived")return i.jsx(bt,{title:"Files unavailable",children:"Archived sessions don't show their files. Unarchive the session to browse them."});if(!s.includes("write"))return i.jsx(bt,{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(kz,{session:e,path:c,onBack:()=>u(null),onDirectory:d}):i.jsx(jz,{session:e,path:a,onOpen:d,onFile:u})}function iw(e,s){return`/api/sessions/${ce(e.id)}/files?path=${encodeURIComponent(s)}`}function sw({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 jz({session:e,path:s,onOpen:a,onFile:l}){const c=Ie(iw(e,s)),u=c.data?.files;return T.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(sw,{path:s,onOpen:a}),i.jsx("span",{className:"spacer"}),i.jsx(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh files",title:"Refresh",disabled:c.loading,onClick:c.refresh})]}),i.jsx(ut,{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(ie,{leading:i.jsx(ke,{name:"chevron-left",size:16}),title:"..",hint:"Parent directory",onClick:()=>a(bz(s))}),u.entries.map(d=>{const h=xz(s,d.name);return i.jsx(ie,{leading:i.jsx(ke,{name:vz[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:zo(d.size)}):void 0,onClick:d.type==="other"?void 0:()=>d.type==="directory"?a(h):l(h)},d.name)}),!u.entries.length&&i.jsx(ie,{title:"Empty directory"}),u.truncated&&i.jsx(ie,{title:`Showing ${u.entries.length} of ${u.total} entries`,hint:"Directories first, then by name"})]}):i.jsx(bt,{title:"The worktree is empty",children:"The agent clones the session's repositories into it as it works."}))})]})}function kz({session:e,path:s,onBack:a,onDirectory:l}){const c=Ie(iw(e,s)),u=c.data?.files;return T.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(G,{variant:"ghost",size:"xs",icon:"chevron-left","aria-label":"Back to directory",title:"Back",onClick:a}),i.jsx(sw,{path:s,onOpen:l}),i.jsx("span",{className:"spacer"}),i.jsx(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh file",title:"Refresh",disabled:c.loading,onClick:c.refresh})]}),i.jsx(ut,{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:[zo(u.size),u.text!==void 0&&u.truncated?` · showing the first ${zo(jy.textBytes)}`:""]}),u.redacted&&i.jsxs(xe,{title:"Secret hidden",children:["Something that looks like a secret is shown as ",i.jsx("code",{children:kt}),", as in the conversation."]}),u.text!==void 0&&(u.text?Sz(s)&&!u.truncated?i.jsx(Cz,{text:u.text,path:s},s):i.jsx(nw,{text:u.text,path:s}):i.jsx(bt,{title:"Empty file"})),u.image&&i.jsx(aw,{src:`data:${u.image.mimeType};base64,${u.image.data}`,path:s},s),u.binary&&i.jsx(bt,{title:u.truncated?"Too large to preview":"No preview",children:u.truncated?`Images up to ${zo(jy.imageBytes)} are shown.`:"This isn't a text file or an image."})]})})]})}const Sz=e=>/\.svg$/i.test(e);function aw({src:e,path:s}){const[a,l]=T.useState(null),[c,u]=T.useState(!1),[d,h]=T.useState(!1);return d?i.jsx(bt,{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(p=>!p),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:p=>l({width:p.currentTarget.naturalWidth,height:p.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 Cz({text:e,path:s}){const[a,l]=T.useState("preview");return i.jsxs("div",{className:"stack",children:[i.jsx(Is,{size:"xs",label:"SVG view",value:a,onChange:l,options:[{value:"preview",label:"Preview"},{value:"source",label:"Source"}]}),a==="preview"?i.jsx(aw,{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,path:s}):i.jsx(nw,{text:e,path:s})]})}const vh=5,Az={"@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 *"},Tz=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],Nz=["sun","mon","tue","wed","thu","fri","sat"];class Zn extends Error{}function Pd(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 Zn(`"${e}" is not a valid value.`);const h=Number(e);if(h<s||h>a)throw new Zn(`${h} is outside ${s}-${a}.`);return h}function Mr(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[p,m,y]=h.split("/");if(y!==void 0||!p)throw new Zn(`"${h}" is not a valid entry.`);let x=1;if(m!==void 0){if(!/^\d{1,2}$/.test(m)||Number(m)<1)throw new Zn(`"${m}" is not a valid step.`);x=Number(m)}let v,b;if(p==="*")v=s,b=a;else if(p.includes("-")){const[w,S,A]=p.split("-");if(A!==void 0||!w||!S)throw new Zn(`"${p}" is not a valid range.`);if(v=Pd(w,s,a,c,u),b=Pd(S,s,a,c,u),v>b)throw new Zn(`"${p}" runs backwards.`)}else v=Pd(p,s,a,c,u),b=m===void 0?v:a;for(let w=v;w<=b;w+=x)d.add(w)}}catch(h){throw h instanceof Zn?new Zn(`${l}: ${h.message}`):h}return{values:d,any:!1}}function rw(e){const s=e.trim().replace(/\s+/g," "),l=(Az[s.toLowerCase()]??s).split(" ");if(l.length!==5)throw new Zn("A schedule has five fields: minute, hour, day of month, month and day of week.");const[c,u,d,h,p]=l,m=Mr(c,0,59,"Minute"),y=Mr(u,0,23,"Hour"),x=Mr(d,1,31,"Day of month"),v=Mr(h,1,12,"Month",Tz,1),b=Mr(p,0,7,"Day of week",Nz);b.values.delete(7)&&b.values.add(0);const w=[...m.values].sort((S,A)=>S-A);for(let S=0;S<w.length;S++){const A=S+1<w.length?w[S+1]:w[0]+60;if(w.length>1&&A-w[S]<vh)throw new Zn(`Runs must be at least ${vh} minutes apart.`)}return{minutes:m.values,hours:y.values,days:x.values,months:v.values,weekdays:b.values,anyDay:x.any,anyWeekday:b.any}}const zx=new Map;function lw(e){let s=zx.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"}),zx.set(e,s)),s}function Ez(e){if(typeof e!="string"||!e||e.length>64)return!1;try{return lw(e),!0}catch{return!1}}function Oo(e,s){const a={};for(const l of lw(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 zz(e,s){let a=e-(Oo(e,s)-e);return a=e-(Oo(a,s)-a),Oo(a,s)===e?a:null}function Oz(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 Ur=6e4,Rz=60*Ur,Dz=24*Rz;function Mz(e,s,a){const l=typeof e=="string"?rw(e):e;let c=Math.floor(Oo(a,s)/Ur)*Ur+Ur;const u=c+5*366*Dz;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(!Oz(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=zz(c,s);if(h!==null&&h>a)return h}c+=Ur}return null}const Ox=[{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 * *"}],ow={read:"Read-only",approval:"Ask for approval",auto:"Auto-approve"},Lz={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"},_z={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 Uz(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Bz(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 Hz(e,s){if(!Ez(s))return{error:"Unknown time zone.",field:"timeZone"};try{const a=rw(e),l=[];let c=Date.now();for(let u=0;u<3;u++){const d=Mz(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 Zn?a.message:"Invalid schedule.",field:"cron"}}}function $z({session:e,changed:s}){const a=`/api/sessions/${ce(e.id)}/schedules`,l=Ie(a),{refreshSessions:c}=vt(),u=Ce(),[d,h]=T.useState(null),p=!!l.data?.canManage&&!e.frozen,m=()=>{l.refresh(),c(),s()},y=`${e.nextScheduledAt??""}|${e.activity??""}`,x=T.useRef(y),{refresh:v}=l;T.useEffect(()=>{x.current!==y&&(x.current=y,v())},[y,v]);function b(k){u.run(async()=>{await fe(`${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 fe(`${a}/${ce(k.id)}/run`,{method:"POST"}),m()},`Sent ${k.name} to the agent`)}async function S(k){await qe({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 fe(`${a}/${ce(k.id)}`,{method:"DELETE"}),m()},`Deleted ${k.name}`)}if(d)return i.jsx(Iz,{base:a,schedule:d==="new"?null:d,isOwner:p,onDone:k=>{h(null),k&&m()}});const A=l.data?.schedules??[];return i.jsxs(Te,{title:i.jsxs(i.Fragment,{children:["Scheduled prompts ",A.length>0&&i.jsx("span",{className:"muted",children:A.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(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh schedules",title:"Refresh",disabled:l.loading,onClick:l.refresh}),p&&i.jsx(G,{variant:"outline",size:"sm",icon:"plus",onClick:()=>h("new"),children:"New"})]}),bare:!0,children:[i.jsx(ut,{...l,retry:l.refresh,children:A.length?i.jsx("div",{className:"stack",children:A.map(k=>i.jsxs("article",{className:"card schedule-card",children:[i.jsx(ie,{leading:i.jsx(ke,{name:"clock",size:16}),title:k.name,hint:i.jsxs(i.Fragment,{children:[i.jsx("code",{children:k.cron})," · ",k.timeZone," · ",ow[k.access]]}),trailing:k.enabled?k.nextRunAt?i.jsxs(Ae,{tone:"info",children:["Next ",Bz(k.nextRunAt)]}):i.jsx(Ae,{tone:"warning",children:"Never runs"}):i.jsx(Ae,{tone:"neutral",children:"Paused"})}),i.jsxs(Ee,{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:_z[k.lastError]??k.lastError})]}):" sent its message","."]}):"Hasn't run yet."]}),p&&i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>b(k),children:k.enabled?"Pause":"Resume"}),i.jsx(G,{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(G,{variant:"ghost",size:"sm",icon:"pencil",disabled:u.busy,onClick:()=>h(k),children:"Edit"}),i.jsx(G,{variant:"ghost",size:"sm",icon:"trash",disabled:u.busy,"aria-label":`Delete ${k.name}`,title:"Delete",onClick:()=>{S(k)}})]})]})]},k.id))}):i.jsx(bt,{title:"No scheduled prompts",children:p?"Wake the agent with a message every hour, day or week.":"The session owner hasn't scheduled any prompts."})}),i.jsx(ve,{error:u.error,notice:u.notice})]})}function Iz({base:e,schedule:s,isOwner:a,onDone:l}){const c=Ce(),[u,d]=T.useState(s?.name??""),[h,p]=T.useState(s?.cron??"0 9 * * 1-5"),[m,y]=T.useState(s?.timeZone??Uz()),[x,v]=T.useState(s?.content??""),[b,w]=T.useState(s?.access??"approval"),S=T.useMemo(()=>Hz(h,m),[h,m]),A=Ox.find(N=>N.cron===h.trim())?.cron??"",k=a&&x.trim().length>0&&"runs"in S;function z(N){N.preventDefault(),!(!k||c.busy)&&c.run(async()=>{const M={name:u.trim(),cron:h,timeZone:m,content:x,access:b};s?await fe(`${e}/${ce(s.id)}`,{method:"PATCH",body:{...M,...M.name?{}:{name:s.name}}}):await fe(e,{method:"POST",body:M}),l(!0)})}return i.jsx(Te,{title:s?"Edit scheduled prompt":"New scheduled prompt",bare:!0,children:i.jsx("form",{className:"card",onSubmit:z,children:i.jsx(Ee,{children:i.jsxs("fieldset",{disabled:c.busy,className:"stack",children:[i.jsx(ge,{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:x,onChange:N=>v(N.target.value),placeholder:"Pull main, run the tests and summarise any failures"})}),i.jsx(ge,{label:"Name",hint:"Optional; the message's first line otherwise",children:i.jsx("input",{className:"input",maxLength:100,value:u,onChange:N=>d(N.target.value),placeholder:"Nightly test run"})}),i.jsx(ge,{label:"Repeat",children:i.jsxs("select",{className:"select",value:A,onChange:N=>{N.target.value&&p(N.target.value)},children:[Ox.map(N=>i.jsx("option",{value:N.cron,children:N.label},N.cron)),i.jsx("option",{value:"",children:"Custom"})]})}),i.jsx(ge,{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 ",vh," 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:N=>p(N.target.value)})}),i.jsx(ge,{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:N=>y(N.target.value)})}),"runs"in S&&i.jsxs("p",{className:"muted small",children:["Next runs: ",S.runs.map((N,M)=>i.jsxs("span",{children:[M?", ":"",i.jsx(Kt,{value:N})]},N))]}),i.jsx(ge,{label:"Access",hint:Lz[b],children:i.jsx("select",{className:"select",value:b,onChange:N=>w(N.target.value),children:["approval","read","auto"].map(N=>i.jsx("option",{value:N,children:ow[N]},N))})}),b==="auto"&&i.jsx(xe,{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(G,{type:"submit",variant:"default",size:"sm",disabled:!k,children:c.busy?"Saving...":s?"Save":"Create schedule"}),i.jsx(G,{variant:"ghost",size:"sm",onClick:()=>l(!1),children:"Cancel"})]}),i.jsx(ve,{error:c.error}),c.busy&&i.jsx(Bt,{children:"Saving"})]})})})})}const qz={ask:"Side ask",send:"Message",create:"Opening message",notify:"Notification"},Gz={pending:{label:"Will notify",tone:"info"},delivered:{label:"Notified",tone:"success"},failed:{label:"Notification failed",tone:"danger"},expired:{label:"Notification expired",tone:"neutral"}};function Rx({session:e,relation:s}){return i.jsx(ie,{href:Ze({name:"session",sessionId:e.id}),chevron:!0,leading:i.jsx(ke,{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 Fz({session:e}){const s=Ie(`/api/sessions/${ce(e.id)}/connections`),a=s.data;return a&&!a.parent&&!a.children.length&&!a.messages.length?null:i.jsx(Te,{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(ut,{loading:s.loading,error:s.error,retry:s.refresh,children:a&&i.jsxs(i.Fragment,{children:[a.parent&&i.jsx(Rx,{session:a.parent,relation:"Started this session"}),a.children.map(l=>i.jsx(Rx,{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&&Gz[l.notify];return i.jsx(ie,{href:Ze({name:"session",sessionId:u}),leading:i.jsx(ke,{name:c?"send":"message",size:16}),title:i.jsxs("span",{className:"truncate",children:[qz[l.kind]," ",c?"to":"from"," ",l.otherTitle]}),hint:i.jsxs(i.Fragment,{children:["By ",i.jsx(ri,{id:l.actorId,you:!0})," · hop ",l.hops," · ",i.jsx(Qn,{value:l.createdAt})]}),trailing:d&&i.jsx(Ae,{tone:d.tone,children:d.label})},l.id)})]})})})}function Pz({session:e,user:s,manages:a,backupBlocked:l,onChange:c}){const u=Ce(),[d,h]=T.useState(null),p=e?.ownerId===s.id,m=Ie(e&&p&&e.status!=="archived"?`/api/sessions/${ce(e.id)}/backups`:null),y=m.data?.enabled===!1,x=!m.data&&!m.error,v=m.data?.conversationOnlySupported===!1;async function b(){if(!e||!a||u.busy)return;const N=(e.visibility??"private")==="workspace"?"private":"workspace";await qe(N==="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 fe(`/api/sessions/${ce(e.id)}`,{method:"PATCH",body:{visibility:N}}),c()},N==="workspace"?"Session is workspace-visible. Workspace members can view prompts and output.":"Session is private. Existing explicit grants still apply.")}async function w({conversationOnly:N=!1}={}){if(!e||!p||l||y||x||u.busy||N&&v)return;h(null);const M=`/api/sessions/${ce(e.id)}`;let H;try{const{workspaceDatabase:L}=await fe(`${M}/backups`);if(L?.confirm){if(!await qe({title:"Save to the workspace database?",message:`This backup is saved in ${Eo(L)}, the database the workspace owner connected. Whoever can read it can read this session: its prompts, output${N?"":" and files"}, and your personal environment values.`,confirmLabel:"Save backup"}))return;H=L.id}}catch{}await u.run(async()=>{const L={...H?{trustedDatabaseId:H}:{},...N?{conversationOnly:!0}:{}},P=await fe(`${M}/backup`,{method:"POST",...Object.keys(L).length?{body:L}:{}});h(P.backup),c()},N?"Conversation backup created":"Backup created")}async function S(N){const M=N.trim();if(!e||!a||u.busy||!M)return!1;if(M===e.title)return!0;let H=!1;return await u.run(async()=>{await fe(`/api/sessions/${ce(e.id)}`,{method:"PATCH",body:{title:M}}),H=!0,c()},"Session renamed"),H}async function A(){!e||!a||u.busy||e.status==="archived"||!await qe({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 fe(`/api/sessions/${ce(e.id)}/archive`,{method:"POST"}),c()},"Session archived")}function k(){!e||!a||u.busy||e.status!=="archived"||u.run(async()=>{await fe(`/api/sessions/${ce(e.id)}/unarchive`,{method:"POST"}),c()},e.packed?"Session unarchived, its files unpacked":"Session unarchived")}async function z(){!e||!p||u.busy||e.status!=="archived"||e.packed||!await qe({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 fe(`/api/sessions/${ce(e.id)}/pack`,{method:"POST"}),c()},"Session files packed")}return{action:u,backup:d,backups:m,backupsOff:y,backupsPending:x,backupBlocked:l,changeVisibility:()=>{b()},createBackup:N=>{w(N)},conversationOnlyOff:v,rename:S,archive:()=>{A()},unarchive:k,pack:()=>{z()}}}const cw={pending:"warning",approved:"info",executing:"running",executed:"success",denied:"neutral",interrupted:"warning",failed:"danger"};function Yz({approval:e}){return i.jsxs(i.Fragment,{children:[e.automatic&&i.jsx(Ae,{tone:"warning",children:"Auto-approved"}),i.jsx(Ae,{tone:cw[e.status],dot:e.status==="executing",children:e.status})]})}function Dx({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(Ae,{tone:"warning",children:"Auto-approved"}),e.some(s=>s.unbounded)&&i.jsx(Ae,{tone:"warning",children:"No resource limits"}),e.filter(s=>s.status!=="executed").map((s,a)=>i.jsx(Ae,{tone:cw[s.status]??"neutral",dot:s.status==="executing",children:e.length>1?`${s.tool}: ${s.status}`:s.status},a))]})}function Vz(e,s){let a=e;if(typeof e=="string")try{a=JSON.parse(e)}catch{return e}return JSON.stringify(th(a,s),null,2)??""}function Zz(e){const{tab:s,setTab:a,onClose:l,view:c,audit:u}=e,d=_h(),h=c?.approvals??[],p=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(Is,{size:"xs",label:"Panel",value:s,onChange:a,options:[{value:"details",label:"Details"},{value:"approvals",label:p?`Approvals ${p}`:"Approvals"},{value:"files",label:"Files"},{value:"schedules",label:"Schedules"},{value:"activity",label:"Activity"}]}),i.jsx("span",{className:"spacer"}),i.jsx(G,{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(iO,{...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(dw,{approval:m},m.id)),!!c?.olderApprovals&&i.jsx("p",{className:"muted small",children:Xz(c.olderApprovals)})]}):c?i.jsx(bt,{title:"No approvals",children:uw}):i.jsx(Bt,{})),s==="files"&&i.jsx(wz,{session:e.session}),s==="schedules"&&i.jsx($z,{session:e.session,changed:()=>{u.refresh(),e.refresh()}},e.session.id),s==="activity"&&i.jsx(Te,{title:"Audit log",action:i.jsx(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh activity",title:"Refresh",disabled:u.loading,onClick:u.refresh}),bare:!0,children:i.jsx(ut,{...u,retry:u.refresh,children:u.data?.events.length?i.jsx("div",{className:"card",children:u.data.events.map(m=>i.jsx(us,{title:m.action,hint:i.jsxs(i.Fragment,{children:[Mt(d.person(m.actorId))," · ",i.jsx(Qn,{value:m.createdAt})]}),children:i.jsx("pre",{children:Vz(m.detail,d.person)})},m.id))}):i.jsx(bt,{title:"No activity"})})})]})]})}const uw="Commands that ran under auto-approve are marked on their tool calls in the conversation.";function Xz(e){return`${e} older settled ${e===1?"approval isn't":"approvals aren't"} listed. ${uw}`}function dw({approval:e,children:s}){const{operation:a}=e,l=(u,d)=>i.jsxs(i.Fragment,{children:[" · Allowed by ",i.jsx(ri,{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(ri,{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(Ae,{tone:"warning",children:"No resource limits"}),ih(a)&&i.jsx(Ae,{tone:"warning",children:"Secret hidden"}),i.jsx(Yz,{approval:e})]}),a.kind==="permission"?i.jsx(Wz,{request:a,pending:e.status==="pending"}):i.jsxs(i.Fragment,{children:[a.kind==="host.bash"&&i.jsxs(xe,{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(xe,{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(eO,{operation:a}),a.kind==="github.merge"&&i.jsx(nO,{operation:a}),i.jsx("pre",{children:JSON.stringify(a,null,2)}),e.status==="pending"&&ih(a)&&i.jsx(hw,{})]}),i.jsxs("p",{className:"muted small",children:["Requested by ",i.jsx(ri,{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(Qz,{result:e.result}),s]})}function Qz({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(It,{variant:"outline",size:"sm",href:Ze({name:"session",sessionId:s.sessionId}),children:"Open repinned session"})}catch{return null}}const Kz={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."},Jz=["bash","git_commit","git_push","github_comment","github_merge","github_issue","host_bash","git_repin"];function Wz({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:Kz[a]},a))}),e.target&&i.jsx("pre",{children:e.target}),s&&ih(e.target)&&i.jsx(hw,{}),s&&Jz.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 hw(){return i.jsxs("p",{className:"small",children:["Something that looks like a secret is shown as ",i.jsx("code",{children:kt}),". Allowing or approving this uses the real value, so make sure it belongs here."]})}function eO({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 tO={merge:"Merge commit",squash:"Squash and merge",rebase:"Rebase and merge"};function nO({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:tO[e.method]})]})}function iO({session:e,view:s,user:a,workspaceRole:l,hosts:c,refresh:u,audit:d,actions:h,openSession:p}){const m=e.permissions??[],y=e.ownerId===a.id,x=m.includes("write"),v=Rh(a.id,e.ownerId,l),b=()=>{d.refresh(),u()};return i.jsxs("div",{children:[i.jsx(aO,{session:e,user:a,hosts:c}),i.jsx(rO,{session:e,refresh:u}),i.jsx(cO,{session:e,user:a,workspaceRole:l,actions:h,changed:b}),i.jsx(sO,{session:e,manages:v,changed:b}),i.jsx(Fz,{session:e}),y&&e.status!=="archived"&&i.jsx(uO,{session:e,actions:h,openSession:p}),y&&e.status!=="archived"&&!e.frozen&&e.connectorId&&i.jsx(lz,{session:e,user:a,hosts:c,openSession:p,changed:b}),x&&e.status!=="archived"&&!e.frozen&&i.jsx(hO,{session:e,changed:b}),y&&i.jsx(dO,{session:e}),i.jsx(fO,{session:e,view:s,user:a})]})}function sO({session:e,manages:s,changed:a}){const l=Ce(),c=Ie(`/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 fe(`/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 p=c.data?.settings.paging;return i.jsxs(Te,{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(ie,{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(Ae,{tone:"neutral",children:u?"On":"Off"})}),i.jsx(ie,{title:"Loading",hint:p===void 0?c.error?"Couldn't check the workspace setting":i.jsx(Bt,{children:"Checking"}):p?"Latest messages first; earlier ones load as you scroll up":"The whole transcript at once"}),(l.error||l.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...l})})]})}function aO({session:e,user:s,hosts:a}){const l=a.data?.connectors.find(c=>c.id===e.connectorId);return i.jsxs(Te,{title:"Host",info:i.jsxs("p",{children:["Work runs as the session owner (",i.jsx(ri,{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(ie,{leading:i.jsx(ke,{name:"server",size:16}),title:l?.name??"Pinned host",hint:i.jsxs(i.Fragment,{children:["Hosted by ",l?.ownerName??(e.connectorOwnerId?i.jsx(ri,{id:e.connectorOwnerId}):"unknown"),e.connectorOwnerId===s.id?" (you)":""]}),trailing:a.loading?i.jsx(Bt,{children:"Checking"}):l?i.jsx(Kr,{connector:l}):e.hostUnsandboxed&&i.jsx(Ae,{tone:"danger",children:"Unsandboxed"})}),e.hostEnvironment&&i.jsx(ie,{leading:i.jsx(ke,{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(Ae,{tone:"danger",children:"On host"})}),l&&i.jsx(Ko,{connector:l}),!a.loading&&!l&&!a.error&&i.jsx(ie,{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(ie,{title:"Connection ID",hint:i.jsx("code",{children:e.connectorId})})]}):i.jsx(ie,{leading:i.jsx(ke,{name:"server",size:16}),title:"Operator-managed session",hint:"No local host is pinned"}),a.error&&i.jsx(Ee,{children:i.jsx(ve,{error:a.error})})]})}function rO({session:e,refresh:s}){const a=e.repositories??[];return e.repositoryMode==="clone"?i.jsx(Te,{title:"Repositories",info:i.jsx(Uh,{}),bare:!0,children:i.jsxs("div",{className:"card",children:[i.jsx(ie,{leading:i.jsx(ke,{name:"git-branch",size:16}),title:"Cloned on demand",hint:"Nothing is pinned: the agent clones and switches branches as it works"}),i.jsx(ie,{title:"Manage repositories and network access",href:Ze({name:"settings",section:"workspaces",id:e.workspaceId}),chevron:!0})]})}):i.jsx(Te,{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(G,{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(xe,{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(xe,{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(ie,{leading:i.jsx(ke,{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(ie,{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(ie,{title:"Manage repositories for future sessions",href:Ze({name:"settings",section:"workspaces",id:e.workspaceId}),chevron:!0})]})]})})}const Ro={viewer:"Viewer",member:"Member",collaborator:"Collaborator",admin:"Admin"},lO={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"},Yd={owner:"workspace owner",admin:"workspace admin",collaborator:"workspace collaborator",member:"workspace member",viewer:"workspace viewer"};function wh(e){return e.sessionRole===void 0?hb(e.permissions):e.sessionRole}function oO(e){const s=wh(e);return s?Ro[s]:`Custom (${e.permissions.join(", ")||"none"})`}function cO({session:e,user:s,workspaceRole:a,actions:l,changed:c}){const u=Ce(),d=_h(),h=e.permissions??[],p=e.ownerId===s.id,m=Rh(s.id,e.ownerId,a),y=!p&&a&&Uo.includes(a)?a:null,x=e.visibility??"private",v=!p&&!h.some(J=>J!=="read"),b=hb(h),w=h.includes("manage"),S=e.status==="archived",A=`/api/sessions/${ce(e.id)}`,k=Ie(w&&!S?`${A}/grants`:null),[z,N]=T.useState(""),[M,H]=T.useState(null),L=eh(z,d.list);async function P(J){u.busy||await u.run(async()=>{await fe(`${A}/auto-approved-requesters/${ce(J)}`,{method:"DELETE"}),c()},`${Mt(d.person(J))}'s requests ask again.`)}const ue=Mt(d.person(L)),se=L===e.ownerId,$=k.data?.grants.find(J=>J.userId===L),I=$?wh($):null,X=$?.workspaceRole??d.person(L).role;function le(J){return E0(J,h)?N0(J,X)?null:"workspace viewers can only be session viewers":"needs permissions you don't hold"}const te=X&&!se?S0(X,x):[],F=X!==void 0&&Uo.includes(X),B=w&&!se&&!!L&&M!==null&&!le(M)&&M!==I;function U(){return[ue!==L&&z.trim()!==ue?ue:null,X?Yd[X]:null].filter(Boolean).join(" · ")||void 0}function ee(J){N(J);const be=eh(J,d.list),ye=k.data?.grants.find(Me=>Me.userId===be);H(ye?wh(ye):null)}function re(J){J.preventDefault(),!(!B||!M||u.busy)&&u.run(async()=>{await fe(`${A}/grants`,{method:"POST",body:{userId:L,role:M}}),k.refresh(),c()},`${ue} is now a session ${Ro[M].toLowerCase()}`)}async function O(){!w||se||!$||u.busy||!await qe({title:"Remove session access?",message:F?`Remove ${ue}'s session role? As a ${Yd[X]}, they still manage this session, as they do every session in the workspace.`:x==="workspace"?`Remove ${ue}'s session role? They keep what their workspace role gives them while this session is workspace-visible. Making it private removes that.`:`Remove ${ue}'s session role? They will no longer be able to open this private session.`,confirmLabel:"Remove access",destructive:!0})||await u.run(async()=>{await fe(`${A}/grants/${ce(L)}`,{method:"DELETE"}),ee(""),k.refresh(),c()},F?"Session role removed. As a workspace owner or admin, they still manage this session.":x==="workspace"?"Session role removed. Workspace members can still view this session until it is made private.":"Session role removed")}const R=nz({session:e,user:s,manages:m,action:l.action,onChange:c}),Q=R.link,E=p&&Q!==void 0?Q!==null:!!e.linkShared;return i.jsxs(Te,{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(ie,{leading:i.jsx(ke,{name:"user",size:16}),title:p?"Owner":y?`Workspace ${y}`:b?`Session ${Ro[b].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(ie,{leading:i.jsx(ke,{name:x==="workspace"?"globe":"lock",size:16}),title:x==="workspace"?"Workspace-visible":"Private",hint:i.jsxs(i.Fragment,{children:[x==="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?x==="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(G,{variant:"outline",size:"sm",disabled:l.action.busy,onClick:l.changeVisibility,children:x==="workspace"?"Make private":"Make workspace-visible"})}),(p||E)&&i.jsx(ie,{leading:i.jsx(ke,{name:"link",size:16}),title:E?"Anyone with the link can view":"Link sharing off",hint:p?E?"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:p?E?i.jsx(G,{variant:"outline",size:"sm",disabled:l.action.busy,onClick:R.unshareLink,children:"Turn off"}):!S&&i.jsx(G,{variant:"outline",size:"sm",disabled:l.action.busy||R.linkLoading,onClick:()=>{R.shareLink()},children:"Create link"}):m&&E&&i.jsx(G,{variant:"outline",size:"sm",disabled:l.action.busy,onClick:R.unshareLink,children:"Turn off"})}),p&&Q&&i.jsx(Ee,{children:i.jsx(ge,{label:"Share link",hint:i.jsxs(i.Fragment,{children:["Created ",i.jsx(Qn,{value:Q.createdAt})]}),children:i.jsx(In,{value:Q.url,label:"Copy share link"})})}),p&&R.linkError&&i.jsx(Ee,{children:i.jsx(ve,{error:R.linkError})}),(e.autoApprovedRequesters??[]).map(J=>i.jsx(ie,{leading:i.jsx(ke,{name:"check",size:16}),title:i.jsxs(i.Fragment,{children:["Always approves ",i.jsx(ri,{id:J,you:!0})]}),hint:e.requesterAutoApprove?`Their commands, pushes, and GitHub comments and issues here run without asking, as the owner. Merges, host commands and new permissions still ask${p?"":". Only the owner can stop it"}`:"Paused: the workspace no longer lets owners auto-approve other members' requests, so they ask again. It applies again if that's turned back on",trailing:p&&i.jsx(G,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>{P(J)},children:"Stop"})},J)),w&&!S?i.jsx(us,{title:"Session roles",hint:k.data?`${k.data.grants.length} ${k.data.grants.length===1?"person":"people"} with access`:void 0,leading:i.jsx(ke,{name:"users",size:16}),trailing:i.jsx(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh session roles",title:"Refresh session roles",disabled:k.loading,onClick:J=>{J.preventDefault(),k.refresh()}}),children:i.jsx(ut,{...k,retry:k.refresh,children:k.data&&i.jsx("form",{onSubmit:re,children:i.jsxs("fieldset",{disabled:u.busy,className:"stack",children:[i.jsx(ge,{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:$?L:"",onChange:J=>ee(J.target.value&&Mt(d.person(J.target.value))),children:[i.jsx("option",{value:"",children:"Add someone"}),k.data.grants.map(J=>i.jsxs("option",{value:J.userId,children:[Mt(d.person(J.userId)),": ",J.userId===e.ownerId?"Owner (immutable)":oO(J)]},J.userId))]})}),i.jsx(ge,{label:"Workspace member",hint:se?"The owner's access is immutable":L?U():void 0,children:i.jsx("input",{className:"input",required:!0,autoComplete:"off",spellCheck:!1,placeholder:"Username or user ID",value:z,onChange:J=>ee(J.target.value)})}),i.jsxs("fieldset",{disabled:se,className:"stack session-permissions",children:[i.jsx("legend",{className:"small muted",children:"Session role"}),ub.map(J=>{const be=le(J);return i.jsxs("label",{className:"check-row",children:[i.jsx("input",{className:"radio",type:"radio",name:"session-role",value:J,checked:M===J,disabled:!!be,onChange:()=>H(J)}),i.jsxs("span",{children:[Ro[J],I===J&&i.jsx("span",{className:"muted",children:" (current)"}),be&&i.jsxs("span",{className:"muted",children:[" (",be,")"]}),i.jsxs("span",{className:"muted small session-role-hint",children:[lO[J]," · ",Xo[J].join(", ")]})]})]},J)})]}),$&&!se&&!I&&i.jsxs("p",{className:"muted small",children:[ue," has a custom grant (",$.permissions.join(", "),") from before session roles. Choose a role to replace it."]}),te.length>1&&X&&i.jsxs("p",{className:"muted small",children:["As a ",Yd[X],", ",ue," already has ",te.join(", ")," on this ",F?"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(G,{type:"submit",variant:"secondary",size:"sm",disabled:!B,children:u.busy?"Saving...":$?"Change role":"Give role"}),$&&!se&&i.jsx(G,{variant:"outline",size:"sm",onClick:()=>{O()},children:"Remove access"})]}),x==="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(ie,{leading:i.jsx(ke,{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(Ee,{children:i.jsx(ve,{...u})})]})}function uO({session:e,actions:s,openSession:a}){const[l,c]=T.useState(0),{backup:u}=s;return i.jsxs(Te,{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(G,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh backups",title:"Refresh backups",onClick:()=>c(d=>d+1)}),i.jsx(G,{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(G,{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(ie,{title:"Backup unavailable right now",hint:"Unavailable while work is queued or running, or the live state can't be confirmed"}),u&&i.jsx(ie,{leading:i.jsx(ke,{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",Jv(u)," · ID ",i.jsx("code",{children:u.id})," · SHA-256 ",i.jsx("code",{children:u.sha256})]}),trailing:i.jsx(It,{variant:"outline",size:"sm",href:Wv(e.id,u.id),children:"Download"})}),i.jsx(rz,{sourceId:e.id,ownerId:e.ownerId,backups:s.backups,latestBackup:u,refreshKey:l,openSession:a})]})}function dO({session:e}){return i.jsx(Te,{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(ie,{leading:i.jsx(ke,{name:"archive",size:16}),title:"Session data",hint:"JSON, without secrets",trailing:i.jsx(It,{variant:"outline",size:"sm",href:`/api/sessions/${ce(e.id)}/export`,download:!0,children:"Export"})})})}function hO({session:e,changed:s}){const a=Ce(),[l,c]=T.useState(null),[u,d]=T.useState("bash"),[h,p]=T.useState(""),[m,y]=T.useState(""),[x,v]=T.useState(""),[b,w]=T.useState(""),S=Number(x),A=u==="bash"?!!h.trim():/^[^/\s]+\/[^/\s]+$/.test(m.trim())&&Number.isSafeInteger(S)&&S>0&&!!b.trim();function k(z){if(z.preventDefault(),!A||a.busy)return;const N=u==="bash"?{kind:u,command:h}:{kind:u,repository:m.trim(),issue:S,body:b};c(null),a.run(async()=>{const M=await fe(`/api/sessions/${ce(e.id)}/operations`,{method:"POST",body:N});c({id:M.approval.id,status:M.approval.status}),s()},"Operation requested. Review its approval in the session.")}return i.jsx(Te,{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(Ee,{children:i.jsx("form",{onSubmit:k,children:i.jsxs("fieldset",{disabled:a.busy,className:"stack",children:[i.jsx(ge,{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(ge,{label:"Command",children:i.jsx("textarea",{className:"textarea mono",required:!0,autoComplete:"off",value:h,onChange:z=>p(z.target.value)})}),u==="github.comment"&&i.jsxs(i.Fragment,{children:[i.jsx(ge,{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(ge,{label:"Issue number",children:i.jsx("input",{className:"input",required:!0,type:"number",min:"1",step:"1",value:x,onChange:z=>v(z.target.value)})}),i.jsx(ge,{label:"Comment",children:i.jsx("textarea",{className:"textarea",required:!0,autoComplete:"off",value:b,onChange:z=>w(z.target.value)})})]}),i.jsx("div",{className:"inline",children:i.jsx(G,{type:"submit",variant:"secondary",size:"sm",disabled:!A,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 fO({session:e,view:s,user:a}){const l=e.visibility??"private";return i.jsxs(Te,{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 ",kt," 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(ie,{leading:i.jsx(ke,{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(ie,{leading:i.jsx(ke,{name:"git-branch",size:16}),title:"Commits as",hint:i.jsxs(i.Fragment,{children:[s.owner.gitName," <",s.owner.gitEmail,">"]})})]}):i.jsx(ie,{title:i.jsx(Bt,{children:"Loading identity..."})}),i.jsx(Ee,{children:i.jsx(ge,{label:"Session ID",children:i.jsx(In,{value:e.id,label:"Copy session ID"})})})]})}const fw="Context compaction failed",mO={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 mw(e,s={}){const a=mO[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 pO(e){const[s,a]=T.useState(null),[l,c]=T.useState(null),[u,d]=T.useState(""),[h,p]=T.useState("connecting"),[m,y]=T.useState(0),x=T.useRef(()=>{}),v=T.useRef(async()=>{}),b=T.useCallback(()=>x.current(),[]),w=T.useCallback(A=>v.current(A),[]),S=T.useCallback(()=>y(A=>A+1),[]);return T.useEffect(()=>{p("connecting");const A=sS(e,{session:a,view:c,error:d,status:p});return x.current=A.refresh,v.current=A.loadOlder,()=>{A.stop(),x.current=()=>{},v.current=async()=>{}}},[e,m]),{session:s,view:l,error:u,status:h,refresh:b,loadOlder:w,reconnect:S}}const Mx="pikibun.sessionPanel",Lx="(min-width: 1100px)";function gO(){const[e,s]=T.useState(()=>{if(!window.matchMedia(Lx).matches)return!1;try{const l=localStorage.getItem(Mx);if(l)return l==="open"}catch{}return!0}),a=T.useCallback(l=>{if(s(l),!!window.matchMedia(Lx).matches)try{localStorage.setItem(Mx,l?"open":"closed")}catch{}},[]);return[e,a]}function yO({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 _x({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(ke,{name:s,size:14}),i.jsx("span",{className:"truncate",children:a}),c,i.jsx(ke,{name:"chevron-right",size:14})]}),i.jsx("pre",{children:l}),u&&i.jsx(xO,{trimmed:u})]})}function xO({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 bO(e){return e.trimmed&&e.role==="toolResult"&&e.text.trim()?i.jsxs("span",{className:"muted",children:[" · ",e.text]}):null}function Ux({entry:e,actions:s}){const[a,l]=T.useState(!1);T.useEffect(()=>{if(!a)return;const m=window.setTimeout(()=>l(!1),1500);return()=>window.clearTimeout(m)},[a]);const c=Z1(e),u=s&&P1(e),d=u&&s?.revert,h=u&&s?.fork;if(!c&&!d&&!h)return null;const p=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(G,{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(G,{variant:"ghost",size:"xs",icon:"history","aria-label":p,title:d.disabled||p,disabled:!!d.disabled,onClick:()=>d.run(e,u)}),h&&i.jsx(G,{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 vO({entry:e,userId:s,actions:a}){const l=e.actorId&&i.jsx(ri,{id:e.actorId,you:!0}),{prose:c,calls:u}=e.role==="assistant"?Wo(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 p=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:_o(e.durationMs)})]});return i.jsx(_x,{role:e.role,icon:d?"tool":"terminal",label:i.jsxs(i.Fragment,{children:[p,m,l&&i.jsxs(i.Fragment,{children:[" · ",l]}),bO(e)]}),text:e.text,badges:i.jsx(Dx,{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(xe,{variant:"error",title:fw,children:mw(e.error.compaction)}):i.jsx(xe,{variant:"error",title:"Model request failed",children:yO(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(Ux,{entry:e,actions:a})]})]});const h=e.durationMs!==void 0&&i.jsx("span",{title:"How long the model took to reply",children:_o(e.durationMs)});return i.jsxs("div",{className:"entry-assistant","data-role":e.role,title:e.kind,children:[i.jsx(Fv,{text:c}),d&&i.jsx(_x,{icon:"tool",label:d,text:u.map(p=>p.line).join(`
|
|
51
|
-
`),badges:i.jsx(Dx,{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(Ux,{entry:e,actions:a})]})]})}function wO({sessionId:e}){return i.jsx(jO,{id:e},e)}function jO({id:e}){const{user:s,workspaces:a,sessions:l,refreshSessions:c,setLiveActivity:u}=vt(),d=pO(e),h=d.session,p=d.view,m=Ie(`/api/sessions/${ce(e)}/audit`),[y,x]=gO(),[v,b]=T.useState("details"),w=h?.permissions??[],S=w.includes("write");w.includes("ask");const A=h?.status==="archived",k=h?.frozen===!0,z=w.includes("approve")&&!A&&!k,N=h?.ownerId===s.id,[M,H]=T.useState(!1),L=Qr(h?.connectorId?`/api/workspaces/${ce(h.workspaceId)}/connectors`:null),P=L.data?.connectors.find(de=>de.id===h?.connectorId),ue=P?.online,se=T.useRef(ue);T.useEffect(()=>{se.current===!1&&ue&&d.refresh(),se.current=ue},[ue,d.refresh]);const $=p?.activity;T.useEffect(()=>{u($?{sessionId:e,activity:$}:null)},[e,$,u]),T.useEffect(()=>()=>{u(null),c()},[u,c]);const I=(p?.queue??[]).filter(de=>Ho.includes(de.status)),X=T.useCallback(()=>{d.refresh(),m.refresh(),c()},[d.refresh,m.refresh,c]),le=h?a.find(de=>de.id===h.workspaceId)?.role:void 0,te=!!(h&&Rh(s.id,h.ownerId,le)),F=Pz({session:h,user:s,manages:te,backupBlocked:A||k||!p||!!d.error||p.busy||I.length>0,onChange:X}),B=T.useCallback(de=>{c(),ds({name:"session",sessionId:de})},[c]),U=Ce(),ee=h??l.find(de=>de.id===e),re=Ob(ee?.workspaceId??null),O=ee&&a.find(de=>de.id===ee.workspaceId)?.name,R=l.find(de=>de.id===e)?.pullRequest??h?.pullRequest,Q=h?.visibility??"private",E=d.status==="online"?i.jsx(Ae,{tone:"success",dot:!0,children:"Live"}):d.status==="reconnecting"?i.jsx(Ae,{tone:"warning",dot:!0,children:"Reconnecting"}):d.status==="offline"?i.jsx(Ae,{tone:"danger",dot:!0,children:"Disconnected"}):i.jsx(Ae,{tone:"neutral",dot:!0,children:"Connecting"}),J=[{label:"Copy session ID",icon:"copy",onSelect:()=>{navigator.clipboard.writeText(e)}}];h&&te&&!A&&(J.push({label:"Rename",icon:"pencil",disabled:F.action.busy,onSelect:()=>H(!0)}),J.push({label:Q==="workspace"?"Make private":"Make workspace-visible",icon:Q==="workspace"?"lock":"globe",disabled:F.action.busy,onSelect:F.changeVisibility}),N&&!k&&(J.push({label:"Create backup",icon:"archive",disabled:F.backupsOff||F.backupsPending||F.backupBlocked||F.action.busy,hint:F.backupsOff?"Backups are off":F.backupBlocked?"Session busy":void 0,onSelect:()=>F.createBackup()}),J.push({label:"Back up conversation only",icon:"archive",disabled:F.backupsOff||F.backupsPending||F.backupBlocked||F.conversationOnlyOff||F.action.busy,hint:F.backupsOff?"Backups are off":F.backupBlocked?"Session busy":F.conversationOnlyOff?"Update the host's connector":void 0,onSelect:()=>F.createBackup({conversationOnly:!0})})),J.push({label:"Archive",icon:"archive",disabled:F.action.busy,onSelect:F.archive})),h&&te&&A&&(J.push({label:"Unarchive",icon:"archive",disabled:F.action.busy||!!h.packed&&!N,onSelect:F.unarchive}),N&&!h.packed&&!k&&!h.hostEnvironment&&J.push({label:"Pack files",icon:"archive",disabled:F.action.busy,onSelect:F.pack})),ee&&J.push("separator",{label:"Open in workspace settings",icon:"settings",onSelect:()=>ds({name:"settings",section:"workspaces",id:ee.workspaceId})});function be(de){if(!h||A||k)return!1;if(bh(de.operation,h,de.unbounded))return JE(de.operation,h,P,s.id,w.includes("approve"));const ht=de.operation.kind==="permission"||de.operation.kind==="git.repin";return z&&(!ht||N)}async function ye(de,ht,Lt,Zt=!1){if(!be(de)||U.busy||!de.reviewHash||de.status!=="pending")return;const Wt=de.operation.kind==="permission"?ht==="deny"?"Not allowed":Lt==="session"?"Allowed for the rest of the session":"Allowed for this call":Zt?`Approved. ${Us(re.person(de.requestedBy))}'s requests here now run without asking; stop it under Details › People.`:ht==="approve"?"Approval decision recorded":"Operation denied";await U.run(async()=>{await fe(`/api/sessions/${ce(e)}/approvals/${ce(de.id)}`,{method:"POST",body:{decision:ht,reviewHash:de.reviewHash,...Lt?{scope:Lt}:{},...Zt?{alwaysApprove:!0}:{}}}),d.refresh(),m.refresh()},Wt)}const Me=!p&&!!(h&&(h.status==="error"||h.status==="provisioning")),Xe=Me?i.jsx(Ae,{tone:h?.status==="error"?"danger":"running",dot:!0,children:h?.status==="error"?"Not started":"Starting"}):!p&&d.error?i.jsx(Ae,{tone:"warning",dot:!0,children:"Unavailable"}):E;return i.jsx(n1,{people:re,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(Zo,{leading:i.jsx(tz,{}),title:ee?.title??"Session",subtitle:O,actions:i.jsxs(i.Fragment,{children:[h&&i.jsxs("span",{className:"session-badges",children:[A?i.jsx(Ae,{tone:"neutral",children:"Archived"}):Xe,h.packed&&i.jsx(Ae,{tone:"neutral",children:"Files packed"}),i.jsx(Ae,{children:Q==="workspace"?"Workspace-visible":"Private"}),h.linkShared&&i.jsx(Ae,{tone:"info",children:"Link shared"})]}),h&&R&&i.jsx(IE,{pull:R}),h&&i.jsx(G,{variant:"ghost",size:"xs",icon:"panel-right","aria-label":"Toggle session panel",title:"Session panel","aria-pressed":y,onClick:()=>x(!y)}),i.jsx(Wn,{label:"Session actions",items:J})]})}),(A||k||h?.cloneUnavailable||d.error&&!Me||F.action.error||F.action.notice)&&i.jsxs("div",{className:"session-alerts",children:[k&&!A&&i.jsx(xe,{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(xe,{variant:"warning",title:"Can't clone repositories",children:h.cloneUnavailable}),A&&i.jsxs(xe,{title:"Archived",actions:te&&(!h?.packed||N)&&i.jsx(G,{variant:"outline",size:"sm",disabled:F.action.busy,onClick:F.unarchive,children:"Unarchive"}),children:["This session is read-only. ",h?.packed?N?"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.":te?"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(xe,{variant:"error",title:h?"Live updates interrupted":"Unable to open session",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:d.reconnect,children:"Reconnect and check access"}),children:d.error}),i.jsx(ve,{...F.action})]}),p?h&&i.jsx(SO,{id:e,user:s,session:h,view:p,host:P,stale:!!d.error,refresh:d.refresh,loadOlder:d.loadOlder,openSession:B,pinned:i.jsxs(i.Fragment,{children:[p.repositories&&i.jsx(YE,{sessionId:e,preparation:p.repositories,canRestart:N&&!A&&w.includes("manage"),onRestarted:X}),h.hostUnsandboxed&&(S||z)&&(h.hostEnvironment?i.jsx(xe,{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(xe,{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."})),p.approvals.filter(de=>de.status==="pending").map(de=>{const ht=de.operation.kind==="permission",Lt=XE(de.operation,h),Zt=bh(de.operation,h,de.unbounded),Wt=ht||de.operation.kind==="git.repin",yt=U.busy||!de.reviewHash;return i.jsx(dw,{approval:de,children:be(de)?i.jsxs(i.Fragment,{children:[!de.reviewHash&&i.jsx(xe,{variant:"warning",title:"No verified review commitment",actions:i.jsx(G,{variant:"outline",size:"sm",disabled:U.busy,onClick:d.refresh,children:"Refresh approval"}),children:"Refresh before deciding; the server must bind the displayed operation and requester."}),ht?i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"default",size:"sm",disabled:yt,onClick:()=>{ye(de,"approve","call")},children:"Allow once"}),!(de.operation.kind==="permission"&&de.operation.tool==="host_bash")&&i.jsx(G,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ye(de,"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(G,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ye(de,"deny")},children:"Deny"})]}):i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"default",size:"sm",disabled:yt,onClick:()=>{ye(de,"approve")},children:"Approve"}),QE(de,h,P,s.id)&&i.jsxs(G,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ye(de,"approve",void 0,!0)},title:`Approves this and runs ${Us(re.person(de.requestedBy))}'s later commands, pushes, and GitHub comments and issues in this session without asking, as you. Merges, host commands and new permissions still ask. Stop it any time under Details › People.`,children:["Always approve ",Us(re.person(de.requestedBy))]}),i.jsx(G,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ye(de,"deny")},children:"Deny"}),i.jsxs("span",{className:"muted small",children:["Runs as ",Lt?"the host OS user (outside the sandbox)":p.owner.displayName," · each approval covers one exact operation and its arguments"]})]})]}):i.jsx("p",{className:"muted small",children:Zt?WE(de.operation,P):Wt?"Waiting for the session owner":"Waiting for an authorized approver"})},de.id)}),i.jsx(ve,{...U})]})}):d.error?h?i.jsx(CO,{id:e,user:s,session:h,error:d.error,recovered:()=>{d.reconnect(),c()}}):i.jsx("div",{className:"session-transcript"}):i.jsx(oi,{})]}),h&&y&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"session-scrim","aria-label":"Close session panel",onClick:()=>x(!1)}),i.jsx(Zz,{session:h,view:p,user:s,workspaceRole:le,hosts:L,tab:v,setTab:b,onClose:()=>x(!1),refresh:d.refresh,audit:m,actions:F,openSession:B})]}),h&&te&&i.jsx(kO,{open:M,title:h.title,busy:F.action.busy,onClose:()=>H(!1),onSave:async de=>{await F.rename(de)&&H(!1)}})]})})}function kO({open:e,title:s,busy:a,onClose:l,onSave:c}){const[u,d]=T.useState(s);T.useEffect(()=>{e&&d(s)},[e,s]);const h=u.trim();function p(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(G,{variant:"ghost",onClick:l,children:"Cancel"}),i.jsx(G,{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:p,children:i.jsx(ge,{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 SO({id:e,user:s,session:a,view:l,host:c,stale:u,refresh:d,loadOlder:h,openSession:p,pinned:m}){const y=a.ownerId===s.id,[x,v]=T.useState(()=>Q0(l,y)),[b,w]=T.useState("write"),[S,A]=Nb(e),k=mb(fb(c),()=>_0(e));T.useEffect(()=>{U0(e)},[e]),M0(e,k);const[z,N]=T.useState(""),M=T.useRef(null),H=T.useRef(!1),L=Ce(),P=Ce(),ue=Ce(),[se,$]=T.useState(""),I=T.useRef(!0);T.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const[X,le]=T.useState(null),te=T.useRef(null),F=T.useRef(!0),[B,U]=T.useState(!1),ee=T.useRef(!1),re=T.useRef(void 0),O=a.permissions??[],R=O.includes("write"),Q=O.includes("ask"),E=b==="ask"&&!Q?"write":b,J=a.status==="archived",be=a.frozen===!0,ye=!J&&!be&&(E==="write"?R:Q),Me=!!(a.hostUnsandboxed||c?.capabilities.unsandboxed),Xe=l.queue??[],de=Xe.filter(he=>Ho.includes(he.status)),ht=Xe.filter(he=>!Ho.includes(he.status)).slice(-5).reverse(),Lt=!!l.stoppable&&!J&&R&&de.length>0,Zt=Xe.some(he=>he.status==="stopping"),Wt=l.withdrawable&&!J&&!be?de.filter(he=>he.actorId===s.id&&he.status==="queued"&&(he.mode==="ask"?Q:R)):[],yt=k.images.length>0,Gn=l.conversations,Ne=Gn.filter(he=>he.mode==="ask"&&(!he.actorId||he.actorId===s.id)),et=l.entries.filter(he=>{if(he.role==="system"&&!he.text.trim())return!1;const we=Gn.find(mt=>mt.id===he.conversationId);return E==="ask"?we?.mode==="ask"&&(!we.actorId||we.actorId===s.id)&&(!z||he.conversationId===z):we?.mode!=="ask"}),Nn=et.at(-1)?.id,yn=et[0]?.id,en=Gn.filter(he=>(he.olderEntries??0)>0&&(E==="ask"?he.mode==="ask"&&(!he.actorId||he.actorId===s.id)&&(!z||he.id===z):he.mode!=="ask")),Fn=en.reduce((he,we)=>he+(we.olderEntries??0),0),[En,Gs]=T.useState(!1),Tt=T.useRef(null);function Fs(){if(En||!en.length)return;const he=te.current;Tt.current=he?{first:yn,height:he.scrollHeight,top:he.scrollTop}:null,Gs(!0),Promise.all(en.map(we=>h(we.id))).finally(()=>Gs(!1))}T.useLayoutEffect(()=>{const he=te.current;he&&F.current&&(he.scrollTop=he.scrollHeight)},[Nn,et.length]),T.useEffect(()=>{const he=te.current;if(!he||typeof ResizeObserver>"u")return;const we=()=>{F.current&&(he.scrollTop=he.scrollHeight)},mt=new ResizeObserver(we);return mt.observe(he),he.firstElementChild&&mt.observe(he.firstElementChild),()=>mt.disconnect()},[]);function Ui(he){const we=he.scrollHeight-he.scrollTop-he.clientHeight;F.current=we<80;const mt=we>240;U(rn=>rn===mt?rn:mt)}function W(){ee.current=!1,window.clearTimeout(re.current),re.current=void 0}T.useEffect(()=>()=>window.clearTimeout(re.current),[]);function pe(){const he=te.current;he&&(F.current=!0,ee.current=!0,U(!1),he.scrollTo({top:he.scrollHeight,behavior:"smooth"}),window.clearTimeout(re.current),re.current=window.setTimeout(()=>{W(),te.current&&Ui(te.current)},1e3))}function De(){ee.current&&(W(),te.current&&Ui(te.current))}T.useLayoutEffect(()=>{F.current=!0,Tt.current=null;const he=te.current;he&&(he.scrollTop=he.scrollHeight)},[E,z]),T.useLayoutEffect(()=>{const he=te.current,we=Tt.current;!he||!we||we.first===yn||(Tt.current=null,!(we.first===void 0||!et.some(mt=>mt.id===we.first))&&(he.scrollTop=we.top+he.scrollHeight-we.height))},[yn]);async function Le(he){he?.preventDefault();const we=k.images;if(!ye||!S.trim()&&!we.length||L.busy||H.current)return;const mt=bb(c,x,E==="ask"?"ask":"submit"),rn=K0(c,x,E==="ask"?"ask":"submit")??J0(c,x);if(!rn&&c&&wb(mt,Cb())&&(H.current=!0,!await Mh(c,Me).finally(()=>{H.current=!1}))){v(ei=>({...ei,access:"approval"}));return}le(null),$("");const di=S,tl=`${E}:${JSON.stringify(mt??null)}:${we.map(hi=>hi.id).join(",")}:${di}`;M.current?.key!==tl&&(M.current={key:tl,id:crypto.randomUUID()});const _a=M.current;F.current=!0,L.run(async()=>{if(rn)throw new Error(rn);const hi=_a.images??=await yb(we),ei=await fe(`/api/sessions/${ce(e)}/${E==="ask"?"ask":"submit"}`,{method:"POST",body:{content:di,requestId:_a.id,...mt?{options:mt}:{},...hi.length?{images:hi}:{}}});le(ei),mt&&kb(c,x,l.agent),E==="ask"&&N(ei.conversationId),Tb(e,di),k.sent(we),M.current=null,d()})}function _t(he){ue.busy||L.busy||yt||($(""),ue.run(async()=>{const we=await fe(`/api/sessions/${ce(e)}/withdraw`,{method:"POST",body:{submissionId:he}});e1(e,we.content),L0(e,B0(we.images??[])),I.current&&(we.imagesLost&&$("Its images were no longer on the host: attach them again before sending."),w(we.mode),F.current=!0,d())}))}function tt(){!Lt||P.busy||P.run(async()=>{await fe(`/api/sessions/${ce(e)}/stop`,{method:"POST",body:{}}),d()})}const st=Ce(),ft=l.busy||de.length>0,St=Y1(l)&&E==="write"&&!J&&!be&&(R||y)?{...R?{revert:{run:ui,disabled:st.busy?"Working...":ft?"Stop the session's work to go back to an earlier message":void 0}}:{},...y?{fork:{run:Ps,disabled:st.busy?"Working...":void 0}}:{}}:void 0;async function ui(he,we){st.busy||!await qe({title:we.before?"Go back to before this message?":"Go back to this reply?",message:i.jsxs(i.Fragment,{children:[we.before?"This message and everything after it leave":"Everything after this reply leaves"," the shared conversation, for everyone, and the agent continues from there.",we.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})||st.run(async()=>{await fe(`/api/sessions/${ce(e)}/revert`,{method:"POST",body:{entryId:we.entryId}}),we.before&&!Bo(e).trim()&&A(zy(he)),F.current=!0,d()})}async function Ps(he,we){st.busy||!await qe({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 ",we.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"})||st.run(async()=>{const rn=await fe(`/api/sessions/${ce(e)}/fork`,{method:"POST",body:{entryId:we.entryId}});we.before&&Xr(rn.session.id,zy(he)),p(rn.session.id)})}const fs=!!S.trim()&&$1(S)!==S,Nt=PE(l)?i.jsxs(i.Fragment,{children:[i.jsx(Ls,{}),"Preparing repositories...",de.length>0&&i.jsxs("span",{className:"muted",children:[" · ",de.length," queued"]})]}):Zt?i.jsxs(i.Fragment,{children:[i.jsx(Ls,{}),"Stopping...",de.length>0&&i.jsxs("span",{className:"muted",children:[" · ",de.length," queued"]})]}):l.busy?i.jsxs(i.Fragment,{children:[i.jsx(Ls,{}),l.activity==="waiting"?"Waiting for a decision":"Working","...",de.length>0&&i.jsxs("span",{className:"muted",children:[" · ",de.length," queued"]})]}):de.length?i.jsxs(i.Fragment,{children:[de.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:te,onWheel:De,onTouchStart:De,onKeyDown:De,onScroll:he=>{const we=he.currentTarget;if(ee.current)if(we.scrollHeight-we.scrollTop-we.clientHeight<80)W();else return;Ui(we),we.scrollTop<240&&Fn>0&&Fs()},"aria-label":E==="ask"?"Side ask history":"Shared session history",children:i.jsxs("div",{className:"chat-column",children:[Fn>0&&i.jsx("div",{className:"transcript-earlier",children:i.jsx(G,{variant:"ghost",size:"sm",icon:"chevron-up",disabled:En,onClick:Fs,children:En?"Loading earlier messages...":`Show earlier messages (${Fn})`})}),et.length?et.map(he=>i.jsx(vO,{entry:he,userId:s.id,actions:St},he.id)):i.jsx(bt,{title:E==="ask"?"A question on the side":"The conversation begins here",children:E==="ask"?"Ask about the work without changing it":"Committed messages and tool results will appear here"})]})}),B&&i.jsx(G,{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:pe})]}),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:[Nt,i.jsx(ke,{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."}),X&&i.jsxs("p",{className:"small",children:["Last receipt ",i.jsx("code",{children:X.submissionId})," · ",X.status,X.queuePosition!==void 0?` · queue position ${X.queuePosition}`:""]}),de.length>0&&i.jsx("ol",{className:"queue-items",children:de.map((he,we)=>i.jsxs("li",{children:[i.jsxs("span",{children:[we+1,". ",he.mode==="ask"?"Read-only side ask":"Shared submission"," · ",he.status]}),i.jsxs("span",{className:"muted small",children:["By ",i.jsx(ri,{id:he.actorId,you:!0})," · Receipt ",i.jsx("code",{children:he.submissionId})]}),Wt.includes(he)&&i.jsx("span",{className:"inline",children:i.jsx(G,{variant:"outline",size:"xs",icon:"pencil",disabled:ue.busy||L.busy||yt,title:yt?"Remove the images from your chat box to edit this message there":"Take this message out of the queue and back into your chat box",onClick:()=>_t(he.submissionId),children:"Edit"})})]},he.submissionId))}),ht.length>0&&i.jsx("ul",{className:"queue-items",children:ht.map(he=>i.jsxs("li",{children:[i.jsxs("span",{children:[he.status," · ",he.mode==="ask"?"Side ask":"Shared submission"]}),i.jsxs("span",{className:"muted small",children:["By ",i.jsx(ri,{id:he.actorId,you:!0})," · Receipt ",i.jsx("code",{children:he.submissionId})]})]},he.submissionId))}),i.jsx("div",{className:"inline",children:i.jsx(G,{variant:"outline",size:"sm",icon:"refresh",onClick:d,children:"Refresh queue"})})]})]})]})}),i.jsxs("div",{className:"chat-column stack",children:[i.jsx(pw,{value:S,onChange:A,onSubmit:Le,attachments:k,busy:L.busy,disabled:!ye,onStop:Lt?tt:void 0,stopping:P.busy,onRecall:ye&&Wt.length&&!yt?()=>_t(Wt.at(-1).submissionId):void 0,label:E==="ask"?"Ask without making changes":"Continue the shared work",placeholder:ye?Wt.length&&!yt?"Press ↑ to edit your queued message":E==="ask"?"Ask without changing anything":"Message the agent":"Read-only",sendLabel:E==="ask"?"Send side ask":"Submit to session",hintRequired:!ye||E==="ask",hint:J?"Read-only · this session is archived":be?"Read-only · this session pinned its repositories when it started":ye?E==="ask"?"Read-only · anyone who can view this session can see side asks":`Runs as ${l.owner.displayName}${l.owner.id===s.id?" (you)":""}`:Q?"Read-only · switch to Side ask to ask questions":"Read-only · submitting needs write permission",tools:i.jsxs(i.Fragment,{children:[Q&&i.jsx(Is,{size:"xs",label:"Conversation mode",value:E,onChange:w,options:[{value:"write",label:"Shared"},{value:"ask",label:"Side ask"}]}),E==="ask"&&Ne.length>0&&i.jsx(Vt,{label:"Side conversation",side:"above",value:z,onChange:N,options:[{value:"",label:"All my side asks"},...Ne.map((he,we)=>({value:he.id,label:`Side ask ${we+1}`,hint:he.id.slice(0,8)}))]}),ye&&i.jsx(Ab,{host:c,value:x,onChange:v,owner:y,showAccess:E==="write",unsandboxed:Me})]})}),fs&&i.jsxs("p",{className:"muted small",role:"status",children:["This message looks like it holds a secret. Everyone, you included, sees it as ",kt," in the transcript, but the agent and its host receive it as typed."]}),i.jsx(ve,{error:L.error||P.error||ue.error||st.error,notice:se})]})]})]})}function pw({value:e,onChange:s,onSubmit:a,attachments:l,onStop:c,stopping:u,onRecall:d,busy:h,disabled:p,label:m,placeholder:y,sendLabel:x,hint:v,hintRequired:b,tools:w}){const[S]=T.useState(()=>lb()),A=!!(e.trim()||l?.images.length),k=T.useRef(null);T.useLayoutEffect(()=>{const M=k.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[e]);function z(M){M?.preventDefault(),!p&&!h&&A&&a()}function N(M){S&&M.key==="Enter"&&!M.shiftKey&&!M.nativeEvent.isComposing?z(M):d&&M.key==="ArrowUp"&&!M.shiftKey&&!M.altKey&&!M.ctrlKey&&!M.metaKey&&!M.nativeEvent.isComposing&&!p&&!h&&!e&&!l?.images.length&&(M.preventDefault(),d())}return i.jsxs("form",{className:"composer",onSubmit:z,children:[l&&i.jsx(gb,{attachments:l,disabled:h||p}),i.jsx("textarea",{ref:k,rows:1,required:!l?.images.length,value:e,disabled:h||p,"aria-label":m,placeholder:y,enterKeyHint:S?"send":"enter",onChange:M=>s(M.target.value),onKeyDown:N,onPaste:l?.paste}),l?.notice&&i.jsx("p",{className:"composer-notice",role:"status",children:l.notice}),i.jsxs("div",{className:"composer-toolbar",children:[(l&&!p||w)&&i.jsxs("span",{className:"composer-tools",children:[l&&!p&&i.jsx(pb,{attachments:l,disabled:h}),w]}),i.jsx("span",{className:b?"composer-hint required":"composer-hint",children:v}),i.jsxs("span",{className:"composer-actions",children:[c&&i.jsx(G,{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(G,{type:"submit",variant:"default",size:"sm",icon:"send",className:"composer-send","aria-label":h?"Sending...":x,title:x,disabled:h||p||!A})]})]})]})}function CO({id:e,user:s,session:a,error:l,recovered:c}){const[u,d]=Nb(e),h=T.useRef(null),p=Ce(),m=a.status==="error"||a.status==="provisioning",y=m&&a.ownerId===s.id&&!!a.permissions?.includes("manage"),x=!!a.permissions?.includes("write");function v(){const S=u;h.current?.content!==S&&(h.current={content:S,id:crypto.randomUUID()});const A=h.current.id;p.run(async()=>{await fe(`/api/sessions/${ce(e)}/restart`,{method:"POST"});try{await fe(`/api/sessions/${ce(e)}/submit`,{method:"POST",body:{content:S,requestId:A}})}catch(k){throw Xr(e,S),c(),k}h.current=null,Tb(e,S),c()})}const b=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.":x?"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(bt,{title:b,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(pw,{value:u,onChange:d,onSubmit:v,busy:p.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:p.busy?"Starting the session and preparing repositories...":y?"Restarts the session, then sends":m?"Only the owner can restart this session":x?"Waiting for the host":"Read-only — submitting needs write permission"}),i.jsx(ve,{error:p.error})]})})]})}const Bx={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 gw(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(Bx,s)?Bx[s]:{tone:"success"}}function yw(e){const s=new Set(e.map(h=>h.id)),a=new Map,l=[];for(const h of e){const p=h.parentSessionId;if(p&&s.has(p)&&p!==h.id){const m=a.get(p);m?m.push(h):a.set(p,[h])}else l.push(h)}const c=[],u=new Set,d=(h,p)=>{if(!u.has(h.id)){u.add(h.id),c.push({session:h,depth:p});for(const m of a.get(h.id)??[])d(m,Math.min(p+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 Hx=50;function AO(){const{user:e,sessions:s,sessionsLoading:a,workspaces:l,currentWorkspace:c}=vt(),[u,d]=T.useState(""),[h,p]=T.useState({}),[m,y]=T.useState(!1),[x,v]=T.useState(!1),b=T.useMemo(()=>s.filter(k=>k.status==="archived").length,[s]),w=T.useMemo(()=>{const k=u.trim().toLowerCase(),z=new Map;for(const H of s){if(H.status==="archived"&&!x||k&&!H.title.toLowerCase().includes(k))continue;const L=z.get(H.workspaceId);L?L.push(H):z.set(H.workspaceId,[H])}const N=[c?.id,...l.map(H=>H.id)],M=H=>{const L=N.indexOf(H);return L<0?N.length:L};return[...z.entries()].sort(([H],[L])=>M(H)-M(L)).map(([H,L])=>({id:H,name:l.find(P=>P.id===H)?.name??"Other workspace",sessions:L}))},[s,u,x,l,c?.id]),S=i.jsx(Zo,{title:"Sessions",actions:i.jsxs(i.Fragment,{children:[i.jsx(Hr,{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."})]})}),b>0&&i.jsx(G,{variant:"ghost",size:"sm",icon:"archive","aria-pressed":x,onClick:()=>v(k=>!k),children:x?"Hide archived":`Show archived (${b})`}),i.jsx(G,{variant:"outline",size:"sm",onClick:()=>y(!0),children:"Open by ID"})]})}),A=i.jsx(TO,{open:m,onClose:()=>y(!1)});return a?i.jsxs(i.Fragment,{children:[S,i.jsx(oi,{}),A]}):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]??Hx;return i.jsxs(Te,{title:i.jsxs("span",{className:"inline",children:[i.jsx(Mi,{name:k.name,id:k.id}),k.name]}),children:[yw(k.sessions).slice(0,z).map(({session:N,depth:M})=>{const H=N.ownerId===e.id,L=!H&&N.permissions?.includes("read")&&N.permissions.every(ue=>ue==="read"),P=gw(N);return i.jsx(ie,{href:Ze({name:"session",sessionId:N.id}),chevron:!0,leading:i.jsx(cs,{tone:P.tone,icon:P.icon,label:P.label?void 0:N.status}),title:i.jsxs("span",{className:"truncate",children:[M>0&&i.jsxs("span",{className:"muted","aria-label":"Started by the session above",children:[" ".repeat(M-1),"↳ "]}),N.title]}),hint:i.jsxs(i.Fragment,{children:[P.label&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`session-status ${P.tone}`,children:P.label})," · "]}),N.pullRequest&&i.jsxs(i.Fragment,{children:[i.jsx(Zv,{pull:N.pullRequest})," · "]}),H?"Yours":L?"Viewer":"Shared"," · ",N.visibility==="workspace"?"Workspace-visible":"Private"," · ",i.jsx(Qn,{value:N.createdAt})]})},N.id)}),k.sessions.length>z&&i.jsx("div",{className:"sessions-more",children:i.jsx(G,{variant:"ghost",size:"sm",block:!0,onClick:()=>p(N=>({...N,[k.id]:z+Hx})),children:"Load more"})})]},k.id)}):i.jsx(bt,{title:!u.trim()&&!x?"All sessions are archived":"No matching sessions"})]}),A]}):i.jsxs(i.Fragment,{children:[S,i.jsx(bt,{title:"No sessions yet",action:c&&i.jsx(It,{variant:"ghost",href:Ze({name:"new",workspaceId:c.id}),children:"Start a session"})}),A]})}function TO({open:e,onClose:s}){const[a,l]=T.useState(""),c=Ce();function u(d){d.preventDefault(),!(!a.trim()||c.busy)&&c.run(async()=>{const h=await fe(`/api/sessions/${ce(a.trim())}`);s(),l(""),ds({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(G,{variant:"ghost",onClick:s,children:"Cancel"}),i.jsx(G,{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(ge,{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(ve,{error:c.error})]})})}function of(){const e=typeof window>"u"?void 0:window.pikibunDesktop;return e&&e.version===1?e:void 0}async function An(e){const s=await e;if(s&&!s.ok)throw new Error(s.error)}function NO(){const e=of(),[s,a]=T.useState(null),[l,c]=T.useState(""),u=T.useCallback(()=>{e&&e.view().then(d=>{a(d),c("")},()=>c("Pikibun's app settings are unavailable on this page."))},[e]);return T.useEffect(()=>{if(e)return u(),e.onUpdate(a)},[e,u]),{bridge:e,view:s,error:l,reload:u}}function Ri(e,s,a){return`${e.toLocaleString()} ${e===1?s:a}`}function Vd(e,...s){const a=s.filter(Boolean).join(" ").toLowerCase();return e.toLowerCase().split(/\s+/).filter(Boolean).every(l=>a.includes(l))}function Zd({list:e}){return e?.truncated?i.jsx(Ee,{children:i.jsxs("span",{className:"muted small",children:["Only the newest ",e.items.length.toLocaleString()," are listed"]})}):null}function EO(){const e=Ie("/api/admin/overview"),s=Ie("/api/admin/users"),a=Ie("/api/admin/workspaces"),l=Ie("/api/admin/hosts"),[c,u]=T.useState(""),d=Ce(),h=e.data?.overview;function p(){e.refresh(),s.refresh(),l.refresh()}async function m(w){await qe({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 fe(`/api/admin/users/${ce(w.id)}/suspend`,{method:"POST"}),p()},"Account suspended.")}function y(w){d.run(async()=>{await fe(`/api/admin/users/${ce(w.id)}/unsuspend`,{method:"POST"}),p()},"Account unsuspended. They can sign in again and their hosts reconnect.")}const x=(s.data?.items??[]).filter(w=>Vd(c,w.displayName,w.githubLogin,w.id)),v=(a.data?.items??[]).filter(w=>Vd(c,w.name,w.ownerName,w.ownerGithubLogin,w.ownerId,w.id)),b=(l.data?.items??[]).filter(w=>Vd(c,w.name,w.ownerName,w.ownerGithubLogin,w.ownerId,w.id));return i.jsxs(i.Fragment,{children:[i.jsx(Te,{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(ut,{...e,retry:e.refresh,children:h&&i.jsxs(i.Fragment,{children:[i.jsx(ie,{title:"Accounts",trailing:i.jsxs(i.Fragment,{children:[h.users.toLocaleString(),h.suspendedUsers>0&&i.jsxs(Ae,{tone:"danger",children:[h.suspendedUsers.toLocaleString()," suspended"]})]})}),i.jsx(ie,{title:"Workspaces",trailing:h.workspaces.toLocaleString()}),i.jsx(ie,{title:"Hosts",trailing:`${h.onlineHosts.toLocaleString()} online of ${h.hosts.toLocaleString()}`}),i.jsx(ie,{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(Te,{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(ut,{...s,retry:s.refresh,children:[x.length?x.map(w=>i.jsx(ie,{leading:i.jsx(Mi,{name:w.displayName,id:w.id}),title:w.displayName,hint:i.jsxs(i.Fragment,{children:[Mt(w)," · ",Ri(w.workspaces,"workspace","workspaces")," · ",Ri(w.hosts,"host","hosts")," · ",Ri(w.sessions,"session","sessions")," · Joined ",i.jsx(Qn,{value:w.createdAt})]}),trailing:i.jsxs(i.Fragment,{children:[w.instanceAdmin&&i.jsx(Ae,{tone:"success",children:"Administrator"}),w.suspendedAt&&i.jsx(Ae,{tone:"danger",children:"Suspended"}),!w.instanceAdmin&&i.jsx(Wn,{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(Ee,{children:i.jsx("span",{className:"muted",children:c.trim()?"No matching accounts":"No accounts"})}),i.jsx(Zd,{list:s.data}),(d.error||d.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...d})})]})}),i.jsx(Te,{title:"Workspaces",children:i.jsxs(ut,{...a,retry:a.refresh,children:[v.length?v.map(w=>i.jsx(ie,{leading:i.jsx(Mi,{name:w.name,id:w.id}),title:w.name,hint:i.jsxs(i.Fragment,{children:["Owner ",Mt({id:w.ownerId,githubLogin:w.ownerGithubLogin})," · ",Ri(w.members,"member","members")," · ",Ri(w.repositories,"repository","repositories")," · ",Ri(w.hosts,"host","hosts")," · ",Ri(w.sessions,"session","sessions")," · Created ",i.jsx(Qn,{value:w.createdAt})]})},w.id)):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:c.trim()?"No matching workspaces":"No workspaces"})}),i.jsx(Zd,{list:a.data})]})}),i.jsx(Te,{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(ut,{...l,retry:l.refresh,children:[b.length?b.map(w=>{const[S,A]=w.revokedAt?["danger","Revoked"]:w.online?["success","Online"]:["neutral","Offline"];return i.jsx(ie,{leading:i.jsx(cs,{tone:S,label:A}),title:w.name,hint:i.jsxs(i.Fragment,{children:[Mt({id:w.ownerId,githubLogin:w.ownerGithubLogin})," · ",Ri(w.workspaces,"workspace","workspaces")," · ",Ri(w.sessions,"session","sessions"),w.lastSeenAt&&i.jsxs(i.Fragment,{children:[" · Last connected ",i.jsx(Qn,{value:w.lastSeenAt})]})]}),trailing:i.jsx(Ae,{tone:S,children:A})},w.id)}):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:c.trim()?"No matching hosts":"No hosts"})}),i.jsx(Zd,{list:l.data})]})})]})}const xw="pikibun.theme";function bw(){try{const e=localStorage.getItem(xw);return e==="light"||e==="dark"||e==="pikibun"?e:"system"}catch{return"system"}}function jh(e=bw()){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 vw(){const[e,s]=T.useState(bw);return T.useEffect(()=>{jh(e);const a=matchMedia("(prefers-color-scheme: dark)"),l=()=>jh();return a.addEventListener("change",l),()=>a.removeEventListener("change",l)},[e]),[e,a=>{try{localStorage.setItem(xw,a)}catch{}s(a)}]}function zO(){const[e,s]=vw();return i.jsx(Te,{title:"Theme",children:i.jsx(ie,{title:"Color theme",hint:"System follows your device setting",trailing:i.jsx(Is,{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 OO={stopped:"Stopped",starting:"Starting",connecting:"Connecting",connected:"Online",disconnected:"Reconnecting",stopping:"Stopping"},Yo=e=>{try{return new URL(e).host}catch{return e}};function ww(e){const s=e.error&&e.state==="stopped",a=e.state==="connected"?"success":s?"danger":e.state==="stopped"?"neutral":"warning";return i.jsx(Ae,{tone:a,dot:e.state==="connected",children:s?"Stopped (error)":OO[e.state]})}function jw(e){const s=e.inspection;if(s?.unsupported)return s.unsupported;const a=e.running?e.running.unsandboxed?"unsandboxed":"sandboxed":s?.mode;return a==="sandboxed"?"Sandboxed (bubblewrap)":a==="unsandboxed"?"Unsandboxed, after your consent in the app":"Checking..."}function RO(){const{bridge:e,view:s,error:a}=NO();return e?s?i.jsxs(i.Fragment,{children:[i.jsx(DO,{view:s,bridge:e}),i.jsx(MO,{view:s,bridge:e}),i.jsx(UO,{view:s,bridge:e}),i.jsx(BO,{view:s,bridge:e})]}):a?i.jsx(xe,{variant:"error",title:"App settings unavailable",children:a}):i.jsx(Bt,{}):i.jsx(bt,{title:"Only in the Pikibun app",children:"Open Pikibun in its desktop app to run sessions on this computer, connect it to several servers, or run Pikibun itself here."})}function DO({view:e,bridge:s}){const a=e.hosts.connections.find(y=>y.id===e.connectionHere),[l,c]=T.useState(e.title==="This Mac"?"My Mac":"My computer"),u=Ce(),d=Yo(e.origin);if(e.local.status.origin===e.origin)return i.jsx(Te,{title:`${e.title} and ${d}`,children:i.jsx(ie,{title:"Pikibun runs on this computer",hint:`It becomes its own host once you have signed in: no pairing needed. Sessions: ${e.local.status.host}.`})});const h=a?.inspection?.pairedServer===e.origin,p=a?.inspection&&!h&&(a.inspection.pairedServer||a.inspection.pairingError);function m(y){y.preventDefault(),u.run(async()=>{const{pairing:x}=await fe("/api/connectors/pairings",{method:"POST",body:{name:l.trim()}});await An(s.host.pairHere({id:x.id,code:x.code},!!p))},`${e.title} is pairing with ${d}. It appears under Hosts once it is online.`)}return i.jsx(Te,{title:`${e.title} and ${d}`,info:`${e.title} runs sessions for this server as one of your hosts, as \`pikibun connect\` does. Its other servers are below.`,children:a&&h?i.jsxs(i.Fragment,{children:[i.jsx(ie,{title:`${e.title} is a host of ${d}`,hint:jw(a),trailing:ww(a)}),i.jsxs(Ee,{children:[a.error&&i.jsx(xe,{variant:"error",title:"The host stopped",children:a.error}),i.jsx("div",{className:"inline",children:a.state==="stopped"?i.jsx(G,{variant:"default",disabled:u.busy,onClick:()=>{u.run(()=>An(s.host.start(a.id)))},children:"Start host"}):i.jsx(G,{variant:"outline",disabled:u.busy||a.state==="stopping",onClick:()=>{u.run(()=>An(s.host.stop(a.id)))},children:"Stop host"})}),i.jsx(ve,{...u})]})]}):i.jsx("form",{onSubmit:m,children:i.jsxs(Ee,{children:[i.jsx("span",{className:"small muted",children:p?`${e.title}'s connection to this server is paired elsewhere (${a?.inspection?.pairedServer??"an unreadable pairing"}). Pairing again replaces it; the old host stays in that Pikibun, offline, until you remove it there.`:`Pair ${e.title} with ${d} as your host in one step: no code to copy.${a?"":" The app asks before it adds this server to its list."}`}),i.jsx(ge,{label:"Host name",children:i.jsx("input",{className:"input",required:!0,maxLength:120,autoComplete:"off",value:l,onChange:y=>c(y.target.value)})}),i.jsx("div",{className:"inline",children:i.jsx(G,{type:"submit",variant:"default",disabled:u.busy||!l.trim(),children:u.busy?"Pairing...":`Pair ${e.title}`})}),i.jsx(ve,{...u})]})})})}function MO({view:e,bridge:s}){const[a,l]=T.useState(""),c=Ce();function u(d){d.preventDefault(),c.run(async()=>{await An(s.host.add(a)),l("")},"Added. Pair it from that server's Settings, or in the app's This Mac window.")}return i.jsxs(Te,{title:"Servers",info:`${e.title} can run sessions for several Pikibun servers at once, each with its own pairing and host, as one \`pikibun connect\` per server would. The primary server is the one the Pikibun window opens.`,children:[e.hosts.connections.map(d=>i.jsx(LO,{connection:d,view:e,bridge:s},d.id)),i.jsx("form",{onSubmit:u,children:i.jsxs(Ee,{children:[i.jsx(ge,{label:"Add a server",hint:"HTTPS; plain HTTP only for localhost and 127.0.0.1.",children:i.jsx("input",{className:"input",type:"url",required:!0,autoComplete:"off",spellCheck:!1,placeholder:"https://pikibun.example.com",value:a,onChange:d=>l(d.target.value)})}),i.jsx("div",{className:"inline",children:i.jsx(G,{type:"submit",variant:"outline",icon:"plus",disabled:c.busy||!a.trim(),children:"Add server"})}),i.jsx(ve,{...c})]})})]})}function LO({connection:e,view:s,bridge:a}){const l=Ce(),c=e.inspection,u=c?.models??[],d=v=>`${v.provider}/${v.modelId}`,[h,p]=T.useState(null),m=h??new Set(e.models?e.models.map(d):u.map(d)),y=e.server===s.origin,x=(v,b)=>{l.run(async()=>{await An(v())},b)};return i.jsx(us,{title:i.jsxs(i.Fragment,{children:[Yo(e.server),e.primary&&i.jsx("span",{className:"muted",children:" · primary"}),y&&i.jsx("span",{className:"muted",children:" · this server"})]}),hint:c?c.pairedServer?`Paired · ${jw(e)}`:c.pairingError??"Not paired yet":e.server,trailing:ww(e),children:i.jsxs("div",{className:"stack",children:[e.error&&i.jsx(xe,{variant:"error",title:"The host stopped",children:e.error}),i.jsx(ge,{label:"Server",children:i.jsx("span",{children:e.server})}),c&&i.jsx(ge,{label:"State directory",children:i.jsx("span",{className:"small",children:c.stateDir})}),i.jsx(ge,{label:"The same connection in a terminal",children:i.jsx(In,{value:e.command,label:"Copy command"})}),i.jsxs("div",{className:"inline",children:[e.state==="stopped"?i.jsx(G,{variant:"default",size:"sm",disabled:l.busy||!c?.pairedServer,onClick:()=>x(()=>a.host.start(e.id)),children:"Start host"}):i.jsx(G,{variant:"outline",size:"sm",disabled:l.busy||e.state==="stopping",onClick:()=>x(()=>a.host.stop(e.id)),children:"Stop host"}),!y&&i.jsx(G,{variant:"outline",size:"sm",icon:"external",onClick:()=>x(()=>a.host.open(e.id)),children:"Open"}),i.jsx(G,{variant:"ghost",size:"sm",icon:"refresh",disabled:e.inspecting,onClick:()=>x(()=>a.host.refresh(e.id)),children:"Refresh"}),!e.primary&&i.jsx(G,{variant:"ghost",size:"sm",icon:"trash",disabled:l.busy,onClick:()=>x(()=>a.host.remove(e.id)),children:"Remove"})]}),!c?.pairedServer&&!y&&i.jsxs("span",{className:"small muted",children:["Pair it from ",Yo(e.server),"'s own Settings › ",s.title," (Open, then Settings), or with a pairing code in the app's This Mac window."]}),u.length>0&&i.jsx(ge,{label:"Models offered",hint:e.models?"Only the checked models; a change applies from the host's next start.":"Pi chooses: its enabledModels setting, or every model with configured authentication. Uncheck some to offer only the rest.",children:i.jsxs("div",{className:"stack",children:[u.map(v=>i.jsxs("label",{className:"check-row",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:m.has(d(v)),disabled:l.busy,onChange:b=>{const w=new Set(m);b.target.checked?w.add(d(v)):w.delete(d(v)),p(w)}}),i.jsxs("span",{children:[v.name," ",i.jsx("span",{className:"small muted",children:d(v)})]})]},d(v))),i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"outline",size:"sm",disabled:l.busy||!h,onClick:()=>x(async()=>{await An(a.host.setModels(e.id,u.filter(v=>m.has(d(v))).map(v=>({provider:v.provider,modelId:v.modelId})))),p(null)},"Saved: the host offers these from its next start."),children:"Offer checked models"}),e.models&&i.jsx(G,{variant:"ghost",size:"sm",disabled:l.busy,onClick:()=>x(async()=>{await An(a.host.setModels(e.id,null)),p(null)}),children:"Let Pi choose"})]})]})}),c?.prerequisitesError&&i.jsx(xe,{variant:"warning",title:"Prerequisites",children:c.prerequisitesError}),e.logs.length>0&&i.jsx(us,{plain:!0,title:"Recent activity",children:i.jsx("ol",{className:"small mono desktop-logs",children:e.logs.slice(-30).reverse().map((v,b)=>i.jsxs("li",{className:v.level==="error"?"danger":v.level==="warning"?"muted":void 0,children:[new Date(v.time).toLocaleTimeString()," ",v.message]},b))})}),i.jsx(ve,{...l})]})})}const _O={origin:"",listen:"loopback",trustProxy:!0,signup:"invite",passwordAuth:!0,admins:[]};function UO({view:e,bridge:s}){const{status:a,inspection:l,error:c,notice:u}=e.local,d=a.state!=="stopped",[h,p]=T.useState(e.local.mode),[m,y]=T.useState(l?.shared??_O),[x,v]=T.useState((l?.shared?.admins??[]).join(`
|
|
52
|
-
`)),[b,w]=T.useState(!!l),S=Ce();T.useEffect(()=>{b||!l||(w(!0),l.shared&&(y(l.shared),v(l.shared.admins.join(`
|
|
53
|
-
`))))},[b,l]);const A=d&&a.mode?a.mode:h,k=a.state==="running"?a.mode==="shared"?"Shared":"Running":a.state==="stopped"?"Off":a.state==="starting"?"Starting":"Stopping",z=A==="local"?!l?.githubClientId:!l?.shared?.githubClientId&&!m.passwordAuth;function N(H){H.preventDefault(),S.run(()=>An(s.local.start(A==="local"?{mode:"local"}:{mode:"shared",shared:{origin:m.origin.trim().replace(/\/+$/,""),listen:m.listen,trustProxy:m.trustProxy,signup:m.signup,passwordAuth:m.passwordAuth,admins:x.split(/[\n,]/).map(L=>L.trim()).filter(Boolean)}})))}const M=H=>y(L=>({...L,...H}));return i.jsx(Te,{title:"Pikibun on this computer",info:"Pikibun itself, run by the app as `pikibun serve` does and from the same data: just for you on this computer, or shared with others at a public HTTPS address, as `pikibun serve --share`.",action:i.jsx(Ae,{tone:a.state==="running"?"success":"neutral",dot:a.state==="running",children:k}),children:i.jsx("form",{onSubmit:N,children:i.jsxs(Ee,{children:[i.jsx(Is,{label:"Who uses it",value:A,onChange:H=>{d||p(H)},options:[{value:"local",label:"Just for me",icon:"user"},{value:"shared",label:"Share with others",icon:"users"}]}),d&&i.jsxs(i.Fragment,{children:[i.jsx(ge,{label:"Address",children:i.jsx("span",{children:a.origin})}),a.address&&i.jsx(ge,{label:"Listens on",hint:a.mode==="shared"?"Your TLS proxy or tunnel forwards the public address here.":void 0,children:i.jsx("span",{children:a.address})}),i.jsx(ge,{label:"Sessions",children:i.jsx("span",{children:a.host==="connected"?"Run on this computer":a.host==="waiting"?"On this computer, once you have signed in":a.host==="off"?"Not on this computer":a.host})})]}),A==="local"&&!d&&i.jsxs("span",{className:"small muted",children:["Only this computer can reach it, and only your GitHub account can sign in, through a GitHub OAuth app of your own whose callback is ",i.jsx("code",{children:"http://127.0.0.1/api/auth/github/callback"}),". ",l?.githubClientId?`Saved: client ID ${l.githubClientId}.`:""]}),A==="shared"&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"small muted",children:["A full Pikibun server for your team: people sign in, create workspaces and pair their own hosts. It serves plain HTTP on this computer; people reach it at a public HTTPS address through a TLS proxy or tunnel you run (",i.jsx("code",{children:"tailscale serve"}),", Cloudflare Tunnel, Caddy)."]}),i.jsxs("fieldset",{className:"stack",disabled:d,children:[i.jsx(ge,{label:"Public address",children:i.jsx("input",{className:"input",type:"url",required:!0,spellCheck:!1,placeholder:"https://pikibun.example.com",value:m.origin,onChange:H=>M({origin:H.target.value})})}),i.jsx(ge,{label:"Listen on",children:i.jsxs("select",{className:"select",value:m.listen,onChange:H=>M({listen:H.target.value==="all"?"all":"loopback"}),children:[i.jsx("option",{value:"loopback",children:"This computer only: the proxy or tunnel runs here"}),i.jsx("option",{value:"all",children:"Every network interface: the proxy runs on another machine"})]})}),i.jsxs("label",{className:"check-row",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:m.trustProxy,onChange:H=>M({trustProxy:H.target.checked})}),i.jsx("span",{children:"Trust the proxy's X-Forwarded-Proto and X-Forwarded-Host"})]}),i.jsx(ge,{label:"Who may create an account",children:i.jsxs("select",{className:"select",value:m.signup,onChange:H=>M({signup:H.target.value==="open"?"open":H.target.value==="off"?"off":"invite"}),children:[i.jsx("option",{value:"invite",children:"Only people with a workspace's invite link"}),i.jsx("option",{value:"open",children:"Anyone who reaches it"}),i.jsx("option",{value:"off",children:"Nobody new: only the administrators"})]})}),i.jsxs("label",{className:"check-row",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:m.passwordAuth,onChange:H=>M({passwordAuth:H.target.checked})}),i.jsx("span",{children:"Usernames and passwords, besides GitHub or instead of it"})]}),i.jsx(ge,{label:"Administrators",hint:"One per line: a GitHub login (the app looks up its user ID), github:12345 or password:alice. The first with an account owns this computer's host.",children:i.jsx("textarea",{className:"textarea mono",rows:3,spellCheck:!1,value:x,onChange:H=>v(H.target.value),placeholder:`octocat
|
|
54
|
-
password:admin`})}),i.jsxs("span",{className:"small muted",children:["GitHub sign-in: ",l?.shared?.githubClientId?`saved OAuth app ${l.shared.githubClientId}`:"no OAuth app yet",". Its callback is ",i.jsxs("code",{children:[m.origin.trim().replace(/\/+$/,"")||"https://…","/api/auth/github/callback"]}),"."]})]})]}),z&&!d&&i.jsx(xe,{variant:"info",title:A==="local"?"Add your GitHub OAuth app first":"Add a GitHub OAuth app, or turn on usernames and passwords",actions:i.jsx(G,{size:"sm",variant:"outline",onClick:()=>{s.openWindow("settings")},children:"Open app Settings"}),children:"Secrets are entered only in the app's own Settings window, never in a web page."}),a.state==="running"&&a.mode==="shared"&&l?.shared?.passwordAuth&&i.jsx("span",{className:"small muted",children:"Create a listed password administrator's account in the app's own Settings window, where its password stays out of web pages."}),c&&i.jsx(xe,{variant:"error",title:"Pikibun on this computer",children:c}),u&&i.jsx(xe,{variant:"success",title:"Done",children:u}),i.jsxs("div",{className:"inline",children:[d?i.jsx(G,{variant:"outline",disabled:S.busy||a.state==="stopping",onClick:()=>{S.run(()=>An(s.local.stop()))},children:"Stop"}):i.jsx(G,{type:"submit",variant:"default",disabled:S.busy||z,children:A==="shared"?"Share from this computer":"Run on this computer"}),i.jsx(G,{variant:"ghost",onClick:()=>{s.openWindow("settings")},children:"App Settings…"})]}),i.jsx(ve,{...S})]})})})}function BO({view:e,bridge:s}){const[a,l]=T.useState(e.primaryServer),c=Ce(),u=Ce();function d(h){h.preventDefault(),c.run(()=>An(s.setServer(a)),"Saved. The Pikibun window opens this server.")}return i.jsxs(Te,{title:"App",children:[i.jsx("form",{onSubmit:d,children:i.jsxs(Ee,{children:[i.jsx(ge,{label:"Primary server",hint:"The Pikibun window opens it, and this computer's primary host pairs with it. It keeps the command line's connector state, so a pairing made with `pikibun connect` carries over.",children:i.jsx("input",{className:"input",type:"url",required:!0,spellCheck:!1,value:a,onChange:h=>l(h.target.value)})}),i.jsxs("div",{className:"inline",children:[i.jsx(G,{type:"submit",variant:"outline",disabled:c.busy||a.trim()===e.primaryServer,children:"Save"}),e.primaryServer!==e.defaultServer&&i.jsxs(G,{variant:"ghost",disabled:c.busy,onClick:()=>{l(e.defaultServer),c.run(()=>An(s.setServer(e.defaultServer)))},children:["Use ",Yo(e.defaultServer)]})]}),i.jsx(ve,{...c})]})}),e.hosts.openAtLogin!==void 0&&i.jsx(ie,{title:"Open Pikibun at login",hint:"Hosts left running when Pikibun quits start again when it opens.",trailing:i.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Open Pikibun at login",checked:e.hosts.openAtLogin,disabled:u.busy,onChange:h=>{const p=h.target.checked;u.run(()=>An(s.setOpenAtLogin(p)))}})}),u.error&&i.jsx(Ee,{children:i.jsx(ve,{...u})}),i.jsx(ie,{title:`${e.title} window`,hint:"Prerequisites, activity, and pairing with a code for any server",onClick:()=>{s.openWindow("host")},chevron:!0}),i.jsx(ie,{title:"App Settings window",hint:"GitHub OAuth apps' secrets and password administrators, and settings while no server answers",onClick:()=>{s.openWindow("settings")},chevron:!0})]})}const kh={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"}},$x=[{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}],Rs="*";function kw(e){return Ie(e?`/api/workspaces/${ce(e)}/members`:null)}function HO({connector:e,refresh:s}){const{user:a,workspaces:l}=vt(),c=Ce(),u=e.role==="owner",d=e.admins??[],h=l.filter(z=>(e.connectedWorkspaceIds??e.workspaceIds).includes(z.id)),[p,m]=T.useState(""),y=h.find(z=>z.id===p)??h[0],x=kw(u?y?.id:void 0),v=(x.data?.members??[]).filter(z=>z.userId!==e.ownerId&&!d.some(N=>N.userId===z.userId)),[b,w]=T.useState(""),S=v.find(z=>z.userId===b)??v[0];function A(){S&&(async()=>await qe({title:`Make ${Mt(Li(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 fe(`/api/connectors/${ce(e.id)}/admins/${ce(S.userId)}`,{method:"PUT",body:{}}),s()},"Admin added."))()}function k(z){const N=z===a.id;(async()=>await qe({title:N?"Stop managing this host?":"Remove this admin?",message:N?"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:N?"Step down":"Remove admin"})&&await c.run(async()=>{await fe(`/api/connectors/${ce(e.id)}/admins/${ce(z)}`,{method:"DELETE"}),s()},N?"You no longer manage this host.":"Admin removed."))()}return i.jsxs(Te,{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(ie,{title:"No admins",hint:u?"Only you manage this host":void 0}),d.map(z=>i.jsx(ie,{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(G,{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(ie,{title:"Add admin",hint:x.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(Vt,{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(Vt,{label:"Member",value:S?.userId??"",options:v.map(z=>({value:z.userId,label:Mt(Li(z))})),onChange:w,disabled:c.busy}),i.jsx(G,{variant:"outline",size:"sm",disabled:c.busy||!S,onClick:A,children:"Add"})]})}):i.jsx(ie,{title:"Add admin",hint:"Connect the host to a workspace first"}))]}),i.jsx(ve,{error:c.error,notice:c.notice})]})}function $O(e){return i.jsxs(i.Fragment,{children:[kh[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 IO({connector:e,refresh:s}){const{workspaces:a}=vt(),l=Ce(),c=e.role==="owner",u=e.hostGrants??[],d=new Map(a.map(U=>[U.id,U.name])),h=a.filter(U=>e.workspaceIds.includes(U.id)),[p,m]=T.useState(""),y=h.find(U=>U.id===p)??h[0],x=kw(y?.id),v=(x.data?.members??[]).filter(U=>U.userId!==e.ownerId&&U.role!=="viewer"),[b,w]=T.useState(Rs),[S,A]=T.useState("approve"),k=e.config?.hostSessions===!0&&!e.capabilities.unsandboxed,z=!e.capabilities.productionShell&&!e.capabilities.unsandboxed,N=z&&e.capabilities.unboundedShellGrants===!0,M=c&&u.some(U=>U.hostSessions)&&e.capabilities.hostGrants&&!e.capabilities.hostSessionGrants,[H,L]=T.useState("7"),P=v.find(U=>U.userId===b),ue=P?Mt(Li(P)):`every member of ${y?.name??"the workspace"}`,se=u.find(U=>U.workspaceId===y?.id&&(U.userId??Rs)===(P?.userId??Rs)),$=`${y?.id??""}:${P?.userId??Rs}`,[I,X]=T.useState(null),le=I?.key===$?I.value:se?.hostSessions===!0,te=U=>X({key:$,value:U});function F(){y&&(async()=>{const U=S==="auto",ee=c&&le,re=c&&!le&&se?.hostSessions===!0;if(!await qe({title:ee?"Grant sessions on the host?":U?"Grant automatic host commands?":"Grant host command approval?",message:(U?`${ue} 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.`:`${ue} 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.`)+(ee?` 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${U?", without asking under their Auto-approve":", once approved"}, and their clones use its Git and credentials.`:"")+(N?` As ${e.name} has no resource limits for commands, the shell commands of their own sandboxed sessions will run there without them too${U?", without asking under their Auto-approve":", each once approved like a host command"}.`:"")+(re?` 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:U||ee}))return;const O=$x.find(R=>R.value===H).days;await l.run(async()=>{await fe(`/api/connectors/${ce(e.id)}/host-grants/${ce(y.id)}`,{method:"PUT",body:{...P?{userId:P.userId}:{},level:S,...c?{hostSessions:le}:{},...O?{expiresAt:new Date(Date.now()+O*864e5).toISOString()}:{}}}),X(null),s()},"Host command access granted.")})()}function B(U){l.run(async()=>{const ee=U.userId?`?userId=${encodeURIComponent(U.userId)}`:"";await fe(`/api/connectors/${ce(e.id)}/host-grants/${ce(U.workspaceId)}${ee}`,{method:"DELETE"}),s()},"Host command access removed.")}return i.jsxs(Te,{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(ie,{title:"Only the owner",hint:"No one else decides host commands on this host"}),u.map(U=>i.jsx(ie,{title:i.jsxs(i.Fragment,{children:[U.userId?U.userName??U.userId:"All members"," ",i.jsxs("span",{className:"muted",children:["· ",d.get(U.workspaceId)??U.workspaceId]})]}),hint:$O(U),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Ae,{tone:U.level==="auto"?"warning":"neutral",children:U.level==="auto"?"Auto-approve":"Approve"}),U.hostSessions&&i.jsx(Ae,{tone:"danger",children:"Sessions on host"}),i.jsx(G,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>B(U),children:"Remove"})]})},`${U.workspaceId}:${U.userId??""}`)),!e.revokedAt&&(h.length?i.jsx(ie,{title:"Grant access",hint:x.loading?"Loading members...":kh[S].hint,trailing:i.jsxs(i.Fragment,{children:[h.length>1&&i.jsx(Vt,{label:"Workspace",value:y?.id??"",options:h.map(U=>({value:U.id,label:U.name})),onChange:U=>{m(U),w(Rs)},disabled:l.busy}),i.jsx(Vt,{label:"Member",value:P?P.userId:Rs,options:[{value:Rs,label:"All members"},...v.map(U=>({value:U.userId,label:Mt(Li(U))}))],onChange:w,disabled:l.busy}),i.jsx(Vt,{label:"Access",value:S,options:["approve","auto"].map(U=>({value:U,label:kh[U].label})),onChange:A,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:le,disabled:l.busy,onChange:U=>te(U.target.checked)}),i.jsx("span",{children:"Sessions on the host"})]}),i.jsx(Vt,{label:"Expires",value:H,options:$x.map(U=>({value:U.value,label:U.label})),onChange:L,disabled:l.busy}),i.jsx(G,{variant:"outline",size:"sm",disabled:l.busy||!y,onClick:F,children:"Grant"})]})}):i.jsx(ie,{title:"Grant access",hint:"Share the host with a workspace first"}))]}),c&&u.some(U=>U.hostSessions)&&!k&&i.jsx(ie,{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."}),M&&i.jsx(ie,{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."}),!M&&u.length>0&&z&&e.capabilities.hostGrants&&!e.capabilities.unboundedShellGrants&&i.jsx(ie,{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(ie,{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(ve,{error:l.error,notice:l.notice})]})}const Sw=Object.freeze({commandTimeoutSeconds:Object.freeze({min:30,max:3600}),compactionTokens:Object.freeze({min:0,max:1e7}),compactionModels:200}),Sh=Object.freeze({commandTimeoutSeconds:30,gpu:!1,gitCredentials:!1,repositoryCache:"off",hostSessions:!1,compaction:Object.freeze({})}),qO=Object.freeze(["gitCredentials","repositoryCache","hostSessions"]),Cw=["reserveTokens","keepRecentTokens"],GO={reserveTokens:"",keepRecentTokens:""},Ix=e=>({reserveTokens:e?.reserveTokens?.toString()??"",keepRecentTokens:e?.keepRecentTokens?.toString()??""});function Xd(e){return{overall:Ix(e),models:Object.fromEntries(Object.entries(e.modelOverrides??{}).map(([s,a])=>[s,Ix(a)]))}}function Aw(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<=Sw.compactionTokens.max?a:void 0}function qx(e){const s={};for(const a of Cw){const l=Aw(e[a]);if(l===void 0)return;l!==null&&(s[a]=l)}return s}function FO(e){const s=qx(e.overall);if(!s)return;const a={};for(const l of Object.keys(e.models).sort()){const c=qx(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,PO=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 Gx({value:e,onChange:s,disabled:a,label:l}){return i.jsx("span",{className:"token-inputs",children:Cw.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":Aw(e[c])===void 0||void 0,onChange:d=>s({...e,[c]:d.target.value})})]},c)})})}function YO({connector:e,refresh:s}){const a=e.config?.compaction??{},l=JSON.stringify(a),[c,u]=T.useState(()=>Xd(a)),d=T.useRef(l),h=Ce();T.useEffect(()=>{d.current!==l&&(d.current=l,u(Xd(JSON.parse(l))))},[l]);const p=!!e.role&&!e.revokedAt&&!h.busy,m=FO(c),y=m===void 0||JSON.stringify(m)!==l,x=[...e.models,...e.disabledModels??[]].sort((k,z)=>Qd(k.provider,z.provider)||Qd(k.modelId,z.modelId)),v=new Set(x.map(k=>`${k.provider}/${k.modelId}`)),b=Object.keys(c.models).filter(k=>!v.has(k)).sort(Qd),w=Object.keys(m?.modelOverrides??{}).length;function S(){m&&h.run(async()=>{await fe(`/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 A=k=>{const z=typeof k=="string"?k:`${k.provider}/${k.modelId}`;return i.jsx(ie,{title:typeof k=="string"?k:k.name,hint:typeof k=="string"?"Not offered by this host now":`${k.provider} / ${k.modelId}`,trailing:i.jsx(Gx,{label:z,value:c.models[z]??GO,disabled:!p,onChange:N=>u(M=>({...M,models:{...M.models,[z]:N}}))})},typeof k=="string"?k:_s(k))};return i.jsx(Te,{title:"Compaction",bare:!0,info:PO,children:i.jsxs("div",{className:"card",children:[i.jsx(ie,{title:"All models",hint:"Tokens kept free for compaction, and recent tokens kept unsummarized. Empty keeps the host's Pi setting",trailing:i.jsx(Gx,{label:"all models",value:c.overall,disabled:!p,onChange:k=>u(z=>({...z,overall:k}))})}),x.length+b.length>0&&i.jsxs(us,{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:[x.map(A),b.map(A)]}),e.capabilities.hostConfig&&!e.capabilities.compactionConfig&&i.jsx(ie,{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(Ee,{children:i.jsxs("div",{className:"stack",children:[i.jsx(ve,{...h}),!m&&i.jsxs("span",{className:"small muted",children:["Token counts are whole numbers from 0 to ",Sw.compactionTokens.max.toLocaleString(),"."]}),y&&i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"default",size:"sm",disabled:h.busy||!m,onClick:S,children:"Save compaction"}),i.jsx(G,{variant:"ghost",size:"sm",disabled:h.busy,onClick:()=>u(Xd(a)),children:"Discard"})]})]})})]})})}const VO=[30,60,120,300,600,1800,3600];function ZO(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 Fx=Object.keys(Sh).filter(e=>e!=="compaction"),Px={off:"Off",host:"Shared",owner:"Per owner"},Yx={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"},XO=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 QO({connector:e,refresh:s}){const a=e.role!=="admin",l=e.config??Sh,[c,u]=T.useState(l),d=T.useRef(l),h=Ce();T.useEffect(()=>{const A=d.current;d.current=l;const k=Fx.filter(z=>l[z]!==A[z]);k.length&&u(z=>({...z,...Object.fromEntries(k.map(N=>[N,l[N]]))}))},[l.commandTimeoutSeconds,l.gpu,l.gitCredentials,l.repositoryCache,l.hostSessions]);const p=Fx.filter(A=>c[A]!==l[A]&&(a||!qO.includes(A))),m=p.length>0,y=!e.revokedAt&&!h.busy,{unsandboxed:x,gpu:v}=e.capabilities,b=[...new Set([...VO,l.commandTimeoutSeconds])].sort((A,k)=>A-k);function w(){(async()=>c.gitCredentials&&!l.gitCredentials&&!await qe({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 qe({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 qe({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 qe({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 fe(`/api/connectors/${ce(e.id)}/config`,{method:"PATCH",body:Object.fromEntries(p.map(A=>[A,c[A]]))}),s()},"Configuration saved. Running sessions pick it up within a minute."))()}const S=x?"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(Te,{title:"Configuration",bare:!0,info:XO,children:i.jsxs("div",{className:"card",children:[i.jsx(ie,{title:"Command time limit",hint:x?"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(Vt,{label:"Command time limit",value:String(c.commandTimeoutSeconds),disabled:!y,options:b.map(A=>({value:String(A),label:ZO(A),...A===Sh.commandTimeoutSeconds?{hint:"Default"}:{}})),onChange:A=>u({...c,commandTimeoutSeconds:Number(A)})})}),i.jsx(ie,{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||x),onChange:A=>u({...c,gpu:A.target.checked})}),i.jsx("span",{children:"Lend to sandboxed commands"})]})}),i.jsx(ie,{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:A=>u({...c,gitCredentials:A.target.checked})}),i.jsx("span",{children:"Use for my pushes"})]}):i.jsx(Ae,{tone:l.gitCredentials?"warning":"neutral",children:l.gitCredentials?"On":"Off"})}),i.jsx(ie,{title:"Repository cache",hint:a?`${Yx[c.repositoryCache]}. Applies when the host next connects.`:"Only the host's owner changes this",trailing:a&&y?i.jsx(Is,{label:"Repository cache",value:c.repositoryCache,onChange:A=>u({...c,repositoryCache:A}),options:["off","host","owner"].map(A=>({value:A,label:Px[A],hint:Yx[A]}))}):i.jsx(Ae,{tone:l.repositoryCache==="off"?"neutral":"success",children:Px[l.repositoryCache]})}),i.jsx(ie,{title:"Sessions on the host",hint:x?"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:x?i.jsx(Ae,{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:A=>u({...c,hostSessions:A.target.checked})}),i.jsx("span",{children:"Allow sessions on the host"})]}):i.jsx(Ae,{tone:l.hostSessions?"danger":"neutral",children:l.hostSessions?"On":"Off"})}),!e.capabilities.hostConfig&&i.jsx(ie,{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(Ee,{children:i.jsxs("div",{className:"stack",children:[i.jsx(ve,{...h}),m&&i.jsxs("div",{className:"inline",children:[i.jsx(G,{variant:"default",size:"sm",disabled:h.busy,onClick:w,children:"Save configuration"}),i.jsx(G,{variant:"ghost",size:"sm",disabled:h.busy,onClick:()=>u(l),children:"Discard"})]})]})})]})})}const KO=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."}),Tw=e=>Ze(e?{name:"settings",section:"workspaces",id:e}:{name:"settings",section:"workspaces"});function Nw(e,s,a){return`${e} ${e===1?s:a}`}function Vx(e,s){return e<s?-1:e>s?1:0}function JO(e){const s=e.disabledModels?.length??0;return`${Nw(e.models.length,"model","models")}${s?`, ${s} disabled`:""}`}function WO(e){const s=Ie(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 e4({id:e}){const s=Qr("/api/connectors"),[a,l]=T.useState(!1);if(e)return i.jsx(i4,{id:e,resource:s});const c=s.data?.connectors??[],u=!s.loading&&!s.error&&!c.length,d=i.jsx(G,{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(Te,{title:"Hosts",info:KO,action:c.length?d:void 0,bare:u,children:i.jsx(ut,{...s,retry:s.refresh,children:u?i.jsx(bt,{title:"No hosts yet",action:d}):c.map(h=>i.jsx(ie,{leading:i.jsx(cs,{tone:Lh(h)}),title:h.name,hint:`${h.role==="admin"?`${h.ownerName}'s host, you are an admin · `:""}${JO(h)} · ${h.workspaceIds.length?`Shared with ${Nw(h.workspaceIds.length,"workspace","workspaces")}`:"Private"}`,trailing:i.jsx(Kr,{connector:h}),href:Ze({name:"settings",section:"hosts",id:h.id}),chevron:!0},h.id))})}),i.jsx(t4,{}),a&&i.jsx(Ew,{onClose:()=>l(!1),refresh:s.refresh})]})}function t4(){const{user:e,workspaces:s}=vt(),[a,l]=T.useState({}),c=T.useCallback((h,p)=>l(m=>m[h]===p?m:{...m,[h]:p}),[]),u=s.every(h=>h.id in a),d=s.reduce((h,p)=>h+(a[p.id]??0),0);return i.jsxs(Te,{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(n4,{workspace:h,userId:e.id,report:c},h.id)),u?!d&&i.jsx(ie,{title:"Nothing shared with you",hint:"Hosts members share into your workspaces appear here"}):i.jsx(Ee,{children:i.jsx(Bt,{})})]})}function n4({workspace:e,userId:s,report:a}){const l=Qr(`/api/workspaces/${ce(e.id)}/connectors`),c=(l.data?.connectors??[]).filter(d=>d.ownerId!==s),u=l.error?1:c.length;return T.useEffect(()=>{l.loading||a(e.id,u)},[a,e.id,l.loading,u]),l.error?i.jsx(ie,{leading:i.jsx(cs,{tone:"danger"}),title:`Unable to load hosts for ${e.name}`,hint:l.error,trailing:i.jsx(G,{variant:"outline",size:"sm",onClick:l.refresh,children:"Try again"})}):i.jsx(i.Fragment,{children:c.map(d=>i.jsxs(us,{leading:i.jsx(cs,{tone:Lh(d)}),title:d.name,hint:`${d.ownerName} · ${e.name}`,trailing:i.jsx(Kr,{connector:d}),children:[i.jsx(Ko,{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 Ew({onClose:e,refresh:s}){const{workspaces:a,currentWorkspace:l}=vt(),[c,u]=T.useState(""),[d,h]=T.useState(null),[p,m]=T.useState(!1),y=Ce(),x=T.useRef(!0);T.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]),T.useEffect(()=>{if(!d)return;const M=Math.max(0,new Date(d.expiresAt).getTime()-Date.now()),H=window.setTimeout(()=>{h(null),m(!0)},M);return()=>window.clearTimeout(H)},[d]);function v(M){M?.preventDefault(),!(y.busy||!c.trim())&&(h(null),m(!1),y.run(async()=>{const H=await fe("/api/connectors/pairings",{method:"POST",body:{name:c.trim()}});x.current&&h(H.pairing)}))}function b(){h(null),s(),e()}const w=of(),S=Ce();function A(){if(!d||!w)return;const M={id:d.id,code:d.code};S.run(async()=>{await An(w.host.pairHere(M,!1)),h(null)},"This computer is pairing. It appears in this list once it is online.")}const k=l??a[0]??null,z=y.busy?"Creating code...":d?"Create another code":"Create pairing code",N=d?i.jsxs(i.Fragment,{children:[i.jsx(G,{variant:"outline",disabled:y.busy||!c.trim(),onClick:()=>v(),children:z}),i.jsx(G,{variant:"default",onClick:b,children:"Done"})]}):i.jsx(G,{variant:"default",disabled:y.busy||!c.trim(),onClick:()=>v(),children:z});return i.jsx(an,{open:!0,wide:!0,title:"Pair a host",onClose:e,footer:N,children:i.jsxs("div",{className:"stack",children:[i.jsx("form",{onSubmit:v,children:i.jsx(ge,{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:M=>u(M.target.value),placeholder:"My Linux workstation"})})}),i.jsx(ve,{...y}),p&&i.jsx(xe,{variant:"warning",role:"status",title:"Pairing code expired",children:"The code was cleared. Create a new code to try again."}),d&&w&&i.jsx(xe,{variant:"info",title:"Pairing this computer?",actions:i.jsx(G,{size:"sm",variant:"outline",disabled:S.busy,onClick:A,children:"Pair this computer"}),children:"Pikibun's app runs here: it can pair this computer with the code below and start it as your host, with nothing to copy."}),i.jsx(ve,{...S}),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(ge,{label:"Run this on your host",children:i.jsx(In,{value:`npx pikibun@latest connect --server ${window.location.origin} --pairing-id ${d.id}`,label:"Copy command"})}),i.jsx(ge,{label:"Paste at the hidden prompt, not on the command line",children:i.jsx(In,{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.",k&&i.jsxs(i.Fragment,{children:[" Once the host is online, ",i.jsx("a",{href:Ze({name:"new",workspaceId:k.id}),children:"start a session"})," with one of its models."]})]})]}),i.jsxs(us,{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 i4({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:Ze({name:"settings",section:"hosts"}),children:[i.jsx(ke,{name:"chevron-left"}),"Hosts"]}),i.jsx(ut,{...s,retry:s.refresh,children:a?i.jsx(s4,{connector:a,refresh:s.refresh},a.id):i.jsx(bt,{title:"Host not found"})})]})}function s4({connector:e,refresh:s}){const{workspaces:a}=vt(),l=Ce(),c=Ce(),[u,d]=T.useState(!1),[h,p]=T.useState(!1),m=new Map(a.map(A=>[A.id,A.name])),y=e.role!=="admin",x=[...new Set([...e.connectedWorkspaceIds??[],...e.workspaceIds])],v=a.filter(A=>!e.workspaceIds.includes(A.id));function b(A){(async()=>await qe({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 fe(`/api/connectors/${ce(e.id)}/shares/${ce(A)}`,{method:"DELETE"}),s()},"Host sharing stopped. Your private connection remains available."))()}function w(){(async()=>await qe({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 fe(`/api/connectors/${ce(e.id)}/permanent`,{method:"DELETE"}),ds({name:"settings",section:"hosts"}),s()}))()}function S(){(async()=>await qe({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 fe(`/api/connectors/${ce(e.id)}`,{method:"DELETE"}),s()},"Host revoked."))()}return i.jsxs(i.Fragment,{children:[i.jsxs(Te,{title:"Status",bare:!0,children:[i.jsxs("div",{className:"card",children:[i.jsx(ie,{title:"Status",trailing:i.jsx(Kr,{connector:e})}),y&&!e.online&&i.jsx(ie,{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(G,{variant:"outline",size:"sm",disabled:c.busy,onClick:()=>e.revokedAt?p(!0):d(!0),children:e.revokedAt?"Pair again":"Reconnect"})}),i.jsx(ie,{title:"Owner",trailing:e.ownerName}),i.jsx(ie,{title:"Paired",trailing:i.jsx(Kt,{value:e.createdAt})}),e.revokedAt&&i.jsx(ie,{title:"Revoked",trailing:i.jsx(Kt,{value:e.revokedAt})})]}),i.jsx(Ko,{connector:e})]}),i.jsx(a4,{connector:e,refresh:s}),i.jsxs(Te,{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:[!x.length&&i.jsx(ie,{title:"Not in any workspace yet",hint:"Create or join a workspace to use this host there"}),x.map(A=>{const k=e.workspaceIds.includes(A);return i.jsx(ie,{title:m.get(A)??A,hint:k?"Shared with members":y?"Private: your use only":"Private: the owner's use only",trailing:k&&!e.revokedAt&&i.jsx(G,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>b(A),children:"Unshare"})},A)}),!e.revokedAt&&(v.length?i.jsx(r4,{connector:e,available:v,busy:l.busy,run:l.run,refresh:s}):!a.length&&i.jsx(ie,{title:"Share with workspace",hint:"Create or join a workspace and configure its repositories before sharing",href:Tw(),chevron:!0}))]}),i.jsx(ve,{error:l.error,notice:l.notice})]}),i.jsx(QO,{connector:e,refresh:s}),e.config&&i.jsx(YO,{connector:e,refresh:s}),e.capabilities.hostCommands&&i.jsx(IO,{connector:e,refresh:s}),i.jsx(HO,{connector:e,refresh:s}),i.jsx(Te,{title:"Details",children:i.jsx(Ee,{children:i.jsx(ge,{label:"Connection ID",children:i.jsx(In,{value:e.id,label:"Copy connection ID"})})})}),y&&i.jsxs(Te,{title:"Danger zone",bare:!0,children:[i.jsxs("div",{className:"card",children:[i.jsx(ie,{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(G,{variant:"outline",size:"sm",disabled:c.busy,onClick:S,children:c.busy?"Revoking...":"Revoke"})}),i.jsx(ie,{title:"Permanently remove host",hint:"Remove from Pikibun and invalidate access. Session history and local files are retained.",trailing:i.jsx(G,{variant:"outline",size:"sm",disabled:c.busy,onClick:w,children:"Remove permanently"})})]}),i.jsx(ve,{error:c.error,notice:c.notice})]}),h&&i.jsx(Ew,{onClose:()=>p(!1),refresh:s}),u&&i.jsx(an,{open:!0,title:`Reconnect ${e.name}`,onClose:()=>d(!1),footer:i.jsx(G,{onClick:()=>{s(),d(!1)},children:"Done"}),children:i.jsxs("div",{className:"stack",children:[i.jsx(xe,{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(ge,{label:"Run on your host",children:i.jsx(In,{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(G,{variant:"outline",onClick:s,children:"Refresh status"})]})})]})}function a4({connector:e,refresh:s}){const a=Ce(),l=new Set((e.disabledModels??[]).map(_s)),c=[...e.models,...e.disabledModels??[]].sort((h,p)=>Vx(h.provider,p.provider)||Vx(h.modelId,p.modelId)),u=!!e.role&&!e.revokedAt;function d(h,p){a.busy||!u||a.run(async()=>{await fe(`/api/connectors/${ce(e.id)}/models`,{method:"PATCH",body:{provider:h.provider,modelId:h.modelId,enabled:p}}),s()},p?`${h.name} enabled.`:`${h.name} disabled. No new session or message can use it.`)}return i.jsxs(Te,{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(ie,{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(_s(h)),disabled:!u||a.busy,onChange:p=>d(h,p.target.checked)}),"Enabled"]})},_s(h))):i.jsx(ie,{title:"No models advertised",hint:"Configure models in Pi on the host"})}),i.jsx(ve,{error:a.error,notice:a.notice})]})}function r4({connector:e,available:s,busy:a,run:l,refresh:c}){const[u,d]=T.useState(""),h=s.find(x=>x.id===u)??s[0],p=WO(h);async function m(){!p.configured||a||e.capabilities.unsandboxed&&!await qe({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 fe(`/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=p.loading?i.jsx(Bt,{children:"Checking repositories..."}):p.error?i.jsx("span",{className:"field-error",children:p.error}):p.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:Tw(h.id),children:"bind one"})," before sharing"]});return i.jsx(ie,{title:"Share with workspace",hint:y,trailing:i.jsxs(i.Fragment,{children:[i.jsx(Vt,{label:"Workspace to share with",value:h.id,options:s.map(x=>({value:x.id,label:x.name})),onChange:d,disabled:a}),(p.error||!p.configured)&&!p.loading&&i.jsx(G,{variant:"ghost",size:"sm",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh repositories",disabled:a,onClick:p.refresh}),i.jsx(G,{variant:"outline",size:"sm",disabled:a||!p.configured,onClick:()=>{m()},children:a?"Saving...":"Share"})]})})}const Fr=["notion","google-drive","feishu","dropbox","onedrive","tencent-docs"],pn={notion:"Notion","google-drive":"Google Drive",feishu:"Feishu / Lark",dropbox:"Dropbox",onedrive:"OneDrive / SharePoint","tencent-docs":"Tencent Docs"},Zx=["notion","google-drive","feishu"],Xx={documents:20},l4=Db.filter(e=>e!=="github"),Qx={"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"},o4="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 c4(e){if(e==="git")return"Any server over HTTPS, without pull requests";const s=li[e];return s.fixed??(s.default?`${s.default} or self-managed`:"Self-hosted")}function u4(){const{user:e}=vt(),{accounts:s,loading:a,error:l,refresh:c}=Lb(),u=Ce(),[d,h]=T.useState(null);async function p(m){u.busy||!await qe({title:"Remove Git account",message:`Remove ${nh(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 fe(`/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(ie,{leading:i.jsx(Lo,{}),title:qn.github,hint:`${li.github.default} · Repositories on github.com need an account that signs in with GitHub; this account signs in with a password`,trailing:i.jsx(Ae,{tone:"warning",children:"Not available"})}):i.jsx(ie,{leading:i.jsx(Lo,{}),title:qn.github,hint:e.githubConnected?`${li.github.default} · ${e.githubLogin?`@${e.githubLogin} · `:""}signed in`:`${li.github.default} · Not connected`,trailing:e.githubConnected?i.jsx(Ae,{tone:"success",children:"Connected"}):i.jsx(It,{variant:"outline",size:"sm",href:"/api/auth/github",children:"Sign in"})}),i.jsx(ut,{loading:a&&!s,error:l,retry:c,children:l4.map(m=>{const y=s?.filter(v=>v.provider===m)??[],x=qn[m];return i.jsxs(T.Fragment,{children:[i.jsx(ie,{leading:i.jsx(ke,{name:"git-branch",size:16}),title:x,hint:`${c4(m)} · ${y.length?`${y.length} connected`:"Not connected"}`,trailing:i.jsxs(i.Fragment,{children:[y.length>0&&i.jsx(Ae,{tone:"success",children:"Connected"}),i.jsx(G,{variant:y.length?"ghost":"outline",size:"sm",disabled:u.busy,"aria-label":`Connect ${x}`,onClick:()=>h(m),children:y.length?"Add another":"Connect"})]})}),y.map(v=>i.jsx(ie,{leading:i.jsx("span",{className:"git-account-indent","aria-hidden":!0}),title:`${v.host}${v.organization?`/${v.organization}`:""}`,hint:v.login,trailing:i.jsx(G,{variant:"ghost",size:"sm",disabled:u.busy,"aria-label":`Remove ${nh(v)}`,onClick:()=>{p(v)},children:"Remove"})},v.id))]},m)})}),(u.error||u.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...u})})]}),i.jsx(zw,{provider:d,close:()=>h(null),added:c})]})}function zw({provider:e,close:s,added:a,save:l,initial:c}){const[u,d]=T.useState(""),[h,p]=T.useState(""),[m,y]=T.useState(""),[x,v]=T.useState(""),b=Ce(),w=e?li[e].fixed:null;T.useEffect(()=>{d(c?.host??(e?li[e].default??"":"")),p(c?.organization??""),y(c?.username??""),v("")},[e,c]);function S(){b.busy||(v(""),s())}function A(N){if(N.preventDefault(),!e||b.busy)return;const M={provider:e,token:x,...w?{}:{host:u.trim()},...e==="azure-devops"?{organization:h.trim()}:{},...(e==="bitbucket"||e==="git")&&m.trim()?{username:m.trim()}:{}};b.run(async()=>{try{l?await l(M):await fe("/api/git/accounts",{method:"POST",body:M})}finally{v("")}a(),s()})}const k=!!(e&&x&&(w||u.trim())&&(e!=="azure-devops"||h.trim())&&(e!=="git"||m.trim())),z=!!l;return i.jsx(an,{open:e!==null,title:`Connect ${e?qn[e]:"Git"}${z?" for the workspace":""}`,onClose:S,footer:i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:b.busy,onClick:S,children:"Cancel"}),i.jsx(G,{variant:"default",type:"submit",form:"git-account-form",disabled:!k||b.busy,children:b.busy?"Verifying...":"Connect"})]}),children:i.jsxs("form",{id:"git-account-form",className:"stack",onSubmit:A,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(ge,{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:N=>d(N.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:253,placeholder:"git.example.com"})}),e==="azure-devops"&&i.jsx(ge,{label:"Organization",hint:"From dev.azure.com/<organization>",children:i.jsx("input",{className:"input",required:!0,value:h,onChange:N=>p(N.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:100})}),e==="bitbucket"&&i.jsx(ge,{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:N=>y(N.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:254})}),e==="git"&&i.jsx(ge,{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:N=>y(N.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:254})}),i.jsx(ge,{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 ${qn[e]}, then encrypted on the server`}`:e==="git"?`Needs ${Qx.git}. Encrypted on the server and checked when you add a repository: a Git server has no account to verify it against`:`Scopes: ${Qx[e]}. Verified with ${qn[e]}, then encrypted on the server`,children:i.jsx("input",{className:"input",required:!0,type:"password",value:x,onChange:N=>v(N.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1})})]}),i.jsx(ve,{error:b.error})]})})}const d4=["github-enterprise","gitlab","bitbucket","azure-devops","gitea","git"],Ow=["notion","google-drive","feishu"],Kx=20;function h4(e){const s=Ie(e?`/api/workspaces/${ce(e)}/connections`:null);return{connections:s.data?.connections??null,loading:s.loading,error:s.error,refresh:s.refresh}}function Br(e){if(e.family==="document")return pn[e.provider];const s=Jo(e.provider,e.host);return e.organization?`${s} · ${e.organization}`:s}function f4(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 Jx(e,s){return e?.find(a=>a.family==="document"&&a.provider===s)??null}function Rw({workspaceId:e,sourceId:s,title:a,readAs:l,connection:c,admin:u,action:d,changed:h}){if(!u)return l==="workspace"?i.jsx(Ae,{children:"Workspace connection"}):null;function p(m){m===l||d.busy||d.run(async()=>{await fe(`/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=>p(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 m4({workspaceId:e,admin:s,connections:a,loading:l,error:c,refresh:u,changed:d}){const h=Ce(),[p,m]=T.useState(null),[y,x]=T.useState(null),v=T.useMemo(()=>y?{host:y.host,organization:y.organization,...y.provider==="git"?{username:y.name}:{}}:null,[y]),[b,w]=T.useState(null),S=`/api/workspaces/${ce(e)}/connections`,A=(a?.length??0)>=Kx;async function k(N){h.busy||!await qe({title:"Remove connection",message:`Remove the workspace's ${Br(N)} connection (${N.name})? Its secret is deleted from the server.`,confirmLabel:"Remove",destructive:!0})||h.run(async()=>{await fe(`${S}/${ce(N.id)}`,{method:"DELETE"}),u(),d()},"Connection removed.")}const z=()=>{u(),d()};return i.jsxs(Te,{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&&!A&&i.jsx(Wn,{label:"Add connection",triggerVariant:"outline",trigger:i.jsxs(i.Fragment,{children:[i.jsx(ke,{name:"plus",size:16}),"Add connection"]}),items:[...d4.map(N=>({label:qn[N],onSelect:()=>m(N)})),"separator",...Ow.map(N=>({label:pn[N],onSelect:()=>w(N)}))]}),children:[i.jsxs(ut,{loading:l&&!a,error:c,retry:u,children:[a?.length?a.map(N=>i.jsx(ie,{leading:i.jsx(ke,{name:N.family==="git"?"git-branch":"file",size:16}),title:Br(N),hint:`${N.name} · ${N.sources?`${N.sources} source${N.sources===1?"":"s"} read with it`:"No source reads with it yet"}`,trailing:s&&i.jsxs(i.Fragment,{children:[i.jsx(G,{variant:"ghost",size:"sm",disabled:h.busy,"aria-label":`Replace ${Br(N)}`,title:"Connect it again with a new secret, keeping the sources that read with it",onClick:()=>N.family==="git"?(x(N),m(N.provider)):w(N.provider),children:"Replace"}),i.jsx(G,{variant:"ghost",size:"sm",disabled:h.busy||N.sources>0,title:N.sources>0?"Switch its sources to members' own accounts first":void 0,"aria-label":`Remove ${Br(N)}`,onClick:()=>{k(N)},children:"Remove"})]})},N.id)):i.jsx(Ee,{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(Ee,{children:i.jsx(ve,{...h})})]}),s&&A&&i.jsx(Ee,{children:i.jsxs("span",{className:"muted small",children:["This workspace has ",Kx," connections, the most it can have. Replace one, or remove one to add another."]})}),s&&i.jsx(zw,{provider:p,close:()=>{m(null),x(null)},added:z,initial:v,save:async N=>{await fe(S,{method:"POST",body:{family:"git",...N}})}}),s&&i.jsx(Dw,{provider:b,close:()=>w(null),connected:z,save:async(N,M)=>{await fe(S,{method:"POST",body:{family:"document",provider:N,...M}})}})]})}function p4(e=!0){const s=Ie(e?"/api/source-accounts":null);return{accounts:s.data?.accounts??null,loading:s.loading,error:s.error,refresh:s.refresh}}function g4(e){const s=Ie(e?`/api/workspaces/${ce(e)}/sources`:null);return{sources:s.data?.sources??null,loading:s.loading,error:s.error,refresh:s.refresh}}const y4={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."})},x4={page:"Page",database:"Database",folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",presentation:"Presentation",file:"File",wiki:"Wiki page"};function b4(){const e=Ie("/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=Ce(),[h,p]=T.useState(null),[m,y]=T.useState(null);T.useEffect(()=>{const b=new URLSearchParams(window.location.search),w=b.get("source_account");!w||!Fr.includes(w)||(y({kind:w,ok:b.get("result")==="connected",reason:b.get("reason")??""}),window.history.replaceState(null,"",`${window.location.pathname}${window.location.hash}`))},[]);const x=Fr.filter(b=>Zx.includes(b)||u.includes(b)||s?.some(w=>w.provider===b));async function v(b,w){d.busy||!await qe({title:`Disconnect ${pn[b]}`,message:`Disconnect ${pn[b]} (${w})? Its secret is deleted from the server, and sessions you own can no longer read the workspaces' ${pn[b]} sources.`,confirmLabel:"Disconnect",destructive:!0})||d.run(async()=>{await fe(`/api/source-accounts/${b}`,{method:"DELETE"}),c()},`${pn[b]} disconnected.`)}return i.jsxs(Te,{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:o4}),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(u4,{}),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(ut,{loading:a&&!s,error:l,retry:c,children:x.map(b=>{const w=s?.find(z=>z.provider===b),S=u.includes(b),A=Zx.includes(b),k=i.jsxs(i.Fragment,{children:[S&&i.jsx(It,{variant:w?"ghost":"outline",size:"sm",href:`/api/source-accounts/${b}/oauth/start`,children:w?"Sign in again":"Sign in"}),A&&i.jsx(G,{variant:w||S?"ghost":"outline",size:"sm",disabled:d.busy,onClick:()=>p(b),children:S?"Paste secret":w?"Replace":"Connect"})]});return i.jsx(ie,{leading:i.jsx(ke,{name:"file",size:16}),title:pn[b],hint:w?`${w.name}${w.method==="oauth"?" · signed in":""}`:"Not connected",trailing:w?i.jsxs(i.Fragment,{children:[i.jsx(Ae,{tone:"success",children:"Connected"}),k,i.jsx(G,{variant:"ghost",size:"sm",disabled:d.busy,"aria-label":`Disconnect ${pn[b]}`,onClick:()=>{v(b,w.name)},children:"Disconnect"})]}):k},b)})}),m&&i.jsx(Ee,{children:i.jsx(ve,{...m.ok?{notice:`${pn[m.kind]} connected.`,error:""}:{notice:"",error:`${pn[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(Ee,{children:i.jsx(ve,{...d})})]})]}),i.jsx(Dw,{provider:h,close:()=>p(null),connected:c})]})}function Dw({provider:e,close:s,connected:a,save:l}){const[c,u]=T.useState(""),[d,h]=T.useState(""),[p,m]=T.useState("feishu"),y=Ce();function x(){u(""),h(""),m("feishu")}function v(){y.busy||(x(),s())}const b=!!(c.trim()&&(e!=="feishu"||d.trim()));function w(A){if(A.preventDefault(),!e||!b||y.busy)return;const k=e==="notion"?{token:c.trim()}:e==="google-drive"?{key:c}:{appId:d.trim(),appSecret:c.trim(),domain:p};y.run(async()=>{try{l?await l(e,k):await fe(`/api/source-accounts/${e}`,{method:"PUT",body:k})}finally{u("")}x(),a(),s()})}const S=e?pn[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(G,{disabled:y.busy,onClick:v,children:"Cancel"}),i.jsx(G,{variant:"default",type:"submit",form:"source-account-form",disabled:!b||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:[y4[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(ge,{label:"Internal integration secret",children:i.jsx("input",{className:"input",required:!0,type:"password",value:c,onChange:A=>u(A.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1,placeholder:"ntn_…"})}),e==="google-drive"&&i.jsx(ge,{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:A=>u(A.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(Vt,{label:"Platform",value:p,disabled:y.busy,options:[{value:"feishu",label:"Feishu",hint:"open.feishu.cn"},{value:"lark",label:"Lark",hint:"open.larksuite.com"}],onChange:m})]}),i.jsx(ge,{label:"App ID",children:i.jsx("input",{className:"input",required:!0,value:d,onChange:A=>h(A.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1,placeholder:"cli_…"})}),i.jsx(ge,{label:"App Secret",children:i.jsx("input",{className:"input",required:!0,type:"password",value:c,onChange:A=>u(A.target.value),disabled:y.busy,autoComplete:"off",spellCheck:!1})})]}),i.jsx(ve,{error:y.error})]})})}function v4({workspaceId:e,workspaceName:s,admin:a,sources:l,loading:c,error:u,refresh:d,changed:h,connections:p}){const m=Ce(),y=p4(a),[x,v]=T.useState(!1),b=Fr.filter(z=>y.accounts?.some(N=>N.provider===z)),w=Fr.filter(z=>Jx(p,z)),S=Fr.filter(z=>b.includes(z)||w.includes(z)),A=(l?.length??0)>=Xx.documents;async function k(z){m.busy||!a||!await qe({title:"Remove source",message:`Remove ${z.title} (${pn[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 fe(`/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&&!A&&i.jsx(G,{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(ut,{loading:c,error:u,retry:d,children:[l?.length?l.map(z=>i.jsx(ie,{leading:i.jsx(ke,{name:"file",size:16}),title:z.title,hint:i.jsxs(i.Fragment,{children:[pn[z.kind]," · ",x4[z.itemType]," · ",i.jsx("a",{href:z.url,target:"_blank",rel:"noreferrer",children:"Open"})]}),trailing:i.jsxs(i.Fragment,{children:[Ow.includes(z.kind)&&i.jsx(Rw,{workspaceId:e,sourceId:z.id,title:z.title,readAs:z.readAs,connection:Jx(p,z.kind),admin:a,action:m,changed:h}),a&&i.jsx(G,{variant:"outline",size:"sm",disabled:m.busy,"aria-label":`Remove ${z.title}`,onClick:()=>{k(z)},children:"Remove"})]})},z.id)):i.jsx(Ee,{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(Ee,{children:i.jsx(ve,{...m})})]})}),a&&y.accounts&&!S.length&&i.jsx(xe,{variant:"info",title:"Connect an account to add documents",actions:i.jsx(It,{variant:"outline",size:"sm",href:Ze({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&&A&&i.jsxs(xe,{variant:"info",title:"Document source limit reached",children:["A workspace has at most ",Xx.documents," document sources. Remove one to add another."]}),a&&S.length>0&&i.jsx(j4,{open:x,kinds:S,own:b,workspaceKinds:w,workspaceId:e,close:()=>v(!1),added:()=>{d(),h()}})]})}const w4={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 j4({open:e,kinds:s,own:a,workspaceKinds:l,workspaceId:c,close:u,added:d}){const[h,p]=T.useState(""),[m,y]=T.useState(""),[x,v]=T.useState(""),b=Ce(),w=h||(s.length===1?s[0]:""),S=w?[...a.includes(w)?["members"]:[],...l.includes(w)?["workspace"]:[]]:[],A=x&&S.includes(x)?x:S[0]??"members";function k(){b.busy||(y(""),p(""),u())}function z(N){N.preventDefault(),!(!w||!m.trim()||b.busy)&&b.run(async()=>{await fe(`/api/workspaces/${ce(c)}/sources`,{method:"POST",body:{kind:w,target:m.trim(),readAs:A}}),y(""),p(""),v(""),d(),u()})}return i.jsx(an,{open:e,title:"Add document source",onClose:k,footer:i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:b.busy,onClick:k,children:"Cancel"}),i.jsx(G,{variant:"default",type:"submit",form:"document-source-form",disabled:!w||!m.trim()||b.busy,children:b.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(Vt,{label:"Provider",placeholder:"Choose a provider",value:w,disabled:b.busy,options:s.map(N=>({value:N,label:pn[N]})),onChange:p})]}),S.length>1&&i.jsxs("div",{className:"field",children:[i.jsx("span",{className:"field-label",children:"Reads with"}),i.jsx(Vt,{label:"Reads with",value:A,disabled:b.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(ge,{label:"Link",hint:`${w4[w]}. ${A==="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:N=>y(N.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,placeholder:"https://…"})}),i.jsx(ve,{error:b.error})]})})}function k4(){const e=Ie("/api/me/devices"),s=Ce();async function a(l){s.busy||!await qe({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 fe(`/api/me/devices/${ce(l.id)}`,{method:"DELETE"}),e.refresh()},"App signed out.")}return i.jsxs(Te,{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(ut,{...e,retry:e.refresh,children:[e.data&&!e.data.devices.length&&i.jsx(ie,{title:"No apps signed in",hint:"Sign in from the Pikibun app on iPhone, iPad or Mac"}),e.data?.devices.map(l=>i.jsx(ie,{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(G,{variant:"outline",size:"sm",disabled:s.busy,onClick:()=>{a(l)},children:"Sign out"})},l.id))]}),i.jsx(ve,{...s})]})}function S4(){const[e,s]=T.useState(""),[a,l]=T.useState(""),[c,u]=T.useState(""),d=Ce();function h(p){p.preventDefault(),d.run(async()=>{if(a!==c)throw new Error("The new passwords don't match.");await fe("/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(Te,{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(Ee,{children:[i.jsx(ge,{label:"Current password",children:i.jsx("input",{className:"input",type:"password",required:!0,value:e,onChange:p=>s(p.target.value),autoComplete:"current-password",maxLength:256})}),i.jsx(ge,{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:p=>l(p.target.value),autoComplete:"new-password"})}),i.jsx(ge,{label:"Confirm new password",children:i.jsx("input",{className:"input",type:"password",required:!0,maxLength:256,value:c,onChange:p=>u(p.target.value),autoComplete:"new-password"})})]})}),i.jsxs("div",{className:"settings-actions",children:[i.jsx(ve,{...d}),i.jsx("span",{className:"spacer"}),i.jsx(G,{type:"submit",variant:"default",disabled:d.busy,children:d.busy?"Changing...":"Change password"})]})]})}function C4(){const{user:e,setUser:s,signOut:a}=vt(),[l,c]=T.useState(e.displayName),[u,d]=T.useState(e.gitName),[h,p]=T.useState(e.gitEmail),[m,y]=T.useState(()=>Object.entries(e.env).map(([w,S])=>({id:crypto.randomUUID(),key:w,value:S}))),x=Ce();function v(w){w.preventDefault(),x.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 A=await fe("/api/me",{method:"PATCH",body:{displayName:l,gitName:u,gitEmail:h,env:S}});s(A.user)},"Profile saved. New sessions use your configured identity.")}const b=(w,S)=>y(A=>A.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(Te,{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(Ee,{children:[i.jsx(ge,{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(ge,{label:"Git author name",children:i.jsx("input",{className:"input",required:!0,maxLength:120,value:u,onChange:w=>d(w.target.value)})}),i.jsx(ge,{label:"Git author email",children:i.jsx("input",{className:"input",required:!0,type:"email",value:h,onChange:w=>p(w.target.value),autoComplete:"email"})})]})}),i.jsxs(Te,{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(G,{variant:"outline",size:"sm",icon:"plus",onClick:()=>y(w=>[...w,{id:crypto.randomUUID(),key:"APP_",value:""}]),children:"Add variable"}),children:[!m.length&&i.jsx(ie,{title:"No variables",hint:"Add APP_ variables your sessions need"}),m.map((w,S)=>i.jsx(ie,{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:A=>b(w.id,{key:A.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:A=>b(w.id,{value:A.target.value}),autoComplete:"off"})]}),trailing:i.jsx(G,{variant:"ghost",size:"sm",icon:"trash","aria-label":`Remove variable ${S+1}`,title:"Remove variable",onClick:()=>y(A=>A.filter(k=>k.id!==w.id))})},w.id))]}),i.jsxs("div",{className:"settings-actions",children:[i.jsx(ve,{...x}),i.jsx("span",{className:"spacer"}),i.jsx(G,{type:"submit",variant:"default",disabled:x.busy,children:x.busy?"Saving...":"Save profile"})]})]}),i.jsx(b4,{}),e.passwordSignIn&&i.jsx(S4,{}),i.jsx(k4,{}),i.jsx(Oh,{}),i.jsxs(Te,{title:"Account",children:[i.jsx(ie,{title:"User ID",hint:i.jsx("code",{children:Mt(e)}),trailing:i.jsx(ob,{value:e.id,label:"Copy user ID"})}),i.jsx(ie,{title:"Sign out",trailing:i.jsx(G,{variant:"outline",size:"sm",onClick:a,children:"Sign out"})})]})]})}const A4={domains:100},T4={brave:"Brave Search",tavily:"Tavily",searxng:"SearXNG"},Wx={off:"Off",allowlist:"Allowlist",open:"Open"},N4={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 E4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/network-policy`,l=Ie(a),c=Ce(),[u,d]=T.useState("off"),[h,p]=T.useState(""),[m,y]=T.useState(!0),[x,v]=T.useState(!1),b=l.data?.policy;T.useEffect(()=>{b&&(d(b.mode),p(b.domains.join(`
|
|
55
|
-
`)),y(b.packageRegistries),v(b.webSearch===!0))},[b]);const w=h.split(/[\s,]+/).map(z=>z.trim().toLowerCase()).filter(Boolean),S=!!b&&(u!==b.mode||m!==b.packageRegistries||x!==(b.webSearch===!0)||w.join(`
|
|
56
|
-
`)!==b.domains.join(`
|
|
57
|
-
`)),A=l.data?.webSearchProvider;function k(){!s||c.busy||c.run(async()=>{await fe(a,{method:"PUT",body:{mode:u,domains:w,packageRegistries:m,webSearch:x}}),l.refresh()},"Network access saved. Running sessions pick it up within a minute.")}return i.jsx(Te,{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(ut,{loading:l.loading,error:l.error,retry:l.refresh,children:b&&i.jsxs(i.Fragment,{children:[i.jsx(ie,{title:"Access",hint:N4[u],trailing:s?i.jsx(Is,{label:"Network access",value:u,onChange:d,options:["off","allowlist","open"].map(z=>({value:z,label:Wx[z]}))}):i.jsx(Ae,{tone:b.mode==="off"?"neutral":"success",children:Wx[b.mode]})}),u==="allowlist"&&i.jsx(Ee,{children:i.jsxs("div",{className:"stack",children:[i.jsx(ge,{label:"Allowed domains",hint:`One per line, up to ${A4.domains}. *.example.com allows its subdomains.`,children:i.jsx("textarea",{className:"textarea mono",rows:4,disabled:!s,value:h,onChange:z=>p(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(ie,{title:"Web search",hint:A?`Agents search the web with web_search, through ${T4[A]??A}. 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:x,disabled:!A&&!x,onChange:z=>v(z.target.checked)}),i.jsx("span",{children:"Allow web search"})]}):i.jsx(Ae,{tone:b.webSearch&&A?"success":"neutral",children:b.webSearch&&A?"On":"Off"})}),s&&(S||c.error||c.notice)&&i.jsx(Ee,{children:i.jsxs("div",{className:"stack",children:[i.jsx(ve,{...c}),S&&i.jsx("div",{children:i.jsx(G,{variant:"default",size:"sm",disabled:c.busy,onClick:k,children:"Save network access"})})]})})]})})})}function z4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/transcripts`,l=Ie(a),c=Ce(),u=l.data?.settings,d=u?.paging,h=u?u.toolOutput!=="brief":void 0;function p(y){!s||c.busy||y===d||c.run(async()=>{await fe(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 fe(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(Te,{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 ",sh.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(ut,{loading:l.loading,error:l.error,retry:l.refresh,children:[d!==void 0&&i.jsx(ie,{title:"Latest messages first",hint:d?`Sessions open with the newest ${sh.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=>p(y.target.checked)}):i.jsx(Ae,{tone:d?"success":"neutral",children:d?"On":"Off"})}),h!==void 0&&i.jsx(ie,{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(Ae,{tone:h?"success":"neutral",children:h?"On":"Off"})}),(c.error||c.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...c})})]})})}function O4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/approvals`,l=Ie(a),c=Ce(),u=l.data?.settings.requesterAutoApprove;function d(h){!s||c.busy||h===u||c.run(async()=>{await fe(a,{method:"PUT",body:{requesterAutoApprove:h}}),l.refresh()},h?"Session owners can now choose Always approve on other members' approval cards.":"Other members' requests ask again everywhere. Session owners' choices are kept for when this is turned back on.")}return i.jsx(Te,{title:"Approvals",info:i.jsxs("div",{className:"stack",children:[!s&&i.jsx("p",{children:"Only workspace owners and admins can change this."}),i.jsxs("p",{children:["Approved operations run as the session's owner, with their Git and GitHub access. With this on, a session's owner can choose ",i.jsx("strong",{children:"Always approve"})," on an approval card from another member, and that member's later commands, pushes, and GitHub comments and issues in that session run without asking."]}),i.jsx("p",{children:"Each owner decides for their own sessions and members, and can stop it in the session panel, under Details › People. Merges, host commands, commands without the host's resource limits, and anything the session doesn't allow yet still ask."}),i.jsx("p",{children:"Turning this off makes those requests ask again in every session; owners' choices are kept and apply again if it's turned back on."})]}),children:i.jsxs(ut,{loading:l.loading,error:l.error,retry:l.refresh,children:[u!==void 0&&i.jsx(ie,{title:"Auto-approve other members' requests",hint:u?"Session owners can choose to always approve another member's requests":"Only each session's owner can run things without asking, in their own messages",trailing:s?i.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Let session owners auto-approve other members' requests",checked:u,disabled:c.busy,onChange:h=>d(h.target.checked)}):i.jsx(Ae,{tone:u?"success":"neutral",children:u?"On":"Off"})}),(c.error||c.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...c})})]})})}const Ch={"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"},R4={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"},D4="api://AzureADTokenExchange";function M4({workspace:e,admin:s}){const a=`/api/workspaces/${ce(e.id)}/push-identities`,l=Ie(a),c=Ce(),[u,d]=T.useState(null);async function h(y){await qe({title:"Remove push identity",message:`Remove the ${Kd(y)} push identity (${Ch[y.kind]})? Agents can no longer push to these repositories until another identity is configured.`,confirmLabel:"Remove",destructive:!0})&&c.run(async()=>{await fe(`${a}/${ce(y.id)}`,{method:"DELETE"}),l.refresh()},"Push identity removed.")}function p(y){c.run(async()=>{const x=await fe(`${a}/${ce(y.id)}/authorize`,{method:"POST"});window.location.assign(x.url)})}const m=l.data;return i.jsxs(Te,{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(G,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d({provider:"github"}),children:"Add identity"}),children:[i.jsxs(ut,{...l,retry:l.refresh,children:[m?.githubApp&&i.jsx(ie,{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(It,{variant:"outline",size:"sm",href:m.githubApp.installUrl,target:"_blank",rel:"noreferrer",children:"Install"})}),m?.identities.length?m.identities.map(y=>i.jsx(ie,{title:Kd(y),hint:i.jsxs(i.Fragment,{children:[Ch[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(Ae,{tone:y.status==="ready"?"success":"warning",children:y.status==="ready"?"Ready":"Authorization required"}),s&&y.kind==="oauth-refresh"&&i.jsx(G,{variant:"outline",size:"sm",disabled:c.busy,onClick:()=>p(y),children:"Authorize"}),s&&i.jsx(Wn,{label:`Actions for ${Kd(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(Ee,{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(Ee,{children:i.jsx(ve,{...c})})]}),s&&u&&i.jsx(L4,{path:a,oidc:m?.oidc??null,redirectUri:m?.redirectUri??null,initial:u,close:()=>d(null),saved:l.refresh},u.identity?.id??"new")]})}function Kd(e){return`${Jo(e.provider,e.host)}${e.scope?` · ${e.scope}`:""}`}function L4({path:e,oidc:s,redirectUri:a,initial:l,close:c,saved:u}){const d=l.identity,[h,p]=T.useState(l.provider),[m,y]=T.useState(d?.kind??yo[l.provider][0]),[x,v]=T.useState(d?.host??li[l.provider].default??""),[b,w]=T.useState(d?.scope??""),[S,A]=T.useState(d?{...d.config}:{}),[k,z]=T.useState(""),[N,M]=T.useState(null),H=Ce(),L=li[h].fixed,P=h==="azure-devops"||h==="bitbucket",ue=re=>S[re]??"",se=(re,O)=>A(R=>({...R,[re]:O}));function $(re){p(re),y(yo[re][0]),v(li[re].default??""),w(""),A({}),z("")}const I={"github-app":["appId","slug"],"entra-federation":["tenantId","clientId"],"bitbucket-client-credentials":["key"],"oauth-refresh":["clientId"],"forgejo-integration":["audience"],"owner-account":[],"host-credentials":[]},X=m==="github-app"||m==="bitbucket-client-credentials"||m==="oauth-refresh",le=!!((L||x.trim())&&(!P||b.trim())&&I[m].every(re=>ue(re).trim())&&(!X||k.trim()));function te(){H.busy||c()}function F(re){if(re.preventDefault(),!le||H.busy)return;const O={provider:h,kind:m,...L?{}:{host:x.trim()},...P?{scope:b.trim()}:{},config:Object.fromEntries(I[m].map(R=>[R,ue(R).trim()])),...X?{secret:m==="github-app"?k:k.trim()}:{}};H.run(async()=>{const R=await fe(e,{method:"POST",body:O});z(""),u(),R.identity.kind==="oauth-refresh"?M(R.identity):c()})}function B(re){H.run(async()=>{const O=await fe(`${e}/${ce(re.id)}/authorize`,{method:"POST"});window.location.assign(O.url)})}const U=(re,O,R,Q)=>i.jsx(ge,{label:O,hint:R,children:i.jsx("input",{className:"input",required:!0,value:ue(re),onChange:E=>se(re,E.target.value),autoComplete:"off",spellCheck:!1,placeholder:Q})}),ee=re=>s?i.jsxs("div",{className:"stack",children:[i.jsx(In,{label:"Issuer",value:s.issuer}),i.jsx(In,{label:"Subject",value:s.subject}),re&&i.jsx(In,{label:"Audience",value:re})]}):i.jsx(xe,{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:te,footer:N?i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:H.busy,onClick:c,children:"Later"}),i.jsx(G,{variant:"default",disabled:H.busy,onClick:()=>B(N),children:"Authorize"})]}):i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:H.busy,onClick:te,children:"Cancel"}),i.jsx(G,{variant:"default",type:"submit",form:"push-identity-form",disabled:!le||H.busy,children:H.busy?"Verifying...":"Save"})]}),children:N?i.jsxs("div",{className:"stack",children:[i.jsxs("p",{children:["Saved. Sign in to ",Jo(N.provider,N.host)," as the bot account, then authorize the OAuth app so Pikibun can mint push tokens."]}),i.jsx(ve,{error:H.error})]}):i.jsxs("form",{id:"push-identity-form",className:"stack",onSubmit:F,children:[i.jsx(ge,{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:re=>$(re.target.value),children:Db.map(re=>i.jsx("option",{value:re,children:qn[re]},re))})}),yo[h].length>1&&i.jsx(ge,{label:"Identity type",children:i.jsx("select",{className:"select",value:m,onChange:re=>{y(re.target.value),A({}),z("")},children:yo[h].map(re=>i.jsx("option",{value:re,children:Ch[re]},re))})}),!L&&i.jsx(ge,{label:"Host",hint:"Hostname of the instance, for example git.example.com",children:i.jsx("input",{className:"input",required:!0,value:x,disabled:!!d,onChange:re=>v(re.target.value),autoComplete:"off",spellCheck:!1,placeholder:"git.example.com"})}),P&&i.jsx(ge,{label:h==="azure-devops"?"Azure DevOps organization":"Bitbucket workspace",children:i.jsx("input",{className:"input",required:!0,value:b,disabled:!!d,onChange:re=>w(re.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."}),U("appId","App ID"),U("slug","App slug","From the app's public URL: github.com/apps/<slug>"),i.jsx(ge,{label:"Private key",hint:"PEM file contents. Write-only",children:i.jsx("textarea",{className:"textarea mono",required:!0,value:k,onChange:re=>z(re.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:"}),ee(D4),U("tenantId","Tenant ID",void 0,"00000000-0000-0000-0000-000000000000"),U("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."}),U("key","Key"),i.jsx(ge,{label:"Secret",hint:"Write-only",children:i.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:re=>z(re.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(In,{label:"Redirect URI",value:a}):i.jsx(xe,{variant:"warning",title:"Redirect URI unavailable",children:"The operator has not configured Pikibun's application origin, so this identity cannot be authorized yet."}),U("clientId","Client ID"),i.jsx(ge,{label:"Client secret",hint:"Write-only",children:i.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:re=>z(re.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."}),ee(""),U("audience","Audience")]}),m==="owner-account"&&i.jsxs("p",{className:"muted small",children:["Agents push as the session owner, with ",R4[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(ve,{error:H.error})]})})}const Mw=[{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 eb(e){return Mw.find(s=>s.minutes===e)?.label??`Every ${e} minutes`}function _4(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 U4=32*1024*1024,B4={"verify-full":"TLS, server certificate verified",require:"TLS, server certificate not verified",disable:"Unencrypted"};function Vo(e){return`${e.host.includes(":")?`[${e.host}]`:e.host}:${e.port}/${e.database}`}function H4(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 $4({workspace:e,owner:s}){const a=`/api/workspaces/${ce(e.id)}/database`,l=Ie(a),c=Ce(),[u,d]=T.useState(!1),[h,p]=T.useState(!1),m=l.data,y=m?.database??null;async function x(){!y||c.busy||!await qe({title:"Disconnect database",message:`Disconnect ${Vo(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 fe(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:()=>p(!0)},{label:"Replace",icon:"refresh",disabled:c.busy,onSelect:()=>d(!0)}]:[],{label:"Disconnect",icon:"trash",destructive:!0,disabled:c.busy,onSelect:()=>{x()}}],b=_4(m?.backupStorage??!1),w=m?.available?s?`No database connected, so ${b}`:`No database connected, so ${b}. Only the workspace owner can connect one`:`Session databases are turned off on this server, so ${b}. The server's operator can turn them on with WORKSPACE_DATABASES=true`;return i.jsxs(Te,{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(G,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d(!0),children:"Connect database"}),children:[i.jsxs(ut,{...l,retry:l.refresh,children:[y?i.jsx(ie,{title:Vo(y),hint:i.jsxs(i.Fragment,{children:["User ",i.jsx("code",{children:y.user})," · ",B4[y.tls],y.customCa?" with a custom CA":""]}),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Ae,{tone:m?.available?"success":"warning",children:m?.available?"Connected":"Unavailable"}),s&&i.jsx(Wn,{label:"Actions for the session database",items:v})]})}):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:w})}),y&&m?.available&&m.automaticBackups&&i.jsx(I4,{path:a,database:y,owner:s,state:m.automaticBackups,saved:l.refresh}),y&&m&&!m.available&&i.jsx(Ee,{children:i.jsxs(xe,{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(Ee,{children:i.jsx(ve,{...c})})]}),s&&u&&m?.available&&i.jsx(G4,{path:a,privateHosts:m.privateHosts,existing:y,close:()=>d(!1),saved:l.refresh}),s&&h&&m?.available&&y&&i.jsx(q4,{path:a,database:y,close:()=>p(!1)})]})}function I4({path:e,database:s,owner:a,state:l,saved:c}){const u=Ce();function d(p){const m=p===""?null:Number(p);u.run(async()=>{await fe(`${e}/automatic-backups`,{method:"PUT",body:{minutes:m}}),c()},m===null?"Automatic backups turned off.":`Changed sessions are now backed up ${eb(m).toLowerCase()} at most.`)}async function h(p){p&&!await qe({title:"Confirm this database",message:`Back up your sessions in ${Vo(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 fe(`${e}/consent`,p?{method:"PUT",body:{databaseId:s.id}}:{method:"DELETE"}),c()},p?"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(ie,{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":`${eb(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:p=>d(p.target.value),children:Mw.map(p=>i.jsx("option",{value:p.minutes??"",children:p.label},p.label))})}),!a&&i.jsx(ie,{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(G,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>{h(!l.consented)},children:l.consented?"Withdraw":"Confirm database"})}),(u.error||u.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...u})})]})}function q4({path:e,database:s,close:a}){const[l,c]=T.useState(null),[u,d]=T.useState(null),h=Ce();function p(){h.busy||a()}function m(y){y.preventDefault(),!(!l||h.busy)&&(d(null),h.run(async()=>{if(l.size>U4)throw new Error("This dump is larger than 32 MiB. The server's operator can import it with the --import-dump option.");let x;try{x=JSON.parse(await l.text())}catch{throw new Error("This file is not a JSON dump.")}const v=await fe(`${e}/import`,{method:"POST",body:x});d(v.imported)}))}return i.jsx(an,{open:!0,title:"Import a dump",onClose:p,footer:i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:h.busy,onClick:p,children:u?"Done":"Cancel"}),!u&&i.jsx(G,{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 ",Vo(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(ge,{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(xe,{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(ve,{error:h.error})]})})}function G4({path:e,privateHosts:s,existing:a,close:l,saved:c}){const[u,d]=T.useState(""),[h,p]=T.useState(""),[m,y]=T.useState(a?.host??""),[x,v]=T.useState(String(a?.port??5432)),[b,w]=T.useState(a?.database??""),[S,A]=T.useState(a?.user??""),[k,z]=T.useState(""),[N,M]=T.useState(a&&(a.tls!=="disable"||s)?a.tls:"verify-full"),[H,L]=T.useState(""),P=Ce(),ue=Number(x),se=!!(m.trim()&&b.trim()&&S.trim()&&k)&&Number.isInteger(ue)&&ue>=1&&ue<=65535;function $(){P.busy||l()}function I(){try{const le=H4(u);y(le.host),v(le.port),le.database&&w(le.database),le.user&&A(le.user),le.password&&z(le.password),le.unencrypted&&s&&M("disable"),d(""),p("")}catch(le){p(le instanceof Error?le.message:"The connection URL could not be read.")}}function X(le){if(le.preventDefault(),!se||P.busy)return;const te={host:m.trim(),port:ue,database:b.trim(),user:S.trim(),password:k,tls:N,...N==="verify-full"&&H.trim()?{caCertificate:H.trim()}:{}};P.run(async()=>{await fe(e,{method:"PUT",body:te}),z(""),c(),l()})}return i.jsx(an,{open:!0,title:a?"Replace session database":"Connect session database",onClose:$,footer:i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:P.busy,onClick:$,children:"Cancel"}),i.jsx(G,{variant:"default",type:"submit",form:"workspace-database-form",disabled:!se||P.busy,children:P.busy?"Connecting...":"Save"})]}),children:i.jsxs("form",{id:"workspace-database-form",className:"stack",onSubmit:X,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(ge,{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:le=>d(le.target.value),autoComplete:"off",spellCheck:!1,placeholder:"postgres://user:password@db.example.com:5432/pikibun"})}),i.jsx("div",{className:"inline",children:i.jsx(G,{variant:"outline",size:"sm",disabled:!u.trim()||P.busy,onClick:I,children:"Fill in from URL"})}),i.jsx(ve,{error:h}),i.jsx(ge,{label:"Host",hint:"Host name or IP address, without a scheme or port",children:i.jsx("input",{className:"input",required:!0,value:m,onChange:le=>y(le.target.value),autoComplete:"off",spellCheck:!1,placeholder:"db.example.com"})}),i.jsx(ge,{label:"Port",children:i.jsx("input",{className:"input",required:!0,inputMode:"numeric",value:x,onChange:le=>v(le.target.value),autoComplete:"off",spellCheck:!1})}),i.jsx(ge,{label:"Database",children:i.jsx("input",{className:"input",required:!0,value:b,onChange:le=>w(le.target.value),autoComplete:"off",spellCheck:!1})}),i.jsx(ge,{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:le=>A(le.target.value),autoComplete:"off",spellCheck:!1})}),i.jsx(ge,{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:le=>z(le.target.value),autoComplete:"new-password"})}),i.jsx(ge,{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:N,onChange:le=>M(le.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"})]})}),N==="verify-full"&&i.jsx(ge,{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:H,onChange:le=>L(le.target.value),autoComplete:"off",spellCheck:!1,placeholder:"-----BEGIN CERTIFICATE-----"})}),N==="require"&&i.jsx(xe,{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."}),N==="disable"&&i.jsx(xe,{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(ve,{error:P.error})]})})}const $s={owner:"Owner",admin:"Admin",collaborator:"Collaborator",member:"Member",viewer:"Viewer"},cf={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 F4({id:e}){const{user:s,workspaces:a,workspacesLoading:l,workspacesError:c,refreshWorkspaces:u}=vt(),[d,h]=T.useState(!1),p=i.jsx(Bh,{open:d,onClose:()=>h(!1)});if(e){const m=a.find(y=>y.id===e);return m?i.jsxs(i.Fragment,{children:[i.jsx(tb,{}),i.jsx(P4,{user:s,workspace:m},m.id)]}):l?i.jsx(oi,{}):i.jsxs(i.Fragment,{children:[i.jsx(tb,{}),c?i.jsx(xe,{variant:"error",title:"Unable to load workspaces",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:u,children:"Try again"}),children:c}):i.jsx(bt,{title:"Workspace not found"})]})}return l&&!a.length?i.jsx(oi,{}):c&&!a.length?i.jsx(xe,{variant:"error",title:"Unable to load workspaces",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:u,children:"Try again"}),children:c}):a.length?i.jsxs(i.Fragment,{children:[i.jsx(Te,{title:"Workspaces",info:"A shared home for your repositories, people, agents and sessions",action:i.jsx(G,{variant:"outline",size:"sm",icon:"plus",onClick:()=>h(!0),children:"New workspace"}),children:a.map(m=>i.jsx(ie,{leading:i.jsx(Mi,{name:m.name,id:m.id}),title:m.name,hint:$s[Lw(m,s)],href:Ze({name:"settings",section:"workspaces",id:m.id}),chevron:!0},m.id))}),p]}):i.jsxs(i.Fragment,{children:[i.jsx(bt,{title:"No workspaces yet",action:i.jsx(G,{variant:"default",icon:"plus",onClick:()=>h(!0),children:"New workspace"})}),p]})}function tb(){return i.jsxs("a",{className:"btn ghost sm",href:Ze({name:"settings",section:"workspaces"}),children:[i.jsx(ke,{name:"chevron-left",size:16}),"Workspaces"]})}function Lw(e,s){return e.ownerId===s.id?"owner":e.role??"member"}function P4({user:e,workspace:s}){const a=Lw(s,e),l=a==="owner"||a==="admin",c=Mb(s.id),u=g4(s.id),d=h4(s.id),h=()=>{c.refresh(),u.refresh(),d.refresh()};return i.jsxs(i.Fragment,{children:[i.jsxs(Te,{title:"General",children:[i.jsx(ie,{title:"Name",trailing:i.jsx("span",{children:s.name})}),i.jsx(ie,{title:"Your role",trailing:i.jsx(Ae,{tone:l?"success":"neutral",children:$s[a]})})]}),Pr(a)&&i.jsx(V4,{user:e,workspace:s,admin:l,sourceCount:c.sourceCount}),i.jsx(Z4,{workspace:s,admin:l,...c,connections:d.connections,changed:h,documents:i.jsx(v4,{workspaceId:s.id,workspaceName:s.name,admin:l,...u,connections:d.connections,changed:h})}),i.jsx(m4,{workspaceId:s.id,admin:l,...d,changed:h}),i.jsx(M4,{workspace:s,admin:l}),i.jsx(E4,{workspace:s,admin:l}),i.jsx(z4,{workspace:s,admin:l}),i.jsx(O4,{workspace:s,admin:l}),i.jsx($4,{workspace:s,owner:a==="owner"}),i.jsx(K4,{workspace:s,admin:l,owner:a==="owner"}),l&&i.jsx(Y4,{workspace:s})]})}function Y4({workspace:e}){return i.jsx(Te,{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(ie,{title:"Workspace data",hint:"JSON, without secrets",trailing:i.jsx(It,{variant:"outline",size:"sm",href:`/api/workspaces/${ce(e.id)}/export`,download:!0,children:"Export"})})})}function V4({user:e,workspace:s,admin:a,sourceCount:l}){const{sessions:c,sessionsLoading:u}=vt(),d=Qr(`/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(p=>!p.revokedAt&&p.online&&(p.ownerId===e.id||p.workspaceIds.includes(s.id))),link:Ze({name:"settings",section:"hosts"})},{label:"Start a session",done:c.some(p=>p.workspaceId===s.id),link:Ze({name:"new",workspaceId:s.id})}];return h.every(p=>p.done)?null:i.jsx(Te,{title:"Setup",action:i.jsxs("span",{className:"muted small",children:[h.filter(p=>p.done).length," / ",h.length]}),children:h.map(p=>i.jsx(ie,{leading:i.jsx(cs,{tone:p.done?"success":"neutral",label:p.done?"Done":"To do"}),title:p.label,hint:p.done?void 0:p.hint,href:p.done?void 0:p.link,onClick:p.done?void 0:p.onClick,chevron:!p.done},p.label))})}function Z4({workspace:e,admin:s,repositories:a,sourceCount:l,loading:c,error:u,refresh:d,documents:h,connections:p,changed:m}){const y=Ce(),x=Lb(s),[v,b]=T.useState(!1),w=(a?.length??0)>=Vr.repositories;async function S(M){if(y.busy||!s)return;const H=l===1;await qe({title:"Remove repository",message:`Remove ${M.fullName} from ${e.name}? Existing sessions keep their pinned snapshots.${H?" 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 fe(`/api/workspaces/${ce(e.id)}/repositories/${ce(M.id)}`,{method:"DELETE"}),d()},"Repository removed. Existing sessions keep their pinned snapshots.")}function A(M,H){y.busy||!s||y.run(async()=>{await fe(`/api/workspaces/${ce(e.id)}/repositories/${ce(M.id)}/push-policy`,{method:"PUT",body:{forbidDefaultBranch:!H}}),d()},"Push policy saved.")}function k(M,H){y.busy||!s||y.run(async()=>{await fe(`/api/workspaces/${ce(e.id)}/repositories/${ce(M.id)}/lfs`,{method:"PUT",body:{enabled:H}}),d()},H?"Git LFS turned on. New clones download LFS files.":"Git LFS turned off. Clones check out LFS pointer files.")}const z=p?.filter(M=>M.family==="git")??[],N=s&&!!(x.accounts?.length||z.length)&&!w;return i.jsxs(Te,{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(Uh,{})]}),action:N&&i.jsx(G,{variant:"outline",size:"sm",icon:"plus",disabled:c||!!u||y.busy,onClick:()=>b(!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(ut,{loading:c,error:u,retry:d,children:[a?.length?a.map(M=>i.jsx(ie,{title:M.fullName,hint:i.jsxs(i.Fragment,{children:[Jo(M.provider,M.host)," · ",i.jsx("code",{children:M.ref})]}),trailing:i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"inline small",children:[i.jsx("input",{type:"checkbox",className:"checkbox",checked:!M.forbidDefaultBranchPush,disabled:!s||y.busy,onChange:H=>A(M,H.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:M.lfs,disabled:!s||y.busy,onChange:H=>k(M,H.target.checked)}),"Git LFS"]}),M.provider!=="github"&&i.jsx(Rw,{workspaceId:e.id,sourceId:M.id,title:M.fullName,readAs:M.readAs,connection:f4(p,M),admin:s,action:y,changed:m}),i.jsx(Ae,{children:M.private?"Private":"Public"}),s&&i.jsx(G,{variant:"outline",size:"sm",disabled:y.busy,"aria-label":`Remove ${M.fullName}`,onClick:()=>{S(M)},children:"Remove"})]})},M.id)):i.jsx(Ee,{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(Ee,{children:i.jsx(ve,{...y})})]})}),s&&x.error&&i.jsx(xe,{variant:"error",title:"Unable to load Git accounts",actions:i.jsx(G,{variant:"outline",size:"sm",onClick:x.refresh,children:"Try again"}),children:x.error}),s&&x.accounts&&!x.accounts.length&&!z.length&&i.jsx(xe,{variant:"warning",title:"No Git accounts connected",actions:i.jsx(It,{variant:"outline",size:"sm",href:Ze({name:"settings",section:"profile"}),children:"Open profile"}),children:"Connect GitHub or add a Git account in Settings → Profile before choosing repositories."}),s&&!!x.accounts?.length&&w&&i.jsxs(xe,{variant:"info",title:"Repository limit reached",children:["The workspace has reached its ",Vr.repositories,"-repository limit. Remove a binding to choose another."]})]}),h,N&&i.jsx(Q4,{open:v,workspace:e,accounts:[...x.accounts??[],...z.map(X4)],repositories:a??[],disabled:c||!!u||y.busy,refresh:d,close:()=>b(!1)})]})}const Do="workspace:";function X4(e){return{id:`${Do}${e.id}`,provider:e.provider,host:e.host,organization:e.organization,login:e.name,createdAt:e.createdAt}}function Q4({open:e,workspace:s,accounts:a,repositories:l,disabled:c,refresh:u,close:d}){const[h,p]=T.useState(""),[m,y]=T.useState(""),[x,v]=T.useState(""),b=a.find(ee=>ee.id===h)??a[0],w=b?i1(b.provider):!0,S=b?.id.startsWith(Do)??!1,A=b?S?`/api/workspaces/${ce(s.id)}/connections/${ce(b.id.slice(Do.length))}/repositories`:`/api/git/accounts/${ce(b.id)}/repositories`:null,[k,z]=T.useState(""),[N,M]=T.useState(null),H=Ce(),L=Ie(e&&A&&w?A:null),P=Ce(),ue=w?L.data?.repositories.find(ee=>ee.id===m):N??void 0,se=ee=>l.some(re=>re.provider===b?.provider&&re.host===b.host&&(re.repositoryId===ee.id||re.fullName.toLowerCase()===ee.fullName.toLowerCase())),$=c||P.busy||H.busy||w&&(L.loading||!!L.error)||!b||!ue||se(ue)||l.length>=Vr.repositories,I=b?qn[b.provider]:"Git";function X(ee){y(ee),v("")}function le(ee){p(ee),X(""),z(""),M(null)}function te(){!b||H.busy||!k.trim()||(M(null),v(""),H.run(async()=>{const ee=await fe(`${A}?path=${encodeURIComponent(k.trim())}`);M(ee.repositories[0]??null)}))}function F(){P.busy||(y(""),v(""),z(""),M(null),d())}function B(ee){ee.preventDefault(),!($||!ue||!b)&&P.run(async()=>{await fe(`/api/workspaces/${ce(s.id)}/repositories`,{method:"POST",body:{provider:b.provider,host:b.host,repositoryId:ue.id,fullName:ue.fullName,...x.trim()?{ref:x.trim()}:{},...S?{readAs:"workspace"}:{}}}),u(),y(""),v(""),z(""),M(null),d()})}const U=i.jsx(ge,{label:"Branch, tag or commit",hint:`Optional. Leave blank to use ${ue?`the default branch, ${ue.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:x,onChange:ee=>v(ee.target.value),disabled:c||P.busy||!ue,autoComplete:"off",spellCheck:!1,maxLength:255,placeholder:ue?.defaultBranch??"Repository default branch"})});return i.jsx(an,{open:e,title:"Add repository",onClose:F,footer:i.jsxs(i.Fragment,{children:[i.jsx(G,{disabled:P.busy,onClick:F,children:"Cancel"}),i.jsx(G,{variant:"default",type:"submit",form:"repository-picker-form",disabled:$,children:P.busy?"Binding...":"Bind repository"})]}),children:i.jsxs("form",{id:"repository-picker-form",className:"stack",onSubmit:B,children:[i.jsxs("div",{className:"field",children:[i.jsx("span",{className:"field-label",children:"Account"}),i.jsx(Vt,{label:"Account",placeholder:"Choose an account",value:b?.id??"",disabled:c||P.busy,options:a.map(ee=>ee.id.startsWith(Do)?{value:ee.id,label:`Workspace · ${Br({family:"git",provider:ee.provider,host:ee.host,organization:ee.organization})}`,hint:ee.login}:{value:ee.id,label:nh(ee),hint:ee.login}),onChange:le})]}),S&&i.jsxs("p",{className:"muted small",children:["Sessions read this repository with the workspace's connection (",b?.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 ",I," 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&&b&&i.jsxs(i.Fragment,{children:[i.jsx(ge,{label:"Clone URL or path",hint:`The repository's https:// clone URL on ${b.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:ee=>{z(ee.target.value),M(null)},onKeyDown:ee=>{ee.key==="Enter"&&(ee.preventDefault(),te())},disabled:c||P.busy||H.busy,autoComplete:"off",spellCheck:!1,maxLength:600,placeholder:`https://${b.host}/team/project.git`}),i.jsx(G,{variant:"outline",size:"sm",disabled:c||P.busy||H.busy||!k.trim(),onClick:te,children:H.busy?"Checking...":"Look up"})]})}),N&&i.jsx(ie,{leading:i.jsx(ke,{name:"git-branch",size:16}),title:N.fullName,hint:`${N.private?"Private":"Public"} · default branch ${N.defaultBranch}${se(N)?" · Already configured":""}`}),i.jsx(ve,{error:H.error}),N&&U]}),w&&i.jsx(ut,{...L,retry:L.refresh,children:L.data?.repositories.length?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field",children:[i.jsxs("span",{className:"field-label",children:[I," repository"]}),i.jsx(Vt,{label:`${I} repository`,placeholder:"Choose a repository",value:ue?.id??"",disabled:c||P.busy,options:L.data.repositories.map(ee=>({value:ee.id,label:ee.fullName,disabled:se(ee),hint:`${ee.private?"Private":"Public"}${se(ee)?" · Already configured":""}`})),onChange:X}),L.data.truncated&&i.jsxs("span",{className:"field-hint",children:["Only the first ",Vr.pickerRepositories.toLocaleString()," repositories this account can access are listed"]})]}),U]}):i.jsxs(bt,{title:"No repositories found",children:["Check your ",I," account and organization access"]})}),L.error&&i.jsxs("p",{className:"muted small",children:["Review your ",i.jsx("a",{href:Ze({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(ve,{error:P.error})]})})}function K4({workspace:e,admin:s,owner:a}){const l=`/api/workspaces/${ce(e.id)}/members`,c=Ie(l),[u,d]=T.useState(!1),[h,p]=T.useState(null),m=Ce();async function y(x){await qe({title:"Remove member",message:`Remove ${Mt(Li(x))} from this workspace?`,confirmLabel:"Remove",destructive:!0})&&m.run(async()=>{await fe(`${l}/${ce(x.userId)}`,{method:"DELETE"}),c.refresh()},"Membership removed.")}return i.jsxs(i.Fragment,{children:[i.jsx(Te,{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(G,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d(!0),children:"Add member"}),children:i.jsxs(ut,{...c,retry:c.refresh,children:[c.data?.members.length?c.data.members.map(x=>{const v=Li(x),b=x.displayName||Us(v);return i.jsx(ie,{leading:i.jsx(Mi,{name:b,id:x.userId}),title:b,hint:Mt(v),trailing:i.jsxs(i.Fragment,{children:[i.jsx(Ae,{tone:x.role==="owner"||x.role==="admin"?"success":"neutral",children:$s[x.role]}),s&&x.userId!==e.ownerId&&(a||db.includes(x.role))&&i.jsx(Wn,{label:`Actions for ${b}`,items:[{label:"Change role",icon:"shield",disabled:m.busy,onSelect:()=>p(x)},{label:"Remove",icon:"trash",destructive:!0,disabled:m.busy,onSelect:()=>{y(x)}}]})]})},x.userId)}):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:"No members to display"})}),(m.error||m.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...m})})]})}),s&&i.jsx(J4,{workspace:e}),s&&i.jsx(W4,{workspace:e,owner:a,accepted:c.refresh}),s&&i.jsx(tR,{open:u,path:l,owner:a,close:()=>d(!1),saved:c.refresh}),s&&h&&i.jsx(eR,{member:h,path:l,owner:a,close:()=>p(null),saved:c.refresh},h.userId)]})}function J4({workspace:e}){const s=`/api/workspaces/${ce(e.id)}/invite-link`,a=Ie(s),l=Ce(),c=a.data?.link;function u(){l.busy||l.run(async()=>{a.setData(await fe(s,{method:"PUT"}))},"Invite link created. Share it with the people you want to invite.")}async function d(h){l.busy||!await qe(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 fe(s,{method:"DELETE"}),a.setData(h?await fe(s,{method:"PUT"}):{link:null})},h?"Invite link replaced. The old link no longer works.":"Invite link turned off.")}return i.jsx(Te,{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(Wn,{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(G,{variant:"outline",size:"sm",icon:"plus",disabled:l.busy,onClick:u,children:"Create link"}),children:i.jsxs(ut,{...a,retry:a.refresh,children:[c?i.jsx(Ee,{children:i.jsx(ge,{label:"Invite link",hint:i.jsxs(i.Fragment,{children:["Created ",i.jsx(Qn,{value:c.createdAt}),". Anyone who opens it can ask to join"]}),children:i.jsx(In,{value:c.url,label:"Copy invite link"})})}):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:"No invite link. Create one to let people ask to join"})}),(l.error||l.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...l})})]})})}function W4({workspace:e,owner:s,accepted:a}){const l=`/api/workspaces/${ce(e.id)}/join-requests`,c=Ie(l),u=Ce(),[d,h]=T.useState({}),p=uf(s),m=c.data?.requests??[];function y(v,b){if(u.busy)return;const w=d[v.userId]??"member";u.run(async()=>{c.setData(await fe(`${l}/${ce(v.userId)}/accept`,{method:"POST",body:{role:w}})),a()},`${b} joined as ${$s[w].toLowerCase()}.`)}async function x(v,b){u.busy||!await qe({title:"Decline request",message:`Decline ${b}'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 fe(`${l}/${ce(v.userId)}`,{method:"DELETE"}))},"Request declined.")}return i.jsx(Te,{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(G,{variant:"ghost",size:"sm",icon:"refresh","aria-label":"Refresh pending members",disabled:c.loading,onClick:c.refresh}),children:i.jsxs(ut,{...c,retry:c.refresh,children:[m.length?m.map(v=>{const b=Li({...v,role:"member"}),w=v.displayName||Us(b),S=d[v.userId]??"member";return i.jsx(ie,{leading:i.jsx(Mi,{name:w,id:v.userId}),title:w,hint:i.jsxs(i.Fragment,{children:[Mt(b)," · asked ",i.jsx(Qn,{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:cf[S],onChange:A=>h(k=>({...k,[v.userId]:A.target.value})),children:p.map(A=>i.jsx("option",{value:A,children:$s[A]},A))}),i.jsx(G,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>y(v,w),children:"Accept"}),i.jsx(G,{variant:"ghost",size:"sm",disabled:u.busy,"aria-label":`Decline ${w}`,onClick:()=>{x(v,w)},children:"Decline"})]})},v.userId)}):i.jsx(Ee,{children:i.jsx("span",{className:"muted",children:"Nobody is waiting to join"})}),(u.error||u.notice)&&i.jsx(Ee,{children:i.jsx(ve,{...u})})]})})}function uf(e){return w0.filter(s=>e||db.includes(s))}function eR({member:e,path:s,owner:a,close:l,saved:c}){const u=e.role==="owner"?null:e.role,[d,h]=T.useState(u??"member"),p=uf(a),m=Ce(),y=e.displayName||Us(Li(e));function x(v){v.preventDefault(),!(m.busy||d===u)&&m.run(async()=>{await fe(`${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(G,{disabled:m.busy,onClick:l,children:"Cancel"}),i.jsx(G,{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:x,children:[i.jsx(ge,{label:"Role",hint:`${cf[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:p.map(v=>i.jsxs("option",{value:v,children:[$s[v],v===u?" (current)":""]},v))})}),i.jsx(ve,{error:m.error})]})})}function tR({open:e,path:s,owner:a,close:l,saved:c}){const[u,d]=T.useState(""),[h,p]=T.useState("member"),m=uf(a),y=Ce();function x(v){v.preventDefault(),!(y.busy||!u.trim())&&y.run(async()=>{await fe(s,{method:"POST",body:{userId:eh(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(G,{disabled:y.busy,onClick:l,children:"Cancel"}),i.jsx(G,{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:x,children:[i.jsx(ge,{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(ge,{label:"Role",hint:cf[h],children:i.jsx("select",{className:"select",value:h,onChange:v=>p(v.target.value),children:m.map(v=>i.jsx("option",{value:v,children:$s[v]},v))})}),i.jsx(ve,{error:y.error})]})})}const nR=[{id:"profile",label:"Profile",icon:"user"},{id:"hosts",label:"Hosts",icon:"server"},{id:"desktop",label:"This Computer",icon:"monitor",desktop:!0},{id:"workspaces",label:"Workspaces",icon:"users"},{id:"appearance",label:"Appearance",icon:"palette"},{id:"admin",label:"Administration",icon:"shield",admin:!0}],iR=()=>/Mac/i.test(navigator.platform)?"This Mac":"This Computer";function sR({section:e,id:s}){const{user:a}=vt(),l=!!of(),c=nR.filter(d=>(!d.admin||a.instanceAdmin)&&(!d.desktop||l)).map(d=>d.desktop?{...d,label:iR()}:d),u=c.find(d=>d.id===e)??c[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"}),c.map(d=>i.jsxs("a",{className:"nav-item",href:Ze({name:"settings",section:d.id}),"aria-current":d.id===u.id?"page":void 0,children:[i.jsx(ke,{name:d.icon}),i.jsx("span",{className:"label",children:d.label})]},d.id))]}),i.jsxs("div",{className:"settings-detail",children:[i.jsx(Zo,{title:u.label}),i.jsx("div",{className:"content-column",children:u.id==="profile"?i.jsx(C4,{}):u.id==="hosts"?i.jsx(e4,{id:s}):u.id==="desktop"?i.jsx(RO,{}):u.id==="workspaces"?i.jsx(F4,{id:s}):u.id==="admin"?i.jsx(EO,{}):i.jsx(zO,{})})]})]})}const ko={busyMs:3e3,idleMs:15e3,firstBackoffMs:5e3,maxBackoffMs:6e4};function aR(e){const[s,a]=T.useState({session:null,view:null,error:"",invalid:!1});return T.useEffect(()=>{const l=new AbortController,c={"X-Share-Token":e};let u,d=!1,h=0,p=!1;function m(){if(clearTimeout(u),l.signal.aborted||document.hidden)return;const v=h?Math.min(ko.maxBackoffMs,ko.firstBackoffMs*2**(h-1)):p?ko.busyMs:ko.idleMs;u=setTimeout(()=>{y()},v)}async function y(){if(!(l.signal.aborted||d)){d=!0,clearTimeout(u);try{const{session:v}=await fe("/api/shared",{signal:l.signal,headers:c});if(l.signal.aborted)return;a(w=>({...w,session:v}));const{view:b}=await fe("/api/shared/view",{signal:l.signal,headers:c});if(l.signal.aborted)return;p=b.busy,h=0,a(w=>({...w,view:b,error:""}))}catch(v){if(l.signal.aborted)return;if(v instanceof Xn&&v.status===404&&v.code==="not_found"){a({session:null,view:null,error:"",invalid:!0});return}h++,a(b=>({...b,error:Tn(v)}))}finally{d=!1}m()}}function x(){document.hidden?clearTimeout(u):y()}return document.addEventListener("visibilitychange",x),y(),()=>{l.abort(),clearTimeout(u),document.removeEventListener("visibilitychange",x)}},[e]),s}function rR({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 nb({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(ke,{name:s,size:14}),i.jsx("span",{className:"truncate",children:a}),i.jsx(ke,{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 lR({entry:e}){const{prose:s,calls:a}=e.role==="assistant"?Wo(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:_o(e.durationMs)})]}),h=e.trimmed&&e.role==="toolResult"&&e.text.trim()?i.jsxs("span",{className:"muted",children:[" · ",e.text]}):null;return i.jsx(nb,{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(xe,{variant:"error",title:fw,children:mw(e.error.compaction,{advice:!1})})}):i.jsx("div",{className:"entry-error",title:e.kind,children:i.jsx(xe,{variant:"error",title:"Model request failed",children:rR(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:_o(e.durationMs)});return i.jsxs("div",{className:"entry-assistant","data-role":e.role,title:e.kind,children:[i.jsx(Fv,{text:s}),l&&i.jsx(nb,{icon:"tool",label:l,text:a.map(u=>u.line).join(`
|
|
58
|
-
`),trimmed:e.trimmed}),c&&i.jsx("div",{className:"entry-actor",children:c})]})}function oR({token:e}){const{session:s,view:a,error:l,invalid:c}=aR(e),u=T.useRef(null),d=T.useRef(!0),h=(a?.entries??[]).filter(x=>x.role!=="system"||x.text.trim()),p=h.at(-1)?.id,m=s?.title;if(T.useEffect(()=>{document.title=m?`${m} · Pikibun`:"Shared session · Pikibun"},[m]),T.useLayoutEffect(()=>{const x=u.current;x&&d.current&&(x.scrollTop=x.scrollHeight)},[p,h.length]),c||!s)return!c&&!l?i.jsx(oi,{}):i.jsx("div",{className:"welcome",children:i.jsxs("main",{id:"main-content",className:"welcome-inner",tabIndex:-1,children:[i.jsx(Ra,{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(xe,{variant:"error",title:"Couldn't load the shared session",children:[l," This page keeps trying."]})]})});const y=l?i.jsx(Ae,{tone:"warning",dot:!0,children:"Reconnecting"}):a?a.busy?i.jsx(Ae,{tone:"running",dot:!0,children:"Working"}):s.status==="archived"?i.jsx(Ae,{tone:"neutral",children:"Archived"}):i.jsx(Ae,{tone:"success",dot:!0,children:"Live"}):i.jsx(Ae,{tone:"neutral",dot:!0,children:"Connecting"});return i.jsxs("div",{className:"shared-screen",children:[i.jsx(Zo,{leading:i.jsx(Ra,{size:22}),title:s.title,subtitle:`Shared by ${s.ownerName}`,actions:i.jsxs("span",{className:"session-badges",children:[y,i.jsx(Ae,{children:"Read-only"})]})}),l&&a&&i.jsx("div",{className:"session-alerts",children:i.jsxs(xe,{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:x=>{const v=x.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<80},children:i.jsx("div",{className:"chat-column",children:a?h.length?h.map(x=>i.jsx(lR,{entry:x},x.id)):i.jsx(bt,{title:"The conversation begins here",children:"Messages and tool results appear here as the work goes on"}):l?i.jsx(bt,{title:"The conversation isn't available right now",children:"The session's host may be offline. This page keeps trying."}):i.jsx(oi,{})})}),i.jsx("footer",{className:"shared-status",children:i.jsxs("div",{className:"chat-column",children:[a?.busy?i.jsxs(i.Fragment,{children:[i.jsx(Ls,{}),"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 Jd=6,_w="pikibun.collapsedWorkspaces";function cR(){try{return JSON.parse(localStorage.getItem(_w)??"[]")}catch{return[]}}function uR({workspace:e,sessions:s,route:a,collapsed:l,toggle:c,onNavigate:u}){const{user:d,selectWorkspace:h,liveActivity:p}=vt(),[m,y]=T.useState(!1),x=yw(s),v=m?x:x.slice(0,Jd),b=Ze({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(Mi,{name:e.name,id:e.id}),i.jsx("span",{className:"label",children:e.name})]}),i.jsxs("div",{className:"row-actions",children:[Pr(e.role)&&i.jsx("a",{className:"btn ghost xs icon-only",href:b,"aria-label":`New session in ${e.name}`,title:"New session",onClick:()=>{h(e.id),u()},children:i.jsx(ke,{name:"plus",size:14})}),i.jsx(Wn,{label:`${e.name} options`,items:[...Pr(e.role)?[{label:"New session",icon:"plus",onSelect:()=>{h(e.id),window.location.hash=b,u()}}]:[],{label:"Workspace settings",icon:"settings",onSelect:()=>{window.location.hash=Ze({name:"settings",section:"workspaces",id:e.id}),u()}}]})]})]}),!l&&i.jsxs("ul",{children:[v.map(({session:w,depth:S})=>{const A=a.name==="session"&&a.sessionId===w.id,k=w.ownerId===d.id?null:w.permissions?.every(N=>N==="read")?"Viewer":"Shared",z=gw(w,p?.sessionId===w.id?p.activity:void 0);return i.jsx("li",{style:S?{marginLeft:S*12}:void 0,children:i.jsxs("a",{className:"nav-item session-item",href:Ze({name:"session",sessionId:w.id}),"aria-current":A?"page":void 0,onClick:()=>{h(e.id),u()},children:[i.jsx(cs,{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(Zv,{pull:w.pullRequest},"pull"),k].filter(Boolean).flatMap((N,M)=>M?[" · ",N]:[N])})]}),i.jsx("span",{className:"meta",children:i.jsx(Qn,{value:w.createdAt})})]})},w.id)}),s.length>Jd&&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-Jd} more`})})}),!s.length&&i.jsx("li",{children:i.jsx("a",{className:"nav-item session-item",href:b,onClick:()=>{h(e.id),u()},children:i.jsx("span",{className:"label muted",children:"Start a session"})})})]})]})}function dR({route:e,onNavigate:s}){const{user:a,workspaces:l,workspacesLoading:c,workspacesError:u,sessions:d,sessionsLoading:h,currentWorkspace:p}=vt(),[m,y]=T.useState(!1),[x,v]=T.useState(cR);function b(S){v(A=>{const k=A.includes(S)?A.filter(z=>z!==S):[...A,S];try{localStorage.setItem(_w,JSON.stringify(k))}catch{}return k})}const w=p&&Pr(p.role)?Ze({name:"new",workspaceId:p.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(Ra,{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(ke,{name:"plus"}),i.jsx("span",{className:"label",children:"New session"})]}),i.jsxs("a",{className:"nav-item",href:Ze({name:"sessions"}),onClick:s,"aria-current":e.name==="sessions"?"page":void 0,children:[i.jsx(ke,{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(Bt,{})}):u?i.jsx("p",{className:"field-error",style:{padding:8},children:u}):l.length?l.map(S=>i.jsx(uR,{workspace:S,route:e,onNavigate:s,sessions:d.filter(A=>A.workspaceId===S.id&&(A.status!=="archived"||e.name==="session"&&e.sessionId===A.id)),collapsed:x.includes(S.id),toggle:()=>b(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(Bt,{children:"Loading sessions..."})}),!c&&l.length>0&&i.jsxs("button",{type:"button",className:"nav-item",style:{marginTop:12},onClick:()=>y(!0),children:[i.jsx(ke,{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:Ze({name:"settings",section:"profile"}),onClick:s,title:a.displayName,children:[i.jsx(Mi,{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:Ze({name:"settings",section:"hosts"}),onClick:s,"aria-label":"Hosts",title:"Hosts",children:i.jsx(ke,{name:"server"})}),i.jsx("a",{className:"btn ghost sm icon-only",href:Ze({name:"settings",section:"profile"}),onClick:s,"aria-label":"Settings",title:"Settings","aria-current":e.name==="settings"?"page":void 0,children:i.jsx(ke,{name:"settings"})})]}),i.jsx(Bh,{open:m,onClose:()=>{y(!1),s()}})]})}jh();f0();const Uw=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 hR(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 fR({error:e,retry:s,inviteToken:a}){const l=a!==void 0,c=Ie("/api/health"),[u,d]=T.useState(!1),[h,p]=T.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)}`:""),x=c.data?.githubConfigured===!1,v=c.data?.passwordAuth===!0,b=x&&!v,w=c.data?.localServer,S=[...!x&&!w?[c.data?.githubSignup??"open"]:[],...v?[c.data?.passwordSignup??"off"]:[]],A=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),p("");try{const N=await fetch("/api/auth/github/start",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({inviteToken:a})}),M=await N.json().catch(()=>null);if(!N.ok||typeof M?.url!="string")throw new Error(typeof M?.error=="string"?M.error:`GitHub sign-in could not start (HTTP ${N.status}).`);window.location.assign(M.url)}catch(N){p(N instanceof Error?N.message:"GitHub sign-in could not start."),d(!1)}}}return i.jsxs("div",{className:"welcome",children:[Uw,i.jsxs("main",{id:"main-content",className:"welcome-inner",tabIndex:-1,children:[i.jsx(Ra,{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(xe,{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(xe,{variant:"error",title:"Sign-in problem",children:y}),b&&(w?i.jsxs(xe,{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(xe,{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."})),!b&&w&&!w.claimed&&i.jsxs(xe,{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(d1,{signedIn:s,signup:c.data?.passwordSignup??"off",inviteToken:a}),v&&!x&&i.jsx("div",{className:"sign-in-divider",role:"separator",children:"or"}),!x&&i.jsxs("a",{className:"btn default lg",href:"/api/auth/github","aria-disabled":u,onClick:z=>{k(z)},children:[i.jsx(Lo,{}),"Continue with GitHub"]}),A&&i.jsx("p",{className:"welcome-footnote",children:A}),(y||b)&&i.jsx(G,{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&&!x&&" Repositories on github.com need the GitHub sign-in; a password account reaches other Git providers with their tokens."]})]})]})}function mR(){const{workspaces:e,workspacesLoading:s,workspacesError:a,refreshWorkspaces:l,currentWorkspace:c}=vt(),[u,d]=T.useState(!1);return s?i.jsx(oi,{}):a?i.jsx("div",{className:"content-column",children:i.jsx(xe,{variant:"error",title:"Could not load workspaces",actions:i.jsx(G,{size:"sm",onClick:l,children:"Try again"}),children:a})}):c?i.jsx(_b,{workspaceId:c.id},c.id):i.jsxs("div",{className:"welcome",children:[i.jsxs("div",{className:"welcome-inner",children:[i.jsx(Ra,{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(G,{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(Oh,{})]}),i.jsx(Bh,{open:u,onClose:()=>d(!1)})]})}function pR(){const e=zh(),[s,a]=T.useState(!1);T.useEffect(()=>{document.title=hR(e)},[e]),T.useEffect(()=>{document.getElementById("main-content")?.scrollTo({top:0})},[e]),T.useEffect(()=>{const u=y0();u&&e.name!=="join"&&ds({name:"join",token:u})},[]);const l=e.name==="session"?i.jsx(wO,{sessionId:e.sessionId},e.sessionId):e.name==="join"?i.jsx(b0,{token:e.token},e.token):e.name==="new"?i.jsx(_b,{workspaceId:e.workspaceId},e.workspaceId):e.name==="sessions"?i.jsx(AO,{}):e.name==="settings"?i.jsx(sR,{section:e.section,id:e.id},`${e.section}/${e.id??""}`):i.jsx(mR,{}),c=e.name==="session";return i.jsx(ez,{value:{open:()=>a(!0),expanded:s},children:i.jsxs("div",{className:`app${s?" sidebar-open":""}${c?" own-header":""}`,children:[Uw,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(ke,{name:"menu"})}),i.jsx("span",{className:"screen-title",children:"Pikibun"})]}),i.jsx(dR,{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 gR(){const[e,s]=T.useState(null),[a,l]=T.useState(!0),[c,u]=T.useState(""),[d,h]=T.useState(0);T.useEffect(()=>{const y=new AbortController;return l(!0),u(""),fe("/api/me",{signal:y.signal}).then(x=>{y.signal.aborted||s(x.user)}).catch(x=>{y.signal.aborted||(s(null),x instanceof Xn&&x.status===401||u(Tn(x)))}).finally(()=>{y.signal.aborted||l(!1)}),()=>y.abort()},[d]);async function p(){try{await fe("/api/auth/logout",{method:"POST"})}catch(y){u(Tn(y));return}s(null),ds({name:"home"})}const m=zh();return T.useEffect(()=>{!a&&!e&&m.name==="join"&&g0(m.token)},[a,e,m]),a?i.jsx(oi,{}):e?i.jsx(m0,{user:e,setUser:s,signOut:()=>{p()},children:i.jsx(pR,{})},e.id):i.jsx(fR,{error:c,retry:()=>h(y=>y+1),inviteToken:m.name==="join"?m.token:void 0})}function yR(){vw();const e=zh();return e.name==="shared"?i.jsx(oR,{token:e.token},e.token):i.jsx(gR,{})}const Bw=document.getElementById("root");if(!Bw)throw new Error("Application root is missing.");ab.createRoot(Bw).render(i.jsx(T.StrictMode,{children:i.jsx(yR,{})}));export{ib as g};
|