@nickduy/agent-studio 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- function Ym(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function pd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jm={exports:{}},ho={},Xm={exports:{}},ke={};/**
1
+ function Ym(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function pd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jm={exports:{}},ho={},Xm={exports:{}},be={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ function Ym(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var xl=Symbol.for("react.element"),Ij=Symbol.for("react.portal"),Dj=Symbol.for("react.fragment"),Mj=Symbol.for("react.strict_mode"),zj=Symbol.for("react.profiler"),_j=Symbol.for("react.provider"),$j=Symbol.for("react.context"),Oj=Symbol.for("react.forward_ref"),Fj=Symbol.for("react.suspense"),Uj=Symbol.for("react.memo"),Bj=Symbol.for("react.lazy"),rf=Symbol.iterator;function Hj(e){return e===null||typeof e!="object"?null:(e=rf&&e[rf]||e["@@iterator"],typeof e=="function"?e:null)}var Zm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eg=Object.assign,tg={};function ri(e,t,n){this.props=e,this.context=t,this.refs=tg,this.updater=n||Zm}ri.prototype.isReactComponent={};ri.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ri.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ng(){}ng.prototype=ri.prototype;function md(e,t,n){this.props=e,this.context=t,this.refs=tg,this.updater=n||Zm}var gd=md.prototype=new ng;gd.constructor=md;eg(gd,ri.prototype);gd.isPureReactComponent=!0;var sf=Array.isArray,rg=Object.prototype.hasOwnProperty,xd={current:null},sg={key:!0,ref:!0,__self:!0,__source:!0};function ig(e,t,n){var r,i={},l=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(l=""+t.key),t)rg.call(t,r)&&!sg.hasOwnProperty(r)&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];i.children=u}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return{$$typeof:xl,type:e,key:l,ref:a,props:i,_owner:xd.current}}function Wj(e,t){return{$$typeof:xl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function yd(e){return typeof e=="object"&&e!==null&&e.$$typeof===xl}function Vj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var lf=/\/+/g;function Vo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Vj(""+e.key):t.toString(36)}function da(e,t,n,r,i){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(l){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case xl:case Ij:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Vo(a,0):r,sf(i)?(n="",e!=null&&(n=e.replace(lf,"$&/")+"/"),da(i,t,n,"",function(c){return c})):i!=null&&(yd(i)&&(i=Wj(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(lf,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",sf(e))for(var o=0;o<e.length;o++){l=e[o];var u=r+Vo(l,o);a+=da(l,t,n,u,i)}else if(u=Hj(e),typeof u=="function")for(e=u.call(e),o=0;!(l=e.next()).done;)l=l.value,u=r+Vo(l,o++),a+=da(l,t,n,u,i);else if(l==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function $l(e,t,n){if(e==null)return e;var r=[],i=0;return da(e,r,"","",function(l){return t.call(n,l,i++)}),r}function Qj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Rt={current:null},ha={transition:null},qj={ReactCurrentDispatcher:Rt,ReactCurrentBatchConfig:ha,ReactCurrentOwner:xd};function lg(){throw Error("act(...) is not supported in production builds of React.")}ke.Children={map:$l,forEach:function(e,t,n){$l(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return $l(e,function(){t++}),t},toArray:function(e){return $l(e,function(t){return t})||[]},only:function(e){if(!yd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ke.Component=ri;ke.Fragment=Dj;ke.Profiler=zj;ke.PureComponent=md;ke.StrictMode=Mj;ke.Suspense=Fj;ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qj;ke.act=lg;ke.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=eg({},e.props),i=e.key,l=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(l=t.ref,a=xd.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)rg.call(t,u)&&!sg.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:xl,type:e.type,key:i,ref:l,props:r,_owner:a}};ke.createContext=function(e){return e={$$typeof:$j,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:_j,_context:e},e.Consumer=e};ke.createElement=ig;ke.createFactory=function(e){var t=ig.bind(null,e);return t.type=e,t};ke.createRef=function(){return{current:null}};ke.forwardRef=function(e){return{$$typeof:Oj,render:e}};ke.isValidElement=yd;ke.lazy=function(e){return{$$typeof:Bj,_payload:{_status:-1,_result:e},_init:Qj}};ke.memo=function(e,t){return{$$typeof:Uj,type:e,compare:t===void 0?null:t}};ke.startTransition=function(e){var t=ha.transition;ha.transition={};try{e()}finally{ha.transition=t}};ke.unstable_act=lg;ke.useCallback=function(e,t){return Rt.current.useCallback(e,t)};ke.useContext=function(e){return Rt.current.useContext(e)};ke.useDebugValue=function(){};ke.useDeferredValue=function(e){return Rt.current.useDeferredValue(e)};ke.useEffect=function(e,t){return Rt.current.useEffect(e,t)};ke.useId=function(){return Rt.current.useId()};ke.useImperativeHandle=function(e,t,n){return Rt.current.useImperativeHandle(e,t,n)};ke.useInsertionEffect=function(e,t){return Rt.current.useInsertionEffect(e,t)};ke.useLayoutEffect=function(e,t){return Rt.current.useLayoutEffect(e,t)};ke.useMemo=function(e,t){return Rt.current.useMemo(e,t)};ke.useReducer=function(e,t,n){return Rt.current.useReducer(e,t,n)};ke.useRef=function(e){return Rt.current.useRef(e)};ke.useState=function(e){return Rt.current.useState(e)};ke.useSyncExternalStore=function(e,t,n){return Rt.current.useSyncExternalStore(e,t,n)};ke.useTransition=function(){return Rt.current.useTransition()};ke.version="18.3.1";Xm.exports=ke;var j=Xm.exports;const Gj=pd(j),Kj=Ym({__proto__:null,default:Gj},[j]);/**
9
+ */var gl=Symbol.for("react.element"),Mj=Symbol.for("react.portal"),zj=Symbol.for("react.fragment"),_j=Symbol.for("react.strict_mode"),$j=Symbol.for("react.profiler"),Oj=Symbol.for("react.provider"),Fj=Symbol.for("react.context"),Uj=Symbol.for("react.forward_ref"),Bj=Symbol.for("react.suspense"),Hj=Symbol.for("react.memo"),Wj=Symbol.for("react.lazy"),rf=Symbol.iterator;function Vj(e){return e===null||typeof e!="object"?null:(e=rf&&e[rf]||e["@@iterator"],typeof e=="function"?e:null)}var Zm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eg=Object.assign,tg={};function ri(e,t,n){this.props=e,this.context=t,this.refs=tg,this.updater=n||Zm}ri.prototype.isReactComponent={};ri.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ri.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ng(){}ng.prototype=ri.prototype;function md(e,t,n){this.props=e,this.context=t,this.refs=tg,this.updater=n||Zm}var gd=md.prototype=new ng;gd.constructor=md;eg(gd,ri.prototype);gd.isPureReactComponent=!0;var sf=Array.isArray,rg=Object.prototype.hasOwnProperty,xd={current:null},sg={key:!0,ref:!0,__self:!0,__source:!0};function ig(e,t,n){var r,i={},l=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(l=""+t.key),t)rg.call(t,r)&&!sg.hasOwnProperty(r)&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];i.children=u}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return{$$typeof:gl,type:e,key:l,ref:a,props:i,_owner:xd.current}}function Qj(e,t){return{$$typeof:gl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function yd(e){return typeof e=="object"&&e!==null&&e.$$typeof===gl}function qj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var lf=/\/+/g;function Vo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?qj(""+e.key):t.toString(36)}function ca(e,t,n,r,i){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(l){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case gl:case Mj:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Vo(a,0):r,sf(i)?(n="",e!=null&&(n=e.replace(lf,"$&/")+"/"),ca(i,t,n,"",function(c){return c})):i!=null&&(yd(i)&&(i=Qj(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(lf,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",sf(e))for(var o=0;o<e.length;o++){l=e[o];var u=r+Vo(l,o);a+=ca(l,t,n,u,i)}else if(u=Vj(e),typeof u=="function")for(e=u.call(e),o=0;!(l=e.next()).done;)l=l.value,u=r+Vo(l,o++),a+=ca(l,t,n,u,i);else if(l==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function _l(e,t,n){if(e==null)return e;var r=[],i=0;return ca(e,r,"","",function(l){return t.call(n,l,i++)}),r}function Gj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Lt={current:null},da={transition:null},Kj={ReactCurrentDispatcher:Lt,ReactCurrentBatchConfig:da,ReactCurrentOwner:xd};function lg(){throw Error("act(...) is not supported in production builds of React.")}be.Children={map:_l,forEach:function(e,t,n){_l(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _l(e,function(){t++}),t},toArray:function(e){return _l(e,function(t){return t})||[]},only:function(e){if(!yd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};be.Component=ri;be.Fragment=zj;be.Profiler=$j;be.PureComponent=md;be.StrictMode=_j;be.Suspense=Bj;be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kj;be.act=lg;be.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=eg({},e.props),i=e.key,l=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(l=t.ref,a=xd.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)rg.call(t,u)&&!sg.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:gl,type:e.type,key:i,ref:l,props:r,_owner:a}};be.createContext=function(e){return e={$$typeof:Fj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Oj,_context:e},e.Consumer=e};be.createElement=ig;be.createFactory=function(e){var t=ig.bind(null,e);return t.type=e,t};be.createRef=function(){return{current:null}};be.forwardRef=function(e){return{$$typeof:Uj,render:e}};be.isValidElement=yd;be.lazy=function(e){return{$$typeof:Wj,_payload:{_status:-1,_result:e},_init:Gj}};be.memo=function(e,t){return{$$typeof:Hj,type:e,compare:t===void 0?null:t}};be.startTransition=function(e){var t=da.transition;da.transition={};try{e()}finally{da.transition=t}};be.unstable_act=lg;be.useCallback=function(e,t){return Lt.current.useCallback(e,t)};be.useContext=function(e){return Lt.current.useContext(e)};be.useDebugValue=function(){};be.useDeferredValue=function(e){return Lt.current.useDeferredValue(e)};be.useEffect=function(e,t){return Lt.current.useEffect(e,t)};be.useId=function(){return Lt.current.useId()};be.useImperativeHandle=function(e,t,n){return Lt.current.useImperativeHandle(e,t,n)};be.useInsertionEffect=function(e,t){return Lt.current.useInsertionEffect(e,t)};be.useLayoutEffect=function(e,t){return Lt.current.useLayoutEffect(e,t)};be.useMemo=function(e,t){return Lt.current.useMemo(e,t)};be.useReducer=function(e,t,n){return Lt.current.useReducer(e,t,n)};be.useRef=function(e){return Lt.current.useRef(e)};be.useState=function(e){return Lt.current.useState(e)};be.useSyncExternalStore=function(e,t,n){return Lt.current.useSyncExternalStore(e,t,n)};be.useTransition=function(){return Lt.current.useTransition()};be.version="18.3.1";Xm.exports=be;var j=Xm.exports;const Yj=pd(j),Jj=Ym({__proto__:null,default:Yj},[j]);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ function Ym(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Yj=j,Jj=Symbol.for("react.element"),Xj=Symbol.for("react.fragment"),Zj=Object.prototype.hasOwnProperty,ew=Yj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tw={key:!0,ref:!0,__self:!0,__source:!0};function ag(e,t,n){var r,i={},l=null,a=null;n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Zj.call(t,r)&&!tw.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Jj,type:e,key:l,ref:a,props:i,_owner:ew.current}}ho.Fragment=Xj;ho.jsx=ag;ho.jsxs=ag;Jm.exports=ho;var s=Jm.exports,og={exports:{}},Yt={},ug={exports:{}},cg={};/**
17
+ */var Xj=j,Zj=Symbol.for("react.element"),ew=Symbol.for("react.fragment"),tw=Object.prototype.hasOwnProperty,nw=Xj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rw={key:!0,ref:!0,__self:!0,__source:!0};function ag(e,t,n){var r,i={},l=null,a=null;n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)tw.call(t,r)&&!rw.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Zj,type:e,key:l,ref:a,props:i,_owner:nw.current}}ho.Fragment=ew;ho.jsx=ag;ho.jsxs=ag;Jm.exports=ho;var s=Jm.exports,og={exports:{}},Jt={},ug={exports:{}},cg={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ function Ym(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(H,X){var S=H.length;H.push(X);e:for(;0<S;){var ae=S-1>>>1,O=H[ae];if(0<i(O,X))H[ae]=X,H[S]=O,S=ae;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var X=H[0],S=H.pop();if(S!==X){H[0]=S;e:for(var ae=0,O=H.length,N=O>>>1;ae<N;){var F=2*(ae+1)-1,Z=H[F],oe=F+1,B=H[oe];if(0>i(Z,S))oe<O&&0>i(B,Z)?(H[ae]=B,H[oe]=S,ae=oe):(H[ae]=Z,H[F]=S,ae=F);else if(oe<O&&0>i(B,S))H[ae]=B,H[oe]=S,ae=oe;else break e}}return X}function i(H,X){var S=H.sortIndex-X.sortIndex;return S!==0?S:H.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],h=1,d=null,f=3,m=!1,p=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(H){for(var X=n(c);X!==null;){if(X.callback===null)r(c);else if(X.startTime<=H)r(c),X.sortIndex=X.expirationTime,t(u,X);else break;X=n(c)}}function b(H){if(g=!1,v(H),!p)if(n(u)!==null)p=!0,Q(E);else{var X=n(c);X!==null&&J(b,X.startTime-H)}}function E(H,X){p=!1,g&&(g=!1,x(T),T=-1),m=!0;var S=f;try{for(v(X),d=n(u);d!==null&&(!(d.expirationTime>X)||H&&!L());){var ae=d.callback;if(typeof ae=="function"){d.callback=null,f=d.priorityLevel;var O=ae(d.expirationTime<=X);X=e.unstable_now(),typeof O=="function"?d.callback=O:d===n(u)&&r(u),v(X)}else r(u);d=n(u)}if(d!==null)var N=!0;else{var F=n(c);F!==null&&J(b,F.startTime-X),N=!1}return N}finally{d=null,f=S,m=!1}}var k=!1,R=null,T=-1,D=5,C=-1;function L(){return!(e.unstable_now()-C<D)}function A(){if(R!==null){var H=e.unstable_now();C=H;var X=!0;try{X=R(!0,H)}finally{X?z():(k=!1,R=null)}}else k=!1}var z;if(typeof y=="function")z=function(){y(A)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,I=U.port2;U.port1.onmessage=A,z=function(){I.postMessage(null)}}else z=function(){w(A,0)};function Q(H){R=H,k||(k=!0,z())}function J(H,X){T=w(function(){H(e.unstable_now())},X)}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(H){H.callback=null},e.unstable_continueExecution=function(){p||m||(p=!0,Q(E))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(H){switch(f){case 1:case 2:case 3:var X=3;break;default:X=f}var S=f;f=X;try{return H()}finally{f=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,X){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var S=f;f=H;try{return X()}finally{f=S}},e.unstable_scheduleCallback=function(H,X,S){var ae=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?ae+S:ae):S=ae,H){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=S+O,H={id:h++,callback:X,priorityLevel:H,startTime:S,expirationTime:O,sortIndex:-1},S>ae?(H.sortIndex=S,t(c,H),n(u)===null&&H===n(c)&&(g?(x(T),T=-1):g=!0,J(b,S-ae))):(H.sortIndex=O,t(u,H),p||m||(p=!0,Q(E))),H},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(H){var X=f;return function(){var S=f;f=X;try{return H.apply(this,arguments)}finally{f=S}}}})(cg);ug.exports=cg;var nw=ug.exports;/**
25
+ */(function(e){function t(B,X){var S=B.length;B.push(X);e:for(;0<S;){var ae=S-1>>>1,O=B[ae];if(0<i(O,X))B[ae]=X,B[S]=O,S=ae;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var X=B[0],S=B.pop();if(S!==X){B[0]=S;e:for(var ae=0,O=B.length,N=O>>>1;ae<N;){var F=2*(ae+1)-1,Z=B[F],ce=F+1,Te=B[ce];if(0>i(Z,S))ce<O&&0>i(Te,Z)?(B[ae]=Te,B[ce]=S,ae=ce):(B[ae]=Z,B[F]=S,ae=F);else if(ce<O&&0>i(Te,S))B[ae]=Te,B[ce]=S,ae=ce;else break e}}return X}function i(B,X){var S=B.sortIndex-X.sortIndex;return S!==0?S:B.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],h=1,d=null,f=3,m=!1,p=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(B){for(var X=n(c);X!==null;){if(X.callback===null)r(c);else if(X.startTime<=B)r(c),X.sortIndex=X.expirationTime,t(u,X);else break;X=n(c)}}function b(B){if(g=!1,v(B),!p)if(n(u)!==null)p=!0,Q(E);else{var X=n(c);X!==null&&J(b,X.startTime-B)}}function E(B,X){p=!1,g&&(g=!1,x(T),T=-1),m=!0;var S=f;try{for(v(X),d=n(u);d!==null&&(!(d.expirationTime>X)||B&&!L());){var ae=d.callback;if(typeof ae=="function"){d.callback=null,f=d.priorityLevel;var O=ae(d.expirationTime<=X);X=e.unstable_now(),typeof O=="function"?d.callback=O:d===n(u)&&r(u),v(X)}else r(u);d=n(u)}if(d!==null)var N=!0;else{var F=n(c);F!==null&&J(b,F.startTime-X),N=!1}return N}finally{d=null,f=S,m=!1}}var k=!1,R=null,T=-1,D=5,C=-1;function L(){return!(e.unstable_now()-C<D)}function A(){if(R!==null){var B=e.unstable_now();C=B;var X=!0;try{X=R(!0,B)}finally{X?z():(k=!1,R=null)}}else k=!1}var z;if(typeof y=="function")z=function(){y(A)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,I=U.port2;U.port1.onmessage=A,z=function(){I.postMessage(null)}}else z=function(){w(A,0)};function Q(B){R=B,k||(k=!0,z())}function J(B,X){T=w(function(){B(e.unstable_now())},X)}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_continueExecution=function(){p||m||(p=!0,Q(E))},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"):D=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(B){switch(f){case 1:case 2:case 3:var X=3;break;default:X=f}var S=f;f=X;try{return B()}finally{f=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,X){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var S=f;f=B;try{return X()}finally{f=S}},e.unstable_scheduleCallback=function(B,X,S){var ae=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?ae+S:ae):S=ae,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=S+O,B={id:h++,callback:X,priorityLevel:B,startTime:S,expirationTime:O,sortIndex:-1},S>ae?(B.sortIndex=S,t(c,B),n(u)===null&&B===n(c)&&(g?(x(T),T=-1):g=!0,J(b,S-ae))):(B.sortIndex=O,t(u,B),p||m||(p=!0,Q(E))),B},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(B){var X=f;return function(){var S=f;f=X;try{return B.apply(this,arguments)}finally{f=S}}}})(cg);ug.exports=cg;var sw=ug.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ function Ym(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var rw=j,Kt=nw;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var dg=new Set,Ki={};function as(e,t){Vs(e,t),Vs(e+"Capture",t)}function Vs(e,t){for(Ki[e]=t,e=0;e<t.length;e++)dg.add(t[e])}var Hn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vu=Object.prototype.hasOwnProperty,sw=/^[: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]*$/,af={},of={};function iw(e){return Vu.call(of,e)?!0:Vu.call(af,e)?!1:sw.test(e)?of[e]=!0:(af[e]=!0,!1)}function lw(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function aw(e,t,n,r){if(t===null||typeof t>"u"||lw(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Lt(e,t,n,r,i,l,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=a}var wt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){wt[e]=new Lt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];wt[t]=new Lt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){wt[e]=new Lt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){wt[e]=new Lt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){wt[e]=new Lt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){wt[e]=new Lt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){wt[e]=new Lt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){wt[e]=new Lt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){wt[e]=new Lt(e,5,!1,e.toLowerCase(),null,!1,!1)});var vd=/[\-:]([a-z])/g;function jd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vd,jd);wt[t]=new Lt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vd,jd);wt[t]=new Lt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vd,jd);wt[t]=new Lt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){wt[e]=new Lt(e,1,!1,e.toLowerCase(),null,!1,!1)});wt.xlinkHref=new Lt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){wt[e]=new Lt(e,1,!1,e.toLowerCase(),null,!0,!0)});function wd(e,t,n,r){var i=wt.hasOwnProperty(t)?wt[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(aw(t,n,i,r)&&(n=null),r||i===null?iw(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var qn=rw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ol=Symbol.for("react.element"),Ns=Symbol.for("react.portal"),Cs=Symbol.for("react.fragment"),kd=Symbol.for("react.strict_mode"),Qu=Symbol.for("react.profiler"),hg=Symbol.for("react.provider"),fg=Symbol.for("react.context"),bd=Symbol.for("react.forward_ref"),qu=Symbol.for("react.suspense"),Gu=Symbol.for("react.suspense_list"),Sd=Symbol.for("react.memo"),nr=Symbol.for("react.lazy"),pg=Symbol.for("react.offscreen"),uf=Symbol.iterator;function pi(e){return e===null||typeof e!="object"?null:(e=uf&&e[uf]||e["@@iterator"],typeof e=="function"?e:null)}var Ge=Object.assign,Qo;function Ri(e){if(Qo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Qo=t&&t[1]||""}return`
33
+ */var iw=j,Yt=sw;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var dg=new Set,Gi={};function os(e,t){Vs(e,t),Vs(e+"Capture",t)}function Vs(e,t){for(Gi[e]=t,e=0;e<t.length;e++)dg.add(t[e])}var Hn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vu=Object.prototype.hasOwnProperty,lw=/^[: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]*$/,af={},of={};function aw(e){return Vu.call(of,e)?!0:Vu.call(af,e)?!1:lw.test(e)?of[e]=!0:(af[e]=!0,!1)}function ow(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function uw(e,t,n,r){if(t===null||typeof t>"u"||ow(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function At(e,t,n,r,i,l,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=a}var kt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kt[e]=new At(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kt[t]=new At(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kt[e]=new At(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kt[e]=new At(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){kt[e]=new At(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kt[e]=new At(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kt[e]=new At(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kt[e]=new At(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kt[e]=new At(e,5,!1,e.toLowerCase(),null,!1,!1)});var vd=/[\-:]([a-z])/g;function jd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vd,jd);kt[t]=new At(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vd,jd);kt[t]=new At(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vd,jd);kt[t]=new At(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kt[e]=new At(e,1,!1,e.toLowerCase(),null,!1,!1)});kt.xlinkHref=new At("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kt[e]=new At(e,1,!1,e.toLowerCase(),null,!0,!0)});function wd(e,t,n,r){var i=kt.hasOwnProperty(t)?kt[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(uw(t,n,i,r)&&(n=null),r||i===null?aw(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var qn=iw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$l=Symbol.for("react.element"),Ns=Symbol.for("react.portal"),Cs=Symbol.for("react.fragment"),kd=Symbol.for("react.strict_mode"),Qu=Symbol.for("react.profiler"),hg=Symbol.for("react.provider"),fg=Symbol.for("react.context"),bd=Symbol.for("react.forward_ref"),qu=Symbol.for("react.suspense"),Gu=Symbol.for("react.suspense_list"),Sd=Symbol.for("react.memo"),nr=Symbol.for("react.lazy"),pg=Symbol.for("react.offscreen"),uf=Symbol.iterator;function pi(e){return e===null||typeof e!="object"?null:(e=uf&&e[uf]||e["@@iterator"],typeof e=="function"?e:null)}var Ke=Object.assign,Qo;function Ri(e){if(Qo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Qo=t&&t[1]||""}return`
34
34
  `+Qo+e}var qo=!1;function Go(e,t){if(!e||qo)return"";qo=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
35
35
  `),l=r.stack.split(`
36
36
  `),a=i.length-1,o=l.length-1;1<=a&&0<=o&&i[a]!==l[o];)o--;for(;1<=a&&0<=o;a--,o--)if(i[a]!==l[o]){if(a!==1||o!==1)do if(a--,o--,0>o||i[a]!==l[o]){var u=`
37
- `+i[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{qo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ri(e):""}function ow(e){switch(e.tag){case 5:return Ri(e.type);case 16:return Ri("Lazy");case 13:return Ri("Suspense");case 19:return Ri("SuspenseList");case 0:case 2:case 15:return e=Go(e.type,!1),e;case 11:return e=Go(e.type.render,!1),e;case 1:return e=Go(e.type,!0),e;default:return""}}function Ku(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Cs:return"Fragment";case Ns:return"Portal";case Qu:return"Profiler";case kd:return"StrictMode";case qu:return"Suspense";case Gu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fg:return(e.displayName||"Context")+".Consumer";case hg:return(e._context.displayName||"Context")+".Provider";case bd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Sd:return t=e.displayName||null,t!==null?t:Ku(e.type)||"Memo";case nr:t=e._payload,e=e._init;try{return Ku(e(t))}catch{}}return null}function uw(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ku(t);case 8:return t===kd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function yr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cw(e){var t=mg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fl(e){e._valueTracker||(e._valueTracker=cw(e))}function gg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=mg(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ta(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Yu(e,t){var n=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function cf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=yr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function xg(e,t){t=t.checked,t!=null&&wd(e,"checked",t,!1)}function Ju(e,t){xg(e,t);var n=yr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Xu(e,t.type,n):t.hasOwnProperty("defaultValue")&&Xu(e,t.type,yr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function df(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Xu(e,t,n){(t!=="number"||Ta(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Li=Array.isArray;function $s(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+yr(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Zu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(K(91));return Ge({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function hf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(K(92));if(Li(n)){if(1<n.length)throw Error(K(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:yr(n)}}function yg(e,t){var n=yr(t.value),r=yr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function ff(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vg(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ec(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vg(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ul,jg=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ul=Ul||document.createElement("div"),Ul.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ul.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},dw=["Webkit","ms","Moz","O"];Object.keys(Mi).forEach(function(e){dw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mi[t]=Mi[e]})});function wg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mi.hasOwnProperty(e)&&Mi[e]?(""+t).trim():t+"px"}function kg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=wg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var hw=Ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function tc(e,t){if(t){if(hw[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function nc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rc=null;function Nd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sc=null,Os=null,Fs=null;function pf(e){if(e=jl(e)){if(typeof sc!="function")throw Error(K(280));var t=e.stateNode;t&&(t=xo(t),sc(e.stateNode,e.type,t))}}function bg(e){Os?Fs?Fs.push(e):Fs=[e]:Os=e}function Sg(){if(Os){var e=Os,t=Fs;if(Fs=Os=null,pf(e),t)for(e=0;e<t.length;e++)pf(t[e])}}function Ng(e,t){return e(t)}function Cg(){}var Ko=!1;function Eg(e,t,n){if(Ko)return e(t,n);Ko=!0;try{return Ng(e,t,n)}finally{Ko=!1,(Os!==null||Fs!==null)&&(Cg(),Sg())}}function Ji(e,t){var n=e.stateNode;if(n===null)return null;var r=xo(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(K(231,t,typeof n));return n}var ic=!1;if(Hn)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){ic=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{ic=!1}function fw(e,t,n,r,i,l,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var zi=!1,Pa=null,Ra=!1,lc=null,pw={onError:function(e){zi=!0,Pa=e}};function mw(e,t,n,r,i,l,a,o,u){zi=!1,Pa=null,fw.apply(pw,arguments)}function gw(e,t,n,r,i,l,a,o,u){if(mw.apply(this,arguments),zi){if(zi){var c=Pa;zi=!1,Pa=null}else throw Error(K(198));Ra||(Ra=!0,lc=c)}}function os(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Tg(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function mf(e){if(os(e)!==e)throw Error(K(188))}function xw(e){var t=e.alternate;if(!t){if(t=os(e),t===null)throw Error(K(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var l=i.alternate;if(l===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===l.child){for(l=i.child;l;){if(l===n)return mf(i),e;if(l===r)return mf(i),t;l=l.sibling}throw Error(K(188))}if(n.return!==r.return)n=i,r=l;else{for(var a=!1,o=i.child;o;){if(o===n){a=!0,n=i,r=l;break}if(o===r){a=!0,r=i,n=l;break}o=o.sibling}if(!a){for(o=l.child;o;){if(o===n){a=!0,n=l,r=i;break}if(o===r){a=!0,r=l,n=i;break}o=o.sibling}if(!a)throw Error(K(189))}}if(n.alternate!==r)throw Error(K(190))}if(n.tag!==3)throw Error(K(188));return n.stateNode.current===n?e:t}function Pg(e){return e=xw(e),e!==null?Rg(e):null}function Rg(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Rg(e);if(t!==null)return t;e=e.sibling}return null}var Lg=Kt.unstable_scheduleCallback,gf=Kt.unstable_cancelCallback,yw=Kt.unstable_shouldYield,vw=Kt.unstable_requestPaint,tt=Kt.unstable_now,jw=Kt.unstable_getCurrentPriorityLevel,Cd=Kt.unstable_ImmediatePriority,Ag=Kt.unstable_UserBlockingPriority,La=Kt.unstable_NormalPriority,ww=Kt.unstable_LowPriority,Ig=Kt.unstable_IdlePriority,fo=null,Ln=null;function kw(e){if(Ln&&typeof Ln.onCommitFiberRoot=="function")try{Ln.onCommitFiberRoot(fo,e,void 0,(e.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:Nw,bw=Math.log,Sw=Math.LN2;function Nw(e){return e>>>=0,e===0?32:31-(bw(e)/Sw|0)|0}var Bl=64,Hl=4194304;function Ai(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Aa(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~i;o!==0?r=Ai(o):(l&=a,l!==0&&(r=Ai(l)))}else a=n&~i,a!==0?r=Ai(a):l!==0&&(r=Ai(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,l=t&-t,i>=l||i===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-gn(t),i=1<<n,r|=e[n],t&=~i;return r}function Cw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ew(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,l=e.pendingLanes;0<l;){var a=31-gn(l),o=1<<a,u=i[a];u===-1?(!(o&n)||o&r)&&(i[a]=Cw(o,t)):u<=t&&(e.expiredLanes|=o),l&=~o}}function ac(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Dg(){var e=Bl;return Bl<<=1,!(Bl&4194240)&&(Bl=64),e}function Yo(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function yl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gn(t),e[t]=n}function Tw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-gn(n),l=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~l}}function Ed(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Ie=0;function Mg(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zg,Td,_g,$g,Og,oc=!1,Wl=[],cr=null,dr=null,hr=null,Xi=new Map,Zi=new Map,sr=[],Pw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function xf(e,t){switch(e){case"focusin":case"focusout":cr=null;break;case"dragenter":case"dragleave":dr=null;break;case"mouseover":case"mouseout":hr=null;break;case"pointerover":case"pointerout":Xi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zi.delete(t.pointerId)}}function gi(e,t,n,r,i,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:l,targetContainers:[i]},t!==null&&(t=jl(t),t!==null&&Td(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Rw(e,t,n,r,i){switch(t){case"focusin":return cr=gi(cr,e,t,n,r,i),!0;case"dragenter":return dr=gi(dr,e,t,n,r,i),!0;case"mouseover":return hr=gi(hr,e,t,n,r,i),!0;case"pointerover":var l=i.pointerId;return Xi.set(l,gi(Xi.get(l)||null,e,t,n,r,i)),!0;case"gotpointercapture":return l=i.pointerId,Zi.set(l,gi(Zi.get(l)||null,e,t,n,r,i)),!0}return!1}function Fg(e){var t=Vr(e.target);if(t!==null){var n=os(t);if(n!==null){if(t=n.tag,t===13){if(t=Tg(n),t!==null){e.blockedOn=t,Og(e.priority,function(){_g(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function fa(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=uc(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rc=r,n.target.dispatchEvent(r),rc=null}else return t=jl(n),t!==null&&Td(t),e.blockedOn=n,!1;t.shift()}return!0}function yf(e,t,n){fa(e)&&n.delete(t)}function Lw(){oc=!1,cr!==null&&fa(cr)&&(cr=null),dr!==null&&fa(dr)&&(dr=null),hr!==null&&fa(hr)&&(hr=null),Xi.forEach(yf),Zi.forEach(yf)}function xi(e,t){e.blockedOn===t&&(e.blockedOn=null,oc||(oc=!0,Kt.unstable_scheduleCallback(Kt.unstable_NormalPriority,Lw)))}function el(e){function t(i){return xi(i,e)}if(0<Wl.length){xi(Wl[0],e);for(var n=1;n<Wl.length;n++){var r=Wl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(cr!==null&&xi(cr,e),dr!==null&&xi(dr,e),hr!==null&&xi(hr,e),Xi.forEach(t),Zi.forEach(t),n=0;n<sr.length;n++)r=sr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<sr.length&&(n=sr[0],n.blockedOn===null);)Fg(n),n.blockedOn===null&&sr.shift()}var Us=qn.ReactCurrentBatchConfig,Ia=!0;function Aw(e,t,n,r){var i=Ie,l=Us.transition;Us.transition=null;try{Ie=1,Pd(e,t,n,r)}finally{Ie=i,Us.transition=l}}function Iw(e,t,n,r){var i=Ie,l=Us.transition;Us.transition=null;try{Ie=4,Pd(e,t,n,r)}finally{Ie=i,Us.transition=l}}function Pd(e,t,n,r){if(Ia){var i=uc(e,t,n,r);if(i===null)lu(e,t,r,Da,n),xf(e,r);else if(Rw(i,e,t,n,r))r.stopPropagation();else if(xf(e,r),t&4&&-1<Pw.indexOf(e)){for(;i!==null;){var l=jl(i);if(l!==null&&zg(l),l=uc(e,t,n,r),l===null&&lu(e,t,r,Da,n),l===i)break;i=l}i!==null&&r.stopPropagation()}else lu(e,t,r,null,n)}}var Da=null;function uc(e,t,n,r){if(Da=null,e=Nd(r),e=Vr(e),e!==null)if(t=os(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Tg(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Da=e,null}function Ug(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jw()){case Cd:return 1;case Ag:return 4;case La:case ww:return 16;case Ig:return 536870912;default:return 16}default:return 16}}var lr=null,Rd=null,pa=null;function Bg(){if(pa)return pa;var e,t=Rd,n=t.length,r,i="value"in lr?lr.value:lr.textContent,l=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===i[l-r];r++);return pa=i.slice(e,1<r?1-r:void 0)}function ma(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vl(){return!0}function vf(){return!1}function Jt(e){function t(n,r,i,l,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=l,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?Vl:vf,this.isPropagationStopped=vf,this}return Ge(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Vl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Vl)},persist:function(){},isPersistent:Vl}),t}var si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ld=Jt(si),vl=Ge({},si,{view:0,detail:0}),Dw=Jt(vl),Jo,Xo,yi,po=Ge({},vl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ad,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==yi&&(yi&&e.type==="mousemove"?(Jo=e.screenX-yi.screenX,Xo=e.screenY-yi.screenY):Xo=Jo=0,yi=e),Jo)},movementY:function(e){return"movementY"in e?e.movementY:Xo}}),jf=Jt(po),Mw=Ge({},po,{dataTransfer:0}),zw=Jt(Mw),_w=Ge({},vl,{relatedTarget:0}),Zo=Jt(_w),$w=Ge({},si,{animationName:0,elapsedTime:0,pseudoElement:0}),Ow=Jt($w),Fw=Ge({},si,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Uw=Jt(Fw),Bw=Ge({},si,{data:0}),wf=Jt(Bw),Hw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ww={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"},Vw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vw[e])?!!t[e]:!1}function Ad(){return Qw}var qw=Ge({},vl,{key:function(e){if(e.key){var t=Hw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ma(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ww[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ad,charCode:function(e){return e.type==="keypress"?ma(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ma(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Gw=Jt(qw),Kw=Ge({},po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kf=Jt(Kw),Yw=Ge({},vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ad}),Jw=Jt(Yw),Xw=Ge({},si,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zw=Jt(Xw),e1=Ge({},po,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),t1=Jt(e1),n1=[9,13,27,32],Id=Hn&&"CompositionEvent"in window,_i=null;Hn&&"documentMode"in document&&(_i=document.documentMode);var r1=Hn&&"TextEvent"in window&&!_i,Hg=Hn&&(!Id||_i&&8<_i&&11>=_i),bf=" ",Sf=!1;function Wg(e,t){switch(e){case"keyup":return n1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Es=!1;function s1(e,t){switch(e){case"compositionend":return Vg(t);case"keypress":return t.which!==32?null:(Sf=!0,bf);case"textInput":return e=t.data,e===bf&&Sf?null:e;default:return null}}function i1(e,t){if(Es)return e==="compositionend"||!Id&&Wg(e,t)?(e=Bg(),pa=Rd=lr=null,Es=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Hg&&t.locale!=="ko"?null:t.data;default:return null}}var l1={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 Nf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!l1[e.type]:t==="textarea"}function Qg(e,t,n,r){bg(r),t=Ma(t,"onChange"),0<t.length&&(n=new Ld("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var $i=null,tl=null;function a1(e){rx(e,0)}function mo(e){var t=Rs(e);if(gg(t))return e}function o1(e,t){if(e==="change")return t}var qg=!1;if(Hn){var eu;if(Hn){var tu="oninput"in document;if(!tu){var Cf=document.createElement("div");Cf.setAttribute("oninput","return;"),tu=typeof Cf.oninput=="function"}eu=tu}else eu=!1;qg=eu&&(!document.documentMode||9<document.documentMode)}function Ef(){$i&&($i.detachEvent("onpropertychange",Gg),tl=$i=null)}function Gg(e){if(e.propertyName==="value"&&mo(tl)){var t=[];Qg(t,tl,e,Nd(e)),Eg(a1,t)}}function u1(e,t,n){e==="focusin"?(Ef(),$i=t,tl=n,$i.attachEvent("onpropertychange",Gg)):e==="focusout"&&Ef()}function c1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mo(tl)}function d1(e,t){if(e==="click")return mo(t)}function h1(e,t){if(e==="input"||e==="change")return mo(t)}function f1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jn=typeof Object.is=="function"?Object.is:f1;function nl(e,t){if(jn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Vu.call(t,i)||!jn(e[i],t[i]))return!1}return!0}function Tf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Pf(e,t){var n=Tf(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Tf(n)}}function Kg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yg(){for(var e=window,t=Ta();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ta(e.document)}return t}function Dd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function p1(e){var t=Yg(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Kg(n.ownerDocument.documentElement,n)){if(r!==null&&Dd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,l=Math.min(r.start,i);r=r.end===void 0?l:Math.min(r.end,i),!e.extend&&l>r&&(i=r,r=l,l=i),i=Pf(n,l);var a=Pf(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var m1=Hn&&"documentMode"in document&&11>=document.documentMode,Ts=null,cc=null,Oi=null,dc=!1;function Rf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;dc||Ts==null||Ts!==Ta(r)||(r=Ts,"selectionStart"in r&&Dd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Oi&&nl(Oi,r)||(Oi=r,r=Ma(cc,"onSelect"),0<r.length&&(t=new Ld("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ts)))}function Ql(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ps={animationend:Ql("Animation","AnimationEnd"),animationiteration:Ql("Animation","AnimationIteration"),animationstart:Ql("Animation","AnimationStart"),transitionend:Ql("Transition","TransitionEnd")},nu={},Jg={};Hn&&(Jg=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function go(e){if(nu[e])return nu[e];if(!Ps[e])return e;var t=Ps[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Jg)return nu[e]=t[n];return e}var Xg=go("animationend"),Zg=go("animationiteration"),ex=go("animationstart"),tx=go("transitionend"),nx=new Map,Lf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Sr(e,t){nx.set(e,t),as(t,[e])}for(var ru=0;ru<Lf.length;ru++){var su=Lf[ru],g1=su.toLowerCase(),x1=su[0].toUpperCase()+su.slice(1);Sr(g1,"on"+x1)}Sr(Xg,"onAnimationEnd");Sr(Zg,"onAnimationIteration");Sr(ex,"onAnimationStart");Sr("dblclick","onDoubleClick");Sr("focusin","onFocus");Sr("focusout","onBlur");Sr(tx,"onTransitionEnd");Vs("onMouseEnter",["mouseout","mouseover"]);Vs("onMouseLeave",["mouseout","mouseover"]);Vs("onPointerEnter",["pointerout","pointerover"]);Vs("onPointerLeave",["pointerout","pointerover"]);as("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));as("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));as("onBeforeInput",["compositionend","keypress","textInput","paste"]);as("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));as("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));as("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ii="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(" "),y1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ii));function Af(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,gw(r,t,void 0,e),e.currentTarget=null}function rx(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var l=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==l&&i.isPropagationStopped())break e;Af(i,o,c),l=u}else for(a=0;a<r.length;a++){if(o=r[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==l&&i.isPropagationStopped())break e;Af(i,o,c),l=u}}}if(Ra)throw e=lc,Ra=!1,lc=null,e}function Be(e,t){var n=t[gc];n===void 0&&(n=t[gc]=new Set);var r=e+"__bubble";n.has(r)||(sx(t,e,2,!1),n.add(r))}function iu(e,t,n){var r=0;t&&(r|=4),sx(n,e,r,t)}var ql="_reactListening"+Math.random().toString(36).slice(2);function rl(e){if(!e[ql]){e[ql]=!0,dg.forEach(function(n){n!=="selectionchange"&&(y1.has(n)||iu(n,!1,e),iu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ql]||(t[ql]=!0,iu("selectionchange",!1,t))}}function sx(e,t,n,r){switch(Ug(t)){case 1:var i=Aw;break;case 4:i=Iw;break;default:i=Pd}n=i.bind(null,t,n,e),i=void 0,!ic||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function lu(e,t,n,r,i){var l=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===i||u.nodeType===8&&u.parentNode===i))return;a=a.return}for(;o!==null;){if(a=Vr(o),a===null)return;if(u=a.tag,u===5||u===6){r=l=a;continue e}o=o.parentNode}}r=r.return}Eg(function(){var c=l,h=Nd(n),d=[];e:{var f=nx.get(e);if(f!==void 0){var m=Ld,p=e;switch(e){case"keypress":if(ma(n)===0)break e;case"keydown":case"keyup":m=Gw;break;case"focusin":p="focus",m=Zo;break;case"focusout":p="blur",m=Zo;break;case"beforeblur":case"afterblur":m=Zo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=zw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Jw;break;case Xg:case Zg:case ex:m=Ow;break;case tx:m=Zw;break;case"scroll":m=Dw;break;case"wheel":m=t1;break;case"copy":case"cut":case"paste":m=Uw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=kf}var g=(t&4)!==0,w=!g&&e==="scroll",x=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,v;y!==null;){v=y;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,x!==null&&(b=Ji(y,x),b!=null&&g.push(sl(y,b,v)))),w)break;y=y.return}0<g.length&&(f=new m(f,p,null,n,h),d.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==rc&&(p=n.relatedTarget||n.fromElement)&&(Vr(p)||p[Wn]))break e;if((m||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?Vr(p):null,p!==null&&(w=os(p),p!==w||p.tag!==5&&p.tag!==6)&&(p=null)):(m=null,p=c),m!==p)){if(g=jf,b="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=kf,b="onPointerLeave",x="onPointerEnter",y="pointer"),w=m==null?f:Rs(m),v=p==null?f:Rs(p),f=new g(b,y+"leave",m,n,h),f.target=w,f.relatedTarget=v,b=null,Vr(h)===c&&(g=new g(x,y+"enter",p,n,h),g.target=v,g.relatedTarget=w,b=g),w=b,m&&p)t:{for(g=m,x=p,y=0,v=g;v;v=vs(v))y++;for(v=0,b=x;b;b=vs(b))v++;for(;0<y-v;)g=vs(g),y--;for(;0<v-y;)x=vs(x),v--;for(;y--;){if(g===x||x!==null&&g===x.alternate)break t;g=vs(g),x=vs(x)}g=null}else g=null;m!==null&&If(d,f,m,g,!1),p!==null&&w!==null&&If(d,w,p,g,!0)}}e:{if(f=c?Rs(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var E=o1;else if(Nf(f))if(qg)E=h1;else{E=c1;var k=u1}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=d1);if(E&&(E=E(e,c))){Qg(d,E,n,h);break e}k&&k(e,f,c),e==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&Xu(f,"number",f.value)}switch(k=c?Rs(c):window,e){case"focusin":(Nf(k)||k.contentEditable==="true")&&(Ts=k,cc=c,Oi=null);break;case"focusout":Oi=cc=Ts=null;break;case"mousedown":dc=!0;break;case"contextmenu":case"mouseup":case"dragend":dc=!1,Rf(d,n,h);break;case"selectionchange":if(m1)break;case"keydown":case"keyup":Rf(d,n,h)}var R;if(Id)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Es?Wg(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(Hg&&n.locale!=="ko"&&(Es||T!=="onCompositionStart"?T==="onCompositionEnd"&&Es&&(R=Bg()):(lr=h,Rd="value"in lr?lr.value:lr.textContent,Es=!0)),k=Ma(c,T),0<k.length&&(T=new wf(T,e,null,n,h),d.push({event:T,listeners:k}),R?T.data=R:(R=Vg(n),R!==null&&(T.data=R)))),(R=r1?s1(e,n):i1(e,n))&&(c=Ma(c,"onBeforeInput"),0<c.length&&(h=new wf("onBeforeInput","beforeinput",null,n,h),d.push({event:h,listeners:c}),h.data=R))}rx(d,t)})}function sl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ma(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,l=i.stateNode;i.tag===5&&l!==null&&(i=l,l=Ji(e,n),l!=null&&r.unshift(sl(e,l,i)),l=Ji(e,t),l!=null&&r.push(sl(e,l,i))),e=e.return}return r}function vs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function If(e,t,n,r,i){for(var l=t._reactName,a=[];n!==null&&n!==r;){var o=n,u=o.alternate,c=o.stateNode;if(u!==null&&u===r)break;o.tag===5&&c!==null&&(o=c,i?(u=Ji(n,l),u!=null&&a.unshift(sl(n,u,o))):i||(u=Ji(n,l),u!=null&&a.push(sl(n,u,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var v1=/\r\n?/g,j1=/\u0000|\uFFFD/g;function Df(e){return(typeof e=="string"?e:""+e).replace(v1,`
38
- `).replace(j1,"")}function Gl(e,t,n){if(t=Df(t),Df(e)!==t&&n)throw Error(K(425))}function za(){}var hc=null,fc=null;function pc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mc=typeof setTimeout=="function"?setTimeout:void 0,w1=typeof clearTimeout=="function"?clearTimeout:void 0,Mf=typeof Promise=="function"?Promise:void 0,k1=typeof queueMicrotask=="function"?queueMicrotask:typeof Mf<"u"?function(e){return Mf.resolve(null).then(e).catch(b1)}:mc;function b1(e){setTimeout(function(){throw e})}function au(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),el(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);el(t)}function fr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function zf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ii=Math.random().toString(36).slice(2),Pn="__reactFiber$"+ii,il="__reactProps$"+ii,Wn="__reactContainer$"+ii,gc="__reactEvents$"+ii,S1="__reactListeners$"+ii,N1="__reactHandles$"+ii;function Vr(e){var t=e[Pn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wn]||n[Pn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=zf(e);e!==null;){if(n=e[Pn])return n;e=zf(e)}return t}e=n,n=e.parentNode}return null}function jl(e){return e=e[Pn]||e[Wn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Rs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(K(33))}function xo(e){return e[il]||null}var xc=[],Ls=-1;function Nr(e){return{current:e}}function He(e){0>Ls||(e.current=xc[Ls],xc[Ls]=null,Ls--)}function Ue(e,t){Ls++,xc[Ls]=e.current,e.current=t}var vr={},Ct=Nr(vr),zt=Nr(!1),Zr=vr;function Qs(e,t){var n=e.type.contextTypes;if(!n)return vr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},l;for(l in n)i[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function _t(e){return e=e.childContextTypes,e!=null}function _a(){He(zt),He(Ct)}function _f(e,t,n){if(Ct.current!==vr)throw Error(K(168));Ue(Ct,t),Ue(zt,n)}function ix(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(K(108,uw(e)||"Unknown",i));return Ge({},n,r)}function $a(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vr,Zr=Ct.current,Ue(Ct,e),Ue(zt,zt.current),!0}function $f(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=ix(e,t,Zr),r.__reactInternalMemoizedMergedChildContext=e,He(zt),He(Ct),Ue(Ct,e)):He(zt),Ue(zt,n)}var $n=null,yo=!1,ou=!1;function lx(e){$n===null?$n=[e]:$n.push(e)}function C1(e){yo=!0,lx(e)}function Cr(){if(!ou&&$n!==null){ou=!0;var e=0,t=Ie;try{var n=$n;for(Ie=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$n=null,yo=!1}catch(i){throw $n!==null&&($n=$n.slice(e+1)),Lg(Cd,Cr),i}finally{Ie=t,ou=!1}}return null}var As=[],Is=0,Oa=null,Fa=0,tn=[],nn=0,es=null,On=1,Fn="";function Fr(e,t){As[Is++]=Fa,As[Is++]=Oa,Oa=e,Fa=t}function ax(e,t,n){tn[nn++]=On,tn[nn++]=Fn,tn[nn++]=es,es=e;var r=On;e=Fn;var i=32-gn(r)-1;r&=~(1<<i),n+=1;var l=32-gn(t)+i;if(30<l){var a=i-i%5;l=(r&(1<<a)-1).toString(32),r>>=a,i-=a,On=1<<32-gn(t)+i|n<<i|r,Fn=l+e}else On=1<<l|n<<i|r,Fn=e}function Md(e){e.return!==null&&(Fr(e,1),ax(e,1,0))}function zd(e){for(;e===Oa;)Oa=As[--Is],As[Is]=null,Fa=As[--Is],As[Is]=null;for(;e===es;)es=tn[--nn],tn[nn]=null,Fn=tn[--nn],tn[nn]=null,On=tn[--nn],tn[nn]=null}var qt=null,Vt=null,Ve=!1,mn=null;function ox(e,t){var n=sn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Of(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,qt=e,Vt=fr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,qt=e,Vt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=es!==null?{id:On,overflow:Fn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=sn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,qt=e,Vt=null,!0):!1;default:return!1}}function yc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function vc(e){if(Ve){var t=Vt;if(t){var n=t;if(!Of(e,t)){if(yc(e))throw Error(K(418));t=fr(n.nextSibling);var r=qt;t&&Of(e,t)?ox(r,n):(e.flags=e.flags&-4097|2,Ve=!1,qt=e)}}else{if(yc(e))throw Error(K(418));e.flags=e.flags&-4097|2,Ve=!1,qt=e}}}function Ff(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;qt=e}function Kl(e){if(e!==qt)return!1;if(!Ve)return Ff(e),Ve=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!pc(e.type,e.memoizedProps)),t&&(t=Vt)){if(yc(e))throw ux(),Error(K(418));for(;t;)ox(e,t),t=fr(t.nextSibling)}if(Ff(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Vt=fr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Vt=null}}else Vt=qt?fr(e.stateNode.nextSibling):null;return!0}function ux(){for(var e=Vt;e;)e=fr(e.nextSibling)}function qs(){Vt=qt=null,Ve=!1}function _d(e){mn===null?mn=[e]:mn.push(e)}var E1=qn.ReactCurrentBatchConfig;function vi(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(K(309));var r=n.stateNode}if(!r)throw Error(K(147,e));var i=r,l=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===l?t.ref:(t=function(a){var o=i.refs;a===null?delete o[l]:o[l]=a},t._stringRef=l,t)}if(typeof e!="string")throw Error(K(284));if(!n._owner)throw Error(K(290,e))}return e}function Yl(e,t){throw e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Uf(e){var t=e._init;return t(e._payload)}function cx(e){function t(x,y){if(e){var v=x.deletions;v===null?(x.deletions=[y],x.flags|=16):v.push(y)}}function n(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function r(x,y){for(x=new Map;y!==null;)y.key!==null?x.set(y.key,y):x.set(y.index,y),y=y.sibling;return x}function i(x,y){return x=xr(x,y),x.index=0,x.sibling=null,x}function l(x,y,v){return x.index=v,e?(v=x.alternate,v!==null?(v=v.index,v<y?(x.flags|=2,y):v):(x.flags|=2,y)):(x.flags|=1048576,y)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function o(x,y,v,b){return y===null||y.tag!==6?(y=mu(v,x.mode,b),y.return=x,y):(y=i(y,v),y.return=x,y)}function u(x,y,v,b){var E=v.type;return E===Cs?h(x,y,v.props.children,b,v.key):y!==null&&(y.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===nr&&Uf(E)===y.type)?(b=i(y,v.props),b.ref=vi(x,y,v),b.return=x,b):(b=ka(v.type,v.key,v.props,null,x.mode,b),b.ref=vi(x,y,v),b.return=x,b)}function c(x,y,v,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=gu(v,x.mode,b),y.return=x,y):(y=i(y,v.children||[]),y.return=x,y)}function h(x,y,v,b,E){return y===null||y.tag!==7?(y=Jr(v,x.mode,b,E),y.return=x,y):(y=i(y,v),y.return=x,y)}function d(x,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return y=mu(""+y,x.mode,v),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ol:return v=ka(y.type,y.key,y.props,null,x.mode,v),v.ref=vi(x,null,y),v.return=x,v;case Ns:return y=gu(y,x.mode,v),y.return=x,y;case nr:var b=y._init;return d(x,b(y._payload),v)}if(Li(y)||pi(y))return y=Jr(y,x.mode,v,null),y.return=x,y;Yl(x,y)}return null}function f(x,y,v,b){var E=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return E!==null?null:o(x,y,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ol:return v.key===E?u(x,y,v,b):null;case Ns:return v.key===E?c(x,y,v,b):null;case nr:return E=v._init,f(x,y,E(v._payload),b)}if(Li(v)||pi(v))return E!==null?null:h(x,y,v,b,null);Yl(x,v)}return null}function m(x,y,v,b,E){if(typeof b=="string"&&b!==""||typeof b=="number")return x=x.get(v)||null,o(y,x,""+b,E);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ol:return x=x.get(b.key===null?v:b.key)||null,u(y,x,b,E);case Ns:return x=x.get(b.key===null?v:b.key)||null,c(y,x,b,E);case nr:var k=b._init;return m(x,y,v,k(b._payload),E)}if(Li(b)||pi(b))return x=x.get(v)||null,h(y,x,b,E,null);Yl(y,b)}return null}function p(x,y,v,b){for(var E=null,k=null,R=y,T=y=0,D=null;R!==null&&T<v.length;T++){R.index>T?(D=R,R=null):D=R.sibling;var C=f(x,R,v[T],b);if(C===null){R===null&&(R=D);break}e&&R&&C.alternate===null&&t(x,R),y=l(C,y,T),k===null?E=C:k.sibling=C,k=C,R=D}if(T===v.length)return n(x,R),Ve&&Fr(x,T),E;if(R===null){for(;T<v.length;T++)R=d(x,v[T],b),R!==null&&(y=l(R,y,T),k===null?E=R:k.sibling=R,k=R);return Ve&&Fr(x,T),E}for(R=r(x,R);T<v.length;T++)D=m(R,x,T,v[T],b),D!==null&&(e&&D.alternate!==null&&R.delete(D.key===null?T:D.key),y=l(D,y,T),k===null?E=D:k.sibling=D,k=D);return e&&R.forEach(function(L){return t(x,L)}),Ve&&Fr(x,T),E}function g(x,y,v,b){var E=pi(v);if(typeof E!="function")throw Error(K(150));if(v=E.call(v),v==null)throw Error(K(151));for(var k=E=null,R=y,T=y=0,D=null,C=v.next();R!==null&&!C.done;T++,C=v.next()){R.index>T?(D=R,R=null):D=R.sibling;var L=f(x,R,C.value,b);if(L===null){R===null&&(R=D);break}e&&R&&L.alternate===null&&t(x,R),y=l(L,y,T),k===null?E=L:k.sibling=L,k=L,R=D}if(C.done)return n(x,R),Ve&&Fr(x,T),E;if(R===null){for(;!C.done;T++,C=v.next())C=d(x,C.value,b),C!==null&&(y=l(C,y,T),k===null?E=C:k.sibling=C,k=C);return Ve&&Fr(x,T),E}for(R=r(x,R);!C.done;T++,C=v.next())C=m(R,x,T,C.value,b),C!==null&&(e&&C.alternate!==null&&R.delete(C.key===null?T:C.key),y=l(C,y,T),k===null?E=C:k.sibling=C,k=C);return e&&R.forEach(function(A){return t(x,A)}),Ve&&Fr(x,T),E}function w(x,y,v,b){if(typeof v=="object"&&v!==null&&v.type===Cs&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Ol:e:{for(var E=v.key,k=y;k!==null;){if(k.key===E){if(E=v.type,E===Cs){if(k.tag===7){n(x,k.sibling),y=i(k,v.props.children),y.return=x,x=y;break e}}else if(k.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===nr&&Uf(E)===k.type){n(x,k.sibling),y=i(k,v.props),y.ref=vi(x,k,v),y.return=x,x=y;break e}n(x,k);break}else t(x,k);k=k.sibling}v.type===Cs?(y=Jr(v.props.children,x.mode,b,v.key),y.return=x,x=y):(b=ka(v.type,v.key,v.props,null,x.mode,b),b.ref=vi(x,y,v),b.return=x,x=b)}return a(x);case Ns:e:{for(k=v.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(x,y.sibling),y=i(y,v.children||[]),y.return=x,x=y;break e}else{n(x,y);break}else t(x,y);y=y.sibling}y=gu(v,x.mode,b),y.return=x,x=y}return a(x);case nr:return k=v._init,w(x,y,k(v._payload),b)}if(Li(v))return p(x,y,v,b);if(pi(v))return g(x,y,v,b);Yl(x,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(x,y.sibling),y=i(y,v),y.return=x,x=y):(n(x,y),y=mu(v,x.mode,b),y.return=x,x=y),a(x)):n(x,y)}return w}var Gs=cx(!0),dx=cx(!1),Ua=Nr(null),Ba=null,Ds=null,$d=null;function Od(){$d=Ds=Ba=null}function Fd(e){var t=Ua.current;He(Ua),e._currentValue=t}function jc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Bs(e,t){Ba=e,$d=Ds=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Mt=!0),e.firstContext=null)}function on(e){var t=e._currentValue;if($d!==e)if(e={context:e,memoizedValue:t,next:null},Ds===null){if(Ba===null)throw Error(K(308));Ds=e,Ba.dependencies={lanes:0,firstContext:e}}else Ds=Ds.next=e;return t}var Qr=null;function Ud(e){Qr===null?Qr=[e]:Qr.push(e)}function hx(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ud(t)):(n.next=i.next,i.next=n),t.interleaved=n,Vn(e,r)}function Vn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var rr=!1;function Bd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Un(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Te&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Vn(e,n)}return i=r.interleaved,i===null?(t.next=t,Ud(r)):(t.next=i.next,i.next=t),r.interleaved=t,Vn(e,n)}function ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ed(e,n)}}function Bf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?i=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?i=l=t:l=l.next=t}else i=l=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ha(e,t,n,r){var i=e.updateQueue;rr=!1;var l=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?l=c:a.next=c,a=u;var h=e.alternate;h!==null&&(h=h.updateQueue,o=h.lastBaseUpdate,o!==a&&(o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=u))}if(l!==null){var d=i.baseState;a=0,h=c=u=null,o=l;do{var f=o.lane,m=o.eventTime;if((r&f)===f){h!==null&&(h=h.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=e,g=o;switch(f=t,m=n,g.tag){case 1:if(p=g.payload,typeof p=="function"){d=p.call(m,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,f=typeof p=="function"?p.call(m,d,f):p,f==null)break e;d=Ge({},d,f);break e;case 2:rr=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[o]:f.push(o))}else m={eventTime:m,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},h===null?(c=h=m,u=d):h=h.next=m,a|=f;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;f=o,o=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(h===null&&(u=d),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=h,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else l===null&&(i.shared.lanes=0);ns|=a,e.lanes=a,e.memoizedState=d}}function Hf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(K(191,i));i.call(r)}}}var wl={},An=Nr(wl),ll=Nr(wl),al=Nr(wl);function qr(e){if(e===wl)throw Error(K(174));return e}function Hd(e,t){switch(Ue(al,t),Ue(ll,e),Ue(An,wl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ec(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ec(t,e)}He(An),Ue(An,t)}function Ks(){He(An),He(ll),He(al)}function px(e){qr(al.current);var t=qr(An.current),n=ec(t,e.type);t!==n&&(Ue(ll,e),Ue(An,n))}function Wd(e){ll.current===e&&(He(An),He(ll))}var Qe=Nr(0);function Wa(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var uu=[];function Vd(){for(var e=0;e<uu.length;e++)uu[e]._workInProgressVersionPrimary=null;uu.length=0}var xa=qn.ReactCurrentDispatcher,cu=qn.ReactCurrentBatchConfig,ts=0,qe=null,lt=null,ct=null,Va=!1,Fi=!1,ol=0,T1=0;function bt(){throw Error(K(321))}function Qd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jn(e[n],t[n]))return!1;return!0}function qd(e,t,n,r,i,l){if(ts=l,qe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xa.current=e===null||e.memoizedState===null?A1:I1,e=n(r,i),Fi){l=0;do{if(Fi=!1,ol=0,25<=l)throw Error(K(301));l+=1,ct=lt=null,t.updateQueue=null,xa.current=D1,e=n(r,i)}while(Fi)}if(xa.current=Qa,t=lt!==null&&lt.next!==null,ts=0,ct=lt=qe=null,Va=!1,t)throw Error(K(300));return e}function Gd(){var e=ol!==0;return ol=0,e}function En(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ct===null?qe.memoizedState=ct=e:ct=ct.next=e,ct}function un(){if(lt===null){var e=qe.alternate;e=e!==null?e.memoizedState:null}else e=lt.next;var t=ct===null?qe.memoizedState:ct.next;if(t!==null)ct=t,lt=e;else{if(e===null)throw Error(K(310));lt=e,e={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},ct===null?qe.memoizedState=ct=e:ct=ct.next=e}return ct}function ul(e,t){return typeof t=="function"?t(e):t}function du(e){var t=un(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=lt,i=r.baseQueue,l=n.pending;if(l!==null){if(i!==null){var a=i.next;i.next=l.next,l.next=a}r.baseQueue=i=l,n.pending=null}if(i!==null){l=i.next,r=r.baseState;var o=a=null,u=null,c=l;do{var h=c.lane;if((ts&h)===h)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=d,a=r):u=u.next=d,qe.lanes|=h,ns|=h}c=c.next}while(c!==null&&c!==l);u===null?a=r:u.next=o,jn(r,t.memoizedState)||(Mt=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do l=i.lane,qe.lanes|=l,ns|=l,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function hu(e){var t=un(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,l=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do l=e(l,a.action),a=a.next;while(a!==i);jn(l,t.memoizedState)||(Mt=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,r]}function mx(){}function gx(e,t){var n=qe,r=un(),i=t(),l=!jn(r.memoizedState,i);if(l&&(r.memoizedState=i,Mt=!0),r=r.queue,Kd(vx.bind(null,n,r,e),[e]),r.getSnapshot!==t||l||ct!==null&&ct.memoizedState.tag&1){if(n.flags|=2048,cl(9,yx.bind(null,n,r,i,t),void 0,null),ht===null)throw Error(K(349));ts&30||xx(n,t,i)}return i}function xx(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function yx(e,t,n,r){t.value=n,t.getSnapshot=r,jx(t)&&wx(e)}function vx(e,t,n){return n(function(){jx(t)&&wx(e)})}function jx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jn(e,n)}catch{return!0}}function wx(e){var t=Vn(e,1);t!==null&&xn(t,e,1,-1)}function Wf(e){var t=En();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ul,lastRenderedState:e},t.queue=e,e=e.dispatch=L1.bind(null,qe,e),[t.memoizedState,e]}function cl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function kx(){return un().memoizedState}function ya(e,t,n,r){var i=En();qe.flags|=e,i.memoizedState=cl(1|t,n,void 0,r===void 0?null:r)}function vo(e,t,n,r){var i=un();r=r===void 0?null:r;var l=void 0;if(lt!==null){var a=lt.memoizedState;if(l=a.destroy,r!==null&&Qd(r,a.deps)){i.memoizedState=cl(t,n,l,r);return}}qe.flags|=e,i.memoizedState=cl(1|t,n,l,r)}function Vf(e,t){return ya(8390656,8,e,t)}function Kd(e,t){return vo(2048,8,e,t)}function bx(e,t){return vo(4,2,e,t)}function Sx(e,t){return vo(4,4,e,t)}function Nx(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Cx(e,t,n){return n=n!=null?n.concat([e]):null,vo(4,4,Nx.bind(null,t,e),n)}function Yd(){}function Ex(e,t){var n=un();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qd(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Tx(e,t){var n=un();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qd(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Px(e,t,n){return ts&21?(jn(n,t)||(n=Dg(),qe.lanes|=n,ns|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Mt=!0),e.memoizedState=n)}function P1(e,t){var n=Ie;Ie=n!==0&&4>n?n:4,e(!0);var r=cu.transition;cu.transition={};try{e(!1),t()}finally{Ie=n,cu.transition=r}}function Rx(){return un().memoizedState}function R1(e,t,n){var r=gr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Lx(e))Ax(t,n);else if(n=hx(e,t,n,r),n!==null){var i=Tt();xn(n,e,r,i),Ix(n,t,r)}}function L1(e,t,n){var r=gr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Lx(e))Ax(t,i);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,o=l(a,n);if(i.hasEagerState=!0,i.eagerState=o,jn(o,a)){var u=t.interleaved;u===null?(i.next=i,Ud(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=hx(e,t,i,r),n!==null&&(i=Tt(),xn(n,e,r,i),Ix(n,t,r))}}function Lx(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function Ax(e,t){Fi=Va=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ix(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ed(e,n)}}var Qa={readContext:on,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useInsertionEffect:bt,useLayoutEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useMutableSource:bt,useSyncExternalStore:bt,useId:bt,unstable_isNewReconciler:!1},A1={readContext:on,useCallback:function(e,t){return En().memoizedState=[e,t===void 0?null:t],e},useContext:on,useEffect:Vf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ya(4194308,4,Nx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ya(4194308,4,e,t)},useInsertionEffect:function(e,t){return ya(4,2,e,t)},useMemo:function(e,t){var n=En();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=En();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=R1.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=En();return e={current:e},t.memoizedState=e},useState:Wf,useDebugValue:Yd,useDeferredValue:function(e){return En().memoizedState=e},useTransition:function(){var e=Wf(!1),t=e[0];return e=P1.bind(null,e[1]),En().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=En();if(Ve){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),ht===null)throw Error(K(349));ts&30||xx(r,t,n)}i.memoizedState=n;var l={value:n,getSnapshot:t};return i.queue=l,Vf(vx.bind(null,r,l,e),[e]),r.flags|=2048,cl(9,yx.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=En(),t=ht.identifierPrefix;if(Ve){var n=Fn,r=On;n=(r&~(1<<32-gn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ol++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=T1++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},I1={readContext:on,useCallback:Ex,useContext:on,useEffect:Kd,useImperativeHandle:Cx,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:du,useRef:kx,useState:function(){return du(ul)},useDebugValue:Yd,useDeferredValue:function(e){var t=un();return Px(t,lt.memoizedState,e)},useTransition:function(){var e=du(ul)[0],t=un().memoizedState;return[e,t]},useMutableSource:mx,useSyncExternalStore:gx,useId:Rx,unstable_isNewReconciler:!1},D1={readContext:on,useCallback:Ex,useContext:on,useEffect:Kd,useImperativeHandle:Cx,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:hu,useRef:kx,useState:function(){return hu(ul)},useDebugValue:Yd,useDeferredValue:function(e){var t=un();return lt===null?t.memoizedState=e:Px(t,lt.memoizedState,e)},useTransition:function(){var e=hu(ul)[0],t=un().memoizedState;return[e,t]},useMutableSource:mx,useSyncExternalStore:gx,useId:Rx,unstable_isNewReconciler:!1};function hn(e,t){if(e&&e.defaultProps){t=Ge({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function wc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ge({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var jo={isMounted:function(e){return(e=e._reactInternals)?os(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Tt(),i=gr(e),l=Un(r,i);l.payload=t,n!=null&&(l.callback=n),t=pr(e,l,i),t!==null&&(xn(t,e,i,r),ga(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Tt(),i=gr(e),l=Un(r,i);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=pr(e,l,i),t!==null&&(xn(t,e,i,r),ga(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Tt(),r=gr(e),i=Un(n,r);i.tag=2,t!=null&&(i.callback=t),t=pr(e,i,r),t!==null&&(xn(t,e,r,n),ga(t,e,r))}};function Qf(e,t,n,r,i,l,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,l,a):t.prototype&&t.prototype.isPureReactComponent?!nl(n,r)||!nl(i,l):!0}function Dx(e,t,n){var r=!1,i=vr,l=t.contextType;return typeof l=="object"&&l!==null?l=on(l):(i=_t(t)?Zr:Ct.current,r=t.contextTypes,l=(r=r!=null)?Qs(e,i):vr),t=new t(n,l),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=jo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=l),t}function qf(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&jo.enqueueReplaceState(t,t.state,null)}function kc(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Bd(e);var l=t.contextType;typeof l=="object"&&l!==null?i.context=on(l):(l=_t(t)?Zr:Ct.current,i.context=Qs(e,l)),i.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(wc(e,t,l,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&jo.enqueueReplaceState(i,i.state,null),Ha(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Ys(e,t){try{var n="",r=t;do n+=ow(r),r=r.return;while(r);var i=n}catch(l){i=`
37
+ `+i[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{qo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ri(e):""}function cw(e){switch(e.tag){case 5:return Ri(e.type);case 16:return Ri("Lazy");case 13:return Ri("Suspense");case 19:return Ri("SuspenseList");case 0:case 2:case 15:return e=Go(e.type,!1),e;case 11:return e=Go(e.type.render,!1),e;case 1:return e=Go(e.type,!0),e;default:return""}}function Ku(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Cs:return"Fragment";case Ns:return"Portal";case Qu:return"Profiler";case kd:return"StrictMode";case qu:return"Suspense";case Gu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fg:return(e.displayName||"Context")+".Consumer";case hg:return(e._context.displayName||"Context")+".Provider";case bd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Sd:return t=e.displayName||null,t!==null?t:Ku(e.type)||"Memo";case nr:t=e._payload,e=e._init;try{return Ku(e(t))}catch{}}return null}function dw(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ku(t);case 8:return t===kd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function yr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hw(e){var t=mg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ol(e){e._valueTracker||(e._valueTracker=hw(e))}function gg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=mg(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ea(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Yu(e,t){var n=t.checked;return Ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function cf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=yr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function xg(e,t){t=t.checked,t!=null&&wd(e,"checked",t,!1)}function Ju(e,t){xg(e,t);var n=yr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Xu(e,t.type,n):t.hasOwnProperty("defaultValue")&&Xu(e,t.type,yr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function df(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Xu(e,t,n){(t!=="number"||Ea(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Li=Array.isArray;function $s(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+yr(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Zu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(K(91));return Ke({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function hf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(K(92));if(Li(n)){if(1<n.length)throw Error(K(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:yr(n)}}function yg(e,t){var n=yr(t.value),r=yr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function ff(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vg(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ec(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vg(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fl,jg=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Fl=Fl||document.createElement("div"),Fl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Fl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ki(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fw=["Webkit","ms","Moz","O"];Object.keys(Mi).forEach(function(e){fw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mi[t]=Mi[e]})});function wg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mi.hasOwnProperty(e)&&Mi[e]?(""+t).trim():t+"px"}function kg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=wg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var pw=Ke({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function tc(e,t){if(t){if(pw[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function nc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rc=null;function Nd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sc=null,Os=null,Fs=null;function pf(e){if(e=vl(e)){if(typeof sc!="function")throw Error(K(280));var t=e.stateNode;t&&(t=xo(t),sc(e.stateNode,e.type,t))}}function bg(e){Os?Fs?Fs.push(e):Fs=[e]:Os=e}function Sg(){if(Os){var e=Os,t=Fs;if(Fs=Os=null,pf(e),t)for(e=0;e<t.length;e++)pf(t[e])}}function Ng(e,t){return e(t)}function Cg(){}var Ko=!1;function Eg(e,t,n){if(Ko)return e(t,n);Ko=!0;try{return Ng(e,t,n)}finally{Ko=!1,(Os!==null||Fs!==null)&&(Cg(),Sg())}}function Yi(e,t){var n=e.stateNode;if(n===null)return null;var r=xo(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(K(231,t,typeof n));return n}var ic=!1;if(Hn)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){ic=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{ic=!1}function mw(e,t,n,r,i,l,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var zi=!1,Ta=null,Pa=!1,lc=null,gw={onError:function(e){zi=!0,Ta=e}};function xw(e,t,n,r,i,l,a,o,u){zi=!1,Ta=null,mw.apply(gw,arguments)}function yw(e,t,n,r,i,l,a,o,u){if(xw.apply(this,arguments),zi){if(zi){var c=Ta;zi=!1,Ta=null}else throw Error(K(198));Pa||(Pa=!0,lc=c)}}function us(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Tg(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function mf(e){if(us(e)!==e)throw Error(K(188))}function vw(e){var t=e.alternate;if(!t){if(t=us(e),t===null)throw Error(K(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var l=i.alternate;if(l===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===l.child){for(l=i.child;l;){if(l===n)return mf(i),e;if(l===r)return mf(i),t;l=l.sibling}throw Error(K(188))}if(n.return!==r.return)n=i,r=l;else{for(var a=!1,o=i.child;o;){if(o===n){a=!0,n=i,r=l;break}if(o===r){a=!0,r=i,n=l;break}o=o.sibling}if(!a){for(o=l.child;o;){if(o===n){a=!0,n=l,r=i;break}if(o===r){a=!0,r=l,n=i;break}o=o.sibling}if(!a)throw Error(K(189))}}if(n.alternate!==r)throw Error(K(190))}if(n.tag!==3)throw Error(K(188));return n.stateNode.current===n?e:t}function Pg(e){return e=vw(e),e!==null?Rg(e):null}function Rg(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Rg(e);if(t!==null)return t;e=e.sibling}return null}var Lg=Yt.unstable_scheduleCallback,gf=Yt.unstable_cancelCallback,jw=Yt.unstable_shouldYield,ww=Yt.unstable_requestPaint,et=Yt.unstable_now,kw=Yt.unstable_getCurrentPriorityLevel,Cd=Yt.unstable_ImmediatePriority,Ag=Yt.unstable_UserBlockingPriority,Ra=Yt.unstable_NormalPriority,bw=Yt.unstable_LowPriority,Ig=Yt.unstable_IdlePriority,fo=null,Rn=null;function Sw(e){if(Rn&&typeof Rn.onCommitFiberRoot=="function")try{Rn.onCommitFiberRoot(fo,e,void 0,(e.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:Ew,Nw=Math.log,Cw=Math.LN2;function Ew(e){return e>>>=0,e===0?32:31-(Nw(e)/Cw|0)|0}var Ul=64,Bl=4194304;function Ai(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function La(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~i;o!==0?r=Ai(o):(l&=a,l!==0&&(r=Ai(l)))}else a=n&~i,a!==0?r=Ai(a):l!==0&&(r=Ai(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,l=t&-t,i>=l||i===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-gn(t),i=1<<n,r|=e[n],t&=~i;return r}function Tw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pw(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,l=e.pendingLanes;0<l;){var a=31-gn(l),o=1<<a,u=i[a];u===-1?(!(o&n)||o&r)&&(i[a]=Tw(o,t)):u<=t&&(e.expiredLanes|=o),l&=~o}}function ac(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Dg(){var e=Ul;return Ul<<=1,!(Ul&4194240)&&(Ul=64),e}function Yo(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function xl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gn(t),e[t]=n}function Rw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-gn(n),l=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~l}}function Ed(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Me=0;function Mg(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zg,Td,_g,$g,Og,oc=!1,Hl=[],cr=null,dr=null,hr=null,Ji=new Map,Xi=new Map,sr=[],Lw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function xf(e,t){switch(e){case"focusin":case"focusout":cr=null;break;case"dragenter":case"dragleave":dr=null;break;case"mouseover":case"mouseout":hr=null;break;case"pointerover":case"pointerout":Ji.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xi.delete(t.pointerId)}}function gi(e,t,n,r,i,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:l,targetContainers:[i]},t!==null&&(t=vl(t),t!==null&&Td(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Aw(e,t,n,r,i){switch(t){case"focusin":return cr=gi(cr,e,t,n,r,i),!0;case"dragenter":return dr=gi(dr,e,t,n,r,i),!0;case"mouseover":return hr=gi(hr,e,t,n,r,i),!0;case"pointerover":var l=i.pointerId;return Ji.set(l,gi(Ji.get(l)||null,e,t,n,r,i)),!0;case"gotpointercapture":return l=i.pointerId,Xi.set(l,gi(Xi.get(l)||null,e,t,n,r,i)),!0}return!1}function Fg(e){var t=Qr(e.target);if(t!==null){var n=us(t);if(n!==null){if(t=n.tag,t===13){if(t=Tg(n),t!==null){e.blockedOn=t,Og(e.priority,function(){_g(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ha(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=uc(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rc=r,n.target.dispatchEvent(r),rc=null}else return t=vl(n),t!==null&&Td(t),e.blockedOn=n,!1;t.shift()}return!0}function yf(e,t,n){ha(e)&&n.delete(t)}function Iw(){oc=!1,cr!==null&&ha(cr)&&(cr=null),dr!==null&&ha(dr)&&(dr=null),hr!==null&&ha(hr)&&(hr=null),Ji.forEach(yf),Xi.forEach(yf)}function xi(e,t){e.blockedOn===t&&(e.blockedOn=null,oc||(oc=!0,Yt.unstable_scheduleCallback(Yt.unstable_NormalPriority,Iw)))}function Zi(e){function t(i){return xi(i,e)}if(0<Hl.length){xi(Hl[0],e);for(var n=1;n<Hl.length;n++){var r=Hl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(cr!==null&&xi(cr,e),dr!==null&&xi(dr,e),hr!==null&&xi(hr,e),Ji.forEach(t),Xi.forEach(t),n=0;n<sr.length;n++)r=sr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<sr.length&&(n=sr[0],n.blockedOn===null);)Fg(n),n.blockedOn===null&&sr.shift()}var Us=qn.ReactCurrentBatchConfig,Aa=!0;function Dw(e,t,n,r){var i=Me,l=Us.transition;Us.transition=null;try{Me=1,Pd(e,t,n,r)}finally{Me=i,Us.transition=l}}function Mw(e,t,n,r){var i=Me,l=Us.transition;Us.transition=null;try{Me=4,Pd(e,t,n,r)}finally{Me=i,Us.transition=l}}function Pd(e,t,n,r){if(Aa){var i=uc(e,t,n,r);if(i===null)lu(e,t,r,Ia,n),xf(e,r);else if(Aw(i,e,t,n,r))r.stopPropagation();else if(xf(e,r),t&4&&-1<Lw.indexOf(e)){for(;i!==null;){var l=vl(i);if(l!==null&&zg(l),l=uc(e,t,n,r),l===null&&lu(e,t,r,Ia,n),l===i)break;i=l}i!==null&&r.stopPropagation()}else lu(e,t,r,null,n)}}var Ia=null;function uc(e,t,n,r){if(Ia=null,e=Nd(r),e=Qr(e),e!==null)if(t=us(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Tg(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ia=e,null}function Ug(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(kw()){case Cd:return 1;case Ag:return 4;case Ra:case bw:return 16;case Ig:return 536870912;default:return 16}default:return 16}}var lr=null,Rd=null,fa=null;function Bg(){if(fa)return fa;var e,t=Rd,n=t.length,r,i="value"in lr?lr.value:lr.textContent,l=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===i[l-r];r++);return fa=i.slice(e,1<r?1-r:void 0)}function pa(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Wl(){return!0}function vf(){return!1}function Xt(e){function t(n,r,i,l,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=l,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?Wl:vf,this.isPropagationStopped=vf,this}return Ke(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),t}var si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ld=Xt(si),yl=Ke({},si,{view:0,detail:0}),zw=Xt(yl),Jo,Xo,yi,po=Ke({},yl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ad,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==yi&&(yi&&e.type==="mousemove"?(Jo=e.screenX-yi.screenX,Xo=e.screenY-yi.screenY):Xo=Jo=0,yi=e),Jo)},movementY:function(e){return"movementY"in e?e.movementY:Xo}}),jf=Xt(po),_w=Ke({},po,{dataTransfer:0}),$w=Xt(_w),Ow=Ke({},yl,{relatedTarget:0}),Zo=Xt(Ow),Fw=Ke({},si,{animationName:0,elapsedTime:0,pseudoElement:0}),Uw=Xt(Fw),Bw=Ke({},si,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hw=Xt(Bw),Ww=Ke({},si,{data:0}),wf=Xt(Ww),Vw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qw={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"},qw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qw[e])?!!t[e]:!1}function Ad(){return Gw}var Kw=Ke({},yl,{key:function(e){if(e.key){var t=Vw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=pa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Qw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ad,charCode:function(e){return e.type==="keypress"?pa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yw=Xt(Kw),Jw=Ke({},po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kf=Xt(Jw),Xw=Ke({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ad}),Zw=Xt(Xw),e1=Ke({},si,{propertyName:0,elapsedTime:0,pseudoElement:0}),t1=Xt(e1),n1=Ke({},po,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),r1=Xt(n1),s1=[9,13,27,32],Id=Hn&&"CompositionEvent"in window,_i=null;Hn&&"documentMode"in document&&(_i=document.documentMode);var i1=Hn&&"TextEvent"in window&&!_i,Hg=Hn&&(!Id||_i&&8<_i&&11>=_i),bf=" ",Sf=!1;function Wg(e,t){switch(e){case"keyup":return s1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Es=!1;function l1(e,t){switch(e){case"compositionend":return Vg(t);case"keypress":return t.which!==32?null:(Sf=!0,bf);case"textInput":return e=t.data,e===bf&&Sf?null:e;default:return null}}function a1(e,t){if(Es)return e==="compositionend"||!Id&&Wg(e,t)?(e=Bg(),fa=Rd=lr=null,Es=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Hg&&t.locale!=="ko"?null:t.data;default:return null}}var o1={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 Nf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!o1[e.type]:t==="textarea"}function Qg(e,t,n,r){bg(r),t=Da(t,"onChange"),0<t.length&&(n=new Ld("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var $i=null,el=null;function u1(e){rx(e,0)}function mo(e){var t=Rs(e);if(gg(t))return e}function c1(e,t){if(e==="change")return t}var qg=!1;if(Hn){var eu;if(Hn){var tu="oninput"in document;if(!tu){var Cf=document.createElement("div");Cf.setAttribute("oninput","return;"),tu=typeof Cf.oninput=="function"}eu=tu}else eu=!1;qg=eu&&(!document.documentMode||9<document.documentMode)}function Ef(){$i&&($i.detachEvent("onpropertychange",Gg),el=$i=null)}function Gg(e){if(e.propertyName==="value"&&mo(el)){var t=[];Qg(t,el,e,Nd(e)),Eg(u1,t)}}function d1(e,t,n){e==="focusin"?(Ef(),$i=t,el=n,$i.attachEvent("onpropertychange",Gg)):e==="focusout"&&Ef()}function h1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mo(el)}function f1(e,t){if(e==="click")return mo(t)}function p1(e,t){if(e==="input"||e==="change")return mo(t)}function m1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jn=typeof Object.is=="function"?Object.is:m1;function tl(e,t){if(jn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Vu.call(t,i)||!jn(e[i],t[i]))return!1}return!0}function Tf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Pf(e,t){var n=Tf(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Tf(n)}}function Kg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yg(){for(var e=window,t=Ea();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ea(e.document)}return t}function Dd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function g1(e){var t=Yg(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Kg(n.ownerDocument.documentElement,n)){if(r!==null&&Dd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,l=Math.min(r.start,i);r=r.end===void 0?l:Math.min(r.end,i),!e.extend&&l>r&&(i=r,r=l,l=i),i=Pf(n,l);var a=Pf(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var x1=Hn&&"documentMode"in document&&11>=document.documentMode,Ts=null,cc=null,Oi=null,dc=!1;function Rf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;dc||Ts==null||Ts!==Ea(r)||(r=Ts,"selectionStart"in r&&Dd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Oi&&tl(Oi,r)||(Oi=r,r=Da(cc,"onSelect"),0<r.length&&(t=new Ld("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ts)))}function Vl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ps={animationend:Vl("Animation","AnimationEnd"),animationiteration:Vl("Animation","AnimationIteration"),animationstart:Vl("Animation","AnimationStart"),transitionend:Vl("Transition","TransitionEnd")},nu={},Jg={};Hn&&(Jg=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function go(e){if(nu[e])return nu[e];if(!Ps[e])return e;var t=Ps[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Jg)return nu[e]=t[n];return e}var Xg=go("animationend"),Zg=go("animationiteration"),ex=go("animationstart"),tx=go("transitionend"),nx=new Map,Lf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Nr(e,t){nx.set(e,t),os(t,[e])}for(var ru=0;ru<Lf.length;ru++){var su=Lf[ru],y1=su.toLowerCase(),v1=su[0].toUpperCase()+su.slice(1);Nr(y1,"on"+v1)}Nr(Xg,"onAnimationEnd");Nr(Zg,"onAnimationIteration");Nr(ex,"onAnimationStart");Nr("dblclick","onDoubleClick");Nr("focusin","onFocus");Nr("focusout","onBlur");Nr(tx,"onTransitionEnd");Vs("onMouseEnter",["mouseout","mouseover"]);Vs("onMouseLeave",["mouseout","mouseover"]);Vs("onPointerEnter",["pointerout","pointerover"]);Vs("onPointerLeave",["pointerout","pointerover"]);os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));os("onBeforeInput",["compositionend","keypress","textInput","paste"]);os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ii="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(" "),j1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ii));function Af(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,yw(r,t,void 0,e),e.currentTarget=null}function rx(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var l=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==l&&i.isPropagationStopped())break e;Af(i,o,c),l=u}else for(a=0;a<r.length;a++){if(o=r[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==l&&i.isPropagationStopped())break e;Af(i,o,c),l=u}}}if(Pa)throw e=lc,Pa=!1,lc=null,e}function He(e,t){var n=t[gc];n===void 0&&(n=t[gc]=new Set);var r=e+"__bubble";n.has(r)||(sx(t,e,2,!1),n.add(r))}function iu(e,t,n){var r=0;t&&(r|=4),sx(n,e,r,t)}var Ql="_reactListening"+Math.random().toString(36).slice(2);function nl(e){if(!e[Ql]){e[Ql]=!0,dg.forEach(function(n){n!=="selectionchange"&&(j1.has(n)||iu(n,!1,e),iu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ql]||(t[Ql]=!0,iu("selectionchange",!1,t))}}function sx(e,t,n,r){switch(Ug(t)){case 1:var i=Dw;break;case 4:i=Mw;break;default:i=Pd}n=i.bind(null,t,n,e),i=void 0,!ic||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function lu(e,t,n,r,i){var l=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===i||u.nodeType===8&&u.parentNode===i))return;a=a.return}for(;o!==null;){if(a=Qr(o),a===null)return;if(u=a.tag,u===5||u===6){r=l=a;continue e}o=o.parentNode}}r=r.return}Eg(function(){var c=l,h=Nd(n),d=[];e:{var f=nx.get(e);if(f!==void 0){var m=Ld,p=e;switch(e){case"keypress":if(pa(n)===0)break e;case"keydown":case"keyup":m=Yw;break;case"focusin":p="focus",m=Zo;break;case"focusout":p="blur",m=Zo;break;case"beforeblur":case"afterblur":m=Zo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=$w;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Zw;break;case Xg:case Zg:case ex:m=Uw;break;case tx:m=t1;break;case"scroll":m=zw;break;case"wheel":m=r1;break;case"copy":case"cut":case"paste":m=Hw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=kf}var g=(t&4)!==0,w=!g&&e==="scroll",x=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,v;y!==null;){v=y;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,x!==null&&(b=Yi(y,x),b!=null&&g.push(rl(y,b,v)))),w)break;y=y.return}0<g.length&&(f=new m(f,p,null,n,h),d.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==rc&&(p=n.relatedTarget||n.fromElement)&&(Qr(p)||p[Wn]))break e;if((m||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?Qr(p):null,p!==null&&(w=us(p),p!==w||p.tag!==5&&p.tag!==6)&&(p=null)):(m=null,p=c),m!==p)){if(g=jf,b="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=kf,b="onPointerLeave",x="onPointerEnter",y="pointer"),w=m==null?f:Rs(m),v=p==null?f:Rs(p),f=new g(b,y+"leave",m,n,h),f.target=w,f.relatedTarget=v,b=null,Qr(h)===c&&(g=new g(x,y+"enter",p,n,h),g.target=v,g.relatedTarget=w,b=g),w=b,m&&p)t:{for(g=m,x=p,y=0,v=g;v;v=vs(v))y++;for(v=0,b=x;b;b=vs(b))v++;for(;0<y-v;)g=vs(g),y--;for(;0<v-y;)x=vs(x),v--;for(;y--;){if(g===x||x!==null&&g===x.alternate)break t;g=vs(g),x=vs(x)}g=null}else g=null;m!==null&&If(d,f,m,g,!1),p!==null&&w!==null&&If(d,w,p,g,!0)}}e:{if(f=c?Rs(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var E=c1;else if(Nf(f))if(qg)E=p1;else{E=h1;var k=d1}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=f1);if(E&&(E=E(e,c))){Qg(d,E,n,h);break e}k&&k(e,f,c),e==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&Xu(f,"number",f.value)}switch(k=c?Rs(c):window,e){case"focusin":(Nf(k)||k.contentEditable==="true")&&(Ts=k,cc=c,Oi=null);break;case"focusout":Oi=cc=Ts=null;break;case"mousedown":dc=!0;break;case"contextmenu":case"mouseup":case"dragend":dc=!1,Rf(d,n,h);break;case"selectionchange":if(x1)break;case"keydown":case"keyup":Rf(d,n,h)}var R;if(Id)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Es?Wg(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(Hg&&n.locale!=="ko"&&(Es||T!=="onCompositionStart"?T==="onCompositionEnd"&&Es&&(R=Bg()):(lr=h,Rd="value"in lr?lr.value:lr.textContent,Es=!0)),k=Da(c,T),0<k.length&&(T=new wf(T,e,null,n,h),d.push({event:T,listeners:k}),R?T.data=R:(R=Vg(n),R!==null&&(T.data=R)))),(R=i1?l1(e,n):a1(e,n))&&(c=Da(c,"onBeforeInput"),0<c.length&&(h=new wf("onBeforeInput","beforeinput",null,n,h),d.push({event:h,listeners:c}),h.data=R))}rx(d,t)})}function rl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Da(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,l=i.stateNode;i.tag===5&&l!==null&&(i=l,l=Yi(e,n),l!=null&&r.unshift(rl(e,l,i)),l=Yi(e,t),l!=null&&r.push(rl(e,l,i))),e=e.return}return r}function vs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function If(e,t,n,r,i){for(var l=t._reactName,a=[];n!==null&&n!==r;){var o=n,u=o.alternate,c=o.stateNode;if(u!==null&&u===r)break;o.tag===5&&c!==null&&(o=c,i?(u=Yi(n,l),u!=null&&a.unshift(rl(n,u,o))):i||(u=Yi(n,l),u!=null&&a.push(rl(n,u,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var w1=/\r\n?/g,k1=/\u0000|\uFFFD/g;function Df(e){return(typeof e=="string"?e:""+e).replace(w1,`
38
+ `).replace(k1,"")}function ql(e,t,n){if(t=Df(t),Df(e)!==t&&n)throw Error(K(425))}function Ma(){}var hc=null,fc=null;function pc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mc=typeof setTimeout=="function"?setTimeout:void 0,b1=typeof clearTimeout=="function"?clearTimeout:void 0,Mf=typeof Promise=="function"?Promise:void 0,S1=typeof queueMicrotask=="function"?queueMicrotask:typeof Mf<"u"?function(e){return Mf.resolve(null).then(e).catch(N1)}:mc;function N1(e){setTimeout(function(){throw e})}function au(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Zi(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Zi(t)}function fr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function zf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ii=Math.random().toString(36).slice(2),Tn="__reactFiber$"+ii,sl="__reactProps$"+ii,Wn="__reactContainer$"+ii,gc="__reactEvents$"+ii,C1="__reactListeners$"+ii,E1="__reactHandles$"+ii;function Qr(e){var t=e[Tn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wn]||n[Tn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=zf(e);e!==null;){if(n=e[Tn])return n;e=zf(e)}return t}e=n,n=e.parentNode}return null}function vl(e){return e=e[Tn]||e[Wn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Rs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(K(33))}function xo(e){return e[sl]||null}var xc=[],Ls=-1;function Cr(e){return{current:e}}function We(e){0>Ls||(e.current=xc[Ls],xc[Ls]=null,Ls--)}function Be(e,t){Ls++,xc[Ls]=e.current,e.current=t}var vr={},Et=Cr(vr),_t=Cr(!1),es=vr;function Qs(e,t){var n=e.type.contextTypes;if(!n)return vr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},l;for(l in n)i[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function $t(e){return e=e.childContextTypes,e!=null}function za(){We(_t),We(Et)}function _f(e,t,n){if(Et.current!==vr)throw Error(K(168));Be(Et,t),Be(_t,n)}function ix(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(K(108,dw(e)||"Unknown",i));return Ke({},n,r)}function _a(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vr,es=Et.current,Be(Et,e),Be(_t,_t.current),!0}function $f(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=ix(e,t,es),r.__reactInternalMemoizedMergedChildContext=e,We(_t),We(Et),Be(Et,e)):We(_t),Be(_t,n)}var $n=null,yo=!1,ou=!1;function lx(e){$n===null?$n=[e]:$n.push(e)}function T1(e){yo=!0,lx(e)}function Er(){if(!ou&&$n!==null){ou=!0;var e=0,t=Me;try{var n=$n;for(Me=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$n=null,yo=!1}catch(i){throw $n!==null&&($n=$n.slice(e+1)),Lg(Cd,Er),i}finally{Me=t,ou=!1}}return null}var As=[],Is=0,$a=null,Oa=0,tn=[],nn=0,ts=null,On=1,Fn="";function Ur(e,t){As[Is++]=Oa,As[Is++]=$a,$a=e,Oa=t}function ax(e,t,n){tn[nn++]=On,tn[nn++]=Fn,tn[nn++]=ts,ts=e;var r=On;e=Fn;var i=32-gn(r)-1;r&=~(1<<i),n+=1;var l=32-gn(t)+i;if(30<l){var a=i-i%5;l=(r&(1<<a)-1).toString(32),r>>=a,i-=a,On=1<<32-gn(t)+i|n<<i|r,Fn=l+e}else On=1<<l|n<<i|r,Fn=e}function Md(e){e.return!==null&&(Ur(e,1),ax(e,1,0))}function zd(e){for(;e===$a;)$a=As[--Is],As[Is]=null,Oa=As[--Is],As[Is]=null;for(;e===ts;)ts=tn[--nn],tn[nn]=null,Fn=tn[--nn],tn[nn]=null,On=tn[--nn],tn[nn]=null}var Gt=null,Qt=null,Qe=!1,mn=null;function ox(e,t){var n=sn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Of(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Gt=e,Qt=fr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Gt=e,Qt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ts!==null?{id:On,overflow:Fn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=sn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Gt=e,Qt=null,!0):!1;default:return!1}}function yc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function vc(e){if(Qe){var t=Qt;if(t){var n=t;if(!Of(e,t)){if(yc(e))throw Error(K(418));t=fr(n.nextSibling);var r=Gt;t&&Of(e,t)?ox(r,n):(e.flags=e.flags&-4097|2,Qe=!1,Gt=e)}}else{if(yc(e))throw Error(K(418));e.flags=e.flags&-4097|2,Qe=!1,Gt=e}}}function Ff(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Gt=e}function Gl(e){if(e!==Gt)return!1;if(!Qe)return Ff(e),Qe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!pc(e.type,e.memoizedProps)),t&&(t=Qt)){if(yc(e))throw ux(),Error(K(418));for(;t;)ox(e,t),t=fr(t.nextSibling)}if(Ff(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Qt=fr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Qt=null}}else Qt=Gt?fr(e.stateNode.nextSibling):null;return!0}function ux(){for(var e=Qt;e;)e=fr(e.nextSibling)}function qs(){Qt=Gt=null,Qe=!1}function _d(e){mn===null?mn=[e]:mn.push(e)}var P1=qn.ReactCurrentBatchConfig;function vi(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(K(309));var r=n.stateNode}if(!r)throw Error(K(147,e));var i=r,l=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===l?t.ref:(t=function(a){var o=i.refs;a===null?delete o[l]:o[l]=a},t._stringRef=l,t)}if(typeof e!="string")throw Error(K(284));if(!n._owner)throw Error(K(290,e))}return e}function Kl(e,t){throw e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Uf(e){var t=e._init;return t(e._payload)}function cx(e){function t(x,y){if(e){var v=x.deletions;v===null?(x.deletions=[y],x.flags|=16):v.push(y)}}function n(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function r(x,y){for(x=new Map;y!==null;)y.key!==null?x.set(y.key,y):x.set(y.index,y),y=y.sibling;return x}function i(x,y){return x=xr(x,y),x.index=0,x.sibling=null,x}function l(x,y,v){return x.index=v,e?(v=x.alternate,v!==null?(v=v.index,v<y?(x.flags|=2,y):v):(x.flags|=2,y)):(x.flags|=1048576,y)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function o(x,y,v,b){return y===null||y.tag!==6?(y=mu(v,x.mode,b),y.return=x,y):(y=i(y,v),y.return=x,y)}function u(x,y,v,b){var E=v.type;return E===Cs?h(x,y,v.props.children,b,v.key):y!==null&&(y.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===nr&&Uf(E)===y.type)?(b=i(y,v.props),b.ref=vi(x,y,v),b.return=x,b):(b=wa(v.type,v.key,v.props,null,x.mode,b),b.ref=vi(x,y,v),b.return=x,b)}function c(x,y,v,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=gu(v,x.mode,b),y.return=x,y):(y=i(y,v.children||[]),y.return=x,y)}function h(x,y,v,b,E){return y===null||y.tag!==7?(y=Xr(v,x.mode,b,E),y.return=x,y):(y=i(y,v),y.return=x,y)}function d(x,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return y=mu(""+y,x.mode,v),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case $l:return v=wa(y.type,y.key,y.props,null,x.mode,v),v.ref=vi(x,null,y),v.return=x,v;case Ns:return y=gu(y,x.mode,v),y.return=x,y;case nr:var b=y._init;return d(x,b(y._payload),v)}if(Li(y)||pi(y))return y=Xr(y,x.mode,v,null),y.return=x,y;Kl(x,y)}return null}function f(x,y,v,b){var E=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return E!==null?null:o(x,y,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case $l:return v.key===E?u(x,y,v,b):null;case Ns:return v.key===E?c(x,y,v,b):null;case nr:return E=v._init,f(x,y,E(v._payload),b)}if(Li(v)||pi(v))return E!==null?null:h(x,y,v,b,null);Kl(x,v)}return null}function m(x,y,v,b,E){if(typeof b=="string"&&b!==""||typeof b=="number")return x=x.get(v)||null,o(y,x,""+b,E);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case $l:return x=x.get(b.key===null?v:b.key)||null,u(y,x,b,E);case Ns:return x=x.get(b.key===null?v:b.key)||null,c(y,x,b,E);case nr:var k=b._init;return m(x,y,v,k(b._payload),E)}if(Li(b)||pi(b))return x=x.get(v)||null,h(y,x,b,E,null);Kl(y,b)}return null}function p(x,y,v,b){for(var E=null,k=null,R=y,T=y=0,D=null;R!==null&&T<v.length;T++){R.index>T?(D=R,R=null):D=R.sibling;var C=f(x,R,v[T],b);if(C===null){R===null&&(R=D);break}e&&R&&C.alternate===null&&t(x,R),y=l(C,y,T),k===null?E=C:k.sibling=C,k=C,R=D}if(T===v.length)return n(x,R),Qe&&Ur(x,T),E;if(R===null){for(;T<v.length;T++)R=d(x,v[T],b),R!==null&&(y=l(R,y,T),k===null?E=R:k.sibling=R,k=R);return Qe&&Ur(x,T),E}for(R=r(x,R);T<v.length;T++)D=m(R,x,T,v[T],b),D!==null&&(e&&D.alternate!==null&&R.delete(D.key===null?T:D.key),y=l(D,y,T),k===null?E=D:k.sibling=D,k=D);return e&&R.forEach(function(L){return t(x,L)}),Qe&&Ur(x,T),E}function g(x,y,v,b){var E=pi(v);if(typeof E!="function")throw Error(K(150));if(v=E.call(v),v==null)throw Error(K(151));for(var k=E=null,R=y,T=y=0,D=null,C=v.next();R!==null&&!C.done;T++,C=v.next()){R.index>T?(D=R,R=null):D=R.sibling;var L=f(x,R,C.value,b);if(L===null){R===null&&(R=D);break}e&&R&&L.alternate===null&&t(x,R),y=l(L,y,T),k===null?E=L:k.sibling=L,k=L,R=D}if(C.done)return n(x,R),Qe&&Ur(x,T),E;if(R===null){for(;!C.done;T++,C=v.next())C=d(x,C.value,b),C!==null&&(y=l(C,y,T),k===null?E=C:k.sibling=C,k=C);return Qe&&Ur(x,T),E}for(R=r(x,R);!C.done;T++,C=v.next())C=m(R,x,T,C.value,b),C!==null&&(e&&C.alternate!==null&&R.delete(C.key===null?T:C.key),y=l(C,y,T),k===null?E=C:k.sibling=C,k=C);return e&&R.forEach(function(A){return t(x,A)}),Qe&&Ur(x,T),E}function w(x,y,v,b){if(typeof v=="object"&&v!==null&&v.type===Cs&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case $l:e:{for(var E=v.key,k=y;k!==null;){if(k.key===E){if(E=v.type,E===Cs){if(k.tag===7){n(x,k.sibling),y=i(k,v.props.children),y.return=x,x=y;break e}}else if(k.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===nr&&Uf(E)===k.type){n(x,k.sibling),y=i(k,v.props),y.ref=vi(x,k,v),y.return=x,x=y;break e}n(x,k);break}else t(x,k);k=k.sibling}v.type===Cs?(y=Xr(v.props.children,x.mode,b,v.key),y.return=x,x=y):(b=wa(v.type,v.key,v.props,null,x.mode,b),b.ref=vi(x,y,v),b.return=x,x=b)}return a(x);case Ns:e:{for(k=v.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(x,y.sibling),y=i(y,v.children||[]),y.return=x,x=y;break e}else{n(x,y);break}else t(x,y);y=y.sibling}y=gu(v,x.mode,b),y.return=x,x=y}return a(x);case nr:return k=v._init,w(x,y,k(v._payload),b)}if(Li(v))return p(x,y,v,b);if(pi(v))return g(x,y,v,b);Kl(x,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(x,y.sibling),y=i(y,v),y.return=x,x=y):(n(x,y),y=mu(v,x.mode,b),y.return=x,x=y),a(x)):n(x,y)}return w}var Gs=cx(!0),dx=cx(!1),Fa=Cr(null),Ua=null,Ds=null,$d=null;function Od(){$d=Ds=Ua=null}function Fd(e){var t=Fa.current;We(Fa),e._currentValue=t}function jc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Bs(e,t){Ua=e,$d=Ds=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(zt=!0),e.firstContext=null)}function on(e){var t=e._currentValue;if($d!==e)if(e={context:e,memoizedValue:t,next:null},Ds===null){if(Ua===null)throw Error(K(308));Ds=e,Ua.dependencies={lanes:0,firstContext:e}}else Ds=Ds.next=e;return t}var qr=null;function Ud(e){qr===null?qr=[e]:qr.push(e)}function hx(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ud(t)):(n.next=i.next,i.next=n),t.interleaved=n,Vn(e,r)}function Vn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var rr=!1;function Bd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Un(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Re&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Vn(e,n)}return i=r.interleaved,i===null?(t.next=t,Ud(r)):(t.next=i.next,i.next=t),r.interleaved=t,Vn(e,n)}function ma(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ed(e,n)}}function Bf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?i=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?i=l=t:l=l.next=t}else i=l=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ba(e,t,n,r){var i=e.updateQueue;rr=!1;var l=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?l=c:a.next=c,a=u;var h=e.alternate;h!==null&&(h=h.updateQueue,o=h.lastBaseUpdate,o!==a&&(o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=u))}if(l!==null){var d=i.baseState;a=0,h=c=u=null,o=l;do{var f=o.lane,m=o.eventTime;if((r&f)===f){h!==null&&(h=h.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=e,g=o;switch(f=t,m=n,g.tag){case 1:if(p=g.payload,typeof p=="function"){d=p.call(m,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,f=typeof p=="function"?p.call(m,d,f):p,f==null)break e;d=Ke({},d,f);break e;case 2:rr=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[o]:f.push(o))}else m={eventTime:m,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},h===null?(c=h=m,u=d):h=h.next=m,a|=f;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;f=o,o=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(h===null&&(u=d),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=h,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else l===null&&(i.shared.lanes=0);rs|=a,e.lanes=a,e.memoizedState=d}}function Hf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(K(191,i));i.call(r)}}}var jl={},Ln=Cr(jl),il=Cr(jl),ll=Cr(jl);function Gr(e){if(e===jl)throw Error(K(174));return e}function Hd(e,t){switch(Be(ll,t),Be(il,e),Be(Ln,jl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ec(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ec(t,e)}We(Ln),Be(Ln,t)}function Ks(){We(Ln),We(il),We(ll)}function px(e){Gr(ll.current);var t=Gr(Ln.current),n=ec(t,e.type);t!==n&&(Be(il,e),Be(Ln,n))}function Wd(e){il.current===e&&(We(Ln),We(il))}var qe=Cr(0);function Ha(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var uu=[];function Vd(){for(var e=0;e<uu.length;e++)uu[e]._workInProgressVersionPrimary=null;uu.length=0}var ga=qn.ReactCurrentDispatcher,cu=qn.ReactCurrentBatchConfig,ns=0,Ge=null,lt=null,dt=null,Wa=!1,Fi=!1,al=0,R1=0;function St(){throw Error(K(321))}function Qd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jn(e[n],t[n]))return!1;return!0}function qd(e,t,n,r,i,l){if(ns=l,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ga.current=e===null||e.memoizedState===null?D1:M1,e=n(r,i),Fi){l=0;do{if(Fi=!1,al=0,25<=l)throw Error(K(301));l+=1,dt=lt=null,t.updateQueue=null,ga.current=z1,e=n(r,i)}while(Fi)}if(ga.current=Va,t=lt!==null&&lt.next!==null,ns=0,dt=lt=Ge=null,Wa=!1,t)throw Error(K(300));return e}function Gd(){var e=al!==0;return al=0,e}function Cn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ge.memoizedState=dt=e:dt=dt.next=e,dt}function un(){if(lt===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=lt.next;var t=dt===null?Ge.memoizedState:dt.next;if(t!==null)dt=t,lt=e;else{if(e===null)throw Error(K(310));lt=e,e={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},dt===null?Ge.memoizedState=dt=e:dt=dt.next=e}return dt}function ol(e,t){return typeof t=="function"?t(e):t}function du(e){var t=un(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=lt,i=r.baseQueue,l=n.pending;if(l!==null){if(i!==null){var a=i.next;i.next=l.next,l.next=a}r.baseQueue=i=l,n.pending=null}if(i!==null){l=i.next,r=r.baseState;var o=a=null,u=null,c=l;do{var h=c.lane;if((ns&h)===h)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=d,a=r):u=u.next=d,Ge.lanes|=h,rs|=h}c=c.next}while(c!==null&&c!==l);u===null?a=r:u.next=o,jn(r,t.memoizedState)||(zt=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do l=i.lane,Ge.lanes|=l,rs|=l,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function hu(e){var t=un(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,l=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do l=e(l,a.action),a=a.next;while(a!==i);jn(l,t.memoizedState)||(zt=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,r]}function mx(){}function gx(e,t){var n=Ge,r=un(),i=t(),l=!jn(r.memoizedState,i);if(l&&(r.memoizedState=i,zt=!0),r=r.queue,Kd(vx.bind(null,n,r,e),[e]),r.getSnapshot!==t||l||dt!==null&&dt.memoizedState.tag&1){if(n.flags|=2048,ul(9,yx.bind(null,n,r,i,t),void 0,null),ht===null)throw Error(K(349));ns&30||xx(n,t,i)}return i}function xx(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ge.updateQueue,t===null?(t={lastEffect:null,stores:null},Ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function yx(e,t,n,r){t.value=n,t.getSnapshot=r,jx(t)&&wx(e)}function vx(e,t,n){return n(function(){jx(t)&&wx(e)})}function jx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jn(e,n)}catch{return!0}}function wx(e){var t=Vn(e,1);t!==null&&xn(t,e,1,-1)}function Wf(e){var t=Cn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:e},t.queue=e,e=e.dispatch=I1.bind(null,Ge,e),[t.memoizedState,e]}function ul(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ge.updateQueue,t===null?(t={lastEffect:null,stores:null},Ge.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function kx(){return un().memoizedState}function xa(e,t,n,r){var i=Cn();Ge.flags|=e,i.memoizedState=ul(1|t,n,void 0,r===void 0?null:r)}function vo(e,t,n,r){var i=un();r=r===void 0?null:r;var l=void 0;if(lt!==null){var a=lt.memoizedState;if(l=a.destroy,r!==null&&Qd(r,a.deps)){i.memoizedState=ul(t,n,l,r);return}}Ge.flags|=e,i.memoizedState=ul(1|t,n,l,r)}function Vf(e,t){return xa(8390656,8,e,t)}function Kd(e,t){return vo(2048,8,e,t)}function bx(e,t){return vo(4,2,e,t)}function Sx(e,t){return vo(4,4,e,t)}function Nx(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Cx(e,t,n){return n=n!=null?n.concat([e]):null,vo(4,4,Nx.bind(null,t,e),n)}function Yd(){}function Ex(e,t){var n=un();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qd(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Tx(e,t){var n=un();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qd(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Px(e,t,n){return ns&21?(jn(n,t)||(n=Dg(),Ge.lanes|=n,rs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,zt=!0),e.memoizedState=n)}function L1(e,t){var n=Me;Me=n!==0&&4>n?n:4,e(!0);var r=cu.transition;cu.transition={};try{e(!1),t()}finally{Me=n,cu.transition=r}}function Rx(){return un().memoizedState}function A1(e,t,n){var r=gr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Lx(e))Ax(t,n);else if(n=hx(e,t,n,r),n!==null){var i=Pt();xn(n,e,r,i),Ix(n,t,r)}}function I1(e,t,n){var r=gr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Lx(e))Ax(t,i);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,o=l(a,n);if(i.hasEagerState=!0,i.eagerState=o,jn(o,a)){var u=t.interleaved;u===null?(i.next=i,Ud(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=hx(e,t,i,r),n!==null&&(i=Pt(),xn(n,e,r,i),Ix(n,t,r))}}function Lx(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Ax(e,t){Fi=Wa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ix(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ed(e,n)}}var Va={readContext:on,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useInsertionEffect:St,useLayoutEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useMutableSource:St,useSyncExternalStore:St,useId:St,unstable_isNewReconciler:!1},D1={readContext:on,useCallback:function(e,t){return Cn().memoizedState=[e,t===void 0?null:t],e},useContext:on,useEffect:Vf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xa(4194308,4,Nx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xa(4194308,4,e,t)},useInsertionEffect:function(e,t){return xa(4,2,e,t)},useMemo:function(e,t){var n=Cn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Cn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=A1.bind(null,Ge,e),[r.memoizedState,e]},useRef:function(e){var t=Cn();return e={current:e},t.memoizedState=e},useState:Wf,useDebugValue:Yd,useDeferredValue:function(e){return Cn().memoizedState=e},useTransition:function(){var e=Wf(!1),t=e[0];return e=L1.bind(null,e[1]),Cn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ge,i=Cn();if(Qe){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),ht===null)throw Error(K(349));ns&30||xx(r,t,n)}i.memoizedState=n;var l={value:n,getSnapshot:t};return i.queue=l,Vf(vx.bind(null,r,l,e),[e]),r.flags|=2048,ul(9,yx.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Cn(),t=ht.identifierPrefix;if(Qe){var n=Fn,r=On;n=(r&~(1<<32-gn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=al++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=R1++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},M1={readContext:on,useCallback:Ex,useContext:on,useEffect:Kd,useImperativeHandle:Cx,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:du,useRef:kx,useState:function(){return du(ol)},useDebugValue:Yd,useDeferredValue:function(e){var t=un();return Px(t,lt.memoizedState,e)},useTransition:function(){var e=du(ol)[0],t=un().memoizedState;return[e,t]},useMutableSource:mx,useSyncExternalStore:gx,useId:Rx,unstable_isNewReconciler:!1},z1={readContext:on,useCallback:Ex,useContext:on,useEffect:Kd,useImperativeHandle:Cx,useInsertionEffect:bx,useLayoutEffect:Sx,useMemo:Tx,useReducer:hu,useRef:kx,useState:function(){return hu(ol)},useDebugValue:Yd,useDeferredValue:function(e){var t=un();return lt===null?t.memoizedState=e:Px(t,lt.memoizedState,e)},useTransition:function(){var e=hu(ol)[0],t=un().memoizedState;return[e,t]},useMutableSource:mx,useSyncExternalStore:gx,useId:Rx,unstable_isNewReconciler:!1};function hn(e,t){if(e&&e.defaultProps){t=Ke({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function wc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ke({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var jo={isMounted:function(e){return(e=e._reactInternals)?us(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Pt(),i=gr(e),l=Un(r,i);l.payload=t,n!=null&&(l.callback=n),t=pr(e,l,i),t!==null&&(xn(t,e,i,r),ma(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Pt(),i=gr(e),l=Un(r,i);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=pr(e,l,i),t!==null&&(xn(t,e,i,r),ma(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pt(),r=gr(e),i=Un(n,r);i.tag=2,t!=null&&(i.callback=t),t=pr(e,i,r),t!==null&&(xn(t,e,r,n),ma(t,e,r))}};function Qf(e,t,n,r,i,l,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,l,a):t.prototype&&t.prototype.isPureReactComponent?!tl(n,r)||!tl(i,l):!0}function Dx(e,t,n){var r=!1,i=vr,l=t.contextType;return typeof l=="object"&&l!==null?l=on(l):(i=$t(t)?es:Et.current,r=t.contextTypes,l=(r=r!=null)?Qs(e,i):vr),t=new t(n,l),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=jo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=l),t}function qf(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&jo.enqueueReplaceState(t,t.state,null)}function kc(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Bd(e);var l=t.contextType;typeof l=="object"&&l!==null?i.context=on(l):(l=$t(t)?es:Et.current,i.context=Qs(e,l)),i.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(wc(e,t,l,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&jo.enqueueReplaceState(i,i.state,null),Ba(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Ys(e,t){try{var n="",r=t;do n+=cw(r),r=r.return;while(r);var i=n}catch(l){i=`
39
39
  Error generating stack: `+l.message+`
40
- `+l.stack}return{value:e,source:t,stack:i,digest:null}}function fu(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function bc(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var M1=typeof WeakMap=="function"?WeakMap:Map;function Mx(e,t,n){n=Un(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ga||(Ga=!0,Ic=r),bc(e,t)},n}function zx(e,t,n){n=Un(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){bc(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){bc(e,t),typeof r!="function"&&(mr===null?mr=new Set([this]):mr.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Gf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new M1;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=K1.bind(null,e,t,n),t.then(e,e))}function Kf(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Yf(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Un(-1,1),t.tag=2,pr(n,t,1))),n.lanes|=1),e)}var z1=qn.ReactCurrentOwner,Mt=!1;function Et(e,t,n,r){t.child=e===null?dx(t,null,n,r):Gs(t,e.child,n,r)}function Jf(e,t,n,r,i){n=n.render;var l=t.ref;return Bs(t,i),r=qd(e,t,n,r,l,i),n=Gd(),e!==null&&!Mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qn(e,t,i)):(Ve&&n&&Md(t),t.flags|=1,Et(e,t,r,i),t.child)}function Xf(e,t,n,r,i){if(e===null){var l=n.type;return typeof l=="function"&&!sh(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,_x(e,t,l,r,i)):(e=ka(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!(e.lanes&i)){var a=l.memoizedProps;if(n=n.compare,n=n!==null?n:nl,n(a,r)&&e.ref===t.ref)return Qn(e,t,i)}return t.flags|=1,e=xr(l,r),e.ref=t.ref,e.return=t,t.child=e}function _x(e,t,n,r,i){if(e!==null){var l=e.memoizedProps;if(nl(l,r)&&e.ref===t.ref)if(Mt=!1,t.pendingProps=r=l,(e.lanes&i)!==0)e.flags&131072&&(Mt=!0);else return t.lanes=e.lanes,Qn(e,t,i)}return Sc(e,t,n,r,i)}function $x(e,t,n){var r=t.pendingProps,i=r.children,l=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ue(zs,Ht),Ht|=n;else{if(!(n&1073741824))return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ue(zs,Ht),Ht|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,Ue(zs,Ht),Ht|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,Ue(zs,Ht),Ht|=r;return Et(e,t,i,n),t.child}function Ox(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Sc(e,t,n,r,i){var l=_t(n)?Zr:Ct.current;return l=Qs(t,l),Bs(t,i),n=qd(e,t,n,r,l,i),r=Gd(),e!==null&&!Mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qn(e,t,i)):(Ve&&r&&Md(t),t.flags|=1,Et(e,t,n,i),t.child)}function Zf(e,t,n,r,i){if(_t(n)){var l=!0;$a(t)}else l=!1;if(Bs(t,i),t.stateNode===null)va(e,t),Dx(t,n,r),kc(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=on(c):(c=_t(n)?Zr:Ct.current,c=Qs(t,c));var h=n.getDerivedStateFromProps,d=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==c)&&qf(t,a,r,c),rr=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),u=t.memoizedState,o!==r||f!==u||zt.current||rr?(typeof h=="function"&&(wc(t,n,h,r),u=t.memoizedState),(o=rr||Qf(t,n,o,r,f,u,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,fx(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:hn(t.type,o),a.props=c,d=t.pendingProps,f=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=on(u):(u=_t(n)?Zr:Ct.current,u=Qs(t,u));var m=n.getDerivedStateFromProps;(h=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||f!==u)&&qf(t,a,r,u),rr=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i);var p=t.memoizedState;o!==d||f!==p||zt.current||rr?(typeof m=="function"&&(wc(t,n,m,r),p=t.memoizedState),(c=rr||Qf(t,n,c,r,f,p,u)||!1)?(h||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,p,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,p,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Nc(e,t,n,r,l,i)}function Nc(e,t,n,r,i,l){Ox(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&$f(t,n,!1),Qn(e,t,l);r=t.stateNode,z1.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Gs(t,e.child,null,l),t.child=Gs(t,null,o,l)):Et(e,t,o,l),t.memoizedState=r.state,i&&$f(t,n,!0),t.child}function Fx(e){var t=e.stateNode;t.pendingContext?_f(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_f(e,t.context,!1),Hd(e,t.containerInfo)}function ep(e,t,n,r,i){return qs(),_d(i),t.flags|=256,Et(e,t,n,r),t.child}var Cc={dehydrated:null,treeContext:null,retryLane:0};function Ec(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ux(e,t,n){var r=t.pendingProps,i=Qe.current,l=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(i&2)!==0),o?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ue(Qe,i&1),e===null)return vc(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,l?(r=t.mode,l=t.child,a={mode:"hidden",children:a},!(r&1)&&l!==null?(l.childLanes=0,l.pendingProps=a):l=bo(a,r,0,null),e=Jr(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Ec(n),t.memoizedState=Cc,e):Jd(t,a));if(i=e.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return _1(e,t,a,r,o,i,n);if(l){l=r.fallback,a=t.mode,i=e.child,o=i.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=xr(i,u),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?l=xr(o,l):(l=Jr(l,a,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,r=l,l=t.child,a=e.child.memoizedState,a=a===null?Ec(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},l.memoizedState=a,l.childLanes=e.childLanes&~n,t.memoizedState=Cc,r}return l=e.child,e=l.sibling,r=xr(l,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Jd(e,t){return t=bo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jl(e,t,n,r){return r!==null&&_d(r),Gs(t,e.child,null,n),e=Jd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _1(e,t,n,r,i,l,a){if(n)return t.flags&256?(t.flags&=-257,r=fu(Error(K(422))),Jl(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,i=t.mode,r=bo({mode:"visible",children:r.children},i,0,null),l=Jr(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,t.mode&1&&Gs(t,e.child,null,a),t.child.memoizedState=Ec(a),t.memoizedState=Cc,l);if(!(t.mode&1))return Jl(e,t,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,l=Error(K(419)),r=fu(l,r,void 0),Jl(e,t,a,r)}if(o=(a&e.childLanes)!==0,Mt||o){if(r=ht,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==l.retryLane&&(l.retryLane=i,Vn(e,i),xn(r,e,i,-1))}return rh(),r=fu(Error(K(421))),Jl(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Y1.bind(null,e),i._reactRetry=t,null):(e=l.treeContext,Vt=fr(i.nextSibling),qt=t,Ve=!0,mn=null,e!==null&&(tn[nn++]=On,tn[nn++]=Fn,tn[nn++]=es,On=e.id,Fn=e.overflow,es=t),t=Jd(t,r.children),t.flags|=4096,t)}function tp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),jc(e.return,t,n)}function pu(e,t,n,r,i){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=r,l.tail=n,l.tailMode=i)}function Bx(e,t,n){var r=t.pendingProps,i=r.revealOrder,l=r.tail;if(Et(e,t,r.children,n),r=Qe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tp(e,n,t);else if(e.tag===19)tp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ue(Qe,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Wa(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),pu(t,!1,i,n,l);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Wa(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}pu(t,!0,n,null,l);break;case"together":pu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function va(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ns|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=xr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function $1(e,t,n){switch(t.tag){case 3:Fx(t),qs();break;case 5:px(t);break;case 1:_t(t.type)&&$a(t);break;case 4:Hd(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ue(Ua,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ue(Qe,Qe.current&1),t.flags|=128,null):n&t.child.childLanes?Ux(e,t,n):(Ue(Qe,Qe.current&1),e=Qn(e,t,n),e!==null?e.sibling:null);Ue(Qe,Qe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Bx(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ue(Qe,Qe.current),r)break;return null;case 22:case 23:return t.lanes=0,$x(e,t,n)}return Qn(e,t,n)}var Hx,Tc,Wx,Vx;Hx=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Tc=function(){};Wx=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,qr(An.current);var l=null;switch(n){case"input":i=Yu(e,i),r=Yu(e,r),l=[];break;case"select":i=Ge({},i,{value:void 0}),r=Ge({},r,{value:void 0}),l=[];break;case"textarea":i=Zu(e,i),r=Zu(e,r),l=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=za)}tc(n,r);var a;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var o=i[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ki.hasOwnProperty(c)?l||(l=[]):(l=l||[]).push(c,null));for(c in r){var u=r[c];if(o=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(l||(l=[]),l.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(l=l||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(l=l||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ki.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&Be("scroll",e),l||o===u||(l=[])):(l=l||[]).push(c,u))}n&&(l=l||[]).push("style",n);var c=l;(t.updateQueue=c)&&(t.flags|=4)}};Vx=function(e,t,n,r){n!==r&&(t.flags|=4)};function ji(e,t){if(!Ve)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function St(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function O1(e,t,n){var r=t.pendingProps;switch(zd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(t),null;case 1:return _t(t.type)&&_a(),St(t),null;case 3:return r=t.stateNode,Ks(),He(zt),He(Ct),Vd(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Kl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,mn!==null&&(zc(mn),mn=null))),Tc(e,t),St(t),null;case 5:Wd(t);var i=qr(al.current);if(n=t.type,e!==null&&t.stateNode!=null)Wx(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return St(t),null}if(e=qr(An.current),Kl(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Pn]=t,r[il]=l,e=(t.mode&1)!==0,n){case"dialog":Be("cancel",r),Be("close",r);break;case"iframe":case"object":case"embed":Be("load",r);break;case"video":case"audio":for(i=0;i<Ii.length;i++)Be(Ii[i],r);break;case"source":Be("error",r);break;case"img":case"image":case"link":Be("error",r),Be("load",r);break;case"details":Be("toggle",r);break;case"input":cf(r,l),Be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},Be("invalid",r);break;case"textarea":hf(r,l),Be("invalid",r)}tc(n,l),i=null;for(var a in l)if(l.hasOwnProperty(a)){var o=l[a];a==="children"?typeof o=="string"?r.textContent!==o&&(l.suppressHydrationWarning!==!0&&Gl(r.textContent,o,e),i=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(l.suppressHydrationWarning!==!0&&Gl(r.textContent,o,e),i=["children",""+o]):Ki.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&Be("scroll",r)}switch(n){case"input":Fl(r),df(r,l,!0);break;case"textarea":Fl(r),ff(r);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(r.onclick=za)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=vg(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Pn]=t,e[il]=r,Hx(e,t,!1,!1),t.stateNode=e;e:{switch(a=nc(n,r),n){case"dialog":Be("cancel",e),Be("close",e),i=r;break;case"iframe":case"object":case"embed":Be("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ii.length;i++)Be(Ii[i],e);i=r;break;case"source":Be("error",e),i=r;break;case"img":case"image":case"link":Be("error",e),Be("load",e),i=r;break;case"details":Be("toggle",e),i=r;break;case"input":cf(e,r),i=Yu(e,r),Be("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ge({},r,{value:void 0}),Be("invalid",e);break;case"textarea":hf(e,r),i=Zu(e,r),Be("invalid",e);break;default:i=r}tc(n,i),o=i;for(l in o)if(o.hasOwnProperty(l)){var u=o[l];l==="style"?kg(e,u):l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&jg(e,u)):l==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Yi(e,u):typeof u=="number"&&Yi(e,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Ki.hasOwnProperty(l)?u!=null&&l==="onScroll"&&Be("scroll",e):u!=null&&wd(e,l,u,a))}switch(n){case"input":Fl(e),df(e,r,!1);break;case"textarea":Fl(e),ff(e);break;case"option":r.value!=null&&e.setAttribute("value",""+yr(r.value));break;case"select":e.multiple=!!r.multiple,l=r.value,l!=null?$s(e,!!r.multiple,l,!1):r.defaultValue!=null&&$s(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=za)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return St(t),null;case 6:if(e&&t.stateNode!=null)Vx(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(n=qr(al.current),qr(An.current),Kl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Pn]=t,(l=r.nodeValue!==n)&&(e=qt,e!==null))switch(e.tag){case 3:Gl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gl(r.nodeValue,n,(e.mode&1)!==0)}l&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Pn]=t,t.stateNode=r}return St(t),null;case 13:if(He(Qe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ve&&Vt!==null&&t.mode&1&&!(t.flags&128))ux(),qs(),t.flags|=98560,l=!1;else if(l=Kl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!l)throw Error(K(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(K(317));l[Pn]=t}else qs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;St(t),l=!1}else mn!==null&&(zc(mn),mn=null),l=!0;if(!l)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Qe.current&1?at===0&&(at=3):rh())),t.updateQueue!==null&&(t.flags|=4),St(t),null);case 4:return Ks(),Tc(e,t),e===null&&rl(t.stateNode.containerInfo),St(t),null;case 10:return Fd(t.type._context),St(t),null;case 17:return _t(t.type)&&_a(),St(t),null;case 19:if(He(Qe),l=t.memoizedState,l===null)return St(t),null;if(r=(t.flags&128)!==0,a=l.rendering,a===null)if(r)ji(l,!1);else{if(at!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Wa(e),a!==null){for(t.flags|=128,ji(l,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)l=n,e=r,l.flags&=14680066,a=l.alternate,a===null?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=a.childLanes,l.lanes=a.lanes,l.child=a.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=a.memoizedProps,l.memoizedState=a.memoizedState,l.updateQueue=a.updateQueue,l.type=a.type,e=a.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ue(Qe,Qe.current&1|2),t.child}e=e.sibling}l.tail!==null&&tt()>Js&&(t.flags|=128,r=!0,ji(l,!1),t.lanes=4194304)}else{if(!r)if(e=Wa(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ji(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!Ve)return St(t),null}else 2*tt()-l.renderingStartTime>Js&&n!==1073741824&&(t.flags|=128,r=!0,ji(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(n=l.last,n!==null?n.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=tt(),t.sibling=null,n=Qe.current,Ue(Qe,r?n&1|2:n&1),t):(St(t),null);case 22:case 23:return nh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ht&1073741824&&(St(t),t.subtreeFlags&6&&(t.flags|=8192)):St(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function F1(e,t){switch(zd(t),t.tag){case 1:return _t(t.type)&&_a(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ks(),He(zt),He(Ct),Vd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Wd(t),null;case 13:if(He(Qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));qs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return He(Qe),null;case 4:return Ks(),null;case 10:return Fd(t.type._context),null;case 22:case 23:return nh(),null;case 24:return null;default:return null}}var Xl=!1,Nt=!1,U1=typeof WeakSet=="function"?WeakSet:Set,te=null;function Ms(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Xe(e,t,r)}else n.current=null}function Pc(e,t,n){try{n()}catch(r){Xe(e,t,r)}}var np=!1;function B1(e,t){if(hc=Ia,e=Yg(),Dd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,h=0,d=e,f=null;t:for(;;){for(var m;d!==n||i!==0&&d.nodeType!==3||(o=a+i),d!==l||r!==0&&d.nodeType!==3||(u=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++c===i&&(o=a),f===l&&++h===r&&(u=a),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(fc={focusedElem:e,selectionRange:n},Ia=!1,te=t;te!==null;)if(t=te,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,te=e;else for(;te!==null;){t=te;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,w=p.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:hn(t.type,g),w);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(b){Xe(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,te=e;break}te=t.return}return p=np,np=!1,p}function Ui(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var l=i.destroy;i.destroy=void 0,l!==void 0&&Pc(t,n,l)}i=i.next}while(i!==r)}}function wo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Rc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Qx(e){var t=e.alternate;t!==null&&(e.alternate=null,Qx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Pn],delete t[il],delete t[gc],delete t[S1],delete t[N1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qx(e){return e.tag===5||e.tag===3||e.tag===4}function rp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=za));else if(r!==4&&(e=e.child,e!==null))for(Lc(e,t,n),e=e.sibling;e!==null;)Lc(e,t,n),e=e.sibling}function Ac(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var xt=null,fn=!1;function Zn(e,t,n){for(n=n.child;n!==null;)Gx(e,t,n),n=n.sibling}function Gx(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(fo,n)}catch{}switch(n.tag){case 5:Nt||Ms(n,t);case 6:var r=xt,i=fn;xt=null,Zn(e,t,n),xt=r,fn=i,xt!==null&&(fn?(e=xt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xt.removeChild(n.stateNode));break;case 18:xt!==null&&(fn?(e=xt,n=n.stateNode,e.nodeType===8?au(e.parentNode,n):e.nodeType===1&&au(e,n),el(e)):au(xt,n.stateNode));break;case 4:r=xt,i=fn,xt=n.stateNode.containerInfo,fn=!0,Zn(e,t,n),xt=r,fn=i;break;case 0:case 11:case 14:case 15:if(!Nt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&Pc(n,t,a),i=i.next}while(i!==r)}Zn(e,t,n);break;case 1:if(!Nt&&(Ms(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Xe(n,t,o)}Zn(e,t,n);break;case 21:Zn(e,t,n);break;case 22:n.mode&1?(Nt=(r=Nt)||n.memoizedState!==null,Zn(e,t,n),Nt=r):Zn(e,t,n);break;default:Zn(e,t,n)}}function sp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new U1),t.forEach(function(r){var i=J1.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function dn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var l=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:xt=o.stateNode,fn=!1;break e;case 3:xt=o.stateNode.containerInfo,fn=!0;break e;case 4:xt=o.stateNode.containerInfo,fn=!0;break e}o=o.return}if(xt===null)throw Error(K(160));Gx(l,a,i),xt=null,fn=!1;var u=i.alternate;u!==null&&(u.return=null),i.return=null}catch(c){Xe(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Kx(t,e),t=t.sibling}function Kx(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(dn(t,e),Cn(e),r&4){try{Ui(3,e,e.return),wo(3,e)}catch(g){Xe(e,e.return,g)}try{Ui(5,e,e.return)}catch(g){Xe(e,e.return,g)}}break;case 1:dn(t,e),Cn(e),r&512&&n!==null&&Ms(n,n.return);break;case 5:if(dn(t,e),Cn(e),r&512&&n!==null&&Ms(n,n.return),e.flags&32){var i=e.stateNode;try{Yi(i,"")}catch(g){Xe(e,e.return,g)}}if(r&4&&(i=e.stateNode,i!=null)){var l=e.memoizedProps,a=n!==null?n.memoizedProps:l,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&l.type==="radio"&&l.name!=null&&xg(i,l),nc(o,a);var c=nc(o,l);for(a=0;a<u.length;a+=2){var h=u[a],d=u[a+1];h==="style"?kg(i,d):h==="dangerouslySetInnerHTML"?jg(i,d):h==="children"?Yi(i,d):wd(i,h,d,c)}switch(o){case"input":Ju(i,l);break;case"textarea":yg(i,l);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!l.multiple;var m=l.value;m!=null?$s(i,!!l.multiple,m,!1):f!==!!l.multiple&&(l.defaultValue!=null?$s(i,!!l.multiple,l.defaultValue,!0):$s(i,!!l.multiple,l.multiple?[]:"",!1))}i[il]=l}catch(g){Xe(e,e.return,g)}}break;case 6:if(dn(t,e),Cn(e),r&4){if(e.stateNode===null)throw Error(K(162));i=e.stateNode,l=e.memoizedProps;try{i.nodeValue=l}catch(g){Xe(e,e.return,g)}}break;case 3:if(dn(t,e),Cn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{el(t.containerInfo)}catch(g){Xe(e,e.return,g)}break;case 4:dn(t,e),Cn(e);break;case 13:dn(t,e),Cn(e),i=e.child,i.flags&8192&&(l=i.memoizedState!==null,i.stateNode.isHidden=l,!l||i.alternate!==null&&i.alternate.memoizedState!==null||(eh=tt())),r&4&&sp(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Nt=(c=Nt)||h,dn(t,e),Nt=c):dn(t,e),Cn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(te=e,h=e.child;h!==null;){for(d=te=h;te!==null;){switch(f=te,m=f.child,f.tag){case 0:case 11:case 14:case 15:Ui(4,f,f.return);break;case 1:Ms(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(g){Xe(r,n,g)}}break;case 5:Ms(f,f.return);break;case 22:if(f.memoizedState!==null){lp(d);continue}}m!==null?(m.return=f,te=m):lp(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{i=d.stateNode,c?(l=i.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(o=d.stateNode,u=d.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=wg("display",a))}catch(g){Xe(e,e.return,g)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(g){Xe(e,e.return,g)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:dn(t,e),Cn(e),r&4&&sp(e);break;case 21:break;default:dn(t,e),Cn(e)}}function Cn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(qx(n)){var r=n;break e}n=n.return}throw Error(K(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Yi(i,""),r.flags&=-33);var l=rp(e);Ac(e,l,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=rp(e);Lc(e,o,a);break;default:throw Error(K(161))}}catch(u){Xe(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function H1(e,t,n){te=e,Yx(e)}function Yx(e,t,n){for(var r=(e.mode&1)!==0;te!==null;){var i=te,l=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||Xl;if(!a){var o=i.alternate,u=o!==null&&o.memoizedState!==null||Nt;o=Xl;var c=Nt;if(Xl=a,(Nt=u)&&!c)for(te=i;te!==null;)a=te,u=a.child,a.tag===22&&a.memoizedState!==null?ap(i):u!==null?(u.return=a,te=u):ap(i);for(;l!==null;)te=l,Yx(l),l=l.sibling;te=i,Xl=o,Nt=c}ip(e)}else i.subtreeFlags&8772&&l!==null?(l.return=i,te=l):ip(e)}}function ip(e){for(;te!==null;){var t=te;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Nt||wo(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Nt)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:hn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&Hf(t,l,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Hf(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&el(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(K(163))}Nt||t.flags&512&&Rc(t)}catch(f){Xe(t,t.return,f)}}if(t===e){te=null;break}if(n=t.sibling,n!==null){n.return=t.return,te=n;break}te=t.return}}function lp(e){for(;te!==null;){var t=te;if(t===e){te=null;break}var n=t.sibling;if(n!==null){n.return=t.return,te=n;break}te=t.return}}function ap(e){for(;te!==null;){var t=te;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wo(4,t)}catch(u){Xe(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(u){Xe(t,i,u)}}var l=t.return;try{Rc(t)}catch(u){Xe(t,l,u)}break;case 5:var a=t.return;try{Rc(t)}catch(u){Xe(t,a,u)}}}catch(u){Xe(t,t.return,u)}if(t===e){te=null;break}var o=t.sibling;if(o!==null){o.return=t.return,te=o;break}te=t.return}}var W1=Math.ceil,qa=qn.ReactCurrentDispatcher,Xd=qn.ReactCurrentOwner,an=qn.ReactCurrentBatchConfig,Te=0,ht=null,it=null,jt=0,Ht=0,zs=Nr(0),at=0,dl=null,ns=0,ko=0,Zd=0,Bi=null,Dt=null,eh=0,Js=1/0,_n=null,Ga=!1,Ic=null,mr=null,Zl=!1,ar=null,Ka=0,Hi=0,Dc=null,ja=-1,wa=0;function Tt(){return Te&6?tt():ja!==-1?ja:ja=tt()}function gr(e){return e.mode&1?Te&2&&jt!==0?jt&-jt:E1.transition!==null?(wa===0&&(wa=Dg()),wa):(e=Ie,e!==0||(e=window.event,e=e===void 0?16:Ug(e.type)),e):1}function xn(e,t,n,r){if(50<Hi)throw Hi=0,Dc=null,Error(K(185));yl(e,n,r),(!(Te&2)||e!==ht)&&(e===ht&&(!(Te&2)&&(ko|=n),at===4&&ir(e,jt)),$t(e,r),n===1&&Te===0&&!(t.mode&1)&&(Js=tt()+500,yo&&Cr()))}function $t(e,t){var n=e.callbackNode;Ew(e,t);var r=Aa(e,e===ht?jt:0);if(r===0)n!==null&&gf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&gf(n),t===1)e.tag===0?C1(op.bind(null,e)):lx(op.bind(null,e)),k1(function(){!(Te&6)&&Cr()}),n=null;else{switch(Mg(r)){case 1:n=Cd;break;case 4:n=Ag;break;case 16:n=La;break;case 536870912:n=Ig;break;default:n=La}n=sy(n,Jx.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Jx(e,t){if(ja=-1,wa=0,Te&6)throw Error(K(327));var n=e.callbackNode;if(Hs()&&e.callbackNode!==n)return null;var r=Aa(e,e===ht?jt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ya(e,r);else{t=r;var i=Te;Te|=2;var l=Zx();(ht!==e||jt!==t)&&(_n=null,Js=tt()+500,Yr(e,t));do try{q1();break}catch(o){Xx(e,o)}while(!0);Od(),qa.current=l,Te=i,it!==null?t=0:(ht=null,jt=0,t=at)}if(t!==0){if(t===2&&(i=ac(e),i!==0&&(r=i,t=Mc(e,i))),t===1)throw n=dl,Yr(e,0),ir(e,r),$t(e,tt()),n;if(t===6)ir(e,r);else{if(i=e.current.alternate,!(r&30)&&!V1(i)&&(t=Ya(e,r),t===2&&(l=ac(e),l!==0&&(r=l,t=Mc(e,l))),t===1))throw n=dl,Yr(e,0),ir(e,r),$t(e,tt()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(K(345));case 2:Ur(e,Dt,_n);break;case 3:if(ir(e,r),(r&130023424)===r&&(t=eh+500-tt(),10<t)){if(Aa(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Tt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=mc(Ur.bind(null,e,Dt,_n),t);break}Ur(e,Dt,_n);break;case 4:if(ir(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-gn(r);l=1<<a,a=t[a],a>i&&(i=a),r&=~l}if(r=i,r=tt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*W1(r/1960))-r,10<r){e.timeoutHandle=mc(Ur.bind(null,e,Dt,_n),r);break}Ur(e,Dt,_n);break;case 5:Ur(e,Dt,_n);break;default:throw Error(K(329))}}}return $t(e,tt()),e.callbackNode===n?Jx.bind(null,e):null}function Mc(e,t){var n=Bi;return e.current.memoizedState.isDehydrated&&(Yr(e,t).flags|=256),e=Ya(e,t),e!==2&&(t=Dt,Dt=n,t!==null&&zc(t)),e}function zc(e){Dt===null?Dt=e:Dt.push.apply(Dt,e)}function V1(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],l=i.getSnapshot;i=i.value;try{if(!jn(l(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ir(e,t){for(t&=~Zd,t&=~ko,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-gn(t),r=1<<n;e[n]=-1,t&=~r}}function op(e){if(Te&6)throw Error(K(327));Hs();var t=Aa(e,0);if(!(t&1))return $t(e,tt()),null;var n=Ya(e,t);if(e.tag!==0&&n===2){var r=ac(e);r!==0&&(t=r,n=Mc(e,r))}if(n===1)throw n=dl,Yr(e,0),ir(e,t),$t(e,tt()),n;if(n===6)throw Error(K(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ur(e,Dt,_n),$t(e,tt()),null}function th(e,t){var n=Te;Te|=1;try{return e(t)}finally{Te=n,Te===0&&(Js=tt()+500,yo&&Cr())}}function rs(e){ar!==null&&ar.tag===0&&!(Te&6)&&Hs();var t=Te;Te|=1;var n=an.transition,r=Ie;try{if(an.transition=null,Ie=1,e)return e()}finally{Ie=r,an.transition=n,Te=t,!(Te&6)&&Cr()}}function nh(){Ht=zs.current,He(zs)}function Yr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,w1(n)),it!==null)for(n=it.return;n!==null;){var r=n;switch(zd(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&_a();break;case 3:Ks(),He(zt),He(Ct),Vd();break;case 5:Wd(r);break;case 4:Ks();break;case 13:He(Qe);break;case 19:He(Qe);break;case 10:Fd(r.type._context);break;case 22:case 23:nh()}n=n.return}if(ht=e,it=e=xr(e.current,null),jt=Ht=t,at=0,dl=null,Zd=ko=ns=0,Dt=Bi=null,Qr!==null){for(t=0;t<Qr.length;t++)if(n=Qr[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,l=n.pending;if(l!==null){var a=l.next;l.next=i,r.next=a}n.pending=r}Qr=null}return e}function Xx(e,t){do{var n=it;try{if(Od(),xa.current=Qa,Va){for(var r=qe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Va=!1}if(ts=0,ct=lt=qe=null,Fi=!1,ol=0,Xd.current=null,n===null||n.return===null){at=1,dl=t,it=null;break}e:{var l=e,a=n.return,o=n,u=t;if(t=jt,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,h=o,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var m=Kf(a);if(m!==null){m.flags&=-257,Yf(m,a,o,l,t),m.mode&1&&Gf(l,c,t),t=m,u=c;var p=t.updateQueue;if(p===null){var g=new Set;g.add(u),t.updateQueue=g}else p.add(u);break e}else{if(!(t&1)){Gf(l,c,t),rh();break e}u=Error(K(426))}}else if(Ve&&o.mode&1){var w=Kf(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Yf(w,a,o,l,t),_d(Ys(u,o));break e}}l=u=Ys(u,o),at!==4&&(at=2),Bi===null?Bi=[l]:Bi.push(l),l=a;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t;var x=Mx(l,u,t);Bf(l,x);break e;case 1:o=u;var y=l.type,v=l.stateNode;if(!(l.flags&128)&&(typeof y.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(mr===null||!mr.has(v)))){l.flags|=65536,t&=-t,l.lanes|=t;var b=zx(l,o,t);Bf(l,b);break e}}l=l.return}while(l!==null)}ty(n)}catch(E){t=E,it===n&&n!==null&&(it=n=n.return);continue}break}while(!0)}function Zx(){var e=qa.current;return qa.current=Qa,e===null?Qa:e}function rh(){(at===0||at===3||at===2)&&(at=4),ht===null||!(ns&268435455)&&!(ko&268435455)||ir(ht,jt)}function Ya(e,t){var n=Te;Te|=2;var r=Zx();(ht!==e||jt!==t)&&(_n=null,Yr(e,t));do try{Q1();break}catch(i){Xx(e,i)}while(!0);if(Od(),Te=n,qa.current=r,it!==null)throw Error(K(261));return ht=null,jt=0,at}function Q1(){for(;it!==null;)ey(it)}function q1(){for(;it!==null&&!yw();)ey(it)}function ey(e){var t=ry(e.alternate,e,Ht);e.memoizedProps=e.pendingProps,t===null?ty(e):it=t,Xd.current=null}function ty(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=F1(n,t),n!==null){n.flags&=32767,it=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{at=6,it=null;return}}else if(n=O1(n,t,Ht),n!==null){it=n;return}if(t=t.sibling,t!==null){it=t;return}it=t=e}while(t!==null);at===0&&(at=5)}function Ur(e,t,n){var r=Ie,i=an.transition;try{an.transition=null,Ie=1,G1(e,t,n,r)}finally{an.transition=i,Ie=r}return null}function G1(e,t,n,r){do Hs();while(ar!==null);if(Te&6)throw Error(K(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(K(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(Tw(e,l),e===ht&&(it=ht=null,jt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Zl||(Zl=!0,sy(La,function(){return Hs(),null})),l=(n.flags&15990)!==0,n.subtreeFlags&15990||l){l=an.transition,an.transition=null;var a=Ie;Ie=1;var o=Te;Te|=4,Xd.current=null,B1(e,n),Kx(n,e),p1(fc),Ia=!!hc,fc=hc=null,e.current=n,H1(n),vw(),Te=o,Ie=a,an.transition=l}else e.current=n;if(Zl&&(Zl=!1,ar=e,Ka=i),l=e.pendingLanes,l===0&&(mr=null),kw(n.stateNode),$t(e,tt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ga)throw Ga=!1,e=Ic,Ic=null,e;return Ka&1&&e.tag!==0&&Hs(),l=e.pendingLanes,l&1?e===Dc?Hi++:(Hi=0,Dc=e):Hi=0,Cr(),null}function Hs(){if(ar!==null){var e=Mg(Ka),t=an.transition,n=Ie;try{if(an.transition=null,Ie=16>e?16:e,ar===null)var r=!1;else{if(e=ar,ar=null,Ka=0,Te&6)throw Error(K(331));var i=Te;for(Te|=4,te=e.current;te!==null;){var l=te,a=l.child;if(te.flags&16){var o=l.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for(te=c;te!==null;){var h=te;switch(h.tag){case 0:case 11:case 15:Ui(8,h,l)}var d=h.child;if(d!==null)d.return=h,te=d;else for(;te!==null;){h=te;var f=h.sibling,m=h.return;if(Qx(h),h===c){te=null;break}if(f!==null){f.return=m,te=f;break}te=m}}}var p=l.alternate;if(p!==null){var g=p.child;if(g!==null){p.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}te=l}}if(l.subtreeFlags&2064&&a!==null)a.return=l,te=a;else e:for(;te!==null;){if(l=te,l.flags&2048)switch(l.tag){case 0:case 11:case 15:Ui(9,l,l.return)}var x=l.sibling;if(x!==null){x.return=l.return,te=x;break e}te=l.return}}var y=e.current;for(te=y;te!==null;){a=te;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,te=v;else e:for(a=y;te!==null;){if(o=te,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:wo(9,o)}}catch(E){Xe(o,o.return,E)}if(o===a){te=null;break e}var b=o.sibling;if(b!==null){b.return=o.return,te=b;break e}te=o.return}}if(Te=i,Cr(),Ln&&typeof Ln.onPostCommitFiberRoot=="function")try{Ln.onPostCommitFiberRoot(fo,e)}catch{}r=!0}return r}finally{Ie=n,an.transition=t}}return!1}function up(e,t,n){t=Ys(n,t),t=Mx(e,t,1),e=pr(e,t,1),t=Tt(),e!==null&&(yl(e,1,t),$t(e,t))}function Xe(e,t,n){if(e.tag===3)up(e,e,n);else for(;t!==null;){if(t.tag===3){up(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(mr===null||!mr.has(r))){e=Ys(n,e),e=zx(t,e,1),t=pr(t,e,1),e=Tt(),t!==null&&(yl(t,1,e),$t(t,e));break}}t=t.return}}function K1(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Tt(),e.pingedLanes|=e.suspendedLanes&n,ht===e&&(jt&n)===n&&(at===4||at===3&&(jt&130023424)===jt&&500>tt()-eh?Yr(e,0):Zd|=n),$t(e,t)}function ny(e,t){t===0&&(e.mode&1?(t=Hl,Hl<<=1,!(Hl&130023424)&&(Hl=4194304)):t=1);var n=Tt();e=Vn(e,t),e!==null&&(yl(e,t,n),$t(e,n))}function Y1(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ny(e,n)}function J1(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),ny(e,n)}var ry;ry=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||zt.current)Mt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Mt=!1,$1(e,t,n);Mt=!!(e.flags&131072)}else Mt=!1,Ve&&t.flags&1048576&&ax(t,Fa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;va(e,t),e=t.pendingProps;var i=Qs(t,Ct.current);Bs(t,n),i=qd(null,t,r,e,i,n);var l=Gd();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(r)?(l=!0,$a(t)):l=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Bd(t),i.updater=jo,t.stateNode=i,i._reactInternals=t,kc(t,r,e,n),t=Nc(null,t,r,!0,l,n)):(t.tag=0,Ve&&l&&Md(t),Et(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(va(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Z1(r),e=hn(r,e),i){case 0:t=Sc(null,t,r,e,n);break e;case 1:t=Zf(null,t,r,e,n);break e;case 11:t=Jf(null,t,r,e,n);break e;case 14:t=Xf(null,t,r,hn(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),Sc(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),Zf(e,t,r,i,n);case 3:e:{if(Fx(t),e===null)throw Error(K(387));r=t.pendingProps,l=t.memoizedState,i=l.element,fx(e,t),Ha(t,r,null,n);var a=t.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){i=Ys(Error(K(423)),t),t=ep(e,t,r,n,i);break e}else if(r!==i){i=Ys(Error(K(424)),t),t=ep(e,t,r,n,i);break e}else for(Vt=fr(t.stateNode.containerInfo.firstChild),qt=t,Ve=!0,mn=null,n=dx(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qs(),r===i){t=Qn(e,t,n);break e}Et(e,t,r,n)}t=t.child}return t;case 5:return px(t),e===null&&vc(t),r=t.type,i=t.pendingProps,l=e!==null?e.memoizedProps:null,a=i.children,pc(r,i)?a=null:l!==null&&pc(r,l)&&(t.flags|=32),Ox(e,t),Et(e,t,a,n),t.child;case 6:return e===null&&vc(t),null;case 13:return Ux(e,t,n);case 4:return Hd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gs(t,null,r,n):Et(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),Jf(e,t,r,i,n);case 7:return Et(e,t,t.pendingProps,n),t.child;case 8:return Et(e,t,t.pendingProps.children,n),t.child;case 12:return Et(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,l=t.memoizedProps,a=i.value,Ue(Ua,r._currentValue),r._currentValue=a,l!==null)if(jn(l.value,a)){if(l.children===i.children&&!zt.current){t=Qn(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){a=l.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(l.tag===1){u=Un(-1,n&-n),u.tag=2;var c=l.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),jc(l.return,n,t),o.lanes|=n;break}u=u.next}}else if(l.tag===10)a=l.type===t.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(K(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),jc(a,n,t),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===t){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}Et(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Bs(t,n),i=on(i),r=r(i),t.flags|=1,Et(e,t,r,n),t.child;case 14:return r=t.type,i=hn(r,t.pendingProps),i=hn(r.type,i),Xf(e,t,r,i,n);case 15:return _x(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),va(e,t),t.tag=1,_t(r)?(e=!0,$a(t)):e=!1,Bs(t,n),Dx(t,r,i),kc(t,r,i,n),Nc(null,t,r,!0,e,n);case 19:return Bx(e,t,n);case 22:return $x(e,t,n)}throw Error(K(156,t.tag))};function sy(e,t){return Lg(e,t)}function X1(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(e,t,n,r){return new X1(e,t,n,r)}function sh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Z1(e){if(typeof e=="function")return sh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===bd)return 11;if(e===Sd)return 14}return 2}function xr(e,t){var n=e.alternate;return n===null?(n=sn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ka(e,t,n,r,i,l){var a=2;if(r=e,typeof e=="function")sh(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Cs:return Jr(n.children,i,l,t);case kd:a=8,i|=8;break;case Qu:return e=sn(12,n,t,i|2),e.elementType=Qu,e.lanes=l,e;case qu:return e=sn(13,n,t,i),e.elementType=qu,e.lanes=l,e;case Gu:return e=sn(19,n,t,i),e.elementType=Gu,e.lanes=l,e;case pg:return bo(n,i,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hg:a=10;break e;case fg:a=9;break e;case bd:a=11;break e;case Sd:a=14;break e;case nr:a=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=sn(a,n,t,i),t.elementType=e,t.type=r,t.lanes=l,t}function Jr(e,t,n,r){return e=sn(7,e,r,t),e.lanes=n,e}function bo(e,t,n,r){return e=sn(22,e,r,t),e.elementType=pg,e.lanes=n,e.stateNode={isHidden:!1},e}function mu(e,t,n){return e=sn(6,e,null,t),e.lanes=n,e}function gu(e,t,n){return t=sn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ek(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yo(0),this.expirationTimes=Yo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ih(e,t,n,r,i,l,a,o,u){return e=new ek(e,t,n,o,u),t===1?(t=1,l===!0&&(t|=8)):t=0,l=sn(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bd(l),e}function tk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ns,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function iy(e){if(!e)return vr;e=e._reactInternals;e:{if(os(e)!==e||e.tag!==1)throw Error(K(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(_t(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(K(171))}if(e.tag===1){var n=e.type;if(_t(n))return ix(e,n,t)}return t}function ly(e,t,n,r,i,l,a,o,u){return e=ih(n,r,!0,e,i,l,a,o,u),e.context=iy(null),n=e.current,r=Tt(),i=gr(n),l=Un(r,i),l.callback=t??null,pr(n,l,i),e.current.lanes=i,yl(e,i,r),$t(e,r),e}function So(e,t,n,r){var i=t.current,l=Tt(),a=gr(i);return n=iy(n),t.context===null?t.context=n:t.pendingContext=n,t=Un(l,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=pr(i,t,a),e!==null&&(xn(e,i,a,l),ga(e,i,a)),a}function Ja(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lh(e,t){cp(e,t),(e=e.alternate)&&cp(e,t)}function nk(){return null}var ay=typeof reportError=="function"?reportError:function(e){console.error(e)};function ah(e){this._internalRoot=e}No.prototype.render=ah.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));So(e,t,null,null)};No.prototype.unmount=ah.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rs(function(){So(null,e,null,null)}),t[Wn]=null}};function No(e){this._internalRoot=e}No.prototype.unstable_scheduleHydration=function(e){if(e){var t=$g();e={blockedOn:null,target:e,priority:t};for(var n=0;n<sr.length&&t!==0&&t<sr[n].priority;n++);sr.splice(n,0,e),n===0&&Fg(e)}};function oh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Co(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dp(){}function rk(e,t,n,r,i){if(i){if(typeof r=="function"){var l=r;r=function(){var c=Ja(a);l.call(c)}}var a=ly(t,r,e,0,null,!1,!1,"",dp);return e._reactRootContainer=a,e[Wn]=a.current,rl(e.nodeType===8?e.parentNode:e),rs(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var c=Ja(u);o.call(c)}}var u=ih(e,0,!1,null,null,!1,!1,"",dp);return e._reactRootContainer=u,e[Wn]=u.current,rl(e.nodeType===8?e.parentNode:e),rs(function(){So(t,u,n,r)}),u}function Eo(e,t,n,r,i){var l=n._reactRootContainer;if(l){var a=l;if(typeof i=="function"){var o=i;i=function(){var u=Ja(a);o.call(u)}}So(t,a,e,i)}else a=rk(n,t,e,i,r);return Ja(a)}zg=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ai(t.pendingLanes);n!==0&&(Ed(t,n|1),$t(t,tt()),!(Te&6)&&(Js=tt()+500,Cr()))}break;case 13:rs(function(){var r=Vn(e,1);if(r!==null){var i=Tt();xn(r,e,1,i)}}),lh(e,1)}};Td=function(e){if(e.tag===13){var t=Vn(e,134217728);if(t!==null){var n=Tt();xn(t,e,134217728,n)}lh(e,134217728)}};_g=function(e){if(e.tag===13){var t=gr(e),n=Vn(e,t);if(n!==null){var r=Tt();xn(n,e,t,r)}lh(e,t)}};$g=function(){return Ie};Og=function(e,t){var n=Ie;try{return Ie=e,t()}finally{Ie=n}};sc=function(e,t,n){switch(t){case"input":if(Ju(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=xo(r);if(!i)throw Error(K(90));gg(r),Ju(r,i)}}}break;case"textarea":yg(e,n);break;case"select":t=n.value,t!=null&&$s(e,!!n.multiple,t,!1)}};Ng=th;Cg=rs;var sk={usingClientEntryPoint:!1,Events:[jl,Rs,xo,bg,Sg,th]},wi={findFiberByHostInstance:Vr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ik={bundleType:wi.bundleType,version:wi.version,rendererPackageName:wi.rendererPackageName,rendererConfig:wi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:qn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Pg(e),e===null?null:e.stateNode},findFiberByHostInstance:wi.findFiberByHostInstance||nk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ea=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ea.isDisabled&&ea.supportsFiber)try{fo=ea.inject(ik),Ln=ea}catch{}}Yt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sk;Yt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!oh(t))throw Error(K(200));return tk(e,t,null,n)};Yt.createRoot=function(e,t){if(!oh(e))throw Error(K(299));var n=!1,r="",i=ay;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=ih(e,1,!1,null,null,n,!1,r,i),e[Wn]=t.current,rl(e.nodeType===8?e.parentNode:e),new ah(t)};Yt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=Pg(t),e=e===null?null:e.stateNode,e};Yt.flushSync=function(e){return rs(e)};Yt.hydrate=function(e,t,n){if(!Co(t))throw Error(K(200));return Eo(null,e,t,!0,n)};Yt.hydrateRoot=function(e,t,n){if(!oh(e))throw Error(K(405));var r=n!=null&&n.hydratedSources||null,i=!1,l="",a=ay;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=ly(t,null,e,1,n??null,i,!1,l,a),e[Wn]=t.current,rl(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new No(t)};Yt.render=function(e,t,n){if(!Co(t))throw Error(K(200));return Eo(null,e,t,!1,n)};Yt.unmountComponentAtNode=function(e){if(!Co(e))throw Error(K(40));return e._reactRootContainer?(rs(function(){Eo(null,null,e,!1,function(){e._reactRootContainer=null,e[Wn]=null})}),!0):!1};Yt.unstable_batchedUpdates=th;Yt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Co(n))throw Error(K(200));if(e==null||e._reactInternals===void 0)throw Error(K(38));return Eo(e,t,n,!1,r)};Yt.version="18.3.1-next-f1338f8080-20240426";function oy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oy)}catch(e){console.error(e)}}oy(),og.exports=Yt;var Er=og.exports;const lk=pd(Er),ak=Ym({__proto__:null,default:lk},[Er]);var uy,hp=Er;uy=hp.createRoot,hp.hydrateRoot;/**
40
+ `+l.stack}return{value:e,source:t,stack:i,digest:null}}function fu(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function bc(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var _1=typeof WeakMap=="function"?WeakMap:Map;function Mx(e,t,n){n=Un(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){qa||(qa=!0,Ic=r),bc(e,t)},n}function zx(e,t,n){n=Un(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){bc(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){bc(e,t),typeof r!="function"&&(mr===null?mr=new Set([this]):mr.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Gf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new _1;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=J1.bind(null,e,t,n),t.then(e,e))}function Kf(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Yf(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Un(-1,1),t.tag=2,pr(n,t,1))),n.lanes|=1),e)}var $1=qn.ReactCurrentOwner,zt=!1;function Tt(e,t,n,r){t.child=e===null?dx(t,null,n,r):Gs(t,e.child,n,r)}function Jf(e,t,n,r,i){n=n.render;var l=t.ref;return Bs(t,i),r=qd(e,t,n,r,l,i),n=Gd(),e!==null&&!zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qn(e,t,i)):(Qe&&n&&Md(t),t.flags|=1,Tt(e,t,r,i),t.child)}function Xf(e,t,n,r,i){if(e===null){var l=n.type;return typeof l=="function"&&!sh(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,_x(e,t,l,r,i)):(e=wa(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!(e.lanes&i)){var a=l.memoizedProps;if(n=n.compare,n=n!==null?n:tl,n(a,r)&&e.ref===t.ref)return Qn(e,t,i)}return t.flags|=1,e=xr(l,r),e.ref=t.ref,e.return=t,t.child=e}function _x(e,t,n,r,i){if(e!==null){var l=e.memoizedProps;if(tl(l,r)&&e.ref===t.ref)if(zt=!1,t.pendingProps=r=l,(e.lanes&i)!==0)e.flags&131072&&(zt=!0);else return t.lanes=e.lanes,Qn(e,t,i)}return Sc(e,t,n,r,i)}function $x(e,t,n){var r=t.pendingProps,i=r.children,l=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Be(zs,Wt),Wt|=n;else{if(!(n&1073741824))return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Be(zs,Wt),Wt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,Be(zs,Wt),Wt|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,Be(zs,Wt),Wt|=r;return Tt(e,t,i,n),t.child}function Ox(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Sc(e,t,n,r,i){var l=$t(n)?es:Et.current;return l=Qs(t,l),Bs(t,i),n=qd(e,t,n,r,l,i),r=Gd(),e!==null&&!zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qn(e,t,i)):(Qe&&r&&Md(t),t.flags|=1,Tt(e,t,n,i),t.child)}function Zf(e,t,n,r,i){if($t(n)){var l=!0;_a(t)}else l=!1;if(Bs(t,i),t.stateNode===null)ya(e,t),Dx(t,n,r),kc(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=on(c):(c=$t(n)?es:Et.current,c=Qs(t,c));var h=n.getDerivedStateFromProps,d=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==c)&&qf(t,a,r,c),rr=!1;var f=t.memoizedState;a.state=f,Ba(t,r,a,i),u=t.memoizedState,o!==r||f!==u||_t.current||rr?(typeof h=="function"&&(wc(t,n,h,r),u=t.memoizedState),(o=rr||Qf(t,n,o,r,f,u,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,fx(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:hn(t.type,o),a.props=c,d=t.pendingProps,f=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=on(u):(u=$t(n)?es:Et.current,u=Qs(t,u));var m=n.getDerivedStateFromProps;(h=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||f!==u)&&qf(t,a,r,u),rr=!1,f=t.memoizedState,a.state=f,Ba(t,r,a,i);var p=t.memoizedState;o!==d||f!==p||_t.current||rr?(typeof m=="function"&&(wc(t,n,m,r),p=t.memoizedState),(c=rr||Qf(t,n,c,r,f,p,u)||!1)?(h||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,p,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,p,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Nc(e,t,n,r,l,i)}function Nc(e,t,n,r,i,l){Ox(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&$f(t,n,!1),Qn(e,t,l);r=t.stateNode,$1.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Gs(t,e.child,null,l),t.child=Gs(t,null,o,l)):Tt(e,t,o,l),t.memoizedState=r.state,i&&$f(t,n,!0),t.child}function Fx(e){var t=e.stateNode;t.pendingContext?_f(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_f(e,t.context,!1),Hd(e,t.containerInfo)}function ep(e,t,n,r,i){return qs(),_d(i),t.flags|=256,Tt(e,t,n,r),t.child}var Cc={dehydrated:null,treeContext:null,retryLane:0};function Ec(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ux(e,t,n){var r=t.pendingProps,i=qe.current,l=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(i&2)!==0),o?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Be(qe,i&1),e===null)return vc(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,l?(r=t.mode,l=t.child,a={mode:"hidden",children:a},!(r&1)&&l!==null?(l.childLanes=0,l.pendingProps=a):l=bo(a,r,0,null),e=Xr(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Ec(n),t.memoizedState=Cc,e):Jd(t,a));if(i=e.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return O1(e,t,a,r,o,i,n);if(l){l=r.fallback,a=t.mode,i=e.child,o=i.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=xr(i,u),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?l=xr(o,l):(l=Xr(l,a,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,r=l,l=t.child,a=e.child.memoizedState,a=a===null?Ec(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},l.memoizedState=a,l.childLanes=e.childLanes&~n,t.memoizedState=Cc,r}return l=e.child,e=l.sibling,r=xr(l,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Jd(e,t){return t=bo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Yl(e,t,n,r){return r!==null&&_d(r),Gs(t,e.child,null,n),e=Jd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function O1(e,t,n,r,i,l,a){if(n)return t.flags&256?(t.flags&=-257,r=fu(Error(K(422))),Yl(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,i=t.mode,r=bo({mode:"visible",children:r.children},i,0,null),l=Xr(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,t.mode&1&&Gs(t,e.child,null,a),t.child.memoizedState=Ec(a),t.memoizedState=Cc,l);if(!(t.mode&1))return Yl(e,t,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,l=Error(K(419)),r=fu(l,r,void 0),Yl(e,t,a,r)}if(o=(a&e.childLanes)!==0,zt||o){if(r=ht,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==l.retryLane&&(l.retryLane=i,Vn(e,i),xn(r,e,i,-1))}return rh(),r=fu(Error(K(421))),Yl(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=X1.bind(null,e),i._reactRetry=t,null):(e=l.treeContext,Qt=fr(i.nextSibling),Gt=t,Qe=!0,mn=null,e!==null&&(tn[nn++]=On,tn[nn++]=Fn,tn[nn++]=ts,On=e.id,Fn=e.overflow,ts=t),t=Jd(t,r.children),t.flags|=4096,t)}function tp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),jc(e.return,t,n)}function pu(e,t,n,r,i){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=r,l.tail=n,l.tailMode=i)}function Bx(e,t,n){var r=t.pendingProps,i=r.revealOrder,l=r.tail;if(Tt(e,t,r.children,n),r=qe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tp(e,n,t);else if(e.tag===19)tp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Be(qe,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Ha(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),pu(t,!1,i,n,l);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ha(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}pu(t,!0,n,null,l);break;case"together":pu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ya(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=xr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function F1(e,t,n){switch(t.tag){case 3:Fx(t),qs();break;case 5:px(t);break;case 1:$t(t.type)&&_a(t);break;case 4:Hd(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Be(Fa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Be(qe,qe.current&1),t.flags|=128,null):n&t.child.childLanes?Ux(e,t,n):(Be(qe,qe.current&1),e=Qn(e,t,n),e!==null?e.sibling:null);Be(qe,qe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Bx(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Be(qe,qe.current),r)break;return null;case 22:case 23:return t.lanes=0,$x(e,t,n)}return Qn(e,t,n)}var Hx,Tc,Wx,Vx;Hx=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Tc=function(){};Wx=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Gr(Ln.current);var l=null;switch(n){case"input":i=Yu(e,i),r=Yu(e,r),l=[];break;case"select":i=Ke({},i,{value:void 0}),r=Ke({},r,{value:void 0}),l=[];break;case"textarea":i=Zu(e,i),r=Zu(e,r),l=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ma)}tc(n,r);var a;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var o=i[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Gi.hasOwnProperty(c)?l||(l=[]):(l=l||[]).push(c,null));for(c in r){var u=r[c];if(o=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(l||(l=[]),l.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(l=l||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(l=l||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Gi.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&He("scroll",e),l||o===u||(l=[])):(l=l||[]).push(c,u))}n&&(l=l||[]).push("style",n);var c=l;(t.updateQueue=c)&&(t.flags|=4)}};Vx=function(e,t,n,r){n!==r&&(t.flags|=4)};function ji(e,t){if(!Qe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Nt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function U1(e,t,n){var r=t.pendingProps;switch(zd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nt(t),null;case 1:return $t(t.type)&&za(),Nt(t),null;case 3:return r=t.stateNode,Ks(),We(_t),We(Et),Vd(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Gl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,mn!==null&&(zc(mn),mn=null))),Tc(e,t),Nt(t),null;case 5:Wd(t);var i=Gr(ll.current);if(n=t.type,e!==null&&t.stateNode!=null)Wx(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return Nt(t),null}if(e=Gr(Ln.current),Gl(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Tn]=t,r[sl]=l,e=(t.mode&1)!==0,n){case"dialog":He("cancel",r),He("close",r);break;case"iframe":case"object":case"embed":He("load",r);break;case"video":case"audio":for(i=0;i<Ii.length;i++)He(Ii[i],r);break;case"source":He("error",r);break;case"img":case"image":case"link":He("error",r),He("load",r);break;case"details":He("toggle",r);break;case"input":cf(r,l),He("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},He("invalid",r);break;case"textarea":hf(r,l),He("invalid",r)}tc(n,l),i=null;for(var a in l)if(l.hasOwnProperty(a)){var o=l[a];a==="children"?typeof o=="string"?r.textContent!==o&&(l.suppressHydrationWarning!==!0&&ql(r.textContent,o,e),i=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(l.suppressHydrationWarning!==!0&&ql(r.textContent,o,e),i=["children",""+o]):Gi.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&He("scroll",r)}switch(n){case"input":Ol(r),df(r,l,!0);break;case"textarea":Ol(r),ff(r);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(r.onclick=Ma)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=vg(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Tn]=t,e[sl]=r,Hx(e,t,!1,!1),t.stateNode=e;e:{switch(a=nc(n,r),n){case"dialog":He("cancel",e),He("close",e),i=r;break;case"iframe":case"object":case"embed":He("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ii.length;i++)He(Ii[i],e);i=r;break;case"source":He("error",e),i=r;break;case"img":case"image":case"link":He("error",e),He("load",e),i=r;break;case"details":He("toggle",e),i=r;break;case"input":cf(e,r),i=Yu(e,r),He("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ke({},r,{value:void 0}),He("invalid",e);break;case"textarea":hf(e,r),i=Zu(e,r),He("invalid",e);break;default:i=r}tc(n,i),o=i;for(l in o)if(o.hasOwnProperty(l)){var u=o[l];l==="style"?kg(e,u):l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&jg(e,u)):l==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Ki(e,u):typeof u=="number"&&Ki(e,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Gi.hasOwnProperty(l)?u!=null&&l==="onScroll"&&He("scroll",e):u!=null&&wd(e,l,u,a))}switch(n){case"input":Ol(e),df(e,r,!1);break;case"textarea":Ol(e),ff(e);break;case"option":r.value!=null&&e.setAttribute("value",""+yr(r.value));break;case"select":e.multiple=!!r.multiple,l=r.value,l!=null?$s(e,!!r.multiple,l,!1):r.defaultValue!=null&&$s(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Ma)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Nt(t),null;case 6:if(e&&t.stateNode!=null)Vx(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(n=Gr(ll.current),Gr(Ln.current),Gl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Tn]=t,(l=r.nodeValue!==n)&&(e=Gt,e!==null))switch(e.tag){case 3:ql(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ql(r.nodeValue,n,(e.mode&1)!==0)}l&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Tn]=t,t.stateNode=r}return Nt(t),null;case 13:if(We(qe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Qe&&Qt!==null&&t.mode&1&&!(t.flags&128))ux(),qs(),t.flags|=98560,l=!1;else if(l=Gl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!l)throw Error(K(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(K(317));l[Tn]=t}else qs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nt(t),l=!1}else mn!==null&&(zc(mn),mn=null),l=!0;if(!l)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||qe.current&1?at===0&&(at=3):rh())),t.updateQueue!==null&&(t.flags|=4),Nt(t),null);case 4:return Ks(),Tc(e,t),e===null&&nl(t.stateNode.containerInfo),Nt(t),null;case 10:return Fd(t.type._context),Nt(t),null;case 17:return $t(t.type)&&za(),Nt(t),null;case 19:if(We(qe),l=t.memoizedState,l===null)return Nt(t),null;if(r=(t.flags&128)!==0,a=l.rendering,a===null)if(r)ji(l,!1);else{if(at!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ha(e),a!==null){for(t.flags|=128,ji(l,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)l=n,e=r,l.flags&=14680066,a=l.alternate,a===null?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=a.childLanes,l.lanes=a.lanes,l.child=a.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=a.memoizedProps,l.memoizedState=a.memoizedState,l.updateQueue=a.updateQueue,l.type=a.type,e=a.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Be(qe,qe.current&1|2),t.child}e=e.sibling}l.tail!==null&&et()>Js&&(t.flags|=128,r=!0,ji(l,!1),t.lanes=4194304)}else{if(!r)if(e=Ha(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ji(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!Qe)return Nt(t),null}else 2*et()-l.renderingStartTime>Js&&n!==1073741824&&(t.flags|=128,r=!0,ji(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(n=l.last,n!==null?n.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=et(),t.sibling=null,n=qe.current,Be(qe,r?n&1|2:n&1),t):(Nt(t),null);case 22:case 23:return nh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Wt&1073741824&&(Nt(t),t.subtreeFlags&6&&(t.flags|=8192)):Nt(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function B1(e,t){switch(zd(t),t.tag){case 1:return $t(t.type)&&za(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ks(),We(_t),We(Et),Vd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Wd(t),null;case 13:if(We(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));qs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return We(qe),null;case 4:return Ks(),null;case 10:return Fd(t.type._context),null;case 22:case 23:return nh(),null;case 24:return null;default:return null}}var Jl=!1,Ct=!1,H1=typeof WeakSet=="function"?WeakSet:Set,te=null;function Ms(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Xe(e,t,r)}else n.current=null}function Pc(e,t,n){try{n()}catch(r){Xe(e,t,r)}}var np=!1;function W1(e,t){if(hc=Aa,e=Yg(),Dd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,h=0,d=e,f=null;t:for(;;){for(var m;d!==n||i!==0&&d.nodeType!==3||(o=a+i),d!==l||r!==0&&d.nodeType!==3||(u=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++c===i&&(o=a),f===l&&++h===r&&(u=a),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(fc={focusedElem:e,selectionRange:n},Aa=!1,te=t;te!==null;)if(t=te,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,te=e;else for(;te!==null;){t=te;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,w=p.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:hn(t.type,g),w);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(b){Xe(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,te=e;break}te=t.return}return p=np,np=!1,p}function Ui(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var l=i.destroy;i.destroy=void 0,l!==void 0&&Pc(t,n,l)}i=i.next}while(i!==r)}}function wo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Rc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Qx(e){var t=e.alternate;t!==null&&(e.alternate=null,Qx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tn],delete t[sl],delete t[gc],delete t[C1],delete t[E1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qx(e){return e.tag===5||e.tag===3||e.tag===4}function rp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ma));else if(r!==4&&(e=e.child,e!==null))for(Lc(e,t,n),e=e.sibling;e!==null;)Lc(e,t,n),e=e.sibling}function Ac(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var xt=null,fn=!1;function Zn(e,t,n){for(n=n.child;n!==null;)Gx(e,t,n),n=n.sibling}function Gx(e,t,n){if(Rn&&typeof Rn.onCommitFiberUnmount=="function")try{Rn.onCommitFiberUnmount(fo,n)}catch{}switch(n.tag){case 5:Ct||Ms(n,t);case 6:var r=xt,i=fn;xt=null,Zn(e,t,n),xt=r,fn=i,xt!==null&&(fn?(e=xt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xt.removeChild(n.stateNode));break;case 18:xt!==null&&(fn?(e=xt,n=n.stateNode,e.nodeType===8?au(e.parentNode,n):e.nodeType===1&&au(e,n),Zi(e)):au(xt,n.stateNode));break;case 4:r=xt,i=fn,xt=n.stateNode.containerInfo,fn=!0,Zn(e,t,n),xt=r,fn=i;break;case 0:case 11:case 14:case 15:if(!Ct&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&Pc(n,t,a),i=i.next}while(i!==r)}Zn(e,t,n);break;case 1:if(!Ct&&(Ms(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Xe(n,t,o)}Zn(e,t,n);break;case 21:Zn(e,t,n);break;case 22:n.mode&1?(Ct=(r=Ct)||n.memoizedState!==null,Zn(e,t,n),Ct=r):Zn(e,t,n);break;default:Zn(e,t,n)}}function sp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new H1),t.forEach(function(r){var i=Z1.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function dn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var l=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:xt=o.stateNode,fn=!1;break e;case 3:xt=o.stateNode.containerInfo,fn=!0;break e;case 4:xt=o.stateNode.containerInfo,fn=!0;break e}o=o.return}if(xt===null)throw Error(K(160));Gx(l,a,i),xt=null,fn=!1;var u=i.alternate;u!==null&&(u.return=null),i.return=null}catch(c){Xe(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Kx(t,e),t=t.sibling}function Kx(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(dn(t,e),Nn(e),r&4){try{Ui(3,e,e.return),wo(3,e)}catch(g){Xe(e,e.return,g)}try{Ui(5,e,e.return)}catch(g){Xe(e,e.return,g)}}break;case 1:dn(t,e),Nn(e),r&512&&n!==null&&Ms(n,n.return);break;case 5:if(dn(t,e),Nn(e),r&512&&n!==null&&Ms(n,n.return),e.flags&32){var i=e.stateNode;try{Ki(i,"")}catch(g){Xe(e,e.return,g)}}if(r&4&&(i=e.stateNode,i!=null)){var l=e.memoizedProps,a=n!==null?n.memoizedProps:l,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&l.type==="radio"&&l.name!=null&&xg(i,l),nc(o,a);var c=nc(o,l);for(a=0;a<u.length;a+=2){var h=u[a],d=u[a+1];h==="style"?kg(i,d):h==="dangerouslySetInnerHTML"?jg(i,d):h==="children"?Ki(i,d):wd(i,h,d,c)}switch(o){case"input":Ju(i,l);break;case"textarea":yg(i,l);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!l.multiple;var m=l.value;m!=null?$s(i,!!l.multiple,m,!1):f!==!!l.multiple&&(l.defaultValue!=null?$s(i,!!l.multiple,l.defaultValue,!0):$s(i,!!l.multiple,l.multiple?[]:"",!1))}i[sl]=l}catch(g){Xe(e,e.return,g)}}break;case 6:if(dn(t,e),Nn(e),r&4){if(e.stateNode===null)throw Error(K(162));i=e.stateNode,l=e.memoizedProps;try{i.nodeValue=l}catch(g){Xe(e,e.return,g)}}break;case 3:if(dn(t,e),Nn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Zi(t.containerInfo)}catch(g){Xe(e,e.return,g)}break;case 4:dn(t,e),Nn(e);break;case 13:dn(t,e),Nn(e),i=e.child,i.flags&8192&&(l=i.memoizedState!==null,i.stateNode.isHidden=l,!l||i.alternate!==null&&i.alternate.memoizedState!==null||(eh=et())),r&4&&sp(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Ct=(c=Ct)||h,dn(t,e),Ct=c):dn(t,e),Nn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(te=e,h=e.child;h!==null;){for(d=te=h;te!==null;){switch(f=te,m=f.child,f.tag){case 0:case 11:case 14:case 15:Ui(4,f,f.return);break;case 1:Ms(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(g){Xe(r,n,g)}}break;case 5:Ms(f,f.return);break;case 22:if(f.memoizedState!==null){lp(d);continue}}m!==null?(m.return=f,te=m):lp(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{i=d.stateNode,c?(l=i.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(o=d.stateNode,u=d.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=wg("display",a))}catch(g){Xe(e,e.return,g)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(g){Xe(e,e.return,g)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:dn(t,e),Nn(e),r&4&&sp(e);break;case 21:break;default:dn(t,e),Nn(e)}}function Nn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(qx(n)){var r=n;break e}n=n.return}throw Error(K(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Ki(i,""),r.flags&=-33);var l=rp(e);Ac(e,l,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=rp(e);Lc(e,o,a);break;default:throw Error(K(161))}}catch(u){Xe(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function V1(e,t,n){te=e,Yx(e)}function Yx(e,t,n){for(var r=(e.mode&1)!==0;te!==null;){var i=te,l=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||Jl;if(!a){var o=i.alternate,u=o!==null&&o.memoizedState!==null||Ct;o=Jl;var c=Ct;if(Jl=a,(Ct=u)&&!c)for(te=i;te!==null;)a=te,u=a.child,a.tag===22&&a.memoizedState!==null?ap(i):u!==null?(u.return=a,te=u):ap(i);for(;l!==null;)te=l,Yx(l),l=l.sibling;te=i,Jl=o,Ct=c}ip(e)}else i.subtreeFlags&8772&&l!==null?(l.return=i,te=l):ip(e)}}function ip(e){for(;te!==null;){var t=te;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ct||wo(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ct)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:hn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&Hf(t,l,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Hf(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&Zi(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(K(163))}Ct||t.flags&512&&Rc(t)}catch(f){Xe(t,t.return,f)}}if(t===e){te=null;break}if(n=t.sibling,n!==null){n.return=t.return,te=n;break}te=t.return}}function lp(e){for(;te!==null;){var t=te;if(t===e){te=null;break}var n=t.sibling;if(n!==null){n.return=t.return,te=n;break}te=t.return}}function ap(e){for(;te!==null;){var t=te;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wo(4,t)}catch(u){Xe(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(u){Xe(t,i,u)}}var l=t.return;try{Rc(t)}catch(u){Xe(t,l,u)}break;case 5:var a=t.return;try{Rc(t)}catch(u){Xe(t,a,u)}}}catch(u){Xe(t,t.return,u)}if(t===e){te=null;break}var o=t.sibling;if(o!==null){o.return=t.return,te=o;break}te=t.return}}var Q1=Math.ceil,Qa=qn.ReactCurrentDispatcher,Xd=qn.ReactCurrentOwner,an=qn.ReactCurrentBatchConfig,Re=0,ht=null,it=null,wt=0,Wt=0,zs=Cr(0),at=0,cl=null,rs=0,ko=0,Zd=0,Bi=null,Mt=null,eh=0,Js=1/0,_n=null,qa=!1,Ic=null,mr=null,Xl=!1,ar=null,Ga=0,Hi=0,Dc=null,va=-1,ja=0;function Pt(){return Re&6?et():va!==-1?va:va=et()}function gr(e){return e.mode&1?Re&2&&wt!==0?wt&-wt:P1.transition!==null?(ja===0&&(ja=Dg()),ja):(e=Me,e!==0||(e=window.event,e=e===void 0?16:Ug(e.type)),e):1}function xn(e,t,n,r){if(50<Hi)throw Hi=0,Dc=null,Error(K(185));xl(e,n,r),(!(Re&2)||e!==ht)&&(e===ht&&(!(Re&2)&&(ko|=n),at===4&&ir(e,wt)),Ot(e,r),n===1&&Re===0&&!(t.mode&1)&&(Js=et()+500,yo&&Er()))}function Ot(e,t){var n=e.callbackNode;Pw(e,t);var r=La(e,e===ht?wt:0);if(r===0)n!==null&&gf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&gf(n),t===1)e.tag===0?T1(op.bind(null,e)):lx(op.bind(null,e)),S1(function(){!(Re&6)&&Er()}),n=null;else{switch(Mg(r)){case 1:n=Cd;break;case 4:n=Ag;break;case 16:n=Ra;break;case 536870912:n=Ig;break;default:n=Ra}n=sy(n,Jx.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Jx(e,t){if(va=-1,ja=0,Re&6)throw Error(K(327));var n=e.callbackNode;if(Hs()&&e.callbackNode!==n)return null;var r=La(e,e===ht?wt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ka(e,r);else{t=r;var i=Re;Re|=2;var l=Zx();(ht!==e||wt!==t)&&(_n=null,Js=et()+500,Jr(e,t));do try{K1();break}catch(o){Xx(e,o)}while(!0);Od(),Qa.current=l,Re=i,it!==null?t=0:(ht=null,wt=0,t=at)}if(t!==0){if(t===2&&(i=ac(e),i!==0&&(r=i,t=Mc(e,i))),t===1)throw n=cl,Jr(e,0),ir(e,r),Ot(e,et()),n;if(t===6)ir(e,r);else{if(i=e.current.alternate,!(r&30)&&!q1(i)&&(t=Ka(e,r),t===2&&(l=ac(e),l!==0&&(r=l,t=Mc(e,l))),t===1))throw n=cl,Jr(e,0),ir(e,r),Ot(e,et()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(K(345));case 2:Br(e,Mt,_n);break;case 3:if(ir(e,r),(r&130023424)===r&&(t=eh+500-et(),10<t)){if(La(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Pt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=mc(Br.bind(null,e,Mt,_n),t);break}Br(e,Mt,_n);break;case 4:if(ir(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-gn(r);l=1<<a,a=t[a],a>i&&(i=a),r&=~l}if(r=i,r=et()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Q1(r/1960))-r,10<r){e.timeoutHandle=mc(Br.bind(null,e,Mt,_n),r);break}Br(e,Mt,_n);break;case 5:Br(e,Mt,_n);break;default:throw Error(K(329))}}}return Ot(e,et()),e.callbackNode===n?Jx.bind(null,e):null}function Mc(e,t){var n=Bi;return e.current.memoizedState.isDehydrated&&(Jr(e,t).flags|=256),e=Ka(e,t),e!==2&&(t=Mt,Mt=n,t!==null&&zc(t)),e}function zc(e){Mt===null?Mt=e:Mt.push.apply(Mt,e)}function q1(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],l=i.getSnapshot;i=i.value;try{if(!jn(l(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ir(e,t){for(t&=~Zd,t&=~ko,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-gn(t),r=1<<n;e[n]=-1,t&=~r}}function op(e){if(Re&6)throw Error(K(327));Hs();var t=La(e,0);if(!(t&1))return Ot(e,et()),null;var n=Ka(e,t);if(e.tag!==0&&n===2){var r=ac(e);r!==0&&(t=r,n=Mc(e,r))}if(n===1)throw n=cl,Jr(e,0),ir(e,t),Ot(e,et()),n;if(n===6)throw Error(K(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Br(e,Mt,_n),Ot(e,et()),null}function th(e,t){var n=Re;Re|=1;try{return e(t)}finally{Re=n,Re===0&&(Js=et()+500,yo&&Er())}}function ss(e){ar!==null&&ar.tag===0&&!(Re&6)&&Hs();var t=Re;Re|=1;var n=an.transition,r=Me;try{if(an.transition=null,Me=1,e)return e()}finally{Me=r,an.transition=n,Re=t,!(Re&6)&&Er()}}function nh(){Wt=zs.current,We(zs)}function Jr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,b1(n)),it!==null)for(n=it.return;n!==null;){var r=n;switch(zd(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&za();break;case 3:Ks(),We(_t),We(Et),Vd();break;case 5:Wd(r);break;case 4:Ks();break;case 13:We(qe);break;case 19:We(qe);break;case 10:Fd(r.type._context);break;case 22:case 23:nh()}n=n.return}if(ht=e,it=e=xr(e.current,null),wt=Wt=t,at=0,cl=null,Zd=ko=rs=0,Mt=Bi=null,qr!==null){for(t=0;t<qr.length;t++)if(n=qr[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,l=n.pending;if(l!==null){var a=l.next;l.next=i,r.next=a}n.pending=r}qr=null}return e}function Xx(e,t){do{var n=it;try{if(Od(),ga.current=Va,Wa){for(var r=Ge.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Wa=!1}if(ns=0,dt=lt=Ge=null,Fi=!1,al=0,Xd.current=null,n===null||n.return===null){at=1,cl=t,it=null;break}e:{var l=e,a=n.return,o=n,u=t;if(t=wt,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,h=o,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var m=Kf(a);if(m!==null){m.flags&=-257,Yf(m,a,o,l,t),m.mode&1&&Gf(l,c,t),t=m,u=c;var p=t.updateQueue;if(p===null){var g=new Set;g.add(u),t.updateQueue=g}else p.add(u);break e}else{if(!(t&1)){Gf(l,c,t),rh();break e}u=Error(K(426))}}else if(Qe&&o.mode&1){var w=Kf(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Yf(w,a,o,l,t),_d(Ys(u,o));break e}}l=u=Ys(u,o),at!==4&&(at=2),Bi===null?Bi=[l]:Bi.push(l),l=a;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t;var x=Mx(l,u,t);Bf(l,x);break e;case 1:o=u;var y=l.type,v=l.stateNode;if(!(l.flags&128)&&(typeof y.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(mr===null||!mr.has(v)))){l.flags|=65536,t&=-t,l.lanes|=t;var b=zx(l,o,t);Bf(l,b);break e}}l=l.return}while(l!==null)}ty(n)}catch(E){t=E,it===n&&n!==null&&(it=n=n.return);continue}break}while(!0)}function Zx(){var e=Qa.current;return Qa.current=Va,e===null?Va:e}function rh(){(at===0||at===3||at===2)&&(at=4),ht===null||!(rs&268435455)&&!(ko&268435455)||ir(ht,wt)}function Ka(e,t){var n=Re;Re|=2;var r=Zx();(ht!==e||wt!==t)&&(_n=null,Jr(e,t));do try{G1();break}catch(i){Xx(e,i)}while(!0);if(Od(),Re=n,Qa.current=r,it!==null)throw Error(K(261));return ht=null,wt=0,at}function G1(){for(;it!==null;)ey(it)}function K1(){for(;it!==null&&!jw();)ey(it)}function ey(e){var t=ry(e.alternate,e,Wt);e.memoizedProps=e.pendingProps,t===null?ty(e):it=t,Xd.current=null}function ty(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=B1(n,t),n!==null){n.flags&=32767,it=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{at=6,it=null;return}}else if(n=U1(n,t,Wt),n!==null){it=n;return}if(t=t.sibling,t!==null){it=t;return}it=t=e}while(t!==null);at===0&&(at=5)}function Br(e,t,n){var r=Me,i=an.transition;try{an.transition=null,Me=1,Y1(e,t,n,r)}finally{an.transition=i,Me=r}return null}function Y1(e,t,n,r){do Hs();while(ar!==null);if(Re&6)throw Error(K(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(K(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(Rw(e,l),e===ht&&(it=ht=null,wt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xl||(Xl=!0,sy(Ra,function(){return Hs(),null})),l=(n.flags&15990)!==0,n.subtreeFlags&15990||l){l=an.transition,an.transition=null;var a=Me;Me=1;var o=Re;Re|=4,Xd.current=null,W1(e,n),Kx(n,e),g1(fc),Aa=!!hc,fc=hc=null,e.current=n,V1(n),ww(),Re=o,Me=a,an.transition=l}else e.current=n;if(Xl&&(Xl=!1,ar=e,Ga=i),l=e.pendingLanes,l===0&&(mr=null),Sw(n.stateNode),Ot(e,et()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(qa)throw qa=!1,e=Ic,Ic=null,e;return Ga&1&&e.tag!==0&&Hs(),l=e.pendingLanes,l&1?e===Dc?Hi++:(Hi=0,Dc=e):Hi=0,Er(),null}function Hs(){if(ar!==null){var e=Mg(Ga),t=an.transition,n=Me;try{if(an.transition=null,Me=16>e?16:e,ar===null)var r=!1;else{if(e=ar,ar=null,Ga=0,Re&6)throw Error(K(331));var i=Re;for(Re|=4,te=e.current;te!==null;){var l=te,a=l.child;if(te.flags&16){var o=l.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for(te=c;te!==null;){var h=te;switch(h.tag){case 0:case 11:case 15:Ui(8,h,l)}var d=h.child;if(d!==null)d.return=h,te=d;else for(;te!==null;){h=te;var f=h.sibling,m=h.return;if(Qx(h),h===c){te=null;break}if(f!==null){f.return=m,te=f;break}te=m}}}var p=l.alternate;if(p!==null){var g=p.child;if(g!==null){p.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}te=l}}if(l.subtreeFlags&2064&&a!==null)a.return=l,te=a;else e:for(;te!==null;){if(l=te,l.flags&2048)switch(l.tag){case 0:case 11:case 15:Ui(9,l,l.return)}var x=l.sibling;if(x!==null){x.return=l.return,te=x;break e}te=l.return}}var y=e.current;for(te=y;te!==null;){a=te;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,te=v;else e:for(a=y;te!==null;){if(o=te,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:wo(9,o)}}catch(E){Xe(o,o.return,E)}if(o===a){te=null;break e}var b=o.sibling;if(b!==null){b.return=o.return,te=b;break e}te=o.return}}if(Re=i,Er(),Rn&&typeof Rn.onPostCommitFiberRoot=="function")try{Rn.onPostCommitFiberRoot(fo,e)}catch{}r=!0}return r}finally{Me=n,an.transition=t}}return!1}function up(e,t,n){t=Ys(n,t),t=Mx(e,t,1),e=pr(e,t,1),t=Pt(),e!==null&&(xl(e,1,t),Ot(e,t))}function Xe(e,t,n){if(e.tag===3)up(e,e,n);else for(;t!==null;){if(t.tag===3){up(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(mr===null||!mr.has(r))){e=Ys(n,e),e=zx(t,e,1),t=pr(t,e,1),e=Pt(),t!==null&&(xl(t,1,e),Ot(t,e));break}}t=t.return}}function J1(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Pt(),e.pingedLanes|=e.suspendedLanes&n,ht===e&&(wt&n)===n&&(at===4||at===3&&(wt&130023424)===wt&&500>et()-eh?Jr(e,0):Zd|=n),Ot(e,t)}function ny(e,t){t===0&&(e.mode&1?(t=Bl,Bl<<=1,!(Bl&130023424)&&(Bl=4194304)):t=1);var n=Pt();e=Vn(e,t),e!==null&&(xl(e,t,n),Ot(e,n))}function X1(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ny(e,n)}function Z1(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),ny(e,n)}var ry;ry=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_t.current)zt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return zt=!1,F1(e,t,n);zt=!!(e.flags&131072)}else zt=!1,Qe&&t.flags&1048576&&ax(t,Oa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ya(e,t),e=t.pendingProps;var i=Qs(t,Et.current);Bs(t,n),i=qd(null,t,r,e,i,n);var l=Gd();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$t(r)?(l=!0,_a(t)):l=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Bd(t),i.updater=jo,t.stateNode=i,i._reactInternals=t,kc(t,r,e,n),t=Nc(null,t,r,!0,l,n)):(t.tag=0,Qe&&l&&Md(t),Tt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ya(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=tk(r),e=hn(r,e),i){case 0:t=Sc(null,t,r,e,n);break e;case 1:t=Zf(null,t,r,e,n);break e;case 11:t=Jf(null,t,r,e,n);break e;case 14:t=Xf(null,t,r,hn(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),Sc(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),Zf(e,t,r,i,n);case 3:e:{if(Fx(t),e===null)throw Error(K(387));r=t.pendingProps,l=t.memoizedState,i=l.element,fx(e,t),Ba(t,r,null,n);var a=t.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){i=Ys(Error(K(423)),t),t=ep(e,t,r,n,i);break e}else if(r!==i){i=Ys(Error(K(424)),t),t=ep(e,t,r,n,i);break e}else for(Qt=fr(t.stateNode.containerInfo.firstChild),Gt=t,Qe=!0,mn=null,n=dx(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qs(),r===i){t=Qn(e,t,n);break e}Tt(e,t,r,n)}t=t.child}return t;case 5:return px(t),e===null&&vc(t),r=t.type,i=t.pendingProps,l=e!==null?e.memoizedProps:null,a=i.children,pc(r,i)?a=null:l!==null&&pc(r,l)&&(t.flags|=32),Ox(e,t),Tt(e,t,a,n),t.child;case 6:return e===null&&vc(t),null;case 13:return Ux(e,t,n);case 4:return Hd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gs(t,null,r,n):Tt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),Jf(e,t,r,i,n);case 7:return Tt(e,t,t.pendingProps,n),t.child;case 8:return Tt(e,t,t.pendingProps.children,n),t.child;case 12:return Tt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,l=t.memoizedProps,a=i.value,Be(Fa,r._currentValue),r._currentValue=a,l!==null)if(jn(l.value,a)){if(l.children===i.children&&!_t.current){t=Qn(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){a=l.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(l.tag===1){u=Un(-1,n&-n),u.tag=2;var c=l.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),jc(l.return,n,t),o.lanes|=n;break}u=u.next}}else if(l.tag===10)a=l.type===t.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(K(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),jc(a,n,t),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===t){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}Tt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Bs(t,n),i=on(i),r=r(i),t.flags|=1,Tt(e,t,r,n),t.child;case 14:return r=t.type,i=hn(r,t.pendingProps),i=hn(r.type,i),Xf(e,t,r,i,n);case 15:return _x(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hn(r,i),ya(e,t),t.tag=1,$t(r)?(e=!0,_a(t)):e=!1,Bs(t,n),Dx(t,r,i),kc(t,r,i,n),Nc(null,t,r,!0,e,n);case 19:return Bx(e,t,n);case 22:return $x(e,t,n)}throw Error(K(156,t.tag))};function sy(e,t){return Lg(e,t)}function ek(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(e,t,n,r){return new ek(e,t,n,r)}function sh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tk(e){if(typeof e=="function")return sh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===bd)return 11;if(e===Sd)return 14}return 2}function xr(e,t){var n=e.alternate;return n===null?(n=sn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function wa(e,t,n,r,i,l){var a=2;if(r=e,typeof e=="function")sh(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Cs:return Xr(n.children,i,l,t);case kd:a=8,i|=8;break;case Qu:return e=sn(12,n,t,i|2),e.elementType=Qu,e.lanes=l,e;case qu:return e=sn(13,n,t,i),e.elementType=qu,e.lanes=l,e;case Gu:return e=sn(19,n,t,i),e.elementType=Gu,e.lanes=l,e;case pg:return bo(n,i,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hg:a=10;break e;case fg:a=9;break e;case bd:a=11;break e;case Sd:a=14;break e;case nr:a=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=sn(a,n,t,i),t.elementType=e,t.type=r,t.lanes=l,t}function Xr(e,t,n,r){return e=sn(7,e,r,t),e.lanes=n,e}function bo(e,t,n,r){return e=sn(22,e,r,t),e.elementType=pg,e.lanes=n,e.stateNode={isHidden:!1},e}function mu(e,t,n){return e=sn(6,e,null,t),e.lanes=n,e}function gu(e,t,n){return t=sn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function nk(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yo(0),this.expirationTimes=Yo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ih(e,t,n,r,i,l,a,o,u){return e=new nk(e,t,n,o,u),t===1?(t=1,l===!0&&(t|=8)):t=0,l=sn(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bd(l),e}function rk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ns,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function iy(e){if(!e)return vr;e=e._reactInternals;e:{if(us(e)!==e||e.tag!==1)throw Error(K(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if($t(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(K(171))}if(e.tag===1){var n=e.type;if($t(n))return ix(e,n,t)}return t}function ly(e,t,n,r,i,l,a,o,u){return e=ih(n,r,!0,e,i,l,a,o,u),e.context=iy(null),n=e.current,r=Pt(),i=gr(n),l=Un(r,i),l.callback=t??null,pr(n,l,i),e.current.lanes=i,xl(e,i,r),Ot(e,r),e}function So(e,t,n,r){var i=t.current,l=Pt(),a=gr(i);return n=iy(n),t.context===null?t.context=n:t.pendingContext=n,t=Un(l,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=pr(i,t,a),e!==null&&(xn(e,i,a,l),ma(e,i,a)),a}function Ya(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lh(e,t){cp(e,t),(e=e.alternate)&&cp(e,t)}function sk(){return null}var ay=typeof reportError=="function"?reportError:function(e){console.error(e)};function ah(e){this._internalRoot=e}No.prototype.render=ah.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));So(e,t,null,null)};No.prototype.unmount=ah.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ss(function(){So(null,e,null,null)}),t[Wn]=null}};function No(e){this._internalRoot=e}No.prototype.unstable_scheduleHydration=function(e){if(e){var t=$g();e={blockedOn:null,target:e,priority:t};for(var n=0;n<sr.length&&t!==0&&t<sr[n].priority;n++);sr.splice(n,0,e),n===0&&Fg(e)}};function oh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Co(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dp(){}function ik(e,t,n,r,i){if(i){if(typeof r=="function"){var l=r;r=function(){var c=Ya(a);l.call(c)}}var a=ly(t,r,e,0,null,!1,!1,"",dp);return e._reactRootContainer=a,e[Wn]=a.current,nl(e.nodeType===8?e.parentNode:e),ss(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var c=Ya(u);o.call(c)}}var u=ih(e,0,!1,null,null,!1,!1,"",dp);return e._reactRootContainer=u,e[Wn]=u.current,nl(e.nodeType===8?e.parentNode:e),ss(function(){So(t,u,n,r)}),u}function Eo(e,t,n,r,i){var l=n._reactRootContainer;if(l){var a=l;if(typeof i=="function"){var o=i;i=function(){var u=Ya(a);o.call(u)}}So(t,a,e,i)}else a=ik(n,t,e,i,r);return Ya(a)}zg=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ai(t.pendingLanes);n!==0&&(Ed(t,n|1),Ot(t,et()),!(Re&6)&&(Js=et()+500,Er()))}break;case 13:ss(function(){var r=Vn(e,1);if(r!==null){var i=Pt();xn(r,e,1,i)}}),lh(e,1)}};Td=function(e){if(e.tag===13){var t=Vn(e,134217728);if(t!==null){var n=Pt();xn(t,e,134217728,n)}lh(e,134217728)}};_g=function(e){if(e.tag===13){var t=gr(e),n=Vn(e,t);if(n!==null){var r=Pt();xn(n,e,t,r)}lh(e,t)}};$g=function(){return Me};Og=function(e,t){var n=Me;try{return Me=e,t()}finally{Me=n}};sc=function(e,t,n){switch(t){case"input":if(Ju(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=xo(r);if(!i)throw Error(K(90));gg(r),Ju(r,i)}}}break;case"textarea":yg(e,n);break;case"select":t=n.value,t!=null&&$s(e,!!n.multiple,t,!1)}};Ng=th;Cg=ss;var lk={usingClientEntryPoint:!1,Events:[vl,Rs,xo,bg,Sg,th]},wi={findFiberByHostInstance:Qr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ak={bundleType:wi.bundleType,version:wi.version,rendererPackageName:wi.rendererPackageName,rendererConfig:wi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:qn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Pg(e),e===null?null:e.stateNode},findFiberByHostInstance:wi.findFiberByHostInstance||sk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zl.isDisabled&&Zl.supportsFiber)try{fo=Zl.inject(ak),Rn=Zl}catch{}}Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lk;Jt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!oh(t))throw Error(K(200));return rk(e,t,null,n)};Jt.createRoot=function(e,t){if(!oh(e))throw Error(K(299));var n=!1,r="",i=ay;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=ih(e,1,!1,null,null,n,!1,r,i),e[Wn]=t.current,nl(e.nodeType===8?e.parentNode:e),new ah(t)};Jt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=Pg(t),e=e===null?null:e.stateNode,e};Jt.flushSync=function(e){return ss(e)};Jt.hydrate=function(e,t,n){if(!Co(t))throw Error(K(200));return Eo(null,e,t,!0,n)};Jt.hydrateRoot=function(e,t,n){if(!oh(e))throw Error(K(405));var r=n!=null&&n.hydratedSources||null,i=!1,l="",a=ay;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=ly(t,null,e,1,n??null,i,!1,l,a),e[Wn]=t.current,nl(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new No(t)};Jt.render=function(e,t,n){if(!Co(t))throw Error(K(200));return Eo(null,e,t,!1,n)};Jt.unmountComponentAtNode=function(e){if(!Co(e))throw Error(K(40));return e._reactRootContainer?(ss(function(){Eo(null,null,e,!1,function(){e._reactRootContainer=null,e[Wn]=null})}),!0):!1};Jt.unstable_batchedUpdates=th;Jt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Co(n))throw Error(K(200));if(e==null||e._reactInternals===void 0)throw Error(K(38));return Eo(e,t,n,!1,r)};Jt.version="18.3.1-next-f1338f8080-20240426";function oy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oy)}catch(e){console.error(e)}}oy(),og.exports=Jt;var Tr=og.exports;const ok=pd(Tr),uk=Ym({__proto__:null,default:ok},[Tr]);var uy,hp=Tr;uy=hp.createRoot,hp.hydrateRoot;/**
41
41
  * @remix-run/router v1.21.0
42
42
  *
43
43
  * Copyright (c) Remix Software Inc.
@@ -46,8 +46,8 @@ Error generating stack: `+l.message+`
46
46
  * LICENSE.md file in the root directory of this source tree.
47
47
  *
48
48
  * @license MIT
49
- */function We(){return We=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},We.apply(this,arguments)}var st;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(st||(st={}));const fp="popstate";function ok(e){e===void 0&&(e={});function t(r,i){let{pathname:l,search:a,hash:o}=r.location;return hl("",{pathname:l,search:a,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:ss(i)}return ck(t,n,null,e)}function je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function uk(){return Math.random().toString(36).substr(2,8)}function pp(e,t){return{usr:e.state,key:e.key,idx:t}}function hl(e,t,n,r){return n===void 0&&(n=null),We({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Tr(t):t,{state:n,key:t&&t.key||r||uk()})}function ss(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Tr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ck(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:l=!1}=r,a=i.history,o=st.Pop,u=null,c=h();c==null&&(c=0,a.replaceState(We({},a.state,{idx:c}),""));function h(){return(a.state||{idx:null}).idx}function d(){o=st.Pop;let w=h(),x=w==null?null:w-c;c=w,u&&u({action:o,location:g.location,delta:x})}function f(w,x){o=st.Push;let y=hl(g.location,w,x);c=h()+1;let v=pp(y,c),b=g.createHref(y);try{a.pushState(v,"",b)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;i.location.assign(b)}l&&u&&u({action:o,location:g.location,delta:1})}function m(w,x){o=st.Replace;let y=hl(g.location,w,x);c=h();let v=pp(y,c),b=g.createHref(y);a.replaceState(v,"",b),l&&u&&u({action:o,location:g.location,delta:0})}function p(w){let x=i.location.origin!=="null"?i.location.origin:i.location.href,y=typeof w=="string"?w:ss(w);return y=y.replace(/ $/,"%20"),je(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let g={get action(){return o},get location(){return e(i,a)},listen(w){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(fp,d),u=w,()=>{i.removeEventListener(fp,d),u=null}},createHref(w){return t(i,w)},createURL:p,encodeLocation(w){let x=p(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:m,go(w){return a.go(w)}};return g}var De;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(De||(De={}));const dk=new Set(["lazy","caseSensitive","path","id","index","children"]);function hk(e){return e.index===!0}function Xa(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((i,l)=>{let a=[...n,String(l)],o=typeof i.id=="string"?i.id:a.join("-");if(je(i.index!==!0||!i.children,"Cannot specify children on an index route"),je(!r[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),hk(i)){let u=We({},i,t(i),{id:o});return r[o]=u,u}else{let u=We({},i,t(i),{id:o,children:void 0});return r[o]=u,i.children&&(u.children=Xa(i.children,t,a,r)),u}})}function Hr(e,t,n){return n===void 0&&(n="/"),ba(e,t,n,!1)}function ba(e,t,n,r){let i=typeof t=="string"?Tr(t):t,l=wn(i.pathname||"/",n);if(l==null)return null;let a=cy(e);pk(a);let o=null;for(let u=0;o==null&&u<a.length;++u){let c=Nk(l);o=bk(a[u],c,r)}return o}function fk(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],handle:n.handle}}function cy(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(l,a,o)=>{let u={relativePath:o===void 0?l.path||"":o,caseSensitive:l.caseSensitive===!0,childrenIndex:a,route:l};u.relativePath.startsWith("/")&&(je(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let c=Bn([r,u.relativePath]),h=n.concat(u);l.children&&l.children.length>0&&(je(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),cy(l.children,t,h,c)),!(l.path==null&&!l.index)&&t.push({path:c,score:wk(c,l.index),routesMeta:h})};return e.forEach((l,a)=>{var o;if(l.path===""||!((o=l.path)!=null&&o.includes("?")))i(l,a);else for(let u of dy(l.path))i(l,a,u)}),t}function dy(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return i?[l,""]:[l];let a=dy(r.join("/")),o=[];return o.push(...a.map(u=>u===""?l:[l,u].join("/"))),i&&o.push(...a),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function pk(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:kk(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const mk=/^:[\w-]+$/,gk=3,xk=2,yk=1,vk=10,jk=-2,mp=e=>e==="*";function wk(e,t){let n=e.split("/"),r=n.length;return n.some(mp)&&(r+=jk),t&&(r+=xk),n.filter(i=>!mp(i)).reduce((i,l)=>i+(mk.test(l)?gk:l===""?yk:vk),r)}function kk(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function bk(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},l="/",a=[];for(let o=0;o<r.length;++o){let u=r[o],c=o===r.length-1,h=l==="/"?t:t.slice(l.length)||"/",d=Za({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},h),f=u.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Za({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!d)return null;Object.assign(i,d.params),a.push({params:i,pathname:Bn([l,d.pathname]),pathnameBase:Tk(Bn([l,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(l=Bn([l,d.pathnameBase]))}return a}function Za(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Sk(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let l=i[0],a=l.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:r.reduce((c,h,d)=>{let{paramName:f,isOptional:m}=h;if(f==="*"){let g=o[d]||"";a=l.slice(0,l.length-g.length).replace(/(.)\/+$/,"$1")}const p=o[d];return m&&!p?c[f]=void 0:c[f]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:l,pathnameBase:a,pattern:e}}function Sk(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Xs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function Nk(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xs(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function wn(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Ck(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Tr(e):e;return{pathname:n?n.startsWith("/")?n:Ek(n,t):t,search:Pk(r),hash:Rk(i)}}function Ek(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function xu(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function hy(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function uh(e,t){let n=hy(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ch(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Tr(e):(i=We({},e),je(!i.pathname||!i.pathname.includes("?"),xu("?","pathname","search",i)),je(!i.pathname||!i.pathname.includes("#"),xu("#","pathname","hash",i)),je(!i.search||!i.search.includes("#"),xu("#","search","hash",i)));let l=e===""||i.pathname==="",a=l?"/":i.pathname,o;if(a==null)o=n;else{let d=t.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?t[d]:"/"}let u=Ck(i,o),c=a&&a!=="/"&&a.endsWith("/"),h=(l||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||h)&&(u.pathname+="/"),u}const Bn=e=>e.join("/").replace(/\/\/+/g,"/"),Tk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Pk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Rk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class eo{constructor(t,n,r,i){i===void 0&&(i=!1),this.status=t,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function To(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const fy=["post","put","patch","delete"],Lk=new Set(fy),Ak=["get",...fy],Ik=new Set(Ak),Dk=new Set([301,302,303,307,308]),Mk=new Set([307,308]),yu={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},zk={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ks={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},dh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_k=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),py="remix-router-transitions";function $k(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;je(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let P=e.detectErrorBoundary;i=M=>({hasErrorBoundary:P(M)})}else i=_k;let l={},a=Xa(e.routes,i,void 0,l),o,u=e.basename||"/",c=e.dataStrategy||Bk,h=e.patchRoutesOnNavigation,d=We({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,m=new Set,p=null,g=null,w=null,x=e.hydrationData!=null,y=Hr(a,e.history.location,u),v=null;if(y==null&&!h){let P=It(404,{pathname:e.history.location.pathname}),{matches:M,route:_}=Cp(a);y=M,v={[_.id]:P}}y&&!e.hydrationData&&Dl(y,a,e.history.location.pathname).active&&(y=null);let b;if(y)if(y.some(P=>P.route.lazy))b=!1;else if(!y.some(P=>P.route.loader))b=!0;else if(d.v7_partialHydration){let P=e.hydrationData?e.hydrationData.loaderData:null,M=e.hydrationData?e.hydrationData.errors:null;if(M){let _=y.findIndex(V=>M[V.route.id]!==void 0);b=y.slice(0,_+1).every(V=>!$c(V.route,P,M))}else b=y.every(_=>!$c(_.route,P,M))}else b=e.hydrationData!=null;else if(b=!1,y=[],d.v7_partialHydration){let P=Dl(null,a,e.history.location.pathname);P.active&&P.matches&&(y=P.matches)}let E,k={historyAction:e.history.action,location:e.history.location,matches:y,initialized:b,navigation:yu,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||v,fetchers:new Map,blockers:new Map},R=st.Pop,T=!1,D,C=!1,L=new Map,A=null,z=!1,U=!1,I=[],Q=new Set,J=new Map,H=0,X=-1,S=new Map,ae=new Set,O=new Map,N=new Map,F=new Set,Z=new Map,oe=new Map,B;function he(){if(f=e.history.listen(P=>{let{action:M,location:_,delta:V}=P;if(B){B(),B=void 0;return}Xs(oe.size===0||V!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ne=ms({currentLocation:k.location,nextLocation:_,historyAction:M});if(ne&&V!=null){let ue=new Promise(xe=>{B=xe});e.history.go(V*-1),_r(ne,{state:"blocked",location:_,proceed(){_r(ne,{state:"proceeding",proceed:void 0,reset:void 0,location:_}),ue.then(()=>e.history.go(V))},reset(){let xe=new Map(k.blockers);xe.set(ne,ks),W({blockers:xe})}});return}return en(M,_)}),n){n0(t,L);let P=()=>r0(t,L);t.addEventListener("pagehide",P),A=()=>t.removeEventListener("pagehide",P)}return k.initialized||en(st.Pop,k.location,{initialHydration:!0}),E}function ze(){f&&f(),A&&A(),m.clear(),D&&D.abort(),k.fetchers.forEach((P,M)=>me(M)),k.blockers.forEach((P,M)=>Xn(M))}function Ke(P){return m.add(P),()=>m.delete(P)}function W(P,M){M===void 0&&(M={}),k=We({},k,P);let _=[],V=[];d.v7_fetcherPersist&&k.fetchers.forEach((ne,ue)=>{ne.state==="idle"&&(F.has(ue)?V.push(ue):_.push(ue))}),[...m].forEach(ne=>ne(k,{deletedFetchers:V,viewTransitionOpts:M.viewTransitionOpts,flushSync:M.flushSync===!0})),d.v7_fetcherPersist&&(_.forEach(ne=>k.fetchers.delete(ne)),V.forEach(ne=>me(ne)))}function fe(P,M,_){var V,ne;let{flushSync:ue}=_===void 0?{}:_,xe=k.actionData!=null&&k.navigation.formMethod!=null&&pn(k.navigation.formMethod)&&k.navigation.state==="loading"&&((V=P.state)==null?void 0:V._isRedirect)!==!0,se;M.actionData?Object.keys(M.actionData).length>0?se=M.actionData:se=null:xe?se=k.actionData:se=null;let ie=M.loaderData?Sp(k.loaderData,M.loaderData,M.matches||[],M.errors):k.loaderData,re=k.blockers;re.size>0&&(re=new Map(re),re.forEach((Ee,gt)=>re.set(gt,ks)));let ce=T===!0||k.navigation.formMethod!=null&&pn(k.navigation.formMethod)&&((ne=P.state)==null?void 0:ne._isRedirect)!==!0;o&&(a=o,o=void 0),z||R===st.Pop||(R===st.Push?e.history.push(P,P.state):R===st.Replace&&e.history.replace(P,P.state));let be;if(R===st.Pop){let Ee=L.get(k.location.pathname);Ee&&Ee.has(P.pathname)?be={currentLocation:k.location,nextLocation:P}:L.has(P.pathname)&&(be={currentLocation:P,nextLocation:k.location})}else if(C){let Ee=L.get(k.location.pathname);Ee?Ee.add(P.pathname):(Ee=new Set([P.pathname]),L.set(k.location.pathname,Ee)),be={currentLocation:k.location,nextLocation:P}}W(We({},M,{actionData:se,loaderData:ie,historyAction:R,location:P,initialized:!0,navigation:yu,revalidation:"idle",restoreScrollPosition:tf(P,M.matches||k.matches),preventScrollReset:ce,blockers:re}),{viewTransitionOpts:be,flushSync:ue===!0}),R=st.Pop,T=!1,C=!1,z=!1,U=!1,I=[]}async function Ze(P,M){if(typeof P=="number"){e.history.go(P);return}let _=_c(k.location,k.matches,u,d.v7_prependBasename,P,d.v7_relativeSplatPath,M==null?void 0:M.fromRouteId,M==null?void 0:M.relative),{path:V,submission:ne,error:ue}=gp(d.v7_normalizeFormMethod,!1,_,M),xe=k.location,se=hl(k.location,V,M&&M.state);se=We({},se,e.history.encodeLocation(se));let ie=M&&M.replace!=null?M.replace:void 0,re=st.Push;ie===!0?re=st.Replace:ie===!1||ne!=null&&pn(ne.formMethod)&&ne.formAction===k.location.pathname+k.location.search&&(re=st.Replace);let ce=M&&"preventScrollReset"in M?M.preventScrollReset===!0:void 0,be=(M&&M.flushSync)===!0,Ee=ms({currentLocation:xe,nextLocation:se,historyAction:re});if(Ee){_r(Ee,{state:"blocked",location:se,proceed(){_r(Ee,{state:"proceeding",proceed:void 0,reset:void 0,location:se}),Ze(P,M)},reset(){let gt=new Map(k.blockers);gt.set(Ee,ks),W({blockers:gt})}});return}return await en(re,se,{submission:ne,pendingError:ue,preventScrollReset:ce,replace:M&&M.replace,enableViewTransition:M&&M.viewTransition,flushSync:be})}function Zt(){if(ci(),W({revalidation:"loading"}),k.navigation.state!=="submitting"){if(k.navigation.state==="idle"){en(k.historyAction,k.location,{startUninterruptedRevalidation:!0});return}en(R||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:C===!0})}}async function en(P,M,_){D&&D.abort(),D=null,R=P,z=(_&&_.startUninterruptedRevalidation)===!0,Pj(k.location,k.matches),T=(_&&_.preventScrollReset)===!0,C=(_&&_.enableViewTransition)===!0;let V=o||a,ne=_&&_.overrideNavigation,ue=Hr(V,M,u),xe=(_&&_.flushSync)===!0,se=Dl(ue,V,M.pathname);if(se.active&&se.matches&&(ue=se.matches),!ue){let{error:Fe,notFoundMatches:Ae,route:Ye}=mt(M.pathname);fe(M,{matches:Ae,loaderData:{},errors:{[Ye.id]:Fe}},{flushSync:xe});return}if(k.initialized&&!U&&Gk(k.location,M)&&!(_&&_.submission&&pn(_.submission.formMethod))){fe(M,{matches:ue},{flushSync:xe});return}D=new AbortController;let ie=js(e.history,M,D.signal,_&&_.submission),re;if(_&&_.pendingError)re=[Wr(ue).route.id,{type:De.error,error:_.pendingError}];else if(_&&_.submission&&pn(_.submission.formMethod)){let Fe=await ee(ie,M,_.submission,ue,se.active,{replace:_.replace,flushSync:xe});if(Fe.shortCircuited)return;if(Fe.pendingActionResult){let[Ae,Ye]=Fe.pendingActionResult;if(Wt(Ye)&&To(Ye.error)&&Ye.error.status===404){D=null,fe(M,{matches:Fe.matches,loaderData:{},errors:{[Ae]:Ye.error}});return}}ue=Fe.matches||ue,re=Fe.pendingActionResult,ne=vu(M,_.submission),xe=!1,se.active=!1,ie=js(e.history,ie.url,ie.signal)}let{shortCircuited:ce,matches:be,loaderData:Ee,errors:gt}=await Ne(ie,M,ue,se.active,ne,_&&_.submission,_&&_.fetcherSubmission,_&&_.replace,_&&_.initialHydration===!0,xe,re);ce||(D=null,fe(M,We({matches:be||ue},Np(re),{loaderData:Ee,errors:gt})))}async function ee(P,M,_,V,ne,ue){ue===void 0&&(ue={}),ci();let xe=e0(M,_);if(W({navigation:xe},{flushSync:ue.flushSync===!0}),ne){let re=await Ml(V,M.pathname,P.signal);if(re.type==="aborted")return{shortCircuited:!0};if(re.type==="error"){let ce=Wr(re.partialMatches).route.id;return{matches:re.partialMatches,pendingActionResult:[ce,{type:De.error,error:re.error}]}}else if(re.matches)V=re.matches;else{let{notFoundMatches:ce,error:be,route:Ee}=mt(M.pathname);return{matches:ce,pendingActionResult:[Ee.id,{type:De.error,error:be}]}}}let se,ie=Di(V,M);if(!ie.route.action&&!ie.route.lazy)se={type:De.error,error:It(405,{method:P.method,pathname:M.pathname,routeId:ie.route.id})};else if(se=(await Mr("action",k,P,[ie],V,null))[ie.route.id],P.signal.aborted)return{shortCircuited:!0};if(Gr(se)){let re;return ue&&ue.replace!=null?re=ue.replace:re=wp(se.response.headers.get("Location"),new URL(P.url),u)===k.location.pathname+k.location.search,await Mn(P,se,!0,{submission:_,replace:re}),{shortCircuited:!0}}if(or(se))throw It(400,{type:"defer-action"});if(Wt(se)){let re=Wr(V,ie.route.id);return(ue&&ue.replace)!==!0&&(R=st.Push),{matches:V,pendingActionResult:[re.route.id,se]}}return{matches:V,pendingActionResult:[ie.route.id,se]}}async function Ne(P,M,_,V,ne,ue,xe,se,ie,re,ce){let be=ne||vu(M,ue),Ee=ue||xe||Tp(be),gt=!z&&(!d.v7_partialHydration||!ie);if(V){if(gt){let Je=et(ce);W(We({navigation:be},Je!==void 0?{actionData:Je}:{}),{flushSync:re})}let Re=await Ml(_,M.pathname,P.signal);if(Re.type==="aborted")return{shortCircuited:!0};if(Re.type==="error"){let Je=Wr(Re.partialMatches).route.id;return{matches:Re.partialMatches,loaderData:{},errors:{[Je]:Re.error}}}else if(Re.matches)_=Re.matches;else{let{error:Je,notFoundMatches:xs,route:fi}=mt(M.pathname);return{matches:xs,loaderData:{},errors:{[fi.id]:Je}}}}let Fe=o||a,[Ae,Ye]=yp(e.history,k,_,Ee,M,d.v7_partialHydration&&ie===!0,d.v7_skipActionErrorRevalidation,U,I,Q,F,O,ae,Fe,u,ce);if(Sn(Re=>!(_&&_.some(Je=>Je.route.id===Re))||Ae&&Ae.some(Je=>Je.route.id===Re)),X=++H,Ae.length===0&&Ye.length===0){let Re=Ut();return fe(M,We({matches:_,loaderData:{},errors:ce&&Wt(ce[1])?{[ce[0]]:ce[1].error}:null},Np(ce),Re?{fetchers:new Map(k.fetchers)}:{}),{flushSync:re}),{shortCircuited:!0}}if(gt){let Re={};if(!V){Re.navigation=be;let Je=et(ce);Je!==void 0&&(Re.actionData=Je)}Ye.length>0&&(Re.fetchers=Dr(Ye)),W(Re,{flushSync:re})}Ye.forEach(Re=>{Ce(Re.key),Re.controller&&J.set(Re.key,Re.controller)});let gs=()=>Ye.forEach(Re=>Ce(Re.key));D&&D.signal.addEventListener("abort",gs);let{loaderResults:di,fetcherResults:zn}=await Il(k,_,Ae,Ye,P);if(P.signal.aborted)return{shortCircuited:!0};D&&D.signal.removeEventListener("abort",gs),Ye.forEach(Re=>J.delete(Re.key));let Nn=ta(di);if(Nn)return await Mn(P,Nn.result,!0,{replace:se}),{shortCircuited:!0};if(Nn=ta(zn),Nn)return ae.add(Nn.key),await Mn(P,Nn.result,!0,{replace:se}),{shortCircuited:!0};let{loaderData:Wo,errors:hi}=bp(k,_,di,ce,Ye,zn,Z);Z.forEach((Re,Je)=>{Re.subscribe(xs=>{(xs||Re.done)&&Z.delete(Je)})}),d.v7_partialHydration&&ie&&k.errors&&(hi=We({},k.errors,hi));let $r=Ut(),zl=Jn(X),_l=$r||zl||Ye.length>0;return We({matches:_,loaderData:Wo,errors:hi},_l?{fetchers:new Map(k.fetchers)}:{})}function et(P){if(P&&!Wt(P[1]))return{[P[0]]:P[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Dr(P){return P.forEach(M=>{let _=k.fetchers.get(M.key),V=ki(void 0,_?_.data:void 0);k.fetchers.set(M.key,V)}),new Map(k.fetchers)}function Ll(P,M,_,V){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ce(P);let ne=(V&&V.flushSync)===!0,ue=o||a,xe=_c(k.location,k.matches,u,d.v7_prependBasename,_,d.v7_relativeSplatPath,M,V==null?void 0:V.relative),se=Hr(ue,xe,u),ie=Dl(se,ue,xe);if(ie.active&&ie.matches&&(se=ie.matches),!se){G(P,M,It(404,{pathname:xe}),{flushSync:ne});return}let{path:re,submission:ce,error:be}=gp(d.v7_normalizeFormMethod,!0,xe,V);if(be){G(P,M,be,{flushSync:ne});return}let Ee=Di(se,re),gt=(V&&V.preventScrollReset)===!0;if(ce&&pn(ce.formMethod)){Al(P,M,re,Ee,se,ie.active,ne,gt,ce);return}O.set(P,{routeId:M,path:re}),Ho(P,M,re,Ee,se,ie.active,ne,gt,ce)}async function Al(P,M,_,V,ne,ue,xe,se,ie){ci(),O.delete(P);function re(nt){if(!nt.route.action&&!nt.route.lazy){let ys=It(405,{method:ie.formMethod,pathname:_,routeId:M});return G(P,M,ys,{flushSync:xe}),!0}return!1}if(!ue&&re(V))return;let ce=k.fetchers.get(P);$(P,t0(ie,ce),{flushSync:xe});let be=new AbortController,Ee=js(e.history,_,be.signal,ie);if(ue){let nt=await Ml(ne,_,Ee.signal);if(nt.type==="aborted")return;if(nt.type==="error"){G(P,M,nt.error,{flushSync:xe});return}else if(nt.matches){if(ne=nt.matches,V=Di(ne,_),re(V))return}else{G(P,M,It(404,{pathname:_}),{flushSync:xe});return}}J.set(P,be);let gt=H,Ae=(await Mr("action",k,Ee,[V],ne,P))[V.route.id];if(Ee.signal.aborted){J.get(P)===be&&J.delete(P);return}if(d.v7_fetcherPersist&&F.has(P)){if(Gr(Ae)||Wt(Ae)){$(P,tr(void 0));return}}else{if(Gr(Ae))if(J.delete(P),X>gt){$(P,tr(void 0));return}else return ae.add(P),$(P,ki(ie)),Mn(Ee,Ae,!1,{fetcherSubmission:ie,preventScrollReset:se});if(Wt(Ae)){G(P,M,Ae.error);return}}if(or(Ae))throw It(400,{type:"defer-action"});let Ye=k.navigation.location||k.location,gs=js(e.history,Ye,be.signal),di=o||a,zn=k.navigation.state!=="idle"?Hr(di,k.navigation.location,u):k.matches;je(zn,"Didn't find any matches after fetcher action");let Nn=++H;S.set(P,Nn);let Wo=ki(ie,Ae.data);k.fetchers.set(P,Wo);let[hi,$r]=yp(e.history,k,zn,ie,Ye,!1,d.v7_skipActionErrorRevalidation,U,I,Q,F,O,ae,di,u,[V.route.id,Ae]);$r.filter(nt=>nt.key!==P).forEach(nt=>{let ys=nt.key,nf=k.fetchers.get(ys),Aj=ki(void 0,nf?nf.data:void 0);k.fetchers.set(ys,Aj),Ce(ys),nt.controller&&J.set(ys,nt.controller)}),W({fetchers:new Map(k.fetchers)});let zl=()=>$r.forEach(nt=>Ce(nt.key));be.signal.addEventListener("abort",zl);let{loaderResults:_l,fetcherResults:Re}=await Il(k,zn,hi,$r,gs);if(be.signal.aborted)return;be.signal.removeEventListener("abort",zl),S.delete(P),J.delete(P),$r.forEach(nt=>J.delete(nt.key));let Je=ta(_l);if(Je)return Mn(gs,Je.result,!1,{preventScrollReset:se});if(Je=ta(Re),Je)return ae.add(Je.key),Mn(gs,Je.result,!1,{preventScrollReset:se});let{loaderData:xs,errors:fi}=bp(k,zn,_l,void 0,$r,Re,Z);if(k.fetchers.has(P)){let nt=tr(Ae.data);k.fetchers.set(P,nt)}Jn(Nn),k.navigation.state==="loading"&&Nn>X?(je(R,"Expected pending action"),D&&D.abort(),fe(k.navigation.location,{matches:zn,loaderData:xs,errors:fi,fetchers:new Map(k.fetchers)})):(W({errors:fi,loaderData:Sp(k.loaderData,xs,zn,fi),fetchers:new Map(k.fetchers)}),U=!1)}async function Ho(P,M,_,V,ne,ue,xe,se,ie){let re=k.fetchers.get(P);$(P,ki(ie,re?re.data:void 0),{flushSync:xe});let ce=new AbortController,be=js(e.history,_,ce.signal);if(ue){let Ae=await Ml(ne,_,be.signal);if(Ae.type==="aborted")return;if(Ae.type==="error"){G(P,M,Ae.error,{flushSync:xe});return}else if(Ae.matches)ne=Ae.matches,V=Di(ne,_);else{G(P,M,It(404,{pathname:_}),{flushSync:xe});return}}J.set(P,ce);let Ee=H,Fe=(await Mr("loader",k,be,[V],ne,P))[V.route.id];if(or(Fe)&&(Fe=await hh(Fe,be.signal,!0)||Fe),J.get(P)===ce&&J.delete(P),!be.signal.aborted){if(F.has(P)){$(P,tr(void 0));return}if(Gr(Fe))if(X>Ee){$(P,tr(void 0));return}else{ae.add(P),await Mn(be,Fe,!1,{preventScrollReset:se});return}if(Wt(Fe)){G(P,M,Fe.error);return}je(!or(Fe),"Unhandled fetcher deferred data"),$(P,tr(Fe.data))}}async function Mn(P,M,_,V){let{submission:ne,fetcherSubmission:ue,preventScrollReset:xe,replace:se}=V===void 0?{}:V;M.response.headers.has("X-Remix-Revalidate")&&(U=!0);let ie=M.response.headers.get("Location");je(ie,"Expected a Location header on the redirect Response"),ie=wp(ie,new URL(P.url),u);let re=hl(k.location,ie,{_isRedirect:!0});if(n){let Ae=!1;if(M.response.headers.has("X-Remix-Reload-Document"))Ae=!0;else if(dh.test(ie)){const Ye=e.history.createURL(ie);Ae=Ye.origin!==t.location.origin||wn(Ye.pathname,u)==null}if(Ae){se?t.location.replace(ie):t.location.assign(ie);return}}D=null;let ce=se===!0||M.response.headers.has("X-Remix-Replace")?st.Replace:st.Push,{formMethod:be,formAction:Ee,formEncType:gt}=k.navigation;!ne&&!ue&&be&&Ee&&gt&&(ne=Tp(k.navigation));let Fe=ne||ue;if(Mk.has(M.response.status)&&Fe&&pn(Fe.formMethod))await en(ce,re,{submission:We({},Fe,{formAction:ie}),preventScrollReset:xe||T,enableViewTransition:_?C:void 0});else{let Ae=vu(re,ne);await en(ce,re,{overrideNavigation:Ae,fetcherSubmission:ue,preventScrollReset:xe||T,enableViewTransition:_?C:void 0})}}async function Mr(P,M,_,V,ne,ue){let xe,se={};try{xe=await Hk(c,P,M,_,V,ne,ue,l,i)}catch(ie){return V.forEach(re=>{se[re.route.id]={type:De.error,error:ie}}),se}for(let[ie,re]of Object.entries(xe))if(Kk(re)){let ce=re.result;se[ie]={type:De.redirect,response:Qk(ce,_,ie,ne,u,d.v7_relativeSplatPath)}}else se[ie]=await Vk(re);return se}async function Il(P,M,_,V,ne){let ue=P.matches,xe=Mr("loader",P,ne,_,M,null),se=Promise.all(V.map(async ce=>{if(ce.matches&&ce.match&&ce.controller){let Ee=(await Mr("loader",P,js(e.history,ce.path,ce.controller.signal),[ce.match],ce.matches,ce.key))[ce.match.route.id];return{[ce.key]:Ee}}else return Promise.resolve({[ce.key]:{type:De.error,error:It(404,{pathname:ce.path})}})})),ie=await xe,re=(await se).reduce((ce,be)=>Object.assign(ce,be),{});return await Promise.all([Xk(M,ie,ne.signal,ue,P.loaderData),Zk(M,re,V)]),{loaderResults:ie,fetcherResults:re}}function ci(){U=!0,I.push(...Sn()),O.forEach((P,M)=>{J.has(M)&&Q.add(M),Ce(M)})}function $(P,M,_){_===void 0&&(_={}),k.fetchers.set(P,M),W({fetchers:new Map(k.fetchers)},{flushSync:(_&&_.flushSync)===!0})}function G(P,M,_,V){V===void 0&&(V={});let ne=Wr(k.matches,M);me(P),W({errors:{[ne.route.id]:_},fetchers:new Map(k.fetchers)},{flushSync:(V&&V.flushSync)===!0})}function pe(P){return d.v7_fetcherPersist&&(N.set(P,(N.get(P)||0)+1),F.has(P)&&F.delete(P)),k.fetchers.get(P)||zk}function me(P){let M=k.fetchers.get(P);J.has(P)&&!(M&&M.state==="loading"&&S.has(P))&&Ce(P),O.delete(P),S.delete(P),ae.delete(P),F.delete(P),Q.delete(P),k.fetchers.delete(P)}function kt(P){if(d.v7_fetcherPersist){let M=(N.get(P)||0)-1;M<=0?(N.delete(P),F.add(P)):N.set(P,M)}else me(P);W({fetchers:new Map(k.fetchers)})}function Ce(P){let M=J.get(P);M&&(M.abort(),J.delete(P))}function pt(P){for(let M of P){let _=pe(M),V=tr(_.data);k.fetchers.set(M,V)}}function Ut(){let P=[],M=!1;for(let _ of ae){let V=k.fetchers.get(_);je(V,"Expected fetcher: "+_),V.state==="loading"&&(ae.delete(_),P.push(_),M=!0)}return pt(P),M}function Jn(P){let M=[];for(let[_,V]of S)if(V<P){let ne=k.fetchers.get(_);je(ne,"Expected fetcher: "+_),ne.state==="loading"&&(Ce(_),S.delete(_),M.push(_))}return pt(M),M.length>0}function zr(P,M){let _=k.blockers.get(P)||ks;return oe.get(P)!==M&&oe.set(P,M),_}function Xn(P){k.blockers.delete(P),oe.delete(P)}function _r(P,M){let _=k.blockers.get(P)||ks;je(_.state==="unblocked"&&M.state==="blocked"||_.state==="blocked"&&M.state==="blocked"||_.state==="blocked"&&M.state==="proceeding"||_.state==="blocked"&&M.state==="unblocked"||_.state==="proceeding"&&M.state==="unblocked","Invalid blocker state transition: "+_.state+" -> "+M.state);let V=new Map(k.blockers);V.set(P,M),W({blockers:V})}function ms(P){let{currentLocation:M,nextLocation:_,historyAction:V}=P;if(oe.size===0)return;oe.size>1&&Xs(!1,"A router only supports one blocker at a time");let ne=Array.from(oe.entries()),[ue,xe]=ne[ne.length-1],se=k.blockers.get(ue);if(!(se&&se.state==="proceeding")&&xe({currentLocation:M,nextLocation:_,historyAction:V}))return ue}function mt(P){let M=It(404,{pathname:P}),_=o||a,{matches:V,route:ne}=Cp(_);return Sn(),{notFoundMatches:V,route:ne,error:M}}function Sn(P){let M=[];return Z.forEach((_,V)=>{(!P||P(V))&&(_.cancel(),M.push(V),Z.delete(V))}),M}function cn(P,M,_){if(p=P,w=M,g=_||null,!x&&k.navigation===yu){x=!0;let V=tf(k.location,k.matches);V!=null&&W({restoreScrollPosition:V})}return()=>{p=null,w=null,g=null}}function ef(P,M){return g&&g(P,M.map(V=>fk(V,k.loaderData)))||P.key}function Pj(P,M){if(p&&w){let _=ef(P,M);p[_]=w()}}function tf(P,M){if(p){let _=ef(P,M),V=p[_];if(typeof V=="number")return V}return null}function Dl(P,M,_){if(h)if(P){if(Object.keys(P[0].params).length>0)return{active:!0,matches:ba(M,_,u,!0)}}else return{active:!0,matches:ba(M,_,u,!0)||[]};return{active:!1,matches:null}}async function Ml(P,M,_){if(!h)return{type:"success",matches:P};let V=P;for(;;){let ne=o==null,ue=o||a,xe=l;try{await h({path:M,matches:V,patch:(re,ce)=>{_.aborted||jp(re,ce,ue,xe,i)}})}catch(re){return{type:"error",error:re,partialMatches:V}}finally{ne&&!_.aborted&&(a=[...a])}if(_.aborted)return{type:"aborted"};let se=Hr(ue,M,u);if(se)return{type:"success",matches:se};let ie=ba(ue,M,u,!0);if(!ie||V.length===ie.length&&V.every((re,ce)=>re.route.id===ie[ce].route.id))return{type:"success",matches:null};V=ie}}function Rj(P){l={},o=Xa(P,i,void 0,l)}function Lj(P,M){let _=o==null;jp(P,M,o||a,l,i),_&&(a=[...a],W({}))}return E={get basename(){return u},get future(){return d},get state(){return k},get routes(){return a},get window(){return t},initialize:he,subscribe:Ke,enableScrollRestoration:cn,navigate:Ze,fetch:Ll,revalidate:Zt,createHref:P=>e.history.createHref(P),encodeLocation:P=>e.history.encodeLocation(P),getFetcher:pe,deleteFetcher:kt,dispose:ze,getBlocker:zr,deleteBlocker:Xn,patchRoutes:Lj,_internalFetchControllers:J,_internalActiveDeferreds:Z,_internalSetRoutes:Rj},E}function Ok(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function _c(e,t,n,r,i,l,a,o){let u,c;if(a){u=[];for(let d of t)if(u.push(d),d.route.id===a){c=d;break}}else u=t,c=t[t.length-1];let h=ch(i||".",uh(u,l),wn(e.pathname,n)||e.pathname,o==="path");if(i==null&&(h.search=e.search,h.hash=e.hash),(i==null||i===""||i===".")&&c){let d=fh(h.search);if(c.route.index&&!d)h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let f=new URLSearchParams(h.search),m=f.getAll("index");f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();h.search=p?"?"+p:""}}return r&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Bn([n,h.pathname])),ss(h)}function gp(e,t,n,r){if(!r||!Ok(r))return{path:n};if(r.formMethod&&!Jk(r.formMethod))return{path:n,error:It(405,{method:r.formMethod})};let i=()=>({path:n,error:It(400,{type:"invalid-body"})}),l=r.formMethod||"get",a=e?l.toUpperCase():l.toLowerCase(),o=xy(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!pn(a))return i();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,p)=>{let[g,w]=p;return""+m+g+"="+w+`
50
- `},""):String(r.body);return{path:n,submission:{formMethod:a,formAction:o,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!pn(a))return i();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:a,formAction:o,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return i()}}}je(typeof FormData=="function","FormData is not available in this environment");let u,c;if(r.formData)u=Oc(r.formData),c=r.formData;else if(r.body instanceof FormData)u=Oc(r.body),c=r.body;else if(r.body instanceof URLSearchParams)u=r.body,c=kp(u);else if(r.body==null)u=new URLSearchParams,c=new FormData;else try{u=new URLSearchParams(r.body),c=kp(u)}catch{return i()}let h={formMethod:a,formAction:o,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(pn(h.formMethod))return{path:n,submission:h};let d=Tr(n);return t&&d.search&&fh(d.search)&&u.append("index",""),d.search="?"+u,{path:ss(d),submission:h}}function xp(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(i=>i.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function yp(e,t,n,r,i,l,a,o,u,c,h,d,f,m,p,g){let w=g?Wt(g[1])?g[1].error:g[1].data:void 0,x=e.createURL(t.location),y=e.createURL(i),v=n;l&&t.errors?v=xp(n,Object.keys(t.errors)[0],!0):g&&Wt(g[1])&&(v=xp(n,g[0]));let b=g?g[1].statusCode:void 0,E=a&&b&&b>=400,k=v.filter((T,D)=>{let{route:C}=T;if(C.lazy)return!0;if(C.loader==null)return!1;if(l)return $c(C,t.loaderData,t.errors);if(Fk(t.loaderData,t.matches[D],T)||u.some(z=>z===T.route.id))return!0;let L=t.matches[D],A=T;return vp(T,We({currentUrl:x,currentParams:L.params,nextUrl:y,nextParams:A.params},r,{actionResult:w,actionStatus:b,defaultShouldRevalidate:E?!1:o||x.pathname+x.search===y.pathname+y.search||x.search!==y.search||my(L,A)}))}),R=[];return d.forEach((T,D)=>{if(l||!n.some(U=>U.route.id===T.routeId)||h.has(D))return;let C=Hr(m,T.path,p);if(!C){R.push({key:D,routeId:T.routeId,path:T.path,matches:null,match:null,controller:null});return}let L=t.fetchers.get(D),A=Di(C,T.path),z=!1;f.has(D)?z=!1:c.has(D)?(c.delete(D),z=!0):L&&L.state!=="idle"&&L.data===void 0?z=o:z=vp(A,We({currentUrl:x,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:w,actionStatus:b,defaultShouldRevalidate:E?!1:o})),z&&R.push({key:D,routeId:T.routeId,path:T.path,matches:C,match:A,controller:new AbortController})}),[k,R]}function $c(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,i=n!=null&&n[e.id]!==void 0;return!r&&i?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!i}function Fk(e,t,n){let r=!t||n.route.id!==t.route.id,i=e[n.route.id]===void 0;return r||i}function my(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function vp(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function jp(e,t,n,r,i){var l;let a;if(e){let c=r[e];je(c,"No route found to patch children into: routeId = "+e),c.children||(c.children=[]),a=c.children}else a=n;let o=t.filter(c=>!a.some(h=>gy(c,h))),u=Xa(o,i,[e||"_","patch",String(((l=a)==null?void 0:l.length)||"0")],r);a.push(...u)}function gy(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>{var i;return(i=t.children)==null?void 0:i.some(l=>gy(n,l))}):!1}async function Uk(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let i=n[e.id];je(i,"No route found in manifest");let l={};for(let a in r){let u=i[a]!==void 0&&a!=="hasErrorBoundary";Xs(!u,'Route "'+i.id+'" has a static property "'+a+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+a+'" will be ignored.')),!u&&!dk.has(a)&&(l[a]=r[a])}Object.assign(i,l),Object.assign(i,We({},t(i),{lazy:void 0}))}async function Bk(e){let{matches:t}=e,n=t.filter(i=>i.shouldLoad);return(await Promise.all(n.map(i=>i.resolve()))).reduce((i,l,a)=>Object.assign(i,{[n[a].route.id]:l}),{})}async function Hk(e,t,n,r,i,l,a,o,u,c){let h=l.map(m=>m.route.lazy?Uk(m.route,u,o):void 0),d=l.map((m,p)=>{let g=h[p],w=i.some(y=>y.route.id===m.route.id);return We({},m,{shouldLoad:w,resolve:async y=>(y&&r.method==="GET"&&(m.route.lazy||m.route.loader)&&(w=!0),w?Wk(t,r,m,g,y,c):Promise.resolve({type:De.data,result:void 0}))})}),f=await e({matches:d,request:r,params:l[0].params,fetcherKey:a,context:c});try{await Promise.all(h)}catch{}return f}async function Wk(e,t,n,r,i,l){let a,o,u=c=>{let h,d=new Promise((p,g)=>h=g);o=()=>h(),t.signal.addEventListener("abort",o);let f=p=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):c({request:t,params:n.params,context:l},...p!==void 0?[p]:[]),m=(async()=>{try{return{type:"data",result:await(i?i(g=>f(g)):f())}}catch(p){return{type:"error",result:p}}})();return Promise.race([m,d])};try{let c=n.route[e];if(r)if(c){let h,[d]=await Promise.all([u(c).catch(f=>{h=f}),r]);if(h!==void 0)throw h;a=d}else if(await r,c=n.route[e],c)a=await u(c);else if(e==="action"){let h=new URL(t.url),d=h.pathname+h.search;throw It(405,{method:t.method,pathname:d,routeId:n.route.id})}else return{type:De.data,result:void 0};else if(c)a=await u(c);else{let h=new URL(t.url),d=h.pathname+h.search;throw It(404,{pathname:d})}je(a.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:De.error,result:c}}finally{o&&t.signal.removeEventListener("abort",o)}return a}async function Vk(e){let{result:t,type:n}=e;if(yy(t)){let c;try{let h=t.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?t.body==null?c=null:c=await t.json():c=await t.text()}catch(h){return{type:De.error,error:h}}return n===De.error?{type:De.error,error:new eo(t.status,t.statusText,c),statusCode:t.status,headers:t.headers}:{type:De.data,data:c,statusCode:t.status,headers:t.headers}}if(n===De.error){if(Ep(t)){var r;if(t.data instanceof Error){var i;return{type:De.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status}}t=new eo(((r=t.init)==null?void 0:r.status)||500,void 0,t.data)}return{type:De.error,error:t,statusCode:To(t)?t.status:void 0}}if(Yk(t)){var l,a;return{type:De.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((a=t.init)==null?void 0:a.headers)&&new Headers(t.init.headers)}}if(Ep(t)){var o,u;return{type:De.data,data:t.data,statusCode:(o=t.init)==null?void 0:o.status,headers:(u=t.init)!=null&&u.headers?new Headers(t.init.headers):void 0}}return{type:De.data,data:t}}function Qk(e,t,n,r,i,l){let a=e.headers.get("Location");if(je(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!dh.test(a)){let o=r.slice(0,r.findIndex(u=>u.route.id===n)+1);a=_c(new URL(t.url),o,i,!0,a,l),e.headers.set("Location",a)}return e}function wp(e,t,n){if(dh.test(e)){let r=e,i=r.startsWith("//")?new URL(t.protocol+r):new URL(r),l=wn(i.pathname,n)!=null;if(i.origin===t.origin&&l)return i.pathname+i.search+i.hash}return e}function js(e,t,n,r){let i=e.createURL(xy(t)).toString(),l={signal:n};if(r&&pn(r.formMethod)){let{formMethod:a,formEncType:o}=r;l.method=a.toUpperCase(),o==="application/json"?(l.headers=new Headers({"Content-Type":o}),l.body=JSON.stringify(r.json)):o==="text/plain"?l.body=r.text:o==="application/x-www-form-urlencoded"&&r.formData?l.body=Oc(r.formData):l.body=r.formData}return new Request(i,l)}function Oc(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function kp(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function qk(e,t,n,r,i){let l={},a=null,o,u=!1,c={},h=n&&Wt(n[1])?n[1].error:void 0;return e.forEach(d=>{if(!(d.route.id in t))return;let f=d.route.id,m=t[f];if(je(!Gr(m),"Cannot handle redirect results in processLoaderData"),Wt(m)){let p=m.error;h!==void 0&&(p=h,h=void 0),a=a||{};{let g=Wr(e,f);a[g.route.id]==null&&(a[g.route.id]=p)}l[f]=void 0,u||(u=!0,o=To(m.error)?m.error.status:500),m.headers&&(c[f]=m.headers)}else or(m)?(r.set(f,m.deferredData),l[f]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[f]=m.headers)):(l[f]=m.data,m.statusCode&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[f]=m.headers))}),h!==void 0&&n&&(a={[n[0]]:h},l[n[0]]=void 0),{loaderData:l,errors:a,statusCode:o||200,loaderHeaders:c}}function bp(e,t,n,r,i,l,a){let{loaderData:o,errors:u}=qk(t,n,r,a);return i.forEach(c=>{let{key:h,match:d,controller:f}=c,m=l[h];if(je(m,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if(Wt(m)){let p=Wr(e.matches,d==null?void 0:d.route.id);u&&u[p.route.id]||(u=We({},u,{[p.route.id]:m.error})),e.fetchers.delete(h)}else if(Gr(m))je(!1,"Unhandled fetcher revalidation redirect");else if(or(m))je(!1,"Unhandled fetcher deferred data");else{let p=tr(m.data);e.fetchers.set(h,p)}}),{loaderData:o,errors:u}}function Sp(e,t,n,r){let i=We({},t);for(let l of n){let a=l.route.id;if(t.hasOwnProperty(a)?t[a]!==void 0&&(i[a]=t[a]):e[a]!==void 0&&l.route.loader&&(i[a]=e[a]),r&&r.hasOwnProperty(a))break}return i}function Np(e){return e?Wt(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Wr(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Cp(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function It(e,t){let{pathname:n,routeId:r,method:i,type:l,message:a}=t===void 0?{}:t,o="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(o="Bad Request",i&&n&&r?u="You made a "+i+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":l==="defer-action"?u="defer() is not supported in actions":l==="invalid-body"&&(u="Unable to encode submission body")):e===403?(o="Forbidden",u='Route "'+r+'" does not match URL "'+n+'"'):e===404?(o="Not Found",u='No route matches URL "'+n+'"'):e===405&&(o="Method Not Allowed",i&&n&&r?u="You made a "+i.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":i&&(u='Invalid request method "'+i.toUpperCase()+'"')),new eo(e||500,o,new Error(u),!0)}function ta(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,i]=t[n];if(Gr(i))return{key:r,result:i}}}function xy(e){let t=typeof e=="string"?Tr(e):e;return ss(We({},t,{hash:""}))}function Gk(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Kk(e){return yy(e.result)&&Dk.has(e.result.status)}function or(e){return e.type===De.deferred}function Wt(e){return e.type===De.error}function Gr(e){return(e&&e.type)===De.redirect}function Ep(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Yk(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function yy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Jk(e){return Ik.has(e.toLowerCase())}function pn(e){return Lk.has(e.toLowerCase())}async function Xk(e,t,n,r,i){let l=Object.entries(t);for(let a=0;a<l.length;a++){let[o,u]=l[a],c=e.find(f=>(f==null?void 0:f.route.id)===o);if(!c)continue;let h=r.find(f=>f.route.id===c.route.id),d=h!=null&&!my(h,c)&&(i&&i[c.route.id])!==void 0;or(u)&&d&&await hh(u,n,!1).then(f=>{f&&(t[o]=f)})}}async function Zk(e,t,n){for(let r=0;r<n.length;r++){let{key:i,routeId:l,controller:a}=n[r],o=t[i];e.find(c=>(c==null?void 0:c.route.id)===l)&&or(o)&&(je(a,"Expected an AbortController for revalidating fetcher deferred result"),await hh(o,a.signal,!0).then(c=>{c&&(t[i]=c)}))}}async function hh(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:De.data,data:e.deferredData.unwrappedData}}catch(i){return{type:De.error,error:i}}return{type:De.data,data:e.deferredData.data}}}function fh(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Di(e,t){let n=typeof t=="string"?Tr(t).search:t.search;if(e[e.length-1].route.index&&fh(n||""))return e[e.length-1];let r=hy(e);return r[r.length-1]}function Tp(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:l,json:a}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(l!=null)return{formMethod:t,formAction:n,formEncType:r,formData:l,json:void 0,text:void 0};if(a!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:a,text:void 0}}}function vu(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function e0(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function ki(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function t0(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function tr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function n0(e,t){try{let n=e.sessionStorage.getItem(py);if(n){let r=JSON.parse(n);for(let[i,l]of Object.entries(r||{}))l&&Array.isArray(l)&&t.set(i,new Set(l||[]))}}catch{}}function r0(e,t){if(t.size>0){let n={};for(let[r,i]of t)n[r]=[...i];try{e.sessionStorage.setItem(py,JSON.stringify(n))}catch(r){Xs(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
49
+ */function Ve(){return Ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ve.apply(this,arguments)}var st;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(st||(st={}));const fp="popstate";function ck(e){e===void 0&&(e={});function t(r,i){let{pathname:l,search:a,hash:o}=r.location;return dl("",{pathname:l,search:a,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:is(i)}return hk(t,n,null,e)}function we(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function dk(){return Math.random().toString(36).substr(2,8)}function pp(e,t){return{usr:e.state,key:e.key,idx:t}}function dl(e,t,n,r){return n===void 0&&(n=null),Ve({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pr(t):t,{state:n,key:t&&t.key||r||dk()})}function is(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Pr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function hk(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:l=!1}=r,a=i.history,o=st.Pop,u=null,c=h();c==null&&(c=0,a.replaceState(Ve({},a.state,{idx:c}),""));function h(){return(a.state||{idx:null}).idx}function d(){o=st.Pop;let w=h(),x=w==null?null:w-c;c=w,u&&u({action:o,location:g.location,delta:x})}function f(w,x){o=st.Push;let y=dl(g.location,w,x);c=h()+1;let v=pp(y,c),b=g.createHref(y);try{a.pushState(v,"",b)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;i.location.assign(b)}l&&u&&u({action:o,location:g.location,delta:1})}function m(w,x){o=st.Replace;let y=dl(g.location,w,x);c=h();let v=pp(y,c),b=g.createHref(y);a.replaceState(v,"",b),l&&u&&u({action:o,location:g.location,delta:0})}function p(w){let x=i.location.origin!=="null"?i.location.origin:i.location.href,y=typeof w=="string"?w:is(w);return y=y.replace(/ $/,"%20"),we(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let g={get action(){return o},get location(){return e(i,a)},listen(w){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(fp,d),u=w,()=>{i.removeEventListener(fp,d),u=null}},createHref(w){return t(i,w)},createURL:p,encodeLocation(w){let x=p(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:m,go(w){return a.go(w)}};return g}var ze;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ze||(ze={}));const fk=new Set(["lazy","caseSensitive","path","id","index","children"]);function pk(e){return e.index===!0}function Ja(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((i,l)=>{let a=[...n,String(l)],o=typeof i.id=="string"?i.id:a.join("-");if(we(i.index!==!0||!i.children,"Cannot specify children on an index route"),we(!r[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),pk(i)){let u=Ve({},i,t(i),{id:o});return r[o]=u,u}else{let u=Ve({},i,t(i),{id:o,children:void 0});return r[o]=u,i.children&&(u.children=Ja(i.children,t,a,r)),u}})}function Wr(e,t,n){return n===void 0&&(n="/"),ka(e,t,n,!1)}function ka(e,t,n,r){let i=typeof t=="string"?Pr(t):t,l=wn(i.pathname||"/",n);if(l==null)return null;let a=cy(e);gk(a);let o=null;for(let u=0;o==null&&u<a.length;++u){let c=Ek(l);o=Nk(a[u],c,r)}return o}function mk(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],handle:n.handle}}function cy(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(l,a,o)=>{let u={relativePath:o===void 0?l.path||"":o,caseSensitive:l.caseSensitive===!0,childrenIndex:a,route:l};u.relativePath.startsWith("/")&&(we(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let c=Bn([r,u.relativePath]),h=n.concat(u);l.children&&l.children.length>0&&(we(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),cy(l.children,t,h,c)),!(l.path==null&&!l.index)&&t.push({path:c,score:bk(c,l.index),routesMeta:h})};return e.forEach((l,a)=>{var o;if(l.path===""||!((o=l.path)!=null&&o.includes("?")))i(l,a);else for(let u of dy(l.path))i(l,a,u)}),t}function dy(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return i?[l,""]:[l];let a=dy(r.join("/")),o=[];return o.push(...a.map(u=>u===""?l:[l,u].join("/"))),i&&o.push(...a),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function gk(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Sk(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const xk=/^:[\w-]+$/,yk=3,vk=2,jk=1,wk=10,kk=-2,mp=e=>e==="*";function bk(e,t){let n=e.split("/"),r=n.length;return n.some(mp)&&(r+=kk),t&&(r+=vk),n.filter(i=>!mp(i)).reduce((i,l)=>i+(xk.test(l)?yk:l===""?jk:wk),r)}function Sk(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function Nk(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},l="/",a=[];for(let o=0;o<r.length;++o){let u=r[o],c=o===r.length-1,h=l==="/"?t:t.slice(l.length)||"/",d=Xa({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},h),f=u.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Xa({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!d)return null;Object.assign(i,d.params),a.push({params:i,pathname:Bn([l,d.pathname]),pathnameBase:Rk(Bn([l,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(l=Bn([l,d.pathnameBase]))}return a}function Xa(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ck(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let l=i[0],a=l.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:r.reduce((c,h,d)=>{let{paramName:f,isOptional:m}=h;if(f==="*"){let g=o[d]||"";a=l.slice(0,l.length-g.length).replace(/(.)\/+$/,"$1")}const p=o[d];return m&&!p?c[f]=void 0:c[f]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:l,pathnameBase:a,pattern:e}}function Ck(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Xs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function Ek(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xs(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function wn(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Tk(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Pr(e):e;return{pathname:n?n.startsWith("/")?n:Pk(n,t):t,search:Lk(r),hash:Ak(i)}}function Pk(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function xu(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function hy(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function uh(e,t){let n=hy(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ch(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Pr(e):(i=Ve({},e),we(!i.pathname||!i.pathname.includes("?"),xu("?","pathname","search",i)),we(!i.pathname||!i.pathname.includes("#"),xu("#","pathname","hash",i)),we(!i.search||!i.search.includes("#"),xu("#","search","hash",i)));let l=e===""||i.pathname==="",a=l?"/":i.pathname,o;if(a==null)o=n;else{let d=t.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?t[d]:"/"}let u=Tk(i,o),c=a&&a!=="/"&&a.endsWith("/"),h=(l||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||h)&&(u.pathname+="/"),u}const Bn=e=>e.join("/").replace(/\/\/+/g,"/"),Rk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Lk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ak=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Za{constructor(t,n,r,i){i===void 0&&(i=!1),this.status=t,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function To(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const fy=["post","put","patch","delete"],Ik=new Set(fy),Dk=["get",...fy],Mk=new Set(Dk),zk=new Set([301,302,303,307,308]),_k=new Set([307,308]),yu={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},$k={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ks={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},dh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ok=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),py="remix-router-transitions";function Fk(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;we(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let P=e.detectErrorBoundary;i=M=>({hasErrorBoundary:P(M)})}else i=Ok;let l={},a=Ja(e.routes,i,void 0,l),o,u=e.basename||"/",c=e.dataStrategy||Wk,h=e.patchRoutesOnNavigation,d=Ve({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,m=new Set,p=null,g=null,w=null,x=e.hydrationData!=null,y=Wr(a,e.history.location,u),v=null;if(y==null&&!h){let P=Dt(404,{pathname:e.history.location.pathname}),{matches:M,route:_}=Cp(a);y=M,v={[_.id]:P}}y&&!e.hydrationData&&Il(y,a,e.history.location.pathname).active&&(y=null);let b;if(y)if(y.some(P=>P.route.lazy))b=!1;else if(!y.some(P=>P.route.loader))b=!0;else if(d.v7_partialHydration){let P=e.hydrationData?e.hydrationData.loaderData:null,M=e.hydrationData?e.hydrationData.errors:null;if(M){let _=y.findIndex(H=>M[H.route.id]!==void 0);b=y.slice(0,_+1).every(H=>!$c(H.route,P,M))}else b=y.every(_=>!$c(_.route,P,M))}else b=e.hydrationData!=null;else if(b=!1,y=[],d.v7_partialHydration){let P=Il(null,a,e.history.location.pathname);P.active&&P.matches&&(y=P.matches)}let E,k={historyAction:e.history.action,location:e.history.location,matches:y,initialized:b,navigation:yu,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||v,fetchers:new Map,blockers:new Map},R=st.Pop,T=!1,D,C=!1,L=new Map,A=null,z=!1,U=!1,I=[],Q=new Set,J=new Map,B=0,X=-1,S=new Map,ae=new Set,O=new Map,N=new Map,F=new Set,Z=new Map,ce=new Map,Te;function tt(){if(f=e.history.listen(P=>{let{action:M,location:_,delta:H}=P;if(Te){Te(),Te=void 0;return}Xs(ce.size===0||H!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ne=ms({currentLocation:k.location,nextLocation:_,historyAction:M});if(ne&&H!=null){let oe=new Promise(xe=>{Te=xe});e.history.go(H*-1),$r(ne,{state:"blocked",location:_,proceed(){$r(ne,{state:"proceeding",proceed:void 0,reset:void 0,location:_}),oe.then(()=>e.history.go(H))},reset(){let xe=new Map(k.blockers);xe.set(ne,ks),V({blockers:xe})}});return}return en(M,_)}),n){s0(t,L);let P=()=>i0(t,L);t.addEventListener("pagehide",P),A=()=>t.removeEventListener("pagehide",P)}return k.initialized||en(st.Pop,k.location,{initialHydration:!0}),E}function W(){f&&f(),A&&A(),m.clear(),D&&D.abort(),k.fetchers.forEach((P,M)=>pe(M)),k.blockers.forEach((P,M)=>Xn(M))}function ge(P){return m.add(P),()=>m.delete(P)}function V(P,M){M===void 0&&(M={}),k=Ve({},k,P);let _=[],H=[];d.v7_fetcherPersist&&k.fetchers.forEach((ne,oe)=>{ne.state==="idle"&&(F.has(oe)?H.push(oe):_.push(oe))}),[...m].forEach(ne=>ne(k,{deletedFetchers:H,viewTransitionOpts:M.viewTransitionOpts,flushSync:M.flushSync===!0})),d.v7_fetcherPersist&&(_.forEach(ne=>k.fetchers.delete(ne)),H.forEach(ne=>pe(ne)))}function de(P,M,_){var H,ne;let{flushSync:oe}=_===void 0?{}:_,xe=k.actionData!=null&&k.navigation.formMethod!=null&&pn(k.navigation.formMethod)&&k.navigation.state==="loading"&&((H=P.state)==null?void 0:H._isRedirect)!==!0,se;M.actionData?Object.keys(M.actionData).length>0?se=M.actionData:se=null:xe?se=k.actionData:se=null;let ie=M.loaderData?Sp(k.loaderData,M.loaderData,M.matches||[],M.errors):k.loaderData,re=k.blockers;re.size>0&&(re=new Map(re),re.forEach((Pe,gt)=>re.set(gt,ks)));let ue=T===!0||k.navigation.formMethod!=null&&pn(k.navigation.formMethod)&&((ne=P.state)==null?void 0:ne._isRedirect)!==!0;o&&(a=o,o=void 0),z||R===st.Pop||(R===st.Push?e.history.push(P,P.state):R===st.Replace&&e.history.replace(P,P.state));let Se;if(R===st.Pop){let Pe=L.get(k.location.pathname);Pe&&Pe.has(P.pathname)?Se={currentLocation:k.location,nextLocation:P}:L.has(P.pathname)&&(Se={currentLocation:P,nextLocation:k.location})}else if(C){let Pe=L.get(k.location.pathname);Pe?Pe.add(P.pathname):(Pe=new Set([P.pathname]),L.set(k.location.pathname,Pe)),Se={currentLocation:k.location,nextLocation:P}}V(Ve({},M,{actionData:se,loaderData:ie,historyAction:R,location:P,initialized:!0,navigation:yu,revalidation:"idle",restoreScrollPosition:tf(P,M.matches||k.matches),preventScrollReset:ue,blockers:re}),{viewTransitionOpts:Se,flushSync:oe===!0}),R=st.Pop,T=!1,C=!1,z=!1,U=!1,I=[]}async function ve(P,M){if(typeof P=="number"){e.history.go(P);return}let _=_c(k.location,k.matches,u,d.v7_prependBasename,P,d.v7_relativeSplatPath,M==null?void 0:M.fromRouteId,M==null?void 0:M.relative),{path:H,submission:ne,error:oe}=gp(d.v7_normalizeFormMethod,!1,_,M),xe=k.location,se=dl(k.location,H,M&&M.state);se=Ve({},se,e.history.encodeLocation(se));let ie=M&&M.replace!=null?M.replace:void 0,re=st.Push;ie===!0?re=st.Replace:ie===!1||ne!=null&&pn(ne.formMethod)&&ne.formAction===k.location.pathname+k.location.search&&(re=st.Replace);let ue=M&&"preventScrollReset"in M?M.preventScrollReset===!0:void 0,Se=(M&&M.flushSync)===!0,Pe=ms({currentLocation:xe,nextLocation:se,historyAction:re});if(Pe){$r(Pe,{state:"blocked",location:se,proceed(){$r(Pe,{state:"proceeding",proceed:void 0,reset:void 0,location:se}),ve(P,M)},reset(){let gt=new Map(k.blockers);gt.set(Pe,ks),V({blockers:gt})}});return}return await en(re,se,{submission:ne,pendingError:oe,preventScrollReset:ue,replace:M&&M.replace,enableViewTransition:M&&M.viewTransition,flushSync:Se})}function ct(){if(ci(),V({revalidation:"loading"}),k.navigation.state!=="submitting"){if(k.navigation.state==="idle"){en(k.historyAction,k.location,{startUninterruptedRevalidation:!0});return}en(R||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:C===!0})}}async function en(P,M,_){D&&D.abort(),D=null,R=P,z=(_&&_.startUninterruptedRevalidation)===!0,Lj(k.location,k.matches),T=(_&&_.preventScrollReset)===!0,C=(_&&_.enableViewTransition)===!0;let H=o||a,ne=_&&_.overrideNavigation,oe=Wr(H,M,u),xe=(_&&_.flushSync)===!0,se=Il(oe,H,M.pathname);if(se.active&&se.matches&&(oe=se.matches),!oe){let{error:Ue,notFoundMatches:De,route:Ye}=mt(M.pathname);de(M,{matches:De,loaderData:{},errors:{[Ye.id]:Ue}},{flushSync:xe});return}if(k.initialized&&!U&&Yk(k.location,M)&&!(_&&_.submission&&pn(_.submission.formMethod))){de(M,{matches:oe},{flushSync:xe});return}D=new AbortController;let ie=js(e.history,M,D.signal,_&&_.submission),re;if(_&&_.pendingError)re=[Vr(oe).route.id,{type:ze.error,error:_.pendingError}];else if(_&&_.submission&&pn(_.submission.formMethod)){let Ue=await ee(ie,M,_.submission,oe,se.active,{replace:_.replace,flushSync:xe});if(Ue.shortCircuited)return;if(Ue.pendingActionResult){let[De,Ye]=Ue.pendingActionResult;if(Vt(Ye)&&To(Ye.error)&&Ye.error.status===404){D=null,de(M,{matches:Ue.matches,loaderData:{},errors:{[De]:Ye.error}});return}}oe=Ue.matches||oe,re=Ue.pendingActionResult,ne=vu(M,_.submission),xe=!1,se.active=!1,ie=js(e.history,ie.url,ie.signal)}let{shortCircuited:ue,matches:Se,loaderData:Pe,errors:gt}=await Ce(ie,M,oe,se.active,ne,_&&_.submission,_&&_.fetcherSubmission,_&&_.replace,_&&_.initialHydration===!0,xe,re);ue||(D=null,de(M,Ve({matches:Se||oe},Np(re),{loaderData:Pe,errors:gt})))}async function ee(P,M,_,H,ne,oe){oe===void 0&&(oe={}),ci();let xe=n0(M,_);if(V({navigation:xe},{flushSync:oe.flushSync===!0}),ne){let re=await Dl(H,M.pathname,P.signal);if(re.type==="aborted")return{shortCircuited:!0};if(re.type==="error"){let ue=Vr(re.partialMatches).route.id;return{matches:re.partialMatches,pendingActionResult:[ue,{type:ze.error,error:re.error}]}}else if(re.matches)H=re.matches;else{let{notFoundMatches:ue,error:Se,route:Pe}=mt(M.pathname);return{matches:ue,pendingActionResult:[Pe.id,{type:ze.error,error:Se}]}}}let se,ie=Di(H,M);if(!ie.route.action&&!ie.route.lazy)se={type:ze.error,error:Dt(405,{method:P.method,pathname:M.pathname,routeId:ie.route.id})};else if(se=(await zr("action",k,P,[ie],H,null))[ie.route.id],P.signal.aborted)return{shortCircuited:!0};if(Kr(se)){let re;return oe&&oe.replace!=null?re=oe.replace:re=wp(se.response.headers.get("Location"),new URL(P.url),u)===k.location.pathname+k.location.search,await Mn(P,se,!0,{submission:_,replace:re}),{shortCircuited:!0}}if(or(se))throw Dt(400,{type:"defer-action"});if(Vt(se)){let re=Vr(H,ie.route.id);return(oe&&oe.replace)!==!0&&(R=st.Push),{matches:H,pendingActionResult:[re.route.id,se]}}return{matches:H,pendingActionResult:[ie.route.id,se]}}async function Ce(P,M,_,H,ne,oe,xe,se,ie,re,ue){let Se=ne||vu(M,oe),Pe=oe||xe||Tp(Se),gt=!z&&(!d.v7_partialHydration||!ie);if(H){if(gt){let Je=Ze(ue);V(Ve({navigation:Se},Je!==void 0?{actionData:Je}:{}),{flushSync:re})}let Ae=await Dl(_,M.pathname,P.signal);if(Ae.type==="aborted")return{shortCircuited:!0};if(Ae.type==="error"){let Je=Vr(Ae.partialMatches).route.id;return{matches:Ae.partialMatches,loaderData:{},errors:{[Je]:Ae.error}}}else if(Ae.matches)_=Ae.matches;else{let{error:Je,notFoundMatches:xs,route:fi}=mt(M.pathname);return{matches:xs,loaderData:{},errors:{[fi.id]:Je}}}}let Ue=o||a,[De,Ye]=yp(e.history,k,_,Pe,M,d.v7_partialHydration&&ie===!0,d.v7_skipActionErrorRevalidation,U,I,Q,F,O,ae,Ue,u,ue);if(bn(Ae=>!(_&&_.some(Je=>Je.route.id===Ae))||De&&De.some(Je=>Je.route.id===Ae)),X=++B,De.length===0&&Ye.length===0){let Ae=Bt();return de(M,Ve({matches:_,loaderData:{},errors:ue&&Vt(ue[1])?{[ue[0]]:ue[1].error}:null},Np(ue),Ae?{fetchers:new Map(k.fetchers)}:{}),{flushSync:re}),{shortCircuited:!0}}if(gt){let Ae={};if(!H){Ae.navigation=Se;let Je=Ze(ue);Je!==void 0&&(Ae.actionData=Je)}Ye.length>0&&(Ae.fetchers=Mr(Ye)),V(Ae,{flushSync:re})}Ye.forEach(Ae=>{Ee(Ae.key),Ae.controller&&J.set(Ae.key,Ae.controller)});let gs=()=>Ye.forEach(Ae=>Ee(Ae.key));D&&D.signal.addEventListener("abort",gs);let{loaderResults:di,fetcherResults:zn}=await Al(k,_,De,Ye,P);if(P.signal.aborted)return{shortCircuited:!0};D&&D.signal.removeEventListener("abort",gs),Ye.forEach(Ae=>J.delete(Ae.key));let Sn=ea(di);if(Sn)return await Mn(P,Sn.result,!0,{replace:se}),{shortCircuited:!0};if(Sn=ea(zn),Sn)return ae.add(Sn.key),await Mn(P,Sn.result,!0,{replace:se}),{shortCircuited:!0};let{loaderData:Wo,errors:hi}=bp(k,_,di,ue,Ye,zn,Z);Z.forEach((Ae,Je)=>{Ae.subscribe(xs=>{(xs||Ae.done)&&Z.delete(Je)})}),d.v7_partialHydration&&ie&&k.errors&&(hi=Ve({},k.errors,hi));let Or=Bt(),Ml=Jn(X),zl=Or||Ml||Ye.length>0;return Ve({matches:_,loaderData:Wo,errors:hi},zl?{fetchers:new Map(k.fetchers)}:{})}function Ze(P){if(P&&!Vt(P[1]))return{[P[0]]:P[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Mr(P){return P.forEach(M=>{let _=k.fetchers.get(M.key),H=ki(void 0,_?_.data:void 0);k.fetchers.set(M.key,H)}),new Map(k.fetchers)}function Rl(P,M,_,H){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ee(P);let ne=(H&&H.flushSync)===!0,oe=o||a,xe=_c(k.location,k.matches,u,d.v7_prependBasename,_,d.v7_relativeSplatPath,M,H==null?void 0:H.relative),se=Wr(oe,xe,u),ie=Il(se,oe,xe);if(ie.active&&ie.matches&&(se=ie.matches),!se){G(P,M,Dt(404,{pathname:xe}),{flushSync:ne});return}let{path:re,submission:ue,error:Se}=gp(d.v7_normalizeFormMethod,!0,xe,H);if(Se){G(P,M,Se,{flushSync:ne});return}let Pe=Di(se,re),gt=(H&&H.preventScrollReset)===!0;if(ue&&pn(ue.formMethod)){Ll(P,M,re,Pe,se,ie.active,ne,gt,ue);return}O.set(P,{routeId:M,path:re}),Ho(P,M,re,Pe,se,ie.active,ne,gt,ue)}async function Ll(P,M,_,H,ne,oe,xe,se,ie){ci(),O.delete(P);function re(nt){if(!nt.route.action&&!nt.route.lazy){let ys=Dt(405,{method:ie.formMethod,pathname:_,routeId:M});return G(P,M,ys,{flushSync:xe}),!0}return!1}if(!oe&&re(H))return;let ue=k.fetchers.get(P);$(P,r0(ie,ue),{flushSync:xe});let Se=new AbortController,Pe=js(e.history,_,Se.signal,ie);if(oe){let nt=await Dl(ne,_,Pe.signal);if(nt.type==="aborted")return;if(nt.type==="error"){G(P,M,nt.error,{flushSync:xe});return}else if(nt.matches){if(ne=nt.matches,H=Di(ne,_),re(H))return}else{G(P,M,Dt(404,{pathname:_}),{flushSync:xe});return}}J.set(P,Se);let gt=B,De=(await zr("action",k,Pe,[H],ne,P))[H.route.id];if(Pe.signal.aborted){J.get(P)===Se&&J.delete(P);return}if(d.v7_fetcherPersist&&F.has(P)){if(Kr(De)||Vt(De)){$(P,tr(void 0));return}}else{if(Kr(De))if(J.delete(P),X>gt){$(P,tr(void 0));return}else return ae.add(P),$(P,ki(ie)),Mn(Pe,De,!1,{fetcherSubmission:ie,preventScrollReset:se});if(Vt(De)){G(P,M,De.error);return}}if(or(De))throw Dt(400,{type:"defer-action"});let Ye=k.navigation.location||k.location,gs=js(e.history,Ye,Se.signal),di=o||a,zn=k.navigation.state!=="idle"?Wr(di,k.navigation.location,u):k.matches;we(zn,"Didn't find any matches after fetcher action");let Sn=++B;S.set(P,Sn);let Wo=ki(ie,De.data);k.fetchers.set(P,Wo);let[hi,Or]=yp(e.history,k,zn,ie,Ye,!1,d.v7_skipActionErrorRevalidation,U,I,Q,F,O,ae,di,u,[H.route.id,De]);Or.filter(nt=>nt.key!==P).forEach(nt=>{let ys=nt.key,nf=k.fetchers.get(ys),Dj=ki(void 0,nf?nf.data:void 0);k.fetchers.set(ys,Dj),Ee(ys),nt.controller&&J.set(ys,nt.controller)}),V({fetchers:new Map(k.fetchers)});let Ml=()=>Or.forEach(nt=>Ee(nt.key));Se.signal.addEventListener("abort",Ml);let{loaderResults:zl,fetcherResults:Ae}=await Al(k,zn,hi,Or,gs);if(Se.signal.aborted)return;Se.signal.removeEventListener("abort",Ml),S.delete(P),J.delete(P),Or.forEach(nt=>J.delete(nt.key));let Je=ea(zl);if(Je)return Mn(gs,Je.result,!1,{preventScrollReset:se});if(Je=ea(Ae),Je)return ae.add(Je.key),Mn(gs,Je.result,!1,{preventScrollReset:se});let{loaderData:xs,errors:fi}=bp(k,zn,zl,void 0,Or,Ae,Z);if(k.fetchers.has(P)){let nt=tr(De.data);k.fetchers.set(P,nt)}Jn(Sn),k.navigation.state==="loading"&&Sn>X?(we(R,"Expected pending action"),D&&D.abort(),de(k.navigation.location,{matches:zn,loaderData:xs,errors:fi,fetchers:new Map(k.fetchers)})):(V({errors:fi,loaderData:Sp(k.loaderData,xs,zn,fi),fetchers:new Map(k.fetchers)}),U=!1)}async function Ho(P,M,_,H,ne,oe,xe,se,ie){let re=k.fetchers.get(P);$(P,ki(ie,re?re.data:void 0),{flushSync:xe});let ue=new AbortController,Se=js(e.history,_,ue.signal);if(oe){let De=await Dl(ne,_,Se.signal);if(De.type==="aborted")return;if(De.type==="error"){G(P,M,De.error,{flushSync:xe});return}else if(De.matches)ne=De.matches,H=Di(ne,_);else{G(P,M,Dt(404,{pathname:_}),{flushSync:xe});return}}J.set(P,ue);let Pe=B,Ue=(await zr("loader",k,Se,[H],ne,P))[H.route.id];if(or(Ue)&&(Ue=await hh(Ue,Se.signal,!0)||Ue),J.get(P)===ue&&J.delete(P),!Se.signal.aborted){if(F.has(P)){$(P,tr(void 0));return}if(Kr(Ue))if(X>Pe){$(P,tr(void 0));return}else{ae.add(P),await Mn(Se,Ue,!1,{preventScrollReset:se});return}if(Vt(Ue)){G(P,M,Ue.error);return}we(!or(Ue),"Unhandled fetcher deferred data"),$(P,tr(Ue.data))}}async function Mn(P,M,_,H){let{submission:ne,fetcherSubmission:oe,preventScrollReset:xe,replace:se}=H===void 0?{}:H;M.response.headers.has("X-Remix-Revalidate")&&(U=!0);let ie=M.response.headers.get("Location");we(ie,"Expected a Location header on the redirect Response"),ie=wp(ie,new URL(P.url),u);let re=dl(k.location,ie,{_isRedirect:!0});if(n){let De=!1;if(M.response.headers.has("X-Remix-Reload-Document"))De=!0;else if(dh.test(ie)){const Ye=e.history.createURL(ie);De=Ye.origin!==t.location.origin||wn(Ye.pathname,u)==null}if(De){se?t.location.replace(ie):t.location.assign(ie);return}}D=null;let ue=se===!0||M.response.headers.has("X-Remix-Replace")?st.Replace:st.Push,{formMethod:Se,formAction:Pe,formEncType:gt}=k.navigation;!ne&&!oe&&Se&&Pe&&gt&&(ne=Tp(k.navigation));let Ue=ne||oe;if(_k.has(M.response.status)&&Ue&&pn(Ue.formMethod))await en(ue,re,{submission:Ve({},Ue,{formAction:ie}),preventScrollReset:xe||T,enableViewTransition:_?C:void 0});else{let De=vu(re,ne);await en(ue,re,{overrideNavigation:De,fetcherSubmission:oe,preventScrollReset:xe||T,enableViewTransition:_?C:void 0})}}async function zr(P,M,_,H,ne,oe){let xe,se={};try{xe=await Vk(c,P,M,_,H,ne,oe,l,i)}catch(ie){return H.forEach(re=>{se[re.route.id]={type:ze.error,error:ie}}),se}for(let[ie,re]of Object.entries(xe))if(Jk(re)){let ue=re.result;se[ie]={type:ze.redirect,response:Gk(ue,_,ie,ne,u,d.v7_relativeSplatPath)}}else se[ie]=await qk(re);return se}async function Al(P,M,_,H,ne){let oe=P.matches,xe=zr("loader",P,ne,_,M,null),se=Promise.all(H.map(async ue=>{if(ue.matches&&ue.match&&ue.controller){let Pe=(await zr("loader",P,js(e.history,ue.path,ue.controller.signal),[ue.match],ue.matches,ue.key))[ue.match.route.id];return{[ue.key]:Pe}}else return Promise.resolve({[ue.key]:{type:ze.error,error:Dt(404,{pathname:ue.path})}})})),ie=await xe,re=(await se).reduce((ue,Se)=>Object.assign(ue,Se),{});return await Promise.all([e0(M,ie,ne.signal,oe,P.loaderData),t0(M,re,H)]),{loaderResults:ie,fetcherResults:re}}function ci(){U=!0,I.push(...bn()),O.forEach((P,M)=>{J.has(M)&&Q.add(M),Ee(M)})}function $(P,M,_){_===void 0&&(_={}),k.fetchers.set(P,M),V({fetchers:new Map(k.fetchers)},{flushSync:(_&&_.flushSync)===!0})}function G(P,M,_,H){H===void 0&&(H={});let ne=Vr(k.matches,M);pe(P),V({errors:{[ne.route.id]:_},fetchers:new Map(k.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function fe(P){return d.v7_fetcherPersist&&(N.set(P,(N.get(P)||0)+1),F.has(P)&&F.delete(P)),k.fetchers.get(P)||$k}function pe(P){let M=k.fetchers.get(P);J.has(P)&&!(M&&M.state==="loading"&&S.has(P))&&Ee(P),O.delete(P),S.delete(P),ae.delete(P),F.delete(P),Q.delete(P),k.fetchers.delete(P)}function bt(P){if(d.v7_fetcherPersist){let M=(N.get(P)||0)-1;M<=0?(N.delete(P),F.add(P)):N.set(P,M)}else pe(P);V({fetchers:new Map(k.fetchers)})}function Ee(P){let M=J.get(P);M&&(M.abort(),J.delete(P))}function pt(P){for(let M of P){let _=fe(M),H=tr(_.data);k.fetchers.set(M,H)}}function Bt(){let P=[],M=!1;for(let _ of ae){let H=k.fetchers.get(_);we(H,"Expected fetcher: "+_),H.state==="loading"&&(ae.delete(_),P.push(_),M=!0)}return pt(P),M}function Jn(P){let M=[];for(let[_,H]of S)if(H<P){let ne=k.fetchers.get(_);we(ne,"Expected fetcher: "+_),ne.state==="loading"&&(Ee(_),S.delete(_),M.push(_))}return pt(M),M.length>0}function _r(P,M){let _=k.blockers.get(P)||ks;return ce.get(P)!==M&&ce.set(P,M),_}function Xn(P){k.blockers.delete(P),ce.delete(P)}function $r(P,M){let _=k.blockers.get(P)||ks;we(_.state==="unblocked"&&M.state==="blocked"||_.state==="blocked"&&M.state==="blocked"||_.state==="blocked"&&M.state==="proceeding"||_.state==="blocked"&&M.state==="unblocked"||_.state==="proceeding"&&M.state==="unblocked","Invalid blocker state transition: "+_.state+" -> "+M.state);let H=new Map(k.blockers);H.set(P,M),V({blockers:H})}function ms(P){let{currentLocation:M,nextLocation:_,historyAction:H}=P;if(ce.size===0)return;ce.size>1&&Xs(!1,"A router only supports one blocker at a time");let ne=Array.from(ce.entries()),[oe,xe]=ne[ne.length-1],se=k.blockers.get(oe);if(!(se&&se.state==="proceeding")&&xe({currentLocation:M,nextLocation:_,historyAction:H}))return oe}function mt(P){let M=Dt(404,{pathname:P}),_=o||a,{matches:H,route:ne}=Cp(_);return bn(),{notFoundMatches:H,route:ne,error:M}}function bn(P){let M=[];return Z.forEach((_,H)=>{(!P||P(H))&&(_.cancel(),M.push(H),Z.delete(H))}),M}function cn(P,M,_){if(p=P,w=M,g=_||null,!x&&k.navigation===yu){x=!0;let H=tf(k.location,k.matches);H!=null&&V({restoreScrollPosition:H})}return()=>{p=null,w=null,g=null}}function ef(P,M){return g&&g(P,M.map(H=>mk(H,k.loaderData)))||P.key}function Lj(P,M){if(p&&w){let _=ef(P,M);p[_]=w()}}function tf(P,M){if(p){let _=ef(P,M),H=p[_];if(typeof H=="number")return H}return null}function Il(P,M,_){if(h)if(P){if(Object.keys(P[0].params).length>0)return{active:!0,matches:ka(M,_,u,!0)}}else return{active:!0,matches:ka(M,_,u,!0)||[]};return{active:!1,matches:null}}async function Dl(P,M,_){if(!h)return{type:"success",matches:P};let H=P;for(;;){let ne=o==null,oe=o||a,xe=l;try{await h({path:M,matches:H,patch:(re,ue)=>{_.aborted||jp(re,ue,oe,xe,i)}})}catch(re){return{type:"error",error:re,partialMatches:H}}finally{ne&&!_.aborted&&(a=[...a])}if(_.aborted)return{type:"aborted"};let se=Wr(oe,M,u);if(se)return{type:"success",matches:se};let ie=ka(oe,M,u,!0);if(!ie||H.length===ie.length&&H.every((re,ue)=>re.route.id===ie[ue].route.id))return{type:"success",matches:null};H=ie}}function Aj(P){l={},o=Ja(P,i,void 0,l)}function Ij(P,M){let _=o==null;jp(P,M,o||a,l,i),_&&(a=[...a],V({}))}return E={get basename(){return u},get future(){return d},get state(){return k},get routes(){return a},get window(){return t},initialize:tt,subscribe:ge,enableScrollRestoration:cn,navigate:ve,fetch:Rl,revalidate:ct,createHref:P=>e.history.createHref(P),encodeLocation:P=>e.history.encodeLocation(P),getFetcher:fe,deleteFetcher:bt,dispose:W,getBlocker:_r,deleteBlocker:Xn,patchRoutes:Ij,_internalFetchControllers:J,_internalActiveDeferreds:Z,_internalSetRoutes:Aj},E}function Uk(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function _c(e,t,n,r,i,l,a,o){let u,c;if(a){u=[];for(let d of t)if(u.push(d),d.route.id===a){c=d;break}}else u=t,c=t[t.length-1];let h=ch(i||".",uh(u,l),wn(e.pathname,n)||e.pathname,o==="path");if(i==null&&(h.search=e.search,h.hash=e.hash),(i==null||i===""||i===".")&&c){let d=fh(h.search);if(c.route.index&&!d)h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let f=new URLSearchParams(h.search),m=f.getAll("index");f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();h.search=p?"?"+p:""}}return r&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Bn([n,h.pathname])),is(h)}function gp(e,t,n,r){if(!r||!Uk(r))return{path:n};if(r.formMethod&&!Zk(r.formMethod))return{path:n,error:Dt(405,{method:r.formMethod})};let i=()=>({path:n,error:Dt(400,{type:"invalid-body"})}),l=r.formMethod||"get",a=e?l.toUpperCase():l.toLowerCase(),o=xy(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!pn(a))return i();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,p)=>{let[g,w]=p;return""+m+g+"="+w+`
50
+ `},""):String(r.body);return{path:n,submission:{formMethod:a,formAction:o,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!pn(a))return i();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:a,formAction:o,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return i()}}}we(typeof FormData=="function","FormData is not available in this environment");let u,c;if(r.formData)u=Oc(r.formData),c=r.formData;else if(r.body instanceof FormData)u=Oc(r.body),c=r.body;else if(r.body instanceof URLSearchParams)u=r.body,c=kp(u);else if(r.body==null)u=new URLSearchParams,c=new FormData;else try{u=new URLSearchParams(r.body),c=kp(u)}catch{return i()}let h={formMethod:a,formAction:o,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(pn(h.formMethod))return{path:n,submission:h};let d=Pr(n);return t&&d.search&&fh(d.search)&&u.append("index",""),d.search="?"+u,{path:is(d),submission:h}}function xp(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(i=>i.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function yp(e,t,n,r,i,l,a,o,u,c,h,d,f,m,p,g){let w=g?Vt(g[1])?g[1].error:g[1].data:void 0,x=e.createURL(t.location),y=e.createURL(i),v=n;l&&t.errors?v=xp(n,Object.keys(t.errors)[0],!0):g&&Vt(g[1])&&(v=xp(n,g[0]));let b=g?g[1].statusCode:void 0,E=a&&b&&b>=400,k=v.filter((T,D)=>{let{route:C}=T;if(C.lazy)return!0;if(C.loader==null)return!1;if(l)return $c(C,t.loaderData,t.errors);if(Bk(t.loaderData,t.matches[D],T)||u.some(z=>z===T.route.id))return!0;let L=t.matches[D],A=T;return vp(T,Ve({currentUrl:x,currentParams:L.params,nextUrl:y,nextParams:A.params},r,{actionResult:w,actionStatus:b,defaultShouldRevalidate:E?!1:o||x.pathname+x.search===y.pathname+y.search||x.search!==y.search||my(L,A)}))}),R=[];return d.forEach((T,D)=>{if(l||!n.some(U=>U.route.id===T.routeId)||h.has(D))return;let C=Wr(m,T.path,p);if(!C){R.push({key:D,routeId:T.routeId,path:T.path,matches:null,match:null,controller:null});return}let L=t.fetchers.get(D),A=Di(C,T.path),z=!1;f.has(D)?z=!1:c.has(D)?(c.delete(D),z=!0):L&&L.state!=="idle"&&L.data===void 0?z=o:z=vp(A,Ve({currentUrl:x,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:w,actionStatus:b,defaultShouldRevalidate:E?!1:o})),z&&R.push({key:D,routeId:T.routeId,path:T.path,matches:C,match:A,controller:new AbortController})}),[k,R]}function $c(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,i=n!=null&&n[e.id]!==void 0;return!r&&i?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!i}function Bk(e,t,n){let r=!t||n.route.id!==t.route.id,i=e[n.route.id]===void 0;return r||i}function my(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function vp(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function jp(e,t,n,r,i){var l;let a;if(e){let c=r[e];we(c,"No route found to patch children into: routeId = "+e),c.children||(c.children=[]),a=c.children}else a=n;let o=t.filter(c=>!a.some(h=>gy(c,h))),u=Ja(o,i,[e||"_","patch",String(((l=a)==null?void 0:l.length)||"0")],r);a.push(...u)}function gy(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>{var i;return(i=t.children)==null?void 0:i.some(l=>gy(n,l))}):!1}async function Hk(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let i=n[e.id];we(i,"No route found in manifest");let l={};for(let a in r){let u=i[a]!==void 0&&a!=="hasErrorBoundary";Xs(!u,'Route "'+i.id+'" has a static property "'+a+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+a+'" will be ignored.')),!u&&!fk.has(a)&&(l[a]=r[a])}Object.assign(i,l),Object.assign(i,Ve({},t(i),{lazy:void 0}))}async function Wk(e){let{matches:t}=e,n=t.filter(i=>i.shouldLoad);return(await Promise.all(n.map(i=>i.resolve()))).reduce((i,l,a)=>Object.assign(i,{[n[a].route.id]:l}),{})}async function Vk(e,t,n,r,i,l,a,o,u,c){let h=l.map(m=>m.route.lazy?Hk(m.route,u,o):void 0),d=l.map((m,p)=>{let g=h[p],w=i.some(y=>y.route.id===m.route.id);return Ve({},m,{shouldLoad:w,resolve:async y=>(y&&r.method==="GET"&&(m.route.lazy||m.route.loader)&&(w=!0),w?Qk(t,r,m,g,y,c):Promise.resolve({type:ze.data,result:void 0}))})}),f=await e({matches:d,request:r,params:l[0].params,fetcherKey:a,context:c});try{await Promise.all(h)}catch{}return f}async function Qk(e,t,n,r,i,l){let a,o,u=c=>{let h,d=new Promise((p,g)=>h=g);o=()=>h(),t.signal.addEventListener("abort",o);let f=p=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):c({request:t,params:n.params,context:l},...p!==void 0?[p]:[]),m=(async()=>{try{return{type:"data",result:await(i?i(g=>f(g)):f())}}catch(p){return{type:"error",result:p}}})();return Promise.race([m,d])};try{let c=n.route[e];if(r)if(c){let h,[d]=await Promise.all([u(c).catch(f=>{h=f}),r]);if(h!==void 0)throw h;a=d}else if(await r,c=n.route[e],c)a=await u(c);else if(e==="action"){let h=new URL(t.url),d=h.pathname+h.search;throw Dt(405,{method:t.method,pathname:d,routeId:n.route.id})}else return{type:ze.data,result:void 0};else if(c)a=await u(c);else{let h=new URL(t.url),d=h.pathname+h.search;throw Dt(404,{pathname:d})}we(a.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:ze.error,result:c}}finally{o&&t.signal.removeEventListener("abort",o)}return a}async function qk(e){let{result:t,type:n}=e;if(yy(t)){let c;try{let h=t.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?t.body==null?c=null:c=await t.json():c=await t.text()}catch(h){return{type:ze.error,error:h}}return n===ze.error?{type:ze.error,error:new Za(t.status,t.statusText,c),statusCode:t.status,headers:t.headers}:{type:ze.data,data:c,statusCode:t.status,headers:t.headers}}if(n===ze.error){if(Ep(t)){var r;if(t.data instanceof Error){var i;return{type:ze.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status}}t=new Za(((r=t.init)==null?void 0:r.status)||500,void 0,t.data)}return{type:ze.error,error:t,statusCode:To(t)?t.status:void 0}}if(Xk(t)){var l,a;return{type:ze.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((a=t.init)==null?void 0:a.headers)&&new Headers(t.init.headers)}}if(Ep(t)){var o,u;return{type:ze.data,data:t.data,statusCode:(o=t.init)==null?void 0:o.status,headers:(u=t.init)!=null&&u.headers?new Headers(t.init.headers):void 0}}return{type:ze.data,data:t}}function Gk(e,t,n,r,i,l){let a=e.headers.get("Location");if(we(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!dh.test(a)){let o=r.slice(0,r.findIndex(u=>u.route.id===n)+1);a=_c(new URL(t.url),o,i,!0,a,l),e.headers.set("Location",a)}return e}function wp(e,t,n){if(dh.test(e)){let r=e,i=r.startsWith("//")?new URL(t.protocol+r):new URL(r),l=wn(i.pathname,n)!=null;if(i.origin===t.origin&&l)return i.pathname+i.search+i.hash}return e}function js(e,t,n,r){let i=e.createURL(xy(t)).toString(),l={signal:n};if(r&&pn(r.formMethod)){let{formMethod:a,formEncType:o}=r;l.method=a.toUpperCase(),o==="application/json"?(l.headers=new Headers({"Content-Type":o}),l.body=JSON.stringify(r.json)):o==="text/plain"?l.body=r.text:o==="application/x-www-form-urlencoded"&&r.formData?l.body=Oc(r.formData):l.body=r.formData}return new Request(i,l)}function Oc(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function kp(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Kk(e,t,n,r,i){let l={},a=null,o,u=!1,c={},h=n&&Vt(n[1])?n[1].error:void 0;return e.forEach(d=>{if(!(d.route.id in t))return;let f=d.route.id,m=t[f];if(we(!Kr(m),"Cannot handle redirect results in processLoaderData"),Vt(m)){let p=m.error;h!==void 0&&(p=h,h=void 0),a=a||{};{let g=Vr(e,f);a[g.route.id]==null&&(a[g.route.id]=p)}l[f]=void 0,u||(u=!0,o=To(m.error)?m.error.status:500),m.headers&&(c[f]=m.headers)}else or(m)?(r.set(f,m.deferredData),l[f]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[f]=m.headers)):(l[f]=m.data,m.statusCode&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[f]=m.headers))}),h!==void 0&&n&&(a={[n[0]]:h},l[n[0]]=void 0),{loaderData:l,errors:a,statusCode:o||200,loaderHeaders:c}}function bp(e,t,n,r,i,l,a){let{loaderData:o,errors:u}=Kk(t,n,r,a);return i.forEach(c=>{let{key:h,match:d,controller:f}=c,m=l[h];if(we(m,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if(Vt(m)){let p=Vr(e.matches,d==null?void 0:d.route.id);u&&u[p.route.id]||(u=Ve({},u,{[p.route.id]:m.error})),e.fetchers.delete(h)}else if(Kr(m))we(!1,"Unhandled fetcher revalidation redirect");else if(or(m))we(!1,"Unhandled fetcher deferred data");else{let p=tr(m.data);e.fetchers.set(h,p)}}),{loaderData:o,errors:u}}function Sp(e,t,n,r){let i=Ve({},t);for(let l of n){let a=l.route.id;if(t.hasOwnProperty(a)?t[a]!==void 0&&(i[a]=t[a]):e[a]!==void 0&&l.route.loader&&(i[a]=e[a]),r&&r.hasOwnProperty(a))break}return i}function Np(e){return e?Vt(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Vr(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Cp(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Dt(e,t){let{pathname:n,routeId:r,method:i,type:l,message:a}=t===void 0?{}:t,o="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(o="Bad Request",i&&n&&r?u="You made a "+i+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":l==="defer-action"?u="defer() is not supported in actions":l==="invalid-body"&&(u="Unable to encode submission body")):e===403?(o="Forbidden",u='Route "'+r+'" does not match URL "'+n+'"'):e===404?(o="Not Found",u='No route matches URL "'+n+'"'):e===405&&(o="Method Not Allowed",i&&n&&r?u="You made a "+i.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":i&&(u='Invalid request method "'+i.toUpperCase()+'"')),new Za(e||500,o,new Error(u),!0)}function ea(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,i]=t[n];if(Kr(i))return{key:r,result:i}}}function xy(e){let t=typeof e=="string"?Pr(e):e;return is(Ve({},t,{hash:""}))}function Yk(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Jk(e){return yy(e.result)&&zk.has(e.result.status)}function or(e){return e.type===ze.deferred}function Vt(e){return e.type===ze.error}function Kr(e){return(e&&e.type)===ze.redirect}function Ep(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Xk(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function yy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Zk(e){return Mk.has(e.toLowerCase())}function pn(e){return Ik.has(e.toLowerCase())}async function e0(e,t,n,r,i){let l=Object.entries(t);for(let a=0;a<l.length;a++){let[o,u]=l[a],c=e.find(f=>(f==null?void 0:f.route.id)===o);if(!c)continue;let h=r.find(f=>f.route.id===c.route.id),d=h!=null&&!my(h,c)&&(i&&i[c.route.id])!==void 0;or(u)&&d&&await hh(u,n,!1).then(f=>{f&&(t[o]=f)})}}async function t0(e,t,n){for(let r=0;r<n.length;r++){let{key:i,routeId:l,controller:a}=n[r],o=t[i];e.find(c=>(c==null?void 0:c.route.id)===l)&&or(o)&&(we(a,"Expected an AbortController for revalidating fetcher deferred result"),await hh(o,a.signal,!0).then(c=>{c&&(t[i]=c)}))}}async function hh(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:ze.data,data:e.deferredData.unwrappedData}}catch(i){return{type:ze.error,error:i}}return{type:ze.data,data:e.deferredData.data}}}function fh(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Di(e,t){let n=typeof t=="string"?Pr(t).search:t.search;if(e[e.length-1].route.index&&fh(n||""))return e[e.length-1];let r=hy(e);return r[r.length-1]}function Tp(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:l,json:a}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(l!=null)return{formMethod:t,formAction:n,formEncType:r,formData:l,json:void 0,text:void 0};if(a!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:a,text:void 0}}}function vu(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function n0(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function ki(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function r0(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function tr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function s0(e,t){try{let n=e.sessionStorage.getItem(py);if(n){let r=JSON.parse(n);for(let[i,l]of Object.entries(r||{}))l&&Array.isArray(l)&&t.set(i,new Set(l||[]))}}catch{}}function i0(e,t){if(t.size>0){let n={};for(let[r,i]of t)n[r]=[...i];try{e.sessionStorage.setItem(py,JSON.stringify(n))}catch(r){Xs(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
51
51
  * React Router v6.28.0
52
52
  *
53
53
  * Copyright (c) Remix Software Inc.
@@ -56,7 +56,7 @@ Error generating stack: `+l.message+`
56
56
  * LICENSE.md file in the root directory of this source tree.
57
57
  *
58
58
  * @license MIT
59
- */function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zs.apply(this,arguments)}const kl=j.createContext(null),ph=j.createContext(null),Pr=j.createContext(null),mh=j.createContext(null),Gn=j.createContext({outlet:null,matches:[],isDataRoute:!1}),vy=j.createContext(null);function s0(e,t){let{relative:n}=t===void 0?{}:t;bl()||je(!1);let{basename:r,navigator:i}=j.useContext(Pr),{hash:l,pathname:a,search:o}=Po(e,{relative:n}),u=a;return r!=="/"&&(u=a==="/"?r:Bn([r,a])),i.createHref({pathname:u,search:o,hash:l})}function bl(){return j.useContext(mh)!=null}function Kn(){return bl()||je(!1),j.useContext(mh).location}function jy(e){j.useContext(Pr).static||j.useLayoutEffect(e)}function ut(){let{isDataRoute:e}=j.useContext(Gn);return e?x0():i0()}function i0(){bl()||je(!1);let e=j.useContext(kl),{basename:t,future:n,navigator:r}=j.useContext(Pr),{matches:i}=j.useContext(Gn),{pathname:l}=Kn(),a=JSON.stringify(uh(i,n.v7_relativeSplatPath)),o=j.useRef(!1);return jy(()=>{o.current=!0}),j.useCallback(function(c,h){if(h===void 0&&(h={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let d=ch(c,JSON.parse(a),l,h.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Bn([t,d.pathname])),(h.replace?r.replace:r.push)(d,h.state,h)},[t,r,a,l,e])}const l0=j.createContext(null);function a0(e){let t=j.useContext(Gn).outlet;return t&&j.createElement(l0.Provider,{value:e},t)}function li(){let{matches:e}=j.useContext(Gn),t=e[e.length-1];return t?t.params:{}}function Po(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=j.useContext(Pr),{matches:i}=j.useContext(Gn),{pathname:l}=Kn(),a=JSON.stringify(uh(i,r.v7_relativeSplatPath));return j.useMemo(()=>ch(e,JSON.parse(a),l,n==="path"),[e,a,l,n])}function o0(e,t,n,r){bl()||je(!1);let{navigator:i}=j.useContext(Pr),{matches:l}=j.useContext(Gn),a=l[l.length-1],o=a?a.params:{};a&&a.pathname;let u=a?a.pathnameBase:"/";a&&a.route;let c=Kn(),h;h=c;let d=h.pathname||"/",f=d;if(u!=="/"){let g=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(g.length).join("/")}let m=Hr(e,{pathname:f});return f0(m&&m.map(g=>Object.assign({},g,{params:Object.assign({},o,g.params),pathname:Bn([u,i.encodeLocation?i.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?u:Bn([u,i.encodeLocation?i.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),l,n,r)}function u0(){let e=m0(),t=To(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:i},n):null,null)}const c0=j.createElement(u0,null);class d0 extends j.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?j.createElement(Gn.Provider,{value:this.props.routeContext},j.createElement(vy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function h0(e){let{routeContext:t,match:n,children:r}=e,i=j.useContext(kl);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),j.createElement(Gn.Provider,{value:t},r)}function f0(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var l;if(!n)return null;if(n.errors)e=n.matches;else if((l=r)!=null&&l.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=(i=n)==null?void 0:i.errors;if(o!=null){let h=a.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);h>=0||je(!1),a=a.slice(0,Math.min(a.length,h+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let h=0;h<a.length;h++){let d=a[h];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=h),d.route.id){let{loaderData:f,errors:m}=n,p=d.route.loader&&f[d.route.id]===void 0&&(!m||m[d.route.id]===void 0);if(d.route.lazy||p){u=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((h,d,f)=>{let m,p=!1,g=null,w=null;n&&(m=o&&d.route.id?o[d.route.id]:void 0,g=d.route.errorElement||c0,u&&(c<0&&f===0?(y0("route-fallback"),p=!0,w=null):c===f&&(p=!0,w=d.route.hydrateFallbackElement||null)));let x=t.concat(a.slice(0,f+1)),y=()=>{let v;return m?v=g:p?v=w:d.route.Component?v=j.createElement(d.route.Component,null):d.route.element?v=d.route.element:v=h,j.createElement(h0,{match:d,routeContext:{outlet:h,matches:x,isDataRoute:n!=null},children:v})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?j.createElement(d0,{location:n.location,revalidation:n.revalidation,component:g,error:m,children:y(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var wy=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(wy||{}),ky=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ky||{});function by(e){let t=j.useContext(kl);return t||je(!1),t}function Sy(e){let t=j.useContext(ph);return t||je(!1),t}function p0(e){let t=j.useContext(Gn);return t||je(!1),t}function Ny(e){let t=p0(),n=t.matches[t.matches.length-1];return n.route.id||je(!1),n.route.id}function m0(){var e;let t=j.useContext(vy),n=Sy(),r=Ny();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}let g0=0;function gh(e){let{router:t,basename:n}=by(wy.UseBlocker),r=Sy(ky.UseBlocker),[i,l]=j.useState(""),a=j.useCallback(o=>{if(typeof e!="function")return!!e;if(n==="/")return e(o);let{currentLocation:u,nextLocation:c,historyAction:h}=o;return e({currentLocation:Zs({},u,{pathname:wn(u.pathname,n)||u.pathname}),nextLocation:Zs({},c,{pathname:wn(c.pathname,n)||c.pathname}),historyAction:h})},[n,e]);return j.useEffect(()=>{let o=String(++g0);return l(o),()=>t.deleteBlocker(o)},[t]),j.useEffect(()=>{i!==""&&t.getBlocker(i,a)},[t,i,a]),i&&r.blockers.has(i)?r.blockers.get(i):ks}function x0(){let{router:e}=by(),t=Ny(),n=j.useRef(!1);return jy(()=>{n.current=!0}),j.useCallback(function(i,l){l===void 0&&(l={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Zs({fromRouteId:t},l)))},[e,t])}const Pp={};function y0(e,t,n){Pp[e]||(Pp[e]=!0)}const Rp={};function v0(e,t){Rp[t]||(Rp[t]=!0,console.warn(t))}const ws=(e,t,n)=>v0(e,"⚠️ React Router Future Flag Warning: "+t+". "+("You can use the `"+e+"` future flag to opt-in early. ")+("For more information, see "+n+"."));function j0(e,t){e!=null&&e.v7_startTransition||ws("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(e!=null&&e.v7_relativeSplatPath)&&(!t||!t.v7_relativeSplatPath)&&ws("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),t&&(t.v7_fetcherPersist||ws("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),t.v7_normalizeFormMethod||ws("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),t.v7_partialHydration||ws("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),t.v7_skipActionErrorRevalidation||ws("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function w0(e){return a0(e.context)}function k0(e){let{basename:t="/",children:n=null,location:r,navigationType:i=st.Pop,navigator:l,static:a=!1,future:o}=e;bl()&&je(!1);let u=t.replace(/^\/*/,"/"),c=j.useMemo(()=>({basename:u,navigator:l,static:a,future:Zs({v7_relativeSplatPath:!1},o)}),[u,o,l,a]);typeof r=="string"&&(r=Tr(r));let{pathname:h="/",search:d="",hash:f="",state:m=null,key:p="default"}=r,g=j.useMemo(()=>{let w=wn(h,u);return w==null?null:{location:{pathname:w,search:d,hash:f,state:m,key:p},navigationType:i}},[u,h,d,f,m,p,i]);return g==null?null:j.createElement(Pr.Provider,{value:c},j.createElement(mh.Provider,{children:n,value:g}))}new Promise(()=>{});function b0(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:j.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:j.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:j.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
59
+ */function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zs.apply(this,arguments)}const wl=j.createContext(null),ph=j.createContext(null),Rr=j.createContext(null),mh=j.createContext(null),Gn=j.createContext({outlet:null,matches:[],isDataRoute:!1}),vy=j.createContext(null);function l0(e,t){let{relative:n}=t===void 0?{}:t;kl()||we(!1);let{basename:r,navigator:i}=j.useContext(Rr),{hash:l,pathname:a,search:o}=Po(e,{relative:n}),u=a;return r!=="/"&&(u=a==="/"?r:Bn([r,a])),i.createHref({pathname:u,search:o,hash:l})}function kl(){return j.useContext(mh)!=null}function Kn(){return kl()||we(!1),j.useContext(mh).location}function jy(e){j.useContext(Rr).static||j.useLayoutEffect(e)}function ut(){let{isDataRoute:e}=j.useContext(Gn);return e?v0():a0()}function a0(){kl()||we(!1);let e=j.useContext(wl),{basename:t,future:n,navigator:r}=j.useContext(Rr),{matches:i}=j.useContext(Gn),{pathname:l}=Kn(),a=JSON.stringify(uh(i,n.v7_relativeSplatPath)),o=j.useRef(!1);return jy(()=>{o.current=!0}),j.useCallback(function(c,h){if(h===void 0&&(h={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let d=ch(c,JSON.parse(a),l,h.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Bn([t,d.pathname])),(h.replace?r.replace:r.push)(d,h.state,h)},[t,r,a,l,e])}const o0=j.createContext(null);function u0(e){let t=j.useContext(Gn).outlet;return t&&j.createElement(o0.Provider,{value:e},t)}function li(){let{matches:e}=j.useContext(Gn),t=e[e.length-1];return t?t.params:{}}function Po(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=j.useContext(Rr),{matches:i}=j.useContext(Gn),{pathname:l}=Kn(),a=JSON.stringify(uh(i,r.v7_relativeSplatPath));return j.useMemo(()=>ch(e,JSON.parse(a),l,n==="path"),[e,a,l,n])}function c0(e,t,n,r){kl()||we(!1);let{navigator:i}=j.useContext(Rr),{matches:l}=j.useContext(Gn),a=l[l.length-1],o=a?a.params:{};a&&a.pathname;let u=a?a.pathnameBase:"/";a&&a.route;let c=Kn(),h;h=c;let d=h.pathname||"/",f=d;if(u!=="/"){let g=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(g.length).join("/")}let m=Wr(e,{pathname:f});return m0(m&&m.map(g=>Object.assign({},g,{params:Object.assign({},o,g.params),pathname:Bn([u,i.encodeLocation?i.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?u:Bn([u,i.encodeLocation?i.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),l,n,r)}function d0(){let e=x0(),t=To(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:i},n):null,null)}const h0=j.createElement(d0,null);class f0 extends j.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?j.createElement(Gn.Provider,{value:this.props.routeContext},j.createElement(vy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function p0(e){let{routeContext:t,match:n,children:r}=e,i=j.useContext(wl);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),j.createElement(Gn.Provider,{value:t},r)}function m0(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var l;if(!n)return null;if(n.errors)e=n.matches;else if((l=r)!=null&&l.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=(i=n)==null?void 0:i.errors;if(o!=null){let h=a.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);h>=0||we(!1),a=a.slice(0,Math.min(a.length,h+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let h=0;h<a.length;h++){let d=a[h];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=h),d.route.id){let{loaderData:f,errors:m}=n,p=d.route.loader&&f[d.route.id]===void 0&&(!m||m[d.route.id]===void 0);if(d.route.lazy||p){u=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((h,d,f)=>{let m,p=!1,g=null,w=null;n&&(m=o&&d.route.id?o[d.route.id]:void 0,g=d.route.errorElement||h0,u&&(c<0&&f===0?(j0("route-fallback"),p=!0,w=null):c===f&&(p=!0,w=d.route.hydrateFallbackElement||null)));let x=t.concat(a.slice(0,f+1)),y=()=>{let v;return m?v=g:p?v=w:d.route.Component?v=j.createElement(d.route.Component,null):d.route.element?v=d.route.element:v=h,j.createElement(p0,{match:d,routeContext:{outlet:h,matches:x,isDataRoute:n!=null},children:v})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?j.createElement(f0,{location:n.location,revalidation:n.revalidation,component:g,error:m,children:y(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var wy=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(wy||{}),ky=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ky||{});function by(e){let t=j.useContext(wl);return t||we(!1),t}function Sy(e){let t=j.useContext(ph);return t||we(!1),t}function g0(e){let t=j.useContext(Gn);return t||we(!1),t}function Ny(e){let t=g0(),n=t.matches[t.matches.length-1];return n.route.id||we(!1),n.route.id}function x0(){var e;let t=j.useContext(vy),n=Sy(),r=Ny();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}let y0=0;function gh(e){let{router:t,basename:n}=by(wy.UseBlocker),r=Sy(ky.UseBlocker),[i,l]=j.useState(""),a=j.useCallback(o=>{if(typeof e!="function")return!!e;if(n==="/")return e(o);let{currentLocation:u,nextLocation:c,historyAction:h}=o;return e({currentLocation:Zs({},u,{pathname:wn(u.pathname,n)||u.pathname}),nextLocation:Zs({},c,{pathname:wn(c.pathname,n)||c.pathname}),historyAction:h})},[n,e]);return j.useEffect(()=>{let o=String(++y0);return l(o),()=>t.deleteBlocker(o)},[t]),j.useEffect(()=>{i!==""&&t.getBlocker(i,a)},[t,i,a]),i&&r.blockers.has(i)?r.blockers.get(i):ks}function v0(){let{router:e}=by(),t=Ny(),n=j.useRef(!1);return jy(()=>{n.current=!0}),j.useCallback(function(i,l){l===void 0&&(l={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Zs({fromRouteId:t},l)))},[e,t])}const Pp={};function j0(e,t,n){Pp[e]||(Pp[e]=!0)}const Rp={};function w0(e,t){Rp[t]||(Rp[t]=!0,console.warn(t))}const ws=(e,t,n)=>w0(e,"⚠️ React Router Future Flag Warning: "+t+". "+("You can use the `"+e+"` future flag to opt-in early. ")+("For more information, see "+n+"."));function k0(e,t){e!=null&&e.v7_startTransition||ws("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(e!=null&&e.v7_relativeSplatPath)&&(!t||!t.v7_relativeSplatPath)&&ws("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),t&&(t.v7_fetcherPersist||ws("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),t.v7_normalizeFormMethod||ws("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),t.v7_partialHydration||ws("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),t.v7_skipActionErrorRevalidation||ws("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function b0(e){return u0(e.context)}function S0(e){let{basename:t="/",children:n=null,location:r,navigationType:i=st.Pop,navigator:l,static:a=!1,future:o}=e;kl()&&we(!1);let u=t.replace(/^\/*/,"/"),c=j.useMemo(()=>({basename:u,navigator:l,static:a,future:Zs({v7_relativeSplatPath:!1},o)}),[u,o,l,a]);typeof r=="string"&&(r=Pr(r));let{pathname:h="/",search:d="",hash:f="",state:m=null,key:p="default"}=r,g=j.useMemo(()=>{let w=wn(h,u);return w==null?null:{location:{pathname:w,search:d,hash:f,state:m,key:p},navigationType:i}},[u,h,d,f,m,p,i]);return g==null?null:j.createElement(Rr.Provider,{value:c},j.createElement(mh.Provider,{children:n,value:g}))}new Promise(()=>{});function N0(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:j.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:j.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:j.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
60
60
  * React Router DOM v6.28.0
61
61
  *
62
62
  * Copyright (c) Remix Software Inc.
@@ -65,7 +65,7 @@ Error generating stack: `+l.message+`
65
65
  * LICENSE.md file in the root directory of this source tree.
66
66
  *
67
67
  * @license MIT
68
- */function ei(){return ei=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ei.apply(this,arguments)}function Cy(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,l;for(l=0;l<r.length;l++)i=r[l],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function S0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function N0(e,t){return e.button===0&&(!t||t==="_self")&&!S0(e)}function Fc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function C0(e,t){let n=Fc(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}const E0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],T0=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],P0="6";try{window.__reactRouterVersion=P0}catch{}function R0(e,t){return $k({basename:t==null?void 0:t.basename,future:ei({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:ok({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||L0(),routes:e,mapRouteProperties:b0,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window}).initialize()}function L0(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=ei({},t,{errors:A0(t.errors)})),t}function A0(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,i]of t)if(i&&i.__type==="RouteErrorResponse")n[r]=new eo(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let l=window[i.__subType];if(typeof l=="function")try{let a=new l(i.message);a.stack="",n[r]=a}catch{}}if(n[r]==null){let l=new Error(i.message);l.stack="",n[r]=l}}else n[r]=i;return n}const Ey=j.createContext({isTransitioning:!1}),I0=j.createContext(new Map),D0="startTransition",Lp=Kj[D0],M0="flushSync",Ap=ak[M0];function z0(e){Lp?Lp(e):e()}function bi(e){Ap?Ap(e):e()}class _0{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function $0(e){let{fallbackElement:t,router:n,future:r}=e,[i,l]=j.useState(n.state),[a,o]=j.useState(),[u,c]=j.useState({isTransitioning:!1}),[h,d]=j.useState(),[f,m]=j.useState(),[p,g]=j.useState(),w=j.useRef(new Map),{v7_startTransition:x}=r||{},y=j.useCallback(T=>{x?z0(T):T()},[x]),v=j.useCallback((T,D)=>{let{deletedFetchers:C,flushSync:L,viewTransitionOpts:A}=D;C.forEach(U=>w.current.delete(U)),T.fetchers.forEach((U,I)=>{U.data!==void 0&&w.current.set(I,U.data)});let z=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!A||z){L?bi(()=>l(T)):y(()=>l(T));return}if(L){bi(()=>{f&&(h&&h.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:A.currentLocation,nextLocation:A.nextLocation})});let U=n.window.document.startViewTransition(()=>{bi(()=>l(T))});U.finished.finally(()=>{bi(()=>{d(void 0),m(void 0),o(void 0),c({isTransitioning:!1})})}),bi(()=>m(U));return}f?(h&&h.resolve(),f.skipTransition(),g({state:T,currentLocation:A.currentLocation,nextLocation:A.nextLocation})):(o(T),c({isTransitioning:!0,flushSync:!1,currentLocation:A.currentLocation,nextLocation:A.nextLocation}))},[n.window,f,h,w,y]);j.useLayoutEffect(()=>n.subscribe(v),[n,v]),j.useEffect(()=>{u.isTransitioning&&!u.flushSync&&d(new _0)},[u]),j.useEffect(()=>{if(h&&a&&n.window){let T=a,D=h.promise,C=n.window.document.startViewTransition(async()=>{y(()=>l(T)),await D});C.finished.finally(()=>{d(void 0),m(void 0),o(void 0),c({isTransitioning:!1})}),m(C)}},[y,a,h,n.window]),j.useEffect(()=>{h&&a&&i.location.key===a.location.key&&h.resolve()},[h,f,i.location,a]),j.useEffect(()=>{!u.isTransitioning&&p&&(o(p.state),c({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),g(void 0))},[u.isTransitioning,p]),j.useEffect(()=>{},[]);let b=j.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:T=>n.navigate(T),push:(T,D,C)=>n.navigate(T,{state:D,preventScrollReset:C==null?void 0:C.preventScrollReset}),replace:(T,D,C)=>n.navigate(T,{replace:!0,state:D,preventScrollReset:C==null?void 0:C.preventScrollReset})}),[n]),E=n.basename||"/",k=j.useMemo(()=>({router:n,navigator:b,static:!1,basename:E}),[n,b,E]),R=j.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return j.useEffect(()=>j0(r,n.future),[r,n.future]),j.createElement(j.Fragment,null,j.createElement(kl.Provider,{value:k},j.createElement(ph.Provider,{value:i},j.createElement(I0.Provider,{value:w.current},j.createElement(Ey.Provider,{value:u},j.createElement(k0,{basename:E,location:i.location,navigationType:i.historyAction,navigator:b,future:R},i.initialized||n.future.v7_partialHydration?j.createElement(O0,{routes:n.routes,future:n.future,state:i}):t))))),null)}const O0=j.memo(F0);function F0(e){let{routes:t,future:n,state:r}=e;return o0(t,void 0,r,n)}const U0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",B0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ye=j.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:l,replace:a,state:o,target:u,to:c,preventScrollReset:h,viewTransition:d}=t,f=Cy(t,E0),{basename:m}=j.useContext(Pr),p,g=!1;if(typeof c=="string"&&B0.test(c)&&(p=c,U0))try{let v=new URL(window.location.href),b=c.startsWith("//")?new URL(v.protocol+c):new URL(c),E=wn(b.pathname,m);b.origin===v.origin&&E!=null?c=E+b.search+b.hash:g=!0}catch{}let w=s0(c,{relative:i}),x=V0(c,{replace:a,state:o,target:u,preventScrollReset:h,relative:i,viewTransition:d});function y(v){r&&r(v),v.defaultPrevented||x(v)}return j.createElement("a",ei({},f,{href:p||w,onClick:g||l?r:y,ref:n,target:u}))}),H0=j.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:l="",end:a=!1,style:o,to:u,viewTransition:c,children:h}=t,d=Cy(t,T0),f=Po(u,{relative:d.relative}),m=Kn(),p=j.useContext(ph),{navigator:g,basename:w}=j.useContext(Pr),x=p!=null&&Q0(f)&&c===!0,y=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,v=m.pathname,b=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;i||(v=v.toLowerCase(),b=b?b.toLowerCase():null,y=y.toLowerCase()),b&&w&&(b=wn(b,w)||b);const E=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let k=v===y||!a&&v.startsWith(y)&&v.charAt(E)==="/",R=b!=null&&(b===y||!a&&b.startsWith(y)&&b.charAt(y.length)==="/"),T={isActive:k,isPending:R,isTransitioning:x},D=k?r:void 0,C;typeof l=="function"?C=l(T):C=[l,k?"active":null,R?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(T):o;return j.createElement(ye,ei({},d,{"aria-current":D,className:C,ref:n,style:L,to:u,viewTransition:c}),typeof h=="function"?h(T):h)});var Uc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Uc||(Uc={}));var Ip;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Ip||(Ip={}));function W0(e){let t=j.useContext(kl);return t||je(!1),t}function V0(e,t){let{target:n,replace:r,state:i,preventScrollReset:l,relative:a,viewTransition:o}=t===void 0?{}:t,u=ut(),c=Kn(),h=Po(e,{relative:a});return j.useCallback(d=>{if(N0(d,n)){d.preventDefault();let f=r!==void 0?r:ss(c)===ss(h);u(e,{replace:f,state:i,preventScrollReset:l,relative:a,viewTransition:o})}},[c,u,h,r,i,n,e,l,a,o])}function xh(e){let t=j.useRef(Fc(e)),n=j.useRef(!1),r=Kn(),i=j.useMemo(()=>C0(r.search,n.current?null:t.current),[r.search]),l=ut(),a=j.useCallback((o,u)=>{const c=Fc(typeof o=="function"?o(i):o);n.current=!0,l("?"+c,u)},[l,i]);return[i,a]}function Q0(e,t){t===void 0&&(t={});let n=j.useContext(Ey);n==null&&je(!1);let{basename:r}=W0(Uc.useViewTransitionState),i=Po(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=wn(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=wn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Za(i.pathname,a)!=null||Za(i.pathname,l)!=null}class to extends Error{constructor(t,n){super(n),this.status=t}}const Bc="qa-studio:server-down";async function q0(){try{return(await fetch("/api/health",{cache:"no-store"})).ok}catch{return!1}}async function le(e,t,n){let r;try{r=await fetch(t,{method:e,headers:n===void 0?void 0:{"Content-Type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)})}catch{throw window.dispatchEvent(new Event(Bc)),new to(0,"Agent Studio server is not reachable. Is it running?")}if(r.status===204)return;const i=await r.json().catch(()=>({}));if(!r.ok)throw new to(r.status,Array.isArray(i.message)?i.message.join(", "):i.message??r.statusText);return i}const _e=encodeURIComponent,ju=e=>Object.entries(e).filter(([,t])=>t!==void 0&&t!=="").map(([t,n])=>`${_e(t)}=${_e(String(n))}`).join("&"),q={dashboard:()=>le("GET","/api/dashboard"),specs:()=>le("GET","/api/specs"),spec:e=>le("GET",`/api/specs/${_e(e)}`),createSpec:(e,t)=>le("POST","/api/specs",{file:e,content:t}),saveSpec:(e,t,n)=>le("PUT",`/api/specs/${_e(e)}`,{content:t,baseMtime:n}),deleteSpec:e=>le("DELETE",`/api/specs/${_e(e)}`),mapping:()=>le("GET","/api/mapping"),mappingPage:e=>le("GET",`/api/mapping/page?${ju(e)}`),jobs:()=>le("GET","/api/jobs"),jobsPage:e=>le("GET",`/api/jobs?${ju(e)}`),job:e=>le("GET",`/api/jobs/${e}`),agentRun:(e,t)=>le("GET",`/api/jobs/${e}/agents/${t}`),createJob:e=>le("POST","/api/jobs",e),cancelJob:e=>le("POST",`/api/jobs/${e}/cancel`),approveJob:e=>le("POST",`/api/jobs/${e}/approve`),rerunFailedJob:e=>le("POST",`/api/jobs/${e}/rerun-failed`),rejectJob:(e,t)=>le("POST",`/api/jobs/${e}/reject`,{reason:t}),answerJob:(e,t)=>le("POST",`/api/jobs/${e}/answer`,{answers:t}),jobRequirement:e=>le("GET",`/api/jobs/${e}/requirement`),settings:()=>le("GET","/api/settings"),saveSettings:e=>le("PUT","/api/settings",e),usage:e=>le("GET",`/api/usage?days=${e}`),searchTestCases:e=>le("POST","/api/test-cases/search",e),testRuns:e=>le("GET",`/api/test-runs?${ju(e)}`),claudeMd:()=>le("GET","/api/project/claude-md"),uploadClaudeMd:e=>le("POST","/api/project/claude-md",{content:e}),resetPlan:e=>le("GET",`/api/project/reset/plan${e?`?terms=${_e(e)}`:""}`),resetProject:e=>le("POST","/api/project/reset",e),claudeStatus:()=>le("GET","/api/claude/status"),claudeTest:()=>le("POST","/api/claude/test"),agentPrompts:()=>le("GET","/api/agents/prompts"),saveAgentPrompt:(e,t)=>le("PUT",`/api/agents/prompts/${_e(e)}`,{instructions:t}),resetAgentPrompt:e=>le("DELETE",`/api/agents/prompts/${_e(e)}`),saveAgentModel:(e,t)=>le("PUT",`/api/agents/prompts/${_e(e)}/model`,{model:t}),resetAgentModel:e=>le("DELETE",`/api/agents/prompts/${_e(e)}/model`),skills:()=>le("GET","/api/agents/skills"),customAgents:()=>le("GET","/api/agents/custom"),customAgent:e=>le("GET",`/api/agents/custom/${_e(e)}`),createCustomAgent:e=>le("POST","/api/agents/custom",e),saveCustomAgent:(e,t,n)=>le("PUT",`/api/agents/custom/${_e(e)}`,{...t,baseUpdatedAt:n}),deleteCustomAgent:e=>le("DELETE",`/api/agents/custom/${_e(e)}`),previewCustomAgent:(e,t)=>le("POST",e?`/api/agents/custom/${_e(e)}/preview`:"/api/agents/custom/preview",t),exportProject:async()=>{const e=await fetch("/api/project/export");if(!e.ok)throw new to(e.status,(await e.json().catch(()=>({}))).message??e.statusText);return e.blob()},importProject:e=>le("POST","/api/project/import",{zip:e}),claudeMdSections:()=>le("GET","/api/project/claude-md/sections"),saveAgentSkills:(e,t)=>le("PUT",`/api/agents/prompts/${_e(e)}/skills`,{skills:t}),pipelines:()=>le("GET","/api/pipelines"),pipeline:e=>le("GET",`/api/pipelines/${_e(e)}`),createPipeline:e=>le("POST","/api/pipelines",e),savePipeline:(e,t,n)=>le("PUT",`/api/pipelines/${_e(e)}`,{...t,baseUpdatedAt:n}),deletePipeline:e=>le("DELETE",`/api/pipelines/${_e(e)}`),chatCommands:(e=!1)=>le("GET",`/api/chat/commands${e?"?refresh=1":""}`),chats:()=>le("GET","/api/chat/sessions"),chat:e=>le("GET",`/api/chat/sessions/${_e(e)}`),createChat:e=>le("POST","/api/chat/sessions",e),updateChat:(e,t)=>le("PATCH",`/api/chat/sessions/${_e(e)}`,t),deleteChat:e=>le("DELETE",`/api/chat/sessions/${_e(e)}`),uploadChatFile:(e,t)=>le("POST",`/api/chat/sessions/${_e(e)}/attachments`,t),sendChat:(e,t,n)=>le("POST",`/api/chat/sessions/${_e(e)}/messages`,{text:t,attachmentIds:n}),answerChatPermission:(e,t,n)=>le("POST",`/api/chat/sessions/${_e(e)}/permissions/${_e(t)}`,{decision:n}),stopChat:e=>le("POST",`/api/chat/sessions/${_e(e)}/stop`),previewAgentPrompt:(e,t)=>le("POST",`/api/agents/prompts/${_e(e)}/preview`,t)};function G0(e,t,n){const r=new EventSource(`/api/jobs/${e}/stream`);for(const i of["job","agent","log"])r.addEventListener(i,l=>t(JSON.parse(l.data)));return r.onerror=()=>{r.close(),n()},()=>r.close()}function K0(e,t){const n=new EventSource(`/api/chat/sessions/${encodeURIComponent(e)}/stream`);for(const r of["session","message"])n.addEventListener(r,i=>t(JSON.parse(i.data)));return()=>n.close()}const yh=e=>`/api/jobs/${e}/report/`,Hc=["passed","failed","cancelled","interrupted"],Y0=`# Spec title
68
+ */function ei(){return ei=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ei.apply(this,arguments)}function Cy(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,l;for(l=0;l<r.length;l++)i=r[l],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function C0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function E0(e,t){return e.button===0&&(!t||t==="_self")&&!C0(e)}function Fc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function T0(e,t){let n=Fc(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}const P0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],R0=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],L0="6";try{window.__reactRouterVersion=L0}catch{}function A0(e,t){return Fk({basename:t==null?void 0:t.basename,future:ei({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:ck({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||I0(),routes:e,mapRouteProperties:N0,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window}).initialize()}function I0(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=ei({},t,{errors:D0(t.errors)})),t}function D0(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,i]of t)if(i&&i.__type==="RouteErrorResponse")n[r]=new Za(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let l=window[i.__subType];if(typeof l=="function")try{let a=new l(i.message);a.stack="",n[r]=a}catch{}}if(n[r]==null){let l=new Error(i.message);l.stack="",n[r]=l}}else n[r]=i;return n}const Ey=j.createContext({isTransitioning:!1}),M0=j.createContext(new Map),z0="startTransition",Lp=Jj[z0],_0="flushSync",Ap=uk[_0];function $0(e){Lp?Lp(e):e()}function bi(e){Ap?Ap(e):e()}class O0{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function F0(e){let{fallbackElement:t,router:n,future:r}=e,[i,l]=j.useState(n.state),[a,o]=j.useState(),[u,c]=j.useState({isTransitioning:!1}),[h,d]=j.useState(),[f,m]=j.useState(),[p,g]=j.useState(),w=j.useRef(new Map),{v7_startTransition:x}=r||{},y=j.useCallback(T=>{x?$0(T):T()},[x]),v=j.useCallback((T,D)=>{let{deletedFetchers:C,flushSync:L,viewTransitionOpts:A}=D;C.forEach(U=>w.current.delete(U)),T.fetchers.forEach((U,I)=>{U.data!==void 0&&w.current.set(I,U.data)});let z=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!A||z){L?bi(()=>l(T)):y(()=>l(T));return}if(L){bi(()=>{f&&(h&&h.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:A.currentLocation,nextLocation:A.nextLocation})});let U=n.window.document.startViewTransition(()=>{bi(()=>l(T))});U.finished.finally(()=>{bi(()=>{d(void 0),m(void 0),o(void 0),c({isTransitioning:!1})})}),bi(()=>m(U));return}f?(h&&h.resolve(),f.skipTransition(),g({state:T,currentLocation:A.currentLocation,nextLocation:A.nextLocation})):(o(T),c({isTransitioning:!0,flushSync:!1,currentLocation:A.currentLocation,nextLocation:A.nextLocation}))},[n.window,f,h,w,y]);j.useLayoutEffect(()=>n.subscribe(v),[n,v]),j.useEffect(()=>{u.isTransitioning&&!u.flushSync&&d(new O0)},[u]),j.useEffect(()=>{if(h&&a&&n.window){let T=a,D=h.promise,C=n.window.document.startViewTransition(async()=>{y(()=>l(T)),await D});C.finished.finally(()=>{d(void 0),m(void 0),o(void 0),c({isTransitioning:!1})}),m(C)}},[y,a,h,n.window]),j.useEffect(()=>{h&&a&&i.location.key===a.location.key&&h.resolve()},[h,f,i.location,a]),j.useEffect(()=>{!u.isTransitioning&&p&&(o(p.state),c({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),g(void 0))},[u.isTransitioning,p]),j.useEffect(()=>{},[]);let b=j.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:T=>n.navigate(T),push:(T,D,C)=>n.navigate(T,{state:D,preventScrollReset:C==null?void 0:C.preventScrollReset}),replace:(T,D,C)=>n.navigate(T,{replace:!0,state:D,preventScrollReset:C==null?void 0:C.preventScrollReset})}),[n]),E=n.basename||"/",k=j.useMemo(()=>({router:n,navigator:b,static:!1,basename:E}),[n,b,E]),R=j.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return j.useEffect(()=>k0(r,n.future),[r,n.future]),j.createElement(j.Fragment,null,j.createElement(wl.Provider,{value:k},j.createElement(ph.Provider,{value:i},j.createElement(M0.Provider,{value:w.current},j.createElement(Ey.Provider,{value:u},j.createElement(S0,{basename:E,location:i.location,navigationType:i.historyAction,navigator:b,future:R},i.initialized||n.future.v7_partialHydration?j.createElement(U0,{routes:n.routes,future:n.future,state:i}):t))))),null)}const U0=j.memo(B0);function B0(e){let{routes:t,future:n,state:r}=e;return c0(t,void 0,r,n)}const H0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",W0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ye=j.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:l,replace:a,state:o,target:u,to:c,preventScrollReset:h,viewTransition:d}=t,f=Cy(t,P0),{basename:m}=j.useContext(Rr),p,g=!1;if(typeof c=="string"&&W0.test(c)&&(p=c,H0))try{let v=new URL(window.location.href),b=c.startsWith("//")?new URL(v.protocol+c):new URL(c),E=wn(b.pathname,m);b.origin===v.origin&&E!=null?c=E+b.search+b.hash:g=!0}catch{}let w=l0(c,{relative:i}),x=q0(c,{replace:a,state:o,target:u,preventScrollReset:h,relative:i,viewTransition:d});function y(v){r&&r(v),v.defaultPrevented||x(v)}return j.createElement("a",ei({},f,{href:p||w,onClick:g||l?r:y,ref:n,target:u}))}),V0=j.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:l="",end:a=!1,style:o,to:u,viewTransition:c,children:h}=t,d=Cy(t,R0),f=Po(u,{relative:d.relative}),m=Kn(),p=j.useContext(ph),{navigator:g,basename:w}=j.useContext(Rr),x=p!=null&&G0(f)&&c===!0,y=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,v=m.pathname,b=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;i||(v=v.toLowerCase(),b=b?b.toLowerCase():null,y=y.toLowerCase()),b&&w&&(b=wn(b,w)||b);const E=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let k=v===y||!a&&v.startsWith(y)&&v.charAt(E)==="/",R=b!=null&&(b===y||!a&&b.startsWith(y)&&b.charAt(y.length)==="/"),T={isActive:k,isPending:R,isTransitioning:x},D=k?r:void 0,C;typeof l=="function"?C=l(T):C=[l,k?"active":null,R?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(T):o;return j.createElement(ye,ei({},d,{"aria-current":D,className:C,ref:n,style:L,to:u,viewTransition:c}),typeof h=="function"?h(T):h)});var Uc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Uc||(Uc={}));var Ip;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Ip||(Ip={}));function Q0(e){let t=j.useContext(wl);return t||we(!1),t}function q0(e,t){let{target:n,replace:r,state:i,preventScrollReset:l,relative:a,viewTransition:o}=t===void 0?{}:t,u=ut(),c=Kn(),h=Po(e,{relative:a});return j.useCallback(d=>{if(E0(d,n)){d.preventDefault();let f=r!==void 0?r:is(c)===is(h);u(e,{replace:f,state:i,preventScrollReset:l,relative:a,viewTransition:o})}},[c,u,h,r,i,n,e,l,a,o])}function xh(e){let t=j.useRef(Fc(e)),n=j.useRef(!1),r=Kn(),i=j.useMemo(()=>T0(r.search,n.current?null:t.current),[r.search]),l=ut(),a=j.useCallback((o,u)=>{const c=Fc(typeof o=="function"?o(i):o);n.current=!0,l("?"+c,u)},[l,i]);return[i,a]}function G0(e,t){t===void 0&&(t={});let n=j.useContext(Ey);n==null&&we(!1);let{basename:r}=Q0(Uc.useViewTransitionState),i=Po(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=wn(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=wn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Xa(i.pathname,a)!=null||Xa(i.pathname,l)!=null}class eo extends Error{constructor(t,n){super(n),this.status=t}}const Bc="qa-studio:server-down";async function K0(){try{return(await fetch("/api/health",{cache:"no-store"})).ok}catch{return!1}}async function le(e,t,n){let r;try{r=await fetch(t,{method:e,headers:n===void 0?void 0:{"Content-Type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)})}catch{throw window.dispatchEvent(new Event(Bc)),new eo(0,"Agent Studio server is not reachable. Is it running?")}if(r.status===204)return;const i=await r.json().catch(()=>({}));if(!r.ok)throw new eo(r.status,Array.isArray(i.message)?i.message.join(", "):i.message??r.statusText);return i}const $e=encodeURIComponent,ju=e=>Object.entries(e).filter(([,t])=>t!==void 0&&t!=="").map(([t,n])=>`${$e(t)}=${$e(String(n))}`).join("&"),q={dashboard:()=>le("GET","/api/dashboard"),specs:()=>le("GET","/api/specs"),spec:e=>le("GET",`/api/specs/${$e(e)}`),createSpec:(e,t)=>le("POST","/api/specs",{file:e,content:t}),saveSpec:(e,t,n)=>le("PUT",`/api/specs/${$e(e)}`,{content:t,baseMtime:n}),deleteSpec:e=>le("DELETE",`/api/specs/${$e(e)}`),mapping:()=>le("GET","/api/mapping"),mappingPage:e=>le("GET",`/api/mapping/page?${ju(e)}`),jobs:()=>le("GET","/api/jobs"),jobsPage:e=>le("GET",`/api/jobs?${ju(e)}`),job:e=>le("GET",`/api/jobs/${e}`),agentRun:(e,t)=>le("GET",`/api/jobs/${e}/agents/${t}`),createJob:e=>le("POST","/api/jobs",e),cancelJob:e=>le("POST",`/api/jobs/${e}/cancel`),approveJob:e=>le("POST",`/api/jobs/${e}/approve`),rerunFailedJob:e=>le("POST",`/api/jobs/${e}/rerun-failed`),rejectJob:(e,t)=>le("POST",`/api/jobs/${e}/reject`,{reason:t}),answerJob:(e,t)=>le("POST",`/api/jobs/${e}/answer`,{answers:t}),jobRequirement:e=>le("GET",`/api/jobs/${e}/requirement`),settings:()=>le("GET","/api/settings"),saveSettings:e=>le("PUT","/api/settings",e),usage:e=>le("GET",`/api/usage?days=${e}`),searchTestCases:e=>le("POST","/api/test-cases/search",e),testRuns:e=>le("GET",`/api/test-runs?${ju(e)}`),claudeMd:()=>le("GET","/api/project/claude-md"),uploadClaudeMd:e=>le("POST","/api/project/claude-md",{content:e}),resetPlan:e=>le("GET",`/api/project/reset/plan${e?`?terms=${$e(e)}`:""}`),resetProject:e=>le("POST","/api/project/reset",e),claudeStatus:()=>le("GET","/api/claude/status"),claudeTest:()=>le("POST","/api/claude/test"),agentPrompts:()=>le("GET","/api/agents/prompts"),saveAgentPrompt:(e,t)=>le("PUT",`/api/agents/prompts/${$e(e)}`,{instructions:t}),resetAgentPrompt:e=>le("DELETE",`/api/agents/prompts/${$e(e)}`),saveAgentModel:(e,t)=>le("PUT",`/api/agents/prompts/${$e(e)}/model`,{model:t}),resetAgentModel:e=>le("DELETE",`/api/agents/prompts/${$e(e)}/model`),skills:()=>le("GET","/api/agents/skills"),customAgents:()=>le("GET","/api/agents/custom"),customAgent:e=>le("GET",`/api/agents/custom/${$e(e)}`),createCustomAgent:e=>le("POST","/api/agents/custom",e),saveCustomAgent:(e,t,n)=>le("PUT",`/api/agents/custom/${$e(e)}`,{...t,baseUpdatedAt:n}),deleteCustomAgent:e=>le("DELETE",`/api/agents/custom/${$e(e)}`),previewCustomAgent:(e,t)=>le("POST",e?`/api/agents/custom/${$e(e)}/preview`:"/api/agents/custom/preview",t),exportProject:async()=>{const e=await fetch("/api/project/export");if(!e.ok)throw new eo(e.status,(await e.json().catch(()=>({}))).message??e.statusText);return e.blob()},importProject:e=>le("POST","/api/project/import",{zip:e}),claudeMdSections:()=>le("GET","/api/project/claude-md/sections"),saveAgentSkills:(e,t)=>le("PUT",`/api/agents/prompts/${$e(e)}/skills`,{skills:t}),pipelines:()=>le("GET","/api/pipelines"),pipeline:e=>le("GET",`/api/pipelines/${$e(e)}`),createPipeline:e=>le("POST","/api/pipelines",e),savePipeline:(e,t,n)=>le("PUT",`/api/pipelines/${$e(e)}`,{...t,baseUpdatedAt:n}),deletePipeline:e=>le("DELETE",`/api/pipelines/${$e(e)}`),chatCommands:(e=!1)=>le("GET",`/api/chat/commands${e?"?refresh=1":""}`),chats:()=>le("GET","/api/chat/sessions"),chat:e=>le("GET",`/api/chat/sessions/${$e(e)}`),createChat:e=>le("POST","/api/chat/sessions",e),updateChat:(e,t)=>le("PATCH",`/api/chat/sessions/${$e(e)}`,t),deleteChat:e=>le("DELETE",`/api/chat/sessions/${$e(e)}`),uploadChatFile:(e,t)=>le("POST",`/api/chat/sessions/${$e(e)}/attachments`,t),sendChat:(e,t,n)=>le("POST",`/api/chat/sessions/${$e(e)}/messages`,{text:t,attachmentIds:n}),answerChatPermission:(e,t,n)=>le("POST",`/api/chat/sessions/${$e(e)}/permissions/${$e(t)}`,{decision:n}),stopChat:e=>le("POST",`/api/chat/sessions/${$e(e)}/stop`),previewAgentPrompt:(e,t)=>le("POST",`/api/agents/prompts/${$e(e)}/preview`,t)};function Y0(e,t,n){const r=new EventSource(`/api/jobs/${e}/stream`);for(const i of["job","agent","log"])r.addEventListener(i,l=>t(JSON.parse(l.data)));return r.onerror=()=>{r.close(),n()},()=>r.close()}function J0(e,t){const n=new EventSource(`/api/chat/sessions/${encodeURIComponent(e)}/stream`);for(const r of["session","message"])n.addEventListener(r,i=>t(JSON.parse(i.data)));return()=>n.close()}const yh=e=>`/api/jobs/${e}/report/`,Hc=["passed","failed","cancelled","interrupted"],X0=`# Spec title
69
69
  Tags: smoke
70
70
  Preconditions: describe the initial state
71
71
 
@@ -73,9 +73,9 @@ Preconditions: describe the initial state
73
73
  1. Step 1
74
74
  2. Step 2
75
75
  3. Expected result
76
- `;function Me(e,t=[]){const[n,r]=j.useState(null),[i,l]=j.useState(null),[a,o]=j.useState(0);j.useEffect(()=>{let c=!0;return e().then(h=>c&&(r(h),l(null))).catch(h=>c&&l(h.message)),()=>{c=!1}},[...t,a]);const u=j.useCallback(()=>o(c=>c+1),[]);return{data:n,error:i,reload:u}}const Ty=j.createContext({specs:[],mapping:[],refresh:()=>{}}),Xt=()=>j.useContext(Ty);function J0(){const[e,t]=j.useState([]),[n,r]=j.useState([]),i=j.useCallback(()=>{Promise.all([q.specs(),q.mapping()]).then(([l,a])=>{t(l),r(a)}).catch(()=>{})},[]);return j.useEffect(()=>{i();const l=setInterval(i,15e3);return()=>clearInterval(l)},[i]),{specs:e,mapping:n,refresh:i}}function X0(e){const[t,n]=j.useState(null),[r,i]=j.useState([]),[l,a]=j.useState([]),[o,u]=j.useState(null),[c,h]=j.useState({}),[d,f]=j.useState(null),[m,p]=j.useState(null),g=j.useRef(!1),[w,x]=j.useState(0),y=j.useCallback(()=>x(b=>b+1),[]),v=j.useCallback(async()=>{const b=await q.job(e);return p(b.pending??null),n(b.job),i(b.agentRuns),a(b.testResults),u(b.pipeline??null),b},[e]);return j.useEffect(()=>{let b=!0,E=null,k=null;g.current=!1;const R=()=>{h({}),E=G0(e,T=>{b&&(T.type==="job"?(n(T.job),T.job.status==="waiting"?v():p(null),Hc.includes(T.job.status)&&!g.current&&(g.current=!0,v())):T.type==="agent"?i(D=>{const C=D.findIndex(A=>A.id===T.run.id);if(C<0)return[...D,T.run].sort((A,z)=>A.seq-z.seq);const L=D.slice();return L[C]=T.run,L}):h(D=>({...D,[T.runId]:(D[T.runId]??"")+T.chunk})))},()=>{b&&!g.current&&(k=setTimeout(R,2e3))})};return v().then(()=>b&&R()).catch(T=>b&&f(T.message)),()=>{b=!1,E==null||E(),k&&clearTimeout(k)}},[e,v,w]),{job:t,runs:r,results:l,pipeline:o,pending:m,logs:c,error:d,refetch:v,reconnect:y}}function Z0(){const[e,t]=j.useState(()=>{try{return localStorage.getItem("qa-studio.theme")??"light"}catch{return"light"}});return j.useEffect(()=>{document.documentElement.dataset.theme=e;try{localStorage.setItem("qa-studio.theme",e)}catch{}},[e]),[e,()=>t(n=>n==="dark"?"light":"dark")]}function eb(e,t){const[n,r]=j.useState(e);return j.useEffect(()=>{const i=setTimeout(()=>r(e),t);return()=>clearTimeout(i)},[e,t]),n}function we({size:e=18,children:t,...n}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:t})}const tb=e=>s.jsxs(we,{...e,children:[s.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"2"}),s.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"2"}),s.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"2"}),s.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"2"})]}),jr=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),s.jsx("path",{d:"M14 3v5h5M9 13h6M9 17h4"})]}),vh=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"})]}),ft=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z"})}),nb=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z",fill:"currentColor",stroke:"none"})}),rb=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M10 3.5l1.6 4.4a2 2 0 0 0 1.2 1.2L17.2 10.7l-4.4 1.6a2 2 0 0 0-1.2 1.2L10 17.9l-1.6-4.4a2 2 0 0 0-1.2-1.2L2.8 10.7l4.4-1.6a2 2 0 0 0 1.2-1.2z"}),s.jsx("path",{d:"M18.5 14.5l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z"})]}),Ro=e=>s.jsxs(we,{...e,children:[s.jsx("circle",{cx:"11",cy:"11",r:"7"}),s.jsx("path",{d:"m20 20-3.5-3.5"})]}),Qt=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M12 5v14M5 12h14"})}),ti=({open:e,...t})=>s.jsx(we,{...t,style:{transform:e?"rotate(90deg)":void 0,transition:"transform .15s"},children:s.jsx("path",{d:"m9 6 6 6-6 6"})}),jh=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"m5 12 5 5 9-10"})}),wr=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),sb=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"})}),Py=e=>s.jsxs(we,{...e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m15.5 8.5-2 5-5 2 2-5z"})]}),wh=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"m4 20 12-12M14 4l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM19 11l.6 1.4L21 13l-1.4.6L19 15l-.6-1.4L17 13l1.4-.6z"})}),kh=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M12 3 5 6v6c0 4.5 3 7.5 7 9 4-1.5 7-4.5 7-9V6z"}),s.jsx("path",{d:"m9 12 2 2 4-4"})]}),Ry=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M19.5 12.5 12 20l-7.5-7.5a4.5 4.5 0 0 1 6.4-6.4l1.1 1.1 1.1-1.1a4.5 4.5 0 0 1 6.4 6.4z"}),s.jsx("path",{d:"M12 10v5M9.5 12.5h5"})]}),ib=e=>s.jsxs(we,{...e,children:[s.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),s.jsx("path",{d:"m7 9 3 3-3 3M13 15h4"})]}),Ly=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"})}),Ay=e=>s.jsxs(we,{...e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),Rr=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M20 11a8 8 0 0 0-14.5-4.5L4 8M4 4v4h4M4 13a8 8 0 0 0 14.5 4.5L20 16M20 20v-4h-4"})}),Iy=e=>s.jsx(we,{...e,children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Lr=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3"})}),us=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M5 3h11l3 3v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}),s.jsx("path",{d:"M7 3v6h8V3M7 21v-7h10v7"})]}),Dy=e=>s.jsxs(we,{...e,children:[s.jsx("circle",{cx:"7",cy:"7",r:"3"}),s.jsx("circle",{cx:"17",cy:"17",r:"3"}),s.jsx("path",{d:"M10 7h4a3 3 0 0 1 3 3v4M7 10v4a3 3 0 0 0 3 3h4"})]}),lb=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"}),s.jsx("circle",{cx:"15",cy:"6",r:"2"}),s.jsx("circle",{cx:"9",cy:"12",r:"2"}),s.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),ab=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M19 12H5M11 18l-6-6 6-6"})}),Lo=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M12 16V4M7 9l5-5 5 5M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3"})}),bh=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20V3H6.5A2.5 2.5 0 0 0 4 5.5z"}),s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 0 6.5 22H20v-5"})]}),ob=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M9 6h11M9 12h11M9 18h11"}),s.jsx("path",{d:"M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2"})]}),Sh=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M14 4h6v6M20 4l-9 9"}),s.jsx("path",{d:"M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"})]}),fl=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M12 20h9"}),s.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"})]}),is=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M17 2l4 4-4 4"}),s.jsx("path",{d:"M3 11v-1a4 4 0 0 1 4-4h14"}),s.jsx("path",{d:"M7 22l-4-4 4-4"}),s.jsx("path",{d:"M21 13v1a4 4 0 0 1-4 4H3"})]}),My=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M12 14l4-4"}),s.jsx("path",{d:"M3.3 19a9 9 0 1 1 17.4 0"})]}),ub=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M4 5h16l-6 8v5l-4 2v-7z"})}),cb=e=>s.jsxs(we,{...e,children:[s.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),s.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]}),zy=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"m21 11.5-8.6 8.6a5.5 5.5 0 0 1-7.8-7.8l8.6-8.6a3.7 3.7 0 0 1 5.2 5.2l-8.6 8.6a1.8 1.8 0 0 1-2.6-2.6l7.9-7.9"})}),db=e=>s.jsx(we,{...e,children:s.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Nh=e=>s.jsxs(we,{...e,children:[s.jsx("path",{d:"M20 12a8 8 0 0 1-11.6 7.1L4 20l1-4.1A8 8 0 1 1 20 12z"}),s.jsx("path",{d:"M8.5 12h.01M12 12h.01M15.5 12h.01"})]}),hb=/^[A-Z][A-Z0-9]*(-[A-Z0-9]+)+$/;function fb(e){return typeof e=="string"&&hb.test(e)}function pb(e){const t={title:"",tags:[],preconditions:"",tcs:[],warnings:[]},n=new Set;return e.split(/\r?\n/).forEach((r,i)=>{const l=r.trim(),a=i+1;let o;const u=t.tcs[t.tcs.length-1];if(!t.title&&(o=l.match(/^#\s+(.+)$/)))t.title=o[1].trim();else if(o=l.match(/^tags\s*:\s*(.*)$/i)){const c=o[1].split(",").map(h=>h.trim()).filter(Boolean);u?u.tags=c:t.tags=c}else if(u&&(o=l.match(/^technique\s*:\s*(.*)$/i)))u.technique=o[1].trim()||null;else if(o=l.match(/^preconditions\s*:\s*(.*)$/i))t.preconditions=o[1].trim();else if(o=l.match(/^##\s+(.*)$/)){const c=o[1].match(/^(\S+?)\s*:\s*(.+)$/);c&&fb(c[1])?(n.has(c[1])&&t.warnings.push(`Line ${a}: duplicate TC-ID ${c[1]} in spec`),n.add(c[1]),t.tcs.push({id:c[1],title:c[2].trim(),line:a,tags:[],technique:null})):t.warnings.push(`Line ${a}: heading "${l}" does not match "## <TC-ID>: <name>"`)}}),t}const Dp=e=>e===null||e===""?[]:e.replace(/\r\n/g,`
76
+ `;function _e(e,t=[]){const[n,r]=j.useState(null),[i,l]=j.useState(null),[a,o]=j.useState(0);j.useEffect(()=>{let c=!0;return e().then(h=>c&&(r(h),l(null))).catch(h=>c&&l(h.message)),()=>{c=!1}},[...t,a]);const u=j.useCallback(()=>o(c=>c+1),[]);return{data:n,error:i,reload:u}}const Ty=j.createContext({specs:[],mapping:[],refresh:()=>{}}),Zt=()=>j.useContext(Ty);function Z0(){const[e,t]=j.useState([]),[n,r]=j.useState([]),i=j.useCallback(()=>{Promise.all([q.specs(),q.mapping()]).then(([l,a])=>{t(l),r(a)}).catch(()=>{})},[]);return j.useEffect(()=>{i();const l=setInterval(i,15e3);return()=>clearInterval(l)},[i]),{specs:e,mapping:n,refresh:i}}function eb(e){const[t,n]=j.useState(null),[r,i]=j.useState([]),[l,a]=j.useState([]),[o,u]=j.useState(null),[c,h]=j.useState({}),[d,f]=j.useState(null),[m,p]=j.useState(null),g=j.useRef(!1),[w,x]=j.useState(0),y=j.useCallback(()=>x(b=>b+1),[]),v=j.useCallback(async()=>{const b=await q.job(e);return p(b.pending??null),n(b.job),i(b.agentRuns),a(b.testResults),u(b.pipeline??null),b},[e]);return j.useEffect(()=>{let b=!0,E=null,k=null;g.current=!1;const R=()=>{h({}),E=Y0(e,T=>{b&&(T.type==="job"?(n(T.job),T.job.status==="waiting"?v():p(null),Hc.includes(T.job.status)&&!g.current&&(g.current=!0,v())):T.type==="agent"?i(D=>{const C=D.findIndex(A=>A.id===T.run.id);if(C<0)return[...D,T.run].sort((A,z)=>A.seq-z.seq);const L=D.slice();return L[C]=T.run,L}):h(D=>({...D,[T.runId]:(D[T.runId]??"")+T.chunk})))},()=>{b&&!g.current&&(k=setTimeout(R,2e3))})};return v().then(()=>b&&R()).catch(T=>b&&f(T.message)),()=>{b=!1,E==null||E(),k&&clearTimeout(k)}},[e,v,w]),{job:t,runs:r,results:l,pipeline:o,pending:m,logs:c,error:d,refetch:v,reconnect:y}}function tb(){const[e,t]=j.useState(()=>{try{return localStorage.getItem("qa-studio.theme")??"light"}catch{return"light"}});return j.useEffect(()=>{document.documentElement.dataset.theme=e;try{localStorage.setItem("qa-studio.theme",e)}catch{}},[e]),[e,()=>t(n=>n==="dark"?"light":"dark")]}function nb(e,t){const[n,r]=j.useState(e);return j.useEffect(()=>{const i=setTimeout(()=>r(e),t);return()=>clearTimeout(i)},[e,t]),n}function ke({size:e=18,children:t,...n}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:t})}const rb=e=>s.jsxs(ke,{...e,children:[s.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"2"}),s.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"2"}),s.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"2"}),s.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"2"})]}),jr=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),s.jsx("path",{d:"M14 3v5h5M9 13h6M9 17h4"})]}),vh=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"})]}),ft=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z"})}),sb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z",fill:"currentColor",stroke:"none"})}),ib=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M10 3.5l1.6 4.4a2 2 0 0 0 1.2 1.2L17.2 10.7l-4.4 1.6a2 2 0 0 0-1.2 1.2L10 17.9l-1.6-4.4a2 2 0 0 0-1.2-1.2L2.8 10.7l4.4-1.6a2 2 0 0 0 1.2-1.2z"}),s.jsx("path",{d:"M18.5 14.5l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z"})]}),Ro=e=>s.jsxs(ke,{...e,children:[s.jsx("circle",{cx:"11",cy:"11",r:"7"}),s.jsx("path",{d:"m20 20-3.5-3.5"})]}),qt=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M12 5v14M5 12h14"})}),ti=({open:e,...t})=>s.jsx(ke,{...t,style:{transform:e?"rotate(90deg)":void 0,transition:"transform .15s"},children:s.jsx("path",{d:"m9 6 6 6-6 6"})}),jh=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"m5 12 5 5 9-10"})}),wr=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),lb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"})}),Py=e=>s.jsxs(ke,{...e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m15.5 8.5-2 5-5 2 2-5z"})]}),wh=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"m4 20 12-12M14 4l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM19 11l.6 1.4L21 13l-1.4.6L19 15l-.6-1.4L17 13l1.4-.6z"})}),kh=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M12 3 5 6v6c0 4.5 3 7.5 7 9 4-1.5 7-4.5 7-9V6z"}),s.jsx("path",{d:"m9 12 2 2 4-4"})]}),Ry=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M19.5 12.5 12 20l-7.5-7.5a4.5 4.5 0 0 1 6.4-6.4l1.1 1.1 1.1-1.1a4.5 4.5 0 0 1 6.4 6.4z"}),s.jsx("path",{d:"M12 10v5M9.5 12.5h5"})]}),ab=e=>s.jsxs(ke,{...e,children:[s.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),s.jsx("path",{d:"m7 9 3 3-3 3M13 15h4"})]}),Ly=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"})}),Ay=e=>s.jsxs(ke,{...e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),Lr=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M20 11a8 8 0 0 0-14.5-4.5L4 8M4 4v4h4M4 13a8 8 0 0 0 14.5 4.5L20 16M20 20v-4h-4"})}),Iy=e=>s.jsx(ke,{...e,children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Ar=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3"})}),cs=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M5 3h11l3 3v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}),s.jsx("path",{d:"M7 3v6h8V3M7 21v-7h10v7"})]}),Dy=e=>s.jsxs(ke,{...e,children:[s.jsx("circle",{cx:"7",cy:"7",r:"3"}),s.jsx("circle",{cx:"17",cy:"17",r:"3"}),s.jsx("path",{d:"M10 7h4a3 3 0 0 1 3 3v4M7 10v4a3 3 0 0 0 3 3h4"})]}),ob=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"}),s.jsx("circle",{cx:"15",cy:"6",r:"2"}),s.jsx("circle",{cx:"9",cy:"12",r:"2"}),s.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),ub=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M19 12H5M11 18l-6-6 6-6"})}),Lo=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M12 16V4M7 9l5-5 5 5M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3"})}),bh=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20V3H6.5A2.5 2.5 0 0 0 4 5.5z"}),s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 0 6.5 22H20v-5"})]}),cb=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M9 6h11M9 12h11M9 18h11"}),s.jsx("path",{d:"M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2"})]}),Sh=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M14 4h6v6M20 4l-9 9"}),s.jsx("path",{d:"M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"})]}),hl=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M12 20h9"}),s.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"})]}),ls=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M17 2l4 4-4 4"}),s.jsx("path",{d:"M3 11v-1a4 4 0 0 1 4-4h14"}),s.jsx("path",{d:"M7 22l-4-4 4-4"}),s.jsx("path",{d:"M21 13v1a4 4 0 0 1-4 4H3"})]}),My=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M12 14l4-4"}),s.jsx("path",{d:"M3.3 19a9 9 0 1 1 17.4 0"})]}),db=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M4 5h16l-6 8v5l-4 2v-7z"})}),hb=e=>s.jsxs(ke,{...e,children:[s.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),s.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]}),zy=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"m21 11.5-8.6 8.6a5.5 5.5 0 0 1-7.8-7.8l8.6-8.6a3.7 3.7 0 0 1 5.2 5.2l-8.6 8.6a1.8 1.8 0 0 1-2.6-2.6l7.9-7.9"})}),fb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Nh=e=>s.jsxs(ke,{...e,children:[s.jsx("path",{d:"M20 12a8 8 0 0 1-11.6 7.1L4 20l1-4.1A8 8 0 1 1 20 12z"}),s.jsx("path",{d:"M8.5 12h.01M12 12h.01M15.5 12h.01"})]}),pb=/^[A-Z][A-Z0-9]*(-[A-Z0-9]+)+$/;function mb(e){return typeof e=="string"&&pb.test(e)}function gb(e){const t={title:"",tags:[],preconditions:"",tcs:[],warnings:[]},n=new Set;return e.split(/\r?\n/).forEach((r,i)=>{const l=r.trim(),a=i+1;let o;const u=t.tcs[t.tcs.length-1];if(!t.title&&(o=l.match(/^#\s+(.+)$/)))t.title=o[1].trim();else if(o=l.match(/^tags\s*:\s*(.*)$/i)){const c=o[1].split(",").map(h=>h.trim()).filter(Boolean);u?u.tags=c:t.tags=c}else if(u&&(o=l.match(/^technique\s*:\s*(.*)$/i)))u.technique=o[1].trim()||null;else if(o=l.match(/^preconditions\s*:\s*(.*)$/i))t.preconditions=o[1].trim();else if(o=l.match(/^##\s+(.*)$/)){const c=o[1].match(/^(\S+?)\s*:\s*(.+)$/);c&&mb(c[1])?(n.has(c[1])&&t.warnings.push(`Line ${a}: duplicate TC-ID ${c[1]} in spec`),n.add(c[1]),t.tcs.push({id:c[1],title:c[2].trim(),line:a,tags:[],technique:null})):t.warnings.push(`Line ${a}: heading "${l}" does not match "## <TC-ID>: <name>"`)}}),t}const Dp=e=>e===null||e===""?[]:e.replace(/\r\n/g,`
77
77
  `).split(`
78
- `);function mb(e,t){const n=Dp(e),r=Dp(t),i=Array.from({length:n.length+1},()=>new Array(r.length+1).fill(0));for(let u=n.length-1;u>=0;u--)for(let c=r.length-1;c>=0;c--)i[u][c]=n[u]===r[c]?i[u+1][c+1]+1:Math.max(i[u+1][c],i[u][c+1]);const l=[];let a=0,o=0;for(;a<n.length&&o<r.length;)n[a]===r[o]?(l.push({type:"same",text:n[a]}),a++,o++):i[a+1][o]>=i[a][o+1]?l.push({type:"del",text:n[a++]}):l.push({type:"add",text:r[o++]});for(;a<n.length;)l.push({type:"del",text:n[a++]});for(;o<r.length;)l.push({type:"add",text:r[o++]});return l}const Se={explorer:{label:"QA Explorer",llm:!0,description:"Verifies each test case in a real browser"},generator:{label:"QA Script Generator",llm:!0,description:"Generates the Playwright script from the exploration results"},validator:{label:"QA Validator",llm:!1,description:"Runs the script with repeat-each=3, retries=0"},healer:{label:"QA Script Healer",llm:!0,description:"Fixes script errors (never assertions) and flags app bugs"},runner:{label:"QA Test Runner",llm:!1,description:"Runs Playwright tests"},specwriter:{label:"QA Test Case Writer",llm:!0,description:"Turns a BA requirement into a spec file with test cases"},contextwriter:{label:"Context Writer",llm:!0,description:"Rewrites the project context in CLAUDE.md and removes the old project's"},custom:{label:"Custom agent",llm:!0,description:"An agent created on the Agents page"}},Ao={explore:["explorer"],generate:["explorer","generator","validator"],heal:["healer","validator"],spec:["specwriter"],testrun:["runner"],context:["contextwriter"]},Ch=["validator","healer"],Mp=500,gb=5,xb=120,yb=2e3,wu=5e4,_y=20,vb=[10,20,50,100],jb={maxHealRounds:2},zp=10,Eh=[{id:"opus",label:"Opus — most capable, highest cost"},{id:"sonnet",label:"Sonnet — balanced"},{id:"haiku",label:"Haiku — fastest, cheapest"}],wb=["specFile","testFile","jobDir"],kb={mode:"scoped",browser:!1,editTests:!1,editSpecs:!1,typecheck:!1,deniedCommands:[],protectedPaths:[]},$y=["git push","git reset --hard","rm -rf","curl","wget","cat .env","type .env"],Oy=["qa-studio",".git",".claude","node_modules"],bb=2e3;Eh.map(e=>e.id);const Th=e=>`custom:${e}`,Sl=e=>e.startsWith("custom:")?e.slice(7):null,Sb=["first","last"],cs=e=>typeof e=="string"?{kind:"agent",agent:e}:e,Wc=80,Vc=500,Sa=20,Na=10,pl=10,Nb=3,no=3,_p=100,Cb=Object.keys(Se).filter(e=>e!=="custom"),Io=e=>e.flatMap(t=>t.kind==="agent"?[t.agent]:Io(t.steps.map(cs))),Fy=e=>e.kind==="agent"?0:1+Math.max(0,...e.steps.map(t=>Fy(cs(t))));function Uy(e){if(e.kind==="agent")return 1;const t=e.steps.map(a=>Uy(cs(a))),n=e.maxIterations,r=t.reduce((a,o)=>a+o,0);if(e.endsWhen==="last")return n*r;const[i=0,...l]=t;return n*i+Math.max(0,n-1)*l.reduce((a,o)=>a+o,0)}const Eb=new Set(["explorer","generator","validator","healer","runner","specwriter"]),Tb=e=>Io(e).find(t=>Eb.has(t))??null;function Pb(e,t){const n=[];if(!e||typeof e!="object")return{ok:!1,errors:["Body must be an object"]};const r=e,i=typeof r.name=="string"?r.name.trim():"";i?i.length>Wc&&n.push(`Name is longer than ${Wc} characters`):n.push("Name is required");const l=r.description===void 0||r.description===null?"":r.description;typeof l!="string"?n.push("Description must be text"):l.length>Vc&&n.push(`Description is longer than ${Vc} characters`);let a;if(r.workDir!==void 0&&r.workDir!==null)if(typeof r.workDir!="string")n.push("Working directory must be text");else{const h=r.workDir.trim();h&&(/^([A-Za-z]:[\\/]|\/)/.test(h)?a=/^([A-Za-z]:[\\/]|\/)$/.test(h)?h:h.replace(/[\\/]+$/,""):n.push("Working directory must be an absolute path (e.g. D:\\my-app)"))}const o=h=>typeof h!="string"?`unknown agent ${JSON.stringify(h)}`:Sl(h)!==null||Cb.includes(h)?null:`unknown agent ${JSON.stringify(h)}`,u=(h,d,f)=>{if(f>no)return n.push(`${d}: loops can be nested at most ${no} levels deep`),null;const m=h.maxIterations;let p=!0;if((typeof m!="number"||!Number.isInteger(m)||m<1||m>pl)&&(n.push(`${d}: maximum loop count must be a whole number from 1 to ${pl}`),p=!1),h.endsWhen!==void 0&&!Sb.includes(h.endsWhen)&&(n.push(`${d}: ends when must be "first" or "last"`),p=!1),!Array.isArray(h.steps)||h.steps.length===0)return n.push(`${d}: drop at least one agent into the loop`),null;h.steps.length>Na&&(n.push(`${d}: a loop has at most ${Na} entries`),p=!1);const g=[],w=new Set;return h.steps.slice(0,Na).forEach((x,y)=>{if(typeof x=="string"){const b=o(x);b?w.add(b):g.push(x);return}const v=x;if(v&&typeof v=="object"&&v.kind==="loop"){const b=u(v,`${d} › loop ${y+1}`,f+1);b?g.push(b):p=!1;return}if(v&&typeof v=="object"&&v.kind==="agent"){const b=o(v.agent);b?w.add(b):g.push(v.agent);return}w.add(`unknown agent ${JSON.stringify(x)}`)}),w.forEach(x=>n.push(`${d}: ${x}`)),!p||w.size?null:{kind:"loop",steps:g,maxIterations:m,...h.endsWhen==="last"?{endsWhen:"last"}:{}}},c=[];return Array.isArray(r.steps)?(r.steps.length===0&&n.push("Add at least one agent to the pipeline"),r.steps.length>Sa&&n.push(`A pipeline has at most ${Sa} blocks`),r.steps.slice(0,Sa).forEach((h,d)=>{const f=`Block ${d+1}`,m=h;if(!m||typeof m!="object")return void n.push(`${f}: must be an object`);if(m.kind==="agent"){const p=o(m.agent);if(p)return void n.push(`${f}: ${p}`);c.push({kind:"agent",agent:m.agent})}else if(m.kind==="loop"){const p=u(m,f,1);if(!p)return;const g=Uy(p);if(Fy(p)>1&&g>_p)return void n.push(`${f}: these nested loops could take up to ${g} agent runs (at most ${_p}); lower the maximum iterations`);c.push(p)}else n.push(`${f}: kind must be "agent" or "loop"`)})):n.push("steps must be a list"),c.findIndex(h=>Io([h]).includes("specwriter")),n.length?{ok:!1,errors:n}:{ok:!0,value:{name:i,description:l.trim(),steps:c,...a?{workDir:a}:{}}}}function Rb(e){const t=Math.max(1,Math.min(pl,e+1));return[{id:"explore",name:"Explore",description:"Verify each test case in a real browser.",steps:[{kind:"agent",agent:"explorer"}]},{id:"generate",name:"Generate",description:"Explore the spec, generate the script, then validate and heal until it passes.",steps:[{kind:"agent",agent:"explorer"},{kind:"agent",agent:"generator"},{kind:"loop",steps:["validator","healer"],maxIterations:t}]},{id:"heal",name:"Heal",description:"Fix a failing script, then validate it.",steps:[{kind:"loop",steps:["validator","healer"],maxIterations:t}]},{id:"spec",name:"Write spec",description:"Turn a BA requirement into a spec file.",steps:[{kind:"agent",agent:"specwriter"}]},{id:"testrun",name:"Test run",description:"Run all tests, one spec, one test case or a picked selection.",steps:[{kind:"agent",agent:"runner"}]},{id:"context",name:"Project context",description:"Rewrite the project context in CLAUDE.md.",steps:[{kind:"agent",agent:"contextwriter"}]}]}const $p=[{id:"default",label:"Default"},{id:"fable",label:"Fable"},{id:"opus",label:"Opus"},{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"}],Kr=["default","low","medium","high","xhigh","max"],ro=[{id:"manual",label:"Ask every time",description:"Like the terminal: Claude asks before editing files or running commands"},{id:"acceptEdits",label:"Accept edits",description:"File edits run without asking; commands and other actions ask you first"},{id:"plan",label:"Plan (read-only)",description:"Claude can read and search but not edit files or run commands"},{id:"auto",label:"Auto",description:"Claude Code decides which actions are safe to run"},{id:"bypassPermissions",label:"Bypass permissions",description:"Every tool runs without asking (use with care)"}];function na(e,t){const n=t.toLowerCase();if(!n)return e;const r=i=>{const l=i.name.toLowerCase();return l.startsWith(n)||l.slice(l.indexOf(":")+1).startsWith(n)?0:l.includes(n)?1:i.description.toLowerCase().includes(n)?2:3};return e.map((i,l)=>({i,idx:l,r:r(i)})).filter(i=>i.r<3).sort((i,l)=>i.r-l.r||i.idx-l.idx).map(i=>i.i)}const By={mode:"scoped",browser:!1,editTests:!1,editSpecs:!1,typecheck:!1,deniedCommands:[],protectedPaths:[]},ku={...By,mode:"full",typecheck:!0,deniedCommands:[...$y],protectedPaths:[...Oy]},Lb=`# Planner Agent — Instructions
78
+ `);function xb(e,t){const n=Dp(e),r=Dp(t),i=Array.from({length:n.length+1},()=>new Array(r.length+1).fill(0));for(let u=n.length-1;u>=0;u--)for(let c=r.length-1;c>=0;c--)i[u][c]=n[u]===r[c]?i[u+1][c+1]+1:Math.max(i[u+1][c],i[u][c+1]);const l=[];let a=0,o=0;for(;a<n.length&&o<r.length;)n[a]===r[o]?(l.push({type:"same",text:n[a]}),a++,o++):i[a+1][o]>=i[a][o+1]?l.push({type:"del",text:n[a++]}):l.push({type:"add",text:r[o++]});for(;a<n.length;)l.push({type:"del",text:n[a++]});for(;o<r.length;)l.push({type:"add",text:r[o++]});return l}const Ne={explorer:{label:"QA Explorer",llm:!0,description:"Verifies each test case in a real browser"},generator:{label:"QA Script Generator",llm:!0,description:"Generates the Playwright script from the exploration results"},validator:{label:"QA Validator",llm:!1,description:"Runs the script with repeat-each=3, retries=0"},healer:{label:"QA Script Healer",llm:!0,description:"Fixes script errors (never assertions) and flags app bugs"},runner:{label:"QA Test Runner",llm:!1,description:"Runs Playwright tests"},specwriter:{label:"QA Test Case Writer",llm:!0,description:"Turns a BA requirement into a spec file with test cases"},contextwriter:{label:"Context Writer",llm:!0,description:"Rewrites the project context in CLAUDE.md and removes the old project's"},custom:{label:"Custom agent",llm:!0,description:"An agent created on the Agents page"}},Ao={explore:["explorer"],generate:["explorer","generator","validator"],heal:["healer","validator"],spec:["specwriter"],testrun:["runner"],context:["contextwriter"]},Ch=["validator","healer"],Mp=500,yb=5,vb=120,jb=2e3,wu=5e4,_y=20,wb=[10,20,50,100],kb={maxHealRounds:2},zp=10,Eh=[{id:"opus",label:"Opus — most capable, highest cost"},{id:"sonnet",label:"Sonnet — balanced"},{id:"haiku",label:"Haiku — fastest, cheapest"}],bb=["specFile","testFile","jobDir"],Sb={mode:"scoped",browser:!1,editTests:!1,editSpecs:!1,typecheck:!1,deniedCommands:[],protectedPaths:[]},$y=["git push","git reset --hard","rm -rf","curl","wget","cat .env","type .env"],Oy=["qa-studio",".git",".claude","node_modules"],Nb=2e3;Eh.map(e=>e.id);const Th=e=>`custom:${e}`,bl=e=>e.startsWith("custom:")?e.slice(7):null,Cb=["first","last"],ds=e=>typeof e=="string"?{kind:"agent",agent:e}:e,Wc=80,Vc=500,ba=20,Sa=10,fl=10,Eb=3,to=3,_p=100,Tb=Object.keys(Ne).filter(e=>e!=="custom"),Io=e=>e.flatMap(t=>t.kind==="agent"?[t.agent]:Io(t.steps.map(ds))),Fy=e=>e.kind==="agent"?0:1+Math.max(0,...e.steps.map(t=>Fy(ds(t))));function Uy(e){if(e.kind==="agent")return 1;const t=e.steps.map(a=>Uy(ds(a))),n=e.maxIterations,r=t.reduce((a,o)=>a+o,0);if(e.endsWhen==="last")return n*r;const[i=0,...l]=t;return n*i+Math.max(0,n-1)*l.reduce((a,o)=>a+o,0)}const Pb=new Set(["explorer","generator","validator","healer","runner","specwriter"]),Rb=e=>Io(e).find(t=>Pb.has(t))??null;function Lb(e,t){const n=[];if(!e||typeof e!="object")return{ok:!1,errors:["Body must be an object"]};const r=e,i=typeof r.name=="string"?r.name.trim():"";i?i.length>Wc&&n.push(`Name is longer than ${Wc} characters`):n.push("Name is required");const l=r.description===void 0||r.description===null?"":r.description;typeof l!="string"?n.push("Description must be text"):l.length>Vc&&n.push(`Description is longer than ${Vc} characters`);let a;if(r.workDir!==void 0&&r.workDir!==null)if(typeof r.workDir!="string")n.push("Working directory must be text");else{const h=r.workDir.trim();h&&(/^([A-Za-z]:[\\/]|\/)/.test(h)?a=/^([A-Za-z]:[\\/]|\/)$/.test(h)?h:h.replace(/[\\/]+$/,""):n.push("Working directory must be an absolute path (e.g. D:\\my-app)"))}const o=h=>typeof h!="string"?`unknown agent ${JSON.stringify(h)}`:bl(h)!==null||Tb.includes(h)?null:`unknown agent ${JSON.stringify(h)}`,u=(h,d,f)=>{if(f>to)return n.push(`${d}: loops can be nested at most ${to} levels deep`),null;const m=h.maxIterations;let p=!0;if((typeof m!="number"||!Number.isInteger(m)||m<1||m>fl)&&(n.push(`${d}: maximum loop count must be a whole number from 1 to ${fl}`),p=!1),h.endsWhen!==void 0&&!Cb.includes(h.endsWhen)&&(n.push(`${d}: ends when must be "first" or "last"`),p=!1),!Array.isArray(h.steps)||h.steps.length===0)return n.push(`${d}: drop at least one agent into the loop`),null;h.steps.length>Sa&&(n.push(`${d}: a loop has at most ${Sa} entries`),p=!1);const g=[],w=new Set;return h.steps.slice(0,Sa).forEach((x,y)=>{if(typeof x=="string"){const b=o(x);b?w.add(b):g.push(x);return}const v=x;if(v&&typeof v=="object"&&v.kind==="loop"){const b=u(v,`${d} › loop ${y+1}`,f+1);b?g.push(b):p=!1;return}if(v&&typeof v=="object"&&v.kind==="agent"){const b=o(v.agent);b?w.add(b):g.push(v.agent);return}w.add(`unknown agent ${JSON.stringify(x)}`)}),w.forEach(x=>n.push(`${d}: ${x}`)),!p||w.size?null:{kind:"loop",steps:g,maxIterations:m,...h.endsWhen==="last"?{endsWhen:"last"}:{}}},c=[];return Array.isArray(r.steps)?(r.steps.length===0&&n.push("Add at least one agent to the pipeline"),r.steps.length>ba&&n.push(`A pipeline has at most ${ba} blocks`),r.steps.slice(0,ba).forEach((h,d)=>{const f=`Block ${d+1}`,m=h;if(!m||typeof m!="object")return void n.push(`${f}: must be an object`);if(m.kind==="agent"){const p=o(m.agent);if(p)return void n.push(`${f}: ${p}`);c.push({kind:"agent",agent:m.agent})}else if(m.kind==="loop"){const p=u(m,f,1);if(!p)return;const g=Uy(p);if(Fy(p)>1&&g>_p)return void n.push(`${f}: these nested loops could take up to ${g} agent runs (at most ${_p}); lower the maximum iterations`);c.push(p)}else n.push(`${f}: kind must be "agent" or "loop"`)})):n.push("steps must be a list"),c.findIndex(h=>Io([h]).includes("specwriter")),n.length?{ok:!1,errors:n}:{ok:!0,value:{name:i,description:l.trim(),steps:c,...a?{workDir:a}:{}}}}function Ab(e){const t=Math.max(1,Math.min(fl,e+1));return[{id:"explore",name:"Explore",description:"Verify each test case in a real browser.",steps:[{kind:"agent",agent:"explorer"}]},{id:"generate",name:"Generate",description:"Explore the spec, generate the script, then validate and heal until it passes.",steps:[{kind:"agent",agent:"explorer"},{kind:"agent",agent:"generator"},{kind:"loop",steps:["validator","healer"],maxIterations:t}]},{id:"heal",name:"Heal",description:"Fix a failing script, then validate it.",steps:[{kind:"loop",steps:["validator","healer"],maxIterations:t}]},{id:"spec",name:"Write spec",description:"Turn a BA requirement into a spec file.",steps:[{kind:"agent",agent:"specwriter"}]},{id:"testrun",name:"Test run",description:"Run all tests, one spec, one test case or a picked selection.",steps:[{kind:"agent",agent:"runner"}]},{id:"context",name:"Project context",description:"Rewrite the project context in CLAUDE.md.",steps:[{kind:"agent",agent:"contextwriter"}]}]}const $p=[{id:"default",label:"Default"},{id:"fable",label:"Fable"},{id:"opus",label:"Opus"},{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"}],Yr=["default","low","medium","high","xhigh","max"],no=[{id:"manual",label:"Ask every time",description:"Like the terminal: Claude asks before editing files or running commands"},{id:"acceptEdits",label:"Accept edits",description:"File edits run without asking; commands and other actions ask you first"},{id:"plan",label:"Plan (read-only)",description:"Claude can read and search but not edit files or run commands"},{id:"auto",label:"Auto",description:"Claude Code decides which actions are safe to run"},{id:"bypassPermissions",label:"Bypass permissions",description:"Every tool runs without asking (use with care)"}];function ta(e,t){const n=t.toLowerCase();if(!n)return e;const r=i=>{const l=i.name.toLowerCase();return l.startsWith(n)||l.slice(l.indexOf(":")+1).startsWith(n)?0:l.includes(n)?1:i.description.toLowerCase().includes(n)?2:3};return e.map((i,l)=>({i,idx:l,r:r(i)})).filter(i=>i.r<3).sort((i,l)=>i.r-l.r||i.idx-l.idx).map(i=>i.i)}const By={mode:"scoped",browser:!1,editTests:!1,editSpecs:!1,typecheck:!1,deniedCommands:[],protectedPaths:[]},ku={...By,mode:"full",typecheck:!0,deniedCommands:[...$y],protectedPaths:[...Oy]},Ib=`# Planner Agent — Instructions
79
79
 
80
80
  ## 1. Persona
81
81
 
@@ -136,7 +136,7 @@ Ask the questions that matter, get the human's answers, and turn the request int
136
136
  - Do not write or change code.
137
137
  - Keep the solution minimal: no features, refactors or dependencies the request does not need.
138
138
  - \`status\` is \`passed\` when you wrote questions or a final solution. Use \`failed\` only when the request cannot be planned (for example, it contradicts the codebase), and say why in \`failure\`.
139
- `,Ab=`# Coding Agent — Instructions
139
+ `,Db=`# Coding Agent — Instructions
140
140
 
141
141
  ## 1. Persona
142
142
 
@@ -192,7 +192,7 @@ Implement the **approved solution** with minimal, readable, correct and type-saf
192
192
  - **Notes for Unit Test agent:** new or changed behavior that needs tests (units, branches, edge and error cases).
193
193
 
194
194
  \`status\`: \`passed\` when the solution (or every CRITICAL/REQUIRED finding) is implemented and the checks pass, otherwise \`failed\`.
195
- `,Ib=`# Unit Test Agent
195
+ `,Mb=`# Unit Test Agent
196
196
 
197
197
  ## Persona
198
198
 
@@ -270,7 +270,7 @@ Own the unit tests for the change. Review the existing tests, update or add test
270
270
  - Are all tests deterministic and independent?
271
271
  - Is every branch of the changed code exercised?
272
272
  - Is there at least one edge case and one error case per unit?
273
- `,Db=`# Code Review Agent
273
+ `,zb=`# Code Review Agent
274
274
 
275
275
  ## Persona
276
276
 
@@ -357,63 +357,63 @@ Any CRITICAL or REQUIRED finding, or any failed check → \`"status": "failed"\`
357
357
  - Is the verdict consistent with the Rule?
358
358
  - Did I check every checklist category?
359
359
  - Is every Must-fix item specific enough for the Coding agent to act on without asking?
360
- `,Qc=[{id:"planner",label:"Planner",agent:{name:"Planner",description:"Asks the open questions, takes the answers and writes the solution",instructions:Lb,model:"sonnet",permissions:By,review:"human"}},{id:"coding",label:"Coding",agent:{name:"Coding",description:"Implements the approved solution; never writes tests",instructions:Ab,model:"opus",permissions:ku,review:"auto"}},{id:"unit-test",label:"Unit Test",agent:{name:"Unit Test",description:"Tests the diff with 100% line and branch coverage and runs the suite",instructions:Ib,model:"sonnet",permissions:ku,review:"auto"}},{id:"code-review",label:"Code Review",agent:{name:"Code Review",description:"Solution-architect review: CRITICAL/REQUIRED go back to Coding, OPTIONAL noted for later",instructions:Db,model:"sonnet",permissions:ku,review:"auto"}}];function Mb(e){const t=Qc.find(r=>r.id===e);if(!t)throw new Error(`Unknown agent template: ${e}`);const n=t.agent.permissions;return{...t.agent,skills:[],claudeMdSections:[],permissions:{...n,deniedCommands:[...n.deniedCommands],protectedPaths:[...n.protectedPaths]}}}function dt({status:e,children:t}){return e?s.jsx("span",{className:`badge ${e}`,children:t??e}):s.jsx("span",{className:"badge",children:"—"})}function kn({status:e}){return s.jsx(dt,{status:e,children:e==="passed"?"done":e==="waiting"?"waiting for review":void 0})}function ni({status:e,children:t,title:n}){return e?s.jsxs("span",{className:`pill ${e}`,title:n,children:[s.jsx("i",{}),t??e]}):s.jsx("span",{className:"pill",children:"—"})}function Pe({error:e}){return e?s.jsx("div",{className:"error-box",role:"alert",children:e}):null}function bn({value:e,onChange:t,items:n}){return s.jsx("div",{className:"tabs",role:"tablist",children:n.map(r=>s.jsx("button",{role:"tab","aria-selected":e===r.id,className:`tab ${e===r.id?"active":""}`,onClick:()=>t(r.id),children:r.label},r.id))})}const Hy={explorer:Py,generator:wh,validator:kh,healer:Ry,runner:ib,specwriter:fl,contextwriter:bh,custom:fl};function Ot({agent:e,size:t=36}){const n=Hy[e];return s.jsx("span",{className:`agent-icon ${e}`,style:{width:t,height:t,borderRadius:t/3},title:Se[e].label,children:s.jsx(n,{size:Math.round(t*.5)})})}function zb({agents:e}){return s.jsx("span",{className:"row",style:{gap:0},children:e.map(t=>{const n=Hy[t.agent];return s.jsx("span",{className:`agent-chip agent-icon ${t.agent} ${t.status}`,title:`${Se[t.agent].label}: ${t.status}`,children:s.jsx(n,{size:12})},t.id)})})}function Pt(e){if(!e)return"—";const t=new Date(e),n=(Date.now()-t.getTime())/1e3;return n<60?"just now":n<3600?`${Math.floor(n/60)} min ago`:n<86400?`${Math.floor(n/3600)} h ago`:t.toLocaleString("en-US",{hour12:!1})}function ds(e,t){if(!e)return"—";const n=(t?Date.parse(t):Date.now())-Date.parse(e);if(n<1e3)return`${Math.max(n,0)} ms`;const r=Math.round(n/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`}const kr={explore:"Explore",generate:"Generate",heal:"Heal",spec:"Write spec",testrun:"Test run",context:"Project context",custom:"Custom agent",pipeline:"Pipeline"};function _b(e){var t;return e.label??((t=Se[e.agent])==null?void 0:t.label)??e.agent}function ln(e){return e==null?"—":e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)}k`:`${(e/1e6).toFixed(2)}M`}function Gt(e){return e==null?"—":e>0&&e<.01?"<$0.01":`$${e.toFixed(2)}`}function $b({onClose:e,onNewSpec:t}){const n=ut(),{specs:r}=Xt(),i=Me(()=>q.jobs()),[l,a]=j.useState(""),[o,u]=j.useState(0),c=m=>{e(),n(m)},h=j.useMemo(()=>{const m=[{group:"Actions",key:"new",label:"Create new spec",text:"new spec create",icon:s.jsx(Qt,{size:16}),run:t},{group:"Actions",key:"runall",label:"Run all tests",text:"run all tests",icon:s.jsx(ft,{size:16}),run:()=>void q.createJob({type:"testrun",repeatEach:1}).then(g=>c(`/runs/${g.id}`))},...r.map(g=>({group:"Specs",key:`s-${g.file}`,label:s.jsxs(s.Fragment,{children:[g.file," ",s.jsx("span",{className:"muted small",children:g.parsed.title})]}),text:`${g.file} ${g.parsed.title}`,icon:s.jsx(jr,{size:16}),run:()=>c(`/specs/${g.file}`)})),...r.flatMap(g=>g.parsed.tcs.map(w=>({group:"Test case",key:`t-${g.file}-${w.id}`,label:s.jsxs(s.Fragment,{children:[s.jsx("code",{children:w.id})," ",w.title]}),text:`${w.id} ${w.title} ${g.file}`,icon:s.jsx(jr,{size:16}),run:()=>c(`/specs/${g.file}`)}))),...(i.data??[]).slice(0,20).map(g=>({group:"Jobs",key:`j-${g.id}`,label:s.jsxs(s.Fragment,{children:["#",g.id," ",kr[g.type]," · ",g.target," ",s.jsx(kn,{status:g.status})]}),text:`#${g.id} ${g.type} ${g.target} ${g.status}`,icon:s.jsx(ft,{size:16}),run:()=>c(`/runs/${g.id}`)}))],p=l.trim().toLowerCase();return p?m.filter(g=>g.text.toLowerCase().includes(p)):m},[l,r,i.data]);j.useEffect(()=>u(0),[l]);const d=m=>{var p;m.key==="ArrowDown"?(m.preventDefault(),u(g=>Math.min(g+1,h.length-1))):m.key==="ArrowUp"?(m.preventDefault(),u(g=>Math.max(g-1,0))):m.key==="Enter"&&((p=h[o])==null||p.run())};let f="";return s.jsx("div",{className:"overlay",onClick:e,children:s.jsxs("div",{className:"palette",onClick:m=>m.stopPropagation(),role:"dialog","aria-label":"Command palette",children:[s.jsx("input",{autoFocus:!0,placeholder:"Search specs, test cases, jobs, actions…",value:l,onChange:m=>a(m.target.value),onKeyDown:d}),s.jsxs("ul",{role:"listbox",children:[h.map((m,p)=>{const g=m.group!==f;return f=m.group,s.jsxs("div",{children:[g&&s.jsx("li",{className:"group",children:m.group}),s.jsxs("li",{role:"option","aria-selected":p===o,className:p===o?"active":"",onMouseEnter:()=>u(p),onClick:m.run,children:[m.icon,s.jsx("span",{children:m.label})]})]},m.key)}),h.length===0&&s.jsx("li",{className:"group",children:"No results"})]})]})})}const Wy=j.createContext(async()=>!1),In=()=>j.useContext(Wy);function Ob({children:e}){const[t,n]=j.useState([]),r=j.useRef(1),i=j.useCallback(u=>{const c=r.current++;return new Promise(h=>n(d=>[...d,{...u,id:c,resolve:h}]))},[]),l=t[0],a=j.useCallback(u=>{n(c=>{var h;return(h=c[0])==null||h.resolve(u),c.slice(1)})},[]),o=j.useMemo(()=>i,[i]);return s.jsxs(Wy.Provider,{value:o,children:[e,l&&Er.createPortal(s.jsx(Fb,{opts:l,onClose:a},l.id),document.body)]})}function Fb({opts:e,onClose:t}){const n=j.useRef(null),r=j.useRef(null);return j.useEffect(()=>{var l;(l=(e.danger?n:r).current)==null||l.focus();const i=a=>{var o;if(a.key==="Escape"&&(a.stopPropagation(),t(!1)),a.key==="Tab"){const u=[n.current,r.current].filter(Boolean),c=u.indexOf(document.activeElement);a.preventDefault(),(o=u[(c+(a.shiftKey?-1:1)+u.length)%u.length])==null||o.focus()}};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[e.danger,t]),s.jsx("div",{className:"overlay confirm-overlay",onClick:()=>t(!1),children:s.jsx("div",{className:"modal confirm-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-title","aria-describedby":"confirm-msg",onClick:i=>i.stopPropagation(),children:s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"confirm-head",children:[e.danger&&s.jsx("span",{className:"confirm-icon","aria-hidden":"true",children:s.jsx(Lr,{size:18})}),s.jsxs("div",{children:[s.jsx("h3",{id:"confirm-title",children:e.title}),e.message&&s.jsx("div",{id:"confirm-msg",className:"confirm-msg",children:e.message})]})]}),s.jsxs("div",{className:"confirm-actions",children:[s.jsx("button",{ref:n,type:"button",className:"btn ghost",onClick:()=>t(!1),children:e.cancelLabel??"Cancel"}),s.jsx("button",{ref:r,type:"button",className:`btn ${e.danger?"btn-danger-solid":""}`,onClick:()=>t(!0),children:e.confirmLabel??(e.danger?"Delete":"OK")})]})]})})})}function Ph(e,t){const n=In(),r=j.useRef(!1),i=j.useRef(t);i.current=t,j.useEffect(()=>{e.state!=="blocked"||r.current||(r.current=!0,n(i.current).then(l=>{r.current=!1,l?e.proceed():e.reset()}))},[e,n])}const Vy=j.createContext(e=>e),Ub=()=>j.useContext(Vy);function Bb({children:e}){const[t,n]=j.useState(0),r=j.useCallback(i=>(n(l=>l+1),i.finally(()=>n(l=>l-1))),[]);return s.jsxs(Vy.Provider,{value:r,children:[e,t>0&&Er.createPortal(s.jsx("div",{className:"loading-bar",role:"progressbar","aria-label":"Loading"}),document.body)]})}const Si=()=>{},Qy=j.createContext({show:Si,info:Si,success:Si,warning:Si,error:Si}),Ar=()=>j.useContext(Qy);function Hb({children:e}){const[t,n]=j.useState([]),r=j.useRef(1),i=j.useCallback(o=>n(u=>u.filter(c=>c.id!==o)),[]),l=j.useCallback((o,u)=>{const c=(u==null?void 0:u.kind)??"info",h={id:r.current++,kind:c,message:o,duration:(u==null?void 0:u.duration)??(c==="error"?6e3:3500)};n(d=>[...d,h].slice(-4))},[]),a=j.useMemo(()=>({show:l,info:o=>l(o,{kind:"info"}),success:o=>l(o,{kind:"success"}),warning:o=>l(o,{kind:"warning"}),error:o=>l(o,{kind:"error"})}),[l]);return s.jsxs(Qy.Provider,{value:a,children:[e,Er.createPortal(s.jsx("div",{className:"toasts",role:"region","aria-label":"Notifications",children:t.map(o=>s.jsx(Wb,{item:o,onClose:()=>i(o.id)},o.id))}),document.body)]})}function Wb({item:e,onClose:t}){const[n,r]=j.useState(!1);return j.useEffect(()=>{if(n)return;const i=setTimeout(t,e.duration);return()=>clearTimeout(i)},[n,e.duration,t]),s.jsxs("div",{className:`toast ${e.kind}`,role:e.kind==="error"?"alert":"status",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:e.kind==="success"?s.jsx(jh,{size:14}):e.kind==="error"?s.jsx(wr,{size:14}):e.kind==="warning"?"!":"i"}),s.jsx("span",{className:"toast-msg",children:e.message}),s.jsx("button",{className:"toast-close",onClick:t,"aria-label":"Dismiss notification",children:s.jsx(wr,{size:13})})]})}const qy=j.createContext({refreshClaude:()=>{},openNewSpec:()=>{},openPalette:()=>{},theme:"light",toggleTheme:()=>{},crumbSlot:null,extraSlot:null}),hs=()=>j.useContext(qy);function Vb(){try{return localStorage.getItem("qa-studio.sidebar")==="collapsed"}catch{return!1}}const Qb=.6,bu="Agent Studio (v0.1.5)";function qb(e,t){j.useLayoutEffect(()=>{const n=e.current,r=t.current;if(!n||!r)return;const i=()=>{r.style.zoom="";const o=getComputedStyle(n),u=n.clientHeight-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom),c=r.scrollHeight,h=c>u&&u>0?Math.max(Qb,u/c):1;r.style.zoom=h<1?h.toFixed(3):""};i();const l=new ResizeObserver(i);l.observe(n);const a=new MutationObserver(i);return a.observe(r,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),a.disconnect()}},[e,t])}function Gb({collapsed:e,mobileOpen:t,onCloseMobile:n}){var x;const r=j.useRef(null),i=j.useRef(null);qb(r,i);const{specs:l,mapping:a}=Xt(),{openPalette:o}=hs(),u=Kn(),c=Me(()=>q.jobs(),[u.pathname]),{reload:h}=c,d=(c.data??[]).some(y=>y.status==="queued"||y.status==="running"||y.status==="waiting");j.useEffect(()=>{if(!d)return;const y=setInterval(h,5e3);return()=>clearInterval(y)},[d,h]);const f=(c.data??[]).filter(y=>y.status==="running"||y.status==="queued").length,m=(c.data??[]).filter(y=>y.status==="waiting").length;j.useEffect(()=>(document.title=m?`● ${bu}`:bu,()=>{document.title=bu}),[m]);const p=a.filter(y=>y.status!=="orphan"&&y.testFile).length,g=a.filter(y=>y.status!=="orphan").length,w=(y,v,b,E,k,R)=>s.jsxs(H0,{to:y,end:k,className:({isActive:T})=>`side-link ${T&&!(R&&u.pathname.startsWith(R))?"active":""}`,title:e?b:void 0,children:[v,s.jsx("span",{className:"side-label",children:b}),E!==void 0&&s.jsx("span",{className:"count",children:E})]});return s.jsx("aside",{ref:r,id:"app-sidebar",className:`sidebar ${e?"collapsed":""} ${t?"mobile-open":""}`,"aria-label":"Main menu",children:s.jsxs("div",{ref:i,className:"side-inner",children:[s.jsxs("div",{className:"side-head",children:[s.jsx("span",{className:"logo",children:s.jsx(kh,{size:18})}),s.jsx("h2",{className:"side-label",children:"Agent Studio"}),s.jsx("button",{className:"side-close",onClick:n,"aria-label":"Close menu",children:s.jsx(wr,{size:18})})]}),s.jsxs("button",{className:"side-search",onClick:o,"aria-label":"Search (Ctrl+K)",children:[s.jsx(Ro,{size:16}),s.jsx("span",{className:"side-label",children:"Search"}),s.jsx("span",{className:"kbd side-label",children:"⌘K"})]}),s.jsx("div",{className:"side-group side-label",children:"Overview"}),s.jsxs("nav",{className:"side-nav","aria-label":"Overview",children:[w("/",s.jsx(tb,{size:17}),"Overview",void 0,!0),w("/chat",s.jsx(Nh,{size:17}),"Claude chat")]}),s.jsx("div",{className:"side-group side-label",children:"Specification"}),s.jsxs("nav",{className:"side-nav","aria-label":"Specification",children:[w("/specs",s.jsx(jr,{size:17}),"Specification",l.length,!1,"/specs/from-requirement"),w("/specs/from-requirement",s.jsx(fl,{size:17}),"Generator")]}),s.jsx("div",{className:"side-group side-label",children:"Testing"}),s.jsxs("nav",{className:"side-nav","aria-label":"Testing",children:[w("/mapping",s.jsx(vh,{size:17}),"Test cases",g?`${p}/${g}`:0),w("/test-runs",s.jsx(ob,{size:17}),"Test runs"),w("/runs",s.jsx(ft,{size:17}),"Recent runs",m?`${m} waiting`:f?`${f} running`:((x=c.data)==null?void 0:x.length)??0)]}),s.jsx("div",{className:"side-group side-label",children:"Settings"}),s.jsxs("nav",{className:"side-nav","aria-label":"Settings",children:[w("/agents",s.jsx(Dy,{size:17}),"Agents"),w("/usage",s.jsx(My,{size:17}),"Claude usage"),w("/project",s.jsx(bh,{size:17}),"Project"),w("/settings",s.jsx(lb,{size:17}),"Settings")]})]})})}function Kb({setCrumbSlot:e,setExtraSlot:t,menuOpen:n,onMenu:r}){const{theme:i,toggleTheme:l,openPalette:a}=hs();return s.jsxs("header",{className:"topbar",children:[s.jsx("button",{className:"menu-btn",onClick:r,"aria-label":"Open menu","aria-expanded":n,"aria-controls":"app-sidebar",children:s.jsx(sb,{size:20})}),s.jsx("div",{className:"topbar-crumbs",ref:e}),s.jsx("div",{className:"topbar-spacer"}),s.jsx("div",{className:"topbar-extra",ref:t}),s.jsxs("button",{className:"top-search",onClick:a,"aria-label":"Search specs, TC-ID (Ctrl+K)",children:[s.jsx(Ro,{size:15}),s.jsx("span",{children:"Search specs, TC-ID…"})]}),s.jsx("button",{className:"theme-btn",onClick:l,title:"Toggle light/dark theme","aria-label":"Toggle light/dark theme",children:i==="dark"?s.jsx(Ay,{size:17}):s.jsx(Ly,{size:17})})]})}const Yb=/^[a-z0-9][a-z0-9_-]*$/;function Jb({initial:e,onClose:t}){const n=ut(),{refresh:r}=Xt(),[i,l]=j.useState((e==null?void 0:e.name)??""),[a,o]=j.useState(null),u=async c=>{c.preventDefault();const h=i.trim().replace(/\.md$/,"");if(!Yb.test(h))return o('Name may only contain lowercase letters, digits, "-" or "_", and must start with a letter or digit.');try{await q.createSpec(`${h}.md`,(e==null?void 0:e.content)??Y0),r(),t(),n(`/specs/${h}.md`)}catch(d){o(d.message)}};return s.jsx("div",{className:"overlay",onClick:t,children:s.jsx("form",{className:"modal",onClick:c=>c.stopPropagation(),onSubmit:u,children:s.jsxs("div",{className:"modal-body",children:[s.jsx("h3",{style:{margin:0},children:e!=null&&e.content?"Import spec":"New spec"}),s.jsxs("div",{className:"row",children:[s.jsx("input",{className:"input grow",autoFocus:!0,placeholder:"spec-name",value:i,onChange:c=>l(c.target.value),"aria-label":"Spec name"}),s.jsx("span",{className:"muted",children:".md"})]}),s.jsx(Pe,{error:a}),s.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn",children:e!=null&&e.content?"Import":"Create spec"})]})]})})})}function Xb(e){const[t,n]=j.useState(!1);return j.useEffect(()=>{const r=()=>n(!0);return window.addEventListener(Bc,r),()=>window.removeEventListener(Bc,r)},[]),j.useEffect(()=>{if(!t)return;let r=!1;const i=setInterval(()=>{q0().then(l=>{l&&!r&&(n(!1),e())})},3e3);return()=>{r=!0,clearInterval(i)}},[t,e]),t}function Zb(){var k;const e=J0(),[t,n]=Z0(),[r,i]=j.useState(!1),[l,a]=j.useState(null),[o,u]=j.useState(Vb),[c,h]=j.useState(!1),{pathname:d}=Kn();j.useEffect(()=>h(!1),[d]);const[f,m]=j.useState(null),[p,g]=j.useState(null),[w,x]=j.useState(null),y=j.useCallback(()=>{q.claudeStatus().then(x).catch(()=>{})},[]),{refresh:v}=e,b=Xb(j.useCallback(()=>{v(),y()},[v,y]));j.useEffect(()=>{y();const R=setInterval(y,5*6e4);return()=>clearInterval(R)},[y]),j.useEffect(()=>{try{localStorage.setItem("qa-studio.sidebar",o?"collapsed":"open")}catch{}},[o]),j.useEffect(()=>{const R=T=>{(T.ctrlKey||T.metaKey)&&T.key.toLowerCase()==="k"&&(T.preventDefault(),i(D=>!D)),T.key==="Escape"&&(i(!1),a(null),h(!1))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]);const E=j.useMemo(()=>({openNewSpec:R=>a(R??{}),openPalette:()=>i(!0),theme:t,toggleTheme:n,crumbSlot:f,extraSlot:p,refreshClaude:y}),[t,n,f,p,y]);return s.jsx(Ty.Provider,{value:e,children:s.jsx(qy.Provider,{value:E,children:s.jsx(Hb,{children:s.jsx(Bb,{children:s.jsxs(Ob,{children:[s.jsxs("div",{className:`shell ${o?"side-collapsed":""}`,children:[s.jsx(Gb,{collapsed:o,mobileOpen:c,onCloseMobile:()=>h(!1)}),c&&s.jsx("div",{className:"side-backdrop",onClick:()=>h(!1),"aria-hidden":"true"}),s.jsx("button",{className:"side-toggle-dot",onClick:()=>u(R=>!R),"aria-label":o?"Expand menu":"Collapse menu",title:o?"Expand menu":"Collapse menu",children:s.jsx("span",{style:{display:"inline-flex",transform:o?void 0:"rotate(180deg)"},children:s.jsx(ti,{size:10})})}),s.jsxs("div",{className:"main",children:[s.jsx(Kb,{setCrumbSlot:m,setExtraSlot:g,menuOpen:c,onMenu:()=>h(!0)}),b&&s.jsxs("div",{className:"claude-banner",role:"alert",children:[s.jsx("b",{children:"Agent Studio server is not running."})," Start it with ",s.jsx("code",{children:"npm run studio:start"})," in the repo folder; this page reconnects by itself."]}),!b&&(w==null?void 0:w.state)==="not-ready"&&s.jsxs("div",{className:"claude-banner",role:"alert",children:[s.jsx("b",{children:"Claude Code is not ready:"})," ",w.binary.ok?w.version.ok?(k=w.test)==null?void 0:k.message:w.version.detail:w.binary.detail,". Built-in agents (explore, generate, heal, spec generator, project context) cannot run. ",s.jsx(ye,{to:"/settings#claude",children:"Fix it in Settings"})]}),s.jsx("div",{className:"content",children:s.jsx(w0,{})})]})]}),r&&s.jsx($b,{onClose:()=>i(!1),onNewSpec:()=>(i(!1),a({}))}),l&&s.jsx(Jb,{initial:l,onClose:()=>a(null)})]})})})})})}function ot({items:e}){const{crumbSlot:t}=hs();return t?Er.createPortal(s.jsx("nav",{className:"crumbs","aria-label":"Breadcrumb",children:e.map((n,r)=>s.jsxs("span",{className:"crumb",children:[r>0&&s.jsx("span",{className:"sep",children:"/"}),n.to?s.jsx(ye,{to:n.to,children:n.label}):s.jsx("span",{className:"current",children:n.label}),n.count!==void 0&&s.jsx("span",{className:"pill-count",children:n.count})]},r))}),t):null}function eS({children:e}){const{extraSlot:t}=hs();return t?Er.createPortal(e,t):null}function tS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sS={};function Op(e,t){return(sS.jsx?rS:nS).test(e)}const iS=/[ \t\n\f\r]/g;function lS(e){return typeof e=="object"?e.type==="text"?Fp(e.value):!1:Fp(e)}function Fp(e){return e.replace(iS,"")===""}class Nl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Nl.prototype.normal={};Nl.prototype.property={};Nl.prototype.space=void 0;function Gy(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Nl(n,r,t)}function qc(e){return e.toLowerCase()}class Ft{constructor(t,n){this.attribute=n,this.property=t}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let aS=0;const ge=fs(),rt=fs(),Gc=fs(),Y=fs(),$e=fs(),Xr=fs(),Bt=fs();function fs(){return 2**++aS}const Kc=Object.freeze(Object.defineProperty({__proto__:null,boolean:ge,booleanish:rt,commaOrSpaceSeparated:Bt,commaSeparated:Xr,number:Y,overloadedBoolean:Gc,spaceSeparated:$e},Symbol.toStringTag,{value:"Module"})),Su=Object.keys(Kc);class Rh extends Ft{constructor(t,n,r,i){let l=-1;if(super(t,n),Up(this,"space",i),typeof r=="number")for(;++l<Su.length;){const a=Su[l];Up(this,Su[l],(r&Kc[a])===Kc[a])}}}Rh.prototype.defined=!0;function Up(e,t,n){n&&(e[t]=n)}function ai(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Rh(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[qc(r)]=r,n[qc(l.attribute)]=r}return new Nl(t,n,e.space)}const Ky=ai({properties:{ariaActiveDescendant:null,ariaAtomic:rt,ariaAutoComplete:null,ariaBusy:rt,ariaChecked:rt,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:$e,ariaCurrent:null,ariaDescribedBy:$e,ariaDetails:null,ariaDisabled:rt,ariaDropEffect:$e,ariaErrorMessage:null,ariaExpanded:rt,ariaFlowTo:$e,ariaGrabbed:rt,ariaHasPopup:null,ariaHidden:rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$e,ariaLevel:Y,ariaLive:null,ariaModal:rt,ariaMultiLine:rt,ariaMultiSelectable:rt,ariaOrientation:null,ariaOwns:$e,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:rt,ariaReadOnly:rt,ariaRelevant:null,ariaRequired:rt,ariaRoleDescription:$e,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:rt,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Yy(e,t){return t in e?e[t]:t}function Jy(e,t){return Yy(e,t.toLowerCase())}const oS=ai({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xr,acceptCharset:$e,accessKey:$e,action:null,allow:null,allowFullScreen:ge,allowPaymentRequest:ge,allowUserMedia:ge,alpha:ge,alt:null,as:null,async:ge,autoCapitalize:null,autoComplete:$e,autoFocus:ge,autoPlay:ge,blocking:$e,capture:null,charSet:null,checked:ge,cite:null,className:$e,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:rt,controls:ge,controlsList:$e,coords:Y|Xr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ge,defer:ge,dir:null,dirName:null,disabled:ge,download:Gc,draggable:rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ge,formTarget:null,headers:$e,height:Y,hidden:Gc,high:Y,href:null,hrefLang:null,htmlFor:$e,httpEquiv:$e,id:null,imageSizes:null,imageSrcSet:null,inert:ge,inputMode:null,integrity:null,is:null,isMap:ge,itemId:null,itemProp:$e,itemRef:$e,itemScope:ge,itemType:$e,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ge,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:ge,muted:ge,name:null,nonce:null,noModule:ge,noValidate:ge,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:ge,optimum:Y,pattern:null,ping:$e,placeholder:null,playsInline:ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ge,referrerPolicy:null,rel:$e,required:ge,reversed:ge,rows:Y,rowSpan:Y,sandbox:$e,scope:null,scoped:ge,seamless:ge,selected:ge,shadowRootClonable:ge,shadowRootCustomElementRegistry:ge,shadowRootDelegatesFocus:ge,shadowRootMode:null,shadowRootSerializable:ge,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:ge,useMap:null,value:rt,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$e,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ge,declare:ge,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:ge,noHref:ge,noShade:ge,noWrap:ge,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:rt,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ge,disablePictureInPicture:ge,disableRemotePlayback:ge,exportParts:Xr,part:$e,prefix:null,property:null,results:Y,security:null,unselectable:null},space:"html",transform:Jy}),uS=ai({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:Bt,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:$e,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:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,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:Xr,g2:Xr,glyphName:Xr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:Bt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,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:Y,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:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$e,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Bt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Bt,rev:Bt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Bt,requiredFeatures:Bt,requiredFonts:Bt,requiredFormats:Bt,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:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:Bt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Bt,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Bt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yy}),Xy=ai({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Zy=ai({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jy}),ev=ai({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),cS={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"},dS=/[A-Z]/g,Bp=/-[a-z]/g,hS=/^data[-\w.:]+$/i;function fS(e,t){const n=qc(t);let r=t,i=Ft;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hS.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Bp,mS);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Bp.test(l)){let a=l.replace(dS,pS);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Rh}return new i(r,t)}function pS(e){return"-"+e.toLowerCase()}function mS(e){return e.charAt(1).toUpperCase()}const gS=Gy([Ky,oS,Xy,Zy,ev],"html"),Lh=Gy([Ky,uS,Xy,Zy,ev],"svg");function xS(e){return e.join(" ").trim()}var Hp=/\/\*(?:[^*]|\*(?!\/))*\*\//g,yS=/\n/g,vS=/^\s*/,jS=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,wS=/^:\s*/,kS=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,bS=/^[;\s]*/,SS=`
361
- `,Wp="/",Vp="*",Ni="",NS="comment",CS="declaration";function ES(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(p){var g=p.match(yS);g&&(n+=g.length);var w=p.lastIndexOf(SS);r=~w?p.length-w:r+p.length}function l(){var p={line:n,column:r};return function(g){return g.position=new a(p),c(),g}}function a(p){this.start=p,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(p){var g=new Error(t.source+":"+n+":"+r+": "+p);if(g.reason=p,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function u(p){var g=p.exec(e);if(g){var w=g[0];return i(w),e=e.slice(w.length),g}}function c(){u(vS)}function h(p){for(var g;g=d();)p.push(g);return p}function d(){var p=l();if(!(Wp!=e.charAt(0)||Vp!=e.charAt(1))){for(var g=2;Ni!=e.charAt(g)&&(Vp!=e.charAt(g)||Wp!=e.charAt(g+1));)++g;if(g+=2,Ni===e.charAt(g-1))return o("End of comment missing");var w=e.slice(2,g-2);return r+=2,i(w),e=e.slice(g),r+=2,p({type:NS,comment:w})}}function f(){var p=l(),g=u(jS);if(g){if(d(),!u(wS))return o("property missing ':'");var w=u(kS),x=p({type:CS,property:g[0].replace(Hp,Ni).trim(),value:w?w[0].replace(Hp,Ni).trim():Ni});return u(bS),x}}function m(){var p=[];h(p);for(var g;g=f();)p.push(g),h(p);return p}return c(),m()}function TS(e,t){let n=null;if(!e||typeof e!="string")return n;const r=ES(e),i=typeof t=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:a,value:o}=l;i?t(a,o,l):o&&(n=n??{},n[a]=o)}),n}const tv=nv("end"),Ah=nv("start");function nv(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function PS(e){const t=Ah(e),n=tv(e);if(t&&n)return{start:t,end:n}}function Wi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Qp(e.position):"start"in e||"end"in e?Qp(e):"line"in e||"column"in e?Yc(e):""}function Yc(e){return qp(e&&e.line)+":"+qp(e&&e.column)}function Qp(e){return Yc(e&&e.start)+"-"+Yc(e&&e.end)}function qp(e){return e&&typeof e=="number"?e:1}class Do extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},a=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(a=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?l.ruleId=r:(l.source=r.slice(0,u),l.ruleId=r.slice(u+1))}if(!l.place&&l.ancestors){const u=l.ancestors[l.ancestors.length-1];u&&(l.place=u.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=Wi(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=a&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Object.defineProperties(Do.prototype,{file:{configurable:!0,enumerable:!0,value:"",writable:!0},name:{configurable:!0,enumerable:!0,value:"",writable:!0},reason:{configurable:!0,enumerable:!0,value:"",writable:!0},message:{configurable:!0,enumerable:!0,value:"",writable:!0},stack:{configurable:!0,enumerable:!0,value:"",writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});const Ih={}.hasOwnProperty,RS=new Map,LS=/[A-Z]/g,AS=/-([a-z])/g,IS=new Set(["table","tbody","thead","tfoot","tr"]),DS=new Set(["td","th"]),rv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function MS(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=HS(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=BS(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Lh:gS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=sv(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function sv(e,t,n){if(t.type==="element")return zS(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return _S(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return OS(e,t,n);if(t.type==="mdxjsEsm")return $S(e,t);if(t.type==="root")return FS(e,t,n);if(t.type==="text")return US(e,t)}function zS(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Lh,e.schema=i),e.ancestors.push(t);const l=lv(e,t.tagName,!1),a=WS(e,t);let o=Mh(e,t);return IS.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!lS(u):!0})),iv(e,a,l,t),Dh(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function _S(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ml(e,t.position)}function $S(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ml(e,t.position)}function OS(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Lh,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:lv(e,t.name,!0),a=VS(e,t),o=Mh(e,t);return iv(e,a,l,t),Dh(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function FS(e,t,n){const r={};return Dh(r,Mh(e,t)),e.create(t,e.Fragment,r,n)}function US(e,t){return t.value}function iv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Dh(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function BS(e,t,n){return r;function r(i,l,a,o){const c=Array.isArray(a.children)?n:t;return o?c(l,a,o):c(l,a)}}function HS(e,t){return n;function n(r,i,l,a){const o=Array.isArray(l.children),u=Ah(r);return t(i,l,a,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function WS(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Ih.call(t.properties,i)){const l=QS(e,i,t.properties[i]);if(l){const[a,o]=l;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&DS.has(t.tagName)?r=o:n[a]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function VS(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const a=l.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else ml(e,t.position);else{const{name:i}=r;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else ml(e,t.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function Mh(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:RS;for(;++r<t.children.length;){const l=t.children[r];let a;if(e.passKeys){const u=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(u){const c=i.get(u)||0;a=u+"-"+c,i.set(u,c+1)}}const o=sv(e,l,a);o!==void 0&&n.push(o)}return n}function QS(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const r=fS(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?tS(n):xS(n)),r.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:GS(n):qS(e,String(n))]:[e.elementAttributeNameCase==="react"&&r.space?cS[r.property]||r.property:r.attribute,n]}function qS(e,t){const n={};try{TS(t,function(r,i){if(r&&i){let l=r;l.slice(0,2)!=="--"&&(l=l.toLowerCase(),e.stylePropertyNameCase==="dom"&&(l.slice(0,4)==="-ms-"&&(l=l.slice(1)),l=l.replace(AS,JS))),n[l]=i}})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,l=new Do("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=rv+"#cannot-parse-style-attribute",l}return n}function lv(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,a;for(;++l<i.length;){const o=Op(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(l&&o.type==="Literal"),optional:!1}:o}r=a}else r=Op(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Ih.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ml(e)}function ml(e,t){const n=new Do("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rv+"#cannot-handle-mdx-estrees-without-createevaluater",n}function GS(e){const t={};let n;for(n in e)Ih.call(e,n)&&(t[KS(n)]=e[n]);return t}function KS(e){if(e.slice(0,2)==="--")return e;let t=e.replace(LS,YS);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YS(e){return"-"+e.toLowerCase()}function JS(e,t){return t.toUpperCase()}const Nu={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 Mo(e,t){const n=XS,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return av(e,r,i)}function av(e,t,n){if(ZS(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Gp(e.children,t,n)}return Array.isArray(e)?Gp(e,t,n):""}function Gp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=av(e[i],t,n);return r.join("")}function ZS(e){return!!(e&&typeof e=="object")}const Kp=document.createElement("i");function zh(e){const t="&"+e+";";Kp.innerHTML=t;const n=Kp.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yn(e,t,n,r){const i=e.length;let l=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);l<r.length;)a=r.slice(l,l+1e4),a.unshift(t,0),e.splice(...a),l+=1e4,t+=1e4}function rn(e,t){return e.length>0?(yn(e,e.length,0,t),e):t}const Yp={}.hasOwnProperty;function ov(e){const t={};let n=-1;for(;++n<e.length;)eN(t,e[n]);return t}function eN(e,t){let n;for(n in t){const i=(Yp.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let a;if(l)for(a in l){Yp.call(i,a)||(i[a]=[]);const o=l[a];tN(i[a],Array.isArray(o)?o:o?[o]:[])}}}function tN(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yn(e,0,0,r)}function uv(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function vn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yt=Ir(/[A-Za-z]/),vt=Ir(/[\dA-Za-z]/),nN=Ir(/[#-'*+\--9=?A-Z^-~]/);function so(e){return e!==null&&(e<32||e===127)}const Jc=Ir(/\d/),rN=Ir(/[\dA-Fa-f]/),cv=Ir(/[!-/:-@[-`{-~]/);function de(e){return e!==null&&e<-2}function Oe(e){return e!==null&&(e<0||e===32)}function ve(e){return e===-2||e===-1||e===32}const Cl=Ir(new RegExp("\\p{P}|\\p{S}","u")),ls=Ir(/\s/);function Ir(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function oi(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let a="";if(l===37&&vt(e.charCodeAt(n+1))&&vt(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(a=String.fromCharCode(l));else if(l>55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(a=String.fromCharCode(l,o),i=1):a="�"}else a=String.fromCharCode(l);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Le(e,t,n,r){const i=r?r-1:1/0;let l=0;return a;function a(u){return ve(u)?(e.enter(n),o(u)):t(u)}function o(u){return ve(u)&&l++<i?(e.consume(u),o):(e.exit(n),t(u))}}function dv(e,t,n,r,i,l){let a=0;return o;function o(h){return ve(h)?(e.enter(r),u(h)):c(h)}function u(h){return ve(h)&&a<l?(e.consume(h),a++,u):(e.exit(r),c(h))}function c(h){return a>=i?t(h):n(h)}}const sN={tokenize:iN};function iN(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Le(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),l(o)}function l(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return de(o)?(e.consume(o),e.exit("chunkText"),l):(e.consume(o),a)}}let io=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){Jp(this,t,n,r,!1)}addBefore(t,n,r){Jp(this,t,n,r,!0)}consume(t){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0,this.index.clear()}};function Jp(e,t,n,r,i){if(n===0&&r.length===0)return;const l=e.index.get(t);if(l){l[1]+=n,i?(r.push(...l[2]),l[2]=r):l[2].push(...r);return}const a=[t,n,r];e.map.push(a),e.index.set(t,a)}const lN={tokenize:aN},Xp={tokenize:oN};function aN(e){const t=this,n=[];let r=0,i,l,a;return o;function o(v){if(r<n.length){const b=n[r];return t.containerState=b[1],e.attempt(b[0].continuation,u,c)(v)}return c(v)}function u(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const b=t.events.length;let E=b,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}x(r);let R=b;for(;R<t.events.length;)t.events[R][1].end={...k},R++;const T=new io;return T.add(E+1,0,t.events.slice(b)),T.add(b,R-b,[]),T.consume(t.events),c(v)}return o(v)}function c(v){if(r===n.length){if(!i)return f(v);if(i.currentConstruct&&i.currentConstruct.concrete)return p(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Xp,h,d)(v)}function h(v){return i&&y(),x(r),f(v)}function d(v){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,p(v)}function f(v){return t.containerState={},e.attempt(Xp,m,p)(v)}function m(v){return r++,n.push([t.currentConstruct,t.containerState]),f(v)}function p(v){if(v===null){i&&y(),x(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),g(v)}function g(v){if(v===null){w(e.exit("chunkFlow"),!0),x(0),e.consume(v);return}return de(v)?(e.consume(v),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(v),g)}function w(v,b){const E=t.sliceStream(v);if(b&&E.push(null),v.previous=l,l&&(l.next=v),l=v,i.defineSkip(v.start),i.write(E),t.parser.lazy[v.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<a&&(!i.events[k][1].end||i.events[k][1].end.offset>a))return;const R=t.events.length;let T=R,D,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(D){C=t.events[T][1].end;break}D=!0}for(x(r),k=R;k<t.events.length;)t.events[k][1].end={...C},k++;const L=new io;L.add(T+1,0,t.events.slice(R)),L.add(R,k-R,[]),L.consume(t.events)}}function x(v){let b=n.length;for(;b-- >v;){const E=n[b];t.containerState=E[1],E[0].exit.call(t,e)}n.length=v}function y(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function oN(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function br(e){if(e===null||Oe(e)||ls(e))return 1;if(Cl(e))return 2}function zo(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Xc={name:"attention",resolveAll:uN,tokenize:cN};function uN(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const l=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,a={...e[i][1].end},o={...e[n][1].start};Zp(a,-l),Zp(o,l);const u={type:l>1?"strongSequence":"emphasisSequence",start:a,end:{...e[i][1].end}},c={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:o},h={type:l>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},d={type:l>1?"strong":"emphasis",start:{...u.start},end:{...c.end}};e[i][1].end={...u.start},e[n][1].start={...c.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=rn(r,[["enter",e[i][1],t],["exit",e[i][1],t]])),r=rn(r,[["enter",d,t],["enter",u,t],["exit",u,t],["enter",h,t]]),r=rn(r,zo(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=rn(r,[["exit",h,t],["enter",c,t],["exit",c,t],["exit",d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=rn(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),yn(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function cN(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=br(r);let l;return a;function a(u){return l=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===l)return e.consume(u),o;const c=e.exit("attentionSequence"),h=br(u),d=!h||h===2&&i||n.includes(u)&&u!==42&&u!==95,f=!i||i===2&&h||n.includes(r)&&r!==42&&r!==95;return c._open=!!(l===42?d:d&&(i||!f)),c._close=!!(l===42?f:f&&(h||!d)),t(u)}}function Zp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dN={name:"autolink",tokenize:hN};function hN(e,t,n){let r=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(m){return yt(m)?(e.consume(m),a):m===64?n(m):c(m)}function a(m){return m===43||m===45||m===46||vt(m)?(r=1,o(m)):c(m)}function o(m){return m===58?(e.consume(m),r=0,u):(m===43||m===45||m===46||vt(m))&&r++<32?(e.consume(m),o):(r=0,c(m))}function u(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||so(m)?n(m):(e.consume(m),u)}function c(m){return m===64?(e.consume(m),h):nN(m)?(e.consume(m),c):n(m)}function h(m){return vt(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,h):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||vt(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const El={partial:!0,tokenize:fN};function fN(e,t,n){return r;function r(l){return ve(l)?Le(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||de(l)?t(l):n(l)}}const hv={continuation:{tokenize:mN},exit:gN,name:"blockQuote",tokenize:pN};function pN(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),l}return n(a)}function l(a){return ve(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function mN(e,t,n){const r=this;return i;function i(a){return ve(a)?Le(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):l(a)}function l(a){return e.attempt(hv,t,n)(a)}}function gN(e){e.exit("blockQuote")}const fv={name:"characterEscape",tokenize:xN};function xN(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return cv(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const pv={name:"characterReference",tokenize:yN};function yN(e,t,n){const r=this;let i=0,l,a;return o;function o(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),l=31,a=vt,h(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,a=rN,h):(e.enter("characterReferenceValue"),l=7,a=Jc,h(d))}function h(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return a===vt&&!zh(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&i++<l?(e.consume(d),h):n(d)}}const Zc={partial:!0,tokenize:vN};function vN(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),l)}function l(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const em={concrete:!0,name:"codeFenced",tokenize:jN};function jN(e,t,n){const r=this,i={partial:!0,tokenize:E};let l=0,a=0,o;return u;function u(k){return c(k)}function c(k){const R=r.events[r.events.length-1];return l=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(k)}function h(k){return k===o?(a++,e.consume(k),h):a<3?n(k):(e.exit("codeFencedFenceSequence"),ve(k)?Le(e,d,"whitespace")(k):d(k))}function d(k){return k===null||de(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Zc,g,b)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||de(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):ve(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),f)}function m(k){return k===null||de(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||de(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===o?n(k):(e.consume(k),p)}function g(k){return e.attempt(i,b,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return l>0&&ve(k)?Le(e,y,"linePrefix",l+1)(k):y(k)}function y(k){return k===null||de(k)?e.check(Zc,g,b)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||de(k)?(e.exit("codeFlowValue"),y(k)):(e.consume(k),v)}function b(k){return e.exit("codeFenced"),t(k)}function E(k,R,T){let D=0;return C;function C(I){return k.enter("lineEnding"),k.consume(I),k.exit("lineEnding"),L}function L(I){return k.enter("codeFencedFence"),ve(I)?Le(k,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===o?(k.enter("codeFencedFenceSequence"),z(I)):T(I)}function z(I){return I===o?(D++,k.consume(I),z):D>=a?(k.exit("codeFencedFenceSequence"),ve(I)?Le(k,U,"whitespace")(I):U(I)):T(I)}function U(I){return I===null||de(I)?(k.exit("codeFencedFence"),R(I)):T(I)}}}const Cu={name:"codeIndented",tokenize:kN},wN={partial:!0,tokenize:bN};function kN(e,t,n){return r;function r(o){return e.enter("codeIndented"),dv(e,i,n,"linePrefix",4,4)(o)}function i(o){return o===null?a(o):de(o)?e.attempt(wN,i,a)(o):(e.enter("codeFlowValue"),l(o))}function l(o){return o===null||de(o)?(e.exit("codeFlowValue"),i(o)):(e.consume(o),l)}function a(o){return e.exit("codeIndented"),t(o)}}function bN(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):de(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):dv(e,t,l,"linePrefix",4,4)(a)}function l(a){return de(a)?i(a):n(a)}}const SN={name:"codeText",previous:CN,resolve:NN,tokenize:EN};function NN(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function CN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function EN(e,t,n){let r=0,i,l;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),o(d)}function o(d){return d===96?(e.consume(d),r++,o):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(l=e.enter("codeTextSequence"),i=0,h(d)):de(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||de(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),c)}function h(d){return d===96?(e.consume(d),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(l.type="codeTextData",c(d))}}class TN{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ci(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ci(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ci(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ci(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ci(this.left,n.reverse())}}}function Ci(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mv(e){const t={};let n=-1,r,i,l,a,o,u,c;const h=new TN(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,l=0,l<u.length&&u[l][1].type==="lineEndingBlank"&&(l+=2),l<u.length&&u[l][1].type==="content"))for(;++l<u.length&&u[l][1].type!=="content";)u[l][1].type==="chunkText"&&(u[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,PN(h,n)),n=t[n],c=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(a=h.get(l),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=l);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},o=h.slice(i,n),o.unshift(r),h.splice(i,n-i+1,o))}}return yn(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function PN(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const l=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,u=[],c={};let h,d,f=-1,m=n,p=0,g=0;const w=[g];for(;m;){for(;e.get(++i)[1]!==m;);l.push(i),m._tokenizer||(h=r.sliceStream(m),m.next||h.push(null),d&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(g=f+1,w.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):w.pop(),f=w.length;f--;){const x=o.slice(w[f],w[f+1]),y=l.pop();u.push([y,y+x.length-1]),e.splice(y,2,x)}for(u.reverse(),f=-1;++f<u.length;)c[p+u[f][0]]=p+u[f][1],p+=u[f][1]-u[f][0]-1;return c}const RN={resolve:AN,tokenize:IN},LN={partial:!0,tokenize:DN};function AN(e){return mv(e),e}function IN(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?l(o):de(o)?e.check(LN,a,l)(o):(e.consume(o),i)}function l(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function DN(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Le(e,l,"linePrefix")}function l(a){if(a===null||de(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function gv(e,t,n,r,i,l,a,o,u){const c=u||Number.POSITIVE_INFINITY;let h=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(x),e.exit(l),f):x===null||x===32||x===41||so(x)?n(x):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(x))}function f(x){return x===62?(e.enter(l),e.consume(x),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(e.exit("chunkString"),e.exit(o),f(x)):x===null||x===60||de(x)?n(x):(e.consume(x),x===92?p:m)}function p(x){return x===60||x===62||x===92?(e.consume(x),m):m(x)}function g(x){return!h&&(x===null||x===41||Oe(x))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(x)):h<c&&x===40?(e.consume(x),h++,g):x===41?(e.consume(x),h--,g):x===null||x===32||x===40||so(x)?n(x):(e.consume(x),x===92?w:g)}function w(x){return x===40||x===41||x===92?(e.consume(x),g):g(x)}}function xv(e,t,n,r,i,l){const a=this;let o=0,u;return c;function c(m){return e.enter(r),e.enter(i),e.consume(m),e.exit(i),e.enter(l),h}function h(m){return o>999||m===null||m===91||m===93&&!u||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(l),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):de(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||de(m)||o++>999?(e.exit("chunkString"),h(m)):(e.consume(m),u||(u=!ve(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function yv(e,t,n,r,i,l){let a;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,u):n(f)}function u(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(l),c(f))}function c(f){return f===a?(e.exit(l),u(a)):f===null?n(f):de(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Le(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===a||f===null||de(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:h)}function d(f){return f===a||f===92?(e.consume(f),h):h(f)}}function Vi(e,t){let n;return r;function r(i){return de(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):ve(i)?Le(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const MN={name:"definition",tokenize:_N},zN={partial:!0,tokenize:$N};function _N(e,t,n){const r=this;let i;return l;function l(m){return e.enter("definition"),a(m)}function a(m){return xv.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return i=vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),u):n(m)}function u(m){return Oe(m)?Vi(e,c)(m):c(m)}function c(m){return gv(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function h(m){return e.attempt(zN,d,d)(m)}function d(m){return ve(m)?Le(e,f,"whitespace")(m):f(m)}function f(m){return m===null||de(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function $N(e,t,n){return r;function r(o){return Oe(o)?Vi(e,i)(o):n(o)}function i(o){return yv(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return ve(o)?Le(e,a,"whitespace")(o):a(o)}function a(o){return o===null||de(o)?t(o):n(o)}}const ON={name:"hardBreakEscape",tokenize:FN};function FN(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return de(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const UN={name:"headingAtx",resolve:BN,tokenize:HN};function BN(e,t){let n=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r){const i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"};yn(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])}return e}function HN(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),l(h)}function l(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||Oe(h)?(e.exit("atxHeadingSequence"),o(h)):n(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||de(h)?(e.exit("atxHeading"),t(h)):ve(h)?Le(e,o,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),o(h))}function c(h){return h===null||h===35||Oe(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),c)}}const vv=["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"],ed=["pre","script","style","textarea"],WN={concrete:!0,name:"htmlFlow",resolveTo:QN,tokenize:qN},VN={partial:!0,tokenize:GN};function QN(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function qN(e,t,n){const r=this;let i,l,a,o,u;return c;function c(N){return h(N)}function h(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),d}function d(N){return N===33?(e.consume(N),f):N===47?(e.consume(N),l=!0,g):N===63?(e.consume(N),i=3,r.interrupt?t:S):yt(N)?(e.consume(N),a=String.fromCharCode(N),w):n(N)}function f(N){return N===45?(e.consume(N),i=2,m):N===91?(e.consume(N),i=5,o=0,p):yt(N)?(e.consume(N),i=4,r.interrupt?t:S):n(N)}function m(N){return N===45?(e.consume(N),r.interrupt?t:S):n(N)}function p(N){const F="CDATA[";return N===F.charCodeAt(o++)?(e.consume(N),o===F.length?r.interrupt?t:A:p):n(N)}function g(N){return yt(N)?(e.consume(N),a=String.fromCharCode(N),w):n(N)}function w(N){if(N===null||N===47||N===62||Oe(N)){const F=N===47,Z=a.toLowerCase();return!F&&!l&&ed.includes(Z)?(i=1,r.interrupt?t(N):A(N)):vv.includes(a.toLowerCase())?(i=6,F?(e.consume(N),x):r.interrupt?t(N):A(N)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):l?y(N):v(N))}return N===45||vt(N)?(e.consume(N),a+=String.fromCharCode(N),w):n(N)}function x(N){return N===62?(e.consume(N),r.interrupt?t:A):n(N)}function y(N){return ve(N)?(e.consume(N),y):C(N)}function v(N){return N===47?(e.consume(N),C):N===58||N===95||yt(N)?(e.consume(N),b):ve(N)?(e.consume(N),v):C(N)}function b(N){return N===45||N===46||N===58||N===95||vt(N)?(e.consume(N),b):E(N)}function E(N){return N===61?(e.consume(N),k):ve(N)?(e.consume(N),E):v(N)}function k(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),u=N,R):ve(N)?(e.consume(N),k):T(N)}function R(N){return N===u?(e.consume(N),u=null,D):N===null||de(N)?n(N):(e.consume(N),R)}function T(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Oe(N)?E(N):(e.consume(N),T)}function D(N){return N===47||N===62||ve(N)?v(N):n(N)}function C(N){return N===62?(e.consume(N),L):n(N)}function L(N){return N===null||de(N)?A(N):ve(N)?(e.consume(N),L):n(N)}function A(N){return N===45&&i===2?(e.consume(N),Q):N===60&&i===1?(e.consume(N),J):N===62&&i===4?(e.consume(N),ae):N===63&&i===3?(e.consume(N),S):N===93&&i===5?(e.consume(N),X):de(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(VN,O,z)(N)):N===null||de(N)?(e.exit("htmlFlowData"),z(N)):(e.consume(N),A)}function z(N){return e.check(Zc,U,O)(N)}function U(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),I}function I(N){return N===null||de(N)?z(N):(e.enter("htmlFlowData"),A(N))}function Q(N){return N===45?(e.consume(N),S):A(N)}function J(N){return N===47?(e.consume(N),a="",H):A(N)}function H(N){if(N===62){const F=a.toLowerCase();return ed.includes(F)?(e.consume(N),ae):A(N)}return yt(N)&&a.length<8?(e.consume(N),a+=String.fromCharCode(N),H):A(N)}function X(N){return N===93?(e.consume(N),S):A(N)}function S(N){return N===62?(e.consume(N),ae):N===45&&i===2?(e.consume(N),S):A(N)}function ae(N){return N===null||de(N)?(e.exit("htmlFlowData"),O(N)):(e.consume(N),ae)}function O(N){return e.exit("htmlFlow"),t(N)}}function GN(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(El,t,n)}}const KN={name:"htmlText",tokenize:YN};function YN(e,t,n){const r=this;let i,l,a;return o;function o(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),u}function u(S){return S===33?(e.consume(S),c):S===47?(e.consume(S),E):S===63?(e.consume(S),v):yt(S)?(e.consume(S),T):n(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),l=0,p):yt(S)?(e.consume(S),y):n(S)}function h(S){return S===45?(e.consume(S),m):n(S)}function d(S){return S===null?n(S):S===45?(e.consume(S),f):de(S)?(a=d,J(S)):(e.consume(S),d)}function f(S){return S===45?(e.consume(S),m):d(S)}function m(S){return S===62?Q(S):S===45?f(S):d(S)}function p(S){const ae="CDATA[";return S===ae.charCodeAt(l++)?(e.consume(S),l===ae.length?g:p):n(S)}function g(S){return S===null?n(S):S===93?(e.consume(S),w):de(S)?(a=g,J(S)):(e.consume(S),g)}function w(S){return S===93?(e.consume(S),x):g(S)}function x(S){return S===62?Q(S):S===93?(e.consume(S),x):g(S)}function y(S){return S===null||S===62?Q(S):de(S)?(a=y,J(S)):(e.consume(S),y)}function v(S){return S===null?n(S):S===63?(e.consume(S),b):de(S)?(a=v,J(S)):(e.consume(S),v)}function b(S){return S===62?Q(S):v(S)}function E(S){return yt(S)?(e.consume(S),k):n(S)}function k(S){return S===45||vt(S)?(e.consume(S),k):R(S)}function R(S){return de(S)?(a=R,J(S)):ve(S)?(e.consume(S),R):Q(S)}function T(S){return S===45||vt(S)?(e.consume(S),T):S===47||S===62||Oe(S)?D(S):n(S)}function D(S){return S===47?(e.consume(S),Q):S===58||S===95||yt(S)?(e.consume(S),C):de(S)?(a=D,J(S)):ve(S)?(e.consume(S),D):Q(S)}function C(S){return S===45||S===46||S===58||S===95||vt(S)?(e.consume(S),C):L(S)}function L(S){return S===61?(e.consume(S),A):de(S)?(a=L,J(S)):ve(S)?(e.consume(S),L):D(S)}function A(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),i=S,z):de(S)?(a=A,J(S)):ve(S)?(e.consume(S),A):(e.consume(S),U)}function z(S){return S===i?(e.consume(S),i=void 0,I):S===null?n(S):de(S)?(a=z,J(S)):(e.consume(S),z)}function U(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Oe(S)?D(S):(e.consume(S),U)}function I(S){return S===47||S===62||Oe(S)?D(S):n(S)}function Q(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function J(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),H}function H(S){return ve(S)?Le(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):X(S)}function X(S){return e.enter("htmlTextData"),a(S)}}const _h={name:"labelEnd",resolveAll:eC,resolveTo:tC,tokenize:nC},JN={tokenize:rC},XN={tokenize:sC},ZN={tokenize:iC};function eC(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yn(e,0,e.length,n),e}function tC(e,t){let n=e.length,r=0,i,l,a;for(;n--;){const h=e[n][1];if(i){if(h.type==="link"||h.type==="labelLink"&&h._inactive)break;e[n][0]==="enter"&&h.type==="labelLink"&&(h._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(h.type==="labelImage"||h.type==="labelLink")&&!h._balanced&&(i=n,h.type!=="labelLink")){r=2;break}}else h.type==="labelEnd"&&(l=n)}const o={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[l][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[l-2][1].start}};return a=[["enter",o,t],["enter",u,t]],a=rn(a,e.slice(i+1,i+r+3)),a=rn(a,[["enter",c,t]]),a=rn(a,zo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,l-3),t)),a=rn(a,[["exit",c,t],e[l-2],e[l-1],["exit",u,t]]),a=rn(a,e.slice(l+1)),a=rn(a,[["exit",o,t]]),yn(e,i,e.length,a),e}function nC(e,t,n){const r=this,i=r._labelStarts;let l,a;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();l=i[i.length-1]}return o;function o(f){return l?l._inactive?d(f):(a=r.parser.defined.includes(vn(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):n(f)}function u(f){return f===40?e.attempt(JN,h,a?h:d)(f):f===91?e.attempt(XN,h,a?c:d)(f):a?h(f):d(f)}function c(f){return e.attempt(ZN,h,d)(f)}function h(f){return i.pop(),t(f)}function d(f){return l._balanced=!0,n(f)}}function rC(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Oe(d)?Vi(e,l)(d):l(d)}function l(d){return d===41?h(d):gv(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Oe(d)?Vi(e,u)(d):h(d)}function o(d){return n(d)}function u(d){return d===34||d===39||d===40?yv(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):h(d)}function c(d){return Oe(d)?Vi(e,h)(d):h(d)}function h(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function sC(e,t,n){const r=this;return i;function i(o){return xv.call(r,e,l,a,"reference","referenceMarker","referenceString")(o)}function l(o){return r.parser.defined.includes(vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function iC(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const lC={name:"labelStartImage",resolveAll:_h.resolveAll,tokenize:aC};function aC(e,t,n){const r=this;let i;return l;function l(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),a}function a(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),i=e.exit("labelImage"),o):n(u)}function o(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(u))}}const oC={name:"labelStartLink",resolveAll:_h.resolveAll,tokenize:uC};function uC(e,t,n){const r=this;let i;return l;function l(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),i=e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(o))}}const Eu={name:"lineEnding",tokenize:cC};function cC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Ca={name:"thematicBreak",tokenize:dC};function dC(e,t,n){let r=0,i;return l;function l(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||de(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),ve(c)?Le(e,o,"whitespace")(c):o(c))}}const At={continuation:{tokenize:mC},exit:xC,name:"list",tokenize:pC},hC={partial:!0,tokenize:yC},fC={partial:!0,tokenize:gC};function pC(e,t,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Jc(m)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ca,n,c)(m):c(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(m)}return n(m)}function u(m){return Jc(m)&&++a<10?(e.consume(m),u):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(El,r.interrupt?n:h,e.attempt(hC,f,d))}function h(m){return r.containerState.initialBlankLine=!0,l++,f(m)}function d(m){return ve(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function mC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(El,i,l);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!ve(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(fC,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(At,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function gC(e,t,n){const r=this;return Le(e,i,"listItemIndent",r.containerState.size+1);function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(l):n(l)}}function xC(e){e.exit(this.containerState.type)}function yC(e,t,n){const r=this;return Le(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const a=r.events[r.events.length-1];return!ve(l)&&a&&a[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const tm={name:"setextUnderline",resolveTo:vC,tokenize:jC};function vC(e,t){const n=new io;let r=e.length,i,l,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&n.add(r,1,[]),!a&&e[r][1].type==="definition"&&(a=r);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",a?(n.add(l,0,[["enter",o,t]]),n.add(a+1,0,[["exit",e[i][1],t]]),e[i][1].end={...e[a][1].end}):e[i][1]=o,n.add(e.length,0,[["exit",o,t]]),n.consume(e),e}function jC(e,t,n){const r=this;let i;return l;function l(c){let h=r.events.length,d;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){d=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),ve(c)?Le(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||de(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const wC={tokenize:kC};function kC(e){const t=this,n=e.attempt(El,r,e.attempt(this.parser.constructs.flowInitial,i,Le(e,e.attempt(this.parser.constructs.flow,i,e.attempt(RN,i)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const bC={resolveAll:wv()},SC=jv("string"),NC=jv("text");function jv(e){return{resolveAll:wv(e==="text"?CC:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],l=n.attempt(i,a,o);return a;function a(h){return c(h)?l(h):o(h)}function o(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return c(h)?(n.exit("data"),l(h)):(n.consume(h),u)}function c(h){if(h===null)return!0;const d=i[h];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function wv(e){return t;function t(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,r):n}}function CC(e,t){const n=new io;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],l=t.sliceStream(i);let a=l.length,o=-1,u=0,c;for(;a--;){const h=l[a];if(typeof h=="string"){for(o=h.length;h.charCodeAt(o-1)===32;)u++,o--;if(o)break;o=-1}else if(h===-2)c=!0,u++;else if(h!==-1){a++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(u=0),u){const h={type:r===e.length||c||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:i.start._bufferIndex+o,_index:i.start._index+a,line:i.end.line,column:i.end.column-u,offset:i.end.offset-u},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):n.add(r,0,[["enter",h,t],["exit",h,t]])}r++}return n.consume(e),e}const EC={42:At,43:At,45:At,48:At,49:At,50:At,51:At,52:At,53:At,54:At,55:At,56:At,57:At,62:hv},TC={91:MN},PC={[-2]:Cu,[-1]:Cu,32:Cu},RC={35:UN,42:Ca,45:[tm,Ca],60:WN,61:tm,95:Ca,96:em,126:em},LC={38:pv,92:fv},AC={[-5]:Eu,[-4]:Eu,[-3]:Eu,33:lC,38:pv,42:Xc,60:[dN,KN],91:oC,92:[ON,fv],93:_h,95:Xc,96:SN},IC={null:[Xc,bC]},DC={null:[42,95]},MC={null:[]},zC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:DC,contentInitial:TC,disable:MC,document:EC,flow:RC,flowInitial:PC,insideSpan:IC,string:LC,text:AC},Symbol.toStringTag,{value:"Module"}));function _C(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},l=[];let a=[],o=[];const u={attempt:R(E),check:R(k),consume:y,enter:v,exit:b,interrupt:R(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:d};let h=t.tokenize.call(c,u);return t.resolveAll&&l.push(t),c;function d(L){return a=rn(a,L),w(),a[a.length-1]!==null?[]:(T(t,0),c.events=zo(l,c.events,c),c.events)}function f(L,A){return OC(m(L),A)}function m(L){return $C(a,L)}function p(){const{_bufferIndex:L,_index:A,line:z,column:U,offset:I}=r;return{_bufferIndex:L,_index:A,line:z,column:U,offset:I}}function g(L){i[L.line]=L.column,C()}function w(){for(;r._index<a.length;){const L=a[r._index];if(typeof L=="string"){const A=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<L.length;)x(L.charCodeAt(r._bufferIndex))}else x(L)}}function x(L){h=h(L)}function y(L){de(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,C()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=L}function v(L,A){const z=A||{};return z.type=L,z.start=p(),c.events.push(["enter",z,c]),o.push(z),z}function b(L){const A=o.pop();return A.end=p(),c.events.push(["exit",A,c]),A}function E(L,A){T(L,A.from)}function k(L,A){A.restore()}function R(L,A){return z;function z(U,I,Q){let J,H,X,S;return Array.isArray(U)?O(U):"tokenize"in U?O([U]):ae(U);function ae(oe){return B;function B(he){const ze=he!==null&&oe[he],Ke=he!==null&&oe.null,W=[...Array.isArray(ze)?ze:ze?[ze]:[],...Array.isArray(Ke)?Ke:Ke?[Ke]:[]];return O(W)(he)}}function O(oe){return J=oe,H=0,oe.length===0?Q:N(oe[H])}function N(oe){return B;function B(he){return S=D(),X=oe,oe.partial||(c.currentConstruct=oe),oe.name&&c.parser.constructs.disable.null.includes(oe.name)?Z():oe.tokenize.call(A?Object.assign(Object.create(c),A):c,u,F,Z)(he)}}function F(oe){return L(X,S),I}function Z(oe){return S.restore(),++H<J.length?N(J[H]):Q}}}function T(L,A){L.resolveAll&&!l.includes(L)&&l.push(L),L.resolve&&yn(c.events,A,c.events.length-A,L.resolve(c.events.slice(A),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function D(){const L=p(),A=c.previous,z=c.currentConstruct,U=c.events.length,I=Array.from(o);return{from:U,restore:Q};function Q(){r=L,c.previous=A,c.currentConstruct=z,c.events.length=U,o=I,C()}}function C(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function $C(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,l)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}l>0&&a.push(e[i].slice(0,l))}return a}function OC(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const l=e[n];let a;if(typeof l=="string")a=l;else switch(l){case-5:{a="\r";break}case-4:{a=`
360
+ `,Qc=[{id:"planner",label:"Planner",agent:{name:"Planner",description:"Asks the open questions, takes the answers and writes the solution",instructions:Ib,model:"sonnet",permissions:By,review:"human"}},{id:"coding",label:"Coding",agent:{name:"Coding",description:"Implements the approved solution; never writes tests",instructions:Db,model:"opus",permissions:ku,review:"auto"}},{id:"unit-test",label:"Unit Test",agent:{name:"Unit Test",description:"Tests the diff with 100% line and branch coverage and runs the suite",instructions:Mb,model:"sonnet",permissions:ku,review:"auto"}},{id:"code-review",label:"Code Review",agent:{name:"Code Review",description:"Solution-architect review: CRITICAL/REQUIRED go back to Coding, OPTIONAL noted for later",instructions:zb,model:"sonnet",permissions:ku,review:"auto"}}];function _b(e){const t=Qc.find(r=>r.id===e);if(!t)throw new Error(`Unknown agent template: ${e}`);const n=t.agent.permissions;return{...t.agent,skills:[],claudeMdSections:[],permissions:{...n,deniedCommands:[...n.deniedCommands],protectedPaths:[...n.protectedPaths]}}}function yt({status:e,children:t}){return e?s.jsx("span",{className:`badge ${e}`,children:t??e}):s.jsx("span",{className:"badge",children:"—"})}function An({status:e}){return s.jsx(yt,{status:e,children:e==="passed"?"done":e==="waiting"?"waiting for review":void 0})}function ni({status:e,children:t,title:n}){return e?s.jsxs("span",{className:`pill ${e}`,title:n,children:[s.jsx("i",{}),t??e]}):s.jsx("span",{className:"pill",children:"—"})}function Le({error:e}){return e?s.jsx("div",{className:"error-box",role:"alert",children:e}):null}function kn({value:e,onChange:t,items:n}){return s.jsx("div",{className:"tabs",role:"tablist",children:n.map(r=>s.jsx("button",{role:"tab","aria-selected":e===r.id,className:`tab ${e===r.id?"active":""}`,onClick:()=>t(r.id),children:r.label},r.id))})}const Hy={explorer:Py,generator:wh,validator:kh,healer:Ry,runner:ab,specwriter:hl,contextwriter:bh,custom:hl};function Ft({agent:e,size:t=36}){const n=Hy[e];return s.jsx("span",{className:`agent-icon ${e}`,style:{width:t,height:t,borderRadius:t/3},title:Ne[e].label,children:s.jsx(n,{size:Math.round(t*.5)})})}function $b({agents:e}){return s.jsx("span",{className:"row",style:{gap:0},children:e.map(t=>{const n=Hy[t.agent];return s.jsx("span",{className:`agent-chip agent-icon ${t.agent} ${t.status}`,title:`${Ne[t.agent].label}: ${t.status}`,children:s.jsx(n,{size:12})},t.id)})})}function Rt(e){if(!e)return"—";const t=new Date(e),n=(Date.now()-t.getTime())/1e3;return n<60?"just now":n<3600?`${Math.floor(n/60)} min ago`:n<86400?`${Math.floor(n/3600)} h ago`:t.toLocaleString("en-US",{hour12:!1})}function kr(e,t){if(!e)return"—";const n=(t?Date.parse(t):Date.now())-Date.parse(e);if(n<1e3)return`${Math.max(n,0)} ms`;const r=Math.round(n/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`}const br={explore:"Explore",generate:"Generate",heal:"Heal",spec:"Write spec",testrun:"Test run",context:"Project context",custom:"Custom agent",pipeline:"Pipeline"};function Wy(e){var t;return e.label??((t=Ne[e.agent])==null?void 0:t.label)??e.agent}function ln(e){return e==null?"—":e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)}k`:`${(e/1e6).toFixed(2)}M`}function Kt(e){return e==null?"—":e>0&&e<.01?"<$0.01":`$${e.toFixed(2)}`}function Ob({onClose:e,onNewSpec:t}){const n=ut(),{specs:r}=Zt(),i=_e(()=>q.jobs()),[l,a]=j.useState(""),[o,u]=j.useState(0),c=m=>{e(),n(m)},h=j.useMemo(()=>{const m=[{group:"Actions",key:"new",label:"Create new spec",text:"new spec create",icon:s.jsx(qt,{size:16}),run:t},{group:"Actions",key:"runall",label:"Run all tests",text:"run all tests",icon:s.jsx(ft,{size:16}),run:()=>void q.createJob({type:"testrun",repeatEach:1}).then(g=>c(`/runs/${g.id}`))},...r.map(g=>({group:"Specs",key:`s-${g.file}`,label:s.jsxs(s.Fragment,{children:[g.file," ",s.jsx("span",{className:"muted small",children:g.parsed.title})]}),text:`${g.file} ${g.parsed.title}`,icon:s.jsx(jr,{size:16}),run:()=>c(`/specs/${g.file}`)})),...r.flatMap(g=>g.parsed.tcs.map(w=>({group:"Test case",key:`t-${g.file}-${w.id}`,label:s.jsxs(s.Fragment,{children:[s.jsx("code",{children:w.id})," ",w.title]}),text:`${w.id} ${w.title} ${g.file}`,icon:s.jsx(jr,{size:16}),run:()=>c(`/specs/${g.file}`)}))),...(i.data??[]).slice(0,20).map(g=>({group:"Jobs",key:`j-${g.id}`,label:s.jsxs(s.Fragment,{children:["#",g.id," ",br[g.type]," · ",g.target," ",s.jsx(An,{status:g.status})]}),text:`#${g.id} ${g.type} ${g.target} ${g.status}`,icon:s.jsx(ft,{size:16}),run:()=>c(`/runs/${g.id}`)}))],p=l.trim().toLowerCase();return p?m.filter(g=>g.text.toLowerCase().includes(p)):m},[l,r,i.data]);j.useEffect(()=>u(0),[l]);const d=m=>{var p;m.key==="ArrowDown"?(m.preventDefault(),u(g=>Math.min(g+1,h.length-1))):m.key==="ArrowUp"?(m.preventDefault(),u(g=>Math.max(g-1,0))):m.key==="Enter"&&((p=h[o])==null||p.run())};let f="";return s.jsx("div",{className:"overlay",onClick:e,children:s.jsxs("div",{className:"palette",onClick:m=>m.stopPropagation(),role:"dialog","aria-label":"Command palette",children:[s.jsx("input",{autoFocus:!0,placeholder:"Search specs, test cases, jobs, actions…",value:l,onChange:m=>a(m.target.value),onKeyDown:d}),s.jsxs("ul",{role:"listbox",children:[h.map((m,p)=>{const g=m.group!==f;return f=m.group,s.jsxs("div",{children:[g&&s.jsx("li",{className:"group",children:m.group}),s.jsxs("li",{role:"option","aria-selected":p===o,className:p===o?"active":"",onMouseEnter:()=>u(p),onClick:m.run,children:[m.icon,s.jsx("span",{children:m.label})]})]},m.key)}),h.length===0&&s.jsx("li",{className:"group",children:"No results"})]})]})})}const Vy=j.createContext(async()=>!1),In=()=>j.useContext(Vy);function Fb({children:e}){const[t,n]=j.useState([]),r=j.useRef(1),i=j.useCallback(u=>{const c=r.current++;return new Promise(h=>n(d=>[...d,{...u,id:c,resolve:h}]))},[]),l=t[0],a=j.useCallback(u=>{n(c=>{var h;return(h=c[0])==null||h.resolve(u),c.slice(1)})},[]),o=j.useMemo(()=>i,[i]);return s.jsxs(Vy.Provider,{value:o,children:[e,l&&Tr.createPortal(s.jsx(Ub,{opts:l,onClose:a},l.id),document.body)]})}function Ub({opts:e,onClose:t}){const n=j.useRef(null),r=j.useRef(null);return j.useEffect(()=>{var l;(l=(e.danger?n:r).current)==null||l.focus();const i=a=>{var o;if(a.key==="Escape"&&(a.stopPropagation(),t(!1)),a.key==="Tab"){const u=[n.current,r.current].filter(Boolean),c=u.indexOf(document.activeElement);a.preventDefault(),(o=u[(c+(a.shiftKey?-1:1)+u.length)%u.length])==null||o.focus()}};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[e.danger,t]),s.jsx("div",{className:"overlay confirm-overlay",onClick:()=>t(!1),children:s.jsx("div",{className:"modal confirm-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-title","aria-describedby":"confirm-msg",onClick:i=>i.stopPropagation(),children:s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"confirm-head",children:[e.danger&&s.jsx("span",{className:"confirm-icon","aria-hidden":"true",children:s.jsx(Ar,{size:18})}),s.jsxs("div",{children:[s.jsx("h3",{id:"confirm-title",children:e.title}),e.message&&s.jsx("div",{id:"confirm-msg",className:"confirm-msg",children:e.message})]})]}),s.jsxs("div",{className:"confirm-actions",children:[s.jsx("button",{ref:n,type:"button",className:"btn ghost",onClick:()=>t(!1),children:e.cancelLabel??"Cancel"}),s.jsx("button",{ref:r,type:"button",className:`btn ${e.danger?"btn-danger-solid":""}`,onClick:()=>t(!0),children:e.confirmLabel??(e.danger?"Delete":"OK")})]})]})})})}function Ph(e,t){const n=In(),r=j.useRef(!1),i=j.useRef(t);i.current=t,j.useEffect(()=>{e.state!=="blocked"||r.current||(r.current=!0,n(i.current).then(l=>{r.current=!1,l?e.proceed():e.reset()}))},[e,n])}const Qy=j.createContext(e=>e),Bb=()=>j.useContext(Qy);function Hb({children:e}){const[t,n]=j.useState(0),r=j.useCallback(i=>(n(l=>l+1),i.finally(()=>n(l=>l-1))),[]);return s.jsxs(Qy.Provider,{value:r,children:[e,t>0&&Tr.createPortal(s.jsx("div",{className:"loading-bar",role:"progressbar","aria-label":"Loading"}),document.body)]})}const Si=()=>{},qy=j.createContext({show:Si,info:Si,success:Si,warning:Si,error:Si}),Ir=()=>j.useContext(qy);function Wb({children:e}){const[t,n]=j.useState([]),r=j.useRef(1),i=j.useCallback(o=>n(u=>u.filter(c=>c.id!==o)),[]),l=j.useCallback((o,u)=>{const c=(u==null?void 0:u.kind)??"info",h={id:r.current++,kind:c,message:o,duration:(u==null?void 0:u.duration)??(c==="error"?6e3:3500)};n(d=>[...d,h].slice(-4))},[]),a=j.useMemo(()=>({show:l,info:o=>l(o,{kind:"info"}),success:o=>l(o,{kind:"success"}),warning:o=>l(o,{kind:"warning"}),error:o=>l(o,{kind:"error"})}),[l]);return s.jsxs(qy.Provider,{value:a,children:[e,Tr.createPortal(s.jsx("div",{className:"toasts",role:"region","aria-label":"Notifications",children:t.map(o=>s.jsx(Vb,{item:o,onClose:()=>i(o.id)},o.id))}),document.body)]})}function Vb({item:e,onClose:t}){const[n,r]=j.useState(!1);return j.useEffect(()=>{if(n)return;const i=setTimeout(t,e.duration);return()=>clearTimeout(i)},[n,e.duration,t]),s.jsxs("div",{className:`toast ${e.kind}`,role:e.kind==="error"?"alert":"status",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:e.kind==="success"?s.jsx(jh,{size:14}):e.kind==="error"?s.jsx(wr,{size:14}):e.kind==="warning"?"!":"i"}),s.jsx("span",{className:"toast-msg",children:e.message}),s.jsx("button",{className:"toast-close",onClick:t,"aria-label":"Dismiss notification",children:s.jsx(wr,{size:13})})]})}const Gy=j.createContext({refreshClaude:()=>{},openNewSpec:()=>{},openPalette:()=>{},theme:"light",toggleTheme:()=>{},crumbSlot:null,extraSlot:null}),hs=()=>j.useContext(Gy);function Qb(){try{return localStorage.getItem("qa-studio.sidebar")==="collapsed"}catch{return!1}}const qb=.6,bu="Agent Studio (v0.1.6)";function Gb(e,t){j.useLayoutEffect(()=>{const n=e.current,r=t.current;if(!n||!r)return;const i=()=>{r.style.zoom="";const o=getComputedStyle(n),u=n.clientHeight-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom),c=r.scrollHeight,h=c>u&&u>0?Math.max(qb,u/c):1;r.style.zoom=h<1?h.toFixed(3):""};i();const l=new ResizeObserver(i);l.observe(n);const a=new MutationObserver(i);return a.observe(r,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),a.disconnect()}},[e,t])}function Kb({collapsed:e,mobileOpen:t,onCloseMobile:n}){var x;const r=j.useRef(null),i=j.useRef(null);Gb(r,i);const{specs:l,mapping:a}=Zt(),{openPalette:o}=hs(),u=Kn(),c=_e(()=>q.jobs(),[u.pathname]),{reload:h}=c,d=(c.data??[]).some(y=>y.status==="queued"||y.status==="running"||y.status==="waiting");j.useEffect(()=>{if(!d)return;const y=setInterval(h,5e3);return()=>clearInterval(y)},[d,h]);const f=(c.data??[]).filter(y=>y.status==="running"||y.status==="queued").length,m=(c.data??[]).filter(y=>y.status==="waiting").length;j.useEffect(()=>(document.title=m?`● ${bu}`:bu,()=>{document.title=bu}),[m]);const p=a.filter(y=>y.status!=="orphan"&&y.testFile).length,g=a.filter(y=>y.status!=="orphan").length,w=(y,v,b,E,k,R)=>s.jsxs(V0,{to:y,end:k,className:({isActive:T})=>`side-link ${T&&!(R&&u.pathname.startsWith(R))?"active":""}`,title:e?b:void 0,children:[v,s.jsx("span",{className:"side-label",children:b}),E!==void 0&&s.jsx("span",{className:"count",children:E})]});return s.jsx("aside",{ref:r,id:"app-sidebar",className:`sidebar ${e?"collapsed":""} ${t?"mobile-open":""}`,"aria-label":"Main menu",children:s.jsxs("div",{ref:i,className:"side-inner",children:[s.jsxs("div",{className:"side-head",children:[s.jsx("span",{className:"logo",children:s.jsx(kh,{size:18})}),s.jsx("h2",{className:"side-label",children:"Agent Studio"}),s.jsx("button",{className:"side-close",onClick:n,"aria-label":"Close menu",children:s.jsx(wr,{size:18})})]}),s.jsxs("button",{className:"side-search",onClick:o,"aria-label":"Search (Ctrl+K)",children:[s.jsx(Ro,{size:16}),s.jsx("span",{className:"side-label",children:"Search"}),s.jsx("span",{className:"kbd side-label",children:"⌘K"})]}),s.jsx("div",{className:"side-group side-label",children:"Overview"}),s.jsxs("nav",{className:"side-nav","aria-label":"Overview",children:[w("/",s.jsx(rb,{size:17}),"Overview",void 0,!0),w("/chat",s.jsx(Nh,{size:17}),"Claude chat")]}),s.jsx("div",{className:"side-group side-label",children:"Specification"}),s.jsxs("nav",{className:"side-nav","aria-label":"Specification",children:[w("/specs",s.jsx(jr,{size:17}),"Specification",l.length,!1,"/specs/from-requirement"),w("/specs/from-requirement",s.jsx(hl,{size:17}),"Generator")]}),s.jsx("div",{className:"side-group side-label",children:"Testing"}),s.jsxs("nav",{className:"side-nav","aria-label":"Testing",children:[w("/mapping",s.jsx(vh,{size:17}),"Test cases",g?`${p}/${g}`:0),w("/test-runs",s.jsx(cb,{size:17}),"Test runs"),w("/runs",s.jsx(ft,{size:17}),"Recent runs",m?`${m} waiting`:f?`${f} running`:((x=c.data)==null?void 0:x.length)??0)]}),s.jsx("div",{className:"side-group side-label",children:"Settings"}),s.jsxs("nav",{className:"side-nav","aria-label":"Settings",children:[w("/agents",s.jsx(Dy,{size:17}),"Agents"),w("/usage",s.jsx(My,{size:17}),"Claude usage"),w("/project",s.jsx(bh,{size:17}),"Project"),w("/settings",s.jsx(ob,{size:17}),"Settings")]})]})})}function Yb({setCrumbSlot:e,setExtraSlot:t,menuOpen:n,onMenu:r}){const{theme:i,toggleTheme:l,openPalette:a}=hs();return s.jsxs("header",{className:"topbar",children:[s.jsx("button",{className:"menu-btn",onClick:r,"aria-label":"Open menu","aria-expanded":n,"aria-controls":"app-sidebar",children:s.jsx(lb,{size:20})}),s.jsx("div",{className:"topbar-crumbs",ref:e}),s.jsx("div",{className:"topbar-spacer"}),s.jsx("div",{className:"topbar-extra",ref:t}),s.jsxs("button",{className:"top-search",onClick:a,"aria-label":"Search specs, TC-ID (Ctrl+K)",children:[s.jsx(Ro,{size:15}),s.jsx("span",{children:"Search specs, TC-ID…"})]}),s.jsx("button",{className:"theme-btn",onClick:l,title:"Toggle light/dark theme","aria-label":"Toggle light/dark theme",children:i==="dark"?s.jsx(Ay,{size:17}):s.jsx(Ly,{size:17})})]})}const Jb=/^[a-z0-9][a-z0-9_-]*$/;function Xb({initial:e,onClose:t}){const n=ut(),{refresh:r}=Zt(),[i,l]=j.useState((e==null?void 0:e.name)??""),[a,o]=j.useState(null),u=async c=>{c.preventDefault();const h=i.trim().replace(/\.md$/,"");if(!Jb.test(h))return o('Name may only contain lowercase letters, digits, "-" or "_", and must start with a letter or digit.');try{await q.createSpec(`${h}.md`,(e==null?void 0:e.content)??X0),r(),t(),n(`/specs/${h}.md`)}catch(d){o(d.message)}};return s.jsx("div",{className:"overlay",onClick:t,children:s.jsx("form",{className:"modal",onClick:c=>c.stopPropagation(),onSubmit:u,children:s.jsxs("div",{className:"modal-body",children:[s.jsx("h3",{style:{margin:0},children:e!=null&&e.content?"Import spec":"New spec"}),s.jsxs("div",{className:"row",children:[s.jsx("input",{className:"input grow",autoFocus:!0,placeholder:"spec-name",value:i,onChange:c=>l(c.target.value),"aria-label":"Spec name"}),s.jsx("span",{className:"muted",children:".md"})]}),s.jsx(Le,{error:a}),s.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn",children:e!=null&&e.content?"Import":"Create spec"})]})]})})})}function Zb(e){const[t,n]=j.useState(!1);return j.useEffect(()=>{const r=()=>n(!0);return window.addEventListener(Bc,r),()=>window.removeEventListener(Bc,r)},[]),j.useEffect(()=>{if(!t)return;let r=!1;const i=setInterval(()=>{K0().then(l=>{l&&!r&&(n(!1),e())})},3e3);return()=>{r=!0,clearInterval(i)}},[t,e]),t}function eS(){var k;const e=Z0(),[t,n]=tb(),[r,i]=j.useState(!1),[l,a]=j.useState(null),[o,u]=j.useState(Qb),[c,h]=j.useState(!1),{pathname:d}=Kn();j.useEffect(()=>h(!1),[d]);const[f,m]=j.useState(null),[p,g]=j.useState(null),[w,x]=j.useState(null),y=j.useCallback(()=>{q.claudeStatus().then(x).catch(()=>{})},[]),{refresh:v}=e,b=Zb(j.useCallback(()=>{v(),y()},[v,y]));j.useEffect(()=>{y();const R=setInterval(y,5*6e4);return()=>clearInterval(R)},[y]),j.useEffect(()=>{try{localStorage.setItem("qa-studio.sidebar",o?"collapsed":"open")}catch{}},[o]),j.useEffect(()=>{const R=T=>{(T.ctrlKey||T.metaKey)&&T.key.toLowerCase()==="k"&&(T.preventDefault(),i(D=>!D)),T.key==="Escape"&&(i(!1),a(null),h(!1))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]);const E=j.useMemo(()=>({openNewSpec:R=>a(R??{}),openPalette:()=>i(!0),theme:t,toggleTheme:n,crumbSlot:f,extraSlot:p,refreshClaude:y}),[t,n,f,p,y]);return s.jsx(Ty.Provider,{value:e,children:s.jsx(Gy.Provider,{value:E,children:s.jsx(Wb,{children:s.jsx(Hb,{children:s.jsxs(Fb,{children:[s.jsxs("div",{className:`shell ${o?"side-collapsed":""}`,children:[s.jsx(Kb,{collapsed:o,mobileOpen:c,onCloseMobile:()=>h(!1)}),c&&s.jsx("div",{className:"side-backdrop",onClick:()=>h(!1),"aria-hidden":"true"}),s.jsx("button",{className:"side-toggle-dot",onClick:()=>u(R=>!R),"aria-label":o?"Expand menu":"Collapse menu",title:o?"Expand menu":"Collapse menu",children:s.jsx("span",{style:{display:"inline-flex",transform:o?void 0:"rotate(180deg)"},children:s.jsx(ti,{size:10})})}),s.jsxs("div",{className:"main",children:[s.jsx(Yb,{setCrumbSlot:m,setExtraSlot:g,menuOpen:c,onMenu:()=>h(!0)}),b&&s.jsxs("div",{className:"claude-banner",role:"alert",children:[s.jsx("b",{children:"Agent Studio server is not running."})," Start it with ",s.jsx("code",{children:"npm run studio:start"})," in the repo folder; this page reconnects by itself."]}),!b&&(w==null?void 0:w.state)==="not-ready"&&s.jsxs("div",{className:"claude-banner",role:"alert",children:[s.jsx("b",{children:"Claude Code is not ready:"})," ",w.binary.ok?w.version.ok?(k=w.test)==null?void 0:k.message:w.version.detail:w.binary.detail,". Built-in agents (explore, generate, heal, spec generator, project context) cannot run. ",s.jsx(ye,{to:"/settings#claude",children:"Fix it in Settings"})]}),s.jsx("div",{className:"content",children:s.jsx(b0,{})})]})]}),r&&s.jsx(Ob,{onClose:()=>i(!1),onNewSpec:()=>(i(!1),a({}))}),l&&s.jsx(Xb,{initial:l,onClose:()=>a(null)})]})})})})})}function ot({items:e}){const{crumbSlot:t}=hs();return t?Tr.createPortal(s.jsx("nav",{className:"crumbs","aria-label":"Breadcrumb",children:e.map((n,r)=>s.jsxs("span",{className:"crumb",children:[r>0&&s.jsx("span",{className:"sep",children:"/"}),n.to?s.jsx(ye,{to:n.to,children:n.label}):s.jsx("span",{className:"current",children:n.label}),n.count!==void 0&&s.jsx("span",{className:"pill-count",children:n.count})]},r))}),t):null}function tS({children:e}){const{extraSlot:t}=hs();return t?Tr.createPortal(e,t):null}function nS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const rS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iS={};function Op(e,t){return(iS.jsx?sS:rS).test(e)}const lS=/[ \t\n\f\r]/g;function aS(e){return typeof e=="object"?e.type==="text"?Fp(e.value):!1:Fp(e)}function Fp(e){return e.replace(lS,"")===""}class Sl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Sl.prototype.normal={};Sl.prototype.property={};Sl.prototype.space=void 0;function Ky(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Sl(n,r,t)}function qc(e){return e.toLowerCase()}class Ut{constructor(t,n){this.attribute=n,this.property=t}}Ut.prototype.attribute="";Ut.prototype.booleanish=!1;Ut.prototype.boolean=!1;Ut.prototype.commaOrSpaceSeparated=!1;Ut.prototype.commaSeparated=!1;Ut.prototype.defined=!1;Ut.prototype.mustUseProperty=!1;Ut.prototype.number=!1;Ut.prototype.overloadedBoolean=!1;Ut.prototype.property="";Ut.prototype.spaceSeparated=!1;Ut.prototype.space=void 0;let oS=0;const me=fs(),rt=fs(),Gc=fs(),Y=fs(),Oe=fs(),Zr=fs(),Ht=fs();function fs(){return 2**++oS}const Kc=Object.freeze(Object.defineProperty({__proto__:null,boolean:me,booleanish:rt,commaOrSpaceSeparated:Ht,commaSeparated:Zr,number:Y,overloadedBoolean:Gc,spaceSeparated:Oe},Symbol.toStringTag,{value:"Module"})),Su=Object.keys(Kc);class Rh extends Ut{constructor(t,n,r,i){let l=-1;if(super(t,n),Up(this,"space",i),typeof r=="number")for(;++l<Su.length;){const a=Su[l];Up(this,Su[l],(r&Kc[a])===Kc[a])}}}Rh.prototype.defined=!0;function Up(e,t,n){n&&(e[t]=n)}function ai(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Rh(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[qc(r)]=r,n[qc(l.attribute)]=r}return new Sl(t,n,e.space)}const Yy=ai({properties:{ariaActiveDescendant:null,ariaAtomic:rt,ariaAutoComplete:null,ariaBusy:rt,ariaChecked:rt,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:Oe,ariaCurrent:null,ariaDescribedBy:Oe,ariaDetails:null,ariaDisabled:rt,ariaDropEffect:Oe,ariaErrorMessage:null,ariaExpanded:rt,ariaFlowTo:Oe,ariaGrabbed:rt,ariaHasPopup:null,ariaHidden:rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Oe,ariaLevel:Y,ariaLive:null,ariaModal:rt,ariaMultiLine:rt,ariaMultiSelectable:rt,ariaOrientation:null,ariaOwns:Oe,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:rt,ariaReadOnly:rt,ariaRelevant:null,ariaRequired:rt,ariaRoleDescription:Oe,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:rt,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Jy(e,t){return t in e?e[t]:t}function Xy(e,t){return Jy(e,t.toLowerCase())}const uS=ai({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Zr,acceptCharset:Oe,accessKey:Oe,action:null,allow:null,allowFullScreen:me,allowPaymentRequest:me,allowUserMedia:me,alpha:me,alt:null,as:null,async:me,autoCapitalize:null,autoComplete:Oe,autoFocus:me,autoPlay:me,blocking:Oe,capture:null,charSet:null,checked:me,cite:null,className:Oe,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:rt,controls:me,controlsList:Oe,coords:Y|Zr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:me,defer:me,dir:null,dirName:null,disabled:me,download:Gc,draggable:rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:me,formTarget:null,headers:Oe,height:Y,hidden:Gc,high:Y,href:null,hrefLang:null,htmlFor:Oe,httpEquiv:Oe,id:null,imageSizes:null,imageSrcSet:null,inert:me,inputMode:null,integrity:null,is:null,isMap:me,itemId:null,itemProp:Oe,itemRef:Oe,itemScope:me,itemType:Oe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:me,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:me,muted:me,name:null,nonce:null,noModule:me,noValidate:me,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:me,optimum:Y,pattern:null,ping:Oe,placeholder:null,playsInline:me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:me,referrerPolicy:null,rel:Oe,required:me,reversed:me,rows:Y,rowSpan:Y,sandbox:Oe,scope:null,scoped:me,seamless:me,selected:me,shadowRootClonable:me,shadowRootCustomElementRegistry:me,shadowRootDelegatesFocus:me,shadowRootMode:null,shadowRootSerializable:me,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:me,useMap:null,value:rt,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Oe,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:me,declare:me,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:me,noHref:me,noShade:me,noWrap:me,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:rt,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:me,disablePictureInPicture:me,disableRemotePlayback:me,exportParts:Zr,part:Oe,prefix:null,property:null,results:Y,security:null,unselectable:null},space:"html",transform:Xy}),cS=ai({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:Ht,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:Oe,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:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:me,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,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:Zr,g2:Zr,glyphName:Zr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:Ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,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:Y,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:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Oe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ht,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ht,rev:Ht,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ht,requiredFeatures:Ht,requiredFonts:Ht,requiredFormats:Ht,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:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:Ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ht,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ht,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jy}),Zy=ai({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ev=ai({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xy}),tv=ai({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dS={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"},hS=/[A-Z]/g,Bp=/-[a-z]/g,fS=/^data[-\w.:]+$/i;function pS(e,t){const n=qc(t);let r=t,i=Ut;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&fS.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Bp,gS);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Bp.test(l)){let a=l.replace(hS,mS);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Rh}return new i(r,t)}function mS(e){return"-"+e.toLowerCase()}function gS(e){return e.charAt(1).toUpperCase()}const xS=Ky([Yy,uS,Zy,ev,tv],"html"),Lh=Ky([Yy,cS,Zy,ev,tv],"svg");function yS(e){return e.join(" ").trim()}var Hp=/\/\*(?:[^*]|\*(?!\/))*\*\//g,vS=/\n/g,jS=/^\s*/,wS=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,kS=/^:\s*/,bS=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,SS=/^[;\s]*/,NS=`
361
+ `,Wp="/",Vp="*",Ni="",CS="comment",ES="declaration";function TS(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(p){var g=p.match(vS);g&&(n+=g.length);var w=p.lastIndexOf(NS);r=~w?p.length-w:r+p.length}function l(){var p={line:n,column:r};return function(g){return g.position=new a(p),c(),g}}function a(p){this.start=p,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(p){var g=new Error(t.source+":"+n+":"+r+": "+p);if(g.reason=p,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function u(p){var g=p.exec(e);if(g){var w=g[0];return i(w),e=e.slice(w.length),g}}function c(){u(jS)}function h(p){for(var g;g=d();)p.push(g);return p}function d(){var p=l();if(!(Wp!=e.charAt(0)||Vp!=e.charAt(1))){for(var g=2;Ni!=e.charAt(g)&&(Vp!=e.charAt(g)||Wp!=e.charAt(g+1));)++g;if(g+=2,Ni===e.charAt(g-1))return o("End of comment missing");var w=e.slice(2,g-2);return r+=2,i(w),e=e.slice(g),r+=2,p({type:CS,comment:w})}}function f(){var p=l(),g=u(wS);if(g){if(d(),!u(kS))return o("property missing ':'");var w=u(bS),x=p({type:ES,property:g[0].replace(Hp,Ni).trim(),value:w?w[0].replace(Hp,Ni).trim():Ni});return u(SS),x}}function m(){var p=[];h(p);for(var g;g=f();)p.push(g),h(p);return p}return c(),m()}function PS(e,t){let n=null;if(!e||typeof e!="string")return n;const r=TS(e),i=typeof t=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:a,value:o}=l;i?t(a,o,l):o&&(n=n??{},n[a]=o)}),n}const nv=rv("end"),Ah=rv("start");function rv(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function RS(e){const t=Ah(e),n=nv(e);if(t&&n)return{start:t,end:n}}function Wi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Qp(e.position):"start"in e||"end"in e?Qp(e):"line"in e||"column"in e?Yc(e):""}function Yc(e){return qp(e&&e.line)+":"+qp(e&&e.column)}function Qp(e){return Yc(e&&e.start)+"-"+Yc(e&&e.end)}function qp(e){return e&&typeof e=="number"?e:1}class Do extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},a=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(a=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?l.ruleId=r:(l.source=r.slice(0,u),l.ruleId=r.slice(u+1))}if(!l.place&&l.ancestors){const u=l.ancestors[l.ancestors.length-1];u&&(l.place=u.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=Wi(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=a&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Object.defineProperties(Do.prototype,{file:{configurable:!0,enumerable:!0,value:"",writable:!0},name:{configurable:!0,enumerable:!0,value:"",writable:!0},reason:{configurable:!0,enumerable:!0,value:"",writable:!0},message:{configurable:!0,enumerable:!0,value:"",writable:!0},stack:{configurable:!0,enumerable:!0,value:"",writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});const Ih={}.hasOwnProperty,LS=new Map,AS=/[A-Z]/g,IS=/-([a-z])/g,DS=new Set(["table","tbody","thead","tfoot","tr"]),MS=new Set(["td","th"]),sv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zS(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=WS(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=HS(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Lh:xS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=iv(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function iv(e,t,n){if(t.type==="element")return _S(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return $S(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return FS(e,t,n);if(t.type==="mdxjsEsm")return OS(e,t);if(t.type==="root")return US(e,t,n);if(t.type==="text")return BS(e,t)}function _S(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Lh,e.schema=i),e.ancestors.push(t);const l=av(e,t.tagName,!1),a=VS(e,t);let o=Mh(e,t);return DS.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!aS(u):!0})),lv(e,a,l,t),Dh(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function $S(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}pl(e,t.position)}function OS(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pl(e,t.position)}function FS(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Lh,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:av(e,t.name,!0),a=QS(e,t),o=Mh(e,t);return lv(e,a,l,t),Dh(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function US(e,t,n){const r={};return Dh(r,Mh(e,t)),e.create(t,e.Fragment,r,n)}function BS(e,t){return t.value}function lv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Dh(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function HS(e,t,n){return r;function r(i,l,a,o){const c=Array.isArray(a.children)?n:t;return o?c(l,a,o):c(l,a)}}function WS(e,t){return n;function n(r,i,l,a){const o=Array.isArray(l.children),u=Ah(r);return t(i,l,a,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function VS(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Ih.call(t.properties,i)){const l=qS(e,i,t.properties[i]);if(l){const[a,o]=l;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&MS.has(t.tagName)?r=o:n[a]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function QS(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const a=l.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else pl(e,t.position);else{const{name:i}=r;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else pl(e,t.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function Mh(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:LS;for(;++r<t.children.length;){const l=t.children[r];let a;if(e.passKeys){const u=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(u){const c=i.get(u)||0;a=u+"-"+c,i.set(u,c+1)}}const o=iv(e,l,a);o!==void 0&&n.push(o)}return n}function qS(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const r=pS(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?nS(n):yS(n)),r.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:KS(n):GS(e,String(n))]:[e.elementAttributeNameCase==="react"&&r.space?dS[r.property]||r.property:r.attribute,n]}function GS(e,t){const n={};try{PS(t,function(r,i){if(r&&i){let l=r;l.slice(0,2)!=="--"&&(l=l.toLowerCase(),e.stylePropertyNameCase==="dom"&&(l.slice(0,4)==="-ms-"&&(l=l.slice(1)),l=l.replace(IS,XS))),n[l]=i}})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,l=new Do("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=sv+"#cannot-parse-style-attribute",l}return n}function av(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,a;for(;++l<i.length;){const o=Op(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(l&&o.type==="Literal"),optional:!1}:o}r=a}else r=Op(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Ih.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);pl(e)}function pl(e,t){const n=new Do("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=sv+"#cannot-handle-mdx-estrees-without-createevaluater",n}function KS(e){const t={};let n;for(n in e)Ih.call(e,n)&&(t[YS(n)]=e[n]);return t}function YS(e){if(e.slice(0,2)==="--")return e;let t=e.replace(AS,JS);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function JS(e){return"-"+e.toLowerCase()}function XS(e,t){return t.toUpperCase()}const Nu={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"]},ZS={};function Mo(e,t){const n=ZS,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ov(e,r,i)}function ov(e,t,n){if(eN(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Gp(e.children,t,n)}return Array.isArray(e)?Gp(e,t,n):""}function Gp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=ov(e[i],t,n);return r.join("")}function eN(e){return!!(e&&typeof e=="object")}const Kp=document.createElement("i");function zh(e){const t="&"+e+";";Kp.innerHTML=t;const n=Kp.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yn(e,t,n,r){const i=e.length;let l=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);l<r.length;)a=r.slice(l,l+1e4),a.unshift(t,0),e.splice(...a),l+=1e4,t+=1e4}function rn(e,t){return e.length>0?(yn(e,e.length,0,t),e):t}const Yp={}.hasOwnProperty;function uv(e){const t={};let n=-1;for(;++n<e.length;)tN(t,e[n]);return t}function tN(e,t){let n;for(n in t){const i=(Yp.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let a;if(l)for(a in l){Yp.call(i,a)||(i[a]=[]);const o=l[a];nN(i[a],Array.isArray(o)?o:o?[o]:[])}}}function nN(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yn(e,0,0,r)}function cv(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function vn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vt=Dr(/[A-Za-z]/),jt=Dr(/[\dA-Za-z]/),rN=Dr(/[#-'*+\--9=?A-Z^-~]/);function ro(e){return e!==null&&(e<32||e===127)}const Jc=Dr(/\d/),sN=Dr(/[\dA-Fa-f]/),dv=Dr(/[!-/:-@[-`{-~]/);function he(e){return e!==null&&e<-2}function Fe(e){return e!==null&&(e<0||e===32)}function je(e){return e===-2||e===-1||e===32}const Nl=Dr(new RegExp("\\p{P}|\\p{S}","u")),as=Dr(/\s/);function Dr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function oi(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let a="";if(l===37&&jt(e.charCodeAt(n+1))&&jt(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(a=String.fromCharCode(l));else if(l>55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(a=String.fromCharCode(l,o),i=1):a="�"}else a=String.fromCharCode(l);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ie(e,t,n,r){const i=r?r-1:1/0;let l=0;return a;function a(u){return je(u)?(e.enter(n),o(u)):t(u)}function o(u){return je(u)&&l++<i?(e.consume(u),o):(e.exit(n),t(u))}}function hv(e,t,n,r,i,l){let a=0;return o;function o(h){return je(h)?(e.enter(r),u(h)):c(h)}function u(h){return je(h)&&a<l?(e.consume(h),a++,u):(e.exit(r),c(h))}function c(h){return a>=i?t(h):n(h)}}const iN={tokenize:lN};function lN(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ie(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),l(o)}function l(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return he(o)?(e.consume(o),e.exit("chunkText"),l):(e.consume(o),a)}}let so=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){Jp(this,t,n,r,!1)}addBefore(t,n,r){Jp(this,t,n,r,!0)}consume(t){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0,this.index.clear()}};function Jp(e,t,n,r,i){if(n===0&&r.length===0)return;const l=e.index.get(t);if(l){l[1]+=n,i?(r.push(...l[2]),l[2]=r):l[2].push(...r);return}const a=[t,n,r];e.map.push(a),e.index.set(t,a)}const aN={tokenize:oN},Xp={tokenize:uN};function oN(e){const t=this,n=[];let r=0,i,l,a;return o;function o(v){if(r<n.length){const b=n[r];return t.containerState=b[1],e.attempt(b[0].continuation,u,c)(v)}return c(v)}function u(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const b=t.events.length;let E=b,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}x(r);let R=b;for(;R<t.events.length;)t.events[R][1].end={...k},R++;const T=new so;return T.add(E+1,0,t.events.slice(b)),T.add(b,R-b,[]),T.consume(t.events),c(v)}return o(v)}function c(v){if(r===n.length){if(!i)return f(v);if(i.currentConstruct&&i.currentConstruct.concrete)return p(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Xp,h,d)(v)}function h(v){return i&&y(),x(r),f(v)}function d(v){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,p(v)}function f(v){return t.containerState={},e.attempt(Xp,m,p)(v)}function m(v){return r++,n.push([t.currentConstruct,t.containerState]),f(v)}function p(v){if(v===null){i&&y(),x(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),g(v)}function g(v){if(v===null){w(e.exit("chunkFlow"),!0),x(0),e.consume(v);return}return he(v)?(e.consume(v),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(v),g)}function w(v,b){const E=t.sliceStream(v);if(b&&E.push(null),v.previous=l,l&&(l.next=v),l=v,i.defineSkip(v.start),i.write(E),t.parser.lazy[v.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<a&&(!i.events[k][1].end||i.events[k][1].end.offset>a))return;const R=t.events.length;let T=R,D,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(D){C=t.events[T][1].end;break}D=!0}for(x(r),k=R;k<t.events.length;)t.events[k][1].end={...C},k++;const L=new so;L.add(T+1,0,t.events.slice(R)),L.add(R,k-R,[]),L.consume(t.events)}}function x(v){let b=n.length;for(;b-- >v;){const E=n[b];t.containerState=E[1],E[0].exit.call(t,e)}n.length=v}function y(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function uN(e,t,n){return Ie(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Sr(e){if(e===null||Fe(e)||as(e))return 1;if(Nl(e))return 2}function zo(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Xc={name:"attention",resolveAll:cN,tokenize:dN};function cN(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const l=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,a={...e[i][1].end},o={...e[n][1].start};Zp(a,-l),Zp(o,l);const u={type:l>1?"strongSequence":"emphasisSequence",start:a,end:{...e[i][1].end}},c={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:o},h={type:l>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},d={type:l>1?"strong":"emphasis",start:{...u.start},end:{...c.end}};e[i][1].end={...u.start},e[n][1].start={...c.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=rn(r,[["enter",e[i][1],t],["exit",e[i][1],t]])),r=rn(r,[["enter",d,t],["enter",u,t],["exit",u,t],["enter",h,t]]),r=rn(r,zo(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=rn(r,[["exit",h,t],["enter",c,t],["exit",c,t],["exit",d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=rn(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),yn(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function dN(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Sr(r);let l;return a;function a(u){return l=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===l)return e.consume(u),o;const c=e.exit("attentionSequence"),h=Sr(u),d=!h||h===2&&i||n.includes(u)&&u!==42&&u!==95,f=!i||i===2&&h||n.includes(r)&&r!==42&&r!==95;return c._open=!!(l===42?d:d&&(i||!f)),c._close=!!(l===42?f:f&&(h||!d)),t(u)}}function Zp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hN={name:"autolink",tokenize:fN};function fN(e,t,n){let r=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(m){return vt(m)?(e.consume(m),a):m===64?n(m):c(m)}function a(m){return m===43||m===45||m===46||jt(m)?(r=1,o(m)):c(m)}function o(m){return m===58?(e.consume(m),r=0,u):(m===43||m===45||m===46||jt(m))&&r++<32?(e.consume(m),o):(r=0,c(m))}function u(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||ro(m)?n(m):(e.consume(m),u)}function c(m){return m===64?(e.consume(m),h):rN(m)?(e.consume(m),c):n(m)}function h(m){return jt(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,h):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||jt(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const Cl={partial:!0,tokenize:pN};function pN(e,t,n){return r;function r(l){return je(l)?Ie(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||he(l)?t(l):n(l)}}const fv={continuation:{tokenize:gN},exit:xN,name:"blockQuote",tokenize:mN};function mN(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),l}return n(a)}function l(a){return je(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function gN(e,t,n){const r=this;return i;function i(a){return je(a)?Ie(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):l(a)}function l(a){return e.attempt(fv,t,n)(a)}}function xN(e){e.exit("blockQuote")}const pv={name:"characterEscape",tokenize:yN};function yN(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return dv(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const mv={name:"characterReference",tokenize:vN};function vN(e,t,n){const r=this;let i=0,l,a;return o;function o(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),l=31,a=jt,h(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,a=sN,h):(e.enter("characterReferenceValue"),l=7,a=Jc,h(d))}function h(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return a===jt&&!zh(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&i++<l?(e.consume(d),h):n(d)}}const Zc={partial:!0,tokenize:jN};function jN(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),l)}function l(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const em={concrete:!0,name:"codeFenced",tokenize:wN};function wN(e,t,n){const r=this,i={partial:!0,tokenize:E};let l=0,a=0,o;return u;function u(k){return c(k)}function c(k){const R=r.events[r.events.length-1];return l=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(k)}function h(k){return k===o?(a++,e.consume(k),h):a<3?n(k):(e.exit("codeFencedFenceSequence"),je(k)?Ie(e,d,"whitespace")(k):d(k))}function d(k){return k===null||he(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Zc,g,b)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||he(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):je(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ie(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),f)}function m(k){return k===null||he(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||he(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===o?n(k):(e.consume(k),p)}function g(k){return e.attempt(i,b,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return l>0&&je(k)?Ie(e,y,"linePrefix",l+1)(k):y(k)}function y(k){return k===null||he(k)?e.check(Zc,g,b)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||he(k)?(e.exit("codeFlowValue"),y(k)):(e.consume(k),v)}function b(k){return e.exit("codeFenced"),t(k)}function E(k,R,T){let D=0;return C;function C(I){return k.enter("lineEnding"),k.consume(I),k.exit("lineEnding"),L}function L(I){return k.enter("codeFencedFence"),je(I)?Ie(k,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===o?(k.enter("codeFencedFenceSequence"),z(I)):T(I)}function z(I){return I===o?(D++,k.consume(I),z):D>=a?(k.exit("codeFencedFenceSequence"),je(I)?Ie(k,U,"whitespace")(I):U(I)):T(I)}function U(I){return I===null||he(I)?(k.exit("codeFencedFence"),R(I)):T(I)}}}const Cu={name:"codeIndented",tokenize:bN},kN={partial:!0,tokenize:SN};function bN(e,t,n){return r;function r(o){return e.enter("codeIndented"),hv(e,i,n,"linePrefix",4,4)(o)}function i(o){return o===null?a(o):he(o)?e.attempt(kN,i,a)(o):(e.enter("codeFlowValue"),l(o))}function l(o){return o===null||he(o)?(e.exit("codeFlowValue"),i(o)):(e.consume(o),l)}function a(o){return e.exit("codeIndented"),t(o)}}function SN(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):he(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):hv(e,t,l,"linePrefix",4,4)(a)}function l(a){return he(a)?i(a):n(a)}}const NN={name:"codeText",previous:EN,resolve:CN,tokenize:TN};function CN(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function EN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TN(e,t,n){let r=0,i,l;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),o(d)}function o(d){return d===96?(e.consume(d),r++,o):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(l=e.enter("codeTextSequence"),i=0,h(d)):he(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||he(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),c)}function h(d){return d===96?(e.consume(d),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(l.type="codeTextData",c(d))}}class PN{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ci(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ci(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ci(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ci(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ci(this.left,n.reverse())}}}function Ci(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gv(e){const t={};let n=-1,r,i,l,a,o,u,c;const h=new PN(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,l=0,l<u.length&&u[l][1].type==="lineEndingBlank"&&(l+=2),l<u.length&&u[l][1].type==="content"))for(;++l<u.length&&u[l][1].type!=="content";)u[l][1].type==="chunkText"&&(u[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,RN(h,n)),n=t[n],c=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(a=h.get(l),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=l);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},o=h.slice(i,n),o.unshift(r),h.splice(i,n-i+1,o))}}return yn(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function RN(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const l=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,u=[],c={};let h,d,f=-1,m=n,p=0,g=0;const w=[g];for(;m;){for(;e.get(++i)[1]!==m;);l.push(i),m._tokenizer||(h=r.sliceStream(m),m.next||h.push(null),d&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(g=f+1,w.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):w.pop(),f=w.length;f--;){const x=o.slice(w[f],w[f+1]),y=l.pop();u.push([y,y+x.length-1]),e.splice(y,2,x)}for(u.reverse(),f=-1;++f<u.length;)c[p+u[f][0]]=p+u[f][1],p+=u[f][1]-u[f][0]-1;return c}const LN={resolve:IN,tokenize:DN},AN={partial:!0,tokenize:MN};function IN(e){return gv(e),e}function DN(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?l(o):he(o)?e.check(AN,a,l)(o):(e.consume(o),i)}function l(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function MN(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ie(e,l,"linePrefix")}function l(a){if(a===null||he(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function xv(e,t,n,r,i,l,a,o,u){const c=u||Number.POSITIVE_INFINITY;let h=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(x),e.exit(l),f):x===null||x===32||x===41||ro(x)?n(x):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(x))}function f(x){return x===62?(e.enter(l),e.consume(x),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(e.exit("chunkString"),e.exit(o),f(x)):x===null||x===60||he(x)?n(x):(e.consume(x),x===92?p:m)}function p(x){return x===60||x===62||x===92?(e.consume(x),m):m(x)}function g(x){return!h&&(x===null||x===41||Fe(x))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(x)):h<c&&x===40?(e.consume(x),h++,g):x===41?(e.consume(x),h--,g):x===null||x===32||x===40||ro(x)?n(x):(e.consume(x),x===92?w:g)}function w(x){return x===40||x===41||x===92?(e.consume(x),g):g(x)}}function yv(e,t,n,r,i,l){const a=this;let o=0,u;return c;function c(m){return e.enter(r),e.enter(i),e.consume(m),e.exit(i),e.enter(l),h}function h(m){return o>999||m===null||m===91||m===93&&!u||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(l),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):he(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||he(m)||o++>999?(e.exit("chunkString"),h(m)):(e.consume(m),u||(u=!je(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function vv(e,t,n,r,i,l){let a;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,u):n(f)}function u(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(l),c(f))}function c(f){return f===a?(e.exit(l),u(a)):f===null?n(f):he(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ie(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===a||f===null||he(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:h)}function d(f){return f===a||f===92?(e.consume(f),h):h(f)}}function Vi(e,t){let n;return r;function r(i){return he(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):je(i)?Ie(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const zN={name:"definition",tokenize:$N},_N={partial:!0,tokenize:ON};function $N(e,t,n){const r=this;let i;return l;function l(m){return e.enter("definition"),a(m)}function a(m){return yv.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return i=vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),u):n(m)}function u(m){return Fe(m)?Vi(e,c)(m):c(m)}function c(m){return xv(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function h(m){return e.attempt(_N,d,d)(m)}function d(m){return je(m)?Ie(e,f,"whitespace")(m):f(m)}function f(m){return m===null||he(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function ON(e,t,n){return r;function r(o){return Fe(o)?Vi(e,i)(o):n(o)}function i(o){return vv(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return je(o)?Ie(e,a,"whitespace")(o):a(o)}function a(o){return o===null||he(o)?t(o):n(o)}}const FN={name:"hardBreakEscape",tokenize:UN};function UN(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return he(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const BN={name:"headingAtx",resolve:HN,tokenize:WN};function HN(e,t){let n=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r){const i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"};yn(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])}return e}function WN(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),l(h)}function l(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||Fe(h)?(e.exit("atxHeadingSequence"),o(h)):n(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||he(h)?(e.exit("atxHeading"),t(h)):je(h)?Ie(e,o,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),o(h))}function c(h){return h===null||h===35||Fe(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),c)}}const jv=["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"],ed=["pre","script","style","textarea"],VN={concrete:!0,name:"htmlFlow",resolveTo:qN,tokenize:GN},QN={partial:!0,tokenize:KN};function qN(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function GN(e,t,n){const r=this;let i,l,a,o,u;return c;function c(N){return h(N)}function h(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),d}function d(N){return N===33?(e.consume(N),f):N===47?(e.consume(N),l=!0,g):N===63?(e.consume(N),i=3,r.interrupt?t:S):vt(N)?(e.consume(N),a=String.fromCharCode(N),w):n(N)}function f(N){return N===45?(e.consume(N),i=2,m):N===91?(e.consume(N),i=5,o=0,p):vt(N)?(e.consume(N),i=4,r.interrupt?t:S):n(N)}function m(N){return N===45?(e.consume(N),r.interrupt?t:S):n(N)}function p(N){const F="CDATA[";return N===F.charCodeAt(o++)?(e.consume(N),o===F.length?r.interrupt?t:A:p):n(N)}function g(N){return vt(N)?(e.consume(N),a=String.fromCharCode(N),w):n(N)}function w(N){if(N===null||N===47||N===62||Fe(N)){const F=N===47,Z=a.toLowerCase();return!F&&!l&&ed.includes(Z)?(i=1,r.interrupt?t(N):A(N)):jv.includes(a.toLowerCase())?(i=6,F?(e.consume(N),x):r.interrupt?t(N):A(N)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):l?y(N):v(N))}return N===45||jt(N)?(e.consume(N),a+=String.fromCharCode(N),w):n(N)}function x(N){return N===62?(e.consume(N),r.interrupt?t:A):n(N)}function y(N){return je(N)?(e.consume(N),y):C(N)}function v(N){return N===47?(e.consume(N),C):N===58||N===95||vt(N)?(e.consume(N),b):je(N)?(e.consume(N),v):C(N)}function b(N){return N===45||N===46||N===58||N===95||jt(N)?(e.consume(N),b):E(N)}function E(N){return N===61?(e.consume(N),k):je(N)?(e.consume(N),E):v(N)}function k(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),u=N,R):je(N)?(e.consume(N),k):T(N)}function R(N){return N===u?(e.consume(N),u=null,D):N===null||he(N)?n(N):(e.consume(N),R)}function T(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Fe(N)?E(N):(e.consume(N),T)}function D(N){return N===47||N===62||je(N)?v(N):n(N)}function C(N){return N===62?(e.consume(N),L):n(N)}function L(N){return N===null||he(N)?A(N):je(N)?(e.consume(N),L):n(N)}function A(N){return N===45&&i===2?(e.consume(N),Q):N===60&&i===1?(e.consume(N),J):N===62&&i===4?(e.consume(N),ae):N===63&&i===3?(e.consume(N),S):N===93&&i===5?(e.consume(N),X):he(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(QN,O,z)(N)):N===null||he(N)?(e.exit("htmlFlowData"),z(N)):(e.consume(N),A)}function z(N){return e.check(Zc,U,O)(N)}function U(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),I}function I(N){return N===null||he(N)?z(N):(e.enter("htmlFlowData"),A(N))}function Q(N){return N===45?(e.consume(N),S):A(N)}function J(N){return N===47?(e.consume(N),a="",B):A(N)}function B(N){if(N===62){const F=a.toLowerCase();return ed.includes(F)?(e.consume(N),ae):A(N)}return vt(N)&&a.length<8?(e.consume(N),a+=String.fromCharCode(N),B):A(N)}function X(N){return N===93?(e.consume(N),S):A(N)}function S(N){return N===62?(e.consume(N),ae):N===45&&i===2?(e.consume(N),S):A(N)}function ae(N){return N===null||he(N)?(e.exit("htmlFlowData"),O(N)):(e.consume(N),ae)}function O(N){return e.exit("htmlFlow"),t(N)}}function KN(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Cl,t,n)}}const YN={name:"htmlText",tokenize:JN};function JN(e,t,n){const r=this;let i,l,a;return o;function o(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),u}function u(S){return S===33?(e.consume(S),c):S===47?(e.consume(S),E):S===63?(e.consume(S),v):vt(S)?(e.consume(S),T):n(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),l=0,p):vt(S)?(e.consume(S),y):n(S)}function h(S){return S===45?(e.consume(S),m):n(S)}function d(S){return S===null?n(S):S===45?(e.consume(S),f):he(S)?(a=d,J(S)):(e.consume(S),d)}function f(S){return S===45?(e.consume(S),m):d(S)}function m(S){return S===62?Q(S):S===45?f(S):d(S)}function p(S){const ae="CDATA[";return S===ae.charCodeAt(l++)?(e.consume(S),l===ae.length?g:p):n(S)}function g(S){return S===null?n(S):S===93?(e.consume(S),w):he(S)?(a=g,J(S)):(e.consume(S),g)}function w(S){return S===93?(e.consume(S),x):g(S)}function x(S){return S===62?Q(S):S===93?(e.consume(S),x):g(S)}function y(S){return S===null||S===62?Q(S):he(S)?(a=y,J(S)):(e.consume(S),y)}function v(S){return S===null?n(S):S===63?(e.consume(S),b):he(S)?(a=v,J(S)):(e.consume(S),v)}function b(S){return S===62?Q(S):v(S)}function E(S){return vt(S)?(e.consume(S),k):n(S)}function k(S){return S===45||jt(S)?(e.consume(S),k):R(S)}function R(S){return he(S)?(a=R,J(S)):je(S)?(e.consume(S),R):Q(S)}function T(S){return S===45||jt(S)?(e.consume(S),T):S===47||S===62||Fe(S)?D(S):n(S)}function D(S){return S===47?(e.consume(S),Q):S===58||S===95||vt(S)?(e.consume(S),C):he(S)?(a=D,J(S)):je(S)?(e.consume(S),D):Q(S)}function C(S){return S===45||S===46||S===58||S===95||jt(S)?(e.consume(S),C):L(S)}function L(S){return S===61?(e.consume(S),A):he(S)?(a=L,J(S)):je(S)?(e.consume(S),L):D(S)}function A(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),i=S,z):he(S)?(a=A,J(S)):je(S)?(e.consume(S),A):(e.consume(S),U)}function z(S){return S===i?(e.consume(S),i=void 0,I):S===null?n(S):he(S)?(a=z,J(S)):(e.consume(S),z)}function U(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Fe(S)?D(S):(e.consume(S),U)}function I(S){return S===47||S===62||Fe(S)?D(S):n(S)}function Q(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function J(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),B}function B(S){return je(S)?Ie(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):X(S)}function X(S){return e.enter("htmlTextData"),a(S)}}const _h={name:"labelEnd",resolveAll:tC,resolveTo:nC,tokenize:rC},XN={tokenize:sC},ZN={tokenize:iC},eC={tokenize:lC};function tC(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yn(e,0,e.length,n),e}function nC(e,t){let n=e.length,r=0,i,l,a;for(;n--;){const h=e[n][1];if(i){if(h.type==="link"||h.type==="labelLink"&&h._inactive)break;e[n][0]==="enter"&&h.type==="labelLink"&&(h._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(h.type==="labelImage"||h.type==="labelLink")&&!h._balanced&&(i=n,h.type!=="labelLink")){r=2;break}}else h.type==="labelEnd"&&(l=n)}const o={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[l][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[l-2][1].start}};return a=[["enter",o,t],["enter",u,t]],a=rn(a,e.slice(i+1,i+r+3)),a=rn(a,[["enter",c,t]]),a=rn(a,zo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,l-3),t)),a=rn(a,[["exit",c,t],e[l-2],e[l-1],["exit",u,t]]),a=rn(a,e.slice(l+1)),a=rn(a,[["exit",o,t]]),yn(e,i,e.length,a),e}function rC(e,t,n){const r=this,i=r._labelStarts;let l,a;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();l=i[i.length-1]}return o;function o(f){return l?l._inactive?d(f):(a=r.parser.defined.includes(vn(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):n(f)}function u(f){return f===40?e.attempt(XN,h,a?h:d)(f):f===91?e.attempt(ZN,h,a?c:d)(f):a?h(f):d(f)}function c(f){return e.attempt(eC,h,d)(f)}function h(f){return i.pop(),t(f)}function d(f){return l._balanced=!0,n(f)}}function sC(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Fe(d)?Vi(e,l)(d):l(d)}function l(d){return d===41?h(d):xv(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Fe(d)?Vi(e,u)(d):h(d)}function o(d){return n(d)}function u(d){return d===34||d===39||d===40?vv(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):h(d)}function c(d){return Fe(d)?Vi(e,h)(d):h(d)}function h(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function iC(e,t,n){const r=this;return i;function i(o){return yv.call(r,e,l,a,"reference","referenceMarker","referenceString")(o)}function l(o){return r.parser.defined.includes(vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function lC(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const aC={name:"labelStartImage",resolveAll:_h.resolveAll,tokenize:oC};function oC(e,t,n){const r=this;let i;return l;function l(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),a}function a(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),i=e.exit("labelImage"),o):n(u)}function o(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(u))}}const uC={name:"labelStartLink",resolveAll:_h.resolveAll,tokenize:cC};function cC(e,t,n){const r=this;let i;return l;function l(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),i=e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(o))}}const Eu={name:"lineEnding",tokenize:dC};function dC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ie(e,t,"linePrefix")}}const Na={name:"thematicBreak",tokenize:hC};function hC(e,t,n){let r=0,i;return l;function l(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||he(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),je(c)?Ie(e,o,"whitespace")(c):o(c))}}const It={continuation:{tokenize:gC},exit:yC,name:"list",tokenize:mC},fC={partial:!0,tokenize:vC},pC={partial:!0,tokenize:xC};function mC(e,t,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Jc(m)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Na,n,c)(m):c(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(m)}return n(m)}function u(m){return Jc(m)&&++a<10?(e.consume(m),u):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(Cl,r.interrupt?n:h,e.attempt(fC,f,d))}function h(m){return r.containerState.initialBlankLine=!0,l++,f(m)}function d(m){return je(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function gC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Cl,i,l);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ie(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!je(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(pC,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ie(e,e.attempt(It,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function xC(e,t,n){const r=this;return Ie(e,i,"listItemIndent",r.containerState.size+1);function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(l):n(l)}}function yC(e){e.exit(this.containerState.type)}function vC(e,t,n){const r=this;return Ie(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const a=r.events[r.events.length-1];return!je(l)&&a&&a[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const tm={name:"setextUnderline",resolveTo:jC,tokenize:wC};function jC(e,t){const n=new so;let r=e.length,i,l,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&n.add(r,1,[]),!a&&e[r][1].type==="definition"&&(a=r);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",a?(n.add(l,0,[["enter",o,t]]),n.add(a+1,0,[["exit",e[i][1],t]]),e[i][1].end={...e[a][1].end}):e[i][1]=o,n.add(e.length,0,[["exit",o,t]]),n.consume(e),e}function wC(e,t,n){const r=this;let i;return l;function l(c){let h=r.events.length,d;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){d=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),je(c)?Ie(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||he(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const kC={tokenize:bC};function bC(e){const t=this,n=e.attempt(Cl,r,e.attempt(this.parser.constructs.flowInitial,i,Ie(e,e.attempt(this.parser.constructs.flow,i,e.attempt(LN,i)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const SC={resolveAll:kv()},NC=wv("string"),CC=wv("text");function wv(e){return{resolveAll:kv(e==="text"?EC:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],l=n.attempt(i,a,o);return a;function a(h){return c(h)?l(h):o(h)}function o(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return c(h)?(n.exit("data"),l(h)):(n.consume(h),u)}function c(h){if(h===null)return!0;const d=i[h];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function kv(e){return t;function t(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,r):n}}function EC(e,t){const n=new so;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],l=t.sliceStream(i);let a=l.length,o=-1,u=0,c;for(;a--;){const h=l[a];if(typeof h=="string"){for(o=h.length;h.charCodeAt(o-1)===32;)u++,o--;if(o)break;o=-1}else if(h===-2)c=!0,u++;else if(h!==-1){a++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(u=0),u){const h={type:r===e.length||c||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:i.start._bufferIndex+o,_index:i.start._index+a,line:i.end.line,column:i.end.column-u,offset:i.end.offset-u},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):n.add(r,0,[["enter",h,t],["exit",h,t]])}r++}return n.consume(e),e}const TC={42:It,43:It,45:It,48:It,49:It,50:It,51:It,52:It,53:It,54:It,55:It,56:It,57:It,62:fv},PC={91:zN},RC={[-2]:Cu,[-1]:Cu,32:Cu},LC={35:BN,42:Na,45:[tm,Na],60:VN,61:tm,95:Na,96:em,126:em},AC={38:mv,92:pv},IC={[-5]:Eu,[-4]:Eu,[-3]:Eu,33:aC,38:mv,42:Xc,60:[hN,YN],91:uC,92:[FN,pv],93:_h,95:Xc,96:NN},DC={null:[Xc,SC]},MC={null:[42,95]},zC={null:[]},_C=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:MC,contentInitial:PC,disable:zC,document:TC,flow:LC,flowInitial:RC,insideSpan:DC,string:AC,text:IC},Symbol.toStringTag,{value:"Module"}));function $C(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},l=[];let a=[],o=[];const u={attempt:R(E),check:R(k),consume:y,enter:v,exit:b,interrupt:R(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:d};let h=t.tokenize.call(c,u);return t.resolveAll&&l.push(t),c;function d(L){return a=rn(a,L),w(),a[a.length-1]!==null?[]:(T(t,0),c.events=zo(l,c.events,c),c.events)}function f(L,A){return FC(m(L),A)}function m(L){return OC(a,L)}function p(){const{_bufferIndex:L,_index:A,line:z,column:U,offset:I}=r;return{_bufferIndex:L,_index:A,line:z,column:U,offset:I}}function g(L){i[L.line]=L.column,C()}function w(){for(;r._index<a.length;){const L=a[r._index];if(typeof L=="string"){const A=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<L.length;)x(L.charCodeAt(r._bufferIndex))}else x(L)}}function x(L){h=h(L)}function y(L){he(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,C()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=L}function v(L,A){const z=A||{};return z.type=L,z.start=p(),c.events.push(["enter",z,c]),o.push(z),z}function b(L){const A=o.pop();return A.end=p(),c.events.push(["exit",A,c]),A}function E(L,A){T(L,A.from)}function k(L,A){A.restore()}function R(L,A){return z;function z(U,I,Q){let J,B,X,S;return Array.isArray(U)?O(U):"tokenize"in U?O([U]):ae(U);function ae(ce){return Te;function Te(tt){const W=tt!==null&&ce[tt],ge=tt!==null&&ce.null,V=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return O(V)(tt)}}function O(ce){return J=ce,B=0,ce.length===0?Q:N(ce[B])}function N(ce){return Te;function Te(tt){return S=D(),X=ce,ce.partial||(c.currentConstruct=ce),ce.name&&c.parser.constructs.disable.null.includes(ce.name)?Z():ce.tokenize.call(A?Object.assign(Object.create(c),A):c,u,F,Z)(tt)}}function F(ce){return L(X,S),I}function Z(ce){return S.restore(),++B<J.length?N(J[B]):Q}}}function T(L,A){L.resolveAll&&!l.includes(L)&&l.push(L),L.resolve&&yn(c.events,A,c.events.length-A,L.resolve(c.events.slice(A),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function D(){const L=p(),A=c.previous,z=c.currentConstruct,U=c.events.length,I=Array.from(o);return{from:U,restore:Q};function Q(){r=L,c.previous=A,c.currentConstruct=z,c.events.length=U,o=I,C()}}function C(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function OC(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,l)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}l>0&&a.push(e[i].slice(0,l))}return a}function FC(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const l=e[n];let a;if(typeof l=="string")a=l;else switch(l){case-5:{a="\r";break}case-4:{a=`
362
362
  `;break}case-3:{a=`\r
363
- `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(l)}i=l===-2,r.push(a)}return r.join("")}function FC(e){const r={constructs:ov([zC,...(e||{}).extensions||[]]),content:i(sN),defined:[],document:i(lN),flow:i(wC),lazy:{},string:i(SC),text:i(NC)};return r;function i(l){return a;function a(o){return _C(r,l,o)}}}function UC(e){for(;!mv(e););return e}const nm=/[\0\t\n\r]/g;function BC(){let e=1,t="",n=!0,r;return i;function i(l,a,o){l=t+(typeof l=="string"?l.toString():new TextDecoder(a||void 0).decode(l));const u=[];let c=0;for(t="",n&&(l.charCodeAt(0)===65279&&c++,n=void 0);c<l.length;){nm.lastIndex=c;const h=nm.exec(l),d=h&&h.index!==void 0?h.index:l.length,f=l.charCodeAt(d);if(!h){t=l.slice(c);break}if(f===10&&c===d&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<d&&(u.push(l.slice(c,d)),e+=d-c),f){case 0:{u.push(65533),e++;break}case 9:{const m=Math.ceil(e/4)*4;for(u.push(-2);e++<m;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=d+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const HC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WC(e){return e.replace(HC,VC)}function VC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return uv(n.slice(l?2:1),l?16:10)}return zh(n)||e}const kv={}.hasOwnProperty;function QC(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),qC(n)(UC(FC(n).document().write(BC()(e,t,!0))))}function qC(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ll),autolinkProtocol:C,autolinkEmail:C,atxHeading:a(ee),blockQuote:a(W),characterEscape:C,characterReference:C,codeFenced:a(fe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(fe,o),codeText:a(Ze,o),codeTextData:C,data:C,codeFlowValue:C,definition:a(Zt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(en),hardBreakEscape:a(Ne),hardBreakTrailing:a(Ne),htmlFlow:a(et,o),htmlFlowData:C,htmlText:a(et,o),htmlTextData:C,image:a(Dr),label:o,link:a(Ll),listItem:a(Ho),listItemValue:m,listOrdered:a(Al,f),listUnordered:a(Al),paragraph:a(Mn),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ee),strong:a(Mr),thematicBreak:a(ci)},exit:{atxHeading:c(),atxHeadingSequence:k,autolink:c(),autolinkEmail:Ke,autolinkProtocol:ze,blockQuote:c(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:B,characterReference:he,codeFenced:c(x),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:L,codeIndented:c(y),codeText:c(Q),codeTextData:L,data:L,definition:c(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(U),htmlFlowData:L,htmlText:c(I),htmlTextData:L,image:c(H),label:S,labelText:X,lineEnding:A,link:c(J),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:ae,resourceTitleString:O,resource:N,setextHeading:c(D),setextHeadingLineSequence:T,setextHeadingText:R,strong:c(),thematicBreak:c()}};bv(t,(e||{}).mdastExtensions||[]);const n={};return r;function r($){let G={type:"root",children:[],position:void 0};const pe={stack:[G],tokenStack:[],config:t,enter:u,exit:h,buffer:o,resume:d,data:n},me=[],kt=[];let Ce=-1;for(;++Ce<$.length;)if(kt.push($[Ce]),$[Ce][1].type==="listOrdered"||$[Ce][1].type==="listUnordered")if($[Ce][0]==="enter")me.push(kt.length-1);else{const pt=me.pop();l(kt,pt)}for($=kt,Ce=-1;++Ce<$.length;){const pt=t[$[Ce][0]];$[Ce][0]==="enter"&&t.beforeEnter.length>0&&i(t.beforeEnter,{...pe,sliceSerialize:$[Ce][2].sliceSerialize},$[Ce][1]),kv.call(pt,$[Ce][1].type)&&pt[$[Ce][1].type].call({...pe,sliceSerialize:$[Ce][2].sliceSerialize},$[Ce][1]),$[Ce][0]==="exit"&&t.afterExit.length>0&&i(t.afterExit,{...pe,sliceSerialize:$[Ce][2].sliceSerialize},$[Ce][1])}if(pe.tokenStack.length>0){const pt=pe.tokenStack[pe.tokenStack.length-1];(pt[1]||rm).call(pe,void 0,pt[0])}for(G.position={start:er($.length>0?$[0][1].start:{line:1,column:1,offset:0}),end:er($.length>0?$[$.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)G=t.transforms[Ce](G)||G;return G}function i($,G,pe){let me=-1;for(;++me<$.length;)$[me].call(G,pe)}function l($,G){const pe=$.length-1;let me=G-1,kt=-1,Ce=!1,pt,Ut,Jn,zr;const Xn=[];for(;++me<=pe;){const mt=$[me];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?kt++:kt--,zr=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(pt&&!zr&&!kt&&!Jn&&(Jn=me),zr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:zr=void 0}if(!kt&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||kt===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(pt){let Sn=me;for(Ut=void 0;Sn--;){const cn=$[Sn];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;Ut&&($[Ut][1].type="lineEndingBlank",Ce=!0),cn[1].type="lineEnding",Ut=Sn}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}Jn&&(!Ut||Jn<Ut)&&(pt._spread=!0),pt.end=Object.assign({},Ut?$[Ut][1].start:mt[1].end),Xn.push({at:Ut||me,event:["exit",pt,mt[2]]})}if(mt[1].type==="listItemPrefix"){const Sn={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};pt=Sn,Xn.push({at:me,event:["enter",Sn,mt[2]]}),Jn=void 0,zr=!0}}}const _r=$.splice(G);let ms=0;for(me=-1;++me<_r.length;){for(;ms<Xn.length&&Xn[ms].at===G+me;)$.push(Xn[ms++].event);$.push(_r[me])}$[G][1]._spread=Ce}function a($,G){return pe;function pe(me){u.call(this,$(me),me),G&&G.call(this,me)}}function o(){this.stack.push({type:"fragment",children:[]})}function u($,G,pe){this.stack[this.stack.length-1].children.push($),this.stack.push($),this.tokenStack.push([G,pe||void 0]),$.position={start:er(G.start),end:void 0}}function c($){return G;function G(pe){$&&$.call(this,pe),h.call(this,pe)}}function h($,G){const pe=this.stack.pop(),me=this.tokenStack.pop();if(!me)throw new Error("Cannot close `"+$.type+"` ("+Wi({start:$.start,end:$.end})+"): it’s not open");me[0].type!==$.type&&(G?G.call(this,$,me[0]):(me[1]||rm).call(this,$,me[0])),pe.position.end=er($.end)}function d(){return Mo(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m($){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize($),10),this.data.expectingFirstListItemValue=void 0}}function p(){const $=this.resume(),G=this.stack[this.stack.length-1];G.lang=$}function g(){const $=this.resume(),G=this.stack[this.stack.length-1];G.meta=$}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$.replace(/(\r?\n|\r)$/g,"")}function v($){const G=this.resume(),pe=this.stack[this.stack.length-1];pe.label=G,pe.identifier=vn(this.sliceSerialize($)).toLowerCase()}function b(){const $=this.resume(),G=this.stack[this.stack.length-1];G.title=$}function E(){const $=this.resume(),G=this.stack[this.stack.length-1];G.url=$}function k($){const G=this.stack[this.stack.length-1];if(!G.depth){const pe=this.sliceSerialize($).length;G.depth=pe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function T($){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize($).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function C($){const pe=this.stack[this.stack.length-1].children;let me=pe[pe.length-1];(!me||me.type!=="text")&&(me=Il(),me.position={start:er($.start),end:void 0},pe.push(me)),this.stack.push(me)}function L($){const G=this.stack.pop();G.value+=this.sliceSerialize($),G.position.end=er($.end)}function A($){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=G.children[G.children.length-1];pe.position.end=er($.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(C.call(this,$),L.call(this,$))}function z(){this.data.atHardBreak=!0}function U(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$}function I(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$}function Q(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$}function J(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=G,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function H(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=G,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function X($){const G=this.sliceSerialize($),pe=this.stack[this.stack.length-2];pe.label=WC(G),pe.identifier=vn(G).toLowerCase()}function S(){const $=this.stack[this.stack.length-1],G=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const me=$.children;pe.children=me}else pe.alt=G}function ae(){const $=this.resume(),G=this.stack[this.stack.length-1];G.url=$}function O(){const $=this.resume(),G=this.stack[this.stack.length-1];G.title=$}function N(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function Z($){const G=this.resume(),pe=this.stack[this.stack.length-1];pe.label=G,pe.identifier=vn(this.sliceSerialize($)).toLowerCase(),this.data.referenceType="full"}function oe($){this.data.characterReferenceType=$.type}function B($){const G=this.sliceSerialize($),pe=this.data.characterReferenceType;let me;pe?(me=uv(G,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=zh(G);const kt=this.stack[this.stack.length-1];kt.value+=me}function he($){const G=this.stack.pop();G.position.end=er($.end)}function ze($){L.call(this,$);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize($)}function Ke($){L.call(this,$);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize($)}function W(){return{type:"blockquote",children:[],position:void 0}}function fe(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Ze(){return{type:"inlineCode",value:"",position:void 0}}function Zt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function en(){return{type:"emphasis",children:[],position:void 0}}function ee(){return{type:"heading",depth:0,children:[],position:void 0}}function Ne(){return{type:"break",position:void 0}}function et(){return{type:"html",value:"",position:void 0}}function Dr(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function Ll(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Al($){return{type:"list",ordered:$.type==="listOrdered",start:null,spread:$._spread,children:[],position:void 0}}function Ho($){return{type:"listItem",spread:$._spread,checked:null,children:[],position:void 0}}function Mn(){return{type:"paragraph",children:[],position:void 0}}function Mr(){return{type:"strong",children:[],position:void 0}}function Il(){return{type:"text",value:"",position:void 0}}function ci(){return{type:"thematicBreak",position:void 0}}}function er(e){return{line:e.line,column:e.column,offset:e.offset}}function bv(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?bv(e,r):GC(e,r)}}function GC(e,t){let n;for(n in t)if(kv.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[n];r&&e[n].push(r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function rm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wi({start:t.start,end:t.end})+") is still open")}function KC(e){const t=this;t.parser=n;function n(r){return QC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function YC(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function JC(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
364
- `}]}function XC(e,t){const n=t.value?t.value+`
365
- `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function ZC(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=oi(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=l+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function nE(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Sv(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function sE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sv(e,t);const i={src:oi(r.url||"")};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function iE(e,t){const n={src:oi(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function lE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function aE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sv(e,t);const i={href:oi(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function oE(e,t){const n={href:oi(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function uE(e,t,n){const r=e.all(t),i=n?cE(n):Nv(t),l={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let d;h&&h.type==="element"&&h.tagName==="p"?d=h:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const h=r[o];(i||o!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
363
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(l)}i=l===-2,r.push(a)}return r.join("")}function UC(e){const r={constructs:uv([_C,...(e||{}).extensions||[]]),content:i(iN),defined:[],document:i(aN),flow:i(kC),lazy:{},string:i(NC),text:i(CC)};return r;function i(l){return a;function a(o){return $C(r,l,o)}}}function BC(e){for(;!gv(e););return e}const nm=/[\0\t\n\r]/g;function HC(){let e=1,t="",n=!0,r;return i;function i(l,a,o){l=t+(typeof l=="string"?l.toString():new TextDecoder(a||void 0).decode(l));const u=[];let c=0;for(t="",n&&(l.charCodeAt(0)===65279&&c++,n=void 0);c<l.length;){nm.lastIndex=c;const h=nm.exec(l),d=h&&h.index!==void 0?h.index:l.length,f=l.charCodeAt(d);if(!h){t=l.slice(c);break}if(f===10&&c===d&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<d&&(u.push(l.slice(c,d)),e+=d-c),f){case 0:{u.push(65533),e++;break}case 9:{const m=Math.ceil(e/4)*4;for(u.push(-2);e++<m;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=d+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const WC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function VC(e){return e.replace(WC,QC)}function QC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return cv(n.slice(l?2:1),l?16:10)}return zh(n)||e}const bv={}.hasOwnProperty;function qC(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),GC(n)(BC(UC(n).document().write(HC()(e,t,!0))))}function GC(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Rl),autolinkProtocol:C,autolinkEmail:C,atxHeading:a(ee),blockQuote:a(V),characterEscape:C,characterReference:C,codeFenced:a(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(de,o),codeText:a(ve,o),codeTextData:C,data:C,codeFlowValue:C,definition:a(ct),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(en),hardBreakEscape:a(Ce),hardBreakTrailing:a(Ce),htmlFlow:a(Ze,o),htmlFlowData:C,htmlText:a(Ze,o),htmlTextData:C,image:a(Mr),label:o,link:a(Rl),listItem:a(Ho),listItemValue:m,listOrdered:a(Ll,f),listUnordered:a(Ll),paragraph:a(Mn),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ee),strong:a(zr),thematicBreak:a(ci)},exit:{atxHeading:c(),atxHeadingSequence:k,autolink:c(),autolinkEmail:ge,autolinkProtocol:W,blockQuote:c(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:Te,characterReference:tt,codeFenced:c(x),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:L,codeIndented:c(y),codeText:c(Q),codeTextData:L,data:L,definition:c(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(U),htmlFlowData:L,htmlText:c(I),htmlTextData:L,image:c(B),label:S,labelText:X,lineEnding:A,link:c(J),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:ae,resourceTitleString:O,resource:N,setextHeading:c(D),setextHeadingLineSequence:T,setextHeadingText:R,strong:c(),thematicBreak:c()}};Sv(t,(e||{}).mdastExtensions||[]);const n={};return r;function r($){let G={type:"root",children:[],position:void 0};const fe={stack:[G],tokenStack:[],config:t,enter:u,exit:h,buffer:o,resume:d,data:n},pe=[],bt=[];let Ee=-1;for(;++Ee<$.length;)if(bt.push($[Ee]),$[Ee][1].type==="listOrdered"||$[Ee][1].type==="listUnordered")if($[Ee][0]==="enter")pe.push(bt.length-1);else{const pt=pe.pop();l(bt,pt)}for($=bt,Ee=-1;++Ee<$.length;){const pt=t[$[Ee][0]];$[Ee][0]==="enter"&&t.beforeEnter.length>0&&i(t.beforeEnter,{...fe,sliceSerialize:$[Ee][2].sliceSerialize},$[Ee][1]),bv.call(pt,$[Ee][1].type)&&pt[$[Ee][1].type].call({...fe,sliceSerialize:$[Ee][2].sliceSerialize},$[Ee][1]),$[Ee][0]==="exit"&&t.afterExit.length>0&&i(t.afterExit,{...fe,sliceSerialize:$[Ee][2].sliceSerialize},$[Ee][1])}if(fe.tokenStack.length>0){const pt=fe.tokenStack[fe.tokenStack.length-1];(pt[1]||rm).call(fe,void 0,pt[0])}for(G.position={start:er($.length>0?$[0][1].start:{line:1,column:1,offset:0}),end:er($.length>0?$[$.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)G=t.transforms[Ee](G)||G;return G}function i($,G,fe){let pe=-1;for(;++pe<$.length;)$[pe].call(G,fe)}function l($,G){const fe=$.length-1;let pe=G-1,bt=-1,Ee=!1,pt,Bt,Jn,_r;const Xn=[];for(;++pe<=fe;){const mt=$[pe];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?bt++:bt--,_r=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(pt&&!_r&&!bt&&!Jn&&(Jn=pe),_r=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_r=void 0}if(!bt&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||bt===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(pt){let bn=pe;for(Bt=void 0;bn--;){const cn=$[bn];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;Bt&&($[Bt][1].type="lineEndingBlank",Ee=!0),cn[1].type="lineEnding",Bt=bn}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}Jn&&(!Bt||Jn<Bt)&&(pt._spread=!0),pt.end=Object.assign({},Bt?$[Bt][1].start:mt[1].end),Xn.push({at:Bt||pe,event:["exit",pt,mt[2]]})}if(mt[1].type==="listItemPrefix"){const bn={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};pt=bn,Xn.push({at:pe,event:["enter",bn,mt[2]]}),Jn=void 0,_r=!0}}}const $r=$.splice(G);let ms=0;for(pe=-1;++pe<$r.length;){for(;ms<Xn.length&&Xn[ms].at===G+pe;)$.push(Xn[ms++].event);$.push($r[pe])}$[G][1]._spread=Ee}function a($,G){return fe;function fe(pe){u.call(this,$(pe),pe),G&&G.call(this,pe)}}function o(){this.stack.push({type:"fragment",children:[]})}function u($,G,fe){this.stack[this.stack.length-1].children.push($),this.stack.push($),this.tokenStack.push([G,fe||void 0]),$.position={start:er(G.start),end:void 0}}function c($){return G;function G(fe){$&&$.call(this,fe),h.call(this,fe)}}function h($,G){const fe=this.stack.pop(),pe=this.tokenStack.pop();if(!pe)throw new Error("Cannot close `"+$.type+"` ("+Wi({start:$.start,end:$.end})+"): it’s not open");pe[0].type!==$.type&&(G?G.call(this,$,pe[0]):(pe[1]||rm).call(this,$,pe[0])),fe.position.end=er($.end)}function d(){return Mo(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m($){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize($),10),this.data.expectingFirstListItemValue=void 0}}function p(){const $=this.resume(),G=this.stack[this.stack.length-1];G.lang=$}function g(){const $=this.resume(),G=this.stack[this.stack.length-1];G.meta=$}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$.replace(/(\r?\n|\r)$/g,"")}function v($){const G=this.resume(),fe=this.stack[this.stack.length-1];fe.label=G,fe.identifier=vn(this.sliceSerialize($)).toLowerCase()}function b(){const $=this.resume(),G=this.stack[this.stack.length-1];G.title=$}function E(){const $=this.resume(),G=this.stack[this.stack.length-1];G.url=$}function k($){const G=this.stack[this.stack.length-1];if(!G.depth){const fe=this.sliceSerialize($).length;G.depth=fe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function T($){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize($).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function C($){const fe=this.stack[this.stack.length-1].children;let pe=fe[fe.length-1];(!pe||pe.type!=="text")&&(pe=Al(),pe.position={start:er($.start),end:void 0},fe.push(pe)),this.stack.push(pe)}function L($){const G=this.stack.pop();G.value+=this.sliceSerialize($),G.position.end=er($.end)}function A($){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=G.children[G.children.length-1];fe.position.end=er($.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(C.call(this,$),L.call(this,$))}function z(){this.data.atHardBreak=!0}function U(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$}function I(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$}function Q(){const $=this.resume(),G=this.stack[this.stack.length-1];G.value=$}function J(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=G,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function B(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=G,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function X($){const G=this.sliceSerialize($),fe=this.stack[this.stack.length-2];fe.label=VC(G),fe.identifier=vn(G).toLowerCase()}function S(){const $=this.stack[this.stack.length-1],G=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const pe=$.children;fe.children=pe}else fe.alt=G}function ae(){const $=this.resume(),G=this.stack[this.stack.length-1];G.url=$}function O(){const $=this.resume(),G=this.stack[this.stack.length-1];G.title=$}function N(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function Z($){const G=this.resume(),fe=this.stack[this.stack.length-1];fe.label=G,fe.identifier=vn(this.sliceSerialize($)).toLowerCase(),this.data.referenceType="full"}function ce($){this.data.characterReferenceType=$.type}function Te($){const G=this.sliceSerialize($),fe=this.data.characterReferenceType;let pe;fe?(pe=cv(G,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=zh(G);const bt=this.stack[this.stack.length-1];bt.value+=pe}function tt($){const G=this.stack.pop();G.position.end=er($.end)}function W($){L.call(this,$);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize($)}function ge($){L.call(this,$);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize($)}function V(){return{type:"blockquote",children:[],position:void 0}}function de(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function ve(){return{type:"inlineCode",value:"",position:void 0}}function ct(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function en(){return{type:"emphasis",children:[],position:void 0}}function ee(){return{type:"heading",depth:0,children:[],position:void 0}}function Ce(){return{type:"break",position:void 0}}function Ze(){return{type:"html",value:"",position:void 0}}function Mr(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function Rl(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Ll($){return{type:"list",ordered:$.type==="listOrdered",start:null,spread:$._spread,children:[],position:void 0}}function Ho($){return{type:"listItem",spread:$._spread,checked:null,children:[],position:void 0}}function Mn(){return{type:"paragraph",children:[],position:void 0}}function zr(){return{type:"strong",children:[],position:void 0}}function Al(){return{type:"text",value:"",position:void 0}}function ci(){return{type:"thematicBreak",position:void 0}}}function er(e){return{line:e.line,column:e.column,offset:e.offset}}function Sv(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Sv(e,r):KC(e,r)}}function KC(e,t){let n;for(n in t)if(bv.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[n];r&&e[n].push(r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function rm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wi({start:t.start,end:t.end})+") is still open")}function YC(e){const t=this;t.parser=n;function n(r){return qC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function JC(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function XC(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
364
+ `}]}function ZC(e,t){const n=t.value?t.value+`
365
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function eE(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=oi(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=l+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function rE(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Nv(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function iE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nv(e,t);const i={src:oi(r.url||"")};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function lE(e,t){const n={src:oi(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function aE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function oE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nv(e,t);const i={href:oi(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function uE(e,t){const n={href:oi(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cE(e,t,n){const r=e.all(t),i=n?dE(n):Cv(t),l={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let d;h&&h.type==="element"&&h.tagName==="p"?d=h:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const h=r[o];(i||o!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
366
366
  `}),h.type==="element"&&h.tagName==="p"&&!i?a.push(...h.children):a.push(h)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
367
- `});const c={type:"element",tagName:"li",properties:l,children:a};return e.patch(t,c),e.applyData(t,c)}function cE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const{children:n}=e;let r=-1;for(;!t&&++r<n.length;)t=Nv(n[r])}return t}function Nv(e){const{spread:t}=e;return t??e.children.length>1}function dE(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function hE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mE(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Ah(t.children[1]),u=tv(t.children[t.children.length-1]);o&&u&&(a.position={start:o,end:u}),i.push(a)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function gE(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let u=-1;const c=[];for(;++u<o;){const d=t.children[u],f={},m=a?a[u]:void 0;m&&(f.align=m);let p={type:"element",tagName:l,properties:f,children:[]};d&&(p.children=e.all(d),e.patch(d,p),p=e.applyData(d,p)),c.push(p)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function xE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const sm=9,im=32;function yE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const l=[];for(;r;)l.push(lm(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return l.push(lm(t.slice(i),i>0,!1)),l.join("")}function lm(e,t,n){let r=0,i=e.length;if(t){let l=e.codePointAt(r);for(;l===sm||l===im;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(i-1);for(;l===sm||l===im;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function vE(e,t){const n={type:"text",value:yE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function jE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wE={blockquote:YC,break:JC,code:XC,delete:ZC,emphasis:eE,footnoteReference:tE,heading:nE,html:rE,imageReference:sE,image:iE,inlineCode:lE,linkReference:aE,link:oE,listItem:uE,list:dE,paragraph:hE,root:fE,strong:pE,table:mE,tableCell:xE,tableRow:gE,text:vE,thematicBreak:jE,toml:ra,yaml:ra,definition:ra,footnoteDefinition:ra};function ra(){}const Cv=-1,_o=0,Qi=1,lo=2,$h=3,Oh=4,Fh=5,Uh=6,Ev=7,Tv=8,{defineProperty:kE}=Object,Pv=typeof self=="object"?self:globalThis,am=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Pv[e](t)},bE=(e,t)=>{const n=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,a]=t[i];switch(l){case _o:case Cv:return n(a,i);case Qi:{const o=n([],i);for(const u of a)o.push(r(u));return o}case lo:{const o=n({},i);for(const[u,c]of a){const h=r(u),d=r(c);h==="__proto__"?kE(o,h,{value:d,configurable:!0,enumerable:!0,writable:!0}):o[h]=d}return o}case $h:return n(new Date(a),i);case Oh:{const{source:o,flags:u}=a;return n(new RegExp(o,u),i)}case Fh:{const o=n(new Map,i);for(const[u,c]of a)o.set(r(u),r(c));return o}case Uh:{const o=n(new Set,i);for(const u of a)o.add(r(u));return o}case Ev:{const{name:o,message:u}=a;return n(typeof Pv[o]=="function"?am(o,u):new Error(u),i)}case Tv:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}case"-0":return-0}return n(am(l,a),i)};return r},om=e=>bE(new Map,e)(0),Br="",{toString:SE}={},{keys:NE,is:CE}=Object,Ei=e=>{const t=typeof e;if(t!=="object"||!e)return[_o,t];const n=SE.call(e).slice(8,-1);switch(n){case"Array":return[Qi,Br];case"Object":return[lo,Br];case"Date":return[$h,Br];case"RegExp":return[Oh,Br];case"Map":return[Fh,Br];case"Set":return[Uh,Br];case"DataView":return[Qi,n]}return n.includes("Array")?[Qi,n]:e instanceof Error?[Ev,e.name||"Error"]:[lo,n]},sa=([e,t])=>e===_o&&(t==="function"||t==="symbol"),EE=(e,t,n,r)=>{const i=(a,o)=>{const u=r.push(a)-1;return n.set(o,u),u},l=a=>{if(n.has(a))return n.get(a);let[o,u]=Ei(a);switch(o){case _o:{let h=a;switch(u){case"bigint":o=Tv,h=a.toString();break;case"number":if(!a&&CE(a,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([Cv],a)}return i([o,h],a)}case Qi:{if(u){let f=a;return u==="DataView"?f=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(a)),i([u,[...f]],a)}const h=[],d=i([o,h],a);for(const f of a)h.push(l(f));return d}case lo:{if(u)switch(u){case"BigInt":return i([u,a.toString()],a);case"Boolean":case"Number":case"String":return i([u,a.valueOf()],a)}if(t&&"toJSON"in a)return l(a.toJSON());const h=[],d=i([o,h],a);for(const f of NE(a))(e||!sa(Ei(a[f])))&&h.push([l(f),l(a[f])]);return d}case $h:return i([o,isNaN(a.getTime())?Br:a.toISOString()],a);case Oh:{const{source:h,flags:d}=a;return i([o,{source:h,flags:d}],a)}case Fh:{const h=[],d=i([o,h],a);for(const[f,m]of a)(e||!(sa(Ei(f))||sa(Ei(m))))&&h.push([l(f),l(m)]);return d}case Uh:{const h=[],d=i([o,h],a);for(const f of a)(e||!sa(Ei(f)))&&h.push(l(f));return d}}const{message:c}=a;return i([o,{name:u,message:c}],a)};return l},um=(e,{json:t,lossy:n}={})=>{const r=[];return EE(!(t||n),!!t,new Map,r)(e),r},ao=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?om(um(e,t)):structuredClone(e):(e,t)=>om(um(e,t));function TE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function PE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function RE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||TE,r=e.options.footnoteBackLabel||PE,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[],u=[];let c=-1;for(;++c<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[c]);h&&(o[c]=e.all(h))}for(c=-1;++c<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[c]);if(!h)continue;const d=o[c],f=String(h.identifier).toUpperCase(),m=oi(f.toLowerCase());let p=0;const g=[],w=e.footnoteCounts.get(f);for(;w!==void 0&&++p<=w;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(h,y),u.push(y)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...ao(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
367
+ `});const c={type:"element",tagName:"li",properties:l,children:a};return e.patch(t,c),e.applyData(t,c)}function dE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const{children:n}=e;let r=-1;for(;!t&&++r<n.length;)t=Cv(n[r])}return t}function Cv(e){const{spread:t}=e;return t??e.children.length>1}function hE(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function fE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function mE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gE(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Ah(t.children[1]),u=nv(t.children[t.children.length-1]);o&&u&&(a.position={start:o,end:u}),i.push(a)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function xE(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let u=-1;const c=[];for(;++u<o;){const d=t.children[u],f={},m=a?a[u]:void 0;m&&(f.align=m);let p={type:"element",tagName:l,properties:f,children:[]};d&&(p.children=e.all(d),e.patch(d,p),p=e.applyData(d,p)),c.push(p)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function yE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const sm=9,im=32;function vE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const l=[];for(;r;)l.push(lm(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return l.push(lm(t.slice(i),i>0,!1)),l.join("")}function lm(e,t,n){let r=0,i=e.length;if(t){let l=e.codePointAt(r);for(;l===sm||l===im;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(i-1);for(;l===sm||l===im;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function jE(e,t){const n={type:"text",value:vE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const kE={blockquote:JC,break:XC,code:ZC,delete:eE,emphasis:tE,footnoteReference:nE,heading:rE,html:sE,imageReference:iE,image:lE,inlineCode:aE,linkReference:oE,link:uE,listItem:cE,list:hE,paragraph:fE,root:pE,strong:mE,table:gE,tableCell:yE,tableRow:xE,text:jE,thematicBreak:wE,toml:na,yaml:na,definition:na,footnoteDefinition:na};function na(){}const Ev=-1,_o=0,Qi=1,io=2,$h=3,Oh=4,Fh=5,Uh=6,Tv=7,Pv=8,{defineProperty:bE}=Object,Rv=typeof self=="object"?self:globalThis,am=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Rv[e](t)},SE=(e,t)=>{const n=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,a]=t[i];switch(l){case _o:case Ev:return n(a,i);case Qi:{const o=n([],i);for(const u of a)o.push(r(u));return o}case io:{const o=n({},i);for(const[u,c]of a){const h=r(u),d=r(c);h==="__proto__"?bE(o,h,{value:d,configurable:!0,enumerable:!0,writable:!0}):o[h]=d}return o}case $h:return n(new Date(a),i);case Oh:{const{source:o,flags:u}=a;return n(new RegExp(o,u),i)}case Fh:{const o=n(new Map,i);for(const[u,c]of a)o.set(r(u),r(c));return o}case Uh:{const o=n(new Set,i);for(const u of a)o.add(r(u));return o}case Tv:{const{name:o,message:u}=a;return n(typeof Rv[o]=="function"?am(o,u):new Error(u),i)}case Pv:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}case"-0":return-0}return n(am(l,a),i)};return r},om=e=>SE(new Map,e)(0),Hr="",{toString:NE}={},{keys:CE,is:EE}=Object,Ei=e=>{const t=typeof e;if(t!=="object"||!e)return[_o,t];const n=NE.call(e).slice(8,-1);switch(n){case"Array":return[Qi,Hr];case"Object":return[io,Hr];case"Date":return[$h,Hr];case"RegExp":return[Oh,Hr];case"Map":return[Fh,Hr];case"Set":return[Uh,Hr];case"DataView":return[Qi,n]}return n.includes("Array")?[Qi,n]:e instanceof Error?[Tv,e.name||"Error"]:[io,n]},ra=([e,t])=>e===_o&&(t==="function"||t==="symbol"),TE=(e,t,n,r)=>{const i=(a,o)=>{const u=r.push(a)-1;return n.set(o,u),u},l=a=>{if(n.has(a))return n.get(a);let[o,u]=Ei(a);switch(o){case _o:{let h=a;switch(u){case"bigint":o=Pv,h=a.toString();break;case"number":if(!a&&EE(a,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([Ev],a)}return i([o,h],a)}case Qi:{if(u){let f=a;return u==="DataView"?f=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(a)),i([u,[...f]],a)}const h=[],d=i([o,h],a);for(const f of a)h.push(l(f));return d}case io:{if(u)switch(u){case"BigInt":return i([u,a.toString()],a);case"Boolean":case"Number":case"String":return i([u,a.valueOf()],a)}if(t&&"toJSON"in a)return l(a.toJSON());const h=[],d=i([o,h],a);for(const f of CE(a))(e||!ra(Ei(a[f])))&&h.push([l(f),l(a[f])]);return d}case $h:return i([o,isNaN(a.getTime())?Hr:a.toISOString()],a);case Oh:{const{source:h,flags:d}=a;return i([o,{source:h,flags:d}],a)}case Fh:{const h=[],d=i([o,h],a);for(const[f,m]of a)(e||!(ra(Ei(f))||ra(Ei(m))))&&h.push([l(f),l(m)]);return d}case Uh:{const h=[],d=i([o,h],a);for(const f of a)(e||!ra(Ei(f)))&&h.push(l(f));return d}}const{message:c}=a;return i([o,{name:u,message:c}],a)};return l},um=(e,{json:t,lossy:n}={})=>{const r=[];return TE(!(t||n),!!t,new Map,r)(e),r},lo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?om(um(e,t)):structuredClone(e):(e,t)=>om(um(e,t));function PE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function RE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function LE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||PE,r=e.options.footnoteBackLabel||RE,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[],u=[];let c=-1;for(;++c<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[c]);h&&(o[c]=e.all(h))}for(c=-1;++c<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[c]);if(!h)continue;const d=o[c],f=String(h.identifier).toUpperCase(),m=oi(f.toLowerCase());let p=0;const g=[],w=e.footnoteCounts.get(f);for(;w!==void 0&&++p<=w;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(h,y),u.push(y)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...lo(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
368
368
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
369
- `}]}}const $o=function(e){if(e==null)return DE;if(typeof e=="function")return Oo(e);if(typeof e=="object")return Array.isArray(e)?LE(e):AE(e);if(typeof e=="string")return IE(e);throw new Error("Expected function, string, or object as test")};function LE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=$o(e[n]);return Oo(r);function r(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function AE(e){const t=e;return Oo(n);function n(r){const i=r;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function IE(e){return Oo(t);function t(n){return n&&n.type===e}}function Oo(e){return t;function t(n,r,i){return!!(ME(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function DE(){return!0}function ME(e){return e!==null&&typeof e=="object"&&"type"in e}const Rv=[],zE=!0,qi=!1,td="skip";function nd(e,t,n,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,l,a,o,u;if(typeof n=="function"||n&&typeof n=="object"?(l=t,a=n,r&&(i=!1)):(a=t,n&&(i=!1)),typeof a=="function")o=a;else if(a&&typeof a=="object"){if(!(a.enter===null||a.enter===void 0))if(typeof a.enter=="function")o=a.enter;else throw new Error("Unexpected value `"+a.enter+"` for `visitors.enter`, expected optional visitor");if(typeof a.exit=="function")u=a.exit;else throw new Error("Unexpected value `"+a.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+a+"` for `enter` or `visitors`, expected visitor or object with visitors");const c=$o(l),h=i?1:-1;d(e,void 0,[])();function d(f,m,p){const g=f&&typeof f=="object"?f:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(f.type+(x?"<"+x+">":""))+")"})}return w;function w(){const x=!l||c(f,m,p[p.length-1]||void 0);let y=Rv;if(o&&x&&(y=cm(o(f,p,m)),y[0]===qi))return y;if("children"in f&&f.children){const v=f;if(v.children&&y[0]!==td){let b=(i?-1:v.children.length)+h;const E=[...p,v];for(;b>-1&&b<v.children.length;){const k=v.children[b],R=d(k,b,E)();if(R[0]===qi)return R;b=typeof R[1]=="number"?R[1]:b+h}}}if(u&&x){const v=cm(u(f,p,m));if(v[0]===td)throw new Error("Unexpected value `"+v[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(v[0]===qi||typeof v[1]=="number")return v}return y}}}function cm(e){return Array.isArray(e)?e:typeof e=="number"?[zE,e]:e==null?Rv:[e]}function Fo(e,t,n,r){let i,l,a;l=t,a=n,typeof l=="function"?nd(e,i,rd(l),a):nd(e,i,_E(l),a)}function _E(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?rd(e.enter):e.enter,exit:typeof e.exit=="function"?rd(e.exit):e.exit}}function rd(e){return t;function t(n,r,i){return e(n,i,r[r.length-1])}}const sd={}.hasOwnProperty,$E={};function OE(e,t){const n=t||$E,r=new Map,i=new Map,l=new Map,a={...wE,...n.handlers},o={all:c,applyData:UE,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:a,one:u,options:n,patch:FE,wrap:HE};return Fo(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const d=String(h.identifier).toUpperCase();h.type==="definition"?r.has(d)||r.set(d,h):i.has(d)||i.set(d,h)}}),o;function u(h,d){const{type:f}=h,m=o.handlers[f];if(sd.call(o.handlers,f)&&m)return m(o,h,d);if(o.options.passThrough&&o.options.passThrough.includes(f)){if("children"in h){const{children:g,...w}=h;return{...ao(w),children:o.all(h)}}return ao(h)}return(o.options.unknownHandler||BE)(o,h,d)}function c(h){const d=[];if("children"in h){const f=h.children;let m=-1;for(;++m<f.length;){const p=o.one(f[m],h);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=dm(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=dm(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function FE(e,t){e.position&&(t.position=PS(e))}function UE(e,t){let n=t;if(e&&e.data){const{hChildren:r,hName:i,hProperties:l}=e.data;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const a="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:a}}n.type==="element"&&l&&Object.assign(n.properties,ao(l)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function BE(e,t){const n=t.data||{},r="value"in t&&!(sd.call(n,"hProperties")||sd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function HE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
369
+ `}]}}const $o=function(e){if(e==null)return ME;if(typeof e=="function")return Oo(e);if(typeof e=="object")return Array.isArray(e)?AE(e):IE(e);if(typeof e=="string")return DE(e);throw new Error("Expected function, string, or object as test")};function AE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=$o(e[n]);return Oo(r);function r(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function IE(e){const t=e;return Oo(n);function n(r){const i=r;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function DE(e){return Oo(t);function t(n){return n&&n.type===e}}function Oo(e){return t;function t(n,r,i){return!!(zE(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function ME(){return!0}function zE(e){return e!==null&&typeof e=="object"&&"type"in e}const Lv=[],_E=!0,qi=!1,td="skip";function nd(e,t,n,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,l,a,o,u;if(typeof n=="function"||n&&typeof n=="object"?(l=t,a=n,r&&(i=!1)):(a=t,n&&(i=!1)),typeof a=="function")o=a;else if(a&&typeof a=="object"){if(!(a.enter===null||a.enter===void 0))if(typeof a.enter=="function")o=a.enter;else throw new Error("Unexpected value `"+a.enter+"` for `visitors.enter`, expected optional visitor");if(typeof a.exit=="function")u=a.exit;else throw new Error("Unexpected value `"+a.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+a+"` for `enter` or `visitors`, expected visitor or object with visitors");const c=$o(l),h=i?1:-1;d(e,void 0,[])();function d(f,m,p){const g=f&&typeof f=="object"?f:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(f.type+(x?"<"+x+">":""))+")"})}return w;function w(){const x=!l||c(f,m,p[p.length-1]||void 0);let y=Lv;if(o&&x&&(y=cm(o(f,p,m)),y[0]===qi))return y;if("children"in f&&f.children){const v=f;if(v.children&&y[0]!==td){let b=(i?-1:v.children.length)+h;const E=[...p,v];for(;b>-1&&b<v.children.length;){const k=v.children[b],R=d(k,b,E)();if(R[0]===qi)return R;b=typeof R[1]=="number"?R[1]:b+h}}}if(u&&x){const v=cm(u(f,p,m));if(v[0]===td)throw new Error("Unexpected value `"+v[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(v[0]===qi||typeof v[1]=="number")return v}return y}}}function cm(e){return Array.isArray(e)?e:typeof e=="number"?[_E,e]:e==null?Lv:[e]}function Fo(e,t,n,r){let i,l,a;l=t,a=n,typeof l=="function"?nd(e,i,rd(l),a):nd(e,i,$E(l),a)}function $E(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?rd(e.enter):e.enter,exit:typeof e.exit=="function"?rd(e.exit):e.exit}}function rd(e){return t;function t(n,r,i){return e(n,i,r[r.length-1])}}const sd={}.hasOwnProperty,OE={};function FE(e,t){const n=t||OE,r=new Map,i=new Map,l=new Map,a={...kE,...n.handlers},o={all:c,applyData:BE,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:a,one:u,options:n,patch:UE,wrap:WE};return Fo(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const d=String(h.identifier).toUpperCase();h.type==="definition"?r.has(d)||r.set(d,h):i.has(d)||i.set(d,h)}}),o;function u(h,d){const{type:f}=h,m=o.handlers[f];if(sd.call(o.handlers,f)&&m)return m(o,h,d);if(o.options.passThrough&&o.options.passThrough.includes(f)){if("children"in h){const{children:g,...w}=h;return{...lo(w),children:o.all(h)}}return lo(h)}return(o.options.unknownHandler||HE)(o,h,d)}function c(h){const d=[];if("children"in h){const f=h.children;let m=-1;for(;++m<f.length;){const p=o.one(f[m],h);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=dm(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=dm(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function UE(e,t){e.position&&(t.position=RS(e))}function BE(e,t){let n=t;if(e&&e.data){const{hChildren:r,hName:i,hProperties:l}=e.data;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const a="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:a}}n.type==="element"&&l&&Object.assign(n.properties,lo(l)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function HE(e,t){const n=t.data||{},r="value"in t&&!(sd.call(n,"hProperties")||sd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function WE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
370
370
  `});++r<e.length;)r&&n.push({type:"text",value:`
371
371
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
372
- `}),n}function dm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function hm(e,t){const n=OE(e,t),r=n.one(e,void 0),i=RE(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
373
- `},i),l}function WE(e,t){return e&&"run"in e?async function(n,r){const i=hm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return hm(n,{file:r,...e||t})}}function fm(e){if(e)throw e}var Ea=Object.prototype.hasOwnProperty,Lv=Object.prototype.toString,pm=Object.defineProperty,mm=Object.getOwnPropertyDescriptor,gm=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Lv.call(t)==="[object Array]"},xm=function(t){if(!t||Lv.call(t)!=="[object Object]")return!1;var n=Ea.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ea.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Ea.call(t,i)},ym=function(t,n){pm&&n.name==="__proto__"?pm(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},vm=function(t,n){if(n==="__proto__")if(Ea.call(t,n)){if(mm)return mm(t,n).value}else return;return t[n]},VE=function e(){var t,n,r,i,l,a,o=arguments[0],u=1,c=arguments.length,h=!1;for(typeof o=="boolean"&&(h=o,o=arguments[1]||{},u=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=vm(o,n),i=vm(t,n),o!==i&&(h&&i&&(xm(i)||(l=gm(i)))?(l?(l=!1,a=r&&gm(r)?r:[]):a=r&&xm(r)?r:{},ym(o,{name:n,newValue:e(h,a,i)})):typeof i<"u"&&ym(o,{name:n,newValue:i}));return o};const Tu=pd(VE);function id(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function QE(){const e=[],t={run:n,use:r};return t;function n(...i){let l=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(u,...c){const h=e[++l];let d=-1;if(u){a(u);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,h?qE(h,o)(...c):a(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function qE(e,t){let n;return r;function r(...a){const o=e.length>a.length;let u;o&&a.push(i);try{u=e.apply(this,a)}catch(c){const h=c;if(o&&n)throw h;return i(h)}o||(u&&u.then&&typeof u.then=="function"?u.then(l,i):u instanceof Error?i(u):l(u))}function i(a,...o){n||(n=!0,t(a,...o))}function l(a){i(null,a)}}const Tn={basename:GE,dirname:KE,extname:YE,join:JE,sep:"/"};function GE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Tl(e);let n=0,r=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else a<0&&(l=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function KE(e){if(Tl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function YE(e){Tl(e);let t=e.length,n=-1,r=0,i=-1,l=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function JE(...e){let t=-1,n;for(;++t<e.length;)Tl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":XE(n)}function XE(e){Tl(e);const t=e.codePointAt(0)===47;let n=ZE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function ZE(e,t){let n="",r=0,i=-1,l=0,a=-1,o,u;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||l===1))if(i!==a-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=a,l=0;continue}}else if(n.length>0){n="",r=0,i=a,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,l=0}else o===46&&l>-1?l++:l=-1}return n}function Tl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const eT={cwd:tT};function tT(){return"/"}function ld(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nT(e){if(typeof e=="string")e=new URL(e);else if(!ld(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return rT(e)}function rT(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Pu=["history","path","basename","stem","extname","dirname"];class Av{constructor(t){let n;t?ld(t)?n={path:t}:typeof t=="string"||sT(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":eT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Pu.length;){const l=Pu[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)Pu.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Tn.basename(this.path):void 0}set basename(t){Lu(t,"basename"),Ru(t,"basename"),this.path=Tn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Tn.dirname(this.path):void 0}set dirname(t){jm(this.basename,"dirname"),this.path=Tn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Tn.extname(this.path):void 0}set extname(t){if(Ru(t,"extname"),jm(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Tn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ld(t)&&(t=nT(t)),Lu(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Tn.basename(this.path,this.extname):void 0}set stem(t){Lu(t,"stem"),Ru(t,"stem"),this.path=Tn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Do(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ru(e,t){if(e&&e.includes(Tn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Tn.sep+"`")}function Lu(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jm(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function sT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const iT=function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},lT={}.hasOwnProperty;class Bh extends iT{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=QE()}copy(){const t=new Bh;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Tu(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Du("data",this.frozen),this.namespace[t]=n,this):lT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Du("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ia(t),r=this.parser||this.Parser;return Au("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Au("process",this.parser||this.Parser),Iu("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,a){const o=ia(t),u=r.parse(o);r.run(u,o,function(h,d,f){if(h||!d||!f)return c(h);const m=d,p=r.stringify(m,f);uT(p)?f.value=p:f.result=p,c(h,f)});function c(h,d){h||!d?a(h):l?l(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Au("processSync",this.parser||this.Parser),Iu("processSync",this.compiler||this.Compiler),this.process(t,i),km("processSync","process",n),r;function i(l,a){n=!0,fm(l),r=a}}run(t,n,r){wm(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(a,o){const u=ia(n);i.run(t,u,c);function c(h,d,f){const m=d||t;h?o(h):a?a(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),km("runSync","run",r),i;function l(a,o){fm(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=ia(n),i=this.compiler||this.Compiler;return Iu("stringify",i),wm(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Du("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...d]=c;u(h,d)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))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");o(c.plugins),c.settings&&(i.settings=Tu(!0,i.settings,c.settings))}function o(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const d=c[h];l(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,h){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...h]);else if(h.length>0){let[m,...p]=h;const g=r[f][1];id(g)&&id(m)&&(m=Tu(!0,g,m)),r[f]=[c,m,...p]}}}}const aT=new Bh().freeze();function Au(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Iu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Du(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wm(e){if(!id(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function km(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ia(e){return oT(e)?e:new Av(e)}function oT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function uT(e){return typeof e=="string"||cT(e)}function cT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bm=[],Sm={allowDangerousHtml:!0},hT=/^(https?|ircs?|mailto|xmpp)$/i,fT=[{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:"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 ui(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,l=e.components,a=e.disallowedElements,o=e.rehypePlugins||bm,u=e.remarkPlugins||bm,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Sm}:Sm,h=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||pT,m=aT().use(KC).use(u).use(WE,c).use(o),p=new Av;typeof r=="string"&&(p.value=r);for(const y of fT)Object.hasOwn(e,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+dT+y.id,void 0);const g=m.parse(p);let w=m.runSync(g,p);return i&&(w={type:"element",tagName:"div",properties:{className:i},children:w.type==="root"?w.children:[w]}),Fo(w,x),MS(w,{Fragment:s.Fragment,components:l,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function x(y,v,b){if(y.type==="raw"&&b&&typeof v=="number")return h?b.children.splice(v,1):b.children[v]={type:"text",value:y.value},v;if(y.type==="element"){let E;for(E in Nu)if(Object.hasOwn(Nu,E)&&Object.hasOwn(y.properties,E)){const k=y.properties[E],R=Nu[E];(R===null||R.includes(y.tagName))&&(y.properties[E]=f(String(k||""),E,y))}}if(y.type==="element"){let E=t?!t.includes(y.tagName):a?a.includes(y.tagName):!1;if(!E&&n&&typeof v=="number"&&(E=!n(y,v,b)),E&&b&&typeof v=="number")return d&&y.children?b.children.splice(v,1,...y.children):b.children.splice(v,1),v}}}function pT(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||n>-1&&t>n||r>-1&&t>r||hT.test(e.slice(0,t))?e:""}function mT(e,t){if(t<=7)return Array.from({length:t},(l,a)=>a+1);const n=[1],r=Math.max(2,e-1),i=Math.min(t-1,e+1);r>2&&n.push("…");for(let l=r;l<=i;l++)n.push(l);return i<t-1&&n.push("…"),n.push(t),n}function ps({page:e,pageSize:t,total:n,onPage:r,onPageSize:i,label:l="rows"}){const a=Math.max(1,Math.ceil(n/t)),o=n?(e-1)*t+1:0,u=Math.min(e*t,n);return s.jsxs("div",{className:"pagination",children:[s.jsx("span",{className:"muted small",children:n?`Showing ${o}–${u} of ${n} ${l}`:`0 ${l}`}),s.jsx("div",{className:"grow"}),s.jsxs("label",{className:"row small muted",style:{gap:6},children:["Rows per page",s.jsx("select",{className:"select sm",value:t,onChange:c=>i(Number(c.target.value)),"aria-label":"Rows per page",children:vb.map(c=>s.jsx("option",{value:c,children:c},c))})]}),s.jsxs("nav",{className:"pager","aria-label":"Pagination",children:[s.jsx("button",{className:"pg-btn",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"Previous page",children:s.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:s.jsx(ti,{size:14})})}),mT(e,a).map((c,h)=>c==="…"?s.jsx("span",{className:"pg-gap",children:"…"},`e${h}`):s.jsx("button",{className:`pg-btn ${c===e?"active":""}`,onClick:()=>r(c),"aria-current":c===e?"page":void 0,children:c},c)),s.jsx("button",{className:"pg-btn",onClick:()=>r(e+1),disabled:e>=a,"aria-label":"Next page",children:s.jsx(ti,{size:14})})]})]})}function Pl(e=[],t=_y){const[n,r]=j.useState(1),[i,l]=j.useState(t);return j.useEffect(()=>r(1),e),{page:n,setPage:r,pageSize:i,setPageSize:o=>{l(o),r(1)}}}function Hh(e,t=[],n=_y){const r=Pl(t,n),i=Math.max(1,Math.ceil(e.length/r.pageSize)),l=Math.min(r.page,i);return{pageItems:j.useMemo(()=>e.slice((l-1)*r.pageSize,l*r.pageSize),[e,l,r.pageSize]),props:{page:l,pageSize:r.pageSize,total:e.length,onPage:r.setPage,onPageSize:r.setPageSize}}}const Rl=(e,t)=>{var r;const n=Sl(e);return n?((r=t.find(i=>i.id===n))==null?void 0:r.name)??`${e} (deleted)`:Se[e].label},Wh=e=>Sl(e)?"custom":e,gT={pending:"not started",running:"running",passed:"passed",out:"out of iterations",stopped:"stopped"};function xT({nodes:e,agents:t,selected:n,onSelect:r,waitingRunId:i,finished:l}){const a=u=>{if(u.kind==="agent")return s.jsx(yT,{node:u,label:Rl(u.ref,t),selected:n,onSelect:r,waitingRunId:i??null,finished:l},u.key);const c=u.passes.reduce((d,f)=>d+f,0),h=u.passes.length>1?`${u.passes.join(" + ")} iterations (one number per pass of the outer loop)`:`${c} iteration${c===1?"":"s"}`;return s.jsxs("div",{className:`ptl-loop ${u.state}`,children:[s.jsxs("div",{className:"ptl-loop-head",children:[s.jsx(is,{size:13}),s.jsxs("b",{children:["Loop ×",u.step.maxIterations]}),s.jsxs("span",{className:"muted",children:["· until ",u.step.endsWhen==="last"?"last":"first"," passes"]}),s.jsx("span",{className:`ptl-state ${u.state}`,children:gT[u.state]})]}),s.jsx("div",{className:"ptl-row",children:u.children.map((d,f)=>o(d,f))}),s.jsx("div",{className:`ptl-return ${c?"":"idle"}`,title:`Ran ${h}; at most ${u.step.maxIterations} per pass`,children:s.jsxs("span",{children:["↺ ×",c]})})]},u.key)},o=(u,c)=>s.jsxs(j.Fragment,{children:[c>0&&s.jsx("span",{className:"ptl-arrow","aria-hidden":"true",children:"→"}),a(u)]},u.key);return s.jsx("div",{className:"ptl",role:"tablist","aria-label":"Agents",children:e.map((u,c)=>o(u,c))})}function yT({node:e,label:t,selected:n,onSelect:r,waitingRunId:i,finished:l}){const{runs:a}=e;if(!a.length)return s.jsxs("div",{className:"ptl-node ghost","aria-disabled":"true",title:l?"Skipped":"Not run yet",children:[s.jsx(Ot,{agent:Wh(e.ref),size:22}),s.jsx("span",{className:"ptl-name",children:t}),s.jsx("span",{className:`ptl-dot ${l?"skipped":"pending"}`})]});const o=a[a.length-1],u=a.some(h=>h.id===n),c=a.some(h=>h.id===i);return s.jsxs("div",{className:`ptl-node ${o.status} ${u?"selected":""} ${c?"waiting":""}`,children:[s.jsxs("button",{role:"tab","aria-selected":u,className:"ptl-main",onClick:()=>r((a.find(h=>h.id===n)??o).id),title:`${t} · ${a.length} run${a.length>1?"s":""}`,children:[s.jsx(Ot,{agent:o.agent,size:22}),s.jsx("span",{className:"ptl-name",children:t}),a.length>1&&s.jsxs("span",{className:"ptl-count",children:["×",a.length]})]}),s.jsx("span",{className:"ptl-runs",children:a.map((h,d)=>s.jsx("button",{type:"button",className:`ptl-dot ${h.id===i?"waiting":h.status} ${h.id===n?"on":""}`,onClick:()=>r(h.id),title:vT(h,t,d+1),"aria-label":`${t} run ${d+1}: ${h.status}`},h.id))}),a.length===1&&s.jsx("span",{className:"ptl-time",children:ds(o.startedAt,o.finishedAt)})]})}function vT(e,t,n){const r=e.usage;return[`${t} #${n}: ${e.status}`,ds(e.startedAt,e.finishedAt),e.turns!==null?`${e.turns} turns`:null,e.costUsd!==null?Gt(e.costUsd):null,r?`${ln(r.inputTokens+r.cacheReadTokens+r.cacheWriteTokens)} in / ${ln(r.outputTokens)} out`:null].filter(Boolean).join(" · ")}class Nm extends Error{}const jT=e=>e.ref??e.agent;function wT(e){return e.status==="passed"?!0:e.agent==="explorer"&&e.status==="failed"&&e.output!==null&&e.output!==void 0}function bs(e,t){return e.kind==="agent"?{kind:"ghost",key:t,ref:e.agent}:{kind:"loop",key:t,step:e,state:"pending",iterations:[e.steps.map((n,r)=>bs(cs(n),`${t}.${r}`))]}}function kT(e,t){let n=0;const r=(a,o)=>{const u=t[n];if(!u)return{node:{kind:"ghost",key:o,ref:a},flow:"open"};if(jT(u)!==a)throw new Nm;n++;const c=u.status!=="running"&&u.status!=="pending";return{node:{kind:"run",key:o,run:u},flow:c?wT(u)?"ok":"fail":"open"}},i=(a,o)=>a.kind==="agent"?r(a.agent,o):l(a,o),l=(a,o)=>{const u=a.steps.map(cs),c=a.endsWhen==="last",h=[],d=f=>({kind:"loop",key:o,step:a,iterations:h,state:f});if(n>=t.length)return{node:bs(a,o),flow:"open"};for(let f=0;f<a.maxIterations;f++){const m=[];h.push(m);const p=`${o}i${f}`,g=x=>u.slice(x).forEach((y,v)=>m.push(bs(y,`${p}.${x+v}`)));if(c){for(let x=0;x<u.length;x++){const y=i(u[x],`${p}.${x}`);if(m.push(y.node),y.flow==="open")return g(x+1),{node:d("running"),flow:"open"};if(y.flow==="stop")return{node:d("stopped"),flow:"stop"};const v=x===u.length-1;if(v&&y.flow==="ok")return{node:d("passed"),flow:"ok"};if(!v&&y.flow==="fail")return{node:d("stopped"),flow:"stop"}}if(f<a.maxIterations-1&&n>=t.length)return h.push(u.map((x,y)=>bs(x,`${o}i${f+1}.${y}`))),{node:d("running"),flow:"open"};continue}const w=i(u[0],`${p}.0`);if(m.push(w.node),w.flow==="open")return{node:d("running"),flow:"open"};if(w.flow==="stop")return{node:d("stopped"),flow:"stop"};if(w.flow==="ok")return{node:d("passed"),flow:"ok"};if(f===a.maxIterations-1)break;for(let x=1;x<u.length;x++){const y=i(u[x],`${p}.${x}`);if(m.push(y.node),y.flow==="open")return g(x+1),{node:d("running"),flow:"open"};if(y.flow!=="ok")return{node:d("stopped"),flow:"stop"}}if(n>=t.length)return h.push([bs(u[0],`${o}i${f+1}.0`)]),{node:d("running"),flow:"open"}}return{node:d("out"),flow:"fail"}};try{const a=[];let o=!1;return e.forEach((u,c)=>{if(o){a.push(bs(u,`b${c}`));return}const h=i(u,`b${c}`);a.push(h.node),h.flow!=="ok"&&(o=!0)}),n===t.length?a:null}catch(a){if(a instanceof Nm)return null;throw a}}const Iv=e=>e.some(t=>t.kind==="run"||t.kind==="loop"&&t.iterations.some(Iv));function Dv(e){const t=e[0];if(t.kind!=="loop"){const a=t.kind==="run"?t.run.ref??t.run.agent:t.ref;return{kind:"agent",key:t.key,ref:a,runs:e.flatMap(o=>o.kind==="run"?[o.run]:[])}}const n=e.filter(a=>a.kind==="loop"),r=t.step.steps.length,i=[];for(let a=0;a<r;a++){const o=n.flatMap(u=>u.iterations.flatMap(c=>c[a]?[c[a]]:[]));o.length&&i.push(Dv(o))}const l=n[n.length-1];return{kind:"loop",key:t.key,step:t.step,state:l.state,passes:n.map(a=>a.iterations.filter(Iv).length),children:i}}function bT(e){return e.map(t=>Dv([t]))}const ST=["Read(.env)","Read(**/.env)","Read(.env.local)","Read(**/.env.local)","WebFetch","WebSearch"];function NT(e,t){const n=Ao[e].filter(i=>!Gi(e)||!Ch.includes(i));let r=0;for(const i of t)i.agent===n[r]&&r++;return n.slice(r)}function CT(e,t){const n=o=>o.ref??o.agent,r=(o,u)=>({kind:"agent",key:u,agent:Wh(o),name:Rl(o,e.agents),description:o.startsWith("custom:")?"Custom agent":Se[o].description}),i=(o,u)=>o.kind==="agent"?r(o.agent,u):{kind:"loop",key:u,maxIterations:o.maxIterations,items:o.steps.map((c,h)=>i(cs(c),`${u}-${h}`))},l=[];let a=0;return e.pipeline.steps.forEach((o,u)=>{if(o.kind==="agent"){a<t.length?a++:l.push(i(o,`s${u}`));return}if(a<t.length){const c=new Set(Io([o]));for(;a<t.length&&c.has(n(t[a]));)a++;return}l.push(i(o,`s${u}`))}),l}const Gi=e=>e==="generate"||e==="heal";function ET(e,t){if(!Gi(e.type))return{linear:t,loop:[]};const n=t.findIndex(r=>Ch.includes(r.agent));return n<0?{linear:t,loop:[]}:{linear:t.slice(0,n),loop:t.slice(n)}}function TT(e,t,n,r){if(r)return null;const i=t[t.length-1];if(!i)return e.type==="heal"?"healer":"validator";if(i.status==="running"||i.status==="pending")return null;const l=t.filter(a=>a.agent==="healer").length;return i.agent==="validator"?i.status==="failed"&&l<n?"healer":null:i.status==="passed"?"validator":null}function Cm(e,t){const n=t.filter(i=>i.agent===e.agent&&i.label===e.label),r=_b(e);return n.length>1?`${r} #${n.indexOf(e)+1}`:r}function PT(){var oe;const e=Number(li().id),t=ut(),[n]=xh(),r=n.get("result")?Number(n.get("result")):null,{refresh:i}=Xt(),{job:l,runs:a,results:o,pipeline:u,pending:c,logs:h,error:d,refetch:f,reconnect:m}=X0(e),p=(l==null?void 0:l.status)==="waiting"?c:null,[g,w]=j.useState(null),x=j.useRef(!1),y=j.useRef(!1),[v,b]=j.useState(null);if(j.useEffect(()=>{if(x.current||a.length===0)return;const B=a.find(he=>he.status==="running");w((B??a[a.length-1]).id)},[a]),j.useEffect(()=>{if(y.current||!r||o.length===0)return;const B=o.find(he=>he.id===r);B!=null&&B.agentRunId&&(x.current=!0,y.current=!0,w(B.agentRunId))},[r,o]),j.useEffect(()=>{p&&(x.current=!0,w(p.runId))},[p==null?void 0:p.runId]),j.useEffect(()=>{l&&Hc.includes(l.status)&&i()},[l==null?void 0:l.status]),!Number.isInteger(e)||e<=0)return s.jsx(Pe,{error:"Invalid job id"});const E=a.find(B=>B.id===g)??null,k=l&&l.type in Ao?NT(l.type,a):[],R=l?Hc.includes(l.status):!1,T=(l==null?void 0:l.type)==="pipeline"&&u?kT(u.pipeline.steps,a):null,D=(l==null?void 0:l.type)==="pipeline"&&u&&!T?CT(u,a):[],C=(l==null?void 0:l.args.maxHealRounds)??jb.maxHealRounds,{linear:L,loop:A}=l?ET(l,a):{linear:a,loop:[]},z=l&&Gi(l.type)?TT(l,A,C,R):null,U=A.filter(B=>B.agent==="healer").length,I=B=>{x.current=!0,w(B)},Q=B=>s.jsx(IT,{run:B,label:Cm(B,a),selected:g===B.id,waiting:(p==null?void 0:p.runId)===B.id,onSelect:()=>I(B.id)},B.id),J=(B,he,ze,Ke,W)=>s.jsx(DT,{agent:B,finished:R,note:ze,name:Ke,description:W},he),H=B=>B.kind==="agent"?J(B.agent,B.key,void 0,B.name,B.description):s.jsxs("div",{className:"loop-group idle","aria-label":`Loop ×${B.maxIterations}`,children:[s.jsxs("div",{className:"loop-head",children:[s.jsx(is,{size:14}),s.jsxs("span",{children:["Loop ×",B.maxIterations]})]}),s.jsx("div",{className:"loop-body",children:B.items.map((he,ze)=>s.jsxs(j.Fragment,{children:[ze>0&&s.jsx("span",{className:"connector"}),H(he)]},he.key))})]},B.key),X=a.some(B=>{var he;return B.agent==="runner"&&((he=B.output)==null?void 0:he.htmlReport)}),S=async B=>{if(!l)return;const he=o.filter(W=>(W.status==="failed"||W.status==="flaky")&&W.specFile&&W.tcId).map(W=>({spec:W.specFile,tcId:W.tcId})),ze=`${l.args.name??`Test run #${l.id}`} (${B?"failed re-run":"re-run"})`;if(!l.args.selection&&!B){try{const W=await q.createJob({type:"testrun",name:ze,...l.target!=="all"?{spec:l.target}:{},...l.args.tcId?{tcId:l.args.tcId}:{},repeatEach:l.args.repeatEach??1,...l.args.retries!==void 0?{retries:l.args.retries}:{},htmlReport:l.args.htmlReport});t(`/runs/${W.id}`)}catch(W){b(W.message)}return}let Ke=l.args.selection??he;if(B){const W=new Set(he.map(fe=>`${fe.spec}#${fe.tcId}`));Ke=Ke.filter(fe=>W.has(`${fe.spec}#${fe.tcId}`))}Ke=[...new Map(Ke.map(W=>[`${W.spec}#${W.tcId}`,W])).values()],t("/test-runs/new",{state:{name:ze,selection:Ke,retries:l.args.retries}})},ae=o.some(B=>B.status==="failed"||B.status==="flaky"),O=async()=>{b(null);try{await q.rerunFailedJob(e),m()}catch(B){b(B.message)}},N=async()=>{try{const B=await q.createJob({type:"generate",spec:l.target});t(`/runs/${B.id}`)}catch(B){b(B.message)}},F=l&&(l.type==="testrun"||l.type==="heal"||l.type==="generate")&&R?[...new Set(o.filter(B=>B.status==="failed"&&B.specFile).map(B=>B.specFile))]:[],Z=async B=>{try{const he=await q.createJob({type:"heal",spec:B,sourceJobId:e});t(`/runs/${he.id}`)}catch(he){b(he.message)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Recent runs",to:"/runs"},{label:`Job #${e}`}]}),s.jsx(Pe,{error:d??v}),l&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"row between",style:{marginBottom:6},children:[s.jsxs("div",{className:"row",children:[s.jsxs("h1",{className:"page-title",children:[kr[l.type]," ·"," ",l.type==="testrun"?l.args.name:l.type==="context"?s.jsx(ye,{to:"/project",children:"CLAUDE.md"}):l.type==="custom"||l.type==="pipeline"?[l.type==="pipeline"?l.args.pipelineName:l.args.customAgentName,l.target.endsWith(".md")?l.target:null].filter(Boolean).join(" · ")||l.target:l.target.endsWith(".md")?s.jsx(ye,{to:`/specs/${l.target}`,children:l.target}):l.target]}),s.jsx(kn,{status:l.status})]}),s.jsxs("div",{className:"row",children:[X&&s.jsxs("a",{className:"btn ghost",href:yh(e),target:"_blank",rel:"noreferrer",title:"Playwright HTML report (new tab)",children:[s.jsx(Sh,{size:14})," HTML report"]}),l.type==="testrun"&&R&&s.jsxs(s.Fragment,{children:[ae&&s.jsxs("button",{className:"btn ghost",onClick:()=>void S(!0),title:"New test run with only the failed test cases",children:[s.jsx(ft,{size:14})," Re-run failed"]}),s.jsxs("button",{className:"btn ghost",onClick:()=>void S(!1),title:"New test run with the same test cases",children:[s.jsx(ft,{size:14})," Re-run"]})]}),(l.type==="pipeline"||l.type==="generate"||l.type==="heal")&&(l.status==="failed"||l.status==="cancelled"||l.status==="interrupted")&&s.jsxs("button",{className:"btn ghost",onClick:()=>void O(),title:"Run this job again from the step that stopped it: the earlier steps are not run again, their outputs are reused",children:[s.jsx(ft,{size:14})," Re-run failed"]}),l.type==="context"&&l.status==="passed"&&s.jsxs(ye,{className:"btn ghost",to:"/project",children:[s.jsx(jr,{size:15})," View CLAUDE.md"]}),l.type==="spec"&&l.status==="passed"&&s.jsxs(s.Fragment,{children:[s.jsxs(ye,{className:"btn ghost",to:`/specs/${l.target}`,children:[s.jsx(jr,{size:15})," Open spec"]}),s.jsxs("button",{className:"btn",onClick:()=>void N(),title:"QA Explorer → QA Script Generator → QA Validator ⇄ QA Script Healer on the new spec",children:[s.jsx(wh,{size:15})," Generate tests"]})]}),F.map(B=>s.jsxs("button",{className:"btn",onClick:()=>void Z(B),title:"QA Script Healer fixes the scripts of failing tests, then QA Validator re-runs them",children:[s.jsx(Ry,{size:15})," Heal ",B]},B)),!R&&s.jsxs("button",{className:"btn danger",onClick:()=>void q.cancelJob(e).catch(B=>b(B.message)),children:[s.jsx(Iy,{size:14})," Cancel"]})]})]}),s.jsxs("div",{className:"muted small",style:{marginBottom:14},children:["Started ",Pt(l.startedAt??l.createdAt)," · ",ds(l.startedAt,l.finishedAt),l.args.tcId&&` · ${l.args.tcId}`,l.args.repeatEach&&` · repeat ${l.args.repeatEach}×`,l.args.retries!==void 0&&` · retries ${l.args.retries}`,l.args.selection&&` · ${l.args.selection.length} test case${l.args.selection.length===1?"":"s"}`,l.type==="testrun"&&(l.args.htmlReport?" · line + HTML report":" · line report"),Gi(l.type)&&` · max ${C} heal round${C===1?"":"s"}`,l.args.sourceJobId&&s.jsxs(s.Fragment,{children:[" ","· from ",s.jsxs(ye,{to:`/runs/${l.args.sourceJobId}`,children:["job #",l.args.sourceJobId]})]}),l.summary&&s.jsxs(s.Fragment,{children:[" · ",l.summary]})]}),l.warning&&s.jsxs("div",{className:"warn-box",children:["⚠ ",l.warning]}),T&&u?s.jsx(xT,{nodes:bT(T),agents:u.agents,selected:g,onSelect:I,waitingRunId:(p==null?void 0:p.runId)??null,finished:R}):s.jsxs("div",{className:"timeline",role:"tablist","aria-label":"Agents",children:[L.map((B,he)=>s.jsxs(j.Fragment,{children:[he>0&&s.jsx("span",{className:`connector ${L[he-1].status==="passed"?"done":""}`}),Q(B)]},B.id)),k.map((B,he)=>s.jsxs(j.Fragment,{children:[(L.length>0||he>0)&&s.jsx("span",{className:"connector"}),J(B,`g-${B}-${he}`)]},`ghost-${B}-${he}`)),D.map((B,he)=>s.jsxs(j.Fragment,{children:[(L.length>0||he>0)&&s.jsx("span",{className:"connector"}),H(B)]},B.key)),Gi(l.type)&&s.jsxs(s.Fragment,{children:[(L.length>0||k.length>0)&&s.jsx("span",{className:`connector ${((oe=L[L.length-1])==null?void 0:oe.status)==="passed"?"done":""}`}),s.jsxs("div",{className:`loop-group ${A.length?"":"idle"}`,"aria-label":"Validator and Healer loop",children:[s.jsxs("div",{className:"loop-head",children:[s.jsx(is,{size:14}),s.jsx("span",{children:"Validate ⇄ Heal loop"}),s.jsxs("span",{className:"loop-count",title:"Healer rounds used / maximum (Settings)",children:["heal round ",U,"/",C]})]}),s.jsxs("div",{className:"loop-body",children:[A.map((B,he)=>s.jsxs(j.Fragment,{children:[he>0&&s.jsx("span",{className:`connector ${A[he-1].status==="passed"?"done":""} ${B.agent==="validator"?"back":"fail"}`,title:B.agent==="validator"?"QA Script Healer done → back to QA Validator":"QA Validator failed → QA Script Healer"}),Q(B)]},B.id)),z&&s.jsxs(s.Fragment,{children:[A.length>0&&s.jsx("span",{className:`connector ${z==="validator"?"back":"fail"}`}),J(z,"loop-ghost",z==="healer"&&A.length?"Runs if the QA Validator fails":void 0)]}),!A.length&&!z&&J(l.type==="heal"?"healer":"validator","loop-skip")]}),s.jsx("div",{className:"loop-return",title:`QA Validator fails → QA Script Healer fixes → back to QA Validator. Stops when tests pass, the QA Script Healer reports an app bug or gives up, or after ${C} heal round${C===1?"":"s"}.`,children:s.jsxs("span",{children:["↺ back to QA Validator · max ",C]})})]})]})]}),p&&s.jsx(AT,{jobId:e,label:p.label,questions:p.questions??[],onDone:()=>void f()},`review-${p.runId}`),E?s.jsx(MT,{jobId:e,job:l,run:E,label:Cm(E,a),log:h[E.id]??"",results:o.filter(B=>B.agentRunId===E.id),highlightResultId:r,reviewing:(p==null?void 0:p.runId)===E.id},E.id):s.jsx("div",{className:"card pad muted",children:"Waiting for the first agent to start…"})]})]})}const _s=-1,RT=e=>Object.fromEntries(e.map(t=>[t.id,Math.max(t.options.findIndex(n=>n.recommended),t.options.length?0:_s)]));function LT({questions:e,choice:t,other:n,onChoice:r,onOther:i}){return s.jsx("ol",{className:"question-list",children:e.map(l=>s.jsx("li",{className:"question",children:s.jsxs("fieldset",{children:[s.jsx("legend",{children:l.question}),l.options.map((a,o)=>s.jsxs("label",{className:`question-option ${t[l.id]===o?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${l.id}`,checked:t[l.id]===o,onChange:()=>r(l.id,o)}),s.jsxs("span",{children:[s.jsx("b",{children:a.label}),a.recommended&&s.jsx("span",{className:"chip ok small",children:"Recommended"}),a.description&&s.jsx("span",{className:"muted small question-desc",children:a.description})]})]},o)),s.jsxs("label",{className:`question-option ${t[l.id]===_s?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${l.id}`,checked:t[l.id]===_s,onChange:()=>r(l.id,_s)}),s.jsxs("span",{className:"question-other",children:[s.jsx("b",{children:"Other"}),s.jsx("input",{className:"input",maxLength:bb,placeholder:"Type your answer",value:n[l.id]??"",onFocus:()=>r(l.id,_s),onChange:a=>i(l.id,a.target.value),"aria-label":`Other answer to: ${l.question}`})]})]})]})},l.id))})}function AT({jobId:e,label:t,questions:n,onDone:r}){const i=In(),[l,a]=j.useState(()=>RT(n)),[o,u]=j.useState({}),c=n.length>0,h=n.map(v=>{var b;return{id:v.id,answer:l[v.id]===_s?(o[v.id]??"").trim():((b=v.options[l[v.id]])==null?void 0:b.label)??""}}),d=h.filter(v=>!v.answer).length,[f,m]=j.useState(""),[p,g]=j.useState(!1),[w,x]=j.useState(null),y=async v=>{g(!0);try{await v(),r()}catch(b){x(b.message)}finally{g(!1)}};return s.jsxs("div",{className:"review-panel",role:"region","aria-label":"Review",children:[s.jsx("b",{children:c?`${t} has ${n.length} question${n.length>1?"s":""} for you.`:`${t} is waiting for your review.`}),s.jsx("span",{className:"muted small",children:c?`Pick an option or type your own answer. Sending runs ${t} again with your answers. Reject ends the pipeline.`:"Approve to continue the pipeline with this result. Reject ends the pipeline."}),c&&s.jsx(LT,{questions:n,choice:l,other:o,onChoice:(v,b)=>a(E=>({...E,[v]:b})),onOther:(v,b)=>u(E=>({...E,[v]:b}))}),s.jsx("textarea",{className:"input",rows:2,maxLength:yb,placeholder:"Reason (optional, saved with a rejection)",value:f,onChange:v=>m(v.target.value),"aria-label":"Reject reason"}),s.jsx(Pe,{error:w}),s.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[s.jsx("button",{className:"btn danger",disabled:p,onClick:async()=>{await i({title:`Reject the output of ${t}?`,message:"The pipeline ends here and the job is marked failed.",confirmLabel:"Reject",danger:!0})&&await y(()=>q.rejectJob(e,f.trim()||void 0))},children:"Reject"}),c?s.jsx("button",{className:"btn",disabled:p||d>0,title:d?'Type an answer for every "Other"':void 0,onClick:()=>void y(()=>q.answerJob(e,h)),children:"Send answers"}):s.jsx("button",{className:"btn",disabled:p,onClick:()=>void y(()=>q.approveJob(e)),children:"Approve"})]})]})}function IT({run:e,label:t,selected:n,waiting:r,onSelect:i}){const l=e.usage;return s.jsxs("button",{role:"tab","aria-selected":n,className:`agent-card ${n?"selected":""} ${e.status} ${r?"waiting":""}`,onClick:i,children:[s.jsxs("span",{className:"agent-head",children:[s.jsx(Ot,{agent:e.agent}),s.jsxs("span",{children:[s.jsx("span",{className:"agent-name",children:t}),s.jsx("br",{}),s.jsx(kn,{status:e.status})]})]}),s.jsxs("span",{className:"agent-meta",children:[s.jsx("span",{children:ds(e.startedAt,e.finishedAt)}),e.turns!==null&&s.jsxs("span",{children:[e.turns," turns"]}),e.costUsd!==null&&s.jsx("span",{children:Gt(e.costUsd)}),l&&s.jsxs("span",{title:`input ${l.inputTokens} · output ${l.outputTokens} · cache read ${l.cacheReadTokens} · cache write ${l.cacheWriteTokens}`,children:[ln(l.inputTokens+l.cacheReadTokens+l.cacheWriteTokens)," in / ",ln(l.outputTokens)," out"]})]})]})}function DT({agent:e,finished:t,note:n,name:r,description:i}){return s.jsxs("div",{className:"agent-card ghost","aria-disabled":"true",children:[s.jsxs("span",{className:"agent-head",children:[s.jsx(Ot,{agent:e}),s.jsxs("span",{children:[s.jsx("span",{className:"agent-name",children:r??Se[e].label}),s.jsx("br",{}),s.jsx(dt,{status:t?"skipped":"pending"})]})]}),s.jsx("span",{className:"agent-meta",children:n??i??Se[e].description})]})}function MT({jobId:e,job:t,run:n,label:r,log:i,results:l,highlightResultId:a,reviewing:o}){const u=!!a&&l.some(x=>x.id===a),[c,h]=j.useState(u||o?"output":"log");j.useEffect(()=>{o&&h("output")},[o]);const[d,f]=j.useState(null),m=j.useRef(null),p=j.useRef(!0),g=!["running","pending"].includes(n.status);j.useEffect(()=>{g&&q.agentRun(e,n.id).then(f).catch(()=>{})},[e,n.id,g]),j.useEffect(()=>{const x=m.current;x&&p.current&&(x.scrollTop=x.scrollHeight)},[i,c]),UT(m,c==="log");const w=i||(d==null?void 0:d.log)||"";return s.jsxs("div",{className:"card panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx(Ot,{agent:n.agent,size:30}),s.jsxs("div",{className:"grow",children:[s.jsxs("div",{style:{fontWeight:600},children:[r," ",s.jsx(kn,{status:n.status})]}),s.jsx("div",{className:"muted small",children:Se[n.agent].description})]}),s.jsx(bn,{value:c,onChange:h,items:[{id:"log",label:"Log"},{id:"output",label:"Output"},{id:"perm",label:"Permissions"}]})]}),s.jsxs("div",{className:"panel-body",children:[c==="log"&&n.usage&&s.jsxs("div",{className:"muted small",style:{marginBottom:8},children:[n.usage.model??"model unknown"," · input ",ln(n.usage.inputTokens)," · output ",ln(n.usage.outputTokens)," · cache read"," ",ln(n.usage.cacheReadTokens)," · cache write ",ln(n.usage.cacheWriteTokens),n.costUsd!==null&&s.jsxs(s.Fragment,{children:[" · est. ",Gt(n.costUsd)]})]}),c==="log"&&s.jsx("pre",{className:"log",ref:m,onScroll:x=>{const y=x.currentTarget;p.current=y.scrollHeight-y.scrollTop-y.clientHeight<40},children:w?s.jsx(zT,{text:w}):n.status==="running"?"Waiting for output…":"(empty)"}),c==="output"&&s.jsx($T,{jobId:t.id,run:n,full:d,results:l,highlightResultId:a}),c==="perm"&&s.jsx("div",{children:n.allowedTools?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"muted small",children:["Headless Claude Code with ",s.jsx("code",{children:"--permission-mode dontAsk"}),": any action outside the allow list is denied."]}),s.jsx("h4",{children:"Allowed"}),s.jsx("div",{className:"perm",children:n.allowedTools.map(x=>s.jsx("code",{children:x},x))}),s.jsx("h4",{children:"Explicitly denied"}),s.jsx("div",{className:"perm",children:ST.map(x=>s.jsx("code",{className:"deny",children:x},x))})]}):s.jsx("p",{className:"muted",children:"Non-LLM agent: runs Playwright Test directly (no shell) and cannot write any file other than the report."})})]})]})}function zT({text:e}){const t=j.useMemo(()=>e.split(`
372
+ `}),n}function dm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function hm(e,t){const n=FE(e,t),r=n.one(e,void 0),i=LE(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
373
+ `},i),l}function VE(e,t){return e&&"run"in e?async function(n,r){const i=hm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return hm(n,{file:r,...e||t})}}function fm(e){if(e)throw e}var Ca=Object.prototype.hasOwnProperty,Av=Object.prototype.toString,pm=Object.defineProperty,mm=Object.getOwnPropertyDescriptor,gm=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Av.call(t)==="[object Array]"},xm=function(t){if(!t||Av.call(t)!=="[object Object]")return!1;var n=Ca.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ca.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Ca.call(t,i)},ym=function(t,n){pm&&n.name==="__proto__"?pm(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},vm=function(t,n){if(n==="__proto__")if(Ca.call(t,n)){if(mm)return mm(t,n).value}else return;return t[n]},QE=function e(){var t,n,r,i,l,a,o=arguments[0],u=1,c=arguments.length,h=!1;for(typeof o=="boolean"&&(h=o,o=arguments[1]||{},u=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=vm(o,n),i=vm(t,n),o!==i&&(h&&i&&(xm(i)||(l=gm(i)))?(l?(l=!1,a=r&&gm(r)?r:[]):a=r&&xm(r)?r:{},ym(o,{name:n,newValue:e(h,a,i)})):typeof i<"u"&&ym(o,{name:n,newValue:i}));return o};const Tu=pd(QE);function id(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function qE(){const e=[],t={run:n,use:r};return t;function n(...i){let l=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(u,...c){const h=e[++l];let d=-1;if(u){a(u);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,h?GE(h,o)(...c):a(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function GE(e,t){let n;return r;function r(...a){const o=e.length>a.length;let u;o&&a.push(i);try{u=e.apply(this,a)}catch(c){const h=c;if(o&&n)throw h;return i(h)}o||(u&&u.then&&typeof u.then=="function"?u.then(l,i):u instanceof Error?i(u):l(u))}function i(a,...o){n||(n=!0,t(a,...o))}function l(a){i(null,a)}}const En={basename:KE,dirname:YE,extname:JE,join:XE,sep:"/"};function KE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');El(e);let n=0,r=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else a<0&&(l=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function YE(e){if(El(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function JE(e){El(e);let t=e.length,n=-1,r=0,i=-1,l=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function XE(...e){let t=-1,n;for(;++t<e.length;)El(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":ZE(n)}function ZE(e){El(e);const t=e.codePointAt(0)===47;let n=eT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function eT(e,t){let n="",r=0,i=-1,l=0,a=-1,o,u;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||l===1))if(i!==a-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=a,l=0;continue}}else if(n.length>0){n="",r=0,i=a,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,l=0}else o===46&&l>-1?l++:l=-1}return n}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 ld(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function rT(e){if(typeof e=="string")e=new URL(e);else if(!ld(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return sT(e)}function sT(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Pu=["history","path","basename","stem","extname","dirname"];class Iv{constructor(t){let n;t?ld(t)?n={path:t}:typeof t=="string"||iT(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":tT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Pu.length;){const l=Pu[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)Pu.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?En.basename(this.path):void 0}set basename(t){Lu(t,"basename"),Ru(t,"basename"),this.path=En.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?En.dirname(this.path):void 0}set dirname(t){jm(this.basename,"dirname"),this.path=En.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?En.extname(this.path):void 0}set extname(t){if(Ru(t,"extname"),jm(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=En.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ld(t)&&(t=rT(t)),Lu(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?En.basename(this.path,this.extname):void 0}set stem(t){Lu(t,"stem"),Ru(t,"stem"),this.path=En.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Do(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ru(e,t){if(e&&e.includes(En.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+En.sep+"`")}function Lu(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jm(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function iT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lT=function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},aT={}.hasOwnProperty;class Bh extends lT{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=qE()}copy(){const t=new Bh;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Tu(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Du("data",this.frozen),this.namespace[t]=n,this):aT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Du("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=sa(t),r=this.parser||this.Parser;return Au("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Au("process",this.parser||this.Parser),Iu("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,a){const o=sa(t),u=r.parse(o);r.run(u,o,function(h,d,f){if(h||!d||!f)return c(h);const m=d,p=r.stringify(m,f);cT(p)?f.value=p:f.result=p,c(h,f)});function c(h,d){h||!d?a(h):l?l(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Au("processSync",this.parser||this.Parser),Iu("processSync",this.compiler||this.Compiler),this.process(t,i),km("processSync","process",n),r;function i(l,a){n=!0,fm(l),r=a}}run(t,n,r){wm(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(a,o){const u=sa(n);i.run(t,u,c);function c(h,d,f){const m=d||t;h?o(h):a?a(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),km("runSync","run",r),i;function l(a,o){fm(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=sa(n),i=this.compiler||this.Compiler;return Iu("stringify",i),wm(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Du("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...d]=c;u(h,d)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))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");o(c.plugins),c.settings&&(i.settings=Tu(!0,i.settings,c.settings))}function o(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const d=c[h];l(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,h){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...h]);else if(h.length>0){let[m,...p]=h;const g=r[f][1];id(g)&&id(m)&&(m=Tu(!0,g,m)),r[f]=[c,m,...p]}}}}const oT=new Bh().freeze();function Au(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Iu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Du(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wm(e){if(!id(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function km(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function sa(e){return uT(e)?e:new Iv(e)}function uT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cT(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",bm=[],Sm={allowDangerousHtml:!0},fT=/^(https?|ircs?|mailto|xmpp)$/i,pT=[{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:"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 ui(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,l=e.components,a=e.disallowedElements,o=e.rehypePlugins||bm,u=e.remarkPlugins||bm,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Sm}:Sm,h=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||mT,m=oT().use(YC).use(u).use(VE,c).use(o),p=new Iv;typeof r=="string"&&(p.value=r);for(const y of pT)Object.hasOwn(e,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+hT+y.id,void 0);const g=m.parse(p);let w=m.runSync(g,p);return i&&(w={type:"element",tagName:"div",properties:{className:i},children:w.type==="root"?w.children:[w]}),Fo(w,x),zS(w,{Fragment:s.Fragment,components:l,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function x(y,v,b){if(y.type==="raw"&&b&&typeof v=="number")return h?b.children.splice(v,1):b.children[v]={type:"text",value:y.value},v;if(y.type==="element"){let E;for(E in Nu)if(Object.hasOwn(Nu,E)&&Object.hasOwn(y.properties,E)){const k=y.properties[E],R=Nu[E];(R===null||R.includes(y.tagName))&&(y.properties[E]=f(String(k||""),E,y))}}if(y.type==="element"){let E=t?!t.includes(y.tagName):a?a.includes(y.tagName):!1;if(!E&&n&&typeof v=="number"&&(E=!n(y,v,b)),E&&b&&typeof v=="number")return d&&y.children?b.children.splice(v,1,...y.children):b.children.splice(v,1),v}}}function mT(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||n>-1&&t>n||r>-1&&t>r||fT.test(e.slice(0,t))?e:""}function gT(e,t){if(t<=7)return Array.from({length:t},(l,a)=>a+1);const n=[1],r=Math.max(2,e-1),i=Math.min(t-1,e+1);r>2&&n.push("…");for(let l=r;l<=i;l++)n.push(l);return i<t-1&&n.push("…"),n.push(t),n}function ps({page:e,pageSize:t,total:n,onPage:r,onPageSize:i,label:l="rows"}){const a=Math.max(1,Math.ceil(n/t)),o=n?(e-1)*t+1:0,u=Math.min(e*t,n);return s.jsxs("div",{className:"pagination",children:[s.jsx("span",{className:"muted small",children:n?`Showing ${o}–${u} of ${n} ${l}`:`0 ${l}`}),s.jsx("div",{className:"grow"}),s.jsxs("label",{className:"row small muted",style:{gap:6},children:["Rows per page",s.jsx("select",{className:"select sm",value:t,onChange:c=>i(Number(c.target.value)),"aria-label":"Rows per page",children:wb.map(c=>s.jsx("option",{value:c,children:c},c))})]}),s.jsxs("nav",{className:"pager","aria-label":"Pagination",children:[s.jsx("button",{className:"pg-btn",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"Previous page",children:s.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:s.jsx(ti,{size:14})})}),gT(e,a).map((c,h)=>c==="…"?s.jsx("span",{className:"pg-gap",children:"…"},`e${h}`):s.jsx("button",{className:`pg-btn ${c===e?"active":""}`,onClick:()=>r(c),"aria-current":c===e?"page":void 0,children:c},c)),s.jsx("button",{className:"pg-btn",onClick:()=>r(e+1),disabled:e>=a,"aria-label":"Next page",children:s.jsx(ti,{size:14})})]})]})}function Tl(e=[],t=_y){const[n,r]=j.useState(1),[i,l]=j.useState(t);return j.useEffect(()=>r(1),e),{page:n,setPage:r,pageSize:i,setPageSize:o=>{l(o),r(1)}}}function Hh(e,t=[],n=_y){const r=Tl(t,n),i=Math.max(1,Math.ceil(e.length/r.pageSize)),l=Math.min(r.page,i);return{pageItems:j.useMemo(()=>e.slice((l-1)*r.pageSize,l*r.pageSize),[e,l,r.pageSize]),props:{page:l,pageSize:r.pageSize,total:e.length,onPage:r.setPage,onPageSize:r.setPageSize}}}const Pl=(e,t)=>{var r;const n=bl(e);return n?((r=t.find(i=>i.id===n))==null?void 0:r.name)??`${e} (deleted)`:Ne[e].label},Wh=e=>bl(e)?"custom":e,xT={pending:"not started",running:"running",passed:"passed",out:"out of iterations",stopped:"stopped"};function yT({nodes:e,agents:t,selected:n,onSelect:r,waitingRunId:i,finished:l}){const a=u=>{if(u.kind==="agent")return s.jsx(Dv,{node:u,label:Pl(u.ref,t),selected:n,onSelect:r,waitingRunId:i??null,finished:l},u.key);const c=u.passes.reduce((d,f)=>d+f,0),h=u.passes.length>1?`${u.passes.join(" + ")} iterations (one number per pass of the outer loop)`:`${c} iteration${c===1?"":"s"}`;return s.jsxs("div",{className:`ptl-loop ${u.state}`,children:[s.jsxs("div",{className:"ptl-loop-head",children:[s.jsx(ls,{size:13}),s.jsxs("b",{children:["Loop ×",u.step.maxIterations]}),s.jsxs("span",{className:"muted",children:["· until ",u.step.endsWhen==="last"?"last":"first"," passes"]}),s.jsx("span",{className:`ptl-state ${u.state}`,children:xT[u.state]})]}),s.jsx("div",{className:"ptl-row",children:u.children.map((d,f)=>o(d,f))}),s.jsx("div",{className:`ptl-return ${c?"":"idle"}`,title:`Ran ${h}; at most ${u.step.maxIterations} per pass`,children:s.jsxs("span",{children:["↺ ×",c]})})]},u.key)},o=(u,c)=>s.jsxs(j.Fragment,{children:[c>0&&s.jsx("span",{className:"ptl-arrow","aria-hidden":"true",children:"→"}),a(u)]},u.key);return s.jsx("div",{className:"ptl",role:"tablist","aria-label":"Agents",children:e.map((u,c)=>o(u,c))})}function Dv({node:e,label:t,selected:n,onSelect:r,waitingRunId:i,finished:l}){const{runs:a}=e;if(!a.length)return s.jsxs("div",{className:"ptl-node ghost","aria-disabled":"true",title:l?"Skipped":"Not run yet",children:[s.jsx(Ft,{agent:Wh(e.ref),size:22}),s.jsx("span",{className:"ptl-name",children:t}),s.jsx("span",{className:`ptl-dot ${l?"skipped":"pending"}`})]});const o=a[a.length-1],u=a.some(h=>h.id===n),c=a.some(h=>h.id===i);return s.jsxs("div",{className:`ptl-node ${o.status} ${u?"selected":""} ${c?"waiting":""}`,children:[s.jsxs("button",{role:"tab","aria-selected":u,className:"ptl-main",onClick:()=>r((a.find(h=>h.id===n)??o).id),title:`${t} · ${a.length} run${a.length>1?"s":""}`,children:[s.jsx(Ft,{agent:o.agent,size:22}),s.jsx("span",{className:"ptl-name",children:t}),a.length>1&&s.jsxs("span",{className:"ptl-count",children:["×",a.length]})]}),s.jsx("span",{className:"ptl-runs",children:a.map((h,d)=>s.jsx("button",{type:"button",className:`ptl-dot ${h.id===i?"waiting":h.status} ${h.id===n?"on":""}`,onClick:()=>r(h.id),title:vT(h,t,d+1),"aria-label":`${t} run ${d+1}: ${h.status}`},h.id))}),a.length===1&&s.jsx("span",{className:"ptl-time",children:kr(o.startedAt,o.finishedAt)})]})}function vT(e,t,n){const r=e.usage;return[`${t} #${n}: ${e.status}`,kr(e.startedAt,e.finishedAt),e.turns!==null?`${e.turns} turns`:null,e.costUsd!==null?Kt(e.costUsd):null,r?`${ln(r.inputTokens+r.cacheReadTokens+r.cacheWriteTokens)} in / ${ln(r.outputTokens)} out`:null].filter(Boolean).join(" · ")}class Nm extends Error{}const jT=e=>e.ref??e.agent;function wT(e){return e.status==="passed"?!0:e.agent==="explorer"&&e.status==="failed"&&e.output!==null&&e.output!==void 0}function bs(e,t){return e.kind==="agent"?{kind:"ghost",key:t,ref:e.agent}:{kind:"loop",key:t,step:e,state:"pending",iterations:[e.steps.map((n,r)=>bs(ds(n),`${t}.${r}`))]}}function kT(e,t){let n=0;const r=(a,o)=>{const u=t[n];if(!u)return{node:{kind:"ghost",key:o,ref:a},flow:"open"};if(jT(u)!==a)throw new Nm;n++;const c=u.status!=="running"&&u.status!=="pending";return{node:{kind:"run",key:o,run:u},flow:c?wT(u)?"ok":"fail":"open"}},i=(a,o)=>a.kind==="agent"?r(a.agent,o):l(a,o),l=(a,o)=>{const u=a.steps.map(ds),c=a.endsWhen==="last",h=[],d=f=>({kind:"loop",key:o,step:a,iterations:h,state:f});if(n>=t.length)return{node:bs(a,o),flow:"open"};for(let f=0;f<a.maxIterations;f++){const m=[];h.push(m);const p=`${o}i${f}`,g=x=>u.slice(x).forEach((y,v)=>m.push(bs(y,`${p}.${x+v}`)));if(c){for(let x=0;x<u.length;x++){const y=i(u[x],`${p}.${x}`);if(m.push(y.node),y.flow==="open")return g(x+1),{node:d("running"),flow:"open"};if(y.flow==="stop")return{node:d("stopped"),flow:"stop"};const v=x===u.length-1;if(v&&y.flow==="ok")return{node:d("passed"),flow:"ok"};if(!v&&y.flow==="fail")return{node:d("stopped"),flow:"stop"}}if(f<a.maxIterations-1&&n>=t.length)return h.push(u.map((x,y)=>bs(x,`${o}i${f+1}.${y}`))),{node:d("running"),flow:"open"};continue}const w=i(u[0],`${p}.0`);if(m.push(w.node),w.flow==="open")return{node:d("running"),flow:"open"};if(w.flow==="stop")return{node:d("stopped"),flow:"stop"};if(w.flow==="ok")return{node:d("passed"),flow:"ok"};if(f===a.maxIterations-1)break;for(let x=1;x<u.length;x++){const y=i(u[x],`${p}.${x}`);if(m.push(y.node),y.flow==="open")return g(x+1),{node:d("running"),flow:"open"};if(y.flow!=="ok")return{node:d("stopped"),flow:"stop"}}if(n>=t.length)return h.push([bs(u[0],`${o}i${f+1}.0`)]),{node:d("running"),flow:"open"}}return{node:d("out"),flow:"fail"}};try{const a=[];let o=!1;return e.forEach((u,c)=>{if(o){a.push(bs(u,`b${c}`));return}const h=i(u,`b${c}`);a.push(h.node),h.flow!=="ok"&&(o=!0)}),n===t.length?a:null}catch(a){if(a instanceof Nm)return null;throw a}}const Mv=e=>e.some(t=>t.kind==="run"||t.kind==="loop"&&t.iterations.some(Mv));function zv(e){const t=e[0];if(t.kind!=="loop"){const a=t.kind==="run"?t.run.ref??t.run.agent:t.ref;return{kind:"agent",key:t.key,ref:a,runs:e.flatMap(o=>o.kind==="run"?[o.run]:[])}}const n=e.filter(a=>a.kind==="loop"),r=t.step.steps.length,i=[];for(let a=0;a<r;a++){const o=n.flatMap(u=>u.iterations.flatMap(c=>c[a]?[c[a]]:[]));o.length&&i.push(zv(o))}const l=n[n.length-1];return{kind:"loop",key:t.key,step:t.step,state:l.state,passes:n.map(a=>a.iterations.filter(Mv).length),children:i}}function bT(e){return e.map(t=>zv([t]))}const ST=["Read(.env)","Read(**/.env)","Read(.env.local)","Read(**/.env.local)","WebFetch","WebSearch"];function NT(e,t){const n=Ao[e].filter(i=>!ao(e)||!Ch.includes(i));let r=0;for(const i of t)i.agent===n[r]&&r++;return n.slice(r)}function CT(e,t){const n=o=>o.ref??o.agent,r=(o,u)=>({kind:"agent",key:u,agent:Wh(o),name:Pl(o,e.agents),description:o.startsWith("custom:")?"Custom agent":Ne[o].description}),i=(o,u)=>o.kind==="agent"?r(o.agent,u):{kind:"loop",key:u,maxIterations:o.maxIterations,items:o.steps.map((c,h)=>i(ds(c),`${u}-${h}`))},l=[];let a=0;return e.pipeline.steps.forEach((o,u)=>{if(o.kind==="agent"){a<t.length?a++:l.push(i(o,`s${u}`));return}if(a<t.length){const c=new Set(Io([o]));for(;a<t.length&&c.has(n(t[a]));)a++;return}l.push(i(o,`s${u}`))}),l}const ao=e=>e==="generate"||e==="heal";function ET(e,t){if(!ao(e.type))return{linear:t,loop:[]};const n=t.findIndex(r=>Ch.includes(r.agent));return n<0?{linear:t,loop:[]}:{linear:t.slice(0,n),loop:t.slice(n)}}function Cm(e,t){const n=t.filter(i=>i.agent===e.agent&&i.label===e.label),r=Wy(e);return n.length>1?`${r} #${n.indexOf(e)+1}`:r}function TT(){var tt;const e=Number(li().id),t=ut(),[n]=xh(),r=n.get("result")?Number(n.get("result")):null,{refresh:i}=Zt(),{job:l,runs:a,results:o,pipeline:u,pending:c,logs:h,error:d,refetch:f,reconnect:m}=eb(e),p=(l==null?void 0:l.status)==="waiting"?c:null,[g,w]=j.useState(null),x=j.useRef(!1),y=j.useRef(!1),[v,b]=j.useState(null);if(j.useEffect(()=>{if(x.current||a.length===0)return;const W=a.find(ge=>ge.status==="running");w((W??a[a.length-1]).id)},[a]),j.useEffect(()=>{if(y.current||!r||o.length===0)return;const W=o.find(ge=>ge.id===r);W!=null&&W.agentRunId&&(x.current=!0,y.current=!0,w(W.agentRunId))},[r,o]),j.useEffect(()=>{p&&(x.current=!0,w(p.runId))},[p==null?void 0:p.runId]),j.useEffect(()=>{l&&Hc.includes(l.status)&&i()},[l==null?void 0:l.status]),!Number.isInteger(e)||e<=0)return s.jsx(Le,{error:"Invalid job id"});const E=a.find(W=>W.id===g)??null,k=l&&l.type in Ao?NT(l.type,a):[],R=l?Hc.includes(l.status):!1,T=(l==null?void 0:l.type)==="pipeline"&&u?kT(u.pipeline.steps,a):null,D=(l==null?void 0:l.type)==="pipeline"&&u&&!T?CT(u,a):[],C=(l==null?void 0:l.args.maxHealRounds)??kb.maxHealRounds,{linear:L,loop:A}=l?ET(l,a):{linear:a,loop:[]},z=A.filter(W=>W.agent==="healer").length,U=(l==null?void 0:l.type)==="heal"?["healer","validator"]:["validator","healer"],I=A[A.length-1],Q=I?R?I.agent==="validator"&&I.status==="passed"?"passed":z>=C?"out":"stopped":"running":"pending",J=W=>{x.current=!0,w(W)},B=W=>s.jsx(AT,{run:W,label:Cm(W,a),selected:g===W.id,waiting:(p==null?void 0:p.runId)===W.id,onSelect:()=>J(W.id)},W.id),X=(W,ge,V,de,ve)=>s.jsx(IT,{agent:W,finished:R,note:V,name:de,description:ve},ge),S=W=>W.kind==="agent"?X(W.agent,W.key,void 0,W.name,W.description):s.jsxs("div",{className:"loop-group idle","aria-label":`Loop ×${W.maxIterations}`,children:[s.jsxs("div",{className:"loop-head",children:[s.jsx(ls,{size:14}),s.jsxs("span",{children:["Loop ×",W.maxIterations]})]}),s.jsx("div",{className:"loop-body",children:W.items.map((ge,V)=>s.jsxs(j.Fragment,{children:[V>0&&s.jsx("span",{className:"connector"}),S(ge)]},ge.key))})]},W.key),ae=a.some(W=>{var ge;return W.agent==="runner"&&((ge=W.output)==null?void 0:ge.htmlReport)}),O=async W=>{if(!l)return;const ge=o.filter(ve=>(ve.status==="failed"||ve.status==="flaky")&&ve.specFile&&ve.tcId).map(ve=>({spec:ve.specFile,tcId:ve.tcId})),V=`${l.args.name??`Test run #${l.id}`} (${W?"failed re-run":"re-run"})`;if(!l.args.selection&&!W){try{const ve=await q.createJob({type:"testrun",name:V,...l.target!=="all"?{spec:l.target}:{},...l.args.tcId?{tcId:l.args.tcId}:{},repeatEach:l.args.repeatEach??1,...l.args.retries!==void 0?{retries:l.args.retries}:{},htmlReport:l.args.htmlReport});t(`/runs/${ve.id}`)}catch(ve){b(ve.message)}return}let de=l.args.selection??ge;if(W){const ve=new Set(ge.map(ct=>`${ct.spec}#${ct.tcId}`));de=de.filter(ct=>ve.has(`${ct.spec}#${ct.tcId}`))}de=[...new Map(de.map(ve=>[`${ve.spec}#${ve.tcId}`,ve])).values()],t("/test-runs/new",{state:{name:V,selection:de,retries:l.args.retries}})},N=o.some(W=>W.status==="failed"||W.status==="flaky"),F=async()=>{b(null);try{await q.rerunFailedJob(e),m()}catch(W){b(W.message)}},Z=async()=>{try{const W=await q.createJob({type:"generate",spec:l.target});t(`/runs/${W.id}`)}catch(W){b(W.message)}},ce=l&&(l.type==="testrun"||l.type==="heal"||l.type==="generate")&&R?[...new Set(o.filter(W=>W.status==="failed"&&W.specFile).map(W=>W.specFile))]:[],Te=async W=>{try{const ge=await q.createJob({type:"heal",spec:W,sourceJobId:e});t(`/runs/${ge.id}`)}catch(ge){b(ge.message)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Recent runs",to:"/runs"},{label:`Job #${e}`}]}),s.jsx(Le,{error:d??v}),l&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"row between",style:{marginBottom:6},children:[s.jsxs("div",{className:"row",children:[s.jsxs("h1",{className:"page-title",children:[br[l.type]," ·"," ",l.type==="testrun"?l.args.name:l.type==="context"?s.jsx(ye,{to:"/project",children:"CLAUDE.md"}):l.type==="custom"||l.type==="pipeline"?[l.type==="pipeline"?l.args.pipelineName:l.args.customAgentName,l.target.endsWith(".md")?l.target:null].filter(Boolean).join(" · ")||l.target:l.target.endsWith(".md")?s.jsx(ye,{to:`/specs/${l.target}`,children:l.target}):l.target]}),s.jsx(An,{status:l.status})]}),s.jsxs("div",{className:"row",children:[ae&&s.jsxs("a",{className:"btn ghost",href:yh(e),target:"_blank",rel:"noreferrer",title:"Playwright HTML report (new tab)",children:[s.jsx(Sh,{size:14})," HTML report"]}),l.type==="testrun"&&R&&s.jsxs(s.Fragment,{children:[N&&s.jsxs("button",{className:"btn ghost",onClick:()=>void O(!0),title:"New test run with only the failed test cases",children:[s.jsx(ft,{size:14})," Re-run failed"]}),s.jsxs("button",{className:"btn ghost",onClick:()=>void O(!1),title:"New test run with the same test cases",children:[s.jsx(ft,{size:14})," Re-run"]})]}),(l.type==="pipeline"||l.type==="generate"||l.type==="heal")&&(l.status==="failed"||l.status==="cancelled"||l.status==="interrupted")&&s.jsxs("button",{className:"btn ghost",onClick:()=>void F(),title:"Run this job again from the step that stopped it: the earlier steps are not run again, their outputs are reused",children:[s.jsx(ft,{size:14})," Re-run failed"]}),l.type==="context"&&l.status==="passed"&&s.jsxs(ye,{className:"btn ghost",to:"/project",children:[s.jsx(jr,{size:15})," View CLAUDE.md"]}),l.type==="spec"&&l.status==="passed"&&s.jsxs(s.Fragment,{children:[s.jsxs(ye,{className:"btn ghost",to:`/specs/${l.target}`,children:[s.jsx(jr,{size:15})," Open spec"]}),s.jsxs("button",{className:"btn",onClick:()=>void Z(),title:"QA Explorer → QA Script Generator → QA Validator ⇄ QA Script Healer on the new spec",children:[s.jsx(wh,{size:15})," Generate tests"]})]}),ce.map(W=>s.jsxs("button",{className:"btn",onClick:()=>void Te(W),title:"QA Script Healer fixes the scripts of failing tests, then QA Validator re-runs them",children:[s.jsx(Ry,{size:15})," Heal ",W]},W)),!R&&s.jsxs("button",{className:"btn danger",onClick:()=>void q.cancelJob(e).catch(W=>b(W.message)),children:[s.jsx(Iy,{size:14})," Cancel"]})]})]}),s.jsxs("div",{className:"muted small",style:{marginBottom:14},children:["Started ",Rt(l.startedAt??l.createdAt)," · ",kr(l.startedAt,l.finishedAt),l.args.tcId&&` · ${l.args.tcId}`,l.args.repeatEach&&` · repeat ${l.args.repeatEach}×`,l.args.retries!==void 0&&` · retries ${l.args.retries}`,l.args.selection&&` · ${l.args.selection.length} test case${l.args.selection.length===1?"":"s"}`,l.type==="testrun"&&(l.args.htmlReport?" · line + HTML report":" · line report"),ao(l.type)&&` · max ${C} heal round${C===1?"":"s"}`,l.args.sourceJobId&&s.jsxs(s.Fragment,{children:[" ","· from ",s.jsxs(ye,{to:`/runs/${l.args.sourceJobId}`,children:["job #",l.args.sourceJobId]})]}),l.summary&&s.jsxs(s.Fragment,{children:[" · ",l.summary]})]}),l.warning&&s.jsxs("div",{className:"warn-box",children:["⚠ ",l.warning]}),T&&u?s.jsx(yT,{nodes:bT(T),agents:u.agents,selected:g,onSelect:J,waitingRunId:(p==null?void 0:p.runId)??null,finished:R}):s.jsxs("div",{className:"timeline",role:"tablist","aria-label":"Agents",children:[L.map((W,ge)=>s.jsxs(j.Fragment,{children:[ge>0&&s.jsx("span",{className:`connector ${L[ge-1].status==="passed"?"done":""}`}),B(W)]},W.id)),k.map((W,ge)=>s.jsxs(j.Fragment,{children:[(L.length>0||ge>0)&&s.jsx("span",{className:"connector"}),X(W,`g-${W}-${ge}`)]},`ghost-${W}-${ge}`)),D.map((W,ge)=>s.jsxs(j.Fragment,{children:[(L.length>0||ge>0)&&s.jsx("span",{className:"connector"}),S(W)]},W.key)),ao(l.type)&&s.jsxs(s.Fragment,{children:[(L.length>0||k.length>0)&&s.jsx("span",{className:`connector ${((tt=L[L.length-1])==null?void 0:tt.status)==="passed"?"done":""}`}),s.jsxs("div",{className:`ptl-loop ${Q}`,"aria-label":"Validator and Healer loop",children:[s.jsxs("div",{className:"ptl-loop-head",children:[s.jsx(ls,{size:13}),s.jsx("b",{children:"Validate ⇄ Heal loop"}),s.jsxs("span",{className:"muted",children:["· max ",C]}),s.jsxs("span",{className:`ptl-state ${Q}`,title:"Healer rounds used / maximum (Settings)",children:["heal round ",z,"/",C]})]}),s.jsx("div",{className:"ptl-row",children:U.map((W,ge)=>{const V=A.filter(de=>de.agent===W);return s.jsxs(j.Fragment,{children:[ge>0&&s.jsx("span",{className:"ptl-arrow","aria-hidden":"true",children:"→"}),s.jsx(Dv,{node:{kind:"agent",key:`loop-${W}`,ref:W,runs:V},label:V[0]?Wy(V[0]):Ne[W].label,selected:g,onSelect:J,waitingRunId:(p==null?void 0:p.runId)??null,finished:R})]},W)})}),s.jsx("div",{className:`ptl-return ${z?"":"idle"}`,title:`QA Validator fails → QA Script Healer fixes → back to QA Validator. Stops when tests pass, the QA Script Healer reports an app bug or gives up, or after ${C} heal round${C===1?"":"s"}.`,children:s.jsxs("span",{children:["↺ ×",z]})})]})]})]}),p&&s.jsx(LT,{jobId:e,label:p.label,questions:p.questions??[],onDone:()=>void f()},`review-${p.runId}`),E?s.jsx(DT,{jobId:e,job:l,run:E,label:Cm(E,a),log:h[E.id]??"",results:o.filter(W=>W.agentRunId===E.id),highlightResultId:r,reviewing:(p==null?void 0:p.runId)===E.id},E.id):s.jsx("div",{className:"card pad muted",children:"Waiting for the first agent to start…"})]})]})}const _s=-1,PT=e=>Object.fromEntries(e.map(t=>[t.id,Math.max(t.options.findIndex(n=>n.recommended),t.options.length?0:_s)]));function RT({questions:e,choice:t,other:n,onChoice:r,onOther:i}){return s.jsx("ol",{className:"question-list",children:e.map(l=>s.jsx("li",{className:"question",children:s.jsxs("fieldset",{children:[s.jsx("legend",{children:l.question}),l.options.map((a,o)=>s.jsxs("label",{className:`question-option ${t[l.id]===o?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${l.id}`,checked:t[l.id]===o,onChange:()=>r(l.id,o)}),s.jsxs("span",{children:[s.jsx("b",{children:a.label}),a.recommended&&s.jsx("span",{className:"chip ok small",children:"Recommended"}),a.description&&s.jsx("span",{className:"muted small question-desc",children:a.description})]})]},o)),s.jsxs("label",{className:`question-option ${t[l.id]===_s?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${l.id}`,checked:t[l.id]===_s,onChange:()=>r(l.id,_s)}),s.jsxs("span",{className:"question-other",children:[s.jsx("b",{children:"Other"}),s.jsx("input",{className:"input",maxLength:Nb,placeholder:"Type your answer",value:n[l.id]??"",onFocus:()=>r(l.id,_s),onChange:a=>i(l.id,a.target.value),"aria-label":`Other answer to: ${l.question}`})]})]})]})},l.id))})}function LT({jobId:e,label:t,questions:n,onDone:r}){const i=In(),[l,a]=j.useState(()=>PT(n)),[o,u]=j.useState({}),c=n.length>0,h=n.map(v=>{var b;return{id:v.id,answer:l[v.id]===_s?(o[v.id]??"").trim():((b=v.options[l[v.id]])==null?void 0:b.label)??""}}),d=h.filter(v=>!v.answer).length,[f,m]=j.useState(""),[p,g]=j.useState(!1),[w,x]=j.useState(null),y=async v=>{g(!0);try{await v(),r()}catch(b){x(b.message)}finally{g(!1)}};return s.jsxs("div",{className:"review-panel",role:"region","aria-label":"Review",children:[s.jsx("b",{children:c?`${t} has ${n.length} question${n.length>1?"s":""} for you.`:`${t} is waiting for your review.`}),s.jsx("span",{className:"muted small",children:c?`Pick an option or type your own answer. Sending runs ${t} again with your answers. Reject ends the pipeline.`:"Approve to continue the pipeline with this result. Reject ends the pipeline."}),c&&s.jsx(RT,{questions:n,choice:l,other:o,onChoice:(v,b)=>a(E=>({...E,[v]:b})),onOther:(v,b)=>u(E=>({...E,[v]:b}))}),s.jsx("textarea",{className:"input",rows:2,maxLength:jb,placeholder:"Reason (optional, saved with a rejection)",value:f,onChange:v=>m(v.target.value),"aria-label":"Reject reason"}),s.jsx(Le,{error:w}),s.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[s.jsx("button",{className:"btn danger",disabled:p,onClick:async()=>{await i({title:`Reject the output of ${t}?`,message:"The pipeline ends here and the job is marked failed.",confirmLabel:"Reject",danger:!0})&&await y(()=>q.rejectJob(e,f.trim()||void 0))},children:"Reject"}),c?s.jsx("button",{className:"btn",disabled:p||d>0,title:d?'Type an answer for every "Other"':void 0,onClick:()=>void y(()=>q.answerJob(e,h)),children:"Send answers"}):s.jsx("button",{className:"btn",disabled:p,onClick:()=>void y(()=>q.approveJob(e)),children:"Approve"})]})]})}function AT({run:e,label:t,selected:n,waiting:r,onSelect:i}){const l=e.usage,a=r?"waiting":e.status,o=[`${t}: ${a}`,kr(e.startedAt,e.finishedAt),e.turns!==null?`${e.turns} turns`:null,e.costUsd!==null?Kt(e.costUsd):null,l?`${ln(l.inputTokens+l.cacheReadTokens+l.cacheWriteTokens)} in / ${ln(l.outputTokens)} out`:null].filter(Boolean).join(" · ");return s.jsxs("div",{className:`ptl-node ${e.status} ${n?"selected":""} ${r?"waiting":""}`,children:[s.jsxs("button",{role:"tab","aria-selected":n,className:"ptl-main",onClick:i,title:o,children:[s.jsx(Ft,{agent:e.agent,size:22}),s.jsx("span",{className:"ptl-name",children:t}),s.jsx("span",{className:`ptl-dot ${a}`,"aria-label":a})]}),s.jsx("span",{className:"ptl-time",children:kr(e.startedAt,e.finishedAt)})]})}function IT({agent:e,finished:t,note:n,name:r,description:i}){const l=r??Ne[e].label;return s.jsxs("div",{className:"ptl-node ghost","aria-disabled":"true",title:`${l}: ${t?"skipped":"not run yet"} · ${n??i??Ne[e].description}`,children:[s.jsx(Ft,{agent:e,size:22}),s.jsx("span",{className:"ptl-name",children:l}),s.jsx("span",{className:`ptl-dot ${t?"skipped":"pending"}`})]})}function DT({jobId:e,job:t,run:n,label:r,log:i,results:l,highlightResultId:a,reviewing:o}){const u=!!a&&l.some(x=>x.id===a),[c,h]=j.useState(u||o?"output":"log");j.useEffect(()=>{o&&h("output")},[o]);const[d,f]=j.useState(null),m=j.useRef(null),p=j.useRef(!0),g=!["running","pending"].includes(n.status);j.useEffect(()=>{g&&q.agentRun(e,n.id).then(f).catch(()=>{})},[e,n.id,g]),j.useEffect(()=>{const x=m.current;x&&p.current&&(x.scrollTop=x.scrollHeight)},[i,c]),FT(m,c==="log");const w=i||(d==null?void 0:d.log)||"";return s.jsxs("div",{className:"card panel",children:[s.jsxs("div",{className:"panel-head",children:[s.jsx(Ft,{agent:n.agent,size:30}),s.jsxs("div",{className:"grow",children:[s.jsxs("div",{style:{fontWeight:600},children:[r," ",s.jsx(An,{status:n.status})]}),s.jsx("div",{className:"muted small",children:Ne[n.agent].description})]}),s.jsx(kn,{value:c,onChange:h,items:[{id:"log",label:"Log"},{id:"output",label:"Output"},{id:"perm",label:"Permissions"}]})]}),s.jsxs("div",{className:"panel-body",children:[c==="log"&&n.usage&&s.jsxs("div",{className:"muted small",style:{marginBottom:8},children:[n.usage.model??"model unknown"," · input ",ln(n.usage.inputTokens)," · output ",ln(n.usage.outputTokens)," · cache read"," ",ln(n.usage.cacheReadTokens)," · cache write ",ln(n.usage.cacheWriteTokens),n.costUsd!==null&&s.jsxs(s.Fragment,{children:[" · est. ",Kt(n.costUsd)]})]}),c==="log"&&s.jsx("pre",{className:"log",ref:m,onScroll:x=>{const y=x.currentTarget;p.current=y.scrollHeight-y.scrollTop-y.clientHeight<40},children:w?s.jsx(MT,{text:w}):n.status==="running"?"Waiting for output…":"(empty)"}),c==="output"&&s.jsx(_T,{jobId:t.id,run:n,full:d,results:l,highlightResultId:a}),c==="perm"&&s.jsx("div",{children:n.allowedTools?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"muted small",children:["Headless Claude Code with ",s.jsx("code",{children:"--permission-mode dontAsk"}),": any action outside the allow list is denied."]}),s.jsx("h4",{children:"Allowed"}),s.jsx("div",{className:"perm",children:n.allowedTools.map(x=>s.jsx("code",{children:x},x))}),s.jsx("h4",{children:"Explicitly denied"}),s.jsx("div",{className:"perm",children:ST.map(x=>s.jsx("code",{className:"deny",children:x},x))})]}):s.jsx("p",{className:"muted",children:"Non-LLM agent: runs Playwright Test directly (no shell) and cannot write any file other than the report."})})]})]})}function MT({text:e}){const t=j.useMemo(()=>e.split(`
374
374
  `),[e]);return s.jsx(s.Fragment,{children:t.map((n,r)=>{const i=/^\s*▶/.test(n)?"l-tool":/^\s*←/.test(n)?"l-ok":/^\s*✗|^\[(error|launch error)|^\[denied\]|✘|^\s*\d+\) \S|^\s*\d+ (failed|flaky)\b/.test(n)?"l-err":/^\[claude\]|^\[done\]|^⚠|^\$ /.test(n)?"l-meta":"";return s.jsxs("span",{className:i,children:[n,`
375
- `]},r)})})}function la({before:e,after:t}){const n=j.useMemo(()=>mb(e,t),[e,t]);return n.some(r=>r.type!=="same")?s.jsx("pre",{className:"diff",children:n.map((r,i)=>s.jsxs("div",{className:r.type==="same"?"":r.type,children:[r.type==="add"?"+ ":r.type==="del"?"- ":" ",r.text]},i))}):s.jsx("p",{className:"muted",children:"Test file unchanged."})}function _T({results:e,highlightId:t}){const n=Hh(e),r=j.useRef(null),i=j.useRef(!1);return j.useEffect(()=>{if(!t)return;const l=e.findIndex(o=>o.id===t);if(l<0)return;const a=Math.floor(l/n.props.pageSize)+1;a!==n.props.page&&n.props.onPage(a)},[t,e,n.props.pageSize]),j.useEffect(()=>{t&&r.current&&!i.current&&(r.current.scrollIntoView({behavior:"smooth",block:"center"}),i.current=!0)},[t,n.pageItems]),s.jsxs("div",{className:"table-wrap",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"TC"}),s.jsx("th",{children:"Test"}),s.jsx("th",{children:"Status"}),s.jsx("th",{className:"num",children:"ms"}),s.jsx("th",{children:"Error"})]})}),s.jsx("tbody",{children:n.pageItems.map(l=>s.jsxs("tr",{ref:l.id===t?r:void 0,className:l.id===t?"row-highlight":void 0,children:[s.jsx("td",{children:l.tcId?s.jsx("code",{children:l.tcId}):"—"}),s.jsxs("td",{children:[l.title,s.jsx("div",{className:"muted small",children:l.testFile})]}),s.jsx("td",{children:s.jsx(dt,{status:l.status})}),s.jsx("td",{className:"num",children:l.durationMs}),s.jsxs("td",{style:{maxWidth:440},children:[l.error&&s.jsx("pre",{className:"mono",style:{margin:0,whiteSpace:"pre-wrap",color:"var(--fail)",maxHeight:140,overflow:"auto"},children:l.error}),l.attachments.filter(a=>a.name==="trace"&&a.path).map(a=>s.jsxs("div",{className:"muted small",children:["Trace: ",s.jsxs("code",{children:['npx playwright show-trace "',a.path,'"']})]},a.path))]})]},l.id))})]}),s.jsx(ps,{...n.props,label:"results"})]})}function Em({jobId:e}){const[t,n]=j.useState(null);return j.useEffect(()=>{q.jobRequirement(e).then(r=>n(r.requirement)).catch(()=>n(null))},[e]),t?s.jsxs("details",{style:{marginTop:12},children:[s.jsxs("summary",{children:["BA requirement (",t.length.toLocaleString()," characters)"]}),s.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",maxHeight:320,overflow:"auto",marginTop:8},children:t})]}):null}function $T({jobId:e,run:t,full:n,results:r,highlightResultId:i}){var a,o,u,c,h,d,f,m;if(t.status==="running"||t.status==="pending")return s.jsx("p",{className:"muted",children:"Agent is running; output will be available when it finishes."});if(t.agent==="custom"&&t.output){const p=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(dt,{status:p.status==="passed"?"passed":"failed"})," ",p.summary]}),s.jsx("div",{className:"md",children:s.jsx(ui,{children:p.details})}),!!((a=p.questions)!=null&&a.length)&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Questions asked"}),s.jsx("ol",{children:p.questions.map(g=>s.jsxs("li",{children:[g.question,s.jsx("ul",{children:g.options.map((w,x)=>s.jsxs("li",{children:[w.label,w.recommended?" (recommended)":"",w.description?s.jsxs("span",{className:"muted",children:[" · ",w.description]}):null]},x))})]},g.id))})]}),!!((o=p.answered)!=null&&o.length)&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Your answers"}),s.jsx("ol",{children:p.answered.map(g=>s.jsxs("li",{children:[g.question,s.jsx("br",{}),"→ ",s.jsx("b",{children:g.answer})]},g.id))})]})]})}if(t.agent==="validator"||t.agent==="runner"){const p=t.output;return s.jsxs("div",{children:[p&&s.jsxs("p",{className:"row",children:[s.jsx(dt,{status:p.passed?"passed":"failed"}),Object.entries(p.counts).map(([g,w])=>s.jsxs("span",{className:"row",style:{gap:4},children:[s.jsx(dt,{status:g,children:w})," ",g]},g)),s.jsx("code",{className:"muted",children:p.command}),p.htmlReport&&s.jsxs("a",{href:yh(t.jobId),target:"_blank",rel:"noreferrer",children:[s.jsx(Sh,{size:13})," Open HTML report"]})]}),!p&&s.jsx("p",{className:"muted",children:"No report."}),r.length>0&&s.jsx(_T,{results:r,highlightId:i})]})}if(!t.output)return s.jsxs("div",{children:[s.jsx("p",{className:"muted",children:"The agent did not write a result file. See the Log tab for details."}),t.agent==="specwriter"&&s.jsx(Em,{jobId:e})]});if(t.agent==="contextwriter"){const p=t.output,g=(w,x)=>x!=null&&x.length?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:s.jsx("ul",{style:{margin:0,paddingLeft:18},children:x.map((y,v)=>s.jsx("li",{children:y},v))})})]}):null;return s.jsxs("div",{children:[s.jsx("p",{children:p.summary}),s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[g("Added / updated",p.added),g("Removed (old project)",p.removed),g("Notes added",p.notes),g("Security issues (notes not applied)",Array.isArray(p.security)?p.security.map(w=>typeof w=="string"?w:`"${w.note}" (${w.reason})`):void 0),g("Check these",p.warnings),p.failure?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Failed because"}),s.jsx("dd",{children:p.failure})]}):null]}),n?s.jsx(la,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}if(t.agent==="specwriter"){const p=t.output,g=(w,x)=>x!=null&&x.length?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:s.jsx("ul",{style:{margin:0,paddingLeft:18},children:x.map((y,v)=>s.jsx("li",{children:y},v))})})]}):null;return s.jsxs("div",{children:[s.jsx("p",{children:p.summary}),s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[s.jsx("dt",{children:"Spec"}),s.jsx("dd",{children:s.jsx(ye,{to:`/specs/${p.specFile}`,children:s.jsxs("code",{children:["specs/",p.specFile]})})}),s.jsx("dt",{children:"Test cases"}),s.jsx("dd",{children:(u=p.tcIds)==null?void 0:u.map(w=>s.jsx("code",{style:{marginRight:6},children:w},w))}),g("Assumptions",p.assumptions),g("Questions for the BA",p.questions)]}),n?s.jsx(la,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading spec…"}),s.jsx(Em,{jobId:e})]})}if(t.agent==="explorer"){const p=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(dt,{status:p.status})," ",p.summary]}),((c=p.environment)==null?void 0:c.ready)===!1&&s.jsxs("div",{className:"warn-box",style:{marginBottom:12},children:[s.jsx("b",{children:"Environment/setup not ready, pipeline stopped:"}),s.jsx("ul",{style:{margin:"6px 0 0"},children:((h=p.environment.issues)!=null&&h.length?p.environment.issues:["no details"]).map((g,w)=>s.jsx("li",{children:g},w))})]}),((d=p.environment)==null?void 0:d.ready)!==!1&&p.cases.some(g=>g.status==="failed")&&s.jsxs("p",{className:"muted small",children:["Failed cases: ",p.cases.filter(g=>g.status==="failed").map(g=>g.id).join(", ")," (possible app bugs). A Generate job does not stop here: it still writes their tests, asserting the expected result."]}),s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Case"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Evidence"})]})}),s.jsx("tbody",{children:p.cases.map(g=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{children:g.id})}),s.jsx("td",{children:s.jsx(dt,{status:g.status})}),s.jsx("td",{className:"small",style:{whiteSpace:"pre-wrap"},children:g.evidence})]},g.id))})]})}),p.assertions.length>0&&s.jsxs("details",{style:{marginTop:12},children:[s.jsxs("summary",{children:["Verified assertions (",p.assertions.length,")"]}),s.jsx("div",{className:"table-wrap",style:{marginTop:8},children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Case"}),s.jsx("th",{children:"Expression"}),s.jsx("th",{children:"Expected"}),s.jsx("th",{children:"Observed"})]})}),s.jsx("tbody",{children:p.assertions.map((g,w)=>s.jsxs("tr",{children:[s.jsx("td",{children:g.case}),s.jsx("td",{children:s.jsx("code",{style:{whiteSpace:"pre-wrap"},children:g.expression})}),s.jsx("td",{className:"small",children:g.expected}),s.jsx("td",{className:"small",children:g.observed})]},w))})]})})]}),p.bugs.length>0&&s.jsxs("div",{className:"warn-box",children:[s.jsx("b",{children:"Potential bugs:"}),s.jsx("ul",{style:{margin:"6px 0 0"},children:p.bugs.map((g,w)=>s.jsx("li",{children:g},w))})]})]})}if(t.agent==="generator"){const p=t.output;return s.jsxs("div",{children:[s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[s.jsx("dt",{children:"File test"}),s.jsx("dd",{children:s.jsx("code",{children:p.testFile})}),s.jsx("dt",{children:"Test case"}),s.jsx("dd",{children:(f=p.tcIds)==null?void 0:f.map(g=>s.jsx("code",{style:{marginRight:6},children:g},g))}),p.pomChanges&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Page Object"}),s.jsx("dd",{children:p.pomChanges})]}),p.notes&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Notes"}),s.jsx("dd",{children:p.notes})]})]}),n?s.jsx(la,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}const l=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(dt,{status:l.outcome})," ",l.diagnosis]}),((m=l.changes)==null?void 0:m.length)>0&&s.jsx("ul",{children:l.changes.map((p,g)=>s.jsx("li",{children:p},g))}),n?s.jsx(la,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}const OT=32,FT=240;function UT(e,t){j.useEffect(()=>{const n=e.current;if(!t||!n)return;const r=n.closest(".content"),i=r&&getComputedStyle(r).overflowY!=="visible"?r:null,l=()=>{const u=n.getBoundingClientRect(),c=i?i.clientHeight-(u.top-i.getBoundingClientRect().top+i.scrollTop):window.innerHeight-(u.top+window.scrollY);n.style.maxHeight=`${Math.max(FT,Math.floor(c-OT))}px`};l(),window.addEventListener("resize",l);const a=typeof ResizeObserver>"u"?null:new ResizeObserver(l),o=(i??document.body).firstElementChild;return a&&o&&a.observe(o),()=>{window.removeEventListener("resize",l),a==null||a.disconnect(),n.style.maxHeight=""}},[e,t])}const BT=["all","mapped","missing","stale","orphan"],Mu=e=>e.charAt(0).toUpperCase()+e.slice(1);function HT(){const e=ut(),{specs:t,refresh:n}=Xt(),[r,i]=j.useState("all"),[l,a]=j.useState(""),[o,u]=j.useState(null),c=Pl([r,l]),{data:h,error:d,reload:f}=Me(()=>q.mappingPage({page:c.page,pageSize:c.pageSize,status:r==="all"?void 0:r,spec:l||void 0}),[c.page,c.pageSize,r,l]),m=(h==null?void 0:h.items)??[],p=async g=>{try{const w=await q.createJob(g);e(`/runs/${w.id}`)}catch(w){u(w.message)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Test cases"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Test cases"}),s.jsx("p",{className:"page-sub",children:"Test case ↔ Playwright test traceability."})]})}),s.jsxs("div",{className:"toolbar",children:[s.jsx(bn,{value:r,onChange:i,items:BT.map(g=>({id:g,label:s.jsxs(s.Fragment,{children:[g==="all"?"All":Mu(g)," ",s.jsx("span",{className:"tab-count",children:(h==null?void 0:h.counts[g])??0})]})}))}),s.jsx("div",{className:"grow"}),s.jsxs("select",{className:"select",value:l,onChange:g=>a(g.target.value),"aria-label":"Filter by spec",children:[s.jsx("option",{value:"",children:"All specs"}),t.map(g=>s.jsx("option",{value:g.file,children:g.file},g.file))]}),s.jsxs("button",{className:"btn ghost",onClick:()=>{n(),f()},children:[s.jsx(Rr,{size:14})," Refresh"]})]}),s.jsx(Pe,{error:d??o}),s.jsxs("div",{className:"table-wrap table-fit",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"TC"}),s.jsx("th",{children:"TC name"}),s.jsx("th",{children:"Test file"}),s.jsx("th",{children:"Mapping"}),s.jsx("th",{children:"Last result"}),s.jsx("th",{})]})}),s.jsx("tbody",{children:m.map((g,w)=>s.jsxs("tr",{children:[s.jsx("td",{children:g.specFile?s.jsx(ye,{to:`/specs/${g.specFile}`,className:"mono",children:g.specFile}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{children:g.tcId?s.jsx("code",{children:g.tcId}):"—"}),s.jsx("td",{children:g.tcTitle??g.testTitle??"—"}),s.jsx("td",{children:g.testFile?s.jsxs("code",{children:[g.testFile,":",g.testLine]}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{children:s.jsx(dt,{status:g.status,children:Mu(g.status)})}),s.jsx("td",{children:g.lastResult?s.jsx(ye,{to:`/runs/${g.lastResult.jobId}`,title:Pt(g.lastResult.at),children:s.jsx(dt,{status:g.lastResult.status,children:Mu(g.lastResult.status)})}):s.jsx(dt,{status:null})}),s.jsx("td",{style:{textAlign:"right"},children:g.testFile&&g.tcId&&g.specFile&&g.status!=="orphan"&&s.jsxs("button",{className:"btn ghost sm",onClick:()=>void p({type:"testrun",spec:g.specFile,tcId:g.tcId}),children:[s.jsx(ft,{size:12})," Run"]})})]},`${g.specFile??"__none"}-${g.tcId}-${g.testLine}-${w}`))})]}),h&&m.length===0&&s.jsx("p",{className:"muted pad",children:"No rows match the filter."}),h&&s.jsx(ps,{page:c.page,pageSize:c.pageSize,total:h.total,onPage:c.setPage,onPageSize:c.setPageSize,label:"test cases"})]})]})}const aa=(e,t)=>t?Math.round(e/t*100):0;function WT(){const e=ut(),{openNewSpec:t}=hs(),{specs:n,refresh:r}=Xt(),i=Me(()=>q.dashboard()),l=Me(()=>q.jobs()),[a,o]=j.useState(null),u=i.data,c=n.reduce((p,g)=>p+g.parsed.tcs.length,0),h=l.data??[],d=h[0],f=(u==null?void 0:u.failing)??[],m=()=>void q.createJob({type:"testrun",repeatEach:1}).then(p=>{r(),e(`/runs/${p.id}`)}).catch(p=>o(p.message));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Overview"}]}),s.jsx(Pe,{error:i.error??l.error??a}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Overview"}),s.jsx("p",{className:"page-sub",children:"Test coverage and run health across all specs."})]}),s.jsxs("div",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>t(),children:[s.jsx(Qt,{size:15})," New spec"]}),s.jsxs("button",{className:"btn",onClick:m,children:[s.jsx(ft,{size:13})," Run all specs"]})]})]}),s.jsxs("div",{className:"stats",children:[s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Coverage"}),s.jsx("span",{className:"stat-icon",children:s.jsx(vh,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[aa((u==null?void 0:u.coverage.mapped)??0,(u==null?void 0:u.coverage.total)??0),"%",s.jsxs("small",{children:[(u==null?void 0:u.coverage.mapped)??0," / ",(u==null?void 0:u.coverage.total)??0," TC"]})]}),s.jsx("div",{className:"progress",children:s.jsx("i",{style:{width:`${aa((u==null?void 0:u.coverage.mapped)??0,(u==null?void 0:u.coverage.total)??0)}%`}})})]}),s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Pass rate"}),s.jsx("span",{className:"stat-icon ok",children:s.jsx(kh,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[aa((u==null?void 0:u.passRate.passed)??0,(u==null?void 0:u.passRate.total)??0),"%",s.jsxs("small",{children:[(u==null?void 0:u.passRate.passed)??0," / ",(u==null?void 0:u.passRate.total)??0," TC"]})]}),s.jsx("div",{className:"progress ok",children:s.jsx("i",{style:{width:`${aa((u==null?void 0:u.passRate.passed)??0,(u==null?void 0:u.passRate.total)??0)}%`}})})]}),s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Specs"}),s.jsx("span",{className:"stat-icon info",children:s.jsx(jr,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[n.length,s.jsxs("small",{children:[c," test cases"]})]}),s.jsx(ye,{to:"/specs",className:"stat-link",children:"Manage specs →"})]}),s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Recent runs"}),s.jsx("span",{className:"stat-icon warn",children:s.jsx(ft,{size:14})})]}),s.jsxs("div",{className:"stat-value",children:[h.length,s.jsx("small",{children:"runs"})]}),s.jsxs("div",{className:"muted small",children:["Last run: ",Pt((d==null?void 0:d.finishedAt)??(d==null?void 0:d.startedAt)??(d==null?void 0:d.createdAt))]})]})]}),s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Recent runs"}),s.jsx(ye,{to:"/runs",className:"card-link",children:"View all"})]}),s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Run"}),s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"Result"}),s.jsx("th",{className:"num",children:"Duration"})]})}),s.jsx("tbody",{children:h.slice(0,5).map(p=>s.jsxs("tr",{onClick:()=>e(`/runs/${p.id}`),style:{cursor:"pointer"},children:[s.jsxs("td",{className:"mono",children:["#",p.id]}),s.jsxs("td",{children:[p.target,p.args.tcId?s.jsxs("span",{className:"muted small",children:[" · ",p.args.tcId]}):null]}),s.jsx("td",{children:s.jsx(ni,{status:p.status,title:p.summary??void 0,children:p.summary&&p.summary.length<=24?p.summary:p.status})}),s.jsx("td",{className:"num muted",children:ds(p.startedAt,p.finishedAt)})]},p.id))})]}),l.data&&h.length===0&&s.jsx("p",{className:"muted pad",children:"No runs yet."})]}),s.jsxs("div",{className:"card pad",children:[s.jsx("h3",{className:"card-title",children:"Pipeline agents"}),s.jsxs("p",{className:"muted small",style:{margin:"2px 0 14px"},children:["Runs with ",s.jsx("span",{className:"accent-text",children:"Claude Code"})," — no API key needed."]}),s.jsx("ol",{className:"agent-steps",children:["explorer","generator","validator","healer"].map((p,g)=>s.jsxs("li",{title:Se[p].description,children:[s.jsx("span",{className:"step-num",children:g+1}),Se[p].label,p==="healer"&&s.jsx("span",{className:"muted small accent-soft-text",children:"≤ 2 loops"})]},p))})]})]}),f.length>0&&s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsx("div",{className:"card-head",children:s.jsxs("h3",{children:["Failing tests (",f.length,")"]})}),s.jsx("table",{className:"flat",children:s.jsx("tbody",{children:f.map(p=>s.jsxs("tr",{onClick:()=>e(`/runs/${p.jobId}${p.id?`?result=${p.id}`:""}`),style:{cursor:"pointer"},title:"Open this failed test in Recent runs",children:[s.jsxs("td",{children:[s.jsx("div",{children:p.title}),s.jsx("div",{className:"mono small",style:{color:"var(--fail)"},children:(p.error??"").split(`
376
- `)[0].slice(0,160)})]}),s.jsx("td",{className:"num",children:s.jsxs(ye,{to:`/runs/${p.jobId}${p.id?`?result=${p.id}`:""}`,onClick:g=>g.stopPropagation(),children:["#",p.jobId]})})]},`${p.jobId}-${p.title}`))})})]}),s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Specs at a glance"}),s.jsx(ye,{to:"/specs",className:"card-link",children:"Open Specs page"})]}),s.jsxs("div",{className:"glance",children:[((u==null?void 0:u.specs)??[]).map(p=>s.jsxs(ye,{to:`/specs/${p.file}`,className:"glance-row",children:[s.jsx("span",{className:"file-icon muted-icon",children:s.jsx(jr,{size:16})}),s.jsxs("div",{className:"grow",children:[s.jsx("div",{className:"mono strong",children:p.file}),s.jsx("div",{className:"muted small",children:p.title||"—"})]}),s.jsxs("span",{className:"muted small",children:[p.tcCount," test cases"]}),s.jsxs("span",{className:`chip ${p.mappedCount<p.tcCount?"warn":""}`,children:[p.mappedCount,"/",p.tcCount," mapped"]})]},p.file)),u&&u.specs.length===0&&s.jsx("p",{className:"muted pad",children:"No specs yet."})]})]})]})}function VT({onImported:e}){const{refresh:t}=Xt(),n=Ar(),r=In(),i=Ub(),l=j.useRef(null),[a,o]=j.useState(!1),u=async d=>{o(!0);try{await i(d())}catch(f){n.error(f.message)}finally{o(!1)}},c=()=>u(async()=>{const d=URL.createObjectURL(await q.exportProject()),f=document.createElement("a");f.href=d,f.download=`agent-studio-export-${new Date().toISOString().slice(0,10)}.zip`,f.click(),URL.revokeObjectURL(d),n.success("Project exported")}),h=async d=>{await r({title:`Import ${d.name}?`,message:"Specs, tests, Playwright config, CLAUDE.md and Claude skills in the zip overwrite the files with the same name. Settings, all agents (built-in instructions and custom agents) and pipelines are replaced. Jobs and chats are kept.",confirmLabel:"Import",danger:!0})&&await u(async()=>{const m=await new Promise((g,w)=>{const x=new FileReader;x.onload=()=>g(String(x.result)),x.onerror=()=>w(x.error),x.readAsDataURL(d)}),p=await q.importProject(m.slice(m.indexOf(",")+1));t(),e==null||e(),n.success(`Imported ${p.files} files, ${p.agents} custom agents, ${p.pipelines} custom pipelines and ${p.instructions} built-in agent instructions`)})};return s.jsxs("span",{className:"row",children:[s.jsxs("button",{type:"button",className:"btn ghost",onClick:()=>{var d;return(d=l.current)==null?void 0:d.click()},disabled:a,title:"Import a project zip exported from Agent Studio",children:[s.jsx(Lo,{size:15})," Import"]}),s.jsxs("button",{type:"button",className:"btn ghost",onClick:()=>void c(),disabled:a,title:"Export specs, tests, Playwright config, CLAUDE.md, Claude skills, settings, agents and pipelines as a zip",children:[s.jsx(us,{size:15})," Export"]}),s.jsx("input",{ref:l,type:"file",accept:".zip",hidden:!0,onChange:d=>{var m;const f=(m=d.target.files)==null?void 0:m[0];d.target.value="",f&&h(f)}})]})}async function Mv(){const e=await q.claudeMd();if(e.content===null)return;const t=URL.createObjectURL(new Blob([e.content],{type:"text/markdown"})),n=document.createElement("a");n.href=t,n.download=`CLAUDE-${new Date().toISOString().slice(0,10)}.md`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e3)}function QT(){var v,b,E,k;const e=ut(),t=In(),n=Ar(),r=Me(()=>q.claudeMd()),i=Me(()=>q.jobsPage({page:1,pageSize:1,type:"context"})),[l,a]=j.useState(""),[o,u]=j.useState("rendered"),[c,h]=j.useState(!1),[d,f]=j.useState(null),m=(v=i.data)==null?void 0:v.items[0],p=j.useRef(null),[g,w]=j.useState(null),x=async R=>{if(!R)return;if(!/\.md$/i.test(R.name))return f("Choose a Markdown (.md) file.");const T=await R.text();if(!await t({title:"Replace CLAUDE.md?",message:`CLAUDE.md is replaced with ${R.name}. The current file is backed up first.`,confirmLabel:"Replace",danger:!0})){p.current&&(p.current.value="");return}try{const C=await q.uploadClaudeMd(T);n.success("CLAUDE.md replaced"),w(`CLAUDE.md replaced with ${R.name}.${C.backup?` Previous version backed up to ${C.backup}.`:""}`),f(null),r.reload()}catch(C){f(C.message)}finally{p.current&&(p.current.value="")}},y=async R=>{R.preventDefault(),h(!0);try{const T=await q.createJob({type:"context",...l.trim()?{notes:l.trim()}:{}});e(`/runs/${T.id}`)}catch(T){f(T.message),h(!1)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Project"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Project"}),s.jsx("p",{className:"page-sub",children:"Project context (CLAUDE.md), import / export and reset."})]}),s.jsx(VT,{onImported:r.reload})]}),s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsxs("h3",{children:["CLAUDE.md"," ",((b=r.data)==null?void 0:b.mtimeMs)&&s.jsxs("span",{className:"muted small",style:{fontWeight:400},children:["· modified ",Pt(new Date(r.data.mtimeMs).toISOString())]})]}),s.jsxs("span",{className:"row",children:[s.jsx("button",{className:"btn ghost sm",onClick:()=>void Mv(),disabled:!((E=r.data)!=null&&E.content),children:"Download"}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>{var R;return(R=p.current)==null?void 0:R.click()},title:"Replace CLAUDE.md with a file, e.g. this project's saved context",children:[s.jsx(Lo,{size:13})," Upload"]}),s.jsx("input",{ref:p,type:"file",accept:".md,text/markdown",hidden:!0,onChange:R=>{var T;return void x((T=R.target.files)==null?void 0:T[0])}}),s.jsx(bn,{value:o,onChange:u,items:[{id:"rendered",label:"Preview"},{id:"source",label:"Source"}]})]})]}),g&&s.jsx("div",{className:"ok-box",style:{margin:12},children:g}),s.jsx(Pe,{error:r.error}),r.data&&r.data.content===null&&s.jsx("p",{className:"muted pad",children:"There is no CLAUDE.md at the repo root yet. The Context Writer will create one."}),((k=r.data)==null?void 0:k.content)&&(o==="rendered"?s.jsx("div",{className:"pad md claude-md",children:s.jsx(ui,{children:r.data.content.replace(/<!--[\s\S]*?-->/g,"")})}):s.jsx("pre",{className:"mono pad claude-md",style:{margin:0,whiteSpace:"pre-wrap"},children:r.data.content}))]}),s.jsxs("form",{className:"card pad req-form",onSubmit:y,children:[s.jsxs("div",{className:"row",children:[s.jsx(Ot,{agent:"contextwriter",size:36}),s.jsxs("div",{children:[s.jsx("b",{children:"Context Writer"}),s.jsx("div",{className:"muted small",children:"LLM agent (Claude Code), may only edit CLAUDE.md"})]})]}),s.jsxs("label",{children:["Notes about this project (optional)",s.jsx("textarea",{className:"input",style:{minHeight:140},value:l,onChange:R=>a(R.target.value),placeholder:"e.g. <App name>: customer portal. Roles: admin, customer. Login with email + password. Test ids use data-testid."})]}),s.jsx(Pe,{error:d}),s.jsxs("div",{className:"row between",children:[s.jsx("span",{className:"muted small",children:m?s.jsxs(s.Fragment,{children:["Last update: ",s.jsxs(ye,{to:`/runs/${m.id}`,children:["job #",m.id]})," ",s.jsx(kn,{status:m.status})," ",Pt(m.finishedAt??m.createdAt)]}):"Never updated by Agent Studio"}),s.jsxs("button",{type:"submit",className:"btn",disabled:c,children:[s.jsx(bh,{size:15})," ",c?"Starting…":"Update CLAUDE.md"]})]})]})]}),s.jsxs("div",{className:"card pad danger-zone row between",style:{marginTop:14},children:[s.jsxs("div",{children:[s.jsx("b",{children:"Reset project template"}),s.jsx("div",{className:"muted small",children:"Remove this project's specs, tests, results and context; you choose what and see the list first."})]}),s.jsxs(ye,{className:"btn danger",to:"/project/reset",children:[s.jsx(Lr,{size:14})," Reset project template…"]})]})]})}const qT=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Tm({mentions:e,title:t}){const n=j.useMemo(()=>{const r=new Map;for(const i of e)r.set(i.file,[...r.get(i.file)??[],i]);return[...r.entries()]},[e]);return e.length?s.jsxs("details",{className:"rt-mentions",children:[s.jsxs("summary",{children:[t,": ",e.length," line",e.length===1?"":"s"," in ",n.length," file",n.length===1?"":"s"]}),s.jsx("p",{className:"muted small",children:"These files are not changed by the reset (source code, docs). Review and edit them by hand."}),n.map(([r,i])=>s.jsxs("div",{className:"rt-file",children:[s.jsx("code",{children:r}),i.map(l=>s.jsxs("div",{className:"rt-line",children:[s.jsx("span",{className:"muted",children:l.line})," ",l.text]},`${l.line}-${l.text}`))]},r))]}):s.jsx("p",{className:"muted small",children:"No other file mentions the project."})}function GT(){const{refresh:e}=Xt(),[t,n]=j.useState(null),[r,i]=j.useState(new Set),[l,a]=j.useState(""),[o,u]=j.useState(""),[c,h]=j.useState(!0),[d,f]=j.useState(!1),[m,p]=j.useState(null),[g,w]=j.useState(null),x=async(E=l)=>{try{const k=await q.resetPlan(E);n(k),i(R=>R.size?R:new Set(k.categories.filter(T=>T.defaultOn).map(T=>T.id))),p(null)}catch(k){p(k.message)}};j.useEffect(()=>{x()},[]);const y=E=>i(k=>{const R=new Set(k);return R.has(E)?R.delete(E):R.add(E),R}),v=async()=>{if(t){f(!0);try{const E=await q.resetProject({categories:[...r],confirm:o,backup:c,terms:l.split(",").map(k=>k.trim()).filter(Boolean)});w(E),u(""),e(),await x()}catch(E){p(E.message)}finally{f(!1)}}},b=t&&o===t.confirmWord&&r.size>0&&!t.busy&&!d;return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Project",to:"/project"},{label:"Reset project template"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Reset project template"}),s.jsxs("p",{className:"page-sub",children:["Strip everything that belongs to the current project so this repository can be cloned and reused for another one. With ",s.jsx("b",{children:"Backup data"})," on, specs, tests, CLAUDE.md and chat history are backed up first; results and logs are always deleted for good."]})]})}),g&&s.jsxs("div",{className:"ok-box",children:[s.jsx("b",{children:"Project reset."})," ",Object.entries(g.removed).map(([E,k])=>{var R;return`${((R=t==null?void 0:t.categories.find(T=>T.id===E))==null?void 0:R.label)??E}: ${k}`}).join(" · "),g.backupDir&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),"Backup of the removed files (specs, tests, CLAUDE.md, chat history…): ",s.jsx("code",{children:g.backupDir})]}),!g.backupDir&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),"No backup was made: removed items were deleted permanently."]}),s.jsx("br",{}),"Next: add specs for the new project, then ",s.jsx(ye,{to:"/project",children:"update CLAUDE.md"})," with the Context Writer or upload the project's CLAUDE.md.",g.mentions.length>0&&s.jsx("div",{style:{marginTop:8},children:s.jsx(Tm,{mentions:g.mentions,title:"Still mentioned"})})]}),s.jsx(Pe,{error:m}),(t==null?void 0:t.busy)&&s.jsx("div",{className:"warn-box",children:"A job is queued, running or waiting for review. Wait for it to finish (or cancel it) before resetting."}),t&&s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsx("h3",{children:"What to reset"}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>void x(),children:[s.jsx(Rr,{size:13})," Refresh"]})]}),t.categories.map(E=>s.jsxs("label",{className:`rt-cat ${r.has(E.id)?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:r.has(E.id),onChange:()=>y(E.id)}),s.jsxs("span",{className:"grow",children:[s.jsxs("span",{className:"rt-cat-head",children:[s.jsx("b",{children:E.label}),s.jsxs("span",{className:"muted small",children:[E.fileCount," ",E.id==="prompts"?"custom":`file${E.fileCount===1?"":"s"}`,E.bytes?` · ${qT(E.bytes)}`:""]}),s.jsx("span",{className:`rt-tag ${E.backedUp&&c?"":"gone"}`,children:E.backedUp&&c?"backed up":"deleted for good"})]}),s.jsx("span",{className:"muted small",children:E.description}),E.note&&s.jsx("span",{className:"small",children:E.note}),E.files.length>0&&s.jsxs("details",{className:"rt-files",children:[s.jsx("summary",{className:"small",children:"Show files"}),E.files.map(k=>s.jsx("code",{children:k},k)),E.fileCount>E.files.length&&s.jsxs("span",{className:"muted small",children:["…and ",E.fileCount-E.files.length," more"]})]})]})]},E.id))]}),s.jsxs("div",{style:{display:"grid",gap:14,alignContent:"start"},children:[s.jsxs("div",{className:"card pad",style:{display:"grid",gap:10},children:[s.jsx("h3",{className:"card-title",children:"Project mentions elsewhere"}),s.jsxs("p",{className:"muted small",style:{margin:0},children:["Words that identify this project (from spec, fixture and Page Object names and the app's hostnames):"," ",t.terms.length?t.terms.map(E=>s.jsx("code",{style:{marginRight:4},children:E},E)):"none found","."]}),s.jsxs("div",{className:"row",children:[s.jsx("input",{className:"input grow",placeholder:"More words, comma-separated (e.g. app or client name)",value:l,onChange:E=>a(E.target.value)}),s.jsx("button",{className:"btn ghost sm",onClick:()=>void x(l),children:"Scan"})]}),s.jsx(Tm,{mentions:t.mentions,title:"Mentions the reset leaves"})]}),s.jsxs("div",{className:"card pad danger-zone",style:{display:"grid",gap:10},children:[s.jsx("h3",{className:"card-title",children:"Reset"}),s.jsxs("p",{className:"small",style:{margin:0},children:["Keep this project's context? ",s.jsx("button",{className:"link-btn",onClick:()=>void Mv(),children:"Download the current CLAUDE.md"})," first; upload it again later on the Project page."]}),s.jsxs("label",{className:"small row",style:{gap:8,alignItems:"center"},children:[s.jsx("input",{type:"checkbox",checked:c,onChange:E=>h(E.target.checked)}),s.jsx("b",{children:"Backup data"})]}),!c&&s.jsx("div",{className:"warn-box small",style:{margin:0},children:"Backup is off: the selected items are deleted permanently and cannot be restored."}),s.jsxs("label",{className:"small",style:{display:"grid",gap:6},children:[s.jsxs("span",{children:["Type ",s.jsx("b",{children:t.confirmWord})," to confirm"]}),s.jsx("input",{className:"input mono",value:o,onChange:E=>u(E.target.value),"aria-label":"Confirmation word",autoComplete:"off"})]}),s.jsxs("button",{className:"btn danger-solid",disabled:!b,onClick:()=>void v(),children:[s.jsx(Lr,{size:14})," ",d?"Resetting…":`Reset ${r.size} item${r.size===1?"":"s"}`]})]})]})]})]})}const KT=/^[a-z0-9][a-z0-9_-]*$/;function YT(e){return e.replace(/\.(md|txt)$/i,"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function JT(){const e=ut(),{specs:t}=Xt(),[n,r]=j.useState(""),[i,l]=j.useState(""),[a,o]=j.useState(!1),[u,c]=j.useState(!1),[h,d]=j.useState(null),f=j.useRef(null),m=n.trim().replace(/\.md$/,""),p=`${m}.md`,g=t.some(v=>v.file===p),w=i.length>wu,x=async v=>{if(v){if(!/\.(md|txt)$/i.test(v.name))return d("Only .md or .txt files can be loaded. Copy text from Word/Confluence and paste it instead.");l(await v.text()),m||r(YT(v.name)),d(null)}},y=async v=>{if(v.preventDefault(),!KT.test(m))return d('Spec name may only contain lowercase letters, digits, "-" or "_", and must start with a letter or digit.');if(!i.trim())return d("Paste the requirement first.");if(w)return d(`The requirement is longer than ${wu.toLocaleString()} characters.`);if(g&&!a)return d(`specs/${p} already exists. Choose another name or tick "Overwrite".`);c(!0);try{const b=await q.createJob({type:"spec",spec:p,requirement:i,...g?{overwrite:!0}:{}});e(`/runs/${b.id}`)}catch(b){d(b.message),c(!1)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Generator"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Generator"}),s.jsx("p",{className:"page-sub",children:"Paste a BA requirement or user story. The QA Test Case Writer agent turns it into a spec with test cases, which you then review and run."})]})}),s.jsxs("div",{className:"overview-grid",children:[s.jsxs("form",{className:"card pad req-form",onSubmit:y,children:[s.jsxs("label",{children:["Spec name",s.jsxs("span",{className:"row",children:[s.jsx("input",{className:"input grow",placeholder:"e.g. login",value:n,onChange:v=>r(v.target.value),"aria-describedby":"spec-name-help"}),s.jsx("span",{className:"muted",children:".md"})]}),s.jsxs("span",{id:"spec-name-help",className:"muted small",style:{fontWeight:400},children:["Saved as ",s.jsxs("code",{children:["specs/",m||"<name>",".md"]})]})]}),g&&s.jsxs("label",{className:"row",style:{display:"flex",fontWeight:400},children:[s.jsx("input",{type:"checkbox",checked:a,onChange:v=>o(v.target.checked)}),s.jsxs("span",{children:[s.jsxs("b",{children:["specs/",p]})," already exists: overwrite it (existing TC-IDs are kept where they still apply)"]})]}),s.jsxs("label",{children:[s.jsxs("span",{className:"row between",children:[s.jsx("span",{children:"Requirement"}),s.jsxs("button",{type:"button",className:"btn ghost",onClick:()=>{var v;return(v=f.current)==null?void 0:v.click()},children:[s.jsx(Lo,{size:14})," Load .md / .txt"]})]}),s.jsx("textarea",{className:"input",value:i,onChange:v=>l(v.target.value),placeholder:`As a <role>, I want to <action> so that <benefit>.
375
+ `]},r)})})}function ia({before:e,after:t}){const n=j.useMemo(()=>xb(e,t),[e,t]);return n.some(r=>r.type!=="same")?s.jsx("pre",{className:"diff",children:n.map((r,i)=>s.jsxs("div",{className:r.type==="same"?"":r.type,children:[r.type==="add"?"+ ":r.type==="del"?"- ":" ",r.text]},i))}):s.jsx("p",{className:"muted",children:"Test file unchanged."})}function zT({results:e,highlightId:t}){const n=Hh(e),r=j.useRef(null),i=j.useRef(!1);return j.useEffect(()=>{if(!t)return;const l=e.findIndex(o=>o.id===t);if(l<0)return;const a=Math.floor(l/n.props.pageSize)+1;a!==n.props.page&&n.props.onPage(a)},[t,e,n.props.pageSize]),j.useEffect(()=>{t&&r.current&&!i.current&&(r.current.scrollIntoView({behavior:"smooth",block:"center"}),i.current=!0)},[t,n.pageItems]),s.jsxs("div",{className:"table-wrap",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"TC"}),s.jsx("th",{children:"Test"}),s.jsx("th",{children:"Status"}),s.jsx("th",{className:"num",children:"ms"}),s.jsx("th",{children:"Error"})]})}),s.jsx("tbody",{children:n.pageItems.map(l=>s.jsxs("tr",{ref:l.id===t?r:void 0,className:l.id===t?"row-highlight":void 0,children:[s.jsx("td",{children:l.tcId?s.jsx("code",{children:l.tcId}):"—"}),s.jsxs("td",{children:[l.title,s.jsx("div",{className:"muted small",children:l.testFile})]}),s.jsx("td",{children:s.jsx(yt,{status:l.status})}),s.jsx("td",{className:"num",children:l.durationMs}),s.jsxs("td",{style:{maxWidth:440},children:[l.error&&s.jsx("pre",{className:"mono",style:{margin:0,whiteSpace:"pre-wrap",color:"var(--fail)",maxHeight:140,overflow:"auto"},children:l.error}),l.attachments.filter(a=>a.name==="trace"&&a.path).map(a=>s.jsxs("div",{className:"muted small",children:["Trace: ",s.jsxs("code",{children:['npx playwright show-trace "',a.path,'"']})]},a.path))]})]},l.id))})]}),s.jsx(ps,{...n.props,label:"results"})]})}function Em({jobId:e}){const[t,n]=j.useState(null);return j.useEffect(()=>{q.jobRequirement(e).then(r=>n(r.requirement)).catch(()=>n(null))},[e]),t?s.jsxs("details",{style:{marginTop:12},children:[s.jsxs("summary",{children:["BA requirement (",t.length.toLocaleString()," characters)"]}),s.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",maxHeight:320,overflow:"auto",marginTop:8},children:t})]}):null}function _T({jobId:e,run:t,full:n,results:r,highlightResultId:i}){var a,o,u,c,h,d,f,m;if(t.status==="running"||t.status==="pending")return s.jsx("p",{className:"muted",children:"Agent is running; output will be available when it finishes."});if(t.agent==="custom"&&t.output){const p=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:p.status==="passed"?"passed":"failed"})," ",p.summary]}),s.jsx("div",{className:"md",children:s.jsx(ui,{children:p.details})}),!!((a=p.questions)!=null&&a.length)&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Questions asked"}),s.jsx("ol",{children:p.questions.map(g=>s.jsxs("li",{children:[g.question,s.jsx("ul",{children:g.options.map((w,x)=>s.jsxs("li",{children:[w.label,w.recommended?" (recommended)":"",w.description?s.jsxs("span",{className:"muted",children:[" · ",w.description]}):null]},x))})]},g.id))})]}),!!((o=p.answered)!=null&&o.length)&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Your answers"}),s.jsx("ol",{children:p.answered.map(g=>s.jsxs("li",{children:[g.question,s.jsx("br",{}),"→ ",s.jsx("b",{children:g.answer})]},g.id))})]})]})}if(t.agent==="validator"||t.agent==="runner"){const p=t.output;return s.jsxs("div",{children:[p&&s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:p.passed?"passed":"failed"}),Object.entries(p.counts).map(([g,w])=>s.jsxs("span",{className:"row",style:{gap:4},children:[s.jsx(yt,{status:g,children:w})," ",g]},g)),s.jsx("code",{className:"muted",children:p.command}),p.htmlReport&&s.jsxs("a",{href:yh(t.jobId),target:"_blank",rel:"noreferrer",children:[s.jsx(Sh,{size:13})," Open HTML report"]})]}),!p&&s.jsx("p",{className:"muted",children:"No report."}),r.length>0&&s.jsx(zT,{results:r,highlightId:i})]})}if(!t.output)return s.jsxs("div",{children:[s.jsx("p",{className:"muted",children:"The agent did not write a result file. See the Log tab for details."}),t.agent==="specwriter"&&s.jsx(Em,{jobId:e})]});if(t.agent==="contextwriter"){const p=t.output,g=(w,x)=>x!=null&&x.length?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:s.jsx("ul",{style:{margin:0,paddingLeft:18},children:x.map((y,v)=>s.jsx("li",{children:y},v))})})]}):null;return s.jsxs("div",{children:[s.jsx("p",{children:p.summary}),s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[g("Added / updated",p.added),g("Removed (old project)",p.removed),g("Notes added",p.notes),g("Security issues (notes not applied)",Array.isArray(p.security)?p.security.map(w=>typeof w=="string"?w:`"${w.note}" (${w.reason})`):void 0),g("Check these",p.warnings),p.failure?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Failed because"}),s.jsx("dd",{children:p.failure})]}):null]}),n?s.jsx(ia,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}if(t.agent==="specwriter"){const p=t.output,g=(w,x)=>x!=null&&x.length?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:s.jsx("ul",{style:{margin:0,paddingLeft:18},children:x.map((y,v)=>s.jsx("li",{children:y},v))})})]}):null;return s.jsxs("div",{children:[s.jsx("p",{children:p.summary}),s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[s.jsx("dt",{children:"Spec"}),s.jsx("dd",{children:s.jsx(ye,{to:`/specs/${p.specFile}`,children:s.jsxs("code",{children:["specs/",p.specFile]})})}),s.jsx("dt",{children:"Test cases"}),s.jsx("dd",{children:(u=p.tcIds)==null?void 0:u.map(w=>s.jsx("code",{style:{marginRight:6},children:w},w))}),g("Assumptions",p.assumptions),g("Questions for the BA",p.questions)]}),n?s.jsx(ia,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading spec…"}),s.jsx(Em,{jobId:e})]})}if(t.agent==="explorer"){const p=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:p.status})," ",p.summary]}),((c=p.environment)==null?void 0:c.ready)===!1&&s.jsxs("div",{className:"warn-box",style:{marginBottom:12},children:[s.jsx("b",{children:"Environment/setup not ready, pipeline stopped:"}),s.jsx("ul",{style:{margin:"6px 0 0"},children:((h=p.environment.issues)!=null&&h.length?p.environment.issues:["no details"]).map((g,w)=>s.jsx("li",{children:g},w))})]}),((d=p.environment)==null?void 0:d.ready)!==!1&&p.cases.some(g=>g.status==="failed")&&s.jsxs("p",{className:"muted small",children:["Failed cases: ",p.cases.filter(g=>g.status==="failed").map(g=>g.id).join(", ")," (possible app bugs). A Generate job does not stop here: it still writes their tests, asserting the expected result."]}),s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Case"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Evidence"})]})}),s.jsx("tbody",{children:p.cases.map(g=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{children:g.id})}),s.jsx("td",{children:s.jsx(yt,{status:g.status})}),s.jsx("td",{className:"small",style:{whiteSpace:"pre-wrap"},children:g.evidence})]},g.id))})]})}),p.assertions.length>0&&s.jsxs("details",{style:{marginTop:12},children:[s.jsxs("summary",{children:["Verified assertions (",p.assertions.length,")"]}),s.jsx("div",{className:"table-wrap",style:{marginTop:8},children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Case"}),s.jsx("th",{children:"Expression"}),s.jsx("th",{children:"Expected"}),s.jsx("th",{children:"Observed"})]})}),s.jsx("tbody",{children:p.assertions.map((g,w)=>s.jsxs("tr",{children:[s.jsx("td",{children:g.case}),s.jsx("td",{children:s.jsx("code",{style:{whiteSpace:"pre-wrap"},children:g.expression})}),s.jsx("td",{className:"small",children:g.expected}),s.jsx("td",{className:"small",children:g.observed})]},w))})]})})]}),p.bugs.length>0&&s.jsxs("div",{className:"warn-box",children:[s.jsx("b",{children:"Potential bugs:"}),s.jsx("ul",{style:{margin:"6px 0 0"},children:p.bugs.map((g,w)=>s.jsx("li",{children:g},w))})]})]})}if(t.agent==="generator"){const p=t.output;return s.jsxs("div",{children:[s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[s.jsx("dt",{children:"File test"}),s.jsx("dd",{children:s.jsx("code",{children:p.testFile})}),s.jsx("dt",{children:"Test case"}),s.jsx("dd",{children:(f=p.tcIds)==null?void 0:f.map(g=>s.jsx("code",{style:{marginRight:6},children:g},g))}),p.pomChanges&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Page Object"}),s.jsx("dd",{children:p.pomChanges})]}),p.notes&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Notes"}),s.jsx("dd",{children:p.notes})]})]}),n?s.jsx(ia,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}const l=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:l.outcome})," ",l.diagnosis]}),((m=l.changes)==null?void 0:m.length)>0&&s.jsx("ul",{children:l.changes.map((p,g)=>s.jsx("li",{children:p},g))}),n?s.jsx(ia,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}const $T=32,OT=240;function FT(e,t){j.useEffect(()=>{const n=e.current;if(!t||!n)return;const r=n.closest(".content"),i=r&&getComputedStyle(r).overflowY!=="visible"?r:null,l=()=>{const u=n.getBoundingClientRect(),c=i?i.clientHeight-(u.top-i.getBoundingClientRect().top+i.scrollTop):window.innerHeight-(u.top+window.scrollY);n.style.maxHeight=`${Math.max(OT,Math.floor(c-$T))}px`};l(),window.addEventListener("resize",l);const a=typeof ResizeObserver>"u"?null:new ResizeObserver(l),o=(i??document.body).firstElementChild;return a&&o&&a.observe(o),()=>{window.removeEventListener("resize",l),a==null||a.disconnect(),n.style.maxHeight=""}},[e,t])}const UT=["all","mapped","missing","stale","orphan"],Mu=e=>e.charAt(0).toUpperCase()+e.slice(1);function BT(){const e=ut(),{specs:t,refresh:n}=Zt(),[r,i]=j.useState("all"),[l,a]=j.useState(""),[o,u]=j.useState(null),c=Tl([r,l]),{data:h,error:d,reload:f}=_e(()=>q.mappingPage({page:c.page,pageSize:c.pageSize,status:r==="all"?void 0:r,spec:l||void 0}),[c.page,c.pageSize,r,l]),m=(h==null?void 0:h.items)??[],p=async g=>{try{const w=await q.createJob(g);e(`/runs/${w.id}`)}catch(w){u(w.message)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Test cases"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Test cases"}),s.jsx("p",{className:"page-sub",children:"Test case ↔ Playwright test traceability."})]})}),s.jsxs("div",{className:"toolbar",children:[s.jsx(kn,{value:r,onChange:i,items:UT.map(g=>({id:g,label:s.jsxs(s.Fragment,{children:[g==="all"?"All":Mu(g)," ",s.jsx("span",{className:"tab-count",children:(h==null?void 0:h.counts[g])??0})]})}))}),s.jsx("div",{className:"grow"}),s.jsxs("select",{className:"select",value:l,onChange:g=>a(g.target.value),"aria-label":"Filter by spec",children:[s.jsx("option",{value:"",children:"All specs"}),t.map(g=>s.jsx("option",{value:g.file,children:g.file},g.file))]}),s.jsxs("button",{className:"btn ghost",onClick:()=>{n(),f()},children:[s.jsx(Lr,{size:14})," Refresh"]})]}),s.jsx(Le,{error:d??o}),s.jsxs("div",{className:"table-wrap table-fit",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"TC"}),s.jsx("th",{children:"TC name"}),s.jsx("th",{children:"Test file"}),s.jsx("th",{children:"Mapping"}),s.jsx("th",{children:"Last result"}),s.jsx("th",{})]})}),s.jsx("tbody",{children:m.map((g,w)=>s.jsxs("tr",{children:[s.jsx("td",{children:g.specFile?s.jsx(ye,{to:`/specs/${g.specFile}`,className:"mono",children:g.specFile}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{children:g.tcId?s.jsx("code",{children:g.tcId}):"—"}),s.jsx("td",{children:g.tcTitle??g.testTitle??"—"}),s.jsx("td",{children:g.testFile?s.jsxs("code",{children:[g.testFile,":",g.testLine]}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{children:s.jsx(yt,{status:g.status,children:Mu(g.status)})}),s.jsx("td",{children:g.lastResult?s.jsx(ye,{to:`/runs/${g.lastResult.jobId}`,title:Rt(g.lastResult.at),children:s.jsx(yt,{status:g.lastResult.status,children:Mu(g.lastResult.status)})}):s.jsx(yt,{status:null})}),s.jsx("td",{style:{textAlign:"right"},children:g.testFile&&g.tcId&&g.specFile&&g.status!=="orphan"&&s.jsxs("button",{className:"btn ghost sm",onClick:()=>void p({type:"testrun",spec:g.specFile,tcId:g.tcId}),children:[s.jsx(ft,{size:12})," Run"]})})]},`${g.specFile??"__none"}-${g.tcId}-${g.testLine}-${w}`))})]}),h&&m.length===0&&s.jsx("p",{className:"muted pad",children:"No rows match the filter."}),h&&s.jsx(ps,{page:c.page,pageSize:c.pageSize,total:h.total,onPage:c.setPage,onPageSize:c.setPageSize,label:"test cases"})]})]})}const la=(e,t)=>t?Math.round(e/t*100):0;function HT(){const e=ut(),{openNewSpec:t}=hs(),{specs:n,refresh:r}=Zt(),i=_e(()=>q.dashboard()),l=_e(()=>q.jobs()),[a,o]=j.useState(null),u=i.data,c=n.reduce((p,g)=>p+g.parsed.tcs.length,0),h=l.data??[],d=h[0],f=(u==null?void 0:u.failing)??[],m=()=>void q.createJob({type:"testrun",repeatEach:1}).then(p=>{r(),e(`/runs/${p.id}`)}).catch(p=>o(p.message));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Overview"}]}),s.jsx(Le,{error:i.error??l.error??a}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Overview"}),s.jsx("p",{className:"page-sub",children:"Test coverage and run health across all specs."})]}),s.jsxs("div",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>t(),children:[s.jsx(qt,{size:15})," New spec"]}),s.jsxs("button",{className:"btn",onClick:m,children:[s.jsx(ft,{size:13})," Run all specs"]})]})]}),s.jsxs("div",{className:"stats",children:[s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Coverage"}),s.jsx("span",{className:"stat-icon",children:s.jsx(vh,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[la((u==null?void 0:u.coverage.mapped)??0,(u==null?void 0:u.coverage.total)??0),"%",s.jsxs("small",{children:[(u==null?void 0:u.coverage.mapped)??0," / ",(u==null?void 0:u.coverage.total)??0," TC"]})]}),s.jsx("div",{className:"progress",children:s.jsx("i",{style:{width:`${la((u==null?void 0:u.coverage.mapped)??0,(u==null?void 0:u.coverage.total)??0)}%`}})})]}),s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Pass rate"}),s.jsx("span",{className:"stat-icon ok",children:s.jsx(kh,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[la((u==null?void 0:u.passRate.passed)??0,(u==null?void 0:u.passRate.total)??0),"%",s.jsxs("small",{children:[(u==null?void 0:u.passRate.passed)??0," / ",(u==null?void 0:u.passRate.total)??0," TC"]})]}),s.jsx("div",{className:"progress ok",children:s.jsx("i",{style:{width:`${la((u==null?void 0:u.passRate.passed)??0,(u==null?void 0:u.passRate.total)??0)}%`}})})]}),s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Specs"}),s.jsx("span",{className:"stat-icon info",children:s.jsx(jr,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[n.length,s.jsxs("small",{children:[c," test cases"]})]}),s.jsx(ye,{to:"/specs",className:"stat-link",children:"Manage specs →"})]}),s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:"Recent runs"}),s.jsx("span",{className:"stat-icon warn",children:s.jsx(ft,{size:14})})]}),s.jsxs("div",{className:"stat-value",children:[h.length,s.jsx("small",{children:"runs"})]}),s.jsxs("div",{className:"muted small",children:["Last run: ",Rt((d==null?void 0:d.finishedAt)??(d==null?void 0:d.startedAt)??(d==null?void 0:d.createdAt))]})]})]}),s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Recent runs"}),s.jsx(ye,{to:"/runs",className:"card-link",children:"View all"})]}),s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Run"}),s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"Result"}),s.jsx("th",{className:"num",children:"Duration"})]})}),s.jsx("tbody",{children:h.slice(0,5).map(p=>s.jsxs("tr",{onClick:()=>e(`/runs/${p.id}`),style:{cursor:"pointer"},children:[s.jsxs("td",{className:"mono",children:["#",p.id]}),s.jsxs("td",{children:[p.target,p.args.tcId?s.jsxs("span",{className:"muted small",children:[" · ",p.args.tcId]}):null]}),s.jsx("td",{children:s.jsx(ni,{status:p.status,title:p.summary??void 0,children:p.summary&&p.summary.length<=24?p.summary:p.status})}),s.jsx("td",{className:"num muted",children:kr(p.startedAt,p.finishedAt)})]},p.id))})]}),l.data&&h.length===0&&s.jsx("p",{className:"muted pad",children:"No runs yet."})]}),s.jsxs("div",{className:"card pad",children:[s.jsx("h3",{className:"card-title",children:"Pipeline agents"}),s.jsxs("p",{className:"muted small",style:{margin:"2px 0 14px"},children:["Runs with ",s.jsx("span",{className:"accent-text",children:"Claude Code"})," — no API key needed."]}),s.jsx("ol",{className:"agent-steps",children:["explorer","generator","validator","healer"].map((p,g)=>s.jsxs("li",{title:Ne[p].description,children:[s.jsx("span",{className:"step-num",children:g+1}),Ne[p].label,p==="healer"&&s.jsx("span",{className:"muted small accent-soft-text",children:"≤ 2 loops"})]},p))})]})]}),f.length>0&&s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsx("div",{className:"card-head",children:s.jsxs("h3",{children:["Failing tests (",f.length,")"]})}),s.jsx("table",{className:"flat",children:s.jsx("tbody",{children:f.map(p=>s.jsxs("tr",{onClick:()=>e(`/runs/${p.jobId}${p.id?`?result=${p.id}`:""}`),style:{cursor:"pointer"},title:"Open this failed test in Recent runs",children:[s.jsxs("td",{children:[s.jsx("div",{children:p.title}),s.jsx("div",{className:"mono small",style:{color:"var(--fail)"},children:(p.error??"").split(`
376
+ `)[0].slice(0,160)})]}),s.jsx("td",{className:"num",children:s.jsxs(ye,{to:`/runs/${p.jobId}${p.id?`?result=${p.id}`:""}`,onClick:g=>g.stopPropagation(),children:["#",p.jobId]})})]},`${p.jobId}-${p.title}`))})})]}),s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Specs at a glance"}),s.jsx(ye,{to:"/specs",className:"card-link",children:"Open Specs page"})]}),s.jsxs("div",{className:"glance",children:[((u==null?void 0:u.specs)??[]).map(p=>s.jsxs(ye,{to:`/specs/${p.file}`,className:"glance-row",children:[s.jsx("span",{className:"file-icon muted-icon",children:s.jsx(jr,{size:16})}),s.jsxs("div",{className:"grow",children:[s.jsx("div",{className:"mono strong",children:p.file}),s.jsx("div",{className:"muted small",children:p.title||"—"})]}),s.jsxs("span",{className:"muted small",children:[p.tcCount," test cases"]}),s.jsxs("span",{className:`chip ${p.mappedCount<p.tcCount?"warn":""}`,children:[p.mappedCount,"/",p.tcCount," mapped"]})]},p.file)),u&&u.specs.length===0&&s.jsx("p",{className:"muted pad",children:"No specs yet."})]})]})]})}function WT({onImported:e}){const{refresh:t}=Zt(),n=Ir(),r=In(),i=Bb(),l=j.useRef(null),[a,o]=j.useState(!1),u=async d=>{o(!0);try{await i(d())}catch(f){n.error(f.message)}finally{o(!1)}},c=()=>u(async()=>{const d=URL.createObjectURL(await q.exportProject()),f=document.createElement("a");f.href=d,f.download=`agent-studio-export-${new Date().toISOString().slice(0,10)}.zip`,f.click(),URL.revokeObjectURL(d),n.success("Project exported")}),h=async d=>{await r({title:`Import ${d.name}?`,message:"Specs, tests, Playwright config, CLAUDE.md and Claude skills in the zip overwrite the files with the same name. Settings, all agents (built-in instructions and custom agents) and pipelines are replaced. Jobs and chats are kept.",confirmLabel:"Import",danger:!0})&&await u(async()=>{const m=await new Promise((g,w)=>{const x=new FileReader;x.onload=()=>g(String(x.result)),x.onerror=()=>w(x.error),x.readAsDataURL(d)}),p=await q.importProject(m.slice(m.indexOf(",")+1));t(),e==null||e(),n.success(`Imported ${p.files} files, ${p.agents} custom agents, ${p.pipelines} custom pipelines and ${p.instructions} built-in agent instructions`)})};return s.jsxs("span",{className:"row",children:[s.jsxs("button",{type:"button",className:"btn ghost",onClick:()=>{var d;return(d=l.current)==null?void 0:d.click()},disabled:a,title:"Import a project zip exported from Agent Studio",children:[s.jsx(Lo,{size:15})," Import"]}),s.jsxs("button",{type:"button",className:"btn ghost",onClick:()=>void c(),disabled:a,title:"Export specs, tests, Playwright config, CLAUDE.md, Claude skills, settings, agents and pipelines as a zip",children:[s.jsx(cs,{size:15})," Export"]}),s.jsx("input",{ref:l,type:"file",accept:".zip",hidden:!0,onChange:d=>{var m;const f=(m=d.target.files)==null?void 0:m[0];d.target.value="",f&&h(f)}})]})}async function _v(){const e=await q.claudeMd();if(e.content===null)return;const t=URL.createObjectURL(new Blob([e.content],{type:"text/markdown"})),n=document.createElement("a");n.href=t,n.download=`CLAUDE-${new Date().toISOString().slice(0,10)}.md`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e3)}function VT(){var v,b,E,k;const e=ut(),t=In(),n=Ir(),r=_e(()=>q.claudeMd()),i=_e(()=>q.jobsPage({page:1,pageSize:1,type:"context"})),[l,a]=j.useState(""),[o,u]=j.useState("rendered"),[c,h]=j.useState(!1),[d,f]=j.useState(null),m=(v=i.data)==null?void 0:v.items[0],p=j.useRef(null),[g,w]=j.useState(null),x=async R=>{if(!R)return;if(!/\.md$/i.test(R.name))return f("Choose a Markdown (.md) file.");const T=await R.text();if(!await t({title:"Replace CLAUDE.md?",message:`CLAUDE.md is replaced with ${R.name}. The current file is backed up first.`,confirmLabel:"Replace",danger:!0})){p.current&&(p.current.value="");return}try{const C=await q.uploadClaudeMd(T);n.success("CLAUDE.md replaced"),w(`CLAUDE.md replaced with ${R.name}.${C.backup?` Previous version backed up to ${C.backup}.`:""}`),f(null),r.reload()}catch(C){f(C.message)}finally{p.current&&(p.current.value="")}},y=async R=>{R.preventDefault(),h(!0);try{const T=await q.createJob({type:"context",...l.trim()?{notes:l.trim()}:{}});e(`/runs/${T.id}`)}catch(T){f(T.message),h(!1)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Project"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Project"}),s.jsx("p",{className:"page-sub",children:"Project context (CLAUDE.md), import / export and reset."})]}),s.jsx(WT,{onImported:r.reload})]}),s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsxs("h3",{children:["CLAUDE.md"," ",((b=r.data)==null?void 0:b.mtimeMs)&&s.jsxs("span",{className:"muted small",style:{fontWeight:400},children:["· modified ",Rt(new Date(r.data.mtimeMs).toISOString())]})]}),s.jsxs("span",{className:"row",children:[s.jsx("button",{className:"btn ghost sm",onClick:()=>void _v(),disabled:!((E=r.data)!=null&&E.content),children:"Download"}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>{var R;return(R=p.current)==null?void 0:R.click()},title:"Replace CLAUDE.md with a file, e.g. this project's saved context",children:[s.jsx(Lo,{size:13})," Upload"]}),s.jsx("input",{ref:p,type:"file",accept:".md,text/markdown",hidden:!0,onChange:R=>{var T;return void x((T=R.target.files)==null?void 0:T[0])}}),s.jsx(kn,{value:o,onChange:u,items:[{id:"rendered",label:"Preview"},{id:"source",label:"Source"}]})]})]}),g&&s.jsx("div",{className:"ok-box",style:{margin:12},children:g}),s.jsx(Le,{error:r.error}),r.data&&r.data.content===null&&s.jsx("p",{className:"muted pad",children:"There is no CLAUDE.md at the repo root yet. The Context Writer will create one."}),((k=r.data)==null?void 0:k.content)&&(o==="rendered"?s.jsx("div",{className:"pad md claude-md",children:s.jsx(ui,{children:r.data.content.replace(/<!--[\s\S]*?-->/g,"")})}):s.jsx("pre",{className:"mono pad claude-md",style:{margin:0,whiteSpace:"pre-wrap"},children:r.data.content}))]}),s.jsxs("form",{className:"card pad req-form",onSubmit:y,children:[s.jsxs("div",{className:"row",children:[s.jsx(Ft,{agent:"contextwriter",size:36}),s.jsxs("div",{children:[s.jsx("b",{children:"Context Writer"}),s.jsx("div",{className:"muted small",children:"LLM agent (Claude Code), may only edit CLAUDE.md"})]})]}),s.jsxs("label",{children:["Notes about this project (optional)",s.jsx("textarea",{className:"input",style:{minHeight:140},value:l,onChange:R=>a(R.target.value),placeholder:"e.g. <App name>: customer portal. Roles: admin, customer. Login with email + password. Test ids use data-testid."})]}),s.jsx(Le,{error:d}),s.jsxs("div",{className:"row between",children:[s.jsx("span",{className:"muted small",children:m?s.jsxs(s.Fragment,{children:["Last update: ",s.jsxs(ye,{to:`/runs/${m.id}`,children:["job #",m.id]})," ",s.jsx(An,{status:m.status})," ",Rt(m.finishedAt??m.createdAt)]}):"Never updated by Agent Studio"}),s.jsxs("button",{type:"submit",className:"btn",disabled:c,children:[s.jsx(bh,{size:15})," ",c?"Starting…":"Update CLAUDE.md"]})]})]})]}),s.jsxs("div",{className:"card pad danger-zone row between",style:{marginTop:14},children:[s.jsxs("div",{children:[s.jsx("b",{children:"Reset project template"}),s.jsx("div",{className:"muted small",children:"Remove this project's specs, tests, results and context; you choose what and see the list first."})]}),s.jsxs(ye,{className:"btn danger",to:"/project/reset",children:[s.jsx(Ar,{size:14})," Reset project template…"]})]})]})}const QT=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Tm({mentions:e,title:t}){const n=j.useMemo(()=>{const r=new Map;for(const i of e)r.set(i.file,[...r.get(i.file)??[],i]);return[...r.entries()]},[e]);return e.length?s.jsxs("details",{className:"rt-mentions",children:[s.jsxs("summary",{children:[t,": ",e.length," line",e.length===1?"":"s"," in ",n.length," file",n.length===1?"":"s"]}),s.jsx("p",{className:"muted small",children:"These files are not changed by the reset (source code, docs). Review and edit them by hand."}),n.map(([r,i])=>s.jsxs("div",{className:"rt-file",children:[s.jsx("code",{children:r}),i.map(l=>s.jsxs("div",{className:"rt-line",children:[s.jsx("span",{className:"muted",children:l.line})," ",l.text]},`${l.line}-${l.text}`))]},r))]}):s.jsx("p",{className:"muted small",children:"No other file mentions the project."})}function qT(){const{refresh:e}=Zt(),[t,n]=j.useState(null),[r,i]=j.useState(new Set),[l,a]=j.useState(""),[o,u]=j.useState(""),[c,h]=j.useState(!0),[d,f]=j.useState(!1),[m,p]=j.useState(null),[g,w]=j.useState(null),x=async(E=l)=>{try{const k=await q.resetPlan(E);n(k),i(R=>R.size?R:new Set(k.categories.filter(T=>T.defaultOn).map(T=>T.id))),p(null)}catch(k){p(k.message)}};j.useEffect(()=>{x()},[]);const y=E=>i(k=>{const R=new Set(k);return R.has(E)?R.delete(E):R.add(E),R}),v=async()=>{if(t){f(!0);try{const E=await q.resetProject({categories:[...r],confirm:o,backup:c,terms:l.split(",").map(k=>k.trim()).filter(Boolean)});w(E),u(""),e(),await x()}catch(E){p(E.message)}finally{f(!1)}}},b=t&&o===t.confirmWord&&r.size>0&&!t.busy&&!d;return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Project",to:"/project"},{label:"Reset project template"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Reset project template"}),s.jsxs("p",{className:"page-sub",children:["Strip everything that belongs to the current project so this repository can be cloned and reused for another one. With ",s.jsx("b",{children:"Backup data"})," on, specs, tests, CLAUDE.md and chat history are backed up first; results and logs are always deleted for good."]})]})}),g&&s.jsxs("div",{className:"ok-box",children:[s.jsx("b",{children:"Project reset."})," ",Object.entries(g.removed).map(([E,k])=>{var R;return`${((R=t==null?void 0:t.categories.find(T=>T.id===E))==null?void 0:R.label)??E}: ${k}`}).join(" · "),g.backupDir&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),"Backup of the removed files (specs, tests, CLAUDE.md, chat history…): ",s.jsx("code",{children:g.backupDir})]}),!g.backupDir&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),"No backup was made: removed items were deleted permanently."]}),s.jsx("br",{}),"Next: add specs for the new project, then ",s.jsx(ye,{to:"/project",children:"update CLAUDE.md"})," with the Context Writer or upload the project's CLAUDE.md.",g.mentions.length>0&&s.jsx("div",{style:{marginTop:8},children:s.jsx(Tm,{mentions:g.mentions,title:"Still mentioned"})})]}),s.jsx(Le,{error:m}),(t==null?void 0:t.busy)&&s.jsx("div",{className:"warn-box",children:"A job is queued, running or waiting for review. Wait for it to finish (or cancel it) before resetting."}),t&&s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsx("h3",{children:"What to reset"}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>void x(),children:[s.jsx(Lr,{size:13})," Refresh"]})]}),t.categories.map(E=>s.jsxs("label",{className:`rt-cat ${r.has(E.id)?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:r.has(E.id),onChange:()=>y(E.id)}),s.jsxs("span",{className:"grow",children:[s.jsxs("span",{className:"rt-cat-head",children:[s.jsx("b",{children:E.label}),s.jsxs("span",{className:"muted small",children:[E.fileCount," ",E.id==="prompts"?"custom":`file${E.fileCount===1?"":"s"}`,E.bytes?` · ${QT(E.bytes)}`:""]}),s.jsx("span",{className:`rt-tag ${E.backedUp&&c?"":"gone"}`,children:E.backedUp&&c?"backed up":"deleted for good"})]}),s.jsx("span",{className:"muted small",children:E.description}),E.note&&s.jsx("span",{className:"small",children:E.note}),E.files.length>0&&s.jsxs("details",{className:"rt-files",children:[s.jsx("summary",{className:"small",children:"Show files"}),E.files.map(k=>s.jsx("code",{children:k},k)),E.fileCount>E.files.length&&s.jsxs("span",{className:"muted small",children:["…and ",E.fileCount-E.files.length," more"]})]})]})]},E.id))]}),s.jsxs("div",{style:{display:"grid",gap:14,alignContent:"start"},children:[s.jsxs("div",{className:"card pad",style:{display:"grid",gap:10},children:[s.jsx("h3",{className:"card-title",children:"Project mentions elsewhere"}),s.jsxs("p",{className:"muted small",style:{margin:0},children:["Words that identify this project (from spec, fixture and Page Object names and the app's hostnames):"," ",t.terms.length?t.terms.map(E=>s.jsx("code",{style:{marginRight:4},children:E},E)):"none found","."]}),s.jsxs("div",{className:"row",children:[s.jsx("input",{className:"input grow",placeholder:"More words, comma-separated (e.g. app or client name)",value:l,onChange:E=>a(E.target.value)}),s.jsx("button",{className:"btn ghost sm",onClick:()=>void x(l),children:"Scan"})]}),s.jsx(Tm,{mentions:t.mentions,title:"Mentions the reset leaves"})]}),s.jsxs("div",{className:"card pad danger-zone",style:{display:"grid",gap:10},children:[s.jsx("h3",{className:"card-title",children:"Reset"}),s.jsxs("p",{className:"small",style:{margin:0},children:["Keep this project's context? ",s.jsx("button",{className:"link-btn",onClick:()=>void _v(),children:"Download the current CLAUDE.md"})," first; upload it again later on the Project page."]}),s.jsxs("label",{className:"small row",style:{gap:8,alignItems:"center"},children:[s.jsx("input",{type:"checkbox",checked:c,onChange:E=>h(E.target.checked)}),s.jsx("b",{children:"Backup data"})]}),!c&&s.jsx("div",{className:"warn-box small",style:{margin:0},children:"Backup is off: the selected items are deleted permanently and cannot be restored."}),s.jsxs("label",{className:"small",style:{display:"grid",gap:6},children:[s.jsxs("span",{children:["Type ",s.jsx("b",{children:t.confirmWord})," to confirm"]}),s.jsx("input",{className:"input mono",value:o,onChange:E=>u(E.target.value),"aria-label":"Confirmation word",autoComplete:"off"})]}),s.jsxs("button",{className:"btn danger-solid",disabled:!b,onClick:()=>void v(),children:[s.jsx(Ar,{size:14})," ",d?"Resetting…":`Reset ${r.size} item${r.size===1?"":"s"}`]})]})]})]})]})}const GT=/^[a-z0-9][a-z0-9_-]*$/;function KT(e){return e.replace(/\.(md|txt)$/i,"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function YT(){const e=ut(),{specs:t}=Zt(),[n,r]=j.useState(""),[i,l]=j.useState(""),[a,o]=j.useState(!1),[u,c]=j.useState(!1),[h,d]=j.useState(null),f=j.useRef(null),m=n.trim().replace(/\.md$/,""),p=`${m}.md`,g=t.some(v=>v.file===p),w=i.length>wu,x=async v=>{if(v){if(!/\.(md|txt)$/i.test(v.name))return d("Only .md or .txt files can be loaded. Copy text from Word/Confluence and paste it instead.");l(await v.text()),m||r(KT(v.name)),d(null)}},y=async v=>{if(v.preventDefault(),!GT.test(m))return d('Spec name may only contain lowercase letters, digits, "-" or "_", and must start with a letter or digit.');if(!i.trim())return d("Paste the requirement first.");if(w)return d(`The requirement is longer than ${wu.toLocaleString()} characters.`);if(g&&!a)return d(`specs/${p} already exists. Choose another name or tick "Overwrite".`);c(!0);try{const b=await q.createJob({type:"spec",spec:p,requirement:i,...g?{overwrite:!0}:{}});e(`/runs/${b.id}`)}catch(b){d(b.message),c(!1)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Generator"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Generator"}),s.jsx("p",{className:"page-sub",children:"Paste a BA requirement or user story. The QA Test Case Writer agent turns it into a spec with test cases, which you then review and run."})]})}),s.jsxs("div",{className:"overview-grid",children:[s.jsxs("form",{className:"card pad req-form",onSubmit:y,children:[s.jsxs("label",{children:["Spec name",s.jsxs("span",{className:"row",children:[s.jsx("input",{className:"input grow",placeholder:"e.g. login",value:n,onChange:v=>r(v.target.value),"aria-describedby":"spec-name-help"}),s.jsx("span",{className:"muted",children:".md"})]}),s.jsxs("span",{id:"spec-name-help",className:"muted small",style:{fontWeight:400},children:["Saved as ",s.jsxs("code",{children:["specs/",m||"<name>",".md"]})]})]}),g&&s.jsxs("label",{className:"row",style:{display:"flex",fontWeight:400},children:[s.jsx("input",{type:"checkbox",checked:a,onChange:v=>o(v.target.checked)}),s.jsxs("span",{children:[s.jsxs("b",{children:["specs/",p]})," already exists: overwrite it (existing TC-IDs are kept where they still apply)"]})]}),s.jsxs("label",{children:[s.jsxs("span",{className:"row between",children:[s.jsx("span",{children:"Requirement"}),s.jsxs("button",{type:"button",className:"btn ghost",onClick:()=>{var v;return(v=f.current)==null?void 0:v.click()},children:[s.jsx(Lo,{size:14})," Load .md / .txt"]})]}),s.jsx("textarea",{className:"input",value:i,onChange:v=>l(v.target.value),placeholder:`As a <role>, I want to <action> so that <benefit>.
377
377
 
378
378
  Business rules:
379
379
  - <rule, limits, ranges>
380
380
 
381
381
  Acceptance criteria:
382
382
  - Given ... when ... then ...
383
- - ...`,"aria-label":"Requirement text"}),s.jsxs("span",{className:`small ${w?"":"muted"}`,style:{fontWeight:400,color:w?"var(--fail)":void 0},children:[i.length.toLocaleString()," / ",wu.toLocaleString()," characters"]})]}),s.jsx("input",{ref:f,type:"file",accept:".md,.txt,text/markdown,text/plain",hidden:!0,onChange:v=>{var b;return void x((b=v.target.files)==null?void 0:b[0])}}),s.jsx(Pe,{error:h}),s.jsx("div",{className:"row",style:{justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"btn",disabled:u,children:[s.jsx(fl,{size:15})," ",u?"Starting…":"Generate spec"]})})]}),s.jsxs("div",{className:"card pad",children:[s.jsxs("div",{className:"row",style:{marginBottom:12},children:[s.jsx(Ot,{agent:"specwriter",size:36}),s.jsxs("div",{children:[s.jsx("b",{children:"How it works"}),s.jsx("div",{className:"muted small",children:"QA Test Case Writer agent (Claude Code)"})]})]}),s.jsxs("ol",{className:"req-steps",children:[s.jsx("li",{children:"The requirement is saved with the job. The agent reads it, plus existing specs for style."}),s.jsxs("li",{children:["It writes ",s.jsxs("code",{children:["specs/",m||"<name>",".md"]})," with one ",s.jsx("code",{children:"## TC-…"})," per behaviour, designed with equivalence partitioning, boundary values, decision tables, state transitions and use cases, always adding edge and security cases."]}),s.jsxs("li",{children:["Each test case gets a test level tag (",s.jsx("b",{children:"IT"}),", ",s.jsx("b",{children:"ST"}),", ",s.jsx("b",{children:"SIT"}),", ",s.jsx("b",{children:"UAT"}),") plus type tags (smoke, negative, boundary, security…) and its design technique."]}),s.jsx("li",{children:"Its assumptions and open questions for the BA are listed in the job output."}),s.jsxs("li",{children:["Review the spec in the editor, then run ",s.jsx("b",{children:"Generate tests"}),"."]})]}),s.jsxs("p",{className:"muted small",style:{marginTop:14},children:["The agent can only write that spec file. It does not open a browser and does not invent credentials. Accounts come from ",s.jsx("code",{children:".env"})," when tests are generated."]})]})]})]})}function XT(){const e=ut(),[t,n]=j.useState("all"),r=Pl([t]),{data:i,error:l,reload:a}=Me(()=>q.jobsPage({page:r.page,pageSize:r.pageSize,type:t==="all"?void 0:t}),[r.page,r.pageSize,t]),[o,u]=j.useState(null),c=((i==null?void 0:i.items)??[]).some(d=>d.status==="queued"||d.status==="running");j.useEffect(()=>{if(!c)return;const d=setInterval(a,2e3);return()=>clearInterval(d)},[c,a]);const h=(i==null?void 0:i.items)??[];return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Recent runs"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Recent runs"}),s.jsx("p",{className:"page-sub",children:"Explore, generate, run and heal jobs with their agent timeline."})]})}),s.jsxs("div",{className:"row between",style:{marginBottom:14},children:[s.jsx(bn,{value:t,onChange:n,items:["all","testrun","generate","explore","heal","spec","context"].map(d=>({id:d,label:d==="all"?"All":kr[d]}))}),s.jsx("div",{className:"row",children:s.jsxs("button",{className:"btn dark",onClick:()=>void q.createJob({type:"testrun",repeatEach:1}).then(d=>e(`/runs/${d.id}`)).catch(d=>u(d.message)),children:[s.jsx(ft,{size:14})," Run all tests"]})})]}),s.jsx(Pe,{error:l??o}),s.jsxs("div",{className:"table-wrap",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Job"}),s.jsx("th",{children:"Agents"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Result"}),s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Duration"})]})}),s.jsx("tbody",{children:h.map(d=>s.jsxs("tr",{onClick:()=>e(`/runs/${d.id}`),style:{cursor:"pointer"},children:[s.jsx("td",{children:s.jsxs("div",{className:"file-cell",children:[s.jsx("span",{className:"file-icon",children:s.jsx(ft,{size:14})}),s.jsxs("div",{children:[s.jsxs("div",{children:["#",d.id," ",kr[d.type]]}),s.jsxs("div",{className:"sub",children:[d.args.name??d.target,d.args.tcId?` · ${d.args.tcId}`:"",d.args.repeatEach&&d.args.repeatEach>1?` · ${d.args.repeatEach}×`:""]})]})]})}),s.jsx("td",{children:s.jsx(zb,{agents:d.agents})}),s.jsxs("td",{children:[s.jsx(kn,{status:d.status}),d.warning&&s.jsx("span",{title:d.warning,style:{color:"var(--warn)"},children:" ⚠"})]}),s.jsx("td",{className:"muted small",children:d.summary??"—"}),s.jsx("td",{className:"muted small",children:Pt(d.startedAt??d.createdAt)}),s.jsx("td",{className:"muted small",children:ds(d.startedAt,d.finishedAt)})]},d.id))})]}),i&&h.length===0&&s.jsx("p",{className:"muted",style:{padding:16},children:"No jobs yet."}),i&&s.jsx(ps,{page:r.page,pageSize:r.pageSize,total:i.total,onPage:r.setPage,onPageSize:r.setPageSize,label:"jobs"})]})]})}function Pm(e){return e.replace(/\.md$/i,"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|-+$/g,"")||"spec"}function ZT(e){const t=e.filter(r=>r.lastResult);if(!t.length)return null;const n=t.filter(r=>r.lastResult.status==="passed").length;return n===t.length?{status:"passed",label:`${n}/${t.length} passed`}:{status:"failed",label:`${t.length-n}/${t.length} failed`}}function eP(){const e=ut(),{openNewSpec:t}=hs(),{specs:n,mapping:r,refresh:i}=Xt(),[l,a]=j.useState("all"),[o,u]=j.useState(""),[c,h]=j.useState(new Set),[d,f]=j.useState(!1),[m,p]=j.useState(null),g=j.useRef(null),w=j.useMemo(()=>n.map(L=>{const A=r.filter(U=>U.specFile===L.file&&U.status!=="orphan"),z=new Set(A.filter(U=>U.testFile).map(U=>U.tcId)).size;return{spec:L,mapped:z,total:L.parsed.tcs.length,last:ZT(A)}}),[n,r]),x=L=>L.total>0&&L.mapped>=L.total,y=[...new Set(n.flatMap(L=>L.parsed.tags))].sort(),v=o.trim().toLowerCase(),b=w.filter(L=>(l==="all"||(l==="mapped"?x(L):!x(L)))&&(!v||`${L.spec.file} ${L.spec.parsed.title} ${L.spec.parsed.tags.join(" ")}`.toLowerCase().includes(v))&&(c.size===0||L.spec.parsed.tags.some(A=>c.has(A)))),E=Hh(b,[l,o,c]),k=w.reduce((L,A)=>L+A.total,0),R=w.reduce((L,A)=>L+Math.max(A.total-A.mapped,0),0),T=async L=>{const A=L.filter(U=>/\.md$/i.test(U.name));if(!A.length)return p("Only .md files are accepted");if(A.length===1){t({name:Pm(A[0].name),content:await A[0].text()});return}const z=[];for(const U of A)try{await q.createSpec(`${Pm(U.name)}.md`,await U.text())}catch(I){z.push(`${U.name}: ${I.message}`)}i(),p(z.length?z.join(`
384
- `):null)},D=L=>{T([...L.target.files??[]]),L.target.value=""},C=L=>void q.createJob({type:"testrun",spec:L,repeatEach:1}).then(A=>e(`/runs/${A.id}`)).catch(A=>p(A.message));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Specs"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Specs"}),s.jsx("p",{className:"page-sub",children:"Markdown specs and the test cases mapped to Playwright scripts."})]}),s.jsxs("div",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>{var L;return(L=g.current)==null?void 0:L.click()},children:[s.jsx(Lo,{size:15})," Import .md"]}),s.jsx("input",{ref:g,type:"file",accept:".md,text/markdown",multiple:!0,hidden:!0,onChange:D}),s.jsxs(ye,{className:"btn ghost",to:"/specs/from-requirement",title:"QA Test Case Writer agent drafts the spec from a BA requirement",children:[s.jsx(fl,{size:15})," Generator"]}),s.jsxs("button",{className:"btn",onClick:()=>t(),children:[s.jsx(Qt,{size:15})," New spec"]})]})]}),s.jsx(Pe,{error:m}),s.jsxs("div",{className:"toolbar",children:[s.jsx(bn,{value:l,onChange:a,items:[{id:"all",label:s.jsxs(s.Fragment,{children:["All ",s.jsx("span",{className:"tab-count",children:w.length})]})},{id:"mapped",label:s.jsxs(s.Fragment,{children:["Mapped ",s.jsx("span",{className:"tab-count",children:w.filter(x).length})]})},{id:"needs",label:s.jsxs(s.Fragment,{children:["Needs mapping ",s.jsx("span",{className:"tab-count",children:w.filter(L=>!x(L)).length})]})}]}),s.jsx("div",{className:"grow"}),s.jsxs("label",{className:"search-input",children:[s.jsx(Ro,{size:15}),s.jsx("input",{value:o,onChange:L=>u(L.target.value),placeholder:"Search by file, title or tag","aria-label":"Search specs"})]}),s.jsxs("div",{className:"menu-wrap",children:[s.jsxs("button",{className:`btn ghost ${c.size?"on":""}`,onClick:()=>f(L=>!L),"aria-expanded":d,children:[s.jsx(ub,{size:15})," Tags",c.size?` (${c.size})`:""]}),d&&s.jsxs("div",{className:"menu",onMouseLeave:()=>f(!1),children:[y.length===0&&s.jsx("div",{className:"muted small pad-sm",children:"No tags yet"}),y.map(L=>s.jsxs("label",{className:"menu-item",children:[s.jsx("input",{type:"checkbox",className:"check-box",checked:c.has(L),onChange:()=>h(A=>{const z=new Set(A);return z.has(L)?z.delete(L):z.add(L),z})}),L]},L)),c.size>0&&s.jsx("button",{className:"btn ghost sm",style:{margin:6},onClick:()=>h(new Set),children:"Clear"})]})]})]}),s.jsxs("div",{className:"table-wrap table-fit",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"Tags"}),s.jsx("th",{className:"num",children:"Test cases"}),s.jsx("th",{children:"Coverage"}),s.jsx("th",{children:"Last result"}),s.jsx("th",{className:"num",children:"Actions"})]})}),s.jsx("tbody",{children:E.pageItems.map(({spec:L,mapped:A,total:z,last:U})=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsxs(ye,{to:`/specs/${L.file}`,className:"file-cell",children:[s.jsx("span",{className:"file-icon",children:s.jsx(jr,{size:16})}),s.jsxs("div",{children:[s.jsx("div",{className:"strong",children:L.parsed.title||L.file}),s.jsxs("div",{className:"sub mono",children:[L.file,L.parsed.warnings.length>0&&s.jsxs("span",{style:{color:"var(--warn)"},children:[" · ⚠ ",L.parsed.warnings.length]})]})]})]})}),s.jsx("td",{children:L.parsed.tags.map(I=>s.jsx("span",{className:"tag",children:I},I))}),s.jsx("td",{className:"num",children:z}),s.jsx("td",{children:s.jsxs("div",{className:"cov",children:[s.jsx("span",{className:"progress",children:s.jsx("i",{style:{width:`${z?A/z*100:0}%`}})}),s.jsxs("span",{className:"small",children:[A,"/",z]})]})}),s.jsx("td",{children:U?s.jsx(ni,{status:U.status,children:U.label}):s.jsx(ni,{status:null})}),s.jsx("td",{className:"num",children:s.jsxs("div",{className:"row",style:{justifyContent:"flex-end",flexWrap:"nowrap",gap:6},children:[s.jsx(ye,{to:`/specs/${L.file}`,className:"btn ghost sm",children:"Open"}),s.jsx("button",{className:"btn ghost sm icon",onClick:()=>C(L.file),disabled:A===0,title:A?`Run ${L.file}`:"Spec has no test file yet","aria-label":`Run ${L.file}`,children:s.jsx(ft,{size:12})})]})})]},L.file))})]}),b.length===0&&s.jsx("p",{className:"muted pad",children:w.length?"No specs match the filter.":"No specs yet."}),b.length>0&&s.jsx(ps,{...E.props,label:"specs"}),s.jsxs("div",{className:"table-foot",children:[s.jsxs("span",{children:[w.length," specs · ",k," test cases"]}),s.jsx("span",{children:R?`${R} test cases need mapping`:"All test cases mapped"})]})]})]})}function tP({value:e,onChange:t}){const n=j.useRef(null),r=e.split(`
385
- `).length;return s.jsxs("div",{className:"line-editor",children:[s.jsx("div",{className:"gutter",ref:n,"aria-hidden":"true",children:Array.from({length:r},(i,l)=>s.jsx("div",{children:l+1},l))}),s.jsx("textarea",{value:e,onChange:i=>t(i.target.value),onScroll:i=>{n.current&&(n.current.scrollTop=i.currentTarget.scrollTop)},spellCheck:!1,wrap:"off","aria-label":"Spec content (markdown)"})]})}const zv=/^(given|when|then|and|but)\b[: ]?\s*(.*)$/i,nP=/^\s*(tags|technique)\s*:/i;function rP(e){let t="given";return e.map(n=>{const r=n.trim().match(zv),i=r[1].toLowerCase(),l=i==="and"||i==="but";return l||(t=i),{keyword:r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),kw:t,continuation:l,text:r[2].trim()}})}function sP({text:e}){return s.jsx(ui,{components:{p:({children:t})=>s.jsx(s.Fragment,{children:t})},children:e})}function iP({lines:e}){return s.jsx("ol",{className:"gherkin-steps",children:rP(e).map((t,n)=>s.jsxs("li",{className:`gherkin-step kw-${t.kw}${t.continuation?" continuation":""}`,children:[s.jsx("span",{className:"gherkin-kw",children:t.keyword})," ",s.jsx("span",{className:"gherkin-text",children:s.jsx(sP,{text:t.text})})]},n))})}function lP(e){const t=[];for(const n of e.split(/\r?\n/)){if(nP.test(n))continue;const r=zv.test(n.trim()),i=t[t.length-1];i&&i.gherkin===r?i.lines.push(n):t.push({gherkin:r,lines:[n]})}return t}function aP({text:e}){return s.jsx(s.Fragment,{children:lP(e).map((t,n)=>{if(t.gherkin)return s.jsx(iP,{lines:t.lines},n);const r=t.lines.join(`
386
- `).trim();return r?s.jsx("div",{className:"md",children:s.jsx(ui,{children:r})},n):null})})}function oP({content:e,parsed:t}){var l;const n=e.split(/\r?\n/),r=((l=t.tcs[0])==null?void 0:l.line)??n.length+1,i=n.slice(0,r-1).filter(a=>!/^\s*#\s+/.test(a)&&!/^\s*(tags|preconditions)\s*:/i.test(a)).join(`
383
+ - ...`,"aria-label":"Requirement text"}),s.jsxs("span",{className:`small ${w?"":"muted"}`,style:{fontWeight:400,color:w?"var(--fail)":void 0},children:[i.length.toLocaleString()," / ",wu.toLocaleString()," characters"]})]}),s.jsx("input",{ref:f,type:"file",accept:".md,.txt,text/markdown,text/plain",hidden:!0,onChange:v=>{var b;return void x((b=v.target.files)==null?void 0:b[0])}}),s.jsx(Le,{error:h}),s.jsx("div",{className:"row",style:{justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"btn",disabled:u,children:[s.jsx(hl,{size:15})," ",u?"Starting…":"Generate spec"]})})]}),s.jsxs("div",{className:"card pad",children:[s.jsxs("div",{className:"row",style:{marginBottom:12},children:[s.jsx(Ft,{agent:"specwriter",size:36}),s.jsxs("div",{children:[s.jsx("b",{children:"How it works"}),s.jsx("div",{className:"muted small",children:"QA Test Case Writer agent (Claude Code)"})]})]}),s.jsxs("ol",{className:"req-steps",children:[s.jsx("li",{children:"The requirement is saved with the job. The agent reads it, plus existing specs for style."}),s.jsxs("li",{children:["It writes ",s.jsxs("code",{children:["specs/",m||"<name>",".md"]})," with one ",s.jsx("code",{children:"## TC-…"})," per behaviour, designed with equivalence partitioning, boundary values, decision tables, state transitions and use cases, always adding edge and security cases."]}),s.jsxs("li",{children:["Each test case gets a test level tag (",s.jsx("b",{children:"IT"}),", ",s.jsx("b",{children:"ST"}),", ",s.jsx("b",{children:"SIT"}),", ",s.jsx("b",{children:"UAT"}),") plus type tags (smoke, negative, boundary, security…) and its design technique."]}),s.jsx("li",{children:"Its assumptions and open questions for the BA are listed in the job output."}),s.jsxs("li",{children:["Review the spec in the editor, then run ",s.jsx("b",{children:"Generate tests"}),"."]})]}),s.jsxs("p",{className:"muted small",style:{marginTop:14},children:["The agent can only write that spec file. It does not open a browser and does not invent credentials. Accounts come from ",s.jsx("code",{children:".env"})," when tests are generated."]})]})]})]})}function JT(){const e=ut(),[t,n]=j.useState("all"),r=Tl([t]),{data:i,error:l,reload:a}=_e(()=>q.jobsPage({page:r.page,pageSize:r.pageSize,type:t==="all"?void 0:t}),[r.page,r.pageSize,t]),[o,u]=j.useState(null),c=((i==null?void 0:i.items)??[]).some(d=>d.status==="queued"||d.status==="running");j.useEffect(()=>{if(!c)return;const d=setInterval(a,2e3);return()=>clearInterval(d)},[c,a]);const h=(i==null?void 0:i.items)??[];return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Recent runs"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Recent runs"}),s.jsx("p",{className:"page-sub",children:"Explore, generate, run and heal jobs with their agent timeline."})]})}),s.jsxs("div",{className:"row between",style:{marginBottom:14},children:[s.jsx(kn,{value:t,onChange:n,items:["all","testrun","generate","explore","heal","spec","context"].map(d=>({id:d,label:d==="all"?"All":br[d]}))}),s.jsx("div",{className:"row",children:s.jsxs("button",{className:"btn dark",onClick:()=>void q.createJob({type:"testrun",repeatEach:1}).then(d=>e(`/runs/${d.id}`)).catch(d=>u(d.message)),children:[s.jsx(ft,{size:14})," Run all tests"]})})]}),s.jsx(Le,{error:l??o}),s.jsxs("div",{className:"table-wrap",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Job"}),s.jsx("th",{children:"Agents"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Result"}),s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Duration"})]})}),s.jsx("tbody",{children:h.map(d=>s.jsxs("tr",{onClick:()=>e(`/runs/${d.id}`),style:{cursor:"pointer"},children:[s.jsx("td",{children:s.jsxs("div",{className:"file-cell",children:[s.jsx("span",{className:"file-icon",children:s.jsx(ft,{size:14})}),s.jsxs("div",{children:[s.jsxs("div",{children:["#",d.id," ",br[d.type]]}),s.jsxs("div",{className:"sub",children:[d.args.name??d.target,d.args.tcId?` · ${d.args.tcId}`:"",d.args.repeatEach&&d.args.repeatEach>1?` · ${d.args.repeatEach}×`:""]})]})]})}),s.jsx("td",{children:s.jsx($b,{agents:d.agents})}),s.jsxs("td",{children:[s.jsx(An,{status:d.status}),d.warning&&s.jsx("span",{title:d.warning,style:{color:"var(--warn)"},children:" ⚠"})]}),s.jsx("td",{className:"muted small",children:d.summary??"—"}),s.jsx("td",{className:"muted small",children:Rt(d.startedAt??d.createdAt)}),s.jsx("td",{className:"muted small",children:kr(d.startedAt,d.finishedAt)})]},d.id))})]}),i&&h.length===0&&s.jsx("p",{className:"muted",style:{padding:16},children:"No jobs yet."}),i&&s.jsx(ps,{page:r.page,pageSize:r.pageSize,total:i.total,onPage:r.setPage,onPageSize:r.setPageSize,label:"jobs"})]})]})}function Pm(e){return e.replace(/\.md$/i,"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|-+$/g,"")||"spec"}function XT(e){const t=e.filter(r=>r.lastResult);if(!t.length)return null;const n=t.filter(r=>r.lastResult.status==="passed").length;return n===t.length?{status:"passed",label:`${n}/${t.length} passed`}:{status:"failed",label:`${t.length-n}/${t.length} failed`}}function ZT(){const e=ut(),{openNewSpec:t}=hs(),{specs:n,mapping:r,refresh:i}=Zt(),[l,a]=j.useState("all"),[o,u]=j.useState(""),[c,h]=j.useState(new Set),[d,f]=j.useState(!1),[m,p]=j.useState(null),g=j.useRef(null),w=j.useMemo(()=>n.map(L=>{const A=r.filter(U=>U.specFile===L.file&&U.status!=="orphan"),z=new Set(A.filter(U=>U.testFile).map(U=>U.tcId)).size;return{spec:L,mapped:z,total:L.parsed.tcs.length,last:XT(A)}}),[n,r]),x=L=>L.total>0&&L.mapped>=L.total,y=[...new Set(n.flatMap(L=>L.parsed.tags))].sort(),v=o.trim().toLowerCase(),b=w.filter(L=>(l==="all"||(l==="mapped"?x(L):!x(L)))&&(!v||`${L.spec.file} ${L.spec.parsed.title} ${L.spec.parsed.tags.join(" ")}`.toLowerCase().includes(v))&&(c.size===0||L.spec.parsed.tags.some(A=>c.has(A)))),E=Hh(b,[l,o,c]),k=w.reduce((L,A)=>L+A.total,0),R=w.reduce((L,A)=>L+Math.max(A.total-A.mapped,0),0),T=async L=>{const A=L.filter(U=>/\.md$/i.test(U.name));if(!A.length)return p("Only .md files are accepted");if(A.length===1){t({name:Pm(A[0].name),content:await A[0].text()});return}const z=[];for(const U of A)try{await q.createSpec(`${Pm(U.name)}.md`,await U.text())}catch(I){z.push(`${U.name}: ${I.message}`)}i(),p(z.length?z.join(`
384
+ `):null)},D=L=>{T([...L.target.files??[]]),L.target.value=""},C=L=>void q.createJob({type:"testrun",spec:L,repeatEach:1}).then(A=>e(`/runs/${A.id}`)).catch(A=>p(A.message));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Specs"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Specs"}),s.jsx("p",{className:"page-sub",children:"Markdown specs and the test cases mapped to Playwright scripts."})]}),s.jsxs("div",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>{var L;return(L=g.current)==null?void 0:L.click()},children:[s.jsx(Lo,{size:15})," Import .md"]}),s.jsx("input",{ref:g,type:"file",accept:".md,text/markdown",multiple:!0,hidden:!0,onChange:D}),s.jsxs(ye,{className:"btn ghost",to:"/specs/from-requirement",title:"QA Test Case Writer agent drafts the spec from a BA requirement",children:[s.jsx(hl,{size:15})," Generator"]}),s.jsxs("button",{className:"btn",onClick:()=>t(),children:[s.jsx(qt,{size:15})," New spec"]})]})]}),s.jsx(Le,{error:m}),s.jsxs("div",{className:"toolbar",children:[s.jsx(kn,{value:l,onChange:a,items:[{id:"all",label:s.jsxs(s.Fragment,{children:["All ",s.jsx("span",{className:"tab-count",children:w.length})]})},{id:"mapped",label:s.jsxs(s.Fragment,{children:["Mapped ",s.jsx("span",{className:"tab-count",children:w.filter(x).length})]})},{id:"needs",label:s.jsxs(s.Fragment,{children:["Needs mapping ",s.jsx("span",{className:"tab-count",children:w.filter(L=>!x(L)).length})]})}]}),s.jsx("div",{className:"grow"}),s.jsxs("label",{className:"search-input",children:[s.jsx(Ro,{size:15}),s.jsx("input",{value:o,onChange:L=>u(L.target.value),placeholder:"Search by file, title or tag","aria-label":"Search specs"})]}),s.jsxs("div",{className:"menu-wrap",children:[s.jsxs("button",{className:`btn ghost ${c.size?"on":""}`,onClick:()=>f(L=>!L),"aria-expanded":d,children:[s.jsx(db,{size:15})," Tags",c.size?` (${c.size})`:""]}),d&&s.jsxs("div",{className:"menu",onMouseLeave:()=>f(!1),children:[y.length===0&&s.jsx("div",{className:"muted small pad-sm",children:"No tags yet"}),y.map(L=>s.jsxs("label",{className:"menu-item",children:[s.jsx("input",{type:"checkbox",className:"check-box",checked:c.has(L),onChange:()=>h(A=>{const z=new Set(A);return z.has(L)?z.delete(L):z.add(L),z})}),L]},L)),c.size>0&&s.jsx("button",{className:"btn ghost sm",style:{margin:6},onClick:()=>h(new Set),children:"Clear"})]})]})]}),s.jsxs("div",{className:"table-wrap table-fit",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"Tags"}),s.jsx("th",{className:"num",children:"Test cases"}),s.jsx("th",{children:"Coverage"}),s.jsx("th",{children:"Last result"}),s.jsx("th",{className:"num",children:"Actions"})]})}),s.jsx("tbody",{children:E.pageItems.map(({spec:L,mapped:A,total:z,last:U})=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsxs(ye,{to:`/specs/${L.file}`,className:"file-cell",children:[s.jsx("span",{className:"file-icon",children:s.jsx(jr,{size:16})}),s.jsxs("div",{children:[s.jsx("div",{className:"strong",children:L.parsed.title||L.file}),s.jsxs("div",{className:"sub mono",children:[L.file,L.parsed.warnings.length>0&&s.jsxs("span",{style:{color:"var(--warn)"},children:[" · ⚠ ",L.parsed.warnings.length]})]})]})]})}),s.jsx("td",{children:L.parsed.tags.map(I=>s.jsx("span",{className:"tag",children:I},I))}),s.jsx("td",{className:"num",children:z}),s.jsx("td",{children:s.jsxs("div",{className:"cov",children:[s.jsx("span",{className:"progress",children:s.jsx("i",{style:{width:`${z?A/z*100:0}%`}})}),s.jsxs("span",{className:"small",children:[A,"/",z]})]})}),s.jsx("td",{children:U?s.jsx(ni,{status:U.status,children:U.label}):s.jsx(ni,{status:null})}),s.jsx("td",{className:"num",children:s.jsxs("div",{className:"row",style:{justifyContent:"flex-end",flexWrap:"nowrap",gap:6},children:[s.jsx(ye,{to:`/specs/${L.file}`,className:"btn ghost sm",children:"Open"}),s.jsx("button",{className:"btn ghost sm icon",onClick:()=>C(L.file),disabled:A===0,title:A?`Run ${L.file}`:"Spec has no test file yet","aria-label":`Run ${L.file}`,children:s.jsx(ft,{size:12})})]})})]},L.file))})]}),b.length===0&&s.jsx("p",{className:"muted pad",children:w.length?"No specs match the filter.":"No specs yet."}),b.length>0&&s.jsx(ps,{...E.props,label:"specs"}),s.jsxs("div",{className:"table-foot",children:[s.jsxs("span",{children:[w.length," specs · ",k," test cases"]}),s.jsx("span",{children:R?`${R} test cases need mapping`:"All test cases mapped"})]})]})]})}function eP({value:e,onChange:t}){const n=j.useRef(null),r=e.split(`
385
+ `).length;return s.jsxs("div",{className:"line-editor",children:[s.jsx("div",{className:"gutter",ref:n,"aria-hidden":"true",children:Array.from({length:r},(i,l)=>s.jsx("div",{children:l+1},l))}),s.jsx("textarea",{value:e,onChange:i=>t(i.target.value),onScroll:i=>{n.current&&(n.current.scrollTop=i.currentTarget.scrollTop)},spellCheck:!1,wrap:"off","aria-label":"Spec content (markdown)"})]})}const $v=/^(given|when|then|and|but)\b[: ]?\s*(.*)$/i,tP=/^\s*(tags|technique)\s*:/i;function nP(e){let t="given";return e.map(n=>{const r=n.trim().match($v),i=r[1].toLowerCase(),l=i==="and"||i==="but";return l||(t=i),{keyword:r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),kw:t,continuation:l,text:r[2].trim()}})}function rP({text:e}){return s.jsx(ui,{components:{p:({children:t})=>s.jsx(s.Fragment,{children:t})},children:e})}function sP({lines:e}){return s.jsx("ol",{className:"gherkin-steps",children:nP(e).map((t,n)=>s.jsxs("li",{className:`gherkin-step kw-${t.kw}${t.continuation?" continuation":""}`,children:[s.jsx("span",{className:"gherkin-kw",children:t.keyword})," ",s.jsx("span",{className:"gherkin-text",children:s.jsx(rP,{text:t.text})})]},n))})}function iP(e){const t=[];for(const n of e.split(/\r?\n/)){if(tP.test(n))continue;const r=$v.test(n.trim()),i=t[t.length-1];i&&i.gherkin===r?i.lines.push(n):t.push({gherkin:r,lines:[n]})}return t}function lP({text:e}){return s.jsx(s.Fragment,{children:iP(e).map((t,n)=>{if(t.gherkin)return s.jsx(sP,{lines:t.lines},n);const r=t.lines.join(`
386
+ `).trim();return r?s.jsx("div",{className:"md",children:s.jsx(ui,{children:r})},n):null})})}function aP({content:e,parsed:t}){var l;const n=e.split(/\r?\n/),r=((l=t.tcs[0])==null?void 0:l.line)??n.length+1,i=n.slice(0,r-1).filter(a=>!/^\s*#\s+/.test(a)&&!/^\s*(tags|preconditions)\s*:/i.test(a)).join(`
387
387
  `).trim();return s.jsxs("div",{className:"spec-preview",children:[s.jsx("h2",{children:t.title||"Untitled spec"}),(t.tags.length>0||t.preconditions)&&s.jsxs("p",{className:"meta",children:[t.tags.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Tags:"})," ",t.tags.join(", ")]}),t.tags.length>0&&t.preconditions&&" · ",t.preconditions&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Preconditions:"})," ",t.preconditions]})]}),i&&s.jsx("div",{className:"md",children:s.jsx(ui,{children:i})}),t.tcs.map((a,o)=>{var h;const u=((h=t.tcs[o+1])==null?void 0:h.line)??n.length+1,c=n.slice(a.line,u-1).join(`
388
- `).trim();return s.jsxs("div",{className:"tc-card",children:[s.jsxs("div",{className:"tc-card-head",children:[s.jsx("span",{className:"tc-chip",children:a.id}),s.jsx("b",{children:a.title}),a.tags.map(d=>s.jsx("span",{className:"tag",children:d},d)),a.technique&&s.jsxs("span",{className:"muted small",children:["Technique: ",a.technique]})]}),c&&s.jsx(aP,{text:c})]},`${a.id}-${o}`)})]})}function uP(){const{file:e=""}=li(),t=ut(),{refresh:n,mapping:r}=Xt(),i=In(),l=Ar(),[a,o]=j.useState(""),[u,c]=j.useState(""),[h,d]=j.useState(),[f,m]=j.useState(!1),[p,g]=j.useState(null),[w,x]=j.useState(null),[y,v]=j.useState(!1),[b,E]=j.useState(1),[k,R]=j.useState("split"),T=j.useRef(!1),D=Me(()=>q.jobs(),[e]),C=f&&a!==u,L=j.useMemo(()=>pb(a),[a]),A=r.filter(F=>F.specFile===e&&F.status!=="orphan"),z=new Set(A.filter(F=>F.testFile).map(F=>F.tcId)),U=A.filter(F=>F.lastResult),I=U.filter(F=>F.lastResult.status==="passed").length,Q=(D.data??[]).filter(F=>F.target===e).slice(0,5),J=j.useCallback(async()=>{try{const F=await q.spec(e);o(F.content),c(F.content),d(F.mtimeMs),m(!0),g(null)}catch(F){g(F.message)}},[e]);j.useEffect(()=>{m(!1),T.current=!1,J()},[J]);const H=gh(({currentLocation:F,nextLocation:Z})=>C&&!T.current&&F.pathname!==Z.pathname);Ph(H,{title:"Leave with unsaved changes?",message:"Your edits to this spec are not saved and will be lost.",confirmLabel:"Discard changes",danger:!0}),j.useEffect(()=>{const F=Z=>{C&&Z.preventDefault()};return window.addEventListener("beforeunload",F),()=>window.removeEventListener("beforeunload",F)},[C]);const X=j.useCallback(async(F=!1)=>{v(!0),x(null);try{const Z=await q.saveSpec(e,a,F?void 0:h);return c(a),d(Z.mtimeMs),g(null),x("Saved."),n(),!0}catch(Z){return Z instanceof to&&Z.status===409&&await i({title:"Spec changed on disk",message:`${Z.message} Overwrite it with your current edits?`,confirmLabel:"Overwrite",danger:!0})?(v(!1),X(!0)):(g(Z.message),!1)}finally{v(!1)}},[a,e,h,n,i]);j.useEffect(()=>{const F=Z=>{(Z.ctrlKey||Z.metaKey)&&Z.key.toLowerCase()==="s"&&(Z.preventDefault(),C&&X())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,X]);const S=async F=>{if(!(C&&!await X()))try{const Z=await q.createJob(F);T.current=!0,t(`/runs/${Z.id}`)}catch(Z){g(Z.message)}},ae=async()=>{if(await i({title:`Delete ${e}?`,message:"The spec file is removed. Its test file in tests/e2e (if any) is NOT deleted. This cannot be undone.",confirmLabel:"Delete spec",danger:!0}))try{await q.deleteSpec(e),T.current=!0,n(),l.success(`Deleted ${e}`),t("/specs")}catch(Z){g(Z.message)}},O=L.tcs.length===0,N=Hh(L.tcs,[e]);return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Specs",to:"/specs"},{label:e}]}),s.jsxs(eS,{children:[s.jsxs("span",{className:"chip",children:["Coverage ",z.size,"/",L.tcs.length]}),s.jsxs("span",{className:`chip ${I<U.length?"fail":"ok"}`,children:["Pass rate ",I,"/",U.length]})]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{className:"row",style:{alignItems:"flex-start",flexWrap:"nowrap"},children:[s.jsx("button",{className:"btn ghost icon square",onClick:()=>t("/specs"),"aria-label":"Back to specs list",title:"Back to Specs",children:s.jsx(ab,{size:16})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"page-title",children:[L.title||e," ",C&&s.jsx("span",{className:"badge stale",children:"unsaved"})]}),s.jsxs("p",{className:"page-sub row",style:{gap:6},children:[s.jsx("span",{className:"mono",children:e}),L.tags.map(F=>s.jsxs("span",{children:["· ",s.jsx("span",{className:"tag",children:F})]},F))]})]})]}),s.jsxs("div",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>void X(),disabled:!C||y,title:"Ctrl+S",children:[s.jsx(us,{size:15})," Save"]}),s.jsx("button",{className:"btn ghost icon square",onClick:()=>void(async()=>{C&&!await i({title:"Discard unsaved changes?",message:"Reloading replaces your edits with the file on disk.",confirmLabel:"Discard & reload",danger:!0})||await J()})(),disabled:y,title:"Reload from disk","aria-label":"Reload from disk",children:s.jsx(Rr,{size:15})}),s.jsx("button",{className:"btn danger icon square",onClick:()=>void ae(),disabled:y,title:"Delete spec","aria-label":"Delete spec",children:s.jsx(Lr,{size:15})})]})]}),s.jsxs("div",{className:"pipeline-bar",children:[s.jsxs("div",{className:"pipeline-steps",title:"Runs with Claude Code, no API key needed",children:[s.jsx("b",{children:"Pipeline"}),s.jsx("span",{className:"step",children:Se.explorer.label}),"→",s.jsx("span",{className:"step",children:Se.generator.label}),"→",s.jsx("span",{className:"step",children:Se.validator.label}),"→",s.jsxs("span",{className:"step",children:[Se.healer.label," ≤ 2"]})]}),s.jsx("div",{className:"grow"}),s.jsxs("button",{className:"btn ghost",onClick:()=>void S({type:"explore",spec:e}),disabled:y||O,children:[s.jsx(Py,{size:15})," Explore"]}),s.jsxs("button",{className:"btn",onClick:()=>void S({type:"generate",spec:e}),disabled:y||O,children:[s.jsx(wh,{size:15})," Generate"]}),s.jsx("select",{className:"select",value:b,onChange:F=>E(Number(F.target.value)),"aria-label":"Repeat count",children:[1,2,3,5,10].map(F=>s.jsxs("option",{value:F,children:[F,"×"]},F))}),s.jsxs("button",{className:"btn dark",onClick:()=>void S({type:"testrun",spec:e,repeatEach:b}),disabled:y||z.size===0,title:z.size?"":"Spec has no test file yet",children:[s.jsx(ft,{size:13})," Run"]})]}),s.jsx(Pe,{error:p}),w&&s.jsx("div",{className:"info-box",children:w}),f&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Spec content"}),s.jsx(bn,{value:k,onChange:R,items:[{id:"editor",label:"Editor"},{id:"split",label:"Split"},{id:"preview",label:"Preview"}]})]}),s.jsxs("div",{className:`spec-body ${k}`,children:[k!=="preview"&&s.jsx(tP,{value:a,onChange:o}),k!=="editor"&&s.jsx(oP,{content:a,parsed:L})]})]}),L.warnings.map(F=>s.jsxs("div",{className:"warn-box",children:["⚠ ",F]},F)),s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsx("div",{className:"card-head",children:s.jsxs("h3",{children:["Test cases ",s.jsxs("span",{className:"muted",children:["(",L.tcs.length,")"]})]})}),s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"TC-ID"}),s.jsx("th",{children:"Name"}),s.jsx("th",{children:"Mapping"}),s.jsx("th",{children:"Last result"}),s.jsx("th",{className:"num",children:"Actions"})]})}),s.jsx("tbody",{children:N.pageItems.map(F=>{const Z=A.find(B=>B.tcId===F.id),oe=Z==null?void 0:Z.lastResult;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{className:"strong",children:F.id})}),s.jsx("td",{children:F.title}),s.jsx("td",{children:Z!=null&&Z.testFile?s.jsxs("span",{className:"map-link",title:`${Z.testFile}:${Z.testLine??""}`,children:[s.jsx(vh,{size:13}),s.jsx("code",{children:Z.testFile.split("/").pop()}),Z.status==="stale"&&s.jsx(dt,{status:"stale"})]}):s.jsx(dt,{status:(Z==null?void 0:Z.status)??"missing"})}),s.jsx("td",{children:oe?s.jsx(ye,{to:`/runs/${oe.jobId}`,children:s.jsx(ni,{status:oe.status,children:oe.status.charAt(0).toUpperCase()+oe.status.slice(1)})}):s.jsx(ni,{status:null})}),s.jsx("td",{className:"num",children:s.jsxs("div",{className:"tc-actions",children:[s.jsx("button",{className:"btn ghost icon tc-action gen",disabled:y,title:z.has(F.id)?`Regenerate the test of ${F.id} only (Explorer → Generator → Validator)`:`Generate a test for ${F.id} only (Explorer → Generator → Validator)`,"aria-label":`Generate ${F.id}`,onClick:()=>void S({type:"generate",spec:e,tcId:F.id}),children:s.jsx(rb,{size:16})}),s.jsx("button",{className:"btn ghost icon tc-action run",disabled:!z.has(F.id)||y,title:z.has(F.id)?`Run ${F.id}`:"TC has no test yet, run Generate","aria-label":`Run ${F.id}`,onClick:()=>void S({type:"testrun",spec:e,tcId:F.id,repeatEach:b}),children:s.jsx(nb,{size:14})})]})})]},`${F.id}-${F.line}`)})})]}),O&&s.jsx("p",{className:"muted pad",children:"No test cases yet. Add a heading like “## TC-XXX-001: Name”."}),!O&&s.jsx(ps,{...N.props,label:"test cases"})]}),Q.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"section-title",children:"Recent jobs for this spec"}),s.jsx("div",{className:"row",children:Q.map(F=>s.jsxs(ye,{to:`/runs/${F.id}`,className:"card pad row",style:{padding:"8px 12px"},children:["#",F.id," ",F.type," ",s.jsx(kn,{status:F.status})]},F.id))})]})]})]})}const cP={settings:"path set below",env:"QA_STUDIO_CLAUDE_BIN",path:"found on PATH"};function zu({label:e,check:t,pending:n}){const r=t?t.ok?"ok":"fail":"pending";return s.jsxs("div",{className:`cc-row ${r}`,children:[s.jsx("span",{className:"cc-mark","aria-hidden":"true",children:r==="ok"?s.jsx(jh,{size:13}):r==="fail"?s.jsx(wr,{size:13}):"?"}),s.jsx("span",{className:"cc-label",children:e}),s.jsx("span",{className:"cc-detail",children:t?t.detail:n})]})}function dP({status:e}){const t=e.binary.ok?e.version.ok?e.test&&!e.test.ok?e.test.hint:null:"version":"path";return!t&&e.state!=="unverified"?null:s.jsxs("div",{className:"cc-guide",children:[t==="path"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Install Claude Code, or tell Agent Studio where it is"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["Install it: in PowerShell ",s.jsx("code",{children:"irm https://claude.ai/install.ps1 | iex"}),", or with Node.js ",s.jsx("code",{children:"npm install -g @anthropic-ai/claude-code"}),"."]}),s.jsxs("li",{children:["Open a new terminal and check: ",s.jsx("code",{children:"claude --version"}),"."]}),s.jsxs("li",{children:["If Agent Studio still cannot find it, paste the full path of ",s.jsx("code",{children:"claude.exe"})," below (find it with ",s.jsx("code",{children:"where.exe claude"}),"; for an npm install use the"," ",s.jsx("code",{children:"claude.exe"})," inside ",s.jsx("code",{children:"node_modules\\@anthropic-ai\\claude-code\\bin"}),", not ",s.jsx("code",{children:"claude.cmd"}),")."]})]})]}),t==="version"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"The binary was found but does not start"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["Run ",s.jsxs("code",{children:[e.binary.detail," --version"]})," in a terminal to see the error."]}),s.jsx("li",{children:"Reinstall or update Claude Code, or point the path below to a working claude.exe."})]})]}),t==="login"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Log Claude Code in"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["In a terminal run ",s.jsx("code",{children:"claude"}),", type ",s.jsx("code",{children:"/login"})," and sign in with your Claude account (or a Console API key)."]}),s.jsxs("li",{children:["Using an API key instead: set ",s.jsx("code",{children:"ANTHROPIC_API_KEY"})," in the environment that starts Agent Studio (not only in ",s.jsx("code",{children:".env"}),"), then restart Agent Studio."]}),s.jsx("li",{children:"Come back and run the test prompt again."})]})]}),t==="network"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Claude Code did not answer"}),s.jsxs("ol",{children:[s.jsx("li",{children:"Check the internet connection, proxy or VPN of this machine."}),s.jsxs("li",{children:["Run ",s.jsx("code",{children:'claude -p "hi"'})," in a terminal to see the error, then test again."]})]})]}),t==="other"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Claude Code returned an error"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["Run ",s.jsx("code",{children:'claude -p "hi"'})," in a terminal from the repo folder to see the full message."]}),s.jsxs("li",{children:["Check usage limits with ",s.jsx("code",{children:"/usage"})," in Claude Code, then test again."]})]})]}),!t&&e.state==="unverified"&&s.jsxs("span",{children:["Claude Code is installed. Run the ",s.jsx("b",{children:"test prompt"})," once to confirm it is logged in and can answer (one short request on the smallest model; on a subscription it only counts toward usage limits)."]})]})}function hP({onChange:e}){const[t,n]=j.useState(null),[r,i]=j.useState(!1),[l,a]=j.useState(!1),[o,u]=j.useState(""),[c,h]=j.useState(null),d=async()=>{i(!0);try{const g=await q.claudeStatus();n(g),u(w=>w||g.configuredPath),h(null),e==null||e()}catch(g){h(g.message)}finally{i(!1)}};j.useEffect(()=>{d()},[]);const f=async()=>{a(!0);try{await q.claudeTest(),await d()}catch(g){h(g.message)}finally{a(!1)}},m=async g=>{try{await q.saveSettings({claudeBin:g}),u(g),h(null),await d()}catch(w){h(w.message)}},p=(t==null?void 0:t.state)==="ready"?"Ready":(t==null?void 0:t.state)==="unverified"?"Installed, not verified":t?"Not ready":"Checking…";return s.jsxs("div",{className:"pad cc",children:[s.jsxs("div",{className:"row between",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Claude Code"})," ",s.jsxs("span",{className:`cc-state ${(t==null?void 0:t.state)??"pending"}`,children:[s.jsx("i",{})," ",p]}),s.jsx("div",{className:"muted small",children:"The QA Explorer, QA Script Generator, QA Script Healer, QA Test Case Writer and Context Writer run through headless Claude Code (claude.exe)."})]}),s.jsxs("span",{className:"row",children:[s.jsxs("button",{className:"btn ghost sm",onClick:()=>void d(),disabled:r||l,children:[s.jsx(Rr,{size:13})," ",r?"Checking…":"Check again"]}),s.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:l||!(t!=null&&t.binary.ok)||!(t!=null&&t.version.ok),title:"Sends one short prompt through Claude Code",children:l?"Testing… (up to 2 min)":"Run test prompt"})]})]}),s.jsx(Pe,{error:c}),t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"cc-checks",children:[s.jsx(zu,{label:"Binary",check:t.binary}),s.jsx(zu,{label:"Starts",check:t.version}),s.jsx(zu,{label:"Logged in & answers",check:t.test?{ok:t.test.ok,detail:`${t.test.message} · ${Pt(t.test.at)}${t.test.model?` · ${t.test.model}`:""}${t.test.costUsd!==null?` · ${Gt(t.test.costUsd)}`:""}`}:null,pending:"Not tested yet for this binary"})]}),t.source&&s.jsxs("div",{className:"muted small",children:["Using ",cP[t.source],"."]}),s.jsx(dP,{status:t})]}),s.jsxs("div",{className:"cc-path",children:[s.jsxs("label",{htmlFor:"claude-bin",className:"small",style:{fontWeight:600},children:["Path to claude.exe ",s.jsx("span",{className:"muted",style:{fontWeight:400},children:"(leave empty to use QA_STUDIO_CLAUDE_BIN or PATH)"})]}),s.jsxs("div",{className:"row",children:[s.jsx("input",{id:"claude-bin",className:"input grow mono",placeholder:"C:\\Users\\<you>\\.local\\bin\\claude.exe",value:o,onChange:g=>u(g.target.value)}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>void m(o),disabled:o===((t==null?void 0:t.configuredPath)??""),children:[s.jsx(us,{size:13})," Save path"]}),(t==null?void 0:t.configuredPath)&&s.jsx("button",{className:"btn ghost sm",onClick:()=>void m(""),children:"Use automatic"})]})]})]})}function fP(){const{data:e,error:t,reload:n}=Me(()=>q.settings()),[r,i]=j.useState(null),[l,a]=j.useState(null),[o,u]=j.useState(!1);j.useEffect(()=>{e&&i(e.settings.maxHealRounds)},[e]);const c=e==null?void 0:e.settings.maxHealRounds,h=r!==null&&r!==c,d=async()=>{if(r!==null)try{await q.saveSettings({maxHealRounds:r}),a(null),u(!0),setTimeout(()=>u(!1),2e3),n()}catch(f){a(f.message)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Maximum heal rounds"}),s.jsxs("div",{className:"muted small",children:["QA Validator fails → QA Script Healer fixes → back to QA Validator. The loop stops when tests pass, the QA Script Healer reports an app bug or gives up, or after this many heal rounds (prevents an infinite loop). 0 turns the QA Script Healer off. Default ",(e==null?void 0:e.defaults.maxHealRounds)??2,". Applies to jobs queued after saving."]}),s.jsx(Pe,{error:t??l})]}),s.jsxs("span",{className:"row",children:[s.jsx("input",{className:"input",type:"number",min:0,max:zp,step:1,style:{width:80},value:r??"",onChange:f=>i(f.target.value===""?null:Math.max(0,Math.min(zp,Math.round(Number(f.target.value))))),"aria-label":"Maximum heal rounds"}),s.jsxs("button",{className:"btn",disabled:!h,onClick:()=>void d(),children:[s.jsx(us,{size:14})," ",o?"Saved":"Save"]})]})]}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Playwright HTML report"}),s.jsx("div",{className:"muted small",children:"Default for new test runs. The line reporter is always on; when this is on, runs also write the HTML report (traces, screenshots), which opens from the run page. Each run can override it."})]}),s.jsxs("label",{className:"switch",children:[s.jsx("input",{type:"checkbox",checked:(e==null?void 0:e.settings.htmlReport)??!1,disabled:!e,onChange:f=>void q.saveSettings({htmlReport:f.target.checked}).then(n,m=>a(m.message))}),s.jsx("span",{children:e!=null&&e.settings.htmlReport?"On":"Off"})]})]})]})}function pP(){const{theme:e,toggleTheme:t,refreshClaude:n}=hs();return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"General"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Settings"}),s.jsx("p",{className:"page-sub",children:"Pipeline settings are saved in Agent Studio; appearance is stored in this browser."})]})}),s.jsxs("div",{className:"card",style:{marginBottom:12},id:"claude",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"LLM runtime"})}),s.jsx(hP,{onChange:n})]}),s.jsxs("div",{className:"settings-grid",children:[s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"Pipeline"})}),s.jsx(fP,{})]}),s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"Appearance"})}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Theme"}),s.jsx("div",{className:"muted small",children:"Light or dark theme."})]}),s.jsxs("button",{className:"btn ghost",onClick:t,children:[e==="dark"?s.jsx(Ay,{size:15}):s.jsx(Ly,{size:15})," ",e==="dark"?"Dark":"Light"]})]}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Keyboard shortcuts"}),s.jsx("div",{className:"muted small",children:"Search / command palette, save spec."})]}),s.jsxs("span",{className:"row small",children:[s.jsx("span",{className:"kbd-light",children:"Ctrl K"}),s.jsx("span",{className:"kbd-light",children:"Ctrl S"})]})]})]})]})]})}function _v({title:e,onStart:t,onClose:n,specRequired:r,newSpec:i,promptOnly:l,specAgent:a}){var E,k,R;const o=ut(),u=Me(()=>q.specs()),[c,h]=j.useState(""),[d,f]=j.useState(""),[m,p]=j.useState(null),[g,w]=j.useState(!1);j.useEffect(()=>{const T=D=>D.key==="Escape"&&n();return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[n]);const x=async()=>{w(!0);try{let T=c.trim();i&&T&&!T.endsWith(".md")&&(T=`${T}.md`);const D=await t(T,d);o(`/runs/${D.id}`)}catch(T){p(T.message),w(!1)}},y=r?"Spec":"Spec (optional)",v=l?c?"Prompt (optional)":"Prompt":"Input (optional)",b=r?!!c.trim():l?!!c.trim()||!!d.trim():!0;return s.jsx("div",{className:"overlay",onClick:n,children:s.jsx("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":e,onClick:T=>T.stopPropagation(),children:s.jsxs("div",{className:"modal-body",style:{display:"grid",gap:12},children:[s.jsx("h3",{style:{margin:0},children:e}),s.jsx(Pe,{error:m??u.error}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:y}),i?s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"input",list:"run-dialog-specs",value:c,onChange:T=>h(T.target.value),placeholder:"new-spec.md"}),s.jsx("datalist",{id:"run-dialog-specs",children:(E=u.data)==null?void 0:E.map(T=>s.jsx("option",{value:T.file},T.file))})]}):s.jsxs("select",{className:"input",value:c,onChange:T=>h(T.target.value),children:[s.jsx("option",{value:"",children:r?"Select a spec…":l?"No spec (prompt only)":"No spec"}),(k=u.data)==null?void 0:k.map(T=>s.jsx("option",{value:T.file,children:T.file},T.file))]}),l&&a&&!c&&s.jsxs("span",{className:"muted small",children:["Without a spec, the pipeline stops at the ",((R=Se[a])==null?void 0:R.label)??a,"."]})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:v}),s.jsx("textarea",{className:"input",rows:6,value:d,onChange:T=>f(T.target.value),placeholder:i?"The requirement to turn into the spec":"What should the agents do this time?"})]}),s.jsxs("span",{className:"row",style:{justifyContent:"flex-end"},children:[s.jsx("button",{className:"btn ghost",onClick:n,children:"Cancel"}),s.jsxs("button",{className:"btn",onClick:()=>void x(),disabled:g||!b,children:[s.jsx(ft,{size:14})," Start job"]})]})]})})})}const _u=e=>{var t;return((t=e.steps[0])==null?void 0:t.kind)==="agent"&&e.steps[0].agent==="specwriter"},$v=Object.keys(Se).filter(e=>e!=="custom"),Rm=$v.filter(e=>Se[e].llm),Lm=$v.filter(e=>!Se[e].llm),Am=Object.keys(Ao),mP=[{tone:"opus",label:"Opus"},{tone:"sonnet",label:"Sonnet"},{tone:"haiku",label:"Haiku"},{tone:"none",label:"No LLM"}];function Ov(e){const t=e.replace(/^QA\s+/,"").split(/\s+/).filter(Boolean);return t.length>1?t.map(n=>n[0].toUpperCase()).join("").slice(0,2):(t[0]??e).slice(0,2)}function gP(){var y,v,b,E,k,R,T;const e=Ar(),t=In(),n=ut(),[r,i]=xh(),l=r.get("tab")==="custom"?"custom":"default",a=D=>i(D==="custom"?{tab:"custom"}:{},{replace:!0}),o=Me(()=>q.settings()),u=Me(()=>q.agentPrompts()),c=Me(()=>q.pipelines()),h=Me(()=>q.customAgents()),[d,f]=j.useState(null),m=((y=o.data)==null?void 0:y.settings.maxHealRounds)??null,p=D=>{var C;return(C=u.data)==null?void 0:C.find(L=>L.agent===D)},g=D=>{var L,A,z;const C=Sl(D);return C?((A=(L=h.data)==null?void 0:L.find(U=>U.id===C))==null?void 0:A.model)??"none":Se[D].llm?((z=p(D))==null?void 0:z.model)??"none":"none"},w=async D=>{if(await t({title:`Delete the pipeline "${D.name}"?`,message:"The pipeline is removed for everyone using this Agent Studio. This cannot be undone.",confirmLabel:"Delete pipeline",danger:!0}))try{await q.deletePipeline(D.id),e.success(`Pipeline "${D.name}" deleted`),c.reload()}catch(L){e.error(L.message)}},x=(v=c.data)==null?void 0:v.length;return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents"}]}),s.jsxs("div",{className:"page-head ap-page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Agents & pipelines"}),s.jsx("p",{className:"page-sub",children:"Agents are the building blocks. Pipelines chain them into jobs. All agents run through Claude Code; Playwright steps run without an LLM."})]}),s.jsxs("span",{className:"row",children:[s.jsxs(ye,{to:"/agents/custom/new",className:"btn ghost",children:[s.jsx(Qt,{size:15})," New agent"]}),s.jsxs(ye,{to:"/agents/pipelines/new",className:"btn",children:[s.jsx(Qt,{size:15})," New pipeline"]})]})]}),s.jsxs("div",{className:"card ap-card",children:[s.jsxs("div",{className:"ap-head",children:[s.jsxs("div",{className:"ap-head-title",children:[s.jsx("h3",{children:"Agents"}),s.jsxs("span",{className:"muted small",children:[Rm.length," Built-in agents · ",((b=h.data)==null?void 0:b.length)??0," custom · ",Lm.length," Playwright steps · click an agent to open its details"]})]}),s.jsx("span",{className:"ap-legend","aria-label":"Model colours",children:mP.map(D=>s.jsxs("span",{children:[s.jsx("i",{className:`tone-dot tone-${D.tone}`})," ",D.label]},D.tone))})]}),s.jsx(Pe,{error:u.error}),s.jsx("div",{className:"ap-group-label",children:"Built-in agents"}),s.jsx("div",{className:"ap-grid",children:Rm.map(D=>s.jsx(Im,{agent:D,tone:g(D),info:p(D)},D))}),s.jsx("div",{className:"ap-group-label",children:"Custom agents"}),s.jsx(Pe,{error:h.error}),((E=h.data)==null?void 0:E.length)===0&&s.jsxs("p",{className:"ap-note",children:["No custom agents yet. Click ",s.jsx("b",{children:"New agent"})," to create one."]}),!!((k=h.data)!=null&&k.length)&&s.jsx("div",{className:"ap-grid",children:h.data.map(D=>s.jsxs(ye,{to:`/agents/custom/${D.id}`,className:"ap-agent","aria-label":`${D.name}: ${D.description||"Custom agent"}`,children:[s.jsx("span",{className:`ap-avatar tone-${D.model}`,children:Ov(D.name)}),s.jsxs("span",{className:"ap-agent-text",children:[s.jsxs("b",{children:[D.name,D.skills.length>0&&s.jsxs("span",{className:"ap-custom",title:`Skills: ${D.skills.join(", ")}`,children:[D.skills.length," skill",D.skills.length===1?"":"s"]})]}),s.jsx("span",{title:D.description,children:D.description||"Custom agent"})]}),s.jsx("span",{className:`ap-pill tone-${D.model}`,children:D.model[0].toUpperCase()+D.model.slice(1)}),s.jsx("span",{className:"ap-chevron","aria-hidden":"true",children:s.jsx(ti,{size:14})})]},D.id))}),s.jsx("div",{className:"ap-group-label",children:"Playwright steps · No LLM"}),s.jsx("div",{className:"ap-grid",children:Lm.map(D=>s.jsx(Im,{agent:D,tone:"none"},D))})]}),s.jsxs("div",{className:"card ap-card",children:[s.jsxs("div",{className:"ap-head",children:[s.jsx("div",{className:"ap-head-title",children:s.jsx("h3",{children:"Pipelines"})}),s.jsx(bn,{value:l,onChange:a,items:[{id:"default",label:s.jsxs(s.Fragment,{children:["Default ",s.jsx("span",{className:"tab-count",children:Am.length})]})},{id:"custom",label:s.jsxs(s.Fragment,{children:["Custom ",s.jsx("span",{className:"tab-count",children:x??"…"})]})}]})]}),l==="default"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ap-note",children:"Built-in job types. Duplicate one to start a custom pipeline. Loops repeat until the QA Validator passes or the round limit is reached."}),s.jsx("div",{className:"ap-rows",children:Am.map(D=>s.jsxs("div",{className:"ap-row",children:[s.jsx("span",{className:"ap-row-name",children:kr[D]}),s.jsx("span",{className:"ap-row-steps",children:s.jsx(xP,{type:D,maxRounds:m,toneOf:g})}),s.jsxs("span",{className:"ap-row-meta",children:[s.jsx(cb,{size:13})," Built-in"]}),s.jsx("span",{className:"ap-row-actions",children:s.jsx("button",{className:"btn ghost sm",onClick:()=>n(`/agents/pipelines/new?from=${D}`),"aria-label":`Duplicate ${kr[D]}`,children:"Duplicate"})})]},D))})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ap-note",children:"Your own pipelines. Each loop repeats its agents until the first one passes, or up to its maximum iterations."}),s.jsx(Pe,{error:c.error}),((R=c.data)==null?void 0:R.length)===0&&s.jsxs("div",{className:"ap-empty",children:[s.jsx("p",{className:"muted",children:"No custom pipelines yet."}),s.jsxs(ye,{to:"/agents/pipelines/new",className:"btn sm",children:[s.jsx(Qt,{size:14})," New pipeline"]})]}),s.jsx("div",{className:"ap-rows",children:(T=c.data)==null?void 0:T.map(D=>s.jsxs("div",{className:"ap-row",children:[s.jsxs("span",{className:"ap-row-name",children:[s.jsx(ye,{to:`/agents/pipelines/${D.id}`,children:D.name}),D.description&&s.jsx("span",{className:"muted small ap-row-desc",children:D.description})]}),s.jsx("span",{className:"ap-row-steps",children:s.jsx(yP,{steps:D.steps,toneOf:g,custom:h.data??[]})}),s.jsx("span",{className:"ap-row-meta",title:`Updated ${Pt(D.updatedAt)}`,children:Pt(D.updatedAt)}),s.jsxs("span",{className:"ap-row-actions",children:[s.jsx("button",{className:"btn sm",onClick:()=>f(D),"aria-label":`Run pipeline ${D.name}`,children:"Run"}),s.jsx(ye,{to:`/agents/pipelines/${D.id}`,className:"btn ghost sm","aria-label":`Edit pipeline ${D.name}`,children:"Edit"}),s.jsx("button",{className:"btn danger sm icon",onClick:()=>void w(D),"aria-label":`Delete pipeline ${D.name}`,title:"Delete",children:s.jsx(Lr,{size:14})})]})]},D.id))})]})]}),d&&s.jsx(_v,{title:`Run ${d.name}`,specRequired:_u(d),promptOnly:!_u(d),specAgent:Tb(d.steps),newSpec:_u(d),onClose:()=>f(null),onStart:(D,C)=>q.createJob({type:"pipeline",pipelineId:d.id,...D?{spec:D}:{},...C.trim()?{input:C}:{}})})]})}function Im({agent:e,tone:t,info:n}){const r=Se[e],i=(n==null?void 0:n.customized)||(n==null?void 0:n.modelCustomized);return s.jsxs(ye,{to:`/agents/${e}`,className:`ap-agent ${r.llm?"":"step"}`,"aria-label":`${r.label}: ${r.description}`,children:[s.jsx("span",{className:`ap-avatar tone-${t}`,children:Ov(r.label)}),s.jsxs("span",{className:"ap-agent-text",children:[s.jsxs("b",{children:[r.label,i&&s.jsx("span",{className:"ap-custom",title:n!=null&&n.customized?"Custom prompt":"Custom model",children:"custom"}),!!(n!=null&&n.skills.length)&&s.jsxs("span",{className:"ap-custom",title:`Skills: ${n.skills.join(", ")}`,children:[n.skills.length," skill",n.skills.length===1?"":"s"]})]}),s.jsx("span",{title:r.description,children:r.description})]}),s.jsx("span",{className:`ap-pill tone-${t}`,children:r.llm?n?n.model[0].toUpperCase()+n.model.slice(1):"…":"No LLM"}),s.jsx("span",{className:"ap-chevron","aria-hidden":"true",children:s.jsx(ti,{size:14})})]})}const ad=(e,t)=>{var n;return((n=t.find(r=>Th(r.id)===e))==null?void 0:n.review)==="human"};function Fv({agent:e,toneOf:t,custom:n}){const r=ad(e,n);return s.jsxs("span",{className:`ap-chip tone-${t(e)}`,title:r?"Human review":void 0,children:[Rl(e,n),r&&" 👤"]})}const od=()=>s.jsx("span",{className:"ap-arrow",children:"→"});function xP({type:e,maxRounds:t,toneOf:n}){const r=Ao[e],i=e==="generate"||e==="heal",l=i?r.filter(o=>!Ch.includes(o)):r,a=e==="heal"?["healer","validator"]:["validator","healer"];return s.jsxs(s.Fragment,{children:[l.map((o,u)=>s.jsxs(j.Fragment,{children:[u>0&&s.jsx(od,{}),s.jsx(Fv,{agent:o,toneOf:n,custom:[]})]},o)),i&&s.jsxs(s.Fragment,{children:[l.length>0&&s.jsx(od,{}),s.jsx(Vh,{agents:a,toneOf:n,custom:[],suffix:t===null?null:`max ${t} round${t===1?"":"s"}`,swap:!0})]})]})}function yP({steps:e,toneOf:t,custom:n}){return s.jsx(s.Fragment,{children:e.map((r,i)=>s.jsxs(j.Fragment,{children:[i>0&&s.jsx(od,{}),r.kind==="agent"?s.jsx(Fv,{agent:r.agent,toneOf:t,custom:n}):s.jsx(Vh,{agents:r.steps,toneOf:t,custom:n,suffix:`max ${r.maxIterations}×${r.endsWhen==="last"?" · until last passes":""}`,endsWhen:r.endsWhen})]},i))})}function Vh({agents:e,toneOf:t,custom:n,suffix:r,swap:i,endsWhen:l}){return s.jsxs("span",{className:"ap-loop",title:`Repeats its agents; stops when the ${l==="last"?"last":"first"} one passes or the maximum is reached`,children:[s.jsx(is,{size:12}),e.map((a,o)=>s.jsxs(j.Fragment,{children:[o>0&&(i?s.jsx("span",{className:"ap-loop-sep",children:"⇄"}):s.jsx("span",{className:"ap-loop-sep",children:"→"})),typeof a=="string"?s.jsxs("span",{className:`ap-loop-name tone-${t(a)}`,title:ad(a,n)?"Human review":void 0,children:[Rl(a,n),ad(a,n)&&" 👤"]}):s.jsx(Vh,{agents:a.steps,toneOf:t,custom:n,suffix:`max ${a.maxIterations}×${a.endsWhen==="last"?" · until last passes":""}`,endsWhen:a.endsWhen})]},o)),r&&s.jsx("span",{className:"ap-loop-max",children:r})]})}function Dm(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function vP(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function jP(e,t,n){const i=$o((n||{}).ignore||[]),l=wP(t);let a=-1;for(;++a<l.length;)nd(e,o);function o(c,h,d){if(c.type==="text"&&typeof d=="number")return u(c,h,d);if(i(c,d,h[h.length-1]))return td}function u(c,h,d){const f=h[h.length-1],m=l[a][0],p=l[a][1];let g=0,w=!1,x=[];m.lastIndex=0;let y=m.exec(c.value);for(;y;){const b=y.index,E={index:y.index,input:y.input,stack:[...h,c]};let k=p(...y,E);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1)m.lastIndex=b+1;else{if(g!==b&&v({type:"text",value:c.value.slice(g,b)}),Array.isArray(k))for(const R of k)v(R);else k&&v(k);g=b+y[0].length,w=!0}if(!m.global)break;y=m.exec(c.value)}return w?(g<c.value.length&&v({type:"text",value:c.value.slice(g)}),f.children.splice(d,1,...x)):x=[c],d+x.length;function v(b){const E=x[x.length-1];E&&E.type==="text"&&b.type==="text"?E.value+=b.value:x.push(b)}}}function wP(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([kP(i[0]),bP(i[1])])}return t}function kP(e){return typeof e=="string"?new RegExp(vP(e),"g"):e}function bP(e){return typeof e=="function"?e:function(){return e}}const $u="phrasing",Ou=["autolink","link","image","label"];function SP(){return{transforms:[LP],enter:{literalAutolink:CP,literalAutolinkEmail:Fu,literalAutolinkHttp:Fu,literalAutolinkWww:Fu},exit:{literalAutolink:RP,literalAutolinkEmail:PP,literalAutolinkHttp:EP,literalAutolinkWww:TP}}}function NP(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:$u,notInConstruct:Ou},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:$u,notInConstruct:Ou},{character:":",before:"[ps]",after:"\\/",inConstruct:$u,notInConstruct:Ou}]}}function CP(e){this.enter({type:"link",title:null,url:"",children:[],position:void 0},e)}function Fu(e){this.config.enter.autolinkProtocol.call(this,e)}function EP(e){this.config.exit.autolinkProtocol.call(this,e)}function TP(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function PP(e){this.config.exit.autolinkEmail.call(this,e)}function RP(e){this.exit(e)}function LP(e){jP(e,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),AP],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),MP],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),DP],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),IP]],{ignore:["link","linkReference"]})}function AP(e,t,n,r,i){if(!$P(i))return!1;let l="";if(/^w/i.test(t)&&(n=t+n,t="",l="http://"),Cl(n.charCodeAt(0))||!zP(n))return!1;const a=_P(n+r),o={type:"link",title:null,url:l+t+a[0],children:[{type:"text",value:t+a[0],position:void 0}],position:void 0};return a[1]?[o,{type:"text",value:a[1],position:void 0}]:o}function IP(e,t,n){return/[\d\-_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n,position:void 0}],position:void 0}}function DP(e,t,n){if(/[\d\-_]$/.test(n))return!1;const r="mailto:"+t+"@"+n;return{type:"link",title:null,url:r,children:[{type:"text",value:r,position:void 0}],position:void 0}}function MP(e,t,n,r,i){if(/[\d\-_]$/.test(n)||r&&(!/[A-Za-z]$/.test(r)||i.input.charAt(i.index+e.length)==="@"))return!1;const l="xmpp:"+t+"@"+n+(r||"");return{type:"link",title:null,url:l,children:[{type:"text",value:l,position:void 0}],position:void 0}}function zP(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[\dA-Za-z]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[\dA-Za-z]/.test(t[t.length-2])))}function _P(e){let t=e.length;for(;t>0;){const a=e.charCodeAt(t-1);if(a===33||a===34||a===38||a===39||a===41||a===44||a===46||a===58||a===59||a===60||a===62||a===63||a===93||a===125)t--;else break}if(t===e.length)return[e,void 0];let n=e.slice(t);e=e.slice(0,t);let r=n.indexOf(")");const i=Dm(e,"(");let l=Dm(e,")");for(;r!==-1&&i>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function $P(e){const t=e.input.charCodeAt(e.index-1);return e.index===0||ls(t)||Cl(t)}Uv.peek=qP;function OP(){this.buffer()}function FP(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function UP(){this.buffer()}function BP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function HP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function WP(e){this.exit(e)}function VP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function QP(e){this.exit(e)}function qP(){return"["}function Uv(e,t,n,r){const i=n.createTracker(r);let l=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return l+=i.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),a(),l+=i.move("]"),l}function GP(){return{enter:{gfmFootnoteCallString:OP,gfmFootnoteCall:FP,gfmFootnoteDefinitionLabelString:UP,gfmFootnoteDefinition:BP},exit:{gfmFootnoteCallString:HP,gfmFootnoteCall:WP,gfmFootnoteDefinitionLabelString:VP,gfmFootnoteDefinition:QP}}}function KP(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Uv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,l,a){const o=l.createTracker(a);let u=o.move("[^");const c=l.enter("footnoteDefinition"),h=l.enter("label");return u+=o.move(l.safe(l.associationId(r),{before:u,after:"]"})),h(),u+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),u+=o.move((t?`
389
- `:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Bv:YP))),c(),u}}function YP(e,t,n){return t===0?e:Bv(e,t,n)}function Bv(e,t,n){return(n?"":" ")+e}const JP=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Qh.attention=nR;Qh.peek=rR;function XP(){return{canContainEols:["delete"],enter:{strikethrough:eR},exit:{strikethrough:tR}}}function ZP(){return{handlers:{delete:Qh},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:JP}]}}function eR(e){this.enter({type:"delete",children:[],position:void 0},e)}function tR(e){this.exit(e)}function Qh(e,t,n,r){const i=n.createTracker(r),l=n.stack.includes("strikethrough")?"~":"~~",a=n.enter("strikethrough");let o=i.move(l);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move(l),a(),o}function nR(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function rR(){return"~"}function sR(e){return e.length}function iR(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||sR,l=[],a=[],o=[],u=[];let c=0,h=-1;for(;++h<e.length;){const g=[],w=[];let x=-1;for(e[h].length>c&&(c=e[h].length);++x<e[h].length;){const y=lR(e[h][x]);if(n.alignDelimiters!==!1){const v=i(y);w[x]=v,(u[x]===void 0||v>u[x])&&(u[x]=v)}g.push(y)}a[h]=g,o[h]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)l[d]=Mm(r[d]);else{const g=Mm(r);for(;++d<c;)l[d]=g}d=-1;const f=[],m=[];for(;++d<c;){const g=l[d];let w="",x="";g===99?(w=":",x=":"):g===108?w=":":g===114&&(x=":");let y=n.alignDelimiters===!1?1:Math.max(1,u[d]-w.length-x.length);const v=w+"-".repeat(y)+x;n.alignDelimiters!==!1&&(y=w.length+y+x.length,y>u[d]&&(u[d]=y),m[d]=y),f[d]=v}a.splice(1,0,f),o.splice(1,0,m),h=-1;const p=[];for(;++h<a.length;){const g=a[h],w=o[h],x=n.fillRows===!1?Math.max(1,a[h===1?0:h].length):c;d=-1;const y=[];for(;++d<x;){const v=g[d]||"";let b="",E="";if(n.alignDelimiters!==!1){const k=u[d]-(w[d]||0),R=l[d];if(R===114)b=" ".repeat(k);else if(R===99){const T=k/2;k%2?(b=" ".repeat(T+.5),E=" ".repeat(T-.5)):(b=" ".repeat(T),E=b)}else E=" ".repeat(k)}n.delimiterStart!==!1&&!d&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||d)&&y.push(" "),n.alignDelimiters!==!1&&y.push(b),y.push(v),n.alignDelimiters!==!1&&y.push(E),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||d!==x-1)&&y.push("|")}p.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return p.join(`
390
- `)}function lR(e){return e==null?"":String(e)}function Mm(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const aR=$o(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function oR(e,t,n,r){const i=n.enter("blockquote"),l=n.createTracker(r);l.move("> "),l.shift(2);const a=n.indentLines(n.containerFlow(e,l.current()),uR);return i(),a}function uR(e,t,n){return">"+(n?"":" ")+e}function cR(e,t){return zm(e,t.inConstruct,!0)&&!zm(e,t.notInConstruct,!1)}function zm(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function _m(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){const l=n.unsafe[i];if(l.character===`
391
- `&&!l.before&&!l.after&&cR(n.stack,l))return/[\t ]/.test(r.before)?"":" "}return`\\
392
- `}function dR(e,t){const n=String(e);let r=n.indexOf(t),i=r,l=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++l>a&&(a=l):l=1,i=r+t.length,r=n.indexOf(t,i);return a}function hR(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function fR(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function pR(e,t,n,r){const i=fR(n),l=e.value||"";if(hR(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(l,mR);return d(),f}const a=n.createTracker(r),o=i.repeat(Math.max(dR(l,i)+1,3)),u=n.enter("codeFenced"),c=i==="`"?"GraveAccent":"Tilde";let h=a.move(o);if(e.lang){const d=n.enter(`codeFencedLang${c}`);h+=a.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${c}`);h+=a.move(" "),h+=a.move(n.safe(e.meta,{before:h,after:`
388
+ `).trim();return s.jsxs("div",{className:"tc-card",children:[s.jsxs("div",{className:"tc-card-head",children:[s.jsx("span",{className:"tc-chip",children:a.id}),s.jsx("b",{children:a.title}),a.tags.map(d=>s.jsx("span",{className:"tag",children:d},d)),a.technique&&s.jsxs("span",{className:"muted small",children:["Technique: ",a.technique]})]}),c&&s.jsx(lP,{text:c})]},`${a.id}-${o}`)})]})}function oP(){const{file:e=""}=li(),t=ut(),{refresh:n,mapping:r}=Zt(),i=In(),l=Ir(),[a,o]=j.useState(""),[u,c]=j.useState(""),[h,d]=j.useState(),[f,m]=j.useState(!1),[p,g]=j.useState(null),[w,x]=j.useState(null),[y,v]=j.useState(!1),[b,E]=j.useState(1),[k,R]=j.useState("split"),T=j.useRef(!1),D=_e(()=>q.jobs(),[e]),C=f&&a!==u,L=j.useMemo(()=>gb(a),[a]),A=r.filter(F=>F.specFile===e&&F.status!=="orphan"),z=new Set(A.filter(F=>F.testFile).map(F=>F.tcId)),U=A.filter(F=>F.lastResult),I=U.filter(F=>F.lastResult.status==="passed").length,Q=(D.data??[]).filter(F=>F.target===e).slice(0,5),J=j.useCallback(async()=>{try{const F=await q.spec(e);o(F.content),c(F.content),d(F.mtimeMs),m(!0),g(null)}catch(F){g(F.message)}},[e]);j.useEffect(()=>{m(!1),T.current=!1,J()},[J]);const B=gh(({currentLocation:F,nextLocation:Z})=>C&&!T.current&&F.pathname!==Z.pathname);Ph(B,{title:"Leave with unsaved changes?",message:"Your edits to this spec are not saved and will be lost.",confirmLabel:"Discard changes",danger:!0}),j.useEffect(()=>{const F=Z=>{C&&Z.preventDefault()};return window.addEventListener("beforeunload",F),()=>window.removeEventListener("beforeunload",F)},[C]);const X=j.useCallback(async(F=!1)=>{v(!0),x(null);try{const Z=await q.saveSpec(e,a,F?void 0:h);return c(a),d(Z.mtimeMs),g(null),x("Saved."),n(),!0}catch(Z){return Z instanceof eo&&Z.status===409&&await i({title:"Spec changed on disk",message:`${Z.message} Overwrite it with your current edits?`,confirmLabel:"Overwrite",danger:!0})?(v(!1),X(!0)):(g(Z.message),!1)}finally{v(!1)}},[a,e,h,n,i]);j.useEffect(()=>{const F=Z=>{(Z.ctrlKey||Z.metaKey)&&Z.key.toLowerCase()==="s"&&(Z.preventDefault(),C&&X())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,X]);const S=async F=>{if(!(C&&!await X()))try{const Z=await q.createJob(F);T.current=!0,t(`/runs/${Z.id}`)}catch(Z){g(Z.message)}},ae=async()=>{if(await i({title:`Delete ${e}?`,message:"The spec file is removed. Its test file in tests/e2e (if any) is NOT deleted. This cannot be undone.",confirmLabel:"Delete spec",danger:!0}))try{await q.deleteSpec(e),T.current=!0,n(),l.success(`Deleted ${e}`),t("/specs")}catch(Z){g(Z.message)}},O=L.tcs.length===0,N=Hh(L.tcs,[e]);return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Specs",to:"/specs"},{label:e}]}),s.jsxs(tS,{children:[s.jsxs("span",{className:"chip",children:["Coverage ",z.size,"/",L.tcs.length]}),s.jsxs("span",{className:`chip ${I<U.length?"fail":"ok"}`,children:["Pass rate ",I,"/",U.length]})]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{className:"row",style:{alignItems:"flex-start",flexWrap:"nowrap"},children:[s.jsx("button",{className:"btn ghost icon square",onClick:()=>t("/specs"),"aria-label":"Back to specs list",title:"Back to Specs",children:s.jsx(ub,{size:16})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"page-title",children:[L.title||e," ",C&&s.jsx("span",{className:"badge stale",children:"unsaved"})]}),s.jsxs("p",{className:"page-sub row",style:{gap:6},children:[s.jsx("span",{className:"mono",children:e}),L.tags.map(F=>s.jsxs("span",{children:["· ",s.jsx("span",{className:"tag",children:F})]},F))]})]})]}),s.jsxs("div",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>void X(),disabled:!C||y,title:"Ctrl+S",children:[s.jsx(cs,{size:15})," Save"]}),s.jsx("button",{className:"btn ghost icon square",onClick:()=>void(async()=>{C&&!await i({title:"Discard unsaved changes?",message:"Reloading replaces your edits with the file on disk.",confirmLabel:"Discard & reload",danger:!0})||await J()})(),disabled:y,title:"Reload from disk","aria-label":"Reload from disk",children:s.jsx(Lr,{size:15})}),s.jsx("button",{className:"btn danger icon square",onClick:()=>void ae(),disabled:y,title:"Delete spec","aria-label":"Delete spec",children:s.jsx(Ar,{size:15})})]})]}),s.jsxs("div",{className:"pipeline-bar",children:[s.jsxs("div",{className:"pipeline-steps",title:"Runs with Claude Code, no API key needed",children:[s.jsx("b",{children:"Pipeline"}),s.jsx("span",{className:"step",children:Ne.explorer.label}),"→",s.jsx("span",{className:"step",children:Ne.generator.label}),"→",s.jsx("span",{className:"step",children:Ne.validator.label}),"→",s.jsxs("span",{className:"step",children:[Ne.healer.label," ≤ 2"]})]}),s.jsx("div",{className:"grow"}),s.jsxs("button",{className:"btn ghost",onClick:()=>void S({type:"explore",spec:e}),disabled:y||O,children:[s.jsx(Py,{size:15})," Explore"]}),s.jsxs("button",{className:"btn",onClick:()=>void S({type:"generate",spec:e}),disabled:y||O,children:[s.jsx(wh,{size:15})," Generate"]}),s.jsx("select",{className:"select",value:b,onChange:F=>E(Number(F.target.value)),"aria-label":"Repeat count",children:[1,2,3,5,10].map(F=>s.jsxs("option",{value:F,children:[F,"×"]},F))}),s.jsxs("button",{className:"btn dark",onClick:()=>void S({type:"testrun",spec:e,repeatEach:b}),disabled:y||z.size===0,title:z.size?"":"Spec has no test file yet",children:[s.jsx(ft,{size:13})," Run"]})]}),s.jsx(Le,{error:p}),w&&s.jsx("div",{className:"info-box",children:w}),f&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Spec content"}),s.jsx(kn,{value:k,onChange:R,items:[{id:"editor",label:"Editor"},{id:"split",label:"Split"},{id:"preview",label:"Preview"}]})]}),s.jsxs("div",{className:`spec-body ${k}`,children:[k!=="preview"&&s.jsx(eP,{value:a,onChange:o}),k!=="editor"&&s.jsx(aP,{content:a,parsed:L})]})]}),L.warnings.map(F=>s.jsxs("div",{className:"warn-box",children:["⚠ ",F]},F)),s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsx("div",{className:"card-head",children:s.jsxs("h3",{children:["Test cases ",s.jsxs("span",{className:"muted",children:["(",L.tcs.length,")"]})]})}),s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"TC-ID"}),s.jsx("th",{children:"Name"}),s.jsx("th",{children:"Mapping"}),s.jsx("th",{children:"Last result"}),s.jsx("th",{className:"num",children:"Actions"})]})}),s.jsx("tbody",{children:N.pageItems.map(F=>{const Z=A.find(Te=>Te.tcId===F.id),ce=Z==null?void 0:Z.lastResult;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{className:"strong",children:F.id})}),s.jsx("td",{children:F.title}),s.jsx("td",{children:Z!=null&&Z.testFile?s.jsxs("span",{className:"map-link",title:`${Z.testFile}:${Z.testLine??""}`,children:[s.jsx(vh,{size:13}),s.jsx("code",{children:Z.testFile.split("/").pop()}),Z.status==="stale"&&s.jsx(yt,{status:"stale"})]}):s.jsx(yt,{status:(Z==null?void 0:Z.status)??"missing"})}),s.jsx("td",{children:ce?s.jsx(ye,{to:`/runs/${ce.jobId}`,children:s.jsx(ni,{status:ce.status,children:ce.status.charAt(0).toUpperCase()+ce.status.slice(1)})}):s.jsx(ni,{status:null})}),s.jsx("td",{className:"num",children:s.jsxs("div",{className:"tc-actions",children:[s.jsx("button",{className:"btn ghost icon tc-action gen",disabled:y,title:z.has(F.id)?`Regenerate the test of ${F.id} only (Explorer → Generator → Validator)`:`Generate a test for ${F.id} only (Explorer → Generator → Validator)`,"aria-label":`Generate ${F.id}`,onClick:()=>void S({type:"generate",spec:e,tcId:F.id}),children:s.jsx(ib,{size:16})}),s.jsx("button",{className:"btn ghost icon tc-action run",disabled:!z.has(F.id)||y,title:z.has(F.id)?`Run ${F.id}`:"TC has no test yet, run Generate","aria-label":`Run ${F.id}`,onClick:()=>void S({type:"testrun",spec:e,tcId:F.id,repeatEach:b}),children:s.jsx(sb,{size:14})})]})})]},`${F.id}-${F.line}`)})})]}),O&&s.jsx("p",{className:"muted pad",children:"No test cases yet. Add a heading like “## TC-XXX-001: Name”."}),!O&&s.jsx(ps,{...N.props,label:"test cases"})]}),Q.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"section-title",children:"Recent jobs for this spec"}),s.jsx("div",{className:"row",children:Q.map(F=>s.jsxs(ye,{to:`/runs/${F.id}`,className:"card pad row",style:{padding:"8px 12px"},children:["#",F.id," ",F.type," ",s.jsx(An,{status:F.status})]},F.id))})]})]})]})}const uP={settings:"path set below",env:"QA_STUDIO_CLAUDE_BIN",path:"found on PATH"};function zu({label:e,check:t,pending:n}){const r=t?t.ok?"ok":"fail":"pending";return s.jsxs("div",{className:`cc-row ${r}`,children:[s.jsx("span",{className:"cc-mark","aria-hidden":"true",children:r==="ok"?s.jsx(jh,{size:13}):r==="fail"?s.jsx(wr,{size:13}):"?"}),s.jsx("span",{className:"cc-label",children:e}),s.jsx("span",{className:"cc-detail",children:t?t.detail:n})]})}function cP({status:e}){const t=e.binary.ok?e.version.ok?e.test&&!e.test.ok?e.test.hint:null:"version":"path";return!t&&e.state!=="unverified"?null:s.jsxs("div",{className:"cc-guide",children:[t==="path"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Install Claude Code, or tell Agent Studio where it is"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["Install it: in PowerShell ",s.jsx("code",{children:"irm https://claude.ai/install.ps1 | iex"}),", or with Node.js ",s.jsx("code",{children:"npm install -g @anthropic-ai/claude-code"}),"."]}),s.jsxs("li",{children:["Open a new terminal and check: ",s.jsx("code",{children:"claude --version"}),"."]}),s.jsxs("li",{children:["If Agent Studio still cannot find it, paste the full path of ",s.jsx("code",{children:"claude.exe"})," below (find it with ",s.jsx("code",{children:"where.exe claude"}),"; for an npm install use the"," ",s.jsx("code",{children:"claude.exe"})," inside ",s.jsx("code",{children:"node_modules\\@anthropic-ai\\claude-code\\bin"}),", not ",s.jsx("code",{children:"claude.cmd"}),")."]})]})]}),t==="version"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"The binary was found but does not start"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["Run ",s.jsxs("code",{children:[e.binary.detail," --version"]})," in a terminal to see the error."]}),s.jsx("li",{children:"Reinstall or update Claude Code, or point the path below to a working claude.exe."})]})]}),t==="login"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Log Claude Code in"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["In a terminal run ",s.jsx("code",{children:"claude"}),", type ",s.jsx("code",{children:"/login"})," and sign in with your Claude account (or a Console API key)."]}),s.jsxs("li",{children:["Using an API key instead: set ",s.jsx("code",{children:"ANTHROPIC_API_KEY"})," in the environment that starts Agent Studio (not only in ",s.jsx("code",{children:".env"}),"), then restart Agent Studio."]}),s.jsx("li",{children:"Come back and run the test prompt again."})]})]}),t==="network"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Claude Code did not answer"}),s.jsxs("ol",{children:[s.jsx("li",{children:"Check the internet connection, proxy or VPN of this machine."}),s.jsxs("li",{children:["Run ",s.jsx("code",{children:'claude -p "hi"'})," in a terminal to see the error, then test again."]})]})]}),t==="other"&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:"Claude Code returned an error"}),s.jsxs("ol",{children:[s.jsxs("li",{children:["Run ",s.jsx("code",{children:'claude -p "hi"'})," in a terminal from the repo folder to see the full message."]}),s.jsxs("li",{children:["Check usage limits with ",s.jsx("code",{children:"/usage"})," in Claude Code, then test again."]})]})]}),!t&&e.state==="unverified"&&s.jsxs("span",{children:["Claude Code is installed. Run the ",s.jsx("b",{children:"test prompt"})," once to confirm it is logged in and can answer (one short request on the smallest model; on a subscription it only counts toward usage limits)."]})]})}function dP({onChange:e}){const[t,n]=j.useState(null),[r,i]=j.useState(!1),[l,a]=j.useState(!1),[o,u]=j.useState(""),[c,h]=j.useState(null),d=async()=>{i(!0);try{const g=await q.claudeStatus();n(g),u(w=>w||g.configuredPath),h(null),e==null||e()}catch(g){h(g.message)}finally{i(!1)}};j.useEffect(()=>{d()},[]);const f=async()=>{a(!0);try{await q.claudeTest(),await d()}catch(g){h(g.message)}finally{a(!1)}},m=async g=>{try{await q.saveSettings({claudeBin:g}),u(g),h(null),await d()}catch(w){h(w.message)}},p=(t==null?void 0:t.state)==="ready"?"Ready":(t==null?void 0:t.state)==="unverified"?"Installed, not verified":t?"Not ready":"Checking…";return s.jsxs("div",{className:"pad cc",children:[s.jsxs("div",{className:"row between",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Claude Code"})," ",s.jsxs("span",{className:`cc-state ${(t==null?void 0:t.state)??"pending"}`,children:[s.jsx("i",{})," ",p]}),s.jsx("div",{className:"muted small",children:"The QA Explorer, QA Script Generator, QA Script Healer, QA Test Case Writer and Context Writer run through headless Claude Code (claude.exe)."})]}),s.jsxs("span",{className:"row",children:[s.jsxs("button",{className:"btn ghost sm",onClick:()=>void d(),disabled:r||l,children:[s.jsx(Lr,{size:13})," ",r?"Checking…":"Check again"]}),s.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:l||!(t!=null&&t.binary.ok)||!(t!=null&&t.version.ok),title:"Sends one short prompt through Claude Code",children:l?"Testing… (up to 2 min)":"Run test prompt"})]})]}),s.jsx(Le,{error:c}),t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"cc-checks",children:[s.jsx(zu,{label:"Binary",check:t.binary}),s.jsx(zu,{label:"Starts",check:t.version}),s.jsx(zu,{label:"Logged in & answers",check:t.test?{ok:t.test.ok,detail:`${t.test.message} · ${Rt(t.test.at)}${t.test.model?` · ${t.test.model}`:""}${t.test.costUsd!==null?` · ${Kt(t.test.costUsd)}`:""}`}:null,pending:"Not tested yet for this binary"})]}),t.source&&s.jsxs("div",{className:"muted small",children:["Using ",uP[t.source],"."]}),s.jsx(cP,{status:t})]}),s.jsxs("div",{className:"cc-path",children:[s.jsxs("label",{htmlFor:"claude-bin",className:"small",style:{fontWeight:600},children:["Path to claude.exe ",s.jsx("span",{className:"muted",style:{fontWeight:400},children:"(leave empty to use QA_STUDIO_CLAUDE_BIN or PATH)"})]}),s.jsxs("div",{className:"row",children:[s.jsx("input",{id:"claude-bin",className:"input grow mono",placeholder:"C:\\Users\\<you>\\.local\\bin\\claude.exe",value:o,onChange:g=>u(g.target.value)}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>void m(o),disabled:o===((t==null?void 0:t.configuredPath)??""),children:[s.jsx(cs,{size:13})," Save path"]}),(t==null?void 0:t.configuredPath)&&s.jsx("button",{className:"btn ghost sm",onClick:()=>void m(""),children:"Use automatic"})]})]})]})}function hP(){const{data:e,error:t,reload:n}=_e(()=>q.settings()),[r,i]=j.useState(null),[l,a]=j.useState(null),[o,u]=j.useState(!1);j.useEffect(()=>{e&&i(e.settings.maxHealRounds)},[e]);const c=e==null?void 0:e.settings.maxHealRounds,h=r!==null&&r!==c,d=async()=>{if(r!==null)try{await q.saveSettings({maxHealRounds:r}),a(null),u(!0),setTimeout(()=>u(!1),2e3),n()}catch(f){a(f.message)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Maximum heal rounds"}),s.jsxs("div",{className:"muted small",children:["QA Validator fails → QA Script Healer fixes → back to QA Validator. The loop stops when tests pass, the QA Script Healer reports an app bug or gives up, or after this many heal rounds (prevents an infinite loop). 0 turns the QA Script Healer off. Default ",(e==null?void 0:e.defaults.maxHealRounds)??2,". Applies to jobs queued after saving."]}),s.jsx(Le,{error:t??l})]}),s.jsxs("span",{className:"row",children:[s.jsx("input",{className:"input",type:"number",min:0,max:zp,step:1,style:{width:80},value:r??"",onChange:f=>i(f.target.value===""?null:Math.max(0,Math.min(zp,Math.round(Number(f.target.value))))),"aria-label":"Maximum heal rounds"}),s.jsxs("button",{className:"btn",disabled:!h,onClick:()=>void d(),children:[s.jsx(cs,{size:14})," ",o?"Saved":"Save"]})]})]}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Playwright HTML report"}),s.jsx("div",{className:"muted small",children:"Default for new test runs. The line reporter is always on; when this is on, runs also write the HTML report (traces, screenshots), which opens from the run page. Each run can override it."})]}),s.jsxs("label",{className:"switch",children:[s.jsx("input",{type:"checkbox",checked:(e==null?void 0:e.settings.htmlReport)??!1,disabled:!e,onChange:f=>void q.saveSettings({htmlReport:f.target.checked}).then(n,m=>a(m.message))}),s.jsx("span",{children:e!=null&&e.settings.htmlReport?"On":"Off"})]})]})]})}function fP(){const{theme:e,toggleTheme:t,refreshClaude:n}=hs();return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"General"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Settings"}),s.jsx("p",{className:"page-sub",children:"Pipeline settings are saved in Agent Studio; appearance is stored in this browser."})]})}),s.jsxs("div",{className:"card",style:{marginBottom:12},id:"claude",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"LLM runtime"})}),s.jsx(dP,{onChange:n})]}),s.jsxs("div",{className:"settings-grid",children:[s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"Pipeline"})}),s.jsx(hP,{})]}),s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"Appearance"})}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Theme"}),s.jsx("div",{className:"muted small",children:"Light or dark theme."})]}),s.jsxs("button",{className:"btn ghost",onClick:t,children:[e==="dark"?s.jsx(Ay,{size:15}):s.jsx(Ly,{size:15})," ",e==="dark"?"Dark":"Light"]})]}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Keyboard shortcuts"}),s.jsx("div",{className:"muted small",children:"Search / command palette, save spec."})]}),s.jsxs("span",{className:"row small",children:[s.jsx("span",{className:"kbd-light",children:"Ctrl K"}),s.jsx("span",{className:"kbd-light",children:"Ctrl S"})]})]})]})]})]})}function Ov({title:e,onStart:t,onClose:n,specRequired:r,newSpec:i,promptOnly:l,specAgent:a}){var E,k,R;const o=ut(),u=_e(()=>q.specs()),[c,h]=j.useState(""),[d,f]=j.useState(""),[m,p]=j.useState(null),[g,w]=j.useState(!1);j.useEffect(()=>{const T=D=>D.key==="Escape"&&n();return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[n]);const x=async()=>{w(!0);try{let T=c.trim();i&&T&&!T.endsWith(".md")&&(T=`${T}.md`);const D=await t(T,d);o(`/runs/${D.id}`)}catch(T){p(T.message),w(!1)}},y=r?"Spec":"Spec (optional)",v=l?c?"Prompt (optional)":"Prompt":"Input (optional)",b=r?!!c.trim():l?!!c.trim()||!!d.trim():!0;return s.jsx("div",{className:"overlay",onClick:n,children:s.jsx("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":e,onClick:T=>T.stopPropagation(),children:s.jsxs("div",{className:"modal-body",style:{display:"grid",gap:12},children:[s.jsx("h3",{style:{margin:0},children:e}),s.jsx(Le,{error:m??u.error}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:y}),i?s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"input",list:"run-dialog-specs",value:c,onChange:T=>h(T.target.value),placeholder:"new-spec.md"}),s.jsx("datalist",{id:"run-dialog-specs",children:(E=u.data)==null?void 0:E.map(T=>s.jsx("option",{value:T.file},T.file))})]}):s.jsxs("select",{className:"input",value:c,onChange:T=>h(T.target.value),children:[s.jsx("option",{value:"",children:r?"Select a spec…":l?"No spec (prompt only)":"No spec"}),(k=u.data)==null?void 0:k.map(T=>s.jsx("option",{value:T.file,children:T.file},T.file))]}),l&&a&&!c&&s.jsxs("span",{className:"muted small",children:["Without a spec, the pipeline stops at the ",((R=Ne[a])==null?void 0:R.label)??a,"."]})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:v}),s.jsx("textarea",{className:"input",rows:6,value:d,onChange:T=>f(T.target.value),placeholder:i?"The requirement to turn into the spec":"What should the agents do this time?"})]}),s.jsxs("span",{className:"row",style:{justifyContent:"flex-end"},children:[s.jsx("button",{className:"btn ghost",onClick:n,children:"Cancel"}),s.jsxs("button",{className:"btn",onClick:()=>void x(),disabled:g||!b,children:[s.jsx(ft,{size:14})," Start job"]})]})]})})})}const _u=e=>{var t;return((t=e.steps[0])==null?void 0:t.kind)==="agent"&&e.steps[0].agent==="specwriter"},Fv=Object.keys(Ne).filter(e=>e!=="custom"),Rm=Fv.filter(e=>Ne[e].llm),Lm=Fv.filter(e=>!Ne[e].llm),Am=Object.keys(Ao),pP=[{tone:"opus",label:"Opus"},{tone:"sonnet",label:"Sonnet"},{tone:"haiku",label:"Haiku"},{tone:"none",label:"No LLM"}];function Uv(e){const t=e.replace(/^QA\s+/,"").split(/\s+/).filter(Boolean);return t.length>1?t.map(n=>n[0].toUpperCase()).join("").slice(0,2):(t[0]??e).slice(0,2)}function mP(){var y,v,b,E,k,R,T;const e=Ir(),t=In(),n=ut(),[r,i]=xh(),l=r.get("tab")==="custom"?"custom":"default",a=D=>i(D==="custom"?{tab:"custom"}:{},{replace:!0}),o=_e(()=>q.settings()),u=_e(()=>q.agentPrompts()),c=_e(()=>q.pipelines()),h=_e(()=>q.customAgents()),[d,f]=j.useState(null),m=((y=o.data)==null?void 0:y.settings.maxHealRounds)??null,p=D=>{var C;return(C=u.data)==null?void 0:C.find(L=>L.agent===D)},g=D=>{var L,A,z;const C=bl(D);return C?((A=(L=h.data)==null?void 0:L.find(U=>U.id===C))==null?void 0:A.model)??"none":Ne[D].llm?((z=p(D))==null?void 0:z.model)??"none":"none"},w=async D=>{if(await t({title:`Delete the pipeline "${D.name}"?`,message:"The pipeline is removed for everyone using this Agent Studio. This cannot be undone.",confirmLabel:"Delete pipeline",danger:!0}))try{await q.deletePipeline(D.id),e.success(`Pipeline "${D.name}" deleted`),c.reload()}catch(L){e.error(L.message)}},x=(v=c.data)==null?void 0:v.length;return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents"}]}),s.jsxs("div",{className:"page-head ap-page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Agents & pipelines"}),s.jsx("p",{className:"page-sub",children:"Agents are the building blocks. Pipelines chain them into jobs. All agents run through Claude Code; Playwright steps run without an LLM."})]}),s.jsxs("span",{className:"row",children:[s.jsxs(ye,{to:"/agents/custom/new",className:"btn ghost",children:[s.jsx(qt,{size:15})," New agent"]}),s.jsxs(ye,{to:"/agents/pipelines/new",className:"btn",children:[s.jsx(qt,{size:15})," New pipeline"]})]})]}),s.jsxs("div",{className:"card ap-card",children:[s.jsxs("div",{className:"ap-head",children:[s.jsxs("div",{className:"ap-head-title",children:[s.jsx("h3",{children:"Agents"}),s.jsxs("span",{className:"muted small",children:[Rm.length," Built-in agents · ",((b=h.data)==null?void 0:b.length)??0," custom · ",Lm.length," Playwright steps · click an agent to open its details"]})]}),s.jsx("span",{className:"ap-legend","aria-label":"Model colours",children:pP.map(D=>s.jsxs("span",{children:[s.jsx("i",{className:`tone-dot tone-${D.tone}`})," ",D.label]},D.tone))})]}),s.jsx(Le,{error:u.error}),s.jsx("div",{className:"ap-group-label",children:"Built-in agents"}),s.jsx("div",{className:"ap-grid",children:Rm.map(D=>s.jsx(Im,{agent:D,tone:g(D),info:p(D)},D))}),s.jsx("div",{className:"ap-group-label",children:"Custom agents"}),s.jsx(Le,{error:h.error}),((E=h.data)==null?void 0:E.length)===0&&s.jsxs("p",{className:"ap-note",children:["No custom agents yet. Click ",s.jsx("b",{children:"New agent"})," to create one."]}),!!((k=h.data)!=null&&k.length)&&s.jsx("div",{className:"ap-grid",children:h.data.map(D=>s.jsxs(ye,{to:`/agents/custom/${D.id}`,className:"ap-agent","aria-label":`${D.name}: ${D.description||"Custom agent"}`,children:[s.jsx("span",{className:`ap-avatar tone-${D.model}`,children:Uv(D.name)}),s.jsxs("span",{className:"ap-agent-text",children:[s.jsxs("b",{children:[D.name,D.skills.length>0&&s.jsxs("span",{className:"ap-custom",title:`Skills: ${D.skills.join(", ")}`,children:[D.skills.length," skill",D.skills.length===1?"":"s"]})]}),s.jsx("span",{title:D.description,children:D.description||"Custom agent"})]}),s.jsx("span",{className:`ap-pill tone-${D.model}`,children:D.model[0].toUpperCase()+D.model.slice(1)}),s.jsx("span",{className:"ap-chevron","aria-hidden":"true",children:s.jsx(ti,{size:14})})]},D.id))}),s.jsx("div",{className:"ap-group-label",children:"Playwright steps · No LLM"}),s.jsx("div",{className:"ap-grid",children:Lm.map(D=>s.jsx(Im,{agent:D,tone:"none"},D))})]}),s.jsxs("div",{className:"card ap-card",children:[s.jsxs("div",{className:"ap-head",children:[s.jsx("div",{className:"ap-head-title",children:s.jsx("h3",{children:"Pipelines"})}),s.jsx(kn,{value:l,onChange:a,items:[{id:"default",label:s.jsxs(s.Fragment,{children:["Default ",s.jsx("span",{className:"tab-count",children:Am.length})]})},{id:"custom",label:s.jsxs(s.Fragment,{children:["Custom ",s.jsx("span",{className:"tab-count",children:x??"…"})]})}]})]}),l==="default"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ap-note",children:"Built-in job types. Duplicate one to start a custom pipeline. Loops repeat until the QA Validator passes or the round limit is reached."}),s.jsx("div",{className:"ap-rows",children:Am.map(D=>s.jsxs("div",{className:"ap-row",children:[s.jsx("span",{className:"ap-row-name",children:br[D]}),s.jsx("span",{className:"ap-row-steps",children:s.jsx(gP,{type:D,maxRounds:m,toneOf:g})}),s.jsxs("span",{className:"ap-row-meta",children:[s.jsx(hb,{size:13})," Built-in"]}),s.jsx("span",{className:"ap-row-actions",children:s.jsx("button",{className:"btn ghost sm",onClick:()=>n(`/agents/pipelines/new?from=${D}`),"aria-label":`Duplicate ${br[D]}`,children:"Duplicate"})})]},D))})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"ap-note",children:"Your own pipelines. Each loop repeats its agents until the first one passes, or up to its maximum iterations."}),s.jsx(Le,{error:c.error}),((R=c.data)==null?void 0:R.length)===0&&s.jsxs("div",{className:"ap-empty",children:[s.jsx("p",{className:"muted",children:"No custom pipelines yet."}),s.jsxs(ye,{to:"/agents/pipelines/new",className:"btn sm",children:[s.jsx(qt,{size:14})," New pipeline"]})]}),s.jsx("div",{className:"ap-rows",children:(T=c.data)==null?void 0:T.map(D=>s.jsxs("div",{className:"ap-row",children:[s.jsxs("span",{className:"ap-row-name",children:[s.jsx(ye,{to:`/agents/pipelines/${D.id}`,children:D.name}),D.description&&s.jsx("span",{className:"muted small ap-row-desc",children:D.description})]}),s.jsx("span",{className:"ap-row-steps",children:s.jsx(xP,{steps:D.steps,toneOf:g,custom:h.data??[]})}),s.jsx("span",{className:"ap-row-meta",title:`Updated ${Rt(D.updatedAt)}`,children:Rt(D.updatedAt)}),s.jsxs("span",{className:"ap-row-actions",children:[s.jsx("button",{className:"btn sm",onClick:()=>f(D),"aria-label":`Run pipeline ${D.name}`,children:"Run"}),s.jsx(ye,{to:`/agents/pipelines/${D.id}`,className:"btn ghost sm","aria-label":`Edit pipeline ${D.name}`,children:"Edit"}),s.jsx("button",{className:"btn danger sm icon",onClick:()=>void w(D),"aria-label":`Delete pipeline ${D.name}`,title:"Delete",children:s.jsx(Ar,{size:14})})]})]},D.id))})]})]}),d&&s.jsx(Ov,{title:`Run ${d.name}`,specRequired:_u(d),promptOnly:!_u(d),specAgent:Rb(d.steps),newSpec:_u(d),onClose:()=>f(null),onStart:(D,C)=>q.createJob({type:"pipeline",pipelineId:d.id,...D?{spec:D}:{},...C.trim()?{input:C}:{}})})]})}function Im({agent:e,tone:t,info:n}){const r=Ne[e],i=(n==null?void 0:n.customized)||(n==null?void 0:n.modelCustomized);return s.jsxs(ye,{to:`/agents/${e}`,className:`ap-agent ${r.llm?"":"step"}`,"aria-label":`${r.label}: ${r.description}`,children:[s.jsx("span",{className:`ap-avatar tone-${t}`,children:Uv(r.label)}),s.jsxs("span",{className:"ap-agent-text",children:[s.jsxs("b",{children:[r.label,i&&s.jsx("span",{className:"ap-custom",title:n!=null&&n.customized?"Custom prompt":"Custom model",children:"custom"}),!!(n!=null&&n.skills.length)&&s.jsxs("span",{className:"ap-custom",title:`Skills: ${n.skills.join(", ")}`,children:[n.skills.length," skill",n.skills.length===1?"":"s"]})]}),s.jsx("span",{title:r.description,children:r.description})]}),s.jsx("span",{className:`ap-pill tone-${t}`,children:r.llm?n?n.model[0].toUpperCase()+n.model.slice(1):"…":"No LLM"}),s.jsx("span",{className:"ap-chevron","aria-hidden":"true",children:s.jsx(ti,{size:14})})]})}const ad=(e,t)=>{var n;return((n=t.find(r=>Th(r.id)===e))==null?void 0:n.review)==="human"};function Bv({agent:e,toneOf:t,custom:n}){const r=ad(e,n);return s.jsxs("span",{className:`ap-chip tone-${t(e)}`,title:r?"Human review":void 0,children:[Pl(e,n),r&&" 👤"]})}const od=()=>s.jsx("span",{className:"ap-arrow",children:"→"});function gP({type:e,maxRounds:t,toneOf:n}){const r=Ao[e],i=e==="generate"||e==="heal",l=i?r.filter(o=>!Ch.includes(o)):r,a=e==="heal"?["healer","validator"]:["validator","healer"];return s.jsxs(s.Fragment,{children:[l.map((o,u)=>s.jsxs(j.Fragment,{children:[u>0&&s.jsx(od,{}),s.jsx(Bv,{agent:o,toneOf:n,custom:[]})]},o)),i&&s.jsxs(s.Fragment,{children:[l.length>0&&s.jsx(od,{}),s.jsx(Vh,{agents:a,toneOf:n,custom:[],suffix:t===null?null:`max ${t} round${t===1?"":"s"}`,swap:!0})]})]})}function xP({steps:e,toneOf:t,custom:n}){return s.jsx(s.Fragment,{children:e.map((r,i)=>s.jsxs(j.Fragment,{children:[i>0&&s.jsx(od,{}),r.kind==="agent"?s.jsx(Bv,{agent:r.agent,toneOf:t,custom:n}):s.jsx(Vh,{agents:r.steps,toneOf:t,custom:n,suffix:`max ${r.maxIterations}×${r.endsWhen==="last"?" · until last passes":""}`,endsWhen:r.endsWhen})]},i))})}function Vh({agents:e,toneOf:t,custom:n,suffix:r,swap:i,endsWhen:l}){return s.jsxs("span",{className:"ap-loop",title:`Repeats its agents; stops when the ${l==="last"?"last":"first"} one passes or the maximum is reached`,children:[s.jsx(ls,{size:12}),e.map((a,o)=>s.jsxs(j.Fragment,{children:[o>0&&(i?s.jsx("span",{className:"ap-loop-sep",children:"⇄"}):s.jsx("span",{className:"ap-loop-sep",children:"→"})),typeof a=="string"?s.jsxs("span",{className:`ap-loop-name tone-${t(a)}`,title:ad(a,n)?"Human review":void 0,children:[Pl(a,n),ad(a,n)&&" 👤"]}):s.jsx(Vh,{agents:a.steps,toneOf:t,custom:n,suffix:`max ${a.maxIterations}×${a.endsWhen==="last"?" · until last passes":""}`,endsWhen:a.endsWhen})]},o)),r&&s.jsx("span",{className:"ap-loop-max",children:r})]})}function Dm(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function yP(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function vP(e,t,n){const i=$o((n||{}).ignore||[]),l=jP(t);let a=-1;for(;++a<l.length;)nd(e,o);function o(c,h,d){if(c.type==="text"&&typeof d=="number")return u(c,h,d);if(i(c,d,h[h.length-1]))return td}function u(c,h,d){const f=h[h.length-1],m=l[a][0],p=l[a][1];let g=0,w=!1,x=[];m.lastIndex=0;let y=m.exec(c.value);for(;y;){const b=y.index,E={index:y.index,input:y.input,stack:[...h,c]};let k=p(...y,E);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1)m.lastIndex=b+1;else{if(g!==b&&v({type:"text",value:c.value.slice(g,b)}),Array.isArray(k))for(const R of k)v(R);else k&&v(k);g=b+y[0].length,w=!0}if(!m.global)break;y=m.exec(c.value)}return w?(g<c.value.length&&v({type:"text",value:c.value.slice(g)}),f.children.splice(d,1,...x)):x=[c],d+x.length;function v(b){const E=x[x.length-1];E&&E.type==="text"&&b.type==="text"?E.value+=b.value:x.push(b)}}}function jP(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([wP(i[0]),kP(i[1])])}return t}function wP(e){return typeof e=="string"?new RegExp(yP(e),"g"):e}function kP(e){return typeof e=="function"?e:function(){return e}}const $u="phrasing",Ou=["autolink","link","image","label"];function bP(){return{transforms:[RP],enter:{literalAutolink:NP,literalAutolinkEmail:Fu,literalAutolinkHttp:Fu,literalAutolinkWww:Fu},exit:{literalAutolink:PP,literalAutolinkEmail:TP,literalAutolinkHttp:CP,literalAutolinkWww:EP}}}function SP(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:$u,notInConstruct:Ou},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:$u,notInConstruct:Ou},{character:":",before:"[ps]",after:"\\/",inConstruct:$u,notInConstruct:Ou}]}}function NP(e){this.enter({type:"link",title:null,url:"",children:[],position:void 0},e)}function Fu(e){this.config.enter.autolinkProtocol.call(this,e)}function CP(e){this.config.exit.autolinkProtocol.call(this,e)}function EP(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function TP(e){this.config.exit.autolinkEmail.call(this,e)}function PP(e){this.exit(e)}function RP(e){vP(e,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),LP],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),DP],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),IP],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),AP]],{ignore:["link","linkReference"]})}function LP(e,t,n,r,i){if(!_P(i))return!1;let l="";if(/^w/i.test(t)&&(n=t+n,t="",l="http://"),Nl(n.charCodeAt(0))||!MP(n))return!1;const a=zP(n+r),o={type:"link",title:null,url:l+t+a[0],children:[{type:"text",value:t+a[0],position:void 0}],position:void 0};return a[1]?[o,{type:"text",value:a[1],position:void 0}]:o}function AP(e,t,n){return/[\d\-_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n,position:void 0}],position:void 0}}function IP(e,t,n){if(/[\d\-_]$/.test(n))return!1;const r="mailto:"+t+"@"+n;return{type:"link",title:null,url:r,children:[{type:"text",value:r,position:void 0}],position:void 0}}function DP(e,t,n,r,i){if(/[\d\-_]$/.test(n)||r&&(!/[A-Za-z]$/.test(r)||i.input.charAt(i.index+e.length)==="@"))return!1;const l="xmpp:"+t+"@"+n+(r||"");return{type:"link",title:null,url:l,children:[{type:"text",value:l,position:void 0}],position:void 0}}function MP(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[\dA-Za-z]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[\dA-Za-z]/.test(t[t.length-2])))}function zP(e){let t=e.length;for(;t>0;){const a=e.charCodeAt(t-1);if(a===33||a===34||a===38||a===39||a===41||a===44||a===46||a===58||a===59||a===60||a===62||a===63||a===93||a===125)t--;else break}if(t===e.length)return[e,void 0];let n=e.slice(t);e=e.slice(0,t);let r=n.indexOf(")");const i=Dm(e,"(");let l=Dm(e,")");for(;r!==-1&&i>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function _P(e){const t=e.input.charCodeAt(e.index-1);return e.index===0||as(t)||Nl(t)}Hv.peek=QP;function $P(){this.buffer()}function OP(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function FP(){this.buffer()}function UP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function BP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function HP(e){this.exit(e)}function WP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function VP(e){this.exit(e)}function QP(){return"["}function Hv(e,t,n,r){const i=n.createTracker(r);let l=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return l+=i.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),a(),l+=i.move("]"),l}function qP(){return{enter:{gfmFootnoteCallString:$P,gfmFootnoteCall:OP,gfmFootnoteDefinitionLabelString:FP,gfmFootnoteDefinition:UP},exit:{gfmFootnoteCallString:BP,gfmFootnoteCall:HP,gfmFootnoteDefinitionLabelString:WP,gfmFootnoteDefinition:VP}}}function GP(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Hv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,l,a){const o=l.createTracker(a);let u=o.move("[^");const c=l.enter("footnoteDefinition"),h=l.enter("label");return u+=o.move(l.safe(l.associationId(r),{before:u,after:"]"})),h(),u+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),u+=o.move((t?`
389
+ `:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Wv:KP))),c(),u}}function KP(e,t,n){return t===0?e:Wv(e,t,n)}function Wv(e,t,n){return(n?"":" ")+e}const YP=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Qh.attention=tR;Qh.peek=nR;function JP(){return{canContainEols:["delete"],enter:{strikethrough:ZP},exit:{strikethrough:eR}}}function XP(){return{handlers:{delete:Qh},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:YP}]}}function ZP(e){this.enter({type:"delete",children:[],position:void 0},e)}function eR(e){this.exit(e)}function Qh(e,t,n,r){const i=n.createTracker(r),l=n.stack.includes("strikethrough")?"~":"~~",a=n.enter("strikethrough");let o=i.move(l);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move(l),a(),o}function tR(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function nR(){return"~"}function rR(e){return e.length}function sR(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||rR,l=[],a=[],o=[],u=[];let c=0,h=-1;for(;++h<e.length;){const g=[],w=[];let x=-1;for(e[h].length>c&&(c=e[h].length);++x<e[h].length;){const y=iR(e[h][x]);if(n.alignDelimiters!==!1){const v=i(y);w[x]=v,(u[x]===void 0||v>u[x])&&(u[x]=v)}g.push(y)}a[h]=g,o[h]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)l[d]=Mm(r[d]);else{const g=Mm(r);for(;++d<c;)l[d]=g}d=-1;const f=[],m=[];for(;++d<c;){const g=l[d];let w="",x="";g===99?(w=":",x=":"):g===108?w=":":g===114&&(x=":");let y=n.alignDelimiters===!1?1:Math.max(1,u[d]-w.length-x.length);const v=w+"-".repeat(y)+x;n.alignDelimiters!==!1&&(y=w.length+y+x.length,y>u[d]&&(u[d]=y),m[d]=y),f[d]=v}a.splice(1,0,f),o.splice(1,0,m),h=-1;const p=[];for(;++h<a.length;){const g=a[h],w=o[h],x=n.fillRows===!1?Math.max(1,a[h===1?0:h].length):c;d=-1;const y=[];for(;++d<x;){const v=g[d]||"";let b="",E="";if(n.alignDelimiters!==!1){const k=u[d]-(w[d]||0),R=l[d];if(R===114)b=" ".repeat(k);else if(R===99){const T=k/2;k%2?(b=" ".repeat(T+.5),E=" ".repeat(T-.5)):(b=" ".repeat(T),E=b)}else E=" ".repeat(k)}n.delimiterStart!==!1&&!d&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||d)&&y.push(" "),n.alignDelimiters!==!1&&y.push(b),y.push(v),n.alignDelimiters!==!1&&y.push(E),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||d!==x-1)&&y.push("|")}p.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return p.join(`
390
+ `)}function iR(e){return e==null?"":String(e)}function Mm(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const lR=$o(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aR(e,t,n,r){const i=n.enter("blockquote"),l=n.createTracker(r);l.move("> "),l.shift(2);const a=n.indentLines(n.containerFlow(e,l.current()),oR);return i(),a}function oR(e,t,n){return">"+(n?"":" ")+e}function uR(e,t){return zm(e,t.inConstruct,!0)&&!zm(e,t.notInConstruct,!1)}function zm(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function _m(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){const l=n.unsafe[i];if(l.character===`
391
+ `&&!l.before&&!l.after&&uR(n.stack,l))return/[\t ]/.test(r.before)?"":" "}return`\\
392
+ `}function cR(e,t){const n=String(e);let r=n.indexOf(t),i=r,l=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++l>a&&(a=l):l=1,i=r+t.length,r=n.indexOf(t,i);return a}function dR(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function hR(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function fR(e,t,n,r){const i=hR(n),l=e.value||"";if(dR(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(l,pR);return d(),f}const a=n.createTracker(r),o=i.repeat(Math.max(cR(l,i)+1,3)),u=n.enter("codeFenced"),c=i==="`"?"GraveAccent":"Tilde";let h=a.move(o);if(e.lang){const d=n.enter(`codeFencedLang${c}`);h+=a.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${c}`);h+=a.move(" "),h+=a.move(n.safe(e.meta,{before:h,after:`
393
393
  `,encode:["`"],...a.current()})),d()}return h+=a.move(`
394
394
  `),l&&(h+=a.move(l+`
395
- `)),h+=a.move(o),u(),h}function mR(e,t,n){return(n?"":" ")+e}function qh(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gR(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("[");return c+=u.move(n.safe(n.associationId(e),{before:c,after:"]",...u.current()})),c+=u.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(o=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":`
396
- `,...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),o()),a(),c}function xR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function oo(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Ws(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function Hv(e){return"&#x"+e.toString(16).toUpperCase()+";"}function $m(e,t,n){const r=br(e),i=br(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function yR(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const o=e.charCodeAt(2);return o===45?2:o===91?5:yt(o)?4:void 0}if(t===63)return 3;const n=t===47,r=n?2:1;let i=r,l=e.charCodeAt(i);if(!yt(l))return;for(;l===45||vt(l);)l=e.charCodeAt(++i);const a=e.slice(r,i).toLowerCase();return!n&&l!==47&&ed.includes(a)?1:vv.includes(a)?6:7}const Wv=new Map([["*",!1],["_",!0]]);function vR(e,t,n){const r=new Set;for(const l of e){const a=n.get(l);if(a&&l.attention&&t.some(o=>o.attention===l.attention))for(const o of a.tokens)r.add(o.attention)}const i=[];for(const l of e)l.attention&&r.delete(l.attention)&&i.push(l.attention);return i.reverse(),i}function Vv(e,t,n){const r=[],i=new Map,l=new Map;let a=0;for(;a<e.length;){if(!e[a].attention){a++;continue}const o=e[a].value.charAt(0),u=Wv.get(o);let c=a+1;for(;c<e.length&&e[c].attention&&e[c].value.charAt(0)===o;)c++;const h=a?e[a-1].value:t,d=br(h.charCodeAt(h.length-1)),f=br((c<e.length?e[c].value:n).charCodeAt(0)),m=!f||f===2&&!!d,p=!d||d===2&&!!f,g={tokens:e.slice(a,c),markers:[],start:0,end:0,open:u?m&&(!!d||!p):m,close:u?p&&(!!f||!m):p,split:u!==void 0};for(const w of g.tokens){i.set(w,[...g.tokens]),l.set(w,g);let x=w.value.length;for(;x--;)g.markers.push(w)}g.end=g.markers.length,r.push(g),a=c}for(wR(r,i),a=-1;++a<e.length;){const o=i.get(e[a]);if(o)return{attention:vR(e,o,l),index:a}}}function oa(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const r=t?oo(n.value):Ws(n.value),i=Hv(r.codePointAt(0));if(t)n.value=i+n.value.slice(r.length);else{let l=n.value.slice(0,n.value.length-r.length),a=0;for(;l.charCodeAt(l.length-1-a)===92;)a++;a%2&&(l+="\\"),n.value=l+i}}function jR(e,t,n,r,i){for(const l of n.attention){const a=t.get(l)||l.sequences[0];for(const o of l.sequences){if(o===a)continue;const u=new Map(t);u.set(l,o);const c=Uo(e,u,r,i),h=Vv(c,r,i);if(!h||h.index>n.index)return{chosen:u,mistake:h,tokens:c}}}}function wR(e,t){const n=new Map;for(const r of e){const i=r.tokens[0].value.charAt(0);let l=n.get(i);l||(l=[],n.set(i,l));let a=r.close?l.length:0;for(;a--&&r.start<r.end;){const o=l[a],u=o.end-o.start,c=r.end-r.start;if(r.split?(o.close||r.open)&&c%3&&!((u+c)%3):u!==o.markers.length||u!==c)continue;const h=r.split?u>1&&c>1?2:1:c,d=o.markers.slice(o.end-h,o.end),f=r.markers.slice(r.start,r.start+h),m=d[0],p=f[0];if(m===d[h-1]&&m.value.length===h&&p===f[h-1]&&p.value.length===h&&m.attention===p.attention)t.delete(m),t.delete(p);else{const g=[...new Set([...d,...f])];for(const w of g){const x=t.get(w);x&&x.push(...g)}}o.end-=h,r.start+=h,o.start===o.end&&l.splice(a,1),a=l.length}r.open&&r.start<r.end&&l.push(r)}}function kR(e,t,n){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const i of n)if(!Number.isSafeInteger(i)||i<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as size, expected positive integer");const r=[];for(const i of t){if(i.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!cv(i.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(const l of n)r.push(i.repeat(l))}return r}function bR(e,t,n){const r=t.indexStack,i=e.children||[],l=[];let a=-1,o=n.before;r.push(-1);let u=t.createTracker(n);for(;++a<i.length;){const c=i[a];let h;if(r[r.length-1]=a,a+1<i.length){let m=t.handle.handlers[i[a+1].type];m&&m.peek&&(m=m.peek),h=m?oo(m(i[a+1],e,t,{before:"",after:"",...u.current()})):""}else h=n.after;const d=l[l.length-1];typeof d=="string"&&(o==="\r"||o===`
397
- `)&&c.type==="html"&&yR(c.value)!==7&&(l[l.length-1]=d.replace(/(\r?\n|\r)$/," "),o=" ",u=t.createTracker(n),u.move(Bo(l,n.before,n.after)));const f=t.handle.handlers[c.type];if(f&&f.attention){const m=Gh(c,f.attention,t,u);if(!m)continue;l.push(m),o=Ws(m.sequences[0])}else{const m=t.handle(c,e,t,{...u.current(),after:h,before:o});if(!m)continue;u.move(m),l.push(m),o=Ws(m)}}return r.pop(),l}function Gh(e,t,n,r){const{construct:i,markers:l,sizes:a}=t(e,n),o=kR(e.type,l,a),u=o[0],c=n.enter(i),h=n.createTracker(r.current());h.move(u);const d=bR(e,n,{...h.current(),before:u,after:u});if(c(),d.length!==0)return r.move(u),r.move(Bo(d,u,u)),r.move(u),{children:d,sequences:o}}function Om(e,t,n,r){let i=Uo(e,t,n,r),l=Vv(i,n,r);for(;l;){const a=jR(e,t,l,n,r);if(!a)return;t=a.chosen,i=a.tokens,l=a.mistake}return i}function Qv(e,t,n,r){let i=n,l=-1;for(;++l<e.length;){const a=e[l];if(typeof a=="string"){i="";continue}const o=l===e.length-1?r:"",u=a.sequences.find(function(c){const h=c.charAt(0);return h!==i.charAt(0)&&h!==o.charAt(0)||e.length===1&&Wv.has(h)&&c.length>n.length})||a.sequences[0];u!==a.sequences[0]&&t.set(a,u),Qv(a.children,t,u,u),i=u}}function Uo(e,t,n,r){const i=[];let l,a=Ws(n),o=-1;for(;++o<e.length;){const u=e[o];if(typeof u=="string"){const v={value:u,attention:void 0};l&&l===oo(u)&&oa([v],!0),l=void 0,i.push(v),v.value&&(a=Ws(v.value));continue}const c=t.get(u)||u.sequences[0],h=c.charAt(0),d=e[o+1],f=a,m=oo(d===void 0?r:typeof d=="string"?d:t.get(d)||d.sequences[0]),p=Uo(u.children,t,c,c),g=p[0].value,w=$m(f.charCodeAt(f.length-1),g.charCodeAt(0),h);w.inside&&oa(p,!0);const x=Ws(p[p.length-1].value),y=$m(m.charCodeAt(0),x.charCodeAt(x.length-1),h);y.inside&&oa(p,!1),w.outside&&f!==`
398
- `&&f!=="\r"&&oa(i,!1),y.outside&&(l=m),i.push({value:c,attention:u},...p,{value:c,attention:u}),a=c.charAt(c.length-1)}return i}function Bo(e,t,n){const r=new Map;Qv(e,r,t,n);const i=(r.size>0?Om(e,r,t,n):void 0)||Om(e,new Map,t,n)||Uo(e,new Map,t,n);let l="";for(const a of i)l+=a.value;return l}Kh.attention=qv;Kh.peek=SR;function Kh(e,t,n,r){const i=n.enter("phrasing"),l=Gh(e,qv,n,n.createTracker(r)),a=l?Bo([l],r.before,r.after):"";return i(),a}function qv(e,t){return{construct:"emphasis",markers:xR(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function SR(e,t,n){return n.options.emphasis||"*"}function NR(e,t){let n=!1;return Fo(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,qi}),!!((!e.depth||e.depth<3)&&Mo(e)&&(t.options.setext||n))}function CR(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(NR(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...l.current(),before:`
395
+ `)),h+=a.move(o),u(),h}function pR(e,t,n){return(n?"":" ")+e}function qh(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function mR(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("[");return c+=u.move(n.safe(n.associationId(e),{before:c,after:"]",...u.current()})),c+=u.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(o=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":`
396
+ `,...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),o()),a(),c}function gR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function oo(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Ws(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function Vv(e){return"&#x"+e.toString(16).toUpperCase()+";"}function $m(e,t,n){const r=Sr(e),i=Sr(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function xR(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const o=e.charCodeAt(2);return o===45?2:o===91?5:vt(o)?4:void 0}if(t===63)return 3;const n=t===47,r=n?2:1;let i=r,l=e.charCodeAt(i);if(!vt(l))return;for(;l===45||jt(l);)l=e.charCodeAt(++i);const a=e.slice(r,i).toLowerCase();return!n&&l!==47&&ed.includes(a)?1:jv.includes(a)?6:7}const Qv=new Map([["*",!1],["_",!0]]);function yR(e,t,n){const r=new Set;for(const l of e){const a=n.get(l);if(a&&l.attention&&t.some(o=>o.attention===l.attention))for(const o of a.tokens)r.add(o.attention)}const i=[];for(const l of e)l.attention&&r.delete(l.attention)&&i.push(l.attention);return i.reverse(),i}function qv(e,t,n){const r=[],i=new Map,l=new Map;let a=0;for(;a<e.length;){if(!e[a].attention){a++;continue}const o=e[a].value.charAt(0),u=Qv.get(o);let c=a+1;for(;c<e.length&&e[c].attention&&e[c].value.charAt(0)===o;)c++;const h=a?e[a-1].value:t,d=Sr(h.charCodeAt(h.length-1)),f=Sr((c<e.length?e[c].value:n).charCodeAt(0)),m=!f||f===2&&!!d,p=!d||d===2&&!!f,g={tokens:e.slice(a,c),markers:[],start:0,end:0,open:u?m&&(!!d||!p):m,close:u?p&&(!!f||!m):p,split:u!==void 0};for(const w of g.tokens){i.set(w,[...g.tokens]),l.set(w,g);let x=w.value.length;for(;x--;)g.markers.push(w)}g.end=g.markers.length,r.push(g),a=c}for(jR(r,i),a=-1;++a<e.length;){const o=i.get(e[a]);if(o)return{attention:yR(e,o,l),index:a}}}function aa(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const r=t?oo(n.value):Ws(n.value),i=Vv(r.codePointAt(0));if(t)n.value=i+n.value.slice(r.length);else{let l=n.value.slice(0,n.value.length-r.length),a=0;for(;l.charCodeAt(l.length-1-a)===92;)a++;a%2&&(l+="\\"),n.value=l+i}}function vR(e,t,n,r,i){for(const l of n.attention){const a=t.get(l)||l.sequences[0];for(const o of l.sequences){if(o===a)continue;const u=new Map(t);u.set(l,o);const c=Uo(e,u,r,i),h=qv(c,r,i);if(!h||h.index>n.index)return{chosen:u,mistake:h,tokens:c}}}}function jR(e,t){const n=new Map;for(const r of e){const i=r.tokens[0].value.charAt(0);let l=n.get(i);l||(l=[],n.set(i,l));let a=r.close?l.length:0;for(;a--&&r.start<r.end;){const o=l[a],u=o.end-o.start,c=r.end-r.start;if(r.split?(o.close||r.open)&&c%3&&!((u+c)%3):u!==o.markers.length||u!==c)continue;const h=r.split?u>1&&c>1?2:1:c,d=o.markers.slice(o.end-h,o.end),f=r.markers.slice(r.start,r.start+h),m=d[0],p=f[0];if(m===d[h-1]&&m.value.length===h&&p===f[h-1]&&p.value.length===h&&m.attention===p.attention)t.delete(m),t.delete(p);else{const g=[...new Set([...d,...f])];for(const w of g){const x=t.get(w);x&&x.push(...g)}}o.end-=h,r.start+=h,o.start===o.end&&l.splice(a,1),a=l.length}r.open&&r.start<r.end&&l.push(r)}}function wR(e,t,n){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const i of n)if(!Number.isSafeInteger(i)||i<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as size, expected positive integer");const r=[];for(const i of t){if(i.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!dv(i.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(const l of n)r.push(i.repeat(l))}return r}function kR(e,t,n){const r=t.indexStack,i=e.children||[],l=[];let a=-1,o=n.before;r.push(-1);let u=t.createTracker(n);for(;++a<i.length;){const c=i[a];let h;if(r[r.length-1]=a,a+1<i.length){let m=t.handle.handlers[i[a+1].type];m&&m.peek&&(m=m.peek),h=m?oo(m(i[a+1],e,t,{before:"",after:"",...u.current()})):""}else h=n.after;const d=l[l.length-1];typeof d=="string"&&(o==="\r"||o===`
397
+ `)&&c.type==="html"&&xR(c.value)!==7&&(l[l.length-1]=d.replace(/(\r?\n|\r)$/," "),o=" ",u=t.createTracker(n),u.move(Bo(l,n.before,n.after)));const f=t.handle.handlers[c.type];if(f&&f.attention){const m=Gh(c,f.attention,t,u);if(!m)continue;l.push(m),o=Ws(m.sequences[0])}else{const m=t.handle(c,e,t,{...u.current(),after:h,before:o});if(!m)continue;u.move(m),l.push(m),o=Ws(m)}}return r.pop(),l}function Gh(e,t,n,r){const{construct:i,markers:l,sizes:a}=t(e,n),o=wR(e.type,l,a),u=o[0],c=n.enter(i),h=n.createTracker(r.current());h.move(u);const d=kR(e,n,{...h.current(),before:u,after:u});if(c(),d.length!==0)return r.move(u),r.move(Bo(d,u,u)),r.move(u),{children:d,sequences:o}}function Om(e,t,n,r){let i=Uo(e,t,n,r),l=qv(i,n,r);for(;l;){const a=vR(e,t,l,n,r);if(!a)return;t=a.chosen,i=a.tokens,l=a.mistake}return i}function Gv(e,t,n,r){let i=n,l=-1;for(;++l<e.length;){const a=e[l];if(typeof a=="string"){i="";continue}const o=l===e.length-1?r:"",u=a.sequences.find(function(c){const h=c.charAt(0);return h!==i.charAt(0)&&h!==o.charAt(0)||e.length===1&&Qv.has(h)&&c.length>n.length})||a.sequences[0];u!==a.sequences[0]&&t.set(a,u),Gv(a.children,t,u,u),i=u}}function Uo(e,t,n,r){const i=[];let l,a=Ws(n),o=-1;for(;++o<e.length;){const u=e[o];if(typeof u=="string"){const v={value:u,attention:void 0};l&&l===oo(u)&&aa([v],!0),l=void 0,i.push(v),v.value&&(a=Ws(v.value));continue}const c=t.get(u)||u.sequences[0],h=c.charAt(0),d=e[o+1],f=a,m=oo(d===void 0?r:typeof d=="string"?d:t.get(d)||d.sequences[0]),p=Uo(u.children,t,c,c),g=p[0].value,w=$m(f.charCodeAt(f.length-1),g.charCodeAt(0),h);w.inside&&aa(p,!0);const x=Ws(p[p.length-1].value),y=$m(m.charCodeAt(0),x.charCodeAt(x.length-1),h);y.inside&&aa(p,!1),w.outside&&f!==`
398
+ `&&f!=="\r"&&aa(i,!1),y.outside&&(l=m),i.push({value:c,attention:u},...p,{value:c,attention:u}),a=c.charAt(c.length-1)}return i}function Bo(e,t,n){const r=new Map;Gv(e,r,t,n);const i=(r.size>0?Om(e,r,t,n):void 0)||Om(e,new Map,t,n)||Uo(e,new Map,t,n);let l="";for(const a of i)l+=a.value;return l}Kh.attention=Kv;Kh.peek=bR;function Kh(e,t,n,r){const i=n.enter("phrasing"),l=Gh(e,Kv,n,n.createTracker(r)),a=l?Bo([l],r.before,r.after):"";return i(),a}function Kv(e,t){return{construct:"emphasis",markers:gR(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function bR(e,t,n){return n.options.emphasis||"*"}function SR(e,t){let n=!1;return Fo(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,qi}),!!((!e.depth||e.depth<3)&&Mo(e)&&(t.options.setext||n))}function NR(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(SR(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...l.current(),before:`
399
399
  `,after:`
400
400
  `});return f(),d(),m+`
401
401
  `+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
402
402
  `))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),u=n.enter("phrasing");l.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
403
- `,...l.current()});const h=c.charCodeAt(0);return(h===9||h===32)&&(c=Hv(h)+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),u(),o(),c}Gv.peek=ER;function Gv(e){return e.value||""}function ER(){return"<"}Kv.peek=TR;function Kv(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("![");return c+=u.move(n.safe(e.alt,{before:c,after:"]",...u.current()})),c+=u.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(o=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":")",...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),o()),c+=u.move(")"),a(),c}function TR(){return"!"}Yv.peek=PR;function Yv(e,t,n,r){const i=e.referenceType,l=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("![");const c=n.safe(e.alt,{before:u,after:"]",...o.current()});u+=o.move(c+"]["),a();const h=n.stack;n.stack=h.filter(function(f){return f!=="phrasing"}),a=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return a(),n.stack=h,l(),i==="full"||!c||c!==d?u+=o.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function PR(){return"!"}Jv.peek=RR;function Jv(e,t,n){let r=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const a=n.unsafe[l],o=n.compilePattern(a);if(!a.atBreak)continue;let u;for(;u=o.exec(r);){let c=u.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(u.index+1)}}return i+r+i}function RR(){return"`"}function Xv(e,t){const n=Mo(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Zv.peek=LR;function Zv(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);if(Xv(e,n)){const p=n.stack;n.stack=p.filter(function(x){return x!=="phrasing"});const g=n.enter("autolink");let w=a.move("<");return w+=a.move(n.containerPhrasing(e,{before:w,after:">",...a.current()})),w+=a.move(">"),g(),n.stack=p,w}const o=n.enter("link");let u=n.enter("label"),c=a.move("[");const h=n.containerPhrasing(e,{before:c,after:"](",...a.current()});c+=a.move(h),u(),c+=a.move("](");const d=/[\0- \u007F]/.test(e.url),f=r.before.charAt(r.before.length-1);let m=e.title||void 0;if(!m&&!d&&(f===`
404
- `||f==="\r")){let p=0;for(;p<h.length&&h.charCodeAt(p)!==93;)p+=h.charCodeAt(p)===92?2:1;h.charCodeAt(p+1)===58&&(m="")}return!e.url&&typeof m=="string"||d?(u=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(u=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:typeof m=="string"?" ":")",...a.current()}))),u(),typeof m=="string"&&(u=n.enter(`title${l}`),c+=a.move(" "+i),c+=a.move(n.safe(m,{before:c,after:i,...a.current()})),c+=a.move(i),u()),c+=a.move(")"),o(),c}function LR(e,t,n){return Xv(e,n)?"<":"["}ej.peek=AR;function ej(e,t,n,r){const i=e.referenceType,l=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("[");const c=n.containerPhrasing(e,{before:u,after:"]",...o.current()});u+=o.move(c+"]["),a();const h=n.stack;n.stack=h.filter(function(f){return f!=="phrasing"}),a=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return a(),n.stack=h,l(),i==="full"||!c||c!==d?u+=o.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function AR(){return"["}function Yh(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function IR(e){const t=Yh(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function DR(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function tj(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function MR(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let a=e.ordered?DR(n):Yh(n);const o=e.ordered?a==="."?")":".":IR(n);let u=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),tj(n)===a&&h){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=o),n.bulletCurrent=a;const c=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=l,i(),c}function zR(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function _R(e,t,n,r){const i=zR(n);let l=n.bulletCurrent||Yh(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let a=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(a-l.length)),o.shift(a);const u=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,o.current()),h);return u(),c;function h(d,f,m){return f?(m?"":" ".repeat(a))+d:(m?l:l+" ".repeat(a-l.length))+d}}function $R(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),i(),a}function OR(e,t,n,r){if(!e.children.some(function(o){return aR(o)}))return n.containerFlow(e,r);const l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),a}function FR(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Jh.attention=nj;Jh.peek=UR;function Jh(e,t,n,r){const i=n.enter("phrasing"),l=Gh(e,nj,n,n.createTracker(r)),a=l?Bo([l],r.before,r.after):"";return i(),a}function nj(e,t){return{construct:"strong",markers:FR(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function UR(e,t,n){return n.options.strong||"*"}function BR(e,t,n,r){const i=t?t.children:[],l=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:i[l+1],beforeNode:i[l-1]})}function HR(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function WR(e,t,n){const r=(tj(n)+(n.options.ruleSpaces?" ":"")).repeat(HR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ud={blockquote:oR,break:_m,code:pR,definition:gR,emphasis:Kh,hardBreak:_m,heading:CR,html:Gv,image:Kv,imageReference:Yv,inlineCode:Jv,link:Zv,linkReference:ej,list:MR,listItem:_R,paragraph:$R,root:OR,strong:Jh,text:BR,thematicBreak:WR};function VR(){return{enter:{table:QR,tableData:Fm,tableHeader:Fm,tableRow:GR},exit:{codeText:KR,table:qR,tableData:Uu,tableHeader:Uu,tableRow:Uu}}}function QR(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[],position:void 0},e),this.data.inTable=!0}function qR(e){this.exit(e),this.data.inTable=void 0}function GR(e){this.enter({type:"tableRow",children:[],position:void 0},e)}function Uu(e){this.exit(e)}function Fm(e){this.enter({type:"tableCell",children:[],position:void 0},e)}function KR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,YR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function YR(e,t){return t==="|"?t:e}function JR(e){const t=e||{},{tableCellPadding:n,tablePipeAlign:r,stringLength:i}=t,l=n?" ":"|";return{handlers:{inlineCode:f,table:a,tableCell:u,tableRow:o},join:[XR],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
403
+ `,...l.current()});const h=c.charCodeAt(0);return(h===9||h===32)&&(c=Vv(h)+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),u(),o(),c}Yv.peek=CR;function Yv(e){return e.value||""}function CR(){return"<"}Jv.peek=ER;function Jv(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("![");return c+=u.move(n.safe(e.alt,{before:c,after:"]",...u.current()})),c+=u.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(o=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":")",...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),o()),c+=u.move(")"),a(),c}function ER(){return"!"}Xv.peek=TR;function Xv(e,t,n,r){const i=e.referenceType,l=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("![");const c=n.safe(e.alt,{before:u,after:"]",...o.current()});u+=o.move(c+"]["),a();const h=n.stack;n.stack=h.filter(function(f){return f!=="phrasing"}),a=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return a(),n.stack=h,l(),i==="full"||!c||c!==d?u+=o.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function TR(){return"!"}Zv.peek=PR;function Zv(e,t,n){let r=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const a=n.unsafe[l],o=n.compilePattern(a);if(!a.atBreak)continue;let u;for(;u=o.exec(r);){let c=u.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(u.index+1)}}return i+r+i}function PR(){return"`"}function ej(e,t){const n=Mo(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}tj.peek=RR;function tj(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);if(ej(e,n)){const p=n.stack;n.stack=p.filter(function(x){return x!=="phrasing"});const g=n.enter("autolink");let w=a.move("<");return w+=a.move(n.containerPhrasing(e,{before:w,after:">",...a.current()})),w+=a.move(">"),g(),n.stack=p,w}const o=n.enter("link");let u=n.enter("label"),c=a.move("[");const h=n.containerPhrasing(e,{before:c,after:"](",...a.current()});c+=a.move(h),u(),c+=a.move("](");const d=/[\0- \u007F]/.test(e.url),f=r.before.charAt(r.before.length-1);let m=e.title||void 0;if(!m&&!d&&(f===`
404
+ `||f==="\r")){let p=0;for(;p<h.length&&h.charCodeAt(p)!==93;)p+=h.charCodeAt(p)===92?2:1;h.charCodeAt(p+1)===58&&(m="")}return!e.url&&typeof m=="string"||d?(u=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(u=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:typeof m=="string"?" ":")",...a.current()}))),u(),typeof m=="string"&&(u=n.enter(`title${l}`),c+=a.move(" "+i),c+=a.move(n.safe(m,{before:c,after:i,...a.current()})),c+=a.move(i),u()),c+=a.move(")"),o(),c}function RR(e,t,n){return ej(e,n)?"<":"["}nj.peek=LR;function nj(e,t,n,r){const i=e.referenceType,l=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("[");const c=n.containerPhrasing(e,{before:u,after:"]",...o.current()});u+=o.move(c+"]["),a();const h=n.stack;n.stack=h.filter(function(f){return f!=="phrasing"}),a=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return a(),n.stack=h,l(),i==="full"||!c||c!==d?u+=o.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function LR(){return"["}function Yh(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function AR(e){const t=Yh(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function IR(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function rj(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function DR(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let a=e.ordered?IR(n):Yh(n);const o=e.ordered?a==="."?")":".":AR(n);let u=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),rj(n)===a&&h){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=o),n.bulletCurrent=a;const c=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=l,i(),c}function MR(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function zR(e,t,n,r){const i=MR(n);let l=n.bulletCurrent||Yh(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let a=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(a-l.length)),o.shift(a);const u=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,o.current()),h);return u(),c;function h(d,f,m){return f?(m?"":" ".repeat(a))+d:(m?l:l+" ".repeat(a-l.length))+d}}function _R(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),i(),a}function $R(e,t,n,r){if(!e.children.some(function(o){return lR(o)}))return n.containerFlow(e,r);const l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),a}function OR(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Jh.attention=sj;Jh.peek=FR;function Jh(e,t,n,r){const i=n.enter("phrasing"),l=Gh(e,sj,n,n.createTracker(r)),a=l?Bo([l],r.before,r.after):"";return i(),a}function sj(e,t){return{construct:"strong",markers:OR(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function FR(e,t,n){return n.options.strong||"*"}function UR(e,t,n,r){const i=t?t.children:[],l=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:i[l+1],beforeNode:i[l-1]})}function BR(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function HR(e,t,n){const r=(rj(n)+(n.options.ruleSpaces?" ":"")).repeat(BR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ud={blockquote:aR,break:_m,code:fR,definition:mR,emphasis:Kh,hardBreak:_m,heading:NR,html:Yv,image:Jv,imageReference:Xv,inlineCode:Zv,link:tj,linkReference:nj,list:DR,listItem:zR,paragraph:_R,root:$R,strong:Jh,text:UR,thematicBreak:HR};function WR(){return{enter:{table:VR,tableData:Fm,tableHeader:Fm,tableRow:qR},exit:{codeText:GR,table:QR,tableData:Uu,tableHeader:Uu,tableRow:Uu}}}function VR(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[],position:void 0},e),this.data.inTable=!0}function QR(e){this.exit(e),this.data.inTable=void 0}function qR(e){this.enter({type:"tableRow",children:[],position:void 0},e)}function Uu(e){this.exit(e)}function Fm(e){this.enter({type:"tableCell",children:[],position:void 0},e)}function GR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KR(e,t){return t==="|"?t:e}function YR(e){const t=e||{},{tableCellPadding:n,tablePipeAlign:r,stringLength:i}=t,l=n?" ":"|";return{handlers:{inlineCode:f,table:a,tableCell:u,tableRow:o},join:[JR],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
405
405
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}]};function a(m,p,g,w){const x=h(m,g,w),y=x[0];if(y){let v=m.align?m.align.length:0,b=-1;if(!v)for(;++b<x.length;)x[b].length>v&&(v=x[b].length);for(;y.length<v;)y.push("")}return c(x,m.align)}function o(m,p,g,w){const x=d(m,g,w),y=c([x]);return y.slice(0,y.indexOf(`
406
- `))}function u(m,p,g,w){const x=g.enter("tableCell"),y=g.enter("phrasing"),v=g.containerPhrasing(m,{...w,before:l,after:l});return y(),x(),v}function c(m,p){return iR(m,{align:p,alignDelimiters:r,fillRows:!1,padding:n,stringLength:i})}function h(m,p,g){const{children:w}=m;let x=-1;const y=[],v=p.enter("table");for(;++x<w.length;)y[x]=d(w[x],p,g);return v(),y}function d(m,p,g){const{children:w}=m;let x=-1;const y=[],v=p.enter("tableRow");for(;++x<w.length;)y[x]=u(w[x],m,p,g);return v(),y}function f(m,p,g){const w=ud.inlineCode(m,p,g);if(!g.stack.includes("tableCell"))return w;const x=[];let y=0,v=w.indexOf("|");for(;v!==-1;){let b=v;for(;b>y&&w.charCodeAt(b-1)===92;)b--;x.push(w.slice(y,v)),(v-b)%2===0&&x.push("\\"),y=v,v=w.indexOf("|",v+1)}return x.push(w.slice(y)),x.join("")}}function XR(e,t,n,r){if(e.type==="table"&&n.type==="listItem"&&n.spread===!1&&(t.type==="definition"||t.type==="heading"&&ZR(t,r)||t.type==="paragraph"||t.type==="table"))return 1}function ZR(e,t){let n=!1;return Fo(e,function(r){if(r.type==="break"||"value"in r&&/\r?\n|\r/.test(r.value))return n=!0,qi}),!!((!e.depth||e.depth<3)&&Mo(e)&&(t.options.setext||n))}function eL(){return{exit:{taskListCheckValueChecked:Um,taskListCheckValueUnchecked:Um,paragraph:nL}}}function tL(){return{handlers:{paragraph:rL},join:[sL]}}function Um(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function nL(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let l=-1,a;for(;++l<i.length;){const o=i[l];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start={...r.position.start}))}}this.exit(e)}function rL(e,t,n,r){if(!t||t.type!=="listItem"||rj(t)!==e)return ud.paragraph(e,t,n,r);const i="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);l.move(i);const a=ud.paragraph(e.children.length>0?e:{type:"paragraph",children:[{type:"text",value:" "}]},t,n,{...r,...l.current()});return i+a}function sL(e,t,n){if(!(e.type==="definition"&&n.type==="listItem"))return;const r=rj(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function rj(e){if(typeof e.checked=="boolean")for(const t of e.children){if(t.type==="paragraph")return t;if(t.type!=="definition")return}}function iL(){return[SP(),GP(),XP(),VR(),eL()]}function lL(e){return{extensions:[NP(),KP(e),ZP(),JR(e),tL()]}}const aL={tokenize:fL,partial:!0},sj={tokenize:pL,partial:!0},ij={tokenize:mL,partial:!0},lj={tokenize:gL,partial:!0},oL={tokenize:xL,partial:!0},aj={name:"wwwAutolink",tokenize:dL,previous:uj},oj={name:"protocolAutolink",tokenize:hL,previous:cj},Yn={name:"emailAutolink",tokenize:cL,previous:dj},Dn={};function uL(){return{text:Dn}}let Or=48;for(;Or<123;)Dn[Or]=Yn,Or++,Or===58?Or=65:Or===91&&(Or=97);Dn[43]=Yn;Dn[45]=Yn;Dn[46]=Yn;Dn[95]=Yn;Dn[72]=[Yn,oj];Dn[104]=[Yn,oj];Dn[87]=[Yn,aj];Dn[119]=[Yn,aj];function cL(e,t,n){const r=this;let i,l;return a;function a(d){return!cd(d)||!dj.call(r,r.previous)||Xh(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return cd(d)?(e.consume(d),o):d===64?(e.consume(d),u):n(d)}function u(d){return d===46?e.check(oL,h,c)(d):d===45||d===95||vt(d)?(l=!0,e.consume(d),u):h(d)}function c(d){return e.consume(d),i=!0,u}function h(d){return l&&i&&yt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function dL(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!uj.call(r,r.previous)||Xh(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(aL,e.attempt(sj,e.attempt(ij,l),n),n)(a))}function l(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function hL(e,t,n){const r=this;let i="",l=!1;return a;function a(d){return(d===72||d===104)&&cj.call(r,r.previous)&&!Xh(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),o):n(d)}function o(d){if(yt(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),o;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(d),u}return n(d)}function u(d){return d===47?(e.consume(d),l?c:(l=!0,u)):n(d)}function c(d){return d===null||so(d)||Oe(d)||ls(d)||Cl(d)?n(d):e.attempt(sj,e.attempt(ij,h),n)(d)}function h(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function fL(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),l):n(a)}function l(a){return a===null?n(a):t(a)}}function pL(e,t,n){let r,i,l;return a;function a(c){return c===46||c===95?e.check(lj,u,o)(c):c===null||Oe(c)||ls(c)||c!==45&&Cl(c)?u(c):(l=!0,e.consume(c),a)}function o(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),a}function u(c){return i||r||!l?n(c):t(c)}}function mL(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?l(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(lj,t,l)(a):a===null||Oe(a)||ls(a)?t(a):(e.consume(a),i)}function l(a){return a===41&&r++,e.consume(a),i}}function gL(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),l):o===93?(e.consume(o),i):o===60||o===null||Oe(o)||ls(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Oe(o)||ls(o)?t(o):r(o)}function l(o){return yt(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):yt(o)?(e.consume(o),a):n(o)}}function xL(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return vt(l)?n(l):t(l)}}function uj(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Oe(e)}function cj(e){return!yt(e)}function dj(e){return!(e===47||cd(e))}function cd(e){return e===43||e===45||e===46||e===95||vt(e)}function Xh(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const yL={tokenize:CL,partial:!0};function vL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:bL,continuation:{tokenize:SL},exit:NL}},text:{91:{name:"gfmFootnoteCall",tokenize:kL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jL,resolveTo:wL}}}}function jL(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!a||!a._balanced)return n(u);const c=vn(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!l.includes(c.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function wL(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function kL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,a;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(l>999||d===93&&!a||d===null||d===91||Oe(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(vn(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Oe(d)||(a=!0),l++,e.consume(d),d===92?h:c}function h(d){return d===91||d===92||d===93?(e.consume(d),l++,c):c(d)}}function bL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a=0,o;return u;function u(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(p)}function h(p){if(a>999||p===93&&!o||p===null||p===91||Oe(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return l=vn(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Oe(p)||(o=!0),a++,e.consume(p),p===92?d:h}function d(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),i.includes(l)||i.push(l),Le(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function SL(e,t,n){return e.check(El,t,e.attempt(yL,t,n))}function NL(e){e.exit("gfmFootnoteDefinition")}function CL(e,t,n){const r=this;return Le(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(l):n(l)}}function EL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let c=u;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[u][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[u][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[u][1].start)},f=[["enter",h,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&yn(f,f.length,0,zo(m,a.slice(c+1,u),o)),yn(f,f.length,0,[["exit",d,o],["enter",a[u][1],o],["exit",a[u][1],o],["exit",h,o]]),yn(a,c-1,u-c+3,f),u=c+f.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function l(a,o,u){const c=this.previous,h=this.events;let d=0;return f;function f(p){return c===126&&h[h.length-1][1].type!=="characterEscape"?u(p):(a.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const g=br(c);if(p===126)return d>1?u(p):(a.consume(p),d++,m);if(d<2&&!n)return u(p);const w=a.exit("strikethroughSequenceTemporary"),x=br(p);return w._open=!x||x===2&&!!g,w._close=!g||g===2&&!!x,o(p)}}}class TL{constructor(){this.map=[],this.index=new Map}add(t,n,r){PL(this,t,n,r)}consume(t){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0,this.index.clear()}}function PL(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const l=[t,n,r];e.map.push(l),e.index.set(t,l)}function RL(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function LL(){return{flow:{null:{name:"table",tokenize:AL,resolveAll:IL}}}}function AL(e,t,n){const r=this;let i=0,l=0,a;return o;function o(C){let L=r.events.length-1;for(;L>-1;){const{type:U}=r.events[L][1];if(U==="lineEnding"||U==="linePrefix")L--;else break}const A=L>-1?r.events[L][1].type:null,z=A==="tableHead"||A==="tableRow"?k:u;return z===k&&r.parser.lazy[r.now().line]?n(C):z(C)}function u(C){return e.enter("tableHead"),e.enter("tableRow"),c(C)}function c(C){return C===124||(a=!0,l+=1),h(C)}function h(C){return C===null?n(C):de(C)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),m):n(C):ve(C)?Le(e,h,"whitespace")(C):(l+=1,a&&(a=!1,i+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),d(C)))}function d(C){return C===null||C===124||Oe(C)?(e.exit("data"),h(C)):(e.consume(C),C===92?f:d)}function f(C){return C===92||C===124?(e.consume(C),d):d(C)}function m(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),a=!1,ve(C)?Le(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):p(C))}function p(C){return C===45||C===58?w(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),g):E(C)}function g(C){return ve(C)?Le(e,w,"whitespace")(C):w(C)}function w(C){return C===58?(l+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),x):C===45?(l+=1,x(C)):C===null||de(C)?b(C):E(C)}function x(C){return C===45?(e.enter("tableDelimiterFiller"),y(C)):E(C)}function y(C){return C===45?(e.consume(C),y):C===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(C))}function v(C){return ve(C)?Le(e,b,"whitespace")(C):b(C)}function b(C){return C===124?p(C):C===null||de(C)?!a||i!==l?E(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):E(C)}function E(C){return n(C)}function k(C){return e.enter("tableRow"),R(C)}function R(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),R):C===null||de(C)?(e.exit("tableRow"),t(C)):ve(C)?Le(e,R,"whitespace")(C):(e.enter("data"),T(C))}function T(C){return C===null||C===124||Oe(C)?(e.exit("data"),R(C)):(e.consume(C),C===92?D:T)}function D(C){return C===92||C===124?(e.consume(C),T):T(C)}}function IL(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],a=[0,0,0,0],o=!1,u=0,c,h,d;const f=new TL;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(o=!1,u!==0&&(Bm(f,t,u,c,h),h=void 0,u=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,l=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",h,t]])),i=p.type==="tableDelimiterRow"?2:h?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],d=ua(f,t,l,i,void 0,d),l=[0,0,0,0]),a[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(a[0]=a[1],d=ua(f,t,l,i,void 0,d)),l=a,a=[l[1],n,0,0])):p.type==="tableHead"?(o=!0,u=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(u=n,l[1]!==0?(a[0]=a[1],d=ua(f,t,l,i,n,d)):a[1]!==0&&(d=ua(f,t,a,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&Bm(f,t,u,c,h),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=RL(t.events,n))}return e}function ua(e,t,n,r,i,l){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(l.end=Object.assign({},Ss(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const u=Ss(t.events,n[1]);if(l={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const c=Ss(t.events,n[2]),h=Ss(t.events,n[3]),d={type:o,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;e.add(p,g,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(l.end=Object.assign({},Ss(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function Bm(e,t,n,r,i){const l=[],a=Ss(t.events,n);i&&(i.end=Object.assign({},a),l.push(["exit",i,t])),r.end=Object.assign({},a),l.push(["exit",r,t]),e.add(n+1,0,l)}function Ss(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const DL={name:"tasklistCheck",tokenize:zL};function ML(){return{text:{91:DL}}}function zL(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),l)}function l(u){return Oe(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(u)}function o(u){return de(u)?t(u):ve(u)?e.check({tokenize:_L},t,n)(u):n(u)}}function _L(e,t,n){return Le(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function $L(e){return ov([uL(),vL(),EL(e),LL(),ML()])}const OL={};function FL(e){const t=this,n=e||OL,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push($L(n)),l.push(iL()),a.push(lL(n))}const UL={builtin:"built-in",project:"project",user:"user",synced:"claude.ai",plugin:"",other:""},Bu=60;function BL(e,t){var h,d;const n=((h=t.catalog)==null?void 0:h.pipelines)??[],r=e.match(/^\/p:([a-z0-9-]+) (\S*)$/i);if(r){const f=n.find(p=>p.name===r[1].toLowerCase());if(!(f!=null&&f.runnable)||!/^[<[]spec\.md[>\]]/.test(f.argumentHint))return[];const m=r[2].toLowerCase();return t.specs.filter(p=>p.toLowerCase().startsWith(m)).slice(0,Bu).map(p=>({insert:`/p:${f.name} ${p} `,label:p,hint:"",description:"",badge:"spec"}))}const i=e.match(/^\/p:([a-z0-9-]*)$/i);if(i)return na(n,i[1]).slice(0,Bu).map(f=>({insert:`/p:${f.name} `,label:`/p:${f.name}`,hint:f.argumentHint,description:f.label===f.description||!f.description?f.label:`${f.label} — ${f.description}`,badge:f.builtin?"built-in":"custom"}));const l=e.match(/^\/(\S*)$/);if(!l)return[];const a=l[1],o=na(t.local.map(f=>({name:f.cmd.slice(1),description:f.help,l:f})),a).map(({l:f})=>({insert:`${f.cmd} `,label:f.cmd,hint:f.args,description:f.help,badge:"Agent Studio"})),u=n.length?na([{name:"p:",description:"Run an Agent Studio pipeline"}],a).map(()=>({insert:"/p:",label:"/p:<pipeline>",hint:"",description:"Run an Agent Studio pipeline",badge:"Agent Studio"})):[],c=na(((d=t.catalog)==null?void 0:d.commands)??[],a).map(f=>({insert:`/${f.name} `,label:`/${f.name}`,hint:f.argumentHint,description:f.description,badge:f.source==="plugin"?f.name.split(":")[0]:UL[f.source]}));return[...o,...u,...c].slice(0,Bu)}const hj="qa-studio.chat.settings",Hm={model:"default",effort:"default",permissionMode:"acceptEdits"};function HL(){try{return{...Hm,...JSON.parse(localStorage.getItem(hj)??"{}")}}catch{return Hm}}function WL(e){try{localStorage.setItem(hj,JSON.stringify(e))}catch{}}const dd=e=>typeof e=="number"?`$${e<.01&&e>0?e.toFixed(3):e.toFixed(2)}`:"",VL=e=>typeof e=="number"?e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.floor(e/6e4)} min ${Math.round(e%6e4/1e3)} s`:"",QL=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`,uo=[{cmd:"/model",args:"<default|fable|opus|sonnet|haiku|full-id>",help:"Change the model"},{cmd:"/effort",args:`<${Kr.join("|")}>`,help:"Change the reasoning effort"},{cmd:"/mode",args:"<plan|acceptEdits|auto|bypassPermissions>",help:"Change the permission mode"},{cmd:"/new",args:"",help:"Start a new chat"},{cmd:"/help",args:"",help:"List the commands"}];function qL(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,"")),r.onerror=()=>n(r.error??new Error("Could not read the file")),r.readAsDataURL(e)})}const fj=j.createContext(async()=>{}),GL={allowed:"Allowed",always:"Always allowed (saved to .claude/settings.local.json)",denied:"Denied",expired:"No longer waiting"};function KL({b:e}){const t=j.useContext(fj),[n,r]=j.useState(!1),i=a=>{r(!0),t(e.requestId,a).finally(()=>r(!1))},l=e.state==="pending";return s.jsxs("div",{className:`chat-perm ${e.state}`,role:l?"alertdialog":void 0,"aria-label":`Permission for ${e.toolName}`,children:[s.jsxs("div",{className:"chat-perm-head",children:[s.jsx("b",{children:l?`Allow Claude to use ${e.toolName}?`:e.toolName}),!l&&s.jsx("span",{className:`chat-perm-state ${e.state}`,children:GL[e.state]})]}),e.summary&&s.jsx("code",{className:"chat-perm-cmd",children:e.summary}),l&&e.reason&&s.jsx("div",{className:"muted small",children:e.reason}),e.input&&s.jsxs("details",{children:[s.jsx("summary",{className:"muted small",children:"Full input"}),s.jsx("pre",{children:e.input})]}),l&&s.jsxs("div",{className:"row chat-perm-actions",children:[s.jsx("button",{className:"btn sm",disabled:n,onClick:()=>i("allow"),autoFocus:!0,children:"Allow"}),e.canRemember&&s.jsx("button",{className:"btn ghost sm",disabled:n,onClick:()=>i("always"),title:"Allow now and don't ask again for this in this project (.claude/settings.local.json)",children:"Always allow"}),s.jsx("button",{className:"btn ghost sm chat-perm-deny",disabled:n,onClick:()=>i("deny"),children:"Deny"})]})]})}const YL=[FL],JL={table:({node:e,...t})=>s.jsx("div",{className:"chat-table-wrap",children:s.jsx("table",{...t})}),a:({node:e,...t})=>s.jsx("a",{...t,target:"_blank",rel:"noreferrer"})};function XL({b:e}){const t=e.done?e.isError?"error":"ok":"running";return s.jsxs("details",{className:`chat-tool ${t}`,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"chat-tool-state",children:t==="running"?s.jsx("span",{className:"chat-spinner"}):t==="error"?s.jsx(wr,{size:12}):s.jsx(jh,{size:12})}),s.jsx("b",{children:e.name}),e.summary&&s.jsx("code",{className:"chat-tool-sum",children:e.summary})]}),e.input&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"chat-tool-label",children:"Input"}),s.jsx("pre",{children:e.input})]}),e.result!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"chat-tool-label",children:e.isError?"Error":"Result"}),s.jsx("pre",{children:e.result||"(empty)"})]})]})}function ZL({b:e}){switch(e.kind){case"text":return s.jsx("div",{className:"chat-md",children:s.jsx(ui,{remarkPlugins:YL,components:JL,children:e.text})});case"thinking":return s.jsxs("details",{className:"chat-thinking",children:[s.jsx("summary",{children:"Thinking"}),s.jsx("div",{className:"chat-thinking-body",children:e.text})]});case"tool":return s.jsx(XL,{b:e});case"permission":return s.jsx(KL,{b:e});case"error":return s.jsx("div",{className:"error-box chat-error",role:"alert",children:e.text});case"notice":return s.jsx("div",{className:"chat-notice",children:e.text});case"job":return s.jsxs("div",{className:"chat-job",children:[s.jsxs("span",{children:["Started ",s.jsx("strong",{children:e.pipeline})," · ",s.jsx("code",{children:e.target})]}),s.jsxs(ye,{className:"btn ghost",to:`/runs/${e.jobId}`,children:["Open job #",e.jobId]})]})}}function pj({a:e,onRemove:t}){return s.jsxs("span",{className:"chat-att",title:e.path,children:[s.jsx(zy,{size:12}),s.jsx("span",{className:"chat-att-name",children:e.name}),s.jsx("span",{className:"muted",children:QL(e.size)}),t&&s.jsx("button",{type:"button",className:"chat-att-x",onClick:t,"aria-label":`Remove ${e.name}`,children:s.jsx(wr,{size:11})})]})}function eA({m:e}){var n;if(e.role==="user"){const r=e.blocks.find(i=>i.kind==="text");return s.jsxs("div",{className:"chat-msg user",children:[s.jsxs("div",{className:"chat-bubble",children:[r&&r.kind==="text"&&s.jsx("div",{className:"chat-user-text",children:r.text}),!!((n=e.attachments)!=null&&n.length)&&s.jsx("div",{className:"chat-atts",children:e.attachments.map(i=>s.jsx(pj,{a:i},i.id))})]}),e.settings&&s.jsxs("div",{className:"chat-meta",children:[e.settings.model," · effort ",e.settings.effort," · ",e.settings.permissionMode]})]})}const t=[e.model,dd(e.costUsd),VL(e.durationMs),e.turns?`${e.turns} turn${e.turns>1?"s":""}`:""].filter(Boolean);return s.jsxs("div",{className:"chat-msg assistant",children:[s.jsx("span",{className:"chat-avatar","aria-hidden":"true",children:s.jsx(Nh,{size:15})}),s.jsxs("div",{className:"chat-body",children:[e.blocks.map((r,i)=>s.jsx(ZL,{b:r},i)),e.pending&&s.jsxs("div",{className:"chat-typing","aria-label":"Claude is working",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),!e.pending&&t.length>0&&s.jsx("div",{className:"chat-meta",children:t.join(" · ")})]})]})}function tA({settings:e,onSettings:t,busy:n,onSend:r,onStop:i,ensureSession:l,onSlash:a}){var ae;const o=Ar(),[u,c]=j.useState(""),[h,d]=j.useState([]),[f,m]=j.useState(0),[p,g]=j.useState(!1),w=j.useRef(null),x=j.useRef(null),[y,v]=j.useState(null),[b,E]=j.useState([]),[k,R]=j.useState(0),[T,D]=j.useState(null),C=j.useRef(!1),L=j.useRef(null);j.useEffect(()=>{!u.startsWith("/")||C.current||(C.current=!0,q.chatCommands().then(v,()=>v(null)),q.specs().then(O=>E(O.map(N=>N.file)),()=>E([])))},[u]),j.useEffect(()=>R(0),[u]),j.useLayoutEffect(()=>{const O=x.current;O&&(O.style.height="auto",O.style.height=`${Math.min(O.scrollHeight,260)}px`)},[u]);const A=async O=>{if(O.length){m(N=>N+O.length);try{const N=await l();for(const F of O)try{const Z=await qL(F),oe=await q.uploadChatFile(N,{name:F.name||"pasted.png",mime:F.type||"application/octet-stream",data:Z});d(B=>[...B,oe])}catch(Z){o.error(`${F.name}: ${Z.message}`)}finally{m(Z=>Z-1)}}catch(N){m(0),o.error(N.message)}}},z=async()=>{const O=u.trim(),N=O.match(/^(\/[a-z]+)(?:\s+(.*))?$/i);if(N&&uo.some(F=>F.cmd===N[1].toLowerCase())){a(N[1].toLowerCase(),(N[2]??"").trim())&&c("");return}n||f||!O&&!h.length||await r(O,h)&&(c(""),d([]))},U=O=>{var F;const N=H[O];!N||N.disabled||(c(N.insert),R(0),(F=x.current)==null||F.focus())},I=O=>{if(H.length&&!O.nativeEvent.isComposing){const N=F=>{var oe,B;O.preventDefault();const Z=(X+F+H.length)%H.length;R(Z),(B=(oe=L.current)==null?void 0:oe.children[Z])==null||B.scrollIntoView({block:"nearest"})};if(O.key==="ArrowDown")return N(1);if(O.key==="ArrowUp")return N(-1);if(O.key==="Escape")return O.preventDefault(),D(u);if(O.key==="Tab"||O.key==="Enter"&&!O.shiftKey&&H[X]&&H[X].insert.trim()!==u.trim())return O.preventDefault(),U(X)}O.key==="Enter"&&!O.shiftKey&&!O.nativeEvent.isComposing&&(O.preventDefault(),z()),O.key==="Escape"&&n&&i()},Q=O=>{const N=[...O.clipboardData.files];N.length&&(O.preventDefault(),A(N))},J=O=>{O.preventDefault(),g(!1),A([...O.dataTransfer.files])},H=T===u?[]:BL(u,{local:uo,catalog:y,specs:b}),X=Math.min(k,Math.max(0,H.length-1)),S=$p.some(O=>O.id===e.model);return s.jsxs("div",{className:`chat-composer ${p?"dragging":""}`,onDragOver:O=>(O.preventDefault(),g(!0)),onDragLeave:()=>g(!1),onDrop:J,children:[H.length>0&&s.jsxs("div",{className:"chat-slash",role:"listbox",ref:L,children:[H.map((O,N)=>s.jsxs("button",{type:"button",role:"option","aria-selected":N===X,"aria-disabled":O.disabled,title:O.disabledReason??O.description,className:`chat-slash-item ${N===X?"active":""} ${O.disabled?"disabled":""}`,onMouseEnter:()=>R(N),onMouseDown:F=>F.preventDefault(),onClick:()=>U(N),children:[s.jsxs("code",{children:[O.label,O.hint&&s.jsxs("span",{className:"muted",children:[" ",O.hint]})]}),s.jsx("span",{className:"chat-slash-desc muted",children:O.description}),O.badge&&s.jsx("span",{className:"chat-slash-badge",children:O.badge})]},O.insert)),u.startsWith("/")&&!u.startsWith("/p:")&&(y==null?void 0:y.error)&&s.jsx("div",{className:"chat-slash-note muted",children:y.error})]}),(h.length>0||f>0)&&s.jsxs("div",{className:"chat-atts",children:[h.map(O=>s.jsx(pj,{a:O,onRemove:()=>d(N=>N.filter(F=>F.id!==O.id))},O.id)),f>0&&s.jsxs("span",{className:"chat-att muted",children:["Uploading ",f,"…"]})]}),s.jsx("textarea",{ref:x,className:"chat-input",rows:1,autoFocus:!0,placeholder:n?"Claude is answering… (Esc to stop)":"Message Claude Code - Enter to send, Shift+Enter for a new line, / for commands",value:u,onChange:O=>c(O.target.value),onKeyDown:I,onPaste:Q,"aria-label":"Message"}),s.jsxs("div",{className:"chat-toolbar",children:[s.jsx("input",{ref:w,type:"file",multiple:!0,hidden:!0,onChange:O=>(A([...O.target.files??[]]),O.target.value="")}),s.jsx("button",{type:"button",className:"btn ghost icon square",onClick:()=>{var O;return(O=w.current)==null?void 0:O.click()},title:"Attach files (or paste / drop them)","aria-label":"Attach files",children:s.jsx(zy,{size:16})}),s.jsxs("label",{className:"chat-select",title:"Model",children:[s.jsx("span",{children:"Model"}),s.jsxs("select",{value:e.model,onChange:O=>t({model:O.target.value}),"aria-label":"Model",children:[!S&&s.jsx("option",{value:e.model,children:e.model}),$p.map(O=>s.jsx("option",{value:O.id,children:O.label},O.id))]})]}),s.jsxs("label",{className:"chat-select chat-effort",title:"Reasoning effort: higher thinks longer (slower, more tokens). Default = Claude Code's own setting",children:[s.jsx("span",{children:"Effort"}),s.jsx("input",{type:"range",min:0,max:Kr.length-1,step:1,value:Math.max(0,Kr.indexOf(e.effort)),onChange:O=>t({effort:Kr[Number(O.target.value)]}),"aria-label":"Effort","aria-valuetext":e.effort,list:"chat-effort-ticks"}),s.jsx("datalist",{id:"chat-effort-ticks",children:Kr.map((O,N)=>s.jsx("option",{value:N},O))}),s.jsx("b",{className:"chat-effort-value",children:e.effort==="default"?"Default":e.effort})]}),s.jsxs("label",{className:"chat-select",title:(ae=ro.find(O=>O.id===e.permissionMode))==null?void 0:ae.description,children:[s.jsx("span",{children:"Permissions"}),s.jsx("select",{value:e.permissionMode,onChange:O=>t({permissionMode:O.target.value}),"aria-label":"Permission mode",children:ro.map(O=>s.jsx("option",{value:O.id,title:O.description,children:O.label},O.id))})]}),s.jsx("div",{className:"grow"}),n?s.jsxs("button",{type:"button",className:"btn danger sm",onClick:i,title:"Stop (Esc)",children:[s.jsx(Iy,{size:14})," Stop"]}):s.jsxs("button",{type:"button",className:"btn sm",onClick:()=>void z(),disabled:f>0||!u.trim()&&!h.length,"aria-label":"Send",children:[s.jsx(db,{size:14})," Send"]})]})]})}function nA(){const{id:e}=li(),t=ut(),n=Ar(),r=In(),i=Me(()=>q.chats(),[]),[l,a]=j.useState(null),[o,u]=j.useState(HL),[c,h]=j.useState(null),[d,f]=j.useState(null),m=j.useRef(null),p=j.useRef(!0),g=j.useRef(null),w=i.reload;j.useEffect(()=>{if(a(null),h(null),p.current=!0,!e)return;let A=!0;q.chat(e).then(U=>A&&a(I=>I??U)).catch(U=>A&&h(U.message));const z=K0(e,U=>{A&&(U.type==="session"?(a(U.session),U.session.busy||w()):a(I=>I&&{...I,messages:I.messages.map(Q=>Q.id===U.message.id?U.message:Q)}))});return()=>{A=!1,z()}},[e,w]),j.useLayoutEffect(()=>{const A=m.current;A&&p.current&&(A.scrollTop=A.scrollHeight)},[l]);const x=l?{model:l.model,effort:l.effort,permissionMode:l.permissionMode}:o,y=j.useCallback(async()=>{if(e)return e;g.current??(g.current=q.createChat(o).then(A=>(a(A),t(`/chat/${A.id}`,{replace:!0}),w(),A.id)));try{return await g.current}finally{g.current=null}},[e,o,t,w]),v=async A=>{const z={...x,...A};if(u(z),WL(z),!!l){a({...l,...A});try{await q.updateChat(l.id,A)}catch(U){n.error(U.message)}}},b=async(A,z)=>{try{const U=await y();p.current=!0;const I=await q.sendChat(U,A,z.map(Q=>Q.id));return a(Q=>Q&&Q.messages.length>I.messages.length?Q:I),!0}catch(U){return n.error(U.message),!1}},E=j.useCallback(async(A,z)=>{if(e)try{await q.answerChatPermission(e,A,z)}catch(U){n.error(U.message)}},[e,n]),k=()=>{l&&q.stopChat(l.id).catch(A=>n.error(A.message))},R=(A,z)=>{var U;if(A==="/new")return t("/chat"),!0;if(A==="/help")return n.info(s.jsx("div",{children:uo.map(I=>s.jsxs("div",{children:[s.jsx("code",{children:I.cmd})," ",I.help]},I.cmd))})),!0;if(!z)return n.warning(`Usage: ${A} ${(U=uo.find(I=>I.cmd===A))==null?void 0:U.args}`),!1;if(A==="/model")return v({model:z}),n.success(`Model: ${z}`),!0;if(A==="/effort")return Kr.includes(z)?(v({effort:z}),n.success(`Effort: ${z}`),!0):(n.error(`Effort must be one of ${Kr.join(", ")}`),!1);if(A==="/mode"){const I=ro.find(Q=>Q.id.toLowerCase()===z.toLowerCase());return I?(v({permissionMode:I.id}),n.success(`Permissions: ${I.label}`),!0):(n.error(`Mode must be one of ${ro.map(Q=>Q.id).join(", ")}`),!1)}return!1},T=async A=>{if(await r({title:`Delete "${A.title}"?`,message:"The chat and its attachments are removed from Agent Studio. The Claude Code session itself stays in Claude Code’s history.",danger:!0,confirmLabel:"Delete"}))try{await q.deleteChat(A.id),A.id===e&&t("/chat"),w()}catch(z){n.error(z.message)}},D=async()=>{if(!l||d===null)return;const A=d.trim();if(f(null),!(!A||A===l.title))try{a(await q.updateChat(l.id,{title:A})),w()}catch(z){n.error(z.message)}},C=()=>{l&&navigator.clipboard.writeText(`claude --resume ${l.id}`).then(()=>n.success("Copied: run it in a terminal at the repo root to continue there")).catch(()=>n.error("Could not copy"))},L=i.data??[];return s.jsxs("div",{className:"chat-page",children:[s.jsx(ot,{items:[{label:"Claude chat",to:"/chat"},...l?[{label:l.title}]:[]]}),s.jsxs("aside",{className:"chat-list",children:[s.jsxs("button",{className:"btn chat-new",onClick:()=>t("/chat"),children:[s.jsx(Qt,{size:15})," New chat"]}),s.jsxs("div",{className:"chat-list-items",children:[L.length===0&&s.jsx("p",{className:"muted small chat-list-empty",children:"No chats yet."}),L.map(A=>s.jsxs("div",{className:`chat-list-item ${A.id===e?"active":""}`,children:[s.jsxs(ye,{to:`/chat/${A.id}`,className:"chat-list-link",children:[s.jsxs("span",{className:"chat-list-title",children:[A.busy&&s.jsx("span",{className:"chat-dot",title:"Answering"}),A.title]}),s.jsxs("span",{className:"muted small",children:[Pt(A.updatedAt),A.costUsd>0&&` · ${dd(A.costUsd)}`]})]}),s.jsx("button",{className:"chat-list-del",onClick:()=>void T(A),"aria-label":`Delete ${A.title}`,title:"Delete chat",children:s.jsx(Lr,{size:13})})]},A.id))]})]}),s.jsxs("section",{className:"chat-main",children:[s.jsxs("header",{className:"chat-head",children:[l&&d!==null?s.jsx("input",{className:"input chat-rename",autoFocus:!0,value:d,onChange:A=>f(A.target.value),onBlur:()=>void D(),onKeyDown:A=>A.key==="Enter"?void D():A.key==="Escape"&&f(null),"aria-label":"Chat title"}):s.jsx("h1",{className:"chat-title",onDoubleClick:()=>l&&f(l.title),title:l?"Double-click to rename":void 0,children:(l==null?void 0:l.title)??"New chat"}),s.jsx("div",{className:"grow"}),l&&l.costUsd>0&&s.jsxs("span",{className:"muted small",children:["Total ",dd(l.costUsd)]}),(l==null?void 0:l.started)&&s.jsx("button",{className:"btn ghost sm",onClick:C,title:"Copy the command that continues this session in a terminal",children:s.jsx("code",{children:"claude --resume"})})]}),s.jsxs("div",{className:"chat-scroll",ref:m,onScroll:A=>p.current=A.currentTarget.scrollHeight-A.currentTarget.scrollTop-A.currentTarget.clientHeight<80,children:[c&&s.jsx("div",{className:"error-box",children:c}),!c&&(!l||l.messages.length===0)&&s.jsxs("div",{className:"chat-empty",children:[s.jsx("span",{className:"chat-empty-icon",children:s.jsx(Nh,{size:26})}),s.jsx("h2",{children:"Chat with Claude Code"}),s.jsxs("p",{className:"muted",children:["Runs Claude Code in this repository, like the terminal: it reads ",s.jsx("code",{children:"CLAUDE.md"}),", your skills and settings, and can edit files depending on the permission mode. Attach files with the paperclip, paste or drop them. Type ",s.jsx("code",{children:"/"})," for commands."]})]}),s.jsx(fj.Provider,{value:E,children:l==null?void 0:l.messages.map(A=>s.jsx(eA,{m:A},A.id))})]}),s.jsx(tA,{settings:x,onSettings:A=>void v(A),busy:!!(l!=null&&l.busy),onSend:b,onStop:k,ensureSession:y,onSlash:R})]})]})}const rA={name:"",description:"",instructions:"",model:"sonnet",skills:[],claudeMdSections:[],permissions:kb,review:"auto"},sA=[{key:"browser",label:"Browser",hint:"Drive a real browser with playwright cli; gets the .env values (base URL, accounts)."},{key:"editTests",label:"Edit tests",hint:"Edit tests/e2e, tests/pages and tests/fixtures."},{key:"editSpecs",label:"Edit specs",hint:"Edit files in specs/."},{key:"typecheck",label:"Typecheck",hint:"Run npm run typecheck."}],Wm=e=>({name:e.name,description:e.description,instructions:e.instructions,model:e.model,skills:e.skills,claudeMdSections:e.claudeMdSections,permissions:e.permissions,review:e.review??"auto"}),Vm=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t],iA=[{id:"scoped",label:"Scoped",hint:"Read the repository; write only its job directory plus what the toggles allow."},{id:"full",label:"Full edit",hint:"Create and edit any file and run any shell command, except the denied commands and protected folders below."}],lA=[{key:"deniedCommands",label:"Denied commands",hint:"One command per line; it is blocked with any arguments (Bash(<command>:*)).",placeholder:`git push
406
+ `))}function u(m,p,g,w){const x=g.enter("tableCell"),y=g.enter("phrasing"),v=g.containerPhrasing(m,{...w,before:l,after:l});return y(),x(),v}function c(m,p){return sR(m,{align:p,alignDelimiters:r,fillRows:!1,padding:n,stringLength:i})}function h(m,p,g){const{children:w}=m;let x=-1;const y=[],v=p.enter("table");for(;++x<w.length;)y[x]=d(w[x],p,g);return v(),y}function d(m,p,g){const{children:w}=m;let x=-1;const y=[],v=p.enter("tableRow");for(;++x<w.length;)y[x]=u(w[x],m,p,g);return v(),y}function f(m,p,g){const w=ud.inlineCode(m,p,g);if(!g.stack.includes("tableCell"))return w;const x=[];let y=0,v=w.indexOf("|");for(;v!==-1;){let b=v;for(;b>y&&w.charCodeAt(b-1)===92;)b--;x.push(w.slice(y,v)),(v-b)%2===0&&x.push("\\"),y=v,v=w.indexOf("|",v+1)}return x.push(w.slice(y)),x.join("")}}function JR(e,t,n,r){if(e.type==="table"&&n.type==="listItem"&&n.spread===!1&&(t.type==="definition"||t.type==="heading"&&XR(t,r)||t.type==="paragraph"||t.type==="table"))return 1}function XR(e,t){let n=!1;return Fo(e,function(r){if(r.type==="break"||"value"in r&&/\r?\n|\r/.test(r.value))return n=!0,qi}),!!((!e.depth||e.depth<3)&&Mo(e)&&(t.options.setext||n))}function ZR(){return{exit:{taskListCheckValueChecked:Um,taskListCheckValueUnchecked:Um,paragraph:tL}}}function eL(){return{handlers:{paragraph:nL},join:[rL]}}function Um(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function tL(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let l=-1,a;for(;++l<i.length;){const o=i[l];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start={...r.position.start}))}}this.exit(e)}function nL(e,t,n,r){if(!t||t.type!=="listItem"||ij(t)!==e)return ud.paragraph(e,t,n,r);const i="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);l.move(i);const a=ud.paragraph(e.children.length>0?e:{type:"paragraph",children:[{type:"text",value:" "}]},t,n,{...r,...l.current()});return i+a}function rL(e,t,n){if(!(e.type==="definition"&&n.type==="listItem"))return;const r=ij(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function ij(e){if(typeof e.checked=="boolean")for(const t of e.children){if(t.type==="paragraph")return t;if(t.type!=="definition")return}}function sL(){return[bP(),qP(),JP(),WR(),ZR()]}function iL(e){return{extensions:[SP(),GP(e),XP(),YR(e),eL()]}}const lL={tokenize:hL,partial:!0},lj={tokenize:fL,partial:!0},aj={tokenize:pL,partial:!0},oj={tokenize:mL,partial:!0},aL={tokenize:gL,partial:!0},uj={name:"wwwAutolink",tokenize:cL,previous:dj},cj={name:"protocolAutolink",tokenize:dL,previous:hj},Yn={name:"emailAutolink",tokenize:uL,previous:fj},Dn={};function oL(){return{text:Dn}}let Fr=48;for(;Fr<123;)Dn[Fr]=Yn,Fr++,Fr===58?Fr=65:Fr===91&&(Fr=97);Dn[43]=Yn;Dn[45]=Yn;Dn[46]=Yn;Dn[95]=Yn;Dn[72]=[Yn,cj];Dn[104]=[Yn,cj];Dn[87]=[Yn,uj];Dn[119]=[Yn,uj];function uL(e,t,n){const r=this;let i,l;return a;function a(d){return!cd(d)||!fj.call(r,r.previous)||Xh(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return cd(d)?(e.consume(d),o):d===64?(e.consume(d),u):n(d)}function u(d){return d===46?e.check(aL,h,c)(d):d===45||d===95||jt(d)?(l=!0,e.consume(d),u):h(d)}function c(d){return e.consume(d),i=!0,u}function h(d){return l&&i&&vt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function cL(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!dj.call(r,r.previous)||Xh(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(lL,e.attempt(lj,e.attempt(aj,l),n),n)(a))}function l(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function dL(e,t,n){const r=this;let i="",l=!1;return a;function a(d){return(d===72||d===104)&&hj.call(r,r.previous)&&!Xh(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),o):n(d)}function o(d){if(vt(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),o;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(d),u}return n(d)}function u(d){return d===47?(e.consume(d),l?c:(l=!0,u)):n(d)}function c(d){return d===null||ro(d)||Fe(d)||as(d)||Nl(d)?n(d):e.attempt(lj,e.attempt(aj,h),n)(d)}function h(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function hL(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),l):n(a)}function l(a){return a===null?n(a):t(a)}}function fL(e,t,n){let r,i,l;return a;function a(c){return c===46||c===95?e.check(oj,u,o)(c):c===null||Fe(c)||as(c)||c!==45&&Nl(c)?u(c):(l=!0,e.consume(c),a)}function o(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),a}function u(c){return i||r||!l?n(c):t(c)}}function pL(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?l(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(oj,t,l)(a):a===null||Fe(a)||as(a)?t(a):(e.consume(a),i)}function l(a){return a===41&&r++,e.consume(a),i}}function mL(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),l):o===93?(e.consume(o),i):o===60||o===null||Fe(o)||as(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Fe(o)||as(o)?t(o):r(o)}function l(o){return vt(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):vt(o)?(e.consume(o),a):n(o)}}function gL(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return jt(l)?n(l):t(l)}}function dj(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Fe(e)}function hj(e){return!vt(e)}function fj(e){return!(e===47||cd(e))}function cd(e){return e===43||e===45||e===46||e===95||jt(e)}function Xh(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const xL={tokenize:NL,partial:!0};function yL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kL,continuation:{tokenize:bL},exit:SL}},text:{91:{name:"gfmFootnoteCall",tokenize:wL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:vL,resolveTo:jL}}}}function vL(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!a||!a._balanced)return n(u);const c=vn(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!l.includes(c.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function jL(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function wL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,a;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(l>999||d===93&&!a||d===null||d===91||Fe(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(vn(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Fe(d)||(a=!0),l++,e.consume(d),d===92?h:c}function h(d){return d===91||d===92||d===93?(e.consume(d),l++,c):c(d)}}function kL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a=0,o;return u;function u(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(p)}function h(p){if(a>999||p===93&&!o||p===null||p===91||Fe(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return l=vn(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Fe(p)||(o=!0),a++,e.consume(p),p===92?d:h}function d(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),i.includes(l)||i.push(l),Ie(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function bL(e,t,n){return e.check(Cl,t,e.attempt(xL,t,n))}function SL(e){e.exit("gfmFootnoteDefinition")}function NL(e,t,n){const r=this;return Ie(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(l):n(l)}}function CL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let c=u;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[u][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[u][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[u][1].start)},f=[["enter",h,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&yn(f,f.length,0,zo(m,a.slice(c+1,u),o)),yn(f,f.length,0,[["exit",d,o],["enter",a[u][1],o],["exit",a[u][1],o],["exit",h,o]]),yn(a,c-1,u-c+3,f),u=c+f.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function l(a,o,u){const c=this.previous,h=this.events;let d=0;return f;function f(p){return c===126&&h[h.length-1][1].type!=="characterEscape"?u(p):(a.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const g=Sr(c);if(p===126)return d>1?u(p):(a.consume(p),d++,m);if(d<2&&!n)return u(p);const w=a.exit("strikethroughSequenceTemporary"),x=Sr(p);return w._open=!x||x===2&&!!g,w._close=!g||g===2&&!!x,o(p)}}}class EL{constructor(){this.map=[],this.index=new Map}add(t,n,r){TL(this,t,n,r)}consume(t){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0,this.index.clear()}}function TL(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const l=[t,n,r];e.map.push(l),e.index.set(t,l)}function PL(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function RL(){return{flow:{null:{name:"table",tokenize:LL,resolveAll:AL}}}}function LL(e,t,n){const r=this;let i=0,l=0,a;return o;function o(C){let L=r.events.length-1;for(;L>-1;){const{type:U}=r.events[L][1];if(U==="lineEnding"||U==="linePrefix")L--;else break}const A=L>-1?r.events[L][1].type:null,z=A==="tableHead"||A==="tableRow"?k:u;return z===k&&r.parser.lazy[r.now().line]?n(C):z(C)}function u(C){return e.enter("tableHead"),e.enter("tableRow"),c(C)}function c(C){return C===124||(a=!0,l+=1),h(C)}function h(C){return C===null?n(C):he(C)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),m):n(C):je(C)?Ie(e,h,"whitespace")(C):(l+=1,a&&(a=!1,i+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),d(C)))}function d(C){return C===null||C===124||Fe(C)?(e.exit("data"),h(C)):(e.consume(C),C===92?f:d)}function f(C){return C===92||C===124?(e.consume(C),d):d(C)}function m(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),a=!1,je(C)?Ie(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):p(C))}function p(C){return C===45||C===58?w(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),g):E(C)}function g(C){return je(C)?Ie(e,w,"whitespace")(C):w(C)}function w(C){return C===58?(l+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),x):C===45?(l+=1,x(C)):C===null||he(C)?b(C):E(C)}function x(C){return C===45?(e.enter("tableDelimiterFiller"),y(C)):E(C)}function y(C){return C===45?(e.consume(C),y):C===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(C))}function v(C){return je(C)?Ie(e,b,"whitespace")(C):b(C)}function b(C){return C===124?p(C):C===null||he(C)?!a||i!==l?E(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):E(C)}function E(C){return n(C)}function k(C){return e.enter("tableRow"),R(C)}function R(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),R):C===null||he(C)?(e.exit("tableRow"),t(C)):je(C)?Ie(e,R,"whitespace")(C):(e.enter("data"),T(C))}function T(C){return C===null||C===124||Fe(C)?(e.exit("data"),R(C)):(e.consume(C),C===92?D:T)}function D(C){return C===92||C===124?(e.consume(C),T):T(C)}}function AL(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],a=[0,0,0,0],o=!1,u=0,c,h,d;const f=new EL;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(o=!1,u!==0&&(Bm(f,t,u,c,h),h=void 0,u=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,l=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",h,t]])),i=p.type==="tableDelimiterRow"?2:h?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],d=oa(f,t,l,i,void 0,d),l=[0,0,0,0]),a[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(a[0]=a[1],d=oa(f,t,l,i,void 0,d)),l=a,a=[l[1],n,0,0])):p.type==="tableHead"?(o=!0,u=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(u=n,l[1]!==0?(a[0]=a[1],d=oa(f,t,l,i,n,d)):a[1]!==0&&(d=oa(f,t,a,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&Bm(f,t,u,c,h),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=PL(t.events,n))}return e}function oa(e,t,n,r,i,l){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(l.end=Object.assign({},Ss(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const u=Ss(t.events,n[1]);if(l={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const c=Ss(t.events,n[2]),h=Ss(t.events,n[3]),d={type:o,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;e.add(p,g,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(l.end=Object.assign({},Ss(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function Bm(e,t,n,r,i){const l=[],a=Ss(t.events,n);i&&(i.end=Object.assign({},a),l.push(["exit",i,t])),r.end=Object.assign({},a),l.push(["exit",r,t]),e.add(n+1,0,l)}function Ss(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const IL={name:"tasklistCheck",tokenize:ML};function DL(){return{text:{91:IL}}}function ML(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),l)}function l(u){return Fe(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(u)}function o(u){return he(u)?t(u):je(u)?e.check({tokenize:zL},t,n)(u):n(u)}}function zL(e,t,n){return Ie(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function _L(e){return uv([oL(),yL(),CL(e),RL(),DL()])}const $L={};function OL(e){const t=this,n=e||$L,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(_L(n)),l.push(sL()),a.push(iL(n))}const FL={builtin:"built-in",project:"project",user:"user",synced:"claude.ai",plugin:"",other:""},Bu=60;function UL(e,t){var h,d;const n=((h=t.catalog)==null?void 0:h.pipelines)??[],r=e.match(/^\/p:([a-z0-9-]+) (\S*)$/i);if(r){const f=n.find(p=>p.name===r[1].toLowerCase());if(!(f!=null&&f.runnable)||!/^[<[]spec\.md[>\]]/.test(f.argumentHint))return[];const m=r[2].toLowerCase();return t.specs.filter(p=>p.toLowerCase().startsWith(m)).slice(0,Bu).map(p=>({insert:`/p:${f.name} ${p} `,label:p,hint:"",description:"",badge:"spec"}))}const i=e.match(/^\/p:([a-z0-9-]*)$/i);if(i)return ta(n,i[1]).slice(0,Bu).map(f=>({insert:`/p:${f.name} `,label:`/p:${f.name}`,hint:f.argumentHint,description:f.label===f.description||!f.description?f.label:`${f.label} — ${f.description}`,badge:f.builtin?"built-in":"custom"}));const l=e.match(/^\/(\S*)$/);if(!l)return[];const a=l[1],o=ta(t.local.map(f=>({name:f.cmd.slice(1),description:f.help,l:f})),a).map(({l:f})=>({insert:`${f.cmd} `,label:f.cmd,hint:f.args,description:f.help,badge:"Agent Studio"})),u=n.length?ta([{name:"p:",description:"Run an Agent Studio pipeline"}],a).map(()=>({insert:"/p:",label:"/p:<pipeline>",hint:"",description:"Run an Agent Studio pipeline",badge:"Agent Studio"})):[],c=ta(((d=t.catalog)==null?void 0:d.commands)??[],a).map(f=>({insert:`/${f.name} `,label:`/${f.name}`,hint:f.argumentHint,description:f.description,badge:f.source==="plugin"?f.name.split(":")[0]:FL[f.source]}));return[...o,...u,...c].slice(0,Bu)}const pj="qa-studio.chat.settings",Hm={model:"default",effort:"default",permissionMode:"acceptEdits"};function BL(){try{return{...Hm,...JSON.parse(localStorage.getItem(pj)??"{}")}}catch{return Hm}}function HL(e){try{localStorage.setItem(pj,JSON.stringify(e))}catch{}}const dd=e=>typeof e=="number"?`$${e<.01&&e>0?e.toFixed(3):e.toFixed(2)}`:"",WL=e=>typeof e=="number"?e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.floor(e/6e4)} min ${Math.round(e%6e4/1e3)} s`:"",VL=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`,uo=[{cmd:"/model",args:"<default|fable|opus|sonnet|haiku|full-id>",help:"Change the model"},{cmd:"/effort",args:`<${Yr.join("|")}>`,help:"Change the reasoning effort"},{cmd:"/mode",args:"<plan|acceptEdits|auto|bypassPermissions>",help:"Change the permission mode"},{cmd:"/new",args:"",help:"Start a new chat"},{cmd:"/help",args:"",help:"List the commands"}];function QL(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,"")),r.onerror=()=>n(r.error??new Error("Could not read the file")),r.readAsDataURL(e)})}const mj=j.createContext(async()=>{}),qL={allowed:"Allowed",always:"Always allowed (saved to .claude/settings.local.json)",denied:"Denied",expired:"No longer waiting"};function GL({b:e}){const t=j.useContext(mj),[n,r]=j.useState(!1),i=a=>{r(!0),t(e.requestId,a).finally(()=>r(!1))},l=e.state==="pending";return s.jsxs("div",{className:`chat-perm ${e.state}`,role:l?"alertdialog":void 0,"aria-label":`Permission for ${e.toolName}`,children:[s.jsxs("div",{className:"chat-perm-head",children:[s.jsx("b",{children:l?`Allow Claude to use ${e.toolName}?`:e.toolName}),!l&&s.jsx("span",{className:`chat-perm-state ${e.state}`,children:qL[e.state]})]}),e.summary&&s.jsx("code",{className:"chat-perm-cmd",children:e.summary}),l&&e.reason&&s.jsx("div",{className:"muted small",children:e.reason}),e.input&&s.jsxs("details",{children:[s.jsx("summary",{className:"muted small",children:"Full input"}),s.jsx("pre",{children:e.input})]}),l&&s.jsxs("div",{className:"row chat-perm-actions",children:[s.jsx("button",{className:"btn sm",disabled:n,onClick:()=>i("allow"),autoFocus:!0,children:"Allow"}),e.canRemember&&s.jsx("button",{className:"btn ghost sm",disabled:n,onClick:()=>i("always"),title:"Allow now and don't ask again for this in this project (.claude/settings.local.json)",children:"Always allow"}),s.jsx("button",{className:"btn ghost sm chat-perm-deny",disabled:n,onClick:()=>i("deny"),children:"Deny"})]})]})}const KL=[OL],YL={table:({node:e,...t})=>s.jsx("div",{className:"chat-table-wrap",children:s.jsx("table",{...t})}),a:({node:e,...t})=>s.jsx("a",{...t,target:"_blank",rel:"noreferrer"})};function JL({b:e}){const t=e.done?e.isError?"error":"ok":"running";return s.jsxs("details",{className:`chat-tool ${t}`,children:[s.jsxs("summary",{children:[s.jsx("span",{className:"chat-tool-state",children:t==="running"?s.jsx("span",{className:"chat-spinner"}):t==="error"?s.jsx(wr,{size:12}):s.jsx(jh,{size:12})}),s.jsx("b",{children:e.name}),e.summary&&s.jsx("code",{className:"chat-tool-sum",children:e.summary})]}),e.input&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"chat-tool-label",children:"Input"}),s.jsx("pre",{children:e.input})]}),e.result!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"chat-tool-label",children:e.isError?"Error":"Result"}),s.jsx("pre",{children:e.result||"(empty)"})]})]})}function XL({b:e}){switch(e.kind){case"text":return s.jsx("div",{className:"chat-md",children:s.jsx(ui,{remarkPlugins:KL,components:YL,children:e.text})});case"thinking":return s.jsxs("details",{className:"chat-thinking",children:[s.jsx("summary",{children:"Thinking"}),s.jsx("div",{className:"chat-thinking-body",children:e.text})]});case"tool":return s.jsx(JL,{b:e});case"permission":return s.jsx(GL,{b:e});case"error":return s.jsx("div",{className:"error-box chat-error",role:"alert",children:e.text});case"notice":return s.jsx("div",{className:"chat-notice",children:e.text});case"job":return s.jsxs("div",{className:"chat-job",children:[s.jsxs("span",{children:["Started ",s.jsx("strong",{children:e.pipeline})," · ",s.jsx("code",{children:e.target})]}),s.jsxs(ye,{className:"btn ghost",to:`/runs/${e.jobId}`,children:["Open job #",e.jobId]})]})}}function gj({a:e,onRemove:t}){return s.jsxs("span",{className:"chat-att",title:e.path,children:[s.jsx(zy,{size:12}),s.jsx("span",{className:"chat-att-name",children:e.name}),s.jsx("span",{className:"muted",children:VL(e.size)}),t&&s.jsx("button",{type:"button",className:"chat-att-x",onClick:t,"aria-label":`Remove ${e.name}`,children:s.jsx(wr,{size:11})})]})}function ZL({m:e}){var n;if(e.role==="user"){const r=e.blocks.find(i=>i.kind==="text");return s.jsxs("div",{className:"chat-msg user",children:[s.jsxs("div",{className:"chat-bubble",children:[r&&r.kind==="text"&&s.jsx("div",{className:"chat-user-text",children:r.text}),!!((n=e.attachments)!=null&&n.length)&&s.jsx("div",{className:"chat-atts",children:e.attachments.map(i=>s.jsx(gj,{a:i},i.id))})]}),e.settings&&s.jsxs("div",{className:"chat-meta",children:[e.settings.model," · effort ",e.settings.effort," · ",e.settings.permissionMode]})]})}const t=[e.model,dd(e.costUsd),WL(e.durationMs),e.turns?`${e.turns} turn${e.turns>1?"s":""}`:""].filter(Boolean);return s.jsxs("div",{className:"chat-msg assistant",children:[s.jsx("span",{className:"chat-avatar","aria-hidden":"true",children:s.jsx(Nh,{size:15})}),s.jsxs("div",{className:"chat-body",children:[e.blocks.map((r,i)=>s.jsx(XL,{b:r},i)),e.pending&&s.jsxs("div",{className:"chat-typing","aria-label":"Claude is working",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),!e.pending&&t.length>0&&s.jsx("div",{className:"chat-meta",children:t.join(" · ")})]})]})}function eA({settings:e,onSettings:t,busy:n,onSend:r,onStop:i,ensureSession:l,onSlash:a}){var ae;const o=Ir(),[u,c]=j.useState(""),[h,d]=j.useState([]),[f,m]=j.useState(0),[p,g]=j.useState(!1),w=j.useRef(null),x=j.useRef(null),[y,v]=j.useState(null),[b,E]=j.useState([]),[k,R]=j.useState(0),[T,D]=j.useState(null),C=j.useRef(!1),L=j.useRef(null);j.useEffect(()=>{!u.startsWith("/")||C.current||(C.current=!0,q.chatCommands().then(v,()=>v(null)),q.specs().then(O=>E(O.map(N=>N.file)),()=>E([])))},[u]),j.useEffect(()=>R(0),[u]),j.useLayoutEffect(()=>{const O=x.current;O&&(O.style.height="auto",O.style.height=`${Math.min(O.scrollHeight,260)}px`)},[u]);const A=async O=>{if(O.length){m(N=>N+O.length);try{const N=await l();for(const F of O)try{const Z=await QL(F),ce=await q.uploadChatFile(N,{name:F.name||"pasted.png",mime:F.type||"application/octet-stream",data:Z});d(Te=>[...Te,ce])}catch(Z){o.error(`${F.name}: ${Z.message}`)}finally{m(Z=>Z-1)}}catch(N){m(0),o.error(N.message)}}},z=async()=>{const O=u.trim(),N=O.match(/^(\/[a-z]+)(?:\s+(.*))?$/i);if(N&&uo.some(F=>F.cmd===N[1].toLowerCase())){a(N[1].toLowerCase(),(N[2]??"").trim())&&c("");return}n||f||!O&&!h.length||await r(O,h)&&(c(""),d([]))},U=O=>{var F;const N=B[O];!N||N.disabled||(c(N.insert),R(0),(F=x.current)==null||F.focus())},I=O=>{if(B.length&&!O.nativeEvent.isComposing){const N=F=>{var ce,Te;O.preventDefault();const Z=(X+F+B.length)%B.length;R(Z),(Te=(ce=L.current)==null?void 0:ce.children[Z])==null||Te.scrollIntoView({block:"nearest"})};if(O.key==="ArrowDown")return N(1);if(O.key==="ArrowUp")return N(-1);if(O.key==="Escape")return O.preventDefault(),D(u);if(O.key==="Tab"||O.key==="Enter"&&!O.shiftKey&&B[X]&&B[X].insert.trim()!==u.trim())return O.preventDefault(),U(X)}O.key==="Enter"&&!O.shiftKey&&!O.nativeEvent.isComposing&&(O.preventDefault(),z()),O.key==="Escape"&&n&&i()},Q=O=>{const N=[...O.clipboardData.files];N.length&&(O.preventDefault(),A(N))},J=O=>{O.preventDefault(),g(!1),A([...O.dataTransfer.files])},B=T===u?[]:UL(u,{local:uo,catalog:y,specs:b}),X=Math.min(k,Math.max(0,B.length-1)),S=$p.some(O=>O.id===e.model);return s.jsxs("div",{className:`chat-composer ${p?"dragging":""}`,onDragOver:O=>(O.preventDefault(),g(!0)),onDragLeave:()=>g(!1),onDrop:J,children:[B.length>0&&s.jsxs("div",{className:"chat-slash",role:"listbox",ref:L,children:[B.map((O,N)=>s.jsxs("button",{type:"button",role:"option","aria-selected":N===X,"aria-disabled":O.disabled,title:O.disabledReason??O.description,className:`chat-slash-item ${N===X?"active":""} ${O.disabled?"disabled":""}`,onMouseEnter:()=>R(N),onMouseDown:F=>F.preventDefault(),onClick:()=>U(N),children:[s.jsxs("code",{children:[O.label,O.hint&&s.jsxs("span",{className:"muted",children:[" ",O.hint]})]}),s.jsx("span",{className:"chat-slash-desc muted",children:O.description}),O.badge&&s.jsx("span",{className:"chat-slash-badge",children:O.badge})]},O.insert)),u.startsWith("/")&&!u.startsWith("/p:")&&(y==null?void 0:y.error)&&s.jsx("div",{className:"chat-slash-note muted",children:y.error})]}),(h.length>0||f>0)&&s.jsxs("div",{className:"chat-atts",children:[h.map(O=>s.jsx(gj,{a:O,onRemove:()=>d(N=>N.filter(F=>F.id!==O.id))},O.id)),f>0&&s.jsxs("span",{className:"chat-att muted",children:["Uploading ",f,"…"]})]}),s.jsx("textarea",{ref:x,className:"chat-input",rows:1,autoFocus:!0,placeholder:n?"Claude is answering… (Esc to stop)":"Message Claude Code - Enter to send, Shift+Enter for a new line, / for commands",value:u,onChange:O=>c(O.target.value),onKeyDown:I,onPaste:Q,"aria-label":"Message"}),s.jsxs("div",{className:"chat-toolbar",children:[s.jsx("input",{ref:w,type:"file",multiple:!0,hidden:!0,onChange:O=>(A([...O.target.files??[]]),O.target.value="")}),s.jsx("button",{type:"button",className:"btn ghost icon square",onClick:()=>{var O;return(O=w.current)==null?void 0:O.click()},title:"Attach files (or paste / drop them)","aria-label":"Attach files",children:s.jsx(zy,{size:16})}),s.jsxs("label",{className:"chat-select",title:"Model",children:[s.jsx("span",{children:"Model"}),s.jsxs("select",{value:e.model,onChange:O=>t({model:O.target.value}),"aria-label":"Model",children:[!S&&s.jsx("option",{value:e.model,children:e.model}),$p.map(O=>s.jsx("option",{value:O.id,children:O.label},O.id))]})]}),s.jsxs("label",{className:"chat-select chat-effort",title:"Reasoning effort: higher thinks longer (slower, more tokens). Default = Claude Code's own setting",children:[s.jsx("span",{children:"Effort"}),s.jsx("input",{type:"range",min:0,max:Yr.length-1,step:1,value:Math.max(0,Yr.indexOf(e.effort)),onChange:O=>t({effort:Yr[Number(O.target.value)]}),"aria-label":"Effort","aria-valuetext":e.effort,list:"chat-effort-ticks"}),s.jsx("datalist",{id:"chat-effort-ticks",children:Yr.map((O,N)=>s.jsx("option",{value:N},O))}),s.jsx("b",{className:"chat-effort-value",children:e.effort==="default"?"Default":e.effort})]}),s.jsxs("label",{className:"chat-select",title:(ae=no.find(O=>O.id===e.permissionMode))==null?void 0:ae.description,children:[s.jsx("span",{children:"Permissions"}),s.jsx("select",{value:e.permissionMode,onChange:O=>t({permissionMode:O.target.value}),"aria-label":"Permission mode",children:no.map(O=>s.jsx("option",{value:O.id,title:O.description,children:O.label},O.id))})]}),s.jsx("div",{className:"grow"}),n?s.jsxs("button",{type:"button",className:"btn danger sm",onClick:i,title:"Stop (Esc)",children:[s.jsx(Iy,{size:14})," Stop"]}):s.jsxs("button",{type:"button",className:"btn sm",onClick:()=>void z(),disabled:f>0||!u.trim()&&!h.length,"aria-label":"Send",children:[s.jsx(fb,{size:14})," Send"]})]})]})}function tA(){const{id:e}=li(),t=ut(),n=Ir(),r=In(),i=_e(()=>q.chats(),[]),[l,a]=j.useState(null),[o,u]=j.useState(BL),[c,h]=j.useState(null),[d,f]=j.useState(null),m=j.useRef(null),p=j.useRef(!0),g=j.useRef(null),w=i.reload;j.useEffect(()=>{if(a(null),h(null),p.current=!0,!e)return;let A=!0;q.chat(e).then(U=>A&&a(I=>I??U)).catch(U=>A&&h(U.message));const z=J0(e,U=>{A&&(U.type==="session"?(a(U.session),U.session.busy||w()):a(I=>I&&{...I,messages:I.messages.map(Q=>Q.id===U.message.id?U.message:Q)}))});return()=>{A=!1,z()}},[e,w]),j.useLayoutEffect(()=>{const A=m.current;A&&p.current&&(A.scrollTop=A.scrollHeight)},[l]);const x=l?{model:l.model,effort:l.effort,permissionMode:l.permissionMode}:o,y=j.useCallback(async()=>{if(e)return e;g.current??(g.current=q.createChat(o).then(A=>(a(A),t(`/chat/${A.id}`,{replace:!0}),w(),A.id)));try{return await g.current}finally{g.current=null}},[e,o,t,w]),v=async A=>{const z={...x,...A};if(u(z),HL(z),!!l){a({...l,...A});try{await q.updateChat(l.id,A)}catch(U){n.error(U.message)}}},b=async(A,z)=>{try{const U=await y();p.current=!0;const I=await q.sendChat(U,A,z.map(Q=>Q.id));return a(Q=>Q&&Q.messages.length>I.messages.length?Q:I),!0}catch(U){return n.error(U.message),!1}},E=j.useCallback(async(A,z)=>{if(e)try{await q.answerChatPermission(e,A,z)}catch(U){n.error(U.message)}},[e,n]),k=()=>{l&&q.stopChat(l.id).catch(A=>n.error(A.message))},R=(A,z)=>{var U;if(A==="/new")return t("/chat"),!0;if(A==="/help")return n.info(s.jsx("div",{children:uo.map(I=>s.jsxs("div",{children:[s.jsx("code",{children:I.cmd})," ",I.help]},I.cmd))})),!0;if(!z)return n.warning(`Usage: ${A} ${(U=uo.find(I=>I.cmd===A))==null?void 0:U.args}`),!1;if(A==="/model")return v({model:z}),n.success(`Model: ${z}`),!0;if(A==="/effort")return Yr.includes(z)?(v({effort:z}),n.success(`Effort: ${z}`),!0):(n.error(`Effort must be one of ${Yr.join(", ")}`),!1);if(A==="/mode"){const I=no.find(Q=>Q.id.toLowerCase()===z.toLowerCase());return I?(v({permissionMode:I.id}),n.success(`Permissions: ${I.label}`),!0):(n.error(`Mode must be one of ${no.map(Q=>Q.id).join(", ")}`),!1)}return!1},T=async A=>{if(await r({title:`Delete "${A.title}"?`,message:"The chat and its attachments are removed from Agent Studio. The Claude Code session itself stays in Claude Code’s history.",danger:!0,confirmLabel:"Delete"}))try{await q.deleteChat(A.id),A.id===e&&t("/chat"),w()}catch(z){n.error(z.message)}},D=async()=>{if(!l||d===null)return;const A=d.trim();if(f(null),!(!A||A===l.title))try{a(await q.updateChat(l.id,{title:A})),w()}catch(z){n.error(z.message)}},C=()=>{l&&navigator.clipboard.writeText(`claude --resume ${l.id}`).then(()=>n.success("Copied: run it in a terminal at the repo root to continue there")).catch(()=>n.error("Could not copy"))},L=i.data??[];return s.jsxs("div",{className:"chat-page",children:[s.jsx(ot,{items:[{label:"Claude chat",to:"/chat"},...l?[{label:l.title}]:[]]}),s.jsxs("aside",{className:"chat-list",children:[s.jsxs("button",{className:"btn chat-new",onClick:()=>t("/chat"),children:[s.jsx(qt,{size:15})," New chat"]}),s.jsxs("div",{className:"chat-list-items",children:[L.length===0&&s.jsx("p",{className:"muted small chat-list-empty",children:"No chats yet."}),L.map(A=>s.jsxs("div",{className:`chat-list-item ${A.id===e?"active":""}`,children:[s.jsxs(ye,{to:`/chat/${A.id}`,className:"chat-list-link",children:[s.jsxs("span",{className:"chat-list-title",children:[A.busy&&s.jsx("span",{className:"chat-dot",title:"Answering"}),A.title]}),s.jsxs("span",{className:"muted small",children:[Rt(A.updatedAt),A.costUsd>0&&` · ${dd(A.costUsd)}`]})]}),s.jsx("button",{className:"chat-list-del",onClick:()=>void T(A),"aria-label":`Delete ${A.title}`,title:"Delete chat",children:s.jsx(Ar,{size:13})})]},A.id))]})]}),s.jsxs("section",{className:"chat-main",children:[s.jsxs("header",{className:"chat-head",children:[l&&d!==null?s.jsx("input",{className:"input chat-rename",autoFocus:!0,value:d,onChange:A=>f(A.target.value),onBlur:()=>void D(),onKeyDown:A=>A.key==="Enter"?void D():A.key==="Escape"&&f(null),"aria-label":"Chat title"}):s.jsx("h1",{className:"chat-title",onDoubleClick:()=>l&&f(l.title),title:l?"Double-click to rename":void 0,children:(l==null?void 0:l.title)??"New chat"}),s.jsx("div",{className:"grow"}),l&&l.costUsd>0&&s.jsxs("span",{className:"muted small",children:["Total ",dd(l.costUsd)]}),(l==null?void 0:l.started)&&s.jsx("button",{className:"btn ghost sm",onClick:C,title:"Copy the command that continues this session in a terminal",children:s.jsx("code",{children:"claude --resume"})})]}),s.jsxs("div",{className:"chat-scroll",ref:m,onScroll:A=>p.current=A.currentTarget.scrollHeight-A.currentTarget.scrollTop-A.currentTarget.clientHeight<80,children:[c&&s.jsx("div",{className:"error-box",children:c}),!c&&(!l||l.messages.length===0)&&s.jsxs("div",{className:"chat-empty",children:[s.jsx("span",{className:"chat-empty-icon",children:s.jsx(Nh,{size:26})}),s.jsx("h2",{children:"Chat with Claude Code"}),s.jsxs("p",{className:"muted",children:["Runs Claude Code in this repository, like the terminal: it reads ",s.jsx("code",{children:"CLAUDE.md"}),", your skills and settings, and can edit files depending on the permission mode. Attach files with the paperclip, paste or drop them. Type ",s.jsx("code",{children:"/"})," for commands."]})]}),s.jsx(mj.Provider,{value:E,children:l==null?void 0:l.messages.map(A=>s.jsx(ZL,{m:A},A.id))})]}),s.jsx(eA,{settings:x,onSettings:A=>void v(A),busy:!!(l!=null&&l.busy),onSend:b,onStop:k,ensureSession:y,onSlash:R})]})]})}const nA={name:"",description:"",instructions:"",model:"sonnet",skills:[],claudeMdSections:[],permissions:Sb,review:"auto"},rA=[{key:"browser",label:"Browser",hint:"Drive a real browser with playwright cli; gets the .env values (base URL, accounts)."},{key:"editTests",label:"Edit tests",hint:"Edit tests/e2e, tests/pages and tests/fixtures."},{key:"editSpecs",label:"Edit specs",hint:"Edit files in specs/."},{key:"typecheck",label:"Typecheck",hint:"Run npm run typecheck."}],Wm=e=>({name:e.name,description:e.description,instructions:e.instructions,model:e.model,skills:e.skills,claudeMdSections:e.claudeMdSections,permissions:e.permissions,review:e.review??"auto"}),Vm=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t],sA=[{id:"scoped",label:"Scoped",hint:"Read the repository; write only its job directory plus what the toggles allow."},{id:"full",label:"Full edit",hint:"Create and edit any file and run any shell command, except the denied commands and protected folders below."}],iA=[{key:"deniedCommands",label:"Denied commands",hint:"One command per line; it is blocked with any arguments (Bash(<command>:*)).",placeholder:`git push
407
407
  rm -rf`},{key:"protectedPaths",label:"Protected folders",hint:"One folder per line, relative to the repository root; the agent cannot edit or create files inside it (Edit(<folder>/**)).",placeholder:`qa-studio
408
- .git`}];function Qm(){var A,z,U;const{id:e}=li(),t=!e,n=ut(),r=Ar(),i=In(),l=Me(()=>e?q.customAgent(e):Promise.resolve(null),[e]),a=Me(()=>q.claudeMdSections()),o=Me(()=>q.skills()),[u,c]=j.useState(rA),[h,d]=j.useState("instructions"),[f,m]=j.useState(null),[p,g]=j.useState(null),[w,x]=j.useState(!1),[y,v]=j.useState(!1);j.useEffect(()=>{l.data&&c(Wm(l.data))},[l.data]);const b=(I,Q)=>c(J=>({...J,[I]:Q})),E=I=>c(Q=>{const J=Q.permissions,H=I==="full"&&!J.deniedCommands.length&&!J.protectedPaths.length;return{...Q,permissions:{...J,mode:I,...H?{deniedCommands:$y,protectedPaths:Oy}:{}}}}),k=async I=>{const Q=Mb(I);u.instructions.trim()&&u.instructions!==Q.instructions&&!await i({title:`Load the ${Qc.find(H=>H.id===I).label} template?`,message:"It replaces the instructions, description, model, review mode and permissions of this draft. Nothing is saved until you click Save.",confirmLabel:"Load template"})||(c(J=>({...J,name:t||!J.name.trim()?Q.name:J.name,description:Q.description,instructions:Q.instructions,model:Q.model,review:Q.review,permissions:Q.permissions})),d("instructions"),r.success(`Template loaded${t?"":": click Save to keep it"}`))},R=async()=>{var I;x(!0),g(null);try{const Q=t?await q.createCustomAgent(u):await q.saveCustomAgent(e,u,(I=l.data)==null?void 0:I.updatedAt);r.success(t?`Agent "${Q.name}" created`:`Agent "${Q.name}" saved`),t?n(`/agents/custom/${Q.id}`,{replace:!0}):l.reload()}catch(Q){g(Q.message)}finally{x(!1)}},T=async()=>{if(await i({title:`Delete the agent "${u.name}"?`,message:"Past jobs keep their results. This cannot be undone.",confirmLabel:"Delete agent",danger:!0}))try{await q.deleteCustomAgent(e),r.success("Agent deleted"),n("/agents")}catch(Q){r.error(Q.message)}};j.useEffect(()=>{if(h!=="preview"&&h!=="permissions")return;let I=!0;const Q=setTimeout(()=>{q.previewCustomAgent(t?null:e,{agent:u}).then(J=>I&&(m(J),g(null))).catch(J=>I&&g(J.message))},300);return()=>{I=!1,clearTimeout(Q)}},[h,u]);const D=!!l.data&&JSON.stringify(Wm(l.data))!==JSON.stringify(u),C=!w&&(t||!!l.data&&!l.error),L=u.claudeMdSections.filter(I=>a.data&&!a.data.includes(I));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:t?"New agent":u.name||"…"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:t?"New agent":u.name}),s.jsx("p",{className:"page-sub",children:"A custom LLM agent. It runs through Claude Code with the tools you allow below; .env reads, WebFetch and WebSearch are always blocked."})]}),s.jsxs("span",{className:"row",children:[s.jsx(ye,{to:"/agents",className:"btn ghost",children:"Back"}),s.jsxs("select",{className:"input",style:{width:"auto"},value:"",onChange:I=>I.target.value&&void k(I.target.value),"aria-label":"Load template",title:"Fill this agent from a built-in SDLC template",children:[s.jsx("option",{value:"",children:"Load template…"}),Qc.map(I=>s.jsx("option",{value:I.id,children:I.label},I.id))]}),!t&&s.jsxs("button",{className:"btn danger",onClick:()=>void T(),disabled:w,children:[s.jsx(Lr,{size:14})," Delete"]}),!t&&s.jsxs("button",{className:"btn ghost",onClick:()=>v(!0),disabled:D||!l.data,title:D?"Save your changes first":void 0,children:[s.jsx(ft,{size:14})," Run"]}),s.jsxs("button",{className:"btn",onClick:()=>void R(),disabled:!C,children:[t?s.jsx(Qt,{size:14}):s.jsx(us,{size:14})," ",t?"Create agent":"Save"]})]})]}),s.jsx(Pe,{error:l.error??p}),s.jsxs("div",{className:"card pl-meta four",children:[s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{className:"input",value:u.name,maxLength:80,onChange:I=>b("name",I.target.value),placeholder:"e.g. Accessibility reviewer"})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Description"}),s.jsx("input",{className:"input",value:u.description,maxLength:500,onChange:I=>b("description",I.target.value),placeholder:"Optional"})]}),s.jsxs("label",{className:"pl-field pl-from",children:[s.jsx("span",{children:"Model"}),s.jsx("select",{className:"input",value:u.model,onChange:I=>b("model",I.target.value),children:Eh.map(I=>s.jsx("option",{value:I.id,children:I.label},I.id))})]}),s.jsxs("div",{className:"pl-field",children:[s.jsx("span",{children:"Review"}),s.jsx("div",{className:"seg",role:"radiogroup","aria-label":"Review mode",children:["auto","human"].map(I=>s.jsx("button",{type:"button",role:"radio","aria-checked":u.review===I,className:`seg-btn ${u.review===I?"on":""}`,onClick:()=>b("review",I),children:I==="auto"?"Auto":"Human"},I))}),s.jsx("span",{className:"muted small",children:u.review==="human"?"The pipeline pauses after this agent until someone approves or rejects its output.":"The pipeline goes on as soon as this agent finishes."})]})]}),s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head row between",children:s.jsx(bn,{value:h,onChange:d,items:[{id:"instructions",label:"Instructions"},{id:"context",label:u.claudeMdSections.length?`CLAUDE.md (${u.claudeMdSections.length})`:"CLAUDE.md"},{id:"skills",label:u.skills.length?`Skills (${u.skills.length})`:"Skills"},{id:"preview",label:"Full prompt preview"},{id:"permissions",label:"Permissions"}]})}),h==="instructions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Placeholders: ",wb.map(I=>`{{${I}}}`).join(", "),". Agent Studio adds the fixed part (environment, tool rules, result file) after your instructions."]}),s.jsx("textarea",{className:"input prompt-editor",value:u.instructions,onChange:I=>b("instructions",I.target.value),spellCheck:!1,"aria-label":"Instructions"}),s.jsxs("span",{className:"muted small",children:[u.instructions.length.toLocaleString()," characters"]})]}),h==="context"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsx("p",{className:"muted small",style:{margin:0},children:"CLAUDE.md is always loaded. Pick the sections this agent must follow; the prompt names them explicitly."}),L.length>0&&s.jsx("div",{children:s.jsxs("span",{className:"chip warn",children:["Not in CLAUDE.md any more: ",L.join(", ")]})}),s.jsx(Pe,{error:a.error}),((A=a.data)==null?void 0:A.length)===0&&s.jsx("p",{className:"muted",children:"CLAUDE.md has no sections yet."}),s.jsx("div",{className:"skill-list",children:[...a.data??[],...L].map(I=>s.jsxs("label",{className:`skill-item ${u.claudeMdSections.includes(I)?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:u.claudeMdSections.includes(I),onChange:()=>b("claudeMdSections",Vm(u.claudeMdSections,I)),"aria-label":`Section ${I}`}),s.jsx("b",{children:I})]},I))})]}),h==="skills"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Claude Code skills from ",s.jsx("code",{children:".claude/skills/<name>/SKILL.md"}),". The agent loads the selected skills itself when it runs."]}),s.jsx(Pe,{error:o.error}),((z=o.data)==null?void 0:z.length)===0&&s.jsx("p",{className:"muted",children:"No skills found in .claude/skills."}),s.jsx("div",{className:"skill-list",children:(U=o.data)==null?void 0:U.map(I=>{const Q=u.skills.includes(I.name);return s.jsxs("label",{className:`skill-item ${Q?"on":""} ${I.error&&!Q?"invalid":""}`,title:I.error??I.dir,children:[s.jsx("input",{type:"checkbox",checked:Q,disabled:!!I.error&&!Q,onChange:()=>b("skills",Vm(u.skills,I.name)),"aria-label":`Attach skill ${I.name}`}),s.jsx("b",{children:I.name}),s.jsx("span",{className:"skill-desc muted small",children:I.error??I.description})]},I.name)})})]}),h==="permissions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Headless Claude Code with ",s.jsx("code",{children:"--permission-mode dontAsk"}),": anything outside the allow list is denied. The lists below follow your changes."]}),s.jsx("div",{className:"skill-list",children:iA.map(I=>s.jsxs("label",{className:`skill-item ${u.permissions.mode===I.id?"on":""}`,children:[s.jsx("input",{type:"radio",name:"permission-mode",checked:u.permissions.mode===I.id,onChange:()=>E(I.id)}),s.jsx("b",{children:I.label}),s.jsx("span",{className:"skill-desc muted small",children:I.hint})]},I.id))}),s.jsx("h4",{children:u.permissions.mode==="full"?"Options":"Allow"}),s.jsx("div",{className:"skill-list",children:sA.filter(I=>u.permissions.mode==="scoped"||I.key==="browser").map(I=>s.jsxs("label",{className:`skill-item ${u.permissions[I.key]?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:u.permissions[I.key],onChange:Q=>b("permissions",{...u.permissions,[I.key]:Q.target.checked})}),s.jsx("b",{children:I.label}),s.jsx("span",{className:"skill-desc muted small",children:I.hint})]},I.key))}),s.jsx("h4",{children:"Deny"}),u.permissions.mode==="full"&&s.jsx("p",{className:"muted small",style:{margin:0},children:"Command rules match the start of a command, so they are a guard rail, not a sandbox: an agent with full shell access can still reach a protected folder or .env another way. Use Full edit only for agents you trust."}),lA.map(I=>s.jsxs("label",{className:"pl-field",children:[s.jsxs("span",{children:[s.jsx("b",{children:I.label})," ",s.jsx("span",{className:"muted small",children:I.hint})]}),s.jsx("textarea",{className:"input",rows:4,spellCheck:!1,placeholder:I.placeholder,value:u.permissions[I.key].join(`
408
+ .git`}];function Qm(){var A,z,U;const{id:e}=li(),t=!e,n=ut(),r=Ir(),i=In(),l=_e(()=>e?q.customAgent(e):Promise.resolve(null),[e]),a=_e(()=>q.claudeMdSections()),o=_e(()=>q.skills()),[u,c]=j.useState(nA),[h,d]=j.useState("instructions"),[f,m]=j.useState(null),[p,g]=j.useState(null),[w,x]=j.useState(!1),[y,v]=j.useState(!1);j.useEffect(()=>{l.data&&c(Wm(l.data))},[l.data]);const b=(I,Q)=>c(J=>({...J,[I]:Q})),E=I=>c(Q=>{const J=Q.permissions,B=I==="full"&&!J.deniedCommands.length&&!J.protectedPaths.length;return{...Q,permissions:{...J,mode:I,...B?{deniedCommands:$y,protectedPaths:Oy}:{}}}}),k=async I=>{const Q=_b(I);u.instructions.trim()&&u.instructions!==Q.instructions&&!await i({title:`Load the ${Qc.find(B=>B.id===I).label} template?`,message:"It replaces the instructions, description, model, review mode and permissions of this draft. Nothing is saved until you click Save.",confirmLabel:"Load template"})||(c(J=>({...J,name:t||!J.name.trim()?Q.name:J.name,description:Q.description,instructions:Q.instructions,model:Q.model,review:Q.review,permissions:Q.permissions})),d("instructions"),r.success(`Template loaded${t?"":": click Save to keep it"}`))},R=async()=>{var I;x(!0),g(null);try{const Q=t?await q.createCustomAgent(u):await q.saveCustomAgent(e,u,(I=l.data)==null?void 0:I.updatedAt);r.success(t?`Agent "${Q.name}" created`:`Agent "${Q.name}" saved`),t?n(`/agents/custom/${Q.id}`,{replace:!0}):l.reload()}catch(Q){g(Q.message)}finally{x(!1)}},T=async()=>{if(await i({title:`Delete the agent "${u.name}"?`,message:"Past jobs keep their results. This cannot be undone.",confirmLabel:"Delete agent",danger:!0}))try{await q.deleteCustomAgent(e),r.success("Agent deleted"),n("/agents")}catch(Q){r.error(Q.message)}};j.useEffect(()=>{if(h!=="preview"&&h!=="permissions")return;let I=!0;const Q=setTimeout(()=>{q.previewCustomAgent(t?null:e,{agent:u}).then(J=>I&&(m(J),g(null))).catch(J=>I&&g(J.message))},300);return()=>{I=!1,clearTimeout(Q)}},[h,u]);const D=!!l.data&&JSON.stringify(Wm(l.data))!==JSON.stringify(u),C=!w&&(t||!!l.data&&!l.error),L=u.claudeMdSections.filter(I=>a.data&&!a.data.includes(I));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:t?"New agent":u.name||"…"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:t?"New agent":u.name}),s.jsx("p",{className:"page-sub",children:"A custom LLM agent. It runs through Claude Code with the tools you allow below; .env reads, WebFetch and WebSearch are always blocked."})]}),s.jsxs("span",{className:"row",children:[s.jsx(ye,{to:"/agents",className:"btn ghost",children:"Back"}),s.jsxs("select",{className:"input",style:{width:"auto"},value:"",onChange:I=>I.target.value&&void k(I.target.value),"aria-label":"Load template",title:"Fill this agent from a built-in SDLC template",children:[s.jsx("option",{value:"",children:"Load template…"}),Qc.map(I=>s.jsx("option",{value:I.id,children:I.label},I.id))]}),!t&&s.jsxs("button",{className:"btn danger",onClick:()=>void T(),disabled:w,children:[s.jsx(Ar,{size:14})," Delete"]}),!t&&s.jsxs("button",{className:"btn ghost",onClick:()=>v(!0),disabled:D||!l.data,title:D?"Save your changes first":void 0,children:[s.jsx(ft,{size:14})," Run"]}),s.jsxs("button",{className:"btn",onClick:()=>void R(),disabled:!C,children:[t?s.jsx(qt,{size:14}):s.jsx(cs,{size:14})," ",t?"Create agent":"Save"]})]})]}),s.jsx(Le,{error:l.error??p}),s.jsxs("div",{className:"card pl-meta four",children:[s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{className:"input",value:u.name,maxLength:80,onChange:I=>b("name",I.target.value),placeholder:"e.g. Accessibility reviewer"})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Description"}),s.jsx("input",{className:"input",value:u.description,maxLength:500,onChange:I=>b("description",I.target.value),placeholder:"Optional"})]}),s.jsxs("label",{className:"pl-field pl-from",children:[s.jsx("span",{children:"Model"}),s.jsx("select",{className:"input",value:u.model,onChange:I=>b("model",I.target.value),children:Eh.map(I=>s.jsx("option",{value:I.id,children:I.label},I.id))})]}),s.jsxs("div",{className:"pl-field",children:[s.jsx("span",{children:"Review"}),s.jsx("div",{className:"seg",role:"radiogroup","aria-label":"Review mode",children:["auto","human"].map(I=>s.jsx("button",{type:"button",role:"radio","aria-checked":u.review===I,className:`seg-btn ${u.review===I?"on":""}`,onClick:()=>b("review",I),children:I==="auto"?"Auto":"Human"},I))}),s.jsx("span",{className:"muted small",children:u.review==="human"?"The pipeline pauses after this agent until someone approves or rejects its output.":"The pipeline goes on as soon as this agent finishes."})]})]}),s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head row between",children:s.jsx(kn,{value:h,onChange:d,items:[{id:"instructions",label:"Instructions"},{id:"context",label:u.claudeMdSections.length?`CLAUDE.md (${u.claudeMdSections.length})`:"CLAUDE.md"},{id:"skills",label:u.skills.length?`Skills (${u.skills.length})`:"Skills"},{id:"preview",label:"Full prompt preview"},{id:"permissions",label:"Permissions"}]})}),h==="instructions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Placeholders: ",bb.map(I=>`{{${I}}}`).join(", "),". Agent Studio adds the fixed part (environment, tool rules, result file) after your instructions."]}),s.jsx("textarea",{className:"input prompt-editor",value:u.instructions,onChange:I=>b("instructions",I.target.value),spellCheck:!1,"aria-label":"Instructions"}),s.jsxs("span",{className:"muted small",children:[u.instructions.length.toLocaleString()," characters"]})]}),h==="context"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsx("p",{className:"muted small",style:{margin:0},children:"CLAUDE.md is always loaded. Pick the sections this agent must follow; the prompt names them explicitly."}),L.length>0&&s.jsx("div",{children:s.jsxs("span",{className:"chip warn",children:["Not in CLAUDE.md any more: ",L.join(", ")]})}),s.jsx(Le,{error:a.error}),((A=a.data)==null?void 0:A.length)===0&&s.jsx("p",{className:"muted",children:"CLAUDE.md has no sections yet."}),s.jsx("div",{className:"skill-list",children:[...a.data??[],...L].map(I=>s.jsxs("label",{className:`skill-item ${u.claudeMdSections.includes(I)?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:u.claudeMdSections.includes(I),onChange:()=>b("claudeMdSections",Vm(u.claudeMdSections,I)),"aria-label":`Section ${I}`}),s.jsx("b",{children:I})]},I))})]}),h==="skills"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Claude Code skills from ",s.jsx("code",{children:".claude/skills/<name>/SKILL.md"}),". The agent loads the selected skills itself when it runs."]}),s.jsx(Le,{error:o.error}),((z=o.data)==null?void 0:z.length)===0&&s.jsx("p",{className:"muted",children:"No skills found in .claude/skills."}),s.jsx("div",{className:"skill-list",children:(U=o.data)==null?void 0:U.map(I=>{const Q=u.skills.includes(I.name);return s.jsxs("label",{className:`skill-item ${Q?"on":""} ${I.error&&!Q?"invalid":""}`,title:I.error??I.dir,children:[s.jsx("input",{type:"checkbox",checked:Q,disabled:!!I.error&&!Q,onChange:()=>b("skills",Vm(u.skills,I.name)),"aria-label":`Attach skill ${I.name}`}),s.jsx("b",{children:I.name}),s.jsx("span",{className:"skill-desc muted small",children:I.error??I.description})]},I.name)})})]}),h==="permissions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Headless Claude Code with ",s.jsx("code",{children:"--permission-mode dontAsk"}),": anything outside the allow list is denied. The lists below follow your changes."]}),s.jsx("div",{className:"skill-list",children:sA.map(I=>s.jsxs("label",{className:`skill-item ${u.permissions.mode===I.id?"on":""}`,children:[s.jsx("input",{type:"radio",name:"permission-mode",checked:u.permissions.mode===I.id,onChange:()=>E(I.id)}),s.jsx("b",{children:I.label}),s.jsx("span",{className:"skill-desc muted small",children:I.hint})]},I.id))}),s.jsx("h4",{children:u.permissions.mode==="full"?"Options":"Allow"}),s.jsx("div",{className:"skill-list",children:rA.filter(I=>u.permissions.mode==="scoped"||I.key==="browser").map(I=>s.jsxs("label",{className:`skill-item ${u.permissions[I.key]?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:u.permissions[I.key],onChange:Q=>b("permissions",{...u.permissions,[I.key]:Q.target.checked})}),s.jsx("b",{children:I.label}),s.jsx("span",{className:"skill-desc muted small",children:I.hint})]},I.key))}),s.jsx("h4",{children:"Deny"}),u.permissions.mode==="full"&&s.jsx("p",{className:"muted small",style:{margin:0},children:"Command rules match the start of a command, so they are a guard rail, not a sandbox: an agent with full shell access can still reach a protected folder or .env another way. Use Full edit only for agents you trust."}),iA.map(I=>s.jsxs("label",{className:"pl-field",children:[s.jsxs("span",{children:[s.jsx("b",{children:I.label})," ",s.jsx("span",{className:"muted small",children:I.hint})]}),s.jsx("textarea",{className:"input",rows:4,spellCheck:!1,placeholder:I.placeholder,value:u.permissions[I.key].join(`
409
409
  `),onChange:Q=>b("permissions",{...u.permissions,[I.key]:Q.target.value.split(`
410
410
  `)}),"aria-label":I.label})]},I.key)),f&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Allowed"}),s.jsx("div",{className:"perm",children:f.allowedTools.map(I=>s.jsx("code",{children:I},I))}),s.jsx("h4",{children:"Denied"}),s.jsx("div",{className:"perm",children:f.disallowedTools.map(I=>s.jsx("code",{className:"deny",children:I},I))})]})]}),h==="preview"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsx("span",{className:"muted small",children:"What Claude Code receives, with your unsaved edits (updates as you type). Placeholders stay generic; secret values are never shown."}),f?s.jsxs("pre",{className:"prompt-preview",children:[f.instructionsPart,`
411
411
 
412
412
  `,f.fixedPart.split(`
413
413
  `).map((I,Q)=>s.jsxs("span",{className:Q===0?"fixed-head":"fixed",children:[I,`
414
- `]},Q))]}):!p&&s.jsx("p",{className:"muted",children:"Building preview…"})]})]}),y&&e&&s.jsx(_v,{title:"Run agent",onClose:()=>v(!1),onStart:(I,Q)=>q.createJob({type:"custom",agentId:e,...I?{spec:I}:{},...Q.trim()?{input:Q}:{}})})]})}const aA=["Read(.env)","Read(**/.env)","Read(.env.local)","Read(**/.env.local)","WebFetch","WebSearch"],oA={validator:{command:"playwright test tests/e2e/<spec>.spec.ts --project=chrome --repeat-each=3 --retries=0 --reporter=line,json",notes:["Runs after the QA Script Generator and after each QA Script Healer round (QA Validator ⇄ QA Script Healer loop, max rounds in Settings).","Passes only when every repetition passes: catches flaky scripts before they are accepted."]},runner:{command:"playwright test [files] [--grep <TC-IDs>] --project=chrome --repeat-each=<n> --reporter=line,json[,html]",notes:["Used by Run tests and Test runs.",'The HTML reporter is added when the run has "HTML report" on (default in Settings).']}};function uA(){const e=li().agent,t=Se[e];return t?t.llm?s.jsx(hA,{agent:e}):s.jsx(cA,{agent:e}):s.jsx(Pe,{error:`Unknown agent: ${e}`})}function mj({agent:e,extra:t}){const n=Se[e];return s.jsxs(s.Fragment,{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:n.label}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{className:"row",style:{alignItems:"flex-start"},children:[s.jsx(Ot,{agent:e,size:44}),s.jsxs("div",{children:[s.jsxs("h1",{className:"page-title",children:[n.label," ",t]}),s.jsxs("p",{className:"page-sub",children:[n.description," · ",n.llm?"LLM agent (Claude Code)":"Deterministic step"]})]})]})})]})}function cA({agent:e}){const t=oA[e];return s.jsxs("section",{children:[s.jsx(mj,{agent:e}),s.jsxs("div",{className:"card pad",children:[s.jsx("p",{className:"muted",children:"This step has no prompt: it runs Playwright Test directly (no shell, no LLM). It cannot write any file other than its report."}),t&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Command"}),s.jsx("pre",{className:"prompt-preview",children:t.command}),s.jsx("ul",{children:t.notes.map(n=>s.jsx("li",{children:n},n))})]})]})]})}function dA({info:e,onSaved:t}){const[n,r]=j.useState(!1),[i,l]=j.useState(null),a=async u=>{if(u!==e.model){r(!0);try{await q.saveAgentModel(e.agent,u),l(null),t()}catch(c){l(c.message)}finally{r(!1)}}},o=async()=>{r(!0);try{await q.resetAgentModel(e.agent),l(null),t()}catch(u){l(u.message)}finally{r(!1)}};return s.jsxs("div",{className:"row",style:{gap:10,margin:"4px 0 14px"},children:[s.jsx("span",{className:"muted small",children:"Model:"}),s.jsx("select",{className:"select",value:e.model,disabled:n,onChange:u=>void a(u.target.value),"aria-label":`${Se[e.agent].label} model`,children:Eh.map(u=>s.jsx("option",{value:u.id,title:u.label,children:u.label},u.id))}),s.jsx(dt,{status:e.modelCustomized?"stale":"neutral",children:e.modelCustomized?"custom model":"default model"}),e.modelCustomized&&s.jsxs("button",{type:"button",className:"btn ghost sm",disabled:n,onClick:()=>void o(),title:"Use the default model",children:[s.jsx(Rr,{size:12})," Reset"]}),s.jsx(Pe,{error:i})]})}function hA({agent:e}){var A;const{specs:t}=Xt(),n=In(),r=Me(()=>q.agentPrompts(),[e]),i=(A=r.data)==null?void 0:A.find(z=>z.agent===e),[l,a]=j.useState(null),[o,u]=j.useState("instructions"),[c,h]=j.useState(""),[d,f]=j.useState(null),[m,p]=j.useState(null),[g,w]=j.useState(null),[x,y]=j.useState(null),[v,b]=j.useState(!1),E=j.useRef(null);j.useEffect(()=>{i&&l===null&&a(i.instructions)},[i,l]),j.useEffect(()=>a(null),[e]);const k=i!==void 0&&l!==null&&l!==i.instructions,R=i!==void 0&&l!==null&&l.trim()!==i.defaultInstructions.trim(),T=gh(({currentLocation:z,nextLocation:U})=>k&&z.pathname!==U.pathname);Ph(T,{title:"Discard the unsaved instructions?",message:"Your edits to this prompt will be lost.",confirmLabel:"Discard",danger:!0}),j.useEffect(()=>{if(o!=="preview"||l===null)return;const z=setTimeout(()=>{q.previewAgentPrompt(e,{instructions:l,...c?{spec:c}:{}}).then(U=>(f(U),p(null))).catch(U=>p(U.message))},300);return()=>clearTimeout(z)},[o,l,c,e]);const D=async()=>{if(l!==null){b(!0);try{const z=await q.saveAgentPrompt(e,l);a(z.instructions),r.reload(),w(null),y(z.customized?"Saved. New jobs use these instructions.":"Saved: same as the default, so the default is used.")}catch(z){w(z.message)}finally{b(!1)}}},C=async()=>{if(await n({title:`Reset the ${Se[e].label} instructions?`,message:"Your custom instructions are replaced with the built-in default. New jobs use the default.",confirmLabel:"Reset to default",danger:!0})){b(!0);try{const U=await q.resetAgentPrompt(e);a(U.instructions),r.reload(),w(null),y("Reset to the default instructions.")}catch(U){w(U.message)}finally{b(!1)}}},L=z=>{const U=E.current;if(!U||l===null)return;const I=`{{${z}}}`,Q=l.slice(0,U.selectionStart)+I+l.slice(U.selectionEnd),J=U.selectionStart+I.length;a(Q),requestAnimationFrame(()=>(U.focus(),U.setSelectionRange(J,J)))};return s.jsxs("section",{children:[s.jsx(mj,{agent:e,extra:i&&(i.customized?s.jsx(dt,{status:"stale",children:"custom instructions"}):s.jsx(dt,{status:"neutral",children:"default instructions"}))}),i&&s.jsx(dA,{info:i,onSaved:r.reload}),s.jsx(Pe,{error:r.error??g}),x&&!k&&s.jsx("div",{className:"ok-box",children:x}),s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsx(bn,{value:o,onChange:u,items:[{id:"instructions",label:k?"Instructions •":"Instructions"},{id:"skills",label:i!=null&&i.skills.length?`Skills (${i.skills.length})`:"Skills"},{id:"preview",label:"Full prompt preview"},{id:"permissions",label:"Permissions"}]}),s.jsxs("span",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>void C(),disabled:v||!(i!=null&&i.customized),title:"Use the built-in instructions",children:[s.jsx(Rr,{size:14})," Reset to default"]}),s.jsxs("button",{className:"btn",onClick:()=>void D(),disabled:v||!k,children:[s.jsx(us,{size:14})," Save"]})]})]}),o==="instructions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["The agent's role and working rules. Agent Studio appends a fixed part to every prompt: input files, the ",s.jsx("code",{children:".env"})," environment, tool rules and the output JSON the pipeline reads. That part cannot be edited here; see ",s.jsx("b",{children:"Full prompt preview"}),". Project rules shared by all agents live in"," ",s.jsx(ye,{to:"/project",children:"CLAUDE.md"}),". Changes apply to jobs that start after saving."]}),i&&s.jsxs("div",{className:"ph-list","aria-label":"Insert placeholder",children:[s.jsx("span",{className:"muted small",children:"Insert:"}),Object.entries(i.placeholders).map(([z,U])=>s.jsx("button",{type:"button",className:"chip",title:U,onClick:()=>L(z),children:`{{${z}}}`},z))]}),s.jsx("textarea",{ref:E,className:"input prompt-editor",value:l??"",onChange:z=>(a(z.target.value),y(null)),spellCheck:!1,"aria-label":`${Se[e].label} instructions`,disabled:l===null}),s.jsxs("div",{className:"row between muted small",children:[s.jsxs("span",{children:[(l==null?void 0:l.length.toLocaleString())??0," characters",R?" · differs from the default":" · same as the default"]}),k&&s.jsx("button",{type:"button",className:"link-btn",onClick:()=>a(i.instructions),children:"Discard changes"})]})]}),o==="skills"&&i&&s.jsx(fA,{info:i,onSaved:()=>(r.reload(),f(null))}),o==="preview"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("div",{className:"row between",children:[s.jsxs("span",{className:"muted small",children:["What Claude Code receives",k?" (with your unsaved edits)":"",". Generic shows placeholders; pick a spec to see a real job with .env values (passwords and accounts masked)."]}),s.jsxs("select",{className:"select",value:c,onChange:z=>h(z.target.value),"aria-label":"Sample spec",children:[s.jsx("option",{value:"",children:"Generic (placeholders, no project data)"}),t.map(z=>s.jsx("option",{value:z.file,children:z.file},z.file))]})]}),s.jsx(Pe,{error:m}),d?s.jsxs("pre",{className:"prompt-preview",children:[d.instructionsPart,`
414
+ `]},Q))]}):!p&&s.jsx("p",{className:"muted",children:"Building preview…"})]})]}),y&&e&&s.jsx(Ov,{title:"Run agent",onClose:()=>v(!1),onStart:(I,Q)=>q.createJob({type:"custom",agentId:e,...I?{spec:I}:{},...Q.trim()?{input:Q}:{}})})]})}const lA=["Read(.env)","Read(**/.env)","Read(.env.local)","Read(**/.env.local)","WebFetch","WebSearch"],aA={validator:{command:"playwright test tests/e2e/<spec>.spec.ts --project=chrome --repeat-each=3 --retries=0 --reporter=line,json",notes:["Runs after the QA Script Generator and after each QA Script Healer round (QA Validator ⇄ QA Script Healer loop, max rounds in Settings).","Passes only when every repetition passes: catches flaky scripts before they are accepted."]},runner:{command:"playwright test [files] [--grep <TC-IDs>] --project=chrome --repeat-each=<n> --reporter=line,json[,html]",notes:["Used by Run tests and Test runs.",'The HTML reporter is added when the run has "HTML report" on (default in Settings).']}};function oA(){const e=li().agent,t=Ne[e];return t?t.llm?s.jsx(dA,{agent:e}):s.jsx(uA,{agent:e}):s.jsx(Le,{error:`Unknown agent: ${e}`})}function xj({agent:e,extra:t}){const n=Ne[e];return s.jsxs(s.Fragment,{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:n.label}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{className:"row",style:{alignItems:"flex-start"},children:[s.jsx(Ft,{agent:e,size:44}),s.jsxs("div",{children:[s.jsxs("h1",{className:"page-title",children:[n.label," ",t]}),s.jsxs("p",{className:"page-sub",children:[n.description," · ",n.llm?"LLM agent (Claude Code)":"Deterministic step"]})]})]})})]})}function uA({agent:e}){const t=aA[e];return s.jsxs("section",{children:[s.jsx(xj,{agent:e}),s.jsxs("div",{className:"card pad",children:[s.jsx("p",{className:"muted",children:"This step has no prompt: it runs Playwright Test directly (no shell, no LLM). It cannot write any file other than its report."}),t&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Command"}),s.jsx("pre",{className:"prompt-preview",children:t.command}),s.jsx("ul",{children:t.notes.map(n=>s.jsx("li",{children:n},n))})]})]})]})}function cA({info:e,onSaved:t}){const[n,r]=j.useState(!1),[i,l]=j.useState(null),a=async u=>{if(u!==e.model){r(!0);try{await q.saveAgentModel(e.agent,u),l(null),t()}catch(c){l(c.message)}finally{r(!1)}}},o=async()=>{r(!0);try{await q.resetAgentModel(e.agent),l(null),t()}catch(u){l(u.message)}finally{r(!1)}};return s.jsxs("div",{className:"row",style:{gap:10,margin:"4px 0 14px"},children:[s.jsx("span",{className:"muted small",children:"Model:"}),s.jsx("select",{className:"select",value:e.model,disabled:n,onChange:u=>void a(u.target.value),"aria-label":`${Ne[e.agent].label} model`,children:Eh.map(u=>s.jsx("option",{value:u.id,title:u.label,children:u.label},u.id))}),s.jsx(yt,{status:e.modelCustomized?"stale":"neutral",children:e.modelCustomized?"custom model":"default model"}),e.modelCustomized&&s.jsxs("button",{type:"button",className:"btn ghost sm",disabled:n,onClick:()=>void o(),title:"Use the default model",children:[s.jsx(Lr,{size:12})," Reset"]}),s.jsx(Le,{error:i})]})}function dA({agent:e}){var A;const{specs:t}=Zt(),n=In(),r=_e(()=>q.agentPrompts(),[e]),i=(A=r.data)==null?void 0:A.find(z=>z.agent===e),[l,a]=j.useState(null),[o,u]=j.useState("instructions"),[c,h]=j.useState(""),[d,f]=j.useState(null),[m,p]=j.useState(null),[g,w]=j.useState(null),[x,y]=j.useState(null),[v,b]=j.useState(!1),E=j.useRef(null);j.useEffect(()=>{i&&l===null&&a(i.instructions)},[i,l]),j.useEffect(()=>a(null),[e]);const k=i!==void 0&&l!==null&&l!==i.instructions,R=i!==void 0&&l!==null&&l.trim()!==i.defaultInstructions.trim(),T=gh(({currentLocation:z,nextLocation:U})=>k&&z.pathname!==U.pathname);Ph(T,{title:"Discard the unsaved instructions?",message:"Your edits to this prompt will be lost.",confirmLabel:"Discard",danger:!0}),j.useEffect(()=>{if(o!=="preview"||l===null)return;const z=setTimeout(()=>{q.previewAgentPrompt(e,{instructions:l,...c?{spec:c}:{}}).then(U=>(f(U),p(null))).catch(U=>p(U.message))},300);return()=>clearTimeout(z)},[o,l,c,e]);const D=async()=>{if(l!==null){b(!0);try{const z=await q.saveAgentPrompt(e,l);a(z.instructions),r.reload(),w(null),y(z.customized?"Saved. New jobs use these instructions.":"Saved: same as the default, so the default is used.")}catch(z){w(z.message)}finally{b(!1)}}},C=async()=>{if(await n({title:`Reset the ${Ne[e].label} instructions?`,message:"Your custom instructions are replaced with the built-in default. New jobs use the default.",confirmLabel:"Reset to default",danger:!0})){b(!0);try{const U=await q.resetAgentPrompt(e);a(U.instructions),r.reload(),w(null),y("Reset to the default instructions.")}catch(U){w(U.message)}finally{b(!1)}}},L=z=>{const U=E.current;if(!U||l===null)return;const I=`{{${z}}}`,Q=l.slice(0,U.selectionStart)+I+l.slice(U.selectionEnd),J=U.selectionStart+I.length;a(Q),requestAnimationFrame(()=>(U.focus(),U.setSelectionRange(J,J)))};return s.jsxs("section",{children:[s.jsx(xj,{agent:e,extra:i&&(i.customized?s.jsx(yt,{status:"stale",children:"custom instructions"}):s.jsx(yt,{status:"neutral",children:"default instructions"}))}),i&&s.jsx(cA,{info:i,onSaved:r.reload}),s.jsx(Le,{error:r.error??g}),x&&!k&&s.jsx("div",{className:"ok-box",children:x}),s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsx(kn,{value:o,onChange:u,items:[{id:"instructions",label:k?"Instructions •":"Instructions"},{id:"skills",label:i!=null&&i.skills.length?`Skills (${i.skills.length})`:"Skills"},{id:"preview",label:"Full prompt preview"},{id:"permissions",label:"Permissions"}]}),s.jsxs("span",{className:"row",children:[s.jsxs("button",{className:"btn ghost",onClick:()=>void C(),disabled:v||!(i!=null&&i.customized),title:"Use the built-in instructions",children:[s.jsx(Lr,{size:14})," Reset to default"]}),s.jsxs("button",{className:"btn",onClick:()=>void D(),disabled:v||!k,children:[s.jsx(cs,{size:14})," Save"]})]})]}),o==="instructions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["The agent's role and working rules. Agent Studio appends a fixed part to every prompt: input files, the ",s.jsx("code",{children:".env"})," environment, tool rules and the output JSON the pipeline reads. That part cannot be edited here; see ",s.jsx("b",{children:"Full prompt preview"}),". Project rules shared by all agents live in"," ",s.jsx(ye,{to:"/project",children:"CLAUDE.md"}),". Changes apply to jobs that start after saving."]}),i&&s.jsxs("div",{className:"ph-list","aria-label":"Insert placeholder",children:[s.jsx("span",{className:"muted small",children:"Insert:"}),Object.entries(i.placeholders).map(([z,U])=>s.jsx("button",{type:"button",className:"chip",title:U,onClick:()=>L(z),children:`{{${z}}}`},z))]}),s.jsx("textarea",{ref:E,className:"input prompt-editor",value:l??"",onChange:z=>(a(z.target.value),y(null)),spellCheck:!1,"aria-label":`${Ne[e].label} instructions`,disabled:l===null}),s.jsxs("div",{className:"row between muted small",children:[s.jsxs("span",{children:[(l==null?void 0:l.length.toLocaleString())??0," characters",R?" · differs from the default":" · same as the default"]}),k&&s.jsx("button",{type:"button",className:"link-btn",onClick:()=>a(i.instructions),children:"Discard changes"})]})]}),o==="skills"&&i&&s.jsx(hA,{info:i,onSaved:()=>(r.reload(),f(null))}),o==="preview"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("div",{className:"row between",children:[s.jsxs("span",{className:"muted small",children:["What Claude Code receives",k?" (with your unsaved edits)":"",". Generic shows placeholders; pick a spec to see a real job with .env values (passwords and accounts masked)."]}),s.jsxs("select",{className:"select",value:c,onChange:z=>h(z.target.value),"aria-label":"Sample spec",children:[s.jsx("option",{value:"",children:"Generic (placeholders, no project data)"}),t.map(z=>s.jsx("option",{value:z.file,children:z.file},z.file))]})]}),s.jsx(Le,{error:m}),d?s.jsxs("pre",{className:"prompt-preview",children:[d.instructionsPart,`
415
415
 
416
416
  `,d.fixedPart.split(`
417
417
  `).map((z,U)=>s.jsxs("span",{className:U===0?"fixed-head":"fixed",children:[z,`
418
- `]},U))]}):!m&&s.jsx("p",{className:"muted",children:"Building preview…"})]}),o==="permissions"&&s.jsxs("div",{className:"pad",children:[s.jsxs("p",{className:"muted small",children:["Headless Claude Code with ",s.jsx("code",{children:"--permission-mode dontAsk"}),": anything outside the allow list is denied. Permissions are fixed by Agent Studio."]}),s.jsx("h4",{children:"Allowed"}),s.jsx("div",{className:"perm",children:d?d.allowedTools.map(z=>s.jsx("code",{children:z},z)):s.jsx(pA,{agent:e,onLoad:f})}),s.jsx("h4",{children:"Explicitly denied"}),s.jsx("div",{className:"perm",children:((d==null?void 0:d.disallowedTools)??aA).map(z=>s.jsx("code",{className:"deny",children:z},z))})]})]})]})}function fA({info:e,onSaved:t}){var d,f,m;const n=Me(()=>q.skills(),[e.agent]),[r,i]=j.useState(!1),[l,a]=j.useState(null),o=e.skills,u=new Set((d=n.data)==null?void 0:d.map(p=>p.name)),c=async p=>{i(!0);try{await q.saveAgentSkills(e.agent,p),a(null),t()}catch(g){a(g.message)}finally{i(!1)}},h=p=>{const g=o.includes(p.name);p.error&&!g||c(g?o.filter(w=>w!==p.name):[...o,p.name])};return s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Select Claude Code skills from ",s.jsx("code",{children:".claude/skills/<name>/SKILL.md"})," (frontmatter ",s.jsx("code",{children:"name"})," + ",s.jsx("code",{children:"description"}),", then the skill's instructions). The skill content is not copied into the instructions: when the agent runs, Claude Code loads the selected skills itself with its Skill tool and applies them on top of the agent's role and persona. Claude Code's own skills (built-in, plugins such as superpowers) stay available too; nothing is blocked. The agent log shows every skill used (",s.jsx("code",{children:"[skill]"})," lines). Changes apply to jobs that start after saving."]}),s.jsx(Pe,{error:n.error??l}),e.skillsUnavailable.length>0&&s.jsxs("div",{className:"row",style:{gap:8},children:[s.jsxs("span",{className:"chip warn",children:["Skipped when jobs run: ",e.skillsUnavailable.join(", ")]}),s.jsx("span",{className:"muted small",children:"missing or invalid on disk"}),n.data&&e.skillsUnavailable.some(p=>!u.has(p))&&s.jsx("button",{type:"button",className:"link-btn",disabled:r,onClick:()=>void c(o.filter(p=>u.has(p))),children:"Remove missing"})]}),((f=n.data)==null?void 0:f.length)===0&&s.jsxs("p",{className:"muted",children:["No skills found. Create ",s.jsx("code",{children:".claude/skills/<name>/SKILL.md"})," in the project, then click ",s.jsx("b",{children:"Rescan folder"}),"."]}),s.jsx("div",{className:"skill-list",children:(m=n.data)==null?void 0:m.map(p=>{const g=o.includes(p.name);return s.jsxs("label",{className:`skill-item ${g?"on":""} ${p.error&&!g?"invalid":""}`,title:p.error??p.dir,children:[s.jsx("input",{type:"checkbox",checked:g,disabled:r||!!p.error&&!g,onChange:()=>h(p),"aria-label":`Attach skill ${p.name}`}),s.jsxs("span",{className:"row",style:{gap:8},children:[s.jsx("b",{children:p.name}),g&&s.jsx(dt,{status:"stale",children:o.length>1?`attached #${o.indexOf(p.name)+1}`:"attached"}),p.error&&s.jsx("span",{className:"chip fail",children:"invalid"})]}),s.jsx("span",{className:"skill-desc muted small",children:p.error??p.description}),s.jsxs("span",{className:"skill-meta muted small",children:[s.jsxs("code",{children:[p.dir,"/SKILL.md"]}),s.jsxs("span",{children:[p.chars.toLocaleString()," characters"]}),p.files.length>0&&s.jsxs("span",{title:p.files.join(", "),children:["+",p.files.length," file",p.files.length===1?"":"s"]}),p.allowedTools.length>0&&s.jsxs("span",{className:"chip warn",title:"From the skill's frontmatter: Claude Code allows these tools while the skill is active, on top of the agent's permissions",children:["allowed-tools: ",p.allowedTools.join(" ")]})]})]},p.name)})}),s.jsxs("div",{className:"row between muted small",children:[s.jsxs("span",{children:[o.length," attached · see Full prompt preview for the result"]}),s.jsxs("button",{type:"button",className:"btn ghost sm",onClick:n.reload,disabled:r,children:[s.jsx(Rr,{size:12})," Rescan folder"]})]})]})}function pA({agent:e,onLoad:t}){return j.useEffect(()=>{q.previewAgentPrompt(e,{}).then(t).catch(()=>{})},[e,t]),s.jsx("span",{className:"muted small",children:"Loading…"})}let mA=0;const gj=()=>`b${Date.now().toString(36)}${(mA++).toString(36)}`;function xj(e,t=gj){return e.map(n=>n.kind==="agent"?{uid:t(),kind:"agent",agent:n.agent}:{uid:t(),kind:"loop",maxIterations:n.maxIterations,endsWhen:n.endsWhen??"first",steps:xj(n.steps.map(cs),t)})}const yj=e=>({kind:"loop",steps:e.steps.map(t=>t.kind==="agent"?t.agent:yj(t)),maxIterations:e.maxIterations,...e.endsWhen==="last"?{endsWhen:"last"}:{}});function vj(e){return e.map(t=>t.kind==="agent"?{kind:"agent",agent:t.agent}:yj(t))}const hd=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),jj=(e,t)=>e.length<=t.length&&e.every((n,r)=>n===t[r]);function Zh(e,t){let n=e,r;for(const i of t){if(r=n[i],!r)return;n=r.kind==="loop"?r.steps:[]}return r}function wj(e,t){if(t.length===0)return e;const n=Zh(e,t);return(n==null?void 0:n.kind)==="loop"?n.steps:null}const kj=e=>e.kind==="agent"?0:1+Math.max(0,...e.steps.map(kj));function gl(e,t,n){if(t.length===0)return n(e);const[r,...i]=t;return e.map((l,a)=>a===r&&l.kind==="loop"?{...l,steps:gl(l.steps,i,n)}:l)}const gA=(e,t)=>t.from==="block"?Zh(e,t.path)??null:null;function bj(e,t,n){const r=wj(e,n.parent);if(!r||n.index<0||n.index>r.length)return!1;let i;if(t.from==="palette")i=0;else if(t.from==="palette-loop")i=1;else{const a=gA(e,t);if(!a||jj(t.path,n.parent))return!1;i=kj(a)}return n.parent.length+i>no?!1:t.from==="block"&&hd(t.path.slice(0,-1),n.parent)||r.length<(n.parent.length===0?Sa:Na)}function fd(e,t,n,r=gj){if(!bj(e,t,n))return e;let i,l=e,a=n;if(t.from==="palette")i={uid:r(),kind:"agent",agent:t.agent};else if(t.from==="palette-loop")i={uid:r(),kind:"loop",steps:[],maxIterations:Nb,endsWhen:"first"};else{const o=t.path.slice(0,-1),u=t.path[t.path.length-1];if(hd(o,n.parent)&&(n.index===u||n.index===u+1))return e;if(i=Zh(e,t.path),l=gl(e,o,c=>c.filter((h,d)=>d!==u)),hd(o,n.parent))n.index>u&&(a={...n,index:n.index-1});else if(jj(o,n.parent)&&n.parent[o.length]>u){const c=[...n.parent];c[o.length]-=1,a={...n,parent:c}}}return gl(l,a.parent,o=>[...o.slice(0,a.index),i,...o.slice(a.index)])}function qm(e,t,n){const r=t.slice(0,-1),i=t[t.length-1],l=wj(e,r),a=i+n;return!l||a<0||a>=l.length?e:fd(e,{from:"block",path:t},{parent:r,index:n<0?a:a+1})}function xA(e,t){const n=t[t.length-1];return gl(e,t.slice(0,-1),r=>r.filter((i,l)=>l!==n))}function Gm(e,t,n){const r=t[t.length-1];return gl(e,t.slice(0,-1),i=>i.map((l,a)=>a===r&&l.kind==="loop"?{...l,...n}:l))}const yA=Object.keys(Se).filter(e=>e!=="custom"),Hu=(e,t,n,r="")=>JSON.stringify({name:e.trim(),description:t.trim(),workDir:r.trim(),steps:vj(n)});function Km(){const{id:e}=li(),t=!e||e==="new",[n]=xh(),r=ut(),i=In(),l=Ar(),a=Me(()=>q.settings()),o=Me(()=>q.customAgents()).data??[],u=Me(()=>t?Promise.resolve(null):q.pipeline(e),[e]),[c,h]=j.useState(""),[d,f]=j.useState(""),[m,p]=j.useState(""),[g,w]=j.useState([]),[x,y]=j.useState(),[v,b]=j.useState(null),[E,k]=j.useState(!1),[R,T]=j.useState(null),[D,C]=j.useState(null),[L,A]=j.useState(!1),[z,U]=j.useState(!1),I=j.useRef(!1),Q=j.useMemo(()=>{var W;return Rb(((W=a.data)==null?void 0:W.settings.maxHealRounds)??2)},[a.data]),J=(W,fe,Ze=!0)=>{const Zt=xj(W.steps);h(W.name),f(W.description),p(W.workDir??""),w(Zt),y(fe),b(Ze?Hu(W.name,W.description,Zt,W.workDir??""):Hu("","",[],"")),k(!0)};j.useEffect(()=>{if(!t){u.data&&J(u.data,u.data.updatedAt);return}const W=n.get("from");if(W&&!a.data)return;const fe=Q.find(Ze=>Ze.id===W);fe?J({...fe,name:`${fe.name} (custom)`},void 0,!1):J({name:"",description:"",steps:[]},void 0)},[t,u.data,a.data]);const H=Hu(c,d,g,m),X=E&&v!==null&&H!==v,S=Pb({name:c,description:d,workDir:m,steps:vj(g)}),ae=S.ok?[]:S.errors,O=gh(({currentLocation:W,nextLocation:fe})=>X&&!I.current&&W.pathname!==fe.pathname);Ph(O,{title:"Discard the unsaved pipeline changes?",message:"Your changes to this pipeline will be lost.",confirmLabel:"Discard",danger:!0});const N=async()=>{if(S.ok){A(!0);try{const W=t?await q.createPipeline(S.value):await q.savePipeline(e,S.value,x);C(null),J(W,W.updatedAt),U(!0),setTimeout(()=>U(!1),2e3),l.success(t?`Pipeline "${W.name}" created`:`Pipeline "${W.name}" saved`),t&&(I.current=!0,r(`/agents/pipelines/${W.id}`,{replace:!0}))}catch(W){C(W.message)}finally{A(!1)}}},F=async()=>{var Ze;if(t)return;const W=((Ze=u.data)==null?void 0:Ze.name)||c||e;if(await i({title:`Delete the pipeline "${W}"?`,message:"The pipeline is removed for everyone using this Agent Studio. This cannot be undone.",confirmLabel:"Delete pipeline",danger:!0})){A(!0);try{await q.deletePipeline(e),I.current=!0,l.success(`Pipeline "${W}" deleted`),r("/agents?tab=custom",{replace:!0})}catch(Zt){C(Zt.message),A(!1)}}},Z=(W,fe)=>{W.dataTransfer.effectAllowed=fe.from==="palette"||fe.from==="palette-loop"?"copy":"move",W.dataTransfer.setData("text/plain","qa-pipeline"),T(fe)},oe=()=>T(null),B=W=>{R&&w(fe=>fd(fe,R,W)),T(null)},he=W=>w(fe=>fd(fe,W,{parent:[],index:fe.length})),ze={blocks:g,drag:R,customAgents:o,setBlocks:w,startDrag:Z,endDrag:oe,drop:B},Ke=t?"New pipeline":c||"Pipeline";return!t&&u.error?s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:"Pipeline"}]}),s.jsx(Pe,{error:u.error}),s.jsx(ye,{to:"/agents",className:"btn ghost",children:"Back to Agents"})]}):s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:Ke}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:Ke}),s.jsxs("p",{className:"page-sub",children:["Drag agents from the palette into the pipeline, reorder them by dragging, and add a ",s.jsx("b",{children:"Loop"})," to repeat agents. Each loop runs its entries in order and ends when its first entry passes (check first) or when its last entry passes (work first, then check), or after its maximum number of iterations. Drop a loop inside another loop to nest it (up to ",no," levels); a nested loop in the check position (first, or last for loops that end when the last entry passes) ends the outer loop when it passes. Run it from the chat with ",s.jsx("code",{children:"/p:<name> <spec.md> [input]"})," or a prompt that names a spec or TC-ID (",s.jsx("code",{children:"/p:<name> check TC-LOGIN-001 on mobile"}),"); a pipeline with only custom agents or the Context Writer also runs from a prompt alone: ",s.jsx("code",{children:"/p:<name> <prompt>"}),"."]})]}),s.jsxs("span",{className:"row",children:[!t&&s.jsxs("button",{className:"btn danger",onClick:()=>void F(),disabled:L,children:[s.jsx(Lr,{size:14})," Delete"]}),s.jsxs("button",{className:"btn",onClick:()=>void N(),disabled:L||!E||!S.ok||!t&&!X,title:ae[0],children:[s.jsx(us,{size:14})," ",z?"Saved":t?"Create pipeline":"Save"]})]})]}),s.jsx(Pe,{error:D}),s.jsxs("div",{className:"card pl-meta",children:[s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{className:"input",value:c,maxLength:Wc,onChange:W=>h(W.target.value),placeholder:"e.g. Nightly regression"})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Description"}),s.jsx("input",{className:"input",value:d,maxLength:Vc,onChange:W=>f(W.target.value),placeholder:"Optional"})]}),s.jsxs("label",{className:"pl-field wide",children:[s.jsx("span",{children:"Working directory"}),s.jsx("input",{className:"input",value:m,onChange:W=>p(W.target.value),placeholder:"Optional"}),s.jsx("span",{className:"muted small",children:"Custom agents run here (e.g. D:\\my-app). Empty: this QA repository."})]}),t&&s.jsxs("label",{className:"pl-field pl-from",children:[s.jsx("span",{children:"Start from"}),s.jsxs("select",{className:"input",value:n.get("from")??"",onChange:async W=>{const fe=W.target.value;if(g.length&&!await i({title:"Replace the current steps?",message:"The pipeline steps are replaced with the chosen starting point.",confirmLabel:"Replace",danger:!0}))return;r(fe?`/agents/pipelines/new?from=${fe}`:"/agents/pipelines/new",{replace:!0});const Ze=Q.find(Zt=>Zt.id===fe);J(Ze?{...Ze,name:`${Ze.name} (custom)`}:{name:"",description:"",steps:[]},void 0,!Ze)},children:[s.jsx("option",{value:"",children:"Blank pipeline"}),Q.map(W=>s.jsxs("option",{value:W.id,children:["Built-in: ",W.name]},W.id))]})]})]}),s.jsxs("div",{className:"pl-layout",children:[s.jsxs("aside",{className:"card pl-palette","aria-label":"Agent palette",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"Palette"})}),s.jsx("p",{className:"muted small pl-hint",children:"Drag onto the pipeline, or press + to add at the end."}),s.jsxs("div",{className:"pl-tile pl-tile-loop",draggable:!0,onDragStart:W=>Z(W,{from:"palette-loop"}),onDragEnd:oe,children:[s.jsx("span",{className:"pl-loop-icon",children:s.jsx(is,{size:16})}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:"Loop"}),s.jsx("span",{className:"muted small",children:"Repeat agents up to a maximum count; loops can be nested"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":"Add a loop",onClick:()=>he({from:"palette-loop"}),children:s.jsx(Qt,{size:14})})]}),yA.map(W=>s.jsxs("div",{className:"pl-tile",draggable:!0,onDragStart:fe=>Z(fe,{from:"palette",agent:W}),onDragEnd:oe,children:[s.jsx(Ot,{agent:W,size:28}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:Se[W].label}),s.jsx("span",{className:"muted small",children:Se[W].llm?"LLM agent":"Playwright step"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Add ${Se[W].label}`,onClick:()=>he({from:"palette",agent:W}),children:s.jsx(Qt,{size:14})})]},W)),o.map(W=>{const fe=Th(W.id);return s.jsxs("div",{className:"pl-tile",draggable:!0,onDragStart:Ze=>Z(Ze,{from:"palette",agent:fe}),onDragEnd:oe,children:[s.jsx(Ot,{agent:"custom",size:28}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:W.name}),s.jsx("span",{className:"muted small",children:"Custom agent"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Add ${W.name}`,onClick:()=>he({from:"palette",agent:fe}),children:s.jsx(Qt,{size:14})})]},W.id)}),o.length===0&&s.jsxs(ye,{to:"/agents/custom/new",className:"btn ghost sm",children:[s.jsx(Qt,{size:14})," New agent"]})]}),s.jsxs("div",{className:"card pl-canvas","aria-label":"Pipeline",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Pipeline"}),s.jsxs("span",{className:"muted small",children:[g.length," block",g.length===1?"":"s"]})]}),s.jsxs("div",{className:"pl-flow",children:[s.jsx("span",{className:"pl-terminal",children:"Start"}),g.map((W,fe)=>s.jsxs("div",{className:"pl-item",children:[s.jsx(co,{tree:ze,target:{parent:[],index:fe}}),s.jsx(Cj,{tree:ze,block:W,path:[fe],siblings:g.length})]},W.uid)),s.jsx(co,{tree:ze,target:{parent:[],index:g.length},empty:g.length===0}),s.jsx("span",{className:"pl-terminal",children:"End"})]}),E&&ae.length>0&&(g.length>0||c)&&s.jsx("div",{className:"warn-box",role:"status",children:ae.join(`
419
- `)})]})]})]})}const Sj=e=>e.map(t=>t+1).join("."),Nj=(e,t)=>(e==null?void 0:e.from)==="block"&&e.path.length===t.length&&e.path.every((n,r)=>n===t[r]);function Cj({tree:e,block:t,path:n,siblings:r,parentEndsWhen:i}){var m;const{drag:l,customAgents:a,startDrag:o,endDrag:u}=e,c=n.length>1,h=n[n.length-1],d=c&&(i==="last"?h===r-1:h===0),f=p=>{p.stopPropagation(),o(p,{from:"block",path:n})};if(t.kind==="agent"){const p=Rl(t.agent,a);return s.jsxs("div",{className:`pl-block ${c?"inner":""} ${Nj(l,n)?"dragging":""}`,draggable:!0,onDragStart:f,onDragEnd:u,children:[s.jsx("span",{className:"pl-num",children:Sj(n)}),s.jsx(Ot,{agent:Wh(t.agent),size:c?26:30}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:p}),((m=a.find(g=>Th(g.id)===t.agent))==null?void 0:m.review)==="human"&&s.jsx("span",{className:"hr-badge",children:"Human review"}),d?s.jsx("span",{className:"muted small",children:"Loop ends when this agent passes"}):!c&&s.jsx("span",{className:"muted small",children:Sl(t.agent)?"Custom agent":Se[t.agent].description})]}),s.jsx(Ej,{tree:e,path:n,count:r,label:p})]})}return s.jsx(vA,{tree:e,loop:t,path:n,siblings:r,first:d,onDragStart:f})}function vA({tree:e,loop:t,path:n,siblings:r,first:i,onDragStart:l}){const{drag:a,setBlocks:o,endDrag:u}=e,c=Sj(n),h=`loop ${c}`;return s.jsxs("div",{className:`pl-loop ${n.length>1?"nested":""} ${Nj(a,n)?"dragging":""}`,"data-depth":n.length,children:[s.jsxs("div",{className:"pl-loop-head",draggable:!0,onDragStart:l,onDragEnd:u,children:[s.jsx("span",{className:"pl-num",children:c}),s.jsx("span",{className:"pl-loop-icon",children:s.jsx(is,{size:15})}),s.jsxs("span",{className:"pl-loop-title",children:[s.jsx("b",{children:n.length>1?"Nested loop":"Loop"}),i&&s.jsx("span",{className:"muted small",children:"Outer loop ends when this loop passes"})]}),s.jsxs("label",{className:"pl-max",children:[s.jsx("span",{className:"muted small",children:"Max iterations"}),s.jsx("input",{className:"input",type:"number",min:1,max:pl,step:1,value:t.maxIterations??"","aria-label":`Maximum iterations of ${h}`,onChange:d=>o(f=>Gm(f,n,{maxIterations:d.target.value===""?null:Math.max(1,Math.min(pl,Math.round(Number(d.target.value))))}))})]}),s.jsxs("label",{className:"pl-max",children:[s.jsx("span",{className:"muted small",children:"Ends when"}),s.jsxs("select",{className:"input",value:t.endsWhen,"aria-label":`When ${h} ends`,onChange:d=>o(f=>Gm(f,n,{endsWhen:d.target.value})),children:[s.jsx("option",{value:"first",children:"first entry passes"}),s.jsx("option",{value:"last",children:"last entry passes"})]})]}),s.jsx(Ej,{tree:e,path:n,count:r,label:h})]}),s.jsxs("div",{className:"pl-loop-body",children:[t.steps.map((d,f)=>s.jsxs("div",{className:"pl-item",children:[s.jsx(co,{tree:e,target:{parent:n,index:f},inner:!0}),s.jsx(Cj,{tree:e,block:d,path:[...n,f],siblings:t.steps.length,parentEndsWhen:t.endsWhen})]},d.uid)),s.jsx(co,{tree:e,target:{parent:n,index:t.steps.length},inner:!0,empty:t.steps.length===0}),s.jsxs("div",{className:"pl-loop-foot muted small",children:[s.jsx(is,{size:12})," repeats up to ",t.maxIterations??"?"," time",t.maxIterations===1?"":"s"]})]})]})}function co({tree:e,target:t,inner:n,empty:r}){const{blocks:i,drag:l,drop:a}=e,[o,u]=j.useState(!1),c=l!==null&&bj(i,l,t);return s.jsx("div",{className:`pl-gap ${n?"inner":""} ${r?"empty":""} ${c?"active":""} ${o&&c?"over":""}`,onDragOver:h=>{c&&(h.preventDefault(),h.stopPropagation(),h.dataTransfer.dropEffect=l.from==="palette"||l.from==="palette-loop"?"copy":"move",o||u(!0))},onDragLeave:()=>u(!1),onDrop:h=>{h.preventDefault(),h.stopPropagation(),u(!1),a(t)},children:r?s.jsx("span",{className:"muted small",children:n?"Drop agents or a loop here to repeat them":"Drag agents or a loop here"}):s.jsx("span",{className:"pl-arrow",children:"↓"})})}function Ej({tree:e,path:t,count:n,label:r}){const{setBlocks:i}=e,l=t[t.length-1];return s.jsxs("span",{className:"pl-actions",children:[s.jsx("button",{className:"btn ghost sm icon","aria-label":`Move ${r} up`,disabled:l===0,onClick:()=>i(a=>qm(a,t,-1)),children:"↑"}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Move ${r} down`,disabled:l===n-1,onClick:()=>i(a=>qm(a,t,1)),children:"↓"}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Remove ${r}`,onClick:()=>i(a=>xA(a,t)),children:s.jsx(wr,{size:13})})]})}const jA=[{id:"1",label:"24 h"},{id:"7",label:"7 days"},{id:"30",label:"30 days"},{id:"90",label:"90 days"}],ur=e=>e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens,Rn=(e,t)=>e.trackedRuns?ln(t):"—";function wA(e){const t=new Map(e.byDay.map(i=>[i.day,i])),n=[],r=new Date;for(let i=Math.max(e.days,1)-1;i>=0;i--){const l=new Date(r.getTime()-i*864e5).toISOString().slice(0,10);n.push(t.get(l)??{day:l,runs:0,trackedRuns:0,costUsd:0,turns:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0})}return n}function kA(e){if(e<=0)return 1;const t=10**Math.floor(Math.log10(e));return([1,2,2.5,5,10].find(n=>n*t>=e)??10)*t}const Ti=e=>new Date(`${e}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"});function bA({report:e}){const t=wA(e),n=kA(Math.max(...t.map(r=>r.costUsd)));return s.jsxs("div",{children:[s.jsxs("div",{className:"usage-chart",role:"img","aria-label":`Estimated cost per day over the last ${e.days} days`,children:[[.5,1].map(r=>s.jsx("div",{className:"usage-chart-gridline",style:{bottom:`${r*100}%`},children:s.jsx("span",{children:Gt(n*r)})},r)),t.map(r=>s.jsxs("div",{className:`bar-col ${r.costUsd?"":"zero"}`,tabIndex:0,"aria-label":`${Ti(r.day)}: ${Gt(r.costUsd)}, ${r.runs} runs`,children:[s.jsx("i",{style:{height:`${Math.max(r.costUsd/n*100,r.costUsd?2:0)}%`}}),s.jsxs("span",{className:"tip",children:[s.jsx("b",{children:Ti(r.day)})," · ",Gt(r.costUsd),s.jsx("br",{}),r.runs," run",r.runs===1?"":"s"," · ",ln(ur(r))," in / ",ln(r.outputTokens)," out"]})]},r.day))]}),s.jsxs("div",{className:"usage-axis",children:[s.jsx("span",{children:Ti(t[0].day)}),t.length>2&&s.jsx("span",{children:Ti(t[Math.floor(t.length/2)].day)}),s.jsx("span",{children:Ti(t[t.length-1].day)})]})]})}function ca({icon:e,label:t,value:n,sub:r}){return s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:t}),s.jsx("span",{className:"stat-icon",children:e})]}),s.jsx("div",{className:"stat-value",children:n}),r&&s.jsx("div",{className:"muted small",children:r})]})}function Wu({title:e,rows:t,name:n,total:r}){return s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:e})}),t.length===0?s.jsx("p",{className:"muted pad",children:"No runs in this range."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Name"}),s.jsx("th",{className:"num",children:"Runs"}),s.jsx("th",{className:"num",children:"Tokens in"}),s.jsx("th",{className:"num",children:"Tokens out"}),s.jsx("th",{className:"num",children:"Est. cost"}),s.jsx("th",{children:"Share"})]})}),s.jsx("tbody",{children:t.map((i,l)=>s.jsxs("tr",{children:[s.jsx("td",{children:n(i)}),s.jsx("td",{className:"num",children:i.runs}),s.jsx("td",{className:"num",children:Rn(i,ur(i))}),s.jsx("td",{className:"num",children:Rn(i,i.outputTokens)}),s.jsx("td",{className:"num",children:Gt(i.costUsd)}),s.jsx("td",{children:s.jsx("div",{className:"share-bar",title:`${r?Math.round(i.costUsd/r*100):0}% of cost`,children:s.jsx("i",{style:{width:`${r?i.costUsd/r*100:0}%`}})})})]},l))})]})})]})}const Tj="qa-studio.usage.recentView";function SA(){try{return localStorage.getItem(Tj)==="jobs"?"jobs":"runs"}catch{return"runs"}}function NA({job:e}){return s.jsxs(s.Fragment,{children:[s.jsxs(ye,{to:`/runs/${e.jobId}`,children:["#",e.jobId," ",kr[e.jobType]??e.jobType]}),s.jsx("div",{className:"muted small",children:e.name??e.target})]})}function CA({jobs:e}){const[t,n]=j.useState(()=>new Set),r=l=>n(a=>{const o=new Set(a);return o.has(l)?o.delete(l):o.add(l),o}),i=e.length>0&&e.every(l=>t.has(l.jobId));return e.length===0?s.jsx("p",{className:"muted pad",children:"No runs in this range."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"flat usage-jobs",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:s.jsx("button",{className:"btn ghost sm",onClick:()=>n(i?new Set:new Set(e.map(l=>l.jobId))),children:i?"Collapse all":"Expand all"})}),s.jsx("th",{children:"Agents"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Model"}),s.jsx("th",{className:"num",children:"Turns"}),s.jsx("th",{className:"num",children:"Tokens in"}),s.jsx("th",{className:"num",children:"Tokens out"}),s.jsx("th",{className:"num",children:"Est. cost"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:e.map(l=>{const a=t.has(l.jobId),o=[...new Set(l.agentRuns.map(u=>u.model).filter(Boolean))];return s.jsxs(j.Fragment,{children:[s.jsxs("tr",{className:"usage-job-row",children:[s.jsx("td",{children:s.jsxs("span",{className:"usage-job-cell",children:[s.jsx("button",{className:"usage-expand",onClick:()=>r(l.jobId),"aria-expanded":a,"aria-label":`${a?"Hide":"Show"} the LLM runs of job #${l.jobId}`,children:s.jsx(ti,{size:12,open:a})}),s.jsx("span",{children:s.jsx(NA,{job:l})})]})}),s.jsx("td",{children:s.jsxs("span",{className:"usage-agent-icons",title:l.agentRuns.map(u=>{var c;return((c=Se[u.agent])==null?void 0:c.label)??u.agent}).join(" → "),children:[l.agentRuns.slice(0,6).map(u=>s.jsx(Ot,{agent:u.agent,size:20},u.runId)),s.jsxs("span",{className:"muted small",children:[l.runs," run",l.runs===1?"":"s"]})]})}),s.jsx("td",{children:s.jsx(kn,{status:l.status})}),s.jsx("td",{children:o.length?o.map(u=>s.jsx("code",{children:u},u)):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:l.turns}),s.jsx("td",{className:"num",children:Rn(l,ur(l))}),s.jsx("td",{className:"num",children:Rn(l,l.outputTokens)}),s.jsx("td",{className:"num strong",children:Gt(l.costUsd)}),s.jsx("td",{className:"small",children:Pt(l.at)})]}),a&&l.agentRuns.map(u=>{var c;return s.jsxs("tr",{className:"usage-sub-row",children:[s.jsx("td",{children:s.jsxs("span",{className:"usage-sub-name",children:[s.jsx(Ot,{agent:u.agent,size:20})," ",((c=Se[u.agent])==null?void 0:c.label)??u.agent]})}),s.jsxs("td",{className:"muted small",children:["run #",u.runId]}),s.jsx("td",{children:s.jsx(kn,{status:u.status})}),s.jsx("td",{children:u.model?s.jsx("code",{children:u.model}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:u.turns}),s.jsx("td",{className:"num",children:Rn(u,ur(u))}),s.jsx("td",{className:"num",children:Rn(u,u.outputTokens)}),s.jsx("td",{className:"num",children:Gt(u.costUsd)}),s.jsx("td",{className:"small",children:Pt(u.at)})]},u.runId)})]},l.jobId)})})]})})}function EA(){const[e,t]=j.useState(SA),n=d=>{t(d);try{localStorage.setItem(Tj,d)}catch{}},[r,i]=j.useState("30"),{data:l,error:a,reload:o}=Me(()=>q.usage(Number(r)),[r]),u=l==null?void 0:l.totals,c=u&&ur(u)?Math.round(u.cacheReadTokens/ur(u)*100):0,h=u?u.runs-u.trackedRuns:0;return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Claude usage"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Claude usage"}),s.jsxs("p",{className:"page-sub",children:["Tokens and estimated cost of the Claude Code agents run by Agent Studio (QA Explorer, QA Script Generator, QA Script Healer, QA Test Case Writer, Context Writer). The cost is Claude Code's API-price estimate. On a Claude subscription, check plan limits with ",s.jsx("code",{children:"/usage"})," in Claude Code."]})]}),s.jsxs("div",{className:"row",children:[s.jsx(bn,{value:r,onChange:i,items:jA}),s.jsx("button",{className:"btn ghost",onClick:o,title:"Refresh","aria-label":"Refresh",children:s.jsx(Rr,{size:15})})]})]}),s.jsx(Pe,{error:a}),l&&u&&s.jsxs(s.Fragment,{children:[h>0&&s.jsxs("div",{className:"warn-box",style:{marginBottom:14},children:[h," of ",u.runs," runs in this range were recorded before token tracking was added: they count toward cost and runs, but their tokens show as —."]}),s.jsxs("div",{className:"stats usage-stats",children:[s.jsx(ca,{icon:s.jsx(My,{size:16}),label:"Estimated cost",value:Gt(u.costUsd),sub:`${u.runs?Gt(u.costUsd/u.runs):"—"} per run`}),s.jsx(ca,{icon:s.jsx(Dy,{size:16}),label:"LLM agent runs",value:u.runs,sub:`${u.turns.toLocaleString()} turns`}),s.jsx(ca,{icon:s.jsx(ft,{size:16}),label:"Tokens in",value:Rn(u,ur(u)),sub:u.trackedRuns?`${c}% served from cache`:"No token data yet"}),s.jsx(ca,{icon:s.jsx(ft,{size:16}),label:"Tokens out",value:Rn(u,u.outputTokens),sub:u.trackedRuns?`${ln(u.inputTokens)} uncached input`:"No token data yet"})]}),s.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[s.jsxs("div",{className:"row between",style:{marginBottom:18},children:[s.jsx("h3",{className:"card-title",children:"Estimated cost per day"}),s.jsxs("span",{className:"muted small",children:["Since ",new Date(l.since).toLocaleString("en-US",{hour12:!1})]})]}),s.jsx(bA,{report:l})]}),s.jsxs("div",{className:"overview-grid",style:{marginBottom:14},children:[s.jsx(Wu,{title:"By spec",rows:l.bySpec,total:u.costUsd,name:d=>d.target.endsWith(".md")?s.jsx(ye,{to:`/specs/${d.target}`,children:d.target}):d.target}),s.jsx(Wu,{title:"By agent",rows:l.byAgent,total:u.costUsd,name:d=>{var f;return s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,whiteSpace:"nowrap"},children:[s.jsx(Ot,{agent:d.agent,size:22})," ",((f=Se[d.agent])==null?void 0:f.label)??d.agent]})}})]}),s.jsx("div",{style:{marginBottom:14},children:s.jsx(Wu,{title:"By model",rows:l.byModel,total:u.costUsd,name:d=>s.jsx("code",{children:d.model})})}),s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Recent LLM runs"}),s.jsx(bn,{value:e,onChange:n,items:[{id:"runs",label:"Runs"},{id:"jobs",label:"Group by job"}]})]}),e==="jobs"?s.jsx(CA,{jobs:l.recentJobs}):l.recent.length===0?s.jsx("p",{className:"muted pad",children:"No runs in this range. Usage is recorded for agent runs from this version of Agent Studio onward."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Job"}),s.jsx("th",{children:"Agent"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Model"}),s.jsx("th",{className:"num",children:"Turns"}),s.jsx("th",{className:"num",children:"Tokens in"}),s.jsx("th",{className:"num",children:"Tokens out"}),s.jsx("th",{className:"num",children:"Est. cost"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:l.recent.map(d=>{var f;return s.jsxs("tr",{children:[s.jsxs("td",{children:[s.jsxs(ye,{to:`/runs/${d.jobId}`,children:["#",d.jobId," ",kr[d.jobType]]}),s.jsx("div",{className:"muted small",children:d.target})]}),s.jsx("td",{children:((f=Se[d.agent])==null?void 0:f.label)??d.agent}),s.jsx("td",{children:s.jsx(kn,{status:d.status})}),s.jsx("td",{children:d.model?s.jsx("code",{children:d.model}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:d.turns}),s.jsx("td",{className:"num",children:Rn(d,ur(d))}),s.jsx("td",{className:"num",children:Rn(d,d.outputTokens)}),s.jsx("td",{className:"num",children:Gt(d.costUsd)}),s.jsx("td",{className:"small",children:Pt(d.at)})]},d.runId)})})]})})]})]})]})}const Pi=e=>`${e.spec}#${e.tcId}`;function TA(e){return e.target==="all"?"All tests":e.args.tcId?"1 TC":"Whole spec"}function PA({counts:e}){const t=Object.values(e).reduce((r,i)=>r+i,0);if(!t)return s.jsx("span",{className:"muted small",children:"—"});const n=["passed","flaky","failed","skipped"];return s.jsxs("span",{className:"row",style:{gap:8},children:[s.jsx("span",{className:"tr-progress",role:"img","aria-label":n.filter(r=>e[r]).map(r=>`${e[r]} ${r}`).join(", "),children:n.map(r=>e[r]?s.jsx("i",{className:r,style:{width:`${e[r]/t*100}%`},title:`${e[r]} ${r}`},r):null)}),s.jsxs("span",{className:"small",children:[e.passed??0,"/",t]})]})}function RA(){const e=ut(),t=Pl(),{data:n,error:r,reload:i}=Me(()=>q.testRuns({page:t.page,pageSize:t.pageSize}),[t.page,t.pageSize]),l=(n==null?void 0:n.items)??[],a=l.some(o=>o.status==="queued"||o.status==="running");return j.useEffect(()=>{if(!a)return;const o=setInterval(i,2e3);return()=>clearInterval(o)},[a,i]),s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Test runs"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Test runs"}),s.jsx("p",{className:"page-sub",children:"Pick test cases, name the run, execute it and review the results. Results use the line reporter; the Playwright HTML report is optional."})]}),s.jsxs(ye,{className:"btn",to:"/test-runs/new",children:[s.jsx(Qt,{size:15})," New test run"]})]}),s.jsx(Pe,{error:r}),s.jsxs("div",{className:"table-wrap",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Run"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Results"}),s.jsx("th",{className:"num",children:"Cases"}),s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Duration"}),s.jsx("th",{children:"Report"})]})}),s.jsx("tbody",{children:l.map(o=>s.jsxs("tr",{onClick:()=>e(`/runs/${o.id}`),style:{cursor:"pointer"},children:[s.jsxs("td",{children:[s.jsx("div",{className:"strong",children:o.args.name??`Test run #${o.id}`}),s.jsxs("div",{className:"muted small",children:["#",o.id,o.args.repeatEach&&o.args.repeatEach>1?` · ${o.args.repeatEach}×`:"",o.args.retries!==void 0?` · retries ${o.args.retries}`:""]})]}),s.jsx("td",{children:s.jsx(kn,{status:o.status})}),s.jsx("td",{children:s.jsx(PA,{counts:o.counts})}),s.jsx("td",{className:"num",children:o.args.selection?o.caseCount:s.jsx("span",{className:"muted small",children:TA(o)})}),s.jsx("td",{className:"muted small",children:Pt(o.startedAt??o.createdAt)}),s.jsx("td",{className:"muted small",children:ds(o.startedAt,o.finishedAt)}),s.jsx("td",{onClick:u=>u.stopPropagation(),children:o.hasHtmlReport?s.jsxs("a",{className:"btn ghost",href:yh(o.id),target:"_blank",rel:"noreferrer",children:[s.jsx(Sh,{size:13})," HTML"]}):s.jsx("span",{className:"muted small",children:"line only"})})]},o.id))})]}),n&&l.length===0&&s.jsxs("p",{className:"muted",style:{padding:16},children:["No test runs yet. ",s.jsx(ye,{to:"/test-runs/new",children:"Create the first one"}),"."]}),n&&s.jsx(ps,{page:t.page,pageSize:t.pageSize,total:n.total,onPage:t.setPage,onPageSize:t.setPageSize,label:"runs"})]})]})}const LA=8;function AA({query:e,onQuery:t,tags:n,allTags:r,onToggleTag:i,onClearTags:l}){const[a,o]=j.useState(!1),[u,c]=j.useState(0),h=j.useRef(null),d=e.trim().toLowerCase().replace(/^#/,""),f=r.filter(w=>!n.has(w)&&(!d||w.toLowerCase().includes(d))).sort((w,x)=>+!w.toLowerCase().startsWith(d)-+!x.toLowerCase().startsWith(d)).slice(0,LA),m=a&&f.length>0&&(d.length>0||n.size===0||e==="");j.useEffect(()=>c(0),[d]);const p=w=>{var x;i(w),t(""),c(0),(x=h.current)==null||x.focus()},g=w=>{var x;w.key==="ArrowDown"&&m?(w.preventDefault(),c(y=>(y+1)%f.length)):w.key==="ArrowUp"&&m?(w.preventDefault(),c(y=>(y-1+f.length)%f.length)):w.key==="Enter"?(w.preventDefault(),m&&d&&p(f[u])):w.key==="Escape"?e?t(""):(x=h.current)==null||x.blur():w.key==="Backspace"&&e===""&&n.size>0&&i([...n][n.size-1])};return s.jsxs("div",{className:"tag-search grow",onClick:()=>{var w;return(w=h.current)==null?void 0:w.focus()},children:[s.jsx(Ro,{size:15}),[...n].map(w=>s.jsxs("span",{className:"tag-token",children:["#",w,s.jsx("button",{type:"button","aria-label":`Remove tag filter ${w}`,onClick:x=>{x.stopPropagation(),i(w)},children:s.jsx(wr,{size:11})})]},w)),s.jsx("input",{ref:h,className:"tag-search-input",placeholder:n.size?"Add text or another tag…":"Search TC-ID, title, spec or tag…",value:e,onChange:w=>t(w.target.value),onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:g,role:"combobox","aria-expanded":m,"aria-controls":"tag-suggestions","aria-activedescendant":m?`tag-opt-${u}`:void 0,"aria-label":"Search test cases or filter by tag"}),n.size>0&&s.jsx("button",{type:"button",className:"tag-search-clear",onClick:w=>{w.stopPropagation(),l()},title:"Clear tag filters","aria-label":"Clear tag filters",children:"Clear tags"}),m&&s.jsxs("ul",{id:"tag-suggestions",className:"tag-suggestions",role:"listbox","aria-label":"Tags",children:[s.jsx("li",{className:"tag-suggestions-head","aria-hidden":"true",children:"Filter by tag"}),f.map((w,x)=>s.jsxs("li",{id:`tag-opt-${x}`,role:"option","aria-selected":x===u,className:x===u?"active":"",onMouseEnter:()=>c(x),onMouseDown:y=>{y.preventDefault(),p(w)},children:["#",w]},w))]})]})}const IA=()=>`Test run ${new Date().toLocaleString("en-GB",{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}`;function DA(){var en;const e=ut(),n=Kn().state??null,{specs:r}=Xt(),i=Me(()=>q.settings()),[l,a]=j.useState((n==null?void 0:n.name)??IA()),[o,u]=j.useState(()=>new Map(((n==null?void 0:n.selection)??[]).map(ee=>[Pi(ee),ee]))),[c,h]=j.useState(""),d=eb(c.trim(),250),[f,m]=j.useState(""),[p,g]=j.useState(new Set),[w,x]=j.useState("all"),[y,v]=j.useState(!1),[b,E]=j.useState(1),[k,R]=j.useState((n==null?void 0:n.retries)??null),[T,D]=j.useState(null),[C,L]=j.useState(!1),[A,z]=j.useState(null),U=T??((en=i.data)==null?void 0:en.settings.htmlReport)??!1,I=[...p].sort(),Q=y?[...o.keys()].sort():null,J=Pl([],50),H=JSON.stringify([d,f,I,w,y]),[X,S]=j.useState(H),ae=H!==X;ae&&(S(H),J.page!==1&&J.setPage(1));const O=ae?1:J.page,N=Me(()=>q.searchTestCases({page:O,pageSize:J.pageSize,q:d,tags:I,spec:f,result:w,...Q?{selected:Q}:{}}),[O,J.pageSize,d,f,I.join("\0"),w,(Q==null?void 0:Q.join("\0"))??null]),F=N.data,Z=(F==null?void 0:F.items)??[],oe=(F==null?void 0:F.allTags)??[],B=(F==null?void 0:F.matchingRunnable)??[],he=B.length>0&&B.every(ee=>o.has(Pi(ee))),ze=[...o.values()],Ke=new Set(ze.map(ee=>ee.spec)).size,W=ee=>u(Ne=>{const et=new Map(Ne),Dr=Pi(ee);return et.has(Dr)?et.delete(Dr):et.set(Dr,ee),et}),fe=()=>u(ee=>{const Ne=new Map(ee);for(const et of B)he?Ne.delete(Pi(et)):Ne.set(Pi(et),et);return Ne}),Ze=ee=>g(Ne=>{const et=new Set(Ne);return et.has(ee)?et.delete(ee):et.add(ee),et}),Zt=async ee=>{if(ee.preventDefault(),!l.trim())return z("Give the test run a name.");if(!ze.length)return z("Pick at least one test case that has a Playwright test.");if(ze.length>Mp)return z(`A test run can have at most ${Mp} test cases.`);L(!0);try{const Ne=await q.createJob({type:"testrun",name:l.trim(),selection:ze,repeatEach:b,...k!==null?{retries:k}:{},htmlReport:U});e(`/runs/${Ne.id}`)}catch(Ne){z(Ne.message),L(!1)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Test runs",to:"/test-runs"},{label:"New test run"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"New test run"}),s.jsx("p",{className:"page-sub",children:"Filter and pick test cases. Only test cases that have a Playwright test can be run."})]})}),s.jsxs("form",{className:"tr-layout",onSubmit:Zt,children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"tr-filters",children:[s.jsx(AA,{query:c,onQuery:h,tags:p,allTags:oe,onToggleTag:Ze,onClearTags:()=>g(new Set)}),s.jsxs("select",{className:"select",value:f,onChange:ee=>m(ee.target.value),"aria-label":"Spec",children:[s.jsx("option",{value:"",children:"All specs"}),r.map(ee=>s.jsx("option",{value:ee.file,children:ee.file},ee.file))]}),s.jsxs("select",{className:"select",value:w,onChange:ee=>x(ee.target.value),"aria-label":"Last result",children:[s.jsx("option",{value:"all",children:"Any last result"}),s.jsx("option",{value:"passed",children:"Last passed"}),s.jsx("option",{value:"failed",children:"Last failed"}),s.jsx("option",{value:"none",children:"Never run"})]}),s.jsxs("label",{className:"row small",style:{gap:6},children:[s.jsx("input",{type:"checkbox",checked:y,onChange:ee=>v(ee.target.checked)})," Selected only"]})]}),s.jsxs("div",{className:"table-wrap",style:{border:0},children:[s.jsxs("table",{className:"tr-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"check",children:s.jsx("input",{type:"checkbox",checked:he,onChange:fe,disabled:!B.length,"aria-label":`Select all ${B.length} filtered test cases`,title:`All ${B.length} runnable test cases that match the filters (every page)`})}),s.jsx("th",{children:"Test case"}),s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"Tags"}),s.jsx("th",{children:"Last result"})]})}),s.jsx("tbody",{children:Z.map(ee=>s.jsxs("tr",{className:`${ee.runnable?"":"disabled"} ${o.has(ee.key)?"picked":""}`,onClick:()=>ee.runnable&&W(ee.ref),style:{cursor:ee.runnable?"pointer":"default"},children:[s.jsx("td",{className:"check",onClick:Ne=>Ne.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:o.has(ee.key),disabled:!ee.runnable,onChange:()=>W(ee.ref),"aria-label":`Select ${ee.tcId}`})}),s.jsxs("td",{children:[s.jsx("code",{children:ee.tcId})," ",ee.tcTitle,!ee.runnable&&s.jsx("div",{className:"muted small",children:"No Playwright test yet: generate it first"})]}),s.jsx("td",{className:"small",children:s.jsx(ye,{to:`/specs/${ee.ref.spec}`,onClick:Ne=>Ne.stopPropagation(),children:ee.ref.spec})}),s.jsx("td",{children:s.jsx("span",{className:"row",style:{gap:4,flexWrap:"wrap"},children:ee.tags.map(Ne=>s.jsx("button",{type:"button",className:`tag tag-btn ${p.has(Ne)?"on":""}`,title:p.has(Ne)?`Remove the "${Ne}" filter`:`Filter by "${Ne}"`,onClick:et=>{et.stopPropagation(),Ze(Ne)},children:Ne},Ne))})}),s.jsx("td",{children:ee.lastResult?s.jsx(ni,{status:ee.lastResult.status,title:Pt(ee.lastResult.at)}):s.jsx("span",{className:"muted small",children:"never"})})]},ee.key))})]}),s.jsx(Pe,{error:N.error}),F&&Z.length===0&&s.jsx("p",{className:"muted",style:{padding:16},children:F.totalCases?"No test case matches the filters.":"No test cases yet: add a spec first."}),!F&&!N.error&&s.jsx("p",{className:"muted",style:{padding:16},children:"Loading test cases…"}),F&&s.jsx(ps,{page:O,pageSize:J.pageSize,total:F.total,onPage:J.setPage,onPageSize:J.setPageSize,label:"test cases"})]})]}),s.jsx("div",{className:"tr-side",children:s.jsxs("div",{className:"card pad",style:{display:"grid",gap:12},children:[s.jsxs("label",{children:["Run name",s.jsx("input",{className:"input",value:l,maxLength:xb,onChange:ee=>a(ee.target.value)})]}),s.jsxs("label",{children:["Repeat each test",s.jsx("select",{className:"select",value:b,onChange:ee=>E(Number(ee.target.value)),children:[1,2,3,5,10].map(ee=>s.jsxs("option",{value:ee,children:[ee,"×"]},ee))})]}),s.jsxs("label",{children:["Retries on failure",s.jsxs("select",{className:"select",value:k??"",onChange:ee=>R(ee.target.value===""?null:Number(ee.target.value)),children:[s.jsx("option",{value:"",children:"Default (playwright.config.ts)"}),Array.from({length:gb+1},(ee,Ne)=>s.jsx("option",{value:Ne,children:Ne===0?"No retries":`${Ne} ${Ne===1?"retry":"retries"}`},Ne))]}),s.jsx("div",{className:"muted small",children:"A test that fails and then passes on a retry is reported as flaky."})]}),s.jsxs("div",{className:"row between",children:[s.jsxs("span",{style:{fontSize:13,fontWeight:600},children:["HTML report",s.jsx("div",{className:"muted small",style:{fontWeight:400},children:"Line report is always on"})]}),s.jsxs("label",{className:"switch",children:[s.jsx("input",{type:"checkbox",checked:U,onChange:ee=>D(ee.target.checked),"aria-label":"Also write the Playwright HTML report"}),s.jsx("span",{children:U?"On":"Off"})]})]}),s.jsxs("div",{className:"muted small",children:[s.jsx("b",{style:{color:"var(--text)"},children:ze.length})," test case",ze.length===1?"":"s"," selected from ",Ke," spec",Ke===1?"":"s",o.size>0&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{type:"button",className:"link-btn",onClick:()=>u(new Map),children:"clear"})]})]}),s.jsx(Pe,{error:A}),s.jsxs("button",{type:"submit",className:"btn",disabled:C||!ze.length,children:[s.jsx(ft,{size:14})," ",C?"Starting…":"Create & run"]})]})})]})]})}const MA=R0([{element:s.jsx(Zb,{}),children:[{path:"/",element:s.jsx(WT,{})},{path:"/chat/:id?",element:s.jsx(nA,{})},{path:"/specs",element:s.jsx(eP,{})},{path:"/specs/from-requirement",element:s.jsx(JT,{})},{path:"/specs/:file",element:s.jsx(uP,{})},{path:"/mapping",element:s.jsx(HT,{})},{path:"/runs",element:s.jsx(XT,{})},{path:"/runs/:id",element:s.jsx(PT,{})},{path:"/agents",element:s.jsx(gP,{})},{path:"/agents/custom/new",element:s.jsx(Qm,{},"new")},{path:"/agents/custom/:id",element:s.jsx(Qm,{})},{path:"/agents/:agent",element:s.jsx(uA,{})},{path:"/agents/pipelines/new",element:s.jsx(Km,{},"new")},{path:"/agents/pipelines/:id",element:s.jsx(Km,{})},{path:"/usage",element:s.jsx(EA,{})},{path:"/test-runs",element:s.jsx(RA,{})},{path:"/test-runs/new",element:s.jsx(DA,{})},{path:"/project",element:s.jsx(QT,{})},{path:"/project/reset",element:s.jsx(GT,{})},{path:"/settings",element:s.jsx(pP,{})},{path:"*",element:s.jsx("p",{children:"Page not found."})}]}],{future:{v7_relativeSplatPath:!0,v7_fetcherPersist:!0,v7_normalizeFormMethod:!0,v7_partialHydration:!0,v7_skipActionErrorRevalidation:!0}});"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>console.warn("Service worker registration failed",e))});uy(document.getElementById("root")).render(s.jsx(j.StrictMode,{children:s.jsx($0,{router:MA,future:{v7_startTransition:!0}})}));
418
+ `]},U))]}):!m&&s.jsx("p",{className:"muted",children:"Building preview…"})]}),o==="permissions"&&s.jsxs("div",{className:"pad",children:[s.jsxs("p",{className:"muted small",children:["Headless Claude Code with ",s.jsx("code",{children:"--permission-mode dontAsk"}),": anything outside the allow list is denied. Permissions are fixed by Agent Studio."]}),s.jsx("h4",{children:"Allowed"}),s.jsx("div",{className:"perm",children:d?d.allowedTools.map(z=>s.jsx("code",{children:z},z)):s.jsx(fA,{agent:e,onLoad:f})}),s.jsx("h4",{children:"Explicitly denied"}),s.jsx("div",{className:"perm",children:((d==null?void 0:d.disallowedTools)??lA).map(z=>s.jsx("code",{className:"deny",children:z},z))})]})]})]})}function hA({info:e,onSaved:t}){var d,f,m;const n=_e(()=>q.skills(),[e.agent]),[r,i]=j.useState(!1),[l,a]=j.useState(null),o=e.skills,u=new Set((d=n.data)==null?void 0:d.map(p=>p.name)),c=async p=>{i(!0);try{await q.saveAgentSkills(e.agent,p),a(null),t()}catch(g){a(g.message)}finally{i(!1)}},h=p=>{const g=o.includes(p.name);p.error&&!g||c(g?o.filter(w=>w!==p.name):[...o,p.name])};return s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Select Claude Code skills from ",s.jsx("code",{children:".claude/skills/<name>/SKILL.md"})," (frontmatter ",s.jsx("code",{children:"name"})," + ",s.jsx("code",{children:"description"}),", then the skill's instructions). The skill content is not copied into the instructions: when the agent runs, Claude Code loads the selected skills itself with its Skill tool and applies them on top of the agent's role and persona. Claude Code's own skills (built-in, plugins such as superpowers) stay available too; nothing is blocked. The agent log shows every skill used (",s.jsx("code",{children:"[skill]"})," lines). Changes apply to jobs that start after saving."]}),s.jsx(Le,{error:n.error??l}),e.skillsUnavailable.length>0&&s.jsxs("div",{className:"row",style:{gap:8},children:[s.jsxs("span",{className:"chip warn",children:["Skipped when jobs run: ",e.skillsUnavailable.join(", ")]}),s.jsx("span",{className:"muted small",children:"missing or invalid on disk"}),n.data&&e.skillsUnavailable.some(p=>!u.has(p))&&s.jsx("button",{type:"button",className:"link-btn",disabled:r,onClick:()=>void c(o.filter(p=>u.has(p))),children:"Remove missing"})]}),((f=n.data)==null?void 0:f.length)===0&&s.jsxs("p",{className:"muted",children:["No skills found. Create ",s.jsx("code",{children:".claude/skills/<name>/SKILL.md"})," in the project, then click ",s.jsx("b",{children:"Rescan folder"}),"."]}),s.jsx("div",{className:"skill-list",children:(m=n.data)==null?void 0:m.map(p=>{const g=o.includes(p.name);return s.jsxs("label",{className:`skill-item ${g?"on":""} ${p.error&&!g?"invalid":""}`,title:p.error??p.dir,children:[s.jsx("input",{type:"checkbox",checked:g,disabled:r||!!p.error&&!g,onChange:()=>h(p),"aria-label":`Attach skill ${p.name}`}),s.jsxs("span",{className:"row",style:{gap:8},children:[s.jsx("b",{children:p.name}),g&&s.jsx(yt,{status:"stale",children:o.length>1?`attached #${o.indexOf(p.name)+1}`:"attached"}),p.error&&s.jsx("span",{className:"chip fail",children:"invalid"})]}),s.jsx("span",{className:"skill-desc muted small",children:p.error??p.description}),s.jsxs("span",{className:"skill-meta muted small",children:[s.jsxs("code",{children:[p.dir,"/SKILL.md"]}),s.jsxs("span",{children:[p.chars.toLocaleString()," characters"]}),p.files.length>0&&s.jsxs("span",{title:p.files.join(", "),children:["+",p.files.length," file",p.files.length===1?"":"s"]}),p.allowedTools.length>0&&s.jsxs("span",{className:"chip warn",title:"From the skill's frontmatter: Claude Code allows these tools while the skill is active, on top of the agent's permissions",children:["allowed-tools: ",p.allowedTools.join(" ")]})]})]},p.name)})}),s.jsxs("div",{className:"row between muted small",children:[s.jsxs("span",{children:[o.length," attached · see Full prompt preview for the result"]}),s.jsxs("button",{type:"button",className:"btn ghost sm",onClick:n.reload,disabled:r,children:[s.jsx(Lr,{size:12})," Rescan folder"]})]})]})}function fA({agent:e,onLoad:t}){return j.useEffect(()=>{q.previewAgentPrompt(e,{}).then(t).catch(()=>{})},[e,t]),s.jsx("span",{className:"muted small",children:"Loading…"})}let pA=0;const yj=()=>`b${Date.now().toString(36)}${(pA++).toString(36)}`;function vj(e,t=yj){return e.map(n=>n.kind==="agent"?{uid:t(),kind:"agent",agent:n.agent}:{uid:t(),kind:"loop",maxIterations:n.maxIterations,endsWhen:n.endsWhen??"first",steps:vj(n.steps.map(ds),t)})}const jj=e=>({kind:"loop",steps:e.steps.map(t=>t.kind==="agent"?t.agent:jj(t)),maxIterations:e.maxIterations,...e.endsWhen==="last"?{endsWhen:"last"}:{}});function wj(e){return e.map(t=>t.kind==="agent"?{kind:"agent",agent:t.agent}:jj(t))}const hd=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),kj=(e,t)=>e.length<=t.length&&e.every((n,r)=>n===t[r]);function Zh(e,t){let n=e,r;for(const i of t){if(r=n[i],!r)return;n=r.kind==="loop"?r.steps:[]}return r}function bj(e,t){if(t.length===0)return e;const n=Zh(e,t);return(n==null?void 0:n.kind)==="loop"?n.steps:null}const Sj=e=>e.kind==="agent"?0:1+Math.max(0,...e.steps.map(Sj));function ml(e,t,n){if(t.length===0)return n(e);const[r,...i]=t;return e.map((l,a)=>a===r&&l.kind==="loop"?{...l,steps:ml(l.steps,i,n)}:l)}const mA=(e,t)=>t.from==="block"?Zh(e,t.path)??null:null;function Nj(e,t,n){const r=bj(e,n.parent);if(!r||n.index<0||n.index>r.length)return!1;let i;if(t.from==="palette")i=0;else if(t.from==="palette-loop")i=1;else{const a=mA(e,t);if(!a||kj(t.path,n.parent))return!1;i=Sj(a)}return n.parent.length+i>to?!1:t.from==="block"&&hd(t.path.slice(0,-1),n.parent)||r.length<(n.parent.length===0?ba:Sa)}function fd(e,t,n,r=yj){if(!Nj(e,t,n))return e;let i,l=e,a=n;if(t.from==="palette")i={uid:r(),kind:"agent",agent:t.agent};else if(t.from==="palette-loop")i={uid:r(),kind:"loop",steps:[],maxIterations:Eb,endsWhen:"first"};else{const o=t.path.slice(0,-1),u=t.path[t.path.length-1];if(hd(o,n.parent)&&(n.index===u||n.index===u+1))return e;if(i=Zh(e,t.path),l=ml(e,o,c=>c.filter((h,d)=>d!==u)),hd(o,n.parent))n.index>u&&(a={...n,index:n.index-1});else if(kj(o,n.parent)&&n.parent[o.length]>u){const c=[...n.parent];c[o.length]-=1,a={...n,parent:c}}}return ml(l,a.parent,o=>[...o.slice(0,a.index),i,...o.slice(a.index)])}function qm(e,t,n){const r=t.slice(0,-1),i=t[t.length-1],l=bj(e,r),a=i+n;return!l||a<0||a>=l.length?e:fd(e,{from:"block",path:t},{parent:r,index:n<0?a:a+1})}function gA(e,t){const n=t[t.length-1];return ml(e,t.slice(0,-1),r=>r.filter((i,l)=>l!==n))}function Gm(e,t,n){const r=t[t.length-1];return ml(e,t.slice(0,-1),i=>i.map((l,a)=>a===r&&l.kind==="loop"?{...l,...n}:l))}const xA=Object.keys(Ne).filter(e=>e!=="custom"),Hu=(e,t,n,r="")=>JSON.stringify({name:e.trim(),description:t.trim(),workDir:r.trim(),steps:wj(n)});function Km(){const{id:e}=li(),t=!e||e==="new",[n]=xh(),r=ut(),i=In(),l=Ir(),a=_e(()=>q.settings()),o=_e(()=>q.customAgents()).data??[],u=_e(()=>t?Promise.resolve(null):q.pipeline(e),[e]),[c,h]=j.useState(""),[d,f]=j.useState(""),[m,p]=j.useState(""),[g,w]=j.useState([]),[x,y]=j.useState(),[v,b]=j.useState(null),[E,k]=j.useState(!1),[R,T]=j.useState(null),[D,C]=j.useState(null),[L,A]=j.useState(!1),[z,U]=j.useState(!1),I=j.useRef(!1),Q=j.useMemo(()=>{var V;return Ab(((V=a.data)==null?void 0:V.settings.maxHealRounds)??2)},[a.data]),J=(V,de,ve=!0)=>{const ct=vj(V.steps);h(V.name),f(V.description),p(V.workDir??""),w(ct),y(de),b(ve?Hu(V.name,V.description,ct,V.workDir??""):Hu("","",[],"")),k(!0)};j.useEffect(()=>{if(!t){u.data&&J(u.data,u.data.updatedAt);return}const V=n.get("from");if(V&&!a.data)return;const de=Q.find(ve=>ve.id===V);de?J({...de,name:`${de.name} (custom)`},void 0,!1):J({name:"",description:"",steps:[]},void 0)},[t,u.data,a.data]);const B=Hu(c,d,g,m),X=E&&v!==null&&B!==v,S=Lb({name:c,description:d,workDir:m,steps:wj(g)}),ae=S.ok?[]:S.errors,O=gh(({currentLocation:V,nextLocation:de})=>X&&!I.current&&V.pathname!==de.pathname);Ph(O,{title:"Discard the unsaved pipeline changes?",message:"Your changes to this pipeline will be lost.",confirmLabel:"Discard",danger:!0});const N=async()=>{if(S.ok){A(!0);try{const V=t?await q.createPipeline(S.value):await q.savePipeline(e,S.value,x);C(null),J(V,V.updatedAt),U(!0),setTimeout(()=>U(!1),2e3),l.success(t?`Pipeline "${V.name}" created`:`Pipeline "${V.name}" saved`),t&&(I.current=!0,r(`/agents/pipelines/${V.id}`,{replace:!0}))}catch(V){C(V.message)}finally{A(!1)}}},F=async()=>{var ve;if(t)return;const V=((ve=u.data)==null?void 0:ve.name)||c||e;if(await i({title:`Delete the pipeline "${V}"?`,message:"The pipeline is removed for everyone using this Agent Studio. This cannot be undone.",confirmLabel:"Delete pipeline",danger:!0})){A(!0);try{await q.deletePipeline(e),I.current=!0,l.success(`Pipeline "${V}" deleted`),r("/agents?tab=custom",{replace:!0})}catch(ct){C(ct.message),A(!1)}}},Z=(V,de)=>{V.dataTransfer.effectAllowed=de.from==="palette"||de.from==="palette-loop"?"copy":"move",V.dataTransfer.setData("text/plain","qa-pipeline"),T(de)},ce=()=>T(null),Te=V=>{R&&w(de=>fd(de,R,V)),T(null)},tt=V=>w(de=>fd(de,V,{parent:[],index:de.length})),W={blocks:g,drag:R,customAgents:o,setBlocks:w,startDrag:Z,endDrag:ce,drop:Te},ge=t?"New pipeline":c||"Pipeline";return!t&&u.error?s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:"Pipeline"}]}),s.jsx(Le,{error:u.error}),s.jsx(ye,{to:"/agents",className:"btn ghost",children:"Back to Agents"})]}):s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:ge}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:ge}),s.jsxs("p",{className:"page-sub",children:["Drag agents from the palette into the pipeline, reorder them by dragging, and add a ",s.jsx("b",{children:"Loop"})," to repeat agents. Each loop runs its entries in order and ends when its first entry passes (check first) or when its last entry passes (work first, then check), or after its maximum number of iterations. Drop a loop inside another loop to nest it (up to ",to," levels); a nested loop in the check position (first, or last for loops that end when the last entry passes) ends the outer loop when it passes. Run it from the chat with ",s.jsx("code",{children:"/p:<name> <spec.md> [input]"})," or a prompt that names a spec or TC-ID (",s.jsx("code",{children:"/p:<name> check TC-LOGIN-001 on mobile"}),"); a pipeline with only custom agents or the Context Writer also runs from a prompt alone: ",s.jsx("code",{children:"/p:<name> <prompt>"}),"."]})]}),s.jsxs("span",{className:"row",children:[!t&&s.jsxs("button",{className:"btn danger",onClick:()=>void F(),disabled:L,children:[s.jsx(Ar,{size:14})," Delete"]}),s.jsxs("button",{className:"btn",onClick:()=>void N(),disabled:L||!E||!S.ok||!t&&!X,title:ae[0],children:[s.jsx(cs,{size:14})," ",z?"Saved":t?"Create pipeline":"Save"]})]})]}),s.jsx(Le,{error:D}),s.jsxs("div",{className:"card pl-meta",children:[s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{className:"input",value:c,maxLength:Wc,onChange:V=>h(V.target.value),placeholder:"e.g. Nightly regression"})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:"Description"}),s.jsx("input",{className:"input",value:d,maxLength:Vc,onChange:V=>f(V.target.value),placeholder:"Optional"})]}),s.jsxs("label",{className:"pl-field wide",children:[s.jsx("span",{children:"Working directory"}),s.jsx("input",{className:"input",value:m,onChange:V=>p(V.target.value),placeholder:"Optional"}),s.jsx("span",{className:"muted small",children:"Custom agents run here (e.g. D:\\my-app). Empty: this QA repository."})]}),t&&s.jsxs("label",{className:"pl-field pl-from",children:[s.jsx("span",{children:"Start from"}),s.jsxs("select",{className:"input",value:n.get("from")??"",onChange:async V=>{const de=V.target.value;if(g.length&&!await i({title:"Replace the current steps?",message:"The pipeline steps are replaced with the chosen starting point.",confirmLabel:"Replace",danger:!0}))return;r(de?`/agents/pipelines/new?from=${de}`:"/agents/pipelines/new",{replace:!0});const ve=Q.find(ct=>ct.id===de);J(ve?{...ve,name:`${ve.name} (custom)`}:{name:"",description:"",steps:[]},void 0,!ve)},children:[s.jsx("option",{value:"",children:"Blank pipeline"}),Q.map(V=>s.jsxs("option",{value:V.id,children:["Built-in: ",V.name]},V.id))]})]})]}),s.jsxs("div",{className:"pl-layout",children:[s.jsxs("aside",{className:"card pl-palette","aria-label":"Agent palette",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:"Palette"})}),s.jsx("p",{className:"muted small pl-hint",children:"Drag onto the pipeline, or press + to add at the end."}),s.jsxs("div",{className:"pl-tile pl-tile-loop",draggable:!0,onDragStart:V=>Z(V,{from:"palette-loop"}),onDragEnd:ce,children:[s.jsx("span",{className:"pl-loop-icon",children:s.jsx(ls,{size:16})}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:"Loop"}),s.jsx("span",{className:"muted small",children:"Repeat agents up to a maximum count; loops can be nested"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":"Add a loop",onClick:()=>tt({from:"palette-loop"}),children:s.jsx(qt,{size:14})})]}),xA.map(V=>s.jsxs("div",{className:"pl-tile",draggable:!0,onDragStart:de=>Z(de,{from:"palette",agent:V}),onDragEnd:ce,children:[s.jsx(Ft,{agent:V,size:28}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:Ne[V].label}),s.jsx("span",{className:"muted small",children:Ne[V].llm?"LLM agent":"Playwright step"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Add ${Ne[V].label}`,onClick:()=>tt({from:"palette",agent:V}),children:s.jsx(qt,{size:14})})]},V)),o.map(V=>{const de=Th(V.id);return s.jsxs("div",{className:"pl-tile",draggable:!0,onDragStart:ve=>Z(ve,{from:"palette",agent:de}),onDragEnd:ce,children:[s.jsx(Ft,{agent:"custom",size:28}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:V.name}),s.jsx("span",{className:"muted small",children:"Custom agent"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Add ${V.name}`,onClick:()=>tt({from:"palette",agent:de}),children:s.jsx(qt,{size:14})})]},V.id)}),o.length===0&&s.jsxs(ye,{to:"/agents/custom/new",className:"btn ghost sm",children:[s.jsx(qt,{size:14})," New agent"]})]}),s.jsxs("div",{className:"card pl-canvas","aria-label":"Pipeline",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Pipeline"}),s.jsxs("span",{className:"muted small",children:[g.length," block",g.length===1?"":"s"]})]}),s.jsxs("div",{className:"pl-flow",children:[s.jsx("span",{className:"pl-terminal",children:"Start"}),g.map((V,de)=>s.jsxs("div",{className:"pl-item",children:[s.jsx(co,{tree:W,target:{parent:[],index:de}}),s.jsx(Tj,{tree:W,block:V,path:[de],siblings:g.length})]},V.uid)),s.jsx(co,{tree:W,target:{parent:[],index:g.length},empty:g.length===0}),s.jsx("span",{className:"pl-terminal",children:"End"})]}),E&&ae.length>0&&(g.length>0||c)&&s.jsx("div",{className:"warn-box",role:"status",children:ae.join(`
419
+ `)})]})]})]})}const Cj=e=>e.map(t=>t+1).join("."),Ej=(e,t)=>(e==null?void 0:e.from)==="block"&&e.path.length===t.length&&e.path.every((n,r)=>n===t[r]);function Tj({tree:e,block:t,path:n,siblings:r,parentEndsWhen:i}){var m;const{drag:l,customAgents:a,startDrag:o,endDrag:u}=e,c=n.length>1,h=n[n.length-1],d=c&&(i==="last"?h===r-1:h===0),f=p=>{p.stopPropagation(),o(p,{from:"block",path:n})};if(t.kind==="agent"){const p=Pl(t.agent,a);return s.jsxs("div",{className:`pl-block ${c?"inner":""} ${Ej(l,n)?"dragging":""}`,draggable:!0,onDragStart:f,onDragEnd:u,children:[s.jsx("span",{className:"pl-num",children:Cj(n)}),s.jsx(Ft,{agent:Wh(t.agent),size:c?26:30}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:p}),((m=a.find(g=>Th(g.id)===t.agent))==null?void 0:m.review)==="human"&&s.jsx("span",{className:"hr-badge",children:"Human review"}),d?s.jsx("span",{className:"muted small",children:"Loop ends when this agent passes"}):!c&&s.jsx("span",{className:"muted small",children:bl(t.agent)?"Custom agent":Ne[t.agent].description})]}),s.jsx(Pj,{tree:e,path:n,count:r,label:p})]})}return s.jsx(yA,{tree:e,loop:t,path:n,siblings:r,first:d,onDragStart:f})}function yA({tree:e,loop:t,path:n,siblings:r,first:i,onDragStart:l}){const{drag:a,setBlocks:o,endDrag:u}=e,c=Cj(n),h=`loop ${c}`;return s.jsxs("div",{className:`pl-loop ${n.length>1?"nested":""} ${Ej(a,n)?"dragging":""}`,"data-depth":n.length,children:[s.jsxs("div",{className:"pl-loop-head",draggable:!0,onDragStart:l,onDragEnd:u,children:[s.jsx("span",{className:"pl-num",children:c}),s.jsx("span",{className:"pl-loop-icon",children:s.jsx(ls,{size:15})}),s.jsxs("span",{className:"pl-loop-title",children:[s.jsx("b",{children:n.length>1?"Nested loop":"Loop"}),i&&s.jsx("span",{className:"muted small",children:"Outer loop ends when this loop passes"})]}),s.jsxs("label",{className:"pl-max",children:[s.jsx("span",{className:"muted small",children:"Max iterations"}),s.jsx("input",{className:"input",type:"number",min:1,max:fl,step:1,value:t.maxIterations??"","aria-label":`Maximum iterations of ${h}`,onChange:d=>o(f=>Gm(f,n,{maxIterations:d.target.value===""?null:Math.max(1,Math.min(fl,Math.round(Number(d.target.value))))}))})]}),s.jsxs("label",{className:"pl-max",children:[s.jsx("span",{className:"muted small",children:"Ends when"}),s.jsxs("select",{className:"input",value:t.endsWhen,"aria-label":`When ${h} ends`,onChange:d=>o(f=>Gm(f,n,{endsWhen:d.target.value})),children:[s.jsx("option",{value:"first",children:"first entry passes"}),s.jsx("option",{value:"last",children:"last entry passes"})]})]}),s.jsx(Pj,{tree:e,path:n,count:r,label:h})]}),s.jsxs("div",{className:"pl-loop-body",children:[t.steps.map((d,f)=>s.jsxs("div",{className:"pl-item",children:[s.jsx(co,{tree:e,target:{parent:n,index:f},inner:!0}),s.jsx(Tj,{tree:e,block:d,path:[...n,f],siblings:t.steps.length,parentEndsWhen:t.endsWhen})]},d.uid)),s.jsx(co,{tree:e,target:{parent:n,index:t.steps.length},inner:!0,empty:t.steps.length===0}),s.jsxs("div",{className:"pl-loop-foot muted small",children:[s.jsx(ls,{size:12})," repeats up to ",t.maxIterations??"?"," time",t.maxIterations===1?"":"s"]})]})]})}function co({tree:e,target:t,inner:n,empty:r}){const{blocks:i,drag:l,drop:a}=e,[o,u]=j.useState(!1),c=l!==null&&Nj(i,l,t);return s.jsx("div",{className:`pl-gap ${n?"inner":""} ${r?"empty":""} ${c?"active":""} ${o&&c?"over":""}`,onDragOver:h=>{c&&(h.preventDefault(),h.stopPropagation(),h.dataTransfer.dropEffect=l.from==="palette"||l.from==="palette-loop"?"copy":"move",o||u(!0))},onDragLeave:()=>u(!1),onDrop:h=>{h.preventDefault(),h.stopPropagation(),u(!1),a(t)},children:r?s.jsx("span",{className:"muted small",children:n?"Drop agents or a loop here to repeat them":"Drag agents or a loop here"}):s.jsx("span",{className:"pl-arrow",children:"↓"})})}function Pj({tree:e,path:t,count:n,label:r}){const{setBlocks:i}=e,l=t[t.length-1];return s.jsxs("span",{className:"pl-actions",children:[s.jsx("button",{className:"btn ghost sm icon","aria-label":`Move ${r} up`,disabled:l===0,onClick:()=>i(a=>qm(a,t,-1)),children:"↑"}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Move ${r} down`,disabled:l===n-1,onClick:()=>i(a=>qm(a,t,1)),children:"↓"}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Remove ${r}`,onClick:()=>i(a=>gA(a,t)),children:s.jsx(wr,{size:13})})]})}const vA=[{id:"1",label:"24 h"},{id:"7",label:"7 days"},{id:"30",label:"30 days"},{id:"90",label:"90 days"}],ur=e=>e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens,Pn=(e,t)=>e.trackedRuns?ln(t):"—";function jA(e){const t=new Map(e.byDay.map(i=>[i.day,i])),n=[],r=new Date;for(let i=Math.max(e.days,1)-1;i>=0;i--){const l=new Date(r.getTime()-i*864e5).toISOString().slice(0,10);n.push(t.get(l)??{day:l,runs:0,trackedRuns:0,costUsd:0,turns:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0})}return n}function wA(e){if(e<=0)return 1;const t=10**Math.floor(Math.log10(e));return([1,2,2.5,5,10].find(n=>n*t>=e)??10)*t}const Ti=e=>new Date(`${e}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"});function kA({report:e}){const t=jA(e),n=wA(Math.max(...t.map(r=>r.costUsd)));return s.jsxs("div",{children:[s.jsxs("div",{className:"usage-chart",role:"img","aria-label":`Estimated cost per day over the last ${e.days} days`,children:[[.5,1].map(r=>s.jsx("div",{className:"usage-chart-gridline",style:{bottom:`${r*100}%`},children:s.jsx("span",{children:Kt(n*r)})},r)),t.map(r=>s.jsxs("div",{className:`bar-col ${r.costUsd?"":"zero"}`,tabIndex:0,"aria-label":`${Ti(r.day)}: ${Kt(r.costUsd)}, ${r.runs} runs`,children:[s.jsx("i",{style:{height:`${Math.max(r.costUsd/n*100,r.costUsd?2:0)}%`}}),s.jsxs("span",{className:"tip",children:[s.jsx("b",{children:Ti(r.day)})," · ",Kt(r.costUsd),s.jsx("br",{}),r.runs," run",r.runs===1?"":"s"," · ",ln(ur(r))," in / ",ln(r.outputTokens)," out"]})]},r.day))]}),s.jsxs("div",{className:"usage-axis",children:[s.jsx("span",{children:Ti(t[0].day)}),t.length>2&&s.jsx("span",{children:Ti(t[Math.floor(t.length/2)].day)}),s.jsx("span",{children:Ti(t[t.length-1].day)})]})]})}function ua({icon:e,label:t,value:n,sub:r}){return s.jsxs("div",{className:"stat",children:[s.jsxs("div",{className:"stat-head",children:[s.jsx("span",{children:t}),s.jsx("span",{className:"stat-icon",children:e})]}),s.jsx("div",{className:"stat-value",children:n}),r&&s.jsx("div",{className:"muted small",children:r})]})}function Wu({title:e,rows:t,name:n,total:r}){return s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-head",children:s.jsx("h3",{children:e})}),t.length===0?s.jsx("p",{className:"muted pad",children:"No runs in this range."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Name"}),s.jsx("th",{className:"num",children:"Runs"}),s.jsx("th",{className:"num",children:"Tokens in"}),s.jsx("th",{className:"num",children:"Tokens out"}),s.jsx("th",{className:"num",children:"Est. cost"}),s.jsx("th",{children:"Share"})]})}),s.jsx("tbody",{children:t.map((i,l)=>s.jsxs("tr",{children:[s.jsx("td",{children:n(i)}),s.jsx("td",{className:"num",children:i.runs}),s.jsx("td",{className:"num",children:Pn(i,ur(i))}),s.jsx("td",{className:"num",children:Pn(i,i.outputTokens)}),s.jsx("td",{className:"num",children:Kt(i.costUsd)}),s.jsx("td",{children:s.jsx("div",{className:"share-bar",title:`${r?Math.round(i.costUsd/r*100):0}% of cost`,children:s.jsx("i",{style:{width:`${r?i.costUsd/r*100:0}%`}})})})]},l))})]})})]})}const Rj="qa-studio.usage.recentView";function bA(){try{return localStorage.getItem(Rj)==="jobs"?"jobs":"runs"}catch{return"runs"}}function SA({job:e}){return s.jsxs(s.Fragment,{children:[s.jsxs(ye,{to:`/runs/${e.jobId}`,children:["#",e.jobId," ",br[e.jobType]??e.jobType]}),s.jsx("div",{className:"muted small",children:e.name??e.target})]})}function NA({jobs:e}){const[t,n]=j.useState(()=>new Set),r=l=>n(a=>{const o=new Set(a);return o.has(l)?o.delete(l):o.add(l),o}),i=e.length>0&&e.every(l=>t.has(l.jobId));return e.length===0?s.jsx("p",{className:"muted pad",children:"No runs in this range."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"flat usage-jobs",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:s.jsx("button",{className:"btn ghost sm",onClick:()=>n(i?new Set:new Set(e.map(l=>l.jobId))),children:i?"Collapse all":"Expand all"})}),s.jsx("th",{children:"Agents"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Model"}),s.jsx("th",{className:"num",children:"Turns"}),s.jsx("th",{className:"num",children:"Tokens in"}),s.jsx("th",{className:"num",children:"Tokens out"}),s.jsx("th",{className:"num",children:"Est. cost"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:e.map(l=>{const a=t.has(l.jobId),o=[...new Set(l.agentRuns.map(u=>u.model).filter(Boolean))];return s.jsxs(j.Fragment,{children:[s.jsxs("tr",{className:"usage-job-row",children:[s.jsx("td",{children:s.jsxs("span",{className:"usage-job-cell",children:[s.jsx("button",{className:"usage-expand",onClick:()=>r(l.jobId),"aria-expanded":a,"aria-label":`${a?"Hide":"Show"} the LLM runs of job #${l.jobId}`,children:s.jsx(ti,{size:12,open:a})}),s.jsx("span",{children:s.jsx(SA,{job:l})})]})}),s.jsx("td",{children:s.jsxs("span",{className:"usage-agent-icons",title:l.agentRuns.map(u=>{var c;return((c=Ne[u.agent])==null?void 0:c.label)??u.agent}).join(" → "),children:[l.agentRuns.slice(0,6).map(u=>s.jsx(Ft,{agent:u.agent,size:20},u.runId)),s.jsxs("span",{className:"muted small",children:[l.runs," run",l.runs===1?"":"s"]})]})}),s.jsx("td",{children:s.jsx(An,{status:l.status})}),s.jsx("td",{children:o.length?o.map(u=>s.jsx("code",{children:u},u)):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:l.turns}),s.jsx("td",{className:"num",children:Pn(l,ur(l))}),s.jsx("td",{className:"num",children:Pn(l,l.outputTokens)}),s.jsx("td",{className:"num strong",children:Kt(l.costUsd)}),s.jsx("td",{className:"small",children:Rt(l.at)})]}),a&&l.agentRuns.map(u=>{var c;return s.jsxs("tr",{className:"usage-sub-row",children:[s.jsx("td",{children:s.jsxs("span",{className:"usage-sub-name",children:[s.jsx(Ft,{agent:u.agent,size:20})," ",((c=Ne[u.agent])==null?void 0:c.label)??u.agent]})}),s.jsxs("td",{className:"muted small",children:["run #",u.runId]}),s.jsx("td",{children:s.jsx(An,{status:u.status})}),s.jsx("td",{children:u.model?s.jsx("code",{children:u.model}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:u.turns}),s.jsx("td",{className:"num",children:Pn(u,ur(u))}),s.jsx("td",{className:"num",children:Pn(u,u.outputTokens)}),s.jsx("td",{className:"num",children:Kt(u.costUsd)}),s.jsx("td",{className:"small",children:Rt(u.at)})]},u.runId)})]},l.jobId)})})]})})}function CA(){const[e,t]=j.useState(bA),n=d=>{t(d);try{localStorage.setItem(Rj,d)}catch{}},[r,i]=j.useState("30"),{data:l,error:a,reload:o}=_e(()=>q.usage(Number(r)),[r]),u=l==null?void 0:l.totals,c=u&&ur(u)?Math.round(u.cacheReadTokens/ur(u)*100):0,h=u?u.runs-u.trackedRuns:0;return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Claude usage"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Claude usage"}),s.jsxs("p",{className:"page-sub",children:["Tokens and estimated cost of the Claude Code agents run by Agent Studio (QA Explorer, QA Script Generator, QA Script Healer, QA Test Case Writer, Context Writer). The cost is Claude Code's API-price estimate. On a Claude subscription, check plan limits with ",s.jsx("code",{children:"/usage"})," in Claude Code."]})]}),s.jsxs("div",{className:"row",children:[s.jsx(kn,{value:r,onChange:i,items:vA}),s.jsx("button",{className:"btn ghost",onClick:o,title:"Refresh","aria-label":"Refresh",children:s.jsx(Lr,{size:15})})]})]}),s.jsx(Le,{error:a}),l&&u&&s.jsxs(s.Fragment,{children:[h>0&&s.jsxs("div",{className:"warn-box",style:{marginBottom:14},children:[h," of ",u.runs," runs in this range were recorded before token tracking was added: they count toward cost and runs, but their tokens show as —."]}),s.jsxs("div",{className:"stats usage-stats",children:[s.jsx(ua,{icon:s.jsx(My,{size:16}),label:"Estimated cost",value:Kt(u.costUsd),sub:`${u.runs?Kt(u.costUsd/u.runs):"—"} per run`}),s.jsx(ua,{icon:s.jsx(Dy,{size:16}),label:"LLM agent runs",value:u.runs,sub:`${u.turns.toLocaleString()} turns`}),s.jsx(ua,{icon:s.jsx(ft,{size:16}),label:"Tokens in",value:Pn(u,ur(u)),sub:u.trackedRuns?`${c}% served from cache`:"No token data yet"}),s.jsx(ua,{icon:s.jsx(ft,{size:16}),label:"Tokens out",value:Pn(u,u.outputTokens),sub:u.trackedRuns?`${ln(u.inputTokens)} uncached input`:"No token data yet"})]}),s.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[s.jsxs("div",{className:"row between",style:{marginBottom:18},children:[s.jsx("h3",{className:"card-title",children:"Estimated cost per day"}),s.jsxs("span",{className:"muted small",children:["Since ",new Date(l.since).toLocaleString("en-US",{hour12:!1})]})]}),s.jsx(kA,{report:l})]}),s.jsxs("div",{className:"overview-grid",style:{marginBottom:14},children:[s.jsx(Wu,{title:"By spec",rows:l.bySpec,total:u.costUsd,name:d=>d.target.endsWith(".md")?s.jsx(ye,{to:`/specs/${d.target}`,children:d.target}):d.target}),s.jsx(Wu,{title:"By agent",rows:l.byAgent,total:u.costUsd,name:d=>{var f;return s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,whiteSpace:"nowrap"},children:[s.jsx(Ft,{agent:d.agent,size:22})," ",((f=Ne[d.agent])==null?void 0:f.label)??d.agent]})}})]}),s.jsx("div",{style:{marginBottom:14},children:s.jsx(Wu,{title:"By model",rows:l.byModel,total:u.costUsd,name:d=>s.jsx("code",{children:d.model})})}),s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Recent LLM runs"}),s.jsx(kn,{value:e,onChange:n,items:[{id:"runs",label:"Runs"},{id:"jobs",label:"Group by job"}]})]}),e==="jobs"?s.jsx(NA,{jobs:l.recentJobs}):l.recent.length===0?s.jsx("p",{className:"muted pad",children:"No runs in this range. Usage is recorded for agent runs from this version of Agent Studio onward."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"flat",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Job"}),s.jsx("th",{children:"Agent"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Model"}),s.jsx("th",{className:"num",children:"Turns"}),s.jsx("th",{className:"num",children:"Tokens in"}),s.jsx("th",{className:"num",children:"Tokens out"}),s.jsx("th",{className:"num",children:"Est. cost"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:l.recent.map(d=>{var f;return s.jsxs("tr",{children:[s.jsxs("td",{children:[s.jsxs(ye,{to:`/runs/${d.jobId}`,children:["#",d.jobId," ",br[d.jobType]]}),s.jsx("div",{className:"muted small",children:d.target})]}),s.jsx("td",{children:((f=Ne[d.agent])==null?void 0:f.label)??d.agent}),s.jsx("td",{children:s.jsx(An,{status:d.status})}),s.jsx("td",{children:d.model?s.jsx("code",{children:d.model}):s.jsx("span",{className:"muted",children:"—"})}),s.jsx("td",{className:"num",children:d.turns}),s.jsx("td",{className:"num",children:Pn(d,ur(d))}),s.jsx("td",{className:"num",children:Pn(d,d.outputTokens)}),s.jsx("td",{className:"num",children:Kt(d.costUsd)}),s.jsx("td",{className:"small",children:Rt(d.at)})]},d.runId)})})]})})]})]})]})}const Pi=e=>`${e.spec}#${e.tcId}`;function EA(e){return e.target==="all"?"All tests":e.args.tcId?"1 TC":"Whole spec"}function TA({counts:e}){const t=Object.values(e).reduce((r,i)=>r+i,0);if(!t)return s.jsx("span",{className:"muted small",children:"—"});const n=["passed","flaky","failed","skipped"];return s.jsxs("span",{className:"row",style:{gap:8},children:[s.jsx("span",{className:"tr-progress",role:"img","aria-label":n.filter(r=>e[r]).map(r=>`${e[r]} ${r}`).join(", "),children:n.map(r=>e[r]?s.jsx("i",{className:r,style:{width:`${e[r]/t*100}%`},title:`${e[r]} ${r}`},r):null)}),s.jsxs("span",{className:"small",children:[e.passed??0,"/",t]})]})}function PA(){const e=ut(),t=Tl(),{data:n,error:r,reload:i}=_e(()=>q.testRuns({page:t.page,pageSize:t.pageSize}),[t.page,t.pageSize]),l=(n==null?void 0:n.items)??[],a=l.some(o=>o.status==="queued"||o.status==="running");return j.useEffect(()=>{if(!a)return;const o=setInterval(i,2e3);return()=>clearInterval(o)},[a,i]),s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Test runs"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Test runs"}),s.jsx("p",{className:"page-sub",children:"Pick test cases, name the run, execute it and review the results. Results use the line reporter; the Playwright HTML report is optional."})]}),s.jsxs(ye,{className:"btn",to:"/test-runs/new",children:[s.jsx(qt,{size:15})," New test run"]})]}),s.jsx(Le,{error:r}),s.jsxs("div",{className:"table-wrap",children:[s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Run"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Results"}),s.jsx("th",{className:"num",children:"Cases"}),s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Duration"}),s.jsx("th",{children:"Report"})]})}),s.jsx("tbody",{children:l.map(o=>s.jsxs("tr",{onClick:()=>e(`/runs/${o.id}`),style:{cursor:"pointer"},children:[s.jsxs("td",{children:[s.jsx("div",{className:"strong",children:o.args.name??`Test run #${o.id}`}),s.jsxs("div",{className:"muted small",children:["#",o.id,o.args.repeatEach&&o.args.repeatEach>1?` · ${o.args.repeatEach}×`:"",o.args.retries!==void 0?` · retries ${o.args.retries}`:""]})]}),s.jsx("td",{children:s.jsx(An,{status:o.status})}),s.jsx("td",{children:s.jsx(TA,{counts:o.counts})}),s.jsx("td",{className:"num",children:o.args.selection?o.caseCount:s.jsx("span",{className:"muted small",children:EA(o)})}),s.jsx("td",{className:"muted small",children:Rt(o.startedAt??o.createdAt)}),s.jsx("td",{className:"muted small",children:kr(o.startedAt,o.finishedAt)}),s.jsx("td",{onClick:u=>u.stopPropagation(),children:o.hasHtmlReport?s.jsxs("a",{className:"btn ghost",href:yh(o.id),target:"_blank",rel:"noreferrer",children:[s.jsx(Sh,{size:13})," HTML"]}):s.jsx("span",{className:"muted small",children:"line only"})})]},o.id))})]}),n&&l.length===0&&s.jsxs("p",{className:"muted",style:{padding:16},children:["No test runs yet. ",s.jsx(ye,{to:"/test-runs/new",children:"Create the first one"}),"."]}),n&&s.jsx(ps,{page:t.page,pageSize:t.pageSize,total:n.total,onPage:t.setPage,onPageSize:t.setPageSize,label:"runs"})]})]})}const RA=8;function LA({query:e,onQuery:t,tags:n,allTags:r,onToggleTag:i,onClearTags:l}){const[a,o]=j.useState(!1),[u,c]=j.useState(0),h=j.useRef(null),d=e.trim().toLowerCase().replace(/^#/,""),f=r.filter(w=>!n.has(w)&&(!d||w.toLowerCase().includes(d))).sort((w,x)=>+!w.toLowerCase().startsWith(d)-+!x.toLowerCase().startsWith(d)).slice(0,RA),m=a&&f.length>0&&(d.length>0||n.size===0||e==="");j.useEffect(()=>c(0),[d]);const p=w=>{var x;i(w),t(""),c(0),(x=h.current)==null||x.focus()},g=w=>{var x;w.key==="ArrowDown"&&m?(w.preventDefault(),c(y=>(y+1)%f.length)):w.key==="ArrowUp"&&m?(w.preventDefault(),c(y=>(y-1+f.length)%f.length)):w.key==="Enter"?(w.preventDefault(),m&&d&&p(f[u])):w.key==="Escape"?e?t(""):(x=h.current)==null||x.blur():w.key==="Backspace"&&e===""&&n.size>0&&i([...n][n.size-1])};return s.jsxs("div",{className:"tag-search grow",onClick:()=>{var w;return(w=h.current)==null?void 0:w.focus()},children:[s.jsx(Ro,{size:15}),[...n].map(w=>s.jsxs("span",{className:"tag-token",children:["#",w,s.jsx("button",{type:"button","aria-label":`Remove tag filter ${w}`,onClick:x=>{x.stopPropagation(),i(w)},children:s.jsx(wr,{size:11})})]},w)),s.jsx("input",{ref:h,className:"tag-search-input",placeholder:n.size?"Add text or another tag…":"Search TC-ID, title, spec or tag…",value:e,onChange:w=>t(w.target.value),onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:g,role:"combobox","aria-expanded":m,"aria-controls":"tag-suggestions","aria-activedescendant":m?`tag-opt-${u}`:void 0,"aria-label":"Search test cases or filter by tag"}),n.size>0&&s.jsx("button",{type:"button",className:"tag-search-clear",onClick:w=>{w.stopPropagation(),l()},title:"Clear tag filters","aria-label":"Clear tag filters",children:"Clear tags"}),m&&s.jsxs("ul",{id:"tag-suggestions",className:"tag-suggestions",role:"listbox","aria-label":"Tags",children:[s.jsx("li",{className:"tag-suggestions-head","aria-hidden":"true",children:"Filter by tag"}),f.map((w,x)=>s.jsxs("li",{id:`tag-opt-${x}`,role:"option","aria-selected":x===u,className:x===u?"active":"",onMouseEnter:()=>c(x),onMouseDown:y=>{y.preventDefault(),p(w)},children:["#",w]},w))]})]})}const AA=()=>`Test run ${new Date().toLocaleString("en-GB",{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}`;function IA(){var en;const e=ut(),n=Kn().state??null,{specs:r}=Zt(),i=_e(()=>q.settings()),[l,a]=j.useState((n==null?void 0:n.name)??AA()),[o,u]=j.useState(()=>new Map(((n==null?void 0:n.selection)??[]).map(ee=>[Pi(ee),ee]))),[c,h]=j.useState(""),d=nb(c.trim(),250),[f,m]=j.useState(""),[p,g]=j.useState(new Set),[w,x]=j.useState("all"),[y,v]=j.useState(!1),[b,E]=j.useState(1),[k,R]=j.useState((n==null?void 0:n.retries)??null),[T,D]=j.useState(null),[C,L]=j.useState(!1),[A,z]=j.useState(null),U=T??((en=i.data)==null?void 0:en.settings.htmlReport)??!1,I=[...p].sort(),Q=y?[...o.keys()].sort():null,J=Tl([],50),B=JSON.stringify([d,f,I,w,y]),[X,S]=j.useState(B),ae=B!==X;ae&&(S(B),J.page!==1&&J.setPage(1));const O=ae?1:J.page,N=_e(()=>q.searchTestCases({page:O,pageSize:J.pageSize,q:d,tags:I,spec:f,result:w,...Q?{selected:Q}:{}}),[O,J.pageSize,d,f,I.join("\0"),w,(Q==null?void 0:Q.join("\0"))??null]),F=N.data,Z=(F==null?void 0:F.items)??[],ce=(F==null?void 0:F.allTags)??[],Te=(F==null?void 0:F.matchingRunnable)??[],tt=Te.length>0&&Te.every(ee=>o.has(Pi(ee))),W=[...o.values()],ge=new Set(W.map(ee=>ee.spec)).size,V=ee=>u(Ce=>{const Ze=new Map(Ce),Mr=Pi(ee);return Ze.has(Mr)?Ze.delete(Mr):Ze.set(Mr,ee),Ze}),de=()=>u(ee=>{const Ce=new Map(ee);for(const Ze of Te)tt?Ce.delete(Pi(Ze)):Ce.set(Pi(Ze),Ze);return Ce}),ve=ee=>g(Ce=>{const Ze=new Set(Ce);return Ze.has(ee)?Ze.delete(ee):Ze.add(ee),Ze}),ct=async ee=>{if(ee.preventDefault(),!l.trim())return z("Give the test run a name.");if(!W.length)return z("Pick at least one test case that has a Playwright test.");if(W.length>Mp)return z(`A test run can have at most ${Mp} test cases.`);L(!0);try{const Ce=await q.createJob({type:"testrun",name:l.trim(),selection:W,repeatEach:b,...k!==null?{retries:k}:{},htmlReport:U});e(`/runs/${Ce.id}`)}catch(Ce){z(Ce.message),L(!1)}};return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Testing"},{label:"Test runs",to:"/test-runs"},{label:"New test run"}]}),s.jsx("div",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"New test run"}),s.jsx("p",{className:"page-sub",children:"Filter and pick test cases. Only test cases that have a Playwright test can be run."})]})}),s.jsxs("form",{className:"tr-layout",onSubmit:ct,children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"tr-filters",children:[s.jsx(LA,{query:c,onQuery:h,tags:p,allTags:ce,onToggleTag:ve,onClearTags:()=>g(new Set)}),s.jsxs("select",{className:"select",value:f,onChange:ee=>m(ee.target.value),"aria-label":"Spec",children:[s.jsx("option",{value:"",children:"All specs"}),r.map(ee=>s.jsx("option",{value:ee.file,children:ee.file},ee.file))]}),s.jsxs("select",{className:"select",value:w,onChange:ee=>x(ee.target.value),"aria-label":"Last result",children:[s.jsx("option",{value:"all",children:"Any last result"}),s.jsx("option",{value:"passed",children:"Last passed"}),s.jsx("option",{value:"failed",children:"Last failed"}),s.jsx("option",{value:"none",children:"Never run"})]}),s.jsxs("label",{className:"row small",style:{gap:6},children:[s.jsx("input",{type:"checkbox",checked:y,onChange:ee=>v(ee.target.checked)})," Selected only"]})]}),s.jsxs("div",{className:"table-wrap",style:{border:0},children:[s.jsxs("table",{className:"tr-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"check",children:s.jsx("input",{type:"checkbox",checked:tt,onChange:de,disabled:!Te.length,"aria-label":`Select all ${Te.length} filtered test cases`,title:`All ${Te.length} runnable test cases that match the filters (every page)`})}),s.jsx("th",{children:"Test case"}),s.jsx("th",{children:"Spec"}),s.jsx("th",{children:"Tags"}),s.jsx("th",{children:"Last result"})]})}),s.jsx("tbody",{children:Z.map(ee=>s.jsxs("tr",{className:`${ee.runnable?"":"disabled"} ${o.has(ee.key)?"picked":""}`,onClick:()=>ee.runnable&&V(ee.ref),style:{cursor:ee.runnable?"pointer":"default"},children:[s.jsx("td",{className:"check",onClick:Ce=>Ce.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:o.has(ee.key),disabled:!ee.runnable,onChange:()=>V(ee.ref),"aria-label":`Select ${ee.tcId}`})}),s.jsxs("td",{children:[s.jsx("code",{children:ee.tcId})," ",ee.tcTitle,!ee.runnable&&s.jsx("div",{className:"muted small",children:"No Playwright test yet: generate it first"})]}),s.jsx("td",{className:"small",children:s.jsx(ye,{to:`/specs/${ee.ref.spec}`,onClick:Ce=>Ce.stopPropagation(),children:ee.ref.spec})}),s.jsx("td",{children:s.jsx("span",{className:"row",style:{gap:4,flexWrap:"wrap"},children:ee.tags.map(Ce=>s.jsx("button",{type:"button",className:`tag tag-btn ${p.has(Ce)?"on":""}`,title:p.has(Ce)?`Remove the "${Ce}" filter`:`Filter by "${Ce}"`,onClick:Ze=>{Ze.stopPropagation(),ve(Ce)},children:Ce},Ce))})}),s.jsx("td",{children:ee.lastResult?s.jsx(ni,{status:ee.lastResult.status,title:Rt(ee.lastResult.at)}):s.jsx("span",{className:"muted small",children:"never"})})]},ee.key))})]}),s.jsx(Le,{error:N.error}),F&&Z.length===0&&s.jsx("p",{className:"muted",style:{padding:16},children:F.totalCases?"No test case matches the filters.":"No test cases yet: add a spec first."}),!F&&!N.error&&s.jsx("p",{className:"muted",style:{padding:16},children:"Loading test cases…"}),F&&s.jsx(ps,{page:O,pageSize:J.pageSize,total:F.total,onPage:J.setPage,onPageSize:J.setPageSize,label:"test cases"})]})]}),s.jsx("div",{className:"tr-side",children:s.jsxs("div",{className:"card pad",style:{display:"grid",gap:12},children:[s.jsxs("label",{children:["Run name",s.jsx("input",{className:"input",value:l,maxLength:vb,onChange:ee=>a(ee.target.value)})]}),s.jsxs("label",{children:["Repeat each test",s.jsx("select",{className:"select",value:b,onChange:ee=>E(Number(ee.target.value)),children:[1,2,3,5,10].map(ee=>s.jsxs("option",{value:ee,children:[ee,"×"]},ee))})]}),s.jsxs("label",{children:["Retries on failure",s.jsxs("select",{className:"select",value:k??"",onChange:ee=>R(ee.target.value===""?null:Number(ee.target.value)),children:[s.jsx("option",{value:"",children:"Default (playwright.config.ts)"}),Array.from({length:yb+1},(ee,Ce)=>s.jsx("option",{value:Ce,children:Ce===0?"No retries":`${Ce} ${Ce===1?"retry":"retries"}`},Ce))]}),s.jsx("div",{className:"muted small",children:"A test that fails and then passes on a retry is reported as flaky."})]}),s.jsxs("div",{className:"row between",children:[s.jsxs("span",{style:{fontSize:13,fontWeight:600},children:["HTML report",s.jsx("div",{className:"muted small",style:{fontWeight:400},children:"Line report is always on"})]}),s.jsxs("label",{className:"switch",children:[s.jsx("input",{type:"checkbox",checked:U,onChange:ee=>D(ee.target.checked),"aria-label":"Also write the Playwright HTML report"}),s.jsx("span",{children:U?"On":"Off"})]})]}),s.jsxs("div",{className:"muted small",children:[s.jsx("b",{style:{color:"var(--text)"},children:W.length})," test case",W.length===1?"":"s"," selected from ",ge," spec",ge===1?"":"s",o.size>0&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{type:"button",className:"link-btn",onClick:()=>u(new Map),children:"clear"})]})]}),s.jsx(Le,{error:A}),s.jsxs("button",{type:"submit",className:"btn",disabled:C||!W.length,children:[s.jsx(ft,{size:14})," ",C?"Starting…":"Create & run"]})]})})]})]})}const DA=A0([{element:s.jsx(eS,{}),children:[{path:"/",element:s.jsx(HT,{})},{path:"/chat/:id?",element:s.jsx(tA,{})},{path:"/specs",element:s.jsx(ZT,{})},{path:"/specs/from-requirement",element:s.jsx(YT,{})},{path:"/specs/:file",element:s.jsx(oP,{})},{path:"/mapping",element:s.jsx(BT,{})},{path:"/runs",element:s.jsx(JT,{})},{path:"/runs/:id",element:s.jsx(TT,{})},{path:"/agents",element:s.jsx(mP,{})},{path:"/agents/custom/new",element:s.jsx(Qm,{},"new")},{path:"/agents/custom/:id",element:s.jsx(Qm,{})},{path:"/agents/:agent",element:s.jsx(oA,{})},{path:"/agents/pipelines/new",element:s.jsx(Km,{},"new")},{path:"/agents/pipelines/:id",element:s.jsx(Km,{})},{path:"/usage",element:s.jsx(CA,{})},{path:"/test-runs",element:s.jsx(PA,{})},{path:"/test-runs/new",element:s.jsx(IA,{})},{path:"/project",element:s.jsx(VT,{})},{path:"/project/reset",element:s.jsx(qT,{})},{path:"/settings",element:s.jsx(fP,{})},{path:"*",element:s.jsx("p",{children:"Page not found."})}]}],{future:{v7_relativeSplatPath:!0,v7_fetcherPersist:!0,v7_normalizeFormMethod:!0,v7_partialHydration:!0,v7_skipActionErrorRevalidation:!0}});"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>console.warn("Service worker registration failed",e))});uy(document.getElementById("root")).render(s.jsx(j.StrictMode,{children:s.jsx(F0,{router:DA,future:{v7_startTransition:!0}})}));