@nickduy/agent-studio 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.mjs +1 -1
- package/package.json +1 -1
- package/web/assets/index-Diuxmi__.js +417 -0
- package/web/assets/index-DxhzRQDF.css +1 -0
- package/web/index.html +3 -3
- package/web/assets/index-BalnEIdq.css +0 -1
- package/web/assets/index-BvXh5Y31.js +0 -419
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
function rg(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 yd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sg={exports:{}},po={},ig={exports:{}},be={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var gl=Symbol.for("react.element"),Vj=Symbol.for("react.portal"),Qj=Symbol.for("react.fragment"),qj=Symbol.for("react.strict_mode"),Gj=Symbol.for("react.profiler"),Kj=Symbol.for("react.provider"),Yj=Symbol.for("react.context"),Jj=Symbol.for("react.forward_ref"),Xj=Symbol.for("react.suspense"),Zj=Symbol.for("react.memo"),ew=Symbol.for("react.lazy"),uf=Symbol.iterator;function tw(e){return e===null||typeof e!="object"?null:(e=uf&&e[uf]||e["@@iterator"],typeof e=="function"?e:null)}var lg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ag=Object.assign,og={};function si(e,t,n){this.props=e,this.context=t,this.refs=og,this.updater=n||lg}si.prototype.isReactComponent={};si.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")};si.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ug(){}ug.prototype=si.prototype;function vd(e,t,n){this.props=e,this.context=t,this.refs=og,this.updater=n||lg}var jd=vd.prototype=new ug;jd.constructor=vd;ag(jd,si.prototype);jd.isPureReactComponent=!0;var cf=Array.isArray,cg=Object.prototype.hasOwnProperty,wd={current:null},dg={key:!0,ref:!0,__self:!0,__source:!0};function hg(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)cg.call(t,r)&&!dg.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:wd.current}}function nw(e,t){return{$$typeof:gl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function kd(e){return typeof e=="object"&&e!==null&&e.$$typeof===gl}function rw(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var df=/\/+/g;function Go(e,t){return typeof e=="object"&&e!==null&&e.key!=null?rw(""+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 gl:case Vj:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Go(a,0):r,cf(i)?(n="",e!=null&&(n=e.replace(df,"$&/")+"/"),da(i,t,n,"",function(c){return c})):i!=null&&(kd(i)&&(i=nw(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(df,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",cf(e))for(var o=0;o<e.length;o++){l=e[o];var u=r+Go(l,o);a+=da(l,t,n,u,i)}else if(u=tw(e),typeof u=="function")for(e=u.call(e),o=0;!(l=e.next()).done;)l=l.value,u=r+Go(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 sw(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},ha={transition:null},iw={ReactCurrentDispatcher:Lt,ReactCurrentBatchConfig:ha,ReactCurrentOwner:wd};function fg(){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(!kd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};be.Component=si;be.Fragment=Qj;be.Profiler=Gj;be.PureComponent=vd;be.StrictMode=qj;be.Suspense=Xj;be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=iw;be.act=fg;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=ag({},e.props),i=e.key,l=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(l=t.ref,a=wd.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)cg.call(t,u)&&!dg.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:Yj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Kj,_context:e},e.Consumer=e};be.createElement=hg;be.createFactory=function(e){var t=hg.bind(null,e);return t.type=e,t};be.createRef=function(){return{current:null}};be.forwardRef=function(e){return{$$typeof:Jj,render:e}};be.isValidElement=kd;be.lazy=function(e){return{$$typeof:ew,_payload:{_status:-1,_result:e},_init:sw}};be.memo=function(e,t){return{$$typeof:Zj,type:e,compare:t===void 0?null:t}};be.startTransition=function(e){var t=ha.transition;ha.transition={};try{e()}finally{ha.transition=t}};be.unstable_act=fg;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";ig.exports=be;var j=ig.exports;const lw=yd(j),aw=rg({__proto__:null,default:lw},[j]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ow=j,uw=Symbol.for("react.element"),cw=Symbol.for("react.fragment"),dw=Object.prototype.hasOwnProperty,hw=ow.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fw={key:!0,ref:!0,__self:!0,__source:!0};function pg(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)dw.call(t,r)&&!fw.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:uw,type:e,key:l,ref:a,props:i,_owner:hw.current}}po.Fragment=cw;po.jsx=pg;po.jsxs=pg;sg.exports=po;var s=sg.exports,mg={exports:{}},Jt={},gg={exports:{}},xg={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(B,Y){var N=B.length;B.push(Y);e:for(;0<N;){var ae=N-1>>>1,O=B[ae];if(0<i(O,Y))B[ae]=Y,B[N]=O,N=ae;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var Y=B[0],N=B.pop();if(N!==Y){B[0]=N;e:for(var ae=0,O=B.length,E=O>>>1;ae<E;){var F=2*(ae+1)-1,J=B[F],ce=F+1,Te=B[ce];if(0>i(J,N))ce<O&&0>i(Te,J)?(B[ae]=Te,B[ce]=N,ae=ce):(B[ae]=J,B[F]=N,ae=F);else if(ce<O&&0>i(Te,N))B[ae]=Te,B[ce]=N,ae=ce;else break e}}return Y}function i(B,Y){var N=B.sortIndex-Y.sortIndex;return N!==0?N:B.id-Y.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,p=3,m=!1,f=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,x=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 Y=n(c);Y!==null;){if(Y.callback===null)r(c);else if(Y.startTime<=B)r(c),Y.sortIndex=Y.expirationTime,t(u,Y);else break;Y=n(c)}}function b(B){if(g=!1,v(B),!f)if(n(u)!==null)f=!0,ie(A);else{var Y=n(c);Y!==null&&X(b,Y.startTime-B)}}function A(B,Y){f=!1,g&&(g=!1,y(P),P=-1),m=!0;var N=p;try{for(v(Y),d=n(u);d!==null&&(!(d.expirationTime>Y)||B&&!L());){var ae=d.callback;if(typeof ae=="function"){d.callback=null,p=d.priorityLevel;var O=ae(d.expirationTime<=Y);Y=e.unstable_now(),typeof O=="function"?d.callback=O:d===n(u)&&r(u),v(Y)}else r(u);d=n(u)}if(d!==null)var E=!0;else{var F=n(c);F!==null&&X(b,F.startTime-Y),E=!1}return E}finally{d=null,p=N,m=!1}}var k=!1,T=null,P=-1,I=5,C=-1;function L(){return!(e.unstable_now()-C<I)}function S(){if(T!==null){var B=e.unstable_now();C=B;var Y=!0;try{Y=T(!0,B)}finally{Y?D():(k=!1,T=null)}}else k=!1}var D;if(typeof x=="function")D=function(){x(S)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,U=M.port2;M.port1.onmessage=S,D=function(){U.postMessage(null)}}else D=function(){w(S,0)};function ie(B){T=B,k||(k=!0,D())}function X(B,Y){P=w(function(){B(e.unstable_now())},Y)}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(){f||m||(f=!0,ie(A))},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"):I=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(B){switch(p){case 1:case 2:case 3:var Y=3;break;default:Y=p}var N=p;p=Y;try{return B()}finally{p=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,Y){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var N=p;p=B;try{return Y()}finally{p=N}},e.unstable_scheduleCallback=function(B,Y,N){var ae=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?ae+N:ae):N=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=N+O,B={id:h++,callback:Y,priorityLevel:B,startTime:N,expirationTime:O,sortIndex:-1},N>ae?(B.sortIndex=N,t(c,B),n(u)===null&&B===n(c)&&(g?(y(P),P=-1):g=!0,X(b,N-ae))):(B.sortIndex=O,t(u,B),f||m||(f=!0,ie(A))),B},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(B){var Y=p;return function(){var N=p;p=Y;try{return B.apply(this,arguments)}finally{p=N}}}})(xg);gg.exports=xg;var pw=gg.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var mw=j,Yt=pw;function G(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 yg=new Set,Gi={};function us(e,t){Qs(e,t),Qs(e+"Capture",t)}function Qs(e,t){for(Gi[e]=t,e=0;e<t.length;e++)yg.add(t[e])}var Hn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gu=Object.prototype.hasOwnProperty,gw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,hf={},ff={};function xw(e){return Gu.call(ff,e)?!0:Gu.call(hf,e)?!1:gw.test(e)?ff[e]=!0:(hf[e]=!0,!1)}function yw(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 vw(e,t,n,r){if(t===null||typeof t>"u"||yw(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 bd=/[\-:]([a-z])/g;function Sd(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(bd,Sd);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(bd,Sd);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(bd,Sd);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 Nd(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")&&(vw(t,n,i,r)&&(n=null),r||i===null?xw(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 Gn=mw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_l=Symbol.for("react.element"),Cs=Symbol.for("react.portal"),Es=Symbol.for("react.fragment"),Cd=Symbol.for("react.strict_mode"),Ku=Symbol.for("react.profiler"),vg=Symbol.for("react.provider"),jg=Symbol.for("react.context"),Ed=Symbol.for("react.forward_ref"),Yu=Symbol.for("react.suspense"),Ju=Symbol.for("react.suspense_list"),Td=Symbol.for("react.memo"),sr=Symbol.for("react.lazy"),wg=Symbol.for("react.offscreen"),pf=Symbol.iterator;function pi(e){return e===null||typeof e!="object"?null:(e=pf&&e[pf]||e["@@iterator"],typeof e=="function"?e:null)}var Ke=Object.assign,Ko;function Ri(e){if(Ko===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ko=t&&t[1]||""}return`
|
|
34
|
+
`+Ko+e}var Yo=!1;function Jo(e,t){if(!e||Yo)return"";Yo=!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
|
+
`),l=r.stack.split(`
|
|
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{Yo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ri(e):""}function jw(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=Jo(e.type,!1),e;case 11:return e=Jo(e.type.render,!1),e;case 1:return e=Jo(e.type,!0),e;default:return""}}function Xu(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 Es:return"Fragment";case Cs:return"Portal";case Ku:return"Profiler";case Cd:return"StrictMode";case Yu:return"Suspense";case Ju:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jg:return(e.displayName||"Context")+".Consumer";case vg:return(e._context.displayName||"Context")+".Provider";case Ed:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Td:return t=e.displayName||null,t!==null?t:Xu(e.type)||"Memo";case sr:t=e._payload,e=e._init;try{return Xu(e(t))}catch{}}return null}function ww(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 Xu(t);case 8:return t===Cd?"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 jr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kw(e){var t=kg(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=kw(e))}function bg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=kg(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pa(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 Zu(e,t){var n=t.checked;return Ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=jr(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 Sg(e,t){t=t.checked,t!=null&&Nd(e,"checked",t,!1)}function ec(e,t){Sg(e,t);var n=jr(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")?tc(e,t.type,n):t.hasOwnProperty("defaultValue")&&tc(e,t.type,jr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gf(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 tc(e,t,n){(t!=="number"||Pa(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Li=Array.isArray;function Os(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=""+jr(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 nc(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(G(91));return Ke({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function xf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(G(92));if(Li(n)){if(1<n.length)throw Error(G(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:jr(n)}}function Ng(e,t){var n=jr(t.value),r=jr(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 yf(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Cg(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 rc(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Cg(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fl,Eg=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 zi={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},bw=["Webkit","ms","Moz","O"];Object.keys(zi).forEach(function(e){bw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zi[t]=zi[e]})});function Tg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||zi.hasOwnProperty(e)&&zi[e]?(""+t).trim():t+"px"}function Pg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Tg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Sw=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 sc(e,t){if(t){if(Sw[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(G(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(G(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(G(61))}if(t.style!=null&&typeof t.style!="object")throw Error(G(62))}}function ic(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 lc=null;function Pd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ac=null,Fs=null,Us=null;function vf(e){if(e=vl(e)){if(typeof ac!="function")throw Error(G(280));var t=e.stateNode;t&&(t=vo(t),ac(e.stateNode,e.type,t))}}function Rg(e){Fs?Us?Us.push(e):Us=[e]:Fs=e}function Lg(){if(Fs){var e=Fs,t=Us;if(Us=Fs=null,vf(e),t)for(e=0;e<t.length;e++)vf(t[e])}}function Ag(e,t){return e(t)}function Ig(){}var Xo=!1;function Dg(e,t,n){if(Xo)return e(t,n);Xo=!0;try{return Ag(e,t,n)}finally{Xo=!1,(Fs!==null||Us!==null)&&(Ig(),Lg())}}function Yi(e,t){var n=e.stateNode;if(n===null)return null;var r=vo(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(G(231,t,typeof n));return n}var oc=!1;if(Hn)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){oc=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{oc=!1}function Nw(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 Mi=!1,Ra=null,La=!1,uc=null,Cw={onError:function(e){Mi=!0,Ra=e}};function Ew(e,t,n,r,i,l,a,o,u){Mi=!1,Ra=null,Nw.apply(Cw,arguments)}function Tw(e,t,n,r,i,l,a,o,u){if(Ew.apply(this,arguments),Mi){if(Mi){var c=Ra;Mi=!1,Ra=null}else throw Error(G(198));La||(La=!0,uc=c)}}function cs(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 zg(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 jf(e){if(cs(e)!==e)throw Error(G(188))}function Pw(e){var t=e.alternate;if(!t){if(t=cs(e),t===null)throw Error(G(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 jf(i),e;if(l===r)return jf(i),t;l=l.sibling}throw Error(G(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(G(189))}}if(n.alternate!==r)throw Error(G(190))}if(n.tag!==3)throw Error(G(188));return n.stateNode.current===n?e:t}function Mg(e){return e=Pw(e),e!==null?$g(e):null}function $g(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=$g(e);if(t!==null)return t;e=e.sibling}return null}var _g=Yt.unstable_scheduleCallback,wf=Yt.unstable_cancelCallback,Rw=Yt.unstable_shouldYield,Lw=Yt.unstable_requestPaint,et=Yt.unstable_now,Aw=Yt.unstable_getCurrentPriorityLevel,Rd=Yt.unstable_ImmediatePriority,Og=Yt.unstable_UserBlockingPriority,Aa=Yt.unstable_NormalPriority,Iw=Yt.unstable_LowPriority,Fg=Yt.unstable_IdlePriority,mo=null,Rn=null;function Dw(e){if(Rn&&typeof Rn.onCommitFiberRoot=="function")try{Rn.onCommitFiberRoot(mo,e,void 0,(e.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:$w,zw=Math.log,Mw=Math.LN2;function $w(e){return e>>>=0,e===0?32:31-(zw(e)/Mw|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 Ia(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-xn(t),i=1<<n,r|=e[n],t&=~i;return r}function _w(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 Ow(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,l=e.pendingLanes;0<l;){var a=31-xn(l),o=1<<a,u=i[a];u===-1?(!(o&n)||o&r)&&(i[a]=_w(o,t)):u<=t&&(e.expiredLanes|=o),l&=~o}}function cc(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ug(){var e=Ul;return Ul<<=1,!(Ul&4194240)&&(Ul=64),e}function Zo(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-xn(t),e[t]=n}function Fw(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-xn(n),l=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~l}}function Ld(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-xn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var ze=0;function Bg(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Hg,Ad,Wg,Vg,Qg,dc=!1,Hl=[],hr=null,fr=null,pr=null,Ji=new Map,Xi=new Map,lr=[],Uw="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 kf(e,t){switch(e){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":fr=null;break;case"mouseover":case"mouseout":pr=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&&Ad(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Bw(e,t,n,r,i){switch(t){case"focusin":return hr=gi(hr,e,t,n,r,i),!0;case"dragenter":return fr=gi(fr,e,t,n,r,i),!0;case"mouseover":return pr=gi(pr,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 qg(e){var t=qr(e.target);if(t!==null){var n=cs(t);if(n!==null){if(t=n.tag,t===13){if(t=zg(n),t!==null){e.blockedOn=t,Qg(e.priority,function(){Wg(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=hc(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);lc=r,n.target.dispatchEvent(r),lc=null}else return t=vl(n),t!==null&&Ad(t),e.blockedOn=n,!1;t.shift()}return!0}function bf(e,t,n){fa(e)&&n.delete(t)}function Hw(){dc=!1,hr!==null&&fa(hr)&&(hr=null),fr!==null&&fa(fr)&&(fr=null),pr!==null&&fa(pr)&&(pr=null),Ji.forEach(bf),Xi.forEach(bf)}function xi(e,t){e.blockedOn===t&&(e.blockedOn=null,dc||(dc=!0,Yt.unstable_scheduleCallback(Yt.unstable_NormalPriority,Hw)))}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(hr!==null&&xi(hr,e),fr!==null&&xi(fr,e),pr!==null&&xi(pr,e),Ji.forEach(t),Xi.forEach(t),n=0;n<lr.length;n++)r=lr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<lr.length&&(n=lr[0],n.blockedOn===null);)qg(n),n.blockedOn===null&&lr.shift()}var Bs=Gn.ReactCurrentBatchConfig,Da=!0;function Ww(e,t,n,r){var i=ze,l=Bs.transition;Bs.transition=null;try{ze=1,Id(e,t,n,r)}finally{ze=i,Bs.transition=l}}function Vw(e,t,n,r){var i=ze,l=Bs.transition;Bs.transition=null;try{ze=4,Id(e,t,n,r)}finally{ze=i,Bs.transition=l}}function Id(e,t,n,r){if(Da){var i=hc(e,t,n,r);if(i===null)uu(e,t,r,za,n),kf(e,r);else if(Bw(i,e,t,n,r))r.stopPropagation();else if(kf(e,r),t&4&&-1<Uw.indexOf(e)){for(;i!==null;){var l=vl(i);if(l!==null&&Hg(l),l=hc(e,t,n,r),l===null&&uu(e,t,r,za,n),l===i)break;i=l}i!==null&&r.stopPropagation()}else uu(e,t,r,null,n)}}var za=null;function hc(e,t,n,r){if(za=null,e=Pd(r),e=qr(e),e!==null)if(t=cs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=zg(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 za=e,null}function Gg(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(Aw()){case Rd:return 1;case Og:return 4;case Aa:case Iw:return 16;case Fg:return 536870912;default:return 16}default:return 16}}var or=null,Dd=null,pa=null;function Kg(){if(pa)return pa;var e,t=Dd,n=t.length,r,i="value"in or?or.value:or.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 Wl(){return!0}function Sf(){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:Sf,this.isPropagationStopped=Sf,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 ii={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=Xt(ii),yl=Ke({},ii,{view:0,detail:0}),Qw=Xt(yl),eu,tu,yi,go=Ke({},yl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Md,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"?(eu=e.screenX-yi.screenX,tu=e.screenY-yi.screenY):tu=eu=0,yi=e),eu)},movementY:function(e){return"movementY"in e?e.movementY:tu}}),Nf=Xt(go),qw=Ke({},go,{dataTransfer:0}),Gw=Xt(qw),Kw=Ke({},yl,{relatedTarget:0}),nu=Xt(Kw),Yw=Ke({},ii,{animationName:0,elapsedTime:0,pseudoElement:0}),Jw=Xt(Yw),Xw=Ke({},ii,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zw=Xt(Xw),e1=Ke({},ii,{data:0}),Cf=Xt(e1),t1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},n1={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"},r1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function s1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=r1[e])?!!t[e]:!1}function Md(){return s1}var i1=Ke({},yl,{key:function(e){if(e.key){var t=t1[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"?n1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Md,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}}),l1=Xt(i1),a1=Ke({},go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ef=Xt(a1),o1=Ke({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Md}),u1=Xt(o1),c1=Ke({},ii,{propertyName:0,elapsedTime:0,pseudoElement:0}),d1=Xt(c1),h1=Ke({},go,{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}),f1=Xt(h1),p1=[9,13,27,32],$d=Hn&&"CompositionEvent"in window,$i=null;Hn&&"documentMode"in document&&($i=document.documentMode);var m1=Hn&&"TextEvent"in window&&!$i,Yg=Hn&&(!$d||$i&&8<$i&&11>=$i),Tf=" ",Pf=!1;function Jg(e,t){switch(e){case"keyup":return p1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ts=!1;function g1(e,t){switch(e){case"compositionend":return Xg(t);case"keypress":return t.which!==32?null:(Pf=!0,Tf);case"textInput":return e=t.data,e===Tf&&Pf?null:e;default:return null}}function x1(e,t){if(Ts)return e==="compositionend"||!$d&&Jg(e,t)?(e=Kg(),pa=Dd=or=null,Ts=!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 Yg&&t.locale!=="ko"?null:t.data;default:return null}}var y1={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 Rf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!y1[e.type]:t==="textarea"}function Zg(e,t,n,r){Rg(r),t=Ma(t,"onChange"),0<t.length&&(n=new zd("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var _i=null,el=null;function v1(e){cx(e,0)}function xo(e){var t=Ls(e);if(bg(t))return e}function j1(e,t){if(e==="change")return t}var ex=!1;if(Hn){var ru;if(Hn){var su="oninput"in document;if(!su){var Lf=document.createElement("div");Lf.setAttribute("oninput","return;"),su=typeof Lf.oninput=="function"}ru=su}else ru=!1;ex=ru&&(!document.documentMode||9<document.documentMode)}function Af(){_i&&(_i.detachEvent("onpropertychange",tx),el=_i=null)}function tx(e){if(e.propertyName==="value"&&xo(el)){var t=[];Zg(t,el,e,Pd(e)),Dg(v1,t)}}function w1(e,t,n){e==="focusin"?(Af(),_i=t,el=n,_i.attachEvent("onpropertychange",tx)):e==="focusout"&&Af()}function k1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return xo(el)}function b1(e,t){if(e==="click")return xo(t)}function S1(e,t){if(e==="input"||e==="change")return xo(t)}function N1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wn=typeof Object.is=="function"?Object.is:N1;function tl(e,t){if(wn(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(!Gu.call(t,i)||!wn(e[i],t[i]))return!1}return!0}function If(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Df(e,t){var n=If(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=If(n)}}function nx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?nx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function rx(){for(var e=window,t=Pa();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pa(e.document)}return t}function _d(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 C1(e){var t=rx(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&nx(n.ownerDocument.documentElement,n)){if(r!==null&&_d(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=Df(n,l);var a=Df(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 E1=Hn&&"documentMode"in document&&11>=document.documentMode,Ps=null,fc=null,Oi=null,pc=!1;function zf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;pc||Ps==null||Ps!==Pa(r)||(r=Ps,"selectionStart"in r&&_d(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=Ma(fc,"onSelect"),0<r.length&&(t=new zd("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ps)))}function Vl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Rs={animationend:Vl("Animation","AnimationEnd"),animationiteration:Vl("Animation","AnimationIteration"),animationstart:Vl("Animation","AnimationStart"),transitionend:Vl("Transition","TransitionEnd")},iu={},sx={};Hn&&(sx=document.createElement("div").style,"AnimationEvent"in window||(delete Rs.animationend.animation,delete Rs.animationiteration.animation,delete Rs.animationstart.animation),"TransitionEvent"in window||delete Rs.transitionend.transition);function yo(e){if(iu[e])return iu[e];if(!Rs[e])return e;var t=Rs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in sx)return iu[e]=t[n];return e}var ix=yo("animationend"),lx=yo("animationiteration"),ax=yo("animationstart"),ox=yo("transitionend"),ux=new Map,Mf="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 Cr(e,t){ux.set(e,t),us(t,[e])}for(var lu=0;lu<Mf.length;lu++){var au=Mf[lu],T1=au.toLowerCase(),P1=au[0].toUpperCase()+au.slice(1);Cr(T1,"on"+P1)}Cr(ix,"onAnimationEnd");Cr(lx,"onAnimationIteration");Cr(ax,"onAnimationStart");Cr("dblclick","onDoubleClick");Cr("focusin","onFocus");Cr("focusout","onBlur");Cr(ox,"onTransitionEnd");Qs("onMouseEnter",["mouseout","mouseover"]);Qs("onMouseLeave",["mouseout","mouseover"]);Qs("onPointerEnter",["pointerout","pointerover"]);Qs("onPointerLeave",["pointerout","pointerover"]);us("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));us("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));us("onBeforeInput",["compositionend","keypress","textInput","paste"]);us("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));us("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));us("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var 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(" "),R1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ii));function $f(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Tw(r,t,void 0,e),e.currentTarget=null}function cx(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;$f(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;$f(i,o,c),l=u}}}if(La)throw e=uc,La=!1,uc=null,e}function He(e,t){var n=t[vc];n===void 0&&(n=t[vc]=new Set);var r=e+"__bubble";n.has(r)||(dx(t,e,2,!1),n.add(r))}function ou(e,t,n){var r=0;t&&(r|=4),dx(n,e,r,t)}var Ql="_reactListening"+Math.random().toString(36).slice(2);function nl(e){if(!e[Ql]){e[Ql]=!0,yg.forEach(function(n){n!=="selectionchange"&&(R1.has(n)||ou(n,!1,e),ou(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ql]||(t[Ql]=!0,ou("selectionchange",!1,t))}}function dx(e,t,n,r){switch(Gg(t)){case 1:var i=Ww;break;case 4:i=Vw;break;default:i=Id}n=i.bind(null,t,n,e),i=void 0,!oc||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 uu(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}Dg(function(){var c=l,h=Pd(n),d=[];e:{var p=ux.get(e);if(p!==void 0){var m=zd,f=e;switch(e){case"keypress":if(ma(n)===0)break e;case"keydown":case"keyup":m=l1;break;case"focusin":f="focus",m=nu;break;case"focusout":f="blur",m=nu;break;case"beforeblur":case"afterblur":m=nu;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=Nf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=Gw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=u1;break;case ix:case lx:case ax:m=Jw;break;case ox:m=d1;break;case"scroll":m=Qw;break;case"wheel":m=f1;break;case"copy":case"cut":case"paste":m=Zw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Ef}var g=(t&4)!==0,w=!g&&e==="scroll",y=g?p!==null?p+"Capture":null:p;g=[];for(var x=c,v;x!==null;){v=x;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,y!==null&&(b=Yi(x,y),b!=null&&g.push(rl(x,b,v)))),w)break;x=x.return}0<g.length&&(p=new m(p,f,null,n,h),d.push({event:p,listeners:g}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&n!==lc&&(f=n.relatedTarget||n.fromElement)&&(qr(f)||f[Wn]))break e;if((m||p)&&(p=h.window===h?h:(p=h.ownerDocument)?p.defaultView||p.parentWindow:window,m?(f=n.relatedTarget||n.toElement,m=c,f=f?qr(f):null,f!==null&&(w=cs(f),f!==w||f.tag!==5&&f.tag!==6)&&(f=null)):(m=null,f=c),m!==f)){if(g=Nf,b="onMouseLeave",y="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(g=Ef,b="onPointerLeave",y="onPointerEnter",x="pointer"),w=m==null?p:Ls(m),v=f==null?p:Ls(f),p=new g(b,x+"leave",m,n,h),p.target=w,p.relatedTarget=v,b=null,qr(h)===c&&(g=new g(y,x+"enter",f,n,h),g.target=v,g.relatedTarget=w,b=g),w=b,m&&f)t:{for(g=m,y=f,x=0,v=g;v;v=js(v))x++;for(v=0,b=y;b;b=js(b))v++;for(;0<x-v;)g=js(g),x--;for(;0<v-x;)y=js(y),v--;for(;x--;){if(g===y||y!==null&&g===y.alternate)break t;g=js(g),y=js(y)}g=null}else g=null;m!==null&&_f(d,p,m,g,!1),f!==null&&w!==null&&_f(d,w,f,g,!0)}}e:{if(p=c?Ls(c):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var A=j1;else if(Rf(p))if(ex)A=S1;else{A=k1;var k=w1}else(m=p.nodeName)&&m.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(A=b1);if(A&&(A=A(e,c))){Zg(d,A,n,h);break e}k&&k(e,p,c),e==="focusout"&&(k=p._wrapperState)&&k.controlled&&p.type==="number"&&tc(p,"number",p.value)}switch(k=c?Ls(c):window,e){case"focusin":(Rf(k)||k.contentEditable==="true")&&(Ps=k,fc=c,Oi=null);break;case"focusout":Oi=fc=Ps=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,zf(d,n,h);break;case"selectionchange":if(E1)break;case"keydown":case"keyup":zf(d,n,h)}var T;if($d)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Ts?Jg(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(Yg&&n.locale!=="ko"&&(Ts||P!=="onCompositionStart"?P==="onCompositionEnd"&&Ts&&(T=Kg()):(or=h,Dd="value"in or?or.value:or.textContent,Ts=!0)),k=Ma(c,P),0<k.length&&(P=new Cf(P,e,null,n,h),d.push({event:P,listeners:k}),T?P.data=T:(T=Xg(n),T!==null&&(P.data=T)))),(T=m1?g1(e,n):x1(e,n))&&(c=Ma(c,"onBeforeInput"),0<c.length&&(h=new Cf("onBeforeInput","beforeinput",null,n,h),d.push({event:h,listeners:c}),h.data=T))}cx(d,t)})}function rl(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=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 js(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function _f(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 L1=/\r\n?/g,A1=/\u0000|\uFFFD/g;function Of(e){return(typeof e=="string"?e:""+e).replace(L1,`
|
|
38
|
+
`).replace(A1,"")}function ql(e,t,n){if(t=Of(t),Of(e)!==t&&n)throw Error(G(425))}function $a(){}var mc=null,gc=null;function xc(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 yc=typeof setTimeout=="function"?setTimeout:void 0,I1=typeof clearTimeout=="function"?clearTimeout:void 0,Ff=typeof Promise=="function"?Promise:void 0,D1=typeof queueMicrotask=="function"?queueMicrotask:typeof Ff<"u"?function(e){return Ff.resolve(null).then(e).catch(z1)}:yc;function z1(e){setTimeout(function(){throw e})}function cu(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 mr(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 Uf(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 li=Math.random().toString(36).slice(2),Tn="__reactFiber$"+li,sl="__reactProps$"+li,Wn="__reactContainer$"+li,vc="__reactEvents$"+li,M1="__reactListeners$"+li,$1="__reactHandles$"+li;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=Uf(e);e!==null;){if(n=e[Tn])return n;e=Uf(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 Ls(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(G(33))}function vo(e){return e[sl]||null}var jc=[],As=-1;function Er(e){return{current:e}}function We(e){0>As||(e.current=jc[As],jc[As]=null,As--)}function Be(e,t){As++,jc[As]=e.current,e.current=t}var wr={},Et=Er(wr),$t=Er(!1),ts=wr;function qs(e,t){var n=e.type.contextTypes;if(!n)return wr;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(){We($t),We(Et)}function Bf(e,t,n){if(Et.current!==wr)throw Error(G(168));Be(Et,t),Be($t,n)}function hx(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(G(108,ww(e)||"Unknown",i));return Ke({},n,r)}function Oa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wr,ts=Et.current,Be(Et,e),Be($t,$t.current),!0}function Hf(e,t,n){var r=e.stateNode;if(!r)throw Error(G(169));n?(e=hx(e,t,ts),r.__reactInternalMemoizedMergedChildContext=e,We($t),We(Et),Be(Et,e)):We($t),Be($t,n)}var _n=null,jo=!1,du=!1;function fx(e){_n===null?_n=[e]:_n.push(e)}function _1(e){jo=!0,fx(e)}function Tr(){if(!du&&_n!==null){du=!0;var e=0,t=ze;try{var n=_n;for(ze=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}_n=null,jo=!1}catch(i){throw _n!==null&&(_n=_n.slice(e+1)),_g(Rd,Tr),i}finally{ze=t,du=!1}}return null}var Is=[],Ds=0,Fa=null,Ua=0,en=[],tn=0,ns=null,On=1,Fn="";function Br(e,t){Is[Ds++]=Ua,Is[Ds++]=Fa,Fa=e,Ua=t}function px(e,t,n){en[tn++]=On,en[tn++]=Fn,en[tn++]=ns,ns=e;var r=On;e=Fn;var i=32-xn(r)-1;r&=~(1<<i),n+=1;var l=32-xn(t)+i;if(30<l){var a=i-i%5;l=(r&(1<<a)-1).toString(32),r>>=a,i-=a,On=1<<32-xn(t)+i|n<<i|r,Fn=l+e}else On=1<<l|n<<i|r,Fn=e}function Od(e){e.return!==null&&(Br(e,1),px(e,1,0))}function Fd(e){for(;e===Fa;)Fa=Is[--Ds],Is[Ds]=null,Ua=Is[--Ds],Is[Ds]=null;for(;e===ns;)ns=en[--tn],en[tn]=null,Fn=en[--tn],en[tn]=null,On=en[--tn],en[tn]=null}var Gt=null,Qt=null,Qe=!1,gn=null;function mx(e,t){var n=rn(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 Wf(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=mr(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=ns!==null?{id:On,overflow:Fn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Gt=e,Qt=null,!0):!1;default:return!1}}function wc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function kc(e){if(Qe){var t=Qt;if(t){var n=t;if(!Wf(e,t)){if(wc(e))throw Error(G(418));t=mr(n.nextSibling);var r=Gt;t&&Wf(e,t)?mx(r,n):(e.flags=e.flags&-4097|2,Qe=!1,Gt=e)}}else{if(wc(e))throw Error(G(418));e.flags=e.flags&-4097|2,Qe=!1,Gt=e}}}function Vf(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 Vf(e),Qe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!xc(e.type,e.memoizedProps)),t&&(t=Qt)){if(wc(e))throw gx(),Error(G(418));for(;t;)mx(e,t),t=mr(t.nextSibling)}if(Vf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(G(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Qt=mr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Qt=null}}else Qt=Gt?mr(e.stateNode.nextSibling):null;return!0}function gx(){for(var e=Qt;e;)e=mr(e.nextSibling)}function Gs(){Qt=Gt=null,Qe=!1}function Ud(e){gn===null?gn=[e]:gn.push(e)}var O1=Gn.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(G(309));var r=n.stateNode}if(!r)throw Error(G(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(G(284));if(!n._owner)throw Error(G(290,e))}return e}function Kl(e,t){throw e=Object.prototype.toString.call(t),Error(G(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qf(e){var t=e._init;return t(e._payload)}function xx(e){function t(y,x){if(e){var v=y.deletions;v===null?(y.deletions=[x],y.flags|=16):v.push(x)}}function n(y,x){if(!e)return null;for(;x!==null;)t(y,x),x=x.sibling;return null}function r(y,x){for(y=new Map;x!==null;)x.key!==null?y.set(x.key,x):y.set(x.index,x),x=x.sibling;return y}function i(y,x){return y=vr(y,x),y.index=0,y.sibling=null,y}function l(y,x,v){return y.index=v,e?(v=y.alternate,v!==null?(v=v.index,v<x?(y.flags|=2,x):v):(y.flags|=2,x)):(y.flags|=1048576,x)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function o(y,x,v,b){return x===null||x.tag!==6?(x=yu(v,y.mode,b),x.return=y,x):(x=i(x,v),x.return=y,x)}function u(y,x,v,b){var A=v.type;return A===Es?h(y,x,v.props.children,b,v.key):x!==null&&(x.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===sr&&Qf(A)===x.type)?(b=i(x,v.props),b.ref=vi(y,x,v),b.return=y,b):(b=ka(v.type,v.key,v.props,null,y.mode,b),b.ref=vi(y,x,v),b.return=y,b)}function c(y,x,v,b){return x===null||x.tag!==4||x.stateNode.containerInfo!==v.containerInfo||x.stateNode.implementation!==v.implementation?(x=vu(v,y.mode,b),x.return=y,x):(x=i(x,v.children||[]),x.return=y,x)}function h(y,x,v,b,A){return x===null||x.tag!==7?(x=Zr(v,y.mode,b,A),x.return=y,x):(x=i(x,v),x.return=y,x)}function d(y,x,v){if(typeof x=="string"&&x!==""||typeof x=="number")return x=yu(""+x,y.mode,v),x.return=y,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case _l:return v=ka(x.type,x.key,x.props,null,y.mode,v),v.ref=vi(y,null,x),v.return=y,v;case Cs:return x=vu(x,y.mode,v),x.return=y,x;case sr:var b=x._init;return d(y,b(x._payload),v)}if(Li(x)||pi(x))return x=Zr(x,y.mode,v,null),x.return=y,x;Kl(y,x)}return null}function p(y,x,v,b){var A=x!==null?x.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return A!==null?null:o(y,x,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case _l:return v.key===A?u(y,x,v,b):null;case Cs:return v.key===A?c(y,x,v,b):null;case sr:return A=v._init,p(y,x,A(v._payload),b)}if(Li(v)||pi(v))return A!==null?null:h(y,x,v,b,null);Kl(y,v)}return null}function m(y,x,v,b,A){if(typeof b=="string"&&b!==""||typeof b=="number")return y=y.get(v)||null,o(x,y,""+b,A);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case _l:return y=y.get(b.key===null?v:b.key)||null,u(x,y,b,A);case Cs:return y=y.get(b.key===null?v:b.key)||null,c(x,y,b,A);case sr:var k=b._init;return m(y,x,v,k(b._payload),A)}if(Li(b)||pi(b))return y=y.get(v)||null,h(x,y,b,A,null);Kl(x,b)}return null}function f(y,x,v,b){for(var A=null,k=null,T=x,P=x=0,I=null;T!==null&&P<v.length;P++){T.index>P?(I=T,T=null):I=T.sibling;var C=p(y,T,v[P],b);if(C===null){T===null&&(T=I);break}e&&T&&C.alternate===null&&t(y,T),x=l(C,x,P),k===null?A=C:k.sibling=C,k=C,T=I}if(P===v.length)return n(y,T),Qe&&Br(y,P),A;if(T===null){for(;P<v.length;P++)T=d(y,v[P],b),T!==null&&(x=l(T,x,P),k===null?A=T:k.sibling=T,k=T);return Qe&&Br(y,P),A}for(T=r(y,T);P<v.length;P++)I=m(T,y,P,v[P],b),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?P:I.key),x=l(I,x,P),k===null?A=I:k.sibling=I,k=I);return e&&T.forEach(function(L){return t(y,L)}),Qe&&Br(y,P),A}function g(y,x,v,b){var A=pi(v);if(typeof A!="function")throw Error(G(150));if(v=A.call(v),v==null)throw Error(G(151));for(var k=A=null,T=x,P=x=0,I=null,C=v.next();T!==null&&!C.done;P++,C=v.next()){T.index>P?(I=T,T=null):I=T.sibling;var L=p(y,T,C.value,b);if(L===null){T===null&&(T=I);break}e&&T&&L.alternate===null&&t(y,T),x=l(L,x,P),k===null?A=L:k.sibling=L,k=L,T=I}if(C.done)return n(y,T),Qe&&Br(y,P),A;if(T===null){for(;!C.done;P++,C=v.next())C=d(y,C.value,b),C!==null&&(x=l(C,x,P),k===null?A=C:k.sibling=C,k=C);return Qe&&Br(y,P),A}for(T=r(y,T);!C.done;P++,C=v.next())C=m(T,y,P,C.value,b),C!==null&&(e&&C.alternate!==null&&T.delete(C.key===null?P:C.key),x=l(C,x,P),k===null?A=C:k.sibling=C,k=C);return e&&T.forEach(function(S){return t(y,S)}),Qe&&Br(y,P),A}function w(y,x,v,b){if(typeof v=="object"&&v!==null&&v.type===Es&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case _l:e:{for(var A=v.key,k=x;k!==null;){if(k.key===A){if(A=v.type,A===Es){if(k.tag===7){n(y,k.sibling),x=i(k,v.props.children),x.return=y,y=x;break e}}else if(k.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===sr&&Qf(A)===k.type){n(y,k.sibling),x=i(k,v.props),x.ref=vi(y,k,v),x.return=y,y=x;break e}n(y,k);break}else t(y,k);k=k.sibling}v.type===Es?(x=Zr(v.props.children,y.mode,b,v.key),x.return=y,y=x):(b=ka(v.type,v.key,v.props,null,y.mode,b),b.ref=vi(y,x,v),b.return=y,y=b)}return a(y);case Cs:e:{for(k=v.key;x!==null;){if(x.key===k)if(x.tag===4&&x.stateNode.containerInfo===v.containerInfo&&x.stateNode.implementation===v.implementation){n(y,x.sibling),x=i(x,v.children||[]),x.return=y,y=x;break e}else{n(y,x);break}else t(y,x);x=x.sibling}x=vu(v,y.mode,b),x.return=y,y=x}return a(y);case sr:return k=v._init,w(y,x,k(v._payload),b)}if(Li(v))return f(y,x,v,b);if(pi(v))return g(y,x,v,b);Kl(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,x!==null&&x.tag===6?(n(y,x.sibling),x=i(x,v),x.return=y,y=x):(n(y,x),x=yu(v,y.mode,b),x.return=y,y=x),a(y)):n(y,x)}return w}var Ks=xx(!0),yx=xx(!1),Ba=Er(null),Ha=null,zs=null,Bd=null;function Hd(){Bd=zs=Ha=null}function Wd(e){var t=Ba.current;We(Ba),e._currentValue=t}function bc(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 Hs(e,t){Ha=e,Bd=zs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Mt=!0),e.firstContext=null)}function an(e){var t=e._currentValue;if(Bd!==e)if(e={context:e,memoizedValue:t,next:null},zs===null){if(Ha===null)throw Error(G(308));zs=e,Ha.dependencies={lanes:0,firstContext:e}}else zs=zs.next=e;return t}var Gr=null;function Vd(e){Gr===null?Gr=[e]:Gr.push(e)}function vx(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Vd(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 ir=!1;function Qd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jx(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 gr(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,Vd(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,Ld(e,n)}}function qf(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 Wa(e,t,n,r){var i=e.updateQueue;ir=!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 p=o.lane,m=o.eventTime;if((r&p)===p){h!==null&&(h=h.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var f=e,g=o;switch(p=t,m=n,g.tag){case 1:if(f=g.payload,typeof f=="function"){d=f.call(m,d,p);break e}d=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=g.payload,p=typeof f=="function"?f.call(m,d,p):f,p==null)break e;d=Ke({},d,p);break e;case 2:ir=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[o]:p.push(o))}else m={eventTime:m,lane:p,tag:o.tag,payload:o.payload,callback:o.callback,next:null},h===null?(c=h=m,u=d):h=h.next=m,a|=p;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;p=o,o=p.next,p.next=null,i.lastBaseUpdate=p,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);ss|=a,e.lanes=a,e.memoizedState=d}}function Gf(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(G(191,i));i.call(r)}}}var jl={},Ln=Er(jl),il=Er(jl),ll=Er(jl);function Kr(e){if(e===jl)throw Error(G(174));return e}function qd(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:rc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=rc(t,e)}We(Ln),Be(Ln,t)}function Ys(){We(Ln),We(il),We(ll)}function wx(e){Kr(ll.current);var t=Kr(Ln.current),n=rc(t,e.type);t!==n&&(Be(il,e),Be(Ln,n))}function Gd(e){il.current===e&&(We(Ln),We(il))}var qe=Er(0);function Va(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 hu=[];function Kd(){for(var e=0;e<hu.length;e++)hu[e]._workInProgressVersionPrimary=null;hu.length=0}var xa=Gn.ReactCurrentDispatcher,fu=Gn.ReactCurrentBatchConfig,rs=0,Ge=null,lt=null,dt=null,Qa=!1,Fi=!1,al=0,F1=0;function St(){throw Error(G(321))}function Yd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wn(e[n],t[n]))return!1;return!0}function Jd(e,t,n,r,i,l){if(rs=l,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xa.current=e===null||e.memoizedState===null?W1:V1,e=n(r,i),Fi){l=0;do{if(Fi=!1,al=0,25<=l)throw Error(G(301));l+=1,dt=lt=null,t.updateQueue=null,xa.current=Q1,e=n(r,i)}while(Fi)}if(xa.current=qa,t=lt!==null&<.next!==null,rs=0,dt=lt=Ge=null,Qa=!1,t)throw Error(G(300));return e}function Xd(){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 on(){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(G(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 pu(e){var t=on(),n=t.queue;if(n===null)throw Error(G(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((rs&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,ss|=h}c=c.next}while(c!==null&&c!==l);u===null?a=r:u.next=o,wn(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,Ge.lanes|=l,ss|=l,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function mu(e){var t=on(),n=t.queue;if(n===null)throw Error(G(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);wn(l,t.memoizedState)||(Mt=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,r]}function kx(){}function bx(e,t){var n=Ge,r=on(),i=t(),l=!wn(r.memoizedState,i);if(l&&(r.memoizedState=i,Mt=!0),r=r.queue,Zd(Cx.bind(null,n,r,e),[e]),r.getSnapshot!==t||l||dt!==null&&dt.memoizedState.tag&1){if(n.flags|=2048,ul(9,Nx.bind(null,n,r,i,t),void 0,null),ht===null)throw Error(G(349));rs&30||Sx(n,t,i)}return i}function Sx(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 Nx(e,t,n,r){t.value=n,t.getSnapshot=r,Ex(t)&&Tx(e)}function Cx(e,t,n){return n(function(){Ex(t)&&Tx(e)})}function Ex(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wn(e,n)}catch{return!0}}function Tx(e){var t=Vn(e,1);t!==null&&yn(t,e,1,-1)}function Kf(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=H1.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 Px(){return on().memoizedState}function ya(e,t,n,r){var i=Cn();Ge.flags|=e,i.memoizedState=ul(1|t,n,void 0,r===void 0?null:r)}function wo(e,t,n,r){var i=on();r=r===void 0?null:r;var l=void 0;if(lt!==null){var a=lt.memoizedState;if(l=a.destroy,r!==null&&Yd(r,a.deps)){i.memoizedState=ul(t,n,l,r);return}}Ge.flags|=e,i.memoizedState=ul(1|t,n,l,r)}function Yf(e,t){return ya(8390656,8,e,t)}function Zd(e,t){return wo(2048,8,e,t)}function Rx(e,t){return wo(4,2,e,t)}function Lx(e,t){return wo(4,4,e,t)}function Ax(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 Ix(e,t,n){return n=n!=null?n.concat([e]):null,wo(4,4,Ax.bind(null,t,e),n)}function eh(){}function Dx(e,t){var n=on();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yd(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function zx(e,t){var n=on();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yd(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Mx(e,t,n){return rs&21?(wn(n,t)||(n=Ug(),Ge.lanes|=n,ss|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Mt=!0),e.memoizedState=n)}function U1(e,t){var n=ze;ze=n!==0&&4>n?n:4,e(!0);var r=fu.transition;fu.transition={};try{e(!1),t()}finally{ze=n,fu.transition=r}}function $x(){return on().memoizedState}function B1(e,t,n){var r=yr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_x(e))Ox(t,n);else if(n=vx(e,t,n,r),n!==null){var i=Pt();yn(n,e,r,i),Fx(n,t,r)}}function H1(e,t,n){var r=yr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_x(e))Ox(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,wn(o,a)){var u=t.interleaved;u===null?(i.next=i,Vd(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=vx(e,t,i,r),n!==null&&(i=Pt(),yn(n,e,r,i),Fx(n,t,r))}}function _x(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Ox(e,t){Fi=Qa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fx(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ld(e,n)}}var qa={readContext:an,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},W1={readContext:an,useCallback:function(e,t){return Cn().memoizedState=[e,t===void 0?null:t],e},useContext:an,useEffect:Yf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ya(4194308,4,Ax.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=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=B1.bind(null,Ge,e),[r.memoizedState,e]},useRef:function(e){var t=Cn();return e={current:e},t.memoizedState=e},useState:Kf,useDebugValue:eh,useDeferredValue:function(e){return Cn().memoizedState=e},useTransition:function(){var e=Kf(!1),t=e[0];return e=U1.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(G(407));n=n()}else{if(n=t(),ht===null)throw Error(G(349));rs&30||Sx(r,t,n)}i.memoizedState=n;var l={value:n,getSnapshot:t};return i.queue=l,Yf(Cx.bind(null,r,l,e),[e]),r.flags|=2048,ul(9,Nx.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-xn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=al++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=F1++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},V1={readContext:an,useCallback:Dx,useContext:an,useEffect:Zd,useImperativeHandle:Ix,useInsertionEffect:Rx,useLayoutEffect:Lx,useMemo:zx,useReducer:pu,useRef:Px,useState:function(){return pu(ol)},useDebugValue:eh,useDeferredValue:function(e){var t=on();return Mx(t,lt.memoizedState,e)},useTransition:function(){var e=pu(ol)[0],t=on().memoizedState;return[e,t]},useMutableSource:kx,useSyncExternalStore:bx,useId:$x,unstable_isNewReconciler:!1},Q1={readContext:an,useCallback:Dx,useContext:an,useEffect:Zd,useImperativeHandle:Ix,useInsertionEffect:Rx,useLayoutEffect:Lx,useMemo:zx,useReducer:mu,useRef:Px,useState:function(){return mu(ol)},useDebugValue:eh,useDeferredValue:function(e){var t=on();return lt===null?t.memoizedState=e:Mx(t,lt.memoizedState,e)},useTransition:function(){var e=mu(ol)[0],t=on().memoizedState;return[e,t]},useMutableSource:kx,useSyncExternalStore:bx,useId:$x,unstable_isNewReconciler:!1};function fn(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 Sc(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 ko={isMounted:function(e){return(e=e._reactInternals)?cs(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Pt(),i=yr(e),l=Un(r,i);l.payload=t,n!=null&&(l.callback=n),t=gr(e,l,i),t!==null&&(yn(t,e,i,r),ga(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Pt(),i=yr(e),l=Un(r,i);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=gr(e,l,i),t!==null&&(yn(t,e,i,r),ga(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pt(),r=yr(e),i=Un(n,r);i.tag=2,t!=null&&(i.callback=t),t=gr(e,i,r),t!==null&&(yn(t,e,r,n),ga(t,e,r))}};function Jf(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 Ux(e,t,n){var r=!1,i=wr,l=t.contextType;return typeof l=="object"&&l!==null?l=an(l):(i=_t(t)?ts:Et.current,r=t.contextTypes,l=(r=r!=null)?qs(e,i):wr),t=new t(n,l),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ko,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=l),t}function Xf(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&&ko.enqueueReplaceState(t,t.state,null)}function Nc(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Qd(e);var l=t.contextType;typeof l=="object"&&l!==null?i.context=an(l):(l=_t(t)?ts:Et.current,i.context=qs(e,l)),i.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(Sc(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&&ko.enqueueReplaceState(i,i.state,null),Wa(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Js(e,t){try{var n="",r=t;do n+=jw(r),r=r.return;while(r);var i=n}catch(l){i=`
|
|
39
|
+
Error generating stack: `+l.message+`
|
|
40
|
+
`+l.stack}return{value:e,source:t,stack:i,digest:null}}function gu(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Cc(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var q1=typeof WeakMap=="function"?WeakMap:Map;function Bx(e,t,n){n=Un(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ka||(Ka=!0,Mc=r),Cc(e,t)},n}function Hx(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(){Cc(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){Cc(e,t),typeof r!="function"&&(xr===null?xr=new Set([this]):xr.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Zf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new q1;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=ak.bind(null,e,t,n),t.then(e,e))}function ep(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 tp(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,gr(n,t,1))),n.lanes|=1),e)}var G1=Gn.ReactCurrentOwner,Mt=!1;function Tt(e,t,n,r){t.child=e===null?yx(t,null,n,r):Ks(t,e.child,n,r)}function np(e,t,n,r,i){n=n.render;var l=t.ref;return Hs(t,i),r=Jd(e,t,n,r,l,i),n=Xd(),e!==null&&!Mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qn(e,t,i)):(Qe&&n&&Od(t),t.flags|=1,Tt(e,t,r,i),t.child)}function rp(e,t,n,r,i){if(e===null){var l=n.type;return typeof l=="function"&&!oh(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,Wx(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:tl,n(a,r)&&e.ref===t.ref)return Qn(e,t,i)}return t.flags|=1,e=vr(l,r),e.ref=t.ref,e.return=t,t.child=e}function Wx(e,t,n,r,i){if(e!==null){var l=e.memoizedProps;if(tl(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 Ec(e,t,n,r,i)}function Vx(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($s,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($s,Wt),Wt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,Be($s,Wt),Wt|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,Be($s,Wt),Wt|=r;return Tt(e,t,i,n),t.child}function Qx(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ec(e,t,n,r,i){var l=_t(n)?ts:Et.current;return l=qs(t,l),Hs(t,i),n=Jd(e,t,n,r,l,i),r=Xd(),e!==null&&!Mt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qn(e,t,i)):(Qe&&r&&Od(t),t.flags|=1,Tt(e,t,n,i),t.child)}function sp(e,t,n,r,i){if(_t(n)){var l=!0;Oa(t)}else l=!1;if(Hs(t,i),t.stateNode===null)va(e,t),Ux(t,n,r),Nc(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=an(c):(c=_t(n)?ts: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)&&Xf(t,a,r,c),ir=!1;var p=t.memoizedState;a.state=p,Wa(t,r,a,i),u=t.memoizedState,o!==r||p!==u||$t.current||ir?(typeof h=="function"&&(Sc(t,n,h,r),u=t.memoizedState),(o=ir||Jf(t,n,o,r,p,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,jx(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:fn(t.type,o),a.props=c,d=t.pendingProps,p=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=an(u):(u=_t(n)?ts: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||p!==u)&&Xf(t,a,r,u),ir=!1,p=t.memoizedState,a.state=p,Wa(t,r,a,i);var f=t.memoizedState;o!==d||p!==f||$t.current||ir?(typeof m=="function"&&(Sc(t,n,m,r),f=t.memoizedState),(c=ir||Jf(t,n,c,r,p,f,u)||!1)?(h||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Tc(e,t,n,r,l,i)}function Tc(e,t,n,r,i,l){Qx(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&Hf(t,n,!1),Qn(e,t,l);r=t.stateNode,G1.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Ks(t,e.child,null,l),t.child=Ks(t,null,o,l)):Tt(e,t,o,l),t.memoizedState=r.state,i&&Hf(t,n,!0),t.child}function qx(e){var t=e.stateNode;t.pendingContext?Bf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Bf(e,t.context,!1),qd(e,t.containerInfo)}function ip(e,t,n,r,i){return Gs(),Ud(i),t.flags|=256,Tt(e,t,n,r),t.child}var Pc={dehydrated:null,treeContext:null,retryLane:0};function Rc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gx(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 kc(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=No(a,r,0,null),e=Zr(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Rc(n),t.memoizedState=Pc,e):th(t,a));if(i=e.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return K1(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=vr(i,u),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?l=vr(o,l):(l=Zr(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?Rc(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},l.memoizedState=a,l.childLanes=e.childLanes&~n,t.memoizedState=Pc,r}return l=e.child,e=l.sibling,r=vr(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 th(e,t){return t=No({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Yl(e,t,n,r){return r!==null&&Ud(r),Ks(t,e.child,null,n),e=th(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function K1(e,t,n,r,i,l,a){if(n)return t.flags&256?(t.flags&=-257,r=gu(Error(G(422))),Yl(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,i=t.mode,r=No({mode:"visible",children:r.children},i,0,null),l=Zr(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,t.mode&1&&Ks(t,e.child,null,a),t.child.memoizedState=Rc(a),t.memoizedState=Pc,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(G(419)),r=gu(l,r,void 0),Yl(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),yn(r,e,i,-1))}return ah(),r=gu(Error(G(421))),Yl(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=ok.bind(null,e),i._reactRetry=t,null):(e=l.treeContext,Qt=mr(i.nextSibling),Gt=t,Qe=!0,gn=null,e!==null&&(en[tn++]=On,en[tn++]=Fn,en[tn++]=ns,On=e.id,Fn=e.overflow,ns=t),t=th(t,r.children),t.flags|=4096,t)}function lp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),bc(e.return,t,n)}function xu(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 Kx(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&&lp(e,n,t);else if(e.tag===19)lp(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&&Va(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),xu(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&&Va(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}xu(t,!0,n,null,l);break;case"together":xu(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),ss|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(G(153));if(t.child!==null){for(e=t.child,n=vr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=vr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Y1(e,t,n){switch(t.tag){case 3:qx(t),Gs();break;case 5:wx(t);break;case 1:_t(t.type)&&Oa(t);break;case 4:qd(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Be(Ba,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?Gx(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 Kx(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,Vx(e,t,n)}return Qn(e,t,n)}var Yx,Lc,Jx,Xx;Yx=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}};Lc=function(){};Jx=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Kr(Ln.current);var l=null;switch(n){case"input":i=Zu(e,i),r=Zu(e,r),l=[];break;case"select":i=Ke({},i,{value:void 0}),r=Ke({},r,{value:void 0}),l=[];break;case"textarea":i=nc(e,i),r=nc(e,r),l=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=$a)}sc(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)}};Xx=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 J1(e,t,n){var r=t.pendingProps;switch(Fd(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)&&_a(),Nt(t),null;case 3:return r=t.stateNode,Ys(),We($t),We(Et),Kd(),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,gn!==null&&(Oc(gn),gn=null))),Lc(e,t),Nt(t),null;case 5:Gd(t);var i=Kr(ll.current);if(n=t.type,e!==null&&t.stateNode!=null)Jx(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(G(166));return Nt(t),null}if(e=Kr(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":mf(r,l),He("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},He("invalid",r);break;case"textarea":xf(r,l),He("invalid",r)}sc(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),gf(r,l,!0);break;case"textarea":Ol(r),yf(r);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(r.onclick=$a)}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=Cg(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,Yx(e,t,!1,!1),t.stateNode=e;e:{switch(a=ic(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":mf(e,r),i=Zu(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":xf(e,r),i=nc(e,r),He("invalid",e);break;default:i=r}sc(n,i),o=i;for(l in o)if(o.hasOwnProperty(l)){var u=o[l];l==="style"?Pg(e,u):l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Eg(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&&Nd(e,l,u,a))}switch(n){case"input":Ol(e),gf(e,r,!1);break;case"textarea":Ol(e),yf(e);break;case"option":r.value!=null&&e.setAttribute("value",""+jr(r.value));break;case"select":e.multiple=!!r.multiple,l=r.value,l!=null?Os(e,!!r.multiple,l,!1):r.defaultValue!=null&&Os(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=$a)}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)Xx(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(G(166));if(n=Kr(ll.current),Kr(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))gx(),Gs(),t.flags|=98560,l=!1;else if(l=Gl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!l)throw Error(G(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(G(317));l[Tn]=t}else Gs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nt(t),l=!1}else gn!==null&&(Oc(gn),gn=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):ah())),t.updateQueue!==null&&(t.flags|=4),Nt(t),null);case 4:return Ys(),Lc(e,t),e===null&&nl(t.stateNode.containerInfo),Nt(t),null;case 10:return Wd(t.type._context),Nt(t),null;case 17:return _t(t.type)&&_a(),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=Va(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()>Xs&&(t.flags|=128,r=!0,ji(l,!1),t.lanes=4194304)}else{if(!r)if(e=Va(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>Xs&&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 lh(),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(G(156,t.tag))}function X1(e,t){switch(Fd(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 Ys(),We($t),We(Et),Kd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Gd(t),null;case 13:if(We(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(G(340));Gs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return We(qe),null;case 4:return Ys(),null;case 10:return Wd(t.type._context),null;case 22:case 23:return lh(),null;case 24:return null;default:return null}}var Jl=!1,Ct=!1,Z1=typeof WeakSet=="function"?WeakSet:Set,ee=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 Ac(e,t,n){try{n()}catch(r){Xe(e,t,r)}}var ap=!1;function ek(e,t){if(mc=Da,e=rx(),_d(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,p=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;)p=d,d=m;for(;;){if(d===e)break t;if(p===n&&++c===i&&(o=a),p===l&&++h===r&&(u=a),(m=d.nextSibling)!==null)break;d=p,p=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(gc={focusedElem:e,selectionRange:n},Da=!1,ee=t;ee!==null;)if(t=ee,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ee=e;else for(;ee!==null;){t=ee;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var g=f.memoizedProps,w=f.memoizedState,y=t.stateNode,x=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:fn(t.type,g),w);y.__reactInternalSnapshotBeforeUpdate=x}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(G(163))}}catch(b){Xe(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ee=e;break}ee=t.return}return f=ap,ap=!1,f}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&&Ac(t,n,l)}i=i.next}while(i!==r)}}function bo(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 Ic(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 Zx(e){var t=e.alternate;t!==null&&(e.alternate=null,Zx(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[vc],delete t[M1],delete t[$1])),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 ey(e){return e.tag===5||e.tag===3||e.tag===4}function op(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ey(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 Dc(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=$a));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function zc(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(zc(e,t,n),e=e.sibling;e!==null;)zc(e,t,n),e=e.sibling}var xt=null,pn=!1;function tr(e,t,n){for(n=n.child;n!==null;)ty(e,t,n),n=n.sibling}function ty(e,t,n){if(Rn&&typeof Rn.onCommitFiberUnmount=="function")try{Rn.onCommitFiberUnmount(mo,n)}catch{}switch(n.tag){case 5:Ct||Ms(n,t);case 6:var r=xt,i=pn;xt=null,tr(e,t,n),xt=r,pn=i,xt!==null&&(pn?(e=xt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xt.removeChild(n.stateNode));break;case 18:xt!==null&&(pn?(e=xt,n=n.stateNode,e.nodeType===8?cu(e.parentNode,n):e.nodeType===1&&cu(e,n),Zi(e)):cu(xt,n.stateNode));break;case 4:r=xt,i=pn,xt=n.stateNode.containerInfo,pn=!0,tr(e,t,n),xt=r,pn=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)&&Ac(n,t,a),i=i.next}while(i!==r)}tr(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)}tr(e,t,n);break;case 21:tr(e,t,n);break;case 22:n.mode&1?(Ct=(r=Ct)||n.memoizedState!==null,tr(e,t,n),Ct=r):tr(e,t,n);break;default:tr(e,t,n)}}function up(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Z1),t.forEach(function(r){var i=uk.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function hn(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,pn=!1;break e;case 3:xt=o.stateNode.containerInfo,pn=!0;break e;case 4:xt=o.stateNode.containerInfo,pn=!0;break e}o=o.return}if(xt===null)throw Error(G(160));ty(l,a,i),xt=null,pn=!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;)ny(t,e),t=t.sibling}function ny(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(hn(t,e),Nn(e),r&4){try{Ui(3,e,e.return),bo(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:hn(t,e),Nn(e),r&512&&n!==null&&Ms(n,n.return);break;case 5:if(hn(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&&Sg(i,l),ic(o,a);var c=ic(o,l);for(a=0;a<u.length;a+=2){var h=u[a],d=u[a+1];h==="style"?Pg(i,d):h==="dangerouslySetInnerHTML"?Eg(i,d):h==="children"?Ki(i,d):Nd(i,h,d,c)}switch(o){case"input":ec(i,l);break;case"textarea":Ng(i,l);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!l.multiple;var m=l.value;m!=null?Os(i,!!l.multiple,m,!1):p!==!!l.multiple&&(l.defaultValue!=null?Os(i,!!l.multiple,l.defaultValue,!0):Os(i,!!l.multiple,l.multiple?[]:"",!1))}i[sl]=l}catch(g){Xe(e,e.return,g)}}break;case 6:if(hn(t,e),Nn(e),r&4){if(e.stateNode===null)throw Error(G(162));i=e.stateNode,l=e.memoizedProps;try{i.nodeValue=l}catch(g){Xe(e,e.return,g)}}break;case 3:if(hn(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:hn(t,e),Nn(e);break;case 13:hn(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||(sh=et())),r&4&&up(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Ct=(c=Ct)||h,hn(t,e),Ct=c):hn(t,e),Nn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(ee=e,h=e.child;h!==null;){for(d=ee=h;ee!==null;){switch(p=ee,m=p.child,p.tag){case 0:case 11:case 14:case 15:Ui(4,p,p.return);break;case 1:Ms(p,p.return);var f=p.stateNode;if(typeof f.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,f.props=t.memoizedProps,f.state=t.memoizedState,f.componentWillUnmount()}catch(g){Xe(r,n,g)}}break;case 5:Ms(p,p.return);break;case 22:if(p.memoizedState!==null){dp(d);continue}}m!==null?(m.return=p,ee=m):dp(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=Tg("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:hn(t,e),Nn(e),r&4&&up(e);break;case 21:break;default:hn(t,e),Nn(e)}}function Nn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(ey(n)){var r=n;break e}n=n.return}throw Error(G(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Ki(i,""),r.flags&=-33);var l=op(e);zc(e,l,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=op(e);Dc(e,o,a);break;default:throw Error(G(161))}}catch(u){Xe(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tk(e,t,n){ee=e,ry(e)}function ry(e,t,n){for(var r=(e.mode&1)!==0;ee!==null;){var i=ee,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(ee=i;ee!==null;)a=ee,u=a.child,a.tag===22&&a.memoizedState!==null?hp(i):u!==null?(u.return=a,ee=u):hp(i);for(;l!==null;)ee=l,ry(l),l=l.sibling;ee=i,Jl=o,Ct=c}cp(e)}else i.subtreeFlags&8772&&l!==null?(l.return=i,ee=l):cp(e)}}function cp(e){for(;ee!==null;){var t=ee;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ct||bo(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:fn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&Gf(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}Gf(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(G(163))}Ct||t.flags&512&&Ic(t)}catch(p){Xe(t,t.return,p)}}if(t===e){ee=null;break}if(n=t.sibling,n!==null){n.return=t.return,ee=n;break}ee=t.return}}function dp(e){for(;ee!==null;){var t=ee;if(t===e){ee=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ee=n;break}ee=t.return}}function hp(e){for(;ee!==null;){var t=ee;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{bo(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{Ic(t)}catch(u){Xe(t,l,u)}break;case 5:var a=t.return;try{Ic(t)}catch(u){Xe(t,a,u)}}}catch(u){Xe(t,t.return,u)}if(t===e){ee=null;break}var o=t.sibling;if(o!==null){o.return=t.return,ee=o;break}ee=t.return}}var nk=Math.ceil,Ga=Gn.ReactCurrentDispatcher,nh=Gn.ReactCurrentOwner,ln=Gn.ReactCurrentBatchConfig,Re=0,ht=null,it=null,wt=0,Wt=0,$s=Er(0),at=0,cl=null,ss=0,So=0,rh=0,Bi=null,zt=null,sh=0,Xs=1/0,$n=null,Ka=!1,Mc=null,xr=null,Xl=!1,ur=null,Ya=0,Hi=0,$c=null,ja=-1,wa=0;function Pt(){return Re&6?et():ja!==-1?ja:ja=et()}function yr(e){return e.mode&1?Re&2&&wt!==0?wt&-wt:O1.transition!==null?(wa===0&&(wa=Ug()),wa):(e=ze,e!==0||(e=window.event,e=e===void 0?16:Gg(e.type)),e):1}function yn(e,t,n,r){if(50<Hi)throw Hi=0,$c=null,Error(G(185));xl(e,n,r),(!(Re&2)||e!==ht)&&(e===ht&&(!(Re&2)&&(So|=n),at===4&&ar(e,wt)),Ot(e,r),n===1&&Re===0&&!(t.mode&1)&&(Xs=et()+500,jo&&Tr()))}function Ot(e,t){var n=e.callbackNode;Ow(e,t);var r=Ia(e,e===ht?wt:0);if(r===0)n!==null&&wf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&wf(n),t===1)e.tag===0?_1(fp.bind(null,e)):fx(fp.bind(null,e)),D1(function(){!(Re&6)&&Tr()}),n=null;else{switch(Bg(r)){case 1:n=Rd;break;case 4:n=Og;break;case 16:n=Aa;break;case 536870912:n=Fg;break;default:n=Aa}n=dy(n,sy.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function sy(e,t){if(ja=-1,wa=0,Re&6)throw Error(G(327));var n=e.callbackNode;if(Ws()&&e.callbackNode!==n)return null;var r=Ia(e,e===ht?wt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ja(e,r);else{t=r;var i=Re;Re|=2;var l=ly();(ht!==e||wt!==t)&&($n=null,Xs=et()+500,Xr(e,t));do try{ik();break}catch(o){iy(e,o)}while(!0);Hd(),Ga.current=l,Re=i,it!==null?t=0:(ht=null,wt=0,t=at)}if(t!==0){if(t===2&&(i=cc(e),i!==0&&(r=i,t=_c(e,i))),t===1)throw n=cl,Xr(e,0),ar(e,r),Ot(e,et()),n;if(t===6)ar(e,r);else{if(i=e.current.alternate,!(r&30)&&!rk(i)&&(t=Ja(e,r),t===2&&(l=cc(e),l!==0&&(r=l,t=_c(e,l))),t===1))throw n=cl,Xr(e,0),ar(e,r),Ot(e,et()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(G(345));case 2:Hr(e,zt,$n);break;case 3:if(ar(e,r),(r&130023424)===r&&(t=sh+500-et(),10<t)){if(Ia(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Pt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=yc(Hr.bind(null,e,zt,$n),t);break}Hr(e,zt,$n);break;case 4:if(ar(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-xn(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*nk(r/1960))-r,10<r){e.timeoutHandle=yc(Hr.bind(null,e,zt,$n),r);break}Hr(e,zt,$n);break;case 5:Hr(e,zt,$n);break;default:throw Error(G(329))}}}return Ot(e,et()),e.callbackNode===n?sy.bind(null,e):null}function _c(e,t){var n=Bi;return e.current.memoizedState.isDehydrated&&(Xr(e,t).flags|=256),e=Ja(e,t),e!==2&&(t=zt,zt=n,t!==null&&Oc(t)),e}function Oc(e){zt===null?zt=e:zt.push.apply(zt,e)}function rk(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(!wn(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 ar(e,t){for(t&=~rh,t&=~So,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-xn(t),r=1<<n;e[n]=-1,t&=~r}}function fp(e){if(Re&6)throw Error(G(327));Ws();var t=Ia(e,0);if(!(t&1))return Ot(e,et()),null;var n=Ja(e,t);if(e.tag!==0&&n===2){var r=cc(e);r!==0&&(t=r,n=_c(e,r))}if(n===1)throw n=cl,Xr(e,0),ar(e,t),Ot(e,et()),n;if(n===6)throw Error(G(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Hr(e,zt,$n),Ot(e,et()),null}function ih(e,t){var n=Re;Re|=1;try{return e(t)}finally{Re=n,Re===0&&(Xs=et()+500,jo&&Tr())}}function is(e){ur!==null&&ur.tag===0&&!(Re&6)&&Ws();var t=Re;Re|=1;var n=ln.transition,r=ze;try{if(ln.transition=null,ze=1,e)return e()}finally{ze=r,ln.transition=n,Re=t,!(Re&6)&&Tr()}}function lh(){Wt=$s.current,We($s)}function Xr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,I1(n)),it!==null)for(n=it.return;n!==null;){var r=n;switch(Fd(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&_a();break;case 3:Ys(),We($t),We(Et),Kd();break;case 5:Gd(r);break;case 4:Ys();break;case 13:We(qe);break;case 19:We(qe);break;case 10:Wd(r.type._context);break;case 22:case 23:lh()}n=n.return}if(ht=e,it=e=vr(e.current,null),wt=Wt=t,at=0,cl=null,rh=So=ss=0,zt=Bi=null,Gr!==null){for(t=0;t<Gr.length;t++)if(n=Gr[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}Gr=null}return e}function iy(e,t){do{var n=it;try{if(Hd(),xa.current=qa,Qa){for(var r=Ge.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Qa=!1}if(rs=0,dt=lt=Ge=null,Fi=!1,al=0,nh.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 p=h.alternate;p?(h.updateQueue=p.updateQueue,h.memoizedState=p.memoizedState,h.lanes=p.lanes):(h.updateQueue=null,h.memoizedState=null)}var m=ep(a);if(m!==null){m.flags&=-257,tp(m,a,o,l,t),m.mode&1&&Zf(l,c,t),t=m,u=c;var f=t.updateQueue;if(f===null){var g=new Set;g.add(u),t.updateQueue=g}else f.add(u);break e}else{if(!(t&1)){Zf(l,c,t),ah();break e}u=Error(G(426))}}else if(Qe&&o.mode&1){var w=ep(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),tp(w,a,o,l,t),Ud(Js(u,o));break e}}l=u=Js(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 y=Bx(l,u,t);qf(l,y);break e;case 1:o=u;var x=l.type,v=l.stateNode;if(!(l.flags&128)&&(typeof x.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(xr===null||!xr.has(v)))){l.flags|=65536,t&=-t,l.lanes|=t;var b=Hx(l,o,t);qf(l,b);break e}}l=l.return}while(l!==null)}oy(n)}catch(A){t=A,it===n&&n!==null&&(it=n=n.return);continue}break}while(!0)}function ly(){var e=Ga.current;return Ga.current=qa,e===null?qa:e}function ah(){(at===0||at===3||at===2)&&(at=4),ht===null||!(ss&268435455)&&!(So&268435455)||ar(ht,wt)}function Ja(e,t){var n=Re;Re|=2;var r=ly();(ht!==e||wt!==t)&&($n=null,Xr(e,t));do try{sk();break}catch(i){iy(e,i)}while(!0);if(Hd(),Re=n,Ga.current=r,it!==null)throw Error(G(261));return ht=null,wt=0,at}function sk(){for(;it!==null;)ay(it)}function ik(){for(;it!==null&&!Rw();)ay(it)}function ay(e){var t=cy(e.alternate,e,Wt);e.memoizedProps=e.pendingProps,t===null?oy(e):it=t,nh.current=null}function oy(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=X1(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=J1(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 Hr(e,t,n){var r=ze,i=ln.transition;try{ln.transition=null,ze=1,lk(e,t,n,r)}finally{ln.transition=i,ze=r}return null}function lk(e,t,n,r){do Ws();while(ur!==null);if(Re&6)throw Error(G(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(G(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(Fw(e,l),e===ht&&(it=ht=null,wt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xl||(Xl=!0,dy(Aa,function(){return Ws(),null})),l=(n.flags&15990)!==0,n.subtreeFlags&15990||l){l=ln.transition,ln.transition=null;var a=ze;ze=1;var o=Re;Re|=4,nh.current=null,ek(e,n),ny(n,e),C1(gc),Da=!!mc,gc=mc=null,e.current=n,tk(n),Lw(),Re=o,ze=a,ln.transition=l}else e.current=n;if(Xl&&(Xl=!1,ur=e,Ya=i),l=e.pendingLanes,l===0&&(xr=null),Dw(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(Ka)throw Ka=!1,e=Mc,Mc=null,e;return Ya&1&&e.tag!==0&&Ws(),l=e.pendingLanes,l&1?e===$c?Hi++:(Hi=0,$c=e):Hi=0,Tr(),null}function Ws(){if(ur!==null){var e=Bg(Ya),t=ln.transition,n=ze;try{if(ln.transition=null,ze=16>e?16:e,ur===null)var r=!1;else{if(e=ur,ur=null,Ya=0,Re&6)throw Error(G(331));var i=Re;for(Re|=4,ee=e.current;ee!==null;){var l=ee,a=l.child;if(ee.flags&16){var o=l.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for(ee=c;ee!==null;){var h=ee;switch(h.tag){case 0:case 11:case 15:Ui(8,h,l)}var d=h.child;if(d!==null)d.return=h,ee=d;else for(;ee!==null;){h=ee;var p=h.sibling,m=h.return;if(Zx(h),h===c){ee=null;break}if(p!==null){p.return=m,ee=p;break}ee=m}}}var f=l.alternate;if(f!==null){var g=f.child;if(g!==null){f.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}ee=l}}if(l.subtreeFlags&2064&&a!==null)a.return=l,ee=a;else e:for(;ee!==null;){if(l=ee,l.flags&2048)switch(l.tag){case 0:case 11:case 15:Ui(9,l,l.return)}var y=l.sibling;if(y!==null){y.return=l.return,ee=y;break e}ee=l.return}}var x=e.current;for(ee=x;ee!==null;){a=ee;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,ee=v;else e:for(a=x;ee!==null;){if(o=ee,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:bo(9,o)}}catch(A){Xe(o,o.return,A)}if(o===a){ee=null;break e}var b=o.sibling;if(b!==null){b.return=o.return,ee=b;break e}ee=o.return}}if(Re=i,Tr(),Rn&&typeof Rn.onPostCommitFiberRoot=="function")try{Rn.onPostCommitFiberRoot(mo,e)}catch{}r=!0}return r}finally{ze=n,ln.transition=t}}return!1}function pp(e,t,n){t=Js(n,t),t=Bx(e,t,1),e=gr(e,t,1),t=Pt(),e!==null&&(xl(e,1,t),Ot(e,t))}function Xe(e,t,n){if(e.tag===3)pp(e,e,n);else for(;t!==null;){if(t.tag===3){pp(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(xr===null||!xr.has(r))){e=Js(n,e),e=Hx(t,e,1),t=gr(t,e,1),e=Pt(),t!==null&&(xl(t,1,e),Ot(t,e));break}}t=t.return}}function ak(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()-sh?Xr(e,0):rh|=n),Ot(e,t)}function uy(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 ok(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),uy(e,n)}function uk(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(G(314))}r!==null&&r.delete(t),uy(e,n)}var cy;cy=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$t.current)Mt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Mt=!1,Y1(e,t,n);Mt=!!(e.flags&131072)}else Mt=!1,Qe&&t.flags&1048576&&px(t,Ua,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;va(e,t),e=t.pendingProps;var i=qs(t,Et.current);Hs(t,n),i=Jd(null,t,r,e,i,n);var l=Xd();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,Oa(t)):l=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Qd(t),i.updater=ko,t.stateNode=i,i._reactInternals=t,Nc(t,r,e,n),t=Tc(null,t,r,!0,l,n)):(t.tag=0,Qe&&l&&Od(t),Tt(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=dk(r),e=fn(r,e),i){case 0:t=Ec(null,t,r,e,n);break e;case 1:t=sp(null,t,r,e,n);break e;case 11:t=np(null,t,r,e,n);break e;case 14:t=rp(null,t,r,fn(r.type,e),n);break e}throw Error(G(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fn(r,i),Ec(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fn(r,i),sp(e,t,r,i,n);case 3:e:{if(qx(t),e===null)throw Error(G(387));r=t.pendingProps,l=t.memoizedState,i=l.element,jx(e,t),Wa(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=Js(Error(G(423)),t),t=ip(e,t,r,n,i);break e}else if(r!==i){i=Js(Error(G(424)),t),t=ip(e,t,r,n,i);break e}else for(Qt=mr(t.stateNode.containerInfo.firstChild),Gt=t,Qe=!0,gn=null,n=yx(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gs(),r===i){t=Qn(e,t,n);break e}Tt(e,t,r,n)}t=t.child}return t;case 5:return wx(t),e===null&&kc(t),r=t.type,i=t.pendingProps,l=e!==null?e.memoizedProps:null,a=i.children,xc(r,i)?a=null:l!==null&&xc(r,l)&&(t.flags|=32),Qx(e,t),Tt(e,t,a,n),t.child;case 6:return e===null&&kc(t),null;case 13:return Gx(e,t,n);case 4:return qd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ks(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:fn(r,i),np(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(Ba,r._currentValue),r._currentValue=a,l!==null)if(wn(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),bc(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(G(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),bc(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,Hs(t,n),i=an(i),r=r(i),t.flags|=1,Tt(e,t,r,n),t.child;case 14:return r=t.type,i=fn(r,t.pendingProps),i=fn(r.type,i),rp(e,t,r,i,n);case 15:return Wx(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fn(r,i),va(e,t),t.tag=1,_t(r)?(e=!0,Oa(t)):e=!1,Hs(t,n),Ux(t,r,i),Nc(t,r,i,n),Tc(null,t,r,!0,e,n);case 19:return Kx(e,t,n);case 22:return Vx(e,t,n)}throw Error(G(156,t.tag))};function dy(e,t){return _g(e,t)}function ck(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 rn(e,t,n,r){return new ck(e,t,n,r)}function oh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dk(e){if(typeof e=="function")return oh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ed)return 11;if(e===Td)return 14}return 2}function vr(e,t){var n=e.alternate;return n===null?(n=rn(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")oh(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Es:return Zr(n.children,i,l,t);case Cd:a=8,i|=8;break;case Ku:return e=rn(12,n,t,i|2),e.elementType=Ku,e.lanes=l,e;case Yu:return e=rn(13,n,t,i),e.elementType=Yu,e.lanes=l,e;case Ju:return e=rn(19,n,t,i),e.elementType=Ju,e.lanes=l,e;case wg:return No(n,i,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vg:a=10;break e;case jg:a=9;break e;case Ed:a=11;break e;case Td:a=14;break e;case sr:a=16,r=null;break e}throw Error(G(130,e==null?e:typeof e,""))}return t=rn(a,n,t,i),t.elementType=e,t.type=r,t.lanes=l,t}function Zr(e,t,n,r){return e=rn(7,e,r,t),e.lanes=n,e}function No(e,t,n,r){return e=rn(22,e,r,t),e.elementType=wg,e.lanes=n,e.stateNode={isHidden:!1},e}function yu(e,t,n){return e=rn(6,e,null,t),e.lanes=n,e}function vu(e,t,n){return t=rn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hk(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=Zo(0),this.expirationTimes=Zo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function uh(e,t,n,r,i,l,a,o,u){return e=new hk(e,t,n,o,u),t===1?(t=1,l===!0&&(t|=8)):t=0,l=rn(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qd(l),e}function fk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Cs,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function hy(e){if(!e)return wr;e=e._reactInternals;e:{if(cs(e)!==e||e.tag!==1)throw Error(G(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(G(171))}if(e.tag===1){var n=e.type;if(_t(n))return hx(e,n,t)}return t}function fy(e,t,n,r,i,l,a,o,u){return e=uh(n,r,!0,e,i,l,a,o,u),e.context=hy(null),n=e.current,r=Pt(),i=yr(n),l=Un(r,i),l.callback=t??null,gr(n,l,i),e.current.lanes=i,xl(e,i,r),Ot(e,r),e}function Co(e,t,n,r){var i=t.current,l=Pt(),a=yr(i);return n=hy(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=gr(i,t,a),e!==null&&(yn(e,i,a,l),ga(e,i,a)),a}function Xa(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 mp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ch(e,t){mp(e,t),(e=e.alternate)&&mp(e,t)}function pk(){return null}var py=typeof reportError=="function"?reportError:function(e){console.error(e)};function dh(e){this._internalRoot=e}Eo.prototype.render=dh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(G(409));Co(e,t,null,null)};Eo.prototype.unmount=dh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;is(function(){Co(null,e,null,null)}),t[Wn]=null}};function Eo(e){this._internalRoot=e}Eo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vg();e={blockedOn:null,target:e,priority:t};for(var n=0;n<lr.length&&t!==0&&t<lr[n].priority;n++);lr.splice(n,0,e),n===0&&qg(e)}};function hh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function To(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function gp(){}function mk(e,t,n,r,i){if(i){if(typeof r=="function"){var l=r;r=function(){var c=Xa(a);l.call(c)}}var a=fy(t,r,e,0,null,!1,!1,"",gp);return e._reactRootContainer=a,e[Wn]=a.current,nl(e.nodeType===8?e.parentNode:e),is(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var c=Xa(u);o.call(c)}}var u=uh(e,0,!1,null,null,!1,!1,"",gp);return e._reactRootContainer=u,e[Wn]=u.current,nl(e.nodeType===8?e.parentNode:e),is(function(){Co(t,u,n,r)}),u}function Po(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=Xa(a);o.call(u)}}Co(t,a,e,i)}else a=mk(n,t,e,i,r);return Xa(a)}Hg=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ai(t.pendingLanes);n!==0&&(Ld(t,n|1),Ot(t,et()),!(Re&6)&&(Xs=et()+500,Tr()))}break;case 13:is(function(){var r=Vn(e,1);if(r!==null){var i=Pt();yn(r,e,1,i)}}),ch(e,1)}};Ad=function(e){if(e.tag===13){var t=Vn(e,134217728);if(t!==null){var n=Pt();yn(t,e,134217728,n)}ch(e,134217728)}};Wg=function(e){if(e.tag===13){var t=yr(e),n=Vn(e,t);if(n!==null){var r=Pt();yn(n,e,t,r)}ch(e,t)}};Vg=function(){return ze};Qg=function(e,t){var n=ze;try{return ze=e,t()}finally{ze=n}};ac=function(e,t,n){switch(t){case"input":if(ec(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=vo(r);if(!i)throw Error(G(90));bg(r),ec(r,i)}}}break;case"textarea":Ng(e,n);break;case"select":t=n.value,t!=null&&Os(e,!!n.multiple,t,!1)}};Ag=ih;Ig=is;var gk={usingClientEntryPoint:!1,Events:[vl,Ls,vo,Rg,Lg,ih]},wi={findFiberByHostInstance:qr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},xk={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:Gn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Mg(e),e===null?null:e.stateNode},findFiberByHostInstance:wi.findFiberByHostInstance||pk,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{mo=Zl.inject(xk),Rn=Zl}catch{}}Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gk;Jt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hh(t))throw Error(G(200));return fk(e,t,null,n)};Jt.createRoot=function(e,t){if(!hh(e))throw Error(G(299));var n=!1,r="",i=py;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=uh(e,1,!1,null,null,n,!1,r,i),e[Wn]=t.current,nl(e.nodeType===8?e.parentNode:e),new dh(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(G(188)):(e=Object.keys(e).join(","),Error(G(268,e)));return e=Mg(t),e=e===null?null:e.stateNode,e};Jt.flushSync=function(e){return is(e)};Jt.hydrate=function(e,t,n){if(!To(t))throw Error(G(200));return Po(null,e,t,!0,n)};Jt.hydrateRoot=function(e,t,n){if(!hh(e))throw Error(G(405));var r=n!=null&&n.hydratedSources||null,i=!1,l="",a=py;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=fy(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 Eo(t)};Jt.render=function(e,t,n){if(!To(t))throw Error(G(200));return Po(null,e,t,!1,n)};Jt.unmountComponentAtNode=function(e){if(!To(e))throw Error(G(40));return e._reactRootContainer?(is(function(){Po(null,null,e,!1,function(){e._reactRootContainer=null,e[Wn]=null})}),!0):!1};Jt.unstable_batchedUpdates=ih;Jt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!To(n))throw Error(G(200));if(e==null||e._reactInternals===void 0)throw Error(G(38));return Po(e,t,n,!1,r)};Jt.version="18.3.1-next-f1338f8080-20240426";function my(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(my)}catch(e){console.error(e)}}my(),mg.exports=Jt;var Pr=mg.exports;const yk=yd(Pr),vk=rg({__proto__:null,default:yk},[Pr]);var gy,xp=Pr;gy=xp.createRoot,xp.hydrateRoot;/**
|
|
41
|
+
* @remix-run/router v1.21.0
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
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 yp="popstate";function jk(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:ls(i)}return kk(t,n,null,e)}function we(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Zs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wk(){return Math.random().toString(36).substr(2,8)}function vp(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"?Rr(t):t,{state:n,key:t&&t.key||r||wk()})}function ls(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 Rr(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 kk(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(),y=w==null?null:w-c;c=w,u&&u({action:o,location:g.location,delta:y})}function p(w,y){o=st.Push;let x=dl(g.location,w,y);c=h()+1;let v=vp(x,c),b=g.createHref(x);try{a.pushState(v,"",b)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(b)}l&&u&&u({action:o,location:g.location,delta:1})}function m(w,y){o=st.Replace;let x=dl(g.location,w,y);c=h();let v=vp(x,c),b=g.createHref(x);a.replaceState(v,"",b),l&&u&&u({action:o,location:g.location,delta:0})}function f(w){let y=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof w=="string"?w:ls(w);return x=x.replace(/ $/,"%20"),we(y,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,y)}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(yp,d),u=w,()=>{i.removeEventListener(yp,d),u=null}},createHref(w){return t(i,w)},createURL:f,encodeLocation(w){let y=f(w);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:p,replace:m,go(w){return a.go(w)}};return g}var Me;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Me||(Me={}));const bk=new Set(["lazy","caseSensitive","path","id","index","children"]);function Sk(e){return e.index===!0}function Za(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`),Sk(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=Za(i.children,t,a,r)),u}})}function Vr(e,t,n){return n===void 0&&(n="/"),ba(e,t,n,!1)}function ba(e,t,n,r){let i=typeof t=="string"?Rr(t):t,l=kn(i.pathname||"/",n);if(l==null)return null;let a=xy(e);Ck(a);let o=null;for(let u=0;o==null&&u<a.length;++u){let c=$k(l);o=zk(a[u],c,r)}return o}function Nk(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 xy(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+'".')),xy(l.children,t,h,c)),!(l.path==null&&!l.index)&&t.push({path:c,score:Ik(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 yy(l.path))i(l,a,u)}),t}function yy(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=yy(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 Ck(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Dk(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Ek=/^:[\w-]+$/,Tk=3,Pk=2,Rk=1,Lk=10,Ak=-2,jp=e=>e==="*";function Ik(e,t){let n=e.split("/"),r=n.length;return n.some(jp)&&(r+=Ak),t&&(r+=Pk),n.filter(i=>!jp(i)).reduce((i,l)=>i+(Ek.test(l)?Tk:l===""?Rk:Lk),r)}function Dk(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 zk(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=eo({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},h),p=u.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=eo({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:Fk(Bn([l,d.pathnameBase])),route:p}),d.pathnameBase!=="/"&&(l=Bn([l,d.pathnameBase]))}return a}function eo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Mk(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:p,isOptional:m}=h;if(p==="*"){let g=o[d]||"";a=l.slice(0,l.length-g.length).replace(/(.)\/+$/,"$1")}const f=o[d];return m&&!f?c[p]=void 0:c[p]=(f||"").replace(/%2F/g,"/"),c},{}),pathname:l,pathnameBase:a,pattern:e}}function Mk(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Zs(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 $k(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zs(!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 kn(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 _k(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Rr(e):e;return{pathname:n?n.startsWith("/")?n:Ok(n,t):t,search:Uk(r),hash:Bk(i)}}function Ok(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 ju(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 vy(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function fh(e,t){let n=vy(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ph(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Rr(e):(i=Ve({},e),we(!i.pathname||!i.pathname.includes("?"),ju("?","pathname","search",i)),we(!i.pathname||!i.pathname.includes("#"),ju("#","pathname","hash",i)),we(!i.search||!i.search.includes("#"),ju("#","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 p=a.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}o=d>=0?t[d]:"/"}let u=_k(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,"/"),Fk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Uk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Bk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class to{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 Ro(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const jy=["post","put","patch","delete"],Hk=new Set(jy),Wk=["get",...jy],Vk=new Set(Wk),Qk=new Set([301,302,303,307,308]),qk=new Set([307,308]),wu={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Gk={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},bs={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},mh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kk=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),wy="remix-router-transitions";function Yk(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 R=e.detectErrorBoundary;i=z=>({hasErrorBoundary:R(z)})}else i=Kk;let l={},a=Za(e.routes,i,void 0,l),o,u=e.basename||"/",c=e.dataStrategy||e0,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),p=null,m=new Set,f=null,g=null,w=null,y=e.hydrationData!=null,x=Vr(a,e.history.location,u),v=null;if(x==null&&!h){let R=Dt(404,{pathname:e.history.location.pathname}),{matches:z,route:$}=Lp(a);x=z,v={[$.id]:R}}x&&!e.hydrationData&&Il(x,a,e.history.location.pathname).active&&(x=null);let b;if(x)if(x.some(R=>R.route.lazy))b=!1;else if(!x.some(R=>R.route.loader))b=!0;else if(d.v7_partialHydration){let R=e.hydrationData?e.hydrationData.loaderData:null,z=e.hydrationData?e.hydrationData.errors:null;if(z){let $=x.findIndex(H=>z[H.route.id]!==void 0);b=x.slice(0,$+1).every(H=>!Uc(H.route,R,z))}else b=x.every($=>!Uc($.route,R,z))}else b=e.hydrationData!=null;else if(b=!1,x=[],d.v7_partialHydration){let R=Il(null,a,e.history.location.pathname);R.active&&R.matches&&(x=R.matches)}let A,k={historyAction:e.history.action,location:e.history.location,matches:x,initialized:b,navigation:wu,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},T=st.Pop,P=!1,I,C=!1,L=new Map,S=null,D=!1,M=!1,U=[],ie=new Set,X=new Map,B=0,Y=-1,N=new Map,ae=new Set,O=new Map,E=new Map,F=new Set,J=new Map,ce=new Map,Te;function tt(){if(p=e.history.listen(R=>{let{action:z,location:$,delta:H}=R;if(Te){Te(),Te=void 0;return}Zs(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 te=gs({currentLocation:k.location,nextLocation:$,historyAction:z});if(te&&H!=null){let oe=new Promise(xe=>{Te=xe});e.history.go(H*-1),Or(te,{state:"blocked",location:$,proceed(){Or(te,{state:"proceeding",proceed:void 0,reset:void 0,location:$}),oe.then(()=>e.history.go(H))},reset(){let xe=new Map(k.blockers);xe.set(te,bs),Q({blockers:xe})}});return}return Zt(z,$)}),n){p0(t,L);let R=()=>m0(t,L);t.addEventListener("pagehide",R),S=()=>t.removeEventListener("pagehide",R)}return k.initialized||Zt(st.Pop,k.location,{initialHydration:!0}),A}function W(){p&&p(),S&&S(),m.clear(),I&&I.abort(),k.fetchers.forEach((R,z)=>pe(z)),k.blockers.forEach((R,z)=>er(z))}function ge(R){return m.add(R),()=>m.delete(R)}function Q(R,z){z===void 0&&(z={}),k=Ve({},k,R);let $=[],H=[];d.v7_fetcherPersist&&k.fetchers.forEach((te,oe)=>{te.state==="idle"&&(F.has(oe)?H.push(oe):$.push(oe))}),[...m].forEach(te=>te(k,{deletedFetchers:H,viewTransitionOpts:z.viewTransitionOpts,flushSync:z.flushSync===!0})),d.v7_fetcherPersist&&($.forEach(te=>k.fetchers.delete(te)),H.forEach(te=>pe(te)))}function de(R,z,$){var H,te;let{flushSync:oe}=$===void 0?{}:$,xe=k.actionData!=null&&k.navigation.formMethod!=null&&mn(k.navigation.formMethod)&&k.navigation.state==="loading"&&((H=R.state)==null?void 0:H._isRedirect)!==!0,re;z.actionData?Object.keys(z.actionData).length>0?re=z.actionData:re=null:xe?re=k.actionData:re=null;let le=z.loaderData?Pp(k.loaderData,z.loaderData,z.matches||[],z.errors):k.loaderData,ne=k.blockers;ne.size>0&&(ne=new Map(ne),ne.forEach((Pe,gt)=>ne.set(gt,bs)));let ue=P===!0||k.navigation.formMethod!=null&&mn(k.navigation.formMethod)&&((te=R.state)==null?void 0:te._isRedirect)!==!0;o&&(a=o,o=void 0),D||T===st.Pop||(T===st.Push?e.history.push(R,R.state):T===st.Replace&&e.history.replace(R,R.state));let Se;if(T===st.Pop){let Pe=L.get(k.location.pathname);Pe&&Pe.has(R.pathname)?Se={currentLocation:k.location,nextLocation:R}:L.has(R.pathname)&&(Se={currentLocation:R,nextLocation:k.location})}else if(C){let Pe=L.get(k.location.pathname);Pe?Pe.add(R.pathname):(Pe=new Set([R.pathname]),L.set(k.location.pathname,Pe)),Se={currentLocation:k.location,nextLocation:R}}Q(Ve({},z,{actionData:re,loaderData:le,historyAction:T,location:R,initialized:!0,navigation:wu,revalidation:"idle",restoreScrollPosition:af(R,z.matches||k.matches),preventScrollReset:ue,blockers:ne}),{viewTransitionOpts:Se,flushSync:oe===!0}),T=st.Pop,P=!1,C=!1,D=!1,M=!1,U=[]}async function ve(R,z){if(typeof R=="number"){e.history.go(R);return}let $=Fc(k.location,k.matches,u,d.v7_prependBasename,R,d.v7_relativeSplatPath,z==null?void 0:z.fromRouteId,z==null?void 0:z.relative),{path:H,submission:te,error:oe}=wp(d.v7_normalizeFormMethod,!1,$,z),xe=k.location,re=dl(k.location,H,z&&z.state);re=Ve({},re,e.history.encodeLocation(re));let le=z&&z.replace!=null?z.replace:void 0,ne=st.Push;le===!0?ne=st.Replace:le===!1||te!=null&&mn(te.formMethod)&&te.formAction===k.location.pathname+k.location.search&&(ne=st.Replace);let ue=z&&"preventScrollReset"in z?z.preventScrollReset===!0:void 0,Se=(z&&z.flushSync)===!0,Pe=gs({currentLocation:xe,nextLocation:re,historyAction:ne});if(Pe){Or(Pe,{state:"blocked",location:re,proceed(){Or(Pe,{state:"proceeding",proceed:void 0,reset:void 0,location:re}),ve(R,z)},reset(){let gt=new Map(k.blockers);gt.set(Pe,bs),Q({blockers:gt})}});return}return await Zt(ne,re,{submission:te,pendingError:oe,preventScrollReset:ue,replace:z&&z.replace,enableViewTransition:z&&z.viewTransition,flushSync:Se})}function ct(){if(ci(),Q({revalidation:"loading"}),k.navigation.state!=="submitting"){if(k.navigation.state==="idle"){Zt(k.historyAction,k.location,{startUninterruptedRevalidation:!0});return}Zt(T||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:C===!0})}}async function Zt(R,z,$){I&&I.abort(),I=null,T=R,D=($&&$.startUninterruptedRevalidation)===!0,Uj(k.location,k.matches),P=($&&$.preventScrollReset)===!0,C=($&&$.enableViewTransition)===!0;let H=o||a,te=$&&$.overrideNavigation,oe=Vr(H,z,u),xe=($&&$.flushSync)===!0,re=Il(oe,H,z.pathname);if(re.active&&re.matches&&(oe=re.matches),!oe){let{error:Ue,notFoundMatches:De,route:Ye}=mt(z.pathname);de(z,{matches:De,loaderData:{},errors:{[Ye.id]:Ue}},{flushSync:xe});return}if(k.initialized&&!M&&l0(k.location,z)&&!($&&$.submission&&mn($.submission.formMethod))){de(z,{matches:oe},{flushSync:xe});return}I=new AbortController;let le=ws(e.history,z,I.signal,$&&$.submission),ne;if($&&$.pendingError)ne=[Qr(oe).route.id,{type:Me.error,error:$.pendingError}];else if($&&$.submission&&mn($.submission.formMethod)){let Ue=await Z(le,z,$.submission,oe,re.active,{replace:$.replace,flushSync:xe});if(Ue.shortCircuited)return;if(Ue.pendingActionResult){let[De,Ye]=Ue.pendingActionResult;if(Vt(Ye)&&Ro(Ye.error)&&Ye.error.status===404){I=null,de(z,{matches:Ue.matches,loaderData:{},errors:{[De]:Ye.error}});return}}oe=Ue.matches||oe,ne=Ue.pendingActionResult,te=ku(z,$.submission),xe=!1,re.active=!1,le=ws(e.history,le.url,le.signal)}let{shortCircuited:ue,matches:Se,loaderData:Pe,errors:gt}=await Ce(le,z,oe,re.active,te,$&&$.submission,$&&$.fetcherSubmission,$&&$.replace,$&&$.initialHydration===!0,xe,ne);ue||(I=null,de(z,Ve({matches:Se||oe},Rp(ne),{loaderData:Pe,errors:gt})))}async function Z(R,z,$,H,te,oe){oe===void 0&&(oe={}),ci();let xe=h0(z,$);if(Q({navigation:xe},{flushSync:oe.flushSync===!0}),te){let ne=await Dl(H,z.pathname,R.signal);if(ne.type==="aborted")return{shortCircuited:!0};if(ne.type==="error"){let ue=Qr(ne.partialMatches).route.id;return{matches:ne.partialMatches,pendingActionResult:[ue,{type:Me.error,error:ne.error}]}}else if(ne.matches)H=ne.matches;else{let{notFoundMatches:ue,error:Se,route:Pe}=mt(z.pathname);return{matches:ue,pendingActionResult:[Pe.id,{type:Me.error,error:Se}]}}}let re,le=Di(H,z);if(!le.route.action&&!le.route.lazy)re={type:Me.error,error:Dt(405,{method:R.method,pathname:z.pathname,routeId:le.route.id})};else if(re=(await $r("action",k,R,[le],H,null))[le.route.id],R.signal.aborted)return{shortCircuited:!0};if(Yr(re)){let ne;return oe&&oe.replace!=null?ne=oe.replace:ne=Cp(re.response.headers.get("Location"),new URL(R.url),u)===k.location.pathname+k.location.search,await zn(R,re,!0,{submission:$,replace:ne}),{shortCircuited:!0}}if(cr(re))throw Dt(400,{type:"defer-action"});if(Vt(re)){let ne=Qr(H,le.route.id);return(oe&&oe.replace)!==!0&&(T=st.Push),{matches:H,pendingActionResult:[ne.route.id,re]}}return{matches:H,pendingActionResult:[le.route.id,re]}}async function Ce(R,z,$,H,te,oe,xe,re,le,ne,ue){let Se=te||ku(z,oe),Pe=oe||xe||Ip(Se),gt=!D&&(!d.v7_partialHydration||!le);if(H){if(gt){let Je=Ze(ue);Q(Ve({navigation:Se},Je!==void 0?{actionData:Je}:{}),{flushSync:ne})}let Le=await Dl($,z.pathname,R.signal);if(Le.type==="aborted")return{shortCircuited:!0};if(Le.type==="error"){let Je=Qr(Le.partialMatches).route.id;return{matches:Le.partialMatches,loaderData:{},errors:{[Je]:Le.error}}}else if(Le.matches)$=Le.matches;else{let{error:Je,notFoundMatches:ys,route:fi}=mt(z.pathname);return{matches:ys,loaderData:{},errors:{[fi.id]:Je}}}}let Ue=o||a,[De,Ye]=bp(e.history,k,$,Pe,z,d.v7_partialHydration&&le===!0,d.v7_skipActionErrorRevalidation,M,U,ie,F,O,ae,Ue,u,ue);if(bn(Le=>!($&&$.some(Je=>Je.route.id===Le))||De&&De.some(Je=>Je.route.id===Le)),Y=++B,De.length===0&&Ye.length===0){let Le=Bt();return de(z,Ve({matches:$,loaderData:{},errors:ue&&Vt(ue[1])?{[ue[0]]:ue[1].error}:null},Rp(ue),Le?{fetchers:new Map(k.fetchers)}:{}),{flushSync:ne}),{shortCircuited:!0}}if(gt){let Le={};if(!H){Le.navigation=Se;let Je=Ze(ue);Je!==void 0&&(Le.actionData=Je)}Ye.length>0&&(Le.fetchers=Mr(Ye)),Q(Le,{flushSync:ne})}Ye.forEach(Le=>{Ee(Le.key),Le.controller&&X.set(Le.key,Le.controller)});let xs=()=>Ye.forEach(Le=>Ee(Le.key));I&&I.signal.addEventListener("abort",xs);let{loaderResults:di,fetcherResults:Mn}=await Al(k,$,De,Ye,R);if(R.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener("abort",xs),Ye.forEach(Le=>X.delete(Le.key));let Sn=ea(di);if(Sn)return await zn(R,Sn.result,!0,{replace:re}),{shortCircuited:!0};if(Sn=ea(Mn),Sn)return ae.add(Sn.key),await zn(R,Sn.result,!0,{replace:re}),{shortCircuited:!0};let{loaderData:qo,errors:hi}=Tp(k,$,di,ue,Ye,Mn,J);J.forEach((Le,Je)=>{Le.subscribe(ys=>{(ys||Le.done)&&J.delete(Je)})}),d.v7_partialHydration&&le&&k.errors&&(hi=Ve({},k.errors,hi));let Fr=Bt(),zl=Zn(Y),Ml=Fr||zl||Ye.length>0;return Ve({matches:$,loaderData:qo,errors:hi},Ml?{fetchers:new Map(k.fetchers)}:{})}function Ze(R){if(R&&!Vt(R[1]))return{[R[0]]:R[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Mr(R){return R.forEach(z=>{let $=k.fetchers.get(z.key),H=ki(void 0,$?$.data:void 0);k.fetchers.set(z.key,H)}),new Map(k.fetchers)}function Rl(R,z,$,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(R);let te=(H&&H.flushSync)===!0,oe=o||a,xe=Fc(k.location,k.matches,u,d.v7_prependBasename,$,d.v7_relativeSplatPath,z,H==null?void 0:H.relative),re=Vr(oe,xe,u),le=Il(re,oe,xe);if(le.active&&le.matches&&(re=le.matches),!re){q(R,z,Dt(404,{pathname:xe}),{flushSync:te});return}let{path:ne,submission:ue,error:Se}=wp(d.v7_normalizeFormMethod,!0,xe,H);if(Se){q(R,z,Se,{flushSync:te});return}let Pe=Di(re,ne),gt=(H&&H.preventScrollReset)===!0;if(ue&&mn(ue.formMethod)){Ll(R,z,ne,Pe,re,le.active,te,gt,ue);return}O.set(R,{routeId:z,path:ne}),Qo(R,z,ne,Pe,re,le.active,te,gt,ue)}async function Ll(R,z,$,H,te,oe,xe,re,le){ci(),O.delete(R);function ne(nt){if(!nt.route.action&&!nt.route.lazy){let vs=Dt(405,{method:le.formMethod,pathname:$,routeId:z});return q(R,z,vs,{flushSync:xe}),!0}return!1}if(!oe&&ne(H))return;let ue=k.fetchers.get(R);_(R,f0(le,ue),{flushSync:xe});let Se=new AbortController,Pe=ws(e.history,$,Se.signal,le);if(oe){let nt=await Dl(te,$,Pe.signal);if(nt.type==="aborted")return;if(nt.type==="error"){q(R,z,nt.error,{flushSync:xe});return}else if(nt.matches){if(te=nt.matches,H=Di(te,$),ne(H))return}else{q(R,z,Dt(404,{pathname:$}),{flushSync:xe});return}}X.set(R,Se);let gt=B,De=(await $r("action",k,Pe,[H],te,R))[H.route.id];if(Pe.signal.aborted){X.get(R)===Se&&X.delete(R);return}if(d.v7_fetcherPersist&&F.has(R)){if(Yr(De)||Vt(De)){_(R,rr(void 0));return}}else{if(Yr(De))if(X.delete(R),Y>gt){_(R,rr(void 0));return}else return ae.add(R),_(R,ki(le)),zn(Pe,De,!1,{fetcherSubmission:le,preventScrollReset:re});if(Vt(De)){q(R,z,De.error);return}}if(cr(De))throw Dt(400,{type:"defer-action"});let Ye=k.navigation.location||k.location,xs=ws(e.history,Ye,Se.signal),di=o||a,Mn=k.navigation.state!=="idle"?Vr(di,k.navigation.location,u):k.matches;we(Mn,"Didn't find any matches after fetcher action");let Sn=++B;N.set(R,Sn);let qo=ki(le,De.data);k.fetchers.set(R,qo);let[hi,Fr]=bp(e.history,k,Mn,le,Ye,!1,d.v7_skipActionErrorRevalidation,M,U,ie,F,O,ae,di,u,[H.route.id,De]);Fr.filter(nt=>nt.key!==R).forEach(nt=>{let vs=nt.key,of=k.fetchers.get(vs),Wj=ki(void 0,of?of.data:void 0);k.fetchers.set(vs,Wj),Ee(vs),nt.controller&&X.set(vs,nt.controller)}),Q({fetchers:new Map(k.fetchers)});let zl=()=>Fr.forEach(nt=>Ee(nt.key));Se.signal.addEventListener("abort",zl);let{loaderResults:Ml,fetcherResults:Le}=await Al(k,Mn,hi,Fr,xs);if(Se.signal.aborted)return;Se.signal.removeEventListener("abort",zl),N.delete(R),X.delete(R),Fr.forEach(nt=>X.delete(nt.key));let Je=ea(Ml);if(Je)return zn(xs,Je.result,!1,{preventScrollReset:re});if(Je=ea(Le),Je)return ae.add(Je.key),zn(xs,Je.result,!1,{preventScrollReset:re});let{loaderData:ys,errors:fi}=Tp(k,Mn,Ml,void 0,Fr,Le,J);if(k.fetchers.has(R)){let nt=rr(De.data);k.fetchers.set(R,nt)}Zn(Sn),k.navigation.state==="loading"&&Sn>Y?(we(T,"Expected pending action"),I&&I.abort(),de(k.navigation.location,{matches:Mn,loaderData:ys,errors:fi,fetchers:new Map(k.fetchers)})):(Q({errors:fi,loaderData:Pp(k.loaderData,ys,Mn,fi),fetchers:new Map(k.fetchers)}),M=!1)}async function Qo(R,z,$,H,te,oe,xe,re,le){let ne=k.fetchers.get(R);_(R,ki(le,ne?ne.data:void 0),{flushSync:xe});let ue=new AbortController,Se=ws(e.history,$,ue.signal);if(oe){let De=await Dl(te,$,Se.signal);if(De.type==="aborted")return;if(De.type==="error"){q(R,z,De.error,{flushSync:xe});return}else if(De.matches)te=De.matches,H=Di(te,$);else{q(R,z,Dt(404,{pathname:$}),{flushSync:xe});return}}X.set(R,ue);let Pe=B,Ue=(await $r("loader",k,Se,[H],te,R))[H.route.id];if(cr(Ue)&&(Ue=await gh(Ue,Se.signal,!0)||Ue),X.get(R)===ue&&X.delete(R),!Se.signal.aborted){if(F.has(R)){_(R,rr(void 0));return}if(Yr(Ue))if(Y>Pe){_(R,rr(void 0));return}else{ae.add(R),await zn(Se,Ue,!1,{preventScrollReset:re});return}if(Vt(Ue)){q(R,z,Ue.error);return}we(!cr(Ue),"Unhandled fetcher deferred data"),_(R,rr(Ue.data))}}async function zn(R,z,$,H){let{submission:te,fetcherSubmission:oe,preventScrollReset:xe,replace:re}=H===void 0?{}:H;z.response.headers.has("X-Remix-Revalidate")&&(M=!0);let le=z.response.headers.get("Location");we(le,"Expected a Location header on the redirect Response"),le=Cp(le,new URL(R.url),u);let ne=dl(k.location,le,{_isRedirect:!0});if(n){let De=!1;if(z.response.headers.has("X-Remix-Reload-Document"))De=!0;else if(mh.test(le)){const Ye=e.history.createURL(le);De=Ye.origin!==t.location.origin||kn(Ye.pathname,u)==null}if(De){re?t.location.replace(le):t.location.assign(le);return}}I=null;let ue=re===!0||z.response.headers.has("X-Remix-Replace")?st.Replace:st.Push,{formMethod:Se,formAction:Pe,formEncType:gt}=k.navigation;!te&&!oe&&Se&&Pe&>&&(te=Ip(k.navigation));let Ue=te||oe;if(qk.has(z.response.status)&&Ue&&mn(Ue.formMethod))await Zt(ue,ne,{submission:Ve({},Ue,{formAction:le}),preventScrollReset:xe||P,enableViewTransition:$?C:void 0});else{let De=ku(ne,te);await Zt(ue,ne,{overrideNavigation:De,fetcherSubmission:oe,preventScrollReset:xe||P,enableViewTransition:$?C:void 0})}}async function $r(R,z,$,H,te,oe){let xe,re={};try{xe=await t0(c,R,z,$,H,te,oe,l,i)}catch(le){return H.forEach(ne=>{re[ne.route.id]={type:Me.error,error:le}}),re}for(let[le,ne]of Object.entries(xe))if(a0(ne)){let ue=ne.result;re[le]={type:Me.redirect,response:s0(ue,$,le,te,u,d.v7_relativeSplatPath)}}else re[le]=await r0(ne);return re}async function Al(R,z,$,H,te){let oe=R.matches,xe=$r("loader",R,te,$,z,null),re=Promise.all(H.map(async ue=>{if(ue.matches&&ue.match&&ue.controller){let Pe=(await $r("loader",R,ws(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:Me.error,error:Dt(404,{pathname:ue.path})}})})),le=await xe,ne=(await re).reduce((ue,Se)=>Object.assign(ue,Se),{});return await Promise.all([c0(z,le,te.signal,oe,R.loaderData),d0(z,ne,H)]),{loaderResults:le,fetcherResults:ne}}function ci(){M=!0,U.push(...bn()),O.forEach((R,z)=>{X.has(z)&&ie.add(z),Ee(z)})}function _(R,z,$){$===void 0&&($={}),k.fetchers.set(R,z),Q({fetchers:new Map(k.fetchers)},{flushSync:($&&$.flushSync)===!0})}function q(R,z,$,H){H===void 0&&(H={});let te=Qr(k.matches,z);pe(R),Q({errors:{[te.route.id]:$},fetchers:new Map(k.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function fe(R){return d.v7_fetcherPersist&&(E.set(R,(E.get(R)||0)+1),F.has(R)&&F.delete(R)),k.fetchers.get(R)||Gk}function pe(R){let z=k.fetchers.get(R);X.has(R)&&!(z&&z.state==="loading"&&N.has(R))&&Ee(R),O.delete(R),N.delete(R),ae.delete(R),F.delete(R),ie.delete(R),k.fetchers.delete(R)}function bt(R){if(d.v7_fetcherPersist){let z=(E.get(R)||0)-1;z<=0?(E.delete(R),F.add(R)):E.set(R,z)}else pe(R);Q({fetchers:new Map(k.fetchers)})}function Ee(R){let z=X.get(R);z&&(z.abort(),X.delete(R))}function pt(R){for(let z of R){let $=fe(z),H=rr($.data);k.fetchers.set(z,H)}}function Bt(){let R=[],z=!1;for(let $ of ae){let H=k.fetchers.get($);we(H,"Expected fetcher: "+$),H.state==="loading"&&(ae.delete($),R.push($),z=!0)}return pt(R),z}function Zn(R){let z=[];for(let[$,H]of N)if(H<R){let te=k.fetchers.get($);we(te,"Expected fetcher: "+$),te.state==="loading"&&(Ee($),N.delete($),z.push($))}return pt(z),z.length>0}function _r(R,z){let $=k.blockers.get(R)||bs;return ce.get(R)!==z&&ce.set(R,z),$}function er(R){k.blockers.delete(R),ce.delete(R)}function Or(R,z){let $=k.blockers.get(R)||bs;we($.state==="unblocked"&&z.state==="blocked"||$.state==="blocked"&&z.state==="blocked"||$.state==="blocked"&&z.state==="proceeding"||$.state==="blocked"&&z.state==="unblocked"||$.state==="proceeding"&&z.state==="unblocked","Invalid blocker state transition: "+$.state+" -> "+z.state);let H=new Map(k.blockers);H.set(R,z),Q({blockers:H})}function gs(R){let{currentLocation:z,nextLocation:$,historyAction:H}=R;if(ce.size===0)return;ce.size>1&&Zs(!1,"A router only supports one blocker at a time");let te=Array.from(ce.entries()),[oe,xe]=te[te.length-1],re=k.blockers.get(oe);if(!(re&&re.state==="proceeding")&&xe({currentLocation:z,nextLocation:$,historyAction:H}))return oe}function mt(R){let z=Dt(404,{pathname:R}),$=o||a,{matches:H,route:te}=Lp($);return bn(),{notFoundMatches:H,route:te,error:z}}function bn(R){let z=[];return J.forEach(($,H)=>{(!R||R(H))&&($.cancel(),z.push(H),J.delete(H))}),z}function dn(R,z,$){if(f=R,w=z,g=$||null,!y&&k.navigation===wu){y=!0;let H=af(k.location,k.matches);H!=null&&Q({restoreScrollPosition:H})}return()=>{f=null,w=null,g=null}}function lf(R,z){return g&&g(R,z.map(H=>Nk(H,k.loaderData)))||R.key}function Uj(R,z){if(f&&w){let $=lf(R,z);f[$]=w()}}function af(R,z){if(f){let $=lf(R,z),H=f[$];if(typeof H=="number")return H}return null}function Il(R,z,$){if(h)if(R){if(Object.keys(R[0].params).length>0)return{active:!0,matches:ba(z,$,u,!0)}}else return{active:!0,matches:ba(z,$,u,!0)||[]};return{active:!1,matches:null}}async function Dl(R,z,$){if(!h)return{type:"success",matches:R};let H=R;for(;;){let te=o==null,oe=o||a,xe=l;try{await h({path:z,matches:H,patch:(ne,ue)=>{$.aborted||Np(ne,ue,oe,xe,i)}})}catch(ne){return{type:"error",error:ne,partialMatches:H}}finally{te&&!$.aborted&&(a=[...a])}if($.aborted)return{type:"aborted"};let re=Vr(oe,z,u);if(re)return{type:"success",matches:re};let le=ba(oe,z,u,!0);if(!le||H.length===le.length&&H.every((ne,ue)=>ne.route.id===le[ue].route.id))return{type:"success",matches:null};H=le}}function Bj(R){l={},o=Za(R,i,void 0,l)}function Hj(R,z){let $=o==null;Np(R,z,o||a,l,i),$&&(a=[...a],Q({}))}return A={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:dn,navigate:ve,fetch:Rl,revalidate:ct,createHref:R=>e.history.createHref(R),encodeLocation:R=>e.history.encodeLocation(R),getFetcher:fe,deleteFetcher:bt,dispose:W,getBlocker:_r,deleteBlocker:er,patchRoutes:Hj,_internalFetchControllers:X,_internalActiveDeferreds:J,_internalSetRoutes:Bj},A}function Jk(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Fc(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=ph(i||".",fh(u,l),kn(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=xh(h.search);if(c.route.index&&!d)h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let p=new URLSearchParams(h.search),m=p.getAll("index");p.delete("index"),m.filter(g=>g).forEach(g=>p.append("index",g));let f=p.toString();h.search=f?"?"+f:""}}return r&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Bn([n,h.pathname])),ls(h)}function wp(e,t,n,r){if(!r||!Jk(r))return{path:n};if(r.formMethod&&!u0(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=Sy(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!mn(a))return i();let p=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,f)=>{let[g,w]=f;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:p}}}else if(r.formEncType==="application/json"){if(!mn(a))return i();try{let p=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:p,text:void 0}}}catch{return i()}}}we(typeof FormData=="function","FormData is not available in this environment");let u,c;if(r.formData)u=Bc(r.formData),c=r.formData;else if(r.body instanceof FormData)u=Bc(r.body),c=r.body;else if(r.body instanceof URLSearchParams)u=r.body,c=Ep(u);else if(r.body==null)u=new URLSearchParams,c=new FormData;else try{u=new URLSearchParams(r.body),c=Ep(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(mn(h.formMethod))return{path:n,submission:h};let d=Rr(n);return t&&d.search&&xh(d.search)&&u.append("index",""),d.search="?"+u,{path:ls(d),submission:h}}function kp(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 bp(e,t,n,r,i,l,a,o,u,c,h,d,p,m,f,g){let w=g?Vt(g[1])?g[1].error:g[1].data:void 0,y=e.createURL(t.location),x=e.createURL(i),v=n;l&&t.errors?v=kp(n,Object.keys(t.errors)[0],!0):g&&Vt(g[1])&&(v=kp(n,g[0]));let b=g?g[1].statusCode:void 0,A=a&&b&&b>=400,k=v.filter((P,I)=>{let{route:C}=P;if(C.lazy)return!0;if(C.loader==null)return!1;if(l)return Uc(C,t.loaderData,t.errors);if(Xk(t.loaderData,t.matches[I],P)||u.some(D=>D===P.route.id))return!0;let L=t.matches[I],S=P;return Sp(P,Ve({currentUrl:y,currentParams:L.params,nextUrl:x,nextParams:S.params},r,{actionResult:w,actionStatus:b,defaultShouldRevalidate:A?!1:o||y.pathname+y.search===x.pathname+x.search||y.search!==x.search||ky(L,S)}))}),T=[];return d.forEach((P,I)=>{if(l||!n.some(M=>M.route.id===P.routeId)||h.has(I))return;let C=Vr(m,P.path,f);if(!C){T.push({key:I,routeId:P.routeId,path:P.path,matches:null,match:null,controller:null});return}let L=t.fetchers.get(I),S=Di(C,P.path),D=!1;p.has(I)?D=!1:c.has(I)?(c.delete(I),D=!0):L&&L.state!=="idle"&&L.data===void 0?D=o:D=Sp(S,Ve({currentUrl:y,currentParams:t.matches[t.matches.length-1].params,nextUrl:x,nextParams:n[n.length-1].params},r,{actionResult:w,actionStatus:b,defaultShouldRevalidate:A?!1:o})),D&&T.push({key:I,routeId:P.routeId,path:P.path,matches:C,match:S,controller:new AbortController})}),[k,T]}function Uc(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 Xk(e,t,n){let r=!t||n.route.id!==t.route.id,i=e[n.route.id]===void 0;return r||i}function ky(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Sp(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Np(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=>by(c,h))),u=Za(o,i,[e||"_","patch",String(((l=a)==null?void 0:l.length)||"0")],r);a.push(...u)}function by(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=>by(n,l))}):!1}async function Zk(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";Zs(!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&&!bk.has(a)&&(l[a]=r[a])}Object.assign(i,l),Object.assign(i,Ve({},t(i),{lazy:void 0}))}async function e0(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 t0(e,t,n,r,i,l,a,o,u,c){let h=l.map(m=>m.route.lazy?Zk(m.route,u,o):void 0),d=l.map((m,f)=>{let g=h[f],w=i.some(x=>x.route.id===m.route.id);return Ve({},m,{shouldLoad:w,resolve:async x=>(x&&r.method==="GET"&&(m.route.lazy||m.route.loader)&&(w=!0),w?n0(t,r,m,g,x,c):Promise.resolve({type:Me.data,result:void 0}))})}),p=await e({matches:d,request:r,params:l[0].params,fetcherKey:a,context:c});try{await Promise.all(h)}catch{}return p}async function n0(e,t,n,r,i,l){let a,o,u=c=>{let h,d=new Promise((f,g)=>h=g);o=()=>h(),t.signal.addEventListener("abort",o);let p=f=>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},...f!==void 0?[f]:[]),m=(async()=>{try{return{type:"data",result:await(i?i(g=>p(g)):p())}}catch(f){return{type:"error",result:f}}})();return Promise.race([m,d])};try{let c=n.route[e];if(r)if(c){let h,[d]=await Promise.all([u(c).catch(p=>{h=p}),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:Me.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:Me.error,result:c}}finally{o&&t.signal.removeEventListener("abort",o)}return a}async function r0(e){let{result:t,type:n}=e;if(Ny(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:Me.error,error:h}}return n===Me.error?{type:Me.error,error:new to(t.status,t.statusText,c),statusCode:t.status,headers:t.headers}:{type:Me.data,data:c,statusCode:t.status,headers:t.headers}}if(n===Me.error){if(Ap(t)){var r;if(t.data instanceof Error){var i;return{type:Me.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status}}t=new to(((r=t.init)==null?void 0:r.status)||500,void 0,t.data)}return{type:Me.error,error:t,statusCode:Ro(t)?t.status:void 0}}if(o0(t)){var l,a;return{type:Me.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(Ap(t)){var o,u;return{type:Me.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:Me.data,data:t}}function s0(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"),!mh.test(a)){let o=r.slice(0,r.findIndex(u=>u.route.id===n)+1);a=Fc(new URL(t.url),o,i,!0,a,l),e.headers.set("Location",a)}return e}function Cp(e,t,n){if(mh.test(e)){let r=e,i=r.startsWith("//")?new URL(t.protocol+r):new URL(r),l=kn(i.pathname,n)!=null;if(i.origin===t.origin&&l)return i.pathname+i.search+i.hash}return e}function ws(e,t,n,r){let i=e.createURL(Sy(t)).toString(),l={signal:n};if(r&&mn(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=Bc(r.formData):l.body=r.formData}return new Request(i,l)}function Bc(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Ep(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function i0(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 p=d.route.id,m=t[p];if(we(!Yr(m),"Cannot handle redirect results in processLoaderData"),Vt(m)){let f=m.error;h!==void 0&&(f=h,h=void 0),a=a||{};{let g=Qr(e,p);a[g.route.id]==null&&(a[g.route.id]=f)}l[p]=void 0,u||(u=!0,o=Ro(m.error)?m.error.status:500),m.headers&&(c[p]=m.headers)}else cr(m)?(r.set(p,m.deferredData),l[p]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[p]=m.headers)):(l[p]=m.data,m.statusCode&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[p]=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 Tp(e,t,n,r,i,l,a){let{loaderData:o,errors:u}=i0(t,n,r,a);return i.forEach(c=>{let{key:h,match:d,controller:p}=c,m=l[h];if(we(m,"Did not find corresponding fetcher result"),!(p&&p.signal.aborted))if(Vt(m)){let f=Qr(e.matches,d==null?void 0:d.route.id);u&&u[f.route.id]||(u=Ve({},u,{[f.route.id]:m.error})),e.fetchers.delete(h)}else if(Yr(m))we(!1,"Unhandled fetcher revalidation redirect");else if(cr(m))we(!1,"Unhandled fetcher deferred data");else{let f=rr(m.data);e.fetchers.set(h,f)}}),{loaderData:o,errors:u}}function Pp(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 Rp(e){return e?Vt(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Qr(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 Lp(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 to(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(Yr(i))return{key:r,result:i}}}function Sy(e){let t=typeof e=="string"?Rr(e):e;return ls(Ve({},t,{hash:""}))}function l0(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function a0(e){return Ny(e.result)&&Qk.has(e.result.status)}function cr(e){return e.type===Me.deferred}function Vt(e){return e.type===Me.error}function Yr(e){return(e&&e.type)===Me.redirect}function Ap(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function o0(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 Ny(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function u0(e){return Vk.has(e.toLowerCase())}function mn(e){return Hk.has(e.toLowerCase())}async function c0(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(p=>(p==null?void 0:p.route.id)===o);if(!c)continue;let h=r.find(p=>p.route.id===c.route.id),d=h!=null&&!ky(h,c)&&(i&&i[c.route.id])!==void 0;cr(u)&&d&&await gh(u,n,!1).then(p=>{p&&(t[o]=p)})}}async function d0(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)&&cr(o)&&(we(a,"Expected an AbortController for revalidating fetcher deferred result"),await gh(o,a.signal,!0).then(c=>{c&&(t[i]=c)}))}}async function gh(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Me.data,data:e.deferredData.unwrappedData}}catch(i){return{type:Me.error,error:i}}return{type:Me.data,data:e.deferredData.data}}}function xh(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Di(e,t){let n=typeof t=="string"?Rr(t).search:t.search;if(e[e.length-1].route.index&&xh(n||""))return e[e.length-1];let r=vy(e);return r[r.length-1]}function Ip(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 ku(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 h0(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 f0(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 rr(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 p0(e,t){try{let n=e.sessionStorage.getItem(wy);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 m0(e,t){if(t.size>0){let n={};for(let[r,i]of t)n[r]=[...i];try{e.sessionStorage.setItem(wy,JSON.stringify(n))}catch(r){Zs(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
|
|
51
|
+
* React Router v6.28.0
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) Remix Software Inc.
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license found in the
|
|
56
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
57
|
+
*
|
|
58
|
+
* @license MIT
|
|
59
|
+
*/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)}const wl=j.createContext(null),yh=j.createContext(null),Lr=j.createContext(null),vh=j.createContext(null),Kn=j.createContext({outlet:null,matches:[],isDataRoute:!1}),Cy=j.createContext(null);function g0(e,t){let{relative:n}=t===void 0?{}:t;kl()||we(!1);let{basename:r,navigator:i}=j.useContext(Lr),{hash:l,pathname:a,search:o}=Lo(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(vh)!=null}function Yn(){return kl()||we(!1),j.useContext(vh).location}function Ey(e){j.useContext(Lr).static||j.useLayoutEffect(e)}function ut(){let{isDataRoute:e}=j.useContext(Kn);return e?P0():x0()}function x0(){kl()||we(!1);let e=j.useContext(wl),{basename:t,future:n,navigator:r}=j.useContext(Lr),{matches:i}=j.useContext(Kn),{pathname:l}=Yn(),a=JSON.stringify(fh(i,n.v7_relativeSplatPath)),o=j.useRef(!1);return Ey(()=>{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=ph(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 y0=j.createContext(null);function v0(e){let t=j.useContext(Kn).outlet;return t&&j.createElement(y0.Provider,{value:e},t)}function ai(){let{matches:e}=j.useContext(Kn),t=e[e.length-1];return t?t.params:{}}function Lo(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=j.useContext(Lr),{matches:i}=j.useContext(Kn),{pathname:l}=Yn(),a=JSON.stringify(fh(i,r.v7_relativeSplatPath));return j.useMemo(()=>ph(e,JSON.parse(a),l,n==="path"),[e,a,l,n])}function j0(e,t,n,r){kl()||we(!1);let{navigator:i}=j.useContext(Lr),{matches:l}=j.useContext(Kn),a=l[l.length-1],o=a?a.params:{};a&&a.pathname;let u=a?a.pathnameBase:"/";a&&a.route;let c=Yn(),h;h=c;let d=h.pathname||"/",p=d;if(u!=="/"){let g=u.replace(/^\//,"").split("/");p="/"+d.replace(/^\//,"").split("/").slice(g.length).join("/")}let m=Vr(e,{pathname:p});return N0(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 w0(){let e=E0(),t=Ro(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 k0=j.createElement(w0,null);class b0 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(Kn.Provider,{value:this.props.routeContext},j.createElement(Cy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function S0(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(Kn.Provider,{value:t},r)}function N0(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:p,errors:m}=n,f=d.route.loader&&p[d.route.id]===void 0&&(!m||m[d.route.id]===void 0);if(d.route.lazy||f){u=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((h,d,p)=>{let m,f=!1,g=null,w=null;n&&(m=o&&d.route.id?o[d.route.id]:void 0,g=d.route.errorElement||k0,u&&(c<0&&p===0?(R0("route-fallback"),f=!0,w=null):c===p&&(f=!0,w=d.route.hydrateFallbackElement||null)));let y=t.concat(a.slice(0,p+1)),x=()=>{let v;return m?v=g:f?v=w:d.route.Component?v=j.createElement(d.route.Component,null):d.route.element?v=d.route.element:v=h,j.createElement(S0,{match:d,routeContext:{outlet:h,matches:y,isDataRoute:n!=null},children:v})};return n&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?j.createElement(b0,{location:n.location,revalidation:n.revalidation,component:g,error:m,children:x(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):x()},null)}var Ty=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Ty||{}),Py=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}(Py||{});function Ry(e){let t=j.useContext(wl);return t||we(!1),t}function Ly(e){let t=j.useContext(yh);return t||we(!1),t}function C0(e){let t=j.useContext(Kn);return t||we(!1),t}function Ay(e){let t=C0(),n=t.matches[t.matches.length-1];return n.route.id||we(!1),n.route.id}function E0(){var e;let t=j.useContext(Cy),n=Ly(),r=Ay();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}let T0=0;function jh(e){let{router:t,basename:n}=Ry(Ty.UseBlocker),r=Ly(Py.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:ei({},u,{pathname:kn(u.pathname,n)||u.pathname}),nextLocation:ei({},c,{pathname:kn(c.pathname,n)||c.pathname}),historyAction:h})},[n,e]);return j.useEffect(()=>{let o=String(++T0);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):bs}function P0(){let{router:e}=Ry(),t=Ay(),n=j.useRef(!1);return Ey(()=>{n.current=!0}),j.useCallback(function(i,l){l===void 0&&(l={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ei({fromRouteId:t},l)))},[e,t])}const Dp={};function R0(e,t,n){Dp[e]||(Dp[e]=!0)}const zp={};function L0(e,t){zp[t]||(zp[t]=!0,console.warn(t))}const ks=(e,t,n)=>L0(e,"⚠️ React Router Future Flag Warning: "+t+". "+("You can use the `"+e+"` future flag to opt-in early. ")+("For more information, see "+n+"."));function A0(e,t){e!=null&&e.v7_startTransition||ks("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)&&ks("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),t&&(t.v7_fetcherPersist||ks("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),t.v7_normalizeFormMethod||ks("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),t.v7_partialHydration||ks("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),t.v7_skipActionErrorRevalidation||ks("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function I0(e){return v0(e.context)}function D0(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:ei({v7_relativeSplatPath:!1},o)}),[u,o,l,a]);typeof r=="string"&&(r=Rr(r));let{pathname:h="/",search:d="",hash:p="",state:m=null,key:f="default"}=r,g=j.useMemo(()=>{let w=kn(h,u);return w==null?null:{location:{pathname:w,search:d,hash:p,state:m,key:f},navigationType:i}},[u,h,d,p,m,f,i]);return g==null?null:j.createElement(Lr.Provider,{value:c},j.createElement(vh.Provider,{children:n,value:g}))}new Promise(()=>{});function z0(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
|
+
* React Router DOM v6.28.0
|
|
61
|
+
*
|
|
62
|
+
* Copyright (c) Remix Software Inc.
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the MIT license found in the
|
|
65
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
66
|
+
*
|
|
67
|
+
* @license MIT
|
|
68
|
+
*/function ti(){return ti=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},ti.apply(this,arguments)}function Iy(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 M0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $0(e,t){return e.button===0&&(!t||t==="_self")&&!M0(e)}function Hc(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 _0(e,t){let n=Hc(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}const O0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],F0=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],U0="6";try{window.__reactRouterVersion=U0}catch{}function B0(e,t){return Yk({basename:t==null?void 0:t.basename,future:ti({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:jk({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||H0(),routes:e,mapRouteProperties:z0,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window}).initialize()}function H0(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=ti({},t,{errors:W0(t.errors)})),t}function W0(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 to(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 Dy=j.createContext({isTransitioning:!1}),V0=j.createContext(new Map),Q0="startTransition",Mp=aw[Q0],q0="flushSync",$p=vk[q0];function G0(e){Mp?Mp(e):e()}function bi(e){$p?$p(e):e()}class K0{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 Y0(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(),[p,m]=j.useState(),[f,g]=j.useState(),w=j.useRef(new Map),{v7_startTransition:y}=r||{},x=j.useCallback(P=>{y?G0(P):P()},[y]),v=j.useCallback((P,I)=>{let{deletedFetchers:C,flushSync:L,viewTransitionOpts:S}=I;C.forEach(M=>w.current.delete(M)),P.fetchers.forEach((M,U)=>{M.data!==void 0&&w.current.set(U,M.data)});let D=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!S||D){L?bi(()=>l(P)):x(()=>l(P));return}if(L){bi(()=>{p&&(h&&h.resolve(),p.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:S.currentLocation,nextLocation:S.nextLocation})});let M=n.window.document.startViewTransition(()=>{bi(()=>l(P))});M.finished.finally(()=>{bi(()=>{d(void 0),m(void 0),o(void 0),c({isTransitioning:!1})})}),bi(()=>m(M));return}p?(h&&h.resolve(),p.skipTransition(),g({state:P,currentLocation:S.currentLocation,nextLocation:S.nextLocation})):(o(P),c({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}))},[n.window,p,h,w,x]);j.useLayoutEffect(()=>n.subscribe(v),[n,v]),j.useEffect(()=>{u.isTransitioning&&!u.flushSync&&d(new K0)},[u]),j.useEffect(()=>{if(h&&a&&n.window){let P=a,I=h.promise,C=n.window.document.startViewTransition(async()=>{x(()=>l(P)),await I});C.finished.finally(()=>{d(void 0),m(void 0),o(void 0),c({isTransitioning:!1})}),m(C)}},[x,a,h,n.window]),j.useEffect(()=>{h&&a&&i.location.key===a.location.key&&h.resolve()},[h,p,i.location,a]),j.useEffect(()=>{!u.isTransitioning&&f&&(o(f.state),c({isTransitioning:!0,flushSync:!1,currentLocation:f.currentLocation,nextLocation:f.nextLocation}),g(void 0))},[u.isTransitioning,f]),j.useEffect(()=>{},[]);let b=j.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:P=>n.navigate(P),push:(P,I,C)=>n.navigate(P,{state:I,preventScrollReset:C==null?void 0:C.preventScrollReset}),replace:(P,I,C)=>n.navigate(P,{replace:!0,state:I,preventScrollReset:C==null?void 0:C.preventScrollReset})}),[n]),A=n.basename||"/",k=j.useMemo(()=>({router:n,navigator:b,static:!1,basename:A}),[n,b,A]),T=j.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return j.useEffect(()=>A0(r,n.future),[r,n.future]),j.createElement(j.Fragment,null,j.createElement(wl.Provider,{value:k},j.createElement(yh.Provider,{value:i},j.createElement(V0.Provider,{value:w.current},j.createElement(Dy.Provider,{value:u},j.createElement(D0,{basename:A,location:i.location,navigationType:i.historyAction,navigator:b,future:T},i.initialized||n.future.v7_partialHydration?j.createElement(J0,{routes:n.routes,future:n.future,state:i}):t))))),null)}const J0=j.memo(X0);function X0(e){let{routes:t,future:n,state:r}=e;return j0(t,void 0,r,n)}const Z0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",eb=/^(?:[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,p=Iy(t,O0),{basename:m}=j.useContext(Lr),f,g=!1;if(typeof c=="string"&&eb.test(c)&&(f=c,Z0))try{let v=new URL(window.location.href),b=c.startsWith("//")?new URL(v.protocol+c):new URL(c),A=kn(b.pathname,m);b.origin===v.origin&&A!=null?c=A+b.search+b.hash:g=!0}catch{}let w=g0(c,{relative:i}),y=rb(c,{replace:a,state:o,target:u,preventScrollReset:h,relative:i,viewTransition:d});function x(v){r&&r(v),v.defaultPrevented||y(v)}return j.createElement("a",ti({},p,{href:f||w,onClick:g||l?r:x,ref:n,target:u}))}),tb=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=Iy(t,F0),p=Lo(u,{relative:d.relative}),m=Yn(),f=j.useContext(yh),{navigator:g,basename:w}=j.useContext(Lr),y=f!=null&&sb(p)&&c===!0,x=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,v=m.pathname,b=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;i||(v=v.toLowerCase(),b=b?b.toLowerCase():null,x=x.toLowerCase()),b&&w&&(b=kn(b,w)||b);const A=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let k=v===x||!a&&v.startsWith(x)&&v.charAt(A)==="/",T=b!=null&&(b===x||!a&&b.startsWith(x)&&b.charAt(x.length)==="/"),P={isActive:k,isPending:T,isTransitioning:y},I=k?r:void 0,C;typeof l=="function"?C=l(P):C=[l,k?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(P):o;return j.createElement(ye,ti({},d,{"aria-current":I,className:C,ref:n,style:L,to:u,viewTransition:c}),typeof h=="function"?h(P):h)});var Wc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Wc||(Wc={}));var _p;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(_p||(_p={}));function nb(e){let t=j.useContext(wl);return t||we(!1),t}function rb(e,t){let{target:n,replace:r,state:i,preventScrollReset:l,relative:a,viewTransition:o}=t===void 0?{}:t,u=ut(),c=Yn(),h=Lo(e,{relative:a});return j.useCallback(d=>{if($0(d,n)){d.preventDefault();let p=r!==void 0?r:ls(c)===ls(h);u(e,{replace:p,state:i,preventScrollReset:l,relative:a,viewTransition:o})}},[c,u,h,r,i,n,e,l,a,o])}function wh(e){let t=j.useRef(Hc(e)),n=j.useRef(!1),r=Yn(),i=j.useMemo(()=>_0(r.search,n.current?null:t.current),[r.search]),l=ut(),a=j.useCallback((o,u)=>{const c=Hc(typeof o=="function"?o(i):o);n.current=!0,l("?"+c,u)},[l,i]);return[i,a]}function sb(e,t){t===void 0&&(t={});let n=j.useContext(Dy);n==null&&we(!1);let{basename:r}=nb(Wc.useViewTransitionState),i=Lo(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=kn(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=kn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return eo(i.pathname,a)!=null||eo(i.pathname,l)!=null}class no extends Error{constructor(t,n){super(n),this.status=t}}const Vc="qa-studio:server-down";async function ib(){try{return(await fetch("/api/health",{cache:"no-store"})).ok}catch{return!1}}async function se(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(Vc)),new no(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 no(r.status,Array.isArray(i.message)?i.message.join(", "):i.message??r.statusText);return i}const $e=encodeURIComponent,bu=e=>Object.entries(e).filter(([,t])=>t!==void 0&&t!=="").map(([t,n])=>`${$e(t)}=${$e(String(n))}`).join("&"),V={dashboard:()=>se("GET","/api/dashboard"),specs:()=>se("GET","/api/specs"),spec:e=>se("GET",`/api/specs/${$e(e)}`),createSpec:(e,t)=>se("POST","/api/specs",{file:e,content:t}),saveSpec:(e,t,n)=>se("PUT",`/api/specs/${$e(e)}`,{content:t,baseMtime:n}),deleteSpec:e=>se("DELETE",`/api/specs/${$e(e)}`),mapping:()=>se("GET","/api/mapping"),mappingPage:e=>se("GET",`/api/mapping/page?${bu(e)}`),jobs:()=>se("GET","/api/jobs"),jobsPage:e=>se("GET",`/api/jobs?${bu(e)}`),job:e=>se("GET",`/api/jobs/${e}`),agentRun:(e,t)=>se("GET",`/api/jobs/${e}/agents/${t}`),createJob:e=>se("POST","/api/jobs",e),cancelJob:e=>se("POST",`/api/jobs/${e}/cancel`),approveJob:(e,t)=>se("POST",`/api/jobs/${e}/approve`,t?{comment:t}:void 0),rerunFailedJob:e=>se("POST",`/api/jobs/${e}/rerun-failed`),rejectJob:(e,t)=>se("POST",`/api/jobs/${e}/reject`,{reason:t}),answerJob:(e,t,n={})=>se("POST",`/api/jobs/${e}/answer`,{answers:t,...n.comment?{comment:n.comment}:{},...n.approve?{approve:!0}:{}}),jobRequirement:e=>se("GET",`/api/jobs/${e}/requirement`),jobInput:e=>se("GET",`/api/jobs/${e}/input`),settings:()=>se("GET","/api/settings"),saveSettings:e=>se("PUT","/api/settings",e),usage:e=>se("GET",`/api/usage?days=${e}`),searchTestCases:e=>se("POST","/api/test-cases/search",e),testRuns:e=>se("GET",`/api/test-runs?${bu(e)}`),claudeMd:()=>se("GET","/api/project/claude-md"),uploadClaudeMd:e=>se("POST","/api/project/claude-md",{content:e}),resetPlan:e=>se("GET",`/api/project/reset/plan${e?`?terms=${$e(e)}`:""}`),resetProject:e=>se("POST","/api/project/reset",e),updateStatus:()=>se("GET","/api/update"),startUpdate:()=>se("POST","/api/update"),claudeStatus:()=>se("GET","/api/claude/status"),claudeTest:()=>se("POST","/api/claude/test"),agentPrompts:()=>se("GET","/api/agents/prompts"),saveAgentPrompt:(e,t)=>se("PUT",`/api/agents/prompts/${$e(e)}`,{instructions:t}),resetAgentPrompt:e=>se("DELETE",`/api/agents/prompts/${$e(e)}`),saveAgentModel:(e,t)=>se("PUT",`/api/agents/prompts/${$e(e)}/model`,{model:t}),resetAgentModel:e=>se("DELETE",`/api/agents/prompts/${$e(e)}/model`),skills:()=>se("GET","/api/agents/skills"),customAgents:()=>se("GET","/api/agents/custom"),customAgent:e=>se("GET",`/api/agents/custom/${$e(e)}`),createCustomAgent:e=>se("POST","/api/agents/custom",e),saveCustomAgent:(e,t,n)=>se("PUT",`/api/agents/custom/${$e(e)}`,{...t,baseUpdatedAt:n}),deleteCustomAgent:e=>se("DELETE",`/api/agents/custom/${$e(e)}`),previewCustomAgent:(e,t)=>se("POST",e?`/api/agents/custom/${$e(e)}/preview`:"/api/agents/custom/preview",t),exportProject:async(e={})=>{const t=new URLSearchParams;e.jobs&&t.set("jobs","1"),e.chats&&t.set("chats","1");const n=t.toString(),r=await fetch(`/api/project/export${n?`?${n}`:""}`);if(!r.ok)throw new no(r.status,(await r.json().catch(()=>({}))).message??r.statusText);return r.blob()},importProject:(e,t={})=>se("POST","/api/project/import",{zip:e,jobs:!!t.jobs,chats:!!t.chats}),saveAgentSkills:(e,t)=>se("PUT",`/api/agents/prompts/${$e(e)}/skills`,{skills:t}),pipelines:()=>se("GET","/api/pipelines"),pipeline:e=>se("GET",`/api/pipelines/${$e(e)}`),createPipeline:e=>se("POST","/api/pipelines",e),savePipeline:(e,t,n)=>se("PUT",`/api/pipelines/${$e(e)}`,{...t,baseUpdatedAt:n}),deletePipeline:e=>se("DELETE",`/api/pipelines/${$e(e)}`),chatCommands:(e=!1)=>se("GET",`/api/chat/commands${e?"?refresh=1":""}`),chats:()=>se("GET","/api/chat/sessions"),chat:e=>se("GET",`/api/chat/sessions/${$e(e)}`),createChat:e=>se("POST","/api/chat/sessions",e),updateChat:(e,t)=>se("PATCH",`/api/chat/sessions/${$e(e)}`,t),deleteChat:e=>se("DELETE",`/api/chat/sessions/${$e(e)}`),uploadChatFile:(e,t)=>se("POST",`/api/chat/sessions/${$e(e)}/attachments`,t),sendChat:(e,t,n)=>se("POST",`/api/chat/sessions/${$e(e)}/messages`,{text:t,attachmentIds:n}),answerChatPermission:(e,t,n)=>se("POST",`/api/chat/sessions/${$e(e)}/permissions/${$e(t)}`,{decision:n}),stopChat:e=>se("POST",`/api/chat/sessions/${$e(e)}/stop`),previewAgentPrompt:(e,t)=>se("POST",`/api/agents/prompts/${$e(e)}/preview`,t)};function lb(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 ab(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 kh=e=>`/api/jobs/${e}/report/`,Qc=["passed","failed","cancelled","interrupted"],ob=`# Spec title
|
|
69
|
+
Tags: smoke
|
|
70
|
+
Preconditions: describe the initial state
|
|
71
|
+
|
|
72
|
+
## TC-XXX-001: Test case name
|
|
73
|
+
1. Step 1
|
|
74
|
+
2. Step 2
|
|
75
|
+
3. Expected result
|
|
76
|
+
`,qc="agent-studio:data-changed",ub=()=>window.dispatchEvent(new Event(qc));function zy(e){j.useEffect(()=>(window.addEventListener(qc,e),()=>window.removeEventListener(qc,e)),[e])}function Oe(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 zy(u),{data:n,error:i,reload:u}}const My=j.createContext({specs:[],mapping:[],refresh:()=>{}}),cn=()=>j.useContext(My);function cb(){const[e,t]=j.useState([]),[n,r]=j.useState([]),i=j.useCallback(()=>{Promise.all([V.specs(),V.mapping()]).then(([l,a])=>{t(l),r(a)}).catch(()=>{})},[]);return j.useEffect(()=>{i();const l=setInterval(i,15e3);return()=>clearInterval(l)},[i]),zy(i),{specs:e,mapping:n,refresh:i}}function db(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,p]=j.useState(null),[m,f]=j.useState(null),g=j.useRef(!1),[w,y]=j.useState(0),x=j.useCallback(()=>y(b=>b+1),[]),v=j.useCallback(async()=>{const b=await V.job(e);return f(b.pending??null),n(b.job),i(b.agentRuns),a(b.testResults),u(b.pipeline??null),b},[e]);return j.useEffect(()=>{let b=!0,A=null,k=null;g.current=!1;const T=()=>{h({}),A=lb(e,P=>{b&&(P.type==="job"?(n(P.job),P.job.status==="waiting"?v():f(null),Qc.includes(P.job.status)&&!g.current&&(g.current=!0,v())):P.type==="agent"?i(I=>{const C=I.findIndex(S=>S.id===P.run.id);if(C<0)return[...I,P.run].sort((S,D)=>S.seq-D.seq);const L=I.slice();return L[C]=P.run,L}):h(I=>({...I,[P.runId]:(I[P.runId]??"")+P.chunk})))},()=>{b&&!g.current&&(k=setTimeout(T,2e3))})};return v().then(()=>b&&T()).catch(P=>b&&p(P.message)),()=>{b=!1,A==null||A(),k&&clearTimeout(k)}},[e,v,w]),{job:t,runs:r,results:l,pipeline:o,pending:m,logs:c,error:d,refetch:v,reconnect:x}}function hb(){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 fb(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 pb=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"})]}),qn=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"})]}),bh=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"})}),mb=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"})}),gb=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"})]}),Ao=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"})}),ni=({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"})}),Sh=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"m5 12 5 5 9-10"})}),kr=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),xb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"})}),$y=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"})]}),Io=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"})}),Nh=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"})]}),_y=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"})]}),yb=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"})]}),Oy=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"})}),Fy=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"})]}),Jn=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"})}),Uy=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"})}),ds=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"})]}),By=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"})]}),vb=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"})]}),jb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M19 12H5M11 18l-6-6 6-6"})}),Do=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"})}),Ch=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"})]}),wb=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"})]}),Eh=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"})]}),as=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"})]}),Hy=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"})]}),kb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M4 5h16l-6 8v5l-4 2v-7z"})}),bb=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"})]}),Wy=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"})}),Sb=e=>s.jsx(ke,{...e,children:s.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Th=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"})]}),Nb=/^[A-Z][A-Z0-9]*(-[A-Z0-9]+)+$/;function Cb(e){return typeof e=="string"&&Nb.test(e)}function Eb(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&&Cb(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 Op=e=>e===null||e===""?[]:e.replace(/\r\n/g,`
|
|
77
|
+
`).split(`
|
|
78
|
+
`);function Tb(e,t){const n=Op(e),r=Op(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"}},zo={explore:["explorer"],generate:["explorer","generator","validator"],heal:["healer","validator"],spec:["specwriter"],testrun:["runner"],context:["contextwriter"]},Ph=["validator","healer"],Fp=500,Pb=5,Rb=120,Lb=2e3,Su=5e4,Vy=20,Ab=[10,20,50,100],Ib={maxHealRounds:2},Up=10,Rh=[{id:"opus",label:"Opus — most capable, highest cost"},{id:"sonnet",label:"Sonnet — balanced"},{id:"haiku",label:"Haiku — fastest, cheapest"}],Db=["specFile","testFile","jobDir"],zb={mode:"scoped",browser:!1,editTests:!1,editSpecs:!1,typecheck:!1,deniedCommands:[],protectedPaths:[]},Qy=["git push","git reset --hard","rm -rf","curl","wget","cat .env","type .env"],qy=["qa-studio",".git",".claude","node_modules"],Mb=2e3,$b=4e3;Rh.map(e=>e.id);const Lh=e=>`custom:${e}`,bl=e=>e.startsWith("custom:")?e.slice(7):null,_b=["first","last"],hs=e=>typeof e=="string"?{kind:"agent",agent:e}:e,Gc=80,Kc=500,Sa=20,Na=10,fl=10,Ob=3,ro=3,Bp=100,Fb=Object.keys(Ne).filter(e=>e!=="custom"),Mo=e=>e.flatMap(t=>t.kind==="agent"?[t.agent]:Mo(t.steps.map(hs))),Gy=e=>e.kind==="agent"?0:1+Math.max(0,...e.steps.map(t=>Gy(hs(t))));function Ky(e){if(e.kind==="agent")return 1;const t=e.steps.map(a=>Ky(hs(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 Ub=new Set(["explorer","generator","validator","healer","runner","specwriter"]),Bb=e=>Mo(e).find(t=>Ub.has(t))??null;function Hb(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>Gc&&n.push(`Name is longer than ${Gc} 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>Kc&&n.push(`Description is longer than ${Kc} 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||Fb.includes(h)?null:`unknown agent ${JSON.stringify(h)}`,u=(h,d,p)=>{if(p>ro)return n.push(`${d}: loops can be nested at most ${ro} levels deep`),null;const m=h.maxIterations;let f=!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}`),f=!1),h.endsWhen!==void 0&&!_b.includes(h.endsWhen)&&(n.push(`${d}: ends when must be "first" or "last"`),f=!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`),f=!1);const g=[],w=new Set;return h.steps.slice(0,Na).forEach((y,x)=>{if(typeof y=="string"){const b=o(y);b?w.add(b):g.push(y);return}const v=y;if(v&&typeof v=="object"&&v.kind==="loop"){const b=u(v,`${d} › loop ${x+1}`,p+1);b?g.push(b):f=!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(y)}`)}),w.forEach(y=>n.push(`${d}: ${y}`)),!f||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 p=`Block ${d+1}`,m=h;if(!m||typeof m!="object")return void n.push(`${p}: must be an object`);if(m.kind==="agent"){const f=o(m.agent);if(f)return void n.push(`${p}: ${f}`);c.push({kind:"agent",agent:m.agent})}else if(m.kind==="loop"){const f=u(m,p,1);if(!f)return;const g=Ky(f);if(Gy(f)>1&&g>Bp)return void n.push(`${p}: these nested loops could take up to ${g} agent runs (at most ${Bp}); lower the maximum iterations`);c.push(f)}else n.push(`${p}: kind must be "agent" or "loop"`)})):n.push("steps must be a list"),c.findIndex(h=>Mo([h]).includes("specwriter")),n.length?{ok:!1,errors:n}:{ok:!0,value:{name:i,description:l.trim(),steps:c,...a?{workDir:a}:{}}}}function Wb(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 Hp=[{id:"default",label:"Default"},{id:"fable",label:"Fable"},{id:"opus",label:"Opus"},{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"}],Jr=["default","low","medium","high","xhigh","max"],so=[{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 Yy={mode:"scoped",browser:!1,editTests:!1,editSpecs:!1,typecheck:!1,deniedCommands:[],protectedPaths:[]},Nu={...Yy,mode:"full",typecheck:!0,deniedCommands:[...Qy],protectedPaths:[...qy]},Vb=`# Planner Agent — Instructions
|
|
79
|
+
|
|
80
|
+
## 1. Persona
|
|
81
|
+
|
|
82
|
+
You are a **Senior Tech Lead and Business Analyst** with many years of experience.
|
|
83
|
+
|
|
84
|
+
You turn vague requests into precise, minimal, implementable plans. You are curious, concise, and never assume what you can verify in the codebase.
|
|
85
|
+
|
|
86
|
+
## 2. Objective
|
|
87
|
+
|
|
88
|
+
Ask the questions that matter, get the human's answers, and turn the request into a clear, **human-approved solution** (implementation plan) that the Coding agent can execute without further questions.
|
|
89
|
+
|
|
90
|
+
## 3. Context
|
|
91
|
+
|
|
92
|
+
- You have **READ-ONLY** access to the codebase.
|
|
93
|
+
- You are the first stage of the pipeline: **Planner → (Coding ⇄ Unit Test) → Code Review**.
|
|
94
|
+
- Reply in the same language the user writes in. Keep code identifiers in English.
|
|
95
|
+
- You run inside Agent Studio, not in a chat, so you **cannot wait** for a reply in this session. Put open questions in the \`questions\` field of your result file. The pipeline pauses, the human picks an option or types their own answer on the job page, and you run again with the answers.
|
|
96
|
+
|
|
97
|
+
## 4. Process
|
|
98
|
+
|
|
99
|
+
### Step 1: UNDERSTAND
|
|
100
|
+
- Restate the request in 1–2 sentences.
|
|
101
|
+
|
|
102
|
+
### Step 2: EXPLORE
|
|
103
|
+
- Inspect the relevant code:
|
|
104
|
+
- Project structure and conventions
|
|
105
|
+
- Similar features and existing utilities
|
|
106
|
+
- Tech stack and dependencies
|
|
107
|
+
- Test setup and patterns (framework, coverage tool, where tests live)
|
|
108
|
+
- Do not ask about anything you can find yourself.
|
|
109
|
+
|
|
110
|
+
### Step 3: ASK (first run only)
|
|
111
|
+
- Collect the remaining ambiguities that change what gets built (scope, behavior, data, UX, location, dependencies).
|
|
112
|
+
- Add one entry to \`questions\` in the result JSON for each:
|
|
113
|
+
- \`question\`: one clear sentence.
|
|
114
|
+
- \`options\`: 2–4 concrete choices. Mark exactly one \`"recommended": true\`: the default grounded in the codebase, with the reason in its \`description\` (one line).
|
|
115
|
+
- Do not add an "Other" option. The reviewer can always type their own answer.
|
|
116
|
+
- Put the draft solution (everything already decided) in \`details\`, and mark where each open question affects it.
|
|
117
|
+
- If nothing is ambiguous, leave out \`questions\` and go straight to Step 5.
|
|
118
|
+
|
|
119
|
+
### Step 4: WAIT
|
|
120
|
+
- After writing the questions, stop. Do not finalize on your own and do not "assume defaults". The human decides.
|
|
121
|
+
|
|
122
|
+
### Step 5: SOLUTION (no open questions, or after you get the answers file)
|
|
123
|
+
- Read the answers file named in the pipeline context. Treat every answer, including a typed one, as a confirmed decision.
|
|
124
|
+
- Write the final solution to \`details\`:
|
|
125
|
+
1. **Summary**: the request in 1–2 sentences.
|
|
126
|
+
2. **Decisions**: each question → the chosen answer.
|
|
127
|
+
3. **Files**: each file to create or change, and what changes.
|
|
128
|
+
4. **Tasks**: ordered, small, each one verifiable.
|
|
129
|
+
5. **Acceptance criteria**: testable statements. The Unit Test and Code Review agents check against these.
|
|
130
|
+
6. **Test plan for the Unit Test agent**: units, important branches, edge and error cases, the test command and the coverage tool.
|
|
131
|
+
7. **Out of scope**: what must not change.
|
|
132
|
+
- Leave out \`questions\` unless an answer creates a new blocking ambiguity.
|
|
133
|
+
|
|
134
|
+
## 5. Constraints
|
|
135
|
+
|
|
136
|
+
- Do not write or change code.
|
|
137
|
+
- Keep the solution minimal: no features, refactors or dependencies the request does not need.
|
|
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
|
+
`,Qb=`# Coding Agent — Instructions
|
|
140
|
+
|
|
141
|
+
## 1. Persona
|
|
142
|
+
|
|
143
|
+
You are a **Senior Software Engineer** who values simplicity above cleverness.
|
|
144
|
+
|
|
145
|
+
You write the least code that correctly solves the problem, following the idioms of the language and the existing codebase.
|
|
146
|
+
|
|
147
|
+
## 2. Objective
|
|
148
|
+
|
|
149
|
+
Implement the **approved solution** with minimal, readable, correct and type-safe production code that follows the project's conventions.
|
|
150
|
+
|
|
151
|
+
## 3. Context
|
|
152
|
+
|
|
153
|
+
- **Input:** The approved solution from the Planner: the latest Planner output, plus the answers file if there is one. On later runs, the earlier outputs also include the Unit Test agent's and the Code Review agent's reports.
|
|
154
|
+
- **Output:** Production code. It goes to the Unit Test agent, then to the Code Review agent (strict gatekeeper).
|
|
155
|
+
- Pipeline: **Planner → (Coding ⇄ Unit Test) → Code Review**. When Code Review requests changes, the pipeline comes back to you.
|
|
156
|
+
- Detect the language, framework, linter and formatter from the repository and follow them.
|
|
157
|
+
|
|
158
|
+
## 4. Absolute rule: you do NOT write tests
|
|
159
|
+
|
|
160
|
+
- Never create, edit or delete test files (\`*.test.*\`, \`*.spec.*\`, \`__tests__/\`, \`test/\`, \`tests/\`, test setup files). The **Unit Test agent owns all tests**.
|
|
161
|
+
- You may *run* the existing tests to check that you did not break them.
|
|
162
|
+
- If a test fails because the behavior intentionally changed, leave the test alone. Say so under **Notes for Unit Test agent**.
|
|
163
|
+
- Make the code testable: pure functions where possible, injectable boundaries (time, randomness, network, storage, browser APIs), no hidden global state.
|
|
164
|
+
|
|
165
|
+
## 5. Process
|
|
166
|
+
|
|
167
|
+
### Step 1: READ
|
|
168
|
+
- Read the approved solution and the surrounding code.
|
|
169
|
+
- On a later run, read the **latest** Unit Test report and the **latest** Code Review report first.
|
|
170
|
+
- Identify reusable utilities, components and existing patterns before implementing.
|
|
171
|
+
|
|
172
|
+
### Step 2: VALIDATE
|
|
173
|
+
- If the solution is ambiguous or contradicts the codebase, **STOP**: set \`status\` to \`failed\` and explain in \`failure\`.
|
|
174
|
+
- Never guess or silently change requirements.
|
|
175
|
+
|
|
176
|
+
### Step 3: IMPLEMENT
|
|
177
|
+
- First run: implement the solution's tasks in order.
|
|
178
|
+
- Later run from Unit Test: fix every production bug and testability issue listed under "Issues for Coding Agent".
|
|
179
|
+
- Later run from Code Review: fix **every CRITICAL and REQUIRED finding**. Fix an OPTIONAL finding only when it is a one-line change in code you are already touching. Leave the rest for the user.
|
|
180
|
+
- Keep changes minimal and focused. Follow the existing architecture, naming and conventions. No unrelated refactors.
|
|
181
|
+
|
|
182
|
+
### Step 4: VERIFY
|
|
183
|
+
- Run typecheck, lint, build and the existing tests when available.
|
|
184
|
+
- Fix errors your changes introduced. Report pre-existing ones without fixing them.
|
|
185
|
+
|
|
186
|
+
## 6. Output (result \`details\`, markdown)
|
|
187
|
+
|
|
188
|
+
- **Changes:** files and what changed, mapped to solution tasks or finding numbers.
|
|
189
|
+
- **Findings fixed:** \`[SEVERITY] #n → how\` for each Code Review or Unit Test item you handled.
|
|
190
|
+
- **Not fixed (and why):** anything skipped, including OPTIONAL items left for the user.
|
|
191
|
+
- **Checks:** typecheck / lint / build / tests, each pass or fail.
|
|
192
|
+
- **Notes for Unit Test agent:** new or changed behavior that needs tests (units, branches, edge and error cases).
|
|
193
|
+
|
|
194
|
+
\`status\`: \`passed\` when the solution (or every CRITICAL/REQUIRED finding) is implemented and the checks pass, otherwise \`failed\`.
|
|
195
|
+
`,qb=`# Unit Test Agent
|
|
196
|
+
|
|
197
|
+
## Persona
|
|
198
|
+
|
|
199
|
+
You are a **Senior QA Engineer** who specializes in unit testing for backend and frontend. You write fast, deterministic tests that protect **behavior**, not implementation details.
|
|
200
|
+
|
|
201
|
+
## Objective
|
|
202
|
+
|
|
203
|
+
Own the unit tests for the change. Review the existing tests, update or add tests for the **diff the Coding agent produced**, run them, and reach **100% line and 100% branch coverage of the changed production files**.
|
|
204
|
+
|
|
205
|
+
## Context
|
|
206
|
+
|
|
207
|
+
**Input:** The solution (Planner output plus answers), the Coding agent's latest report, and the code.
|
|
208
|
+
|
|
209
|
+
- Find the diff yourself: the files listed in the Coding report, plus \`git status --porcelain\` and \`git diff\`. Untracked new files and folders count as fully new code.
|
|
210
|
+
- Detect the test framework, test command, coverage tool and folder layout from the repository (Vitest, Jest, pytest, JUnit, …) and follow the existing style.
|
|
211
|
+
- **Backend:** services, controllers, utilities, validators, repositories (mocked).
|
|
212
|
+
- **Frontend:** components, hooks, state logic, utilities.
|
|
213
|
+
- You may create and edit **test files** and test tooling (test setup files, the coverage section of the test config, dev dependencies such as a coverage provider). Never change production code. If production code must change, report it to the Coding agent.
|
|
214
|
+
|
|
215
|
+
## Process
|
|
216
|
+
|
|
217
|
+
1. **ANALYZE** the diff: list each unit of behavior (function, branch, component state, error path) in the changed files.
|
|
218
|
+
2. **REVIEW** the existing tests for those units:
|
|
219
|
+
- Keep the good tests.
|
|
220
|
+
- **Update** tests that assert outdated behavior, are flaky or weak (no real assertion, snapshot-only logic), or test internals.
|
|
221
|
+
- Never delete or weaken a test just to make it pass. If a test fails because of a production bug, keep it failing and report the bug.
|
|
222
|
+
3. **DESIGN** cases per unit: happy path, edge cases (null, empty, boundaries), error paths, and every conditional branch (both sides of each \`if\`, \`?:\`, \`&&\`, \`||\`, \`??\`, every \`switch\` case, early return and \`catch\`).
|
|
223
|
+
4. **WRITE** tests using Arrange-Act-Assert.
|
|
224
|
+
5. **RUN** the tests with coverage, for example \`cd <app> && npx vitest run --coverage\` (or the project's coverage script). If the coverage provider is missing, install it as a dev dependency and run again.
|
|
225
|
+
6. **ITERATE** until the changed files reach **100% lines and 100% branches**, or the remaining gaps are justified (truly unreachable code, or pure framework glue). Give a reason for each gap in the report.
|
|
226
|
+
7. **REPORT** the results.
|
|
227
|
+
|
|
228
|
+
## Principles
|
|
229
|
+
|
|
230
|
+
- **FIRST:** Fast, Isolated, Repeatable, Self-validating, Timely.
|
|
231
|
+
- Test behavior and public contracts, not private methods or internal calls.
|
|
232
|
+
- One scenario per test. Name it \`should <expected> when <condition>\`.
|
|
233
|
+
- Mock only boundaries (DB, HTTP, time, randomness, file system, browser APIs such as AudioContext). **Never** mock the unit under test.
|
|
234
|
+
- Frontend: query by role, label or text as a user would. Avoid CSS class assertions and snapshot tests for logic.
|
|
235
|
+
- Use fake timers for timer logic. No sleeps, no real network, no dependence on test order.
|
|
236
|
+
- Use factories or fixtures for test data. No shared mutable state between tests.
|
|
237
|
+
|
|
238
|
+
## Constraints
|
|
239
|
+
|
|
240
|
+
- Do **NOT** modify production code.
|
|
241
|
+
- Do **NOT** write trivial tests (getters, constants, framework behavior) just to raise coverage. Cover branches through real behavior.
|
|
242
|
+
- Do **NOT** delete or weaken existing tests to make them pass.
|
|
243
|
+
|
|
244
|
+
## Result
|
|
245
|
+
|
|
246
|
+
\`status\`:
|
|
247
|
+
- \`passed\`: all tests pass and the changed files have 100% line and branch coverage (or only justified gaps remain).
|
|
248
|
+
- \`failed\`: a test fails because of a **production bug**, production code is untestable, or coverage is below 100% without a justification. The pipeline then sends the work back to the Coding agent, so say exactly what to fix.
|
|
249
|
+
- A failure caused by **your own** test is not a reason to fail: fix the test.
|
|
250
|
+
|
|
251
|
+
\`details\` (markdown):
|
|
252
|
+
|
|
253
|
+
**Test plan:** unit → scenarios, grouped into backend and frontend
|
|
254
|
+
|
|
255
|
+
**Files created/changed:** test file paths (+ dev dependencies installed)
|
|
256
|
+
|
|
257
|
+
**Existing tests reviewed:** kept / updated (why) / flagged
|
|
258
|
+
|
|
259
|
+
**Run result:** passed and failed counts; the exact command used
|
|
260
|
+
|
|
261
|
+
**Coverage (changed files):** table with file | lines % | branches % | uncovered lines
|
|
262
|
+
|
|
263
|
+
**Untested / Gaps:** what and why (each one justified)
|
|
264
|
+
|
|
265
|
+
**Issues for Coding Agent:** production bugs (with the failing test name) and testability problems, or "None"
|
|
266
|
+
|
|
267
|
+
## Self-check
|
|
268
|
+
|
|
269
|
+
- Would each test fail if the behavior broke?
|
|
270
|
+
- Are all tests deterministic and independent?
|
|
271
|
+
- Is every branch of the changed code exercised?
|
|
272
|
+
- Is there at least one edge case and one error case per unit?
|
|
273
|
+
`,Gb=`# Code Review Agent
|
|
274
|
+
|
|
275
|
+
## Persona
|
|
276
|
+
|
|
277
|
+
You are a **Solution Architect** acting as the final quality gate. You are rigorous, evidence-based and fair. You look beyond the diff at design, architecture and long-term maintainability. You block real problems and ignore personal taste. You report findings, not praise.
|
|
278
|
+
|
|
279
|
+
## Objective
|
|
280
|
+
|
|
281
|
+
Find bugs, design flaws, convention and best-practice violations, and security and performance risks, and classify each one by severity. Send the change back to the Coding agent until **every CRITICAL and REQUIRED finding is fixed**. Record OPTIONAL findings so the user can understand them and fix them later.
|
|
282
|
+
|
|
283
|
+
## Context
|
|
284
|
+
|
|
285
|
+
- **Input:** The solution (Planner output plus answers), the code, the test suite, and the latest Coding and Unit Test reports (earlier outputs in the job directory). On a later run, also your own previous review: check that each earlier CRITICAL/REQUIRED finding is really fixed.
|
|
286
|
+
- You may run typecheck, lint, unit tests and coverage, but you **never edit files**: you review, the Coding agent fixes.
|
|
287
|
+
- **Unit tests only.** Run the unit-test suite of the project you are reviewing, inside its own folder (e.g. \`cd <app> && npx vitest run --coverage\`). Do **NOT** run end-to-end or browser tests: no Playwright (\`npx playwright test\`, \`tests/e2e\`), no \`npm test\` at the QA repository root, no dev servers or browsers. E2E testing is not part of code review.
|
|
288
|
+
- Apply the project's own conventions and previously agreed standards first.
|
|
289
|
+
- Pipeline: **Planner → (Coding ⇄ Unit Test) → Code Review**. \`failed\` sends the work back to Coding (then Unit Test, then you again). \`passed\` ends the pipeline.
|
|
290
|
+
|
|
291
|
+
## Process
|
|
292
|
+
|
|
293
|
+
1. **RUN** typecheck, lint, unit tests and coverage of the reviewed project (no e2e/Playwright). Record the exact commands and results as evidence.
|
|
294
|
+
2. **READ** the diff against the solution: is everything required done, and nothing extra?
|
|
295
|
+
3. **INSPECT** each changed file against the checklist.
|
|
296
|
+
4. **VERIFY** earlier findings (on a re-review): mark each one fixed or still open.
|
|
297
|
+
5. **CLASSIFY** every finding by severity, with \`file:line\` evidence.
|
|
298
|
+
6. **DECIDE** the verdict and report.
|
|
299
|
+
|
|
300
|
+
## Checklist
|
|
301
|
+
|
|
302
|
+
- **Correctness:** logic errors, off-by-one, null/undefined, async/race conditions, unhandled errors, resource leaks (timers, listeners, streams), wrong edge-case handling.
|
|
303
|
+
- **Architecture & design:** fits the existing architecture; clear responsibilities; correct layering and dependencies; no hidden coupling or global state; testable boundaries.
|
|
304
|
+
- **Best practices:** idiomatic use of the language and framework (e.g. React hooks rules, effect cleanup, accessibility, error handling, config via env).
|
|
305
|
+
- **Types:** strict typing, no unsafe casts or \`any\`, correct generics, typecheck passes.
|
|
306
|
+
- **Security:** injection, XSS, authn/authz gaps, secrets in code, unsafe input handling, risky dependencies.
|
|
307
|
+
- **Conventions:** naming, structure, formatting, lint rules, project patterns.
|
|
308
|
+
- **Simplicity:** unnecessary abstraction, duplicated logic, dead code, scope creep.
|
|
309
|
+
- **Performance:** N+1 queries, unnecessary re-renders, heavy loops, large bundles, missing indexes.
|
|
310
|
+
- **Tests:** behavior coverage, 100% line/branch coverage of changed files (or justified gaps), edge and error cases, flakiness, weak assertions. Also check that the Coding agent did **not** write tests.
|
|
311
|
+
- **Solution conformance:** acceptance criteria met, no unrelated changes.
|
|
312
|
+
|
|
313
|
+
## Severity
|
|
314
|
+
|
|
315
|
+
| Level | Meaning | Action |
|
|
316
|
+
|-------|---------|--------|
|
|
317
|
+
| CRITICAL | Bug, security flaw, data loss, crash, failing typecheck/lint/test, acceptance criterion not met | Must fix now → back to Coding |
|
|
318
|
+
| REQUIRED | Likely defect; architecture, convention or best-practice violation; missing critical test or uncovered risky branch | Must fix now → back to Coding |
|
|
319
|
+
| OPTIONAL | Maintainability improvement, minor refactor, style or taste | Not blocking; recorded for the user to fix later |
|
|
320
|
+
|
|
321
|
+
## Constraints
|
|
322
|
+
|
|
323
|
+
- Do **NOT** edit files. Suggest each fix in a few lines.
|
|
324
|
+
- Report only issues you can justify with \`file:line\` and a concrete reason. If unsure, label the finding **"Needs verification"**, state your confidence, and classify it OPTIONAL.
|
|
325
|
+
- Do **NOT** block on OPTIONAL findings.
|
|
326
|
+
- No duplicate findings. Group repeated patterns into one item.
|
|
327
|
+
|
|
328
|
+
## Rule
|
|
329
|
+
|
|
330
|
+
Any CRITICAL or REQUIRED finding, or any failed check → \`"status": "failed"\` (REQUEST_CHANGES). Otherwise → \`"status": "passed"\` (APPROVE), even if OPTIONAL findings remain.
|
|
331
|
+
|
|
332
|
+
## Result \`details\` (markdown)
|
|
333
|
+
|
|
334
|
+
**Verdict:** APPROVE | REQUEST_CHANGES
|
|
335
|
+
|
|
336
|
+
**Checks:** typecheck <pass/fail> · lint <pass/fail/none> · unit tests <pass/fail> · coverage <lines% / branches%>
|
|
337
|
+
|
|
338
|
+
**Previous findings:** #n fixed / still open (re-review only)
|
|
339
|
+
|
|
340
|
+
**Must fix (for Coding agent):**
|
|
341
|
+
|
|
342
|
+
1. [CRITICAL|REQUIRED] \`path:line\` — <problem>
|
|
343
|
+
- **Why:** <impact>
|
|
344
|
+
- **Fix:** <suggestion>
|
|
345
|
+
|
|
346
|
+
**Optional (for the user, later):**
|
|
347
|
+
|
|
348
|
+
1. [OPTIONAL] \`path:line\` — <problem>
|
|
349
|
+
- **Why:** <impact, in plain words>
|
|
350
|
+
- **Fix:** <suggestion>
|
|
351
|
+
|
|
352
|
+
**Summary:** 2–3 lines: what must change before approval, or why it is approved.
|
|
353
|
+
|
|
354
|
+
## Self-check
|
|
355
|
+
|
|
356
|
+
- Is every finding backed by evidence?
|
|
357
|
+
- Is the verdict consistent with the Rule?
|
|
358
|
+
- Did I check every checklist category?
|
|
359
|
+
- Is every Must-fix item specific enough for the Coding agent to act on without asking?
|
|
360
|
+
`,Yc=[{id:"planner",label:"Planner",agent:{name:"Planner",description:"Asks the open questions, takes the answers and writes the solution",instructions:Vb,model:"sonnet",permissions:Yy,review:"human"}},{id:"coding",label:"Coding",agent:{name:"Coding",description:"Implements the approved solution; never writes tests",instructions:Qb,model:"opus",permissions:Nu,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:qb,model:"sonnet",permissions:Nu,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:Gb,model:"sonnet",permissions:Nu,review:"auto"}}];function Kb(e){const t=Yc.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 ri({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 Ie({error:e}){return e?s.jsx("div",{className:"error-box",role:"alert",children:e}):null}function un({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 Jy={explorer:$y,generator:Io,validator:Nh,healer:_y,runner:yb,specwriter:hl,contextwriter:Ch,custom:hl};function Ft({agent:e,size:t=36}){const n=Jy[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 Yb({agents:e}){return s.jsx("span",{className:"row",style:{gap:0},children:e.map(t=>{const n=Jy[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 br(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 Sr={explore:"Explore",generate:"Generate",heal:"Heal",spec:"Write spec",testrun:"Test run",context:"Project context",custom:"Custom agent",pipeline:"Pipeline"};function Xy(e){var t;return e.label??((t=Ne[e.agent])==null?void 0:t.label)??e.agent}function sn(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 Jb({onClose:e,onNewSpec:t}){const n=ut(),{specs:r}=cn(),i=Oe(()=>V.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 V.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(qn,{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(qn,{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," ",Sr[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}`)}))],f=l.trim().toLowerCase();return f?m.filter(g=>g.text.toLowerCase().includes(f)):m},[l,r,i.data]);j.useEffect(()=>u(0),[l]);const d=m=>{var f;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"&&((f=h[o])==null||f.run())};let p="";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,f)=>{const g=m.group!==p;return p=m.group,s.jsxs("div",{children:[g&&s.jsx("li",{className:"group",children:m.group}),s.jsxs("li",{role:"option","aria-selected":f===o,className:f===o?"active":"",onMouseEnter:()=>u(f),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 Zy=j.createContext(async()=>!1),In=()=>j.useContext(Zy);function Xb({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(Zy.Provider,{value:o,children:[e,l&&Pr.createPortal(s.jsx(Zb,{opts:l,onClose:a},l.id),document.body)]})}function Zb({opts:e,onClose:t}){const n=j.useRef(null),r=j.useRef(null),i=j.useRef(null);return j.useEffect(()=>{var a;(a=(e.danger?r:i).current)==null||a.focus();const l=o=>{var u,c;if(o.key==="Escape"&&(o.stopPropagation(),t(!1)),o.key==="Tab"){const h=[...((u=n.current)==null?void 0:u.querySelectorAll("button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a[href]"))??[]],d=h.indexOf(document.activeElement);o.preventDefault(),(c=h[(d+(o.shiftKey?-1:1)+h.length)%h.length])==null||c.focus()}};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[e.danger,t]),s.jsx("div",{className:"overlay confirm-overlay",onClick:()=>t(!1),children:s.jsx("div",{ref:n,className:"modal confirm-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-title","aria-describedby":"confirm-msg",onClick:l=>l.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:r,type:"button",className:"btn ghost",onClick:()=>t(!1),children:e.cancelLabel??"Cancel"}),s.jsx("button",{ref:i,type:"button",className:`btn ${e.danger?"btn-danger-solid":""}`,onClick:()=>t(!0),children:e.confirmLabel??(e.danger?"Delete":"OK")})]})]})})})}function Ah(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 ev=j.createContext(e=>e),eS=()=>j.useContext(ev);function tS({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(ev.Provider,{value:r,children:[e,t>0&&Pr.createPortal(s.jsx("div",{className:"loading-bar",role:"progressbar","aria-label":"Loading"}),document.body)]})}const Si=()=>{},tv=j.createContext({show:Si,info:Si,success:Si,warning:Si,error:Si}),Ir=()=>j.useContext(tv);function nS({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(tv.Provider,{value:a,children:[e,Pr.createPortal(s.jsx("div",{className:"toasts",role:"region","aria-label":"Notifications",children:t.map(o=>s.jsx(rS,{item:o,onClose:()=>i(o.id)},o.id))}),document.body)]})}function rS({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(Sh,{size:14}):e.kind==="error"?s.jsx(kr,{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(kr,{size:13})})]})}const sS=15*60*1e3,iS=2e3,lS=5*60*1e3;async function aS(){try{const e=await fetch("/api/update",{cache:"no-store"});return e.status===404?"other":e.ok?await e.json():null}catch{return null}}function oS(){const[e,t]=j.useState(null),[n,r]=j.useState(null),[i,l]=j.useState(null),a=j.useCallback(()=>{V.updateStatus().then(t).catch(()=>{})},[]);if(j.useEffect(()=>{a();const u=setInterval(a,sS);return window.addEventListener("focus",a),()=>{clearInterval(u),window.removeEventListener("focus",a)}},[a]),j.useEffect(()=>{if(!n)return;const u=Date.now();let c=!1;const h=setInterval(()=>{aS().then(d=>{if(!d)return void(c=!0);if(d==="other"||d.current===n)return window.location.reload();(c||Date.now()-u>lS)&&(r(null),t(d),d.error||l("The update did not finish. Run the command below in a terminal, then restart Agent Studio."))})},iS);return()=>clearInterval(h)},[n]),!(e!=null&&e.required)&&!n)return null;const o=async()=>{l(null);try{const u=await V.startUpdate();r(u.latest)}catch(u){l(u.message)}};return s.jsx("div",{className:"overlay update-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"update-title",children:s.jsx("div",{className:"modal",children:s.jsx("div",{className:"modal-body",children:n?s.jsxs(s.Fragment,{children:[s.jsxs("h3",{id:"update-title",children:["Updating to v",n," ..."]}),s.jsx("p",{className:"muted",children:"Installing and restarting Agent Studio. Progress is shown in the terminal where it runs; this page reloads by itself."})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{id:"update-title",children:"Update required"}),s.jsxs("p",{children:["Agent Studio ",s.jsxs("b",{children:["v",e.latest]})," is available (you have v",e.current,"). Update to keep using the app."]}),(i||e.error)&&s.jsxs("div",{className:"error-box",role:"alert",children:[i||e.error,s.jsx("pre",{className:"update-cmd",children:e.command})]}),s.jsx("div",{className:"confirm-actions",children:s.jsxs("button",{className:"btn",onClick:()=>void o(),children:[s.jsx(Jn,{size:14})," Update and restart"]})})]})})})})}const nv=j.createContext({refreshClaude:()=>{},openNewSpec:()=>{},openPalette:()=>{},theme:"light",toggleTheme:()=>{},crumbSlot:null,extraSlot:null}),fs=()=>j.useContext(nv);function uS(){try{return localStorage.getItem("qa-studio.sidebar")==="collapsed"}catch{return!1}}const cS=.6,Cu="Agent Studio (v0.1.11)";function dS(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(cS,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 hS({collapsed:e,mobileOpen:t,onCloseMobile:n}){var y;const r=j.useRef(null),i=j.useRef(null);dS(r,i);const{specs:l,mapping:a}=cn(),{openPalette:o}=fs(),u=Yn(),c=Oe(()=>V.jobs(),[u.pathname]),{reload:h}=c,d=(c.data??[]).some(x=>x.status==="queued"||x.status==="running"||x.status==="waiting");j.useEffect(()=>{if(!d)return;const x=setInterval(h,5e3);return()=>clearInterval(x)},[d,h]);const p=(c.data??[]).filter(x=>x.status==="running"||x.status==="queued").length,m=(c.data??[]).filter(x=>x.status==="waiting").length;j.useEffect(()=>(document.title=m?`● ${Cu}`:Cu,()=>{document.title=Cu}),[m]);const f=a.filter(x=>x.status!=="orphan"&&x.testFile).length,g=a.filter(x=>x.status!=="orphan").length,w=(x,v,b,A,k,T)=>s.jsxs(tb,{to:x,end:k,className:({isActive:P})=>`side-link ${P&&!(T&&u.pathname.startsWith(T))?"active":""}`,title:e?b:void 0,children:[v,s.jsx("span",{className:"side-label",children:b}),A!==void 0&&s.jsx("span",{className:"count",children:A})]});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(Nh,{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(kr,{size:18})})]}),s.jsxs("button",{className:"side-search",onClick:o,"aria-label":"Search (Ctrl+K)",children:[s.jsx(Ao,{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(pb,{size:17}),"Overview",void 0,!0),w("/chat",s.jsx(Th,{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(qn,{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(bh,{size:17}),"Test cases",g?`${f}/${g}`:0),w("/test-runs",s.jsx(wb,{size:17}),"Test runs"),w("/runs",s.jsx(ft,{size:17}),"Recent runs",m?`${m} waiting`:p?`${p} running`:((y=c.data)==null?void 0:y.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(By,{size:17}),"Agents"),w("/usage",s.jsx(Hy,{size:17}),"Claude usage"),w("/project",s.jsx(Ch,{size:17}),"Project"),w("/settings",s.jsx(vb,{size:17}),"Settings")]})]})})}function fS({setCrumbSlot:e,setExtraSlot:t,menuOpen:n,onMenu:r}){const{theme:i,toggleTheme:l,openPalette:a}=fs();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(xb,{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(Ao,{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(Fy,{size:17}):s.jsx(Oy,{size:17})})]})}const pS=/^[a-z0-9][a-z0-9_-]*$/;function mS({initial:e,onClose:t}){const n=ut(),{refresh:r}=cn(),[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(!pS.test(h))return o('Name may only contain lowercase letters, digits, "-" or "_", and must start with a letter or digit.');try{await V.createSpec(`${h}.md`,(e==null?void 0:e.content)??ob),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(Ie,{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 gS(e){const[t,n]=j.useState(!1);return j.useEffect(()=>{const r=()=>n(!0);return window.addEventListener(Vc,r),()=>window.removeEventListener(Vc,r)},[]),j.useEffect(()=>{if(!t)return;let r=!1;const i=setInterval(()=>{ib().then(l=>{l&&!r&&(n(!1),e())})},3e3);return()=>{r=!0,clearInterval(i)}},[t,e]),t}function xS(){var k;const e=cb(),[t,n]=hb(),[r,i]=j.useState(!1),[l,a]=j.useState(null),[o,u]=j.useState(uS),[c,h]=j.useState(!1),{pathname:d}=Yn();j.useEffect(()=>h(!1),[d]);const[p,m]=j.useState(null),[f,g]=j.useState(null),[w,y]=j.useState(null),x=j.useCallback(()=>{V.claudeStatus().then(y).catch(()=>{})},[]),{refresh:v}=e,b=gS(j.useCallback(()=>{v(),x()},[v,x]));j.useEffect(()=>{x();const T=setInterval(x,5*6e4);return()=>clearInterval(T)},[x]),j.useEffect(()=>{try{localStorage.setItem("qa-studio.sidebar",o?"collapsed":"open")}catch{}},[o]),j.useEffect(()=>{const T=P=>{(P.ctrlKey||P.metaKey)&&P.key.toLowerCase()==="k"&&(P.preventDefault(),i(I=>!I)),P.key==="Escape"&&(i(!1),a(null),h(!1))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]);const A=j.useMemo(()=>({openNewSpec:T=>a(T??{}),openPalette:()=>i(!0),theme:t,toggleTheme:n,crumbSlot:p,extraSlot:f,refreshClaude:x}),[t,n,p,f,x]);return s.jsx(My.Provider,{value:e,children:s.jsx(nv.Provider,{value:A,children:s.jsx(nS,{children:s.jsx(tS,{children:s.jsxs(Xb,{children:[s.jsxs("div",{className:`shell ${o?"side-collapsed":""}`,children:[s.jsx(hS,{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(T=>!T),"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(ni,{size:10})})}),s.jsxs("div",{className:"main",children:[s.jsx(fS,{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(I0,{})})]})]}),r&&s.jsx(Jb,{onClose:()=>i(!1),onNewSpec:()=>(i(!1),a({}))}),l&&s.jsx(mS,{initial:l,onClose:()=>a(null)}),s.jsx(oS,{})]})})})})})}function ot({items:e}){const{crumbSlot:t}=fs();return t?Pr.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 yS({children:e}){const{extraSlot:t}=fs();return t?Pr.createPortal(e,t):null}function vS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const jS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kS={};function Wp(e,t){return(kS.jsx?wS:jS).test(e)}const bS=/[ \t\n\f\r]/g;function SS(e){return typeof e=="object"?e.type==="text"?Vp(e.value):!1:Vp(e)}function Vp(e){return e.replace(bS,"")===""}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 rv(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 Jc(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 NS=0;const me=ps(),rt=ps(),Xc=ps(),K=ps(),_e=ps(),es=ps(),Ht=ps();function ps(){return 2**++NS}const Zc=Object.freeze(Object.defineProperty({__proto__:null,boolean:me,booleanish:rt,commaOrSpaceSeparated:Ht,commaSeparated:es,number:K,overloadedBoolean:Xc,spaceSeparated:_e},Symbol.toStringTag,{value:"Module"})),Eu=Object.keys(Zc);class Ih extends Ut{constructor(t,n,r,i){let l=-1;if(super(t,n),Qp(this,"space",i),typeof r=="number")for(;++l<Eu.length;){const a=Eu[l];Qp(this,Eu[l],(r&Zc[a])===Zc[a])}}}Ih.prototype.defined=!0;function Qp(e,t,n){n&&(e[t]=n)}function oi(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Ih(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[Jc(r)]=r,n[Jc(l.attribute)]=r}return new Sl(t,n,e.space)}const sv=oi({properties:{ariaActiveDescendant:null,ariaAtomic:rt,ariaAutoComplete:null,ariaBusy:rt,ariaChecked:rt,ariaColCount:K,ariaColIndex:K,ariaColSpan:K,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:K,ariaLive:null,ariaModal:rt,ariaMultiLine:rt,ariaMultiSelectable:rt,ariaOrientation:null,ariaOwns:_e,ariaPlaceholder:null,ariaPosInSet:K,ariaPressed:rt,ariaReadOnly:rt,ariaRelevant:null,ariaRequired:rt,ariaRoleDescription:_e,ariaRowCount:K,ariaRowIndex:K,ariaRowSpan:K,ariaSelected:rt,ariaSetSize:K,ariaSort:null,ariaValueMax:K,ariaValueMin:K,ariaValueNow:K,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function iv(e,t){return t in e?e[t]:t}function lv(e,t){return iv(e,t.toLowerCase())}const CS=oi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:es,acceptCharset:_e,accessKey:_e,action:null,allow:null,allowFullScreen:me,allowPaymentRequest:me,allowUserMedia:me,alpha:me,alt:null,as:null,async:me,autoCapitalize:null,autoComplete:_e,autoFocus:me,autoPlay:me,blocking:_e,capture:null,charSet:null,checked:me,cite:null,className:_e,closedBy:null,colorSpace:null,cols:K,colSpan:K,command:null,commandFor:null,content:null,contentEditable:rt,controls:me,controlsList:_e,coords:K|es,crossOrigin:null,data:null,dateTime:null,decoding:null,default:me,defer:me,dir:null,dirName:null,disabled:me,download:Xc,draggable:rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:me,formTarget:null,headers:_e,height:K,hidden:Xc,high:K,href:null,hrefLang:null,htmlFor:_e,httpEquiv:_e,id:null,imageSizes:null,imageSrcSet:null,inert:me,inputMode:null,integrity:null,is:null,isMap:me,itemId:null,itemProp:_e,itemRef:_e,itemScope:me,itemType:_e,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:me,low:K,manifest:null,max:null,maxLength:K,media:null,method:null,min:null,minLength:K,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:K,pattern:null,ping:_e,placeholder:null,playsInline:me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:me,referrerPolicy:null,rel:_e,required:me,reversed:me,rows:K,rowSpan:K,sandbox:_e,scope:null,scoped:me,seamless:me,selected:me,shadowRootClonable:me,shadowRootCustomElementRegistry:me,shadowRootDelegatesFocus:me,shadowRootMode:null,shadowRootSerializable:me,shape:null,size:K,sizes:null,slot:null,span:K,spellCheck:rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:K,step:null,style:null,tabIndex:K,target:null,title:null,translate:null,type:null,typeMustMatch:me,useMap:null,value:rt,width:K,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_e,axis:null,background:null,bgColor:null,border:K,borderColor:null,bottomMargin:K,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:K,leftMargin:K,link:null,longDesc:null,lowSrc:null,marginHeight:K,marginWidth:K,noResize:me,noHref:me,noShade:me,noWrap:me,object:null,profile:null,prompt:null,rev:null,rightMargin:K,rules:null,scheme:null,scrolling:rt,standby:null,summary:null,text:null,topMargin:K,valueType:null,version:null,vAlign:null,vLink:null,vSpace:K,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:me,disablePictureInPicture:me,disableRemotePlayback:me,exportParts:es,part:_e,prefix:null,property:null,results:K,security:null,unselectable:null},space:"html",transform:lv}),ES=oi({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:K,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:K,amplitude:K,arabicForm:null,ascent:K,attributeName:null,attributeType:null,azimuth:K,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:K,by:null,calcMode:null,capHeight:K,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:K,diffuseConstant:K,direction:null,display:null,dur:null,divisor:K,dominantBaseline:null,download:me,dx:null,dy:null,edgeMode:null,editable:null,elevation:K,enableBackground:null,end:null,event:null,exponent:K,externalResourcesRequired:null,fill:null,fillOpacity:K,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:es,g2:es,glyphName:es,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:K,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:K,horizOriginX:K,horizOriginY:K,id:null,ideographic:K,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:K,k:K,k1:K,k2:K,k3:K,k4:K,kernelMatrix:Ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:K,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:K,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:K,overlineThickness:K,paintOrder:null,panose1:null,path:null,pathLength:K,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_e,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:K,pointsAtY:K,pointsAtZ:K,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:K,specularExponent:K,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:K,strikethroughThickness:K,string:null,stroke:null,strokeDashArray:Ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:K,strokeOpacity:K,strokeWidth:null,style:null,surfaceScale:K,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ht,tabIndex:K,tableValues:null,target:null,targetX:K,targetY:K,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:K,underlineThickness:K,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:K,values:null,vAlphabetic:K,vMathematical:K,vectorEffect:null,vHanging:K,vIdeographic:K,version:null,vertAdvY:K,vertOriginX:K,vertOriginY:K,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:K,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:iv}),av=oi({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()}}),ov=oi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lv}),uv=oi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),TS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},PS=/[A-Z]/g,qp=/-[a-z]/g,RS=/^data[-\w.:]+$/i;function LS(e,t){const n=Jc(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"&&RS.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(qp,IS);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!qp.test(l)){let a=l.replace(PS,AS);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ih}return new i(r,t)}function AS(e){return"-"+e.toLowerCase()}function IS(e){return e.charAt(1).toUpperCase()}const DS=rv([sv,CS,av,ov,uv],"html"),Dh=rv([sv,ES,av,ov,uv],"svg");function zS(e){return e.join(" ").trim()}var Gp=/\/\*(?:[^*]|\*(?!\/))*\*\//g,MS=/\n/g,$S=/^\s*/,_S=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,OS=/^:\s*/,FS=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,US=/^[;\s]*/,BS=`
|
|
361
|
+
`,Kp="/",Yp="*",Ni="",HS="comment",WS="declaration";function VS(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(f){var g=f.match(MS);g&&(n+=g.length);var w=f.lastIndexOf(BS);r=~w?f.length-w:r+f.length}function l(){var f={line:n,column:r};return function(g){return g.position=new a(f),c(),g}}function a(f){this.start=f,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(f){var g=new Error(t.source+":"+n+":"+r+": "+f);if(g.reason=f,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function u(f){var g=f.exec(e);if(g){var w=g[0];return i(w),e=e.slice(w.length),g}}function c(){u($S)}function h(f){for(var g;g=d();)f.push(g);return f}function d(){var f=l();if(!(Kp!=e.charAt(0)||Yp!=e.charAt(1))){for(var g=2;Ni!=e.charAt(g)&&(Yp!=e.charAt(g)||Kp!=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,f({type:HS,comment:w})}}function p(){var f=l(),g=u(_S);if(g){if(d(),!u(OS))return o("property missing ':'");var w=u(FS),y=f({type:WS,property:g[0].replace(Gp,Ni).trim(),value:w?w[0].replace(Gp,Ni).trim():Ni});return u(US),y}}function m(){var f=[];h(f);for(var g;g=p();)f.push(g),h(f);return f}return c(),m()}function QS(e,t){let n=null;if(!e||typeof e!="string")return n;const r=VS(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 cv=dv("end"),zh=dv("start");function dv(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 qS(e){const t=zh(e),n=cv(e);if(t&&n)return{start:t,end:n}}function Wi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Jp(e.position):"start"in e||"end"in e?Jp(e):"line"in e||"column"in e?ed(e):""}function ed(e){return Xp(e&&e.line)+":"+Xp(e&&e.column)}function Jp(e){return ed(e&&e.start)+"-"+ed(e&&e.end)}function Xp(e){return e&&typeof e=="number"?e:1}class $o 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($o.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 Mh={}.hasOwnProperty,GS=new Map,KS=/[A-Z]/g,YS=/-([a-z])/g,JS=new Set(["table","tbody","thead","tfoot","tr"]),XS=new Set(["td","th"]),hv="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=aN(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=lN(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"?Dh:DS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=fv(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function fv(e,t,n){if(t.type==="element")return eN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return tN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rN(e,t,n);if(t.type==="mdxjsEsm")return nN(e,t);if(t.type==="root")return sN(e,t,n);if(t.type==="text")return iN(e,t)}function eN(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Dh,e.schema=i),e.ancestors.push(t);const l=mv(e,t.tagName,!1),a=oN(e,t);let o=_h(e,t);return JS.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!SS(u):!0})),pv(e,a,l,t),$h(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function tN(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 nN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pl(e,t.position)}function rN(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Dh,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:mv(e,t.name,!0),a=uN(e,t),o=_h(e,t);return pv(e,a,l,t),$h(a,o),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function sN(e,t,n){const r={};return $h(r,_h(e,t)),e.create(t,e.Fragment,r,n)}function iN(e,t){return t.value}function pv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $h(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function lN(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 aN(e,t){return n;function n(r,i,l,a){const o=Array.isArray(l.children),u=zh(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 oN(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Mh.call(t.properties,i)){const l=cN(e,i,t.properties[i]);if(l){const[a,o]=l;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&XS.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 uN(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 _h(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:GS;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=fv(e,l,a);o!==void 0&&n.push(o)}return n}function cN(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const r=LS(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?vS(n):zS(n)),r.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:hN(n):dN(e,String(n))]:[e.elementAttributeNameCase==="react"&&r.space?TS[r.property]||r.property:r.attribute,n]}function dN(e,t){const n={};try{QS(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(YS,mN))),n[l]=i}})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,l=new $o("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=hv+"#cannot-parse-style-attribute",l}return n}function mv(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=Wp(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=Wp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Mh.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 $o("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=hv+"#cannot-handle-mdx-estrees-without-createevaluater",n}function hN(e){const t={};let n;for(n in e)Mh.call(e,n)&&(t[fN(n)]=e[n]);return t}function fN(e){if(e.slice(0,2)==="--")return e;let t=e.replace(KS,pN);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function pN(e){return"-"+e.toLowerCase()}function mN(e,t){return t.toUpperCase()}const Tu={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"]},gN={};function _o(e,t){const n=gN,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return gv(e,r,i)}function gv(e,t,n){if(xN(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 Zp(e.children,t,n)}return Array.isArray(e)?Zp(e,t,n):""}function Zp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=gv(e[i],t,n);return r.join("")}function xN(e){return!!(e&&typeof e=="object")}const em=document.createElement("i");function Oh(e){const t="&"+e+";";em.innerHTML=t;const n=em.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function vn(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 nn(e,t){return e.length>0?(vn(e,e.length,0,t),e):t}const tm={}.hasOwnProperty;function xv(e){const t={};let n=-1;for(;++n<e.length;)yN(t,e[n]);return t}function yN(e,t){let n;for(n in t){const i=(tm.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let a;if(l)for(a in l){tm.call(i,a)||(i[a]=[]);const o=l[a];vN(i[a],Array.isArray(o)?o:o?[o]:[])}}}function vN(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);vn(e,0,0,r)}function yv(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 jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vt=Dr(/[A-Za-z]/),jt=Dr(/[\dA-Za-z]/),jN=Dr(/[#-'*+\--9=?A-Z^-~]/);function io(e){return e!==null&&(e<32||e===127)}const td=Dr(/\d/),wN=Dr(/[\dA-Fa-f]/),vv=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")),os=Dr(/\s/);function Dr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ui(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 Ae(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 jv(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 kN={tokenize:bN};function bN(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"),Ae(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 lo=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){nm(this,t,n,r,!1)}addBefore(t,n,r){nm(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 nm(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 SN={tokenize:NN},rm={tokenize:CN};function NN(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&&x();const b=t.events.length;let A=b,k;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){k=t.events[A][1].end;break}y(r);let T=b;for(;T<t.events.length;)t.events[T][1].end={...k},T++;const P=new lo;return P.add(A+1,0,t.events.slice(b)),P.add(b,T-b,[]),P.consume(t.events),c(v)}return o(v)}function c(v){if(r===n.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return f(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rm,h,d)(v)}function h(v){return i&&x(),y(r),p(v)}function d(v){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,f(v)}function p(v){return t.containerState={},e.attempt(rm,m,f)(v)}function m(v){return r++,n.push([t.currentConstruct,t.containerState]),p(v)}function f(v){if(v===null){i&&x(),y(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),y(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 A=t.sliceStream(v);if(b&&A.push(null),v.previous=l,l&&(l.next=v),l=v,i.defineSkip(v.start),i.write(A),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 T=t.events.length;let P=T,I,C;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(I){C=t.events[P][1].end;break}I=!0}for(y(r),k=T;k<t.events.length;)t.events[k][1].end={...C},k++;const L=new lo;L.add(P+1,0,t.events.slice(T)),L.add(T,k-T,[]),L.consume(t.events)}}function y(v){let b=n.length;for(;b-- >v;){const A=n[b];t.containerState=A[1],A[0].exit.call(t,e)}n.length=v}function x(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function CN(e,t,n){return Ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nr(e){if(e===null||Fe(e)||os(e))return 1;if(Nl(e))return 2}function Oo(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 nd={name:"attention",resolveAll:EN,tokenize:TN};function EN(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};sm(a,-l),sm(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=nn(r,[["enter",e[i][1],t],["exit",e[i][1],t]])),r=nn(r,[["enter",d,t],["enter",u,t],["exit",u,t],["enter",h,t]]),r=nn(r,Oo(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=nn(r,[["exit",h,t],["enter",c,t],["exit",c,t],["exit",d,t]]);let p=0;e[n][1].end.offset-e[n][1].start.offset&&(p=2,r=nn(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),vn(e,i-1,n-i+3,r),n=i+r.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function TN(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Nr(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=Nr(u),d=!h||h===2&&i||n.includes(u)&&u!==42&&u!==95,p=!i||i===2&&h||n.includes(r)&&r!==42&&r!==95;return c._open=!!(l===42?d:d&&(i||!p)),c._close=!!(l===42?p:p&&(h||!d)),t(u)}}function sm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PN={name:"autolink",tokenize:RN};function RN(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||io(m)?n(m):(e.consume(m),u)}function c(m){return m===64?(e.consume(m),h):jN(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):p(m)}function p(m){if((m===45||jt(m))&&r++<63){const f=m===45?p:d;return e.consume(m),f}return n(m)}}const Cl={partial:!0,tokenize:LN};function LN(e,t,n){return r;function r(l){return je(l)?Ae(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||he(l)?t(l):n(l)}}const wv={continuation:{tokenize:IN},exit:DN,name:"blockQuote",tokenize:AN};function AN(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 IN(e,t,n){const r=this;return i;function i(a){return je(a)?Ae(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):l(a)}function l(a){return e.attempt(wv,t,n)(a)}}function DN(e){e.exit("blockQuote")}const kv={name:"characterEscape",tokenize:zN};function zN(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 vv(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const bv={name:"characterReference",tokenize:MN};function MN(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=wN,h):(e.enter("characterReferenceValue"),l=7,a=td,h(d))}function h(d){if(d===59&&i){const p=e.exit("characterReferenceValue");return a===jt&&!Oh(r.sliceSerialize(p))?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 rd={partial:!0,tokenize:$N};function $N(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 im={concrete:!0,name:"codeFenced",tokenize:_N};function _N(e,t,n){const r=this,i={partial:!0,tokenize:A};let l=0,a=0,o;return u;function u(k){return c(k)}function c(k){const T=r.events[r.events.length-1];return l=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[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)?Ae(e,d,"whitespace")(k):d(k))}function d(k){return k===null||he(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(rd,g,b)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||he(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):je(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ae(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),p)}function m(k){return k===null||he(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||he(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===o?n(k):(e.consume(k),f)}function g(k){return e.attempt(i,b,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),y}function y(k){return l>0&&je(k)?Ae(e,x,"linePrefix",l+1)(k):x(k)}function x(k){return k===null||he(k)?e.check(rd,g,b)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||he(k)?(e.exit("codeFlowValue"),x(k)):(e.consume(k),v)}function b(k){return e.exit("codeFenced"),t(k)}function A(k,T,P){let I=0;return C;function C(U){return k.enter("lineEnding"),k.consume(U),k.exit("lineEnding"),L}function L(U){return k.enter("codeFencedFence"),je(U)?Ae(k,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):S(U)}function S(U){return U===o?(k.enter("codeFencedFenceSequence"),D(U)):P(U)}function D(U){return U===o?(I++,k.consume(U),D):I>=a?(k.exit("codeFencedFenceSequence"),je(U)?Ae(k,M,"whitespace")(U):M(U)):P(U)}function M(U){return U===null||he(U)?(k.exit("codeFencedFence"),T(U)):P(U)}}}const Pu={name:"codeIndented",tokenize:FN},ON={partial:!0,tokenize:UN};function FN(e,t,n){return r;function r(o){return e.enter("codeIndented"),jv(e,i,n,"linePrefix",4,4)(o)}function i(o){return o===null?a(o):he(o)?e.attempt(ON,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 UN(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):jv(e,t,l,"linePrefix",4,4)(a)}function l(a){return he(a)?i(a):n(a)}}const BN={name:"codeText",previous:WN,resolve:HN,tokenize:VN};function HN(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 WN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VN(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 QN{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 Sv(e){const t={};let n=-1,r,i,l,a,o,u,c;const h=new QN(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,qN(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 vn(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function qN(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,p=-1,m=n,f=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;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(g=p+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(),p=w.length;p--;){const y=o.slice(w[p],w[p+1]),x=l.pop();u.push([x,x+y.length-1]),e.splice(x,2,y)}for(u.reverse(),p=-1;++p<u.length;)c[f+u[p][0]]=f+u[p][1],f+=u[p][1]-u[p][0]-1;return c}const GN={resolve:YN,tokenize:JN},KN={partial:!0,tokenize:XN};function YN(e){return Sv(e),e}function JN(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(KN,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 XN(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ae(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 Nv(e,t,n,r,i,l,a,o,u){const c=u||Number.POSITIVE_INFINITY;let h=0;return d;function d(y){return y===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(y),e.exit(l),p):y===null||y===32||y===41||io(y)?n(y):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(y))}function p(y){return y===62?(e.enter(l),e.consume(y),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(e.exit("chunkString"),e.exit(o),p(y)):y===null||y===60||he(y)?n(y):(e.consume(y),y===92?f:m)}function f(y){return y===60||y===62||y===92?(e.consume(y),m):m(y)}function g(y){return!h&&(y===null||y===41||Fe(y))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(y)):h<c&&y===40?(e.consume(y),h++,g):y===41?(e.consume(y),h--,g):y===null||y===32||y===40||io(y)?n(y):(e.consume(y),y===92?w:g)}function w(y){return y===40||y===41||y===92?(e.consume(y),g):g(y)}}function Cv(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?p:d)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function Ev(e,t,n,r,i,l){let a;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),a=p===40?41:p,u):n(p)}function u(p){return p===a?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(l),c(p))}function c(p){return p===a?(e.exit(l),u(a)):p===null?n(p):he(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ae(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===a||p===null||he(p)?(e.exit("chunkString"),c(p)):(e.consume(p),p===92?d:h)}function d(p){return p===a||p===92?(e.consume(p),h):h(p)}}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)?Ae(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ZN={name:"definition",tokenize:tC},eC={partial:!0,tokenize:nC};function tC(e,t,n){const r=this;let i;return l;function l(m){return e.enter("definition"),a(m)}function a(m){return Cv.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return i=jn(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 Nv(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function h(m){return e.attempt(eC,d,d)(m)}function d(m){return je(m)?Ae(e,p,"whitespace")(m):p(m)}function p(m){return m===null||he(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function nC(e,t,n){return r;function r(o){return Fe(o)?Vi(e,i)(o):n(o)}function i(o){return Ev(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return je(o)?Ae(e,a,"whitespace")(o):a(o)}function a(o){return o===null||he(o)?t(o):n(o)}}const rC={name:"hardBreakEscape",tokenize:sC};function sC(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 iC={name:"headingAtx",resolve:lC,tokenize:aC};function lC(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"};vn(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])}return e}function aC(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)?Ae(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 Tv=["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"],sd=["pre","script","style","textarea"],oC={concrete:!0,name:"htmlFlow",resolveTo:cC,tokenize:dC},uC={partial:!0,tokenize:hC};function cC(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 dC(e,t,n){const r=this;let i,l,a,o,u;return c;function c(E){return h(E)}function h(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),d}function d(E){return E===33?(e.consume(E),p):E===47?(e.consume(E),l=!0,g):E===63?(e.consume(E),i=3,r.interrupt?t:N):vt(E)?(e.consume(E),a=String.fromCharCode(E),w):n(E)}function p(E){return E===45?(e.consume(E),i=2,m):E===91?(e.consume(E),i=5,o=0,f):vt(E)?(e.consume(E),i=4,r.interrupt?t:N):n(E)}function m(E){return E===45?(e.consume(E),r.interrupt?t:N):n(E)}function f(E){const F="CDATA[";return E===F.charCodeAt(o++)?(e.consume(E),o===F.length?r.interrupt?t:S:f):n(E)}function g(E){return vt(E)?(e.consume(E),a=String.fromCharCode(E),w):n(E)}function w(E){if(E===null||E===47||E===62||Fe(E)){const F=E===47,J=a.toLowerCase();return!F&&!l&&sd.includes(J)?(i=1,r.interrupt?t(E):S(E)):Tv.includes(a.toLowerCase())?(i=6,F?(e.consume(E),y):r.interrupt?t(E):S(E)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):l?x(E):v(E))}return E===45||jt(E)?(e.consume(E),a+=String.fromCharCode(E),w):n(E)}function y(E){return E===62?(e.consume(E),r.interrupt?t:S):n(E)}function x(E){return je(E)?(e.consume(E),x):C(E)}function v(E){return E===47?(e.consume(E),C):E===58||E===95||vt(E)?(e.consume(E),b):je(E)?(e.consume(E),v):C(E)}function b(E){return E===45||E===46||E===58||E===95||jt(E)?(e.consume(E),b):A(E)}function A(E){return E===61?(e.consume(E),k):je(E)?(e.consume(E),A):v(E)}function k(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),u=E,T):je(E)?(e.consume(E),k):P(E)}function T(E){return E===u?(e.consume(E),u=null,I):E===null||he(E)?n(E):(e.consume(E),T)}function P(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Fe(E)?A(E):(e.consume(E),P)}function I(E){return E===47||E===62||je(E)?v(E):n(E)}function C(E){return E===62?(e.consume(E),L):n(E)}function L(E){return E===null||he(E)?S(E):je(E)?(e.consume(E),L):n(E)}function S(E){return E===45&&i===2?(e.consume(E),ie):E===60&&i===1?(e.consume(E),X):E===62&&i===4?(e.consume(E),ae):E===63&&i===3?(e.consume(E),N):E===93&&i===5?(e.consume(E),Y):he(E)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(uC,O,D)(E)):E===null||he(E)?(e.exit("htmlFlowData"),D(E)):(e.consume(E),S)}function D(E){return e.check(rd,M,O)(E)}function M(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),U}function U(E){return E===null||he(E)?D(E):(e.enter("htmlFlowData"),S(E))}function ie(E){return E===45?(e.consume(E),N):S(E)}function X(E){return E===47?(e.consume(E),a="",B):S(E)}function B(E){if(E===62){const F=a.toLowerCase();return sd.includes(F)?(e.consume(E),ae):S(E)}return vt(E)&&a.length<8?(e.consume(E),a+=String.fromCharCode(E),B):S(E)}function Y(E){return E===93?(e.consume(E),N):S(E)}function N(E){return E===62?(e.consume(E),ae):E===45&&i===2?(e.consume(E),N):S(E)}function ae(E){return E===null||he(E)?(e.exit("htmlFlowData"),O(E)):(e.consume(E),ae)}function O(E){return e.exit("htmlFlow"),t(E)}}function hC(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Cl,t,n)}}const fC={name:"htmlText",tokenize:pC};function pC(e,t,n){const r=this;let i,l,a;return o;function o(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),u}function u(N){return N===33?(e.consume(N),c):N===47?(e.consume(N),A):N===63?(e.consume(N),v):vt(N)?(e.consume(N),P):n(N)}function c(N){return N===45?(e.consume(N),h):N===91?(e.consume(N),l=0,f):vt(N)?(e.consume(N),x):n(N)}function h(N){return N===45?(e.consume(N),m):n(N)}function d(N){return N===null?n(N):N===45?(e.consume(N),p):he(N)?(a=d,X(N)):(e.consume(N),d)}function p(N){return N===45?(e.consume(N),m):d(N)}function m(N){return N===62?ie(N):N===45?p(N):d(N)}function f(N){const ae="CDATA[";return N===ae.charCodeAt(l++)?(e.consume(N),l===ae.length?g:f):n(N)}function g(N){return N===null?n(N):N===93?(e.consume(N),w):he(N)?(a=g,X(N)):(e.consume(N),g)}function w(N){return N===93?(e.consume(N),y):g(N)}function y(N){return N===62?ie(N):N===93?(e.consume(N),y):g(N)}function x(N){return N===null||N===62?ie(N):he(N)?(a=x,X(N)):(e.consume(N),x)}function v(N){return N===null?n(N):N===63?(e.consume(N),b):he(N)?(a=v,X(N)):(e.consume(N),v)}function b(N){return N===62?ie(N):v(N)}function A(N){return vt(N)?(e.consume(N),k):n(N)}function k(N){return N===45||jt(N)?(e.consume(N),k):T(N)}function T(N){return he(N)?(a=T,X(N)):je(N)?(e.consume(N),T):ie(N)}function P(N){return N===45||jt(N)?(e.consume(N),P):N===47||N===62||Fe(N)?I(N):n(N)}function I(N){return N===47?(e.consume(N),ie):N===58||N===95||vt(N)?(e.consume(N),C):he(N)?(a=I,X(N)):je(N)?(e.consume(N),I):ie(N)}function C(N){return N===45||N===46||N===58||N===95||jt(N)?(e.consume(N),C):L(N)}function L(N){return N===61?(e.consume(N),S):he(N)?(a=L,X(N)):je(N)?(e.consume(N),L):I(N)}function S(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),i=N,D):he(N)?(a=S,X(N)):je(N)?(e.consume(N),S):(e.consume(N),M)}function D(N){return N===i?(e.consume(N),i=void 0,U):N===null?n(N):he(N)?(a=D,X(N)):(e.consume(N),D)}function M(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||Fe(N)?I(N):(e.consume(N),M)}function U(N){return N===47||N===62||Fe(N)?I(N):n(N)}function ie(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function X(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),B}function B(N){return je(N)?Ae(e,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):Y(N)}function Y(N){return e.enter("htmlTextData"),a(N)}}const Fh={name:"labelEnd",resolveAll:yC,resolveTo:vC,tokenize:jC},mC={tokenize:wC},gC={tokenize:kC},xC={tokenize:bC};function yC(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&&vn(e,0,e.length,n),e}function vC(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=nn(a,e.slice(i+1,i+r+3)),a=nn(a,[["enter",c,t]]),a=nn(a,Oo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,l-3),t)),a=nn(a,[["exit",c,t],e[l-2],e[l-1],["exit",u,t]]),a=nn(a,e.slice(l+1)),a=nn(a,[["exit",o,t]]),vn(e,i,e.length,a),e}function jC(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(p){return l?l._inactive?d(p):(a=r.parser.defined.includes(jn(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):n(p)}function u(p){return p===40?e.attempt(mC,h,a?h:d)(p):p===91?e.attempt(gC,h,a?c:d)(p):a?h(p):d(p)}function c(p){return e.attempt(xC,h,d)(p)}function h(p){return i.pop(),t(p)}function d(p){return l._balanced=!0,n(p)}}function wC(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):Nv(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?Ev(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 kC(e,t,n){const r=this;return i;function i(o){return Cv.call(r,e,l,a,"reference","referenceMarker","referenceString")(o)}function l(o){return r.parser.defined.includes(jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function bC(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 SC={name:"labelStartImage",resolveAll:Fh.resolveAll,tokenize:NC};function NC(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 CC={name:"labelStartLink",resolveAll:Fh.resolveAll,tokenize:EC};function EC(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 Ru={name:"lineEnding",tokenize:TC};function TC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ae(e,t,"linePrefix")}}const Ca={name:"thematicBreak",tokenize:PC};function PC(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)?Ae(e,o,"whitespace")(c):o(c))}}const It={continuation:{tokenize:IC},exit:zC,name:"list",tokenize:AC},RC={partial:!0,tokenize:MC},LC={partial:!0,tokenize:DC};function AC(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 f=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:td(m)){if(r.containerState.type||(r.containerState.type=f,e.enter(f,{_container:!0})),f==="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 td(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(RC,p,d))}function h(m){return r.containerState.initialBlankLine=!0,l++,p(m)}function d(m){return je(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function IC(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,Ae(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(LC,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ae(e,e.attempt(It,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function DC(e,t,n){const r=this;return Ae(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 zC(e){e.exit(this.containerState.type)}function MC(e,t,n){const r=this;return Ae(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 lm={name:"setextUnderline",resolveTo:$C,tokenize:_C};function $C(e,t){const n=new lo;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 _C(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)?Ae(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||he(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const OC={tokenize:FC};function FC(e){const t=this,n=e.attempt(Cl,r,e.attempt(this.parser.constructs.flowInitial,i,Ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(GN,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 UC={resolveAll:Rv()},BC=Pv("string"),HC=Pv("text");function Pv(e){return{resolveAll:Rv(e==="text"?WC: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 p=-1;if(d)for(;++p<d.length;){const m=d[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Rv(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 WC(e,t){const n=new lo;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 VC={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:wv},QC={91:ZN},qC={[-2]:Pu,[-1]:Pu,32:Pu},GC={35:iC,42:Ca,45:[lm,Ca],60:oC,61:lm,95:Ca,96:im,126:im},KC={38:bv,92:kv},YC={[-5]:Ru,[-4]:Ru,[-3]:Ru,33:SC,38:bv,42:nd,60:[PN,fC],91:CC,92:[rC,kv],93:Fh,95:nd,96:BN},JC={null:[nd,UC]},XC={null:[42,95]},ZC={null:[]},eE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:XC,contentInitial:QC,disable:ZC,document:VC,flow:GC,flowInitial:qC,insideSpan:JC,string:KC,text:YC},Symbol.toStringTag,{value:"Module"}));function tE(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:T(A),check:T(k),consume:x,enter:v,exit:b,interrupt:T(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:f,parser:e,previous:null,sliceSerialize:p,sliceStream:m,write:d};let h=t.tokenize.call(c,u);return t.resolveAll&&l.push(t),c;function d(L){return a=nn(a,L),w(),a[a.length-1]!==null?[]:(P(t,0),c.events=Oo(l,c.events,c),c.events)}function p(L,S){return rE(m(L),S)}function m(L){return nE(a,L)}function f(){const{_bufferIndex:L,_index:S,line:D,column:M,offset:U}=r;return{_bufferIndex:L,_index:S,line:D,column:M,offset:U}}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 S=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===S&&r._bufferIndex<L.length;)y(L.charCodeAt(r._bufferIndex))}else y(L)}}function y(L){h=h(L)}function x(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,S){const D=S||{};return D.type=L,D.start=f(),c.events.push(["enter",D,c]),o.push(D),D}function b(L){const S=o.pop();return S.end=f(),c.events.push(["exit",S,c]),S}function A(L,S){P(L,S.from)}function k(L,S){S.restore()}function T(L,S){return D;function D(M,U,ie){let X,B,Y,N;return Array.isArray(M)?O(M):"tokenize"in M?O([M]):ae(M);function ae(ce){return Te;function Te(tt){const W=tt!==null&&ce[tt],ge=tt!==null&&ce.null,Q=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return O(Q)(tt)}}function O(ce){return X=ce,B=0,ce.length===0?ie:E(ce[B])}function E(ce){return Te;function Te(tt){return N=I(),Y=ce,ce.partial||(c.currentConstruct=ce),ce.name&&c.parser.constructs.disable.null.includes(ce.name)?J():ce.tokenize.call(S?Object.assign(Object.create(c),S):c,u,F,J)(tt)}}function F(ce){return L(Y,N),U}function J(ce){return N.restore(),++B<X.length?E(X[B]):ie}}}function P(L,S){L.resolveAll&&!l.includes(L)&&l.push(L),L.resolve&&vn(c.events,S,c.events.length-S,L.resolve(c.events.slice(S),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function I(){const L=f(),S=c.previous,D=c.currentConstruct,M=c.events.length,U=Array.from(o);return{from:M,restore:ie};function ie(){r=L,c.previous=S,c.currentConstruct=D,c.events.length=M,o=U,C()}}function C(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function nE(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 rE(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
|
+
`;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 sE(e){const r={constructs:xv([eE,...(e||{}).extensions||[]]),content:i(kN),defined:[],document:i(SN),flow:i(OC),lazy:{},string:i(BC),text:i(HC)};return r;function i(l){return a;function a(o){return tE(r,l,o)}}}function iE(e){for(;!Sv(e););return e}const am=/[\0\t\n\r]/g;function lE(){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;){am.lastIndex=c;const h=am.exec(l),d=h&&h.index!==void 0?h.index:l.length,p=l.charCodeAt(d);if(!h){t=l.slice(c);break}if(p===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),p){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 aE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function oE(e){return e.replace(aE,uE)}function uE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return yv(n.slice(l?2:1),l?16:10)}return Oh(n)||e}const Lv={}.hasOwnProperty;function cE(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),dE(n)(iE(sE(n).document().write(lE()(e,t,!0))))}function dE(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Rl),autolinkProtocol:C,autolinkEmail:C,atxHeading:a(Z),blockQuote:a(Q),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(Zt),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(Qo),listItemValue:m,listOrdered:a(Ll,p),listUnordered:a(Ll),paragraph:a(zn),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Z),strong:a($r),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(y),codeFencedFence:w,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:L,codeIndented:c(x),codeText:c(ie),codeTextData:L,data:L,definition:c(),definitionDestinationString:A,definitionLabelString:v,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(M),htmlFlowData:L,htmlText:c(U),htmlTextData:L,image:c(B),label:N,labelText:Y,lineEnding:S,link:c(X),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:J,resourceDestinationString:ae,resourceTitleString:O,resource:E,setextHeading:c(I),setextHeadingLineSequence:P,setextHeadingText:T,strong:c(),thematicBreak:c()}};Av(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(_){let q={type:"root",children:[],position:void 0};const fe={stack:[q],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]),Lv.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]||om).call(fe,void 0,pt[0])}for(q.position={start:nr(_.length>0?_[0][1].start:{line:1,column:1,offset:0}),end:nr(_.length>0?_[_.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)q=t.transforms[Ee](q)||q;return q}function i(_,q,fe){let pe=-1;for(;++pe<_.length;)_[pe].call(q,fe)}function l(_,q){const fe=_.length-1;let pe=q-1,bt=-1,Ee=!1,pt,Bt,Zn,_r;const er=[];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&&!Zn&&(Zn=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 dn=_[bn];if(dn[1].type==="lineEnding"||dn[1].type==="lineEndingBlank"){if(dn[0]==="exit")continue;Bt&&(_[Bt][1].type="lineEndingBlank",Ee=!0),dn[1].type="lineEnding",Bt=bn}else if(!(dn[1].type==="linePrefix"||dn[1].type==="blockQuotePrefix"||dn[1].type==="blockQuotePrefixWhitespace"||dn[1].type==="blockQuoteMarker"||dn[1].type==="listItemIndent"))break}Zn&&(!Bt||Zn<Bt)&&(pt._spread=!0),pt.end=Object.assign({},Bt?_[Bt][1].start:mt[1].end),er.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,er.push({at:pe,event:["enter",bn,mt[2]]}),Zn=void 0,_r=!0}}}const Or=_.splice(q);let gs=0;for(pe=-1;++pe<Or.length;){for(;gs<er.length&&er[gs].at===q+pe;)_.push(er[gs++].event);_.push(Or[pe])}_[q][1]._spread=Ee}function a(_,q){return fe;function fe(pe){u.call(this,_(pe),pe),q&&q.call(this,pe)}}function o(){this.stack.push({type:"fragment",children:[]})}function u(_,q,fe){this.stack[this.stack.length-1].children.push(_),this.stack.push(_),this.tokenStack.push([q,fe||void 0]),_.position={start:nr(q.start),end:void 0}}function c(_){return q;function q(fe){_&&_.call(this,fe),h.call(this,fe)}}function h(_,q){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&&(q?q.call(this,_,pe[0]):(pe[1]||om).call(this,_,pe[0])),fe.position.end=nr(_.end)}function d(){return _o(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(_){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(_),10),this.data.expectingFirstListItemValue=void 0}}function f(){const _=this.resume(),q=this.stack[this.stack.length-1];q.lang=_}function g(){const _=this.resume(),q=this.stack[this.stack.length-1];q.meta=_}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const _=this.resume(),q=this.stack[this.stack.length-1];q.value=_.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const _=this.resume(),q=this.stack[this.stack.length-1];q.value=_.replace(/(\r?\n|\r)$/g,"")}function v(_){const q=this.resume(),fe=this.stack[this.stack.length-1];fe.label=q,fe.identifier=jn(this.sliceSerialize(_)).toLowerCase()}function b(){const _=this.resume(),q=this.stack[this.stack.length-1];q.title=_}function A(){const _=this.resume(),q=this.stack[this.stack.length-1];q.url=_}function k(_){const q=this.stack[this.stack.length-1];if(!q.depth){const fe=this.sliceSerialize(_).length;q.depth=fe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function P(_){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(_).codePointAt(0)===61?1:2}function I(){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:nr(_.start),end:void 0},fe.push(pe)),this.stack.push(pe)}function L(_){const q=this.stack.pop();q.value+=this.sliceSerialize(_),q.position.end=nr(_.end)}function S(_){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=q.children[q.children.length-1];fe.position.end=nr(_.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&(C.call(this,_),L.call(this,_))}function D(){this.data.atHardBreak=!0}function M(){const _=this.resume(),q=this.stack[this.stack.length-1];q.value=_}function U(){const _=this.resume(),q=this.stack[this.stack.length-1];q.value=_}function ie(){const _=this.resume(),q=this.stack[this.stack.length-1];q.value=_}function X(){const _=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=q,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 q=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=q,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function Y(_){const q=this.sliceSerialize(_),fe=this.stack[this.stack.length-2];fe.label=oE(q),fe.identifier=jn(q).toLowerCase()}function N(){const _=this.stack[this.stack.length-1],q=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=q}function ae(){const _=this.resume(),q=this.stack[this.stack.length-1];q.url=_}function O(){const _=this.resume(),q=this.stack[this.stack.length-1];q.title=_}function E(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function J(_){const q=this.resume(),fe=this.stack[this.stack.length-1];fe.label=q,fe.identifier=jn(this.sliceSerialize(_)).toLowerCase(),this.data.referenceType="full"}function ce(_){this.data.characterReferenceType=_.type}function Te(_){const q=this.sliceSerialize(_),fe=this.data.characterReferenceType;let pe;fe?(pe=yv(q,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=Oh(q);const bt=this.stack[this.stack.length-1];bt.value+=pe}function tt(_){const q=this.stack.pop();q.position.end=nr(_.end)}function W(_){L.call(this,_);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(_)}function ge(_){L.call(this,_);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(_)}function Q(){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 Zt(){return{type:"emphasis",children:[],position:void 0}}function Z(){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 Qo(_){return{type:"listItem",spread:_._spread,checked:null,children:[],position:void 0}}function zn(){return{type:"paragraph",children:[],position:void 0}}function $r(){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 nr(e){return{line:e.line,column:e.column,offset:e.offset}}function Av(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Av(e,r):hE(e,r)}}function hE(e,t){let n;for(n in t)if(Lv.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 om(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 fE(e){const t=this;t.parser=n;function n(r){return cE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function pE(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 mE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
364
|
+
`}]}function gE(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 xE(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=ui(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 jE(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 wE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Iv(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 kE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Iv(e,t);const i={src:ui(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 bE(e,t){const n={src:ui(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 SE(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 NE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Iv(e,t);const i={href:ui(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 CE(e,t){const n={href:ui(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 EE(e,t,n){const r=e.all(t),i=n?TE(n):Dv(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
|
+
`}),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 TE(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=Dv(n[r])}return t}function Dv(e){const{spread:t}=e;return t??e.children.length>1}function PE(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 RE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function AE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IE(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=zh(t.children[1]),u=cv(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 DE(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],p={},m=a?a[u]:void 0;m&&(p.align=m);let f={type:"element",tagName:l,properties:p,children:[]};d&&(f.children=e.all(d),e.patch(d,f),f=e.applyData(d,f)),c.push(f)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function zE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const um=9,cm=32;function ME(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const l=[];for(;r;)l.push(dm(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return l.push(dm(t.slice(i),i>0,!1)),l.join("")}function dm(e,t,n){let r=0,i=e.length;if(t){let l=e.codePointAt(r);for(;l===um||l===cm;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(i-1);for(;l===um||l===cm;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function $E(e,t){const n={type:"text",value:ME(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _E(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const OE={blockquote:pE,break:mE,code:gE,delete:xE,emphasis:yE,footnoteReference:vE,heading:jE,html:wE,imageReference:kE,image:bE,inlineCode:SE,linkReference:NE,link:CE,listItem:EE,list:PE,paragraph:RE,root:LE,strong:AE,table:IE,tableCell:zE,tableRow:DE,text:$E,thematicBreak:_E,toml:na,yaml:na,definition:na,footnoteDefinition:na};function na(){}const zv=-1,Fo=0,Qi=1,ao=2,Uh=3,Bh=4,Hh=5,Wh=6,Mv=7,$v=8,{defineProperty:FE}=Object,_v=typeof self=="object"?self:globalThis,hm=(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 _v[e](t)},UE=(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 Fo:case zv:return n(a,i);case Qi:{const o=n([],i);for(const u of a)o.push(r(u));return o}case ao:{const o=n({},i);for(const[u,c]of a){const h=r(u),d=r(c);h==="__proto__"?FE(o,h,{value:d,configurable:!0,enumerable:!0,writable:!0}):o[h]=d}return o}case Uh:return n(new Date(a),i);case Bh:{const{source:o,flags:u}=a;return n(new RegExp(o,u),i)}case Hh:{const o=n(new Map,i);for(const[u,c]of a)o.set(r(u),r(c));return o}case Wh:{const o=n(new Set,i);for(const u of a)o.add(r(u));return o}case Mv:{const{name:o,message:u}=a;return n(typeof _v[o]=="function"?hm(o,u):new Error(u),i)}case $v: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(hm(l,a),i)};return r},fm=e=>UE(new Map,e)(0),Wr="",{toString:BE}={},{keys:HE,is:WE}=Object,Ei=e=>{const t=typeof e;if(t!=="object"||!e)return[Fo,t];const n=BE.call(e).slice(8,-1);switch(n){case"Array":return[Qi,Wr];case"Object":return[ao,Wr];case"Date":return[Uh,Wr];case"RegExp":return[Bh,Wr];case"Map":return[Hh,Wr];case"Set":return[Wh,Wr];case"DataView":return[Qi,n]}return n.includes("Array")?[Qi,n]:e instanceof Error?[Mv,e.name||"Error"]:[ao,n]},ra=([e,t])=>e===Fo&&(t==="function"||t==="symbol"),VE=(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 Fo:{let h=a;switch(u){case"bigint":o=$v,h=a.toString();break;case"number":if(!a&&WE(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([zv],a)}return i([o,h],a)}case Qi:{if(u){let p=a;return u==="DataView"?p=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(a)),i([u,[...p]],a)}const h=[],d=i([o,h],a);for(const p of a)h.push(l(p));return d}case ao:{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 p of HE(a))(e||!ra(Ei(a[p])))&&h.push([l(p),l(a[p])]);return d}case Uh:return i([o,isNaN(a.getTime())?Wr:a.toISOString()],a);case Bh:{const{source:h,flags:d}=a;return i([o,{source:h,flags:d}],a)}case Hh:{const h=[],d=i([o,h],a);for(const[p,m]of a)(e||!(ra(Ei(p))||ra(Ei(m))))&&h.push([l(p),l(m)]);return d}case Wh:{const h=[],d=i([o,h],a);for(const p of a)(e||!ra(Ei(p)))&&h.push(l(p));return d}}const{message:c}=a;return i([o,{name:u,message:c}],a)};return l},pm=(e,{json:t,lossy:n}={})=>{const r=[];return VE(!(t||n),!!t,new Map,r)(e),r},oo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?fm(pm(e,t)):structuredClone(e):(e,t)=>fm(pm(e,t));function QE(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 qE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function GE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||QE,r=e.options.footnoteBackLabel||qE,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],p=String(h.identifier).toUpperCase(),m=ui(p.toLowerCase());let f=0;const g=[],w=e.footnoteCounts.get(p);for(;w!==void 0&&++f<=w;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,f);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const v=y.children[y.children.length-1];v&&v.type==="text"?v.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else d.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(h,x),u.push(x)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...oo(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
368
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
369
|
+
`}]}}const Uo=function(e){if(e==null)return XE;if(typeof e=="function")return Bo(e);if(typeof e=="object")return Array.isArray(e)?KE(e):YE(e);if(typeof e=="string")return JE(e);throw new Error("Expected function, string, or object as test")};function KE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Uo(e[n]);return Bo(r);function r(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function YE(e){const t=e;return Bo(n);function n(r){const i=r;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function JE(e){return Bo(t);function t(n){return n&&n.type===e}}function Bo(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 XE(){return!0}function ZE(e){return e!==null&&typeof e=="object"&&"type"in e}const Ov=[],eT=!0,qi=!1,id="skip";function ld(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=Uo(l),h=i?1:-1;d(e,void 0,[])();function d(p,m,f){const g=p&&typeof p=="object"?p:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(p.type+(y?"<"+y+">":""))+")"})}return w;function w(){const y=!l||c(p,m,f[f.length-1]||void 0);let x=Ov;if(o&&y&&(x=mm(o(p,f,m)),x[0]===qi))return x;if("children"in p&&p.children){const v=p;if(v.children&&x[0]!==id){let b=(i?-1:v.children.length)+h;const A=[...f,v];for(;b>-1&&b<v.children.length;){const k=v.children[b],T=d(k,b,A)();if(T[0]===qi)return T;b=typeof T[1]=="number"?T[1]:b+h}}}if(u&&y){const v=mm(u(p,f,m));if(v[0]===id)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 x}}}function mm(e){return Array.isArray(e)?e:typeof e=="number"?[eT,e]:e==null?Ov:[e]}function Ho(e,t,n,r){let i,l,a;l=t,a=n,typeof l=="function"?ld(e,i,ad(l),a):ld(e,i,tT(l),a)}function tT(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?ad(e.enter):e.enter,exit:typeof e.exit=="function"?ad(e.exit):e.exit}}function ad(e){return t;function t(n,r,i){return e(n,i,r[r.length-1])}}const od={}.hasOwnProperty,nT={};function rT(e,t){const n=t||nT,r=new Map,i=new Map,l=new Map,a={...OE,...n.handlers},o={all:c,applyData:iT,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:a,one:u,options:n,patch:sT,wrap:aT};return Ho(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:p}=h,m=o.handlers[p];if(od.call(o.handlers,p)&&m)return m(o,h,d);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in h){const{children:g,...w}=h;return{...oo(w),children:o.all(h)}}return oo(h)}return(o.options.unknownHandler||lT)(o,h,d)}function c(h){const d=[];if("children"in h){const p=h.children;let m=-1;for(;++m<p.length;){const f=o.one(p[m],h);if(f){if(m&&p[m-1].type==="break"&&(!Array.isArray(f)&&f.type==="text"&&(f.value=gm(f.value)),!Array.isArray(f)&&f.type==="element")){const g=f.children[0];g&&g.type==="text"&&(g.value=gm(g.value))}Array.isArray(f)?d.push(...f):d.push(f)}}}return d}}function sT(e,t){e.position&&(t.position=qS(e))}function iT(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,oo(l)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function lT(e,t){const n=t.data||{},r="value"in t&&!(od.call(n,"hProperties")||od.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 aT(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
370
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
371
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
372
|
+
`}),n}function gm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function xm(e,t){const n=rT(e,t),r=n.one(e,void 0),i=GE(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 oT(e,t){return e&&"run"in e?async function(n,r){const i=xm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return xm(n,{file:r,...e||t})}}function ym(e){if(e)throw e}var Ea=Object.prototype.hasOwnProperty,Fv=Object.prototype.toString,vm=Object.defineProperty,jm=Object.getOwnPropertyDescriptor,wm=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Fv.call(t)==="[object Array]"},km=function(t){if(!t||Fv.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)},bm=function(t,n){vm&&n.name==="__proto__"?vm(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Sm=function(t,n){if(n==="__proto__")if(Ea.call(t,n)){if(jm)return jm(t,n).value}else return;return t[n]},uT=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=Sm(o,n),i=Sm(t,n),o!==i&&(h&&i&&(km(i)||(l=wm(i)))?(l?(l=!1,a=r&&wm(r)?r:[]):a=r&&km(r)?r:{},bm(o,{name:n,newValue:e(h,a,i)})):typeof i<"u"&&bm(o,{name:n,newValue:i}));return o};const Lu=yd(uT);function ud(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 cT(){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?dT(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 dT(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:hT,dirname:fT,extname:pT,join:mT,sep:"/"};function hT(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 fT(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 pT(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 mT(...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?".":gT(n)}function gT(e){El(e);const t=e.codePointAt(0)===47;let n=xT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xT(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 yT={cwd:vT};function vT(){return"/"}function cd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jT(e){if(typeof e=="string")e=new URL(e);else if(!cd(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 wT(e)}function wT(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 Au=["history","path","basename","stem","extname","dirname"];class Uv{constructor(t){let n;t?cd(t)?n={path:t}:typeof t=="string"||kT(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":yT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Au.length;){const l=Au[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)Au.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?En.basename(this.path):void 0}set basename(t){Du(t,"basename"),Iu(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){Nm(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(Iu(t,"extname"),Nm(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){cd(t)&&(t=jT(t)),Du(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){Du(t,"stem"),Iu(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 $o(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 Iu(e,t){if(e&&e.includes(En.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+En.sep+"`")}function Du(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Nm(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bT=function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},ST={}.hasOwnProperty;class Vh extends bT{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=cT()}copy(){const t=new Vh;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Lu(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?($u("data",this.frozen),this.namespace[t]=n,this):ST.call(this.namespace,t)&&this.namespace[t]||void 0:t?($u("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 zu("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),zu("process",this.parser||this.Parser),Mu("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,p){if(h||!d||!p)return c(h);const m=d,f=r.stringify(m,p);ET(f)?p.value=f:p.result=f,c(h,p)});function c(h,d){h||!d?a(h):l?l(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),zu("processSync",this.parser||this.Parser),Mu("processSync",this.compiler||this.Compiler),this.process(t,i),Em("processSync","process",n),r;function i(l,a){n=!0,ym(l),r=a}}run(t,n,r){Cm(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,p){const m=d||t;h?o(h):a?a(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),Em("runSync","run",r),i;function l(a,o){ym(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=sa(n),i=this.compiler||this.Compiler;return Mu("stringify",i),Cm(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if($u("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=Lu(!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,p=-1;for(;++d<r.length;)if(r[d][0]===c){p=d;break}if(p===-1)r.push([c,...h]);else if(h.length>0){let[m,...f]=h;const g=r[p][1];ud(g)&&ud(m)&&(m=Lu(!0,g,m)),r[p]=[c,m,...f]}}}}const NT=new Vh().freeze();function zu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $u(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 Cm(e){if(!ud(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Em(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function sa(e){return CT(e)?e:new Uv(e)}function CT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ET(e){return typeof e=="string"||TT(e)}function TT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tm=[],Pm={allowDangerousHtml:!0},RT=/^(https?|ircs?|mailto|xmpp)$/i,LT=[{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 zr(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,l=e.components,a=e.disallowedElements,o=e.rehypePlugins||Tm,u=e.remarkPlugins||Tm,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Pm}:Pm,h=e.skipHtml,d=e.unwrapDisallowed,p=e.urlTransform||AT,m=NT().use(fE).use(u).use(oT,c).use(o),f=new Uv;typeof r=="string"&&(f.value=r);for(const x of LT)Object.hasOwn(e,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+PT+x.id,void 0);const g=m.parse(f);let w=m.runSync(g,f);return i&&(w={type:"element",tagName:"div",properties:{className:i},children:w.type==="root"?w.children:[w]}),Ho(w,y),ZS(w,{Fragment:s.Fragment,components:l,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function y(x,v,b){if(x.type==="raw"&&b&&typeof v=="number")return h?b.children.splice(v,1):b.children[v]={type:"text",value:x.value},v;if(x.type==="element"){let A;for(A in Tu)if(Object.hasOwn(Tu,A)&&Object.hasOwn(x.properties,A)){const k=x.properties[A],T=Tu[A];(T===null||T.includes(x.tagName))&&(x.properties[A]=p(String(k||""),A,x))}}if(x.type==="element"){let A=t?!t.includes(x.tagName):a?a.includes(x.tagName):!1;if(!A&&n&&typeof v=="number"&&(A=!n(x,v,b)),A&&b&&typeof v=="number")return d&&x.children?b.children.splice(v,1,...x.children):b.children.splice(v,1),v}}}function AT(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||RT.test(e.slice(0,t))?e:""}function Rm(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 IT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function DT(e,t,n){const i=Uo((n||{}).ignore||[]),l=zT(t);let a=-1;for(;++a<l.length;)ld(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 id}function u(c,h,d){const p=h[h.length-1],m=l[a][0],f=l[a][1];let g=0,w=!1,y=[];m.lastIndex=0;let x=m.exec(c.value);for(;x;){const b=x.index,A={index:x.index,input:x.input,stack:[...h,c]};let k=f(...x,A);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 T of k)v(T);else k&&v(k);g=b+x[0].length,w=!0}if(!m.global)break;x=m.exec(c.value)}return w?(g<c.value.length&&v({type:"text",value:c.value.slice(g)}),p.children.splice(d,1,...y)):y=[c],d+y.length;function v(b){const A=y[y.length-1];A&&A.type==="text"&&b.type==="text"?A.value+=b.value:y.push(b)}}}function zT(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([MT(i[0]),$T(i[1])])}return t}function MT(e){return typeof e=="string"?new RegExp(IT(e),"g"):e}function $T(e){return typeof e=="function"?e:function(){return e}}const _u="phrasing",Ou=["autolink","link","image","label"];function _T(){return{transforms:[VT],enter:{literalAutolink:FT,literalAutolinkEmail:Fu,literalAutolinkHttp:Fu,literalAutolinkWww:Fu},exit:{literalAutolink:WT,literalAutolinkEmail:HT,literalAutolinkHttp:UT,literalAutolinkWww:BT}}}function OT(){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 FT(e){this.enter({type:"link",title:null,url:"",children:[],position:void 0},e)}function Fu(e){this.config.enter.autolinkProtocol.call(this,e)}function UT(e){this.config.exit.autolinkProtocol.call(this,e)}function BT(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 HT(e){this.config.exit.autolinkEmail.call(this,e)}function WT(e){this.exit(e)}function VT(e){DT(e,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),QT],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),KT],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),GT],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),qT]],{ignore:["link","linkReference"]})}function QT(e,t,n,r,i){if(!XT(i))return!1;let l="";if(/^w/i.test(t)&&(n=t+n,t="",l="http://"),Nl(n.charCodeAt(0))||!YT(n))return!1;const a=JT(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 qT(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 GT(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 KT(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 YT(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 JT(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=Rm(e,"(");let l=Rm(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 XT(e){const t=e.input.charCodeAt(e.index-1);return e.index===0||os(t)||Nl(t)}Bv.peek=aP;function ZT(){this.buffer()}function eP(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tP(){this.buffer()}function nP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function rP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function sP(e){this.exit(e)}function iP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function lP(e){this.exit(e)}function aP(){return"["}function Bv(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 oP(){return{enter:{gfmFootnoteCallString:ZT,gfmFootnoteCall:eP,gfmFootnoteDefinitionLabelString:tP,gfmFootnoteDefinition:nP},exit:{gfmFootnoteCallString:rP,gfmFootnoteCall:sP,gfmFootnoteDefinitionLabelString:iP,gfmFootnoteDefinition:lP}}}function uP(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Bv},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?`
|
|
374
|
+
`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Hv:cP))),c(),u}}function cP(e,t,n){return t===0?e:Hv(e,t,n)}function Hv(e,t,n){return(n?"":" ")+e}const dP=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Qh.attention=gP;Qh.peek=xP;function hP(){return{canContainEols:["delete"],enter:{strikethrough:pP},exit:{strikethrough:mP}}}function fP(){return{handlers:{delete:Qh},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:dP}]}}function pP(e){this.enter({type:"delete",children:[],position:void 0},e)}function mP(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 gP(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function xP(){return"~"}function yP(e){return e.length}function vP(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||yP,l=[],a=[],o=[],u=[];let c=0,h=-1;for(;++h<e.length;){const g=[],w=[];let y=-1;for(e[h].length>c&&(c=e[h].length);++y<e[h].length;){const x=jP(e[h][y]);if(n.alignDelimiters!==!1){const v=i(x);w[y]=v,(u[y]===void 0||v>u[y])&&(u[y]=v)}g.push(x)}a[h]=g,o[h]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)l[d]=Lm(r[d]);else{const g=Lm(r);for(;++d<c;)l[d]=g}d=-1;const p=[],m=[];for(;++d<c;){const g=l[d];let w="",y="";g===99?(w=":",y=":"):g===108?w=":":g===114&&(y=":");let x=n.alignDelimiters===!1?1:Math.max(1,u[d]-w.length-y.length);const v=w+"-".repeat(x)+y;n.alignDelimiters!==!1&&(x=w.length+x+y.length,x>u[d]&&(u[d]=x),m[d]=x),p[d]=v}a.splice(1,0,p),o.splice(1,0,m),h=-1;const f=[];for(;++h<a.length;){const g=a[h],w=o[h],y=n.fillRows===!1?Math.max(1,a[h===1?0:h].length):c;d=-1;const x=[];for(;++d<y;){const v=g[d]||"";let b="",A="";if(n.alignDelimiters!==!1){const k=u[d]-(w[d]||0),T=l[d];if(T===114)b=" ".repeat(k);else if(T===99){const P=k/2;k%2?(b=" ".repeat(P+.5),A=" ".repeat(P-.5)):(b=" ".repeat(P),A=b)}else A=" ".repeat(k)}n.delimiterStart!==!1&&!d&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||d)&&x.push(" "),n.alignDelimiters!==!1&&x.push(b),x.push(v),n.alignDelimiters!==!1&&x.push(A),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||d!==y-1)&&x.push("|")}f.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return f.join(`
|
|
375
|
+
`)}function jP(e){return e==null?"":String(e)}function Lm(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 wP=Uo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function kP(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()),bP);return i(),a}function bP(e,t,n){return">"+(n?"":" ")+e}function SP(e,t){return Am(e,t.inConstruct,!0)&&!Am(e,t.notInConstruct,!1)}function Am(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 Im(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){const l=n.unsafe[i];if(l.character===`
|
|
376
|
+
`&&!l.before&&!l.after&&SP(n.stack,l))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
377
|
+
`}function NP(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 CP(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 EP(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 TP(e,t,n,r){const i=EP(n),l=e.value||"";if(CP(e,n)){const d=n.enter("codeIndented"),p=n.indentLines(l,PP);return d(),p}const a=n.createTracker(r),o=i.repeat(Math.max(NP(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:`
|
|
378
|
+
`,encode:["`"],...a.current()})),d()}return h+=a.move(`
|
|
379
|
+
`),l&&(h+=a.move(l+`
|
|
380
|
+
`)),h+=a.move(o),u(),h}function PP(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 RP(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?" ":`
|
|
381
|
+
`,...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 LP(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 uo(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Vs(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function Wv(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Dm(e,t,n){const r=Nr(e),i=Nr(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 AP(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&&sd.includes(a)?1:Tv.includes(a)?6:7}const Vv=new Map([["*",!1],["_",!0]]);function IP(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=Vv.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=Nr(h.charCodeAt(h.length-1)),p=Nr((c<e.length?e[c].value:n).charCodeAt(0)),m=!p||p===2&&!!d,f=!d||d===2&&!!p,g={tokens:e.slice(a,c),markers:[],start:0,end:0,open:u?m&&(!!d||!f):m,close:u?f&&(!!p||!m):f,split:u!==void 0};for(const w of g.tokens){i.set(w,[...g.tokens]),l.set(w,g);let y=w.value.length;for(;y--;)g.markers.push(w)}g.end=g.markers.length,r.push(g),a=c}for(zP(r,i),a=-1;++a<e.length;){const o=i.get(e[a]);if(o)return{attention:IP(e,o,l),index:a}}}function ia(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const r=t?uo(n.value):Vs(n.value),i=Wv(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 DP(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=Wo(e,u,r,i),h=Qv(c,r,i);if(!h||h.index>n.index)return{chosen:u,mistake:h,tokens:c}}}}function zP(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),p=r.markers.slice(r.start,r.start+h),m=d[0],f=p[0];if(m===d[h-1]&&m.value.length===h&&f===p[h-1]&&f.value.length===h&&m.attention===f.attention)t.delete(m),t.delete(f);else{const g=[...new Set([...d,...p])];for(const w of g){const y=t.get(w);y&&y.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 MP(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(!vv(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 $P(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?uo(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===`
|
|
382
|
+
`)&&c.type==="html"&&AP(c.value)!==7&&(l[l.length-1]=d.replace(/(\r?\n|\r)$/," "),o=" ",u=t.createTracker(n),u.move(Vo(l,n.before,n.after)));const p=t.handle.handlers[c.type];if(p&&p.attention){const m=Gh(c,p.attention,t,u);if(!m)continue;l.push(m),o=Vs(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=Vs(m)}}return r.pop(),l}function Gh(e,t,n,r){const{construct:i,markers:l,sizes:a}=t(e,n),o=MP(e.type,l,a),u=o[0],c=n.enter(i),h=n.createTracker(r.current());h.move(u);const d=$P(e,n,{...h.current(),before:u,after:u});if(c(),d.length!==0)return r.move(u),r.move(Vo(d,u,u)),r.move(u),{children:d,sequences:o}}function zm(e,t,n,r){let i=Wo(e,t,n,r),l=Qv(i,n,r);for(;l;){const a=DP(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&&Vv.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 Wo(e,t,n,r){const i=[];let l,a=Vs(n),o=-1;for(;++o<e.length;){const u=e[o];if(typeof u=="string"){const v={value:u,attention:void 0};l&&l===uo(u)&&ia([v],!0),l=void 0,i.push(v),v.value&&(a=Vs(v.value));continue}const c=t.get(u)||u.sequences[0],h=c.charAt(0),d=e[o+1],p=a,m=uo(d===void 0?r:typeof d=="string"?d:t.get(d)||d.sequences[0]),f=Wo(u.children,t,c,c),g=f[0].value,w=Dm(p.charCodeAt(p.length-1),g.charCodeAt(0),h);w.inside&&ia(f,!0);const y=Vs(f[f.length-1].value),x=Dm(m.charCodeAt(0),y.charCodeAt(y.length-1),h);x.inside&&ia(f,!1),w.outside&&p!==`
|
|
383
|
+
`&&p!=="\r"&&ia(i,!1),x.outside&&(l=m),i.push({value:c,attention:u},...f,{value:c,attention:u}),a=c.charAt(c.length-1)}return i}function Vo(e,t,n){const r=new Map;qv(e,r,t,n);const i=(r.size>0?zm(e,r,t,n):void 0)||zm(e,new Map,t,n)||Wo(e,new Map,t,n);let l="";for(const a of i)l+=a.value;return l}Kh.attention=Gv;Kh.peek=_P;function Kh(e,t,n,r){const i=n.enter("phrasing"),l=Gh(e,Gv,n,n.createTracker(r)),a=l?Vo([l],r.before,r.after):"";return i(),a}function Gv(e,t){return{construct:"emphasis",markers:LP(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function _P(e,t,n){return n.options.emphasis||"*"}function OP(e,t){let n=!1;return Ho(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)&&_o(e)&&(t.options.setext||n))}function FP(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(OP(e,n)){const d=n.enter("headingSetext"),p=n.enter("phrasing"),m=n.containerPhrasing(e,{...l.current(),before:`
|
|
384
|
+
`,after:`
|
|
385
|
+
`});return p(),d(),m+`
|
|
386
|
+
`+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
|
387
|
+
`))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),u=n.enter("phrasing");l.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
388
|
+
`,...l.current()});const h=c.charCodeAt(0);return(h===9||h===32)&&(c=Wv(h)+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),u(),o(),c}Kv.peek=UP;function Kv(e){return e.value||""}function UP(){return"<"}Yv.peek=BP;function Yv(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 BP(){return"!"}Jv.peek=HP;function Jv(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(p){return p!=="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 HP(){return"!"}Xv.peek=WP;function Xv(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 WP(){return"`"}function Zv(e,t){const n=_o(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))}ej.peek=VP;function ej(e,t,n,r){const i=qh(n),l=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);if(Zv(e,n)){const f=n.stack;n.stack=f.filter(function(y){return y!=="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=f,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),p=r.before.charAt(r.before.length-1);let m=e.title||void 0;if(!m&&!d&&(p===`
|
|
389
|
+
`||p==="\r")){let f=0;for(;f<h.length&&h.charCodeAt(f)!==93;)f+=h.charCodeAt(f)===92?2:1;h.charCodeAt(f+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 VP(e,t,n){return Zv(e,n)?"<":"["}tj.peek=QP;function tj(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(p){return p!=="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 QP(){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 qP(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 GP(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 nj(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 KP(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let a=e.ordered?GP(n):Yh(n);const o=e.ordered?a==="."?")":".":qP(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),nj(n)===a&&h){let d=-1;for(;++d<e.children.length;){const p=e.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.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 YP(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 JP(e,t,n,r){const i=YP(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,p,m){return p?(m?"":" ".repeat(a))+d:(m?l:l+" ".repeat(a-l.length))+d}}function XP(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),i(),a}function ZP(e,t,n,r){if(!e.children.some(function(o){return wP(o)}))return n.containerFlow(e,r);const l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),a}function eR(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=rj;Jh.peek=tR;function Jh(e,t,n,r){const i=n.enter("phrasing"),l=Gh(e,rj,n,n.createTracker(r)),a=l?Vo([l],r.before,r.after):"";return i(),a}function rj(e,t){return{construct:"strong",markers:eR(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function tR(e,t,n){return n.options.strong||"*"}function nR(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 rR(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 sR(e,t,n){const r=(nj(n)+(n.options.ruleSpaces?" ":"")).repeat(rR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const dd={blockquote:kP,break:Im,code:TP,definition:RP,emphasis:Kh,hardBreak:Im,heading:FP,html:Kv,image:Yv,imageReference:Jv,inlineCode:Xv,link:ej,linkReference:tj,list:KP,listItem:JP,paragraph:XP,root:ZP,strong:Jh,text:nR,thematicBreak:sR};function iR(){return{enter:{table:lR,tableData:Mm,tableHeader:Mm,tableRow:oR},exit:{codeText:uR,table:aR,tableData:Uu,tableHeader:Uu,tableRow:Uu}}}function lR(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 aR(e){this.exit(e),this.data.inTable=void 0}function oR(e){this.enter({type:"tableRow",children:[],position:void 0},e)}function Uu(e){this.exit(e)}function Mm(e){this.enter({type:"tableCell",children:[],position:void 0},e)}function uR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,cR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function cR(e,t){return t==="|"?t:e}function dR(e){const t=e||{},{tableCellPadding:n,tablePipeAlign:r,stringLength:i}=t,l=n?" ":"|";return{handlers:{inlineCode:p,table:a,tableCell:u,tableRow:o},join:[hR],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
390
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}]};function a(m,f,g,w){const y=h(m,g,w),x=y[0];if(x){let v=m.align?m.align.length:0,b=-1;if(!v)for(;++b<y.length;)y[b].length>v&&(v=y[b].length);for(;x.length<v;)x.push("")}return c(y,m.align)}function o(m,f,g,w){const y=d(m,g,w),x=c([y]);return x.slice(0,x.indexOf(`
|
|
391
|
+
`))}function u(m,f,g,w){const y=g.enter("tableCell"),x=g.enter("phrasing"),v=g.containerPhrasing(m,{...w,before:l,after:l});return x(),y(),v}function c(m,f){return vP(m,{align:f,alignDelimiters:r,fillRows:!1,padding:n,stringLength:i})}function h(m,f,g){const{children:w}=m;let y=-1;const x=[],v=f.enter("table");for(;++y<w.length;)x[y]=d(w[y],f,g);return v(),x}function d(m,f,g){const{children:w}=m;let y=-1;const x=[],v=f.enter("tableRow");for(;++y<w.length;)x[y]=u(w[y],m,f,g);return v(),x}function p(m,f,g){const w=dd.inlineCode(m,f,g);if(!g.stack.includes("tableCell"))return w;const y=[];let x=0,v=w.indexOf("|");for(;v!==-1;){let b=v;for(;b>x&&w.charCodeAt(b-1)===92;)b--;y.push(w.slice(x,v)),(v-b)%2===0&&y.push("\\"),x=v,v=w.indexOf("|",v+1)}return y.push(w.slice(x)),y.join("")}}function hR(e,t,n,r){if(e.type==="table"&&n.type==="listItem"&&n.spread===!1&&(t.type==="definition"||t.type==="heading"&&fR(t,r)||t.type==="paragraph"||t.type==="table"))return 1}function fR(e,t){let n=!1;return Ho(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)&&_o(e)&&(t.options.setext||n))}function pR(){return{exit:{taskListCheckValueChecked:$m,taskListCheckValueUnchecked:$m,paragraph:gR}}}function mR(){return{handlers:{paragraph:xR},join:[yR]}}function $m(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function gR(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 xR(e,t,n,r){if(!t||t.type!=="listItem"||sj(t)!==e)return dd.paragraph(e,t,n,r);const i="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);l.move(i);const a=dd.paragraph(e.children.length>0?e:{type:"paragraph",children:[{type:"text",value:" "}]},t,n,{...r,...l.current()});return i+a}function yR(e,t,n){if(!(e.type==="definition"&&n.type==="listItem"))return;const r=sj(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function sj(e){if(typeof e.checked=="boolean")for(const t of e.children){if(t.type==="paragraph")return t;if(t.type!=="definition")return}}function vR(){return[_T(),oP(),hP(),iR(),pR()]}function jR(e){return{extensions:[OT(),uP(e),fP(),dR(e),mR()]}}const wR={tokenize:ER,partial:!0},ij={tokenize:TR,partial:!0},lj={tokenize:PR,partial:!0},aj={tokenize:RR,partial:!0},kR={tokenize:LR,partial:!0},oj={name:"wwwAutolink",tokenize:NR,previous:cj},uj={name:"protocolAutolink",tokenize:CR,previous:dj},Xn={name:"emailAutolink",tokenize:SR,previous:hj},Dn={};function bR(){return{text:Dn}}let Ur=48;for(;Ur<123;)Dn[Ur]=Xn,Ur++,Ur===58?Ur=65:Ur===91&&(Ur=97);Dn[43]=Xn;Dn[45]=Xn;Dn[46]=Xn;Dn[95]=Xn;Dn[72]=[Xn,uj];Dn[104]=[Xn,uj];Dn[87]=[Xn,oj];Dn[119]=[Xn,oj];function SR(e,t,n){const r=this;let i,l;return a;function a(d){return!hd(d)||!hj.call(r,r.previous)||Xh(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return hd(d)?(e.consume(d),o):d===64?(e.consume(d),u):n(d)}function u(d){return d===46?e.check(kR,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 NR(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!cj.call(r,r.previous)||Xh(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(wR,e.attempt(ij,e.attempt(lj,l),n),n)(a))}function l(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function CR(e,t,n){const r=this;let i="",l=!1;return a;function a(d){return(d===72||d===104)&&dj.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 p=i.toLowerCase();if(p==="http"||p==="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||io(d)||Fe(d)||os(d)||Nl(d)?n(d):e.attempt(ij,e.attempt(lj,h),n)(d)}function h(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function ER(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 TR(e,t,n){let r,i,l;return a;function a(c){return c===46||c===95?e.check(aj,u,o)(c):c===null||Fe(c)||os(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 PR(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(aj,t,l)(a):a===null||Fe(a)||os(a)?t(a):(e.consume(a),i)}function l(a){return a===41&&r++,e.consume(a),i}}function RR(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)||os(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Fe(o)||os(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 LR(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return jt(l)?n(l):t(l)}}function cj(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Fe(e)}function dj(e){return!vt(e)}function hj(e){return!(e===47||hd(e))}function hd(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 AR={tokenize:FR,partial:!0};function IR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:$R,continuation:{tokenize:_R},exit:OR}},text:{91:{name:"gfmFootnoteCall",tokenize:MR},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:DR,resolveTo:zR}}}}function DR(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=jn(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 zR(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 MR(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 p=e.exit("gfmFootnoteCallString");return i.includes(jn(r.sliceSerialize(p)))?(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 $R(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a=0,o;return u;function u(f){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(f){return f===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(f)}function h(f){if(a>999||f===93&&!o||f===null||f===91||Fe(f))return n(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return l=jn(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(f),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Fe(f)||(o=!0),a++,e.consume(f),f===92?d:h}function d(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}function p(f){return f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),i.includes(l)||i.push(l),Ae(e,m,"gfmFootnoteDefinitionWhitespace")):n(f)}function m(f){return t(f)}}function _R(e,t,n){return e.check(Cl,t,e.attempt(AR,t,n))}function OR(e){e.exit("gfmFootnoteDefinition")}function FR(e,t,n){const r=this;return Ae(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 UR(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)},p=[["enter",h,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&vn(p,p.length,0,Oo(m,a.slice(c+1,u),o)),vn(p,p.length,0,[["exit",d,o],["enter",a[u][1],o],["exit",a[u][1],o],["exit",h,o]]),vn(a,c-1,u-c+3,p),u=c+p.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 p;function p(f){return c===126&&h[h.length-1][1].type!=="characterEscape"?u(f):(a.enter("strikethroughSequenceTemporary"),m(f))}function m(f){const g=Nr(c);if(f===126)return d>1?u(f):(a.consume(f),d++,m);if(d<2&&!n)return u(f);const w=a.exit("strikethroughSequenceTemporary"),y=Nr(f);return w._open=!y||y===2&&!!g,w._close=!g||g===2&&!!y,o(f)}}}class BR{constructor(){this.map=[],this.index=new Map}add(t,n,r){HR(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 HR(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 WR(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 VR(){return{flow:{null:{name:"table",tokenize:QR,resolveAll:qR}}}}function QR(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:M}=r.events[L][1];if(M==="lineEnding"||M==="linePrefix")L--;else break}const S=L>-1?r.events[L][1].type:null,D=S==="tableHead"||S==="tableRow"?k:u;return D===k&&r.parser.lazy[r.now().line]?n(C):D(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)?Ae(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?p:d)}function p(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)?Ae(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):f(C))}function f(C){return C===45||C===58?w(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),g):A(C)}function g(C){return je(C)?Ae(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"),y):C===45?(l+=1,y(C)):C===null||he(C)?b(C):A(C)}function y(C){return C===45?(e.enter("tableDelimiterFiller"),x(C)):A(C)}function x(C){return C===45?(e.consume(C),x):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)?Ae(e,b,"whitespace")(C):b(C)}function b(C){return C===124?f(C):C===null||he(C)?!a||i!==l?A(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):A(C)}function A(C){return n(C)}function k(C){return e.enter("tableRow"),T(C)}function T(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),T):C===null||he(C)?(e.exit("tableRow"),t(C)):je(C)?Ae(e,T,"whitespace")(C):(e.enter("data"),P(C))}function P(C){return C===null||C===124||Fe(C)?(e.exit("data"),T(C)):(e.consume(C),C===92?I:P)}function I(C){return C===92||C===124?(e.consume(C),P):P(C)}}function qR(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 p=new BR;for(;++n<e.length;){const m=e[n],f=m[1];m[0]==="enter"?f.type==="tableHead"?(o=!1,u!==0&&(_m(p,t,u,c,h),h=void 0,u=0),c={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(n,0,[["enter",c,t]])):f.type==="tableRow"||f.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({},f.start),end:Object.assign({},f.end)},p.add(n,0,[["enter",h,t]])),i=f.type==="tableDelimiterRow"?2:h?3:1):i&&(f.type==="data"||f.type==="tableDelimiterMarker"||f.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],d=la(p,t,l,i,void 0,d),l=[0,0,0,0]),a[2]=n)):f.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(a[0]=a[1],d=la(p,t,l,i,void 0,d)),l=a,a=[l[1],n,0,0])):f.type==="tableHead"?(o=!0,u=n):f.type==="tableRow"||f.type==="tableDelimiterRow"?(u=n,l[1]!==0?(a[0]=a[1],d=la(p,t,l,i,n,d)):a[1]!==0&&(d=la(p,t,a,i,n,d)),i=0):i&&(f.type==="data"||f.type==="tableDelimiterMarker"||f.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&_m(p,t,u,c,h),p.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=WR(t.events,n))}return e}function la(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 p=t.events[n[2]],m=t.events[n[3]];if(p[1].end=Object.assign({},m[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const f=n[2]+1,g=n[3]-n[2]-1;e.add(f,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 _m(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 GR={name:"tasklistCheck",tokenize:YR};function KR(){return{text:{91:GR}}}function YR(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:JR},t,n)(u):n(u)}}function JR(e,t,n){return Ae(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function XR(e){return xv([bR(),IR(),UR(e),VR(),KR()])}const ZR={};function fj(e){const t=this,n=e||ZR,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(XR(n)),l.push(vR()),a.push(jR(n))}const Zh=[fj],ef={table:({node:e,...t})=>s.jsx("div",{className:"table-wrap md-table",children:s.jsx("table",{...t})}),a:({node:e,...t})=>s.jsx("a",{...t,target:"_blank",rel:"noreferrer"})};function Om({children:e,className:t}){return s.jsx("div",{className:t?`md ${t}`:"md",children:s.jsx(zr,{remarkPlugins:Zh,components:ef,children:e})})}function pj({preview:e}){const[t,n]=j.useState("rendered"),[r,...i]=e.fixedPart.split(`
|
|
392
|
+
`);return s.jsxs("div",{style:{display:"grid",gap:8},children:[s.jsx("div",{children:s.jsx(un,{value:t,onChange:n,items:[{id:"rendered",label:"Rendered"},{id:"raw",label:"Raw"}]})}),t==="raw"?s.jsxs("pre",{className:"prompt-preview",children:[e.instructionsPart,`
|
|
393
|
+
|
|
394
|
+
`,e.fixedPart.split(`
|
|
395
|
+
`).map((l,a)=>s.jsxs("span",{className:a===0?"fixed-head":"fixed",children:[l,`
|
|
396
|
+
`]},a))]}):s.jsxs("div",{className:"prompt-rendered",children:[s.jsx(Om,{children:e.instructionsPart}),e.fixedPart&&s.jsxs("div",{className:"prompt-rendered-fixed",children:[s.jsx("div",{className:"prompt-rendered-fixed-head",children:r.replace(/^[-#]+\s*|\s*-+$/g,"")||"Fixed part"}),s.jsx(Om,{children:i.join(`
|
|
397
|
+
`)})]})]})]})}function eL(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 ms({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:Ab.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(ni,{size:14})})}),eL(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(ni,{size:14})})]})]})}function Tl(e=[],t=Vy){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 tf(e,t=[],n=Vy){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},nf=e=>bl(e)?"custom":e,tL={pending:"not started",running:"running",passed:"passed",out:"out of iterations",stopped:"stopped"};function nL({nodes:e,agents:t,selected:n,onSelect:r,waitingRunId:i,finished:l}){const a=u=>{if(u.kind==="agent")return s.jsx(mj,{node:u,label:Pl(u.ref,t),selected:n,onSelect:r,waitingRunId:i??null,finished:l},u.key);const c=u.passes.reduce((d,p)=>d+p,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(as,{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:tL[u.state]})]}),s.jsx("div",{className:"ptl-row",children:u.children.map((d,p)=>o(d,p))}),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 mj({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:nf(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:rL(h,t,d+1),"aria-label":`${t} run ${d+1}: ${h.status}`},h.id))}),a.length===1&&s.jsx("span",{className:"ptl-time",children:br(o.startedAt,o.finishedAt)})]})}function rL(e,t,n){const r=e.usage;return[`${t} #${n}: ${e.status}`,br(e.startedAt,e.finishedAt),e.turns!==null?`${e.turns} turns`:null,e.costUsd!==null?Kt(e.costUsd):null,r?`${sn(r.inputTokens+r.cacheReadTokens+r.cacheWriteTokens)} in / ${sn(r.outputTokens)} out`:null].filter(Boolean).join(" · ")}class Fm extends Error{}const sL=e=>e.ref??e.agent;function iL(e){return e.status==="passed"?!0:e.agent==="explorer"&&e.status==="failed"&&e.output!==null&&e.output!==void 0}function Ns(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)=>Ns(hs(n),`${t}.${r}`))]}}function lL(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(sL(u)!==a)throw new Fm;n++;const c=u.status!=="running"&&u.status!=="pending";return{node:{kind:"run",key:o,run:u},flow:c?iL(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(hs),c=a.endsWhen==="last",h=[],d=p=>({kind:"loop",key:o,step:a,iterations:h,state:p});if(n>=t.length)return{node:Ns(a,o),flow:"open"};for(let p=0;p<a.maxIterations;p++){const m=[];h.push(m);const f=`${o}i${p}`,g=y=>u.slice(y).forEach((x,v)=>m.push(Ns(x,`${f}.${y+v}`)));if(c){for(let y=0;y<u.length;y++){const x=i(u[y],`${f}.${y}`);if(m.push(x.node),x.flow==="open")return g(y+1),{node:d("running"),flow:"open"};if(x.flow==="stop")return{node:d("stopped"),flow:"stop"};const v=y===u.length-1;if(v&&x.flow==="ok")return{node:d("passed"),flow:"ok"};if(!v&&x.flow==="fail")return{node:d("stopped"),flow:"stop"}}if(p<a.maxIterations-1&&n>=t.length)return h.push(u.map((y,x)=>Ns(y,`${o}i${p+1}.${x}`))),{node:d("running"),flow:"open"};continue}const w=i(u[0],`${f}.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(p===a.maxIterations-1)break;for(let y=1;y<u.length;y++){const x=i(u[y],`${f}.${y}`);if(m.push(x.node),x.flow==="open")return g(y+1),{node:d("running"),flow:"open"};if(x.flow!=="ok")return{node:d("stopped"),flow:"stop"}}if(n>=t.length)return h.push([Ns(u[0],`${o}i${p+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(Ns(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 Fm)return null;throw a}}const gj=e=>e.some(t=>t.kind==="run"||t.kind==="loop"&&t.iterations.some(gj));function xj(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(xj(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(gj).length),children:i}}function aL(e){return e.map(t=>xj([t]))}const oL=["Read(.env)","Read(**/.env)","Read(.env.local)","Read(**/.env.local)","WebFetch","WebSearch"];function uL(e,t){const n=zo[e].filter(i=>!co(e)||!Ph.includes(i));let r=0;for(const i of t)i.agent===n[r]&&r++;return n.slice(r)}function cL(e,t){const n=o=>o.ref??o.agent,r=(o,u)=>({kind:"agent",key:u,agent:nf(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(hs(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(Mo([o]));for(;a<t.length&&c.has(n(t[a]));)a++;return}l.push(i(o,`s${u}`))}),l}const co=e=>e==="generate"||e==="heal";function dL(e,t){if(!co(e.type))return{linear:t,loop:[]};const n=t.findIndex(r=>Ph.includes(r.agent));return n<0?{linear:t,loop:[]}:{linear:t.slice(0,n),loop:t.slice(n)}}function Um(e,t){const n=t.filter(i=>i.agent===e.agent&&i.label===e.label),r=Xy(e);return n.length>1?`${r} #${n.indexOf(e)+1}`:r}function hL(){var tt;const e=Number(ai().id),t=ut(),[n]=wh(),r=n.get("result")?Number(n.get("result")):null,{refresh:i}=cn(),{job:l,runs:a,results:o,pipeline:u,pending:c,logs:h,error:d,refetch:p,reconnect:m}=db(e),f=(l==null?void 0:l.status)==="waiting"?c:null,[g,w]=j.useState(null),y=j.useRef(!1),x=j.useRef(!1),[v,b]=j.useState(null);if(j.useEffect(()=>{if(y.current||a.length===0)return;const W=a.find(ge=>ge.status==="running");w((W??a[a.length-1]).id)},[a]),j.useEffect(()=>{if(x.current||!r||o.length===0)return;const W=o.find(ge=>ge.id===r);W!=null&&W.agentRunId&&(y.current=!0,x.current=!0,w(W.agentRunId))},[r,o]),j.useEffect(()=>{f&&(y.current=!0,w(f.runId))},[f==null?void 0:f.runId]),j.useEffect(()=>{l&&Qc.includes(l.status)&&i()},[l==null?void 0:l.status]),!Number.isInteger(e)||e<=0)return s.jsx(Ie,{error:"Invalid job id"});const A=a.find(W=>W.id===g)??null,k=l&&l.type in zo?uL(l.type,a):[],T=l?Qc.includes(l.status):!1,P=(l==null?void 0:l.type)==="pipeline"&&u?lL(u.pipeline.steps,a):null,I=(l==null?void 0:l.type)==="pipeline"&&u&&!P?cL(u,a):[],C=(l==null?void 0:l.args.maxHealRounds)??Ib.maxHealRounds,{linear:L,loop:S}=l?dL(l,a):{linear:a,loop:[]},D=S.filter(W=>W.agent==="healer").length,M=(l==null?void 0:l.type)==="heal"?["healer","validator"]:["validator","healer"],U=S[S.length-1],ie=U?T?U.agent==="validator"&&U.status==="passed"?"passed":D>=C?"out":"stopped":"running":"pending",X=W=>{y.current=!0,w(W)},B=W=>s.jsx(gL,{run:W,label:Um(W,a),selected:g===W.id,waiting:(f==null?void 0:f.runId)===W.id,onSelect:()=>X(W.id)},W.id),Y=(W,ge,Q,de,ve)=>s.jsx(xL,{agent:W,finished:T,note:Q,name:de,description:ve},ge),N=W=>W.kind==="agent"?Y(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(as,{size:14}),s.jsxs("span",{children:["Loop ×",W.maxIterations]})]}),s.jsx("div",{className:"loop-body",children:W.items.map((ge,Q)=>s.jsxs(j.Fragment,{children:[Q>0&&s.jsx("span",{className:"connector"}),N(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})),Q=`${l.args.name??`Test run #${l.id}`} (${W?"failed re-run":"re-run"})`;if(!l.args.selection&&!W){try{const ve=await V.createJob({type:"testrun",name:Q,...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:Q,selection:de,retries:l.args.retries}})},E=o.some(W=>W.status==="failed"||W.status==="flaky"),F=async()=>{b(null);try{await V.rerunFailedJob(e),m()}catch(W){b(W.message)}},J=async()=>{try{const W=await V.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")&&T?[...new Set(o.filter(W=>W.status==="failed"&&W.specFile).map(W=>W.specFile))]:[],Te=async W=>{try{const ge=await V.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(Ie,{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:[Sr[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:kh(e),target:"_blank",rel:"noreferrer",title:"Playwright HTML report (new tab)",children:[s.jsx(Eh,{size:14})," HTML report"]}),l.type==="testrun"&&T&&s.jsxs(s.Fragment,{children:[E&&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(qn,{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(qn,{size:15})," Open spec"]}),s.jsxs("button",{className:"btn",onClick:()=>void J(),title:"QA Explorer → QA Script Generator → QA Validator ⇄ QA Script Healer on the new spec",children:[s.jsx(Io,{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(_y,{size:15})," Heal ",W]},W)),!T&&s.jsxs("button",{className:"btn danger",onClick:()=>void V.cancelJob(e).catch(W=>b(W.message)),children:[s.jsx(Uy,{size:14})," Cancel"]})]})]}),s.jsxs("div",{className:"muted small",style:{marginBottom:14},children:["Started ",Rt(l.startedAt??l.createdAt)," · ",br(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"),co(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]}),(l.type==="pipeline"||l.type==="custom")&&s.jsx(wL,{job:l}),P&&u?s.jsx(nL,{nodes:aL(P),agents:u.agents,selected:g,onSelect:X,waitingRunId:(f==null?void 0:f.runId)??null,finished:T}):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"}),Y(W,`g-${W}-${ge}`)]},`ghost-${W}-${ge}`)),I.map((W,ge)=>s.jsxs(j.Fragment,{children:[(L.length>0||ge>0)&&s.jsx("span",{className:"connector"}),N(W)]},W.key)),co(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 ${ie}`,"aria-label":"Validator and Healer loop",children:[s.jsxs("div",{className:"ptl-loop-head",children:[s.jsx(as,{size:13}),s.jsx("b",{children:"Validate ⇄ Heal loop"}),s.jsxs("span",{className:"muted",children:["· max ",C]}),s.jsxs("span",{className:`ptl-state ${ie}`,title:"Healer rounds used / maximum (Settings)",children:["heal round ",D,"/",C]})]}),s.jsx("div",{className:"ptl-row",children:M.map((W,ge)=>{const Q=S.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(mj,{node:{kind:"agent",key:`loop-${W}`,ref:W,runs:Q},label:Q[0]?Xy(Q[0]):Ne[W].label,selected:g,onSelect:X,waitingRunId:(f==null?void 0:f.runId)??null,finished:T})]},W)})}),s.jsx("div",{className:`ptl-return ${D?"":"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:["↺ ×",D]})})]})]})]}),f&&s.jsx(mL,{jobId:e,label:f.label,questions:f.questions??[],onDone:()=>void p()},`review-${f.runId}`),A?s.jsx(yL,{jobId:e,job:l,run:A,label:Um(A,a),log:h[A.id]??"",results:o.filter(W=>W.agentRunId===A.id),highlightResultId:r,reviewing:(f==null?void 0:f.runId)===A.id},A.id):s.jsx("div",{className:"card pad muted",children:"Waiting for the first agent to start…"})]})]})}const _s=-1,Ta=-2,fL=e=>Object.fromEntries(e.map(t=>[t.id,Math.max(t.options.findIndex(n=>n.recommended),t.options.length?0:_s)]));function Bm(e){var i;const t=e.currentTarget,n=t.scrollTop<=0&&e.deltaY<0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1&&e.deltaY>0;(n||r)&&((i=t.closest(".content"))==null||i.scrollBy({top:e.deltaY}))}const aa=10;function pL({questions:e,start:t=1,choice:n,other:r,onChoice:i,onOther:l}){return s.jsx("ol",{className:"question-list",start:t,children:e.map(a=>s.jsx("li",{className:"question",children:s.jsxs("fieldset",{children:[s.jsx("legend",{children:a.question}),a.options.map((o,u)=>s.jsxs("label",{className:`question-option ${n[a.id]===u?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${a.id}`,checked:n[a.id]===u,onChange:()=>i(a.id,u)}),s.jsxs("span",{children:[s.jsx("b",{children:o.label}),o.recommended&&s.jsx("span",{className:"chip ok small",children:"Recommended"}),o.description&&s.jsx("span",{className:"muted small question-desc",children:o.description})]})]},u)),s.jsxs("label",{className:`question-option ${n[a.id]===Ta?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${a.id}`,checked:n[a.id]===Ta,onChange:()=>i(a.id,Ta)}),s.jsxs("span",{children:[s.jsx("b",{children:"Let the agent decide"}),s.jsx("span",{className:"muted small question-desc",children:"No answer: the agent follows your comment, or takes its recommended option and records it as an assumption."})]})]}),s.jsxs("label",{className:`question-option ${n[a.id]===_s?"on":""}`,children:[s.jsx("input",{type:"radio",name:`q-${a.id}`,checked:n[a.id]===_s,onChange:()=>i(a.id,_s)}),s.jsxs("span",{className:"question-other",children:[s.jsx("b",{children:"Other"}),s.jsx("input",{className:"input",maxLength:Mb,placeholder:"Type your answer",value:r[a.id]??"",onFocus:()=>i(a.id,_s),onChange:o=>l(a.id,o.target.value),"aria-label":`Other answer to: ${a.question}`})]})]})]})},a.id))})}function mL({jobId:e,label:t,questions:n,onDone:r}){const i=In(),[l,a]=j.useState(()=>fL(n)),[o,u]=j.useState({}),c=n.length>0,h=n.map(M=>{var U;return{id:M.id,answer:l[M.id]===_s?(o[M.id]??"").trim():l[M.id]===Ta?"":((U=M.options[l[M.id]])==null?void 0:U.label)??""}}),d=h.filter(M=>!M.answer).length,[p,m]=j.useState(""),f=p.trim(),g=d>0&&!f,[w,y]=j.useState(!1),[x,v]=j.useState(null),b=Math.max(1,Math.ceil(n.length/aa)),[A,k]=j.useState(0),T=j.useRef(null),P=A*aa,I=n.slice(P,P+aa),C=A===b-1,L=[...new Set(h.flatMap((M,U)=>M.answer?[]:[Math.floor(U/aa)+1]))],S=M=>{var U;k(M),(U=T.current)==null||U.scrollIntoView({block:"start",behavior:"smooth"})},D=async M=>{y(!0);try{await M(),r()}catch(U){v(U.message)}finally{y(!1)}};return s.jsxs("div",{className:"review-panel",role:"region","aria-label":"Review",ref:T,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, type your own answer or let the agent decide. Send answers runs ${t} again (it may ask more). Answer & approve runs it once more to finalise with your answers and comment, then the pipeline goes on. Reject ends the pipeline.`:`Approve to continue the pipeline with this result. With a comment, ${t} runs once more to apply it, then the pipeline goes on. Reject ends the pipeline.`}),c&&b>1&&s.jsxs("span",{className:"muted small","aria-live":"polite",children:["Questions ",P+1,"–",P+I.length," of ",n.length," · page ",A+1," of ",b]}),c&&s.jsx(pL,{questions:I,start:P+1,choice:l,other:o,onChoice:(M,U)=>a(ie=>({...ie,[M]:U})),onOther:(M,U)=>u(ie=>({...ie,[M]:U}))}),s.jsxs("label",{className:"review-comment",children:[s.jsxs("span",{className:"small",children:["Comment for ",t," (optional)"]}),s.jsx("textarea",{className:"input",rows:3,maxLength:$b,placeholder:c?'e.g. "Assume the remaining questions with your recommended option" or "Also cover the expired-link case". Sent with your answers; saved as the reason if you reject.':'e.g. "Rename BR-03 and add an error AC to US-02". Sent with Approve; saved as the reason if you reject.',value:p,onChange:M=>m(M.target.value)})]}),s.jsx(Ie,{error:x}),s.jsxs("div",{className:"review-actions",children:[s.jsx("button",{className:"btn danger",disabled:w,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 D(()=>V.rejectJob(e,f.slice(0,Lb)||void 0))},children:"Reject"}),s.jsx("span",{className:"review-actions-spacer"}),c&&g&&s.jsxs("span",{className:"muted small",children:["Unanswered on page ",L.join(", "),": answer them, or add a comment saying how to handle them"]}),c&&b>1&&s.jsx("button",{className:"btn ghost",disabled:w||A===0,onClick:()=>S(A-1),children:"Prev"}),c&&!C?s.jsx("button",{className:"btn",disabled:w,onClick:()=>S(A+1),children:"Next"}):c?s.jsx("button",{className:"btn ghost",disabled:w||g,title:g?"Answer every question, or add a comment saying how to handle the rest":`Runs ${t} again with your answers; it may ask more questions`,onClick:()=>void D(()=>V.answerJob(e,h,{comment:f})),children:"Send answers"}):null,c?s.jsx("button",{className:"btn",disabled:w,title:`Runs ${t} once more to finalise with your answers and comment (unanswered questions are left to it), then the pipeline goes on`,onClick:()=>void D(()=>V.answerJob(e,h,{comment:f,approve:!0})),children:"Answer & approve"}):s.jsx("button",{className:"btn",disabled:w,title:f?`Runs ${t} once more to apply your comment, then the pipeline goes on`:"Continue the pipeline with this result",onClick:()=>void D(()=>V.approveJob(e,f||void 0)),children:f?"Approve with comment":"Approve"})]})]})}function gL({run:e,label:t,selected:n,waiting:r,onSelect:i}){const l=e.usage,a=r?"waiting":e.status,o=[`${t}: ${a}`,br(e.startedAt,e.finishedAt),e.turns!==null?`${e.turns} turns`:null,e.costUsd!==null?Kt(e.costUsd):null,l?`${sn(l.inputTokens+l.cacheReadTokens+l.cacheWriteTokens)} in / ${sn(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:br(e.startedAt,e.finishedAt)})]})}function xL({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 yL({jobId:e,job:t,run:n,label:r,log:i,results:l,highlightResultId:a,reviewing:o}){const u=!!a&&l.some(y=>y.id===a),[c,h]=j.useState(u||o?"output":"log");j.useEffect(()=>{o&&h("output")},[o]);const[d,p]=j.useState(null),m=j.useRef(null),f=j.useRef(!0),g=!["running","pending"].includes(n.status);j.useEffect(()=>{g&&V.agentRun(e,n.id).then(p).catch(()=>{})},[e,n.id,g]),j.useEffect(()=>{const y=m.current;y&&f.current&&(y.scrollTop=y.scrollHeight)},[i,c]),NL(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(un,{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 ",sn(n.usage.inputTokens)," · output ",sn(n.usage.outputTokens)," · cache read"," ",sn(n.usage.cacheReadTokens)," · cache write ",sn(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:y=>{const x=y.currentTarget;f.current=x.scrollHeight-x.scrollTop-x.clientHeight<40},children:w?s.jsx(vL,{text:w}):n.status==="running"?"Waiting for output…":"(empty)"}),c==="output"&&s.jsx(kL,{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(y=>s.jsx("code",{children:y},y))}),s.jsx("h4",{children:"Explicitly denied"}),s.jsx("div",{className:"perm",children:oL.map(y=>s.jsx("code",{className:"deny",children:y},y))})]}):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 vL({text:e}){const t=j.useMemo(()=>e.split(`
|
|
398
|
+
`),[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,`
|
|
399
|
+
`]},r)})})}function oa({before:e,after:t}){const n=j.useMemo(()=>Tb(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 jL({results:e,highlightId:t}){const n=tf(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(ms,{...n.props,label:"results"})]})}function Hm({jobId:e}){const[t,n]=j.useState(null);return j.useEffect(()=>{V.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 wL({job:e}){const t=e.target.endsWith(".md")?e.target:null,[n,r]=j.useState(void 0),[i,l]=j.useState(void 0);j.useEffect(()=>{V.jobInput(e.id).then(o=>{var u;return r(((u=o.input)==null?void 0:u.trim())||null)}).catch(()=>r(null))},[e.id]);const a=()=>{t&&i===void 0&&V.spec(t).then(o=>l(o.content)).catch(()=>l(null))};return n===void 0||!t&&!n?null:s.jsxs("div",{className:"card job-input",children:[t&&s.jsxs("details",{onToggle:o=>o.currentTarget.open&&a(),children:[s.jsxs("summary",{children:[s.jsx(qn,{size:14})," ",s.jsx("b",{children:"Spec"})," ",s.jsx(ye,{to:`/specs/${t}`,onClick:o=>o.stopPropagation(),children:t})]}),s.jsxs("div",{className:"job-input-body",onWheel:Bm,children:[s.jsx("p",{className:"muted small",children:"Current version of the file: it may have changed since this job started."}),i===void 0?s.jsx("p",{className:"muted",children:"Loading spec…"}):i===null?s.jsx("p",{className:"muted",children:"Spec not found (renamed or deleted)."}):s.jsx("div",{className:"md",children:s.jsx(zr,{remarkPlugins:Zh,components:ef,children:i.replace(/<!--[\s\S]*?-->/g,"")})})]})]}),n&&s.jsxs("details",{open:!t,children:[s.jsxs("summary",{children:[s.jsx(Io,{size:14})," ",s.jsx("b",{children:"Prompt"})," ",s.jsxs("span",{className:"muted small",children:["(",n.length.toLocaleString()," characters)"]})]}),s.jsx("div",{className:"job-input-body",onWheel:Bm,children:s.jsx("pre",{className:"mono job-input-prompt",children:n})})]})]})}function kL({jobId:e,run:t,full:n,results:r,highlightResultId:i}){var a,o,u,c,h,d,p,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 f=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:f.status==="passed"?"passed":"failed"})," ",f.summary]}),s.jsx("div",{className:"md",children:s.jsx(zr,{remarkPlugins:Zh,components:ef,children:f.details})}),!!((a=f.questions)!=null&&a.length)&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Questions asked"}),s.jsx("ol",{children:f.questions.map(g=>s.jsxs("li",{children:[g.question,s.jsx("ul",{children:g.options.map((w,y)=>s.jsxs("li",{children:[w.label,w.recommended?" (recommended)":"",w.description?s.jsxs("span",{className:"muted",children:[" · ",w.description]}):null]},y))})]},g.id))})]}),!!f.reviewComment&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Your comment"}),s.jsx("p",{className:"pre-wrap",children:f.reviewComment})]}),!!((o=f.answered)!=null&&o.length)&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Your answers"}),s.jsx("ol",{children:f.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 f=t.output;return s.jsxs("div",{children:[f&&s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:f.passed?"passed":"failed"}),Object.entries(f.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:f.command}),f.htmlReport&&s.jsxs("a",{href:kh(t.jobId),target:"_blank",rel:"noreferrer",children:[s.jsx(Eh,{size:13})," Open HTML report"]})]}),!f&&s.jsx("p",{className:"muted",children:"No report."}),r.length>0&&s.jsx(jL,{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(Hm,{jobId:e})]});if(t.agent==="contextwriter"){const f=t.output,g=(w,y)=>y!=null&&y.length?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:s.jsx("ul",{style:{margin:0,paddingLeft:18},children:y.map((x,v)=>s.jsx("li",{children:x},v))})})]}):null;return s.jsxs("div",{children:[s.jsx("p",{children:f.summary}),s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[g("Added / updated",f.added),g("Removed (old project)",f.removed),g("Notes added",f.notes),g("Security issues (notes not applied)",Array.isArray(f.security)?f.security.map(w=>typeof w=="string"?w:`"${w.note}" (${w.reason})`):void 0),g("Check these",f.warnings),f.failure?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Failed because"}),s.jsx("dd",{children:f.failure})]}):null]}),n?s.jsx(oa,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}if(t.agent==="specwriter"){const f=t.output,g=(w,y)=>y!=null&&y.length?s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:w}),s.jsx("dd",{children:s.jsx("ul",{style:{margin:0,paddingLeft:18},children:y.map((x,v)=>s.jsx("li",{children:x},v))})})]}):null;return s.jsxs("div",{children:[s.jsx("p",{children:f.summary}),s.jsxs("dl",{className:"kv",style:{marginBottom:12},children:[s.jsx("dt",{children:"Spec"}),s.jsx("dd",{children:s.jsx(ye,{to:`/specs/${f.specFile}`,children:s.jsxs("code",{children:["specs/",f.specFile]})})}),s.jsx("dt",{children:"Test cases"}),s.jsx("dd",{children:(u=f.tcIds)==null?void 0:u.map(w=>s.jsx("code",{style:{marginRight:6},children:w},w))}),g("Assumptions",f.assumptions),g("Questions for the BA",f.questions)]}),n?s.jsx(oa,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading spec…"}),s.jsx(Hm,{jobId:e})]})}if(t.agent==="explorer"){const f=t.output;return s.jsxs("div",{children:[s.jsxs("p",{className:"row",children:[s.jsx(yt,{status:f.status})," ",f.summary]}),((c=f.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=f.environment.issues)!=null&&h.length?f.environment.issues:["no details"]).map((g,w)=>s.jsx("li",{children:g},w))})]}),((d=f.environment)==null?void 0:d.ready)!==!1&&f.cases.some(g=>g.status==="failed")&&s.jsxs("p",{className:"muted small",children:["Failed cases: ",f.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:f.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))})]})}),f.assertions.length>0&&s.jsxs("details",{style:{marginTop:12},children:[s.jsxs("summary",{children:["Verified assertions (",f.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:f.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))})]})})]}),f.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:f.bugs.map((g,w)=>s.jsx("li",{children:g},w))})]})]})}if(t.agent==="generator"){const f=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:f.testFile})}),s.jsx("dt",{children:"Test case"}),s.jsx("dd",{children:(p=f.tcIds)==null?void 0:p.map(g=>s.jsx("code",{style:{marginRight:6},children:g},g))}),f.pomChanges&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Page Object"}),s.jsx("dd",{children:f.pomChanges})]}),f.notes&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Notes"}),s.jsx("dd",{children:f.notes})]})]}),n?s.jsx(oa,{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((f,g)=>s.jsx("li",{children:f},g))}),n?s.jsx(oa,{before:n.fileBefore,after:n.fileAfter}):s.jsx("p",{className:"muted",children:"Loading diff…"})]})}const bL=32,SL=240;function NL(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(SL,Math.floor(c-bL))}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 CL=["all","mapped","missing","stale","orphan"],Bu=e=>e.charAt(0).toUpperCase()+e.slice(1);function EL(){const e=ut(),{specs:t,refresh:n}=cn(),[r,i]=j.useState("all"),[l,a]=j.useState(""),[o,u]=j.useState(null),c=Tl([r,l]),{data:h,error:d,reload:p}=Oe(()=>V.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)??[],f=async g=>{try{const w=await V.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(un,{value:r,onChange:i,items:CL.map(g=>({id:g,label:s.jsxs(s.Fragment,{children:[g==="all"?"All":Bu(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(),p()},children:[s.jsx(Jn,{size:14})," Refresh"]})]}),s.jsx(Ie,{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:Bu(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:Bu(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 f({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(ms,{page:c.page,pageSize:c.pageSize,total:h.total,onPage:c.setPage,onPageSize:c.setPageSize,label:"test cases"})]})]})}const ua=(e,t)=>t?Math.round(e/t*100):0;function TL(){const e=ut(),{openNewSpec:t}=fs(),{specs:n,refresh:r}=cn(),i=Oe(()=>V.dashboard()),l=Oe(()=>V.jobs()),[a,o]=j.useState(null),u=i.data,c=n.reduce((f,g)=>f+g.parsed.tcs.length,0),h=l.data??[],d=h[0],p=(u==null?void 0:u.failing)??[],m=()=>void V.createJob({type:"testrun",repeatEach:1}).then(f=>{r(),e(`/runs/${f.id}`)}).catch(f=>o(f.message));return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Overview"}]}),s.jsx(Ie,{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(bh,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[ua((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:`${ua((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(Nh,{size:16})})]}),s.jsxs("div",{className:"stat-value",children:[ua((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:`${ua((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(qn,{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(f=>s.jsxs("tr",{onClick:()=>e(`/runs/${f.id}`),style:{cursor:"pointer"},children:[s.jsxs("td",{className:"mono",children:["#",f.id]}),s.jsxs("td",{children:[f.target,f.args.tcId?s.jsxs("span",{className:"muted small",children:[" · ",f.args.tcId]}):null]}),s.jsx("td",{children:s.jsx(ri,{status:f.status,title:f.summary??void 0,children:f.summary&&f.summary.length<=24?f.summary:f.status})}),s.jsx("td",{className:"num muted",children:br(f.startedAt,f.finishedAt)})]},f.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((f,g)=>s.jsxs("li",{title:Ne[f].description,children:[s.jsx("span",{className:"step-num",children:g+1}),Ne[f].label,f==="healer"&&s.jsx("span",{className:"muted small accent-soft-text",children:"≤ 2 loops"})]},f))})]})]}),p.length>0&&s.jsxs("div",{className:"card",style:{marginTop:18},children:[s.jsx("div",{className:"card-head",children:s.jsxs("h3",{children:["Failing tests (",p.length,")"]})}),s.jsx("table",{className:"flat",children:s.jsx("tbody",{children:p.map(f=>s.jsxs("tr",{onClick:()=>e(`/runs/${f.jobId}${f.id?`?result=${f.id}`:""}`),style:{cursor:"pointer"},title:"Open this failed test in Recent runs",children:[s.jsxs("td",{children:[s.jsx("div",{children:f.title}),s.jsx("div",{className:"mono small",style:{color:"var(--fail)"},children:(f.error??"").split(`
|
|
400
|
+
`)[0].slice(0,160)})]}),s.jsx("td",{className:"num",children:s.jsxs(ye,{to:`/runs/${f.jobId}${f.id?`?result=${f.id}`:""}`,onClick:g=>g.stopPropagation(),children:["#",f.jobId]})})]},`${f.jobId}-${f.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(f=>s.jsxs(ye,{to:`/specs/${f.file}`,className:"glance-row",children:[s.jsx("span",{className:"file-icon muted-icon",children:s.jsx(qn,{size:16})}),s.jsxs("div",{className:"grow",children:[s.jsx("div",{className:"mono strong",children:f.file}),s.jsx("div",{className:"muted small",children:f.title||"—"})]}),s.jsxs("span",{className:"muted small",children:[f.tcCount," test cases"]}),s.jsxs("span",{className:`chip ${f.mappedCount<f.tcCount?"warn":""}`,children:[f.mappedCount,"/",f.tcCount," mapped"]})]},f.file)),u&&u.specs.length===0&&s.jsx("p",{className:"muted pad",children:"No specs yet."})]})]})]})}function Wm({value:e,mode:t}){const[n,r]=j.useState({...e}),i=(a,o)=>{e[a]=o,r({...e})},l=t==="export"?[{key:"jobs",title:"Jobs",hint:"Agent logs, test results, Claude usage and HTML reports. Can make the zip large."},{key:"chats",title:"Chat history",hint:"Chat messages and uploaded files."}]:[{key:"jobs",title:"Jobs",hint:"Replaces the current job history with the one in the zip."},{key:"chats",title:"Chat history",hint:"Adds the chats in the zip; a chat with the same id is replaced."}];return s.jsxs("fieldset",{className:"transfer-options",children:[s.jsx("legend",{children:t==="export"?"Also include":"Also import (if the zip has it)"}),l.map(a=>s.jsxs("label",{className:`transfer-option${n[a.key]?" on":""}`,children:[s.jsx("input",{type:"checkbox",className:"check-box",checked:n[a.key],onChange:o=>i(a.key,o.target.checked)}),s.jsxs("span",{className:"transfer-option-text",children:[s.jsx("span",{className:"transfer-option-title",children:a.title}),s.jsx("span",{className:"transfer-option-hint",children:a.hint})]})]},a.key))]})}function PL({onImported:e}){const t=Ir(),n=In(),r=eS(),i=j.useRef(null),[l,a]=j.useState(!1),o=async h=>{a(!0);try{await r(h())}catch(d){t.error(d.message)}finally{a(!1)}},u=async()=>{const h={jobs:!1,chats:!1};await n({title:"Export project",message:s.jsxs(s.Fragment,{children:["Specs, tests, Playwright config, CLAUDE.md, Claude skills, settings, agents and pipelines are exported as a zip. Saved browser logins are never included.",s.jsx(Wm,{value:h,mode:"export"})]}),confirmLabel:"Export"})&&await o(async()=>{const p=URL.createObjectURL(await V.exportProject(h)),m=document.createElement("a");m.href=p,m.download=`agent-studio-export-${new Date().toISOString().slice(0,10)}.zip`,m.click(),URL.revokeObjectURL(p);const f=[h.jobs&&"jobs",h.chats&&"chats"].filter(Boolean).join(" and ");t.success(f?`Project exported with ${f}`:"Project exported")})},c=async h=>{const d={jobs:!1,chats:!1};await n({title:`Import ${h.name}?`,message:s.jsxs(s.Fragment,{children:["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 unless ticked below.",s.jsx(Wm,{value:d,mode:"import"})]}),confirmLabel:"Import",danger:!0})&&await o(async()=>{const m=await new Promise((y,x)=>{const v=new FileReader;v.onload=()=>y(String(v.result)),v.onerror=()=>x(v.error),v.readAsDataURL(h)}),f=await V.importProject(m.slice(m.indexOf(",")+1),d);ub(),e==null||e();const g=[`${f.files} files`,`${f.agents} custom agents`,`${f.pipelines} custom pipelines`,`${f.instructions} built-in agent instructions`];f.jobs!==null&&g.push(`${f.jobs} jobs`),f.chats!==null&&g.push(`${f.chats} chats`);const w=[d.jobs&&f.jobs===null&&"jobs",d.chats&&f.chats===null&&"chats"].filter(Boolean).join(" or ");t.success(`Imported ${g.slice(0,-1).join(", ")} and ${g[g.length-1]}${w?` (the zip has no ${w})`:""}`)})};return s.jsxs("span",{className:"row",children:[s.jsxs("button",{type:"button",className:"btn",onClick:()=>{var h;return(h=i.current)==null?void 0:h.click()},disabled:l,title:"Import a project zip exported from Agent Studio",children:[s.jsx(Do,{size:15})," Import"]}),s.jsxs("button",{type:"button",className:"btn",onClick:()=>void u(),disabled:l,title:"Export specs, tests, Playwright config, CLAUDE.md, Claude skills, settings, agents and pipelines (optionally jobs and chats) as a zip",children:[s.jsx(ds,{size:15})," Export"]}),s.jsx("input",{ref:i,type:"file",accept:".zip",hidden:!0,onChange:h=>{var p;const d=(p=h.target.files)==null?void 0:p[0];h.target.value="",d&&c(d)}})]})}async function yj(){const e=await V.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 RL(){var v,b,A,k;const e=ut(),t=In(),n=Ir(),r=Oe(()=>V.claudeMd()),i=Oe(()=>V.jobsPage({page:1,pageSize:1,type:"context"})),[l,a]=j.useState(""),[o,u]=j.useState("rendered"),[c,h]=j.useState(!1),[d,p]=j.useState(null),m=(v=i.data)==null?void 0:v.items[0],f=j.useRef(null),[g,w]=j.useState(null),y=async T=>{if(!T)return;if(!/\.md$/i.test(T.name))return p("Choose a Markdown (.md) file.");const P=await T.text();if(!await t({title:"Replace CLAUDE.md?",message:`CLAUDE.md is replaced with ${T.name}. The current file is backed up first.`,confirmLabel:"Replace",danger:!0})){f.current&&(f.current.value="");return}try{const C=await V.uploadClaudeMd(P);n.success("CLAUDE.md replaced"),w(`CLAUDE.md replaced with ${T.name}.${C.backup?` Previous version backed up to ${C.backup}.`:""}`),p(null),r.reload()}catch(C){p(C.message)}finally{f.current&&(f.current.value="")}},x=async T=>{T.preventDefault(),h(!0);try{const P=await V.createJob({type:"context",...l.trim()?{notes:l.trim()}:{}});e(`/runs/${P.id}`)}catch(P){p(P.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.jsxs("span",{className:"row",children:[s.jsx(PL,{onImported:r.reload}),s.jsxs(ye,{className:"btn danger",to:"/project/reset",title:"Remove this project's specs, tests, results and context; you choose what and see the list first",children:[s.jsx(Ar,{size:14})," Reset"]})]})]}),s.jsxs("div",{className:"overview-grid project-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 yj(),disabled:!((A=r.data)!=null&&A.content),children:"Download"}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>{var T;return(T=f.current)==null?void 0:T.click()},title:"Replace CLAUDE.md with a file, e.g. this project's saved context",children:[s.jsx(Do,{size:13})," Upload"]}),s.jsx("input",{ref:f,type:"file",accept:".md,text/markdown",hidden:!0,onChange:T=>{var P;return void y((P=T.target.files)==null?void 0:P[0])}}),s.jsx(un,{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(Ie,{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(zr,{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 project-writer",onSubmit:x,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:120},value:l,onChange:T=>a(T.target.value),placeholder:"e.g. <App name>: customer portal. Roles: admin, customer. Login with email + password. Test ids use data-testid."})]}),s.jsx(Ie,{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(Ch,{size:15})," ",c?"Starting…":"Update CLAUDE.md"]})]})]})]})]})}const Vm=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function LL({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 AL(){const{refresh:e}=cn(),[t,n]=j.useState(null),[r,i]=j.useState(new Set),[l,a]=j.useState(""),[o,u]=j.useState(!0),[c,h]=j.useState(!1),[d,p]=j.useState(null),[m,f]=j.useState(null),g=async()=>{try{const T=await V.resetPlan();n(T),i(P=>P.size?P:new Set(T.categories.filter(I=>I.defaultOn).map(I=>I.id))),p(null)}catch(T){p(T.message)}};j.useEffect(()=>{g()},[]);const w=T=>i(P=>{const I=new Set(P);return I.has(T)?I.delete(T):I.add(T),I}),y=async()=>{if(t){h(!0);try{const T=await V.resetProject({categories:[...r],confirm:l,backup:o});f(T),a(""),e(),await g()}catch(T){p(T.message)}finally{h(!1)}}},x=T=>i(new Set(T&&t?t.categories.map(P=>P.id):[])),v=(t==null?void 0:t.categories.filter(T=>r.has(T.id)))??[],b=v.reduce((T,P)=>T+(P.id==="prompts"?0:P.fileCount),0),A=v.reduce((T,P)=>T+(P.bytes??0),0),k=t&&l===t.confirmWord&&r.size>0&&!t.busy&&!c;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."]})]})}),m&&s.jsxs("div",{className:"ok-box",children:[s.jsx("b",{children:"Project reset."})," ",Object.entries(m.removed).map(([T,P])=>{var I;return`${((I=t==null?void 0:t.categories.find(C=>C.id===T))==null?void 0:I.label)??T}: ${P}`}).join(" · "),m.backupDir&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),"Backup of the removed files (specs, tests, CLAUDE.md, chat history…): ",s.jsx("code",{children:m.backupDir})]}),!m.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.",m.mentions.length>0&&s.jsx("div",{style:{marginTop:8},children:s.jsx(LL,{mentions:m.mentions,title:"Still mentioned"})})]}),s.jsx(Ie,{error:d}),(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 rt-grid",children:[s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsxs("h3",{children:["What to reset"," ",s.jsxs("span",{className:"muted small",style:{fontWeight:400},children:["· ",r.size," of ",t.categories.length," selected"]})]}),s.jsxs("span",{className:"row",children:[s.jsx("button",{className:"btn ghost sm",onClick:()=>x(r.size<t.categories.length),children:r.size<t.categories.length?"Select all":"Select none"}),s.jsxs("button",{className:"btn ghost sm",onClick:()=>void g(),children:[s.jsx(Jn,{size:13})," Refresh"]})]})]}),t.categories.map(T=>s.jsxs("label",{className:`rt-cat ${r.has(T.id)?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:r.has(T.id),onChange:()=>w(T.id)}),s.jsxs("span",{className:"grow",children:[s.jsxs("span",{className:"rt-cat-head",children:[s.jsx("b",{children:T.label}),s.jsxs("span",{className:"muted small",children:[T.fileCount," ",T.id==="prompts"?"custom":`file${T.fileCount===1?"":"s"}`,T.bytes?` · ${Vm(T.bytes)}`:""]}),s.jsx("span",{className:`rt-tag ${T.backedUp&&o?"":"gone"}`,children:T.backedUp&&o?"backed up":"deleted for good"})]}),s.jsx("span",{className:"muted small",children:T.description}),T.note&&s.jsx("span",{className:"small",children:T.note}),T.files.length>0&&s.jsxs("details",{className:"rt-files",children:[s.jsx("summary",{className:"small",children:"Show files"}),T.files.map(P=>s.jsx("code",{children:P},P)),T.fileCount>T.files.length&&s.jsxs("span",{className:"muted small",children:["…and ",T.fileCount-T.files.length," more"]})]})]})]},T.id))]}),s.jsxs("div",{className:"card pad danger-zone rt-panel",children:[s.jsx("h3",{className:"card-title",children:"Reset"}),s.jsxs("div",{className:"rt-summary small",children:[s.jsx("b",{children:r.size})," item",r.size===1?"":"s"," · ",s.jsx("b",{children:b})," file",b===1?"":"s",A?s.jsxs(s.Fragment,{children:[" · ",Vm(A)]}):null]}),s.jsxs("label",{className:"small row",style:{gap:8,alignItems:"center"},children:[s.jsx("input",{type:"checkbox",checked:o,onChange:T=>u(T.target.checked)}),s.jsx("b",{children:"Backup data"})]}),!o&&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("p",{className:"muted small",style:{margin:0},children:["Keep this project's context? ",s.jsx("button",{className:"link-btn",onClick:()=>void yj(),children:"Download CLAUDE.md"})," first and upload it again later on the Project page."]}),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:l,onChange:T=>a(T.target.value),"aria-label":"Confirmation word",autoComplete:"off"})]}),s.jsxs("button",{className:"btn danger-solid",disabled:!k,onClick:()=>void y(),children:[s.jsx(Ar,{size:14})," ",c?"Resetting…":`Reset ${r.size} item${r.size===1?"":"s"}`]})]})]})]})}const IL=/^[a-z0-9][a-z0-9_-]*$/;function DL(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 zL(){const e=ut(),{specs:t}=cn(),[n,r]=j.useState(""),[i,l]=j.useState(""),[a,o]=j.useState(!1),[u,c]=j.useState(!1),[h,d]=j.useState(null),p=j.useRef(null),m=n.trim().replace(/\.md$/,""),f=`${m}.md`,g=t.some(v=>v.file===f),w=i.length>Su,y=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(DL(v.name)),d(null)}},x=async v=>{if(v.preventDefault(),!IL.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 ${Su.toLocaleString()} characters.`);if(g&&!a)return d(`specs/${f} already exists. Choose another name or tick "Overwrite".`);c(!0);try{const b=await V.createJob({type:"spec",spec:f,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:x,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/",f]})," 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=p.current)==null?void 0:v.click()},children:[s.jsx(Do,{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>.
|
|
401
|
+
|
|
402
|
+
Business rules:
|
|
403
|
+
- <rule, limits, ranges>
|
|
404
|
+
|
|
405
|
+
Acceptance criteria:
|
|
406
|
+
- Given ... when ... then ...
|
|
407
|
+
- ...`,"aria-label":"Requirement text"}),s.jsxs("span",{className:`small ${w?"":"muted"}`,style:{fontWeight:400,color:w?"var(--fail)":void 0},children:[i.length.toLocaleString()," / ",Su.toLocaleString()," characters"]})]}),s.jsx("input",{ref:p,type:"file",accept:".md,.txt,text/markdown,text/plain",hidden:!0,onChange:v=>{var b;return void y((b=v.target.files)==null?void 0:b[0])}}),s.jsx(Ie,{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 ML(){const e=ut(),[t,n]=j.useState("all"),r=Tl([t]),{data:i,error:l,reload:a}=Oe(()=>V.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(un,{value:t,onChange:n,items:["all","testrun","generate","explore","heal","spec","context"].map(d=>({id:d,label:d==="all"?"All":Sr[d]}))}),s.jsx("div",{className:"row",children:s.jsxs("button",{className:"btn dark",onClick:()=>void V.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(Ie,{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," ",Sr[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(Yb,{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:br(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(ms,{page:r.page,pageSize:r.pageSize,total:i.total,onPage:r.setPage,onPageSize:r.setPageSize,label:"jobs"})]})]})}function Qm(e){return e.replace(/\.md$/i,"").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|-+$/g,"")||"spec"}function $L(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 _L(){const e=ut(),{openNewSpec:t}=fs(),{specs:n,mapping:r,refresh:i}=cn(),[l,a]=j.useState("all"),[o,u]=j.useState(""),[c,h]=j.useState(new Set),[d,p]=j.useState(!1),[m,f]=j.useState(null),g=j.useRef(null),w=j.useMemo(()=>n.map(L=>{const S=r.filter(M=>M.specFile===L.file&&M.status!=="orphan"),D=new Set(S.filter(M=>M.testFile).map(M=>M.tcId)).size;return{spec:L,mapped:D,total:L.parsed.tcs.length,last:$L(S)}}),[n,r]),y=L=>L.total>0&&L.mapped>=L.total,x=[...new Set(n.flatMap(L=>L.parsed.tags))].sort(),v=o.trim().toLowerCase(),b=w.filter(L=>(l==="all"||(l==="mapped"?y(L):!y(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(S=>c.has(S)))),A=tf(b,[l,o,c]),k=w.reduce((L,S)=>L+S.total,0),T=w.reduce((L,S)=>L+Math.max(S.total-S.mapped,0),0),P=async L=>{const S=L.filter(M=>/\.md$/i.test(M.name));if(!S.length)return f("Only .md files are accepted");if(S.length===1){t({name:Qm(S[0].name),content:await S[0].text()});return}const D=[];for(const M of S)try{await V.createSpec(`${Qm(M.name)}.md`,await M.text())}catch(U){D.push(`${M.name}: ${U.message}`)}i(),f(D.length?D.join(`
|
|
408
|
+
`):null)},I=L=>{P([...L.target.files??[]]),L.target.value=""},C=L=>void V.createJob({type:"testrun",spec:L,repeatEach:1}).then(S=>e(`/runs/${S.id}`)).catch(S=>f(S.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(Do,{size:15})," Import .md"]}),s.jsx("input",{ref:g,type:"file",accept:".md,text/markdown",multiple:!0,hidden:!0,onChange:I}),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(Ie,{error:m}),s.jsxs("div",{className:"toolbar",children:[s.jsx(un,{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(y).length})]})},{id:"needs",label:s.jsxs(s.Fragment,{children:["Needs mapping ",s.jsx("span",{className:"tab-count",children:w.filter(L=>!y(L)).length})]})}]}),s.jsx("div",{className:"grow"}),s.jsxs("label",{className:"search-input",children:[s.jsx(Ao,{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:()=>p(L=>!L),"aria-expanded":d,children:[s.jsx(kb,{size:15})," Tags",c.size?` (${c.size})`:""]}),d&&s.jsxs("div",{className:"menu",onMouseLeave:()=>p(!1),children:[x.length===0&&s.jsx("div",{className:"muted small pad-sm",children:"No tags yet"}),x.map(L=>s.jsxs("label",{className:"menu-item",children:[s.jsx("input",{type:"checkbox",className:"check-box",checked:c.has(L),onChange:()=>h(S=>{const D=new Set(S);return D.has(L)?D.delete(L):D.add(L),D})}),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:A.pageItems.map(({spec:L,mapped:S,total:D,last:M})=>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(qn,{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(U=>s.jsx("span",{className:"tag",children:U},U))}),s.jsx("td",{className:"num",children:D}),s.jsx("td",{children:s.jsxs("div",{className:"cov",children:[s.jsx("span",{className:"progress",children:s.jsx("i",{style:{width:`${D?S/D*100:0}%`}})}),s.jsxs("span",{className:"small",children:[S,"/",D]})]})}),s.jsx("td",{children:M?s.jsx(ri,{status:M.status,children:M.label}):s.jsx(ri,{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:S===0,title:S?`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(ms,{...A.props,label:"specs"}),s.jsxs("div",{className:"table-foot",children:[s.jsxs("span",{children:[w.length," specs · ",k," test cases"]}),s.jsx("span",{children:T?`${T} test cases need mapping`:"All test cases mapped"})]})]})]})}function OL({value:e,onChange:t}){const n=j.useRef(null),r=e.split(`
|
|
409
|
+
`).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 vj=/^(given|when|then|and|but)\b[: ]?\s*(.*)$/i,FL=/^\s*(tags|technique)\s*:/i;function UL(e){let t="given";return e.map(n=>{const r=n.trim().match(vj),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 BL({text:e}){return s.jsx(zr,{components:{p:({children:t})=>s.jsx(s.Fragment,{children:t})},children:e})}function HL({lines:e}){return s.jsx("ol",{className:"gherkin-steps",children:UL(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(BL,{text:t.text})})]},n))})}function WL(e){const t=[];for(const n of e.split(/\r?\n/)){if(FL.test(n))continue;const r=vj.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 VL({text:e}){return s.jsx(s.Fragment,{children:WL(e).map((t,n)=>{if(t.gherkin)return s.jsx(HL,{lines:t.lines},n);const r=t.lines.join(`
|
|
410
|
+
`).trim();return r?s.jsx("div",{className:"md",children:s.jsx(zr,{children:r})},n):null})})}function QL({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(`
|
|
411
|
+
`).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(zr,{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(`
|
|
412
|
+
`).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(VL,{text:c})]},`${a.id}-${o}`)})]})}function qL(){const{file:e=""}=ai(),t=ut(),{refresh:n,mapping:r}=cn(),i=In(),l=Ir(),[a,o]=j.useState(""),[u,c]=j.useState(""),[h,d]=j.useState(),[p,m]=j.useState(!1),[f,g]=j.useState(null),[w,y]=j.useState(null),[x,v]=j.useState(!1),[b,A]=j.useState(1),[k,T]=j.useState("split"),P=j.useRef(!1),I=Oe(()=>V.jobs(),[e]),C=p&&a!==u,L=j.useMemo(()=>Eb(a),[a]),S=r.filter(F=>F.specFile===e&&F.status!=="orphan"),D=new Set(S.filter(F=>F.testFile).map(F=>F.tcId)),M=S.filter(F=>F.lastResult),U=M.filter(F=>F.lastResult.status==="passed").length,ie=(I.data??[]).filter(F=>F.target===e).slice(0,5),X=j.useCallback(async()=>{try{const F=await V.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),P.current=!1,X()},[X]);const B=jh(({currentLocation:F,nextLocation:J})=>C&&!P.current&&F.pathname!==J.pathname);Ah(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=J=>{C&&J.preventDefault()};return window.addEventListener("beforeunload",F),()=>window.removeEventListener("beforeunload",F)},[C]);const Y=j.useCallback(async(F=!1)=>{v(!0),y(null);try{const J=await V.saveSpec(e,a,F?void 0:h);return c(a),d(J.mtimeMs),g(null),y("Saved."),n(),!0}catch(J){return J instanceof no&&J.status===409&&await i({title:"Spec changed on disk",message:`${J.message} Overwrite it with your current edits?`,confirmLabel:"Overwrite",danger:!0})?(v(!1),Y(!0)):(g(J.message),!1)}finally{v(!1)}},[a,e,h,n,i]);j.useEffect(()=>{const F=J=>{(J.ctrlKey||J.metaKey)&&J.key.toLowerCase()==="s"&&(J.preventDefault(),C&&Y())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,Y]);const N=async F=>{if(!(C&&!await Y()))try{const J=await V.createJob(F);P.current=!0,t(`/runs/${J.id}`)}catch(J){g(J.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 V.deleteSpec(e),P.current=!0,n(),l.success(`Deleted ${e}`),t("/specs")}catch(J){g(J.message)}},O=L.tcs.length===0,E=tf(L.tcs,[e]);return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Specification"},{label:"Specs",to:"/specs"},{label:e}]}),s.jsxs(yS,{children:[s.jsxs("span",{className:"chip",children:["Coverage ",D.size,"/",L.tcs.length]}),s.jsxs("span",{className:`chip ${U<M.length?"fail":"ok"}`,children:["Pass rate ",U,"/",M.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(jb,{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 Y(),disabled:!C||x,title:"Ctrl+S",children:[s.jsx(ds,{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 X()})(),disabled:x,title:"Reload from disk","aria-label":"Reload from disk",children:s.jsx(Jn,{size:15})}),s.jsx("button",{className:"btn danger icon square",onClick:()=>void ae(),disabled:x,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 N({type:"explore",spec:e}),disabled:x||O,children:[s.jsx($y,{size:15})," Explore"]}),s.jsxs("button",{className:"btn",onClick:()=>void N({type:"generate",spec:e}),disabled:x||O,children:[s.jsx(Io,{size:15})," Generate"]}),s.jsx("select",{className:"select",value:b,onChange:F=>A(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 N({type:"testrun",spec:e,repeatEach:b}),disabled:x||D.size===0,title:D.size?"":"Spec has no test file yet",children:[s.jsx(ft,{size:13})," Run"]})]}),s.jsx(Ie,{error:f}),w&&s.jsx("div",{className:"info-box",children:w}),p&&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(un,{value:k,onChange:T,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(OL,{value:a,onChange:o}),k!=="editor"&&s.jsx(QL,{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:E.pageItems.map(F=>{const J=S.find(Te=>Te.tcId===F.id),ce=J==null?void 0:J.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:J!=null&&J.testFile?s.jsxs("span",{className:"map-link",title:`${J.testFile}:${J.testLine??""}`,children:[s.jsx(bh,{size:13}),s.jsx("code",{children:J.testFile.split("/").pop()}),J.status==="stale"&&s.jsx(yt,{status:"stale"})]}):s.jsx(yt,{status:(J==null?void 0:J.status)??"missing"})}),s.jsx("td",{children:ce?s.jsx(ye,{to:`/runs/${ce.jobId}`,children:s.jsx(ri,{status:ce.status,children:ce.status.charAt(0).toUpperCase()+ce.status.slice(1)})}):s.jsx(ri,{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:x,title:D.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 N({type:"generate",spec:e,tcId:F.id}),children:s.jsx(gb,{size:16})}),s.jsx("button",{className:"btn ghost icon tc-action run",disabled:!D.has(F.id)||x,title:D.has(F.id)?`Run ${F.id}`:"TC has no test yet, run Generate","aria-label":`Run ${F.id}`,onClick:()=>void N({type:"testrun",spec:e,tcId:F.id,repeatEach:b}),children:s.jsx(mb,{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(ms,{...E.props,label:"test cases"})]}),ie.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:ie.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 GL={settings:"path set below",env:"QA_STUDIO_CLAUDE_BIN",path:"found on PATH"};function Hu({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(Sh,{size:13}):r==="fail"?s.jsx(kr,{size:13}):"?"}),s.jsx("span",{className:"cc-label",children:e}),s.jsx("span",{className:"cc-detail",children:t?t.detail:n})]})}function KL({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 YL({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 V.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 p=async()=>{a(!0);try{await V.claudeTest(),await d()}catch(g){h(g.message)}finally{a(!1)}},m=async g=>{try{await V.saveSettings({claudeBin:g}),u(g),h(null),await d()}catch(w){h(w.message)}},f=(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",{})," ",f]}),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(Jn,{size:13})," ",r?"Checking…":"Check again"]}),s.jsx("button",{className:"btn sm",onClick:()=>void p(),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(Ie,{error:c}),t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"cc-checks",children:[s.jsx(Hu,{label:"Binary",check:t.binary}),s.jsx(Hu,{label:"Starts",check:t.version}),s.jsx(Hu,{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 ",GL[t.source],"."]}),s.jsx(KL,{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(ds,{size:13})," Save path"]}),(t==null?void 0:t.configuredPath)&&s.jsx("button",{className:"btn ghost sm",onClick:()=>void m(""),children:"Use automatic"})]})]})]})}function JL(){const{data:e,error:t,reload:n}=Oe(()=>V.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 V.saveSettings({maxHealRounds:r}),a(null),u(!0),setTimeout(()=>u(!1),2e3),n()}catch(p){a(p.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(Ie,{error:t??l})]}),s.jsxs("span",{className:"row",children:[s.jsx("input",{className:"input",type:"number",min:0,max:Up,step:1,style:{width:80},value:r??"",onChange:p=>i(p.target.value===""?null:Math.max(0,Math.min(Up,Math.round(Number(p.target.value))))),"aria-label":"Maximum heal rounds"}),s.jsxs("button",{className:"btn",disabled:!h,onClick:()=>void d(),children:[s.jsx(ds,{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)??!0,disabled:!e,onChange:p=>void V.saveSettings({htmlReport:p.target.checked}).then(n,m=>a(m.message))}),s.jsx("span",{children:e!=null&&e.settings.htmlReport?"On":"Off"})]})]})]})}function XL(){const{theme:e,toggleTheme:t,refreshClaude:n}=fs();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(YL,{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(JL,{})]}),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(Fy,{size:15}):s.jsx(Oy,{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 jj({title:e,onStart:t,onClose:n,specRequired:r,newSpec:i,promptOnly:l,specAgent:a}){var A,k,T;const o=ut(),u=Oe(()=>V.specs()),[c,h]=j.useState(""),[d,p]=j.useState(""),[m,f]=j.useState(null),[g,w]=j.useState(!1);j.useEffect(()=>{const P=I=>I.key==="Escape"&&n();return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[n]);const y=async()=>{w(!0);try{let P=c.trim();i&&P&&!P.endsWith(".md")&&(P=`${P}.md`);const I=await t(P,d);o(`/runs/${I.id}`)}catch(P){f(P.message),w(!1)}},x=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:P=>P.stopPropagation(),children:s.jsxs("div",{className:"modal-body",style:{display:"grid",gap:12},children:[s.jsx("h3",{style:{margin:0},children:e}),s.jsx(Ie,{error:m??u.error}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:x}),i?s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"input",list:"run-dialog-specs",value:c,onChange:P=>h(P.target.value),placeholder:"new-spec.md"}),s.jsx("datalist",{id:"run-dialog-specs",children:(A=u.data)==null?void 0:A.map(P=>s.jsx("option",{value:P.file},P.file))})]}):s.jsxs("select",{className:"input",value:c,onChange:P=>h(P.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(P=>s.jsx("option",{value:P.file,children:P.file},P.file))]}),l&&a&&!c&&s.jsxs("span",{className:"muted small",children:["Without a spec, the pipeline stops at the ",((T=Ne[a])==null?void 0:T.label)??a,"."]})]}),s.jsxs("label",{className:"pl-field",children:[s.jsx("span",{children:v}),s.jsx("textarea",{className:"input",rows:6,value:d,onChange:P=>p(P.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 y(),disabled:g||!b,children:[s.jsx(ft,{size:14})," Start job"]})]})]})})})}const Wu=e=>{var t;return((t=e.steps[0])==null?void 0:t.kind)==="agent"&&e.steps[0].agent==="specwriter"},wj=Object.keys(Ne).filter(e=>e!=="custom"),qm=wj.filter(e=>Ne[e].llm),Gm=wj.filter(e=>!Ne[e].llm),Km=Object.keys(zo),ZL=[{tone:"opus",label:"Opus"},{tone:"sonnet",label:"Sonnet"},{tone:"haiku",label:"Haiku"},{tone:"none",label:"No LLM"}];function kj(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 eA(){var x,v,b,A,k,T,P;const e=Ir(),t=In(),n=ut(),[r,i]=wh(),l=r.get("tab")==="custom"?"custom":"default",a=I=>i(I==="custom"?{tab:"custom"}:{},{replace:!0}),o=Oe(()=>V.settings()),u=Oe(()=>V.agentPrompts()),c=Oe(()=>V.pipelines()),h=Oe(()=>V.customAgents()),[d,p]=j.useState(null),m=((x=o.data)==null?void 0:x.settings.maxHealRounds)??null,f=I=>{var C;return(C=u.data)==null?void 0:C.find(L=>L.agent===I)},g=I=>{var L,S,D;const C=bl(I);return C?((S=(L=h.data)==null?void 0:L.find(M=>M.id===C))==null?void 0:S.model)??"none":Ne[I].llm?((D=f(I))==null?void 0:D.model)??"none":"none"},w=async I=>{if(await t({title:`Delete the pipeline "${I.name}"?`,message:"The pipeline is removed for everyone using this Agent Studio. This cannot be undone.",confirmLabel:"Delete pipeline",danger:!0}))try{await V.deletePipeline(I.id),e.success(`Pipeline "${I.name}" deleted`),c.reload()}catch(L){e.error(L.message)}},y=(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:[qm.length," Built-in agents · ",((b=h.data)==null?void 0:b.length)??0," custom · ",Gm.length," Playwright steps · click an agent to open its details"]})]}),s.jsx("span",{className:"ap-legend","aria-label":"Model colours",children:ZL.map(I=>s.jsxs("span",{children:[s.jsx("i",{className:`tone-dot tone-${I.tone}`})," ",I.label]},I.tone))})]}),s.jsx(Ie,{error:u.error}),s.jsx("div",{className:"ap-group-label",children:"Built-in agents"}),s.jsx("div",{className:"ap-grid",children:qm.map(I=>s.jsx(Ym,{agent:I,tone:g(I),info:f(I)},I))}),s.jsx("div",{className:"ap-group-label",children:"Custom agents"}),s.jsx(Ie,{error:h.error}),((A=h.data)==null?void 0:A.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(I=>s.jsxs(ye,{to:`/agents/custom/${I.id}`,className:"ap-agent","aria-label":`${I.name}: ${I.description||"Custom agent"}`,children:[s.jsx("span",{className:`ap-avatar tone-${I.model}`,children:kj(I.name)}),s.jsxs("span",{className:"ap-agent-text",children:[s.jsxs("b",{children:[I.name,I.skills.length>0&&s.jsxs("span",{className:"ap-custom",title:`Skills: ${I.skills.join(", ")}`,children:[I.skills.length," skill",I.skills.length===1?"":"s"]})]}),s.jsx("span",{title:I.description,children:I.description||"Custom agent"})]}),s.jsx("span",{className:`ap-pill tone-${I.model}`,children:I.model[0].toUpperCase()+I.model.slice(1)}),s.jsx("span",{className:"ap-chevron","aria-hidden":"true",children:s.jsx(ni,{size:14})})]},I.id))}),s.jsx("div",{className:"ap-group-label",children:"Playwright steps · No LLM"}),s.jsx("div",{className:"ap-grid",children:Gm.map(I=>s.jsx(Ym,{agent:I,tone:"none"},I))})]}),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(un,{value:l,onChange:a,items:[{id:"default",label:s.jsxs(s.Fragment,{children:["Default ",s.jsx("span",{className:"tab-count",children:Km.length})]})},{id:"custom",label:s.jsxs(s.Fragment,{children:["Custom ",s.jsx("span",{className:"tab-count",children:y??"…"})]})}]})]}),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:Km.map(I=>s.jsxs("div",{className:"ap-row",children:[s.jsx("span",{className:"ap-row-name",children:Sr[I]}),s.jsx("span",{className:"ap-row-steps",children:s.jsx(tA,{type:I,maxRounds:m,toneOf:g})}),s.jsxs("span",{className:"ap-row-meta",children:[s.jsx(bb,{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=${I}`),"aria-label":`Duplicate ${Sr[I]}`,children:"Duplicate"})})]},I))})]}):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(Ie,{error:c.error}),((T=c.data)==null?void 0:T.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:(P=c.data)==null?void 0:P.map(I=>s.jsxs("div",{className:"ap-row",children:[s.jsxs("span",{className:"ap-row-name",children:[s.jsx(ye,{to:`/agents/pipelines/${I.id}`,children:I.name}),I.description&&s.jsx("span",{className:"muted small ap-row-desc",children:I.description})]}),s.jsx("span",{className:"ap-row-steps",children:s.jsx(nA,{steps:I.steps,toneOf:g,custom:h.data??[]})}),s.jsx("span",{className:"ap-row-meta",title:`Updated ${Rt(I.updatedAt)}`,children:Rt(I.updatedAt)}),s.jsxs("span",{className:"ap-row-actions",children:[s.jsx("button",{className:"btn sm",onClick:()=>p(I),"aria-label":`Run pipeline ${I.name}`,children:"Run"}),s.jsx(ye,{to:`/agents/pipelines/${I.id}`,className:"btn ghost sm","aria-label":`Edit pipeline ${I.name}`,children:"Edit"}),s.jsx("button",{className:"btn danger sm icon",onClick:()=>void w(I),"aria-label":`Delete pipeline ${I.name}`,title:"Delete",children:s.jsx(Ar,{size:14})})]})]},I.id))})]})]}),d&&s.jsx(jj,{title:`Run ${d.name}`,specRequired:Wu(d),promptOnly:!Wu(d),specAgent:Bb(d.steps),newSpec:Wu(d),onClose:()=>p(null),onStart:(I,C)=>V.createJob({type:"pipeline",pipelineId:d.id,...I?{spec:I}:{},...C.trim()?{input:C}:{}})})]})}function Ym({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:kj(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(ni,{size:14})})]})}const fd=(e,t)=>{var n;return((n=t.find(r=>Lh(r.id)===e))==null?void 0:n.review)==="human"};function bj({agent:e,toneOf:t,custom:n}){const r=fd(e,n);return s.jsxs("span",{className:`ap-chip tone-${t(e)}`,title:r?"Human review":void 0,children:[Pl(e,n),r&&" 👤"]})}const pd=()=>s.jsx("span",{className:"ap-arrow",children:"→"});function tA({type:e,maxRounds:t,toneOf:n}){const r=zo[e],i=e==="generate"||e==="heal",l=i?r.filter(o=>!Ph.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(pd,{}),s.jsx(bj,{agent:o,toneOf:n,custom:[]})]},o)),i&&s.jsxs(s.Fragment,{children:[l.length>0&&s.jsx(pd,{}),s.jsx(rf,{agents:a,toneOf:n,custom:[],suffix:t===null?null:`max ${t} round${t===1?"":"s"}`,swap:!0})]})]})}function nA({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(pd,{}),r.kind==="agent"?s.jsx(bj,{agent:r.agent,toneOf:t,custom:n}):s.jsx(rf,{agents:r.steps,toneOf:t,custom:n,suffix:`max ${r.maxIterations}×${r.endsWhen==="last"?" · until last passes":""}`,endsWhen:r.endsWhen})]},i))})}function rf({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(as,{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:fd(a,n)?"Human review":void 0,children:[Pl(a,n),fd(a,n)&&" 👤"]}):s.jsx(rf,{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})]})}const rA={builtin:"built-in",project:"project",user:"user",synced:"claude.ai",plugin:"",other:""},Vu=60;function sA(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 p=n.find(f=>f.name===r[1].toLowerCase());if(!(p!=null&&p.runnable)||!/^[<[]spec\.md[>\]]/.test(p.argumentHint))return[];const m=r[2].toLowerCase();return t.specs.filter(f=>f.toLowerCase().startsWith(m)).slice(0,Vu).map(f=>({insert:`/p:${p.name} ${f} `,label:f,hint:"",description:"",badge:"spec"}))}const i=e.match(/^\/p:([a-z0-9-]*)$/i);if(i)return ta(n,i[1]).slice(0,Vu).map(p=>({insert:`/p:${p.name} `,label:`/p:${p.name}`,hint:p.argumentHint,description:p.label===p.description||!p.description?p.label:`${p.label} — ${p.description}`,badge:p.builtin?"built-in":"custom"}));const l=e.match(/^\/(\S*)$/);if(!l)return[];const a=l[1],o=ta(t.local.map(p=>({name:p.cmd.slice(1),description:p.help,l:p})),a).map(({l:p})=>({insert:`${p.cmd} `,label:p.cmd,hint:p.args,description:p.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(p=>({insert:`/${p.name} `,label:`/${p.name}`,hint:p.argumentHint,description:p.description,badge:p.source==="plugin"?p.name.split(":")[0]:rA[p.source]}));return[...o,...u,...c].slice(0,Vu)}const Sj="qa-studio.chat.settings",Jm={model:"default",effort:"default",permissionMode:"acceptEdits"};function iA(){try{return{...Jm,...JSON.parse(localStorage.getItem(Sj)??"{}")}}catch{return Jm}}function lA(e){try{localStorage.setItem(Sj,JSON.stringify(e))}catch{}}const md=e=>typeof e=="number"?`$${e<.01&&e>0?e.toFixed(3):e.toFixed(2)}`:"",aA=e=>typeof e=="number"?e<6e4?`${(e/1e3).toFixed(1)} s`:`${Math.floor(e/6e4)} min ${Math.round(e%6e4/1e3)} s`:"",oA=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(1)} MB`,ho=[{cmd:"/model",args:"<default|fable|opus|sonnet|haiku|full-id>",help:"Change the model"},{cmd:"/effort",args:`<${Jr.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 uA(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 Nj=j.createContext(async()=>{}),cA={allowed:"Allowed",always:"Always allowed (saved to .claude/settings.local.json)",denied:"Denied",expired:"No longer waiting"};function dA({b:e}){const t=j.useContext(Nj),[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:cA[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 hA=[fj],fA={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 pA({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(kr,{size:12}):s.jsx(Sh,{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 mA({b:e}){switch(e.kind){case"text":return s.jsx("div",{className:"chat-md",children:s.jsx(zr,{remarkPlugins:hA,components:fA,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(pA,{b:e});case"permission":return s.jsx(dA,{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 Cj({a:e,onRemove:t}){return s.jsxs("span",{className:"chat-att",title:e.path,children:[s.jsx(Wy,{size:12}),s.jsx("span",{className:"chat-att-name",children:e.name}),s.jsx("span",{className:"muted",children:oA(e.size)}),t&&s.jsx("button",{type:"button",className:"chat-att-x",onClick:t,"aria-label":`Remove ${e.name}`,children:s.jsx(kr,{size:11})})]})}function gA({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(Cj,{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,md(e.costUsd),aA(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(Th,{size:15})}),s.jsxs("div",{className:"chat-body",children:[e.blocks.map((r,i)=>s.jsx(mA,{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 xA({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([]),[p,m]=j.useState(0),[f,g]=j.useState(!1),w=j.useRef(null),y=j.useRef(null),[x,v]=j.useState(null),[b,A]=j.useState([]),[k,T]=j.useState(0),[P,I]=j.useState(null),C=j.useRef(!1),L=j.useRef(null);j.useEffect(()=>{!u.startsWith("/")||C.current||(C.current=!0,V.chatCommands().then(v,()=>v(null)),V.specs().then(O=>A(O.map(E=>E.file)),()=>A([])))},[u]),j.useEffect(()=>T(0),[u]),j.useLayoutEffect(()=>{const O=y.current;O&&(O.style.height="auto",O.style.height=`${Math.min(O.scrollHeight,260)}px`)},[u]);const S=async O=>{if(O.length){m(E=>E+O.length);try{const E=await l();for(const F of O)try{const J=await uA(F),ce=await V.uploadChatFile(E,{name:F.name||"pasted.png",mime:F.type||"application/octet-stream",data:J});d(Te=>[...Te,ce])}catch(J){o.error(`${F.name}: ${J.message}`)}finally{m(J=>J-1)}}catch(E){m(0),o.error(E.message)}}},D=async()=>{const O=u.trim(),E=O.match(/^(\/[a-z]+)(?:\s+(.*))?$/i);if(E&&ho.some(F=>F.cmd===E[1].toLowerCase())){a(E[1].toLowerCase(),(E[2]??"").trim())&&c("");return}n||p||!O&&!h.length||await r(O,h)&&(c(""),d([]))},M=O=>{var F;const E=B[O];!E||E.disabled||(c(E.insert),T(0),(F=y.current)==null||F.focus())},U=O=>{if(B.length&&!O.nativeEvent.isComposing){const E=F=>{var ce,Te;O.preventDefault();const J=(Y+F+B.length)%B.length;T(J),(Te=(ce=L.current)==null?void 0:ce.children[J])==null||Te.scrollIntoView({block:"nearest"})};if(O.key==="ArrowDown")return E(1);if(O.key==="ArrowUp")return E(-1);if(O.key==="Escape")return O.preventDefault(),I(u);if(O.key==="Tab"||O.key==="Enter"&&!O.shiftKey&&B[Y]&&B[Y].insert.trim()!==u.trim())return O.preventDefault(),M(Y)}O.key==="Enter"&&!O.shiftKey&&!O.nativeEvent.isComposing&&(O.preventDefault(),D()),O.key==="Escape"&&n&&i()},ie=O=>{const E=[...O.clipboardData.files];E.length&&(O.preventDefault(),S(E))},X=O=>{O.preventDefault(),g(!1),S([...O.dataTransfer.files])},B=P===u?[]:sA(u,{local:ho,catalog:x,specs:b}),Y=Math.min(k,Math.max(0,B.length-1)),N=Hp.some(O=>O.id===e.model);return s.jsxs("div",{className:`chat-composer ${f?"dragging":""}`,onDragOver:O=>(O.preventDefault(),g(!0)),onDragLeave:()=>g(!1),onDrop:X,children:[B.length>0&&s.jsxs("div",{className:"chat-slash",role:"listbox",ref:L,children:[B.map((O,E)=>s.jsxs("button",{type:"button",role:"option","aria-selected":E===Y,"aria-disabled":O.disabled,title:O.disabledReason??O.description,className:`chat-slash-item ${E===Y?"active":""} ${O.disabled?"disabled":""}`,onMouseEnter:()=>T(E),onMouseDown:F=>F.preventDefault(),onClick:()=>M(E),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:")&&(x==null?void 0:x.error)&&s.jsx("div",{className:"chat-slash-note muted",children:x.error})]}),(h.length>0||p>0)&&s.jsxs("div",{className:"chat-atts",children:[h.map(O=>s.jsx(Cj,{a:O,onRemove:()=>d(E=>E.filter(F=>F.id!==O.id))},O.id)),p>0&&s.jsxs("span",{className:"chat-att muted",children:["Uploading ",p,"…"]})]}),s.jsx("textarea",{ref:y,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:U,onPaste:ie,"aria-label":"Message"}),s.jsxs("div",{className:"chat-toolbar",children:[s.jsx("input",{ref:w,type:"file",multiple:!0,hidden:!0,onChange:O=>(S([...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(Wy,{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:[!N&&s.jsx("option",{value:e.model,children:e.model}),Hp.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:Jr.length-1,step:1,value:Math.max(0,Jr.indexOf(e.effort)),onChange:O=>t({effort:Jr[Number(O.target.value)]}),"aria-label":"Effort","aria-valuetext":e.effort,list:"chat-effort-ticks"}),s.jsx("datalist",{id:"chat-effort-ticks",children:Jr.map((O,E)=>s.jsx("option",{value:E},O))}),s.jsx("b",{className:"chat-effort-value",children:e.effort==="default"?"Default":e.effort})]}),s.jsxs("label",{className:"chat-select",title:(ae=so.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:so.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(Uy,{size:14})," Stop"]}):s.jsxs("button",{type:"button",className:"btn sm",onClick:()=>void D(),disabled:p>0||!u.trim()&&!h.length,"aria-label":"Send",children:[s.jsx(Sb,{size:14})," Send"]})]})]})}function yA(){const{id:e}=ai(),t=ut(),n=Ir(),r=In(),i=Oe(()=>V.chats(),[]),[l,a]=j.useState(null),[o,u]=j.useState(iA),[c,h]=j.useState(null),[d,p]=j.useState(null),m=j.useRef(null),f=j.useRef(!0),g=j.useRef(null),w=i.reload;j.useEffect(()=>{if(a(null),h(null),f.current=!0,!e)return;let S=!0;V.chat(e).then(M=>S&&a(U=>U??M)).catch(M=>S&&h(M.message));const D=ab(e,M=>{S&&(M.type==="session"?(a(M.session),M.session.busy||w()):a(U=>U&&{...U,messages:U.messages.map(ie=>ie.id===M.message.id?M.message:ie)}))});return()=>{S=!1,D()}},[e,w]),j.useLayoutEffect(()=>{const S=m.current;S&&f.current&&(S.scrollTop=S.scrollHeight)},[l]);const y=l?{model:l.model,effort:l.effort,permissionMode:l.permissionMode}:o,x=j.useCallback(async()=>{if(e)return e;g.current??(g.current=V.createChat(o).then(S=>(a(S),t(`/chat/${S.id}`,{replace:!0}),w(),S.id)));try{return await g.current}finally{g.current=null}},[e,o,t,w]),v=async S=>{const D={...y,...S};if(u(D),lA(D),!!l){a({...l,...S});try{await V.updateChat(l.id,S)}catch(M){n.error(M.message)}}},b=async(S,D)=>{try{const M=await x();f.current=!0;const U=await V.sendChat(M,S,D.map(ie=>ie.id));return a(ie=>ie&&ie.messages.length>U.messages.length?ie:U),!0}catch(M){return n.error(M.message),!1}},A=j.useCallback(async(S,D)=>{if(e)try{await V.answerChatPermission(e,S,D)}catch(M){n.error(M.message)}},[e,n]),k=()=>{l&&V.stopChat(l.id).catch(S=>n.error(S.message))},T=(S,D)=>{var M;if(S==="/new")return t("/chat"),!0;if(S==="/help")return n.info(s.jsx("div",{children:ho.map(U=>s.jsxs("div",{children:[s.jsx("code",{children:U.cmd})," ",U.help]},U.cmd))})),!0;if(!D)return n.warning(`Usage: ${S} ${(M=ho.find(U=>U.cmd===S))==null?void 0:M.args}`),!1;if(S==="/model")return v({model:D}),n.success(`Model: ${D}`),!0;if(S==="/effort")return Jr.includes(D)?(v({effort:D}),n.success(`Effort: ${D}`),!0):(n.error(`Effort must be one of ${Jr.join(", ")}`),!1);if(S==="/mode"){const U=so.find(ie=>ie.id.toLowerCase()===D.toLowerCase());return U?(v({permissionMode:U.id}),n.success(`Permissions: ${U.label}`),!0):(n.error(`Mode must be one of ${so.map(ie=>ie.id).join(", ")}`),!1)}return!1},P=async S=>{if(await r({title:`Delete "${S.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 V.deleteChat(S.id),S.id===e&&t("/chat"),w()}catch(D){n.error(D.message)}},I=async()=>{if(!l||d===null)return;const S=d.trim();if(p(null),!(!S||S===l.title))try{a(await V.updateChat(l.id,{title:S})),w()}catch(D){n.error(D.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(S=>s.jsxs("div",{className:`chat-list-item ${S.id===e?"active":""}`,children:[s.jsxs(ye,{to:`/chat/${S.id}`,className:"chat-list-link",children:[s.jsxs("span",{className:"chat-list-title",children:[S.busy&&s.jsx("span",{className:"chat-dot",title:"Answering"}),S.title]}),s.jsxs("span",{className:"muted small",children:[Rt(S.updatedAt),S.costUsd>0&&` · ${md(S.costUsd)}`]})]}),s.jsx("button",{className:"chat-list-del",onClick:()=>void P(S),"aria-label":`Delete ${S.title}`,title:"Delete chat",children:s.jsx(Ar,{size:13})})]},S.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:S=>p(S.target.value),onBlur:()=>void I(),onKeyDown:S=>S.key==="Enter"?void I():S.key==="Escape"&&p(null),"aria-label":"Chat title"}):s.jsx("h1",{className:"chat-title",onDoubleClick:()=>l&&p(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 ",md(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:S=>f.current=S.currentTarget.scrollHeight-S.currentTarget.scrollTop-S.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(Th,{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(Nj.Provider,{value:A,children:l==null?void 0:l.messages.map(S=>s.jsx(gA,{m:S},S.id))})]}),s.jsx(xA,{settings:y,onSettings:S=>void v(S),busy:!!(l!=null&&l.busy),onSend:b,onStop:k,ensureSession:x,onSlash:T})]})]})}const vA={name:"",description:"",instructions:"",model:"sonnet",skills:[],claudeMdSections:[],permissions:zb,review:"auto"},jA=[{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."}],Xm=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"}),wA=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t],kA=[{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."}],bA=[{key:"deniedCommands",label:"Denied commands",hint:"One command per line; it is blocked with any arguments (Bash(<command>:*)).",placeholder:`git push
|
|
413
|
+
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
|
|
414
|
+
.git`}];function Zm(){var C,L;const{id:e}=ai(),t=!e,n=ut(),r=Ir(),i=In(),l=Oe(()=>e?V.customAgent(e):Promise.resolve(null),[e]),a=Oe(()=>V.skills()),[o,u]=j.useState(vA),[c,h]=j.useState("instructions"),[d,p]=j.useState(null),[m,f]=j.useState(null),[g,w]=j.useState(!1),[y,x]=j.useState(!1);j.useEffect(()=>{l.data&&u(Xm(l.data))},[l.data]);const v=(S,D)=>u(M=>({...M,[S]:D})),b=S=>u(D=>{const M=D.permissions,U=S==="full"&&!M.deniedCommands.length&&!M.protectedPaths.length;return{...D,permissions:{...M,mode:S,...U?{deniedCommands:Qy,protectedPaths:qy}:{}}}}),A=async S=>{const D=Kb(S);o.instructions.trim()&&o.instructions!==D.instructions&&!await i({title:`Load the ${Yc.find(U=>U.id===S).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"})||(u(M=>({...M,name:t||!M.name.trim()?D.name:M.name,description:D.description,instructions:D.instructions,model:D.model,review:D.review,permissions:D.permissions})),h("instructions"),r.success(`Template loaded${t?"":": click Save to keep it"}`))},k=async()=>{var S;w(!0),f(null);try{const D=t?await V.createCustomAgent(o):await V.saveCustomAgent(e,o,(S=l.data)==null?void 0:S.updatedAt);r.success(t?`Agent "${D.name}" created`:`Agent "${D.name}" saved`),t?n(`/agents/custom/${D.id}`,{replace:!0}):l.reload()}catch(D){f(D.message)}finally{w(!1)}},T=async()=>{if(await i({title:`Delete the agent "${o.name}"?`,message:"Past jobs keep their results. This cannot be undone.",confirmLabel:"Delete agent",danger:!0}))try{await V.deleteCustomAgent(e),r.success("Agent deleted"),n("/agents")}catch(D){r.error(D.message)}};j.useEffect(()=>{if(c!=="preview"&&c!=="permissions")return;let S=!0;const D=setTimeout(()=>{V.previewCustomAgent(t?null:e,{agent:o}).then(M=>S&&(p(M),f(null))).catch(M=>S&&f(M.message))},300);return()=>{S=!1,clearTimeout(D)}},[c,o]);const P=!!l.data&&JSON.stringify(Xm(l.data))!==JSON.stringify(o),I=!g&&(t||!!l.data&&!l.error);return s.jsxs("section",{children:[s.jsx(ot,{items:[{label:"Settings"},{label:"Agents",to:"/agents"},{label:t?"New agent":o.name||"…"}]}),s.jsxs("div",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:t?"New agent":o.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:S=>S.target.value&&void A(S.target.value),"aria-label":"Load template",title:"Fill this agent from a built-in SDLC template",children:[s.jsx("option",{value:"",children:"Load template…"}),Yc.map(S=>s.jsx("option",{value:S.id,children:S.label},S.id))]}),!t&&s.jsxs("button",{className:"btn danger",onClick:()=>void T(),disabled:g,children:[s.jsx(Ar,{size:14})," Delete"]}),!t&&s.jsxs("button",{className:"btn ghost",onClick:()=>x(!0),disabled:P||!l.data,title:P?"Save your changes first":void 0,children:[s.jsx(ft,{size:14})," Run"]}),s.jsxs("button",{className:"btn",onClick:()=>void k(),disabled:!I,children:[t?s.jsx(qt,{size:14}):s.jsx(ds,{size:14})," ",t?"Create agent":"Save"]})]})]}),s.jsx(Ie,{error:l.error??m}),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:o.name,maxLength:80,onChange:S=>v("name",S.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:o.description,maxLength:500,onChange:S=>v("description",S.target.value),placeholder:"Optional"})]}),s.jsxs("label",{className:"pl-field pl-from",children:[s.jsx("span",{children:"Model"}),s.jsx("select",{className:"input",value:o.model,onChange:S=>v("model",S.target.value),children:Rh.map(S=>s.jsx("option",{value:S.id,children:S.label},S.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(S=>s.jsx("button",{type:"button",role:"radio","aria-checked":o.review===S,className:`seg-btn ${o.review===S?"on":""}`,onClick:()=>v("review",S),children:S==="auto"?"Auto":"Human"},S))}),s.jsx("span",{className:"muted small",children:o.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(un,{value:c,onChange:h,items:[{id:"instructions",label:"Instructions"},{id:"skills",label:o.skills.length?`Skills (${o.skills.length})`:"Skills"},{id:"preview",label:"Full prompt preview"},{id:"permissions",label:"Permissions"}]})}),c==="instructions"&&s.jsxs("div",{className:"pad",style:{display:"grid",gap:12},children:[s.jsxs("p",{className:"muted small",style:{margin:0},children:["Placeholders: ",Db.map(S=>`{{${S}}}`).join(", "),". Agent Studio adds the fixed part (environment, tool rules, result file) after your instructions."]}),s.jsx("textarea",{className:"input prompt-editor",value:o.instructions,onChange:S=>v("instructions",S.target.value),spellCheck:!1,"aria-label":"Instructions"}),s.jsxs("span",{className:"muted small",children:[o.instructions.length.toLocaleString()," characters"]})]}),c==="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(Ie,{error:a.error}),((C=a.data)==null?void 0:C.length)===0&&s.jsx("p",{className:"muted",children:"No skills found in .claude/skills."}),s.jsx("div",{className:"skill-list",children:(L=a.data)==null?void 0:L.map(S=>{const D=o.skills.includes(S.name);return s.jsxs("label",{className:`skill-item ${D?"on":""} ${S.error&&!D?"invalid":""}`,title:S.error??S.dir,children:[s.jsx("input",{type:"checkbox",checked:D,disabled:!!S.error&&!D,onChange:()=>v("skills",wA(o.skills,S.name)),"aria-label":`Attach skill ${S.name}`}),s.jsx("b",{children:S.name}),s.jsx("span",{className:"skill-desc muted small",children:S.error??S.description})]},S.name)})})]}),c==="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:kA.map(S=>s.jsxs("label",{className:`skill-item ${o.permissions.mode===S.id?"on":""}`,children:[s.jsx("input",{type:"radio",name:"permission-mode",checked:o.permissions.mode===S.id,onChange:()=>b(S.id)}),s.jsx("b",{children:S.label}),s.jsx("span",{className:"skill-desc muted small",children:S.hint})]},S.id))}),s.jsx("h4",{children:o.permissions.mode==="full"?"Options":"Allow"}),s.jsx("div",{className:"skill-list",children:jA.filter(S=>o.permissions.mode==="scoped"||S.key==="browser").map(S=>s.jsxs("label",{className:`skill-item ${o.permissions[S.key]?"on":""}`,children:[s.jsx("input",{type:"checkbox",checked:o.permissions[S.key],onChange:D=>v("permissions",{...o.permissions,[S.key]:D.target.checked})}),s.jsx("b",{children:S.label}),s.jsx("span",{className:"skill-desc muted small",children:S.hint})]},S.key))}),s.jsx("h4",{children:"Deny"}),o.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."}),bA.map(S=>s.jsxs("label",{className:"pl-field",children:[s.jsxs("span",{children:[s.jsx("b",{children:S.label})," ",s.jsx("span",{className:"muted small",children:S.hint})]}),s.jsx("textarea",{className:"input",rows:4,spellCheck:!1,placeholder:S.placeholder,value:o.permissions[S.key].join(`
|
|
415
|
+
`),onChange:D=>v("permissions",{...o.permissions,[S.key]:D.target.value.split(`
|
|
416
|
+
`)}),"aria-label":S.label})]},S.key)),d&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Allowed"}),s.jsx("div",{className:"perm",children:d.allowedTools.map(S=>s.jsx("code",{children:S},S))}),s.jsx("h4",{children:"Denied"}),s.jsx("div",{className:"perm",children:d.disallowedTools.map(S=>s.jsx("code",{className:"deny",children:S},S))})]})]}),c==="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."}),d?s.jsx(pj,{preview:d}):!m&&s.jsx("p",{className:"muted",children:"Building preview…"})]})]}),y&&e&&s.jsx(jj,{title:"Run agent",onClose:()=>x(!1),onStart:(S,D)=>V.createJob({type:"custom",agentId:e,...S?{spec:S}:{},...D.trim()?{input:D}:{}})})]})}const SA=["Read(.env)","Read(**/.env)","Read(.env.local)","Read(**/.env.local)","WebFetch","WebSearch"],NA={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 CA(){const e=ai().agent,t=Ne[e];return t?t.llm?s.jsx(PA,{agent:e}):s.jsx(EA,{agent:e}):s.jsx(Ie,{error:`Unknown agent: ${e}`})}function Ej({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 EA({agent:e}){const t=NA[e];return s.jsxs("section",{children:[s.jsx(Ej,{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 TA({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 V.saveAgentModel(e.agent,u),l(null),t()}catch(c){l(c.message)}finally{r(!1)}}},o=async()=>{r(!0);try{await V.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:Rh.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(Jn,{size:12})," Reset"]}),s.jsx(Ie,{error:i})]})}function PA({agent:e}){var S;const{specs:t}=cn(),n=In(),r=Oe(()=>V.agentPrompts(),[e]),i=(S=r.data)==null?void 0:S.find(D=>D.agent===e),[l,a]=j.useState(null),[o,u]=j.useState("instructions"),[c,h]=j.useState(""),[d,p]=j.useState(null),[m,f]=j.useState(null),[g,w]=j.useState(null),[y,x]=j.useState(null),[v,b]=j.useState(!1),A=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,T=i!==void 0&&l!==null&&l.trim()!==i.defaultInstructions.trim(),P=jh(({currentLocation:D,nextLocation:M})=>k&&D.pathname!==M.pathname);Ah(P,{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 D=setTimeout(()=>{V.previewAgentPrompt(e,{instructions:l,...c?{spec:c}:{}}).then(M=>(p(M),f(null))).catch(M=>f(M.message))},300);return()=>clearTimeout(D)},[o,l,c,e]);const I=async()=>{if(l!==null){b(!0);try{const D=await V.saveAgentPrompt(e,l);a(D.instructions),r.reload(),w(null),x(D.customized?"Saved. New jobs use these instructions.":"Saved: same as the default, so the default is used.")}catch(D){w(D.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 M=await V.resetAgentPrompt(e);a(M.instructions),r.reload(),w(null),x("Reset to the default instructions.")}catch(M){w(M.message)}finally{b(!1)}}},L=D=>{const M=A.current;if(!M||l===null)return;const U=`{{${D}}}`,ie=l.slice(0,M.selectionStart)+U+l.slice(M.selectionEnd),X=M.selectionStart+U.length;a(ie),requestAnimationFrame(()=>(M.focus(),M.setSelectionRange(X,X)))};return s.jsxs("section",{children:[s.jsx(Ej,{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(TA,{info:i,onSaved:r.reload}),s.jsx(Ie,{error:r.error??g}),y&&!k&&s.jsx("div",{className:"ok-box",children:y}),s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-head row between",children:[s.jsx(un,{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(Jn,{size:14})," Reset to default"]}),s.jsxs("button",{className:"btn",onClick:()=>void I(),disabled:v||!k,children:[s.jsx(ds,{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(([D,M])=>s.jsx("button",{type:"button",className:"chip",title:M,onClick:()=>L(D),children:`{{${D}}}`},D))]}),s.jsx("textarea",{ref:A,className:"input prompt-editor",value:l??"",onChange:D=>(a(D.target.value),x(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",T?" · 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(RA,{info:i,onSaved:()=>(r.reload(),p(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:D=>h(D.target.value),"aria-label":"Sample spec",children:[s.jsx("option",{value:"",children:"Generic (placeholders, no project data)"}),t.map(D=>s.jsx("option",{value:D.file,children:D.file},D.file))]})]}),s.jsx(Ie,{error:m}),d?s.jsx(pj,{preview:d}):!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(D=>s.jsx("code",{children:D},D)):s.jsx(LA,{agent:e,onLoad:p})}),s.jsx("h4",{children:"Explicitly denied"}),s.jsx("div",{className:"perm",children:((d==null?void 0:d.disallowedTools)??SA).map(D=>s.jsx("code",{className:"deny",children:D},D))})]})]})]})}function RA({info:e,onSaved:t}){var d,p,m;const n=Oe(()=>V.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(f=>f.name)),c=async f=>{i(!0);try{await V.saveAgentSkills(e.agent,f),a(null),t()}catch(g){a(g.message)}finally{i(!1)}},h=f=>{const g=o.includes(f.name);f.error&&!g||c(g?o.filter(w=>w!==f.name):[...o,f.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(Ie,{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(f=>!u.has(f))&&s.jsx("button",{type:"button",className:"link-btn",disabled:r,onClick:()=>void c(o.filter(f=>u.has(f))),children:"Remove missing"})]}),((p=n.data)==null?void 0:p.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(f=>{const g=o.includes(f.name);return s.jsxs("label",{className:`skill-item ${g?"on":""} ${f.error&&!g?"invalid":""}`,title:f.error??f.dir,children:[s.jsx("input",{type:"checkbox",checked:g,disabled:r||!!f.error&&!g,onChange:()=>h(f),"aria-label":`Attach skill ${f.name}`}),s.jsxs("span",{className:"row",style:{gap:8},children:[s.jsx("b",{children:f.name}),g&&s.jsx(yt,{status:"stale",children:o.length>1?`attached #${o.indexOf(f.name)+1}`:"attached"}),f.error&&s.jsx("span",{className:"chip fail",children:"invalid"})]}),s.jsx("span",{className:"skill-desc muted small",children:f.error??f.description}),s.jsxs("span",{className:"skill-meta muted small",children:[s.jsxs("code",{children:[f.dir,"/SKILL.md"]}),s.jsxs("span",{children:[f.chars.toLocaleString()," characters"]}),f.files.length>0&&s.jsxs("span",{title:f.files.join(", "),children:["+",f.files.length," file",f.files.length===1?"":"s"]}),f.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: ",f.allowedTools.join(" ")]})]})]},f.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(Jn,{size:12})," Rescan folder"]})]})]})}function LA({agent:e,onLoad:t}){return j.useEffect(()=>{V.previewAgentPrompt(e,{}).then(t).catch(()=>{})},[e,t]),s.jsx("span",{className:"muted small",children:"Loading…"})}let AA=0;const Tj=()=>`b${Date.now().toString(36)}${(AA++).toString(36)}`;function Pj(e,t=Tj){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:Pj(n.steps.map(hs),t)})}const Rj=e=>({kind:"loop",steps:e.steps.map(t=>t.kind==="agent"?t.agent:Rj(t)),maxIterations:e.maxIterations,...e.endsWhen==="last"?{endsWhen:"last"}:{}});function Lj(e){return e.map(t=>t.kind==="agent"?{kind:"agent",agent:t.agent}:Rj(t))}const gd=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),Aj=(e,t)=>e.length<=t.length&&e.every((n,r)=>n===t[r]);function sf(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 Ij(e,t){if(t.length===0)return e;const n=sf(e,t);return(n==null?void 0:n.kind)==="loop"?n.steps:null}const Dj=e=>e.kind==="agent"?0:1+Math.max(0,...e.steps.map(Dj));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 IA=(e,t)=>t.from==="block"?sf(e,t.path)??null:null;function zj(e,t,n){const r=Ij(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=IA(e,t);if(!a||Aj(t.path,n.parent))return!1;i=Dj(a)}return n.parent.length+i>ro?!1:t.from==="block"&&gd(t.path.slice(0,-1),n.parent)||r.length<(n.parent.length===0?Sa:Na)}function xd(e,t,n,r=Tj){if(!zj(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:Ob,endsWhen:"first"};else{const o=t.path.slice(0,-1),u=t.path[t.path.length-1];if(gd(o,n.parent)&&(n.index===u||n.index===u+1))return e;if(i=sf(e,t.path),l=ml(e,o,c=>c.filter((h,d)=>d!==u)),gd(o,n.parent))n.index>u&&(a={...n,index:n.index-1});else if(Aj(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 eg(e,t,n){const r=t.slice(0,-1),i=t[t.length-1],l=Ij(e,r),a=i+n;return!l||a<0||a>=l.length?e:xd(e,{from:"block",path:t},{parent:r,index:n<0?a:a+1})}function DA(e,t){const n=t[t.length-1];return ml(e,t.slice(0,-1),r=>r.filter((i,l)=>l!==n))}function tg(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 zA=Object.keys(Ne).filter(e=>e!=="custom"),Qu=(e,t,n,r="")=>JSON.stringify({name:e.trim(),description:t.trim(),workDir:r.trim(),steps:Lj(n)});function ng(){const{id:e}=ai(),t=!e||e==="new",[n]=wh(),r=ut(),i=In(),l=Ir(),a=Oe(()=>V.settings()),o=Oe(()=>V.customAgents()).data??[],u=Oe(()=>t?Promise.resolve(null):V.pipeline(e),[e]),[c,h]=j.useState(""),[d,p]=j.useState(""),[m,f]=j.useState(""),[g,w]=j.useState([]),[y,x]=j.useState(),[v,b]=j.useState(null),[A,k]=j.useState(!1),[T,P]=j.useState(null),[I,C]=j.useState(null),[L,S]=j.useState(!1),[D,M]=j.useState(!1),U=j.useRef(!1),ie=j.useMemo(()=>{var Q;return Wb(((Q=a.data)==null?void 0:Q.settings.maxHealRounds)??2)},[a.data]),X=(Q,de,ve=!0)=>{const ct=Pj(Q.steps);h(Q.name),p(Q.description),f(Q.workDir??""),w(ct),x(de),b(ve?Qu(Q.name,Q.description,ct,Q.workDir??""):Qu("","",[],"")),k(!0)};j.useEffect(()=>{if(!t){u.data&&X(u.data,u.data.updatedAt);return}const Q=n.get("from");if(Q&&!a.data)return;const de=ie.find(ve=>ve.id===Q);de?X({...de,name:`${de.name} (custom)`},void 0,!1):X({name:"",description:"",steps:[]},void 0)},[t,u.data,a.data]);const B=Qu(c,d,g,m),Y=A&&v!==null&&B!==v,N=Hb({name:c,description:d,workDir:m,steps:Lj(g)}),ae=N.ok?[]:N.errors,O=jh(({currentLocation:Q,nextLocation:de})=>Y&&!U.current&&Q.pathname!==de.pathname);Ah(O,{title:"Discard the unsaved pipeline changes?",message:"Your changes to this pipeline will be lost.",confirmLabel:"Discard",danger:!0});const E=async()=>{if(N.ok){S(!0);try{const Q=t?await V.createPipeline(N.value):await V.savePipeline(e,N.value,y);C(null),X(Q,Q.updatedAt),M(!0),setTimeout(()=>M(!1),2e3),l.success(t?`Pipeline "${Q.name}" created`:`Pipeline "${Q.name}" saved`),t&&(U.current=!0,r(`/agents/pipelines/${Q.id}`,{replace:!0}))}catch(Q){C(Q.message)}finally{S(!1)}}},F=async()=>{var ve;if(t)return;const Q=((ve=u.data)==null?void 0:ve.name)||c||e;if(await i({title:`Delete the pipeline "${Q}"?`,message:"The pipeline is removed for everyone using this Agent Studio. This cannot be undone.",confirmLabel:"Delete pipeline",danger:!0})){S(!0);try{await V.deletePipeline(e),U.current=!0,l.success(`Pipeline "${Q}" deleted`),r("/agents?tab=custom",{replace:!0})}catch(ct){C(ct.message),S(!1)}}},J=(Q,de)=>{Q.dataTransfer.effectAllowed=de.from==="palette"||de.from==="palette-loop"?"copy":"move",Q.dataTransfer.setData("text/plain","qa-pipeline"),P(de)},ce=()=>P(null),Te=Q=>{T&&w(de=>xd(de,T,Q)),P(null)},tt=Q=>w(de=>xd(de,Q,{parent:[],index:de.length})),W={blocks:g,drag:T,customAgents:o,setBlocks:w,startDrag:J,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(Ie,{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 ",ro," 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 E(),disabled:L||!A||!N.ok||!t&&!Y,title:ae[0],children:[s.jsx(ds,{size:14})," ",D?"Saved":t?"Create pipeline":"Save"]})]})]}),s.jsx(Ie,{error:I}),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:Gc,onChange:Q=>h(Q.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:Kc,onChange:Q=>p(Q.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:Q=>f(Q.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 Q=>{const de=Q.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=ie.find(ct=>ct.id===de);X(ve?{...ve,name:`${ve.name} (custom)`}:{name:"",description:"",steps:[]},void 0,!ve)},children:[s.jsx("option",{value:"",children:"Blank pipeline"}),ie.map(Q=>s.jsxs("option",{value:Q.id,children:["Built-in: ",Q.name]},Q.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:Q=>J(Q,{from:"palette-loop"}),onDragEnd:ce,children:[s.jsx("span",{className:"pl-loop-icon",children:s.jsx(as,{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})})]}),zA.map(Q=>s.jsxs("div",{className:"pl-tile",draggable:!0,onDragStart:de=>J(de,{from:"palette",agent:Q}),onDragEnd:ce,children:[s.jsx(Ft,{agent:Q,size:28}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:Ne[Q].label}),s.jsx("span",{className:"muted small",children:Ne[Q].llm?"LLM agent":"Playwright step"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Add ${Ne[Q].label}`,onClick:()=>tt({from:"palette",agent:Q}),children:s.jsx(qt,{size:14})})]},Q)),o.map(Q=>{const de=Lh(Q.id);return s.jsxs("div",{className:"pl-tile",draggable:!0,onDragStart:ve=>J(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:Q.name}),s.jsx("span",{className:"muted small",children:"Custom agent"})]}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Add ${Q.name}`,onClick:()=>tt({from:"palette",agent:de}),children:s.jsx(qt,{size:14})})]},Q.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((Q,de)=>s.jsxs("div",{className:"pl-item",children:[s.jsx(fo,{tree:W,target:{parent:[],index:de}}),s.jsx(_j,{tree:W,block:Q,path:[de],siblings:g.length})]},Q.uid)),s.jsx(fo,{tree:W,target:{parent:[],index:g.length},empty:g.length===0}),s.jsx("span",{className:"pl-terminal",children:"End"})]}),A&&ae.length>0&&(g.length>0||c)&&s.jsx("div",{className:"warn-box",role:"status",children:ae.join(`
|
|
417
|
+
`)})]})]})]})}const Mj=e=>e.map(t=>t+1).join("."),$j=(e,t)=>(e==null?void 0:e.from)==="block"&&e.path.length===t.length&&e.path.every((n,r)=>n===t[r]);function _j({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),p=f=>{f.stopPropagation(),o(f,{from:"block",path:n})};if(t.kind==="agent"){const f=Pl(t.agent,a);return s.jsxs("div",{className:`pl-block ${c?"inner":""} ${$j(l,n)?"dragging":""}`,draggable:!0,onDragStart:p,onDragEnd:u,children:[s.jsx("span",{className:"pl-num",children:Mj(n)}),s.jsx(Ft,{agent:nf(t.agent),size:c?26:30}),s.jsxs("span",{className:"pl-tile-text",children:[s.jsx("b",{children:f}),((m=a.find(g=>Lh(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(Oj,{tree:e,path:n,count:r,label:f})]})}return s.jsx(MA,{tree:e,loop:t,path:n,siblings:r,first:d,onDragStart:p})}function MA({tree:e,loop:t,path:n,siblings:r,first:i,onDragStart:l}){const{drag:a,setBlocks:o,endDrag:u}=e,c=Mj(n),h=`loop ${c}`;return s.jsxs("div",{className:`pl-loop ${n.length>1?"nested":""} ${$j(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(as,{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(p=>tg(p,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(p=>tg(p,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(Oj,{tree:e,path:n,count:r,label:h})]}),s.jsxs("div",{className:"pl-loop-body",children:[t.steps.map((d,p)=>s.jsxs("div",{className:"pl-item",children:[s.jsx(fo,{tree:e,target:{parent:n,index:p},inner:!0}),s.jsx(_j,{tree:e,block:d,path:[...n,p],siblings:t.steps.length,parentEndsWhen:t.endsWhen})]},d.uid)),s.jsx(fo,{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(as,{size:12})," repeats up to ",t.maxIterations??"?"," time",t.maxIterations===1?"":"s"]})]})]})}function fo({tree:e,target:t,inner:n,empty:r}){const{blocks:i,drag:l,drop:a}=e,[o,u]=j.useState(!1),c=l!==null&&zj(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 Oj({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=>eg(a,t,-1)),children:"↑"}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Move ${r} down`,disabled:l===n-1,onClick:()=>i(a=>eg(a,t,1)),children:"↓"}),s.jsx("button",{className:"btn ghost sm icon","aria-label":`Remove ${r}`,onClick:()=>i(a=>DA(a,t)),children:s.jsx(kr,{size:13})})]})}const $A=[{id:"1",label:"24 h"},{id:"7",label:"7 days"},{id:"30",label:"30 days"},{id:"90",label:"90 days"}],dr=e=>e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens,Pn=(e,t)=>e.trackedRuns?sn(t):"—";function _A(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 OA(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 FA({report:e}){const t=_A(e),n=OA(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"," · ",sn(dr(r))," in / ",sn(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 qu({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,dr(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 Fj="qa-studio.usage.recentView";function UA(){try{return localStorage.getItem(Fj)==="jobs"?"jobs":"runs"}catch{return"runs"}}function BA({job:e}){return s.jsxs(s.Fragment,{children:[s.jsxs(ye,{to:`/runs/${e.jobId}`,children:["#",e.jobId," ",Sr[e.jobType]??e.jobType]}),s.jsx("div",{className:"muted small",children:e.name??e.target})]})}function HA({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(ni,{size:12,open:a})}),s.jsx("span",{children:s.jsx(BA,{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,dr(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,dr(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 WA(){const[e,t]=j.useState(UA),n=d=>{t(d);try{localStorage.setItem(Fj,d)}catch{}},[r,i]=j.useState("30"),{data:l,error:a,reload:o}=Oe(()=>V.usage(Number(r)),[r]),u=l==null?void 0:l.totals,c=u&&dr(u)?Math.round(u.cacheReadTokens/dr(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(un,{value:r,onChange:i,items:$A}),s.jsx("button",{className:"btn ghost",onClick:o,title:"Refresh","aria-label":"Refresh",children:s.jsx(Jn,{size:15})})]})]}),s.jsx(Ie,{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(Hy,{size:16}),label:"Estimated cost",value:Kt(u.costUsd),sub:`${u.runs?Kt(u.costUsd/u.runs):"—"} per run`}),s.jsx(ca,{icon:s.jsx(By,{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:Pn(u,dr(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:Pn(u,u.outputTokens),sub:u.trackedRuns?`${sn(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(FA,{report:l})]}),s.jsxs("div",{className:"overview-grid",style:{marginBottom:14},children:[s.jsx(qu,{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(qu,{title:"By agent",rows:l.byAgent,total:u.costUsd,name:d=>{var p;return s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,whiteSpace:"nowrap"},children:[s.jsx(Ft,{agent:d.agent,size:22})," ",((p=Ne[d.agent])==null?void 0:p.label)??d.agent]})}})]}),s.jsx("div",{style:{marginBottom:14},children:s.jsx(qu,{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(un,{value:e,onChange:n,items:[{id:"runs",label:"Runs"},{id:"jobs",label:"Group by job"}]})]}),e==="jobs"?s.jsx(HA,{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 p;return s.jsxs("tr",{children:[s.jsxs("td",{children:[s.jsxs(ye,{to:`/runs/${d.jobId}`,children:["#",d.jobId," ",Sr[d.jobType]]}),s.jsx("div",{className:"muted small",children:d.target})]}),s.jsx("td",{children:((p=Ne[d.agent])==null?void 0:p.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,dr(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 VA(e){return e.target==="all"?"All tests":e.args.tcId?"1 TC":"Whole spec"}function QA({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 qA(){const e=ut(),t=Tl(),{data:n,error:r,reload:i}=Oe(()=>V.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(Ie,{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(QA,{counts:o.counts})}),s.jsx("td",{className:"num",children:o.args.selection?o.caseCount:s.jsx("span",{className:"muted small",children:VA(o)})}),s.jsx("td",{className:"muted small",children:Rt(o.startedAt??o.createdAt)}),s.jsx("td",{className:"muted small",children:br(o.startedAt,o.finishedAt)}),s.jsx("td",{onClick:u=>u.stopPropagation(),children:o.hasHtmlReport?s.jsxs("a",{className:"btn ghost",href:kh(o.id),target:"_blank",rel:"noreferrer",children:[s.jsx(Eh,{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(ms,{page:t.page,pageSize:t.pageSize,total:n.total,onPage:t.setPage,onPageSize:t.setPageSize,label:"runs"})]})]})}const GA=8;function KA({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(/^#/,""),p=r.filter(w=>!n.has(w)&&(!d||w.toLowerCase().includes(d))).sort((w,y)=>+!w.toLowerCase().startsWith(d)-+!y.toLowerCase().startsWith(d)).slice(0,GA),m=a&&p.length>0&&(d.length>0||n.size===0||e==="");j.useEffect(()=>c(0),[d]);const f=w=>{var y;i(w),t(""),c(0),(y=h.current)==null||y.focus()},g=w=>{var y;w.key==="ArrowDown"&&m?(w.preventDefault(),c(x=>(x+1)%p.length)):w.key==="ArrowUp"&&m?(w.preventDefault(),c(x=>(x-1+p.length)%p.length)):w.key==="Enter"?(w.preventDefault(),m&&d&&f(p[u])):w.key==="Escape"?e?t(""):(y=h.current)==null||y.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(Ao,{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:y=>{y.stopPropagation(),i(w)},children:s.jsx(kr,{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"}),p.map((w,y)=>s.jsxs("li",{id:`tag-opt-${y}`,role:"option","aria-selected":y===u,className:y===u?"active":"",onMouseEnter:()=>c(y),onMouseDown:x=>{x.preventDefault(),f(w)},children:["#",w]},w))]})]})}const YA=()=>`Test run ${new Date().toLocaleString("en-GB",{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}`;function JA(){var Zt;const e=ut(),n=Yn().state??null,{specs:r}=cn(),i=Oe(()=>V.settings()),[l,a]=j.useState((n==null?void 0:n.name)??YA()),[o,u]=j.useState(()=>new Map(((n==null?void 0:n.selection)??[]).map(Z=>[Pi(Z),Z]))),[c,h]=j.useState(""),d=fb(c.trim(),250),[p,m]=j.useState(""),[f,g]=j.useState(new Set),[w,y]=j.useState("all"),[x,v]=j.useState(!1),[b,A]=j.useState(1),[k,T]=j.useState((n==null?void 0:n.retries)??null),[P,I]=j.useState(null),[C,L]=j.useState(!1),[S,D]=j.useState(null),M=P??((Zt=i.data)==null?void 0:Zt.settings.htmlReport)??!0,U=[...f].sort(),ie=x?[...o.keys()].sort():null,X=Tl([],50),B=JSON.stringify([d,p,U,w,x]),[Y,N]=j.useState(B),ae=B!==Y;ae&&(N(B),X.page!==1&&X.setPage(1));const O=ae?1:X.page,E=Oe(()=>V.searchTestCases({page:O,pageSize:X.pageSize,q:d,tags:U,spec:p,result:w,...ie?{selected:ie}:{}}),[O,X.pageSize,d,p,U.join("\0"),w,(ie==null?void 0:ie.join("\0"))??null]),F=E.data,J=(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(Z=>o.has(Pi(Z))),W=[...o.values()],ge=new Set(W.map(Z=>Z.spec)).size,Q=Z=>u(Ce=>{const Ze=new Map(Ce),Mr=Pi(Z);return Ze.has(Mr)?Ze.delete(Mr):Ze.set(Mr,Z),Ze}),de=()=>u(Z=>{const Ce=new Map(Z);for(const Ze of Te)tt?Ce.delete(Pi(Ze)):Ce.set(Pi(Ze),Ze);return Ce}),ve=Z=>g(Ce=>{const Ze=new Set(Ce);return Ze.has(Z)?Ze.delete(Z):Ze.add(Z),Ze}),ct=async Z=>{if(Z.preventDefault(),!l.trim())return D("Give the test run a name.");if(!W.length)return D("Pick at least one test case that has a Playwright test.");if(W.length>Fp)return D(`A test run can have at most ${Fp} test cases.`);L(!0);try{const Ce=await V.createJob({type:"testrun",name:l.trim(),selection:W,repeatEach:b,...k!==null?{retries:k}:{},htmlReport:M});e(`/runs/${Ce.id}`)}catch(Ce){D(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(KA,{query:c,onQuery:h,tags:f,allTags:ce,onToggleTag:ve,onClearTags:()=>g(new Set)}),s.jsxs("select",{className:"select",value:p,onChange:Z=>m(Z.target.value),"aria-label":"Spec",children:[s.jsx("option",{value:"",children:"All specs"}),r.map(Z=>s.jsx("option",{value:Z.file,children:Z.file},Z.file))]}),s.jsxs("select",{className:"select",value:w,onChange:Z=>y(Z.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:x,onChange:Z=>v(Z.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:J.map(Z=>s.jsxs("tr",{className:`${Z.runnable?"":"disabled"} ${o.has(Z.key)?"picked":""}`,onClick:()=>Z.runnable&&Q(Z.ref),style:{cursor:Z.runnable?"pointer":"default"},children:[s.jsx("td",{className:"check",onClick:Ce=>Ce.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:o.has(Z.key),disabled:!Z.runnable,onChange:()=>Q(Z.ref),"aria-label":`Select ${Z.tcId}`})}),s.jsxs("td",{children:[s.jsx("code",{children:Z.tcId})," ",Z.tcTitle,!Z.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/${Z.ref.spec}`,onClick:Ce=>Ce.stopPropagation(),children:Z.ref.spec})}),s.jsx("td",{children:s.jsx("span",{className:"row",style:{gap:4,flexWrap:"wrap"},children:Z.tags.map(Ce=>s.jsx("button",{type:"button",className:`tag tag-btn ${f.has(Ce)?"on":""}`,title:f.has(Ce)?`Remove the "${Ce}" filter`:`Filter by "${Ce}"`,onClick:Ze=>{Ze.stopPropagation(),ve(Ce)},children:Ce},Ce))})}),s.jsx("td",{children:Z.lastResult?s.jsx(ri,{status:Z.lastResult.status,title:Rt(Z.lastResult.at)}):s.jsx("span",{className:"muted small",children:"never"})})]},Z.key))})]}),s.jsx(Ie,{error:E.error}),F&&J.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&&!E.error&&s.jsx("p",{className:"muted",style:{padding:16},children:"Loading test cases…"}),F&&s.jsx(ms,{page:O,pageSize:X.pageSize,total:F.total,onPage:X.setPage,onPageSize:X.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:Rb,onChange:Z=>a(Z.target.value)})]}),s.jsxs("label",{children:["Repeat each test",s.jsx("select",{className:"select",value:b,onChange:Z=>A(Number(Z.target.value)),children:[1,2,3,5,10].map(Z=>s.jsxs("option",{value:Z,children:[Z,"×"]},Z))})]}),s.jsxs("label",{children:["Retries on failure",s.jsxs("select",{className:"select",value:k??"",onChange:Z=>T(Z.target.value===""?null:Number(Z.target.value)),children:[s.jsx("option",{value:"",children:"Default (playwright.config.ts)"}),Array.from({length:Pb+1},(Z,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:M,onChange:Z=>I(Z.target.checked),"aria-label":"Also write the Playwright HTML report"}),s.jsx("span",{children:M?"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(Ie,{error:S}),s.jsxs("button",{type:"submit",className:"btn",disabled:C||!W.length,children:[s.jsx(ft,{size:14})," ",C?"Starting…":"Create & run"]})]})})]})]})}const XA=B0([{element:s.jsx(xS,{}),children:[{path:"/",element:s.jsx(TL,{})},{path:"/chat/:id?",element:s.jsx(yA,{})},{path:"/specs",element:s.jsx(_L,{})},{path:"/specs/from-requirement",element:s.jsx(zL,{})},{path:"/specs/:file",element:s.jsx(qL,{})},{path:"/mapping",element:s.jsx(EL,{})},{path:"/runs",element:s.jsx(ML,{})},{path:"/runs/:id",element:s.jsx(hL,{})},{path:"/agents",element:s.jsx(eA,{})},{path:"/agents/custom/new",element:s.jsx(Zm,{},"new")},{path:"/agents/custom/:id",element:s.jsx(Zm,{})},{path:"/agents/:agent",element:s.jsx(CA,{})},{path:"/agents/pipelines/new",element:s.jsx(ng,{},"new")},{path:"/agents/pipelines/:id",element:s.jsx(ng,{})},{path:"/usage",element:s.jsx(WA,{})},{path:"/test-runs",element:s.jsx(qA,{})},{path:"/test-runs/new",element:s.jsx(JA,{})},{path:"/project",element:s.jsx(RL,{})},{path:"/project/reset",element:s.jsx(AL,{})},{path:"/settings",element:s.jsx(XL,{})},{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))});gy(document.getElementById("root")).render(s.jsx(j.StrictMode,{children:s.jsx(Y0,{router:XA,future:{v7_startTransition:!0}})}));
|