bugxhunter 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,303 @@
1
+ var NS=Object.defineProperty;var My=s=>{throw TypeError(s)};var ES=(s,i,c)=>i in s?NS(s,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[i]=c;var Et=(s,i,c)=>ES(s,typeof i!="symbol"?i+"":i,c),CS=(s,i,c)=>i.has(s)||My("Cannot "+c);var _y=(s,i,c)=>i.has(s)?My("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(s):i.set(s,c);var Ry=(s,i,c)=>(CS(s,i,"access private method"),c);(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function c(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function u(d){if(d.ep)return;d.ep=!0;const h=c(d);fetch(d.href,h)}})();function Hv(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var bf={exports:{}},yo={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and 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 Oy;function MS(){if(Oy)return yo;Oy=1;var s=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function c(u,d,h){var m=null;if(h!==void 0&&(m=""+h),d.key!==void 0&&(m=""+d.key),"key"in d){h={};for(var y in d)y!=="key"&&(h[y]=d[y])}else h=d;return d=h.ref,{$$typeof:s,type:u,key:m,ref:d!==void 0?d:null,props:h}}return yo.Fragment=i,yo.jsx=c,yo.jsxs=c,yo}var Dy;function _S(){return Dy||(Dy=1,bf.exports=MS()),bf.exports}var l=_S(),xf={exports:{}},Qe={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and 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 Ly;function RS(){if(Ly)return Qe;Ly=1;var s=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),T=Symbol.iterator;function z(j){return j===null||typeof j!="object"?null:(j=T&&j[T]||j["@@iterator"],typeof j=="function"?j:null)}var Z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,F={};function ue(j,ae,Ne){this.props=j,this.context=ae,this.refs=F,this.updater=Ne||Z}ue.prototype.isReactComponent={},ue.prototype.setState=function(j,ae){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,ae,"setState")},ue.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function he(){}he.prototype=ue.prototype;function C(j,ae,Ne){this.props=j,this.context=ae,this.refs=F,this.updater=Ne||Z}var Y=C.prototype=new he;Y.constructor=C,D(Y,ue.prototype),Y.isPureReactComponent=!0;var I=Array.isArray;function X(){}var J={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function $(j,ae,Ne){var xe=Ne.ref;return{$$typeof:s,type:j,key:ae,ref:xe!==void 0?xe:null,props:Ne}}function Q(j,ae){return $(j.type,ae,j.props)}function K(j){return typeof j=="object"&&j!==null&&j.$$typeof===s}function ye(j){var ae={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(Ne){return ae[Ne]})}var ve=/\/+/g;function Ce(j,ae){return typeof j=="object"&&j!==null&&j.key!=null?ye(""+j.key):ae.toString(36)}function W(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(X,X):(j.status="pending",j.then(function(ae){j.status==="pending"&&(j.status="fulfilled",j.value=ae)},function(ae){j.status==="pending"&&(j.status="rejected",j.reason=ae)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function ee(j,ae,Ne,xe,oe){var Oe=typeof j;(Oe==="undefined"||Oe==="boolean")&&(j=null);var Le=!1;if(j===null)Le=!0;else switch(Oe){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(j.$$typeof){case s:case i:Le=!0;break;case v:return Le=j._init,ee(Le(j._payload),ae,Ne,xe,oe)}}if(Le)return oe=oe(j),Le=xe===""?"."+Ce(j,0):xe,I(oe)?(Ne="",Le!=null&&(Ne=Le.replace(ve,"$&/")+"/"),ee(oe,ae,Ne,"",function(tt){return tt})):oe!=null&&(K(oe)&&(oe=Q(oe,Ne+(oe.key==null||j&&j.key===oe.key?"":(""+oe.key).replace(ve,"$&/")+"/")+Le)),ae.push(oe)),1;Le=0;var me=xe===""?".":xe+":";if(I(j))for(var De=0;De<j.length;De++)xe=j[De],Oe=me+Ce(xe,De),Le+=ee(xe,ae,Ne,Oe,oe);else if(De=z(j),typeof De=="function")for(j=De.call(j),De=0;!(xe=j.next()).done;)xe=xe.value,Oe=me+Ce(xe,De++),Le+=ee(xe,ae,Ne,Oe,oe);else if(Oe==="object"){if(typeof j.then=="function")return ee(W(j),ae,Ne,xe,oe);throw ae=String(j),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Le}function re(j,ae,Ne){if(j==null)return j;var xe=[],oe=0;return ee(j,xe,"","",function(Oe){return ae.call(Ne,Oe,oe++)}),xe}function P(j){if(j._status===-1){var ae=j._result,Ne=ae();Ne.then(function(xe){(j._status===0||j._status===-1)&&(j._status=1,j._result=xe,Ne.status===void 0&&(Ne.status="fulfilled",Ne.value=xe))},function(xe){(j._status===0||j._status===-1)&&(j._status=2,j._result=xe,Ne.status===void 0&&(Ne.status="rejected",Ne.reason=xe))}),j._status===-1&&(j._status=0,j._result=Ne)}if(j._status===1)return j._result.default;throw j._result}var Ae=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)};function qe(j){var ae=J.T,Ne={};Ne.types=ae!==null?ae.types:null,J.T=Ne;try{var xe=j(),oe=J.S;oe!==null&&oe(Ne,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(X,Ae)}catch(Oe){Ae(Oe)}finally{ae!==null&&Ne.types!==null&&(ae.types=Ne.types),J.T=ae}}function ct(j){var ae=J.T;if(ae!==null){var Ne=ae.types;Ne===null?ae.types=[j]:Ne.indexOf(j)===-1&&Ne.push(j)}else qe(ct.bind(null,j))}var gt={map:re,forEach:function(j,ae,Ne){re(j,function(){ae.apply(this,arguments)},Ne)},count:function(j){var ae=0;return re(j,function(){ae++}),ae},toArray:function(j){return re(j,function(ae){return ae})||[]},only:function(j){if(!K(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Qe.Activity=b,Qe.Children=gt,Qe.Component=ue,Qe.Fragment=c,Qe.Profiler=d,Qe.PureComponent=C,Qe.StrictMode=u,Qe.Suspense=g,Qe.ViewTransition=x,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(j){return J.H.useMemoCache(j)}},Qe.addTransitionType=ct,Qe.cache=function(j){return function(){return j.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(j,ae,Ne){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var xe=D({},j.props),oe=j.key;if(ae!=null)for(Oe in ae.key!==void 0&&(oe=""+ae.key),ae)!se.call(ae,Oe)||Oe==="key"||Oe==="__self"||Oe==="__source"||Oe==="ref"&&ae.ref===void 0||(xe[Oe]=ae[Oe]);var Oe=arguments.length-2;if(Oe===1)xe.children=Ne;else if(1<Oe){for(var Le=Array(Oe),me=0;me<Oe;me++)Le[me]=arguments[me+2];xe.children=Le}return $(j.type,oe,xe)},Qe.createContext=function(j){return j={$$typeof:m,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:h,_context:j},j},Qe.createElement=function(j,ae,Ne){var xe,oe={},Oe=null;if(ae!=null)for(xe in ae.key!==void 0&&(Oe=""+ae.key),ae)se.call(ae,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(oe[xe]=ae[xe]);var Le=arguments.length-2;if(Le===1)oe.children=Ne;else if(1<Le){for(var me=Array(Le),De=0;De<Le;De++)me[De]=arguments[De+2];oe.children=me}if(j&&j.defaultProps)for(xe in Le=j.defaultProps,Le)oe[xe]===void 0&&(oe[xe]=Le[xe]);return $(j,Oe,oe)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(j){return{$$typeof:y,render:j}},Qe.isValidElement=K,Qe.lazy=function(j){return{$$typeof:v,_payload:{_status:-1,_result:j},_init:P}},Qe.memo=function(j,ae){return{$$typeof:S,type:j,compare:ae===void 0?null:ae}},Qe.startTransition=qe,Qe.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},Qe.use=function(j){return J.H.use(j)},Qe.useActionState=function(j,ae,Ne){return J.H.useActionState(j,ae,Ne)},Qe.useCallback=function(j,ae){return J.H.useCallback(j,ae)},Qe.useContext=function(j){return J.H.useContext(j)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(j,ae){return J.H.useDeferredValue(j,ae)},Qe.useEffect=function(j,ae){return J.H.useEffect(j,ae)},Qe.useEffectEvent=function(j){return J.H.useEffectEvent(j)},Qe.useId=function(){return J.H.useId()},Qe.useImperativeHandle=function(j,ae,Ne){return J.H.useImperativeHandle(j,ae,Ne)},Qe.useInsertionEffect=function(j,ae){return J.H.useInsertionEffect(j,ae)},Qe.useLayoutEffect=function(j,ae){return J.H.useLayoutEffect(j,ae)},Qe.useMemo=function(j,ae){return J.H.useMemo(j,ae)},Qe.useOptimistic=function(j,ae){return J.H.useOptimistic(j,ae)},Qe.useReducer=function(j,ae,Ne){return J.H.useReducer(j,ae,Ne)},Qe.useRef=function(j){return J.H.useRef(j)},Qe.useState=function(j){return J.H.useState(j)},Qe.useSyncExternalStore=function(j,ae,Ne){return J.H.useSyncExternalStore(j,ae,Ne)},Qe.useTransition=function(){return J.H.useTransition()},Qe.version="19.3.0",Qe}var zy;function th(){return zy||(zy=1,xf.exports=RS()),xf.exports}var w=th();const OS=Hv(w);var Sf={exports:{}},vo={},wf={exports:{}},Af={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and 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
+ */var Uy;function DS(){return Uy||(Uy=1,(function(s){function i(W,ee){var re=W.length;W.push(ee);e:for(;0<re;){var P=re-1>>>1,Ae=W[P];if(0<d(Ae,ee))W[P]=ee,W[re]=Ae,re=P;else break e}}function c(W){return W.length===0?null:W[0]}function u(W){if(W.length===0)return null;var ee=W[0],re=W.pop();if(re!==ee){W[0]=re;e:for(var P=0,Ae=W.length,qe=Ae>>>1;P<qe;){var ct=2*(P+1)-1,gt=W[ct],j=ct+1,ae=W[j];if(0>d(gt,re))j<Ae&&0>d(ae,gt)?(W[P]=ae,W[j]=re,P=j):(W[P]=gt,W[ct]=re,P=ct);else if(j<Ae&&0>d(ae,re))W[P]=ae,W[j]=re,P=j;else break e}}return ee}function d(W,ee){var re=W.sortIndex-ee.sortIndex;return re!==0?re:W.id-ee.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;s.unstable_now=function(){return h.now()}}else{var m=Date,y=m.now();s.unstable_now=function(){return m.now()-y}}var g=[],S=[],v=1,b=null,x=3,T=!1,z=!1,Z=!1,D=!1,F=typeof setTimeout=="function"?setTimeout:null,ue=typeof clearTimeout=="function"?clearTimeout:null,he=typeof setImmediate<"u"?setImmediate:null;function C(W){for(var ee=c(S);ee!==null;){if(ee.callback===null)u(S);else if(ee.startTime<=W)u(S),ee.sortIndex=ee.expirationTime,i(g,ee);else break;ee=c(S)}}function Y(W){if(Z=!1,C(W),!z)if(c(g)!==null)z=!0,I||(I=!0,K());else{var ee=c(S);ee!==null&&Ce(Y,ee.startTime-W)}}var I=!1,X=-1,J=5,se=-1;function $(){return D?!0:!(s.unstable_now()-se<J)}function Q(){if(D=!1,I){var W=s.unstable_now();se=W;var ee=!0;try{e:{z=!1,Z&&(Z=!1,ue(X),X=-1),T=!0;var re=x;try{t:{for(C(W),b=c(g);b!==null&&!(b.expirationTime>W&&$());){var P=b.callback;if(typeof P=="function"){b.callback=null,x=b.priorityLevel;var Ae=P(b.expirationTime<=W);if(W=s.unstable_now(),typeof Ae=="function"){b.callback=Ae,C(W),ee=!0;break t}b===c(g)&&u(g),C(W)}else u(g);b=c(g)}if(b!==null)ee=!0;else{var qe=c(S);qe!==null&&Ce(Y,qe.startTime-W),ee=!1}}break e}finally{b=null,x=re,T=!1}ee=void 0}}finally{ee?K():I=!1}}}var K;if(typeof he=="function")K=function(){he(Q)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,ve=ye.port2;ye.port1.onmessage=Q,K=function(){ve.postMessage(null)}}else K=function(){F(Q,0)};function Ce(W,ee){X=F(function(){W(s.unstable_now())},ee)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(W){W.callback=null},s.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<W?Math.floor(1e3/W):5},s.unstable_getCurrentPriorityLevel=function(){return x},s.unstable_next=function(W){switch(x){case 1:case 2:case 3:var ee=3;break;default:ee=x}var re=x;x=ee;try{return W()}finally{x=re}},s.unstable_requestPaint=function(){D=!0},s.unstable_runWithPriority=function(W,ee){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var re=x;x=W;try{return ee()}finally{x=re}},s.unstable_scheduleCallback=function(W,ee,re){var P=s.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?P+re:P):re=P,W){case 1:var Ae=-1;break;case 2:Ae=250;break;case 5:Ae=1073741823;break;case 4:Ae=1e4;break;default:Ae=5e3}return Ae=re+Ae,W={id:v++,callback:ee,priorityLevel:W,startTime:re,expirationTime:Ae,sortIndex:-1},re>P?(W.sortIndex=re,i(S,W),c(g)===null&&W===c(S)&&(Z?(ue(X),X=-1):Z=!0,Ce(Y,re-P))):(W.sortIndex=Ae,i(g,W),z||T||(z=!0,I||(I=!0,K()))),W},s.unstable_shouldYield=$,s.unstable_wrapCallback=function(W){var ee=x;return function(){var re=x;x=ee;try{return W.apply(this,arguments)}finally{x=re}}}})(Af)),Af}var Iy;function LS(){return Iy||(Iy=1,wf.exports=DS()),wf.exports}var kf={exports:{}},hn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and 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 By;function zS(){if(By)return hn;By=1;var s=th();function i(v){var b="https://react.dev/errors/"+v;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)b+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+v+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var u={d:{f:c,r:function(){throw Error(i(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},d=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),m=Symbol.for("react.optimistic_key");function y(v,b,x){var T=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:T==null?null:T===m?m:""+T,children:v,containerInfo:b,implementation:x}}var g=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function S(v,b){if(v==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,hn.browser=function(v){return{$$typeof:h,_reason:v}},hn.createPortal=function(v,b){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(i(299));return y(v,b,null,x)},hn.flushSync=function(v){var b=g.T,x=u.p;try{if(g.T=null,u.p=2,v)return v()}finally{g.T=b,u.p=x,u.d.f()}},hn.preconnect=function(v,b){typeof v=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,u.d.C(v,b))},hn.prefetchDNS=function(v){typeof v=="string"&&u.d.D(v)},hn.preinit=function(v,b){if(typeof v=="string"&&b&&typeof b.as=="string"){var x=b.as,T=S(x,b.crossOrigin),z=typeof b.integrity=="string"?b.integrity:void 0,Z=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;x==="style"?u.d.S(v,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:T,integrity:z,fetchPriority:Z}):x==="script"&&u.d.X(v,{crossOrigin:T,integrity:z,fetchPriority:Z,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},hn.preinitModule=function(v,b){if(typeof v=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var x=S(b.as,b.crossOrigin);u.d.M(v,{crossOrigin:x,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&u.d.M(v)},hn.preload=function(v,b){if(typeof v=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var x=b.as,T=S(x,b.crossOrigin);u.d.L(v,x,{crossOrigin:T,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},hn.preloadModule=function(v,b){if(typeof v=="string")if(b){var x=S(b.as,b.crossOrigin);u.d.m(v,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:x,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else u.d.m(v)},hn.requestFormReset=function(v){u.d.r(v)},hn.unstable_batchedUpdates=function(v,b){return v(b)},hn.useFormState=function(v,b,x){return g.H.useFormState(v,b,x)},hn.useFormStatus=function(){return g.H.useHostTransitionStatus()},hn.version="19.3.0",hn}var Hy;function US(){if(Hy)return kf.exports;Hy=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(i){console.error(i)}}return s(),kf.exports=zS(),kf.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var $y;function IS(){if($y)return vo;$y=1;var s=LS(),i=th(),c=US();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;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."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function m(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 y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(h(e)!==e)throw Error(u(188))}function S(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,a=t;;){var o=n.return;if(o===null)break;var r=o.alternate;if(r===null){if(a=o.return,a!==null){n=a;continue}break}if(o.child===r.child){for(r=o.child;r;){if(r===n)return g(o),e;if(r===a)return g(o),t;r=r.sibling}throw Error(u(188))}if(n.return!==a.return)n=o,a=r;else{for(var f=!1,p=o.child;p;){if(p===n){f=!0,n=o,a=r;break}if(p===a){f=!0,a=o,n=r;break}p=p.sibling}if(!f){for(p=r.child;p;){if(p===n){f=!0,n=r,a=o;break}if(p===a){f=!0,a=r,n=o;break}p=p.sibling}if(!f)throw Error(u(189))}}if(n.alternate!==a)throw Error(u(190))}if(n.tag!==3)throw Error(u(188));return n.stateNode.current===n?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}function b(e,t,n,a,o,r){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,a,o,r)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&b(e.child,t,n,a,o,r))return!0;e=e.sibling}return!1}function x(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function T(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function z(e){var t=[null,null],n=x(e);return n===null||Z(t,e,n.child,{foundSelf:!1}),t}function Z(e,t,n,a){for(;n!==null;){if(n===t)a.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(a.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&Z(e,t,n.child,a))return!0;n=n.sibling}return!1}function D(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(u(559))}}var F=null,ue=null;function he(e,t,n){return e===n?!0:e===t?(F=e,!0):!1}function C(e,t,n){return e===n?(ue=e,!1):e===t?(ue!==null&&(F=e),!0):!1}function Y(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function I(e,t,n){for(var a=0,o=e;o;o=n(o))a++;o=0;for(var r=t;r;r=n(r))o++;for(;0<a-o;)e=n(e),a--;for(;0<o-a;)t=n(t),o--;for(;a--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var X=Object.assign,J=Symbol.for("react.element"),se=Symbol.for("react.transitional.element"),$=Symbol.for("react.portal"),Q=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),ye=Symbol.for("react.profiler"),ve=Symbol.for("react.consumer"),Ce=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),Ae=Symbol.for("react.lazy"),qe=Symbol.for("react.activity"),ct=Symbol.for("react.legacy_hidden"),gt=Symbol.for("react.memo_cache_sentinel"),j=Symbol.for("react.view_transition"),ae=Symbol.for("react.recoverable"),Ne=Symbol.iterator;function xe(e){return e===null||typeof e!="object"?null:(e=Ne&&e[Ne]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Symbol.for("react.client.reference");function Oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Q:return"Fragment";case ye:return"Profiler";case K:return"StrictMode";case ee:return"Suspense";case re:return"SuspenseList";case qe:return"Activity";case j:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case $:return"Portal";case Ce:return e.displayName||"Context";case ve:return(e._context.displayName||"Context")+".Consumer";case W:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:Oe(e.type)||"Memo";case Ae:t=e._payload,e=e._init;try{return Oe(e(t))}catch{}}return null}var Le=Array.isArray,me=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,De=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,tt={pending:!1,data:null,method:null,action:null},L=[],je=-1;function be(e){return{current:e}}function Be(e){0>je||(e.current=L[je],L[je]=null,je--)}function Me(e,t){je++,L[je]=e.current,e.current=t}var ie=be(null),ke=be(null),Te=be(null),He=be(null);function q(e,t){switch(Me(Te,t),Me(ke,e),Me(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Bg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Bg(t),e=Hg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Be(ie),Me(ie,e)}function ze(){Be(ie),Be(ke),Be(Te)}function $e(e){var t=e.memoizedState;t!==null&&(fi._currentValue=t.memoizedState,Me(He,e)),t=ie.current;var n=Hg(t,e.type);t!==n&&(Me(ke,e),Me(ie,n))}function yt(e){ke.current===e&&(Be(ie),Be(ke)),He.current===e&&(Be(He),fi._currentValue=tt)}var Ye,pt;function Ve(e){if(Ye===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ye=t&&t[1]||"",pt=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Ye+e+pt}var Vt=!1;function Bn(e,t){if(!e||Vt)return"";Vt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(we){var _=we}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(we){_=we}ne=!1;try{var H=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),ne=!0,new e}finally{ne&&(H!==void 0?Object.defineProperty(e.prototype,"props",H):delete e.prototype.props)}}}else{try{throw Error()}catch(we){_=we}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(we){if(we&&_&&typeof we.stack=="string")return[we.stack,_.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),f=r[0],p=r[1];if(f&&p){var k=f.split(`
44
+ `),O=p.split(`
45
+ `);for(o=a=0;a<k.length&&!k[a].includes("DetermineComponentFrameRoot");)a++;for(;o<O.length&&!O[o].includes("DetermineComponentFrameRoot");)o++;if(a===k.length||o===O.length)for(a=k.length-1,o=O.length-1;1<=a&&0<=o&&k[a]!==O[o];)o--;for(;1<=a&&0<=o;a--,o--)if(k[a]!==O[o]){if(a!==1||o!==1)do if(a--,o--,0>o||k[a]!==O[o]){var G=`
46
+ `+k[a].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=a&&0<=o);break}}}finally{Vt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ve(n):""}function Ea(e,t){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve("Lazy");case 13:return e.child!==t&&t!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return Bn(e.type,!1);case 11:return Bn(e.type.render,!1);case 1:return Bn(e.type,!0);case 31:return Ve("Activity");case 30:return Ve("ViewTransition");default:return""}}function Cn(e){try{var t="",n=null;do t+=Ea(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
47
+ Error generating stack: `+a.message+`
48
+ `+a.stack}}var Mn=Object.prototype.hasOwnProperty,gn=s.unstable_scheduleCallback,ma=s.unstable_cancelCallback,Hn=s.unstable_shouldYield,tn=s.unstable_requestPaint,vt=s.unstable_now,ta=s.unstable_getCurrentPriorityLevel,Sn=s.unstable_ImmediatePriority,wn=s.unstable_UserBlockingPriority,An=s.unstable_NormalPriority,pa=s.unstable_LowPriority,na=s.unstable_IdlePriority,Ca=s.log,ga=s.unstable_setDisableYieldValue,yn=null,Lt=null;function M(e){if(typeof Ca=="function"&&ga(e),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(yn,e)}catch{}}var le=Math.clz32?Math.clz32:Ke,pe=Math.log,Re=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(pe(e)/Re|0)|0}var We=256,ht=262144,N=4194304;function V(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ge(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var o=0,r=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var p=a&134217727;return p!==0?(a=p&~r,a!==0?o=V(a):(f&=p,f!==0?o=V(f):n||(n=p&~e,n!==0&&(o=V(n))))):(p=a&~r,p!==0?o=V(p):f!==0?o=V(f):n||(n=a&~e,n!==0&&(o=V(n)))),o===0?0:t!==0&&t!==o&&(t&r)===0&&(r=o&-o,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:o}function Se(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Je(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var a=31-le(n),o=1<<a;t|=e[a],n&=~o}return t}function ut(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=N;return N<<=1,(N&62914560)===0&&(N=4194304),e}function jt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function st(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Bt(e,t,n,a,o,r){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,k=e.expirationTimes,O=e.hiddenUpdates;for(n=f&~n;0<n;){var G=31-le(n),ne=1<<G;p[G]=0,k[G]=-1;var _=O[G];if(_!==null)for(O[G]=null,G=0;G<_.length;G++){var H=_[G];H!==null&&(H.lane&=-536870913)}n&=~ne}a!==0&&$n(e,a,0),r!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=r&~(f&~t))}function $n(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-le(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function Qa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-le(n),o=1<<a;o&t|e[a]&t&&(e[a]|=t),n&=~o}}function Ma(e,t){var n=t&-t;return n=(n&42)!==0?1:Ps(n),(n&(e.suspendedLanes|t))!==0?0:n}function Ps(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function _a(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ps(){var e=De.p;return e!==0?e:(e=window.event,e===void 0?32:Ay(e.type))}function Cl(e,t){var n=De.p;try{return De.p=e,t()}finally{De.p=n}}var Gt=Math.random().toString(36).slice(2),zt="__reactFiber$"+Gt,Ut="__reactProps$"+Gt,_n="__reactContainer$"+Gt,Yo="__reactEvents$"+Gt,Ml="__reactListeners$"+Gt,Vo="__reactHandles$"+Gt,Qo="__reactResources$"+Gt,gs="__reactMarker$"+Gt,Fs="__reactLoad$"+Gt;function Ka(e){delete e[zt],delete e[Ut],delete e[Ml],delete e[Vo]}function ya(e){var t;if(t=e[zt])return t;for(var n=e.parentNode;n;){if(t=n[_n]||n[zt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ay(e);e!==null;){if(n=e[zt])return n;e=ay(e)}return t}e=n,n=e.parentNode}return null}function va(e){if(e=e[zt]||e[_n]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function aa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function sa(e){var t=e[Qo];return t||(t=e[Qo]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function St(e){e[gs]=!0}function Ko(e){e[Fs]=void 0}var Js=new Set,Zo={};function Ra(e,t){qn(e,t),qn(e+"Capture",t)}function qn(e,t){for(Zo[e]=t,e=0;e<t.length;e++)Js.add(t[e])}var Po=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ni={},Fo={};function Jo(e){return Mn.call(Fo,e)?!0:Mn.call(Ni,e)?!1:Po.test(e)?Fo[e]=!0:(Ni[e]=!0,!1)}var dt=!1;function Wo(){var e=dt;return dt=!1,e}function Ws(e,t,n){if(Jo(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function Za(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function Gn(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,a)}}function ce(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function A(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function U(e,t,n){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var o=a.get,r=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(f){n=""+f,r.call(this,f)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function de(e){if(!e._valueTracker){var t=A(e)?"checked":"value";e._valueTracker=U(e,t,""+e[t])}}function fe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=A(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}var Ie=/[\n"\\]/g;function Ge(e){return e.replace(Ie,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function nt(e,t,n,a,o,r,f,p){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ce(t)):e.value!==""+ce(t)&&(e.value=""+ce(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?f==="number"&&e.value==t?vn(e,ce(e.value)):vn(e,ce(t)):n!=null?vn(e,ce(n)):a!=null&&e.removeAttribute("value"),o==null&&r!=null&&(e.defaultChecked=!!r),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+ce(p):e.removeAttribute("name")}function Rt(e,t,n,a,o,r,f,p){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){de(e);return}n=n!=null?""+ce(n):"",t=t!=null?""+ce(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}a=a??o,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=p?e.checked:!!a,e.defaultChecked=!!a,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),de(e)}function vn(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Qt(e,t,n,a){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&a&&(e[n].defaultSelected=!0)}else{for(n=""+ce(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,a&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Pa(e,t,n){if(t!=null&&(t=""+ce(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+ce(n):""}function _l(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(u(92));if(Le(a)){if(1<a.length)throw Error(u(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=ce(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),de(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var er=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _h(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||er.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Rh(e,t,n){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="",dt=!0);for(var o in t)a=t[o],t.hasOwnProperty(o)&&n[o]!==a&&(_h(e,o,a),dt=!0)}else for(var r in t)t.hasOwnProperty(r)&&_h(e,r,t[r])}function Fc(e){if(e.indexOf("-")===-1)return!1;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 P0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),F0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function tr(e){return F0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Oa(){}var Jc=null;function Wc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rl=null,Ol=null;function Oh(e){var t=va(e);if(t&&(e=t.stateNode)){var n=e[Ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ge(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var o=a[Ut]||null;if(!o)throw Error(u(90));nt(a,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&fe(a)}break e;case"textarea":Pa(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Qt(e,!!n.multiple,t,!1)}}}var eu=!1;function Dh(e,t,n){if(eu)return e(t,n);eu=!0;try{var a=e(t);return a}finally{if(eu=!1,(Rl!==null||Ol!==null)&&(tc(),Rl&&(t=Rl,e=Ol,Ol=Rl=null,Oh(t),e)))for(t=0;t<e.length;t++)Oh(e[t])}}function Ei(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Ut]||null;if(a===null)return null;n=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(u(231,t,typeof n));return n}var Fa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tu=!1;if(Fa)try{var Ci={};Object.defineProperty(Ci,"passive",{get:function(){tu=!0}}),window.addEventListener("test",Ci,Ci),window.removeEventListener("test",Ci,Ci)}catch{tu=!1}var ys=null,nu=null,nr=null;function Lh(){if(nr)return nr;var e,t=nu,n=t.length,a,o="value"in ys?ys.value:ys.textContent,r=o.length;for(e=0;e<n&&t[e]===o[e];e++);var f=n-e;for(a=1;a<=f&&t[n-a]===o[r-a];a++);return nr=o.slice(e,1<a?1-a:void 0)}function ar(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 sr(){return!0}function zh(){return!1}function kn(e){function t(n,a,o,r,f){this._reactName=n,this._targetInst=o,this.type=a,this.nativeEvent=r,this.target=f,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(n=e[p],this[p]=n?n(r):r[p]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?sr:zh,this.isPropagationStopped=zh,this}return X(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=sr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=sr)},persist:function(){},isPersistent:sr}),t}var vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lr=kn(vs),Mi=X({},vs,{view:0,detail:0}),J0=kn(Mi),au,su,_i,ir=X({},Mi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:iu,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!==_i&&(_i&&e.type==="mousemove"?(au=e.screenX-_i.screenX,su=e.screenY-_i.screenY):su=au=0,_i=e),au)},movementY:function(e){return"movementY"in e?e.movementY:su}}),Uh=kn(ir),W0=X({},ir,{dataTransfer:0}),eb=kn(W0),tb=X({},Mi,{relatedTarget:0}),lu=kn(tb),nb=X({},vs,{animationName:0,elapsedTime:0,pseudoElement:0}),ab=kn(nb),sb=X({},vs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lb=kn(sb),ib=X({},vs,{data:0}),Ih=kn(ib),ob={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rb={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"},cb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ub(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=cb[e])?!!t[e]:!1}function iu(){return ub}var db=X({},Mi,{key:function(e){if(e.key){var t=ob[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ar(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?rb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:iu,charCode:function(e){return e.type==="keypress"?ar(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ar(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fb=kn(db),hb=X({},ir,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bh=kn(hb),mb=X({},vs,{submitter:0}),pb=kn(mb),gb=X({},Mi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:iu}),yb=kn(gb),vb=X({},vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),bb=kn(vb),xb=X({},ir,{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}),Sb=kn(xb),wb=X({},vs,{newState:0,oldState:0,source:0}),Ab=kn(wb),kb=[9,13,27,32],ou=Fa&&"CompositionEvent"in window,Ri=null;Fa&&"documentMode"in document&&(Ri=document.documentMode);var Tb=Fa&&"TextEvent"in window&&!Ri,Hh=Fa&&(!ou||Ri&&8<Ri&&11>=Ri),$h=" ",qh=!1;function Gh(e,t){switch(e){case"keyup":return kb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dl=!1;function jb(e,t){switch(e){case"compositionend":return Xh(t);case"keypress":return t.which!==32?null:(qh=!0,$h);case"textInput":return e=t.data,e===$h&&qh?null:e;default:return null}}function Nb(e,t){if(Dl)return e==="compositionend"||!ou&&Gh(e,t)?(e=Lh(),nr=nu=ys=null,Dl=!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 Hh&&t.locale!=="ko"?null:t.data;default:return null}}var Eb={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 Yh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Eb[e.type]:t==="textarea"}function Vh(e,t,n,a){Rl?Ol?Ol.push(a):Ol=[a]:Rl=a,t=oc(t,"onChange"),0<t.length&&(n=new lr("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Oi=null,Di=null;function Cb(e){Og(e,0)}function or(e){var t=aa(e);if(fe(t))return e}function Qh(e,t){if(e==="change")return t}var Kh=!1;if(Fa){var ru;if(Fa){var cu="oninput"in document;if(!cu){var Zh=document.createElement("div");Zh.setAttribute("oninput","return;"),cu=typeof Zh.oninput=="function"}ru=cu}else ru=!1;Kh=ru&&(!document.documentMode||9<document.documentMode)}function Ph(){Oi&&(Oi.detachEvent("onpropertychange",Fh),Di=Oi=null)}function Fh(e){if(e.propertyName==="value"&&or(Di)){var t=[];Vh(t,Di,e,Wc(e)),Dh(Cb,t)}}function Mb(e,t,n){e==="focusin"?(Ph(),Oi=t,Di=n,Oi.attachEvent("onpropertychange",Fh)):e==="focusout"&&Ph()}function _b(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return or(Di)}function Rb(e,t){if(e==="click")return or(t)}function Ob(e,t){if(e==="input"||e==="change")return or(t)}function Db(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xn=typeof Object.is=="function"?Object.is:Db;function Li(e,t){if(Xn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var o=n[a];if(!Mn.call(t,o)||!Xn(e[o],t[o]))return!1}return!0}function uu(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 Jh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wh(e,t){var n=Jh(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jh(n)}}function em(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?em(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=uu(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=uu(e.document)}return t}function du(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")}var Lb=Fa&&"documentMode"in document&&11>=document.documentMode,Ll=null,fu=null,zi=null,hu=!1;function nm(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hu||Ll==null||Ll!==uu(a)||(a=Ll,"selectionStart"in a&&du(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),zi&&Li(zi,a)||(zi=a,a=oc(fu,"onSelect"),0<a.length&&(t=new lr("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Ll)))}function el(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var zl={animationend:el("Animation","AnimationEnd"),animationiteration:el("Animation","AnimationIteration"),animationstart:el("Animation","AnimationStart"),transitionrun:el("Transition","TransitionRun"),transitionstart:el("Transition","TransitionStart"),transitioncancel:el("Transition","TransitionCancel"),transitionend:el("Transition","TransitionEnd")},mu={},am={};Fa&&(am=document.createElement("div").style,"AnimationEvent"in window||(delete zl.animationend.animation,delete zl.animationiteration.animation,delete zl.animationstart.animation),"TransitionEvent"in window||delete zl.transitionend.transition);function tl(e){if(mu[e])return mu[e];if(!zl[e])return e;var t=zl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in am)return mu[e]=t[n];return e}var sm=tl("animationend"),lm=tl("animationiteration"),im=tl("animationstart"),zb=tl("transitionrun"),Ub=tl("transitionstart"),Ib=tl("transitioncancel"),om=tl("transitionend"),rm=new Map,pu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");pu.push("scrollEnd");function ba(e,t){rm.set(e,t),Ra(t,[e])}var Bb=0;function Ja(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Aa.identifierPrefix;var n=Bb++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function cm(e){if(e==null||typeof e=="string")return e;var t=null,n=ni;if(n!==null)for(var a=0;a<n.length;a++){var o=e[n[a]];if(o!=null){if(o==="none")return"none";t=t==null?o:t+(" "+o)}}return t??e.default}function Wa(e,t){return e=cm(e),t=cm(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var rr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},la=[],Ul=0,gu=0;function cr(){for(var e=Ul,t=gu=Ul=0;t<e;){var n=la[t];la[t++]=null;var a=la[t];la[t++]=null;var o=la[t];la[t++]=null;var r=la[t];if(la[t++]=null,a!==null&&o!==null){var f=a.pending;f===null?o.next=o:(o.next=f.next,f.next=o),a.pending=o}r!==0&&um(n,o,r)}}function ur(e,t,n,a){la[Ul++]=e,la[Ul++]=t,la[Ul++]=n,la[Ul++]=a,gu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function yu(e,t,n,a){return ur(e,t,n,a),dr(e)}function nl(e,t){return ur(e,null,null,t),dr(e)}function um(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var o=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(o=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,o&&t!==null&&(o=31-le(n),e=r.hiddenUpdates,a=e[o],a===null?e[o]=[t]:a.push(t),t.lane=n|536870912),r):null}function dr(e){if(50<so)throw so=0,ec=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Il={};function Hb(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(e,t,n,a){return new Hb(e,t,n,a)}function vu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function es(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&1206910976,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.refCleanup=e.refCleanup,n}function dm(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fr(e,t,n,a,o,r){var f=0;if(a=e,typeof a=="function")vu(a)&&(f=1);else if(typeof a=="string")f=mS(e,n,ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(a){case qe:return e=Rn(31,n,t,o),e.elementType=qe,e.lanes=r,e;case Q:return al(n.children,o,r,t);case K:f=8,o|=24;break;case ye:return e=Rn(12,n,t,o|2),e.elementType=ye,e.lanes=r,e;case ee:return e=Rn(13,n,t,o),e.elementType=ee,e.lanes=r,e;case re:return e=Rn(19,n,t,o),e.elementType=re,e.lanes=r,e;case ct:case j:return e=o|32,e=Rn(30,n,t,e),e.elementType=j,e.lanes=r,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case Ce:f=10;break e;case ve:f=9;break e;case W:f=11;break e;case P:f=14;break e;case Ae:f=16,a=null;break e}f=29,n=Error(u(130,e===null?"null":typeof e,"")),a=null}return t=Rn(f,n,t,o),t.elementType=e,t.type=a,t.lanes=r,t}function al(e,t,n,a){return e=Rn(7,e,a,t),e.lanes=n,e}function bu(e,t,n){return e=Rn(6,e,null,t),e.lanes=n,e}function fm(e){var t=Rn(18,null,null,0);return t.stateNode=e,t}function xu(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}var hm=new WeakMap;function ia(e,t){if(typeof e=="object"&&e!==null){var n=hm.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Cn(t)},hm.set(e,t),t)}return{value:e,source:t,stack:Cn(t)}}var Bl=[],Hl=0,hr=null,Ui=0,oa=[],ra=0,bs=null,Da=1,La="";function ts(e,t){Bl[Hl++]=Ui,Bl[Hl++]=hr,hr=e,Ui=t}function mm(e,t,n){oa[ra++]=Da,oa[ra++]=La,oa[ra++]=bs,bs=e;var a=Da;e=La;var o=32-le(a)-1;a&=~(1<<o),n+=1;var r=32-le(t)+o;if(30<r){var f=o-o%5;r=(a&(1<<f)-1).toString(32),a>>=f,o-=f,Da=1<<32-le(t)+o|n<<o|a,La=r+e}else Da=1<<r|n<<o|a,La=e}function mr(e){e.return!==null&&(ts(e,1),mm(e,1,0))}function Su(e){for(;e===hr;)hr=Bl[--Hl],Bl[Hl]=null,Ui=Bl[--Hl],Bl[Hl]=null;for(;e===bs;)bs=oa[--ra],oa[ra]=null,La=oa[--ra],oa[ra]=null,Da=oa[--ra],oa[ra]=null}function pm(e,t){oa[ra++]=Da,oa[ra++]=La,oa[ra++]=bs,Da=t.id,La=t.overflow,bs=e}var nn=null,Mt=null,et=!1,xs=null,ca=!1,wu=Error(u(519));function Ss(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ii(ia(t,e)),wu}function gm(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[zt]=e,t[Ut]=a,n){case"dialog":it("cancel",t),it("close",t);break;case"iframe":case"object":case"embed":it("load",t);break;case"video":case"audio":for(n=0;n<io.length;n++)it(io[n],t);break;case"source":it("error",t);break;case"img":case"image":case"link":it("error",t),it("load",t);break;case"details":it("toggle",t);break;case"input":it("invalid",t),Rt(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":it("invalid",t);break;case"textarea":it("invalid",t),_l(t,a.value,a.defaultValue,a.children)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Ug(t.textContent,n)?(a.popover!=null&&(it("beforetoggle",t),it("toggle",t)),a.onScroll!=null&&it("scroll",t),a.onScrollEnd!=null&&it("scrollend",t),a.onClick!=null&&(t.onclick=Oa),t=!0):t=!1,t||Ss(e,!0)}function pr(e){for(nn=e.return;nn;)switch(nn.tag){case 5:case 31:case 13:ca=!1;return;case 27:case 3:ca=!0;return;default:nn=nn.return}}function $l(e){if(e!==nn)return!1;if(!et)return pr(e),et=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Jd(e.type,e.memoizedProps)),n=!n),n&&Mt&&Ss(e),pr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Mt=ny(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Mt=ny(e)}else t===27?(t=Mt,Us(e.type)?(e=rf,rf=null,Mt=e):Mt=t):Mt=nn?da(e.stateNode.nextSibling):null;return!0}function sl(){Mt=nn=null,et=!1}function Au(){var e=xs;return e!==null&&(Ln===null?Ln=e:Ln.push.apply(Ln,e),xs=null),e}function Ii(e){xs===null?xs=[e]:xs.push(e)}var ku=be(null),ll=null,ns=null;function ws(e,t,n){Me(ku,t._currentValue),t._currentValue=n}function as(e){e._currentValue=ku.current,Be(ku)}function gr(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Tu(e,t,n,a){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var r=o.dependencies;if(r!==null){var f=o.child;r=r.firstContext;e:for(;r!==null;){var p=r;r=o;for(var k=0;k<t.length;k++)if(p.context===t[k]){r.lanes|=n,p=r.alternate,p!==null&&(p.lanes|=n),gr(r.return,n,e),a||(f=null);break e}r=p.next}}else if(o.tag===18){if(f=o.return,f===null)throw Error(u(341));f.lanes|=n,r=f.alternate,r!==null&&(r.lanes|=n),gr(f,n,e),f=null}else o.tag===13&&o.memoizedState!==null&&o.memoizedState.dehydrated===null?(o.lanes|=n,f=o.alternate,f!==null&&(f.lanes|=n),gr(o.return,n,e),f=o.child,f=f!==null?f.sibling:null):f=o.child;if(f!==null)f.return=o;else for(f=o;f!==null;){if(f===e){f=null;break}if(o=f.sibling,o!==null){o.return=f.return,f=o;break}f=f.return}o=f}}function il(e,t,n,a){e=null;for(var o=t,r=!1;o!==null;){if(!r){if((o.flags&524288)!==0)r=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var f=o.alternate;if(f===null)throw Error(u(387));if(f=f.memoizedProps,f!==null){var p=o.type;Xn(o.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(o===He.current){if(f=o.alternate,f===null)throw Error(u(387));f.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(fi):e=[fi])}o=o.return}return e!==null&&Tu(t,e,n,a),t.flags|=262144,e!==null}function yr(e){for(e=e.firstContext;e!==null;){if(!Xn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ol(e){ll=e,ns=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rn(e){return ym(ll,e)}function vr(e,t){return ll===null&&ol(e),ym(e,t)}function ym(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ns===null){if(e===null)throw Error(u(308));ns=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ns=ns.next=t;return n}var $b=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},qb=s.unstable_scheduleCallback,Gb=s.unstable_NormalPriority,Kt={$$typeof:Ce,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ju(){return{controller:new $b,data:new Map,refCount:0}}function Bi(e){e.refCount--,e.refCount===0&&qb(Gb,function(){e.controller.abort()})}function vm(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var a=t[e];n.indexOf(a)===-1&&n.push(a)}}}var Hi=null;function Xb(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var $i=null,Nu=0,rl=0,ql=null;function Yb(e,t){if($i===null){var n=$i=[];Nu=0,rl=Gd(),ql={status:"pending",value:void 0,then:function(a){n.push(a)}}}return Nu++,t.then(bm,bm),t}function bm(){if(--Nu===0&&(Hi=null,$i!==null)){ql!==null&&(ql.status="fulfilled");var e=$i;$i=null,rl=0,ql=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Vb(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var o=0;o<n.length;o++)(0,n[o])(t)},function(o){for(a.status="rejected",a.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),a}var xm=me.S;me.S=function(e,t){if(fg=vt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Yb(e,t),Hi!==null)for(var n=ii;n!==null;)vm(n,Hi),n=n.next;if(n=e.types,n!==null){for(var a=ii;a!==null;)vm(a,n),a=a.next;if(rl!==0){a=Hi,a===null&&(a=Hi=[]);for(var o=0;o<n.length;o++){var r=n[o];a.indexOf(r)===-1&&a.push(r)}}}xm!==null&&xm(e,t)};var cl=be(null);function Eu(){var e=cl.current;return e!==null?e:Ct.pooledCache}function br(e,t){t===null?Me(cl,cl.current):Me(cl,t.pool)}function Sm(){var e=Eu();return e===null?null:{parent:Kt._currentValue,pool:e}}var Gl=Error(u(460)),Cu=Error(u(474)),xr=Error(u(542)),Sr={then:function(){}};function wm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Am(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Oa,Oa),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Tm(e),e===void 0&&!("reason"in t)?Error(u(600)):e;default:if(typeof t.status=="string")t.then(Oa,Oa);else{if(e=Ct,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=a}},function(a){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Tm(e),e}throw dl=t,Gl}}function ul(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(dl=n,Gl):n}}var dl=null;function km(){if(dl===null)throw Error(u(459));var e=dl;return dl=null,e}function Tm(e){if(e===Gl||e===xr)throw Error(u(483))}var Xl=null,qi=0;function wr(e){var t=qi;return qi+=1,Xl===null&&(Xl=[]),Am(Xl,e,t)}function As(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ar(e,t){throw t.$$typeof===J?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function jm(e){function t(R,E){if(e){var B=R.deletions;B===null?(R.deletions=[E],R.flags|=16):B.push(E)}}function n(R,E){if(!e)return null;for(;E!==null;)t(R,E),E=E.sibling;return null}function a(R){for(var E=new Map;R!==null;)R.key===null?E.set(R.index,R):E.set(R.key,R),R=R.sibling;return E}function o(R,E){return R=es(R,E),R.index=0,R.sibling=null,R}function r(R,E,B){return R.index=B,e?(B=R.alternate,B!==null?(B=B.index,B<E?(R.flags|=2,E):B):(R.flags|=134217730,E)):(R.flags|=1048576,E)}function f(R){return e&&R.alternate===null&&(R.flags|=134217730),R}function p(R,E,B,te){return E===null||E.tag!==6?(E=bu(B,R.mode,te),E.return=R,E):(E=o(E,B),E.return=R,E)}function k(R,E,B,te){var Ee=B.type;return Ee===Q?(R=G(R,E,B.props.children,te,B.key),As(R,B),R):E!==null&&(E.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===Ae&&ul(Ee)===E.type)?(E=o(E,B.props),As(E,B),E.return=R,E):(E=fr(B.type,B.key,B.props,null,R.mode,te),As(E,B),E.return=R,E)}function O(R,E,B,te){return E===null||E.tag!==4||E.stateNode.containerInfo!==B.containerInfo||E.stateNode.implementation!==B.implementation?(E=xu(B,R.mode,te),E.return=R,E):(E=o(E,B.children||[]),E.return=R,E)}function G(R,E,B,te,Ee){return E===null||E.tag!==7?(E=al(B,R.mode,te,Ee),E.return=R,E):(E=o(E,B),E.return=R,E)}function ne(R,E,B){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=bu(""+E,R.mode,B),E.return=R,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case se:return B=fr(E.type,E.key,E.props,null,R.mode,B),As(B,E),B.return=R,B;case $:return E=xu(E,R.mode,B),E.return=R,E;case Ae:return E=ul(E),ne(R,E,B)}if(Le(E)||xe(E))return E=al(E,R.mode,B,null),E.return=R,E;if(typeof E.then=="function")return ne(R,wr(E),B);if(E.$$typeof===Ce)return ne(R,vr(R,E),B);Ar(R,E)}return null}function _(R,E,B,te){var Ee=E!==null?E.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return Ee!==null?null:p(R,E,""+B,te);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case se:return B.key===Ee?k(R,E,B,te):null;case $:return B.key===Ee?O(R,E,B,te):null;case Ae:return B=ul(B),_(R,E,B,te)}if(Le(B)||xe(B))return Ee!==null?null:G(R,E,B,te,null);if(typeof B.then=="function")return _(R,E,wr(B),te);if(B.$$typeof===Ce)return _(R,E,vr(R,B),te);Ar(R,B)}return null}function H(R,E,B,te,Ee){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return R=R.get(B)||null,p(E,R,""+te,Ee);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case se:return R=R.get(te.key===null?B:te.key)||null,k(E,R,te,Ee);case $:return R=R.get(te.key===null?B:te.key)||null,O(E,R,te,Ee);case Ae:return te=ul(te),H(R,E,B,te,Ee)}if(Le(te)||xe(te))return R=R.get(B)||null,G(E,R,te,Ee,null);if(typeof te.then=="function")return H(R,E,B,wr(te),Ee);if(te.$$typeof===Ce)return H(R,E,B,vr(E,te),Ee);Ar(E,te)}return null}function we(R,E,B,te){for(var Ee=null,rt=null,Ue=E,Xe=E=0,Ft=null;Ue!==null&&Xe<B.length;Xe++){Ue.index>Xe?(Ft=Ue,Ue=null):Ft=Ue.sibling;var ft=_(R,Ue,B[Xe],te);if(ft===null){Ue===null&&(Ue=Ft);break}e&&Ue&&ft.alternate===null&&t(R,Ue),E=r(ft,E,Xe),rt===null?Ee=ft:rt.sibling=ft,rt=ft,Ue=Ft}if(Xe===B.length)return n(R,Ue),et&&ts(R,Xe),Ee;if(Ue===null){for(;Xe<B.length;Xe++)Ue=ne(R,B[Xe],te),Ue!==null&&(E=r(Ue,E,Xe),rt===null?Ee=Ue:rt.sibling=Ue,rt=Ue);return et&&ts(R,Xe),Ee}for(Ue=a(Ue);Xe<B.length;Xe++)Ft=H(Ue,R,Xe,B[Xe],te),Ft!==null&&(e&&(ft=Ft.alternate,ft!==null&&Ue.delete(ft.key===null?Xe:ft.key)),E=r(Ft,E,Xe),rt===null?Ee=Ft:rt.sibling=Ft,rt=Ft);return e&&Ue.forEach(function(qs){return t(R,qs)}),et&&ts(R,Xe),Ee}function _e(R,E,B,te){if(B==null)throw Error(u(151));for(var Ee=null,rt=null,Ue=E,Xe=E=0,Ft=null,ft=B.next();Ue!==null&&!ft.done;Xe++,ft=B.next()){Ue.index>Xe?(Ft=Ue,Ue=null):Ft=Ue.sibling;var qs=_(R,Ue,ft.value,te);if(qs===null){Ue===null&&(Ue=Ft);break}e&&Ue&&qs.alternate===null&&t(R,Ue),E=r(qs,E,Xe),rt===null?Ee=qs:rt.sibling=qs,rt=qs,Ue=Ft}if(ft.done)return n(R,Ue),et&&ts(R,Xe),Ee;if(Ue===null){for(;!ft.done;Xe++,ft=B.next())ft=ne(R,ft.value,te),ft!==null&&(E=r(ft,E,Xe),rt===null?Ee=ft:rt.sibling=ft,rt=ft);return et&&ts(R,Xe),Ee}for(Ue=a(Ue);!ft.done;Xe++,ft=B.next())ft=H(Ue,R,Xe,ft.value,te),ft!==null&&(e&&(Ft=ft.alternate,Ft!==null&&Ue.delete(Ft.key===null?Xe:Ft.key)),E=r(ft,E,Xe),rt===null?Ee=ft:rt.sibling=ft,rt=ft);return e&&Ue.forEach(function(jS){return t(R,jS)}),et&&ts(R,Xe),Ee}function Pe(R,E,B,te){if(typeof B=="object"&&B!==null&&B.type===Q&&B.key===null&&B.props.ref===void 0&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case se:e:{for(var Ee=B.key;E!==null;){if(E.key===Ee){if(Ee=B.type,Ee===Q){if(E.tag===7){n(R,E.sibling),te=o(E,B.props.children),As(te,B),te.return=R,R=te;break e}}else if(E.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===Ae&&ul(Ee)===E.type){n(R,E.sibling),te=o(E,B.props),As(te,B),te.return=R,R=te;break e}n(R,E);break}else t(R,E);E=E.sibling}B.type===Q?(te=al(B.props.children,R.mode,te,B.key),As(te,B),te.return=R,R=te):(te=fr(B.type,B.key,B.props,null,R.mode,te),As(te,B),te.return=R,R=te)}return f(R);case $:e:{for(Ee=B.key;E!==null;){if(E.key===Ee)if(E.tag===4&&E.stateNode.containerInfo===B.containerInfo&&E.stateNode.implementation===B.implementation){n(R,E.sibling),te=o(E,B.children||[]),te.return=R,R=te;break e}else{n(R,E);break}else t(R,E);E=E.sibling}te=xu(B,R.mode,te),te.return=R,R=te}return f(R);case Ae:return B=ul(B),Pe(R,E,B,te)}if(Le(B))return we(R,E,B,te);if(xe(B)){if(Ee=xe(B),typeof Ee!="function")throw Error(u(150));return B=Ee.call(B),_e(R,E,B,te)}if(typeof B.then=="function")return Pe(R,E,wr(B),te);if(B.$$typeof===Ce)return Pe(R,E,vr(R,B),te);Ar(R,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,E!==null&&E.tag===6?(n(R,E.sibling),te=o(E,B),te.return=R,R=te):(n(R,E),te=bu(B,R.mode,te),te.return=R,R=te),f(R)):n(R,E)}return function(R,E,B,te){try{qi=0;var Ee=Pe(R,E,B,te);return Xl=null,Ee}catch(Ue){if(Ue===Gl||Ue===xr)throw Ue;var rt=Rn(29,Ue,null,R.mode);return rt.lanes=te,rt.return=R,rt}finally{}}}var fl=jm(!0),Nm=jm(!1),ks=!1;function Mu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _u(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ts(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function js(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(bt&2)!==0){var o=a.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),a.pending=t,t=dr(e),um(e,null,n),t}return ur(e,a,t,n),dr(e)}function Gi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Qa(e,n)}}function Ru(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var o=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?o=r=f:r=r.next=f,n=n.next}while(n!==null);r===null?o=r=t:r=r.next=t}else o=r=t;n={baseState:a.baseState,firstBaseUpdate:o,lastBaseUpdate:r,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ou=!1;function Xi(){if(Ou){var e=ql;if(e!==null)throw e}}function Yi(e,t,n,a){Ou=!1;var o=e.updateQueue;ks=!1;var r=o.firstBaseUpdate,f=o.lastBaseUpdate,p=o.shared.pending;if(p!==null){o.shared.pending=null;var k=p,O=k.next;k.next=null,f===null?r=O:f.next=O,f=k;var G=e.alternate;G!==null&&(G=G.updateQueue,p=G.lastBaseUpdate,p!==f&&(p===null?G.firstBaseUpdate=O:p.next=O,G.lastBaseUpdate=k))}if(r!==null){var ne=o.baseState;f=0,G=O=k=null,p=r;do{var _=p.lane&-536870913,H=_!==p.lane;if(H?(ot&_)===_:(a&_)===_){_!==0&&_===rl&&(Ou=!0),G!==null&&(G=G.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var we=e,_e=p;_=t;var Pe=n;switch(_e.tag){case 1:if(we=_e.payload,typeof we=="function"){ne=we.call(Pe,ne,_);break e}ne=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=_e.payload,_=typeof we=="function"?we.call(Pe,ne,_):we,_==null)break e;ne=X({},ne,_);break e;case 2:ks=!0}}_=p.callback,_!==null&&(e.flags|=64,H&&(e.flags|=8192),H=o.callbacks,H===null?o.callbacks=[_]:H.push(_))}else H={lane:_,tag:p.tag,payload:p.payload,callback:p.callback,next:null},G===null?(O=G=H,k=ne):G=G.next=H,f|=_;if(p=p.next,p===null){if(p=o.shared.pending,p===null)break;H=p,p=H.next,H.next=null,o.lastBaseUpdate=H,o.shared.pending=null}}while(!0);G===null&&(k=ne),o.baseState=k,o.firstBaseUpdate=O,o.lastBaseUpdate=G,r===null&&(o.shared.lanes=0),Os|=f,e.lanes=f,e.memoizedState=ne}}function Em(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Cm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Em(n[e],t)}var Ns=be(null),kr=be(0);function Mm(e,t){e=rs,Me(kr,e),Me(Ns,t),rs=e|t.baseLanes}function Du(){Me(kr,rs),Me(Ns,Ns.current)}function Lu(){rs=kr.current,Be(Ns),Be(kr)}var cn=be(null),bn=null;function Es(e){var t=e.alternate;Me(un,un.current&1),Me(cn,e),bn===null&&(t===null||Ns.current!==null||t.memoizedState!==null)&&(bn=e)}function zu(e){Me(un,un.current),Me(cn,e),bn===null&&(bn=e)}function _m(e){e.tag===22?(Me(un,un.current),Me(cn,e),bn===null&&(bn=e)):Cs()}function Cs(){Me(un,un.current),Me(cn,cn.current)}function Yn(e){Be(cn),bn===e&&(bn=null),Be(un)}var un=be(0);function Vi(e,t){Me(cn,cn.current),Me(un,t)}function Uu(e){Be(un),Be(cn),bn===e&&(bn=null)}function Tr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||of(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)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 ss=0,Ze=null,Nt=null,Zt=null,jr=!1,Yl=!1,hl=!1,Nr=0,Qi=0,Vl=null,Qb=0;function $t(){throw Error(u(321))}function Iu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Xn(e[n],t[n]))return!1;return!0}function Bu(e,t,n,a,o,r){return ss=r,Ze=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,me.H=e===null||e.memoizedState===null?mp:pp,hl=!1,r=n(a,o),hl=!1,Yl&&(r=Om(t,n,a,o)),Rm(e),r}function Rm(e){me.H=Dr;var t=Nt!==null&&Nt.next!==null;if(ss=0,Zt=Nt=Ze=null,jr=!1,Qi=0,Vl=null,t)throw Error(u(300));e===null||Pt||(e=e.dependencies,e!==null&&yr(e)&&(Pt=!0))}function Om(e,t,n,a){Ze=e;var o=0;do{if(Yl&&(Vl=null),Qi=0,Yl=!1,25<=o)throw Error(u(301));if(o+=1,Zt=Nt=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}me.H=tx,r=t(n,a)}while(Yl);return r}function Kb(){var e=me.H,t=e.useState()[0];return t=typeof t.then=="function"?Ki(t):t,e=e.useState()[0],(Nt!==null?Nt.memoizedState:null)!==e&&(Ze.flags|=1024),t}function Hu(){var e=Nr!==0;return Nr=0,e}function $u(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function qu(e){if(jr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}jr=!1}ss=0,Zt=Nt=Ze=null,Yl=!1,Qi=Nr=0,Vl=null}function Tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Ze.memoizedState=Zt=e:Zt=Zt.next=e,Zt}function Xt(){if(Nt===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=Nt.next;var t=Zt===null?Ze.memoizedState:Zt.next;if(t!==null)Zt=t,Nt=e;else{if(e===null)throw Ze.alternate===null?Error(u(467)):Error(u(310));Nt=e,e={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Zt===null?Ze.memoizedState=Zt=e:Zt=Zt.next=e}return Zt}function Er(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ki(e){var t=Qi;return Qi+=1,Vl===null&&(Vl=[]),e=Am(Vl,e,t),t=Ze,(Zt===null?t.memoizedState:Zt.next)===null&&(t=t.alternate,me.H=t===null||t.memoizedState===null?mp:pp),e}function Cr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ki(e);if(e.$$typeof===ae)return;if(e.$$typeof===Ce)return rn(e)}throw Error(u(438,String(e)))}function Gu(e){var t=null,n=Ze.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Ze.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Er(),Ze.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=gt;return t.index++,n}function ls(e,t){return typeof t=="function"?t(e):t}function Mr(e){var t=Xt();return Xu(t,Nt,e)}function Xu(e,t,n){var a=e.queue;if(a===null)throw Error(u(311));a.lastRenderedReducer=n;var o=e.baseQueue,r=a.pending;if(r!==null){if(o!==null){var f=o.next;o.next=r.next,r.next=f}t.baseQueue=o=r,a.pending=null}if(r=e.baseState,o===null)e.memoizedState=r;else{t=o.next;var p=f=null,k=null,O=t,G=!1;do{var ne=O.lane&-536870913;if(ne!==O.lane?(ot&ne)===ne:(ss&ne)===ne){var _=O.revertLane;if(_===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),ne===rl&&(G=!0);else if((ss&_)===_){O=O.next,_===rl&&(G=!0);continue}else ne={lane:0,revertLane:O.revertLane,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},k===null?(p=k=ne,f=r):k=k.next=ne,Ze.lanes|=_,Os|=_;ne=O.action,hl&&n(r,ne),r=O.hasEagerState?O.eagerState:n(r,ne)}else _={lane:ne,revertLane:O.revertLane,gesture:O.gesture,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},k===null?(p=k=_,f=r):k=k.next=_,Ze.lanes|=ne,Os|=ne;O=O.next}while(O!==null&&O!==t);if(k===null?f=r:k.next=p,!Xn(r,e.memoizedState)&&(Pt=!0,G&&(n=ql,n!==null)))throw n;e.memoizedState=r,e.baseState=f,e.baseQueue=k,a.lastRenderedState=r}return o===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Yu(e){var t=Xt(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var a=n.dispatch,o=n.pending,r=t.memoizedState;if(o!==null){n.pending=null;var f=o=o.next;do r=e(r,f.action),f=f.next;while(f!==o);Xn(r,t.memoizedState)||(Pt=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function Dm(e,t,n){var a=Ze,o=Xt(),r=et;if(r){if(n===void 0)throw Error(u(407));n=n()}else n=t();var f=!Xn((Nt||o).memoizedState,n);if(f&&(o.memoizedState=n,Pt=!0),o=o.queue,Ku(Um.bind(null,a,o,e),[e]),e=o.getSnapshot!==t||f||Zt!==null&&(Zt.memoizedState.tag&1)!==0,Ql(e?9:8,{destroy:void 0},zm.bind(null,a,o,n,t),null),e){if(a.flags|=2048,Ct===null)throw Error(u(349));r||(ss&127)!==0||Lm(a,t,n)}return n}function Lm(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ze.updateQueue,t===null?(t=Er(),Ze.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zm(e,t,n,a){t.value=n,t.getSnapshot=a,Im(t)&&Bm(e)}function Um(e,t,n){return n(function(){Im(t)&&Bm(e)})}function Im(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xn(e,n)}catch{return!0}}function Bm(e){var t=nl(e,2);t!==null&&zn(t,e,2)}function Vu(e){var t=Tn();if(typeof e=="function"){var n=e;if(e=n(),hl){M(!0);try{n()}finally{M(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:e},t}function Hm(e,t,n,a){return e.baseState=n,Xu(e,Nt,typeof a=="function"?a:ls)}function Zb(e,t,n,a,o){if(Or(e))throw Error(u(485));if(e=t.action,e!==null){var r={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){r.listeners.push(f)}};me.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,$m(t,r)):(r.next=n.next,t.pending=n.next=r)}}function $m(e,t){var n=t.action,a=t.payload,o=e.state;if(t.isTransition){var r=me.T,f={};f.types=r!==null?r.types:null,me.T=f;try{var p=n(o,a),k=me.S;k!==null&&k(f,p),qm(e,t,p)}catch(O){Qu(e,t,O)}finally{r!==null&&f.types!==null&&(r.types=f.types),me.T=r}}else try{r=n(o,a),qm(e,t,r)}catch(O){Qu(e,t,O)}}function qm(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){Gm(e,t,a)},function(a){return Qu(e,t,a)}):Gm(e,t,n)}function Gm(e,t,n){t.status="fulfilled",t.value=n,Xm(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$m(e,n)))}function Qu(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,Xm(t),t=t.next;while(t!==a)}e.action=null}function Xm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ym(e,t){return t}function Vm(e,t){if(et){var n=Ct.formState;if(n!==null){e:{var a=Ze;if(et){if(Mt){t:{for(var o=Mt,r=ca;o.nodeType!==8;){if(!r){o=null;break t}if(o=da(o.nextSibling),o===null){o=null;break t}}r=o.data,o=r==="F!"||r==="F"?o:null}if(o){Mt=da(o.nextSibling),a=o.data==="F!";break e}}Ss(a)}a=!1}a&&(t=n[0])}}return n=Tn(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ym,lastRenderedState:t},n.queue=a,n=dp.bind(null,Ze,a),a.dispatch=n,a=Vu(!1),r=Wu.bind(null,Ze,!1,a.queue),a=Tn(),o={state:t,dispatch:null,action:e,pending:null},a.queue=o,n=Zb.bind(null,Ze,o,r,n),o.dispatch=n,a.memoizedState=e,[t,n,!1]}function Qm(e){var t=Xt();return Km(t,Nt,e)}function Km(e,t,n){if(t=Xu(e,t,Ym)[0],e=Mr(ls)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ki(t)}catch(f){throw f===Gl?xr:f}else a=t;t=Xt();var o=t.queue,r=o.dispatch;return n!==t.memoizedState&&(Ze.flags|=2048,Ql(9,{destroy:void 0},Pb.bind(null,o,n),null)),[a,r,e]}function Pb(e,t){e.action=t}function Zm(e){var t=Xt(),n=Nt;if(n!==null)return Km(t,n,e);Xt(),t=t.memoizedState,n=Xt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Ql(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Ze.updateQueue,t===null&&(t=Er(),Ze.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Pm(){return Xt().memoizedState}function _r(e,t,n,a){var o=Tn();Ze.flags|=e,o.memoizedState=Ql(1|t,{destroy:void 0},n,a===void 0?null:a)}function Rr(e,t,n,a){var o=Xt();a=a===void 0?null:a;var r=o.memoizedState.inst;Nt!==null&&a!==null&&Iu(a,Nt.memoizedState.deps)?o.memoizedState=Ql(t,r,n,a):(Ze.flags|=e,o.memoizedState=Ql(1|t,r,n,a))}function Fm(e,t){_r(8390656,8,e,t)}function Ku(e,t){Rr(2048,8,e,t)}function Fb(e){Ze.flags|=4;var t=Ze.updateQueue;if(t===null)t=Er(),Ze.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Jm(e){var t=Xt().memoizedState;return Fb({ref:t,nextImpl:e}),function(){if((bt&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function Wm(e,t){return Rr(4,2,e,t)}function ep(e,t){return Rr(4,4,e,t)}function tp(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function np(e,t,n){n=n!=null?n.concat([e]):null,Rr(4,4,tp.bind(null,t,e),n)}function Zu(){}function ap(e,t){var n=Xt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Iu(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function sp(e,t){var n=Xt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Iu(t,a[1]))return a[0];if(a=e(),hl){M(!0);try{e()}finally{M(!1)}}return n.memoizedState=[a,t],a}function Pu(e,t,n){return n===void 0||(ss&1073741824)!==0&&(ot&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=mg(),Ze.lanes|=e,Os|=e,n)}function lp(e,t,n,a){return Xn(n,t)?n:Ns.current!==null?(e=Pu(e,n,a),Xn(e,t)||(Pt=!0),e):(ss&106)===0||(ss&1073741824)!==0&&(ot&261930)===0?(Pt=!0,e.memoizedState=n):(e=mg(),Ze.lanes|=e,Os|=e,t)}function ip(e,t,n,a,o){var r=De.p;De.p=r!==0&&8>r?r:8;var f=me.T,p={};p.types=f!==null?f.types:null,me.T=p,Wu(e,!1,t,n);try{var k=o(),O=me.S;if(O!==null&&O(p,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var G=Vb(k,a);Zi(e,t,G,Zn(e))}else Zi(e,t,a,Zn(e))}catch(ne){Zi(e,t,{then:function(){},status:"rejected",reason:ne},Zn())}finally{De.p=r,f!==null&&p.types!==null&&(f.types=p.types),me.T=f}}function Jb(){}function Fu(e,t,n,a){if(e.tag!==5)throw Error(u(476));var o=op(e).queue;ip(e,o,t,tt,n===null?Jb:function(){return rp(e),n(a)})}function op(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:tt,baseState:tt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:tt},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function rp(e){var t=op(e);t.next===null&&(t=e.alternate.memoizedState),Zi(e,t.next.queue,{},Zn())}function Ju(){return rn(fi)}function cp(){return Xt().memoizedState}function up(){return Xt().memoizedState}function Wb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Zn();e=Ts(n);var a=js(t,e,n);a!==null&&(zn(a,t,n),Gi(a,t,n)),t={cache:ju()},e.payload=t;return}t=t.return}}function ex(e,t,n){var a=Zn();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Or(e)?fp(t,n):(n=yu(e,t,n,a),n!==null&&(zn(n,e,a),hp(n,t,a)))}function dp(e,t,n){var a=Zn();Zi(e,t,n,a)}function Zi(e,t,n,a){var o={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Or(e))fp(t,o);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var f=t.lastRenderedState,p=r(f,n);if(o.hasEagerState=!0,o.eagerState=p,Xn(p,f))return ur(e,t,o,0),Ct===null&&cr(),!1}catch{}finally{}if(n=yu(e,t,o,a),n!==null)return zn(n,e,a),hp(n,t,a),!0}return!1}function Wu(e,t,n,a){if(a={lane:2,revertLane:Gd(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Or(e)){if(t)throw Error(u(479))}else t=yu(e,n,a,2),t!==null&&zn(t,e,2)}function Or(e){var t=e.alternate;return e===Ze||t!==null&&t===Ze}function fp(e,t){Yl=jr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hp(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Qa(e,n)}}var Dr={readContext:rn,use:Cr,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t,useEffectEvent:$t},mp={readContext:rn,use:Cr,useCallback:function(e,t){return Tn().memoizedState=[e,t===void 0?null:t],e},useContext:rn,useEffect:Fm,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,_r(4194308,4,tp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _r(4194308,4,e,t)},useInsertionEffect:function(e,t){_r(4,2,e,t)},useMemo:function(e,t){var n=Tn();t=t===void 0?null:t;var a=e();if(hl){M(!0);try{e()}finally{M(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Tn();if(n!==void 0){var o=n(t);if(hl){M(!0);try{n(t)}finally{M(!1)}}}else o=t;return a.memoizedState=a.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},a.queue=e,e=e.dispatch=ex.bind(null,Ze,e),[a.memoizedState,e]},useRef:function(e){var t=Tn();return e={current:e},t.memoizedState=e},useState:function(e){e=Vu(e);var t=e.queue,n=dp.bind(null,Ze,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Zu,useDeferredValue:function(e,t){var n=Tn();return Pu(n,e,t)},useTransition:function(){var e=Vu(!1);return e=ip.bind(null,Ze,e.queue,!0,!1),Tn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Ze,o=Tn();if(et){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),Ct===null)throw Error(u(349));(ot&127)!==0||Lm(a,t,n)}o.memoizedState=n;var r={value:n,getSnapshot:t};return o.queue=r,Fm(Um.bind(null,a,r,e),[e]),a.flags|=2048,Ql(9,{destroy:void 0},zm.bind(null,a,r,n,t),null),n},useId:function(){var e=Tn(),t=Ct.identifierPrefix;if(et){var n=La,a=Da;n=(a&~(1<<32-le(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Nr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Qb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ju,useFormState:Vm,useActionState:Vm,useOptimistic:function(e){var t=Tn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Wu.bind(null,Ze,!0,n),n.dispatch=t,[e,t]},useMemoCache:Gu,useCacheRefresh:function(){return Tn().memoizedState=Wb.bind(null,Ze)},useEffectEvent:function(e){var t=Tn(),n={impl:e};return t.memoizedState=n,function(){if((bt&2)!==0)throw Error(u(440));return n.impl.apply(void 0,arguments)}}},pp={readContext:rn,use:Cr,useCallback:ap,useContext:rn,useEffect:Ku,useImperativeHandle:np,useInsertionEffect:Wm,useLayoutEffect:ep,useMemo:sp,useReducer:Mr,useRef:Pm,useState:function(){return Mr(ls)},useDebugValue:Zu,useDeferredValue:function(e,t){var n=Xt();return lp(n,Nt.memoizedState,e,t)},useTransition:function(){var e=Mr(ls)[0],t=Xt().memoizedState;return[typeof e=="boolean"?e:Ki(e),t]},useSyncExternalStore:Dm,useId:cp,useHostTransitionStatus:Ju,useFormState:Qm,useActionState:Qm,useOptimistic:function(e,t){var n=Xt();return Hm(n,Nt,e,t)},useMemoCache:Gu,useCacheRefresh:up,useEffectEvent:Jm},tx={readContext:rn,use:Cr,useCallback:ap,useContext:rn,useEffect:Ku,useImperativeHandle:np,useInsertionEffect:Wm,useLayoutEffect:ep,useMemo:sp,useReducer:Yu,useRef:Pm,useState:function(){return Yu(ls)},useDebugValue:Zu,useDeferredValue:function(e,t){var n=Xt();return Nt===null?Pu(n,e,t):lp(n,Nt.memoizedState,e,t)},useTransition:function(){var e=Yu(ls)[0],t=Xt().memoizedState;return[typeof e=="boolean"?e:Ki(e),t]},useSyncExternalStore:Dm,useId:cp,useHostTransitionStatus:Ju,useFormState:Zm,useActionState:Zm,useOptimistic:function(e,t){var n=Xt();return Nt!==null?Hm(n,Nt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Gu,useCacheRefresh:up,useEffectEvent:Jm};function ed(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:X({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var td={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Zn(),o=Ts(a);o.payload=t,n!=null&&(o.callback=n),t=js(e,o,a),t!==null&&(zn(t,e,a),Gi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Zn(),o=Ts(a);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=js(e,o,a),t!==null&&(zn(t,e,a),Gi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zn(),a=Ts(n);a.tag=2,t!=null&&(a.callback=t),t=js(e,a,n),t!==null&&(zn(t,e,n),Gi(t,e,n))}};function gp(e,t,n,a,o,r,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,f):t.prototype&&t.prototype.isPureReactComponent?!Li(n,a)||!Li(o,r):!0}function yp(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&td.enqueueReplaceState(t,t.state,null)}function ml(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=X({},n));for(var o in e)n[o]===void 0&&(n[o]=e[o])}return n}function vp(e){rr(e)}function bp(e){console.error(e)}function xp(e){rr(e)}function Lr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Sp(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function nd(e,t,n){return n=Ts(n),n.tag=3,n.payload={element:null},n.callback=function(){Lr(e,t)},n}function wp(e){return e=Ts(e),e.tag=3,e}function Ap(e,t,n,a){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var r=a.value;e.payload=function(){return o(r)},e.callback=function(){Sp(t,n,a)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Sp(t,n,a),typeof o!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var p=a.stack;this.componentDidCatch(a.value,{componentStack:p!==null?p:""})})}function nx(e,t,n,a,o){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&il(t,n,o,!0),n=cn.current,n!==null){switch(n.tag){case 31:case 13:case 19:return bn===null?nc():n.alternate===null&&qt===0&&(qt=3),n.flags&=-257,n.flags|=65536,n.lanes=o,a===Sr?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Hd(e,a,o)),!1;case 22:return n.flags|=65536,a===Sr?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Hd(e,a,o)),!1}throw Error(u(435,n.tag))}return Hd(e,a,o),nc(),!1}if(et)return t=cn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,a!==wu&&(e=Error(u(422),{cause:a}),Ii(ia(e,n)))):(a!==wu&&(t=Error(u(423),{cause:a}),Ii(ia(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,a=ia(a,n),o=nd(e.stateNode,a,o),Ru(e,o),qt!==4&&(qt=2)),!1;var r=Error(u(520),{cause:a});if(r=ia(r,n),ao===null?ao=[r]:ao.push(r),qt!==4&&(qt=2),t===null)return!0;a=ia(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=nd(n.stateNode,a,e),Ru(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Ds===null||!Ds.has(r))))return n.flags|=65536,o&=-o,n.lanes|=o,o=wp(o),Ap(o,e,n,a),Ru(n,o),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var ad=Error(u(461)),Pt=!1;function Wt(e,t,n,a){t.child=e===null?Nm(t,null,n,a):fl(t,e.child,n,a)}function kp(e,t,n,a,o){n=n.render;var r=t.ref;if("ref"in a){var f={};for(var p in a)p!=="ref"&&(f[p]=a[p])}else f=a;return ol(t),a=Bu(e,t,n,f,r,o),p=Hu(),e!==null&&!Pt?($u(e,t,o),is(e,t,o)):(et&&p&&mr(t),t.flags|=1,Wt(e,t,a,o),t.child)}function Tp(e,t,n,a,o){if(e===null){var r=n.type;return typeof r=="function"&&!vu(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,jp(e,t,r,a,o)):(e=fr(n.type,null,a,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!dd(e,o)){var f=r.memoizedProps;if(n=n.compare,n=n!==null?n:Li,n(f,a)&&e.ref===t.ref)return is(e,t,o)}return t.flags|=1,e=es(r,a),e.ref=t.ref,e.return=t,t.child=e}function jp(e,t,n,a,o){if(e!==null){var r=e.memoizedProps;if(Li(r,a)&&e.ref===t.ref)if(Pt=!1,t.pendingProps=a=r,dd(e,o))(e.flags&131072)!==0&&(Pt=!0);else return t.lanes=e.lanes,is(e,t,o)}return sd(e,t,n,a,o)}function Np(e,t,n,a){var o=a.children,r=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(r=r!==null?r.baseLanes|n:n,e!==null){for(a=t.child=e.child,o=0;a!==null;)o=o|a.lanes|a.childLanes,a=a.sibling;a=o&~r}else a=0,t.child=null;return Ep(e,t,r,n,a)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&br(t,r!==null?r.cachePool:null),r!==null?Mm(t,r):Du(),_m(t);else return a=t.lanes=536870912,Ep(e,t,r!==null?r.baseLanes|n:n,n,a)}else r!==null?(br(t,r.cachePool),Mm(t,r),Cs(),t.memoizedState=null):(e!==null&&br(t,null),Du(),Cs());return Wt(e,t,o,n),t.child}function Pi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ep(e,t,n,a,o){var r=Eu();return r=r===null?null:{parent:Kt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&br(t,null),Du(),_m(t),e!==null&&il(e,t,a,!0),t.childLanes=o,null}function zr(e,t){return t=Ur({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Cp(e,t,n){return fl(t,e.child,null,n),e=zr(t,t.pendingProps),e.flags|=2,Yn(t),t.memoizedState=null,e}function ax(e,t,n){var a=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(et){if(a.mode==="hidden")return e=zr(t,a),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Pi(null,e);if(zu(t),(e=Mt)?(e=ty(e,ca),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bs!==null?{id:Da,overflow:La}:null,retryLane:536870912,hydrationErrors:null},n=fm(e),n.return=t,t.child=n,nn=t,Mt=null)):e=null,e===null)throw Ss(t);return t.lanes=536870912,null}return zr(t,a)}var r=e.memoizedState;if(r!==null){var f=r.dehydrated;if(zu(t),o)if(t.flags&256)t.flags&=-257,t=Cp(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(Pt||il(e,t,n,!1),o=(n&e.childLanes)!==0,Pt||o){if(Ns.current===null){if(a=Ct,a!==null&&(f=Ma(a,n),f!==0&&f!==r.retryLane))throw r.retryLane=f,nl(e,f),zn(a,e,f),ad;nc()}t=Cp(e,t,n)}else e=r.treeContext,Mt=da(f.nextSibling),nn=t,et=!0,xs=null,ca=!1,e!==null&&pm(t,e),t=zr(t,a),t.flags|=134221824;return t}return e=es(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kl(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(u(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function sd(e,t,n,a,o){return ol(t),n=Bu(e,t,n,a,void 0,o),a=Hu(),e!==null&&!Pt?($u(e,t,o),is(e,t,o)):(et&&a&&mr(t),t.flags|=1,Wt(e,t,n,o),t.child)}function Mp(e,t,n,a,o,r){return ol(t),t.updateQueue=null,n=Om(t,a,n,o),Rm(e),a=Hu(),e!==null&&!Pt?($u(e,t,r),is(e,t,r)):(et&&a&&mr(t),t.flags|=1,Wt(e,t,n,r),t.child)}function _p(e,t,n,a,o){if(ol(t),t.stateNode===null){var r=Il,f=n.contextType;typeof f=="object"&&f!==null&&(r=rn(f)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=td,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},Mu(t),f=n.contextType,r.context=typeof f=="object"&&f!==null?rn(f):Il,r.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(ed(t,n,f,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(f=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),f!==r.state&&td.enqueueReplaceState(r,r.state,null),Yi(t,a,r,o),Xi(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var p=t.memoizedProps,k=ml(n,p);r.props=k;var O=r.context,G=n.contextType;f=Il,typeof G=="object"&&G!==null&&(f=rn(G));var ne=n.getDerivedStateFromProps;G=typeof ne=="function"||typeof r.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,G||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(p||O!==f)&&yp(t,r,a,f),ks=!1;var _=t.memoizedState;r.state=_,Yi(t,a,r,o),Xi(),O=t.memoizedState,p||_!==O||ks?(typeof ne=="function"&&(ed(t,n,ne,a),O=t.memoizedState),(k=ks||gp(t,n,k,a,_,O,f))?(G||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=O),r.props=a,r.state=O,r.context=f,a=k):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,_u(e,t),f=t.memoizedProps,G=ml(n,f),r.props=G,ne=t.pendingProps,_=r.context,O=n.contextType,k=Il,typeof O=="object"&&O!==null&&(k=rn(O)),p=n.getDerivedStateFromProps,(O=typeof p=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(f!==ne||_!==k)&&yp(t,r,a,k),ks=!1,_=t.memoizedState,r.state=_,Yi(t,a,r,o),Xi();var H=t.memoizedState;f!==ne||_!==H||ks||e!==null&&e.dependencies!==null&&yr(e.dependencies)?(typeof p=="function"&&(ed(t,n,p,a),H=t.memoizedState),(G=ks||gp(t,n,G,a,_,H,k)||e!==null&&e.dependencies!==null&&yr(e.dependencies))?(O||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,H,k),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,H,k)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=H),r.props=a,r.state=H,r.context=k,a=G):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,Kl(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=fl(t,e.child,null,o),t.child=fl(t,null,n,o)):Wt(e,t,n,o),t.memoizedState=r.state,e=t.child):e=is(e,t,o),e}function Rp(e,t,n,a){return sl(),t.flags|=256,Wt(e,t,n,a),t.child}var ld={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function id(e){return{baseLanes:e,cachePool:Sm()}}function od(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kn),e}function Op(e,t,n){var a=t.pendingProps,o=!1,r=(t.flags&128)!==0,f;if((f=r)||(f=e!==null&&e.memoizedState===null?!1:(un.current&2)!==0),f&&(o=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(et){if(o?Es(t):Cs(),(e=Mt)?(e=ty(e,ca),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bs!==null?{id:Da,overflow:La}:null,retryLane:536870912,hydrationErrors:null},n=fm(e),n.return=t,t.child=n,nn=t,Mt=null)):e=null,e===null)throw Ss(t);return of(e)?t.lanes=32:t.lanes=536870912,null}return r=a.children,a=a.fallback,o?(Cs(),o=t.mode,r=Ur({mode:"hidden",children:r},o),a=al(a,o,n,null),r.return=t,a.return=t,r.sibling=a,t.child=r,a=t.child,a.memoizedState=id(n),a.childLanes=od(e,f,n),t.memoizedState=ld,Pi(null,a)):(Es(t),rd(t,r))}var p=e.memoizedState;if(p!==null){var k=p.dehydrated;if(k!==null)return sx(e,t,r,f,a,k,p,n)}return o?(Cs(),o=a.fallback,r=t.mode,p=e.child,k=p.sibling,a=es(p,{mode:"hidden",children:a.children}),a.subtreeFlags=p.subtreeFlags&1206910976,k!==null?o=es(k,o):(o=al(o,r,n,null),o.flags|=2),o.return=t,a.return=t,a.sibling=o,t.child=a,Pi(null,a),a=t.child,o=e.child.memoizedState,o===null?o=id(n):(r=o.cachePool,r!==null?(p=Kt._currentValue,r=r.parent!==p?{parent:p,pool:p}:r):r=Sm(),o={baseLanes:o.baseLanes|n,cachePool:r}),a.memoizedState=o,a.childLanes=od(e,f,n),t.memoizedState=ld,Pi(e.child,a)):(Es(t),n=e.child,e=n.sibling,n=es(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function rd(e,t){return t=Ur({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ur(e,t){return e=Rn(22,e,null,t),e.lanes=0,e}function Ir(e,t,n){return fl(t,e.child,null,n),e=rd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sx(e,t,n,a,o,r,f,p){if(n)return t.flags&256?(Es(t),t.flags&=-257,Ir(e,t,p)):t.memoizedState!==null?(Cs(),t.child=e.child,t.flags|=128,null):(Cs(),r=o.fallback,f=t.mode,o=Ur({mode:"visible",children:o.children},f),r=al(r,f,p,null),r.flags|=2,o.return=t,r.return=t,o.sibling=r,t.child=o,fl(t,e.child,null,p),o=t.child,o.memoizedState=id(p),o.childLanes=od(e,a,p),t.memoizedState=ld,Pi(null,o));if(Es(t),of(r)){if(a=r.nextSibling&&r.nextSibling.dataset,a)var k=a.dgst;return a=k,a!==""&&(o=Error(u(419)),o.stack="",o.digest=a,Ii({value:o,source:null,stack:null})),Ir(e,t,p)}if(Pt||il(e,t,p,!1),a=(p&e.childLanes)!==0,Pt||a){if(Ns.current!==null)return Ir(e,t,p);if(a=Ct,a!==null&&(o=Ma(a,p),o!==0&&o!==f.retryLane))throw f.retryLane=o,nl(e,o),zn(a,e,o),ad;return lf(r)||nc(),Ir(e,t,p)}return lf(r)?(t.flags|=192,t.child=e.child,null):(e=f.treeContext,Mt=da(r.nextSibling),nn=t,et=!0,xs=null,ca=!1,e!==null&&pm(t,e),t=rd(t,o.children),t.flags|=134221824,t)}function Dp(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),gr(e.return,t,n)}function Lp(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Tr(n)===null&&(t=e),e=e.sibling}return t}function Br(e,t,n,a,o,r){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:o,treeForkCount:r}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=a,f.tail=n,f.tailMode=o,f.treeForkCount=r)}function cd(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ud(e,t,n){var a=t.pendingProps,o=a.revealOrder,r=a.tail;a=a.children;var f=un.current;if(t.flags&128)return Vi(t,f),null;var p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,Vi(t,f),o==="backwards"&&e!==null?(cd(e),Wt(e,t,a,n),cd(e)):Wt(e,t,a,n),a=et?Ui:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dp(e,n,t);else if(e.tag===19)Dp(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}switch(o){case"backwards":n=Lp(t.child),n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null,cd(t)),Br(t,!0,o,null,r,a);break;case"unstable_legacy-backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Tr(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Br(t,!0,n,null,r,a);break;case"together":Br(t,!1,null,null,void 0,a);break;case"independent":t.memoizedState=null;break;default:n=Lp(t.child),n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Br(t,!1,o,n,r,a)}return t.child}function zp(e,t,n){var a=t.pendingProps;return ws(t,t.type,a.value),Wt(e,t,a.children,n),t.child}function is(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Os|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(il(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=es(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=es(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function dd(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&yr(e)))}function lx(e,t,n){switch(t.tag){case 3:q(t,t.stateNode.containerInfo),ws(t,Kt,e.memoizedState.cache),sl();break;case 27:case 5:$e(t);break;case 4:q(t,t.stateNode.containerInfo);break;case 10:ws(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,zu(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return Es(t),t.flags|=128,null;a=il(e,t,n,!1);var o=t.child.childLanes;return a||(n&o)!==0?Op(e,t,n):(Es(t),e=is(e,t,n),e!==null?e.sibling:null)}Es(t);break;case 19:if(t.flags&128)return ud(e,t,n);if(o=(e.flags&128)!==0,a=(n&t.childLanes)!==0,a||(il(e,t,n,!1),a=(n&t.childLanes)!==0),o){if(a)return ud(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Vi(t,un.current),a)break;return null;case 22:return t.lanes=0,Np(e,t,n,t.pendingProps);case 24:ws(t,Kt,e.memoizedState.cache)}return is(e,t,n)}function Up(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Pt=!0;else{if(!dd(e,n)&&(t.flags&128)===0)return Pt=!1,lx(e,t,n);Pt=(e.flags&131072)!==0}else Pt=!1,et&&(t.flags&1048576)!==0&&mm(t,Ui,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=ul(t.elementType),t.type=e,typeof e=="function")vu(e)?(a=ml(e,a),t.tag=1,t=_p(null,t,e,a,n)):(t.tag=0,t=sd(null,t,e,a,n));else{if(e!=null){var o=e.$$typeof;if(o===W){t.tag=11,t=kp(null,t,e,a,n);break e}else if(o===P){t.tag=14,t=Tp(null,t,e,a,n);break e}else if(o===Ce){t.tag=10,t.type=e,t=zp(null,t,n);break e}}throw t=Oe(e)||e,Error(u(306,t,""))}}return t;case 0:return sd(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,o=ml(a,t.pendingProps),_p(e,t,a,o,n);case 3:e:{if(q(t,t.stateNode.containerInfo),e===null)throw Error(u(387));a=t.pendingProps;var r=t.memoizedState;o=r.element,_u(e,t),Yi(t,a,null,n);var f=t.memoizedState;if(a=f.cache,ws(t,Kt,a),a!==r.cache&&Tu(t,[Kt],n,!0),Xi(),a=f.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=Rp(e,t,a,n);break e}else if(a!==o){o=ia(Error(u(424)),t),Ii(o),t=Rp(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Mt=da(e.firstChild),nn=t,et=!0,xs=null,ca=!0,n=Nm(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(sl(),a===o){t=is(e,t,n);break e}Wt(e,t,a,n)}t=t.child}return t;case 26:return Kl(e,t),e===null?(n=ry(t.type,null,t.pendingProps,null))?t.memoizedState=n:et||(t.stateNode=$g(t.type,t.pendingProps,Te.current,t)):t.memoizedState=ry(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $e(t),e===null&&et&&(a=t.stateNode=sy(t.type,t.pendingProps,Te.current),nn=t,ca=!0,o=Mt,Us(t.type)?(rf=o,Mt=da(a.firstChild)):Mt=o),Wt(e,t,t.pendingProps.children,n),Kl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&et&&((o=a=Mt)&&(a=Wx(a,t.type,t.pendingProps,ca),a!==null?(t.stateNode=a,nn=t,Mt=da(a.firstChild),ca=!1,o=!0):o=!1),o||Ss(t)),$e(t),o=t.type,r=t.pendingProps,f=e!==null?e.memoizedProps:null,a=r.children,Jd(o,r)?a=null:f!==null&&Jd(o,f)&&(t.flags|=32),t.memoizedState!==null&&(o=Bu(e,t,Kb,null,null,n),fi._currentValue=o),Kl(e,t),Wt(e,t,a,n),t.child;case 6:return e===null&&et&&((e=n=Mt)&&(n=eS(n,t.pendingProps,ca),n!==null?(t.stateNode=n,nn=t,Mt=null,e=!0):e=!1),e||Ss(t)),null;case 13:return Op(e,t,n);case 4:return q(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=fl(t,null,a,n):Wt(e,t,a,n),t.child;case 11:return kp(e,t,t.type,t.pendingProps,n);case 7:return a=t.pendingProps,Kl(e,t),Wt(e,t,a,n),t.child;case 8:return Wt(e,t,t.pendingProps.children,n),t.child;case 12:return Wt(e,t,t.pendingProps.children,n),t.child;case 10:return zp(e,t,n);case 9:return o=t.type._context,a=t.pendingProps.children,ol(t),o=rn(o),a=a(o),t.flags|=1,Wt(e,t,a,n),t.child;case 14:return Tp(e,t,t.type,t.pendingProps,n);case 15:return jp(e,t,t.type,t.pendingProps,n);case 19:return ud(e,t,n);case 31:return ax(e,t,n);case 22:return Np(e,t,n,t.pendingProps);case 24:return ol(t),a=rn(Kt),e===null?(o=Eu(),o===null&&(o=Ct,r=ju(),o.pooledCache=r,r.refCount++,r!==null&&(o.pooledCacheLanes|=n),o=r),t.memoizedState={parent:a,cache:o},Mu(t),ws(t,Kt,o)):((e.lanes&n)!==0&&(_u(e,t),Yi(t,null,null,n),Xi()),o=e.memoizedState,r=t.memoizedState,o.parent!==a?(o={parent:a,cache:a},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),ws(t,Kt,a)):(a=r.cache,ws(t,Kt,a),a!==o.cache&&Tu(t,[Kt],n,!0))),Wt(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),a=t.pendingProps,a.name!=null&&a.name!=="auto"?t.flags|=e===null?18882560:18874368:et&&mr(t),e!==null&&e.memoizedProps.name!==a.name?t.flags|=4194816:Kl(e,t),Wt(e,t,a.children,n),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function os(e){e.flags|=4}function fd(e,t,n,a,o){var r;if((r=(e.mode&32)!==0)&&(r=n===null?fy(t,a):fy(t,a)&&(a.src!==n.src||a.srcSet!==n.srcSet)),r){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(vg())e.flags|=8192;else throw dl=Sr,Cu}else e.flags&=-16777217}function Ip(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!hy(t))if(vg())e.flags|=8192;else throw dl=Sr,Cu}function Hr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?at():536870912,e.lanes|=t,Wl|=t)}function Fi(e,t){if(!et)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function _t(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,a|=o.subtreeFlags&1206910976,a|=o.flags&1206910976,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,a|=o.subtreeFlags,a|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function ix(e,t,n){var a=t.pendingProps;switch(Su(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(t),null;case 1:return _t(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),as(Kt),ze(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&($l(t)?os(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Au())),_t(t),null;case 26:var o=t.type,r=t.memoizedState;return e===null?(os(t),r!==null?(_t(t),Ip(t,r)):(_t(t),fd(t,o,null,a,n))):r?r!==e.memoizedState?(os(t),_t(t),Ip(t,r)):(_t(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&os(t),_t(t),fd(t,o,e,a,n)),null;case 27:if(yt(t),n=Te.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&os(t);else{if(!a){if(t.stateNode===null)throw Error(u(166));return _t(t),t.subtreeFlags&=-33554433,null}e=ie.current,$l(t)?gm(t):(e=sy(o,a,n),t.stateNode=e,os(t))}return _t(t),t.subtreeFlags&=-33554433,null;case 5:if(yt(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&os(t);else{if(!a){if(t.stateNode===null)throw Error(u(166));return _t(t),t.subtreeFlags&=-33554433,null}if(r=ie.current,$l(t))gm(t);else{var f=ro(Te.current);switch(r){case 1:r=f.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:r=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":r=f.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":r=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":r=f.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof a.is=="string"?f.createElement("select",{is:a.is}):f.createElement("select"),a.multiple?r.multiple=!0:a.size&&(r.size=a.size);break;default:r=typeof a.is=="string"?f.createElement(o,{is:a.is}):f.createElement(o)}}r[zt]=t,r[Ut]=a;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)r.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=r;e:switch(fn(r,o,a),o){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&os(t)}}return _t(t),t.subtreeFlags&=-33554433,fd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&os(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(u(166));if(e=Te.current,$l(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,o=nn,o!==null)switch(o.tag){case 27:case 5:a=o.memoizedProps}e[zt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Ug(e.nodeValue,n)),e||Ss(t,!0)}else e=ro(e).createTextNode(a),e[zt]=t,t.stateNode=e}return _t(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=$l(t),n!==null){if(e===null){if(!a)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[zt]=t}else sl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_t(t),e=!1}else n=Au(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Yn(t),t):(Yn(t),null);if((t.flags&128)!==0)throw Error(u(558))}return _t(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=$l(t),a!==null&&a.dehydrated!==null){if(e===null){if(!o)throw Error(u(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(u(317));o[zt]=t}else sl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_t(t),o=!1}else o=Au(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Yn(t),t):(Yn(t),null)}return Yn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,o=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(o=a.alternate.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==o&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Hr(t,t.updateQueue),_t(t),null);case 4:return ze(),e===null&&Qd(t.stateNode.containerInfo),t.flags|=67108864,_t(t),null;case 10:return as(t.type),_t(t),null;case 19:if(Uu(t),a=t.memoizedState,a===null)return _t(t),null;if(o=(t.flags&128)!==0,r=a.rendering,r===null)if(o)Fi(a,!1);else{if(qt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=Tr(e),r!==null){for(t.flags|=128,Fi(a,!1),e=r.updateQueue,t.updateQueue=e,Hr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)dm(n,e),n=n.sibling;return Vi(t,un.current&1|2),et&&ts(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&vt()>Jr&&(t.flags|=128,o=!0,Fi(a,!1),t.lanes=4194304)}else{if(!o)if(e=Tr(r),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Hr(t,e),Fi(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!r.alternate&&!et)return _t(t),null}else 2*vt()-a.renderingStartTime>Jr&&n!==536870912&&(t.flags|=128,o=!0,Fi(a,!1),t.lanes=4194304);a.isBackwards?(r.sibling=t.child,t.child=r):(e=a.last,e!==null?e.sibling=r:t.child=r,a.last=r)}if(a.tail!==null){e=a.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=vt(),e.sibling=null,r=un.current,r=o?r&1|2:r&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!n||et?Vi(t,r):(n=r,Me(cn,t),Me(un,n),bn===null&&(bn=t)),et&&ts(t,a.treeForkCount),e}return _t(t),null;case 22:case 23:return Yn(t),Lu(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(_t(t),t.subtreeFlags&6&&(t.flags|=8192)):_t(t),n=t.updateQueue,n!==null&&Hr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&Be(cl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),as(Kt),_t(t),null;case 25:return null;case 30:return t.flags|=33554432,_t(t),null}throw Error(u(156,t.tag))}function ox(e,t){switch(Su(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return as(Kt),ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return yt(t),null;case 31:if(t.memoizedState!==null){if(Yn(t),t.alternate===null)throw Error(u(340));sl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Yn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));sl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Uu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ze(),null;case 10:return as(t.type),null;case 22:case 23:return Yn(t),Lu(),e!==null&&Be(cl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return as(Kt),null;case 25:return null;default:return null}}function Bp(e,t){switch(Su(t),t.tag){case 3:as(Kt),ze();break;case 26:case 27:case 5:yt(t);break;case 4:ze();break;case 31:t.memoizedState!==null&&Yn(t);break;case 13:Yn(t);break;case 19:Uu(t);break;case 10:as(t.type);break;case 22:case 23:Yn(t),Lu(),e!==null&&Be(cl);break;case 24:as(Kt)}}function Ji(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var o=a.next;n=o;do{if((n.tag&e)===e){a=void 0;var r=n.create,f=n.inst;a=r(),f.destroy=a}n=n.next}while(n!==o)}}catch(p){At(t,t.return,p)}}function Ms(e,t,n){try{var a=t.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var r=o.next;a=r;do{if((a.tag&e)===e){var f=a.inst,p=f.destroy;if(p!==void 0){f.destroy=void 0,o=t;var k=n,O=p;try{O()}catch(G){At(o,k,G)}}}a=a.next}while(a!==r)}}catch(G){At(t,t.return,G)}}function Hp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Cm(t,n)}catch(a){At(e,e.return,a)}}}function $p(e,t,n){n.props=ml(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){At(e,t,a)}}function za(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:var o=e.stateNode,r=Ja(e.memoizedProps,o);(o.ref===null||o.ref.name!==r)&&(o.ref=Kg(r)),a=o.ref;break;case 7:if(e.stateNode===null){var f=new Pn(e);b(e.child,!1,Fx,f,void 0,void 0),e.stateNode=f}a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(p){At(e,t,p)}}function dn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(o){At(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){At(e,t,o)}else n.current=null}function $r(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)ey(e.stateNode,t[n])}function qp(e){for(var t=e.return;t!==null&&(md(t)&&ey(e.stateNode,t.stateNode),!hd(t));)t=t.return}function Wi(e){for(var t=e.return;t!==null&&(md(t)&&Jx(e.stateNode,t.stateNode),!hd(t));)t=t.return}function hd(e){return e.tag===5||e.tag===3||e.tag===27}function md(e){return e&&e.tag===7&&e.stateNode!==null}function pd(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(o){At(e,e.return,o)}}function gd(e,t,n){try{var a=e.stateNode;Ox(a,e.type,n,t),a[Ut]=t}catch(o){At(e,e.return,o)}}function Gp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Us(e.type)||e.tag===4}function yd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gp(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.tag===27&&Us(e.type)||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 vd(e,t,n,a){var o=e.tag;if(o===5||o===6)o=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(o,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(o),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Oa)),$r(e,a),dt=!0;else if(o!==4&&(o===27&&($r(e,a),a=null,Us(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(vd(e,t,n,a),e=e.sibling;e!==null;)vd(e,t,n,a),e=e.sibling}function qr(e,t,n,a){var o=e.tag;if(o===5||o===6)o=e.stateNode,t?n.insertBefore(o,t):n.appendChild(o),$r(e,a),dt=!0;else if(o!==4&&(o===27&&($r(e,a),a=null,Us(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(qr(e,t,n,a),e=e.sibling;e!==null;)qr(e,t,n,a),e=e.sibling}function Xp(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);fn(t,a,n),t[zt]=e,t[Ut]=n}catch(r){At(e,e.return,r)}}var Gr=!1,Vn=null;function Yp(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(Gr=!0)}var Ua=null;function Vp(){var e=Ua;return Ua=null,e}var On=0;function Zl(e,t,n,a,o){return On=0,Qp(e.child,t,n,a,o)}function Qp(e,t,n,a,o){for(var r=!1;e!==null;){if(e.tag===5){var f=e.stateNode;if(a!==null){var p=tf(f);a.push(p),p.view&&(r=!0)}else r||tf(f).view&&(r=!0);Gr=!0,Vg(f,On===0?t:t+"_"+On,n),On++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&o||Qp(e.child,t,n,a,o)&&(r=!0));e=e.sibling}return r}function Ia(e,t){for(;e!==null;)e.tag===5?Qg(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Ia(e.child,t)),e=e.sibling}function Xr(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Xr(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(u(544));var n=t.name;t=Wa(t.default,t.share),t!=="none"&&(Zl(e,n,t,null,!1)||Ia(e.child,!1))}e=e.sibling}}function bd(e,t){if(e.tag===30){var n=e.stateNode,a=e.memoizedProps,o=Ja(a,n),r=Wa(a.default,n.paired?a.share:a.enter);r!=="none"?Zl(e,o,r,null,!1)?(Xr(e),n.paired||t||ai(e,a.onEnter)):Ia(e.child,!1):Xr(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)bd(e,t),e=e.sibling;else Xr(e)}function xd(e){if(Vn!==null&&Vn.size!==0){var t=Vn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,a=n.name;if(a!=null&&a!=="auto"){var o=t.get(a);if(o!==void 0){var r=Wa(n.default,n.share);if(r!=="none"&&(Zl(e,a,r,null,!1)?(r=e.stateNode,o.paired=r,r.paired=o,ai(e,n.onShare)):Ia(e.child,!1)),t.delete(a),t.size===0)break}}}xd(e)}e=e.sibling}}}function Sd(e){if(e.tag===30){var t=e.memoizedProps,n=Ja(t,e.stateNode),a=Vn!==null?Vn.get(n):void 0,o=Wa(t.default,a!==void 0?t.share:t.exit);o!=="none"&&(Zl(e,n,o,null,!1)?a!==void 0?(o=e.stateNode,a.paired=o,o.paired=a,Vn.delete(n),ai(e,t.onShare)):ai(e,t.onExit):Ia(e.child,!1)),Vn!==null&&xd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Sd(e),e=e.sibling;else Vn!==null&&xd(e)}function Kp(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Ja(t,e.stateNode);t=Wa(t.default,t.update),e.flags&=-5,t!=="none"&&Zl(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Kp(e);e=e.sibling}}function wd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Ia(e.child,!1))}wd(e)}e=e.sibling}}function Yr(e){if(e.tag===30)e.stateNode.paired=null,Ia(e.child,!1),wd(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Yr(e),e=e.sibling;else wd(e)}function Zp(e){for(e=e.child;e!==null;)e.tag===30?Ia(e.child,!1):(e.subtreeFlags&33554432)!==0&&Zp(e),e=e.sibling}function Ad(e,t,n,a,o,r,f){for(var p=!1;t!==null;){if(t.tag===5){var k=t.stateNode;if(r!==null&&On<r.length){var O=r[On],G=tf(k);(O.view||G.view)&&(p=!0);var ne;if(ne=(e.flags&4)===0)if(G.clip)ne=!0;else{ne=O.rect;var _=G.rect;ne=ne.y!==_.y||ne.x!==_.x||ne.height!==_.height||ne.width!==_.width}ne&&(e.flags|=4),G.abs?G=!O.abs:(O=O.rect,G=G.rect,G=O.height!==G.height||O.width!==G.width),G&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Vg(k,On===0?n:n+"_"+On,o),p&&(e.flags&4)!==0||(Ua===null&&(Ua=[]),Ua.push(k,On===0?a:a+"_"+On,t.memoizedProps)),On++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&f?e.flags|=t.flags&32:Ad(e,t.child,n,a,o,r,f)&&(p=!0));t=t.sibling}return p}function Pp(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,a=e.stateNode,o=Ja(n,a),r=Wa(n.default,n.update),f;f=e.memoizedState,e.memoizedState=null,a=e;var p=e.child;On=0,o=Ad(a,p,o,o,r,f,!1),(e.flags&4)!==0&&o&&ai(e,n.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Pp(e);e=e.sibling}}var an=!1,xt=!1,Ba=!1,kd=!1,Fp=typeof WeakSet=="function"?WeakSet:Set,sn=null,Ha=!1,eo=!1,Vr=!1,Td=!1;function rx(e,t,n){if(e=e.containerInfo,Pd=hi,e=tm(e),du(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var r=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var p=0,k=-1,O=-1,G=0,ne=0,_=e,H=null;t:for(;;){for(var we;_!==a||r!==0&&_.nodeType!==3||(k=p+r),_!==f||o!==0&&_.nodeType!==3||(O=p+o),_.nodeType===3&&(p+=_.nodeValue.length),(we=_.firstChild)!==null;)H=_,_=we;for(;;){if(_===e)break t;if(H===a&&++G===r&&(k=p),H===f&&++ne===o&&(O=p),(we=_.nextSibling)!==null)break;_=H,H=_.parentNode}_=we}a=k===-1||O===-1?null:{start:k,end:O}}else a=null}a=a||{start:0,end:0}}else a=null;for(Fd={focusedElem:e,selectionRange:a},hi=!1,n=(n&335544064)===n,sn=t,t=n?9270:1024;sn!==null;){if(e=sn,n&&(a=e.deletions,a!==null))for(r=0;r<a.length;r++)n&&Sd(a[r]);if(e.alternate===null&&(e.flags&2)!==0)n&&Yp(e),Qr(n);else{if(e.tag===22){if(a=e.alternate,e.memoizedState!==null){a!==null&&a.memoizedState===null&&n&&Sd(a),Qr(n);continue}else if(a!==null&&a.memoizedState!==null){n&&Yp(e),Qr(n);continue}}a=e.child,(e.subtreeFlags&t)!==0&&a!==null?(a.return=e,sn=a):(n&&Kp(e),Qr(n))}}Vn=null}function Qr(e){for(;sn!==null;){var t=sn,n=e,a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((o&1024)!==0&&a!==null){n=void 0,o=a.memoizedProps,a=a.memoizedState;var r=t.stateNode;try{var f=ml(t.type,o);n=r.getSnapshotBeforeUpdate(f,a),r.__reactInternalSnapshotBeforeUpdate=n}catch(p){At(t,t.return,p)}}break;case 3:if((o&1024)!==0){if(a=t.stateNode.containerInfo,n=a.nodeType,n===9)sf(a);else if(n===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":sf(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&a!==null&&(n=Ja(a.memoizedProps,a.stateNode),o=t.memoizedProps,o=Wa(o.default,o.update),o!=="none"&&Zl(a,n,o,a.memoizedState=[],!0));break;default:if((o&1024)!==0)throw Error(u(163))}if(a=t.sibling,a!==null){a.return=t.return,sn=a;break}sn=t.return}}function Jp(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:$a(e,n),a&4&&Ji(5,n);break;case 1:if($a(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){At(n,n.return,f)}else{var o=ml(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){At(n,n.return,f)}}a&64&&Hp(n),a&512&&za(n,n.return);break;case 3:if($a(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Cm(e,t)}catch(f){At(n,n.return,f)}}break;case 27:t===null&&a&4&&Xp(n);case 26:case 5:$a(e,n),t===null&&a&4&&pd(n),a&512&&za(n,n.return);break;case 12:$a(e,n);break;case 31:$a(e,n),a&4&&ng(e,n);break;case 13:$a(e,n),a&4&&ag(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=xx.bind(null,n),tS(e,n))));break;case 22:if(a=n.memoizedState!==null||an,!a){var r=t!==null&&t.memoizedState!==null||xt;t=an,o=xt,an=a,(xt=r)&&!o?(a=2,(n.subtreeFlags&8772)!==0&&(a|=1),wa(e,n,a)):$a(e,n),an=t,xt=o}break;case 30:$a(e,n),a&512&&za(n,n.return);break;case 7:a&512&&za(n,n.return);default:$a(e,n)}}function jd(e,t){for(e=e.child;e!==null;)Wp(e,t),e=e.sibling}function Wp(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var a=n.style;typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"}else{var o=e.stateNode,r=e.memoizedProps.style,f=r!=null&&r.hasOwnProperty("display")?r.display:null;o.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(k){At(e,e.return,k)}Nd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,dt=!0}catch(k){At(e,e.return,k)}break;case 18:try{var p=e.stateNode;t?Yg(p,!0):Yg(e.stateNode,!1)}catch(k){At(e,e.return,k)}break;case 22:case 23:e.memoizedState===null&&jd(e,t);break;default:jd(e,t)}}function Nd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,a=t;switch(n.tag){case 4:Wp(n,a);break e;case 22:n.memoizedState===null&&Nd(n,a);break e;default:Nd(n,a)}}e=e.sibling}}function eg(e){var t=e.alternate;t!==null&&(e.alternate=null,eg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ka(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Dt=null,Dn=!1;function xa(e,t,n){for(n=n.child;n!==null;)tg(e,t,n),n=n.sibling}function tg(e,t,n){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(yn,n)}catch{}switch(n.tag){case 26:xt||dn(n,t),xa(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!xt&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:xt||dn(n,t),Wi(n);var a=Dt,o=Dn;Us(n.type)&&(Dt=n.stateNode,Dn=!1),xa(e,t,n),ly(n.stateNode,n.type,n.memoizedProps),Dt=a,Dn=o;break;case 5:xt||dn(n,t),Wi(n);case 6:if(n.tag===6&&Wi(n),a=Dt,o=Dn,Dt=null,xa(e,t,n),Dt=a,Dn=o,Dt!==null)if(Dn)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(n.stateNode),dt=!0}catch(r){At(n,t,r)}else try{Dt.removeChild(n.stateNode),dt=!0}catch(r){At(n,t,r)}break;case 18:Dt!==null&&(Dn?(e=Dt,Xg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),mi(e)):Xg(Dt,n.stateNode));break;case 4:a=Dt,o=Dn,Dt=n.stateNode.containerInfo,Dn=!0,xa(e,t,n),Dt=a,Dn=o;break;case 0:case 11:case 14:case 15:Ms(2,n,t),xt||Ms(4,n,t),xa(e,t,n);break;case 1:xt||(dn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&$p(n,t,a)),xa(e,t,n);break;case 21:xa(e,t,n);break;case 22:xt=(a=xt)||n.memoizedState!==null,xa(e,t,n),xt=a;break;case 30:dn(n,t),xa(e,t,n);break;case 7:xt||dn(n,t),xa(e,t,n);break;default:xa(e,t,n)}}function ng(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mi(e)}catch(n){At(t,t.return,n)}}}function ag(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mi(e)}catch(n){At(t,t.return,n)}}function cx(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Fp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Fp),t;default:throw Error(u(435,e.tag))}}function Kr(e,t){var n=cx(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var o=Sx.bind(null,e,a);a.then(o,o)}})}function jn(e,t,n){var a=t.deletions;if(a!==null)for(var o=0;o<a.length;o++){var r=a[o],f=e,p=t,k=p;e:for(;k!==null;){switch(k.tag){case 27:if(Us(k.type)){Dt=k.stateNode,Dn=!1;break e}break;case 5:Dt=k.stateNode,Dn=!1;break e;case 3:case 4:Dt=k.stateNode.containerInfo,Dn=!0;break e}k=k.return}if(Dt===null)throw Error(u(160));tg(f,p,r),Dt=null,Dn=!1,f=r.alternate,f!==null&&(f.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sg(t,e,n),t=t.sibling}var Sa=null;function sg(e,t,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(o&4&&(a=e.updateQueue,a=a!==null?a.events:null,a!==null))for(var r=0;r<a.length;r++){var f=a[r];f.ref.impl=f.nextImpl}jn(t,e,n),Nn(e),o&4&&(Ms(3,e,e.return),Ji(3,e),Ms(5,e,e.return));break;case 1:jn(t,e,n),Nn(e),o&512&&(xt||a===null||dn(a,a.return)),o&64&&an&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(r=Sa,jn(t,e,n),Nn(e),o&512&&(xt||a===null||dn(a,a.return)),o&4)if(o=a!==null?a.memoizedState:null,n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null)if(an)e.stateNode=$g(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,o=r.ownerDocument||r;t:switch(t){case"title":a=o.getElementsByTagName("title")[0],(!a||a[gs]||a[zt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=o.createElement(t),o.head.insertBefore(a,o.querySelector("head > title"))),fn(a,t,n),a[zt]=e,St(a),t=a;break e;case"link":if(r=dy("link","href",o).get(t+(n.href||""))){for(f=0;f<r.length;f++)if(a=r[f],a.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&a.getAttribute("rel")===(n.rel==null?null:n.rel)&&a.getAttribute("title")===(n.title==null?null:n.title)&&a.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){r.splice(f,1);break t}}a=o.createElement(t),fn(a,t,n),o.head.appendChild(a);break;case"meta":if(r=dy("meta","content",o).get(t+(n.content||""))){for(f=0;f<r.length;f++)if(a=r[f],a.getAttribute("content")===(n.content==null?null:""+n.content)&&a.getAttribute("name")===(n.name==null?null:n.name)&&a.getAttribute("property")===(n.property==null?null:n.property)&&a.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute("charset")===(n.charSet==null?null:n.charSet)){r.splice(f,1);break t}}a=o.createElement(t),fn(a,t,n),o.head.appendChild(a);break;default:throw Error(u(468,t))}a[zt]=e,St(a),t=a}e.stateNode=t}else an||ff(r,e.type,e.stateNode);else e.stateNode=uy(r,n,e.memoizedProps);else o!==n?(o===null?(t=a.stateNode,t===null||xt||t.parentNode.removeChild(t)):o.count--,n===null?an||ff(r,e.type,e.stateNode):uy(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&gd(e,e.memoizedProps,a.memoizedProps);break;case 27:jn(t,e,n),Nn(e),o&512&&(xt||a===null||dn(a,a.return)),a!==null&&o&4&&gd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(r=Ba,Ba=!1,jn(t,e,n),Ba=r,Nn(e),o&512&&(xt||a===null||dn(a,a.return)),e.flags&32){t=e.stateNode;try{Ht(t,""),dt=!0}catch(G){At(e,e.return,G)}}o&4&&e.stateNode!=null&&(t=e.memoizedProps,gd(e,t,a!==null?a.memoizedProps:t)),o&1024&&(kd=!0);break;case 6:if(jn(t,e,n),Nn(e),o&4){if(e.stateNode===null)throw Error(u(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,dt=!0}catch(G){At(e,e.return,G)}}break;case 3:if(dt=!1,cc=null,r=Sa,Sa=co(t.containerInfo),jn(t,e,n),Sa=r,Nn(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{mi(t.containerInfo)}catch(G){At(e,e.return,G)}kd&&(kd=!1,lg(e)),dt=!1;break;case 4:o=Ba,Ba=an,a=Wo(),r=Sa,Sa=co(e.stateNode.containerInfo),jn(t,e,n),Nn(e),Sa=r,dt&&eo&&(Vr=!0),dt=a,Ba=o;break;case 12:jn(t,e,n),Nn(e);break;case 31:jn(t,e,n),Nn(e),o&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Kr(e,t)));break;case 13:jn(t,e,n),Nn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Fr=vt()),o&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Kr(e,t)));break;case 22:r=e.memoizedState!==null,f=a!==null&&a.memoizedState!==null;var p=an,k=xt,O=Ba;an=p||r,Ba=O||r,xt=k||f,jn(t,e,n),xt=k,Ba=O,an=p,Nn(e),o&8192&&(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,!r||a===null||f||an||xt||(t=f||xt,n=an,a=xt,an=r||an,xt=t,_s(e,2),an=n,xt=a),!r&&Ba||jd(e,r)),o&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Kr(e,n))));break;case 19:jn(t,e,n),Nn(e),o&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Kr(e,t)));break;case 30:o&512&&(xt||a===null||dn(a,a.return)),o=Wo(),r=eo,f=(n&335544064)===n,p=e.memoizedProps,eo=f&&Wa(p.default,p.update)!=="none",jn(t,e,n),Nn(e),f&&a!==null&&dt&&(e.flags|=4),eo=r,dt=o;break;case 21:break;case 7:o&512&&(xt||a===null||dn(a,a.return)),a&&a.stateNode!==null&&(a.stateNode._fragmentFiber=e);default:jn(t,e,n),Nn(e)}}function Nn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(Gp(a)){n=a;break}a=a.return}a=null;for(var o=e.return;o!==null;){if(md(o)){var r=o.stateNode;a===null?a=[r]:a.push(r)}if(hd(o))break;o=o.return}var f=a;if(n==null)throw Error(u(160));switch(n.tag){case 27:var p=n.stateNode,k=yd(e);qr(e,k,p,f);break;case 5:var O=n.stateNode;n.flags&32&&(Ht(O,""),n.flags&=-33);var G=yd(e);qr(e,G,O,f);break;case 3:case 4:var ne=n.stateNode.containerInfo,_=yd(e);vd(e,_,ne,f);break;default:throw Error(u(161))}}catch(H){At(e,e.return,H)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function lg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;lg(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,hi=!0,t.reset(),hi=!1),e=e.sibling}}function Pl(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)ig(t,e),t=t.sibling;else Pp(t)}function ig(e,t){var n=e.alternate;if(n===null)bd(e,!1);else switch(e.tag){case 3:if(Td=Ha=!1,Vp(),Pl(t,e),!Ha&&!Vr){if(e=Ua,e!==null)for(var a=0;a<e.length;a+=3){n=e[a];var o=e[a+1];Qg(n,e[a+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+o+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Td=!0}Ua=null;break;case 5:Pl(t,e);break;case 4:a=Ha,Ha=!1,Pl(t,e),Ha&&(Vr=!0),Ha=a;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?bd(e,!1):Pl(t,e));break;case 30:a=Ha,o=Vp(),Ha=!1,Pl(t,e),Ha&&(e.flags|=4);var r=e.memoizedProps,f=e.stateNode;t=Ja(r,f),f=Ja(n.memoizedProps,f);var p=Wa(r.default,r.update);p==="none"?t=!1:(r=n.memoizedState,n.memoizedState=null,n=e.child,On=0,t=Ad(e,n,t,f,p,r,!0),On!==(r===null?0:r.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(ai(e,e.memoizedProps.onUpdate),Ua=o):o!==null&&(o.push.apply(o,Ua),Ua=o),Ha=(e.flags&32)!==0?!0:a;break;default:Pl(t,e)}}function $a(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Jp(e,t.alternate,t),t=t.sibling}function _s(e,t){for(e=e.child;e!==null;){var n=e,a=t;switch(n.tag){case 0:case 11:case 14:case 15:Ms(4,n,n.return),_s(n,a);break;case 1:dn(n,n.return);var o=n.stateNode;typeof o.componentWillUnmount=="function"&&$p(n,n.return,o),_s(n,a);break;case 27:(a&2)!==0&&ly(n.stateNode,n.type,n.memoizedProps);case 5:dn(n,n.return),n.tag!==5&&n.tag!==27||Wi(n),_s(n,a);break;case 6:Wi(n);break;case 26:dn(n,n.return),o=n.stateNode,n.memoizedState!==null||o===null||xt||o.parentNode.removeChild(o),_s(n,a);break;case 22:n.memoizedState===null&&_s(n,a);break;case 30:dn(n,n.return),_s(n,a);break;case 7:dn(n,n.return);default:_s(n,a)}e=e.sibling}}function wa(e,t,n){for(n=(t.subtreeFlags&8772)!==0?n:n&-2,t=t.child;t!==null;){var a=t.alternate,o=e,r=t,f=r.flags,p=(n&1)!==0;switch(r.tag){case 0:case 11:case 15:wa(o,r,n),Ji(4,r);break;case 1:if(wa(o,r,n),a=r,o=a.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(G){At(a,a.return,G)}if(a=r,o=a.updateQueue,o!==null){var k=a.stateNode;try{var O=o.shared.hiddenCallbacks;if(O!==null)for(o.shared.hiddenCallbacks=null,o=0;o<O.length;o++)Em(O[o],k)}catch(G){At(a,a.return,G)}}p&&f&64&&Hp(r),za(r,r.return);break;case 27:(n&2)!==0&&Xp(r);case 5:r.tag!==5&&r.tag!==27||qp(r),wa(o,r,n),p&&a===null&&f&4&&pd(r),za(r,r.return);break;case 6:qp(r);break;case 26:k=r.stateNode,r.memoizedState!==null||k===null||an||ff(co(k.ownerDocument),r.type,k),wa(o,r,n),p&&a===null&&f&4&&pd(r),za(r,r.return);break;case 12:wa(o,r,n);break;case 31:wa(o,r,n),p&&f&4&&ng(o,r);break;case 13:wa(o,r,n),p&&f&4&&ag(o,r);break;case 22:r.memoizedState===null&&wa(o,r,n),za(r,r.return);break;case 30:wa(o,r,n),za(r,r.return);break;case 7:za(r,r.return);default:wa(o,r,n)}t=t.sibling}}function Ed(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Bi(n))}function Cd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Bi(e))}function ua(e,t,n,a){var o=(n&335544064)===n;if(t.subtreeFlags&(o?10262:10256))for(t=t.child;t!==null;)og(e,t,n,a),t=t.sibling;else o&&Zp(t)}function og(e,t,n,a){var o=(n&335544064)===n;o&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Yr(t);var r=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,n,a),r&2048&&Ji(9,t);break;case 1:ua(e,t,n,a);break;case 3:ua(e,t,n,a),o&&Td&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),r&2048&&(r=null,t.alternate!==null&&(r=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==r&&(t.refCount++,r!=null&&Bi(r)));break;case 12:if(r&2048){ua(e,t,n,a),r=t.stateNode;try{var f=t.memoizedProps,p=f.id,k=f.onPostCommit;typeof k=="function"&&k(p,t.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(O){At(t,t.return,O)}}else ua(e,t,n,a);break;case 31:ua(e,t,n,a);break;case 13:ua(e,t,n,a);break;case 23:break;case 22:f=t.stateNode,p=t.alternate,t.memoizedState!==null?(o&&p!==null&&p.memoizedState===null&&Yr(p),f._visibility&2?ua(e,t,n,a):to(e,t)):(o&&p!==null&&p.memoizedState!==null&&Yr(t),f._visibility&2?ua(e,t,n,a):(f._visibility|=2,Fl(e,t,n,a,(t.subtreeFlags&10256)!==0||!1))),r&2048&&Ed(p,t);break;case 24:ua(e,t,n,a),r&2048&&Cd(t.alternate,t);break;case 30:o&&(r=t.alternate,r!==null&&(Ia(r.child,!0),Ia(t.child,!0))),ua(e,t,n,a);break;default:ua(e,t,n,a)}}function Fl(e,t,n,a,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var r=e,f=t,p=n,k=a,O=f.flags;switch(f.tag){case 0:case 11:case 15:Fl(r,f,p,k,o),Ji(8,f);break;case 23:break;case 22:var G=f.stateNode;f.memoizedState!==null?G._visibility&2?Fl(r,f,p,k,o):to(r,f):(G._visibility|=2,Fl(r,f,p,k,o)),o&&O&2048&&Ed(f.alternate,f);break;case 24:Fl(r,f,p,k,o),o&&O&2048&&Cd(f.alternate,f);break;default:Fl(r,f,p,k,o)}t=t.sibling}}function to(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,o=a.flags;switch(a.tag){case 22:to(n,a),o&2048&&Ed(a.alternate,a);break;case 24:to(n,a),o&2048&&Cd(a.alternate,a);break;default:to(n,a)}t=t.sibling}}var pl=8192;function gl(e,t,n){if(e.subtreeFlags&pl)for(e=e.child;e!==null;)rg(e,t,n),e=e.sibling}function rg(e,t,n){switch(e.tag){case 26:gl(e,t,n),e.flags&pl&&(e.memoizedState!==null?pS(n,Sa,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&py(n,e)));break;case 5:gl(e,t,n),e.flags&pl&&(e=e.stateNode,(t&335544128)===t&&py(n,e));break;case 3:case 4:var a=Sa;Sa=co(e.stateNode.containerInfo),gl(e,t,n),Sa=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=pl,pl=16777216,gl(e,t,n),pl=a):gl(e,t,n));break;case 30:if((e.flags&pl)!==0&&(a=e.memoizedProps.name,a!=null&&a!=="auto")){var o=e.stateNode;o.paired=null,Vn===null&&(Vn=new Map),Vn.set(a,o)}gl(e,t,n);break;default:gl(e,t,n)}}function cg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function no(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];sn=a,dg(a,e)}cg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ug(e),e=e.sibling}function ug(e){switch(e.tag){case 0:case 11:case 15:no(e),e.flags&2048&&Ms(9,e,e.return);break;case 3:no(e);break;case 12:no(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Zr(e)):no(e);break;default:no(e)}}function Zr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];sn=a,dg(a,e)}cg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ms(8,t,t.return),Zr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Zr(t));break;default:Zr(t)}e=e.sibling}}function dg(e,t){for(;sn!==null;){var n=sn;switch(n.tag){case 0:case 11:case 15:Ms(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Bi(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,sn=a;else e:for(n=e;sn!==null;){a=sn;var o=a.sibling,r=a.return;if(eg(a),a===n){sn=null;break e}if(o!==null){o.return=r,sn=o;break e}sn=r}}}var ux={getCacheForType:function(e){var t=rn(Kt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rn(Kt).controller.signal}},dx=typeof WeakMap=="function"?WeakMap:Map,bt=0,Ct=null,lt=null,ot=0,wt=0,Qn=null,Rs=!1,Jl=!1,Md=!1,rs=0,qt=0,Os=0,yl=0,Pr=0,Kn=0,Wl=0,ao=null,Ln=null,_d=!1,Fr=0,fg=0,Jr=1/0,Wr=null,Ds=null,It=0,Aa=null,vl=null,qa=0,Rd=0,Od=null,hg=null,ei=null,ti=null,ni=null,so=0,ec=null;function Zn(){return(bt&2)!==0&&ot!==0?ot&-ot:me.T!==null?Gd():ps()}function mg(){if(Kn===0)if((ot&536870912)===0||et){var e=ht;ht<<=1,(ht&3932160)===0&&(ht=262144),Kn=e}else Kn=536870912;return e=cn.current,e!==null&&(e.flags|=32),Kn}function ai(e,t){if(t!=null){var n=e.stateNode,a=n.ref;a===null&&(a=n.ref=Kg(Ja(e.memoizedProps,n))),ti===null&&(ti=[]),ti.push(t.bind(null,a))}}function zn(e,t,n){(e===Ct&&(wt===2||wt===9)||e.cancelPendingCommit!==null)&&(si(e,0),Ls(e,ot,Kn,!1)),st(e,n),((bt&2)===0||e!==Ct)&&(e===Ct&&((bt&2)===0&&(yl|=n),qt===4&&Ls(e,ot,Kn,!1)),Ga(e))}function pg(e,t,n){if((bt&6)!==0)throw Error(u(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Se(e,t),o=a?mx(e,t):Ld(e,t,!0),r=a;do{if(o===0){Jl&&!a&&Ls(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!fx(n)){o=Ld(e,t,!1),r=!1;continue}if(o===2){if(r=t,e.errorRecoveryDisabledLanes&r)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var p=e;o=ao;var k=p.current.memoizedState.isDehydrated;if(k&&(si(p,f).flags|=256),f=Ld(p,f,!1),f!==2&&f!==6){if(Md&&!k){p.errorRecoveryDisabledLanes|=r,yl|=r,o=4;break e}r=Ln,Ln=o,r!==null&&(Ln===null?Ln=r:Ln.push.apply(Ln,r))}o=f}if(r=!1,o!==2)continue}}if(o===1){si(e,0),Ls(e,t,0,!0);break}e:{switch(a=e,r=o,r){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Ls(a,t,Kn,!Rs);break e;case 2:Ln=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(o=Fr+300-vt(),10<o)){if(Ls(a,t,Kn,!Rs),ge(a,0,!0)!==0)break e;qa=t,a.timeoutHandle=ef(gg.bind(null,a,n,Ln,Wr,_d,t,Kn,yl,Wl,Rs,r,"Throttled",-0,0),o);break e}gg(a,n,Ln,Wr,_d,t,Kn,yl,Wl,Rs,r,null,-0,0)}}break}while(!0);Ga(e)}function gg(e,t,n,a,o,r,f,p,k,O,G,ne,_,H){e.timeoutHandle=-1;var we=t.subtreeFlags,_e=(r&335544064)===r;if(ne=null,(_e||we&8192||(we&16785408)===16785408)&&(ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Oa},Vn=null,rg(t,r,ne),_e&&(we=ne,_e=e.containerInfo,_e=(_e.nodeType===9?_e:_e.ownerDocument).__reactViewTransition,_e!=null&&(we.count++,we.waitingForViewTransition=!0,we=ho.bind(we),_e.finished.then(we,we))),we=(r&62914560)===r?Fr-vt():(r&4194048)===r?fg-vt():0,we=gS(ne,we),we!==null)){qa=r,e.cancelPendingCommit=we(kg.bind(null,e,t,r,n,a,o,f,p,k,O,G,ne,null,_,H)),Ls(e,r,f,!O);return}kg(e,t,r,n,a,o,f,p,k,O,G,ne)}function fx(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var a=0;a<n.length;a++){var o=n[a],r=o.getSnapshot;o=o.value;try{if(!Xn(r(),o))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 Ls(e,t,n,a){t=Je(e,t),t&=~Pr,t&=~yl,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var o=t;0<o;){var r=31-le(o),f=1<<r;a[r]=-1,o&=~f}n!==0&&$n(e,n,t)}function tc(){return(bt&6)===0?(lo(0),!1):!0}function Dd(){if(lt!==null){if(wt===0)var e=lt.return;else e=lt,ns=ll=null,qu(e),Xl=null,qi=0,e=lt;for(;e!==null;)Bp(e.alternate,e),e=e.return;lt=null}}function si(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,zx(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),qa=0,Dd(),Ct=e,lt=n=es(e.current,null),ot=t,wt=0,Qn=null,Rs=!1,Jl=Se(e,t),Md=!1,Wl=Kn=Pr=yl=Os=qt=0,Ln=ao=null,_d=!1,rs=Je(e,t),cr(),n}function yg(e,t){Ze=null,me.H=Dr,t===Gl||t===xr?(t=km(),wt=3):t===Cu?(t=km(),wt=4):wt=t===ad?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qn=t,lt===null&&(qt=1,Lr(e,ia(t,e.current)))}function vg(){var e=cn.current;return e===null?!0:(ot&4194048)===ot?bn===null:(ot&62914560)===ot||(ot&536870912)!==0?e===bn:!1}function bg(){var e=me.H;return me.H=Dr,e===null?Dr:e}function xg(){var e=me.A;return me.A=ux,e}function nc(){qt=4,Rs||(ot&4194048)!==ot&&cn.current!==null||(Jl=!0),(Os&134217727)===0&&(yl&134217727)===0||Ct===null||Ls(Ct,ot,Kn,!1)}function Ld(e,t,n){var a=bt;bt|=2;var o=bg(),r=xg();(Ct!==e||ot!==t)&&(Wr=null,si(e,t)),t=!1;var f=qt;e:do try{if(wt!==0&&lt!==null){var p=lt,k=Qn;switch(wt){case 8:Dd(),f=6;break e;case 3:case 2:case 9:case 6:cn.current===null&&(t=!0);var O=wt;if(wt=0,Qn=null,li(e,p,k,O),n&&Jl){f=0;break e}break;default:O=wt,wt=0,Qn=null,li(e,p,k,O)}}hx(),f=qt;break}catch(G){yg(e,G)}while(!0);return t&&e.shellSuspendCounter++,ns=ll=null,bt=a,me.H=o,me.A=r,lt===null&&(Ct=null,ot=0,cr()),f}function hx(){for(;lt!==null;)Sg(lt)}function mx(e,t){var n=bt;bt|=2;var a=bg(),o=xg();Ct!==e||ot!==t?(Wr=null,Jr=vt()+500,si(e,t)):Jl=Se(e,t);e:do try{if(wt!==0&&lt!==null){t=lt;var r=Qn;t:switch(wt){case 1:wt=0,Qn=null,li(e,t,r,1);break;case 2:case 9:if(wm(r)){wt=0,Qn=null,wg(t);break}t=function(){wt!==2&&wt!==9||Ct!==e||(wt=7),Ga(e)},r.then(t,t);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:wm(r)?(wt=0,Qn=null,wg(t)):(wt=0,Qn=null,li(e,t,r,7));break;case 5:var f=null;switch(lt.tag){case 26:f=lt.memoizedState;case 5:case 27:var p=lt;if(f?hy(f):p.stateNode.complete){wt=0,Qn=null;var k=p.sibling;if(k!==null)lt=k;else{var O=p.return;O!==null?(lt=O,ac(O)):lt=null}break t}}wt=0,Qn=null,li(e,t,r,5);break;case 6:wt=0,Qn=null,li(e,t,r,6);break;case 8:Dd(),qt=6;break e;default:throw Error(u(462))}}px();break}catch(G){yg(e,G)}while(!0);return ns=ll=null,me.H=a,me.A=o,bt=n,lt!==null?0:(Ct=null,ot=0,cr(),qt)}function px(){for(;lt!==null&&!Hn();)Sg(lt)}function Sg(e){var t=Up(e.alternate,e,rs);e.memoizedProps=e.pendingProps,t===null?ac(e):lt=t}function wg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Mp(n,t,t.pendingProps,t.type,void 0,ot);break;case 11:t=Mp(n,t,t.pendingProps,t.type.render,t.ref,ot);break;case 5:qu(t);var a=t;a===nn&&(et?(pr(a),a.tag===5&&a.stateNode!=null&&(Mt=a.stateNode)):(pr(a),et=!0));default:Bp(n,t),t=lt=dm(t,rs),t=Up(n,t,rs)}e.memoizedProps=e.pendingProps,t===null?ac(e):lt=t}function li(e,t,n,a){ns=ll=null,qu(t),Xl=null,qi=0;var o=t.return;try{if(nx(e,o,t,n,ot)){qt=1,Lr(e,ia(n,e.current)),lt=null;return}}catch(r){if(o!==null)throw lt=o,r;qt=1,Lr(e,ia(n,e.current)),lt=null;return}t.flags&32768?(et||a===1?e=!0:Jl||(ot&536870912)!==0?e=!1:(Rs=e=!0,(a===2||a===9||a===3||a===6)&&(a=cn.current,a!==null&&a.tag===13&&(a.flags|=16384))),Ag(t,e)):ac(t)}function ac(e){var t=e;do{if((t.flags&32768)!==0){Ag(t,Rs);return}e=t.return;var n=ix(t.alternate,t,rs);if(n!==null){lt=n;return}if(t=t.sibling,t!==null){lt=t;return}lt=t=e}while(t!==null);qt===0&&(qt=5)}function Ag(e,t){do{var n=ox(e.alternate,e);if(n!==null){n.flags&=32767,lt=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){lt=e;return}lt=e=n}while(e!==null);qt=6,lt=null}function kg(e,t,n,a,o,r,f,p,k,O,G,ne){e.cancelPendingCommit=null;do sc();while(It!==0);if((bt&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));e===Ct&&(lt=Ct=null,ot=0),vl=t,Aa=e,qa=n,Od=o,hg=a,gx(e,t,n,f,p,k,ne)}}function gx(e,t,n,a,o,r,f){var p=t.lanes|t.childLanes;if(Rd=p,p|=gu,Bt(e,n,p,a,o,r),ti=null,(n&335544064)===n?(ni=Xb(e),a=10262):(ni=null,a=10256),(t.subtreeFlags&a)!==0||(t.flags&a)!==0?(e.callbackNode=null,e.callbackPriority=0,wx(An,function(){return Bd(),null})):(e.callbackNode=null,e.callbackPriority=0),Gr=!1,a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null,o=De.p,De.p=2,r=bt,bt|=4;try{rx(e,t,n)}finally{bt=r,De.p=o,me.T=a}}It=1,Gr?ei=qx(f,e.containerInfo,ni,zd,Ud,vx,Id,Bd,yx):(zd(),Ud(),Id())}function yx(e){if(It!==0){var t=Aa.onRecoverableError;t(e,{componentStack:null})}}function vx(){It===3&&(It=0,ig(vl,Aa),It=4)}function zd(){if(It===1){It=0;var e=Aa,t=vl,n=qa,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null;var o=De.p;De.p=2;var r=bt;bt|=4;try{eo=Vr=!1,sg(t,e,n),n=Fd;var f=tm(e.containerInfo),p=n.focusedElem,k=n.selectionRange;if(f!==p&&p&&p.ownerDocument&&em(p.ownerDocument.documentElement,p)){if(k!==null&&du(p)){var O=k.start,G=k.end;if(G===void 0&&(G=O),"selectionStart"in p)p.selectionStart=O,p.selectionEnd=Math.min(G,p.value.length);else{var ne=p.ownerDocument||document,_=ne&&ne.defaultView||window;if(_.getSelection){var H=_.getSelection(),we=p.textContent.length,_e=Math.min(k.start,we),Pe=k.end===void 0?_e:Math.min(k.end,we);!H.extend&&_e>Pe&&(f=Pe,Pe=_e,_e=f);var R=Wh(p,_e),E=Wh(p,Pe);if(R&&E&&(H.rangeCount!==1||H.anchorNode!==R.node||H.anchorOffset!==R.offset||H.focusNode!==E.node||H.focusOffset!==E.offset)){var B=ne.createRange();B.setStart(R.node,R.offset),H.removeAllRanges(),_e>Pe?(H.addRange(B),H.extend(E.node,E.offset)):(B.setEnd(E.node,E.offset),H.addRange(B))}}}}for(ne=[],H=p;H=H.parentNode;)H.nodeType===1&&ne.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<ne.length;p++){var te=ne[p];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}hi=!!Pd,Fd=Pd=null}finally{bt=r,De.p=o,me.T=a}}e.current=t,It=2}}function Ud(){if(It===2){It=0;var e=Aa,t=vl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=me.T,me.T=null;var a=De.p;De.p=2;var o=bt;bt|=4;try{Jp(e,t.alternate,t)}finally{bt=o,De.p=a,me.T=n}}It=3}}function Id(){if(It===4||It===3){It=0;var e=ei;ei=null,tn();var t=Aa,n=vl,a=qa,o=hg,r=(a&335544064)===a?10262:10256;if((n.subtreeFlags&r)!==0||(n.flags&r)!==0?It=5:(It=0,vl=Aa=null,Tg(t,t.pendingLanes)),r=t.pendingLanes,r===0&&(Ds=null),_a(a),n=n.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(yn,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=me.T,r=De.p,De.p=2,me.T=null;try{for(var f=t.onRecoverableError,p=0;p<o.length;p++){var k=o[p];f(k.value,{componentStack:k.stack})}}finally{me.T=n,De.p=r}}if(o=ti,f=ni,ni=null,o!==null&&(ti=null,f===null&&(f=[]),e!==null))for(k=0;k<o.length;k++)n=(0,o[k])(f),n!==void 0&&e.finished.finally(n);(qa&3)!==0&&sc(),Ga(t),r=t.pendingLanes,(a&261930)!==0&&(r&42)!==0?t===ec?so++:(so=0,ec=t):(so=0,ec=null),lo(0)}}function Tg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Bi(t)))}function sc(){return ei!==null&&(ei.skipTransition(),ei=null),zd(),Ud(),Id(),Bd()}function Bd(){if(It!==5)return!1;var e=Aa,t=Rd;Rd=0;var n=_a(qa),a=me.T,o=De.p;try{De.p=32>n?32:n,me.T=null,n=Od,Od=null;var r=Aa,f=qa;if(It=0,vl=Aa=null,qa=0,(bt&6)!==0)throw Error(u(331));var p=bt;if(bt|=4,ug(r.current),og(r,r.current,f,n),bt=p,lo(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(yn,r)}catch{}return!0}finally{De.p=o,me.T=a,Tg(e,t)}}function jg(e,t,n){t=ia(n,t),t=nd(e.stateNode,t,2),e=js(e,t,2),e!==null&&(st(e,2),Ga(e))}function At(e,t,n){if(e.tag===3)jg(e,e,n);else for(;t!==null;){if(t.tag===3){jg(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ds===null||!Ds.has(a))){e=ia(n,e),n=wp(2),a=js(t,n,2),a!==null&&(Ap(n,a,t,e),st(a,2),Ga(a));break}}t=t.return}}function Hd(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new dx;var o=new Set;a.set(t,o)}else o=a.get(t),o===void 0&&(o=new Set,a.set(t,o));o.has(n)||(Md=!0,o.add(n),e=bx.bind(null,e,t,n),t.then(e,e))}function bx(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ct===e&&(ot&n)===n&&((qt===4||qt===3&&(ot&62914560)===ot&&300>vt()-Fr)&&(bt&2)===0?si(e,0):Pr|=n,Wl===ot&&(Wl=0)),Ga(e)}function Ng(e,t){t===0&&(t=at()),e=nl(e,t),e!==null&&(st(e,t),Ga(e))}function xx(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ng(e,n)}function Sx(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(u(314))}a!==null&&a.delete(t),Ng(e,n)}function wx(e,t){return gn(e,t)}var ii=null,oi=null,$d=!1,lc=!1,qd=!1,zs=0;function Ga(e){e!==oi&&e.next===null&&(oi===null?ii=oi=e:oi=oi.next=e),lc=!0,$d||($d=!0,kx())}function lo(e,t){if(!qd&&lc){qd=!0;do for(var n=!1,a=ii;a!==null;){if(e!==0){var o=a.pendingLanes;if(o===0)var r=0;else{var f=a.suspendedLanes,p=a.pingedLanes;r=(1<<31-le(42|e)+1)-1,r&=o&~(f&~p),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,_g(a,r))}else r=ot,r=ge(a,a===Ct?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(r&3)===0||Se(a,r)||(n=!0,_g(a,r));a=a.next}while(n);qd=!1}}function Ax(){Eg()}function Eg(){lc=$d=!1;var e=0;zs!==0&&Lx()&&(e=zs);for(var t=vt(),n=null,a=ii;a!==null;){var o=a.next,r=Cg(a,t);r===0?(a.next=null,n===null?ii=o:n.next=o,o===null&&(oi=n)):(n=a,(e!==0||(r&3)!==0)&&(lc=!0)),a=o}It!==0&&It!==5||lo(e),zs!==0&&(zs=0)}function Cg(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,o=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var f=31-le(r),p=1<<f,k=o[f];k===-1?((p&n)===0||(p&a)!==0)&&(o[f]=ut(p,t)):k<=t&&(e.expiredLanes|=p),r&=~p}if(t=Ct,n=ot,n=ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(wt===2||wt===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&ma(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Se(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&ma(a),_a(n)){case 2:case 8:n=wn;break;case 32:n=An;break;case 268435456:n=na;break;default:n=An}return a=Mg.bind(null,e),n=gn(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&ma(a),e.callbackPriority=2,e.callbackNode=null,2}function Mg(e,t){if(It!==0&&It!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(sc()&&e.callbackNode!==n)return null;var a=ot;return a=ge(e,e===Ct?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(pg(e,a,t),Cg(e,vt()),e.callbackNode!=null&&e.callbackNode===n?Mg.bind(null,e):null)}function _g(e,t){if(sc())return null;pg(e,t,!0)}function kx(){Ux(function(){(bt&6)!==0?gn(Sn,Ax):Eg()})}function Gd(){if(zs===0){var e=rl;e===0&&(e=We,We<<=1,(We&261888)===0&&(We=256)),zs=e}return zs}function Rg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:tr(e)}function Tx(e,t,n,a,o){if(t==="submit"&&n&&n.stateNode===o){var r=Rg((o[Ut]||null).action),f=a.submitter;f&&(t=(t=f[Ut]||null)?Rg(t.formAction):f.getAttribute("formAction"),t!==null&&(r=t,f=null));var p=new lr("action","action",null,a,o);e.push({event:p,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(zs!==0){var k=new FormData(o,f);Fu(n,{pending:!0,data:k,method:o.method,action:r},null,k)}}else typeof r=="function"&&(p.preventDefault(),k=new FormData(o,f),Fu(n,{pending:!0,data:k,method:o.method,action:r},r,k))},currentTarget:o}]})}}for(var Xd=0;Xd<pu.length;Xd++){var Yd=pu[Xd],jx=Yd.toLowerCase(),Nx=Yd[0].toUpperCase()+Yd.slice(1);ba(jx,"on"+Nx)}ba(sm,"onAnimationEnd"),ba(lm,"onAnimationIteration"),ba(im,"onAnimationStart"),ba("dblclick","onDoubleClick"),ba("focusin","onFocus"),ba("focusout","onBlur"),ba(zb,"onTransitionRun"),ba(Ub,"onTransitionStart"),ba(Ib,"onTransitionCancel"),ba(om,"onTransitionEnd"),qn("onMouseEnter",["mouseout","mouseover"]),qn("onMouseLeave",["mouseout","mouseover"]),qn("onPointerEnter",["pointerout","pointerover"]),qn("onPointerLeave",["pointerout","pointerover"]),Ra("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ra("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ra("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ra("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ra("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ra("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var io="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(" "),Ex=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(io));function Og(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],o=a.event;a=a.listeners;e:{var r=void 0;if(t)for(var f=a.length-1;0<=f;f--){var p=a[f],k=p.instance,O=p.currentTarget;if(p=p.listener,k!==r&&o.isPropagationStopped())break e;r=p,o.currentTarget=O;try{r(o)}catch(G){rr(G)}o.currentTarget=null,r=k}else for(f=0;f<a.length;f++){if(p=a[f],k=p.instance,O=p.currentTarget,p=p.listener,k!==r&&o.isPropagationStopped())break e;r=p,o.currentTarget=O;try{r(o)}catch(G){rr(G)}o.currentTarget=null,r=k}}}}function it(e,t){var n=t[Yo];n===void 0&&(n=t[Yo]=new Set);var a=e+"__bubble";n.has(a)||(Dg(t,e,2,!1),n.add(a))}function Vd(e,t,n){var a=0;t&&(a|=4),Dg(n,e,a,t)}var ic="_reactListening"+Math.random().toString(36).slice(2);function Qd(e){if(!e[ic]){e[ic]=!0,Js.forEach(function(n){n!=="selectionchange"&&(Ex.has(n)||Vd(n,!1,e),Vd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ic]||(t[ic]=!0,Vd("selectionchange",!1,t))}}function Dg(e,t,n,a){switch(Ay(t)){case 2:var o=xS;break;case 8:o=SS;break;default:o=mf}n=o.bind(null,t,n,e),o=void 0,!tu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),a?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Kd(e,t,n,a,o){var r=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var f=a.tag;if(f===3||f===4){var p=a.stateNode.containerInfo;if(p===o)break;if(f===4)for(f=a.return;f!==null;){var k=f.tag;if((k===3||k===4)&&f.stateNode.containerInfo===o)return;f=f.return}for(;p!==null;){if(f=ya(p),f===null)return;if(k=f.tag,k===5||k===6||k===26||k===27){a=r=f;continue e}p=p.parentNode}}a=a.return}Dh(function(){var O=r,G=Wc(n),ne=[];e:{var _=rm.get(e);if(_!==void 0){var H=lr,we=e;switch(e){case"keypress":if(ar(n)===0)break e;case"keydown":case"keyup":H=fb;break;case"focusin":we="focus",H=lu;break;case"focusout":we="blur",H=lu;break;case"beforeblur":case"afterblur":H=lu;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":H=Uh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=eb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=yb;break;case sm:case lm:case im:H=ab;break;case om:H=bb;break;case"scroll":case"scrollend":H=J0;break;case"wheel":H=Sb;break;case"copy":case"cut":case"paste":H=lb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=Bh;break;case"submit":H=pb;break;case"toggle":case"beforetoggle":H=Ab}var _e=(t&4)!==0,Pe=!_e&&(e==="scroll"||e==="scrollend"),R=_e?_!==null?_+"Capture":null:_;_e=[];for(var E=O,B;E!==null;){var te=E;if(B=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||B===null||R===null||(te=Ei(E,R),te!=null&&_e.push(oo(E,te,B))),Pe)break;E=E.return}0<_e.length&&(_=new H(_,we,null,n,G),ne.push({event:_,listeners:_e}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",_=e==="mouseout"||e==="pointerout",H&&n!==Jc&&(we=n.relatedTarget||n.fromElement)&&(ya(we)||we[_n]))break e;(_||H)&&(we=G.window===G?G:(H=G.ownerDocument)?H.defaultView||H.parentWindow:window,_?(H=n.relatedTarget||n.toElement,_=O,H=H?ya(H):null,H!==null&&(Pe=h(H),_e=H.tag,H!==Pe||_e!==5&&_e!==27&&_e!==6)&&(H=null)):(_=null,H=O),_!==H&&(_e=Uh,te="onMouseLeave",R="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(_e=Bh,te="onPointerLeave",R="onPointerEnter",E="pointer"),Pe=_==null?we:aa(_),B=H==null?we:aa(H),we=new _e(te,E+"leave",_,n,G),we.target=Pe,we.relatedTarget=B,te=null,ya(G)===O&&(_e=new _e(R,E+"enter",H,n,G),_e.target=B,_e.relatedTarget=Pe,te=_e),Pe=te,_e=_&&H?I(_,H,Cx):null,_!==null&&Lg(ne,we,_,_e,!1),H!==null&&Pe!==null&&Lg(ne,Pe,H,_e,!0)))}e:{if(_=O?aa(O):window,H=_.nodeName&&_.nodeName.toLowerCase(),H==="select"||H==="input"&&_.type==="file")var Ee=Qh;else if(Yh(_))if(Kh)Ee=Ob;else{Ee=_b;var rt=Mb}else H=_.nodeName,!H||H.toLowerCase()!=="input"||_.type!=="checkbox"&&_.type!=="radio"?O&&Fc(O.elementType)&&(Ee=Qh):Ee=Rb;if(Ee&&(Ee=Ee(e,O))){Vh(ne,Ee,n,G);break e}rt&&rt(e,_,O)}switch(rt=O?aa(O):window,e){case"focusin":(Yh(rt)||rt.contentEditable==="true")&&(Ll=rt,fu=O,zi=null);break;case"focusout":zi=fu=Ll=null;break;case"mousedown":hu=!0;break;case"contextmenu":case"mouseup":case"dragend":hu=!1,nm(ne,n,G);break;case"selectionchange":if(Lb)break;case"keydown":case"keyup":nm(ne,n,G)}var Ue;if(ou)e:{switch(e){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Dl?Gh(e,n)&&(Xe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Xe="onCompositionStart");Xe&&(Hh&&n.locale!=="ko"&&(Dl||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Dl&&(Ue=Lh()):(ys=G,nu="value"in ys?ys.value:ys.textContent,Dl=!0)),rt=oc(O,Xe),0<rt.length&&(Xe=new Ih(Xe,e,null,n,G),ne.push({event:Xe,listeners:rt}),Ue?Xe.data=Ue:(Ue=Xh(n),Ue!==null&&(Xe.data=Ue)))),(Ue=Tb?jb(e,n):Nb(e,n))&&(Xe=oc(O,"onBeforeInput"),0<Xe.length&&(rt=new Ih("onBeforeInput","beforeinput",null,n,G),ne.push({event:rt,listeners:Xe}),rt.data=Ue)),Tx(ne,e,O,n,G)}Og(ne,t)})}function oo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function oc(e,t){for(var n=t+"Capture",a=[];e!==null;){var o=e,r=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||r===null||(o=Ei(e,n),o!=null&&a.unshift(oo(e,o,r)),o=Ei(e,t),o!=null&&a.push(oo(e,o,r))),e.tag===3)return a;e=e.return}return[]}function Cx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Lg(e,t,n,a,o){for(var r=t._reactName,f=[];n!==null&&n!==a;){var p=n,k=p.alternate,O=p.stateNode;if(p=p.tag,k!==null&&k===a)break;p!==5&&p!==26&&p!==27||O===null||(k=O,o?(O=Ei(n,r),O!=null&&f.unshift(oo(n,O,k))):o||(O=Ei(n,r),O!=null&&f.push(oo(n,O,k)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var Mx=/\r\n?/g,_x=/\u0000|\uFFFD/g;function zg(e){return(typeof e=="string"?e:""+e).replace(Mx,`
49
+ `).replace(_x,"")}function Ug(e,t){return t=zg(t),zg(e)===t}function kt(e,t,n,a,o,r){switch(n){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||Ht(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&Ht(e,""+a);else return;break;case"className":Za(e,"class",a);break;case"tabIndex":Za(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Za(e,n,a);break;case"style":Rh(e,a,r);return;case"data":if(t!=="object"){Za(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=tr(a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof r=="function"&&(n==="formAction"?(t!=="input"&&kt(e,t,"name",o.name,o,null),kt(e,t,"formEncType",o.formEncType,o,null),kt(e,t,"formMethod",o.formMethod,o,null),kt(e,t,"formTarget",o.formTarget,o,null)):(kt(e,t,"encType",o.encType,o,null),kt(e,t,"method",o.method,o,null),kt(e,t,"target",o.target,o,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=tr(a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Oa);return;case"onScroll":a!=null&&it("scroll",e);return;case"onScrollEnd":a!=null&&it("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(n=a.__html,n!=null){if(o.children!=null)throw Error(u(60));(r!=null?r.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=tr(a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":it("beforetoggle",e),it("toggle",e),Ws(e,"popover",a);break;case"xlinkActuate":Gn(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Gn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Gn(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Gn(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Gn(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Gn(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Ws(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=P0.get(n)||n,Ws(e,n,a);else return}dt=!0}function Zd(e,t,n,a,o,r){switch(n){case"style":Rh(e,a,r);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(n=a.__html,n!=null){if(o.children!=null)throw Error(u(60));(r!=null?r.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof a=="string")Ht(e,a);else if(typeof a=="number"||typeof a=="bigint")Ht(e,""+a);else return;break;case"onScroll":a!=null&&it("scroll",e);return;case"onScrollEnd":a!=null&&it("scrollend",e);return;case"onClick":a!=null&&(e.onclick=Oa);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Zo.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),r=n.slice(2,o?n.length-7:void 0),t=e[Ut]||null,t=t!=null?t[n]:null,typeof t=="function"&&e.removeEventListener(r,t,o),typeof a=="function")){typeof t!="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(r,a,o);break e}dt=!0,n in e?e[n]=a:a===!0?e.setAttribute(n,""):Ws(e,n,a)}return}dt=!0}function fn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",e),it("load",e);var a=!1,o=!1,r;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"src":a=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:kt(e,t,r,f,n,null)}}o&&kt(e,t,"srcSet",n.srcSet,n,null),a&&kt(e,t,"src",n.src,n,null);return;case"input":it("invalid",e);var p=r=f=o=null,k=null,O=null;for(a in n)if(n.hasOwnProperty(a)){var G=n[a];if(G!=null)switch(a){case"name":o=G;break;case"type":f=G;break;case"checked":k=G;break;case"defaultChecked":O=G;break;case"value":r=G;break;case"defaultValue":p=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(u(137,t));break;default:kt(e,t,a,G,n,null)}}Rt(e,r,p,k,O,f,o,!1);return;case"select":it("invalid",e),a=f=r=null;for(o in n)if(n.hasOwnProperty(o)&&(p=n[o],p!=null))switch(o){case"value":r=p;break;case"defaultValue":f=p;break;case"multiple":a=p;default:kt(e,t,o,p,n,null)}t=r,n=f,e.multiple=!!a,t!=null?Qt(e,!!a,t,!1):n!=null&&Qt(e,!!a,n,!0);return;case"textarea":it("invalid",e),r=o=a=null;for(f in n)if(n.hasOwnProperty(f)&&(p=n[f],p!=null))switch(f){case"value":a=p;break;case"defaultValue":o=p;break;case"children":r=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(u(91));break;default:kt(e,t,f,p,n,null)}_l(e,a,o,r);return;case"option":for(k in n)if(n.hasOwnProperty(k)&&(a=n[k],a!=null))switch(k){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:kt(e,t,k,a,n,null)}return;case"dialog":it("beforetoggle",e),it("toggle",e),it("cancel",e),it("close",e);break;case"iframe":case"object":it("load",e);break;case"video":case"audio":for(a=0;a<io.length;a++)it(io[a],e);break;case"image":it("error",e),it("load",e);break;case"details":it("toggle",e);break;case"embed":case"source":case"link":it("error",e),it("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(O in n)if(n.hasOwnProperty(O)&&(a=n[O],a!=null))switch(O){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:kt(e,t,O,a,n,null)}return;default:if(Fc(t)){for(G in n)n.hasOwnProperty(G)&&(a=n[G],a!==void 0&&Zd(e,t,G,a,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(a=n[p],a!=null&&kt(e,t,p,a,n,null))}var Rx={};function Ox(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,r=null,f=null,p=null,k=null,O=null,G=null;for(H in n){var ne=n[H];if(n.hasOwnProperty(H)&&ne!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":k=ne;default:a.hasOwnProperty(H)||kt(e,t,H,null,a,ne)}}for(var _ in a){var H=a[_];if(ne=n[_],a.hasOwnProperty(_)&&(H!=null||ne!=null))switch(_){case"type":H!==ne&&(dt=!0),r=H;break;case"name":H!==ne&&(dt=!0),o=H;break;case"checked":H!==ne&&(dt=!0),O=H;break;case"defaultChecked":H!==ne&&(dt=!0),G=H;break;case"value":H!==ne&&(dt=!0),f=H;break;case"defaultValue":H!==ne&&(dt=!0),p=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(u(137,t));break;default:H!==ne&&kt(e,t,_,H,a,ne)}}nt(e,f,p,k,O,G,r,o);return;case"select":H=f=p=_=null;for(r in n)if(k=n[r],n.hasOwnProperty(r)&&k!=null)switch(r){case"value":break;case"multiple":H=k;default:a.hasOwnProperty(r)||kt(e,t,r,null,a,k)}for(o in a)if(r=a[o],k=n[o],a.hasOwnProperty(o)&&(r!=null||k!=null))switch(o){case"value":r!==k&&(dt=!0),_=r;break;case"defaultValue":r!==k&&(dt=!0),p=r;break;case"multiple":r!==k&&(dt=!0),f=r;default:r!==k&&kt(e,t,o,r,a,k)}t=p,n=f,a=H,_!=null?Qt(e,!!n,_,!1):!!a!=!!n&&(t!=null?Qt(e,!!n,t,!0):Qt(e,!!n,n?[]:"",!1));return;case"textarea":H=_=null;for(p in n)if(o=n[p],n.hasOwnProperty(p)&&o!=null&&!a.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:kt(e,t,p,null,a,o)}for(f in a)if(o=a[f],r=n[f],a.hasOwnProperty(f)&&(o!=null||r!=null))switch(f){case"value":o!==r&&(dt=!0),_=o;break;case"defaultValue":o!==r&&(dt=!0),H=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(u(91));break;default:o!==r&&kt(e,t,f,o,a,r)}Pa(e,_,H);return;case"option":for(var we in n)if(_=n[we],n.hasOwnProperty(we)&&_!=null&&!a.hasOwnProperty(we))switch(we){case"selected":e.selected=!1;break;default:kt(e,t,we,null,a,_)}for(k in a)if(_=a[k],H=n[k],a.hasOwnProperty(k)&&_!==H&&(_!=null||H!=null))switch(k){case"selected":_!==H&&(dt=!0),e.selected=_&&typeof _!="function"&&typeof _!="symbol";break;default:kt(e,t,k,_,a,H)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _e in n)_=n[_e],n.hasOwnProperty(_e)&&_!=null&&!a.hasOwnProperty(_e)&&kt(e,t,_e,null,a,_);for(O in a)if(_=a[O],H=n[O],a.hasOwnProperty(O)&&_!==H&&(_!=null||H!=null))switch(O){case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(u(137,t));break;default:kt(e,t,O,_,a,H)}return;default:if(Fc(t)){for(var Pe in n)_=n[Pe],n.hasOwnProperty(Pe)&&_!==void 0&&!a.hasOwnProperty(Pe)&&Zd(e,t,Pe,void 0,a,_);for(G in a)_=a[G],H=n[G],!a.hasOwnProperty(G)||_===H||_===void 0&&H===void 0||Zd(e,t,G,_,a,H);return}}for(var R in n)_=n[R],n.hasOwnProperty(R)&&_!=null&&!a.hasOwnProperty(R)&&kt(e,t,R,null,a,_);for(ne in a)_=a[ne],H=n[ne],!a.hasOwnProperty(ne)||_===H||_==null&&H==null||kt(e,t,ne,_,a,H)}function Ig(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Dx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),a=0;a<n.length;a++){var o=n[a],r=o.transferSize,f=o.initiatorType,p=o.duration;if(r&&p&&Ig(f)){for(f=0,p=o.responseEnd,a+=1;a<n.length;a++){var k=n[a],O=k.startTime;if(O>p)break;var G=k.transferSize,ne=k.initiatorType;G&&Ig(ne)&&(k=k.responseEnd,f+=G*(k<p?1:(p-O)/(k-O)))}if(--a,t+=8*(r+f)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Pd=null,Fd=null;function ro(e){return e.nodeType===9?e:e.ownerDocument}function Bg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Hg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function $g(e,t,n,a){return n=ro(n).createElement(e),n[zt]=a,n[Ut]=t,fn(n,e,t),St(n),n}function Jd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Lx(){var e=window.event;return e&&e.type==="popstate"?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var ef=typeof setTimeout=="function"?setTimeout:void 0,zx=typeof clearTimeout=="function"?clearTimeout:void 0,qg=typeof Promise=="function"?Promise:void 0,Gg=typeof requestAnimationFrame=="function"?requestAnimationFrame:ef,Ux=typeof queueMicrotask=="function"?queueMicrotask:typeof qg<"u"?function(e){return qg.resolve(null).then(e).catch(Ix)}:ef;function Ix(e){setTimeout(function(){throw e})}function Us(e){return e==="head"}function Xg(e,t){var n=t,a=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(a===0){e.removeChild(o),mi(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")cf(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,cf(n);for(var r=n.firstChild;r;){var f=r.nextSibling,p=r.nodeName;r[gs]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=f}}else n==="body"&&cf(e.ownerDocument.body);n=o}while(n);mi(t)}function Yg(e,t){var n=e;e=0;do{var a=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function Vg(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var o=a=0;o<t.length;o++){var r=t[o];0<r.width&&0<r.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function Qg(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n=="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n=="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n=="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n=="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Bx(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function tf(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return Bx(t,n,e)}function Hx(e){return e.documentElement.clientHeight}function $x(e){this.addEventListener("load",e),this.addEventListener("error",e)}function qx(e,t,n,a,o,r,f,p,k){var O=t.nodeType===9?t:t.ownerDocument;try{var G=O.startViewTransition({update:function(){var _=O.defaultView,H=_.navigation&&_.navigation.transition,we=O.fonts.status;a();var _e=[];if(we==="loaded"&&(Hx(O),O.fonts.status==="loading"&&_e.push(O.fonts.ready)),we=_e.length,e!==null)for(var Pe=e.suspenseyImages,R=0,E=0;E<Pe.length;E++){var B=Pe[E];if(!B.complete){var te=B.getBoundingClientRect();if(0<te.bottom&&0<te.right&&te.top<_.innerHeight&&te.left<_.innerWidth){if(R+=my(B),R>uc){_e.length=we;break}B=new Promise($x.bind(B)),_e.push(B)}}}if(0<_e.length)return _=Promise.race([Promise.all(_e),new Promise(function(Ee){return setTimeout(Ee,500)})]).then(o,o),(H?Promise.allSettled([H.finished,_]):_).then(r,r);if(o(),H)return H.finished.then(r,r);r()},types:n});O.__reactViewTransition=G;var ne=[];return G.ready.then(function(){for(var _=O.documentElement.getAnimations({subtree:!0}),H=0;H<_.length;H++){var we=_[H],_e=we.effect,Pe=_e.pseudoElement;if(Pe!=null&&Pe.startsWith("::view-transition")){ne.push(we),we=_e.getKeyframes();for(var R=Pe=void 0,E=!0,B=0;B<we.length;B++){var te=we[B],Ee=te.width;if(Pe===void 0)Pe=Ee;else if(Pe!==Ee){E=!1;break}if(Ee=te.height,R===void 0)R=Ee;else if(R!==Ee){E=!1;break}delete te.width,delete te.height,te.transform==="none"&&delete te.transform}E&&Pe!==void 0&&R!==void 0&&(_e.setKeyframes(we),E=getComputedStyle(_e.target,_e.pseudoElement),E.width!==Pe||E.height!==R)&&(E=we[0],E.width=Pe,E.height=R,E=we[we.length-1],E.width=Pe,E.height=R,_e.setKeyframes(we))}}f()},function(_){O.__reactViewTransition===G&&(O.__reactViewTransition=null);try{if(typeof _=="object"&&_!==null)switch(_.name){case"InvalidStateError":(_.message==="View transition was skipped because document visibility state is hidden."||_.message==="Skipping view transition because document visibility state has become hidden."||_.message==="Skipping view transition because viewport size changed."||_.message==="Transition was aborted because of invalid state")&&(_=null)}_!==null&&k(_)}finally{a(),o(),f()}}),G.finished.finally(function(){for(var _=0;_<ne.length;_++)ne[_].cancel();O.__reactViewTransition===G&&(O.__reactViewTransition=null),p()}),G}catch{return a(),o(),f(),null}}function bl(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}bl.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:X({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},bl.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),a=[],o=0;o<n.length;o++){var r=n[o].effect;r!==null&&r.target===e&&r.pseudoElement===t&&a.push(n[o])}return a},bl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Kg(e){return{name:e,group:new bl("group",e),imagePair:new bl("image-pair",e),old:new bl("old",e),new:new bl("new",e)}}function Pn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Pn.prototype.addEventListener=function(e,t,n){var a=null,o=null;if(!(n!=null&&typeof n!="boolean"&&(a=n.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var r=this._eventListeners;if(Pg(r,e,t,n)===-1){var f=this,p=t;n!=null&&typeof n!="boolean"&&n.once===!0&&(p=function(k){f.removeEventListener(e,t,n),typeof t=="function"?t.call(this,k):t.handleEvent(k)}),a!==null&&(o=f.removeEventListener.bind(f,e,t,n),a.addEventListener("abort",o,{once:!0}),o=a.removeEventListener.bind(a,"abort",o)),a=ri(n),r.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:p,cleanup:o}),b(this._fragmentFiber.child,!1,Gx,e,p,a)}this._eventListeners=r}};function Gx(e,t,n,a){return D(e).addEventListener(t,n,a),!1}Pn.prototype.removeEventListener=function(e,t,n){var a=this._eventListeners;if(a!==null&&(t=Pg(a,e,t,n),t!==-1)){var o=a[t];n=o.attachedListener;var r=o.cleanup;o=ri(o.optionsOrUseCapture),b(this._fragmentFiber.child,!1,Xx,e,n,o),a.splice(t,1),r!==null&&r()}};function Xx(e,t,n,a){return D(e).removeEventListener(t,n,a),!1}function ri(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Zg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Pg(e,t,n,a){if(e.length===0)return-1;a=Zg(a);for(var o=0;o<e.length;o++){var r=e[o];if(r.type===t&&r.listener===n&&Zg(r.optionsOrUseCapture)===a)return o}return-1}Pn.prototype.dispatchEvent=function(e){var t=x(this._fragmentFiber);if(t===null)return!0;t=D(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var o=0;o<n.length;o++){var r=n[o];a.addEventListener(r.type,r.attachedListener,ri(r.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),n)for(o=0;o<n.length;o++)r=n[o],a.removeEventListener(r.type,r.attachedListener,ri(r.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},Pn.prototype.focus=function(e){b(this._fragmentFiber.child,!0,Fg,e,void 0,void 0)};function Fg(e,t){return e.tag===6?!1:(e=D(e),nS(e,t))}Pn.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,nf,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Fg(t[n],e);n--);};function nf(e,t){return t.push(e),!1}Pn.prototype.blur=function(){var e=x(this._fragmentFiber);e!==null&&(e=D(e),e=ro(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Yx,e,void 0,void 0))};function Yx(e,t){return e.tag===6?!1:(e=D(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Pn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),b(this._fragmentFiber.child,!1,Vx,e,void 0,void 0)};function Vx(e,t){return e.tag===6||(e=D(e),t.observe(e)),!1}Pn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),b(this._fragmentFiber.child,!1,Qx,e,void 0,void 0);for(var n=t=0;n<ka.length;n++){var a=ka[n];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):ka[t++]=a}ka.length=t}};function Qx(e,t){return e.tag===6||(e=D(e),t.unobserve(e)),!1}var ka=[],af=!1;function Kx(e,t,n){ka.push({fragmentInstance:e,observer:t,instance:n}),af||(af=!0,aS(function(){af=!1;var a=ka;ka=[];for(var o=0;o<a.length;o++){var r=a[o];r.observer.unobserve(r.instance)}}))}Pn.prototype.getClientRects=function(){var e=[];return b(this._fragmentFiber.child,!1,Zx,e,void 0,void 0),e};function Zx(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=D(e),t.push.apply(t,e.getClientRects());return!1}Pn.prototype.getRootNode=function(e){var t=x(this._fragmentFiber);return t===null?this:D(t).getRootNode(e)},Pn.prototype.compareDocumentPosition=function(e){var t=x(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];b(this._fragmentFiber.child,!1,nf,n,void 0,void 0);var a=D(t);if(n.length===0){if(n=a,T(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var o=a=n.compareDocumentPosition(e);return n===e?o=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=z(t)[1],n===null?o=Node.DOCUMENT_POSITION_PRECEDING:(e=D(n).compareDocumentPosition(e),o=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),o|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=D(n[0]),o=D(n[n.length-1]);var r=T(this._fragmentFiber)?t.parentElement:a;if(r==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=r.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,r=r.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY;var f=t.compareDocumentPosition(e),p=o.compareDocumentPosition(e),k=f&Node.DOCUMENT_POSITION_CONTAINED_BY||p&Node.DOCUMENT_POSITION_CONTAINED_BY;return p=a&&r&&f&Node.DOCUMENT_POSITION_FOLLOWING&&p&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||r&&o===e||k||p?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!r&&o===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:f,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Px(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Px(e,t,n,a,o){var r=ya(o);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!r)e:{for(;r!==null;){if(r.tag===7&&(r===t||r.alternate===t)){n=!0;break e}r=r.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(r===null)return r=o.ownerDocument,o===r||o===r.documentElement||o===r.body;e:{for(r=t,t=x(t);r!==null;){if(!(r.tag!==5&&r.tag!==3&&r.tag!==27||r!==t&&r.alternate!==t)){r=!0;break e}r=r.return}r=!1}return r}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!r)&&!(t=r===n)&&(t=I(n,r,Y),t===null?t=!1:(b(t,!0,he,r,n),r=F,F=null,t=r!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!r)&&!(t=r===a)&&(t=I(a,r,Y),t===null?t=!1:(b(t,!0,C,r,a),r=F,ue=F=null,t=r!==null)),t):!1}function Jg(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Pn.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(u(566));var t=[];b(this._fragmentFiber.child,!1,nf,t,void 0,void 0);var n=e!==!1;if(t.length===0){var a=z(this._fragmentFiber);if(a=n?a[1]||a[0]||x(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=D(a),Jg(e,n);return}if(a=D(a),a.nodeType!==9){if(a.nodeType===11){n="host"in a?a.host:null,n!==null&&n.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=n?t.length-1:0;a!==(n?-1:t.length);){var o=t[a];o.tag===6?(o=D(o),Jg(o,n)):D(o).scrollIntoView(e),a+=n?-1:1}};function Fx(e,t){return e=D(e),Wg(e,t),!1}function Wg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function ey(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];e.addEventListener(o.type,o.attachedListener,ri(o.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(r){for(var f=0,p=0;p<ka.length;p++){var k=ka[p];(k.fragmentInstance!==t||k.observer!==r||k.instance!==e)&&(ka[f++]=k)}ka.length=f,r.observe(e)}),Wg(e,t))}function Jx(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];e.removeEventListener(o.type,o.attachedListener,ri(o.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(r){typeof r.rootMargin=="string"?Kx(t,r,e):r.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":sf(n),Ka(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Wx(e,t,n,a){for(;e.nodeType===1;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[gs])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=da(e.nextSibling),e===null)break}return null}function eS(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=da(e.nextSibling),e===null))return null;return e}function ty(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=da(e.nextSibling),e===null))return null;return e}function lf(e){return e.data==="$?"||e.data==="$~"}function of(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function tS(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function da(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==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var rf=null;function ny(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return da(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function ay(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function nS(e,t){function n(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return a}function aS(e){Gg(function(){Gg(function(t){return e(t)})})}function sy(e,t,n){switch(t=ro(n),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function ly(e,t,n){for(var a in n){var o=n[a];n.hasOwnProperty(a)&&o!=null&&kt(e,t,a,null,Rx,o)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Oa&&(e.onclick=null),Ka(e)}function cf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ka(e)}var fa=new Map,iy=new Set;function co(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var cs=De.d;De.d={f:sS,r:lS,D:iS,C:oS,L:rS,m:cS,X:dS,S:uS,M:fS};function sS(){var e=cs.f(),t=tc();return e||t}function lS(e){var t=va(e);t!==null&&t.tag===5&&t.type==="form"?rp(t):cs.r(e)}var ci=typeof document>"u"?null:document;function oy(e,t,n){var a=ci;if(a&&typeof t=="string"&&t){var o=Ge(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),iy.has(o)||(iy.add(o),e={rel:e,crossOrigin:n,href:t},a.querySelector(o)===null&&(t=a.createElement("link"),fn(t,"link",e),St(t),a.head.appendChild(t)))}}function iS(e){cs.D(e),oy("dns-prefetch",e,null)}function oS(e,t){cs.C(e,t),oy("preconnect",e,t)}function rS(e,t,n){cs.L(e,t,n);var a=ci;if(a&&e&&t){var o='link[rel="preload"][as="'+Ge(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Ge(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Ge(n.imageSizes)+'"]')):o+='[href="'+Ge(e)+'"]';var r=o;switch(t){case"style":r=ui(e);break;case"script":r=di(e)}if(!(fa.has(r)||(e=X({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),fa.set(r,e),a.querySelector(o)!==null||t==="style"&&a.querySelector(uo(r))||t==="script"&&a.querySelector(fo(r))))){var f=a.createElement("link");fn(f,"link",e),t==="style"&&(f[Fs]=!0,f.onload=f.onerror=function(){Ko(f)}),St(f),a.head.appendChild(f)}}}function cS(e,t){cs.m(e,t);var n=ci;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ge(a)+'"][href="'+Ge(e)+'"]',r=o;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=di(e)}if(!fa.has(r)&&(e=X({rel:"modulepreload",href:e},t),fa.set(r,e),n.querySelector(o)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(fo(r)))return}a=n.createElement("link"),fn(a,"link",e),St(a),n.head.appendChild(a)}}}function uS(e,t,n){cs.S(e,t,n);var a=ci;if(a&&e){var o=sa(a).hoistableStyles,r=ui(e);t=t||"default";var f=o.get(r);if(!f){var p={loading:0,preload:null};if(f=a.querySelector(uo(r)))p.loading=5;else{e=X({rel:"stylesheet",href:e,"data-precedence":t},n),(n=fa.get(r))&&uf(e,n);var k=f=a.createElement("link");St(k),fn(k,"link",e),k._p=new Promise(function(O,G){k.onload=O,k.onerror=G}),k.addEventListener("load",function(){p.loading|=1}),k.addEventListener("error",function(){p.loading|=2}),p.loading|=4,rc(f,t,a)}f={type:"stylesheet",instance:f,count:1,state:p},o.set(r,f)}}}function dS(e,t){cs.X(e,t);var n=ci;if(n&&e){var a=sa(n).hoistableScripts,o=di(e),r=a.get(o);r||(r=n.querySelector(fo(o)),r||(e=X({src:e,async:!0},t),(t=fa.get(o))&&df(e,t),r=n.createElement("script"),St(r),fn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(o,r))}}function fS(e,t){cs.M(e,t);var n=ci;if(n&&e){var a=sa(n).hoistableScripts,o=di(e),r=a.get(o);r||(r=n.querySelector(fo(o)),r||(e=X({src:e,async:!0,type:"module"},t),(t=fa.get(o))&&df(e,t),r=n.createElement("script"),St(r),fn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(o,r))}}function ry(e,t,n,a){var o=(o=Te.current)?co(o):null;if(!o)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=ui(n.href),t=sa(o).hoistableStyles,a=t.get(n),a||(a={type:"style",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ui(n.href);var r=sa(o).hoistableStyles,f=r.get(e);if(f||(o=o.ownerDocument||o,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,f),(r=o.querySelector(uo(e)))?r._p||(f.instance=r,f.state.loading=5):(r=fa.get(e),r||(r={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},fa.set(e,r)),hS(o,e,r,f.state))),t&&a===null)throw Error(u(528,""));return f}if(t&&a!==null)throw Error(u(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(n=di(n),t=sa(o).hoistableScripts,a=t.get(n),a||(a={type:"script",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function ui(e){return'href="'+Ge(e)+'"'}function uo(e){return'link[rel="stylesheet"]['+e+"]"}function cy(e){return X({},e,{"data-precedence":e.precedence,precedence:null})}function hS(e,t,n,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Fs]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Fs]=!0,t.onload=t.onerror=Ko.bind(null,t),fn(t,"link",n),St(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function di(e){return'[src="'+Ge(e)+'"]'}function fo(e){return"script[async]"+e}function uy(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ge(n.href)+'"]');if(a)return t.instance=a,St(a),a;var o=X({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),St(a),fn(a,"style",o),rc(a,n.precedence,e),t.instance=a;case"stylesheet":o=ui(n.href);var r=e.querySelector(uo(o));if(r)return t.state.loading|=4,t.instance=r,St(r),r;a=cy(n),(o=fa.get(o))&&uf(a,o),r=(e.ownerDocument||e).createElement("link"),St(r);var f=r;return f._p=new Promise(function(p,k){f.onload=p,f.onerror=k}),fn(r,"link",a),t.state.loading|=4,rc(r,n.precedence,e),t.instance=r;case"script":return r=di(n.src),(o=e.querySelector(fo(r)))?(t.instance=o,St(o),o):(a=n,(o=fa.get(r))&&(a=X({},n),df(a,o)),e=e.ownerDocument||e,o=e.createElement("script"),St(o),fn(o,"link",a),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,rc(a,n.precedence,e));return t.instance}function rc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=a.length?a[a.length-1]:null,r=o,f=0;f<a.length;f++){var p=a[f];if(p.dataset.precedence===t)r=p;else if(r!==o)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function uf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function df(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var cc=null;function dy(e,t,n){if(cc===null){var a=new Map,o=cc=new Map;o.set(n,a)}else o=cc,a=o.get(n),a||(a=new Map,o.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),o=0;o<n.length;o++){var r=n[o];if(!(r[gs]||r[zt]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var f=r.getAttribute(t)||"";f=e+f;var p=a.get(f);p?p.push(r):a.set(f,[r])}}return a}function ff(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function mS(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function fy(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function hy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function my(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function py(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=my(t),e.suspenseyImages.push(t)),e=yS.bind(e),t.decode().then(e,e))}function pS(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=ui(a.href),r=t.querySelector(uo(o));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ho.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,St(r);return}r=t.ownerDocument||t,a=cy(a),(o=fa.get(o))&&uf(a,o),r=r.createElement("link"),St(r);var f=r;f._p=new Promise(function(p,k){f.onload=p,f.onerror=k}),fn(r,"link",a),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=ho.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var uc=0;function gS(e,t){return e.stylesheets&&e.count===0&&fc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&fc(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&uc===0&&(uc=62500*Dx());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&fc(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>uc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(o)}}:null}function gy(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)fc(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ho(){this.count--,gy(this)}function yS(){this.imgCount--,gy(this)}var dc=null;function fc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,dc=new Map,t.forEach(vS,e),dc=null,ho.call(e))}function vS(e,t){if(!(t.state.loading&4)){var n=dc.get(e);if(n)var a=n.get(null);else{n=new Map,dc.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<o.length;r++){var f=o[r];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),a=f)}a&&n.set(null,a)}o=t.instance,f=o.getAttribute("data-precedence"),r=n.get(f)||a,r===a&&n.set(null,o),n.set(f,o),this.count++,a=ho.bind(this),o.addEventListener("load",a),o.addEventListener("error",a),r?r.parentNode.insertBefore(o,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var fi={$$typeof:Ce,Provider:null,Consumer:null,_currentValue:tt,_currentValue2:tt,_threadCount:0};function bS(e,t,n,a,o,r,f,p,k){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=jt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(0),this.hiddenUpdates=jt(null),this.identifierPrefix=a,this.onUncaughtError=o,this.onCaughtError=r,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.transitionTypes=null,this.incompleteTransitions=new Map}function yy(e,t,n,a,o,r,f,p,k,O,G,ne){return e=new bS(e,t,n,f,k,O,G,ne,p),t=1,r===!0&&(t|=24),r=Rn(3,null,null,t),e.current=r,r.stateNode=e,t=ju(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},Mu(r),e}function vy(e){return e?(e=Il,e):Il}function by(e,t,n,a,o,r){o=vy(o),a.context===null?a.context=o:a.pendingContext=o,a=Ts(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=js(e,a,t),n!==null&&(zn(n,e,t),Gi(n,e,t))}function xy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hf(e,t){xy(e,t),(e=e.alternate)&&xy(e,t)}function Sy(e){if(e.tag===13||e.tag===31){var t=nl(e,67108864);t!==null&&zn(t,e,67108864),hf(e,67108864)}}function wy(e){if(e.tag===13||e.tag===31){var t=Zn();t=Ps(t);var n=nl(e,t);n!==null&&zn(n,e,t),hf(e,t)}}var hi=!0;function xS(e,t,n,a){var o=me.T;me.T=null;var r=De.p;try{De.p=2,mf(e,t,n,a)}finally{De.p=r,me.T=o}}function SS(e,t,n,a){var o=me.T;me.T=null;var r=De.p;try{De.p=8,mf(e,t,n,a)}finally{De.p=r,me.T=o}}function mf(e,t,n,a){if(hi){var o=pf(a);if(o===null)Kd(e,t,a,hc,n),ky(e,a);else if(AS(o,e,t,n,a))a.stopPropagation();else if(ky(e,a),t&4&&-1<wS.indexOf(e)){for(;o!==null;){var r=va(o);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var f=V(r.pendingLanes);if(f!==0){var p=r;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var k=1<<31-le(f);p.entanglements[1]|=k,f&=~k}Ga(r),(bt&6)===0&&(Jr=vt()+500,lo(0))}}break;case 31:case 13:p=nl(r,2),p!==null&&zn(p,r,2),tc(),hf(r,2)}if(r=pf(a),r===null&&Kd(e,t,a,hc,n),r===o)break;o=r}o!==null&&a.stopPropagation()}else Kd(e,t,a,null,n)}}function pf(e){return e=Wc(e),gf(e)}var hc=null;function gf(e){if(hc=null,e=ya(e),e!==null){var t=h(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=y(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 hc=e,null}function Ay(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ta()){case Sn:return 2;case wn:return 8;case An:case pa:return 32;case na:return 268435456;default:return 32}default:return 32}}var yf=!1,Is=null,Bs=null,Hs=null,mo=new Map,po=new Map,$s=[],wS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ky(e,t){switch(e){case"focusin":case"focusout":Is=null;break;case"dragenter":case"dragleave":Bs=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":mo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(t.pointerId)}}function go(e,t,n,a,o,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[o]},t!==null&&(t=va(t),t!==null&&Sy(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function AS(e,t,n,a,o){switch(t){case"focusin":return Is=go(Is,e,t,n,a,o),!0;case"dragenter":return Bs=go(Bs,e,t,n,a,o),!0;case"mouseover":return Hs=go(Hs,e,t,n,a,o),!0;case"pointerover":var r=o.pointerId;return mo.set(r,go(mo.get(r)||null,e,t,n,a,o)),!0;case"gotpointercapture":return r=o.pointerId,po.set(r,go(po.get(r)||null,e,t,n,a,o)),!0}return!1}function Ty(e){var t=ya(e.target);if(t!==null){var n=h(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Cl(e.priority,function(){wy(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Cl(e.priority,function(){wy(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 mc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pf(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);Jc=a,n.target.dispatchEvent(a),Jc=null}else return t=va(n),t!==null&&Sy(t),e.blockedOn=n,!1;t.shift()}return!0}function jy(e,t,n){mc(e)&&n.delete(t)}function kS(){yf=!1,Is!==null&&mc(Is)&&(Is=null),Bs!==null&&mc(Bs)&&(Bs=null),Hs!==null&&mc(Hs)&&(Hs=null),mo.forEach(jy),po.forEach(jy)}function pc(e,t){e.blockedOn===t&&(e.blockedOn=null,yf||(yf=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,kS)))}var gc=null;function Ny(e){gc!==e&&(gc=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){gc===e&&(gc=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],o=e[t+2];if(typeof a!="function"){if(gf(a||n)===null)continue;break}var r=va(n);r!==null&&(e.splice(t,3),t-=3,Fu(r,{pending:!0,data:o,method:n.method,action:a},a,o))}}))}function mi(e){function t(k){return pc(k,e)}Is!==null&&pc(Is,e),Bs!==null&&pc(Bs,e),Hs!==null&&pc(Hs,e),mo.forEach(t),po.forEach(t);for(var n=0;n<$s.length;n++){var a=$s[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<$s.length&&(n=$s[0],n.blockedOn===null);)Ty(n),n.blockedOn===null&&$s.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var o=n[a],r=n[a+1],f=o[Ut]||null;if(typeof r=="function")f||Ny(n);else if(f){var p=null;if(r&&r.hasAttribute("formAction")){if(o=r,f=r[Ut]||null)p=f.formAction;else if(gf(o)!==null)continue}else p=f.action;typeof p=="function"?n[a+1]=p:(n.splice(a,3),a-=3),Ny(n)}}}function Ey(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(f){return o=f})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),a||setTimeout(n,20)}function n(){if(!a&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function vf(e){this._internalRoot=e}yc.prototype.render=vf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var n=t.current,a=Zn();by(n,a,e,t,null,null)},yc.prototype.unmount=vf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;by(e.current,2,null,e,null,null),tc(),t[_n]=null}};function yc(e){this._internalRoot=e}yc.prototype.unstable_scheduleHydration=function(e){if(e){var t=ps();e={blockedOn:null,target:e,priority:t};for(var n=0;n<$s.length&&t!==0&&t<$s[n].priority;n++);$s.splice(n,0,e),n===0&&Ty(e)}};var Cy=i.version;if(Cy!=="19.3.0")throw Error(u(527,Cy,"19.3.0"));De.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=S(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var TS={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:me,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vc.isDisabled&&vc.supportsFiber)try{yn=vc.inject(TS),Lt=vc}catch{}}return vo.createRoot=function(e,t){if(!d(e))throw Error(u(299));var n=!1,a="",o=vp,r=bp,f=xp;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=yy(e,1,!1,null,null,n,a,null,o,r,f,Ey),e[_n]=t.current,Qd(e),new vf(t)},vo.hydrateRoot=function(e,t,n){if(!d(e))throw Error(u(299));var a=!1,o="",r=vp,f=bp,p=xp,k=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError),n.formState!==void 0&&(k=n.formState)),t=yy(e,1,!0,t,n??null,a,o,k,r,f,p,Ey),t.context=vy(null),n=t.current,a=Zn(),a=Ps(a),o=Ts(a),o.callback=null,js(n,o,a),n=a,t.current.lanes=n,st(t,n),Ga(t),e[_n]=t.current,Qd(e),new yc(t)},vo.version="19.3.0",vo}var qy;function BS(){if(qy)return Sf.exports;qy=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(i){console.error(i)}}return s(),Sf.exports=IS(),Sf.exports}var HS=BS();const $S=Hv(HS);async function qS(){const s=await fetch("/api/models");if(!s.ok)throw new Error(await Yc(s)||`Failed to load models (${s.status})`);return(await s.json()).data}async function GS(){const s=await fetch("/api/kb");return s.ok?(await s.json()).docs:[]}async function XS(s,i){const c=await fetch("/api/kb",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,text:i})});if(!c.ok)throw new Error(await Yc(c)||`Failed to add document (${c.status})`);return(await c.json()).docs}async function YS(s){const i=await fetch(`/api/kb/${s}`,{method:"DELETE"});return i.ok?(await i.json()).docs:[]}async function nh(s,i){var S,v,b,x,T,z,Z,D,F;if(s.stream===!1)return VS(s,i);const c=Date.now(),u=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,stream:!0}),signal:i.signal});if(!u.ok||!u.body){i.onError(await Yc(u)||`Chat request failed (${u.status})`);return}const d=u.body.getReader(),h=new TextDecoder;let m="";const y={};let g=null;for(;;){const{value:ue,done:he}=await d.read();if(he)break;m+=h.decode(ue,{stream:!0});let C;for(;(C=m.indexOf(`
50
+ `))!==-1;){const Y=m.slice(0,C).replace(/\r$/,"");if(m=m.slice(C+1),!Y.startsWith("data:"))continue;const I=Y.slice(5).trim();if(I==="[DONE]"){Gy(y,i),i.onDone(g);return}let X;try{X=JSON.parse(I)}catch{continue}if(X.error){i.onError(X.error.message??"stream error");return}if(X.scx_sources){(S=i.onSources)==null||S.call(i,X.scx_sources);continue}const J=(v=X.choices)==null?void 0:v[0],se=J==null?void 0:J.delta;if(se!=null&&se.content&&i.onDelta(se.content),se!=null&&se.tool_calls)for(const $ of se.tool_calls){const Q=$.index??0;y[Q]??(y[Q]={id:$.id??`call_${Q}`,type:"function",function:{name:"",arguments:""}}),$.id&&(y[Q].id=$.id),(b=$.function)!=null&&b.name&&(y[Q].function.name+=$.function.name),(x=$.function)!=null&&x.arguments&&(y[Q].function.arguments+=$.function.arguments)}J!=null&&J.finish_reason&&(g=J.finish_reason),X.usage&&((D=i.onUsage)==null||D.call(i,{prompt:X.usage.prompt_tokens,completion:X.usage.completion_tokens,reasoning:(T=X.usage.completion_tokens_details)==null?void 0:T.reasoning_tokens,cached:(z=X.usage.prompt_tokens_details)==null?void 0:z.cached_tokens,cacheWrite:(Z=X.usage.prompt_tokens_details)==null?void 0:Z.cache_write_tokens}))}}if(Gy(y,i),!g&&!((F=i.signal)!=null&&F.aborted)){const ue=Math.round((Date.now()-c)/6e4);i.onError(`The connection closed before the model finished${ue?` (after about ${ue} min)`:""}. Long answers can hit a provider's time limit: try again, a faster model, or a smaller request.`);return}i.onDone(g)}async function VS(s,i){var m,y,g,S,v,b,x,T;const c=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,stream:!1}),signal:i.signal});if(!c.ok){i.onError(await Yc(c)||`Chat request failed (${c.status})`);return}const u=await c.json();u.scx_sources&&((m=i.onSources)==null||m.call(i,u.scx_sources));const d=(y=u.choices)==null?void 0:y[0],h=d==null?void 0:d.message;h!=null&&h.content&&i.onDelta(h.content),(g=h==null?void 0:h.tool_calls)!=null&&g.length&&((S=i.onToolCalls)==null||S.call(i,h.tool_calls)),u.usage&&((T=i.onUsage)==null||T.call(i,{prompt:u.usage.prompt_tokens,completion:u.usage.completion_tokens,reasoning:(v=u.usage.completion_tokens_details)==null?void 0:v.reasoning_tokens,cached:(b=u.usage.prompt_tokens_details)==null?void 0:b.cached_tokens,cacheWrite:(x=u.usage.prompt_tokens_details)==null?void 0:x.cache_write_tokens})),i.onDone((d==null?void 0:d.finish_reason)??null)}function Gy(s,i){const c=Object.values(s).filter(u=>u.function.name);c.length&&i.onToolCalls&&i.onToolCalls(c)}async function Yc(s){var i;try{const c=await s.json();return((i=c==null?void 0:c.error)==null?void 0:i.message)??""}catch{return""}}async function QS(s){const i=await fetch(`/api/agent/sessions?directory=${encodeURIComponent(s)}`);if(!i.ok)throw new Error(await on(i)||`Could not list sessions (${i.status})`);return(await i.json()).sessions}async function KS(s,i){const c=await fetch(`/api/agent/session/${encodeURIComponent(s)}/messages?directory=${encodeURIComponent(i)}`);if(!c.ok)throw new Error(await on(c)||`Could not load session (${c.status})`);return c.json()}async function ZS(s,i){const c=await fetch(`/api/agent/session/${encodeURIComponent(s)}?directory=${encodeURIComponent(i)}`,{method:"DELETE"});if(!c.ok)throw new Error(await on(c)||`Could not delete session (${c.status})`)}async function PS(s){const i=await fetch(`/api/agent/commands?directory=${encodeURIComponent(s)}`);return i.ok?(await i.json()).commands:[]}async function FS(s){const i=await fetch("/api/agent/command",{method:"POST",headers:In(),body:JSON.stringify(s)});if(!i.ok)throw new Error(await on(i)||`Command failed (${i.status})`)}async function JS(s,i,c){const u=await fetch("/api/agent/compact",{method:"POST",headers:In(),body:JSON.stringify({sessionID:s,directory:i,model:c})});if(!u.ok)throw new Error(await on(u)||`Compact failed (${u.status})`)}async function WS(){const s=await fetch("/api/agent/status");if(!s.ok)throw new Error(await on(s)||`Agent server not ready (${s.status})`);return s.json()}async function $v(s){const i=await fetch(`/api/agent/directory?directory=${encodeURIComponent(s)}`);if(!i.ok)throw new Error(await on(i)||`Folder not found (${i.status})`);return(await i.json()).directory}async function ew(s,i){const c=await fetch(`/api/agent/pending?sessionID=${encodeURIComponent(s)}&directory=${encodeURIComponent(i)}`);return c.ok?c.json():{permissions:[],questions:[]}}async function tw(s){const i=await fetch("/api/agent/session",{method:"POST",headers:In(),body:JSON.stringify({directory:s})});if(!i.ok)throw new Error(await on(i)||`Could not create session (${i.status})`);return i.json()}async function nw(s){const i=await fetch("/api/agent/prompt",{method:"POST",headers:In(),body:JSON.stringify(s)});if(!i.ok)throw new Error(await on(i)||`Prompt failed (${i.status})`)}async function Xy(s){const i=await fetch("/api/agent/permission",{method:"POST",headers:In(),body:JSON.stringify(s)});if(!i.ok)throw new Error(await on(i)||`Permission reply failed (${i.status})`)}async function aw(s){const i=await fetch("/api/agent/question",{method:"POST",headers:In(),body:JSON.stringify(s)});if(!i.ok)throw new Error(await on(i)||`Answer failed (${i.status})`)}async function sw(s,i){await fetch("/api/agent/abort",{method:"POST",headers:In(),body:JSON.stringify({sessionID:s,directory:i})})}async function lw(s,i){const c=await fetch(`/api/agent/diff?sessionID=${encodeURIComponent(s)}&directory=${encodeURIComponent(i)}`);return c.ok?(await c.json()).diff:null}async function iw(s,i,c,u,d){let h=1e3,m=!1;for(;!u.aborted;){try{await ow(s,i,c,u,()=>{h=1e3,m&&(d==null||d()),m=!0})}catch(y){if(u.aborted)return;if(y.fatal)throw y}if(u.aborted)return;await new Promise(y=>setTimeout(y,h)),h=Math.min(h*2,1e4)}}async function ow(s,i,c,u,d){const h=await fetch(`/api/agent/events?sessionID=${encodeURIComponent(s)}&directory=${encodeURIComponent(i)}`,{signal:u});if(!h.ok||!h.body)throw Object.assign(new Error(await on(h)||`Event stream failed (${h.status})`),{fatal:!0});d();const m=h.body.getReader(),y=new TextDecoder;let g="";for(;;){const{value:S,done:v}=await m.read();if(v)break;g+=y.decode(S,{stream:!0});let b;for(;(b=g.indexOf(`
51
+ `))!==-1;){const x=g.slice(0,b).replace(/\r$/,"");if(g=g.slice(b+1),!!x.startsWith("data:"))try{c(JSON.parse(x.slice(5).trim()))}catch{}}}}async function rw(s){const i=await fetch("/api/agent/recon",{method:"POST",headers:In(),body:JSON.stringify(s)});if(!i.ok)throw new Error(await on(i)||`Could not start recon (${i.status})`);return(await i.json()).recon}async function cw(s){const i=await fetch("/api/agent/recon/batch",{method:"POST",headers:In(),body:JSON.stringify(s)});if(!i.ok)throw new Error(await on(i)||`Could not start the batch (${i.status})`);return(await i.json()).batch}async function Yy(s){const i=await fetch(`/api/agent/recon/batch${s?`?id=${encodeURIComponent(s)}`:""}`);return i.ok?i.json():{batch:null,approvals:[]}}async function uw(s){const i=await fetch("/api/agent/recon/batch/stop",{method:"POST",headers:In(),body:JSON.stringify({id:s})});return i.ok?(await i.json()).batch:null}async function Vy(s){const i=await fetch(`/api/agent/recon/session?scope=${encodeURIComponent(s)}`);return i.ok?(await i.json()).session??null:null}async function dw(s){const i=await fetch(`/api/agent/recon/session?scope=${encodeURIComponent(s)}`,{method:"DELETE",headers:In()});if(!i.ok)throw new Error(await on(i)||`Could not forget the session (${i.status})`)}async function fw(s){const i=await fetch("/api/agent/recon/session/pair",{method:"POST",headers:In(),body:JSON.stringify({scope:s})});if(!i.ok)throw new Error(await on(i)||`Could not make a pairing code (${i.status})`);return i.json()}async function hw(s){const i=await fetch(`/api/agent/recon/memory?scope=${encodeURIComponent(s)}`);return i.ok?(await i.json()).memory??null:null}async function mw(s){const i=await fetch(`/api/agent/recon/memory?scope=${encodeURIComponent(s)}`,{method:"DELETE",headers:In()});if(!i.ok)throw new Error(await on(i)||`Could not forget this target (${i.status})`)}async function Qy(s){const i=await fetch(`/api/agent/recon?sessionID=${encodeURIComponent(s)}`);return i.ok?(await i.json()).recon:null}async function pw(s){const i=await fetch("/api/agent/recon/stop",{method:"POST",headers:In(),body:JSON.stringify({sessionID:s})});return i.ok?(await i.json()).recon:null}const In=()=>({"Content-Type":"application/json"});async function on(s){var i,c;try{return((c=(i=await s.json())==null?void 0:i.error)==null?void 0:c.message)??""}catch{return""}}async function Bo(s,i){if(!s.ok)throw new Error(await on(s)||`${i} failed (${s.status})`);return s.json()}const gw=()=>fetch("/api/workspaces").then(s=>Bo(s,"Listing workspaces")),yw=s=>fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s})}).then(i=>Bo(i,"Creating the workspace")),vw=s=>fetch(`/api/workspaces?directory=${encodeURIComponent(s)}`,{method:"DELETE"}).then(i=>Bo(i,"Deleting the workspace")),bw=(s,i)=>fetch(`/api/agent/files?directory=${encodeURIComponent(s)}&path=${encodeURIComponent(i)}`).then(c=>Bo(c,"Listing files")),xw=(s,i,c)=>fetch(`/api/agent/upload?directory=${encodeURIComponent(s)}&path=${encodeURIComponent(i)}&name=${encodeURIComponent(c.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:c}).then(u=>Bo(u,`Uploading ${c.name}`)),Sw=(s,i)=>`/api/agent/file?directory=${encodeURIComponent(s)}&path=${encodeURIComponent(i)}`,qv=["low","medium","high","xhigh","max"];function ah(s,i){var c;if(!(!s||!((c=i==null?void 0:i.supported_features)!=null&&c.includes("reasoning"))))return qv.includes(s)?s:void 0}let ww=0;const If=()=>`tool_${Date.now().toString(36)}_${(ww++).toString(36)}`,Aw=s=>s.map(i=>i.id?i:{...i,id:If()}),kw=s=>s.map(({id:i,...c})=>c);function Gv({cursor:s=!1}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"prompt",children:">_"}),l.jsxs("span",{className:"word",children:["Bug",l.jsx("span",{className:"x",children:"X"}),"Hunter",s&&l.jsx("span",{className:"cursor big","aria-hidden":!0})]})]})}function Tw({size:s=20,tagline:i=!0}){return l.jsxs("div",{className:"brand","aria-label":"BugXHunter",children:[l.jsx("span",{className:"logo",style:{fontSize:s},children:l.jsx(Gv,{})}),i&&l.jsxs("span",{className:"brand-sub",children:["Open-source AI security testing ",l.jsxs("span",{className:"brand-ver",title:"BugXHunter release v0.14.0",children:["v","0.14.0"]})]})]})}function sh(){return typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function Xv(s){const i=window.SpeechRecognition||window.webkitSpeechRecognition;if(!i)return{stop:()=>{},promise:Promise.resolve("")};const c=new i;c.lang=navigator.language||"en-US",c.interimResults=!0,c.continuous=!1;let u="";const d=new Promise(h=>{var m;c.onresult=y=>{var S;let g="";for(let v=y.resultIndex;v<y.results.length;v++){const b=y.results[v][0].transcript;y.results[v].isFinal?u+=b:g+=b}(S=s.onPartial)==null||S.call(s,u+g)},c.onend=()=>{var y;(y=s.onEnd)==null||y.call(s),h(u.trim())},c.onerror=()=>h(u.trim()),(m=s.onStart)==null||m.call(s),c.start()});return{stop:()=>c.stop(),promise:d}}let Ec=null;function jw(s){if(typeof window>"u"||!window.speechSynthesis)return;const i=s.replace(/[*_`#>]/g,"").replace(/\[(\d+)\]/g,"").trim();i&&(window.speechSynthesis.cancel(),Ec=new SpeechSynthesisUtterance(i),Ec.rate=1.05,window.speechSynthesis.speak(Ec))}function Nw(){typeof window<"u"&&window.speechSynthesis&&window.speechSynthesis.cancel(),Ec=null}function Ho({title:s,tooltip:i,children:c}){return l.jsxs("header",{className:"term-bar",children:[l.jsx("span",{className:"dot r","aria-hidden":!0}),l.jsx("span",{className:"dot y","aria-hidden":!0}),l.jsx("span",{className:"dot g","aria-hidden":!0}),l.jsx("span",{className:"term-title",title:i??s,children:s}),c&&l.jsx("div",{className:"head-actions",children:c})]})}const Ew={p:"$ ",out:"[*] ",ok:"[+] "};function Yv({lines:s}){const i=w.useMemo(()=>{var h;return typeof window<"u"&&!!((h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)},[]),[c,u]=w.useState(()=>i?{line:s.length,chars:0,started:!0}:{line:0,chars:0,started:!1});w.useEffect(()=>{if(c.line>=s.length)return;const h=s[c.line],m=c.chars<h.text.length,y=c.started?m?h.pace??22:260:400,g=setTimeout(()=>{u(m?{line:c.line,chars:c.chars+1,started:!0}:{line:c.line+1,chars:0,started:!0})},y);return()=>clearTimeout(g)},[c,s]);const d=c.line>=s.length;return l.jsxs("div",{className:"boot",children:[s.map((h,m)=>{if(m>c.line)return l.jsx("div",{className:"line","aria-hidden":!0},m);const y=m<c.line,g=y?h.text:h.text.slice(0,c.chars);return l.jsxs("div",{className:"line",children:[l.jsx("span",{className:h.kind,children:Ew[h.kind]}),g,y&&h.ok?l.jsxs("span",{className:"ok",children:[" ",h.ok]}):null,m===c.line&&c.started&&l.jsx("span",{className:"cursor"})]},m)}),d&&l.jsxs("div",{className:"line",children:[l.jsx("span",{className:"p",children:"$ "}),l.jsx("span",{className:"cursor"})]})]})}async function En(s,i){var u,d;const c=await fetch(s,{headers:{"Content-Type":"application/json"},...i});if(!c.ok){let h=`${c.status}`;try{h=((d=(u=await c.json())==null?void 0:u.error)==null?void 0:d.message)??h}catch{}throw new Error(h)}return c.json()}const Zs=s=>({method:"POST",body:s===void 0?void 0:JSON.stringify(s)}),Cw=()=>En("/api/vault"),Mw=(s,i)=>En("/api/vault/init",Zs({doc:s,dek:i})),Vv=s=>En("/api/vault/unseal",Zs({dek:s})),_w=()=>En("/api/vault/seal",Zs()),Rw=(s,i)=>En(`/api/vault/items/${encodeURIComponent(s)}`,{method:"PUT",body:JSON.stringify({value:i})}),Ow=s=>En(`/api/vault/items/${encodeURIComponent(s)}`,{method:"DELETE"}),Ky=(s,i)=>En("/api/vault/methods",Zs({method:s,dek:i})),Dw=s=>En(`/api/vault/methods/${encodeURIComponent(s)}`,{method:"DELETE"}),Lw=s=>En("/api/vault",{method:"DELETE",body:JSON.stringify({dek:s})}),zw=()=>En("/api/auth/me"),Tf=()=>En("/api/auth/methods"),Uw=()=>En("/api/auth/challenge",Zs()),Iw=s=>En("/api/auth/passkey",Zs(s)),Bw=s=>En("/api/auth/recover",Zs({dek:s})),Hw=()=>En("/api/auth/logout",Zs()),$w=6e5,lh="bugxhunter-vault-prf-v1",qw="bugxhunter-vault-kek-v1",Gw="bugxhunter-vault-ok",wi=new TextEncoder,Ks=crypto.subtle,pn={enc:s=>btoa(String.fromCharCode(...s instanceof Uint8Array?s:new Uint8Array(s))),dec:s=>Uint8Array.from(atob(s),i=>i.charCodeAt(0))},Xa={enc:s=>pn.enc(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),dec:s=>pn.dec(s.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-s.length%4)%4))},Ya=s=>crypto.getRandomValues(new Uint8Array(s)),hs=s=>s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);async function Qv(s,i){const c=await Ks.importKey("raw",wi.encode(s),"PBKDF2",!1,["deriveBits"]),u=await Ks.deriveBits({name:"PBKDF2",hash:i.hash,salt:hs(pn.dec(i.salt)),iterations:i.iterations},c,256);return new Uint8Array(u)}async function Kv(s,i,c){if(s.length!==32)throw new Error("PRF output must be 32 bytes");let u;if(i.passphrase){if(!c)throw new Error("This passkey was enrolled with a passphrase; enter it as well.");const m=await Qv(c,i.passphrase);u=new Uint8Array(64),u.set(s,0),u.set(m,32),m.fill(0)}else u=new Uint8Array(s);const d=await Ks.importKey("raw",hs(u),"HKDF",!1,["deriveKey"]),h=await Ks.deriveKey({name:"HKDF",hash:"SHA-256",salt:hs(pn.dec(i.hkdfSalt)),info:wi.encode(qw)},d,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return u.fill(0),h}async function Vc(s,i){const c=await Qv(s,i),u=await Ks.importKey("raw",hs(c),"AES-GCM",!1,["encrypt","decrypt"]);return c.fill(0),u}async function Oo(s,i,c){const u=Ya(12),d=await Ks.encrypt({name:"AES-GCM",iv:hs(u),additionalData:wi.encode(c)},s,hs(i));return{iv:pn.enc(u),ct:pn.enc(d)}}async function ih(s,i,c){const u=await Ks.decrypt({name:"AES-GCM",iv:hs(pn.dec(i.iv)),additionalData:wi.encode(c)},s,hs(pn.dec(i.ct)));return new Uint8Array(u)}const Bf="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function Xw(){const s=Ya(16);let i=0,c=0,u="";for(const d of s)for(c=c<<8|d,i+=8;i>=5;)u+=Bf[c>>>i-5&31],i-=5;return i>0&&(u+=Bf[c<<5-i&31]),u.match(/.{1,5}/g).join("-")}const oh=s=>s.toUpperCase().replace(/[^A-Z2-9]/g,"");function Hf(s){const i=oh(s);return i.length===26&&[...i].every(c=>Bf.includes(c))}const rh=s=>`${s}-${Xa.enc(Ya(6))}`,Zv=()=>({name:"PBKDF2",hash:"SHA-256",iterations:$w,salt:pn.enc(Ya(16))});async function Pv(s,i,c){const u={type:"passkey",id:rh("pk"),label:c,credentialId:i.credentialId,transports:i.transports,publicKey:i.publicKey,alg:i.alg,signCount:0,prfSalt:lh,hkdfSalt:pn.enc(Ya(16)),wrapped:{iv:"",ct:""},createdAt:new Date().toISOString()};return u.wrapped=await Oo(await Kv(i.prf,u),s,u.id),u}async function ch(s,i){const c={type:"password",id:rh("pw"),label:"Backup passphrase",kdf:Zv(),wrapped:{iv:"",ct:""},createdAt:new Date().toISOString()};return c.wrapped=await Oo(await Vc(i,c.kdf),s,c.id),c}async function Yw(s){const i=Ya(32),c=await Ks.importKey("raw",hs(i),"AES-GCM",!1,["encrypt"]),u=new Date().toISOString(),d=[await Pv(i,s,s.label)];s.passphrase&&d.push(await ch(i,s.passphrase));const h=Xw(),m={type:"recovery",id:rh("rc"),label:"Recovery code",kdf:Zv(),wrapped:{iv:"",ct:""},createdAt:u};m.wrapped=await Oo(await Vc(oh(h),m.kdf),i,m.id),d.push(m);const y={};for(const[v,b]of Object.entries(s.items))b&&(y[v]=await Oo(c,wi.encode(b),v));const g={version:1,createdAt:u,methods:d,verifier:await Oo(c,wi.encode(Gw),"verifier"),items:y},S=pn.enc(i);return i.fill(0),{doc:g,dek:S,recoveryCode:h}}async function Fv(s,i,c){const u=await Kv(i,s,c);return pn.enc(await ih(u,s.wrapped,s.id))}async function Jv(s,i){const c=await Vc(i,s.kdf);return pn.enc(await ih(c,s.wrapped,s.id))}async function Wv(s,i){const c=await Vc(oh(i),s.kdf);return pn.enc(await ih(c,s.wrapped,s.id))}class fs extends Error{constructor(i){super(i),this.name="PrfUnsupportedError"}}class uh extends Error{constructor(){super("Passkey prompt cancelled or timed out."),this.name="PasskeyCancelledError"}}const Ai=()=>typeof window<"u"&&!!window.PublicKeyCredential&&!!navigator.credentials,Vw=new TextEncoder;function Rc(){const s=location.hostname;if(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||s.startsWith("["))throw new fs(`Passkeys can't be bound to an IP address (${s}). Open the app via http://localhost:${location.port||80} or a hostname.`);return s}function e0(s){const i=s;return(i==null?void 0:i.name)==="NotAllowedError"?new uh:(i==null?void 0:i.name)==="OperationError"?new fs("Another passkey request is pending in this tab. Close any stray OS dialog or reload, then try again."):(i==null?void 0:i.name)==="SecurityError"?new fs(`The browser refused the passkey request (SecurityError: ${i.message}). Passkeys need https or localhost, and a relying-party name equal to the page's host (${location.hostname}).`):(i==null?void 0:i.name)==="NotSupportedError"||(i==null?void 0:i.name)==="ConstraintError"?new fs(`The authenticator can't do this (${i.name}: ${i.message}).`):i instanceof Error?new Error(`${i.name??"Error"}: ${i.message}`):new Error(String(s))}const t0=s=>({prf:{eval:{first:Vw.encode(s)}}});async function n0(s,i){var S,v,b,x;if(!Ai())throw new fs("This browser has no passkey support.");let c;try{c=await navigator.credentials.create({publicKey:{rp:{id:Rc(),name:"BugXHunter"},user:{id:Ya(16),name:s,displayName:"BugXHunter vault"},challenge:Ya(32),pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-8},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"preferred",userVerification:"required"},timeout:12e4,extensions:t0(i)}})}catch(T){throw e0(T)}if(!c)throw new uh;const u=c.getClientExtensionResults();if(!((S=u.prf)!=null&&S.enabled))throw new fs("This passkey can't derive keys (no PRF support). Use a platform passkey (Windows Hello, Touch ID, Android) or a recent security key, in Chrome, Edge or Safari 18+.");const d=c.response,h=(v=d.getPublicKey)==null?void 0:v.call(d);if(!h)throw new fs("This browser doesn't expose the passkey's public key (needed for sign-in). Use Chrome, Edge or Safari.");const m=((b=d.getTransports)==null?void 0:b.call(d))??void 0,y=Xa.enc(new Uint8Array(c.rawId)),g=(x=u.prf.results)!=null&&x.first?new Uint8Array(u.prf.results.first):(await dh({challenge:Xa.enc(Ya(32)),rpId:Rc(),allowCredentials:[{id:y,transports:m}]},i)).prf;return{credentialId:y,transports:m,prf:g,publicKey:pn.enc(h),alg:d.getPublicKeyAlgorithm()}}async function dh(s,i){var m,y;if(!Ai())throw new fs("This browser has no passkey support.");const c=Rc();s.rpId&&s.rpId!==c&&console.warn(`[vault] server suggested rpId ${s.rpId}; using the page's host ${c}`);let u;try{u=await navigator.credentials.get({publicKey:{rpId:c,challenge:Xa.dec(s.challenge),allowCredentials:s.allowCredentials.map(g=>({type:"public-key",id:Xa.dec(g.id),transports:g.transports})),userVerification:"required",timeout:12e4,extensions:t0(i)}})}catch(g){throw e0(g)}if(!u)throw new uh;const d=u.response,h=u.getClientExtensionResults();return{assertion:{credentialId:Xa.enc(new Uint8Array(u.rawId)),clientDataJSON:Xa.enc(new Uint8Array(d.clientDataJSON)),authenticatorData:Xa.enc(new Uint8Array(d.authenticatorData)),signature:Xa.enc(new Uint8Array(d.signature))},prf:(y=(m=h.prf)==null?void 0:m.results)!=null&&y.first?new Uint8Array(h.prf.results.first):void 0}}async function Qw(s,i,c){const{prf:u}=await dh({challenge:Xa.enc(Ya(32)),rpId:Rc(),allowCredentials:[{id:s,transports:i}]},c);if(!u)throw new fs("The authenticator returned no PRF output. Use a passkey that supports PRF, or your recovery code.");return u}let fh=null;const Oc=s=>{fh=s},hh=()=>{fh=null},Kw=()=>fh,$f="or:unauthorized";async function Zw(){hh(),await Hw().catch(()=>{}),window.location.reload()}function Pw({children:s}){const[i,c]=w.useState("checking");return w.useEffect(()=>{zw().then(d=>c(d.required?d.authenticated?"signed-in":"signed-out":"open")).catch(()=>c("open"));const u=()=>c("signed-out");return window.addEventListener($f,u),()=>window.removeEventListener($f,u)},[]),i==="checking"?null:i==="signed-out"?l.jsx(Fw,{onSuccess:()=>c("signed-in")}):l.jsx(l.Fragment,{children:s})}function Fw({onSuccess:s}){const[i,c]=w.useState("passkey"),[u,d]=w.useState(""),[h,m]=w.useState(""),[y,g]=w.useState(""),[S,v]=w.useState(!1),[b,x]=w.useState(!1),[T,z]=w.useState(!1),[Z,D]=w.useState(null),[F,ue]=w.useState(null);w.useEffect(()=>{Tf().then(({methods:I})=>{v(I.some(X=>X.type==="passkey"&&!!X.passphrase)),x(I.some(X=>X.type==="password"))}).catch(()=>{})},[]);async function he(){var I;z(!0),D(null),ue(null);try{const X=await Uw();if("open"in X)return s();const{methods:J}=await Tf(),se=J.filter(ve=>ve.type==="passkey"),$=((I=se[0])==null?void 0:I.prfSalt)??"bugxhunter-vault-prf-v1",{assertion:Q,prf:K}=await dh(X,$);await Iw(Q);const ye=se.find(ve=>ve.credentialId===Q.credentialId);if(ye&&K)try{const ve=await Fv(ye,K,ye.passphrase?u:void 0);await Vv(ve),Oc(ve)}catch{ue(ye.passphrase?"Signed in; the vault stays locked (passphrase?) — unlock it from the sidebar.":"Signed in, but the vault didn't unlock — unlock it from the sidebar.")}s()}catch(X){D(X.message),z(!1)}}async function C(I){z(!0),D(null);try{const{methods:X}=await Tf();let J;try{if(I==="password"){const se=X.find($=>$.type==="password");if(!se)throw new Error("no method");J=await Jv(se,h)}else{const se=X.find($=>$.type==="recovery");if(!se)throw new Error("no method");J=await Wv(se,y)}}catch{throw new Error(I==="password"?"Wrong backup passphrase.":"That recovery code doesn't open the vault.")}await Bw(J),Oc(J),s()}catch(X){D(X.message),z(!1)}}const Y=()=>{i==="passkey"?he():i==="password"?C("password"):i==="recovery"&&C("recovery")};return l.jsx("div",{className:"login-page grid-bg",children:l.jsxs("form",{className:"login-card",onSubmit:I=>{I.preventDefault(),Y()},children:[l.jsx(Ho,{title:"bugxhunter@redteam: ~/login"}),l.jsxs("div",{className:"login-body",children:[l.jsx("span",{className:"logo login-mark",style:{fontSize:34},"aria-label":"BugXHunter",children:l.jsx(Gv,{cursor:!0})}),l.jsx("div",{className:"login-tag",children:"Open-source AI security testing"}),i==="passkey"&&l.jsxs(l.Fragment,{children:[S&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{htmlFor:"pp",children:["vault passphrase ",l.jsx("span",{className:"muted",children:"(this passkey was enrolled with one)"})]}),l.jsx("input",{id:"pp",type:"password",autoFocus:!0,autoComplete:"current-password",value:u,onChange:I=>d(I.target.value)})]}),!Ai()&&l.jsx("div",{className:"form-status error",children:"This browser has no passkey support. Use Chrome, Edge or Safari, or a backup."}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",type:"submit",autoFocus:!S,disabled:T||!Ai(),children:T?"waiting for the passkey…":"./sign_in --passkey →"})}),l.jsxs("div",{className:"login-links",children:[b&&l.jsx("button",{type:"button",className:"link-btn",disabled:T,onClick:()=>{c("password"),D(null)},children:"use the backup passphrase"}),l.jsx("button",{type:"button",className:"link-btn",disabled:T,onClick:()=>{c("recovery"),D(null)},children:"use the recovery code"})]})]}),i==="password"&&l.jsxs(l.Fragment,{children:[l.jsx("label",{htmlFor:"bp",children:"backup passphrase"}),l.jsx("input",{id:"bp",type:"password",autoFocus:!0,autoComplete:"current-password",value:h,onChange:I=>m(I.target.value)}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",type:"submit",disabled:T||!h,children:T?"checking…":"./sign_in --passphrase →"})}),l.jsxs("div",{className:"login-links",children:[l.jsx("button",{type:"button",className:"link-btn",disabled:T,onClick:()=>{c("passkey"),D(null)},children:"back to the passkey"}),l.jsx("button",{type:"button",className:"link-btn",disabled:T,onClick:()=>{c("recovery"),D(null)},children:"use the recovery code"})]})]}),i==="recovery"&&l.jsxs(l.Fragment,{children:[l.jsx("label",{htmlFor:"rc",children:"recovery code"}),l.jsx("input",{id:"rc",type:"text",className:"mono",autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-X",value:y,onChange:I=>g(I.target.value)}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",type:"submit",disabled:T||!Hf(y),children:T?"checking…":"./sign_in --recovery →"})}),l.jsx("p",{className:"hint",style:{margin:0},children:"This signs you in and unlocks the vault. Enrol a new passkey right after, from the keys dialog."}),l.jsxs("div",{className:"login-links",children:[l.jsx("button",{type:"button",className:"link-btn",disabled:T,onClick:()=>{c("passkey"),D(null)},children:"back to the passkey"}),l.jsx("button",{type:"button",className:"link-btn",disabled:T,onClick:()=>{c("lost"),D(null)},children:"lost that too?"})]})]}),i==="lost"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"hint",style:{margin:0},children:"Without the passkey, the backup passphrase or the recovery code the vault's secrets can't be recovered — by design, and by anyone. Someone with access to the server's files can reset it, which deletes the vault and reopens the app for a fresh setup:"}),l.jsx("pre",{className:"tool-output",style:{borderTop:"1px solid var(--border)"},children:`npm run vault:reset
52
+ # Docker:
53
+ docker compose exec runner rm /data/vault.json`}),l.jsx("p",{className:"hint",style:{margin:0},children:"Nothing on the network can do this, which is what keeps the lock meaningful."}),l.jsx("button",{type:"button",className:"link-btn",onClick:()=>{c("passkey"),D(null)},children:"back"})]}),F&&l.jsx("div",{className:"form-status success",children:F}),Z&&l.jsx("div",{className:"form-status error",children:Z})]})]})})}function jl({title:s,onClose:i,children:c}){return w.useEffect(()=>{if(!i)return;const u=d=>d.key==="Escape"&&i();return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[i]),l.jsx("div",{className:"overlay vault-dialog",onClick:i,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":s,onClick:u=>u.stopPropagation(),children:[l.jsxs("div",{className:"modal-head",children:[l.jsxs("span",{className:"modal-title",children:[l.jsx("span",{className:"dot y","aria-hidden":!0}),s]}),i&&l.jsx("button",{className:"icon-btn close-x",onClick:i,"aria-label":"Close",title:"Close (Esc)",children:"✕"})]}),l.jsx("div",{className:"modal-body",children:c})]})})}const Do=10,Dc=()=>`BugXHunter vault (${location.hostname})`,jf="__custom__",gi=[{name:"SCX_API",short:"SCX.ai — the default provider",label:"SCX.ai model key — the default provider"},{name:"NVIDIA_API_KEY",short:"NVIDIA NIM — build.nvidia.com models",label:"NVIDIA NIM key — build.nvidia.com models incl. Nemotron, DeepSeek, GLM-5.3 (optional)"},{name:"ANTHROPIC_API_KEY",short:"Anthropic — Claude models",label:"Anthropic key — Claude Opus, Sonnet and Haiku (optional)"},{name:"OPENROUTER_API_KEY",short:"OpenRouter — one key, its whole catalogue",label:"OpenRouter key — unlocks its model catalogue (optional)"},{name:"AWS_BEARER_TOKEN_BEDROCK",short:"Amazon Bedrock — API key",label:"Amazon Bedrock API key — GLM 5.3 on Bedrock (optional; not needed when the runner has an AWS role or profile)"}],Jw={SCX_API:"sk-scx-…",NVIDIA_API_KEY:"nvapi-…",ANTHROPIC_API_KEY:"sk-ant-…",OPENROUTER_API_KEY:"sk-or-…",AWS_BEARER_TOKEN_BEDROCK:"Bedrock API key"};function Ww(){const[s,i]=w.useState(null),[c,u]=w.useState(null),[d,h]=w.useState(Date.now()),m=w.useCallback(()=>Cw().then(i).catch(()=>{}),[]);w.useEffect(()=>{m();const v=setInterval(()=>{m(),h(Date.now())},3e4);return()=>clearInterval(v)},[m]);const y=()=>{u(null),m()},g=w.useCallback(()=>{hh(),_w().then(i).catch(()=>{})},[]);if(w.useEffect(()=>{const v=b=>{(b.ctrlKey||b.metaKey)&&b.shiftKey&&b.key.toLowerCase()==="l"&&(b.preventDefault(),g())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[g]),!s)return null;const S=s.initialised?s.unsealed?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"vault-state open",title:s.idleMinutes?`Auto-locks after ${s.idleMinutes} min without activity`:"Auto-lock off",children:["vault open",s.sealsAt?` · locks in ${a1(s.sealsAt-d)}`:""]}),l.jsx("button",{className:"icon-btn vault-btn",onClick:()=>u("manage"),title:"Keys in the vault","aria-label":"Keys in the vault",children:l.jsx(t1,{})}),l.jsx("button",{className:"icon-btn vault-btn",onClick:g,title:"Lock the vault (Ctrl+Shift+L)","aria-label":"Lock the vault (Ctrl+Shift+L)",children:l.jsx(n1,{})})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"vault-state sealed",children:"vault locked"}),l.jsx("button",{className:"icon-btn vault-btn primary",onClick:()=>u("unlock"),title:"Unlock the vault","aria-label":"Unlock the vault",children:l.jsx(e1,{})})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"vault-state none",title:s.keySource==="none"?"No model key yet":s.keySource==="file"?"Model key comes from a key file":`Model key comes from ${s.keySource==="env"?".env":"OpenCode's auth.json"}, in the clear`,children:s.keySource==="none"?"no vault, no model key":"vault not set up"}),l.jsx("button",{className:"btn primary sm",onClick:()=>u("setup"),children:"set_up"})]});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"vault-row",children:S}),c==="setup"&&l.jsx(s1,{onClose:y}),c==="unlock"&&l.jsx(l1,{status:s,onClose:y}),c==="manage"&&l.jsx(i1,{status:s,onChange:i,onClose:y})]})}const e1=()=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"12",cy:"16",r:"1"}),l.jsx("rect",{width:"18",height:"12",x:"3",y:"10",rx:"2"}),l.jsx("path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5"})]}),t1=()=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z"}),l.jsx("path",{d:"m14 7 3 3"}),l.jsx("path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814"})]}),n1=()=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M12 13v3"}),l.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 01-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 011-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 011.52 0C14.51 3.81 17 5 19 5a1 1 0 011 1z"}),l.jsx("circle",{cx:"12",cy:"11",r:"2"})]});function a1(s){const i=Math.max(0,Math.round(s/6e4));return i>=60?`${Math.floor(i/60)}h ${String(i%60).padStart(2,"0")}m`:`${i}m`}const Nf=["passkey","key","backups"];function s1({onClose:s}){const[i,c]=w.useState("passkey"),[u,d]=w.useState(null),[h,m]=w.useState("SCX_API"),[y,g]=w.useState(""),[S,v]=w.useState(""),[b,x]=w.useState(""),[T,z]=w.useState(null),[Z,D]=w.useState(!1),[F,ue]=w.useState(!1),[he,C]=w.useState(!1),[Y,I]=w.useState(null);async function X(){C(!0),I(null);try{d(await n0(Dc(),lh)),c("key")}catch(Q){I(Q.message)}finally{C(!1)}}async function J(){if(u){C(!0),I(null);try{z(await Yw({...u,label:Dc(),items:y.trim()?{[h]:y.trim()}:{}})),c("backups")}catch(Q){I(Q.message)}finally{C(!1)}}}async function se(){if(T){C(!0),I(null);try{let Q=T.doc;S&&(Q={...Q,methods:[...Q.methods,await ch(pn.dec(T.dek),S)]}),await Mw(Q,T.dek),Oc(T.dek),s()}catch(Q){I(Q.message),C(!1)}}}const $=!S||S.length>=Do&&S===b;return l.jsxs(jl,{title:"vault --init",onClose:i==="backups"?void 0:s,children:[l.jsx("div",{className:"steps",children:Nf.map(Q=>l.jsx("span",{className:Q===i?"on":Nf.indexOf(Q)<Nf.indexOf(i)?"done":"",children:Q},Q))}),i==="passkey"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{children:"Your model keys will be sealed at rest, and this passkey will unlock them and sign you in — one touch. The authenticator (Windows Hello, Touch ID, Android, or a security key) derives a secret that never leaves it. Works in Chrome, Edge and Safari 18+; Firefox can't do this yet."}),!Ai()&&l.jsx("div",{className:"form-status error",children:"This browser has no passkey support."}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",disabled:he||!Ai(),onClick:X,children:he?"waiting for the authenticator…":"create passkey →"})})]}),i==="key"&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{children:["Passkey enrolled. Add a model key now, or later from the keys dialog (where you can add the other provider too). It goes straight into the sealed vault; ",l.jsx("code",{className:"mono",children:".env"})," can then drop the key."]}),l.jsx("label",{htmlFor:"v-provider",children:"Provider"}),l.jsx("select",{id:"v-provider",className:"mono",value:h,onChange:Q=>m(Q.target.value),children:gi.map(Q=>l.jsx("option",{value:Q.name,children:Q.short},Q.name))}),l.jsxs("label",{htmlFor:"v-key",children:[h," (optional)"]}),l.jsx("input",{id:"v-key",type:"password",autoFocus:!0,autoComplete:"off",placeholder:Jw[h]??"",value:y,onChange:Q=>g(Q.target.value)}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",disabled:he,onClick:J,children:he?"sealing…":"next →"})})]}),i==="backups"&&T&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{children:["Backups, for when the passkey isn't at hand. This recovery code is shown ",l.jsx("b",{children:"once"})," and stored nowhere — keep it offline, like a password-manager note or paper."]}),l.jsxs("button",{type:"button",className:"recovery-code"+(F?" copied":""),"aria-label":"Recovery code — click to copy",title:"Click to copy",onClick:()=>{var Q;(Q=navigator.clipboard)==null||Q.writeText(T.recoveryCode).then(()=>{ue(!0),setTimeout(()=>ue(!1),2e3)}).catch(()=>{})},children:[l.jsx("span",{className:"code",children:T.recoveryCode}),l.jsx("span",{className:"copy-hint",children:F?"✓ copied":"click to copy"})]}),l.jsxs("label",{className:"check",children:[l.jsx("input",{type:"checkbox",checked:Z,onChange:Q=>D(Q.target.checked)})," I have stored this code somewhere safe."]}),l.jsxs("label",{htmlFor:"v-pass",children:["Backup passphrase (optional, at least ",Do," characters)"]}),l.jsx("input",{id:"v-pass",type:"password",autoComplete:"new-password",value:S,onChange:Q=>v(Q.target.value)}),S&&l.jsxs(l.Fragment,{children:[l.jsx("label",{htmlFor:"v-pass2",children:"Again"}),l.jsx("input",{id:"v-pass2",type:"password",autoComplete:"new-password",value:b,onChange:Q=>x(Q.target.value)}),b&&S!==b&&l.jsx("div",{className:"form-status error",children:"The passphrases differ."})]}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",disabled:!Z||!$||he,onClick:se,children:he?"creating…":"create vault →"})})]}),Y&&l.jsx("div",{className:"form-status error",children:Y})]})}function l1({status:s,onClose:i}){const[c,u]=w.useState("passkey"),[d,h]=w.useState(""),[m,y]=w.useState(""),[g,S]=w.useState(!1),[v,b]=w.useState(null),x=s.methods.find(C=>C.type==="passkey"),T=s.methods.find(C=>C.type==="password"),z=s.methods.find(C=>C.type==="recovery"),Z=!!(x!=null&&x.passphrase);async function D(C,Y){S(!0),b(null);try{let I;try{I=await C()}catch(X){throw X instanceof Error&&/Passkey|authenticator|pending|origin/i.test(X.message)?X:new Error(Y)}await Vv(I),Oc(I),i()}catch(I){b(I.message),S(!1)}}const F=()=>x&&D(async()=>{const C=await Qw(x.credentialId,x.transports,x.prfSalt);return Fv(x,C,Z?d:void 0)},Z?"Wrong passphrase, or a different passkey than the one enrolled.":"A different passkey than the one enrolled."),ue=()=>T&&D(()=>Jv(T,d),"Wrong backup passphrase."),he=()=>z&&D(()=>Wv(z,m),"That recovery code doesn't open the vault.");return l.jsxs(jl,{title:"vault --unlock",onClose:i,children:[c==="passkey"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{children:Z?"This passkey was enrolled with a passphrase: enter it, then confirm with the passkey.":"One touch: confirm with your passkey."}),Z&&l.jsxs(l.Fragment,{children:[l.jsx("label",{htmlFor:"v-unlock-pass",children:"Passphrase"}),l.jsx("input",{id:"v-unlock-pass",type:"password",autoFocus:!0,autoComplete:"current-password",value:d,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&d&&F()}})]}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",autoFocus:!Z,disabled:g||!x||Z&&!d,onClick:F,children:g?"waiting for the authenticator…":"unlock with passkey →"})}),l.jsxs("div",{className:"login-links",children:[T&&l.jsx("button",{className:"link-btn",disabled:g,onClick:()=>{u("password"),b(null)},children:"use the backup passphrase"}),z&&l.jsx("button",{className:"link-btn",disabled:g,onClick:()=>{u("recovery"),b(null)},children:"use the recovery code"})]})]}),c==="password"&&l.jsxs(l.Fragment,{children:[l.jsx("label",{htmlFor:"v-unlock-pw",children:"Backup passphrase"}),l.jsx("input",{id:"v-unlock-pw",type:"password",autoFocus:!0,autoComplete:"current-password",value:d,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&d&&ue()}}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",disabled:g||!d,onClick:ue,children:g?"unlocking…":"unlock →"})}),l.jsxs("div",{className:"login-links",children:[l.jsx("button",{className:"link-btn",disabled:g,onClick:()=>{u("passkey"),b(null)},children:"use the passkey instead"}),z&&l.jsx("button",{className:"link-btn",disabled:g,onClick:()=>{u("recovery"),b(null)},children:"use the recovery code"})]})]}),c==="recovery"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{children:"Enter the recovery code shown when the vault was created."}),l.jsx("label",{htmlFor:"v-code",children:"Recovery code"}),l.jsx("input",{id:"v-code",type:"text",className:"mono",autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-X",value:m,onChange:C=>y(C.target.value),onKeyDown:C=>{C.key==="Enter"&&Hf(m)&&he()}}),l.jsx("div",{className:"perm-actions center",children:l.jsx("button",{className:"btn primary wide",disabled:g||!Hf(m),onClick:he,children:g?"unlocking…":"unlock →"})}),l.jsxs("div",{className:"login-links",children:[l.jsx("button",{className:"link-btn",disabled:g,onClick:()=>{u("passkey"),b(null)},children:"use the passkey instead"}),T&&l.jsx("button",{className:"link-btn",disabled:g,onClick:()=>{u("password"),b(null)},children:"use the backup passphrase"})]})]}),v&&l.jsx("div",{className:"form-status error",children:v})]})}function i1({status:s,onChange:i,onClose:c}){const[u,d]=w.useState("SCX_API"),[h,m]=w.useState(""),[y,g]=w.useState(""),[S,v]=w.useState(!1),[b,x]=w.useState(""),[T,z]=w.useState(!1),[Z,D]=w.useState(null),F=Kw(),ue=s.methods.filter(K=>K.type==="passkey"),he=s.methods.find(K=>K.type==="password");async function C(K){z(!0),D(null);try{const ye=await K();ye&&i(ye)}catch(ye){D(ye.message)}finally{z(!1)}}const Y=()=>{if(!F)throw new Error("Unlock the vault in this tab first (the change must wrap the current key).");return pn.dec(F)},I=()=>C(async()=>{const K=await Rw(u.trim().toUpperCase(),h);return m(""),K}),X=K=>C(()=>Ow(K)),J=K=>C(()=>Dw(K)),se=()=>C(async()=>{const K=Y(),ye=await Pv(K,await n0(Dc(),lh),Dc());return Ky(ye,F)}),$=()=>C(async()=>{const K=Y(),ye=await Ky(await ch(K,y),F);return v(!1),g(""),ye}),Q=()=>C(async()=>{Y();const K=await Lw(F);return hh(),c(),K});return l.jsxs(jl,{title:"vault --keys",onClose:c,children:[l.jsx("p",{children:"Secrets sealed in the vault. Values are never shown again; replace one by saving it under the same name."}),l.jsxs("div",{className:"vault-items",children:[gi.map(K=>{const ye=s.items.includes(K.name);return l.jsxs("div",{className:"vault-item",children:[l.jsx("span",{className:ye?"ok":"missing","aria-hidden":!0,children:ye?"✓":"○"}),l.jsxs("span",{className:"name",children:[K.name,l.jsxs("span",{className:"desc",children:[" — ",K.label]})]}),ye?l.jsx("button",{className:"btn danger",disabled:T,onClick:()=>X(K.name),title:"Remove",children:"✕"}):l.jsx("button",{className:"btn sm",disabled:T,onClick:()=>{d(K.name),setTimeout(()=>{var ve;return(ve=document.getElementById("v-value"))==null?void 0:ve.focus()},0)},children:"add"})]},K.name)}),s.items.filter(K=>!gi.some(ye=>ye.name===K)).map(K=>l.jsxs("div",{className:"vault-item",children:[l.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),l.jsx("span",{className:"name",children:K}),l.jsx("button",{className:"btn danger",disabled:T,onClick:()=>X(K),title:"Remove",children:"✕"})]},K))]}),l.jsx("label",{htmlFor:"v-name",children:"Key"}),l.jsxs("select",{id:"v-name",className:"mono",value:gi.some(K=>K.name===u)?u:jf,onChange:K=>d(K.target.value===jf?"":K.target.value),children:[gi.map(K=>l.jsxs("option",{value:K.name,children:[K.name,s.items.includes(K.name)?" (replace)":""]},K.name)),l.jsx("option",{value:jf,children:"custom…"})]}),!gi.some(K=>K.name===u)&&l.jsx("input",{type:"text",className:"mono",placeholder:"NAME_IN_UPPER_SNAKE_CASE","aria-label":"Custom key name",value:u,onChange:K=>d(K.target.value),spellCheck:!1,autoFocus:!0}),l.jsx("label",{htmlFor:"v-value",children:"Value"}),l.jsx("input",{id:"v-value",type:"password",autoComplete:"off",value:h,onChange:K=>m(K.target.value),onKeyDown:K=>{K.key==="Enter"&&h&&I()}}),l.jsxs("div",{className:"perm-actions",children:[l.jsx("button",{className:"btn primary sm",disabled:T||!h||!u.trim(),onClick:I,children:T?"sealing…":"save"}),l.jsx("span",{className:"hint",style:{margin:0},children:s.idleMinutes?`Auto-locks after ${s.idleMinutes} min idle.`:"Auto-lock is off."})]}),l.jsx("div",{className:"section-title",children:"passkeys"}),l.jsx("p",{children:"Each passkey unlocks the vault and signs you in with one touch. Keep two, on different devices, so losing one is not an emergency."}),l.jsx("div",{className:"vault-items",children:ue.map(K=>l.jsxs("div",{className:"vault-item",children:[l.jsx("span",{className:K.canLogin?"ok":"warn","aria-hidden":!0,children:K.canLogin?"✓":"!"}),l.jsxs("span",{className:"name",children:[K.label,K.passphrase?" — needs its passphrase (older enrolment)":"",K.canLogin?"":" — unlock only, can't sign in; add a new passkey"]}),l.jsx("button",{className:"btn danger",disabled:T||ue.length<=1,onClick:()=>J(K.id),title:ue.length<=1?"Add another passkey first":"Remove",children:"✕"})]},K.id))}),l.jsx("div",{className:"perm-actions",children:l.jsx("button",{className:"btn sm",disabled:T||!F,onClick:se,title:F?"":"Unlock the vault in this tab first",children:T?"waiting for the authenticator…":"+ add passkey"})}),l.jsx("div",{className:"section-title",children:"backups"}),l.jsx("p",{children:"The recovery code from setup always works. A backup passphrase is optional: a way in on a device without the passkey."}),l.jsxs("div",{className:"vault-items",children:[l.jsxs("div",{className:"vault-item",children:[l.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),l.jsx("span",{className:"name",children:"Recovery code"})]}),he&&l.jsxs("div",{className:"vault-item",children:[l.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),l.jsx("span",{className:"name",children:"Backup passphrase"}),l.jsx("button",{className:"btn danger",disabled:T,onClick:()=>J(he.id),title:"Remove",children:"✕"})]})]}),S?l.jsxs(l.Fragment,{children:[l.jsxs("label",{htmlFor:"v-newpass",children:[he?"New backup passphrase":"Backup passphrase"," (at least ",Do," characters)"]}),l.jsx("input",{id:"v-newpass",type:"password",autoFocus:!0,autoComplete:"new-password",value:y,onChange:K=>g(K.target.value),onKeyDown:K=>{K.key==="Enter"&&y.length>=Do&&$()}}),l.jsxs("div",{className:"perm-actions",children:[l.jsx("button",{className:"btn primary sm",disabled:T||y.length<Do,onClick:$,children:T?"sealing…":"save"}),l.jsx("button",{className:"btn sm",disabled:T,onClick:()=>v(!1),children:"cancel"})]})]}):l.jsx("div",{className:"perm-actions",children:l.jsx("button",{className:"btn sm",disabled:T||!F,onClick:()=>v(!0),title:F?"":"Unlock the vault in this tab first",children:he?"replace backup passphrase":"+ set a backup passphrase"})}),l.jsx("div",{className:"section-title",children:"danger zone"}),l.jsxs("p",{children:["Delete the vault to start over with new factors. Its secrets are gone; the app reopens without sign-in until a new vault exists. Lost every factor instead? Run ",l.jsx("code",{className:"mono",children:"npm run vault:reset"})," on the server."]}),l.jsxs("div",{className:"perm-actions",children:[l.jsx("input",{type:"text",className:"mono",placeholder:"type DELETE",value:b,onChange:K=>x(K.target.value),style:{width:160}}),l.jsx("button",{className:"btn danger-outline sm",disabled:T||b!=="DELETE"||!F,onClick:Q,children:"delete vault"})]}),Z&&l.jsx("div",{className:"form-status error",children:Z})]})}function Yt({size:s=14,children:i,className:c}){return l.jsx("svg",{className:c,width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i})}const mh=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),l.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),l.jsx("path",{d:"M10 9H8"}),l.jsx("path",{d:"M16 13H8"}),l.jsx("path",{d:"M16 17H8"})]}),o1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34"}),l.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),l.jsx("path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z"})]}),r1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M12 19h8"}),l.jsx("path",{d:"m4 17 6-6-6-6"})]}),Zy=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"m21 21-4.34-4.34"}),l.jsx("circle",{cx:"11",cy:"11",r:"8"})]}),c1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1"}),l.jsx("path",{d:"m21 21-1.9-1.9"}),l.jsx("circle",{cx:"17",cy:"17",r:"3"})]}),u1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M3 5h.01"}),l.jsx("path",{d:"M3 12h.01"}),l.jsx("path",{d:"M3 19h.01"}),l.jsx("path",{d:"M8 5h13"}),l.jsx("path",{d:"M8 12h13"}),l.jsx("path",{d:"M8 19h13"})]}),d1=s=>l.jsxs(Yt,{...s,children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),l.jsx("path",{d:"M2 12h20"})]}),f1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M13 5h8"}),l.jsx("path",{d:"M13 12h8"}),l.jsx("path",{d:"M13 19h8"}),l.jsx("path",{d:"m3 17 2 2 4-4"}),l.jsx("path",{d:"m3 7 2 2 4-4"})]}),h1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),l.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),l.jsx("path",{d:"M12 17h.01"})]}),m1=s=>l.jsx(Yt,{...s,children:l.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"})}),p1=s=>l.jsxs(Yt,{...s,children:[l.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),l.jsx("circle",{cx:"18",cy:"6",r:"3"}),l.jsx("circle",{cx:"6",cy:"18",r:"3"}),l.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),a0=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),l.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]}),g1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V3a1 1 0 0 1 1-1h2.172a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 13.828 4H20Z"}),l.jsx("path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1"})]}),ph=s=>l.jsx(Yt,{...s,children:l.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),y1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),l.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"})]}),v1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M12 3v12"}),l.jsx("path",{d:"m17 8-5-5-5 5"}),l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"})]}),b1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M12 15V3"}),l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),l.jsx("path",{d:"m7 10 5 5 5-5"})]}),x1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M10 11v6"}),l.jsx("path",{d:"M14 11v6"}),l.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),S1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M5 12h14"}),l.jsx("path",{d:"M12 5v14"})]}),w1=s=>l.jsxs(Yt,{...s,children:[l.jsx("path",{d:"M14 9 9 4 4 9"}),l.jsx("path",{d:"M20 20h-7a4 4 0 0 1-4-4V4"})]}),Qc=s=>l.jsx(Yt,{...s,children:l.jsx("path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"})});function A1({tool:s,size:i=14}){switch(s){case"read":return l.jsx(mh,{size:i});case"write":case"edit":case"patch":case"apply_patch":return l.jsx(o1,{size:i});case"bash":return l.jsx(r1,{size:i});case"grep":return l.jsx(Zy,{size:i});case"glob":case"list":return l.jsx(c1,{size:i});case"webfetch":return l.jsx(d1,{size:i});case"websearch":return l.jsx(Zy,{size:i});case"todowrite":case"todoread":return l.jsx(f1,{size:i});case"task":return l.jsx(u1,{size:i});case"question":return l.jsx(h1,{size:i});default:return l.jsx(m1,{size:i})}}async function Nl(s,i){var u,d;const c=await fetch(s,{headers:{"Content-Type":"application/json"},...i});if(!c.ok){let h=`${c.status}`;try{h=((d=(u=await c.json())==null?void 0:u.error)==null?void 0:d.message)??h}catch{}throw new Error(h)}return c.json()}const k1=()=>Nl("/api/github"),T1=()=>Nl("/api/github/repos").then(s=>s.repos),j1=s=>Nl(`/api/github/branches?repo=${encodeURIComponent(s)}`).then(i=>i.branches),N1=s=>Nl("/api/github/clone",{method:"POST",body:JSON.stringify(s)}),E1=()=>Nl("/api/github/connect/start",{method:"POST"}),C1=s=>Nl("/api/github/connect/poll",{method:"POST",body:JSON.stringify({id:s})}),M1=()=>Nl("/api/github/connect",{method:"DELETE"});function Lc(s){if(!s)return"";const i=Math.max(0,(Date.now()-new Date(s).getTime())/1e3);return i<3600?`${Math.max(1,Math.round(i/60))} min ago`:i<86400?`${Math.round(i/3600)} h ago`:i<86400*30?`${Math.round(i/86400)} d ago`:i<86400*365?`${Math.round(i/(86400*30))} mo ago`:`${Math.round(i/(86400*365))} y ago`}function _1({onOpen:s,onClose:i}){const[c,u]=w.useState(null),[d,h]=w.useState(null),[m,y]=w.useState(null),[g,S]=w.useState(""),[v,b]=w.useState(null),[x,T]=w.useState(null),[z,Z]=w.useState(""),[D,F]=w.useState(null),[ue,he]=w.useState(null),[C,Y]=w.useState(null),[I,X]=w.useState(!1),J=w.useCallback(()=>k1().then(P=>{u(P),h(null)}).catch(P=>h(P.message)),[]);w.useEffect(()=>{J()},[J]);const se=!!(c!=null&&c.connected&&!c.sealed&&!c.error),$=w.useCallback(()=>{F("repos"),T1().then(y).catch(P=>he(P.message)).finally(()=>F(P=>P==="repos"?null:P))},[]);w.useEffect(()=>{se&&$()},[se,$]),w.useEffect(()=>{if(!se)return;const P=()=>$();return window.addEventListener("focus",P),()=>window.removeEventListener("focus",P)},[se,$]);const Q=w.useRef(null),K=()=>{Q.current&&(window.clearTimeout(Q.current),Q.current=null)};w.useEffect(()=>K,[]);async function ye(){F("connect"),he(null);try{const P=await E1();Y(P);try{await navigator.clipboard.writeText(P.userCode),X(!0)}catch{X(!1)}const Ae=async()=>{try{const qe=await C1(P.id);if(qe.status==="pending"){Q.current=window.setTimeout(Ae,P.interval*1e3);return}if(Y(null),F(null),qe.status==="connected"){await J();return}he(qe.status==="denied"?"The sign-in was cancelled on GitHub.":"The code expired. Start again.")}catch(qe){Y(null),F(null),he(qe.message)}};Q.current=window.setTimeout(Ae,P.interval*1e3)}catch(P){F(null),he(P.message)}}function ve(){K(),Y(null),F(null)}async function Ce(){he(null);try{await M1(),y(null),b(null),await J()}catch(P){he(P.message)}}function W(P){b(P),Z(P.defaultBranch),T(null),he(null),F("branches"),j1(P.fullName).then(Ae=>{T(Ae),!Ae.some(qe=>qe.name===P.defaultBranch)&&Ae[0]&&Z(Ae[0].name)}).catch(Ae=>he(Ae.message)).finally(()=>F(Ae=>Ae==="branches"?null:Ae))}async function ee(){if(v){F("clone"),he(null);try{const P=await N1({repo:v.fullName,branch:z});s(P.directory),i()}catch(P){he(P.message)}finally{F(null)}}}const re=w.useMemo(()=>{const P=g.trim().toLowerCase();return(m??[]).filter(Ae=>!P||Ae.fullName.toLowerCase().includes(P)||(Ae.description??"").toLowerCase().includes(P))},[m,g]);return l.jsxs(jl,{title:"github --clone",onClose:i,children:[d&&l.jsx("div",{className:"hint danger",children:d}),c&&!c.connected&&!C&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{children:["Clone a repository into the workspace so the agent can review it. ",l.jsx("b",{children:"Read-only"}),": the app can only read code, it reaches only the repositories you install it on, and nothing in the sandbox can push."]}),l.jsx("div",{className:"perm-actions center",children:l.jsxs("button",{className:"btn primary wide",disabled:D!==null,onClick:ye,children:[l.jsx(a0,{size:15})," ",D==="connect"?"contacting GitHub…":"Connect GitHub"]})}),c.storage==="memory"&&l.jsx("div",{className:"hint",style:{textAlign:"center"},children:"No vault yet, so the sign-in is kept until the runner restarts. Set up the vault to keep it."})]}),C&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{children:["Enter this code on GitHub to connect. ",I?"It is on your clipboard.":"Click it to copy."]}),l.jsx("button",{className:"recovery-code gh-code",onClick:()=>navigator.clipboard.writeText(C.userCode).then(()=>X(!0)).catch(()=>{}),title:"Copy",children:C.userCode}),l.jsx("div",{className:"perm-actions center",children:l.jsx("a",{className:"btn primary wide",href:C.verificationUri,target:"_blank",rel:"noreferrer",children:"Open github.com/login/device ↗"})}),l.jsxs("div",{className:"hint",style:{textAlign:"center"},children:["Waiting for your approval… this finishes by itself. ",l.jsx("button",{className:"link-btn",onClick:ve,children:"cancel"})]})]}),(c==null?void 0:c.sealed)&&l.jsx("p",{children:"Your GitHub sign-in is in the vault, which is locked. Unlock it (the lock icon below) and reopen this dialog."}),(c==null?void 0:c.error)&&l.jsx("div",{className:"hint danger",children:c.error}),se&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-head",children:[l.jsxs("span",{children:["connected as ",l.jsx("b",{children:c.login}),c.storage==="memory"?" · until restart (no vault yet)":""," · ",l.jsx("button",{className:"link-btn",onClick:Ce,children:"disconnect"})]}),l.jsx("a",{href:c.installUrl,target:"_blank",rel:"noreferrer",children:"choose repositories on GitHub ↗"})]}),c.clones.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"section-title",children:"in the workspace"}),l.jsx("div",{className:"vault-items",children:c.clones.map(P=>l.jsxs("div",{className:"vault-item",children:[l.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),l.jsxs("span",{className:"name",title:P.directory,children:[P.fullName,l.jsxs("span",{className:"desc",children:[" — ",P.branch??"detached"]})]}),l.jsx("button",{className:"btn sm",onClick:()=>{s(P.directory),i()},children:"open"})]},P.directory))})]}),m&&m.length===0?l.jsxs("div",{className:"gh-callout",children:[l.jsx("b",{children:"One more step."})," Signing in says who you are; which repositories BugXHunter may read is chosen separately, on GitHub's install screen. An organisation's owner may have to approve it. This list refreshes when you come back.",l.jsx("div",{className:"perm-actions center",children:l.jsx("a",{className:"btn primary wide",href:c.installUrl,target:"_blank",rel:"noreferrer",children:"Choose repositories on GitHub ↗"})})]}):l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",className:"mono",placeholder:"filter repositories…",value:g,onChange:P=>S(P.target.value),spellCheck:!1,autoFocus:!0}),l.jsxs("div",{className:"gh-list",role:"listbox","aria-label":"Repositories",children:[D==="repos"&&!m&&l.jsx("div",{className:"hint",children:"loading…"}),m&&m.length>0&&re.length===0&&l.jsx("div",{className:"hint",children:"Nothing matches."}),re.map(P=>l.jsxs("button",{className:`gh-repo${(v==null?void 0:v.fullName)===P.fullName?" selected":""}`,role:"option","aria-selected":(v==null?void 0:v.fullName)===P.fullName,onClick:()=>W(P),children:[l.jsxs("span",{className:"gh-name",children:[P.fullName,P.private&&l.jsx("span",{className:"badge",children:"private"}),P.archived&&l.jsx("span",{className:"badge",children:"archived"}),P.directory&&l.jsx("span",{className:"badge on",children:"in workspace"})]}),P.description&&l.jsx("span",{className:"gh-desc",children:P.description}),l.jsxs("span",{className:"gh-meta",children:[l.jsx(p1,{size:11})," ",P.defaultBranch,P.pushedAt?` · pushed ${Lc(P.pushedAt)}`:""]})]},P.fullName))]})]}),v&&l.jsxs("div",{className:"gh-clone",children:[l.jsx("label",{htmlFor:"gh-branch",children:"Branch"}),l.jsx("select",{id:"gh-branch",className:"mono",value:z,onChange:P=>Z(P.target.value),disabled:!x,children:(x??[{name:z,isDefault:!0}]).map(P=>l.jsxs("option",{value:P.name,children:[P.name,P.isDefault?" (default)":""]},P.name))}),l.jsx("button",{className:"btn primary sm",disabled:D!==null||!z,onClick:ee,children:D==="clone"?v.directory?"updating…":"cloning…":v.directory?"update & open":"clone & open"})]}),v&&l.jsxs("div",{className:"hint",children:["Lands in ",l.jsxs("span",{className:"mono",children:[c.cloneRoot,"/",v.fullName]}),". An existing clone is fast-forwarded, never reset; the agent's local edits stay."]})]}),ue&&l.jsx("div",{className:"hint danger",children:ue})]})}function R1({current:s,onOpen:i,onDeleted:c,onClose:u}){const[d,h]=w.useState(""),[m,y]=w.useState(null),[g,S]=w.useState(""),[v,b]=w.useState(null),[x,T]=w.useState(""),[z,Z]=w.useState(!1),[D,F]=w.useState(null),ue=w.useCallback(()=>gw().then(I=>{h(I.root),y(I.workspaces)}).catch(I=>F(I.message)),[]);w.useEffect(()=>{ue()},[ue]);async function he(I){Z(!0),F(null);try{await I()}catch(X){F(X.message)}finally{Z(!1)}}const C=()=>he(async()=>{const I=await yw(g.trim());S(""),i(I.directory),u()}),Y=I=>he(async()=>{await vw(I.directory),c(I.directory),b(null),T(""),await ue()});return l.jsxs(jl,{title:"workspace --list",onClose:u,children:[l.jsxs("p",{children:["Each workspace is a folder the agent works in",d?l.jsxs(l.Fragment,{children:[" under ",l.jsx("span",{className:"mono",children:d})]}):null,". Repositories cloned from GitHub appear here too."]}),l.jsxs("div",{className:"ws-new",children:[l.jsx("input",{type:"text",className:"mono",placeholder:"new-workspace-name","aria-label":"New workspace name",value:g,spellCheck:!1,onChange:I=>S(I.target.value),onKeyDown:I=>{I.key==="Enter"&&g.trim()&&C()}}),l.jsxs("button",{className:"btn primary sm",disabled:z||!g.trim(),onClick:C,children:[l.jsx(S1,{size:13})," create"]})]}),l.jsxs("div",{className:"gh-list",role:"list",children:[!m&&!D&&l.jsx("div",{className:"hint",children:"loading…"}),m&&m.length===0&&l.jsx("div",{className:"hint",children:"No workspaces yet. Create one above, or clone a repository from GitHub."}),m==null?void 0:m.map(I=>{const X=I.directory===s;return l.jsxs("div",{className:`ws-row${X?" current":""}`,role:"listitem",children:[l.jsxs("button",{className:"ws-open",onClick:()=>{i(I.directory),u()},disabled:X,title:X?"This is the open project":`Open ${I.directory}`,children:[l.jsx(ph,{size:14}),l.jsxs("span",{className:"gh-name",children:[I.name,X&&l.jsx("span",{className:"badge on",children:"open"}),!I.git&&l.jsx("span",{className:"badge",children:"no git"})]}),l.jsx("span",{className:"gh-meta",children:I.modified?`changed ${Lc(I.modified)}`:""})]}),l.jsx("button",{className:"icon-btn ws-del",disabled:z||X,onClick:()=>{b(I),T("")},title:X?"Open another project before deleting this one":`Delete ${I.name}`,"aria-label":`Delete ${I.name}`,children:l.jsx(x1,{size:14})})]},I.directory)})]}),v&&l.jsxs("div",{className:"ws-confirm",children:[l.jsxs("p",{children:[l.jsxs("b",{children:["Delete ",v.name,"?"]})," Everything in ",l.jsx("span",{className:"mono",children:v.directory})," is removed, including work the agent has not pushed anywhere. Type the name to confirm."]}),l.jsxs("div",{className:"ws-new",children:[l.jsx("input",{type:"text",className:"mono",autoFocus:!0,placeholder:v.name,"aria-label":"Type the workspace name to confirm",value:x,spellCheck:!1,onChange:I=>T(I.target.value),onKeyDown:I=>{I.key==="Enter"&&x===v.name&&Y(v)}}),l.jsx("button",{className:"btn danger-outline sm",disabled:z||x!==v.name,onClick:()=>Y(v),children:z?"deleting…":"delete"}),l.jsx("button",{className:"btn sm",disabled:z,onClick:()=>b(null),children:"cancel"})]})]}),D&&l.jsx("div",{className:"hint danger",children:D})]})}function Uo(s){return s>=1024*1024?(s/1024/1024).toFixed(1)+" MB":s>=1024?Math.round(s/1024)+" KB":s+" B"}function Va(s){return s>=1e6?(s/1e6).toFixed(s%1e6?1:0)+"M":s>=1e3?Math.round(s/1e3)+"k":String(s)}function s0(s){const i=[];return s!=null&&s.cached&&i.push(`${s.cached} cached`),s!=null&&s.cacheWrite&&i.push(`${s.cacheWrite} written`),i.length?` (${i.join(", ")})`:""}const Py=s=>(s<1e4?(s/1e3).toFixed(1):Math.round(s/1e3))+"s";function l0(s,i,c){const u=[];s.ttft!==void 0&&u.push(`${Py(s.ttft)} to first token`);const d=c?s.total:s.total-(s.ttft??0);return i&&d>50&&u.push(`${Math.round(i/(d/1e3))} tok/s`),u.push(`${Py(s.total)} total`),u.join(" · ")}function O1(s,i){const c=i?` ${i.toLocaleString("en")} tokens went on reasoning.`:"";return s!=null&&s.trim()?`Cut off at the Max tokens limit.${c} Raise Max tokens in the sidebar to get the rest.`:`The model reached the Max tokens limit before it wrote an answer.${c||" A reasoning model thinks first, and that counts."} Raise Max tokens in the sidebar and send again.`}function D1({directory:s,onClose:i}){const[c,u]=w.useState(""),[d,h]=w.useState(null),[m,y]=w.useState(null),[g,S]=w.useState([]),[v,b]=w.useState(null),[x,T]=w.useState(!1),z=w.useRef(null),Z=w.useCallback(C=>{b(null),bw(s,C).then(Y=>{h(Y),u(Y.path)}).catch(Y=>b(Y.message))},[s]);w.useEffect(()=>{Z("")},[Z]);async function D(C){const Y=Array.from(C);if(!Y.length)return;b(null);const I=[];for(let X=0;X<Y.length;X++){const J=Y[X];y(`uploading ${X+1} of ${Y.length}: ${J.name}`);try{const se=await xw(s,c,J);I.push(se.name===J.name?`${se.path} (${Uo(se.bytes)})`:`${J.name} → ${se.path}, as a file of that name exists`)}catch(se){I.push(`${J.name}: ${se.message}`)}}y(null),S(I),Z(c)}const F=C=>{C.preventDefault(),T(!1),C.dataTransfer.files.length&&D(C.dataTransfer.files)},ue=c?c.split("/"):[],he=s.split(/[\\/]/).filter(Boolean).pop()??s;return l.jsxs(jl,{title:"files --browse",onClose:i,children:[l.jsxs("div",{className:"files-head",children:[l.jsxs("nav",{className:"files-crumbs mono","aria-label":"Folder",children:[l.jsx("button",{className:"link-btn",onClick:()=>Z(""),title:s,children:he}),ue.map((C,Y)=>l.jsxs("span",{children:[l.jsx("span",{className:"sep",children:"/"}),l.jsx("button",{className:"link-btn",onClick:()=>Z(ue.slice(0,Y+1).join("/")),children:C})]},Y))]}),l.jsxs("button",{className:"btn primary sm",disabled:!!m,onClick:()=>{var C;return(C=z.current)==null?void 0:C.click()},children:[l.jsx(v1,{size:13})," upload"]}),l.jsx("input",{ref:z,type:"file",multiple:!0,hidden:!0,onChange:C=>{C.target.files&&D(C.target.files),C.target.value=""}})]}),l.jsxs("div",{className:`gh-list files-list${x?" dragging":""}`,role:"list",onDragOver:C=>{C.preventDefault(),T(!0)},onDragLeave:()=>T(!1),onDrop:F,children:[!d&&!v&&l.jsx("div",{className:"hint",children:"loading…"}),c&&l.jsxs("button",{className:"file-row",onClick:()=>Z(ue.slice(0,-1).join("/")),children:[l.jsx(w1,{size:14}),l.jsx("span",{className:"file-name",children:".."})]}),d&&d.entries.length===0&&l.jsx("div",{className:"hint",children:"Empty. Drop files here, or use upload."}),d==null?void 0:d.entries.map(C=>{const Y=c?`${c}/${C.name}`:C.name;return C.type==="dir"?l.jsxs("button",{className:"file-row",onClick:()=>Z(Y),children:[l.jsx(ph,{size:14}),l.jsxs("span",{className:"file-name",children:[C.name,"/"]}),l.jsx("span",{className:"gh-meta",children:C.modified?Lc(C.modified):""})]},C.name):l.jsxs("a",{className:"file-row",href:Sw(s,Y),download:C.name,title:`Download ${Y}`,children:[l.jsx(y1,{size:14}),l.jsx("span",{className:"file-name",children:C.name}),l.jsxs("span",{className:"gh-meta",children:[Uo(C.size),C.modified?` · ${Lc(C.modified)}`:""]}),l.jsx(b1,{size:13,className:"file-dl"})]},C.name)}),(d==null?void 0:d.truncated)&&l.jsx("div",{className:"hint",children:"Showing the first 2000 entries."})]}),l.jsx("div",{className:"hint",children:m??"Click a file to download it. Drop files on the list to upload them into this folder; nothing is overwritten."}),g.length>0&&l.jsx("ul",{className:"files-notes",children:g.map((C,Y)=>l.jsx("li",{className:"mono",children:C},Y))}),v&&l.jsx("div",{className:"hint danger",children:v})]})}const L1=/(embed|rerank|retriev|guard|safety|detector|deplot|calibration|reward|whisper|\bstt\b|\btts\b|parse|ocr|opir)/i;function zc(s){return s.output_modalities.includes("text")?!L1.test(`${s.id} ${s.name}`):!1}function z1(s,i){const c=i.trim().toLowerCase();return!c||`${s.name} ${s.id}`.toLowerCase().includes(c)}const i0=[{id:"A01:2025",name:"Broken Access Control",stride:"E",look:"object or function reachable by changing an id, role or URL; missing checks server-side; CORS, path traversal, IDOR, forced browsing, JWT or cookie tampering",fix:"deny by default, enforce ownership and role on the server for every object and function, log failures, rate-limit automation"},{id:"A02:2025",name:"Security Misconfiguration",stride:"I",look:"defaults left on, debug or admin interfaces exposed, verbose errors, permissive cloud storage, missing hardening headers, unneeded features and ports",fix:"hardened repeatable builds, minimal platform, configuration review per environment, automated drift checks"},{id:"A03:2025",name:"Software Supply Chain Failures",stride:"T",look:"unpinned or unverified dependencies, build and CI steps that can be tampered with, packages from untrusted registries, no SBOM, unsigned artifacts",fix:"pin and verify dependencies, signed builds with provenance, SBOM, dependency and container scanning, least privilege for CI tokens"},{id:"A04:2025",name:"Cryptographic Failures",stride:"I",look:"plaintext or weak transport, secrets or PII stored unencrypted, weak algorithms or key sizes, home-made crypto, keys in code, poor randomness",fix:"TLS everywhere, modern algorithms (AES-256-GCM, SHA-256+, Argon2 or bcrypt for passwords), key management, encrypt data at rest, no custom crypto"},{id:"A05:2025",name:"Injection",stride:"T",look:"user input reaching SQL, NoSQL, OS commands, LDAP, templates, XPath or HTML without separation; string-built queries; reflected or stored script",fix:"parameterised queries and safe APIs, allow-list validation, contextual output encoding, CSP, no shell from input"},{id:"A06:2025",name:"Insecure Design",stride:"STRIDE",look:"missing threat model, business-logic abuse (replay, race, quota bypass), trust placed in the client, recovery flows that leak or bypass, no abuse cases",fix:"threat modelling in design, secure design patterns and reference architectures, abuse-case tests, limits on business flows"},{id:"A07:2025",name:"Authentication Failures",stride:"S",look:"credential stuffing and brute force possible, weak or default passwords, no MFA on sensitive actions, session ids in URLs, sessions not rotated or expired, weak recovery",fix:"MFA, breached-password checks, rate limits and lockout, server-side session management with rotation and expiry, secure recovery"},{id:"A08:2025",name:"Software or Data Integrity Failures",stride:"T",look:"unsigned updates and plugins, insecure deserialisation, CI pipelines or auto-update channels that trust unverified input, integrity of data in transit between services unchecked",fix:"signatures and verification for code, updates and serialised data; integrity checks in pipelines; no deserialisation of untrusted input"},{id:"A09:2025",name:"Security Logging and Alerting Failures",stride:"R",look:"logins, access failures and high-value actions not logged, logs without context or integrity, no alerting, no response plan, logs that leak secrets",fix:"log auth and authorisation events with user and time, protect log integrity, alert on patterns, test the response playbook"},{id:"A10:2025",name:"Mishandling of Exceptional Conditions",stride:"D",look:"errors that fail open, unhandled exceptions, resource exhaustion, retries without limits, partial failures that leave state inconsistent, error messages with internals",fix:"fail closed, handle every error path, timeouts and limits, idempotent operations, generic errors to users with detail in logs"}],o0=[{id:"API1:2023",name:"Broken Object Level Authorization",stride:"E",look:"endpoints that take an object id and never check the caller owns it",fix:"authorise every object access against the session's identity; random ids are not a control"},{id:"API2:2023",name:"Broken Authentication",stride:"S",look:"weak tokens, no expiry or rotation, credentials in URLs, unauthenticated sensitive endpoints, auth that differs between API versions",fix:"standard, tested auth on every endpoint; short-lived tokens; MFA for sensitive flows"},{id:"API3:2023",name:"Broken Object Property Level Authorization",stride:"I",look:"responses that return more fields than the client needs; mass assignment of fields the user may not set",fix:"explicit response schemas and allow-lists for writable properties"},{id:"API4:2023",name:"Unrestricted Resource Consumption",stride:"D",look:"no limits on request rate, payload size, pagination, uploads or paid third-party calls",fix:"rate limits, quotas, size and pagination caps, spend limits on paid services"},{id:"API5:2023",name:"Broken Function Level Authorization",stride:"E",look:"admin or privileged functions reachable by guessing the route or changing the method",fix:"deny by default, role checks on every function, one authorisation module"},{id:"API6:2023",name:"Unrestricted Access to Sensitive Business Flows",stride:"D",look:"flows like purchase, signup, voting or booking callable at scale by scripts",fix:"detect and slow automation: device fingerprinting, step-up, human checks, business limits"},{id:"API7:2023",name:"Server Side Request Forgery",stride:"I",look:"the API fetches a URL the client supplies: webhooks, imports, previews, image fetchers",fix:"allow-list destinations, block internal ranges and metadata endpoints, no redirects, isolated fetcher"},{id:"API8:2023",name:"Security Misconfiguration",stride:"I",look:"missing TLS, permissive CORS, verbose errors, unneeded HTTP methods, unpatched components",fix:"hardening baseline, automated configuration checks, patching"},{id:"API9:2023",name:"Improper Inventory Management",stride:"I",look:"old API versions, debug or staging endpoints still live, undocumented hosts and data flows",fix:"inventory of hosts, versions and data flows; retire old versions; document data sharing"},{id:"API10:2023",name:"Unsafe Consumption of APIs",stride:"T",look:"data from third-party APIs trusted without validation, followed redirects, unencrypted upstream calls",fix:"validate and limit upstream responses, TLS to upstreams, timeouts, no blind redirects"}],r0=[{id:"LLM01:2025",name:"Prompt Injection",stride:"T",look:"user or retrieved content changes the model's instructions; indirect injection through documents, web pages, tool results, emails",fix:"treat all model input as untrusted, separate instructions from data, constrain output format, least privilege for what the model can trigger, human approval for consequential actions"},{id:"LLM02:2025",name:"Sensitive Information Disclosure",stride:"I",look:"secrets, PII or system details in training data, context or outputs; model repeats what one user told it to another",fix:"scrub data, scope context per user, output filtering, no secrets in prompts"},{id:"LLM03:2025",name:"Supply Chain",stride:"T",look:"third-party models, adapters, datasets, plugins or packages with no provenance; pickled or unsigned model files",fix:"verified sources, signed artifacts, AI bill of materials, scan model files, pin versions"},{id:"LLM04:2025",name:"Data and Model Poisoning",stride:"T",look:"training, fine-tuning or embedding data that an outsider can influence; backdoor triggers",fix:"dataset provenance and validation, anomaly checks, hold-out evaluation, sandbox fine-tuning"},{id:"LLM05:2025",name:"Improper Output Handling",stride:"T",look:"model output rendered as HTML, executed as code or SQL, or passed to a shell or another API without validation",fix:"treat output as untrusted input: encode, validate, parameterise, sandbox execution"},{id:"LLM06:2025",name:"Excessive Agency",stride:"E",look:"tools and permissions beyond the task, autonomous actions with no approval, one credential for every tool",fix:"minimal tools and scopes, per-action authorisation, human in the loop for consequential actions, kill switch"},{id:"LLM07:2025",name:"System Prompt Leakage",stride:"I",look:"system prompt holds secrets, roles or rules the security depends on; it can be extracted by asking",fix:"no secrets or security decisions in prompts; enforce rules outside the model"},{id:"LLM08:2025",name:"Vector and Embedding Weaknesses",stride:"I",look:"shared vector store across tenants, poisoned or stale documents, embedding inversion, retrieval of restricted documents",fix:"per-tenant and per-user access control on retrieval, validate sources, monitor retrieved content"},{id:"LLM09:2025",name:"Misinformation",stride:"R",look:"hallucinated facts, packages or citations acted on without checking; over-reliance in decisions",fix:"grounding with retrieval, verification steps, human review for decisions, communicate uncertainty"},{id:"LLM10:2025",name:"Unbounded Consumption",stride:"D",look:"no limits on tokens, requests, recursion or cost; model extraction through many queries",fix:"rate and spend limits, input size caps, timeouts, query monitoring, watermark or limit API detail"}],c0=[{id:"ASI01:2026",name:"Agent Goal Hijack",stride:"T",look:"content the agent reads (pages, files, tool results, other agents) redirects what it is trying to do",fix:"isolate instructions from data, verify intent before acting, constrain plans to the task"},{id:"ASI02:2026",name:"Tool Misuse and Exploitation",stride:"E",look:"permitted tools used in loops, unsafe chains or at runaway volume; tool parameters from untrusted text",fix:"least-agency tool scoping, parameter validation, budgets and loop limits, approval for risky tools"},{id:"ASI03:2026",name:"Identity and Privilege Abuse",stride:"S",look:"agent acts with a human's or a service's broad credential; delegation with no bound identity or scope",fix:"per-agent identity, short-lived scoped tokens, delegation that carries the principal and the task"},{id:"ASI04:2026",name:"Agentic Supply Chain Vulnerabilities",stride:"T",look:"imported tools, MCP servers, schemas, prompts or other agents trusted without verification",fix:"verify and pin tool and agent sources, review tool definitions, sandbox third-party tools"},{id:"ASI05:2026",name:"Unexpected Code Execution",stride:"E",look:"generated code or commands run without validation or isolation; interpreters reachable from prompts",fix:"sandboxed execution, allow-listed commands, review before run, no shell from model text"},{id:"ASI06:2026",name:"Memory and Context Poisoning",stride:"T",look:"injected or leaked memory, notes or thread context keeps steering later runs",fix:"validate what is written to memory, scope memory per user and task, expiry, review of persistent context"},{id:"ASI07:2026",name:"Insecure Inter-Agent Communication",stride:"S",look:"messages between agents can be read, forged or altered; no authentication between agents",fix:"authenticated, integrity-protected channels; schemas; treat other agents' output as untrusted"},{id:"ASI08:2026",name:"Cascading Failures",stride:"D",look:"one bad output or outage propagates through chained tools and agents; no circuit breakers",fix:"isolation boundaries, timeouts, circuit breakers, idempotent actions, rollback"},{id:"ASI09:2026",name:"Human-Agent Trust Exploitation",stride:"R",look:"confident agent output accepted without verification; approvals rubber-stamped; UI that hides what the agent did",fix:"show evidence and provenance, require review for consequential actions, measure override rates"},{id:"ASI10:2026",name:"Rogue Agents",stride:"E",look:"agents acting outside their intended behaviour or scope, surviving beyond their task, no way to stop them",fix:"kill switch, task-bound lifetimes, monitoring of actions against policy, audit trail"}],U1=[{id:"M1:2024",name:"Improper Credential Usage",look:"hardcoded keys, credentials stored or transmitted insecurely",fix:"no secrets in the app, platform keystores, short-lived tokens"},{id:"M2:2024",name:"Inadequate Supply Chain Security",look:"unverified SDKs and libraries, compromised build",fix:"vetted dependencies, signed builds, integrity checks"},{id:"M3:2024",name:"Insecure Authentication/Authorization",look:"client-side auth decisions, weak session handling, missing server checks",fix:"server-side authorisation, MFA, secure session tokens"},{id:"M4:2024",name:"Insufficient Input/Output Validation",look:"injection via deep links, intents, WebViews, file inputs",fix:"validate and encode at every boundary, restrict WebView bridges"},{id:"M5:2024",name:"Insecure Communication",look:"plaintext or weakly validated TLS, no pinning where warranted",fix:"TLS with validation, pinning for high-value apps"},{id:"M6:2024",name:"Inadequate Privacy Controls",look:"over-collection, PII in logs, leakage to third parties",fix:"data minimisation, consent, scrub logs"},{id:"M7:2024",name:"Insufficient Binary Protections",look:"easy reverse engineering and tampering of the binary",fix:"obfuscation and integrity checks where the threat model needs them; keep secrets off the device"},{id:"M8:2024",name:"Security Misconfiguration",look:"debug flags, exported components, permissive permissions",fix:"hardened release config, minimal permissions"},{id:"M9:2024",name:"Insecure Data Storage",look:"sensitive data in plain files, caches, backups, clipboard",fix:"platform secure storage, encryption, exclude from backups"},{id:"M10:2024",name:"Insufficient Cryptography",look:"weak algorithms, poor key handling, custom crypto",fix:"platform crypto APIs, modern algorithms, key management"}],I1=[{id:"V1",name:"Encoding and Sanitization",covers:"injection prevention, output encoding, sanitisation of HTML, SQL, OS, templates"},{id:"V2",name:"Validation and Business Logic",covers:"input validation, business-logic limits, anti-automation, sequence and timing"},{id:"V3",name:"Web Frontend Security",covers:"browser security headers, CSP, cookies, CORS, clickjacking"},{id:"V4",name:"API and Web Service",covers:"REST, GraphQL, WebSocket, schema validation, HTTP method handling"},{id:"V5",name:"File Handling",covers:"uploads, downloads, path traversal, file type and size limits, storage"},{id:"V6",name:"Authentication",covers:"passwords, MFA, credential recovery, lookup secrets, out-of-band, rate limits"},{id:"V7",name:"Session Management",covers:"session ids, binding, timeout, logout, re-authentication, cookie attributes"},{id:"V8",name:"Authorization",covers:"object, function and field-level authorisation, ownership, admin interfaces"},{id:"V9",name:"Self-contained Tokens",covers:"JWT and similar: signature, algorithm, audience, expiry, revocation"},{id:"V10",name:"OAuth and OIDC",covers:"flows, PKCE, redirect validation, token handling, client registration"},{id:"V11",name:"Cryptography",covers:"algorithms, key management, randomness, password hashing, crypto agility"},{id:"V12",name:"Secure Communication",covers:"TLS configuration, certificate validation, internal service encryption"},{id:"V13",name:"Configuration",covers:"secrets management, dependencies, unneeded features, secure defaults, build integrity"},{id:"V14",name:"Data Protection",covers:"classification, encryption at rest, minimisation, caching, data in logs and backups"},{id:"V15",name:"Secure Coding and Architecture",covers:"threat modelling, trust boundaries, defensive coding, memory safety, concurrency"},{id:"V16",name:"Security Logging and Error Handling",covers:"what to log, log protection, error handling that fails closed"},{id:"V17",name:"WebRTC",covers:"media and signalling security, TURN, DoS resistance"}],B1=[{id:"4.1",code:"WSTG-INFO",name:"Information Gathering",tests:"search engine and metadata leakage, fingerprint server and framework, enumerate applications and entry points, map architecture and execution paths"},{id:"4.2",code:"WSTG-CONF",name:"Configuration and Deployment Management",tests:"platform and framework configuration, file extensions and backups, admin interfaces, HTTP methods, HSTS, cloud storage, subdomain takeover, path confusion"},{id:"4.3",code:"WSTG-IDNT",name:"Identity Management",tests:"role definitions, registration and provisioning, account enumeration, username policy"},{id:"4.4",code:"WSTG-ATHN",name:"Authentication",tests:"credentials over encrypted channel, default credentials, lockout, bypass, remember-me, cache, password policy and reset, MFA"},{id:"4.5",code:"WSTG-ATHZ",name:"Authorization",tests:"directory traversal and file include, authorisation bypass, privilege escalation, IDOR, OAuth"},{id:"4.6",code:"WSTG-SESS",name:"Session Management",tests:"session schema, cookie attributes, fixation, exposed variables, CSRF, logout, timeout, puzzling, hijacking, JWT"},{id:"4.7",code:"WSTG-INPV",name:"Injection",tests:"reflected and stored XSS, HTTP verb and parameter tampering, SQL, LDAP, XML, SSI, XPath, IMAP/SMTP, code, command, format string, buffer, HTTP splitting, request smuggling, SSRF, mass assignment"},{id:"4.8",code:"WSTG-ERRH",name:"Error Handling",tests:"improper error handling, stack traces"},{id:"4.9",code:"WSTG-CRYP",name:"Weak Cryptography",tests:"TLS, padding oracle, sensitive data over unencrypted channels, weak encryption"},{id:"4.10",code:"WSTG-BUSL",name:"Business Logic",tests:"data validation, request forgery, integrity checks, process timing, function limits, workflow circumvention, defences against misuse, unexpected file types, malicious file upload, payment functionality"},{id:"4.11",code:"WSTG-CLNT",name:"Client-side",tests:"DOM XSS, JavaScript execution, HTML and CSS injection, client-side redirect, resource manipulation, CORS, cross-site flashing, clickjacking, WebSockets, web messaging, browser storage, script inclusion, reverse tabnabbing"},{id:"4.12",code:"WSTG-APIT",name:"API Testing",tests:"GraphQL (introspection, batching, injection), API reconnaissance, broken object-level authorisation"}],qf=[{id:"AML.TA0002",name:"Reconnaissance",techniques:["AML.T0000 Search Open Technical Databases","AML.T0001 Search Open AI Vulnerability Analysis","AML.T0003 Search Victim-Owned Websites","AML.T0004 Search Application Repositories","AML.T0006 Active Scanning","AML.T0064 Gather RAG-Indexed Targets","AML.T0087 Gather Victim Identity Information","AML.T0095 Search Open Websites/Domains"]},{id:"AML.TA0003",name:"Resource Development",techniques:["AML.T0002 Acquire Public AI Artifacts","AML.T0008 Acquire Infrastructure","AML.T0016 Obtain Capabilities","AML.T0017 Develop Capabilities","AML.T0019 Publish Poisoned Datasets","AML.T0020 Poison Training Data","AML.T0021 Establish Accounts","AML.T0058 Publish Poisoned Models","AML.T0060 Publish Hallucinated Entities","AML.T0065 LLM Prompt Crafting","AML.T0066 Retrieval Content Crafting","AML.T0079 Stage Capabilities","AML.T0104 Publish Poisoned AI Agent Tool"]},{id:"AML.TA0004",name:"Initial Access",techniques:["AML.T0010 AI Supply Chain Compromise (hardware, AI software, data, model, container registry, AI agent tool)","AML.T0012 Valid Accounts","AML.T0015 Evade AI Model","AML.T0049 Exploit Public-Facing Application","AML.T0052 Phishing (LLM-written spearphishing, deepfake-assisted)","AML.T0078 Drive-by Compromise","AML.T0093 Prompt Infiltration via Public-Facing Application"]},{id:"AML.TA0000",name:"AI Model Access",techniques:["AML.T0040 AI Model Inference API Access","AML.T0041 Physical Environment Access","AML.T0044 Full AI Model Access","AML.T0047 AI-Enabled Product or Service"]},{id:"AML.TA0005",name:"Execution",techniques:["AML.T0011 User Execution (unsafe AI artifacts, malicious package, poisoned AI agent tool, malicious link)","AML.T0050 Command and Scripting Interpreter","AML.T0051 LLM Prompt Injection (AML.T0051.000 direct, AML.T0051.001 indirect, AML.T0051.002 triggered)","AML.T0053 AI Agent Tool Invocation","AML.T0100 AI Agent Clickbait","AML.T0103 Deploy AI Agent"]},{id:"AML.TA0006",name:"Persistence",techniques:["AML.T0018 Manipulate AI Model (poison, modify architecture, embed malware)","AML.T0020 Poison Training Data","AML.T0061 LLM Prompt Self-Replication","AML.T0070 RAG Poisoning","AML.T0080 AI Agent Context Poisoning (memory, thread)","AML.T0081 Modify AI Agent Configuration","AML.T0093 Prompt Infiltration via Public-Facing Application","AML.T0099 AI Agent Tool Data Poisoning","AML.T0110 AI Agent Tool Poisoning"]},{id:"AML.TA0012",name:"Privilege Escalation",techniques:["AML.T0012 Valid Accounts","AML.T0053 AI Agent Tool Invocation","AML.T0054 LLM Jailbreak","AML.T0105 Escape to Host"]},{id:"AML.TA0007",name:"Defense Evasion",techniques:["AML.T0015 Evade AI Model","AML.T0054 LLM Jailbreak","AML.T0067 LLM Trusted Output Components Manipulation (citations)","AML.T0068 LLM Prompt Obfuscation","AML.T0071 False RAG Entry Injection","AML.T0073 Impersonation","AML.T0074 Masquerading","AML.T0076 Corrupt AI Model","AML.T0081 Modify AI Agent Configuration","AML.T0092 Manipulate User LLM Chat History","AML.T0094 Delay Execution of LLM Instructions","AML.T0097 Virtualization/Sandbox Evasion","AML.T0107 Exploitation for Defense Evasion","AML.T0109 AI Supply Chain Rug Pull","AML.T0111 AI Supply Chain Reputation Inflation"]},{id:"AML.TA0013",name:"Credential Access",techniques:["AML.T0055 Unsecured Credentials","AML.T0082 RAG Credential Harvesting","AML.T0083 Credentials from AI Agent Configuration","AML.T0090 OS Credential Dumping","AML.T0098 AI Agent Tool Credential Harvesting","AML.T0106 Exploitation for Credential Access"]},{id:"AML.TA0008",name:"Discovery",techniques:["AML.T0007 Discover AI Artifacts","AML.T0013 Discover AI Model Ontology","AML.T0014 Discover AI Model Family","AML.T0062 Discover LLM Hallucinations","AML.T0063 Discover AI Model Outputs","AML.T0069 Discover LLM System Information (special character sets, system instruction keywords, system prompt)","AML.T0075 Cloud Service Discovery","AML.T0084 Discover AI Agent Configuration (embedded knowledge, tool definitions, activation triggers, call chains)","AML.T0089 Process Discovery"]},{id:"AML.TA0015",name:"Lateral Movement",techniques:["AML.T0052 Phishing (from a compromised assistant)","AML.T0091 Use Alternate Authentication Material (application access token)"]},{id:"AML.TA0009",name:"Collection",techniques:["AML.T0035 AI Artifact Collection","AML.T0036 Data from Information Repositories","AML.T0037 Data from Local System","AML.T0085 Data from AI Services (RAG databases, AI agent tools)"]},{id:"AML.TA0001",name:"AI Attack Staging",techniques:["AML.T0005 Create Proxy AI Model","AML.T0018 Manipulate AI Model","AML.T0042 Verify Attack","AML.T0043 Craft Adversarial Data (white-box, black-box, transfer, manual, backdoor trigger)","AML.T0088 Generate Deepfakes","AML.T0102 Generate Malicious Commands"]},{id:"AML.TA0014",name:"Command and Control",techniques:["AML.T0072 Reverse Shell","AML.T0096 AI Service API","AML.T0108 AI Agent"]},{id:"AML.TA0010",name:"Exfiltration",techniques:["AML.T0024 Exfiltration via AI Inference API (membership inference, model inversion, model extraction)","AML.T0025 Exfiltration via Cyber Means","AML.T0056 Extract LLM System Prompt","AML.T0057 LLM Data Leakage","AML.T0077 LLM Response Rendering (markdown images, links that carry data)","AML.T0086 Exfiltration via AI Agent Tool Invocation"]},{id:"AML.TA0011",name:"Impact",techniques:["AML.T0015 Evade AI Model","AML.T0029 Denial of AI Service","AML.T0031 Erode AI Model Integrity","AML.T0034 Cost Harvesting (excessive queries, resource-intensive queries, agentic resource consumption)","AML.T0046 Spamming AI System with Chaff Data","AML.T0048 External Harms (financial, reputational, societal, user, AI IP theft)","AML.T0059 Erode Dataset Integrity","AML.T0101 Data Destruction via AI Agent Tool Invocation","AML.T0112 Machine Compromise (local AI agent, AI artifacts)"]}],H1=[{id:"AML.M0000",name:"Limit Public Release of Information"},{id:"AML.M0001",name:"Limit Model Artifact Release"},{id:"AML.M0002",name:"Passive AI Output Obfuscation"},{id:"AML.M0003",name:"Model Hardening"},{id:"AML.M0004",name:"Restrict Number of AI Model Queries"},{id:"AML.M0005",name:"Control Access to AI Models and Data at Rest"},{id:"AML.M0006",name:"Use Ensemble Methods"},{id:"AML.M0007",name:"Sanitize Training Data"},{id:"AML.M0008",name:"Validate AI Model"},{id:"AML.M0009",name:"Use Multi-Modal Sensors"},{id:"AML.M0010",name:"Input Restoration"},{id:"AML.M0011",name:"Restrict Library Loading"},{id:"AML.M0012",name:"Encrypt Sensitive Information"},{id:"AML.M0013",name:"Code Signing"},{id:"AML.M0014",name:"Verify AI Artifacts"},{id:"AML.M0015",name:"Adversarial Input Detection"},{id:"AML.M0016",name:"Vulnerability Scanning"},{id:"AML.M0017",name:"AI Model Distribution Methods"},{id:"AML.M0018",name:"User Training"},{id:"AML.M0019",name:"Control Access to AI Models and Data in Production"},{id:"AML.M0020",name:"Generative AI Guardrails"},{id:"AML.M0021",name:"Generative AI Guidelines"},{id:"AML.M0022",name:"Generative AI Model Alignment"},{id:"AML.M0023",name:"AI Bill of Materials"},{id:"AML.M0024",name:"AI Telemetry Logging"},{id:"AML.M0025",name:"Maintain AI Dataset Provenance"},{id:"AML.M0026",name:"Privileged AI Agent Permissions Configuration"},{id:"AML.M0027",name:"Single-User AI Agent Permissions Configuration"},{id:"AML.M0028",name:"AI Agent Tools Permissions Configuration"},{id:"AML.M0029",name:"Human In-the-Loop for AI Agent Actions"},{id:"AML.M0030",name:"Restrict AI Agent Tool Invocation on Untrusted Data"},{id:"AML.M0031",name:"Memory Hardening"},{id:"AML.M0032",name:"Segmentation of AI Agent Components"},{id:"AML.M0033",name:"Input and Output Validation for AI Agent Components"},{id:"AML.M0034",name:"Deepfake Detection"}],$1=[{letter:"S",name:"Spoofing",violates:"authentication",asks:"can someone pretend to be this user, service or device?"},{letter:"T",name:"Tampering",violates:"integrity",asks:"can data, code, config or a message be changed without detection?"},{letter:"R",name:"Repudiation",violates:"non-repudiation",asks:"can an action be denied later because nothing trustworthy recorded it?"},{letter:"I",name:"Information disclosure",violates:"confidentiality",asks:"can data be read by someone who should not?"},{letter:"D",name:"Denial of service",violates:"availability",asks:"can it be exhausted, crashed or locked?"},{letter:"E",name:"Elevation of privilege",violates:"authorisation",asks:"can a lower-privileged party do a higher-privileged thing?"}],q1={actor:"SR",external:"SRD",service:"STRIDE",ai:"STRIDE",datastore:"TRID",flow:"TID"},$o=(s,i,c=!0)=>`${s}
54
+ `+i.map(u=>`- ${u.id} ${u.name}: look for ${u.look}.${c?` Fix: ${u.fix}.`:""}`).join(`
55
+ `),Vs=(s=!0)=>$o("OWASP Top 10:2025 (web applications):",i0,s),yi=(s=!0)=>$o("OWASP API Security Top 10:2023:",o0,s),us=(s=!0)=>$o("OWASP Top 10 for LLM Applications 2025:",r0,s),vi=(s=!0)=>$o("OWASP Top 10 for Agentic Applications 2026:",c0,s),u0=(s=!0)=>$o("OWASP Mobile Top 10 2024:",U1,s),No=()=>`OWASP ASVS 5.0 chapters (the requirements a control is verified against):
56
+ `+I1.map(s=>`- ${s.id} ${s.name}: ${s.covers}`).join(`
57
+ `),G1=()=>`OWASP WSTG 4.2 test categories (the order a web test runs in):
58
+ `+B1.map(s=>`- ${s.id} ${s.code} ${s.name}: ${s.tests}`).join(`
59
+ `),xl=()=>`MITRE ATLAS tactics and techniques (attacks on AI systems, ids AML.Txxxx; cite them for AI components):
60
+ `+qf.map(s=>`- ${s.id} ${s.name}: ${s.techniques.join("; ")}`).join(`
61
+ `),Cc=()=>`MITRE ATLAS mitigations (cite the id in a fix for an AI component):
62
+ `+H1.map(s=>`${s.id} ${s.name}`).join("; "),gh=()=>`STRIDE, per element:
63
+ `+$1.map(s=>`- ${s.letter} ${s.name} (violates ${s.violates}): ${s.asks}`).join(`
64
+ `)+`
65
+ Applicable categories by element: `+Object.entries(q1).map(([s,i])=>`${s} ${i}`).join(", ")+".",d0=`Severity (rate by what an attacker gets, not by how clever the bug is):
66
+ - critical: unauthenticated, or any user, reaches other users' or regulated data, runs code, or takes over accounts or infrastructure; no mitigating control in the way.
67
+ - high: the same with one precondition (a low-privilege account, user interaction, an internal position), or a sensitive-data exposure at scale.
68
+ - medium: limited data or limited users, needs chaining or an unlikely precondition, or a missing defence-in-depth control that the threat model relies on.
69
+ - low: hygiene, information with no direct path to harm, or an issue needing an already-compromised position.
70
+ Business-critical data (regulated, financial, safety) raises a rating one step; a tested compensating control lowers it one step. Say which applied.`,X1=`Working rules:
71
+ - Only assess systems the user owns or is authorised to test (engagements, labs, CTFs). Decline to help attack anything else, and say so briefly.
72
+ - Separate evidence from inference. Only report what the material shows; say what you assumed and what you could not check. Never invent components, findings or citations.
73
+ - Cite the reference for every finding: the OWASP id (A01:2025, API1:2023, LLM01:2025, ASI01:2026, M1:2024), the CWE, and for AI components the ATLAS technique (AML.Txxxx) and mitigation (AML.Mxxxx); ATT&CK ids (Txxxx) for adversary behaviour outside the AI system.
74
+ - Every finding carries a concrete fix a developer can act on, and the ASVS chapter it is verified against.
75
+ - Rate severity with the rubric below and show the reasoning in one line.
76
+ - Finish with a coverage line: which categories you considered and found nothing for, so silence is not mistaken for safety.`,Y1=()=>[Vs(),yi(),us(),vi(),u0(!1),No(),xl(),Cc()].join(`
77
+
78
+ `),V1=()=>[`OWASP Top 10:2025: ${i0.map(s=>`${s.id} ${s.name}`).join("; ")}.`,`OWASP API Top 10:2023: ${o0.map(s=>`${s.id} ${s.name}`).join("; ")}.`,`OWASP LLM Top 10 2025: ${r0.map(s=>`${s.id} ${s.name}`).join("; ")}.`,`OWASP Agentic Top 10 2026: ${c0.map(s=>`${s.id} ${s.name}`).join("; ")}.`,`ATLAS tactics: ${qf.map(s=>`${s.id} ${s.name}`).join("; ")}.`,`ATLAS techniques to cite on AI components: ${qf.flatMap(s=>s.techniques).filter((s,i,c)=>c.indexOf(s)===i).map(s=>s.replace(/ \(.*\)$/,"")).join("; ")}.`].join(`
79
+ `),Q1=[{id:"web",name:"Web",first:["read the page source, robots.txt, sitemap.xml, .git/, .env, backup names (index.php~, .bak, .old), and every JS bundle for routes and secrets","map every parameter (query, body, cookie, header) and what each changes; note the stack from headers and error pages","try the obvious on each input: a quote, {{7*7}}, ../, a URL you control, an id one off yours, a different HTTP method"],families:["injection: SQL (error, union, blind, time), NoSQL ($ne, $regex), command, SSTI ({{7*7}}, ${7*7}, Jinja2 and Twig gadget chains), XXE, LDAP","access: IDOR, forced browsing, JWT (alg none, key confusion, weak secret, kid injection), session fixation, mass assignment","files: LFI with wrappers (php://filter, data://, zip://), log poisoning, upload bypass (double extension, content-type, polyglot, .htaccess)","client: XSS (reflected, stored, DOM, in attributes and JS strings), CSRF, prototype pollution, postMessage, open redirect","server: SSRF to 127.0.0.1, 169.254.169.254 and internal names, deserialisation (PHP, Java, Python pickle, .NET), race conditions, HTTP smuggling, cache poisoning","logic: coupon and quantity tricks, negative numbers, unicode normalisation, type juggling (== in PHP, 0e hashes), length limits that truncate"],tools:["curl -i -s (see the raw response), ffuf -w wordlist -u URL/FUZZ (directories, parameters, vhosts), katana (crawl), httpx (fingerprint)","sqlmap -u URL --batch (once a manual probe shows injection), jwt_tool or a python one-liner for JWT, Burp or mitmproxy for a repeater","python requests scripts for anything repetitive; a race needs threads or h2 single-packet"],stuck:["what does the challenge name or theme hint at?","which parameter have you not fuzzed?","does an error page or a stack trace name the framework and version?","is the flag perhaps in a file you can read rather than a shell you must get?"],refs:"A01, A05, A07, A08 of OWASP Top 10:2025; API1, API3, API7; WSTG-INPV, WSTG-ATHZ, WSTG-SESS"},{id:"api",name:"API",first:["find the spec: /swagger, /openapi.json, /graphql with introspection, /.well-known","list every endpoint with its auth; try each without a token and with another user's id","look at versions (/v1 vs /v2) and verbs the UI never uses"],families:["BOLA and BFLA, mass assignment, excessive data in responses, GraphQL introspection, batching and aliases for brute force, nested query DoS, JWT and API-key handling, rate-limit absence on sensitive flows, SSRF through webhooks and imports"],tools:["curl and a python script per endpoint, ffuf for parameters and ids, graphql-voyager or inql for schema, jwt_tool"],stuck:["which object ids are predictable?","what does the mobile or admin client call that the web client does not?","can a write endpoint set a field you were never shown?"],refs:"OWASP API Security Top 10:2023; WSTG-APIT"},{id:"crypto",name:"Cryptography",first:["identify the scheme before touching maths: key sizes, moduli, block size, IV reuse, encoding (base64, hex), any reuse across messages","check the classics against the numbers: small e, small d, common modulus, shared primes across keys, p close to q, known plaintext","if it is a custom scheme, find the invariant that leaks (a linear step, a predictable nonce, a padding check that returns a different error)"],families:["RSA: small e with no padding (cube root), Wiener (small d), common modulus, Fermat (p near q), Hastad broadcast, partial key exposure (Coppersmith), textbook signatures","symmetric: ECB cut-and-paste and byte-at-a-time, CBC bit-flipping and padding oracle, CTR nonce reuse (XOR of plaintexts), key reuse","hashes: length extension (MD5, SHA-1, SHA-256), weak or unsalted hashes, collisions, HMAC misuse (hash(key||msg))","classical: Caesar, Vigenere (Kasiski, index of coincidence), substitution (frequency), XOR with a repeating key, bacon, railfence","number theory: discrete log with weak groups, ECC with a singular or small-order curve, invalid-curve points, LCG and Mersenne Twister state recovery, nonce reuse in ECDSA"],tools:["python with pycryptodome and gmpy2, SageMath for lattices and curves, RsaCtfTool for the RSA classics, hashpump or hash_extender for length extension, CyberChef for encodings, z3 for constraint puzzles, factordb.com for a quick factor lookup"],stuck:["what is the same across the samples you have?","what happens to the ciphertext when you change one bit of the input?","is the randomness really random (timestamp seed, reused nonce)?","is the padding check or the error message an oracle?"],refs:"A04:2025 Cryptographic Failures; ASVS V11"},{id:"forensics",name:"Forensics and steganography",first:["file, strings -n 8, exiftool, binwalk -e, xxd | head: what is it really, and what is appended, prepended or embedded","for images: pngcheck, zsteg (PNG/BMP), steghide and stegseek (JPEG with a passphrase), check LSB planes and the alpha channel, compare dimensions in the header with the data","for captures: tshark -r file.pcap -q -z conv,tcp, follow streams, export objects (HTTP, SMB, DNS tunnels), look at unusual protocols","for disk and memory images: Volatility 3 (windows.pslist, cmdline, filescan, hashdump), Autopsy or sleuthkit, carve with foremost or photorec"],families:["appended archives and polyglots, LSB steganography, audio spectrograms, metadata and thumbnails, deleted files and slack space, base64 in DNS or ICMP, keystrokes in USB captures, Office and PDF embedded objects, git history leaks"],tools:["file, strings, exiftool, binwalk, foremost, xxd, zsteg, steghide, stegseek, pngcheck, tshark and Wireshark, Volatility 3, sleuthkit, Audacity or sox for audio, CyberChef"],stuck:["have you looked at the end of the file and at what comes after the declared length?","is there a second file inside (binwalk -e, 7z l)?","what does the challenge text say about a password or a person?","have you tried every channel: text, metadata, pixels, audio, timing?"],refs:"no OWASP category: evidence handling and data-at-rest protection (ASVS V14)"},{id:"reverse",name:"Reverse engineering",first:["file, strings, checksec; run it in a sandbox and watch (ltrace, strace); find main and the comparison that decides success","open in Ghidra or radare2 (aaa; afl; pdf @main); rename as you go; look for the flag check, the decryption loop, the anti-debug","for scripts and bytecode: pyinstaller extraction and decompile (pycdc), JADX for Android, dnSpy or ILSpy for .NET, de4js or a prettifier for JavaScript"],families:["string comparison with a transform (XOR, add, table), hand-rolled crypto, VM-based obfuscation, anti-debugging (ptrace, timing), packed binaries (UPX), flag built at runtime, checks that can be patched or solved with angr or z3"],tools:["Ghidra, radare2 or rizin with Cutter, gdb with gef or pwndbg, ltrace, strace, angr, z3, upx -d, pycdc, JADX, dnSpy"],stuck:["where is the first thing the input touches?","can you make the check pass by patching rather than understanding?","is the transform invertible, and can a solver do it?","does running it with a debugger attached change behaviour?"],refs:"ASVS V15 Secure Coding and Architecture; Mobile M7 Insufficient Binary Protections"},{id:"pwn",name:"Binary exploitation",first:["checksec (RELRO, canary, NX, PIE), file (static or dynamic, stripped), the libc version if given","find the bug: overflow (gets, strcpy, scanf %s), format string (printf(buf)), use after free, integer overflow, off by one","work out what you control and what you need: a return address, a GOT entry, a function pointer, a leak"],families:["stack overflow to ret2win, ret2libc or ROP (ropper, ROPgadget, one_gadget), format string read and write, heap (tcache poisoning, fastbin dup, unsorted bin leak, house of x), SROP, ret2dlresolve, kernel and sandbox escapes in harder sets"],tools:["pwntools (process, remote, ELF, ROP, cyclic, fmtstr_payload), gdb with gef or pwndbg, ropper, ROPgadget, one_gadget, patchelf and pwninit to match the libc, checksec"],stuck:["what is your exact offset (cyclic)?","what leaks (puts of a GOT entry, a format string %p chain)?","which protection is off, and which does that remove from the problem?","does the challenge give a libc, and does your local one match?"],refs:"CWE-120, CWE-134, CWE-416; ASVS V15"},{id:"osint",name:"OSINT",first:["pin down what is known: a name, a handle, an image, a domain; then widen one hop at a time","reverse image search and EXIF; username search across sites; WHOIS, DNS history, certificate transparency; archive.org for what was removed"],families:["usernames reused across platforms, geolocation from image details, leaked documents and metadata, social graph pivots, company registries, commit history and paste sites"],tools:["sherlock or maigret, exiftool, Google and Bing dorks, crt.sh, dnsdumpster, Wayback Machine, Google Earth and Street View, theHarvester"],stuck:["what is the smallest unusual detail in the image or text?","has the target used this handle elsewhere?","what did the page look like a year ago?"],refs:"no OWASP category: ATT&CK Reconnaissance"},{id:"cloud",name:"Cloud",first:["identify the provider from hostnames, headers and bucket URLs; try the metadata endpoint through any SSRF; list public buckets and their ACLs","with any credential found: whoami (sts get-caller-identity), enumerate what it can read, look for role chains and over-broad policies"],families:["public or listable storage, metadata credentials via SSRF, over-privileged roles and assume-role chains, secrets in user data and environment, exposed serverless endpoints, misconfigured OIDC trust, Kubernetes service-account tokens and dashboards"],tools:["aws, az and gcloud CLIs, pacu, enumerate-iam, s3scanner, kube-hunter and kubectl, ScoutSuite"],stuck:["what does the credential's own policy let it do?","which service trusts which role?","is there a public resource whose name you can guess from the company name?"],refs:"A01:2025, A02:2025; API7:2023 SSRF; ASVS V13"},{id:"ai",name:"AI and LLM",first:["learn the system: what it was told (ask it to summarise its instructions), what tools it has, what it can read (files, URLs, other users' data), what checks its output","classify the challenge: extract a secret from the prompt, make it call a tool, make it read content you control, bypass a guardrail, poison its memory or retrieval"],families:["direct injection and jailbreak framings (role-play, translation, continuation, hypothetical, format tricks): AML.T0051.000 and AML.T0054","indirect injection through a document, web page, image or tool result the model reads: AML.T0051.001, AML.T0070 RAG poisoning","system prompt extraction (ask for it in another language, as code, as a poem, piecewise): AML.T0056 and AML.T0069","exfiltration through rendering (markdown image URLs that carry data), tool invocation or links: AML.T0077 and AML.T0086","obfuscation to pass a filter (encodings, homoglyphs, splitting, payload in a code block): AML.T0068","memory and context poisoning across turns or sessions: AML.T0080; tool poisoning and malicious tool definitions: AML.T0110","guardrail evasion of input and output classifiers; model extraction and membership inference on inference APIs: AML.T0024"],tools:["a notebook of your attempts with exact prompts and responses, promptfoo and garak for systematic probes against your own endpoint, CyberChef for encodings"],stuck:["what does the model see that you do not (system prompt, tool results, retrieved text)?","which channel is unfiltered: input, retrieval, tool output, rendering?","can the model be made to do the step for you (write the code, summarise the secret) instead of revealing it directly?"],refs:"OWASP LLM01, LLM02, LLM05, LLM06, LLM07, LLM08; ASI01, ASI02, ASI06; MITRE ATLAS AML.T0051, AML.T0054, AML.T0056, AML.T0057, AML.T0068, AML.T0070, AML.T0077, AML.T0080, AML.T0086"},{id:"misc",name:"Misc and scripting",first:["read the whole challenge text twice; note the flag format; connect to the service and see what it says before sending anything","if it is a game or a puzzle, write a client and automate; if it is a jail (Python, bash, SQL), list what characters and names are allowed"],families:["Python jails (builtins, attribute walking, format string, unicode), bash jails (globbing, $0, env), esoteric languages, QR and barcode layers, encodings stacked (base64, base32, hex, rot, morse, brainfuck), protocol puzzles over nc"],tools:["pwntools remote for sockets, CyberChef magic, dcode.fr for classical ciphers, zbarimg for QR, a quick python script for anything repetitive"],stuck:["what is the flag format, and what in the output already looks like it?","what does the service do with input it does not expect?","which characters are blocked, and what can be built from the rest?"],refs:"A05:2025 Injection; ASVS V1 and V2"}],K1=`First look, for any challenge:
80
+ 1. Read the challenge text, name and category twice; write down the flag format and every hint.
81
+ 2. For a file: file, strings -n 8, exiftool, binwalk, xxd | head and tail; a hash lookup if it looks like a known file; list archives with 7z l. Keep the original untouched; work on a copy.
82
+ 3. For a service: connect once and read what it prints; note the protocol and the prompts before sending anything.
83
+ 4. For a URL: source, robots.txt, the JS bundles, the headers and the error page; map parameters.
84
+ 5. Name the category and the two or three families most likely; write the next three experiments, cheapest first.
85
+ 6. Keep a notes file: every attempt, exact input, exact output. When stuck, read it back and ask the stuck questions for the category.`,Z1=s=>`${s.name} (${s.id}):
86
+ - first: ${s.first.join("; ")}
87
+ - families: ${s.families.join(" | ")}
88
+ - tools: ${s.tools.join("; ")}
89
+ - when stuck: ${s.stuck.join(" ")}
90
+ - refs: ${s.refs}`,P1=()=>`${K1}
91
+
92
+ By category:
93
+ ${Q1.map(Z1).join(`
94
+
95
+ `)}`,F1=`To draw a diagram, put a drawgen spec (YAML) in a fenced block tagged drawio; the app renders it as an editable draw.io diagram. One diagram per block. Format:
96
+
97
+ \`\`\`drawio
98
+ title: Order flow # required
99
+ layout: auto # let the app place nodes; omit x/y on nodes
100
+ direction: right # right (default) or down
101
+ nodes: # id, label, kind are required; sub is an optional second line
102
+ - {id: user, label: Shopper, kind: actor}
103
+ - {id: api, label: Orders API, kind: service, sub: "Node 22"}
104
+ - {id: db, label: Postgres, kind: datastore}
105
+ edges: # from, to required; label optional; style optional
106
+ - {from: user, to: api, label: HTTPS}
107
+ - {from: api, to: db, label: SQL, style: data}
108
+ legend: true
109
+ \`\`\`
110
+
111
+ kind (colour means type only, the label carries the meaning): actor, external, service, ai, worker, datastore, queue, ui, gov, security, decision, step, terminal, note.
112
+ edge style: sync (default), async, data, ai, weak. Edge keys: from, to, label, style, both, curved.
113
+ Zones need manual layout (x, y, w, h on zones and x, y on every node), so prefer layout: auto without zones.
114
+ Keep labels short (two or three words), at most about 15 nodes, ids lowercase without spaces. Draw at most one edge between any two nodes: combine what flows between them into one label (e.g. "GET /user, /download, /run"). Quote any label that contains : ? # { } [ ] or a comma, e.g. label: "GET /user?id=". Put explanations in prose outside the block, not in the diagram.
115
+ For an attack path use kind: actor for the attacker, step for each stage, and put the technique or CWE in sub. Use decision for branches.`,Ta=(s,...i)=>[s,X1,d0,...i].join(`
116
+
117
+ `),Gf=[{id:"code-review",label:"Code reviewer",system:Ta("You are a senior application security engineer reviewing code. For each finding give: severity, the vulnerable line(s), why it is exploitable, the OWASP id and CWE, the ASVS chapter, and a corrected snippet. Work through the OWASP Top 10:2025 for every review, the API Top 10 when the code serves an API, the LLM and Agentic lists when it calls a model or runs an agent, and the Mobile list for app code. If the code is safe for a category, say so in the coverage line; do not invent issues.",Vs(),yi(!1),us(!1),vi(!1),No()),starters:[`Review this code for security vulnerabilities:
118
+
119
+ `,`Is this SQL query safe from injection?
120
+
121
+ `,`Review this tool-calling agent code against the OWASP Agentic Top 10:
122
+
123
+ `,`What are the security risks in this auth middleware?
124
+
125
+ `]},{id:"threat-model",label:"Threat modeller",system:Ta("You are a threat-modelling specialist. For the system described: (1) list assets, actors, trust boundaries and entry points; (2) decompose into elements (actors, services, AI components, data stores, flows); (3) for each element walk the STRIDE categories that apply to it and the OWASP categories that fit its technology (web, API, LLM, agent, mobile); (4) produce a table: threat, element, STRIDE, OWASP or ATLAS id, likelihood, impact, severity, mitigation with its ASVS chapter or ATLAS mitigation; (5) prioritise the top risks and list the assumptions. Flows that cross a trust boundary without authentication or encryption are always threats. AI components (models, agents, RAG, tools) are assessed with the LLM and Agentic lists and ATLAS as well as STRIDE.",gh(),Vs(!1),yi(!1),us(!1),vi(!1),u0(!1),No(),xl(),Cc()),starters:["Threat-model a password-reset flow that emails a link with a token.","Threat-model a customer-support chatbot with RAG over our ticket history and a tool that issues refunds.","Threat-model a mobile app that calls a REST API with JWTs.","What are the top risks of exposing an internal admin panel behind SSO?"]},{id:"ai-review",label:"AI system reviewer (LLM, agents, RAG)",system:Ta("You review AI-enabled systems: LLM applications, agents with tools, RAG pipelines, model APIs, copilots and the pipelines that train or fine-tune them. Map the system (inputs the model reads, what it can trigger, what it can reach, who can influence its context and its data), then assess it against the OWASP LLM Top 10, the OWASP Agentic Top 10 and MITRE ATLAS: for each applicable technique say whether the system is exposed, the evidence, the severity, and the mitigation with its ATLAS id. Treat every input the model reads as attacker-controlled unless the source is shown to be trusted, and every model output as untrusted input to whatever consumes it. When asked to design tests, propose defensive checks (red-team probes, guardrail evaluations, permission reviews) for the user's own system, with the technique each test covers.",us(),vi(),xl(),Cc()),starters:[`Review this LLM application design for prompt-injection and data-leak paths:
126
+
127
+ `,`This agent has these tools and permissions. Which ATLAS techniques apply and what should change?
128
+
129
+ `,"Design a red-team test plan (promptfoo/garak probes) for our chatbot, mapped to ATLAS and the LLM Top 10.","Our RAG index is shared by all tenants. What are the risks and the fixes?"]},{id:"pentest-plan",label:"Pentest planner (WSTG)",system:Ta("You plan authorised web and API penetration tests. From the scope given, produce a test plan ordered by the OWASP WSTG categories: for each, the tests that apply to this target, the tool or manual step for each (the BugXHunter agent has httpx, katana, nuclei, ffuf, testssl, subfinder, nmap, gitleaks, cargo audit, govulncheck, and can install promptfoo and garak for LLM targets), the evidence to capture, and the OWASP or ATLAS id the test covers. Scope beats speed: fingerprint first, then target templates to the stack. Include the rules of engagement checks (authorisation, windows, rate limits, data handling) at the top and a reporting template at the end.",G1(),Vs(!1),yi(!1),us(!1),No()),starters:["Plan a pentest of https://staging.example.com (a React SPA over a REST API, OAuth login). We are authorised in writing.",`Plan an API-only test for an OpenAPI spec I will paste:
130
+
131
+ `,"Plan a review of a customer chatbot (web widget calling an LLM with RAG) for our own product."]},{id:"diagram",label:"Diagram & screenshot reviewer",system:Ta("You review architecture diagrams, network diagrams and UI screenshots for security issues. Read every label carefully. For each issue give: where it appears, why it matters, severity, the OWASP or ATLAS id, and the fix. Look for exposed ports, plaintext protocols, hardcoded secrets, missing auth or MFA, flows crossing a trust boundary without a control, public storage, outdated software, missing logging, and for AI components the paths by which untrusted content reaches a model and what the model can trigger. Only report what is visible and flag any assumptions.",Vs(!1),yi(!1),us(!1),vi(!1),xl()),starters:["Review the attached diagram for security issues.","What would an attacker target first in this screenshot?","Which flows in this diagram cross a trust boundary without authentication?","Check this login page screenshot for security and phishing red flags."]},{id:"draw",label:"Diagram drawer",system:`You explain systems, code and security findings with diagrams. Read what you are given, then draw it: data flows, request paths, trust relationships or attack paths. Draw only what the material shows and say what you assumed. After the diagram, add two to four sentences on what it shows and the main security points, citing OWASP, CWE, ATT&CK or ATLAS ids where they fit.
132
+
133
+ `+F1,starters:[`Draw the request flow of this code, from the user to every data store:
134
+
135
+ `,`Draw the attack path for these findings, from initial access to impact:
136
+
137
+ `,`Draw this system's components and data flows, marking which links are unencrypted:
138
+
139
+ `,`Draw how untrusted content reaches the model in this AI system and what the model can trigger:
140
+
141
+ `]},{id:"tabletop",label:"Tabletop exercise facilitator",system:Ta("You design and facilitate tabletop exercises (TTX) for security teams, defensively: nothing you produce is an attack tool, it is a rehearsal of detection, decision and recovery. When asked for an exercise, produce: (1) objectives and the capabilities under test; (2) participants and roles (incident lead, SOC, engineering, legal, comms, executive, a facilitator and a note-taker); (3) a scenario grounded in real technique ids: ATT&CK for the intrusion, ATLAS for anything involving the organisation's AI systems, OWASP ids for the weaknesses exploited; (4) a master scenario events list (MSEL): timed injects, each with the information released, the question to the room, the expected action and the decision point; (5) a hot-wash and after-action report template whose gaps map to the control that closes them (ASVS chapter, ATLAS mitigation, or a process change). When facilitating live, release one inject at a time, ask what the team does and why, and never give the answer before the room has tried. Keep scenarios plausible for the organisation described and avoid gratuitous detail of how the attack is performed.",xl(),Cc(),Vs(!1),us(!1),vi(!1)),starters:["Design a 90-minute tabletop: an attacker uses indirect prompt injection in our support chatbot to exfiltrate customer data. Participants: SOC, platform team, legal, comms.","Design a tabletop for a compromised CI token that pushes a poisoned dependency to production.","Run the next inject. We have isolated the host and are reviewing the agent's tool logs.",`Write the after-action report from these notes:
142
+
143
+ `]},{id:"ctf",label:"CTF and lab coach",system:Ta("You coach people solving capture-the-flag challenges and deliberately vulnerable labs (their own CTF, a public CTF they are registered for, or training labs). First confirm the challenge is a CTF or lab and ask for the category and what has been tried. Then help by method, not by handing over the flag: identify the vulnerability class (map web and API challenges to the OWASP categories, AI and prompt-injection challenges to the LLM Top 10 and ATLAS techniques), explain the technique, propose the next experiment, and escalate hints in steps (nudge, then the idea, then the concrete step) only when asked. For a solved challenge, help write the write-up: the vulnerability, the OWASP or ATLAS id, the steps, the lesson, and the real-world fix. Cover the usual categories: web, API, crypto, forensics, reverse engineering, binary exploitation, OSINT, cloud, and AI/LLM.",P1(),Vs(!1),yi(!1),us(!1),xl()),starters:["Web CTF: the login form reflects my username on error and the cookie is a base64 JSON. What should I try next?","LLM CTF: the bot refuses to reveal the secret in its system prompt. Which techniques does this challenge expect, and how do they map to ATLAS?",`Write a CTF write-up for this challenge from my notes:
144
+
145
+ `,"Give me a nudge, not the answer: a PHP upload form that checks the extension."]},{id:"phishing",label:"Phishing analyst",system:Ta("You analyse suspicious emails, messages, voice notes and URLs. Give a verdict (phishing / suspicious / likely legitimate) with a confidence level, list the red flags (sender, links, urgency, attachments, headers, signs of LLM-written or deepfake-assisted lures: ATLAS AML.T0052), and the recommended action for the user and for the SOC. Never visit links; reason from the text provided."),starters:[`Is this email phishing?
146
+
147
+ `,`Analyse these email headers for spoofing:
148
+
149
+ `,"Write a 5-point phishing awareness checklist for staff, including AI-generated lures."]},{id:"logs",label:"Log triage (SOC)",system:Ta("You are a SOC analyst triaging logs. Identify suspicious events, group them into likely attack stages with MITRE ATT&CK technique ids where clear, and ATLAS technique ids when the logs come from an AI system (model API gateways, agent tool calls, RAG retrieval, prompt logs), rate severity, and give next investigative steps and containment actions. Separate evidence from inference.",xl()),starters:[`Triage these auth logs for brute force or credential stuffing:
150
+
151
+ `,`Do these web server logs show SQL injection attempts?
152
+
153
+ `,`Triage these agent tool-call logs: did a prompt injection make the agent exfiltrate anything?
154
+
155
+ `,"Write a Sigma rule to detect password spraying against Entra ID."]},{id:"explainer",label:"Vulnerability explainer",system:Ta("You teach application and AI security to developers. Explain the vulnerability class clearly, name its OWASP category and CWE (and the ATLAS technique for AI weaknesses), show a minimal vulnerable example and the fixed version, describe the real-world impact, and list prevention controls with the ASVS chapter they belong to. Keep it educational and defensive.",Vs(!1),us(!1),No()),starters:["Explain SSRF with a vulnerable example and the fix.","Explain indirect prompt injection with an example and the defences.","Explain IDOR and how to test for it in an API.","What is prototype pollution in JavaScript?"]}];Ta("You are a security engineer with the whole catalogue below at hand.",gh(),Y1());const J1=["Explain SSRF with a vulnerable example and the fix.","Threat-model a password-reset flow that emails a link with a token.",`Is this email phishing?
156
+
157
+ `,`Review this code for security vulnerabilities:
158
+
159
+ `];function f0(s){return Gf.find(i=>i.system===s.trim())}const Xf="or_flag_pattern",Ti="\\b[A-Za-z][A-Za-z0-9_-]{1,15}\\{[^{}\\s]{3,120}\\}";let kl=Ti;try{kl=localStorage.getItem(Xf)||Ti}catch{}const yh=()=>kl;function W1(s){const i=s.trim();kl=i&&h0(i)?i:Ti;try{i?localStorage.setItem(Xf,i):localStorage.removeItem(Xf)}catch{}return kl}function h0(s){try{return new RegExp(s,"g"),!0}catch{return!1}}const m0=(s=kl)=>new RegExp(s,"g");function eA(s,i=kl){if(i===Ti&&!s.includes("{"))return s;const c=m0(i);return s.split(/(<[^>]+>)/).map(u=>u.startsWith("<")||!u?u:u.replace(c,d=>`<mark class="flag">${d}</mark>`)).join("")}function tA(s,i=kl){if(i===Ti&&!s.includes("{"))return[s];const c=m0(i),u=[];let d=0;for(const h of s.matchAll(c)){const m=h.index??0;h[0]&&(u.push(s.slice(d,m),h[0]),d=m+h[0].length)}return u.push(s.slice(d)),u}const nA={low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Maximum"},aA={type:"function",function:{name:"get_weather",description:"Get the current weather for a city",parameters:{type:"object",properties:{city:{type:"string",description:"City name"}},required:["city"]}}};function sA({onCollapse:s,sessions:i,mode:c,setMode:u,runner:d,status:h,statusError:m,onOpenDirectory:y,onForgetDirectory:g,config:S,setConfig:v,models:b,modelError:x,activeModel:T,onReset:z,saved:Z}){var Te,He;const[D,F]=w.useState(yh()),ue=(q,ze)=>v($e=>({...$e,[q]:ze})),[he,C]=w.useState(!1);w.useEffect(()=>{const q=()=>fetch("/api/auth/me").then($e=>$e.json()).then($e=>C(!!$e.required)).catch(()=>{});q();const ze=setInterval(q,3e4);return()=>clearInterval(ze)},[]);const[Y,I]=w.useState([]),[X,J]=w.useState(""),[se,$]=w.useState(""),[Q,K]=w.useState(!1),[ye,ve]=w.useState(null),[Ce,W]=w.useState(null);w.useEffect(()=>{GS().then(I).catch(()=>{})},[]);async function ee(){if(se.trim()){K(!0),ve(null);try{const q=await XS(X.trim()||`Document ${Y.length+1}`,se);I(q),J(""),$(""),S.useKnowledge||ue("useKnowledge",!0)}catch(q){ve(String(q.message??q))}finally{K(!1)}}}async function re(q){I(await YS(q))}const P=(T==null?void 0:T.supported_features)??[],Ae=P.includes("tools"),qe=P.includes("json_mode"),ct=P.includes("reasoning"),[gt,j]=w.useState(""),[ae,Ne]=w.useState(!1),xe=b.filter(q=>q.output_modalities.includes("text")),oe=xe.filter(q=>ae||zc(q)||q.id===S.model),Oe=xe.filter(q=>!zc(q)).length,Le=oe.filter(q=>z1(q,gt)||q.id===S.model),me=["scx","anthropic","nvidia","bedrock","openrouter"].map(q=>[q,Le.filter(ze=>(ze.provider??"scx")===q)]).filter(([,q])=>q.length>0),De=f0(S.system),tt=b.some(q=>q.provider==="nvidia"),[L,je]=w.useState([]);w.useEffect(()=>{tt&&fetch("/api/models/nvidia-health").then(q=>q.ok?q.json():null).then(q=>je(Array.isArray(q==null?void 0:q.retired)?q.retired:[])).catch(()=>{})},[tt,b]);function be(q,ze){v($e=>{const yt=$e.tools.slice();return yt[q]={...yt[q],function:{...yt[q].function,...ze}},{...$e,tools:yt}})}function Be(q,ze){try{const $e=JSON.parse(ze);be(q,{parameters:$e})}catch{}}function Me(q){if(!q)return null;const ze=q.function??q;return ze!=null&&ze.name?{type:"function",id:If(),function:{name:ze.name,description:ze.description,parameters:ze.parameters??ze.schema}}:null}async function ie(){W(null);try{const q=await fetch("/example-tools.json",{cache:"no-store"});if(!q.ok)throw new Error(`No example-tools.json yet (${q.status}) — add web/public/example-tools.json first.`);const ze=await q.json(),$e=(Array.isArray(ze)?ze:ze.tools??[]).map(Me).filter(Boolean);if(!$e.length)throw new Error("File had no valid tools.");let yt=0;v(Ye=>{const pt=new Set(Ye.tools.map(Vt=>Vt.function.name)),Ve=$e.filter(Vt=>!pt.has(Vt.function.name));return yt=Ve.length,{...Ye,tools:[...Ye.tools,...Ve]}}),W(yt?`Loaded ${yt} tool${yt>1?"s":""}.`:"Already loaded.")}catch(q){W(String(q.message??q))}}function ke(){const q=new Blob([JSON.stringify(S,null,2)],{type:"application/json"}),ze=URL.createObjectURL(q),$e=document.createElement("a");$e.href=ze,$e.download=`${S.name.replace(/\s+/g,"-").toLowerCase()||"bot"}.json`,$e.click(),URL.revokeObjectURL(ze)}return l.jsxs("aside",{className:"sidebar",children:[l.jsxs("div",{className:"sidebar-head",children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsx(Tw,{}),l.jsx("button",{className:"sidebar-toggle",onClick:s,title:"Hide sidebar (Ctrl+B)","aria-label":"Hide sidebar",children:"«"})]}),l.jsx("div",{className:"mode-switch",children:["runner","playground"].map(q=>l.jsx("button",{className:"seg"+(c===q?" on":""),onClick:()=>u(q),children:q==="runner"?"Runner":"Playground"},q))})]}),c==="runner"?l.jsx(lA,{runner:d,status:h,statusError:m,onOpen:y,onForget:g,sessions:i}):l.jsxs("div",{className:"sidebar-body",children:[l.jsx("p",{className:"hint",style:{marginTop:0},children:"Chat with any SCX model directly — no agent, no file access. Useful for comparing models and prompts."}),l.jsx("div",{className:"section-title",children:"Identity"}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Bot name"}),l.jsx("input",{type:"text",value:S.name,onChange:q=>ue("name",q.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Model"}),l.jsx("input",{type:"search",placeholder:`Search ${oe.length} models…`,value:gt,onChange:q=>j(q.target.value),style:{marginBottom:6},"aria-label":"Search models"}),l.jsx("select",{value:S.model,onChange:q=>ue("model",q.target.value),children:me.map(([q,ze])=>l.jsx("optgroup",{label:q==="openrouter"?"OpenRouter":q==="nvidia"?"NVIDIA NIM":q==="bedrock"?"Amazon Bedrock":q==="anthropic"?"Anthropic":"SCX.ai",children:ze.map($e=>l.jsxs("option",{value:$e.id,children:[$e.name,$e.context_length?` · ${Math.round($e.context_length/1e3)}k ctx`:""]},$e.id))},q))}),Oe>0&&l.jsxs("label",{className:"hint",style:{display:"flex",gap:6,alignItems:"center",cursor:"pointer"},children:[l.jsx("input",{type:"checkbox",checked:ae,onChange:q=>Ne(q.target.checked)}),"Show non-chat models (",Oe," hidden: embeddings, guards, speech…)"]}),L.length>0&&l.jsxs("div",{className:"hint",title:L.join(", "),children:[L.length," retired NVIDIA model",L.length===1?"":"s"," hidden (no longer served)"]}),x&&l.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:x}),(T==null?void 0:T.description)&&l.jsx("div",{className:"hint",children:T.description}),l.jsxs("div",{className:"cap-badges",children:[l.jsx("span",{className:"badge"+(Ae?" on":""),children:"tools"}),l.jsx("span",{className:"badge"+(qe?" on":""),children:"json"}),l.jsx("span",{className:"badge"+(ct?" on":""),children:"reasoning"}),l.jsx("span",{className:"badge"+((Te=T==null?void 0:T.input_modalities)!=null&&Te.includes("image")?" on":""),children:"vision"}),(He=T==null?void 0:T.datacenters)==null?void 0:He.map(q=>l.jsx("span",{className:"badge",children:q.country_code},q.country_code))]})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Security preset"}),l.jsxs("select",{value:(De==null?void 0:De.id)??"custom",onChange:q=>{const ze=Gf.find($e=>$e.id===q.target.value);ze&&ue("system",ze.system)},children:[l.jsx("option",{value:"custom",children:"Custom (your own system prompt)"}),Gf.map(q=>l.jsx("option",{value:q.id,children:q.label},q.id))]})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"System prompt"}),l.jsx("textarea",{value:S.system,onChange:q=>ue("system",q.target.value),placeholder:"Describe the bot's personality, role, and rules…",style:{minHeight:110}})]}),l.jsx("div",{className:"section-title",children:"Generation"}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Temperature"}),l.jsxs("div",{className:"range-row",children:[l.jsx("input",{type:"range",min:0,max:2,step:.05,value:S.temperature,onChange:q=>ue("temperature",Number(q.target.value))}),l.jsx("span",{className:"range-val",children:S.temperature.toFixed(2)})]})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Top P"}),l.jsxs("div",{className:"range-row",children:[l.jsx("input",{type:"range",min:0,max:1,step:.05,value:S.topP,onChange:q=>ue("topP",Number(q.target.value))}),l.jsx("span",{className:"range-val",children:S.topP.toFixed(2)})]})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Max output tokens"}),l.jsxs("div",{className:"range-row",children:[l.jsx("input",{type:"range",min:64,max:(T==null?void 0:T.max_output_length)??4096,step:64,value:Math.min(S.maxTokens,(T==null?void 0:T.max_output_length)??4096),onChange:q=>ue("maxTokens",Number(q.target.value))}),l.jsx("span",{className:"range-val",children:S.maxTokens})]})]}),ct&&l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"reasoning-effort",children:"Reasoning effort"}),l.jsxs("select",{id:"reasoning-effort",value:S.reasoningEffort??"",onChange:q=>ue("reasoningEffort",q.target.value),children:[l.jsx("option",{value:"",children:"Model default"}),qv.map(q=>l.jsx("option",{value:q,children:nA[q]},q))]}),l.jsx("span",{className:"hint",children:"Reasoning counts against Max output tokens. Lower effort answers sooner and leaves more of the limit for the answer."})]}),l.jsx(bc,{label:"Stream responses",sub:"Token-by-token output via SSE",checked:S.stream,onChange:q=>ue("stream",q)}),l.jsx(bc,{label:"JSON mode",sub:qe?"Force valid JSON output":"Not supported by this model",checked:S.jsonMode&&qe,disabled:!qe,onChange:q=>ue("jsonMode",q)}),l.jsxs("div",{className:"section-title",children:["Tools ",Ae?"":"(model has no tool support)"]}),S.tools.map((q,ze)=>l.jsxs("div",{className:"tool-card",children:[l.jsxs("div",{className:"tc-head",children:[l.jsx("input",{type:"text",value:q.function.name,placeholder:"function_name",onChange:$e=>be(ze,{name:$e.target.value})}),l.jsx("button",{className:"btn danger",onClick:()=>v($e=>({...$e,tools:$e.tools.filter((yt,Ye)=>Ye!==ze)})),children:"✕"})]}),l.jsx("input",{type:"text",value:q.function.description??"",placeholder:"description",style:{marginBottom:8},onChange:$e=>be(ze,{description:$e.target.value})}),l.jsx("textarea",{defaultValue:JSON.stringify(q.function.parameters??{},null,2),onChange:$e=>Be(ze,$e.target.value),spellCheck:!1}),l.jsx("div",{className:"hint",children:"JSON Schema for the function parameters."})]},q.id??ze)),l.jsxs("div",{className:"btn-row",children:[l.jsx("button",{className:"btn block ghost mini",disabled:!Ae,onClick:()=>v(q=>({...q,tools:[...q.tools,{...structuredClone(aA),id:If()}]})),children:"+ Add tool"}),l.jsx("button",{className:"btn block ghost mini",onClick:ie,title:"Import tools from web/public/example-tools.json",children:"↓ Load example tools"})]}),Ce&&l.jsx("div",{className:"hint",style:{color:Ce.startsWith("Loaded")?"var(--accent-2)":"var(--muted-2)"},children:Ce}),l.jsx("div",{className:"section-title",children:"Knowledge (RAG)"}),l.jsx(bc,{label:"Ground answers in knowledge",sub:Y.length?`Retrieve from ${Y.length} doc${Y.length>1?"s":""} via embeddings`:"Add a document to enable",checked:S.useKnowledge&&Y.length>0,disabled:Y.length===0,onChange:q=>ue("useKnowledge",q)}),Y.map(q=>l.jsxs("div",{className:"tool-card",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:q.name}),l.jsxs("div",{className:"hint",style:{margin:0},children:[q.chunks," chunks · ",q.chars.toLocaleString()," chars"]})]}),l.jsx("button",{className:"btn danger",onClick:()=>re(q.id),children:"✕"})]},q.id)),l.jsxs("div",{className:"field",style:{marginTop:10},children:[l.jsx("input",{type:"text",placeholder:"Document name (optional)",value:X,onChange:q=>J(q.target.value),style:{marginBottom:8}}),l.jsx("textarea",{placeholder:"Paste text to give your bot a knowledge base…",value:se,onChange:q=>$(q.target.value),style:{minHeight:80}}),ye&&l.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:ye}),l.jsx("button",{className:"btn block ghost mini",style:{marginTop:8},disabled:Q||!se.trim(),onClick:ee,children:Q?"Embedding…":"+ Add to knowledge base"})]}),l.jsx("div",{className:"section-title",children:"Voice"}),l.jsx(bc,{label:"Speak replies aloud",sub:"Browser text-to-speech",checked:S.speak,onChange:q=>ue("speak",q)}),l.jsxs("div",{className:"hint",children:[sh()?"Mic dictation available in the composer.":"Voice input not supported in this browser."," ","SCX-native audio (scx-tts/scx-stt) is gated on this tier."]}),l.jsx("div",{className:"section-title",children:"Saved chats"}),l.jsxs("label",{className:"hint",style:{display:"flex",gap:6,alignItems:"center",cursor:"pointer"},children:[l.jsx("input",{type:"checkbox",checked:S.saveSessions,onChange:q=>ue("saveSessions",q.target.checked)}),"Save chats on this runner, encrypted with your vault"]}),l.jsxs("div",{className:"btn-row",children:[l.jsx("button",{className:"btn block ghost",onClick:z,children:"+ New chat"}),l.jsx("button",{className:"btn block ghost",onClick:ke,title:"Download the bot settings as JSON",children:"Export settings"})]}),Z.status&&l.jsx("div",{className:"hint",style:{color:Z.status.ok?"var(--muted)":"var(--amber)"},children:Z.status.text}),l.jsx(iA,{saved:Z})]}),l.jsxs("div",{className:"sidebar-foot",children:[l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Flag format"}),l.jsx("input",{type:"text",value:D,placeholder:Ti,spellCheck:!1,onChange:q=>{F(q.target.value),W1(q.target.value)},title:"A regular expression. Anything matching it is highlighted in replies and tool output (CTFs, labs). Blank = the default: a short prefix before braces, e.g. flag{...}."}),D.trim()&&!h0(D)&&l.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:"Not a valid regular expression; the default is in use."})]}),l.jsx(Ww,{}),he&&l.jsx("button",{className:"btn ghost sm block",onClick:Zw,children:"Sign out"}),l.jsxs("a",{className:"powered-by",href:"https://www.anthropic.com/claude/mythos",target:"_blank",rel:"noopener noreferrer","aria-label":"Reviewed by Claude Mythos 5.1",children:[l.jsx("span",{className:"powered-by-lead",children:"Reviewed by"}),l.jsx("img",{className:"powered-by-logo",src:"/claude-logo-ivory.svg",alt:"Claude",width:"83",height:"18"}),l.jsx("span",{className:"powered-by-model",children:"Mythos 5.1"})]})]})]})}function lA({runner:s,status:i,statusError:c,onOpen:u,onForget:d,sessions:h}){const[m,y]=w.useState(s.directory),[g,S]=w.useState(null),[v,b]=w.useState(!1),[x,T]=w.useState(!1),[z,Z]=w.useState(!1),[D,F]=w.useState(!1);w.useEffect(()=>y(s.directory),[s.directory]);async function ue(Y=m){if(Y.trim()){b(!0),S(null);try{u(await $v(Y))}catch(I){S(String(I.message??I))}finally{b(!1)}}}const he=s.recent.filter(Y=>Y!==s.directory),C=(i==null?void 0:i.models.filter(Y=>Y.id.startsWith("scx/")).length)??0;return l.jsxs("div",{className:"sidebar-body",children:[l.jsx("div",{className:"section-title",children:"Project"}),l.jsxs("div",{className:"field",children:[l.jsxs("form",{className:"dir-row",onSubmit:Y=>{Y.preventDefault(),ue()},children:[l.jsx("input",{type:"text",className:"mono",value:m,onChange:Y=>y(Y.target.value),placeholder:"C:\\code\\my-project",spellCheck:!1}),l.jsx("button",{className:"btn sm",type:"submit",disabled:v||!m.trim()||m===s.directory,children:"Open"})]}),g&&l.jsx("div",{className:"hint danger",children:g}),l.jsx("div",{className:"hint",children:"The agent reads, edits and runs commands in this folder. Switching folders starts a new session."}),l.jsxs("div",{className:"project-actions",children:[l.jsxs("button",{className:"btn sm gh-open",onClick:()=>Z(!0),title:"Create, open or delete workspaces",children:[l.jsx(g1,{size:13})," workspaces"]}),l.jsxs("button",{className:"btn sm gh-open",onClick:()=>F(!0),disabled:!s.directory,title:"Browse, upload and download this project's files",children:[l.jsx(ph,{size:13})," files"]}),l.jsxs("button",{className:"btn sm gh-open",onClick:()=>T(!0),title:"Clone a repository into the workspace (read-only)",children:[l.jsx(a0,{size:13})," clone from GitHub"]})]}),x&&l.jsx(_1,{onOpen:Y=>ue(Y),onClose:()=>T(!1)}),z&&l.jsx(R1,{current:s.directory,onOpen:Y=>ue(Y),onDeleted:d,onClose:()=>Z(!1)}),D&&s.directory&&l.jsx(D1,{directory:s.directory,onClose:()=>F(!1)})]}),he.length>0&&l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Recent"}),l.jsx("div",{className:"recent-list",children:he.map(Y=>l.jsxs("button",{className:"recent-item",onClick:()=>ue(Y),title:Y,children:[l.jsx("span",{className:"recent-name",children:Y.split(/[\\/]/).filter(Boolean).pop()}),l.jsx("span",{className:"recent-path mono",children:Y})]},Y))})]}),s.directory&&l.jsx(oA,{directory:s.directory,nav:h}),l.jsx("div",{className:"section-title",children:"Agents"}),l.jsxs("div",{className:"agent-info",children:[l.jsxs("div",{className:"ai-row",children:[l.jsx("span",{className:"ai-name",children:"build"}),l.jsx("span",{className:"hint",children:"edits & runs"})]}),l.jsx("div",{className:"hint ai-desc",children:"Every file edit and shell command waits for your approval."}),l.jsxs("div",{className:"ai-row",children:[l.jsx("span",{className:"ai-name",children:"plan"}),l.jsx("span",{className:"hint",children:"read-only"})]}),l.jsx("div",{className:"hint ai-desc",children:"Explores and reasons without changing anything."})]}),l.jsx("div",{className:"section-title",children:"Engine"}),c?l.jsx("div",{className:"hint danger",children:c}):l.jsxs("div",{className:"engine",children:[l.jsxs("div",{children:[l.jsx("span",{className:"muted",children:"Agent"}),l.jsx("span",{children:"OpenCode"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"muted",children:"Provider"}),l.jsxs("span",{children:["SCX.ai · ",C," models"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"muted",children:"Default"}),l.jsx("span",{className:"mono",children:(i==null?void 0:i.defaultModel)??"…"})]})]})]})}function iA({saved:s}){const[i,c]=w.useState(null),[u,d]=w.useState(!1);w.useEffect(()=>{if(!i)return;const y=setTimeout(()=>c(null),3e3);return()=>clearTimeout(y)},[i]);const h=s.list??[];if(s.list&&!h.length)return l.jsx("div",{className:"hint",children:"No saved chats yet."});const m=u?h:h.slice(0,8);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"session-list",children:m.map(y=>l.jsxs("div",{className:"session-item"+(y.id===s.activeId?" on":""),children:[l.jsxs("button",{className:"session-open",onClick:()=>s.onOpen(y.id),title:y.title,children:[l.jsx("span",{className:"session-title",children:y.title||"Untitled chat"}),l.jsx("span",{className:"session-meta",children:p0(Date.parse(y.updatedAt))})]}),l.jsx("button",{className:"session-del"+(i===y.id?" confirm":""),onClick:()=>{if(i!==y.id)return c(y.id);c(null),s.onDelete(y.id)},title:i===y.id?"Click again to delete":"Delete chat","aria-label":i===y.id?"Confirm delete":"Delete chat",children:i===y.id?"Delete?":"✕"})]},y.id))}),h.length>8&&l.jsx("button",{className:"btn ghost sm block",onClick:()=>d(y=>!y),children:u?"Show fewer":`Show all ${h.length}`})]})}function oA({directory:s,nav:i}){const[c,u]=w.useState(null),[d,h]=w.useState(null),[m,y]=w.useState(null),[g,S]=w.useState(!1);w.useEffect(()=>{let x=!0;return QS(s).then(T=>{x&&(u(T),h(null))}).catch(T=>x&&h(String(T.message??T))),()=>{x=!1}},[s,i.version,i.active]),w.useEffect(()=>{if(!m)return;const x=setTimeout(()=>y(null),3e3);return()=>clearTimeout(x)},[m]);async function v(x){if(m!==x){y(x);return}y(null);try{await ZS(x,s),i.active===x&&i.open(null),u(T=>(T==null?void 0:T.filter(z=>z.id!==x))??null)}catch(T){h(String(T.message??T))}}const b=g?c??[]:(c??[]).slice(0,8);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"section-title",children:"Sessions"}),l.jsx("button",{className:"btn ghost sm block new-session",onClick:()=>i.open(null),children:"+ New session"}),d&&l.jsx("div",{className:"hint danger",children:d}),c&&c.length===0&&l.jsx("div",{className:"hint",children:"No past sessions in this folder yet."}),l.jsx("div",{className:"session-list",children:b.map(x=>l.jsxs("div",{className:"session-item"+(x.id===i.active?" on":""),children:[l.jsxs("button",{className:"session-open",onClick:()=>i.open(x.id),title:x.title,children:[l.jsx("span",{className:"session-title",children:x.title||"Untitled session"}),l.jsxs("span",{className:"session-meta",children:[p0(x.updated),x.files>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{className:"adds",children:["+",x.additions]})," ",l.jsxs("span",{className:"dels",children:["−",x.deletions]})]})]})]}),l.jsx("button",{className:"session-del"+(m===x.id?" confirm":""),onClick:()=>v(x.id),title:m===x.id?"Click again to delete":"Delete session","aria-label":m===x.id?"Confirm delete":"Delete session",children:m===x.id?"Delete?":"✕"})]},x.id))}),c&&c.length>8&&l.jsx("button",{className:"btn ghost sm block",onClick:()=>S(x=>!x),children:g?"Show fewer":`Show all ${c.length}`})]})}function p0(s){if(!s)return"";const i=Math.max(0,(Date.now()-s)/1e3);return i<60?"just now":i<3600?`${Math.floor(i/60)}m ago`:i<86400?`${Math.floor(i/3600)}h ago`:i<7*86400?`${Math.floor(i/86400)}d ago`:new Date(s).toLocaleDateString()}function bc({label:s,sub:i,checked:c,onChange:u,disabled:d}){return l.jsxs("div",{className:"toggle",children:[l.jsxs("div",{className:"tg-label",children:[s,i&&l.jsx("small",{children:i})]}),l.jsxs("label",{className:"switch"+(d?" disabled":""),children:[l.jsx("input",{type:"checkbox",checked:c,disabled:d,onChange:h=>u(h.target.checked)}),l.jsx("span",{})]})]})}function g0({text:s}){const i=yh(),c=w.useMemo(()=>tA(s,i),[s,i]);return c.length===1?l.jsx(l.Fragment,{children:s}):l.jsx(l.Fragment,{children:c.map((u,d)=>d%2?l.jsx("mark",{className:"flag",children:u},d):u)})}const rA=512*1024,Fy=5,cA=".md,.markdown,.txt,text/markdown,text/plain";function uA(s,i=""){return/\.(md|markdown|txt)$/i.test(s)?!0:i==="text/markdown"||i==="text/plain"}function dA(s){return/[\u0000-\u0008\u000E-\u001A]/.test(s.slice(0,8192))}const fA=5*1024*1024,Ef=4,hA=3*1024*1024-2048,Jy=3,vh=`image/*,.drawio,.xml,.svg,${cA}`;function mA(s){return new Promise((i,c)=>{const u=new FileReader;u.onload=()=>i(String(u.result)),u.onerror=()=>c(u.error),u.readAsDataURL(s)})}const pA=s=>/\.drawio(\.(svg|xml))?$/i.test(s)||/\.xml$/i.test(s);async function gA(s){if(/\.drawio\.png$/i.test(s.name))return!1;if(pA(s.name))return!0;if(s.type==="image/svg+xml"||/\.svg$/i.test(s.name)){const i=await s.slice(0,4096).text();return/content="[^"]*(mxfile|mxGraphModel)/.test(i)||/&lt;mxfile/.test(i)}return!1}async function yA(s){var u;const i=await fetch("/api/render/outline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:await s.text()})}),c=await i.json().catch(()=>({}));if(!i.ok)throw new Error(((u=c==null?void 0:c.error)==null?void 0:u.message)||`Reading ${s.name} failed (${i.status})`);return{name:s.name,text:c.outline,pages:c.pages}}function bh(){const[s,i]=w.useState([]),[c,u]=w.useState([]),[d,h]=w.useState(0),[m,y]=w.useState(null);async function g(b){y(null);const x=Array.from(b),T=[],z=[],Z=[];for(const D of x)if(await gA(D))z.push(D);else if(D.type.startsWith("image/"))D.size>fA?y(`${D.name} is over 5 MB.`):T.push({name:D.name||"pasted-image.png",url:await mA(D)});else if(uA(D.name,D.type)){if(D.size>rA){y(`${D.name} is over 512 KB.`);continue}const F=await D.text();dA(F)?y(`${D.name} is not a text file.`):F.trim()?Z.push({name:D.name||"pasted-text.txt",text:F,kind:"text"}):y(`${D.name} is empty.`)}else y(`${D.name}: attach images, draw.io files (.drawio, .drawio.svg), or Markdown / text files (.md, .txt).`);Z.length&&u(D=>{const F=Fy-D.filter(ue=>ue.kind==="text").length;return Z.length>F&&y(`Up to ${Fy} text files per message.`),[...D,...Z.slice(0,Math.max(0,F))]}),i(D=>{const F=[...D,...T];return F.length>Ef&&y(`Up to ${Ef} images per message.`),F.slice(0,Ef)});for(const D of z){if(D.size>hA){y(`${D.name} is over 3 MB.`);continue}h(F=>F+1);try{const F=await yA(D);u(ue=>ue.filter(he=>he.kind!=="text").length>=Jy?(y(`Up to ${Jy} diagrams per message.`),ue):[...ue,F])}catch(F){y(String(F.message??F))}finally{h(F=>F-1)}}}function S(b){const x=Array.from(b.clipboardData.files);x.length&&(b.preventDefault(),g(x))}function v(b){b.dataTransfer.files.length&&(b.preventDefault(),g(b.dataTransfer.files))}return{images:s,docs:c,reading:d>0,attachError:m,addImages:g,onPaste:S,onDrop:v,remove:b=>i(x=>x.filter((T,z)=>z!==b)),removeDoc:b=>u(x=>x.filter((T,z)=>z!==b)),clear:()=>{i([]),u([]),y(null)}}}function xh({images:s,docs:i=[],onRemove:c,onRemoveDoc:u,reading:d}){return!s.length&&!i.length&&!d?null:l.jsxs("div",{className:"attach-row",children:[s.map((h,m)=>l.jsxs("span",{className:"attach-chip",title:h.name,children:[l.jsx("img",{src:h.url,alt:""}),l.jsx("span",{className:"attach-name",children:h.name}),l.jsx("button",{className:"attach-x",onClick:()=>c(m),"aria-label":`Remove ${h.name}`,children:"✕"})]},`i${m}`)),i.map((h,m)=>l.jsxs("span",{className:"attach-chip doc",title:h.kind==="text"?`${h.name}: attached as text (${h.text.length.toLocaleString()} characters)`:`${h.name}: read as an exact outline (${h.text.length.toLocaleString()} characters${h.pages&&h.pages.length>1?`, ${h.pages.length} pages`:""})`,children:[l.jsx("span",{className:"attach-doc-icon","aria-hidden":!0,children:"◇"}),l.jsx("span",{className:"attach-name",children:h.name}),u&&l.jsx("button",{className:"attach-x",onClick:()=>u(m),"aria-label":`Remove ${h.name}`,children:"✕"})]},`d${m}`)),d&&l.jsx("span",{className:"attach-chip doc",children:l.jsx("span",{className:"attach-name",children:"reading diagram…"})})]})}function Sh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var El=Sh();function y0(s){El=s}var wl={exec:()=>null};function pi(s){let i=[];return c=>{let u=Math.max(0,Math.min(3,c-1)),d=i[u];return d||(d=s(u),i[u]=d),d}}function Fe(s,i=""){let c=typeof s=="string"?s:s.source,u={replace:(d,h)=>{let m=typeof h=="string"?h:h.source;return m=m.replace(mn.caret,"$1"),c=c.replace(d,m),u},getRegex:()=>new RegExp(c,i)};return u}var vA=((s="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+s)}catch{return!1}})(),mn={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:pi(s=>new RegExp(`^ {0,${s}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:pi(s=>new RegExp(`^ {0,${s}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:pi(s=>new RegExp(`^ {0,${s}}(?:\`\`\`|~~~)`)),headingBeginRegex:pi(s=>new RegExp(`^ {0,${s}}#`)),htmlBeginRegex:pi(s=>new RegExp(`^ {0,${s}}(?:</?(?:${Go})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,"i")),blockquoteBeginRegex:pi(s=>new RegExp(`^ {0,${s}}>`))},bA=/^(?:[ \t]*(?:\n|$))+/,xA=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,SA=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wA=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,v0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,b0=Fe(v0).replace(/bull/g,wh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),AA=Fe(v0).replace(/bull/g,wh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ah=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,kA=/^[^\n]+/,kh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,TA=Fe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",kh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),jA=Fe(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,wh).getRegex(),Go="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Th=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,NA=Fe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Th).replace("tag",Go).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x0=s=>Fe(Ah).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",s).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Go).getRegex(),EA=x0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),CA=x0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),MA=Fe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",CA).getRegex(),jh={blockquote:MA,code:xA,def:TA,fences:SA,heading:wA,hr:qo,html:NA,lheading:b0,list:jA,newline:bA,paragraph:EA,table:wl,text:kA},Wy=Fe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Go).getRegex(),_A={...jh,lheading:AA,table:Wy,paragraph:Fe(Ah).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Wy).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Go).getRegex()},RA={...jh,html:Fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Th).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:wl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Fe(Ah).replace("hr",qo).replace("heading",` *#{1,6} *[^
160
+ ]`).replace("lheading",b0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},OA=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,DA=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,S0=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,LA=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ms=/[\p{P}\p{S}]/u,ji=/[\s\p{P}\p{S}]/u,Xo=/[^\s\p{P}\p{S}]/u,zA=Fe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ji).getRegex(),UA=/[\p{Pi}\p{Ps}"']/u,w0=/(?!~)[\p{P}\p{S}]/u,IA=/(?!~)[\s\p{P}\p{S}]/u,BA=/(?:[^\s\p{P}\p{S}]|~)/u,HA=Fe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",vA?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),A0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,$A=Fe(A0,"u").replace(/punct/g,ms).getRegex(),qA=Fe(A0,"u").replace(/punct/g,w0).getRegex(),GA=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,XA=Fe(GA,"u").replace(/openQuote/g,UA).replace(/punct/g,ms).getRegex(),k0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",YA=Fe(k0,"gu").replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,ji).replace(/punct/g,ms).getRegex(),VA=Fe(k0,"gu").replace(/notPunctSpace/g,BA).replace(/punctSpace/g,IA).replace(/punct/g,w0).getRegex(),QA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",KA=Fe(QA,"gu").replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,ji).replace(/punct/g,ms).getRegex(),ZA=Fe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,ji).replace(/punct/g,ms).getRegex(),PA="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",FA=Fe(PA,"gu").replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,ji).replace(/punct/g,ms).getRegex(),JA=Fe(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ms).getRegex(),WA="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ek=Fe(WA,"gu").replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,ji).replace(/punct/g,ms).getRegex(),tk=Fe(/\\(punct)/,"gu").replace(/punct/g,ms).getRegex(),nk=Fe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ak=Fe(Th).replace("(?:-->|$)","-->").getRegex(),sk=Fe("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ak).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),T0=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Uc=Fe(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",T0).getRegex(),lk=Fe(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",Uc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ik=Fe(/^!?\[(label)\]\[(ref)\]/).replace("label",Uc).replace("ref",kh).getRegex(),ok=Fe(/^!?\[(ref)\](?:\[\])?/).replace("ref",kh).getRegex(),ev=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,rk=Fe(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",T0).getRegex(),ck=Fe("reflink|nolink(?!\\()","g").replace("reflink",Fe(/^!?\[(label)\]\[(ref)\]/).replace("label",rk).replace("ref",ev).getRegex()).replace("nolink",Fe(/^!?\[(ref)\](?:\[\])?/).replace("ref",ev).getRegex()).getRegex(),tv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,uk=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,dk=Fe(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,uk).getRegex(),Nh={_backpedal:wl,anyPunctuation:tk,autolink:nk,blockSkip:HA,br:S0,code:DA,del:wl,delLDelim:wl,delRDelim:wl,emStrongLDelim:$A,emStrongRDelimAst:YA,emStrongRDelimUnd:ZA,escape:OA,link:lk,nolink:ok,punctuation:zA,reflink:ik,reflinkSearch:ck,tag:sk,text:LA,url:wl},fk={...Nh,emStrongLDelim:XA,emStrongRDelimAst:KA,emStrongRDelimUnd:FA,link:Fe(/^!?\[(label)\]\((.*?)\)/).replace("label",Uc).getRegex(),reflink:Fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Uc).getRegex()},Yf={...Nh,emStrongRDelimAst:VA,emStrongLDelim:qA,delLDelim:JA,delRDelim:ek,url:Fe(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",dk).replace("protocol",tv).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Fe(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",tv).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},hk={...Yf,br:Fe(S0).replace("{2,}","*").getRegex(),text:Fe(Yf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xc={normal:jh,gfm:_A,pedantic:RA},bo={normal:Nh,gfm:Yf,breaks:hk,pedantic:fk},mk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nv=s=>mk[s];function Jn(s,i){if(i){if(mn.escapeTest.test(s))return s.replace(mn.escapeReplace,nv)}else if(mn.escapeTestNoEncode.test(s))return s.replace(mn.escapeReplaceNoEncode,nv);return s}function pk(s){return s.replace(mn.numericCharacterReference,(i,c,u)=>{let d=c===void 0?Number.parseInt(u,16):Number.parseInt(c,10);return d===0||d>1114111||d>=55296&&d<=57343?"�":String.fromCodePoint(d)})}function av(s){try{s=encodeURI(s).replace(mn.percentDecode,"%")}catch{return null}return s}function sv(s,i){var h;let c=s.replace(mn.findPipe,(m,y,g)=>{let S=!1,v=y;for(;--v>=0&&g[v]==="\\";)S=!S;return S?"|":" |"}),u=c.split(mn.splitPipe),d=0;if(u[0].trim()||u.shift(),u.length>0&&!((h=u.at(-1))!=null&&h.trim())&&u.pop(),i)if(u.length>i)u.splice(i);else for(;u.length<i;)u.push("");for(;d<u.length;d++)u[d]=u[d].trim().replace(mn.slashPipe,"|");return u}function Gs(s,i,c){let u=s.length;if(u===0)return"";let d=0;for(;d<u&&s.charAt(u-d-1)===i;)d++;return s.slice(0,u-d)}function lv(s){let i=s.split(`
161
+ `),c=i.length-1;for(;c>=0&&mn.blankLine.test(i[c]);)c--;return i.length-c<=2?s:i.slice(0,c+1).join(`
162
+ `)}function Ic(s){return s.trim().toLowerCase().toUpperCase().toLowerCase()}function iv(s,i){if(s.indexOf(i[0])===-1&&s.indexOf(i[1])===-1)return-1;let c=0;for(let u=0;u<s.length;u++)if(s[u]==="\\")u++;else if(s[u]===i[0])c++;else if(s[u]===i[1]&&(c--,c<0))return u;return c>0?-2:-1}function ov(s,i=0){let c=i,u="";for(let d of s)if(d===" "){let h=4-c%4;u+=" ".repeat(h),c+=h}else u+=d,c++;return u}function rv(s,i,c,u,d){let h=i.href,m=i.title||null,y=s[1].replace(d.other.outputLinkReplace,"$1"),g=s[0].charAt(0)==="!";u.state.inLink=!0;let S=u.state.linkEmitted,v=u.state.inRawBlock;u.state.linkEmitted=!1;let b=u.inlineTokens(y),x=u.state.linkEmitted;if(u.state.linkEmitted=S,u.state.inLink=!1,!g){if(x){u.state.inRawBlock=v;return}u.state.linkEmitted=!0}return{type:g?"image":"link",raw:c,href:h,title:m,text:y,tokens:b}}function gk(s,i,c){let u=s.match(c.other.indentCodeCompensation);if(u===null)return i;let d=u[1];return i.split(`
163
+ `).map(h=>{let m=h.match(c.other.beginningSpace);if(m===null)return h;let[y]=m;return h.slice(Math.min(y.length,d.length))}).join(`
164
+ `)}function cv(s,i,c,u){if(!i.includes("<"))return!1;for(let d=0;d<i.length;d++){if(i[d]==="\\"){d++;continue}if(i[d]==="`"){let y=u.inline.code.exec(i.slice(d));if(y){d+=y[0].length-1;continue}}if(i[d]!=="<")continue;let h=s.slice(c+d),m=u.inline.tag.exec(h)||u.inline.autolink.exec(h);if(m){if(m[0].length>i.length-d)return!0;d+=m[0].length-1}}return!1}var Bc=class{constructor(s){Et(this,"options");Et(this,"rules");Et(this,"lexer");this.options=s||El}space(s){let i=this.rules.block.newline.exec(s);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(s){let i=this.rules.block.code.exec(s);if(i){let c=this.options.pedantic?i[0]:lv(i[0]),u=c.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:c,codeBlockStyle:"indented",text:u}}}fences(s){let i=this.rules.block.fences.exec(s);if(i){let c=i[0],u=gk(c,i[3]||"",this.rules);return{type:"code",raw:c,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:u}}}heading(s){let i=this.rules.block.heading.exec(s);if(i){let c=i[2].trim();if(this.rules.other.endingHash.test(c)){let u=Gs(c,"#");(this.options.pedantic||!u||this.rules.other.endingSpaceTabChar.test(u))&&(c=u.trim())}return{type:"heading",raw:Gs(i[0],`
165
+ `),depth:i[1].length,text:c,tokens:this.lexer.inline(c)}}}hr(s){let i=this.rules.block.hr.exec(s);if(i)return{type:"hr",raw:Gs(i[0],`
166
+ `)}}blockquote(s){let i=this.rules.block.blockquote.exec(s);if(i){let c=Gs(i[0],`
167
+ `).split(`
168
+ `),u="",d="",h=[];for(;c.length>0;){let m=!1,y=[],g;for(g=0;g<c.length;g++)if(this.rules.other.blockquoteStart.test(c[g]))y.push(c[g]),m=!0;else if(!m)y.push(c[g]);else break;c=c.slice(g);let S=y.join(`
169
+ `),v=S.replace(this.rules.other.blockquoteSetextReplace,`
170
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");u=u?`${u}
171
+ ${S}`:S,d=d?`${d}
172
+ ${v}`:v;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,h,!0),this.lexer.state.top=b,c.length===0)break;let x=h.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){let T=x,z=c.join(`
173
+ `),Z=T.raw+`
174
+ `+z.replace(this.rules.other.blockquoteSetextReplace2,""),D=this.blockquote(Z);h[h.length-1]=D;let F=Z.substring(D.raw.length).replace(/^\n/,""),ue=F?F.split(`
175
+ `).length:0,he=ue?c.slice(0,-ue):c;he.length>0&&(u=`${u}
176
+ ${he.join(`
177
+ `)}`),d=d.substring(0,d.length-T.text.length)+D.text;break}else if((x==null?void 0:x.type)==="list"){let T=x,z=T.raw+`
178
+ `+c.join(`
179
+ `),Z=this.list(z);h[h.length-1]=Z,u=u.substring(0,u.length-x.raw.length)+Z.raw,d=d.substring(0,d.length-T.raw.length)+Z.raw,c=z.substring(h.at(-1).raw.length).split(`
180
+ `);continue}}return{type:"blockquote",raw:u,tokens:h,text:d}}}list(s){let i=this.rules.block.list.exec(s);if(i){let c=i[1].trim(),u=c.length>1,d={type:"list",raw:"",ordered:u,start:u?+c.slice(0,-1):"",loose:!1,items:[]};c=u?`\\d{1,9}\\${c.slice(-1)}`:`\\${c}`,this.options.pedantic&&(c=u?c:"[*+-]");let h=this.rules.other.listItemRegex(c),m=!1;for(;s;){let g=!1,S="",v="";if(!(i=h.exec(s))||this.rules.block.hr.test(s))break;S=i[0],s=s.substring(S.length);let b=i[2].split(`
181
+ `,1)[0],x=i[1].length,T=this.options.pedantic?ov(b,x):b.replace(this.rules.other.leadingSpaceTab,F=>ov(F,x)),z=s.split(`
182
+ `,1)[0],Z=!T.trim(),D=0;if(this.options.pedantic?(D=2,v=T.trimStart()):Z?D=x+1:(D=T.search(this.rules.other.nonSpaceChar),D=D>4?1:D,v=T.slice(D),D+=x),Z&&this.rules.other.blankLine.test(z)&&(S+=z+`
183
+ `,s=s.substring(z.length+1),g=!0),!g){let F=this.rules.other.nextBulletRegex(D),ue=this.rules.other.hrRegex(D),he=this.rules.other.fencesBeginRegex(D),C=this.rules.other.headingBeginRegex(D),Y=this.rules.other.htmlBeginRegex(D),I=this.rules.other.blockquoteBeginRegex(D);for(;s;){let X=s.split(`
184
+ `,1)[0],J;if(z=X,this.options.pedantic?(z=z.replace(this.rules.other.listReplaceNesting," "),J=z):J=z.replace(this.rules.other.leadingSpaceTab,se=>se.replace(this.rules.other.tabCharGlobal," ")),he.test(z)||C.test(z)||Y.test(z)||I.test(z)||F.test(z)||ue.test(z))break;if(J.search(this.rules.other.nonSpaceChar)>=D||!z.trim())v+=`
185
+ `+J.slice(D);else{if(Z||T.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||he.test(T)||C.test(T)||ue.test(T))break;v+=`
186
+ `+z}Z=!z.trim(),S+=X+`
187
+ `,s=s.substring(X.length+1),T=J.slice(D)}}d.loose||(m?d.loose=!0:this.rules.other.doubleBlankLine.test(S)&&(m=!0)),d.items.push({type:"list_item",raw:S,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),d.raw+=S}let y=d.items.at(-1);if(y)y.raw=y.raw.trimEnd(),y.text=y.text.trimEnd();else return;d.raw=d.raw.trimEnd();for(let g of d.items)if(this.lexer.state.top=!1,g.tokens=this.lexer.blockTokens(g.text,[]),!d.loose){let S=g.tokens.filter(b=>b.type==="space"),v=S.length>0&&S.some(b=>this.rules.other.anyLine.test(b.raw));d.loose=v}for(let g of d.items){let S=g.tokens[0];if(g.task&&((S==null?void 0:S.type)==="text"||(S==null?void 0:S.type)==="paragraph")){g.text=g.text.replace(this.rules.other.listReplaceTask,""),S.raw=S.raw.replace(this.rules.other.listReplaceTask,""),S.text=S.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let v=this.rules.other.listTaskCheckbox.exec(g.raw);if(v){let b={type:"checkbox",raw:v[0]+" ",checked:v[0]!=="[ ]"};g.checked=b.checked,d.loose?g.tokens[0]&&["paragraph","text"].includes(g.tokens[0].type)&&"tokens"in g.tokens[0]&&g.tokens[0].tokens?(g.tokens[0].raw=b.raw+g.tokens[0].raw,g.tokens[0].text=b.raw+g.tokens[0].text,g.tokens[0].tokens.unshift(b)):g.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):g.tokens.unshift(b)}}else g.task&&(g.task=!1)}if(d.loose)for(let g of d.items){g.loose=!0;for(let S of g.tokens)S.type==="text"&&(S.type="paragraph")}return d}}html(s){let i=this.rules.block.html.exec(s);if(i){let c=lv(i[0]);return{type:"html",block:!0,raw:c,pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:c}}}def(s){let i=this.rules.block.def.exec(s);if(i){if(!this.rules.other.startAngleBracket.test(i[2])&&iv(i[2],"()")!==-1)return;let c=Ic(i[1]).replace(this.rules.other.multipleSpaceGlobal," "),u=i[2]?i[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:c,raw:Gs(i[0],`
188
+ `),href:u,title:d}}}table(s){var m;let i=this.rules.block.table.exec(s);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;let c=sv(i[1]),u=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),d=(m=i[3])!=null&&m.trim()?i[3].replace(this.rules.other.tableRowBlankLine,"").split(`
189
+ `):[],h={type:"table",raw:Gs(i[0],`
190
+ `),header:[],align:[],rows:[]};if(c.length===u.length){for(let y of u)this.rules.other.tableAlignRight.test(y)?h.align.push("right"):this.rules.other.tableAlignCenter.test(y)?h.align.push("center"):this.rules.other.tableAlignLeft.test(y)?h.align.push("left"):h.align.push(null);for(let y=0;y<c.length;y++)h.header.push({text:c[y],tokens:this.lexer.inline(c[y]),header:!0,align:h.align[y]});for(let y of d)h.rows.push(sv(y,h.header.length).map((g,S)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:h.align[S]})));return h}}lheading(s){let i=this.rules.block.lheading.exec(s);if(i){let c=i[1].trim();return{type:"heading",raw:Gs(i[0],`
191
+ `),depth:i[2].charAt(0)==="="?1:2,text:c,tokens:this.lexer.inline(c)}}}paragraph(s){let i=this.rules.block.paragraph.exec(s);if(i){let c=i[1].charAt(i[1].length-1)===`
192
+ `?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:c,tokens:this.lexer.inline(c)}}}text(s){let i=this.rules.block.text.exec(s);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(s){let i=this.rules.inline.escape.exec(s);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(s){let i=this.rules.inline.tag.exec(s);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(s){if(this.lexer.state.linkParenPossible===!1)return;let i=this.rules.inline.link.exec(s);if(i){let c=i[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&cv(s,i[1],c,this.rules))return;let u=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(u)){if(!this.rules.other.endAngleBracket.test(u))return;let m=Gs(u.slice(0,-1),"\\");if((u.length-m.length)%2===0)return}else{let m=iv(i[2],"()");if(m===-2)return;if(m>-1){let y=(i[0].indexOf("!")===0?5:4)+i[1].length+m;i[2]=i[2].substring(0,m),i[0]=i[0].substring(0,y).trim(),i[3]=""}}let d=i[2],h="";if(this.options.pedantic){let m=this.rules.other.pedanticHrefTitle.exec(d);m&&(d=m[1],h=m[3])}else h=i[3]?i[3].slice(1,-1):"";return d=d.trim(),this.rules.other.startAngleBracket.test(d)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(u)?d=d.slice(1):d=d.slice(1,-1)),rv(i,{href:d&&d.replace(this.rules.inline.anyPunctuation,"$1"),title:h&&h.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(s,i){let c;if((c=this.rules.inline.reflink.exec(s))||(c=this.rules.inline.nolink.exec(s))){let u=c[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&cv(s,c[1],u,this.rules))return;let d=(c[2]||c[1]).replace(this.rules.other.multipleSpaceGlobal," "),h=i[Ic(d)];if(!h){let m=c[0].charAt(0);return{type:"text",raw:m,text:m}}return rv(c,h,c[0],this.lexer,this.rules)}}emStrong(s,i,c=""){let u=this.rules.inline.emStrongLDelim.exec(s);if(!(!u||!u[1]&&!u[2]&&!u[3]&&!u[4]||u[4]&&c.match(this.rules.other.unicodeAlphaNumeric))&&(!(u[1]||u[3])||!c||this.rules.inline.punctuation.exec(c))){let d=[...u[0]].length-1,h,m,y=d,g=0,S=u[0][0],v=c===S,b=S==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,i=i.slice(-1*s.length+d);(u=b.exec(i))!==null;){if(h=u[1]||u[2]||u[3]||u[4]||u[5]||u[6],!h)continue;if(m=[...h].length,u[3]||u[4]){y+=m;continue}else if(u[5]||u[6]){if(d%3&&!((d+m)%3)){g+=m;continue}if(v)break}if(y-=m,y>0)continue;m=Math.min(m,m+y+g);let x=[...u[0]][0].length,T=s.slice(0,d+u.index+x+m);if(Math.min(d,m)%2){let Z=T.slice(1,-1);return{type:"em",raw:T,text:Z,tokens:this.lexer.inlineTokens(Z)}}let z=T.slice(2,-2);return{type:"strong",raw:T,text:z,tokens:this.lexer.inlineTokens(z)}}}}codespan(s){let i=this.rules.inline.code.exec(s);if(i){let c=i[2].replace(this.rules.other.newLineCharGlobal," "),u=this.rules.other.nonSpaceChar.test(c),d=this.rules.other.startingSpaceChar.test(c)&&this.rules.other.endingSpaceChar.test(c);return u&&d&&(c=c.substring(1,c.length-1)),{type:"codespan",raw:i[0],text:c}}}br(s){let i=this.rules.inline.br.exec(s);if(i)return{type:"br",raw:i[0]}}del(s,i,c=""){let u=this.rules.inline.delLDelim.exec(s);if(u&&(!u[1]||!c||this.rules.inline.punctuation.exec(c))){let d=[...u[0]].length-1,h,m,y=d,g=this.rules.inline.delRDelim;for(g.lastIndex=0,i=i.slice(-1*s.length+d);(u=g.exec(i))!==null;){if(h=u[1]||u[2]||u[3]||u[4]||u[5]||u[6],!h||(m=[...h].length,m!==d))continue;if(u[3]||u[4]){y+=m;continue}if(y-=m,y>0)continue;m=Math.min(m,m+y);let S=[...u[0]][0].length,v=s.slice(0,d+u.index+S+m),b=v.slice(d,-d);return{type:"del",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(s){let i=this.rules.inline.autolink.exec(s);if(i){let c,u;return i[2]==="@"?(c=i[1],u="mailto:"+c):(c=i[1],u=c),{type:"link",raw:i[0],text:c,href:u,autolink:!0,tokens:[{type:"text",raw:c,text:c}]}}}url(s){var c;let i;if(i=this.rules.inline.url.exec(s)){let u,d;if(i[2]==="@")u=i[0],d="mailto:"+u;else{let h;do h=i[0],i[0]=((c=this.rules.inline._backpedal.exec(i[0]))==null?void 0:c[0])??"";while(h!==i[0]);u=i[0],i[1]==="www."?d="http://"+i[0]:d=i[0]}return{type:"link",raw:i[0],text:u,href:d,autolink:!0,tokens:[{type:"text",raw:u,text:u}]}}}inlineText(s){let i=this.rules.inline.text.exec(s);if(i){let c=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:c?i[0]:pk(i[0]),escaped:c}}}},Xc,j0,Al,ja=(Al=class{constructor(i){_y(this,Xc);Et(this,"tokens");Et(this,"options");Et(this,"state");Et(this,"inlineQueue");Et(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=i||El,this.options.tokenizer=this.options.tokenizer||new Bc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let c={other:mn,block:xc.normal,inline:bo.normal};this.options.pedantic?(c.block=xc.pedantic,c.inline=bo.pedantic):this.options.gfm&&(c.block=xc.gfm,this.options.breaks?c.inline=bo.breaks:c.inline=bo.gfm),this.tokenizer.rules=c}static get rules(){return{block:xc,inline:bo}}static lex(i,c){return new Al(c).lex(i)}static lexInline(i,c){return new Al(c).inlineTokens(i)}lex(i){i=i.replace(mn.carriageReturn,`
193
+ `),this.blockTokens(i,this.tokens);for(let c=0;c<this.inlineQueue.length;c++){let u=this.inlineQueue[c];this.inlineTokens(u.src,u.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,c=[],u=!1){var h,m,y;this.tokenizer.lexer=this,this.options.pedantic&&(i=i.replace(mn.tabCharGlobal," ").replace(mn.spaceLine,""));let d=1/0;for(;i;){if(i.length<d)d=i.length;else{this.infiniteLoopError(i.charCodeAt(0));break}let g;if((m=(h=this.options.extensions)==null?void 0:h.block)!=null&&m.some(v=>(g=v.call({lexer:this},i,c))?(i=i.substring(g.raw.length),c.push(g),!0):!1))continue;if(g=this.tokenizer.space(i)){i=i.substring(g.raw.length);let v=c.at(-1);g.raw.length===1&&v!==void 0?v.raw+=`
194
+ `:c.push(g);continue}if(g=this.tokenizer.code(i)){i=i.substring(g.raw.length);let v=c.at(-1);(v==null?void 0:v.type)==="paragraph"||(v==null?void 0:v.type)==="text"?(v.raw+=(v.raw.endsWith(`
195
+ `)?"":`
196
+ `)+g.raw,v.text+=`
197
+ `+g.text,this.inlineQueue.at(-1).src=v.text):c.push(g);continue}if(g=this.tokenizer.fences(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.heading(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.hr(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.blockquote(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.list(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.html(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.def(i)){i=i.substring(g.raw.length);let v=c.at(-1);(v==null?void 0:v.type)==="paragraph"||(v==null?void 0:v.type)==="text"?(v.raw+=(v.raw.endsWith(`
198
+ `)?"":`
199
+ `)+g.raw,v.text+=`
200
+ `+g.raw,this.inlineQueue.at(-1).src=v.text):this.tokens.links[g.tag]||(this.tokens.links[g.tag]={href:g.href,title:g.title},c.push(g));continue}if(g=this.tokenizer.table(i)){i=i.substring(g.raw.length),c.push(g);continue}if(g=this.tokenizer.lheading(i)){i=i.substring(g.raw.length),c.push(g);continue}let S=i;if((y=this.options.extensions)!=null&&y.startBlock){let v=1/0,b=i.slice(1),x;this.options.extensions.startBlock.forEach(T=>{x=T.call({lexer:this},b),typeof x=="number"&&x>=0&&(v=Math.min(v,x))}),v<1/0&&v>=0&&(S=i.substring(0,v+1))}if(this.state.top&&(g=this.tokenizer.paragraph(S))){let v=c.at(-1);u&&(v==null?void 0:v.type)==="paragraph"?(v.raw+=(v.raw.endsWith(`
201
+ `)?"":`
202
+ `)+g.raw,v.text+=`
203
+ `+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=v.text):c.push(g),u=S.length!==i.length,i=i.substring(g.raw.length);continue}if(g=this.tokenizer.text(i)){i=i.substring(g.raw.length);let v=c.at(-1);(v==null?void 0:v.type)==="text"?(v.raw+=(v.raw.endsWith(`
204
+ `)?"":`
205
+ `)+g.raw,v.text+=`
206
+ `+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=v.text):c.push(g);continue}if(i){this.infiniteLoopError(i.charCodeAt(0));break}}return this.state.top=!0,c}inline(i,c=[]){return this.inlineQueue.push({src:i,tokens:c}),c}linkInText(i){if(!i.includes("["))return!1;let c=this.tokenizer.rules.inline.link;for(let u of i.matchAll(this.tokenizer.rules.inline.blockSkip))if(c.test(u[0])&&i.charAt(u.index-1)!=="!")return!0;for(let u of i.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let d=u[0],h=d.lastIndexOf("[");if(!(d.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Ic(d.slice(h+1,-1))))&&!(h>1&&this.linkInText(d.slice(1,h-1))))return!0}return!1}inlineTokens(i,c=[]){this.tokenizer.lexer=this;let u=this.state.linkParenPossible;this.state.linkParenPossible=u&&i.includes(")");try{return Ry(this,Xc,j0).call(this,i,c)}finally{this.state.linkParenPossible=u}}infiniteLoopError(i){let c="Infinite loop on byte: "+i;if(this.options.silent)console.error(c);else throw new Error(c)}},Xc=new WeakSet,j0=function(i,c){var y,g,S,v,b;let u=i;if(this.tokens.links&&i.includes("[")){let x=this.tokenizer.rules.inline.reflinkSearch,T=z=>{let Z=z.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Ic(z.slice(Z+1,-1))))return z;if(Z>1&&z.charAt(0)!=="!"){let D=z.slice(1,Z-1);if(this.linkInText(D))return"["+D.replace(x,T)+"]["+"a".repeat(z.length-Z-2)+"]"}return"["+"a".repeat(z.length-2)+"]"};u=u.replace(x,T)}u=u.replace(this.tokenizer.rules.inline.anyPunctuation,x=>"+".repeat(x.length)),u=u.replace(this.tokenizer.rules.inline.blockSkip,(x,T,z)=>{let Z=z?z.length:0;return x.slice(0,Z)+"["+"a".repeat(x.length-Z-2)+"]"}),u=((g=(y=this.options.hooks)==null?void 0:y.emStrongMask)==null?void 0:g.call({lexer:this},u))??u;let d=!1,h="",m=1/0;for(;i;){if(i.length<m)m=i.length;else{this.infiniteLoopError(i.charCodeAt(0));break}d||(h=""),d=!1;let x;if((v=(S=this.options.extensions)==null?void 0:S.inline)!=null&&v.some(z=>(x=z.call({lexer:this},i,c))?(i=i.substring(x.raw.length),c.push(x),!0):!1))continue;if(x=this.tokenizer.escape(i)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.tag(i)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.link(i)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(x.raw.length);let z=c.at(-1);x.type==="text"&&(z==null?void 0:z.type)==="text"?(z.raw+=x.raw,z.text+=x.text):c.push(x);continue}if(x=this.tokenizer.emStrong(i,u,h)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.codespan(i)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.br(i)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.del(i,u,h)){i=i.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.autolink(i)){i=i.substring(x.raw.length),c.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(i))){i=i.substring(x.raw.length),c.push(x);continue}let T=i;if((b=this.options.extensions)!=null&&b.startInline){let z=1/0,Z=i.slice(1),D;this.options.extensions.startInline.forEach(F=>{D=F.call({lexer:this},Z),typeof D=="number"&&D>=0&&(z=Math.min(z,D))}),z<1/0&&z>=0&&(T=i.substring(0,z+1))}if(x=this.tokenizer.inlineText(T)){i=i.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(h=x.raw.slice(-1)),d=!0;let z=c.at(-1);(z==null?void 0:z.type)==="text"?(z.raw+=x.raw,z.text+=x.text):c.push(x);continue}if(i){this.infiniteLoopError(i.charCodeAt(0));break}}return c},Al),Hc=class{constructor(s){Et(this,"options");Et(this,"parser");this.options=s||El}space(s){return""}code({text:s,lang:i,escaped:c}){var h;let u=(h=(i||"").match(mn.notSpaceStart))==null?void 0:h[0],d=s?s.replace(mn.endingNewline,"")+`
207
+ `:"";return u?'<pre><code class="language-'+Jn(u)+'">'+(c?d:Jn(d,!0))+`</code></pre>
208
+ `:"<pre><code>"+(c?d:Jn(d,!0))+`</code></pre>
209
+ `}blockquote({tokens:s}){return`<blockquote>
210
+ ${this.parser.parse(s)}</blockquote>
211
+ `}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:i}){return`<h${i}>${this.parser.parseInline(s)}</h${i}>
212
+ `}hr(s){return`<hr>
213
+ `}list(s){let i=s.ordered,c=s.start,u="";for(let m=0;m<s.items.length;m++){let y=s.items[m];u+=this.listitem(y)}let d=i?"ol":"ul",h=i&&c!==1?' start="'+c+'"':"";return"<"+d+h+`>
214
+ `+u+"</"+d+`>
215
+ `}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
216
+ `}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
217
+ `}table(s){let i="",c="";for(let d=0;d<s.header.length;d++)c+=this.tablecell(s.header[d]);i+=this.tablerow({text:c});let u="";for(let d=0;d<s.rows.length;d++){let h=s.rows[d];c="";for(let m=0;m<h.length;m++)c+=this.tablecell(h[m]);u+=this.tablerow({text:c})}return u&&(u=`<tbody>${u}</tbody>`),`<table>
218
+ <thead>
219
+ `+i+`</thead>
220
+ `+u+`</table>
221
+ `}tablerow({text:s}){return`<tr>
222
+ ${s}</tr>
223
+ `}tablecell(s){let i=this.parser.parseInline(s.tokens),c=s.header?"th":"td";return(s.align?`<${c} align="${s.align}">`:`<${c}>`)+i+`</${c}>
224
+ `}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${Jn(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:i,text:c,tokens:u,autolink:d}){let h=d?Jn(c,!0):this.parser.parseInline(u),m=av(s);if(m===null)return h;s=Jn(m,d);let y='<a href="'+s+'"';return i&&(y+=' title="'+Jn(i)+'"'),y+=">"+h+"</a>",y}image({href:s,title:i,text:c,tokens:u}){u&&(c=this.parser.parseInline(u,this.parser.textRenderer));let d=av(s);if(d===null)return Jn(c);s=d;let h=`<img src="${Jn(s)}" alt="${Jn(c)}"`;return i&&(h+=` title="${Jn(i)}"`),h+=">",h}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:Jn(s.text)}},Eh=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},Na=class Vf{constructor(i){Et(this,"options");Et(this,"renderer");Et(this,"textRenderer");this.options=i||El,this.options.renderer=this.options.renderer||new Hc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Eh}static parse(i,c){return new Vf(c).parse(i)}static parseInline(i,c){return new Vf(c).parseInline(i)}parse(i){var u,d;this.renderer.parser=this;let c="";for(let h=0;h<i.length;h++){let m=i[h];if((d=(u=this.options.extensions)==null?void 0:u.renderers)!=null&&d[m.type]){let g=m,S=this.options.extensions.renderers[g.type].call({parser:this},g);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(g.type)){c+=S||"";continue}}let y=m;switch(y.type){case"space":{c+=this.renderer.space(y);break}case"hr":{c+=this.renderer.hr(y);break}case"heading":{c+=this.renderer.heading(y);break}case"code":{c+=this.renderer.code(y);break}case"table":{c+=this.renderer.table(y);break}case"blockquote":{c+=this.renderer.blockquote(y);break}case"list":{c+=this.renderer.list(y);break}case"checkbox":{c+=this.renderer.checkbox(y);break}case"html":{c+=this.renderer.html(y);break}case"def":{c+=this.renderer.def(y);break}case"paragraph":{c+=this.renderer.paragraph(y);break}case"text":{c+=this.renderer.text(y);break}default:{let g='Token with "'+y.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return c}parseInline(i,c=this.renderer){var d,h;this.renderer.parser=this;let u="";for(let m=0;m<i.length;m++){let y=i[m];if((h=(d=this.options.extensions)==null?void 0:d.renderers)!=null&&h[y.type]){let S=this.options.extensions.renderers[y.type].call({parser:this},y);if(S!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(y.type)){u+=S||"";continue}}let g=y;switch(g.type){case"escape":{u+=c.text(g);break}case"html":{u+=c.html(g);break}case"link":{u+=c.link(g);break}case"image":{u+=c.image(g);break}case"checkbox":{u+=c.checkbox(g);break}case"strong":{u+=c.strong(g);break}case"em":{u+=c.em(g);break}case"codespan":{u+=c.codespan(g);break}case"br":{u+=c.br(g);break}case"del":{u+=c.del(g);break}case"text":{u+=c.text(g);break}default:{let S='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(S),"";throw new Error(S)}}}return u}},Nc,Eo=(Nc=class{constructor(s){Et(this,"options");Et(this,"block");this.options=s||El}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(s=this.block){return s?ja.lex:ja.lexInline}provideParser(s=this.block){return s?Na.parse:Na.parseInline}},Et(Nc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Et(Nc,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Nc),yk=class{constructor(...s){Et(this,"defaults",Sh());Et(this,"options",this.setOptions);Et(this,"parse",this.parseMarkdown(!0));Et(this,"parseInline",this.parseMarkdown(!1));Et(this,"Parser",Na);Et(this,"Renderer",Hc);Et(this,"TextRenderer",Eh);Et(this,"Lexer",ja);Et(this,"Tokenizer",Bc);Et(this,"Hooks",Eo);this.use(...s)}walkTokens(s,i){var u,d;let c=[];for(let h of s)switch(c=c.concat(i.call(this,h)),h.type){case"table":{let m=h;for(let y of m.header)c=c.concat(this.walkTokens(y.tokens,i));for(let y of m.rows)for(let g of y)c=c.concat(this.walkTokens(g.tokens,i));break}case"list":{let m=h;c=c.concat(this.walkTokens(m.items,i));break}default:{let m=h;(d=(u=this.defaults.extensions)==null?void 0:u.childTokens)!=null&&d[m.type]?this.defaults.extensions.childTokens[m.type].forEach(y=>{let g=m[y].flat(1/0);c=c.concat(this.walkTokens(g,i))}):m.tokens&&(c=c.concat(this.walkTokens(m.tokens,i)))}}return c}use(...s){let i=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(c=>{let u={...c};if(u.async=this.defaults.async||u.async||!1,c.extensions&&(c.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){let h=i.renderers[d.name];h?i.renderers[d.name]=function(...m){let y=d.renderer.apply(this,m);return y===!1&&(y=h.apply(this,m)),y}:i.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let h=i[d.level];h?h.unshift(d.tokenizer):i[d.level]=[d.tokenizer],d.start&&(d.level==="block"?i.startBlock?i.startBlock.push(d.start):i.startBlock=[d.start]:d.level==="inline"&&(i.startInline?i.startInline.push(d.start):i.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(i.childTokens[d.name]=d.childTokens)}),u.extensions=i),c.renderer){let d=this.defaults.renderer||new Hc(this.defaults);for(let h in c.renderer){if(!(h in d))throw new Error(`renderer '${h}' does not exist`);if(["options","parser"].includes(h))continue;let m=h,y=c.renderer[m],g=d[m];d[m]=(...S)=>{let v=y.apply(d,S);return v===!1&&(v=g.apply(d,S)),v||""}}u.renderer=d}if(c.tokenizer){let d=this.defaults.tokenizer||new Bc(this.defaults);for(let h in c.tokenizer){if(!(h in d))throw new Error(`tokenizer '${h}' does not exist`);if(["options","rules","lexer"].includes(h))continue;let m=h,y=c.tokenizer[m],g=d[m];d[m]=(...S)=>{let v=y.apply(d,S);return v===!1&&(v=g.apply(d,S)),v}}u.tokenizer=d}if(c.hooks){let d=this.defaults.hooks||new Eo;for(let h in c.hooks){if(!(h in d))throw new Error(`hook '${h}' does not exist`);if(["options","block"].includes(h))continue;let m=h,y=c.hooks[m],g=d[m];Eo.passThroughHooks.has(h)?d[m]=S=>{if(this.defaults.async&&Eo.passThroughHooksRespectAsync.has(h))return(async()=>{let b=await y.call(d,S);return g.call(d,b)})();let v=y.call(d,S);return g.call(d,v)}:d[m]=(...S)=>{if(this.defaults.async)return(async()=>{let b=await y.apply(d,S);return b===!1&&(b=await g.apply(d,S)),b})();let v=y.apply(d,S);return v===!1&&(v=g.apply(d,S)),v}}u.hooks=d}if(c.walkTokens){let d=this.defaults.walkTokens,h=c.walkTokens;u.walkTokens=function(m){let y=[];return y.push(h.call(this,m)),d&&(y=y.concat(d.call(this,m))),y}}this.defaults={...this.defaults,...u}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,i){return ja.lex(s,i??this.defaults)}parser(s,i){return Na.parse(s,i??this.defaults)}parseMarkdown(s){return(i,c)=>{let u={...c},d={...this.defaults,...u},h=this.onError(!!d.silent,!!d.async);if(this.defaults.async===!0&&u.async===!1)return h(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof i>"u"||i===null)return h(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return h(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(d.hooks&&(d.hooks.options=d,d.hooks.block=s),d.async)return(async()=>{let m=d.hooks?await d.hooks.preprocess(i):i,y=await(d.hooks?await d.hooks.provideLexer(s):s?ja.lex:ja.lexInline)(m,d),g=d.hooks?await d.hooks.processAllTokens(y):y;d.walkTokens&&await Promise.all(this.walkTokens(g,d.walkTokens));let S=await(d.hooks?await d.hooks.provideParser(s):s?Na.parse:Na.parseInline)(g,d);return d.hooks?await d.hooks.postprocess(S):S})().catch(h);try{d.hooks&&(i=d.hooks.preprocess(i));let m=(d.hooks?d.hooks.provideLexer(s):s?ja.lex:ja.lexInline)(i,d);d.hooks&&(m=d.hooks.processAllTokens(m)),d.walkTokens&&this.walkTokens(m,d.walkTokens);let y=(d.hooks?d.hooks.provideParser(s):s?Na.parse:Na.parseInline)(m,d);return d.hooks&&(y=d.hooks.postprocess(y)),y}catch(m){return h(m)}}}onError(s,i){return c=>{if(c.message+=`
225
+ Please report this to https://github.com/markedjs/marked.`,s){let u="<p>An error occurred:</p><pre>"+Jn(c.message+"",!0)+"</pre>";return i?Promise.resolve(u):u}if(i)return Promise.reject(c);throw c}}},Tl=new yk;function Tt(s,i){return Tl.parse(s,i)}Tt.options=Tt.setOptions=function(s){return Tl.setOptions(s),Tt.defaults=Tl.defaults,y0(Tt.defaults),Tt};Tt.getDefaults=Sh;Tt.defaults=El;function vk(...s){return Tl.use(...s),Tt.defaults=Tl.defaults,y0(Tt.defaults),Tt}Tt.use=vk;Tt.walkTokens=function(s,i){return Tl.walkTokens(s,i)};Tt.parseInline=Tl.parseInline;Tt.Parser=Na;Tt.parser=Na.parse;Tt.Renderer=Hc;Tt.TextRenderer=Eh;Tt.Lexer=ja;Tt.lexer=ja.lex;Tt.Tokenizer=Bc;Tt.Hooks=Eo;Tt.parse=Tt;Tt.options;Tt.setOptions;Tt.walkTokens;Tt.parseInline;Na.parse;ja.lex;/*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */function uv(s,i){(i==null||i>s.length)&&(i=s.length);for(var c=0,u=Array(i);c<i;c++)u[c]=s[c];return u}function bk(s){if(Array.isArray(s))return s}function xk(s,i){var c=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(c!=null){var u,d,h,m,y=[],g=!0,S=!1;try{if(h=(c=c.call(s)).next,i!==0)for(;!(g=(u=h.call(c)).done)&&(y.push(u.value),y.length!==i);g=!0);}catch(v){S=!0,d=v}finally{try{if(!g&&c.return!=null&&(m=c.return(),Object(m)!==m))return}finally{if(S)throw d}}return y}}function Sk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
226
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function wk(s,i){return bk(s)||xk(s,i)||Ak(s,i)||Sk()}function Ak(s,i){if(s){if(typeof s=="string")return uv(s,i);var c={}.toString.call(s).slice(8,-1);return c==="Object"&&s.constructor&&(c=s.constructor.name),c==="Map"||c==="Set"?Array.from(s):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?uv(s,i):void 0}}const N0=Object.entries,dv=Object.setPrototypeOf,kk=Object.isFrozen,Tk=Object.getPrototypeOf,jk=Object.getOwnPropertyDescriptor;let en=Object.freeze,ln=Object.seal,bi=Object.create,E0=typeof Reflect<"u"&&Reflect,Qf=E0.apply,Kf=E0.construct;en||(en=function(i){return i});ln||(ln=function(i){return i});Qf||(Qf=function(i,c){for(var u=arguments.length,d=new Array(u>2?u-2:0),h=2;h<u;h++)d[h-2]=arguments[h];return i.apply(c,d)});Kf||(Kf=function(i){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return new i(...u)});const Sl=Jt(Array.prototype.forEach),Nk=Jt(Array.prototype.lastIndexOf),fv=Jt(Array.prototype.pop),xo=Jt(Array.prototype.push),Ek=Jt(Array.prototype.splice),Si=Array.isArray,Co=Jt(String.prototype.toLowerCase),Cf=Jt(String.prototype.toString),hv=Jt(String.prototype.match),So=Jt(String.prototype.replace),mv=Jt(String.prototype.indexOf),Ck=Jt(String.prototype.trim),Mk=Jt(Number.prototype.toString),_k=Jt(Boolean.prototype.toString),pv=typeof BigInt>"u"?null:Jt(BigInt.prototype.toString),gv=typeof Symbol>"u"?null:Jt(Symbol.prototype.toString),Un=Jt(Object.prototype.hasOwnProperty),wo=Jt(Object.prototype.toString),xn=Jt(RegExp.prototype.test),Xs=Rk(TypeError);function Jt(s){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return Qf(s,i,u)}}function Rk(s){return function(){for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];return Kf(s,c)}}function mt(s,i){let c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Co;if(dv&&dv(s,null),!Si(i))return s;let u=i.length;for(;u--;){let d=i[u];if(typeof d=="string"){const h=c(d);h!==d&&(kk(i)||(i[u]=h),d=h)}s[d]=!0}return s}function Ok(s){for(let i=0;i<s.length;i++)Un(s,i)||(s[i]=null);return s}function Wn(s){const i=bi(null);for(const u of N0(s)){var c=wk(u,2);const d=c[0],h=c[1];Un(s,d)&&(Si(h)?i[d]=Ok(h):h&&typeof h=="object"&&h.constructor===Object?i[d]=Wn(h):i[d]=h)}return i}function Dk(s){switch(typeof s){case"string":return s;case"number":return Mk(s);case"boolean":return _k(s);case"bigint":return pv?pv(s):"0";case"symbol":return gv?gv(s):"Symbol()";case"undefined":return wo(s);case"function":case"object":{if(s===null)return wo(s);const i=s,c=ha(i,"toString");if(typeof c=="function"){const u=c(i);return typeof u=="string"?u:wo(u)}return wo(s)}default:return wo(s)}}function ha(s,i){for(;s!==null;){const u=jk(s,i);if(u){if(u.get)return Jt(u.get);if(typeof u.value=="function")return Jt(u.value)}s=Tk(s)}function c(){return null}return c}function Lk(s){try{return xn(s,""),!0}catch{return!1}}const yv=en(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Mf=en(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),_f=en(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zk=en(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Rf=en(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Uk=en(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vv=en(["#text"]),bv=en(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Of=en(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xv=en(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sc=en(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ik=ln(/{{[\w\W]*|^[\w\W]*}}/g),Bk=ln(/<%[\w\W]*|^[\w\W]*%>/g),Hk=ln(/\${[\w\W]*/g),$k=ln(/^data-[\-\w.\u00B7-\uFFFF]+$/),qk=ln(/^aria-[\-\w]+$/),Sv=ln(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gk=ln(/^(?:\w+script|data):/i),Xk=ln(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yk=ln(/^html$/i),Vk=ln(/^[a-z][.\w]*(-[.\w]+)+$/i),wv=ln(/<[/\w!]/g),Av=ln(/<[/\w]/g),Qk=ln(/<\/no(script|embed|frames)/i),Kk=ln(/\/>/i),Fn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},C0=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Zk=en(mt({},C0)),Pk=(function(){const s={};return Sl(C0,i=>{s[i]=ln(new RegExp("</"+i+"(?=[\\t\\n\\f\\r />])","i"))}),en(s)})(),Fk=function(){return typeof window>"u"?null:window},Jk=function(i,c){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let u=null;const d="data-tt-policy-suffix";c&&c.hasAttribute(d)&&(u=c.getAttribute(d));const h="dompurify"+(u?"#"+u:"");try{return i.createPolicy(h,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+h+" could not be created."),null}},kv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ys=function(i,c,u,d){return Un(i,c)&&Si(i[c])?mt(d.base?Wn(d.base):{},i[c],d.transform):u},Df=function(i,c,u){const d=Un(i,c)?i[c]:void 0;return d&&typeof d=="object"?Wn(d):u()};function M0(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fk();const i=ce=>M0(ce);if(i.version="3.4.16",i.removed=[],!s||!s.document||s.document.nodeType!==Fn.document||!s.Element)return i.isSupported=!1,i;let c=s.document;const u=c,d=u.currentScript;s.DocumentFragment;const h=s.HTMLTemplateElement,m=s.Node,y=s.Element,g=s.NodeFilter;s.NamedNodeMap===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const S=s.DOMParser,v=s.trustedTypes,b=y.prototype,x=ha(b,"cloneNode"),T=ha(b,"remove"),z=ha(b,"removeAttributeNode"),Z=ha(b,"nextSibling"),D=ha(b,"childNodes"),F=ha(b,"parentNode"),ue=ha(b,"shadowRoot"),he=ha(b,"attributes"),C=m&&m.prototype?ha(m.prototype,"nodeType"):null,Y=m&&m.prototype?ha(m.prototype,"nodeName"):null,I=m&&m.prototype?ha(m.prototype,"ownerDocument"):null,X=function(A){return C?C(A):A.nodeType},J=function(A){return Y?Y(A):A.nodeName};if(typeof h=="function"){const ce=c.createElement("template");ce.content&&ce.content.ownerDocument&&(c=ce.content.ownerDocument)}let se,$="",Q,K=!1,ye=0;const ve=function(){if(ye>0)throw Xs('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ce=function(A){ve(),ye++;try{return se.createHTML(A)}finally{ye--}},W=function(A){ve(),ye++;try{return se.createScriptURL(A)}finally{ye--}},ee=function(){return K||(Q=Jk(v,d),K=!0),Q},re=c,P=re.implementation,Ae=re.createNodeIterator,qe=re.createDocumentFragment,ct=re.getElementsByTagName,gt=u.importNode;let j=kv();i.isSupported=typeof N0=="function"&&typeof F=="function"&&P&&P.createHTMLDocument!==void 0;const ae=Ik,Ne=Bk,xe=Hk,oe=$k,Oe=qk,Le=Gk,me=Xk,De=Vk;let tt=Sv,L=null;const je=mt({},[...yv,...Mf,..._f,...Rf,...vv]);let be=null;const Be=mt({},[...bv,...Of,...xv,...Sc]);let Me=Object.seal(bi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,ke=null;const Te=Object.seal(bi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let He=!0,q=!0,ze=!1,$e=!0,yt=!1,Ye=!0,pt=!1,Ve=!1,Vt=null,Bn=null,Ea=!1,Cn=!1,Mn=!1,gn=!1,ma=!0,Hn=!1;const tn="user-content-";let vt=!0,ta=!1,Sn={},wn=null;const An=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let pa=null;const na=mt({},["audio","video","img","source","image","track"]);let Ca=null;const ga=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yn="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",M="http://www.w3.org/1999/xhtml";let le=M,pe=!1,Re=null;const Ke=mt({},[yn,Lt,M],Cf),We=en(["mi","mo","mn","ms","mtext"]);let ht=mt({},We);const N=en(["annotation-xml"]);let V=mt({},N);const ge=mt({},["title","style","font","a","script"]);let Se=null;const Je=["application/xhtml+xml","text/html"],ut="text/html";let at=null,jt=null;const st=c.createElement("form"),Bt=function(A){return A instanceof RegExp||A instanceof Function},$n=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jt&&jt===A)return;(!A||typeof A!="object")&&(A={}),A=Wn(A),Se=Je.indexOf(A.PARSER_MEDIA_TYPE)===-1?ut:A.PARSER_MEDIA_TYPE,at=Se==="application/xhtml+xml"?Cf:Co,L=Ys(A,"ALLOWED_TAGS",je,{transform:at}),be=Ys(A,"ALLOWED_ATTR",Be,{transform:at}),Re=Ys(A,"ALLOWED_NAMESPACES",Ke,{transform:Cf}),Ca=Ys(A,"ADD_URI_SAFE_ATTR",ga,{transform:at,base:ga}),pa=Ys(A,"ADD_DATA_URI_TAGS",na,{transform:at,base:na}),wn=Ys(A,"FORBID_CONTENTS",An,{transform:at}),ie=Ys(A,"FORBID_TAGS",Wn({}),{transform:at}),ke=Ys(A,"FORBID_ATTR",Wn({}),{transform:at}),Sn=Un(A,"USE_PROFILES")?A.USE_PROFILES&&typeof A.USE_PROFILES=="object"?Wn(A.USE_PROFILES):A.USE_PROFILES:!1,He=A.ALLOW_ARIA_ATTR!==!1,q=A.ALLOW_DATA_ATTR!==!1,ze=A.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=A.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=A.SAFE_FOR_TEMPLATES||!1,Ye=A.SAFE_FOR_XML!==!1,pt=A.WHOLE_DOCUMENT||!1,Cn=A.RETURN_DOM||!1,Mn=A.RETURN_DOM_FRAGMENT||!1,gn=A.RETURN_TRUSTED_TYPE||!1,Ea=A.FORCE_BODY||!1,ma=A.SANITIZE_DOM!==!1,Hn=A.SANITIZE_NAMED_PROPS||!1,vt=A.KEEP_CONTENT!==!1,ta=A.IN_PLACE||!1,tt=Lk(A.ALLOWED_URI_REGEXP)?A.ALLOWED_URI_REGEXP:Sv,le=typeof A.NAMESPACE=="string"?A.NAMESPACE:M,ht=Df(A,"MATHML_TEXT_INTEGRATION_POINTS",()=>mt({},We)),V=Df(A,"HTML_INTEGRATION_POINTS",()=>mt({},N));const U=Df(A,"CUSTOM_ELEMENT_HANDLING",()=>bi(null));if(Me=bi(null),Un(U,"tagNameCheck")&&Bt(U.tagNameCheck)&&(Me.tagNameCheck=U.tagNameCheck),Un(U,"attributeNameCheck")&&Bt(U.attributeNameCheck)&&(Me.attributeNameCheck=U.attributeNameCheck),Un(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(Me.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),ln(Me),yt&&(q=!1),Mn&&(Cn=!0),Sn&&(L=mt({},vv),be=bi(null),Sn.html===!0&&(mt(L,yv),mt(be,bv)),Sn.svg===!0&&(mt(L,Mf),mt(be,Of),mt(be,Sc)),Sn.svgFilters===!0&&(mt(L,_f),mt(be,Of),mt(be,Sc)),Sn.mathMl===!0&&(mt(L,Rf),mt(be,xv),mt(be,Sc))),Te.tagCheck=null,Te.attributeCheck=null,Un(A,"ADD_TAGS")&&(typeof A.ADD_TAGS=="function"?Te.tagCheck=A.ADD_TAGS:Si(A.ADD_TAGS)&&(L===je&&(L=Wn(L)),mt(L,A.ADD_TAGS,at))),Un(A,"ADD_ATTR")&&(typeof A.ADD_ATTR=="function"?Te.attributeCheck=A.ADD_ATTR:Si(A.ADD_ATTR)&&(be===Be&&(be=Wn(be)),mt(be,A.ADD_ATTR,at))),Un(A,"ADD_FORBID_CONTENTS")&&Si(A.ADD_FORBID_CONTENTS)&&(wn===An&&(wn=Wn(wn)),mt(wn,A.ADD_FORBID_CONTENTS,at)),vt&&(L["#text"]=!0),pt&&mt(L,["html","head","body"]),L.table&&(mt(L,["tbody"]),delete ie.tbody),A.TRUSTED_TYPES_POLICY){if(typeof A.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof A.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const de=se;se=A.TRUSTED_TYPES_POLICY;try{$=Ce("")}catch(fe){throw se=de,fe}}else A.TRUSTED_TYPES_POLICY===null?(se=void 0,$=""):(se===void 0&&(se=ee()),se&&typeof $=="string"&&($=Ce("")));en&&en(A),jt=A},Qa=mt({},[...Mf,..._f,...zk]),Ma=mt({},[...Rf,...Uk]),Ps=function(A,U,de){return U.namespaceURI===M?A==="svg":U.namespaceURI===yn?A==="svg"&&(de==="annotation-xml"||ht[de]):!!Qa[A]},_a=function(A,U,de){return U.namespaceURI===M?A==="math":U.namespaceURI===Lt?A==="math"&&V[de]:!!Ma[A]},ps=function(A,U,de){return U.namespaceURI===Lt&&!V[de]||U.namespaceURI===yn&&!ht[de]?!1:!Ma[A]&&(ge[A]||!Qa[A])},Cl=function(A){let U=F(A);(!U||!U.tagName)&&(U={namespaceURI:le,tagName:"template"});const de=Co(A.tagName),fe=Co(U.tagName);return Re[A.namespaceURI]?A.namespaceURI===Lt?Ps(de,U,fe):A.namespaceURI===yn?_a(de,U,fe):A.namespaceURI===M?ps(de,U,fe):!!(Se==="application/xhtml+xml"&&Re[A.namespaceURI]):!1},Gt=function(A){xo(i.removed,{element:A});try{F(A).removeChild(A)}catch{if(T(A),!F(A))throw Xs("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},zt=function(A,U,de){try{z(A,U)}catch{try{A.removeAttribute(de)}catch{}}},Ut=function(A){Ml(A);const U=D(A);if(U){const fe=[];Sl(U,Ie=>{xo(fe,Ie)}),Sl(fe,Ie=>{try{T(Ie)}catch{}})}const de=he(A);if(de)for(let fe=de.length-1;fe>=0;--fe){const Ie=de[fe],Ge=Ie&&Ie.name;typeof Ge=="string"&&zt(A,Ie,Ge)}},_n=function(A,U,de){if(!de)try{de=U.getAttributeNode(A)}catch{de=null}xo(i.removed,{attribute:de||null,from:U});try{de?z(U,de):U.removeAttribute(A)}catch{try{U.removeAttribute(A)}catch{}}if(A==="is")if(Cn||Mn)try{Gt(U)}catch{}else try{U.setAttribute(A,"")}catch{}},Yo=function(A){const U=he(A);if(U)for(let de=U.length-1;de>=0;--de){const fe=U[de],Ie=fe&&fe.name;typeof Ie!="string"||be[at(Ie)]||zt(A,fe,Ie)}},Ml=function(A){const U=[A];for(;U.length>0;){const de=U.pop();X(de)===Fn.element&&Yo(de);const fe=D(de);if(fe)for(let Ie=fe.length-1;Ie>=0;--Ie)U.push(fe[Ie])}},Vo=function(A,U){return Ye?A==="patchsrc"?!0:A==="for"&&U!=="label"&&U!=="output":!1},Qo=function(A){if(!Ye)return;const U=[A];for(;U.length>0;){const de=U.pop(),fe=X(de);if(fe===Fn.processingInstruction||fe===Fn.comment&&xn(Av,de.data)){try{T(de)}catch{}continue}if(fe===Fn.element){const Ge=de,nt=at(J(de));try{Ge.hasAttribute&&Ge.hasAttribute("patchsrc")&&Ge.removeAttribute("patchsrc"),Ge.hasAttribute&&Ge.hasAttribute("for")&&Vo("for",nt)&&Ge.removeAttribute("for")}catch{}}const Ie=D(de);if(Ie)for(let Ge=Ie.length-1;Ge>=0;--Ge)U.push(Ie[Ge])}},gs=function(A){let U=null,de=null;if(Ea)A="<remove></remove>"+A;else{const Ge=hv(A,/^[\r\n\t ]+/);de=Ge&&Ge[0]}Se==="application/xhtml+xml"&&le===M&&(A='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+A+"</body></html>");const fe=se?Ce(A):A;if(le===M)try{U=new S().parseFromString(fe,Se)}catch{}if(!U||!U.documentElement){U=P.createDocument(le,"template",null);try{U.documentElement.innerHTML=pe?$:fe}catch{}}const Ie=U.body||U.documentElement;return A&&de&&Ie.insertBefore(c.createTextNode(de),Ie.childNodes[0]||null),le===M?ct.call(U,pt?"html":"body")[0]:pt?U.documentElement:Ie},Fs=function(A){const U=I?I(A):A.ownerDocument;return Ae.call(U||A,A,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Ka=function(A){return A=So(A,ae," "),A=So(A,Ne," "),A=So(A,xe," "),A},ya=function(A){var U;A.normalize();const de=I?I(A):A.ownerDocument,fe=Ae.call(de||A,A,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let Ie=fe.nextNode();for(;Ie;)Ie.data=Ka(Ie.data),Ie=fe.nextNode();const Ge=(U=A.querySelectorAll)===null||U===void 0?void 0:U.call(A,"template");Ge&&Sl(Ge,nt=>{aa(nt.content)&&ya(nt.content)})},va=function(A){const U=Y?Y(A):null;return typeof U!="string"||at(U)!=="form"?!1:typeof A.nodeName!="string"||typeof A.textContent!="string"||typeof A.removeChild!="function"||A.attributes!==he(A)||typeof A.removeAttribute!="function"||typeof A.removeAttributeNode!="function"||typeof A.getAttributeNode!="function"||typeof A.setAttribute!="function"||typeof A.namespaceURI!="string"||typeof A.insertBefore!="function"||typeof A.hasChildNodes!="function"||A.nodeType!==C(A)||A.childNodes!==D(A)},aa=function(A){if(!C||typeof A!="object"||A===null)return!1;try{return C(A)===Fn.documentFragment}catch{return!1}},sa=function(A){if(!C||typeof A!="object"||A===null)return!1;try{return typeof C(A)=="number"}catch{return!1}};function St(ce,A,U){ce.length!==0&&Sl(ce,de=>{de.call(i,A,U,jt)})}const Ko=function(A,U){return!!(Ye&&A.hasChildNodes()&&!sa(A.firstElementChild)&&xn(wv,A.textContent)&&xn(wv,A.innerHTML)||Ye&&A.namespaceURI===M&&Zk[U]&&(sa(A.firstElementChild)||typeof A.textContent=="string"&&xn(Pk[U],A.textContent))||A.nodeType===Fn.processingInstruction||Ye&&A.nodeType===Fn.comment&&xn(Av,A.data))},Js=function(A,U){if(A instanceof RegExp)return xn(A,U);if(A instanceof Function){for(var de=arguments.length,fe=new Array(de>2?de-2:0),Ie=2;Ie<de;Ie++)fe[Ie-2]=arguments[Ie];return!!A(U,...fe)}return!1},Zo=function(A,U,de){if(!ie[U]&&Jo(U)&&Js(Me.tagNameCheck,U))return!1;if(vt&&!wn[U]){const fe=F(A),Ie=D(A);if(Ie&&fe){const Ge=Ie.length;for(let nt=Ge-1;nt>=0;--nt){const Rt=A===de?x(Ie[nt],!0):Ie[nt];fe.insertBefore(Rt,Z(A))}}}return Gt(A),!0},Ra=function(A,U,de,fe){return A.length===0?U:U===de||U===fe?Wn(U):U},qn=function(A,U){return A===U||F(A)!==null?!1:(ta&&Ml(A),!0)},Po=function(A,U){if(St(j.beforeSanitizeElements,A,null),qn(A,U))return!0;if(va(A))return Gt(A),!0;const de=at(J(A));if(L=Ra(j.uponSanitizeElement,L,je,Vt),St(j.uponSanitizeElement,A,{tagName:de,allowedTags:L}),qn(A,U))return!0;if(Ko(A,de))return Gt(A),!0;if(ie[de]||!(Te.tagCheck instanceof Function&&Te.tagCheck(de))&&!L[de]){const fe=Zo(A,de,U);return fe===!1&&(St(j.afterSanitizeElements,A,null),qn(A,U))?!0:fe}if(X(A)===Fn.element&&!Cl(A)||(de==="noscript"||de==="noembed"||de==="noframes")&&xn(Qk,A.innerHTML))return Gt(A),!0;if(yt&&A.nodeType===Fn.text){const fe=Ka(A.textContent);A.textContent!==fe&&(xo(i.removed,{element:A.cloneNode()}),A.textContent=fe)}return St(j.afterSanitizeElements,A,null),qn(A,U)},Ni=function(A,U,de){if(ke[U]||Vo(U,A)||ma&&(U==="id"||U==="name")&&(de in c||de in st))return!1;const fe=be[U]||Te.attributeCheck instanceof Function&&Te.attributeCheck(U,A);return q&&xn(oe,U)||He&&xn(Oe,U)?!0:fe?Ca[U]||xn(tt,So(de,me,""))||(U==="src"||U==="xlink:href"||U==="href")&&A!=="script"&&mv(de,"data:")===0&&pa[A]||ze&&!xn(Le,So(de,me,""))?!0:!de:Jo(A)&&Js(Me.tagNameCheck,A)&&Js(Me.attributeNameCheck,U,A)||U==="is"&&Me.allowCustomizedBuiltInElements&&Js(Me.tagNameCheck,de)},Fo=mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Jo=function(A){return!Fo[Co(A)]&&xn(De,A)},dt=function(A,U,de,fe){if(se&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!de)switch(v.getAttributeType(A,U)){case"TrustedHTML":return Ce(fe);case"TrustedScriptURL":return W(fe)}return fe},Wo=function(A,U,de,fe){try{return de?A.setAttributeNS(de,U,fe):A.setAttribute(U,fe),va(A)?(Gt(A),!1):!0}catch{return _n(U,A),!1}},Ws=function(A,U){if(St(j.beforeSanitizeAttributes,A,null),qn(A,U))return;const de=A.attributes;if(!de||va(A))return;be=Ra(j.uponSanitizeAttribute,be,Be,Bn);const fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:be,forceKeepAttr:void 0};let Ie=de.length;const Ge=at(A.nodeName);for(;Ie--;){const nt=de[Ie],Rt=nt.name,vn=nt.namespaceURI,Qt=nt.value,Pa=at(Rt),_l=Qt;let Ht=Rt==="value"?_l:Ck(_l),er=!1;if(fe.attrName=Pa,fe.attrValue=Ht,fe.keepAttr=!0,fe.forceKeepAttr=void 0,St(j.uponSanitizeAttribute,A,fe),Ht=fe.attrValue,Hn&&(Pa==="id"||Pa==="name")&&mv(Ht,tn)!==0&&(_n(Rt,A,nt),Ht=tn+Ht,er=!0),Ye&&xn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ht)){_n(Rt,A,nt);continue}if(Pa==="attributename"&&hv(Ht,"href")){_n(Rt,A,nt);continue}if(!fe.forceKeepAttr){if(!fe.keepAttr){_n(Rt,A,nt);continue}if(!$e&&xn(Kk,Ht)){_n(Rt,A,nt);continue}if(yt&&(Ht=Ka(Ht)),!Ni(Ge,Pa,Ht)){_n(Rt,A,nt);continue}Ht=dt(Ge,Pa,vn,Ht),Ht!==_l&&Wo(A,Rt,vn,Ht)&&er&&fv(i.removed)}}St(j.afterSanitizeAttributes,A,null),qn(A,U)},Za=function(A){let U=null;const de=Fs(A);for(St(j.beforeSanitizeShadowDOM,A,null);U=de.nextNode();)if(St(j.uponSanitizeShadowNode,U,null),Po(U,A),Ws(U,A),aa(U.content)&&Za(U.content),X(U)===Fn.element){const fe=ue(U);aa(fe)&&(Gn(fe),Za(fe))}St(j.afterSanitizeShadowDOM,A,null)},Gn=function(A){const U=[{node:A,shadow:null}];for(;U.length>0;){const de=U.pop();if(de.shadow){Za(de.shadow);continue}const fe=de.node,Ie=X(fe)===Fn.element,Ge=D(fe);if(Ge)for(let nt=Ge.length-1;nt>=0;--nt)U.push({node:Ge[nt],shadow:null});if(Ie){const nt=Y?Y(fe):null;if(typeof nt=="string"&&at(nt)==="template"){const Rt=fe.content;aa(Rt)&&U.push({node:Rt,shadow:null})}}if(Ie){const nt=ue(fe);aa(nt)&&U.push({node:null,shadow:nt},{node:nt,shadow:null})}}};return i.sanitize=function(ce){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,de=null,fe=null,Ie=null;if(pe=!ce,pe&&(ce="<!-->"),typeof ce!="string"&&!sa(ce)&&(ce=Dk(ce),typeof ce!="string"))throw Xs("dirty is not a string, aborting");if(!i.isSupported)return ce;Ve?(L=Vt,be=Bn):$n(A),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(L=Wn(L)),j.uponSanitizeAttribute.length>0&&(be=Wn(be)),i.removed=[];const Ge=ta&&typeof ce!="string"&&sa(ce);if(Ge){Qo(ce);const vn=J(ce);if(typeof vn=="string"){const Qt=at(vn);if(!L[Qt]||ie[Qt])throw Ut(ce),Xs("root node is forbidden and cannot be sanitized in-place")}if(va(ce))throw Ut(ce),Xs("root node is clobbered and cannot be sanitized in-place");try{Gn(ce)}catch(Qt){throw Ut(ce),Qt}}else if(sa(ce))U=gs("<!---->"),de=U.ownerDocument.importNode(ce,!0),de.nodeType===Fn.element&&de.nodeName==="BODY"||de.nodeName==="HTML"?U=de:U.appendChild(de),Gn(U);else{if(!Cn&&!yt&&!pt&&ce.indexOf("<")===-1)return se&&gn?Ce(ce):ce;if(U=gs(ce),!U)return Cn?null:gn?$:""}U&&Ea&&Gt(U.firstChild);const nt=Ge?ce:U;try{const vn=Fs(nt);for(;fe=vn.nextNode();)Po(fe,nt),Ws(fe,nt),aa(fe.content)&&Za(fe.content)}catch(vn){throw Ge&&(Ut(ce),Sl(i.removed,Qt=>{Qt.element&&Ml(Qt.element)})),vn}if(Ge){let vn=!1;if(Sl(i.removed,Qt=>{Qt.element&&(Qt.element===ce&&(vn=!0),Ml(Qt.element))}),vn)throw Xs("a node selected for removal could not be safely returned; refusing to sanitize in place");return yt&&ya(ce),ce}if(Cn){if(yt&&ya(U),Mn)for(Ie=qe.call(U.ownerDocument);U.firstChild;)Ie.appendChild(U.firstChild);else Ie=U;return(be.shadowroot||be.shadowrootmode)&&(Ie=gt.call(u,Ie,!0)),Ie}let Rt=pt?U.outerHTML:U.innerHTML;return pt&&L["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&xn(Yk,U.ownerDocument.doctype.name)&&(Rt="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
227
+ `+Rt),yt&&(Rt=Ka(Rt)),se&&gn?Ce(Rt):Rt},i.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$n(ce),Ve=!0,Vt=L,Bn=be},i.clearConfig=function(){jt=null,Ve=!1,Vt=null,Bn=null,se=Q,$=""},i.isValidAttribute=function(ce,A,U){jt||$n({});const de=at(ce),fe=at(A);return Ni(de,fe,U)},i.addHook=function(ce,A){typeof A=="function"&&Un(j,ce)&&xo(j[ce],A)},i.removeHook=function(ce,A){if(Un(j,ce)){if(A!==void 0){const U=Nk(j[ce],A);return U===-1?void 0:Ek(j[ce],U,1)[0]}return fv(j[ce])}},i.removeHooks=function(ce){Un(j,ce)&&(j[ce]=[])},i.removeAllHooks=function(){j=kv()},i}var _0=M0();let Ch=[],Kc="";function Wk(s,i=[]){Kc=s,Ch=[s,...i].filter(Boolean)}const eT=()=>Ch,tT=()=>Kc,nT=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),aT=s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function sT(s,i=Kc){return`/api/agent/file?directory=${encodeURIComponent(i)}&path=${encodeURIComponent(s)}`}function lT(s){if(!s.length)return null;const i=s.map(c=>nT(c.replace(/[\\/]+$/,"")).replace(/\\\\|\//g,"[\\\\/]")).join("|");return new RegExp(`(?:${i})(?:[\\\\/][^\\s"'<>\`()\\[\\]{}|]*?)+?\\.[A-Za-z0-9]{1,8}(?=[\\s"'<>\`()\\[\\]{}|.,;:!?]|$)`,"g")}function iT(s,i=Ch,c=Kc){const u=lT(i);if(!u)return s;let d=0;return s.split(/(<[^>]+>)/).map(h=>h.startsWith("<")?(/^<a[\s>]/i.test(h)?d++:/^<\/a>/i.test(h)&&(d=Math.max(0,d-1)),h):d||!h?h:h.replace(u,m=>`<a class="file-link" href="${sT(oT(m),c)}" download title="Download ${aT(m)}">${m}</a>`)).join("")}function oT(s){return s.replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}Tt.setOptions({gfm:!0,breaks:!1});const rT=[];_0.addHook("afterSanitizeAttributes",s=>{s.tagName==="A"&&(s.setAttribute("target","_blank"),s.setAttribute("rel","noopener noreferrer"))});function $c({text:s,className:i="",files:c=!1}){const u=c?eT():rT,d=c?tT():"",h=yh(),m=w.useMemo(()=>{const y=_0.sanitize(Tt.parse(s,{async:!1}));return eA(c?iT(y,u,d):y,h)},[s,c,u,d,h]);return l.jsx("div",{className:"md "+i,dangerouslySetInnerHTML:{__html:m}})}const cT=/^ {0,3}(`{3,}|~{3,})[ \t]*(?:drawio|drawgen)\b[^\n]*$/i;function uT(s){const i=s.split(`
228
+ `),c=[];let u=[];const d=()=>{u.join(`
229
+ `).trim()&&c.push({type:"md",text:u.join(`
230
+ `)}),u=[]};for(let h=0;h<i.length;h++){const m=i[h].match(cT);if(!m){u.push(i[h]);continue}const y=m[1],g=new RegExp(`^ {0,3}${y[0]==="`"?"`":"~"}{${y.length},}[ \\t]*$`),S=[];let v=h+1;for(;v<i.length&&!g.test(i[v]);)S.push(i[v++]);d(),c.push({type:"drawio",spec:S.join(`
231
+ `),closed:v<i.length}),h=v}return d(),c}function dT(s,i){return["The diagram renderer reported these problems with your drawio spec:",...(s?s.split(`
232
+ `).filter(Boolean):i.map(u=>`${u.severity} ${u.code} ${u.cell}: ${u.message}`)).slice(0,30).map(u=>`- ${u}`),"","Reply with the corrected spec in a single ```drawio block."].join(`
233
+ `)}const fT=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"diagram",Ao=new Map;let hT=null;const R0=()=>hT??(hT=fetch("/api/render/status").then(s=>s.json()).then(s=>!!(s!=null&&s.ok)).catch(()=>!1));function O0(s){const i=typeof s=="string"?s:JSON.stringify(s);let c=Ao.get(i);return c||(c=fetch("/api/render/drawio",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spec:s})}).then(async u=>{var h;const d=await u.json().catch(()=>({}));return u.ok?{ok:!0,r:d}:{ok:!1,error:((h=d==null?void 0:d.error)==null?void 0:h.message)||`Rendering failed (${u.status})`}}).catch(u=>({ok:!1,error:String((u==null?void 0:u.message)??u)})),Ao.set(i,c),Ao.size>60&&Ao.delete(Ao.keys().next().value)),c}function Tv(s,i,c){const u=URL.createObjectURL(new Blob([i],{type:c}));Object.assign(document.createElement("a"),{href:u,download:s}).click(),setTimeout(()=>URL.revokeObjectURL(u),1e3)}function mT({text:s,streaming:i,onFix:c}){const u=w.useMemo(()=>uT(s),[s]);return u.length===1&&u[0].type==="md"?l.jsx($c,{text:s}):l.jsx(l.Fragment,{children:u.map((d,h)=>d.type==="md"?l.jsx($c,{text:d.text},h):l.jsx(pT,{spec:d.spec,pending:!d.closed&&i,onFix:c},h))})}function pT({spec:s,pending:i,onFix:c}){const[u,d]=w.useState(null),[h,m]=w.useState(null),[y,g]=w.useState(!1);w.useEffect(()=>{R0().then(d)},[]),w.useEffect(()=>{if(i||!u||!s.trim())return;let T=!0;return m(null),O0(s).then(z=>T&&m(z)),()=>{T=!1}},[s,i,u]);const S=w.useMemo(()=>h!=null&&h.ok?URL.createObjectURL(new Blob([h.r.svg],{type:"image/svg+xml"})):null,[h]);w.useEffect(()=>()=>{S&&URL.revokeObjectURL(S)},[S]);const v=l.jsx("pre",{className:"diagram-spec",children:l.jsx("code",{children:s})});if(i)return l.jsxs("div",{className:"diagram-card",children:[l.jsxs("div",{className:"diagram-head",children:[l.jsx("span",{className:"diagram-tag",children:"drawio"})," drawing…"]}),v]});if(u===!1)return l.jsxs("div",{className:"diagram-card",children:[l.jsxs("div",{className:"diagram-head",children:[l.jsx("span",{className:"diagram-tag",children:"drawio"})," Diagram rendering needs the render service (Docker setup)."]}),v]});if(!h)return l.jsx("div",{className:"diagram-card",children:l.jsxs("div",{className:"diagram-head",children:[l.jsx("span",{className:"diagram-tag",children:"drawio"})," rendering…"]})});const b=h.ok?h.r.check.issues:[],x=h.ok?fT(h.r.title):"diagram";return l.jsxs("div",{className:"diagram-card",children:[l.jsxs("div",{className:"diagram-head",children:[l.jsx("span",{className:"diagram-tag",children:"drawio"}),l.jsx("span",{className:"diagram-title",children:h.ok?h.r.title:"Diagram spec has problems"}),h.ok&&(b.length?l.jsxs("span",{className:"diagram-warn",title:b.map(T=>`${T.severity} ${T.code} ${T.cell}: ${T.message}`).join(`
234
+ `),children:[b.length," layout issue",b.length===1?"":"s"]}):l.jsx("span",{className:"diagram-ok",children:"checked"})),l.jsx("span",{className:"spacer"}),h.ok&&l.jsx("button",{className:"btn ghost sm",onClick:()=>Tv(`${x}.drawio.svg`,h.r.svg,"image/svg+xml"),title:"An SVG with the diagram embedded: opens for editing in draw.io and its VS Code extension",children:".drawio.svg"}),h.ok&&l.jsx("button",{className:"btn ghost sm",onClick:()=>Tv(`${x}.drawio`,h.r.xml,"application/xml"),children:".drawio"}),l.jsx("button",{className:"btn ghost sm",onClick:()=>g(T=>!T),children:y?"hide spec":"spec"}),c&&(!h.ok||b.length>0)&&l.jsx("button",{className:"btn sm",onClick:()=>c(dT(h.ok?null:h.error,b)),title:"Send the problems back to the model",children:"ask model to fix"})]}),h.ok?l.jsx("img",{className:"diagram-img",src:S,alt:h.r.title}):l.jsx("pre",{className:"diagram-error",children:h.error}),y&&v]})}function gT({config:s,activeModel:i,messages:c,busy:u,error:d,onSend:h,onStop:m,onReset:y,onToolResult:g,onCompare:S,onCanvas:v}){var W;const[b,x]=w.useState(""),T=bh(),z=T.images,[Z,D]=w.useState(!1),F=w.useRef(null),ue=w.useRef(null),he=w.useRef(null),C=w.useRef(null),Y=((W=i==null?void 0:i.input_modalities)==null?void 0:W.includes("image"))??!1,I=z.length>0&&!Y;w.useEffect(()=>{const ee=he.current;ee&&(ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,260)+"px")},[b]);function X(ee){var P;ee.target.closest("button, select, input, textarea, a")||(P=he.current)==null||P.focus()}function J(){var re;if(Z){(re=F.current)==null||re.stop();return}const ee=Xv({onStart:()=>D(!0),onEnd:()=>{D(!1),F.current=null},onPartial:P=>x(P)});F.current=ee}w.useEffect(()=>{var ee;(ee=ue.current)==null||ee.scrollTo({top:ue.current.scrollHeight,behavior:"smooth"})},[c]);function se(){!b.trim()&&!z.length&&!T.docs.length||u||I||T.reading||(h(b,z.length?z:void 0,T.docs.length?T.docs:void 0),x(""),T.clear())}function $(ee){ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),se())}const Q=c.filter(ee=>ee.role!=="system"),K=(i==null?void 0:i.name)??s.model,ye=f0(s.system),ve=(ye==null?void 0:ye.starters)??J1;function Ce(ee){x(ee),requestAnimationFrame(()=>{const re=he.current;re&&(re.focus(),re.setSelectionRange(ee.length,ee.length))})}return l.jsxs("main",{className:"main",children:[l.jsxs(Ho,{title:`bugxhunter@playground: ~/${K}`,children:[l.jsxs("span",{className:"status-pill"+(u?" live":""),children:[l.jsx("span",{className:"dot"}),u?s.stream?"streaming":"thinking":"ready"]}),l.jsx("button",{className:"btn ghost sm",onClick:v,disabled:u,title:"Threat-model canvas: map a system from a diagram and track its findings",children:"canvas"}),l.jsx("button",{className:"btn ghost sm",onClick:S,disabled:u,title:"Ask 2–3 models the same question side by side",children:"compare"}),l.jsx("button",{className:"btn ghost sm",onClick:y,disabled:u,children:"clear"})]}),l.jsx("div",{className:"transcript grid-bg",ref:ue,children:l.jsxs("div",{className:"transcript-inner",children:[Q.length===0&&l.jsxs("div",{className:"empty-state",children:[l.jsx(Yv,{lines:[{kind:"p",text:`./bxh --playground --model ${K}`,pace:26},{kind:"out",text:"Direct model access: no agent, no file system."},{kind:"out",text:ye?`Preset: ${ye.label}.${Y?" Attach, paste or drop an image to review.":""}`:"Pick a security preset or tune the prompt on the left.",pace:18},{kind:"ok",text:"Model ready ",ok:"OK"}]},K),l.jsx("div",{className:"suggestions",children:ve.map(ee=>l.jsx("button",{className:"chip",onClick:()=>Ce(ee),title:"Puts this in the message box",children:ee.trim()},ee))})]}),Q.map((ee,re)=>l.jsx(yT,{msg:ee,streaming:u&&re===Q.length-1,onToolResult:g,onFix:u?void 0:P=>h(P)},re)),d&&l.jsx("div",{className:"error-banner",children:d})]})}),l.jsxs("div",{className:"composer",children:[l.jsxs("div",{className:"composer-box",onClick:X,onDragOver:ee=>ee.preventDefault(),onDrop:T.onDrop,children:[l.jsx(xh,{images:z,docs:T.docs,reading:T.reading,onRemove:T.remove,onRemoveDoc:T.removeDoc}),l.jsx("textarea",{ref:he,value:b,onChange:ee=>x(ee.target.value),onKeyDown:$,onPaste:T.onPaste,rows:3,placeholder:Z?"Listening…":Y?`Message ${K}… (attach, paste or drop an image, a .drawio file or a .md / .txt file)`:`Message ${K}… (attach or drop a .drawio diagram or a .md / .txt file)`}),l.jsxs("div",{className:"composer-bar",children:[l.jsx("input",{ref:C,type:"file",accept:vh,multiple:!0,hidden:!0,onChange:ee=>{ee.target.files&&T.addImages(ee.target.files),ee.target.value=""}}),l.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var ee;return(ee=C.current)==null?void 0:ee.click()},disabled:u,title:Y?"Attach images, draw.io diagrams or Markdown / text files (or paste / drop them)":"Attach draw.io diagrams or Markdown / text files (images need a vision model)","aria-label":"Attach images, diagrams or text files",children:l.jsx(Qc,{})}),!I&&!T.attachError&&T.docs.some(ee=>ee.kind!=="text")&&s.maxTokens<12e3&&l.jsxs("span",{className:"hint",style:{margin:"0 8px"},title:"Reasoning models think before they answer; a short limit can end the reply before any text",children:["Diagram reviews can need 10–16k output tokens; Max tokens is ",s.maxTokens.toLocaleString(),"."]}),(I||T.attachError)&&l.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:I?`${K} can't see images — pick a vision model (e.g. Nemotron 3.5 Super VL)`:T.attachError}),l.jsx("div",{className:"spacer"}),sh()&&l.jsx("button",{className:"send-btn mic"+(Z?" stop":""),onClick:J,title:Z?"Stop dictation":"Dictate",children:Z?"●":"🎤"}),u?l.jsx("button",{className:"send-btn stop",onClick:m,title:"Stop",children:"■"}):l.jsx("button",{className:"send-btn",onClick:se,disabled:!b.trim()&&!z.length||I,title:"Send",children:"↑"})]})]}),l.jsx("div",{className:"composer-hint",children:"Enter to send · Shift+Enter for a new line"})]})]})}function yT({msg:s,streaming:i,onToolResult:c,onFix:u}){var m,y,g,S,v,b;const d=s.role==="user";return s.role==="tool"?l.jsxs("div",{className:"msg assistant",children:[l.jsx("div",{className:"avatar fn","aria-hidden":!0,children:"fn"}),l.jsx("div",{className:"msg-body",children:l.jsxs("div",{className:"tool-call",children:[l.jsx("span",{className:"tc-name",children:"tool result"}),l.jsx("pre",{children:l.jsx(g0,{text:String(s.content??"")})})]})})]}):d?l.jsx("div",{className:"msg user",children:l.jsxs("div",{className:"bubble user-bubble",children:[s.content,(m=s.images)!=null&&m.length?l.jsx("div",{className:"bubble-images",children:s.images.map((x,T)=>l.jsx("img",{src:x.url,alt:x.name,title:x.name},T))}):null,(y=s.docs)!=null&&y.length?l.jsx("div",{className:"attach-row bubble-docs",children:s.docs.map((x,T)=>l.jsxs("span",{className:"attach-chip doc",title:`Sent as ${x.kind==="text"?"text":"an exact outline"} (${x.text.length.toLocaleString()} characters)`,children:[l.jsx("span",{className:"attach-doc-icon","aria-hidden":!0,children:"◇"}),l.jsx("span",{className:"attach-name",children:x.name})]},T))}):null]})}):l.jsxs("div",{className:"msg assistant",children:[l.jsx("div",{className:"avatar","aria-hidden":!0,children:"▶"}),l.jsxs("div",{className:"msg-body",children:[l.jsxs("div",{children:[s.content?l.jsx(mT,{text:s.content,streaming:i,onFix:u}):null,i&&!s.tool_calls&&l.jsx("span",{className:"cursor"}),(g=s.tool_calls)==null?void 0:g.map(x=>l.jsx(vT,{call:x,onResult:c},x.id))]}),s.sources&&s.sources.length>0&&l.jsxs("div",{className:"sources",children:[l.jsx("span",{className:"sources-label",children:"grounded in"}),s.sources.map((x,T)=>l.jsx("span",{className:"badge on",title:`similarity ${x.score}`,children:x.doc},T))]}),s.finish==="length"&&l.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:O1(s.content,(S=s.usage)==null?void 0:S.reasoning)}),(s.usage||s.timing)&&l.jsxs("div",{className:"msg-meta",children:[s.timing&&l0(s.timing,(v=s.usage)==null?void 0:v.completion,(b=s.usage)==null?void 0:b.reasoning),s.timing&&s.usage&&" · ",s.usage&&l.jsxs(l.Fragment,{children:[s.usage.prompt??0," in",s0(s.usage)," · ",s.usage.completion??0," out",s.usage.reasoning?` · ${s.usage.reasoning} reasoning`:""," tokens"]})]})]})]})}function vT({call:s,onResult:i}){const[c,u]=w.useState(""),[d,h]=w.useState(!1);let m=s.function.arguments;try{m=JSON.stringify(JSON.parse(s.function.arguments),null,2)}catch{}return l.jsxs("div",{className:"tool-call",children:[l.jsxs("span",{className:"tc-name",children:[s.function.name,"()"]}),l.jsx("pre",{children:m}),d?l.jsx("div",{className:"tc-result mini",style:{color:"var(--muted)"},children:"↳ result submitted"}):l.jsxs("div",{className:"tc-result",children:[l.jsx("textarea",{placeholder:"Return a tool result (JSON or text), then continue…",value:c,onChange:y=>u(y.target.value),style:{minHeight:50,fontSize:12}}),l.jsx("button",{className:"btn mini",style:{marginTop:6},disabled:!c.trim(),onClick:()=>{i(s,c),h(!0)},children:"Submit result & continue"})]})]})}function bT(s,i){if(!(i!=null&&i.length))return s;const c=i.map(d=>{const h=d.name.replace(/"/g,"'");return d.kind==="text"?`Attached file "${d.name}", in full:
235
+
236
+ <file name="${h}">
237
+ ${d.text.trimEnd()}
238
+ </file>`:`Attached draw.io diagram "${d.name}", exported as an outline: its zones, the boxes inside each zone (legend colour meanings in [brackets]) and the arrows with their labels. Every label is exact.
239
+
240
+ <diagram file="${h}">
241
+ ${d.text.trimEnd()}
242
+ </diagram>`}),u=i.every(d=>d.kind==="text")?"Review this document for security issues.":"Review this diagram for security issues.";return[(s==null?void 0:s.trim())||u,...c].join(`
243
+
244
+ `)}function Mh(s,i,c){const u=bT(s,c);return i!=null&&i.length?[{type:"text",text:(u==null?void 0:u.trim())||"Describe this image."},...i.map(d=>({type:"image_url",image_url:{url:d.url}}))]:u}const xT=3,ST={scx:"SCX.ai",anthropic:"Anthropic",nvidia:"NVIDIA NIM",bedrock:"Amazon Bedrock",openrouter:"OpenRouter"},ko=s=>({model:s,text:"",busy:!1,error:null});function jv(s,i){var d;const c=s.find(h=>h.id===i[0]),u=s.filter(h=>!i.includes(h.id));return(d=u.find(h=>(h.provider??"scx")!==((c==null?void 0:c.provider)??"scx"))??u[0])==null?void 0:d.id}function wT({config:s,models:i,onExit:c}){const u=i.filter(zc),[d,h]=w.useState(()=>[s.model,jv(u,[s.model])].filter(C=>!!C).map(ko)),[m,y]=w.useState(""),[g,S]=w.useState(null),v=bh(),b=w.useRef(null),x=w.useRef([]),T=d.some(C=>C.busy),z=(C,Y)=>h(I=>I.map((X,J)=>J===C?{...X,...Y}:X));function Z(){x.current.forEach(C=>C.abort()),x.current=[]}function D(){if(!m.trim()&&!v.images.length&&!v.docs.length||T||v.reading)return;Z();const C=v.images,Y=[...s.system.trim()?[{role:"system",content:s.system}]:[],{role:"user",content:Mh(m,C,v.docs)}],I=[C.length?`${C.length} image${C.length>1?"s":""}`:"",...v.docs.map(X=>X.name)].filter(Boolean);S((m.trim()||(v.docs.length?v.docs.every(X=>X.kind==="text")?"Review this document for security issues.":"Review this diagram for security issues.":"Describe this image."))+(I.length?` [+${I.join(", ")}]`:"")),x.current=d.map(()=>new AbortController),d.forEach((X,J)=>{var K,ye;const se=i.find(ve=>ve.id===X.model);if(C.length&&!((K=se==null?void 0:se.input_modalities)!=null&&K.includes("image"))){h(ve=>ve.map((Ce,W)=>W===J?{...ko(Ce.model),skipped:"This model can't see images, so it was skipped."}:Ce));return}h(ve=>ve.map((Ce,W)=>W===J?{...ko(Ce.model),busy:!0}:Ce));const $=performance.now();let Q;nh({model:X.model,messages:Y,temperature:s.temperature,top_p:s.topP,max_tokens:s.maxTokens,reasoning_effort:ah(s.reasoningEffort,i.find(ve=>ve.id===X.model)),response_format:s.jsonMode?{type:"json_object"}:void 0,stream:s.stream},{signal:(ye=x.current[J])==null?void 0:ye.signal,onDelta:ve=>{Q??(Q=performance.now()-$),h(Ce=>Ce.map((W,ee)=>ee===J?{...W,text:W.text+ve}:W))},onUsage:ve=>z(J,{usage:ve}),onError:ve=>z(J,{error:ve}),onDone:()=>z(J,{timing:{ttft:Q,total:performance.now()-$}})}).catch(ve=>{(ve==null?void 0:ve.name)!=="AbortError"&&z(J,{error:String((ve==null?void 0:ve.message)??ve)})}).finally(()=>z(J,{busy:!1}))}),y(""),v.clear()}function F(C){C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),D())}const ue=["scx","anthropic","nvidia","bedrock","openrouter"].map(C=>[C,u.filter(Y=>(Y.provider??"scx")===C)]).filter(([,C])=>C.length>0),he=d.some(C=>{var Y,I;return(I=(Y=i.find(X=>X.id===C.model))==null?void 0:Y.input_modalities)==null?void 0:I.includes("image")});return l.jsxs("main",{className:"main",children:[l.jsxs(Ho,{title:`bugxhunter@playground: ~/compare (${d.length} models)`,children:[l.jsxs("span",{className:"status-pill"+(T?" live":""),children:[l.jsx("span",{className:"dot"}),T?"running":"ready"]}),d.length<xT&&l.jsx("button",{className:"btn ghost sm",disabled:T,onClick:()=>h(C=>[...C,ko(jv(u,C.map(Y=>Y.model))??s.model)]),children:"+ model"}),l.jsx("button",{className:"btn ghost sm",onClick:()=>{Z(),c()},children:"back to chat"})]}),l.jsxs("div",{className:"transcript grid-bg",children:[g&&l.jsxs("div",{className:"compare-prompt mono",children:["$ ",g]}),l.jsx("div",{className:"compare-grid",style:{"--cols":d.length},children:d.map((C,Y)=>{var I,X;return l.jsxs("section",{className:"compare-col",children:[l.jsxs("div",{className:"compare-head",children:[l.jsxs("select",{value:C.model,disabled:T,onChange:J=>z(Y,{...ko(J.target.value)}),"aria-label":`Model ${Y+1}`,children:[!u.some(J=>J.id===C.model)&&l.jsx("option",{value:C.model,children:C.model}),ue.map(([J,se])=>l.jsx("optgroup",{label:ST[J],children:se.map($=>{var Q;return l.jsxs("option",{value:$.id,children:[$.name,(Q=$.input_modalities)!=null&&Q.includes("image")?" · vision":""]},$.id)})},J))]}),d.length>1&&l.jsx("button",{className:"attach-x",disabled:T,onClick:()=>h(J=>J.filter((se,$)=>$!==Y)),"aria-label":"Remove this model",children:"✕"})]}),l.jsxs("div",{className:"compare-body",children:[C.skipped&&l.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:C.skipped}),C.error&&l.jsx("div",{className:"error-banner",children:C.error}),C.text&&l.jsx($c,{text:C.text}),C.busy&&l.jsx("span",{className:"cursor"}),!C.text&&!C.busy&&!C.skipped&&!C.error&&l.jsx("p",{className:"muted mono",style:{margin:0},children:g?"No answer.":"Waiting for a prompt…"})]}),(C.timing||C.usage)&&l.jsxs("div",{className:"msg-meta",children:[C.timing&&l0(C.timing,(I=C.usage)==null?void 0:I.completion,(X=C.usage)==null?void 0:X.reasoning),C.usage&&`${C.timing?" · ":""}${C.usage.prompt??0} in${s0(C.usage)} · ${C.usage.completion??0} out tokens`]})]},Y)})})]}),l.jsxs("div",{className:"composer",children:[l.jsxs("div",{className:"composer-box",onDragOver:C=>C.preventDefault(),onDrop:v.onDrop,children:[l.jsx(xh,{images:v.images,docs:v.docs,reading:v.reading,onRemove:v.remove,onRemoveDoc:v.removeDoc}),l.jsx("textarea",{value:m,onChange:C=>y(C.target.value),onKeyDown:F,onPaste:v.onPaste,rows:3,placeholder:`Ask all ${d.length} models the same thing…${he?" (images go to the vision models)":""}`}),l.jsxs("div",{className:"composer-bar",children:[l.jsx("input",{ref:b,type:"file",accept:vh,multiple:!0,hidden:!0,onChange:C=>{C.target.files&&v.addImages(C.target.files),C.target.value=""}}),l.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var C;return(C=b.current)==null?void 0:C.click()},disabled:T,title:"Attach images (or paste / drop them)","aria-label":"Attach images",children:l.jsx(Qc,{})}),v.attachError&&l.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:v.attachError}),l.jsx("div",{className:"spacer"}),T?l.jsx("button",{className:"send-btn stop",onClick:Z,title:"Stop all",children:"■"}):l.jsx("button",{className:"send-btn",onClick:D,disabled:!m.trim()&&!v.images.length&&!v.docs.length||v.reading,title:"Run on all models",children:"↑"})]})]}),l.jsx("div",{className:"composer-hint",children:"Enter to run on every model · uses the sidebar's system prompt and settings · single turn"})]})]})}const ki=["data","management","attestation","identity","control","blocked"],Io={data:"Data",management:"Management",attestation:"Attestation / evidence",identity:"Identity / credential",control:"Control / config",blocked:"Blocked"},AT=["actor","service","ai","datastore","external"],D0=["critical","high","medium","low"],qc={critical:0,high:1,medium:2,low:3},wc=()=>({title:"Untitled threat model",nodes:[],edges:[]}),Ot=(s,i="")=>typeof s=="string"?s.trim():i,Mo=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"node";function kT(s){const i=Ot(s).toLowerCase();return AT.includes(i)?i:/user|client|admin|customer|attacker|person|internet/.test(i)?"actor":/\b(ai|llm|model|agent|copilot|assistant|rag|retriev|inference|embedding)/.test(i)?"ai":/db|database|store|bucket|storage|cache|queue|file|repo|config|secret/.test(i)?"datastore":/third|external|saas|vendor|partner/.test(i)?"external":"service"}function TT(s,i){const c=Ot(s).toLowerCase();return ki.includes(c)?c:c?/block|denied|disabled|cut/.test(c)?"blocked":/attest|evidence|spdm|measure/.test(c)?"attestation":/ident|credential|cert|svid|token|key|auth/.test(c)?"identity":/manag|admin|mgmt|bmc|redfish|ssh|console/.test(c)?"management":/control|config|crd|gitops|policy|deploy|boot|admission/.test(c)?"control":"data":/\bblocked\b/i.test(i)?"blocked":"data"}function Nv(s,i){return(Array.isArray(s)?s:[]).flatMap((c,u)=>{if(!c||typeof c!="object")return[];const d=c,h=Ot(d.title)||Ot(d.issue)||Ot(d.name);if(!h)return[];const m=Ot(d.status).toLowerCase();return[{id:`${i}-f${u+1}`,title:h,severity:jT(d.severity),fix:Ot(d.fix)||Ot(d.mitigation)||void 0,ref:Ot(d.ref)||Ot(d.cwe)||void 0,status:m==="fixed"||m==="verified"?m:"open"}]})}function jT(s){const i=Ot(s).toLowerCase();return D0.includes(i)?i:i.startsWith("crit")||i==="p1"?"critical":i.startsWith("hi")||i==="p2"?"high":i.startsWith("lo")||i==="p4"||i==="p5"||i.startsWith("info")?"low":"medium"}function NT(s){const i=s.match(/```(?:json)?\s*([\s\S]*?)```/i),c=i?i[1]:s,u=c.indexOf("{"),d=c.lastIndexOf("}");if(u<0||d<=u)throw new Error("No JSON object in the model's reply.");return JSON.parse(c.slice(u,d+1))}function To(s){if(!s||typeof s!="object")throw new Error("Threat model must be a JSON object.");const i=s,c=new Set,u=y=>{let g=y;for(let S=2;c.has(g);S++)g=`${y}-${S}`;return c.add(g),g},d=new Map,h=(Array.isArray(i.nodes)?i.nodes:[]).flatMap((y,g)=>{if(!y||typeof y!="object")return[];const S=y,v=Ot(S.label)||Ot(S.name)||`Component ${g+1}`,b=Ot(S.id)||Mo(v),x=u(Mo(b));d.has(b)||d.set(b,x),d.has(v)||d.set(v,x);const T=Nv(S.findings,x);return[{id:x,label:v,kind:kT(S.kind??S.type),details:(Array.isArray(S.details)?S.details:[]).map(z=>Ot(z)).filter(Boolean).slice(0,8),inScope:S.inScope!==!1,tested:S.tested===!0,findings:T,x:typeof S.x=="number"?S.x:void 0,y:typeof S.y=="number"?S.y:void 0}]}),m=(Array.isArray(i.edges)?i.edges:[]).flatMap((y,g)=>{if(!y||typeof y!="object")return[];const S=y,v=d.get(Ot(S.from))??d.get(Mo(Ot(S.from))),b=d.get(Ot(S.to))??d.get(Mo(Ot(S.to)));if(!v||!b||v===b)return[];let x=Ot(S.label);const T=/\s*\(implied\)\s*$/i.test(x);T&&(x=x.replace(/\s*\(implied\)\s*$/i,""));const z=`e${g+1}`;return[{id:z,from:v,to:b,label:x||Ot(S.protocol)||void 0,kind:TT(S.kind??S.type,x),encrypted:typeof S.encrypted=="boolean"?S.encrypted:void 0,implied:S.implied===!0||T||void 0,protocol:Ot(S.protocol)||void 0,auth:Ot(S.auth)||Ot(S.authentication)||void 0,findings:Nv(S.findings,z)}]});return{title:Ot(i.title)||"Untitled threat model",nodes:h,edges:m}}const ea=200,ds=86,ET=120,CT=40,Zf=ea+ET,Lo=ds+CT,Ev=6,Ac={actor:0,external:1,service:2,ai:3,datastore:4},Lf=s=>s.x!==void 0&&s.y!==void 0;function Qs(s){const i=s.nodes.filter(y=>!Lf(y));if(!i.length)return s;if(i.length===s.nodes.length)return{...s,nodes:_T(s.nodes,s.edges)};const c=s.nodes.filter(Lf),u=Math.min(...c.map(y=>y.x)),d=Math.max(...c.map(y=>y.y))+Lo;let h=0;const m=s.nodes.map(y=>{if(Lf(y))return y;const g=h++;return{...y,x:u+g%4*Zf,y:d+Math.floor(g/4)*Lo}});return{...s,nodes:m}}function MT(s){return Qs({...s,nodes:s.nodes.map(({x:i,y:c,...u})=>u)})}function _T(s,i){var se;const c=new Map(s.map(($,Q)=>[$.id,Q])),u=new Map(s.map($=>[$.id,new Set])),d=new Map(s.map($=>[$.id,new Set]));for(const $ of i)$.from===$.to||!u.has($.from)||!u.has($.to)||(u.get($.from).add($.to),d.get($.to).add($.from));const h=s.filter($=>u.get($.id).size||d.get($.id).size),m=s.filter($=>!u.get($.id).size&&!d.get($.id).size),y=[...h].sort(($,Q)=>(d.get($.id).size?1:0)-(d.get(Q.id).size?1:0)||Ac[$.kind]-Ac[Q.kind]||c.get($.id)-c.get(Q.id)),g=new Map(h.map($=>[$.id,[]])),S=new Map(h.map($=>[$.id,[]])),v=new Map,b=$=>{v.set($,1);for(const Q of u.get($))v.get(Q)!==1&&(g.get($).push(Q),S.get(Q).push($),v.has(Q)||b(Q));v.set($,2)};for(const $ of y)v.has($.id)||b($.id);const x=[],T=new Map(h.map($=>[$.id,S.get($.id).length])),z=h.filter($=>!T.get($.id)).map($=>$.id);for(;z.length;){const $=z.shift();x.push($);for(const Q of g.get($))T.set(Q,T.get(Q)-1),T.get(Q)||z.push(Q)}const Z=new Map;for(const $ of x)Z.set($,Math.max(0,...S.get($).map(Q=>Z.get(Q)+1)));for(const $ of[...x].reverse()){const Q=s[c.get($)];S.get($).length||!g.get($).length||Q.kind==="actor"||Z.set($,Math.max(0,Math.min(...g.get($).map(K=>Z.get(K)))-1))}const D=[];for(const $ of x)(D[se=Z.get($)]??(D[se]=[])).push($);const F=D.filter(Boolean),ue=new Map;F.forEach($=>$.forEach((Q,K)=>ue.set(Q,K-($.length-1)/2)));for(let $=0;$<8;$++){const Q=$%2===0;for(const K of Q?F:[...F].reverse()){const ye=Z.get(K[0]),ve=new Map(K.map(Ce=>{const W=[...d.get(Ce),...u.get(Ce)].filter(ee=>Z.has(ee)&&(Q?Z.get(ee)<ye:Z.get(ee)>ye));return[Ce,W.length?W.reduce((ee,re)=>ee+ue.get(re),0)/W.length:ue.get(Ce)]}));K.sort((Ce,W)=>ve.get(Ce)-ve.get(W)),K.forEach((Ce,W)=>ue.set(Ce,W-(K.length-1)/2))}}const C=Math.min(Ev,Math.max(0,...F.map($=>$.length))),Y=new Map;let I=0;for(const $ of F){const Q=Math.ceil($.length/Ev),K=Math.ceil($.length/Q);$.forEach((ye,ve)=>{const Ce=Math.floor(ve/K),W=Math.min(K,$.length-Ce*K);Y.set(ye,{x:40+(I+Ce)*Zf,y:40+((C-W)/2+ve%K)*Lo})}),I+=Q}const X=F.length?40+(C+.5)*Lo:40,J=Math.max(4,I);return[...m].sort(($,Q)=>Ac[$.kind]-Ac[Q.kind]||c.get($.id)-c.get(Q.id)).forEach(($,Q)=>Y.set($.id,{x:40+Q%J*Zf,y:X+Math.floor(Q/J)*Lo})),s.map($=>({...$,...Y.get($.id)}))}function Cv(s){let i=null;for(const c of s.findings)c.status==="open"&&(!i||qc[c.severity]<qc[i])&&(i=c.severity);return i}function RT(s){const i={critical:0,high:0,medium:0,low:0};let c=0;for(const h of[...s.nodes.flatMap(m=>m.findings),...s.edges.flatMap(m=>m.findings??[])])h.status==="open"?i[h.severity]++:c++;const u=Object.fromEntries(ki.map(h=>[h,0]));for(const h of s.edges)u[h.kind??"data"]++;const d=s.nodes.filter(h=>h.inScope);return{components:s.nodes.length,inScope:d.length,tested:d.filter(h=>h.tested).length,open:i,fixed:c,plaintextFlows:s.edges.filter(h=>h.encrypted===!1).length,flows:s.edges.length,impliedFlows:s.edges.filter(h=>h.implied).length,blockedFlows:u.blocked,byKind:u}}function OT(s){const i=new Map(s.nodes.map(h=>[h.id,h.label])),c=[...s.nodes.flatMap(h=>h.findings.map(m=>({where:h.label,f:m}))),...s.edges.flatMap(h=>(h.findings??[]).map(m=>({where:`${i.get(h.from)??h.from} → ${i.get(h.to)??h.to} (${Io[h.kind??"data"].toLowerCase()} flow)`,f:m})))].sort((h,m)=>qc[h.f.severity]-qc[m.f.severity]),u=(h="")=>h.replace(/\|/g,"\\|").replace(/\n/g," ");return[`# ${u(s.title)}`,"","| Severity | Component or flow | Finding | Fix | Ref | Status |","|---|---|---|---|---|---|",...c.map(({where:h,f:m})=>`| ${m.severity} | ${u(h)} | ${u(m.title)} | ${u(m.fix)} | ${u(m.ref)} | ${m.status} |`)].join(`
245
+ `)+`
246
+ `}function DT(s){const i=Qs(s),c=new Map(i.nodes.map((y,g)=>[y.id,`n${g}-${Mo(y.id)}`])),u=(y,g)=>y.length>g?y.slice(0,g-1)+"…":y,d=y=>{if(!y.inScope)return"out of scope";const g=D0.map(S=>[S,y.findings.filter(v=>v.status==="open"&&v.severity===S).length]).filter(([,S])=>S>0);return g.length?g.map(([S,v])=>`${v} ${S}`).join(" · "):"no open findings"},h=Math.min(...i.nodes.map(y=>y.x??0)),m=Math.min(...i.nodes.map(y=>y.y??0));return{title:u(s.title||"Threat model",80),nodes:i.nodes.map(y=>({id:c.get(y.id),label:u(y.label,40),kind:y.kind,sub:d(y),x:Math.round((y.x??0)-h+40),y:Math.round((y.y??0)-m+90),w:ea,h:ds})),edges:i.edges.filter(y=>c.has(y.from)&&c.has(y.to)).map(y=>{const g=y.kind??"data",S=y.encrypted===!1&&!/plain/i.test(y.label??""),v=S?"async":g==="blocked"?"weak":g==="management"||g==="control"?"sync":g==="attestation"||g==="identity"?"ai":"data",b=[g==="data"?"":`${g}:`,y.label,S?"(plaintext)":"",y.implied?"(implied)":""].filter(Boolean).join(" ");return{from:c.get(y.from),to:c.get(y.to),style:v,...b?{label:u(b,48)}:{}}}),legend:{edges:[]}}}function LT(s,i,c){const u=Math.max(s,i?65536:8192);return c&&c>0?Math.min(u,Math.max(c,1024)):u}let jo;function zT(){if(jo!==void 0)return jo;try{jo=typeof document<"u"?document.createElement("canvas").getContext("2d"):null}catch{jo=null}return jo}function Pf(s,i){var h;const c=zT();if(c)return c.font=i,c.measureText(s).width;const u=Number(((h=/(\d+(?:\.\d+)?)px/.exec(i))==null?void 0:h[1])??12),d=/mono/i.test(i)||/\b[6-9]00\b|bold/.test(i)?.6:.56;return s.length*u*d}function kc(s,i,c){if(i<=0)return"";if(Pf(s,c)<=i)return s;const u=Array.from(s);let d=0,h=u.length;for(;d<h;){const m=Math.ceil((d+h)/2);Pf(u.slice(0,m).join("").trimEnd()+"…",c)<=i?d=m:h=m-1}return d?u.slice(0,d).join("").trimEnd()+"…":"…"}const UT="700 14px Inter, system-ui, sans-serif",IT="10px JetBrains Mono, monospace",BT="11px Inter, system-ui, sans-serif",Mv="11px JetBrains Mono, monospace",HT=`You are a security architect building a threat model of a system the user owns or is authorised to assess.
247
+ From the diagram, screenshot or description you are given, map the system and its weaknesses.
248
+
249
+ Reply with ONE JSON object and nothing else, in exactly this shape:
250
+ {
251
+ "title": "short name of the system",
252
+ "nodes": [
253
+ {
254
+ "id": "short-kebab-id",
255
+ "label": "Component name as shown",
256
+ "kind": "actor" | "service" | "ai" | "datastore" | "external",
257
+ "details": ["facts read off the source: versions, ports, settings"],
258
+ "findings": [
259
+ { "title": "the weakness, one line", "severity": "critical" | "high" | "medium" | "low", "fix": "the remediation, one line", "ref": "ids: OWASP (A01:2025, API1:2023, LLM01:2025, ASI01:2026), CWE-xxx, ATLAS AML.Txxxx for AI components" }
260
+ ]
261
+ }
262
+ ],
263
+ "edges": [
264
+ {
265
+ "from": "node-id", "to": "node-id", "label": "what flows, short",
266
+ "kind": "data" | "management" | "attestation" | "identity" | "control" | "blocked",
267
+ "encrypted": true | false, "protocol": "e.g. Redfish/HTTPS", "auth": "e.g. mTLS",
268
+ "implied": true,
269
+ "findings": [ { "title": "...", "severity": "...", "fix": "...", "ref": "..." } ]
270
+ }
271
+ ]
272
+ }
273
+
274
+ Rules:
275
+ - actor = people or the internet; service = servers, apps, APIs; ai = models, LLM endpoints, agents, copilots, RAG retrievers, inference services; datastore = databases, buckets, files, config, secrets stores, vector indexes, model weights; external = third-party systems.
276
+ - Attach each finding to the component it affects. Notes that apply to a component (e.g. "MFA not required for /admin") go on that component.
277
+ - Only report what the source shows or states. Do not invent components or weaknesses. If something is unclear, leave it out.
278
+ - Flow kind: data = application or tenant data; management = admin and out-of-band access (BMC, SSH, consoles); attestation = evidence and measurements (SPDM, quotes); identity = credentials, certificates, keys, workload identities; control = configuration, policy, deployment, boot images, prompts and tool definitions an AI component loads; blocked = a path the source shows as disabled or cut.
279
+ - Mark a flow "encrypted": false only when the source shows plaintext (HTTP, "plaintext", no TLS); omit "encrypted" when unknown. Classical or weak crypto is not plaintext: record it as a finding instead. Omit "protocol" and "auth" when the source doesn't say.
280
+ - Set "implied": true only for a flow the source does not draw but its labels clearly imply, and only when the user asks for implied flows. Otherwise omit it.
281
+ - A weakness of the connection itself (a classical signature on evidence, missing authentication, a protocol downgrade, untrusted content flowing into an AI component, model output flowing unchecked into a tool or a shell) goes in that flow's "findings"; a weakness of a component goes on the component.
282
+ - Notes, legends and markers (a red X, a "blocked" note) are not components: turn a blocked path into a flow with kind "blocked".
283
+ - The stated threat model or attacker (e.g. "tenant with root on the host") is context, not a finding: put it in that component's details. A control the source shows in place is not a finding either, unless something about it is weak or unverified.
284
+ - Walk every component and flow through the STRIDE categories that apply to it, and the OWASP list that fits its technology; for an "ai" component also walk the ATLAS tactics. A flow between components of different trust (internet to service, tenant to shared store, untrusted content to an AI component) with no authentication or encryption shown is a finding on that flow. Where you considered a category and found nothing, say nothing: the canvas records findings, not coverage.
285
+ - "ref" holds the ids only, space-separated, e.g. "A01:2025 CWE-284" or "LLM01:2025 AML.T0051.001". Prefer the most specific id you are sure of; omit "ref" rather than guess.
286
+ - Keep every string short. No markdown, no commentary outside the JSON.
287
+
288
+ ${d0}
289
+
290
+ ${gh()}
291
+
292
+ ${V1()}`;function $T(s,i){const c=i?"the attached diagram, screenshot or document":"the system described below",u=s.trim()?`
293
+
294
+ Context from the user:
295
+ ${s.trim()}`:"";return`Build the threat model JSON for ${c}.${u}`}const _o=()=>crypto.randomUUID().toLowerCase(),Zc=s=>`/api/playground/sessions/${s}`;async function Pc(s,i){var u,d;if(s.ok)return s.json();let c="";try{c=((d=(u=await s.json())==null?void 0:u.error)==null?void 0:d.message)??""}catch{}throw new Error(c||`${i} failed (${s.status})`)}const Mc=s=>fetch(Zc(s)).then(i=>Pc(i,"Listing saved sessions")).then(i=>i.sessions),Ff=(s,i)=>fetch(`${Zc(s)}/${i}`).then(c=>Pc(c,"Opening the session")),_c=(s,i,c,u)=>fetch(`${Zc(s)}/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:c,body:u})}).then(d=>Pc(d,"Saving")),L0=(s,i)=>fetch(`${Zc(s)}/${i}`,{method:"DELETE"}).then(c=>Pc(c,"Deleting")),_v="or_threat_model",qT=1200,z0="or_canvas_panel",Rv="or_canvas_build_box",U0=340,I0=260,B0=640;function GT(){try{const s=JSON.parse(localStorage.getItem(z0)??"null");if(s&&typeof s.width=="number")return{width:Math.min(B0,Math.max(I0,s.width)),collapsed:s.collapsed===!0}}catch{}return{width:U0,collapsed:!1}}const Ov={actor:"#00e5ff",service:"#8fa8ff",ai:"#c58cff",datastore:"#ffb300",external:"#b4bcc6"},Ro={critical:"#ff3c3c",high:"#ff7a45",medium:"#ffb300",low:"#6e7681"},Jf=["critical","high","medium","low"],XT=["actor","service","ai","datastore","external"],xi={data:"#9aa4b2",management:"#c792ea",attestation:"#e3b341",identity:"#3fb950",control:"#58a6ff",blocked:"#5c6370"},Wf="#ff3c3c";function YT(s,i){const c=(s.x??0)+ea/2,u=(s.y??0)+ds/2,d=(i.x??0)+ea/2,h=(i.y??0)+ds/2;if(Math.abs(d-c)>ea){const b=d>c?1:-1,x=c+b*ea/2,T=d-b*(ea/2+2),z=Math.max(40,Math.abs(T-x)/2)*b;return{d:`M${x},${u} C${x+z},${u} ${T-z},${h} ${T},${h}`,ax:x,ay:u,ex:T,ey:h}}const m=d-c,y=h-u,g=Math.min(Math.abs(ea/2/(m||1e-6)),Math.abs(ds/2/(y||1e-6)),1),S=d-m*g,v=h-y*g;return{d:`M${c},${u} L${S},${v}`,ax:c,ay:u,ex:S,ey:v}}function VT(s){const i=s.encrypted===!1,c=i?Wf:xi[s.kind??"data"],u=s.kind==="blocked"?"2 5":i?"7 5":s.implied?"4 4":void 0;return{plain:i,color:c,dash:u,opacity:s.implied?.6:1,marker:i?"tm-arrow-plain":`tm-arrow-${s.kind??"data"}`}}const QT=(s,i)=>s.length>i?s.slice(0,i-1)+"…":s;function Tc(s,i,c){const u=URL.createObjectURL(new Blob([i],{type:c})),d=document.createElement("a");d.href=u,d.download=s,d.click(),URL.revokeObjectURL(u)}function KT({config:s,models:i,onExit:c}){var Ke,We,ht;const[u,d]=w.useState(wc),[h,m]=w.useState(_o),[y,g]=w.useState(null),[S,v]=w.useState([]),[b,x]=w.useState(null),[T,z]=w.useState(!1),Z=w.useRef(""),[D,F]=w.useState(null),[ue,he]=w.useState(null),[C,Y]=w.useState(GT);w.useEffect(()=>{try{localStorage.setItem(z0,JSON.stringify(C))}catch{}},[C]);const[I,X]=w.useState(()=>{try{return localStorage.getItem(Rv)==="hidden"}catch{return!1}});w.useEffect(()=>{try{localStorage.setItem(Rv,I?"hidden":"shown")}catch{}},[I]);const[J,se]=w.useState(!1);w.useEffect(()=>{var ut,at,jt;if(!J)return;let N=!1;const V=()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{})};(at=(ut=document.documentElement).requestFullscreen)==null||at.call(ut).then(()=>{N&&V()}).catch(()=>{});const ge=[];for(let st=$.current;st!=null&&st.parentElement&&st.parentElement!==document.body;st=st.parentElement)for(const Bt of Array.from(((jt=st.parentElement)==null?void 0:jt.children)??[]))Bt!==st&&!Bt.hasAttribute("inert")&&(Bt.setAttribute("inert",""),ge.push(Bt));const Se=st=>{var $n;if(st.key!=="Escape"||st.defaultPrevented||st.isComposing)return;const Bt=st.target;($n=Bt==null?void 0:Bt.closest)!=null&&$n.call(Bt,"input, textarea, select, [contenteditable]")||document.querySelector(".overlay")||se(!1)},Je=()=>{document.fullscreenElement||se(!1)};return window.addEventListener("keydown",Se),document.addEventListener("fullscreenchange",Je),()=>{N=!0,window.removeEventListener("keydown",Se),document.removeEventListener("fullscreenchange",Je);for(const st of ge)st.removeAttribute("inert");V()}},[J]);const $=w.useRef(null);function Q(N){var ut;N.preventDefault();const V=N.currentTarget;V.setPointerCapture(N.pointerId),document.body.classList.add("resizing");const ge=((ut=$.current)==null?void 0:ut.getBoundingClientRect().right)??window.innerWidth,Se=at=>Y(jt=>({...jt,width:Math.round(Math.min(B0,Math.max(I0,ge-at.clientX)))})),Je=()=>{V.removeEventListener("pointermove",Se),V.removeEventListener("pointerup",Je),document.body.classList.remove("resizing")};V.addEventListener("pointermove",Se),V.addEventListener("pointerup",Je)}const[K,ye]=w.useState(""),[ve,Ce]=w.useState(!1),[W,ee]=w.useState(null),re=bh(),P=w.useRef(null),Ae=w.useRef(null),qe=w.useRef(null),ct=w.useRef(null),gt=()=>Mc("canvas").then(v).catch(N=>x({ok:!1,text:String(N.message??N)}));function j(N,V,ge){d(N),m(V),F(null),he(null),Hn(null),Z.current=ge?JSON.stringify(N):""}w.useEffect(()=>{let N=!0;return(async()=>{try{let V=null;try{V=localStorage.getItem(_v)}catch{}if(V){const Se=Qs(To(JSON.parse(V)));Se.nodes.length&&await _c("canvas",_o(),Se.title,Se);try{localStorage.removeItem(_v)}catch{}}const ge=await Mc("canvas");if(!N)return;if(v(ge),ge[0]){const Se=await Ff("canvas",ge[0].id);N&&j(Qs(To(Se.body)),ge[0].id,!0)}}catch(V){N&&x({ok:!1,text:`Saved canvases unavailable: ${String(V.message??V)}`})}finally{N&&z(!0)}})(),()=>{N=!1}},[]),w.useEffect(()=>{if(!T||!u.nodes.length)return;const N=JSON.stringify(u);if(N===Z.current)return;const V=setTimeout(()=>{_c("canvas",h,u.title,u).then(()=>(Z.current=N,x({ok:!0,text:"Saved, encrypted with your vault"}),Mc("canvas").then(v))).catch(ge=>x({ok:!1,text:`Not saved: ${String(ge.message??ge)}`}))},qT);return()=>clearTimeout(V)},[u,h,T]);async function ae(N){try{const V=await Ff("canvas",N);g(null),j(Qs(To(V.body)),N,!0)}catch(V){x({ok:!1,text:String(V.message??V)})}}async function Ne(N){try{await L0("canvas",N),N===h&&j(wc(),_o(),!1),await gt()}catch(V){x({ok:!1,text:String(V.message??V)})}}const xe=i.filter(zc),oe=xe.filter(N=>{var V;return(V=N.input_modalities)==null?void 0:V.includes("image")}),Oe=re.images.length>0,Le=Oe?oe:xe,[me,De]=w.useState(s.model),tt=Le.some(N=>N.id===me)?me:((Ke=Le[0])==null?void 0:Ke.id)??"",L=RT(u),je=u.nodes.find(N=>N.id===D)??null,be=u.edges.find(N=>N.id===ue)??null;function Be(N){u.nodes.length&&JSON.stringify(u)!==Z.current&&_c("canvas",h,u.title,u).catch(()=>{}),g({model:u,id:h}),j(N,_o(),!1)}const Me=(N,V)=>d(ge=>({...ge,nodes:ge.nodes.map(Se=>Se.id===N?{...Se,...V}:Se)})),ie=(N,V,ge)=>d(Se=>({...Se,nodes:Se.nodes.map(Je=>Je.id===N?{...Je,findings:Je.findings.map(ut=>ut.id===V?{...ut,...ge}:ut)}:Je)}));function ke(){const N=`component-${Date.now().toString(36)}`;d(V=>Qs({...V,nodes:[...V.nodes,{id:N,label:"New component",kind:"service",details:[],inScope:!0,tested:!1,findings:[]}]})),F(N)}function Te(N){d(V=>({...V,nodes:V.nodes.filter(ge=>ge.id!==N),edges:V.edges.filter(ge=>ge.from!==N&&ge.to!==N)})),F(null)}const He=(N,V)=>d(ge=>({...ge,edges:ge.edges.map(Se=>Se.id===N?{...Se,...V}:Se)})),q=(N,V,ge)=>d(Se=>({...Se,edges:Se.edges.map(Je=>Je.id===N?{...Je,findings:Je.findings.map(ut=>ut.id===V?{...ut,...ge}:ut)}:Je)}));function ze(N,V,ge){const Se=`e-${Date.now().toString(36)}`;d(Je=>({...Je,edges:[...Je.edges,{id:Se,from:N,to:V,kind:ge,findings:[]}]})),F(null),he(Se)}function $e(N){d(V=>({...V,edges:V.edges.filter(ge=>ge.id!==N)})),he(null)}function yt(N,V){N.stopPropagation(),F(null),he(V)}function Ye(){var ge;if(ve||!K.trim()&&!re.images.length&&!re.docs.length||re.reading||!tt)return;Ce(!0),ee(null);const N=new AbortController;ct.current=N;let V="";nh({model:tt,messages:[{role:"system",content:HT},{role:"user",content:Mh($T(K,re.images.length>0||re.docs.length>0),re.images,re.docs)}],temperature:.2,max_tokens:LT(s.maxTokens,re.docs.length>0,(ge=xe.find(Se=>Se.id===tt))==null?void 0:ge.max_output_length),reasoning_effort:ah(s.reasoningEffort,xe.find(Se=>Se.id===tt)),stream:!0},{signal:N.signal,onDelta:Se=>{V+=Se},onError:Se=>ee(Se),onDone:Se=>{if(!V.trim()){ee(Se==="length"?"The model used its whole output limit thinking and wrote no threat model. Try again, raise Max tokens, or pick a faster model.":"The model returned no answer. Try again or pick another model.");return}try{const Je=Qs(To(NT(V)));if(!Je.nodes.length)throw new Error("The model returned no components.");Be(Je),ye(""),re.clear()}catch(Je){ee(Se==="length"?"The model ran out of output tokens before finishing the threat model. Raise Max tokens or ask for fewer components.":`Couldn't read the model's threat model: ${Je.message}`)}}}).catch(Se=>{(Se==null?void 0:Se.name)!=="AbortError"&&ee(String((Se==null?void 0:Se.message)??Se))}).finally(()=>{Ce(!1),ct.current=null})}async function pt(N){try{Be(Qs(To(JSON.parse(await N.text()))))}catch(V){ee(`Import failed: ${V.message}`)}}const Ve=u.title.replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-|-$/g,"")||"threat-model",[Vt,Bn]=w.useState(!1),[Ea,Cn]=w.useState(!1);w.useEffect(()=>{R0().then(Bn)},[]);async function Mn(){Cn(!0);const N=await O0(DT(u));Cn(!1),N.ok?Tc(`${Ve}.drawio.svg`,N.r.svg,"image/svg+xml"):x({ok:!1,text:`draw.io export failed: ${N.error}`})}function gn(){const N=qe.current;if(!N)return;const V=N.cloneNode(!0);V.setAttribute("xmlns","http://www.w3.org/2000/svg"),V.removeAttribute("class"),V.removeAttribute("style"),V.setAttribute("viewBox",`${tn.x} ${tn.y} ${tn.w} ${tn.h}`),V.setAttribute("width",String(Math.round(tn.w))),V.setAttribute("height",String(Math.round(tn.h))),Tc(`${Ve}.svg`,new XMLSerializer().serializeToString(V),"image/svg+xml")}const[ma,Hn]=w.useState(null),tn=w.useMemo(()=>{if(!u.nodes.length)return{x:0,y:0,w:900,h:520};const N=u.nodes.map(Je=>Je.x??0),V=u.nodes.map(Je=>Je.y??0),ge=Math.min(...N)-40,Se=Math.min(...V)-40;return{x:ge,y:Se,w:Math.max(900,Math.max(...N)+ea+40-ge),h:Math.max(520,Math.max(...V)+ds+40-Se)}},[u.nodes]),vt=ma??tn,ta=Math.round(tn.w/vt.w*100),Sn=w.useRef(tn);Sn.current=tn;function wn(N,V,ge){Hn(Se=>{const Je=Sn.current,ut=Se??Je,at=Math.min(Je.w*4,Math.max(Je.w/4,ut.w/N)),jt=ut.w/at,st=V??ut.x+ut.w/2,Bt=ge??ut.y+ut.h/2;return{x:st-(st-ut.x)/jt,y:Bt-(Bt-ut.y)/jt,w:at,h:ut.h/jt}})}function An(N,V){const ge=new DOMPoint(N,V).matrixTransform(qe.current.getScreenCTM().inverse());return{x:ge.x,y:ge.y}}const pa=u.nodes.length>0;w.useEffect(()=>{const N=qe.current;if(!N)return;const V=ge=>{ge.preventDefault();const Se=An(ge.clientX,ge.clientY);wn(ge.deltaY<0?1.15:1/1.15,Se.x,Se.y)};return N.addEventListener("wheel",V,{passive:!1}),()=>N.removeEventListener("wheel",V)},[pa]);const na=w.useRef(null),Ca=w.useRef(null),[ga,yn]=w.useState(!1);function Lt(N,V){var Se;N.stopPropagation(),Hn(vt);const ge=An(N.clientX,N.clientY);na.current={id:V.id,dx:ge.x-(V.x??0),dy:ge.y-(V.y??0)},(Se=qe.current)==null||Se.setPointerCapture(N.pointerId),F(V.id),he(null)}function M(N){var ge;const V=qe.current.getBoundingClientRect();Ca.current={cx:N.clientX,cy:N.clientY,start:vt,scale:Math.max(vt.w/V.width,vt.h/V.height)},(ge=qe.current)==null||ge.setPointerCapture(N.pointerId),yn(!0)}function le(N){const V=na.current;if(V){const Se=An(N.clientX,N.clientY);Me(V.id,{x:Math.round(Se.x-V.dx),y:Math.round(Se.y-V.dy)});return}const ge=Ca.current;ge&&Hn({...ge.start,x:ge.start.x-(N.clientX-ge.cx)*ge.scale,y:ge.start.y-(N.clientY-ge.cy)*ge.scale})}function pe(){na.current=null,Ca.current=null,yn(!1)}const Re=new Map(u.nodes.map(N=>[N.id,N]));return l.jsxs("main",{className:"main",children:[l.jsxs(Ho,{title:`bugxhunter@playground: ~/canvas: ${QT(u.title,40)}`,children:[l.jsxs("span",{className:"status-pill",children:[l.jsx("span",{className:"dot"}),L.components," components · ",L.tested,"/",L.inScope," tested · ",L.open.critical+L.open.high," crit/high open"]}),l.jsx("button",{className:"btn ghost sm",onClick:ke,children:"+ component"}),l.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,title:"Lay the canvas out again, left to right along its flows (undo puts it back)",onClick:()=>{g({model:u,id:h}),d(MT(u)),Hn(null)},children:"tidy"}),l.jsx("button",{className:"btn ghost sm",onClick:()=>{var N;return(N=Ae.current)==null?void 0:N.click()},children:"import"}),l.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Tc(`${Ve}.json`,JSON.stringify(u,null,2),"application/json"),children:"json"}),l.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Tc(`${Ve}-findings.md`,OT(u),"text/markdown"),children:"findings.md"}),l.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:gn,children:"svg"}),Vt&&l.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length||Ea,onClick:Mn,title:"An editable diagram: opens in draw.io and its VS Code extension",children:Ea?"draw.io…":"draw.io"}),y&&l.jsx("button",{className:"btn ghost sm",onClick:()=>{j(y.model,y.id,!1),g(null)},children:"undo"}),l.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Be(wc()),children:"clear"}),l.jsx("button",{className:"btn ghost sm",onClick:()=>{var N;(N=ct.current)==null||N.abort(),c()},children:"back to chat"}),l.jsx("input",{ref:Ae,type:"file",accept:"application/json,.json",hidden:!0,onChange:N=>{var ge;const V=(ge=N.target.files)==null?void 0:ge[0];V&&pt(V),N.target.value=""}})]}),l.jsxs("div",{className:"canvas-wrap"+(J?" full":""),ref:$,children:[l.jsxs("div",{className:"canvas-stage grid-bg",onPointerDown:()=>{F(null),he(null)},children:[(pa||J)&&l.jsx("button",{className:"canvas-full-btn"+(J?" on":""),onPointerDown:N=>N.stopPropagation(),onClick:()=>se(N=>!N),"aria-pressed":J,title:J?"Exit full screen (Esc)":"Full screen","aria-label":J?"Exit full screen":"Full screen",children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:J?l.jsx("path",{d:"M6 2v4H2M10 2v4h4M6 14v-4H2M10 14v-4h4"}):l.jsx("path",{d:"M2 6V2h4M14 6V2h-4M2 10v4h4M14 10v4h-4"})})}),J&&(ve||W)&&l.jsxs("div",{className:"canvas-full-status"+(W&&!ve?" failed":""),role:"status",onPointerDown:N=>N.stopPropagation(),children:[ve?"Building the threat model…":W,ve&&l.jsx("button",{className:"btn ghost mini",onClick:()=>{var N;return(N=ct.current)==null?void 0:N.abort()},children:"stop"})]}),pa&&l.jsxs("div",{className:"canvas-zoom",onPointerDown:N=>N.stopPropagation(),children:[l.jsx("button",{onClick:()=>wn(1/1.25),title:"Zoom out","aria-label":"Zoom out",children:"−"}),l.jsxs("span",{title:"Zoom (100% = fit)",children:[ta,"%"]}),l.jsx("button",{onClick:()=>wn(1.25),title:"Zoom in","aria-label":"Zoom in",children:"+"}),l.jsx("button",{onClick:()=>Hn(null),title:"Fit the whole model",children:"fit"})]}),u.nodes.length?l.jsxs("svg",{ref:qe,className:"canvas-svg",viewBox:`${vt.x} ${vt.y} ${vt.w} ${vt.h}`,preserveAspectRatio:"xMidYMin meet",onPointerMove:le,onPointerUp:pe,onPointerCancel:pe,style:{cursor:ga?"grabbing":void 0},children:[l.jsxs("defs",{children:[[...ki.map(N=>[`tm-arrow-${N}`,xi[N]]),["tm-arrow-plain",Wf],["tm-arrow-sel","#ffffff"]].map(([N,V])=>l.jsx("marker",{id:N,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:l.jsx("path",{d:"M0,0 L10,5 L0,10 z",fill:V})},N)),l.jsx("clipPath",{id:"tm-card-clip",children:l.jsx("rect",{width:ea,height:ds,rx:10})})]}),l.jsx("rect",{x:"-100000",y:"-100000",width:"200000",height:"200000",fill:"#0a0e14",style:{cursor:ga?"grabbing":"grab"},onPointerDown:M}),u.edges.map(N=>{var zt;const V=Re.get(N.from),ge=Re.get(N.to);if(!V||!ge)return null;const{d:Se,ax:Je,ay:ut,ex:at,ey:jt}=YT(V,ge),st=VT(N),Bt=ue===N.id,$n=(Je+at)/2,Qa=(ut+jt)/2,Ma=[N.label,st.plain&&!/plain/i.test(N.label??"")?"(plaintext)":"",N.implied?"(implied)":""].filter(Boolean).join(" "),Ps=Math.min(240,Math.max(70,Math.hypot(at-Je,jt-ut)-24)),_a=Ma?kc(Ma,Ps,Mv):"",ps=_a?Pf(_a,Mv)+10:0,Cl=Cv(N),Gt=((zt=N.findings)==null?void 0:zt.filter(Ut=>Ut.status==="open").length)??0;return l.jsxs("g",{opacity:st.opacity,style:{cursor:"pointer"},onPointerDown:Ut=>yt(Ut,N.id),children:[l.jsx("title",{children:`${Io[N.kind??"data"]} flow${N.implied?" (implied)":""}${Ma?`: ${Ma}`:""}`}),l.jsx("path",{d:Se,fill:"none",stroke:"transparent",strokeWidth:14}),l.jsx("path",{d:Se,fill:"none",stroke:Bt?"#ffffff":st.color,strokeWidth:Bt?3:2,strokeDasharray:st.dash,markerEnd:`url(#${Bt?"tm-arrow-sel":st.marker})`}),N.kind==="blocked"&&l.jsxs("g",{transform:`translate(${$n},${Qa})`,children:[l.jsx("circle",{r:8,fill:"#0a0e14",stroke:xi.blocked,strokeWidth:2}),l.jsx("line",{x1:-5,y1:5,x2:5,y2:-5,stroke:xi.blocked,strokeWidth:2})]}),_a&&l.jsxs("g",{transform:`translate(${$n},${Qa-(N.kind==="blocked"?18:10)})`,children:[l.jsx("rect",{x:-ps/2,y:-9,width:ps,height:15,rx:4,fill:"#0a0e14",opacity:.85}),l.jsx("text",{y:2,fill:st.plain?"#ff8080":st.color,fontSize:11,fontFamily:"JetBrains Mono, monospace",textAnchor:"middle",children:_a})]}),Gt>0&&l.jsxs("g",{transform:`translate(${$n+ps/2+4},${Qa-20})`,children:[l.jsx("rect",{width:20,height:16,rx:8,fill:Ro[Cl??"low"]}),l.jsx("text",{x:10,y:12,fill:"#0a0e14",fontSize:10,fontWeight:700,textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",children:Gt})]})]},N.id)}),u.nodes.map(N=>{const V=Cv(N),ge=N.findings.filter(jt=>jt.status==="open").length,Se=N.x??0,Je=N.y??0,ut=ea-16-12,at=`${N.kind.toUpperCase()}${N.inScope?"":" · OUT OF SCOPE"}${N.tested?" · TESTED ✓":""}`;return l.jsxs("g",{transform:`translate(${Se},${Je})`,opacity:N.inScope?1:.45,style:{cursor:"grab"},onPointerDown:jt=>Lt(jt,N),children:[l.jsx("title",{children:[N.label,...N.details].join(`
296
+ `)}),l.jsx("rect",{width:ea,height:ds,rx:10,fill:"#161b22",stroke:D===N.id?"#ffffff":Ov[N.kind],strokeWidth:D===N.id?2.5:1.5,strokeDasharray:N.inScope?void 0:"5 4"}),l.jsxs("g",{clipPath:"url(#tm-card-clip)",children:[V&&l.jsx("rect",{width:6,height:ds,fill:Ro[V]}),l.jsx("text",{x:16,y:22,fill:"#e6edf3",fontSize:14,fontWeight:700,fontFamily:"Inter, system-ui, sans-serif",children:kc(N.label,ut-(ge>0?30:0),UT)}),l.jsx("text",{x:16,y:40,fill:Ov[N.kind],fontSize:10,fontFamily:"JetBrains Mono, monospace",children:kc(at,ut,IT)}),N.details.slice(0,2).map((jt,st)=>l.jsx("text",{x:16,y:58+st*14,fill:"#8b949e",fontSize:11,fontFamily:"Inter, system-ui, sans-serif",children:kc(jt,ut,BT)},st))]}),ge>0&&l.jsxs("g",{transform:`translate(${ea-30},8)`,children:[l.jsx("rect",{width:22,height:18,rx:9,fill:Ro[V??"low"]}),l.jsx("text",{x:11,y:13,fill:"#0a0e14",fontSize:11,fontWeight:700,textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",children:ge})]})]},N.id)})]}):l.jsx("div",{className:"empty-state center",children:l.jsxs("p",{className:"muted mono",children:["No threat model yet. Attach an architecture diagram or describe the system below, then ",l.jsx("b",{children:"build"}),". Or add components by hand, or import a saved model."]})}),C.collapsed&&l.jsx("button",{className:"sidebar-toggle floating canvas-panel-show",onPointerDown:N=>N.stopPropagation(),onClick:()=>Y(N=>({...N,collapsed:!1})),title:"Show panel","aria-label":"Show panel",children:"«"})]}),!C.collapsed&&l.jsx("div",{className:"splitter canvas-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",title:"Drag to resize · double-click to reset",onPointerDown:Q,onDoubleClick:()=>Y(N=>({...N,width:U0}))}),l.jsxs("aside",{className:"canvas-panel",hidden:C.collapsed,style:{width:C.width},children:[l.jsxs("div",{className:"canvas-panel-head",children:[l.jsx("span",{className:"section-title",children:je?"Component":be?"Flow":"Canvas"}),l.jsx("button",{className:"sidebar-toggle",onClick:()=>Y(N=>({...N,collapsed:!0})),title:"Hide panel","aria-label":"Hide panel",children:"»"})]}),je?l.jsx(PT,{node:je,others:u.nodes.filter(N=>N.id!==je.id),onChange:N=>Me(je.id,N),onFinding:(N,V)=>ie(je.id,N,V),onAddFinding:N=>Me(je.id,{findings:[...je.findings,N]}),onRemoveFinding:N=>Me(je.id,{findings:je.findings.filter(V=>V.id!==N)}),onAddFlow:(N,V)=>ze(je.id,N,V),onDelete:()=>Te(je.id)}):be?l.jsx(FT,{edge:be,fromLabel:((We=Re.get(be.from))==null?void 0:We.label)??be.from,toLabel:((ht=Re.get(be.to))==null?void 0:ht.label)??be.to,onChange:N=>He(be.id,N),onFinding:(N,V)=>q(be.id,N,V),onAddFinding:N=>He(be.id,{findings:[...be.findings,N]}),onRemoveFinding:N=>He(be.id,{findings:be.findings.filter(V=>V.id!==N)}),onDelete:()=>$e(be.id)}):l.jsxs("div",{className:"canvas-summary",children:[l.jsx("label",{children:"Title"}),l.jsx("input",{type:"text",value:u.title,onChange:N=>d(V=>({...V,title:N.target.value}))}),l.jsx("div",{className:"section-title",children:"Summary"}),l.jsxs("ul",{className:"canvas-stats",children:[l.jsxs("li",{children:[L.components," components, ",L.inScope," in scope"]}),l.jsxs("li",{children:["Coverage: ",L.tested,"/",L.inScope," tested"]}),Jf.map(N=>l.jsxs("li",{children:[l.jsx("span",{className:"sev-dot",style:{background:Ro[N]}}),L.open[N]," ",N," open"]},N)),l.jsxs("li",{children:[L.fixed," fixed or verified"]}),l.jsxs("li",{children:[L.flows," flow",L.flows===1?"":"s",": ",L.plaintextFlows," plaintext, ",L.impliedFlows," implied, ",L.blockedFlows," blocked"]})]}),l.jsx("div",{className:"section-title",children:"Flows"}),l.jsxs("ul",{className:"canvas-legend",children:[ki.map(N=>l.jsxs("li",{children:[l.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:l.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:xi[N],strokeWidth:"2",strokeDasharray:N==="blocked"?"2 5":void 0})}),Io[N]," ",l.jsxs("span",{className:"muted",children:["(",L.byKind[N],")"]})]},N)),l.jsxs("li",{children:[l.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:l.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:Wf,strokeWidth:"2",strokeDasharray:"7 5"})}),"Plaintext (any type)"]}),l.jsxs("li",{children:[l.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:l.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:xi.data,strokeWidth:"2",strokeDasharray:"4 4",opacity:"0.6"})}),"Implied: not drawn in the source"]})]}),l.jsx("p",{className:"hint",children:"Click a component or a flow to edit it and track its findings. Drag components to rearrange."}),l.jsx("div",{className:"section-title",children:"Saved canvases"}),b&&l.jsx("div",{className:"hint",style:{color:b.ok?"var(--muted)":"var(--amber)"},children:b.text}),l.jsx("button",{className:"btn ghost sm block",onClick:()=>Be(wc()),disabled:!u.nodes.length,children:"+ New canvas"}),l.jsx(ZT,{list:S,activeId:h,onOpen:N=>void ae(N),onDelete:N=>void Ne(N)})]})]})]}),I?l.jsxs("div",{className:"composer canvas-box-collapsed",children:[l.jsxs("button",{className:"canvas-box-toggle",onClick:()=>X(!1),title:"Show the build box","aria-label":"Show the build box","aria-expanded":!1,children:[l.jsx("span",{"aria-hidden":!0,children:"▴"})," build box"]}),ve?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hint",children:"Building the threat model…"}),l.jsx("button",{className:"btn ghost mini",onClick:()=>{var N;return(N=ct.current)==null?void 0:N.abort()},children:"stop"})]}):W||re.attachError?l.jsx("span",{className:"hint",style:{color:"var(--amber)"},children:W??re.attachError}):null]}):l.jsxs("div",{className:"composer",children:[l.jsxs("div",{className:"composer-box canvas-build-box",onDragOver:N=>N.preventDefault(),onDrop:re.onDrop,children:[l.jsx("button",{className:"sidebar-toggle canvas-box-hide",onClick:()=>X(!0),title:"Hide the build box","aria-label":"Hide the build box","aria-expanded":!0,children:"▾"}),l.jsx(xh,{images:re.images,docs:re.docs,reading:re.reading,onRemove:re.remove,onRemoveDoc:re.removeDoc}),l.jsx("textarea",{value:K,onChange:N=>ye(N.target.value),onPaste:re.onPaste,rows:2,placeholder:"Attach an architecture diagram or a .md / .txt description, or describe the system (components, data stores, flows)…"}),l.jsxs("div",{className:"composer-bar",children:[l.jsx("input",{ref:P,type:"file",accept:vh,multiple:!0,hidden:!0,onChange:N=>{N.target.files&&re.addImages(N.target.files),N.target.value=""}}),l.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var N;return(N=P.current)==null?void 0:N.click()},disabled:ve,title:"Attach a diagram or a Markdown / text file (or paste / drop it)","aria-label":"Attach a diagram or text file",children:l.jsx(Qc,{})}),l.jsxs("select",{className:"canvas-builder",value:tt,onChange:N=>De(N.target.value),disabled:ve,"aria-label":"Model that builds the threat model",children:[!Le.length&&l.jsx("option",{value:"",children:Oe?"No vision model available":"No models"}),Le.map(N=>{var V;return l.jsxs("option",{value:N.id,children:[N.name,(V=N.input_modalities)!=null&&V.includes("image")?" · vision":""]},N.id)})]}),(W||re.attachError)&&l.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:W??re.attachError}),l.jsx("div",{className:"spacer"}),ve?l.jsx("button",{className:"send-btn stop",onClick:()=>{var N;return(N=ct.current)==null?void 0:N.abort()},title:"Stop",children:"■"}):l.jsx("button",{className:"btn primary sm",onClick:Ye,disabled:!K.trim()&&!re.images.length&&!re.docs.length||re.reading||!tt,children:u.nodes.length?"rebuild":"build"})]})]}),l.jsx("div",{className:"composer-hint",children:ve?"Building the threat model… (reasoning models can take several minutes on a big diagram)":"Each build starts a new saved canvas; undo brings the previous one back. Saved on the runner, encrypted with your vault."})]})]})}function ZT({list:s,activeId:i,onOpen:c,onDelete:u}){const[d,h]=w.useState(null);return w.useEffect(()=>{if(!d)return;const m=setTimeout(()=>h(null),3e3);return()=>clearTimeout(m)},[d]),s.length?l.jsx("div",{className:"session-list",children:s.map(m=>l.jsxs("div",{className:"session-item"+(m.id===i?" on":""),children:[l.jsxs("button",{className:"session-open",onClick:()=>c(m.id),title:m.title,children:[l.jsx("span",{className:"session-title",children:m.title||"Untitled threat model"}),l.jsx("span",{className:"session-meta",children:new Date(m.updatedAt).toLocaleString()})]}),l.jsx("button",{className:"session-del"+(d===m.id?" confirm":""),onClick:()=>{if(d!==m.id)return h(m.id);h(null),u(m.id)},title:d===m.id?"Click again to delete":"Delete canvas","aria-label":d===m.id?"Confirm delete":"Delete canvas",children:d===m.id?"Delete?":"✕"})]},m.id))}):l.jsx("div",{className:"hint",children:"No saved canvases yet. Build one and it saves itself."})}function H0({ownerId:s,findings:i,onFinding:c,onAddFinding:u,onRemoveFinding:d}){const[h,m]=w.useState(""),[y,g]=w.useState("medium");return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"section-title",children:["Findings (",i.length,")"]}),i.map(S=>l.jsxs("div",{className:"canvas-finding",children:[l.jsxs("div",{className:"cf-head",children:[l.jsx("span",{className:"sev-pill",style:{background:Ro[S.severity]},children:S.severity}),l.jsx("span",{className:"cf-title",children:S.title}),l.jsx("button",{className:"attach-x",onClick:()=>d(S.id),"aria-label":"Remove finding",children:"✕"})]}),S.fix&&l.jsxs("div",{className:"cf-fix",children:["Fix: ",S.fix]}),S.ref&&l.jsx("div",{className:"cf-ref",children:S.ref}),l.jsxs("div",{className:"cf-controls",children:[l.jsx("select",{value:S.severity,onChange:v=>c(S.id,{severity:v.target.value}),"aria-label":"Severity",children:Jf.map(v=>l.jsx("option",{value:v,children:v},v))}),l.jsxs("select",{value:S.status,onChange:v=>c(S.id,{status:v.target.value}),"aria-label":"Status",children:[l.jsx("option",{value:"open",children:"open"}),l.jsx("option",{value:"fixed",children:"fixed"}),l.jsx("option",{value:"verified",children:"verified (retested)"})]})]})]},S.id)),l.jsxs("div",{className:"cf-add",children:[l.jsx("input",{type:"text",placeholder:"Add a finding…",value:h,onChange:S=>m(S.target.value)}),l.jsx("select",{value:y,onChange:S=>g(S.target.value),children:Jf.map(S=>l.jsx("option",{value:S,children:S},S))}),l.jsx("button",{className:"btn mini",disabled:!h.trim(),onClick:()=>{u({id:`${s}-f${Date.now().toString(36)}`,title:h.trim(),severity:y,status:"open"}),m("")},children:"add"})]})]})}function PT({node:s,others:i,onChange:c,onFinding:u,onAddFinding:d,onRemoveFinding:h,onAddFlow:m,onDelete:y}){const[g,S]=w.useState(""),[v,b]=w.useState("data");return l.jsxs("div",{className:"canvas-inspector",children:[l.jsx("label",{children:"Component"}),l.jsx("input",{type:"text",value:s.label,onChange:x=>c({label:x.target.value})}),l.jsx("label",{children:"Kind"}),l.jsx("select",{value:s.kind,onChange:x=>c({kind:x.target.value}),children:XT.map(x=>l.jsx("option",{value:x,children:x},x))}),l.jsxs("label",{className:"check",children:[l.jsx("input",{type:"checkbox",checked:s.inScope,onChange:x=>c({inScope:x.target.checked})})," In scope"]}),l.jsxs("label",{className:"check",children:[l.jsx("input",{type:"checkbox",checked:s.tested,onChange:x=>c({tested:x.target.checked})})," Tested"]}),s.details.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"section-title",children:"Details"}),l.jsx("ul",{className:"canvas-details",children:s.details.map((x,T)=>l.jsx("li",{children:x},T))})]}),l.jsx(H0,{ownerId:s.id,findings:s.findings,onFinding:u,onAddFinding:d,onRemoveFinding:h}),i.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"section-title",children:"Add a flow from here"}),l.jsxs("div",{className:"cf-add",children:[l.jsxs("select",{value:g,onChange:x=>S(x.target.value),"aria-label":"Flow goes to",children:[l.jsx("option",{value:"",children:"to…"}),i.map(x=>l.jsx("option",{value:x.id,children:x.label},x.id))]}),l.jsx("select",{value:v,onChange:x=>b(x.target.value),"aria-label":"Flow type",children:ki.map(x=>l.jsx("option",{value:x,children:Io[x]},x))}),l.jsx("button",{className:"btn mini",disabled:!g,onClick:()=>{m(g,v),S("")},children:"add"})]})]}),l.jsx("button",{className:"btn danger-outline sm",style:{marginTop:14},onClick:y,children:"delete component"})]})}function FT({edge:s,fromLabel:i,toLabel:c,onChange:u,onFinding:d,onAddFinding:h,onRemoveFinding:m,onDelete:y}){const g=s.encrypted===!0?"yes":s.encrypted===!1?"no":"unknown";return l.jsxs("div",{className:"canvas-inspector",children:[l.jsx("label",{children:"Flow"}),l.jsxs("div",{className:"cf-route",title:`${i} → ${c}`,children:[i," ",l.jsx("span",{className:"muted",children:"→"})," ",c]}),l.jsx("label",{children:"Label"}),l.jsx("input",{type:"text",value:s.label??"",placeholder:"what it carries",onChange:S=>u({label:S.target.value||void 0})}),l.jsx("label",{children:"Type"}),l.jsx("select",{value:s.kind??"data",onChange:S=>u({kind:S.target.value}),children:ki.map(S=>l.jsx("option",{value:S,children:Io[S]},S))}),l.jsx("label",{children:"Encrypted"}),l.jsxs("select",{value:g,onChange:S=>u({encrypted:S.target.value==="yes"?!0:S.target.value==="no"?!1:void 0}),children:[l.jsx("option",{value:"unknown",children:"not stated"}),l.jsx("option",{value:"yes",children:"yes"}),l.jsx("option",{value:"no",children:"no (plaintext)"})]}),l.jsx("label",{children:"Protocol"}),l.jsx("input",{type:"text",value:s.protocol??"",placeholder:"not stated",onChange:S=>u({protocol:S.target.value||void 0})}),l.jsx("label",{children:"Authentication"}),l.jsx("input",{type:"text",value:s.auth??"",placeholder:"not stated",onChange:S=>u({auth:S.target.value||void 0})}),l.jsxs("label",{className:"check",title:"Not drawn in the source, but implied by its labels",children:[l.jsx("input",{type:"checkbox",checked:s.implied===!0,onChange:S=>u({implied:S.target.checked||void 0})})," Implied (not drawn in the source)"]}),l.jsx(H0,{ownerId:s.id,findings:s.findings??[],onFinding:d,onAddFinding:h,onRemoveFinding:m}),l.jsx("button",{className:"btn danger-outline sm",style:{marginTop:14},onClick:y,children:"delete flow"})]})}function JT(s){return s.split(/[\r\n,]+/).map(i=>i.trim()).filter(Boolean)}function WT(s){const i=(...u)=>s.workers.filter(d=>u.includes(d.status)).length,c=[[i("starting","running"),"running"],[i("queued"),"queued"],[i("finished"),"finished"],[i("failed"),"failed"],[i("skipped"),"skipped"]];return`${s.workers.length} target${s.workers.length===1?"":"s"}: ${c.filter(([u])=>u>0).map(([u,d])=>`${u} ${d}`).join(", ")}`}function ej(s){var i;return s.status==="failed"?`could not start: ${s.reason??"unknown reason"}`:s.status==="skipped"?`not started: ${s.reason??"skipped"}`:s.status==="finished"&&((i=s.recon)!=null&&i.stopped)?`ended: ${s.recon.stopped}`:null}function tj(s){switch(s){case"quoted":return{text:"evidence matched",kind:"ok",title:"Every excerpt the verifier quoted was found in what this run's commands returned."};case"unmatched":return{text:"evidence not matched",kind:"warn",title:"The verifier quoted text that this run's commands did not return: it was paraphrased, or made up. Check the reproduction yourself."};case"unquoted":return{text:"no quotes",kind:"none",title:"The verifier quoted nothing that could be checked against this run's output."};default:return null}}function nj(s){const i=s??[],c=i.filter(u=>u.status==="open").length;return{open:c,closed:i.length-c}}const $0={"still-reproducible":"still reproducible",fixed:"fixed","cannot-confirm":"could not be confirmed"};function aj(s){const i=s??[];return i.length?["still-reproducible","fixed","cannot-confirm"].map(c=>[i.filter(u=>u.result===c).length,$0[c]]).filter(([c])=>c>0).map(([c,u])=>`${c} ${u}`).join(", "):"nothing retested yet"}function sj(s){return s.mode==="retest"&&s.stopped==="done"?"every remembered finding was retested":null}const zo=(s,i)=>`${s} ${i}${s===1?"":"s"}`,lj=s=>new Date(s).toISOString().slice(0,10);function q0(s){const i=[zo(s.runs,"earlier run"),zo(s.findings,"finding")];return s.paths&&i.push(zo(s.paths,"attack path")),`${i.join(", ")} (last ${lj(s.lastRun)})`}const eh=s=>new Date(s).toISOString().slice(0,16).replace("T"," ")+" UTC";function ij(s,i=Date.now()){const c=[zo(s.cookies,"cookie")];s.authorization&&c.push("the Authorization header");const u=s.firstExpiry===void 0?"":s.firstExpiry<=i?"; a cookie has expired, capture it again":`; first cookie expires ${eh(s.firstExpiry)}`;return`captured ${eh(s.capturedAt)}: ${c.join(" and ")}${u}`}function G0(s){if(!s.session)return null;const i=[zo(s.session.cookies,"cookie")];return s.session.authorization&&i.push("the Authorization header"),`Tested with a logged-in session (${i.join(" and ")}, captured ${eh(s.session.capturedAt)}).`}function oj(s){return s.memory?`Started from ${q0(s.memory)} on this target. Only what was reproduced in this run is listed here.`:null}function X0(s){return s.status!=="finished"?null:s.kept==="pending"?"Not saved yet: the vault is locked. Unlock it and this run is kept for the next one on this target.":s.kept==="off"?"Not kept for later runs: that needs the vault (sidebar → keys).":null}function Y0(s){const i=s??[];return{demonstrated:i.filter(c=>c.status==="demonstrated"),partial:i.filter(c=>c.status==="partial")}}function rj(s,i){if(!s)return[];const{demonstrated:c,partial:u}=Y0(i);return[...c,...u].filter(d=>d.links.includes(s)).map(d=>d.id).filter(d=>!!d)}function cj(s){var c;const i=((c=s.blockedWhy)==null?void 0:c.trim())||"not shown";return s.blockedAt?`Stopped at step ${s.blockedAt}: ${i}`:`Not shown: ${i}`}function V0(s){const i=s.status==="running";if(i&&s.phase==="chains")return`chaining findings · turn ${(s.chainRounds??0)+1}`;const c=`round ${i?s.rounds+1:s.rounds}/${s.maxRounds}`;return!i&&s.chainRounds?`${c} · ${s.chainRounds} chaining`:c}function uj(s){var c,u,d;if(s.status!=="finished")return null;const i=(c=s.chains)!=null&&c.length?"No further attack paths were looked for":"Attack paths were not looked for";switch(s.chainPass){case"ran":return(u=s.chains)!=null&&u.length?null:"No attack path was recorded.";case"off":return`${i}: the chain pass was turned off for this run.`;case"skipped":return`${i}: the run ended before the chain pass.`;case"few-findings":return`${i}: it takes at least two findings to combine.`;case"budget":return`${i}: the token budget was spent.`;case"no-paths":return(d=s.chains)!=null&&d.length?"The findings were reviewed for further attack paths and no other combination was proposed.":"The findings were reviewed for attack paths and no combination was proposed.";case"rate-limited":return"The chain pass stopped: every model was rate-limited.";case"error":return"The chain pass stopped early. What it had recorded is shown.";default:return null}}const dj={done:"the executor reported the in-scope surface exhausted",idle:"a round found nothing new",budget:"the token budget is spent",rounds:"the round limit was reached",stuck:"the executor stayed stuck, even after escalating","rate-limited":"every model is rate-limited",error:"a round failed",aborted:"stopped by you"};function fj({onStart:s,onClose:i}){const[c,u]=w.useState(""),[d,h]=w.useState("Map the attack surface and test access control, authentication and injection, one hypothesis at a time."),[m,y]=w.useState("staging"),[g,S]=w.useState(""),[v,b]=w.useState(""),[x,T]=w.useState(!1),[z,Z]=w.useState(!0),[D,F]=w.useState(null),[ue,he]=w.useState(!0),[C,Y]=w.useState(!1),[I,X]=w.useState(null),[J,se]=w.useState(!0),[$,Q]=w.useState(null),[K,ye]=w.useState(3),[ve,Ce]=w.useState(""),[W,ee]=w.useState(!1),[re,P]=w.useState(null),Ae=JT(c),qe=Ae.length>1,ct=Ae.length===1?Ae[0]:"";w.useEffect(()=>{const oe=ct;if(F(null),!oe)return;let Oe=!0;const Le=setTimeout(()=>{hw(oe).then(me=>{Oe&&F(me)}).catch(()=>{})},400);return()=>{Oe=!1,clearTimeout(Le)}},[ct]),w.useEffect(()=>{const oe=ct;if(X(null),Q(null),!oe)return;let Oe=!0;const Le=setTimeout(()=>{Vy(oe).then(me=>{Oe&&X(me)}).catch(()=>{})},400);return()=>{Oe=!1,clearTimeout(Le)}},[ct]),w.useEffect(()=>{if(!$)return;const oe=c.trim(),Oe=(I==null?void 0:I.capturedAt)??0,Le=setInterval(()=>{if(Date.now()>$.expiresAt)return Q(null);Vy(oe).then(me=>{me&&me.capturedAt>Oe&&(X(me),se(!0),Q(null))}).catch(()=>{})},2500);return()=>clearInterval(Le)},[$]);async function gt(){P(null);try{Q(await fw(c.trim()))}catch(oe){P(oe.message)}}async function j(){P(null);try{await dw(c.trim()),X(null)}catch(oe){P(oe.message)}}async function ae(){if(D){P(null);try{await mw(c.trim()),F(null)}catch(oe){P(oe.message)}}}const Ne=c.trim()&&d.trim()&&g.trim()&&x&&!W;async function xe(){ee(!0),P(null);try{const oe=v.split(",").map(Oe=>Oe.trim()).filter(Boolean);await s({scope:Ae[0]??"",objective:d.trim(),...qe?{targets:Ae,maxWorkers:K,...Number(ve)>0?{totalBudgetTokens:Math.floor(Number(ve))}:{}}:{},env:{kind:m,divergences:g.trim(),...oe.length?{nonProdSettings:oe}:{}},chainPass:{enabled:z},useMemory:qe||!!D&&ue,useSession:qe||!!I&&J,...!qe&&C&&(D!=null&&D.findings)?{mode:"retest"}:{}}),i()}catch(oe){P(oe.message),ee(!1)}}return l.jsxs(jl,{title:"recon --supervised",onClose:W?void 0:i,children:[l.jsx("p",{children:"The agent tests one target round after round: it enumerates, forms a hypothesis, probes it and hands candidates to a verifier. Read-only requests to the target run on their own; anything else waits for your approval."}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-scope",children:"Target (one host or URL; several, one per line, to test them at once)"}),l.jsx("textarea",{id:"recon-scope",rows:qe?Math.min(6,Ae.length+1):1,className:"mono",autoFocus:!0,spellCheck:!1,placeholder:"https://staging.example.com",value:c,onChange:oe=>u(oe.target.value)})]}),qe&&l.jsxs("div",{className:"recon-batch-options",children:[l.jsxs("div",{className:"hint",children:["Concurrency mode: ",Ae.length," targets, one worker each. Every worker has its own approvals, bound to its own target, and they all come to one list. Each starts from what is remembered about its target and uses the logged-in session captured for it, if there is one."]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-workers",children:"Workers at a time (1 to 5)"}),l.jsx("input",{id:"recon-workers",type:"number",min:1,max:5,value:K,onChange:oe=>ye(Math.max(1,Math.min(5,Math.floor(Number(oe.target.value))||1)))})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-total",children:"Token budget for the whole batch (optional; each worker also has its own)"}),l.jsx("input",{id:"recon-total",type:"number",min:2e4,step:1e4,placeholder:"no ceiling",value:ve,onChange:oe=>Ce(oe.target.value)})]})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-objective",children:"Objective"}),l.jsx("textarea",{id:"recon-objective",rows:3,value:d,onChange:oe=>h(oe.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-kind",children:"Environment"}),l.jsxs("select",{id:"recon-kind",value:m,onChange:oe=>y(oe.target.value),children:[l.jsx("option",{value:"local",children:"local"}),l.jsx("option",{value:"staging",children:"staging"}),l.jsx("option",{value:"production",children:"production"})]})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-div",children:"How it differs from production"}),l.jsx("textarea",{id:"recon-div",rows:2,placeholder:"e.g. seed data, SSO replaced by a test login; or: none, this is production",value:g,onChange:oe=>S(oe.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{htmlFor:"recon-settings",children:"Non-production settings (optional, comma-separated)"}),l.jsx("input",{id:"recon-settings",type:"text",className:"mono",spellCheck:!1,placeholder:"DEBUG=1, AUTH_DISABLED",value:v,onChange:oe=>b(oe.target.value)})]}),ct&&l.jsxs("div",{className:"recon-session",children:[I?l.jsxs("label",{className:"recon-consent recon-option",children:[l.jsx("input",{type:"checkbox",checked:J,onChange:oe=>se(oe.target.checked)}),l.jsxs("span",{children:["Test logged in, with the session ",ij(I),"."," ",l.jsx("button",{type:"button",className:"btn-link",disabled:W,onClick:oe=>{oe.preventDefault(),gt()},children:"capture again"})," · ",l.jsx("button",{type:"button",className:"btn-link",disabled:W,onClick:oe=>{oe.preventDefault(),j()},children:"forget"})]})]}):l.jsxs("div",{className:"hint",children:["No logged-in session for this target: the run tests what answers without an account."," ",l.jsx("button",{type:"button",className:"btn-link",disabled:W,onClick:()=>void gt(),children:"capture one from your browser"})]}),$&&l.jsxs("div",{className:"recon-pairing",children:[l.jsxs("div",{children:["1. Install the extension once: ",l.jsx("a",{href:"/api/agent/recon/extension.zip",children:"download"}),", unzip, then in Chrome or Edge open ",l.jsx("span",{className:"mono",children:"chrome://extensions"}),", turn on Developer mode and choose Load unpacked."]}),l.jsx("div",{children:"2. Open the target in a tab and log in yourself, 2FA included. Use a test account."}),l.jsx("div",{children:"3. Click the extension, paste this code and press send. It works once, for this target, for ten minutes."}),l.jsx("input",{type:"text",className:"mono",readOnly:!0,value:$.token,"aria-label":"Pairing code",onFocus:oe=>oe.target.select()}),l.jsx("div",{className:"hint",children:"Waiting for the extension…"})]})]}),D&&l.jsxs("label",{className:"recon-consent recon-option",children:[l.jsx("input",{type:"checkbox",checked:ue,onChange:oe=>he(oe.target.checked)}),l.jsxs("span",{children:["Start from what is remembered about this target: ",q0(D),". Each is re-tested before it counts."," ",l.jsx("button",{type:"button",className:"btn-link",disabled:W,onClick:oe=>{oe.preventDefault(),ae()},children:"forget this target"})]})]}),D&&D.findings>0&&l.jsxs("label",{className:"recon-consent recon-option",children:[l.jsx("input",{type:"checkbox",checked:C,onChange:oe=>Y(oe.target.checked)}),l.jsxs("span",{children:["Retest only: re-check the ",D.findings," remembered finding",D.findings===1?"":"s"," and say which still reproduce and which are fixed. Nothing new is explored, and no attack paths are looked for."]})]}),l.jsxs("label",{className:"recon-consent recon-option",children:[l.jsx("input",{type:"checkbox",checked:z,onChange:oe=>Z(oe.target.checked)}),l.jsx("span",{children:"Look for attack paths afterwards: with two or more findings, try to combine them and show each path end to end. Same approvals, same target; up to 15% of the token budget is kept for it."})]}),l.jsxs("label",{className:"recon-consent",children:[l.jsx("input",{type:"checkbox",checked:x,onChange:oe=>T(oe.target.checked)}),l.jsx("span",{children:qe?"I am authorised to test every target listed, and nothing else is in scope.":"I am authorised to test this target, and it is the only one in scope."})]}),re&&l.jsx("div",{className:"hint danger",children:re}),l.jsxs("div",{className:"perm-actions recon-actions",children:[l.jsx("button",{className:"btn primary sm",disabled:!Ne,onClick:xe,children:W?"starting…":qe?`start ${Ae.length} workers`:"start recon"}),l.jsx("button",{className:"btn sm",disabled:W,onClick:i,children:"cancel"})]})]})}function hj({recon:s,onStop:i,onDismiss:c}){const u=s.status==="running";return l.jsxs("div",{className:"recon-strip"+(u?" live":""),role:"status",children:[l.jsx("span",{className:"recon-name",children:"recon"}),l.jsx("span",{className:"mono",title:s.objective,children:s.scope}),l.jsx("span",{children:V0(s)}),l.jsxs("span",{children:[Va(s.tokens),"/",Va(s.budgetTokens)," tokens"]}),u&&s.model&&l.jsx("span",{title:`profile ${s.profile}`,children:s.model}),l.jsxs("span",{title:"Approvals the gate answered itself, and the ones it left for you",children:["auto-allowed ",s.gate.allowed," · asked ",s.gate.asked," · blocked ",s.gate.denied]}),u?l.jsx("button",{className:"btn sm danger-outline",onClick:i,children:"stop"}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"recon-end",children:["ended: ",sj(s)??(s.stopped?dj[s.stopped]:"finished")]}),l.jsx("button",{className:"link-btn",onClick:c,children:"dismiss"})]})]})}function Q0({recon:s}){if(s.mode==="retest")return l.jsx(mj,{recon:s});if(s.status==="running"&&!s.findings.length)return null;const{demonstrated:i,partial:c}=Y0(s.chains),u=s.status==="running"&&s.phase==="chains",d=uj(s),h=oj(s),m=G0(s),y=X0(s);return l.jsxs("div",{className:"recon-findings",children:[m&&l.jsx("div",{className:"hint recon-from",children:m}),h&&l.jsx("div",{className:"hint recon-from",children:h}),(i.length>0||u)&&l.jsxs("div",{className:"recon-section",children:[l.jsxs("div",{className:"perm-title recon-title",children:["Attack paths (",i.length,")"]}),u&&l.jsx("div",{className:"hint",children:"Combining the findings into attack paths and trying each one…"}),i.map((g,S)=>l.jsx(Dv,{c:g},g.id??S))]}),l.jsxs("div",{className:"recon-section",children:[l.jsxs("div",{className:"perm-title recon-title",children:["Recon findings (",s.findings.length,") · ",s.env.kind]}),s.error&&l.jsx("div",{className:"hint danger",children:s.error}),!s.findings.length&&l.jsx("div",{className:"hint",children:"The verifier confirmed no findings in this run."}),s.findings.map((g,S)=>l.jsx(yj,{f:g,paths:rj(g.id,s.chains)},g.id??S))]}),c.length>0&&l.jsxs("div",{className:"recon-section",children:[l.jsxs("div",{className:"perm-title recon-title recon-title-lead",children:["Unproven paths (",c.length,")"]}),l.jsx("div",{className:"hint",children:"Leads, not findings: each stopped before it was shown end to end."}),c.map((g,S)=>l.jsx(Dv,{c:g},g.id??S))]}),l.jsx(pj,{recon:s}),d&&l.jsx("div",{className:"hint recon-note",children:d}),y&&l.jsx("div",{className:"hint recon-note",children:y})]})}function mj({recon:s}){const i=s.retests??[];if(s.status==="running"&&!i.length)return null;const c=G0(s),u=X0(s);return l.jsxs("div",{className:"recon-findings",children:[c&&l.jsx("div",{className:"hint recon-from",children:c}),l.jsxs("div",{className:"recon-section",children:[l.jsxs("div",{className:"perm-title recon-title",children:["Retest · ",aj(i)," · ",s.env.kind]}),s.error&&l.jsx("div",{className:"hint danger",children:s.error}),i.map((d,h)=>l.jsx(gj,{r:d},h))]}),u&&l.jsx("div",{className:"hint recon-note",children:u})]})}function pj({recon:s}){const i=s.leads??[];if(!i.length)return null;const{open:c,closed:u}=nj(i);return l.jsxs("div",{className:"recon-section",children:[l.jsxs("div",{className:"perm-title recon-title recon-title-lead",children:["Leads · ",c," open, ",u," followed or closed"]}),l.jsx("div",{className:"hint",children:"The executor's own notes of things to follow. Not findings: nothing here was verified."}),l.jsx("ul",{className:"recon-leads",children:i.map(d=>l.jsxs("li",{className:d.status,children:[l.jsx("span",{className:"badge recon-id",children:d.id})," ",d.text,d.status==="closed"&&l.jsxs("span",{className:"recon-in-paths",children:[" · ",d.outcome||"closed"]})]},d.id))})]})}function K0({proof:s}){const i=tj(s);return i?l.jsx("span",{className:`badge proof-${i.kind}`,title:i.title,children:i.text}):null}function gj({r:s}){return l.jsxs("div",{className:`recon-finding recon-retest ${s.result}`,children:[l.jsxs("div",{className:"recon-finding-head",children:[l.jsx("span",{className:`badge retest-${s.result}`,children:$0[s.result]}),l.jsx("span",{className:`badge sev-${s.severity}`,children:s.severity}),l.jsx("span",{className:"recon-finding-title",children:s.title}),s.standardId&&l.jsx("span",{className:"badge",children:s.standardId}),l.jsx(K0,{proof:s.proof}),l.jsxs("span",{className:"recon-in-paths",children:["last verified ",new Date(s.lastVerified).toISOString().slice(0,10)]})]}),s.note&&l.jsx("div",{className:"hint",children:s.note}),s.evidence&&l.jsx("pre",{className:"recon-repro",children:s.evidence})]})}function Dv({c:s}){const i=s.status==="partial";return l.jsxs("div",{className:"recon-finding recon-chain"+(i?" partial":""),children:[l.jsxs("div",{className:"recon-finding-head",children:[s.id&&l.jsx("span",{className:"badge recon-id",children:s.id}),l.jsx("span",{className:`badge sev-${s.severity}`,title:i?"The worst this path could be: it was not shown":void 0,children:i?`up to ${s.severity}`:s.severity}),l.jsx("span",{className:"recon-finding-title",children:s.title}),s.standardId&&l.jsx("span",{className:"badge",children:s.standardId}),s.verdict==="config-dependent"&&l.jsx("span",{className:"badge sev-medium",children:"config-dependent"})]}),l.jsx("div",{className:"recon-impact",children:s.impact}),l.jsxs("div",{className:"recon-links",children:[l.jsx("span",{children:"uses"}),s.links.map(c=>l.jsx("span",{className:"badge recon-id",children:c},c))]}),i&&l.jsx("div",{className:"hint recon-stopped",children:cj(s)}),l.jsx("ol",{className:"recon-steps",children:s.steps.map((c,u)=>l.jsxs("li",{className:i&&s.blockedAt===u+1?"blocked":void 0,children:[l.jsx("div",{children:c.action}),c.evidence&&l.jsx("pre",{className:"recon-repro",children:c.evidence})]},u))}),s.prodCaveat&&l.jsxs("div",{className:"hint",children:["Re-test against production: ",s.prodCaveat]})]})}function yj({f:s,paths:i}){return l.jsxs("div",{className:"recon-finding",children:[l.jsxs("div",{className:"recon-finding-head",children:[s.id&&l.jsx("span",{className:"badge recon-id",children:s.id}),l.jsx("span",{className:`badge sev-${s.severity}`,children:s.severity}),l.jsx("span",{className:"recon-finding-title",children:s.title}),s.standardId&&l.jsx("span",{className:"badge",children:s.standardId}),s.verdict==="config-dependent"&&l.jsx("span",{className:"badge sev-medium",children:"config-dependent"}),l.jsx(K0,{proof:s.proof}),i.length>0&&l.jsxs("span",{className:"recon-in-paths",title:"Attack paths that build on this finding",children:["in ",i.join(", ")]})]}),l.jsx("pre",{className:"recon-repro",children:s.repro}),s.prodCaveat&&l.jsxs("div",{className:"hint",children:["Re-test against production: ",s.prodCaveat]})]})}function vj({batch:s,approvals:i,onReply:c,onStop:u,onDismiss:d}){const h=s.status==="running";return l.jsxs("div",{className:"batch-panel",children:[l.jsxs("div",{className:"recon-strip"+(h?" live":""),role:"status",children:[l.jsx("span",{className:"recon-name",children:"recon batch"}),l.jsx("span",{children:WT(s)}),l.jsxs("span",{children:["up to ",s.maxWorkers," at a time"]}),l.jsxs("span",{children:[Va(s.tokens),s.budgetTokens?`/${Va(s.budgetTokens)}`:""," tokens"]}),h?l.jsx("button",{className:"btn sm danger-outline",onClick:u,children:"stop all"}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"recon-end",children:["ended",s.stopped?": stopped by you":""]}),l.jsx("button",{className:"link-btn",onClick:d,children:"dismiss"})]})]}),i.length>0&&l.jsxs("div",{className:"batch-approvals",children:[l.jsxs("div",{className:"perm-title",children:["Approvals waiting (",i.length,")"]}),i.map(m=>l.jsxs("div",{className:"perm-card",children:[l.jsxs("div",{className:"perm-title",children:[l.jsx("span",{className:"badge recon-id",children:m.target}),m.subagent&&l.jsxs("span",{className:"perm-sub",children:["subagent · ",m.subagent]})]}),l.jsxs("div",{className:"perm-body",children:[l.jsx("span",{className:"perm-type",children:m.permType??"action"})," ",m.title??(Array.isArray(m.pattern)?m.pattern.join(", "):m.pattern)??""]}),l.jsxs("div",{className:"perm-actions",children:[l.jsx("button",{className:"btn primary sm",onClick:()=>c(m,"once"),children:"Approve"}),l.jsx("button",{className:"btn sm danger-outline",onClick:()=>c(m,"reject"),children:"Reject"})]})]},m.permissionID))]}),l.jsx("div",{className:"batch-workers",children:s.workers.map(m=>l.jsx(bj,{w:m},m.target))})]})}function bj({w:s}){var d,h;const i=s.recon,c=ej(s),u=i?i.findings.length+(((d=i.chains)==null?void 0:d.length)??0):0;return l.jsxs("details",{className:`batch-worker ${s.status}`,open:s.status==="finished"&&u>0?void 0:!1,children:[l.jsxs("summary",{children:[l.jsx("span",{className:`badge batch-${s.status}`,children:s.status}),l.jsx("span",{className:"mono batch-target",children:s.target}),i&&l.jsx("span",{children:V0(i)}),i&&l.jsxs("span",{children:[Va(i.tokens),"/",Va(i.budgetTokens)," tokens"]}),i&&l.jsxs("span",{children:[i.findings.length," finding",i.findings.length===1?"":"s",(h=i.chains)!=null&&h.length?`, ${i.chains.length} path${i.chains.length===1?"":"s"}`:""]}),c&&l.jsx("span",{className:"recon-in-paths",children:c})]}),i?l.jsx(Q0,{recon:i}):l.jsx("div",{className:"hint",children:"Nothing yet."}),s.sessionID&&l.jsxs("div",{className:"hint",children:['Its transcript is the session "recon ',s.target,'" in the session list.']})]})}const Gc=[{name:"new",description:"Start a new session",hint:""},{name:"compact",description:"Summarise the conversation to free up context",hint:""},{name:"model",description:"Switch model, e.g. /model kimi",hint:"<name>"},{name:"plan",description:"Switch to the read-only plan agent",hint:""},{name:"build",description:"Switch to the build agent",hint:""},{name:"help",description:"List available commands",hint:""}],xj=25*1024*1024,Lv=30*1024*1024,Z0="or_cmd_history";function Sj(){try{const s=localStorage.getItem(Z0);if(s)return JSON.parse(s)}catch{}return[]}function wj({agent:s,setAgent:i,model:c,setModel:u,models:d,commands:h,busy:m,onSend:y,onStop:g,draft:S,onDraftUsed:v}){var tt;const[b,x]=w.useState(""),[T,z]=w.useState([]),[Z,D]=w.useState(null),[F,ue]=w.useState(!1),[he,C]=w.useState(0),Y=w.useRef(null),I=w.useRef(null),[X,J]=w.useState(!1),se=w.useRef(null);function $(){var be,Be;if(X){(be=se.current)==null||be.stop();return}const L=b.trim(),je=Xv({onStart:()=>J(!0),onEnd:()=>{J(!1),se.current=null},onPartial:Me=>x(L?L+" "+Me:Me)});se.current=je,(Be=Y.current)==null||Be.focus()}const[Q,K]=w.useState(Sj),ye=w.useRef(-1),ve=w.useRef("");function Ce(L){L.trim()&&K(je=>{const be=(je[je.length-1]===L?je:[...je,L]).slice(-200);try{localStorage.setItem(Z0,JSON.stringify(be))}catch{}return be})}function W(){requestAnimationFrame(()=>{const L=Y.current;L&&(L.selectionStart=L.selectionEnd=L.value.length)})}const ee=()=>{const L=Y.current;return!L||!L.value.slice(0,L.selectionStart??0).includes(`
297
+ `)},re=()=>{const L=Y.current;return!L||!L.value.slice(L.selectionEnd??0).includes(`
298
+ `)};function P(L){if(!Q.length)return!1;if(ye.current===-1){if(L===1)return!1;ve.current=b,ye.current=Q.length-1}else{const je=ye.current+L;if(je<0)return!0;if(je>=Q.length)return ye.current=-1,x(ve.current),W(),!0;ye.current=je}return x(Q[ye.current]),W(),!0}w.useEffect(()=>{var L;S!==null&&(x(S),v(),(L=Y.current)==null||L.focus())},[S,v]),w.useEffect(()=>{const L=Y.current;L&&(L.style.height="auto",L.style.height=Math.min(L.scrollHeight,260)+"px")},[b]);function Ae(L){var be;L.target.closest("button, select, input, textarea, a")||(be=Y.current)==null||be.focus()}const qe=w.useMemo(()=>{const L=new Set(Gc.map(je=>je.name));return[...Gc,...h.filter(je=>!L.has(je.name))]},[h]),ct=(tt=/^\/(\S*)$/.exec(b))==null?void 0:tt[1],gt=ct!==void 0?qe.filter(L=>L.name.startsWith(ct.toLowerCase())):[],j=gt.length>0;w.useEffect(()=>C(0),[ct]);function ae(L){var je;L.hint?(x(`/${L.name} `),(je=Y.current)==null||je.focus()):oe(`/${L.name}`)}async function Ne(L){D(null);const je=[];let be=T.reduce((Be,Me)=>Be+Me.size,0);for(const Be of Array.from(L)){if(Be.size>xj){D(`${Be.name} is over 25 MB.`);continue}if(be+Be.size>Lv){D(`Attachments are limited to ${Uo(Lv)} per message; ${Be.name} doesn't fit.`);continue}be+=Be.size;const Me=await Aj(Be);je.push({name:Be.name||`pasted-${Date.now()}.${(Be.type.split("/")[1]||"bin").replace(/\W/g,"")}`,mime:Be.type||"application/octet-stream",size:Be.size,data:Me.slice(Me.indexOf(",")+1),preview:Be.type.startsWith("image/")?Me:void 0})}z(Be=>[...Be,...je])}function xe(L){const je=Array.from(L.clipboardData.files);je.length&&(L.preventDefault(),Ne(je))}function oe(L=b){!L.trim()&&!T.length||(Ce(L),ye.current=-1,y(L,T),x(""),z([]),D(null))}function Oe(L){if(j){if(L.key==="ArrowDown"){L.preventDefault(),C(je=>(je+1)%gt.length);return}if(L.key==="ArrowUp"){L.preventDefault(),C(je=>(je-1+gt.length)%gt.length);return}if(L.key==="Tab"||L.key==="Enter"&&!L.shiftKey){L.preventDefault(),ae(gt[he]);return}if(L.key==="Escape"){L.preventDefault(),x("");return}}if(L.key==="ArrowUp"&&ee()&&P(-1)){L.preventDefault();return}if(L.key==="ArrowDown"&&ye.current!==-1&&re()&&P(1)){L.preventDefault();return}L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),oe())}const Le=d.find(L=>L.id===c),me=w.useMemo(()=>{const L=new Map;for(const je of d)L.set(je.provider,[...L.get(je.provider)??[],je]);return[...L.entries()]},[d]),De=T.some(L=>L.mime.startsWith("image/"));return l.jsxs("div",{className:"composer-wrap",children:[j&&l.jsx("div",{className:"slash-menu",role:"listbox",children:gt.map((L,je)=>l.jsxs("button",{role:"option","aria-selected":je===he,className:"slash-item"+(je===he?" on":""),onMouseEnter:()=>C(je),onMouseDown:be=>{be.preventDefault(),ae(L)},children:[l.jsxs("span",{className:"slash-name mono",children:["/",L.name,L.hint?l.jsxs("span",{className:"slash-hint",children:[" ",L.hint]}):null]}),l.jsx("span",{className:"slash-desc",children:L.description})]},L.name))}),l.jsxs("div",{className:"composer-box"+(F?" dragging":""),onClick:Ae,onDragOver:L=>{L.dataTransfer.types.includes("Files")&&(L.preventDefault(),ue(!0))},onDragLeave:()=>ue(!1),onDrop:L=>{L.preventDefault(),ue(!1),L.dataTransfer.files.length&&Ne(L.dataTransfer.files)},children:[T.length>0&&l.jsx("div",{className:"attach-row",children:T.map((L,je)=>l.jsxs("span",{className:"attach-chip",title:`${L.name} · ${Uo(L.size)}`,children:[L.preview?l.jsx("img",{src:L.preview,alt:""}):l.jsx("span",{className:"attach-icon",children:l.jsx(mh,{})}),l.jsx("span",{className:"attach-name",children:L.name}),l.jsx("button",{className:"attach-x",onClick:()=>z(be=>be.filter((Be,Me)=>Me!==je)),"aria-label":`Remove ${L.name}`,children:"✕"})]},je))}),l.jsx("textarea",{ref:Y,value:b,onChange:L=>{x(L.target.value),ye.current=-1},onKeyDown:Oe,onPaste:xe,rows:3,placeholder:X?"Listening…":s==="build"?"Ask BugXHunter to change something… (/ for commands)":"Ask BugXHunter to plan or explain… (/ for commands)"}),l.jsxs("div",{className:"composer-bar",children:[l.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var L;return(L=I.current)==null?void 0:L.click()},title:"Attach files (or paste / drop them)","aria-label":"Attach files",children:l.jsx(Qc,{size:20})}),l.jsx("input",{ref:I,type:"file",multiple:!0,hidden:!0,onChange:L=>{L.target.files&&Ne(L.target.files),L.target.value=""}}),l.jsx("div",{className:"agent-switch",role:"tablist",children:["build","plan"].map(L=>l.jsx("button",{className:"seg"+(s===L?" on":""),onClick:()=>i(L),disabled:m,children:L},L))}),l.jsxs("select",{className:"model-select",value:c,onChange:L=>u(L.target.value),disabled:m,title:"Model",children:[!Le&&l.jsx("option",{value:c,children:c}),me.map(([L,je])=>l.jsx("optgroup",{label:L,children:je.map(be=>l.jsxs("option",{value:be.id,children:[be.name,be.images?" · sees images":"",be.output?` · ${Va(be.output)} out`:""]},be.id))},L))]}),l.jsx("div",{className:"spacer"}),sh()&&l.jsx("button",{className:"send-btn mic"+(X?" stop":""),onClick:$,disabled:m,title:X?"Stop dictation":"Dictate","aria-label":X?"Stop dictation":"Dictate",children:X?"●":"🎤"}),m?l.jsx("button",{className:"send-btn stop",onClick:g,title:"Stop",children:"■"}):l.jsx("button",{className:"send-btn",onClick:()=>oe(),disabled:!b.trim()&&!T.length,title:"Send (Enter)",children:"↑"})]})]}),l.jsx("div",{className:"composer-hint",children:Z?l.jsx("span",{className:"danger",children:Z}):De&&Le&&!Le.images?l.jsxs("span",{className:"warn",children:[Le.name," can't see images — it gets the saved file only. Pick a model marked “sees images” to let it look."]}):"Enter to send · Shift+Enter new line · / commands · paste or drop files"})]})}function Aj(s){return new Promise((i,c)=>{const u=new FileReader;u.onload=()=>i(String(u.result)),u.onerror=()=>c(u.error),u.readAsDataURL(s)})}const kj={completed:"✓",in_progress:"◐",pending:"○",cancelled:"✕"};function Tj({todos:s}){const[i,c]=w.useState(!0);if(!s.length)return null;const u=s.filter(h=>h.status==="completed").length,d=s.find(h=>h.status==="in_progress");return l.jsxs("div",{className:"todo-panel",children:[l.jsxs("button",{className:"todo-head",onClick:()=>c(h=>!h),"aria-expanded":i,children:[l.jsx("span",{className:"chev"+(i?" open":""),children:"›"}),l.jsx("span",{className:"todo-title",children:"Tasks"}),l.jsxs("span",{className:"todo-count",children:[u,"/",s.length]}),l.jsx("span",{className:"todo-bar",children:l.jsx("span",{style:{width:`${u/s.length*100}%`}})}),!i&&d&&l.jsx("span",{className:"todo-current",children:d.content})]}),i&&l.jsx("ul",{className:"todo-list",children:s.map((h,m)=>l.jsxs("li",{className:"todo s-"+h.status,children:[l.jsx("span",{className:"todo-icon","aria-hidden":!0,children:kj[h.status]??"○"}),l.jsx("span",{className:"todo-text",children:h.content}),h.priority==="high"&&h.status!=="completed"&&l.jsx("span",{className:"todo-prio",children:"high"})]},m))})]})}function jj(s){var u,d;const i=[];let c=!1;for(const h of s.split(`
299
+ `)){const m=h.replace(/\r$/,"");if(m.startsWith("@@")){i.push(null),c=!0;continue}!c||m.startsWith("\\")||(m.startsWith("+")?i.push({kind:"add",text:m.slice(1)}):m.startsWith("-")?i.push({kind:"del",text:m.slice(1)}):i.push({kind:"same",text:m.slice(1)}))}return i[0]===null&&i.shift(),i.length&&((u=i[i.length-1])==null?void 0:u.kind)==="same"&&((d=i[i.length-1])==null?void 0:d.text)===""&&i.pop(),i}function Nj(s,i){const c=s?s.split(`
300
+ `):[],u=i?i.split(`
301
+ `):[];if(c.length*u.length>4e6)return[...c.map(v=>({kind:"del",text:v})),...u.map(v=>({kind:"add",text:v}))];const d=c.length,h=u.length,m=Array.from({length:d+1},()=>new Uint32Array(h+1));for(let v=d-1;v>=0;v--)for(let b=h-1;b>=0;b--)m[v][b]=c[v]===u[b]?m[v+1][b+1]+1:Math.max(m[v+1][b],m[v][b+1]);const y=[];let g=0,S=0;for(;g<d&&S<h;)c[g]===u[S]?(y.push({kind:"same",text:c[g]}),g++,S++):m[g+1][S]>=m[g][S+1]?y.push({kind:"del",text:c[g++]}):y.push({kind:"add",text:u[S++]});for(;g<d;)y.push({kind:"del",text:c[g++]});for(;S<h;)y.push({kind:"add",text:u[S++]});return y}function Ej(s,i=3){const c=new Array(s.length).fill(!1);s.forEach((h,m)=>{if(h.kind!=="same")for(let y=Math.max(0,m-i);y<=Math.min(s.length-1,m+i);y++)c[y]=!0});const u=[];let d=!1;return s.forEach((h,m)=>{c[m]?(u.push(h),d=!1):d||(u.push(null),d=!0)}),u}function Cj({diff:s,onClose:i}){return w.useEffect(()=>{const c=u=>u.key==="Escape"&&i();return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),l.jsx("div",{className:"overlay",onClick:i,children:l.jsxs("div",{className:"modal",onClick:c=>c.stopPropagation(),children:[l.jsxs("div",{className:"modal-head",children:[l.jsxs("span",{className:"modal-title",children:[l.jsx("span",{className:"dot r","aria-hidden":!0}),"git diff --session"]}),l.jsx("button",{className:"icon-btn close-x",onClick:i,"aria-label":"Close",title:"Close (Esc)",children:"✕"})]}),l.jsx("div",{className:"modal-body",children:typeof s=="string"?l.jsx("pre",{className:"diff-raw",children:s}):s.length===0?l.jsxs("p",{className:"muted",children:["No changes recorded. OpenCode tracks changes only in git repositories — run ",l.jsx("code",{className:"mono",children:"git init"})," in the project folder to see them here."]}):s.map((c,u)=>l.jsx(Mj,{f:c},`${c.turn??0}-${c.file}-${u}`))})]})})}function Mj({f:s}){const[i,c]=w.useState(!0),u=w.useMemo(()=>s.patch!==void 0?jj(s.patch):Ej(Nj(s.before??"",s.after??"")),[s.patch,s.before,s.after]);return l.jsxs("div",{className:"file-diff",children:[l.jsxs("button",{className:"file-diff-head",onClick:()=>c(d=>!d),children:[l.jsx("span",{className:"chev"+(i?" open":""),children:"›"}),l.jsx("span",{className:"mono",children:s.file}),s.turn?l.jsxs("span",{className:"muted turn",children:["prompt ",s.turn]}):null,l.jsxs("span",{className:"adds",children:["+",s.additions??0]}),l.jsxs("span",{className:"dels",children:["−",s.deletions??0]})]}),i&&l.jsx("pre",{className:"diff-lines",children:u.map((d,h)=>d===null?l.jsx("div",{className:"dl gap",children:"⋯"},h):l.jsxs("div",{className:"dl "+d.kind,children:[d.kind==="add"?"+ ":d.kind==="del"?"- ":" ",d.text]},h))})]})}function _j({req:s,onAnswer:i,onDismiss:c}){const[u,d]=w.useState(()=>s.questions.map(()=>[])),[h,m]=w.useState(()=>s.questions.map(()=>""));function y(v,b,x){d(T=>T.map((z,Z)=>Z!==v?z:x?z.includes(b)?z.filter(D=>D!==b):[...z,b]:z[0]===b?[]:[b])),x||m(T=>T.map((z,Z)=>Z===v?"":z))}const g=s.questions.map((v,b)=>{const x=h[b].trim();return!v.multiple&&x?[x]:x?[...u[b],x]:u[b]}),S=g.every(v=>v.length>0);return l.jsxs("div",{className:"question-card",children:[l.jsxs("div",{className:"perm-title",children:["The agent has a question",s.subagent&&l.jsxs("span",{className:"perm-sub",children:["subagent · ",s.subagent]})]}),s.questions.map((v,b)=>l.jsxs("div",{className:"q-block",children:[v.header&&l.jsx("span",{className:"q-header",children:v.header}),l.jsx("div",{className:"q-text",children:v.question}),v.multiple&&l.jsx("div",{className:"hint",style:{marginTop:0},children:"Choose any that apply."}),l.jsx("div",{className:"q-options",role:v.multiple?"group":"radiogroup",children:v.options.map(x=>{const T=u[b].includes(x.label);return l.jsxs("button",{className:"q-option"+(T?" on":""),role:v.multiple?"checkbox":"radio","aria-checked":T,onClick:()=>y(b,x.label,v.multiple),children:[l.jsx("span",{className:"q-mark"+(v.multiple?" box":""),"aria-hidden":!0,children:T?"✓":""}),l.jsx("span",{className:"q-label",children:x.label}),x.description&&l.jsx("span",{className:"q-desc",children:x.description})]},x.label)})}),v.custom!==!1&&l.jsx("input",{type:"text",className:"q-custom",placeholder:"Or type your own answer…",value:h[b],onChange:x=>{const T=x.target.value;m(z=>z.map((Z,D)=>D===b?T:Z)),!v.multiple&&T.trim()&&d(z=>z.map((Z,D)=>D===b?[]:Z))},onKeyDown:x=>{x.key==="Enter"&&S&&i(g)}})]},b)),l.jsxs("div",{className:"perm-actions",children:[l.jsx("button",{className:"btn primary sm",disabled:!S,onClick:()=>i(g),children:"Send answer"}),l.jsx("button",{className:"btn sm",onClick:c,children:"Dismiss"})]})]})}const Rj={build:"Edits files and runs commands. You approve each change.",plan:"Read-only. Explores the code and writes a plan."};function Oj(s,i){return[{kind:"p",text:`./bxh --project ${s} --agent ${i}`,pace:26},{kind:"out",text:"Loading project context..."},{kind:"out",text:Rj[i],pace:18},{kind:"ok",text:"Agent ready ",ok:"OK"}]}const Dj=["Summarise the architecture of this project.","Find and explain the main entry points.","Review this project against the OWASP Top 10:2025 and report findings with ids and fixes.","Map every place this code calls a model or runs an agent, and assess it against the OWASP LLM and Agentic Top 10 and ATLAS.","/init"],Lj=80;function zj({status:s,statusError:i,directory:c,model:u,setModel:d,resume:h,onActiveSession:m,onSessionsChanged:y}){const[g,S]=w.useState("build"),[v,b]=w.useState(null),[x,T]=w.useState([]),[z,Z]=w.useState([]),[D,F]=w.useState([]),[ue,he]=w.useState([]),[C,Y]=w.useState(!1),[I,X]=w.useState(!1),[J,se]=w.useState(null),[$,Q]=w.useState(null),[K,ye]=w.useState(null),[ve,Ce]=w.useState([]),[W,ee]=w.useState(null),[re,P]=w.useState(!0),[Ae,qe]=w.useState(null),[ct,gt]=w.useState(!1),[j,ae]=w.useState(null),[Ne,xe]=w.useState([]),oe=w.useRef(!1),[Oe,Le]=w.useState([]),me=w.useRef([]),De=w.useRef(0),tt=w.useRef(!1),L=w.useRef(()=>{}),je=w.useRef({}),be=w.useRef(""),Be=w.useRef(0),Me=w.useRef(null),ie=w.useRef(null),ke=w.useRef(!0);w.useEffect(()=>{PS(c).then(Ce).catch(()=>{}),Wk(c,["/workspace"])},[c]);function Te(){const M=ie.current;if(!M)return;const le=M.scrollHeight-M.scrollTop-M.clientHeight<Lj;ke.current=le,P(le)}function He(M=!0){const le=ie.current;le&&(ke.current=!0,P(!0),le.scrollTo({top:le.scrollHeight,behavior:M?"smooth":"auto"}))}w.useEffect(()=>{var M;ke.current&&((M=ie.current)==null||M.scrollTo({top:ie.current.scrollHeight}))},[x,z,D]);const q=w.useCallback((M,le,pe)=>{T(Re=>{const Ke=Re.slice();let We=Ke.findIndex(N=>N.id===M);We===-1&&(Ke.push({id:M,role:"assistant",parts:[]}),We=Ke.length-1);const ht={...Ke[We],parts:Ke[We].parts.slice()};return pe&&(ht.subagent=pe),le(ht),Ke[We]=ht,Ke})},[]),ze=w.useCallback(M=>{switch(M.kind){case"message":je.current[M.messageID]=M.role,M.role==="assistant"&&q(M.messageID,le=>{le.tokens=M.tokens,le.cost=M.cost,le.model=M.model},M.subagent);break;case"text":case"reasoning":{const le=je.current[M.messageID];if(le==="user"||!le&&M.text.trim()===be.current.trim())break;const pe=M.partID??`${M.kind}-${M.messageID}`;q(M.messageID,Re=>{const Ke=Re.parts.findIndex(ht=>ht.type===M.kind&&"id"in ht&&ht.id===pe),We={type:M.kind,id:pe,text:M.text};Ke===-1?Re.parts.push(We):Re.parts[Ke]=We},M.subagent);break}case"tool":q(M.messageID,le=>{const pe=le.parts.findIndex(Ke=>Ke.type==="tool"&&Ke.callID===M.callID),Re={type:"tool",callID:M.callID,tool:M.tool,status:M.status,title:M.title,input:M.input,output:M.output,error:M.error};pe===-1?le.parts.push(Re):le.parts[pe]={...le.parts[pe],...Re}},M.subagent);break;case"todo":he(M.todos);break;case"session":y();break;case"permission":Z(le=>le.some(pe=>pe.permissionID===M.permissionID)?le:[...le,M]);break;case"permission-replied":Z(le=>le.filter(pe=>pe.permissionID!==M.permissionID));break;case"question":F(le=>le.some(pe=>pe.requestID===M.requestID)?le:[...le,{requestID:M.requestID,questions:M.questions,subagent:M.subagent}]);break;case"question-closed":F(le=>le.filter(pe=>pe.requestID!==M.requestID));break;case"idle":T(le=>le.map(Uj)),y(),oe.current||L.current();break;case"error":se(M.message),oe.current||L.current();break}},[q,y]);function $e(){var M;(M=Me.current)==null||M.abort(),Me.current=null,b(null),T([]),Z([]),F([]),he([]),se(null),Q(null),Y(!1),qe(null),oe.current=!1,me.current=[],gn(),tt.current=!1,je.current={},ke.current=!0,P(!0)}function yt(M){var pe;(pe=Me.current)==null||pe.abort();const le=new AbortController;Me.current=le,iw(M,c,ze,le.signal,()=>Ye(M,le)).catch(Re=>{(Re==null?void 0:Re.name)!=="AbortError"&&se(String((Re==null?void 0:Re.message)??Re))}),Ye(M,le)}function Ye(M,le){ew(M,c).then(({permissions:pe,questions:Re})=>{le.signal.aborted||(pe.length&&(Z(Ke=>{const We=new Set(Ke.map(ht=>ht.permissionID));return[...Ke,...pe.filter(ht=>!We.has(ht.permissionID))]}),Y(!0)),Re.length&&(F(Ke=>{const We=new Set(Ke.map(ht=>ht.requestID));return[...Ke,...Re.filter(ht=>!We.has(ht.requestID)).map(ht=>({requestID:ht.requestID,questions:ht.questions,subagent:ht.subagent}))]}),Y(!0)))}).catch(()=>{})}async function pt(){if(v)return v;const M=await tw(c);return b(M.id),m(M.id),yt(M.id),M.id}function Ve(){$e(),m(null)}w.useEffect(()=>{if(!h)return;if(!h.id){Ve();return}const M=h.id;$e(),X(!0),KS(M,c).then(({messages:le,todos:pe})=>{for(const Re of le)je.current[Re.id]=Re.role;T(le.map(Ij)),he(pe??[]),b(M),m(M),yt(M),Qy(M).then(Vt).catch(()=>{}),requestAnimationFrame(()=>He(!1))}).catch(le=>se(String(le.message??le))).finally(()=>X(!1))},[h==null?void 0:h.n]);function Vt(M){qe(M),(M==null?void 0:M.status)==="running"&&(oe.current=!0,tt.current=!0,Y(!0))}const Bn=(j==null?void 0:j.status)==="running";w.useEffect(()=>{Yy().then(M=>{var le;((le=M.batch)==null?void 0:le.status)==="running"&&M.directory===c&&(ae(M.batch),xe(M.approvals))}).catch(()=>{})},[c]),w.useEffect(()=>{if(!Bn||!j)return;const M=j.id,le=setInterval(()=>{Yy(M).then(pe=>{pe.batch&&(ae(pe.batch),xe(pe.approvals),pe.batch.status!=="running"&&y())}).catch(()=>{})},2e3);return()=>clearInterval(le)},[Bn,j==null?void 0:j.id]);async function Ea(M,le){xe(pe=>pe.filter(Re=>Re.permissionID!==M.permissionID));try{await Xy({sessionID:M.sessionID,permissionID:M.permissionID,response:le,directory:c})}catch(pe){se(String(pe.message??pe))}}async function Cn(M){if(se(null),Q(null),M.targets&&M.targets.length>1){const We=await cw({directory:c,targets:M.targets,objective:M.objective,env:M.env,authorised:!0,maxWorkers:M.maxWorkers,totalBudgetTokens:M.totalBudgetTokens,chainPass:M.chainPass});ae(We),xe([]),y();return}const le=await pt(),pe=await rw({sessionID:le,directory:c,...M,authorised:!0}),Re=`local-${Be.current++}`,Ke=`Supervised recon of ${M.scope} (${M.env.kind})
302
+ ${M.objective}`;T(We=>[...We,{id:Re,role:"user",parts:[{type:"text",id:Re,text:Ke}]}]),Vt(pe),He()}const Mn=(Ae==null?void 0:Ae.status)==="running";w.useEffect(()=>{if(!Mn||!v)return;const M=setInterval(()=>{Qy(v).then(le=>{le&&(qe(le),le.status!=="running"&&(oe.current=!1,L.current(),y()))}).catch(()=>{})},2500);return()=>clearInterval(M)},[Mn,v,y]);const gn=()=>Le([...me.current]);function ma(M,le=[]){if(!(!M.trim()&&!le.length)){if(tt.current){me.current.push({id:De.current++,text:M,files:le}),gn(),He();return}Sn(M,le)}}function Hn(M){me.current=me.current.filter(le=>le.id!==M),gn()}function tn(){if(tt.current)return;const M=me.current.shift();gn(),M&&Sn(M.text,M.files)}const vt=w.useRef(!1);function ta(){tt.current=!1,Y(!1),!vt.current&&(vt.current=!0,requestAnimationFrame(()=>{vt.current=!1,tn()}))}L.current=ta;async function Sn(M,le=[]){const pe=M.trim();se(null),Q(null),He();const Re=/^\/(\S+)(?:\s+([\s\S]*))?$/.exec(pe);if(Re&&!le.length){await wn(Re[1].toLowerCase(),(Re[2]??"").trim()),tt.current||tn();return}try{tt.current=!0;const Ke=await pt();be.current=pe;const We=`local-${Be.current++}`,ht=le.map((V,ge)=>({type:"file",id:`${We}-f${ge}`,filename:V.name,mime:V.mime,url:V.preview,size:V.size}));T(V=>[...V,{id:We,role:"user",parts:[...pe?[{type:"text",id:We,text:pe}]:[],...ht]}]),Y(!0);const N=s==null?void 0:s.models.find(V=>V.id===u);await nw({sessionID:Ke,text:pe,agent:g,model:u,directory:c,files:le.map(({name:V,mime:ge,data:Se})=>({name:V,mime:ge,data:Se})),inlineImages:!!(N!=null&&N.images)})}catch(Ke){se(String(Ke.message??Ke)),ta()}}async function wn(M,le){switch(M){case"new":Ve();return;case"plan":case"build":S(M),Q(`Switched to the ${M} agent.`);return;case"help":{const pe=[...Gc,...ve.filter(Re=>!Gc.some(Ke=>Ke.name===Re.name))];Q(pe.map(Re=>`/${Re.name}${Re.hint?" "+Re.hint:""} — ${Re.description}`).join(`
303
+ `));return}case"model":{const pe=le.toLowerCase(),Re=(s==null?void 0:s.models)??[],Ke=pe&&(Re.find(We=>We.id.toLowerCase()===pe||We.name.toLowerCase()===pe)??Re.find(We=>We.id.toLowerCase().includes(pe)||We.name.toLowerCase().includes(pe)));if(!Ke){se(pe?`No model matches “${le}”.`:"Usage: /model <name>, e.g. /model kimi");return}d(Ke.id),Q(`Model: ${Ke.name}`);return}case"compact":if(!v){se("Nothing to compact yet.");return}try{tt.current=!0,Y(!0),await JS(v,c,u),Q("Compacting the conversation…")}catch(pe){se(String(pe.message??pe)),ta()}return}if(!ve.some(pe=>pe.name===M)){se(`Unknown command /${M}. Type / to see the list.`);return}try{const pe=await pt(),Re=`local-${Be.current++}`,Ke=`/${M}${le?" "+le:""}`;be.current=Ke,T(We=>[...We,{id:Re,role:"user",parts:[{type:"text",id:Re,text:Ke}]}]),tt.current=!0,Y(!0),await FS({sessionID:pe,command:M,arguments:le,agent:g,model:u,directory:c})}catch(pe){se(String(pe.message??pe)),ta()}}async function An(M,le){Z(pe=>pe.filter(Re=>Re.permissionID!==M.permissionID));try{await Xy({sessionID:M.sessionID,permissionID:M.permissionID,response:le,directory:c})}catch(pe){se(String(pe.message??pe))}}async function pa(M,le){F(pe=>pe.filter(Re=>Re.requestID!==M.requestID));try{await aw(le?{requestID:M.requestID,answers:le,directory:c}:{requestID:M.requestID,reject:!0,directory:c})}catch(pe){se(String(pe.message??pe))}}async function na(){if(me.current=[],gn(),oe.current&&v){await pw(v).catch(()=>{});return}tt.current=!1,Y(!1),v&&await sw(v,c).catch(()=>{})}async function Ca(){if(!v)return;const M=await lw(v,c);ye(Array.isArray(M)||typeof M=="string"?M:M?JSON.stringify(M,null,2):[])}w.useEffect(()=>()=>{var M;return(M=Me.current)==null?void 0:M.abort()},[]);const ga=c.split(/[\\/]/).filter(Boolean).pop()??c,yn=w.useMemo(()=>x.reduce((M,le)=>{var pe,Re;return M+(((pe=le.tokens)==null?void 0:pe.input)??0)+(((Re=le.tokens)==null?void 0:Re.output)??0)},0),[x]),Lt=z.length>0||D.length>0;return l.jsxs("main",{className:"main",children:[l.jsxs(Ho,{title:`bugxhunter@redteam: ~/${ga}`,tooltip:c,children:[l.jsxs("span",{className:"status-pill"+(C?" live":""),children:[l.jsx("span",{className:"dot"}),C?Lt?"waiting for you":"running":v?"idle":"ready"]}),yn>0&&l.jsxs("span",{className:"token-pill",children:[Va(yn)," tokens"]}),l.jsx("button",{className:"btn ghost sm",onClick:()=>gt(!0),disabled:C||!(s!=null&&s.ready),title:"Supervised recon: test one target round after round, approving anything that is not a read-only request",children:"recon"}),l.jsx("button",{className:"btn ghost sm",onClick:Ca,disabled:!v,children:"changes"}),l.jsx("button",{className:"btn ghost sm",onClick:Ve,disabled:C,children:"new_session"})]}),l.jsxs("div",{className:"transcript-wrap",children:[l.jsx("div",{className:"transcript grid-bg",ref:ie,onScroll:Te,children:l.jsxs("div",{className:"transcript-inner",children:[I&&l.jsx("p",{className:"muted center mono",children:"Loading session…"}),!I&&x.length===0&&l.jsxs("div",{className:"empty-state",children:[l.jsx(Yv,{lines:Oj(ga,g)},`${ga}:${g}`),l.jsx("div",{className:"suggestions",children:Dj.map(M=>l.jsx("button",{className:"chip",onClick:()=>M.startsWith("/")?ma(M):ee(M),children:M==="/init"?"/init — create AGENTS.md, the project's memory for future sessions":M},M))}),i&&l.jsx("div",{className:"error-banner",children:i})]}),x.map(M=>l.jsx(Bj,{msg:M},M.id)),Ae&&l.jsx(Q0,{recon:Ae}),j&&l.jsx(vj,{batch:j,approvals:Ne,onReply:Ea,onStop:()=>{uw(j.id).then(M=>{M&&ae(M)})},onDismiss:()=>{ae(null),xe([])}}),z.map(M=>l.jsxs("div",{className:"perm-card",children:[l.jsxs("div",{className:"perm-title",children:["Approval needed",M.subagent&&l.jsxs("span",{className:"perm-sub",children:["subagent · ",M.subagent]})]}),l.jsxs("div",{className:"perm-body",children:[l.jsx("span",{className:"perm-type",children:M.permType??"action"})," ",M.title??(Array.isArray(M.pattern)?M.pattern.join(", "):M.pattern)??""]}),l.jsxs("div",{className:"perm-actions",children:[l.jsx("button",{className:"btn primary sm",onClick:()=>An(M,"once"),children:"Approve"}),!Mn&&l.jsx("button",{className:"btn sm",onClick:()=>An(M,"always"),children:"Always allow"}),l.jsx("button",{className:"btn sm danger-outline",onClick:()=>An(M,"reject"),children:"Reject"})]})]},M.permissionID)),D.map(M=>l.jsx(_j,{req:M,onAnswer:le=>pa(M,le),onDismiss:()=>pa(M,null)},M.requestID)),C&&!Lt&&l.jsxs("div",{className:"working",children:[l.jsx("span",{}),l.jsx("span",{}),l.jsx("span",{})]}),Oe.map(M=>l.jsx("div",{className:"msg user",children:l.jsxs("div",{className:"user-col",children:[l.jsx("div",{className:"bubble user-bubble queued-bubble",children:M.text||`(${M.files.length} file${M.files.length>1?"s":""})`}),l.jsxs("div",{className:"queued-label",children:["queued · ",l.jsx("button",{className:"link-btn",onClick:()=>Hn(M.id),children:"cancel"})]})]})},M.id)),$&&l.jsx("div",{className:"notice",children:$}),J&&l.jsx("div",{className:"error-banner",children:J})]})}),!re&&l.jsx("button",{className:"jump-btn",onClick:()=>He(),"aria-label":"Scroll to latest",children:"↓ latest"})]}),l.jsxs("div",{className:"composer",children:[Ae&&l.jsx(hj,{recon:Ae,onStop:na,onDismiss:()=>qe(null)}),l.jsx(Tj,{todos:ue}),l.jsx(wj,{agent:g,setAgent:S,model:u,setModel:d,models:(s==null?void 0:s.models)??[],commands:ve,busy:C,onSend:ma,onStop:na,draft:W,onDraftUsed:w.useCallback(()=>ee(null),[])})]}),K!==null&&l.jsx(Cj,{diff:K,onClose:()=>ye(null)}),ct&&l.jsx(fj,{onStart:Cn,onClose:()=>gt(!1)})]})}function Uj(s){return s.parts.some(i=>i.type==="tool"&&(i.status==="running"||i.status==="pending"))?{...s,parts:s.parts.map(i=>i.type==="tool"&&(i.status==="running"||i.status==="pending")?{...i,status:"interrupted"}:i)}:s}function Ij(s){return{id:s.id,role:s.role,parts:s.parts,tokens:s.tokens,cost:s.cost,model:s.model,error:s.error,subagent:s.subagent}}function Bj({msg:s}){if(s.role==="user"){const i=s.parts.map(u=>u.type==="text"?u.text:"").join(""),c=s.parts.filter(u=>u.type==="file");return l.jsx("div",{className:"msg user",children:l.jsxs("div",{className:"user-col",children:[c.length>0&&l.jsx("div",{className:"attach-row right",children:c.map(u=>l.jsxs("span",{className:"attach-chip",title:u.filename,children:[u.url?l.jsx("img",{src:u.url,alt:""}):l.jsx("span",{className:"attach-icon",children:l.jsx(mh,{})}),l.jsx("span",{className:"attach-name",children:u.filename}),u.size?l.jsx("span",{className:"attach-size",children:Uo(u.size)}):null]},u.id))}),i&&l.jsx("div",{className:"bubble user-bubble",children:i})]})})}return!s.parts.length&&!s.error?null:l.jsxs("div",{className:"msg assistant"+(s.subagent?" subagent":""),children:[l.jsx("div",{className:"avatar","aria-hidden":!0,children:s.subagent?"↳":"▶"}),l.jsxs("div",{className:"msg-body",children:[s.subagent&&l.jsxs("div",{className:"subagent-tag",title:s.subagent,children:["subagent · ",s.subagent]}),s.parts.map((i,c)=>i.type==="tool"?l.jsx($j,{t:i},i.callID):i.type==="reasoning"?l.jsx(Hj,{text:i.text},i.id):i.type==="text"?l.jsx($c,{text:i.text,files:!0},i.id):l.jsx("span",{},i.id??c)),s.error&&l.jsx("div",{className:"error-banner",children:s.error}),s.tokens&&(s.tokens.output??0)>0&&l.jsxs("div",{className:"msg-meta",children:[s.model&&l.jsx("span",{children:s.model}),l.jsxs("span",{children:[Va(s.tokens.input??0)," in · ",Va(s.tokens.output??0)," out"]}),s.cost?l.jsxs("span",{children:["$",s.cost.toFixed(4)]}):null]})]})]})}function Hj({text:s}){const[i,c]=w.useState(!1);return l.jsxs("div",{className:"reasoning",children:[l.jsxs("button",{className:"reasoning-toggle",onClick:()=>c(u=>!u),children:[l.jsx("span",{className:"chev"+(i?" open":""),children:"›"})," Thinking"]}),i&&l.jsx("div",{className:"reasoning-body",children:s})]})}function $j({t:s}){const[i,c]=w.useState(!1),u=s.title||(s.input?String(Object.values(s.input)[0]??""):""),d=!!(s.output||s.error);return l.jsxs("div",{className:"tool s-"+s.status,children:[l.jsxs("button",{className:"tool-head",onClick:()=>d&&c(h=>!h),disabled:!d,children:[l.jsx("span",{className:"tool-icon",children:l.jsx(A1,{tool:s.tool})}),l.jsx("span",{className:"tool-name",children:s.tool}),l.jsx("span",{className:"tool-summary",children:u.slice(0,120)}),l.jsx("span",{className:"tool-state",children:s.status==="running"||s.status==="pending"?l.jsx("span",{className:"spin"}):s.status==="error"?"failed":s.status==="interrupted"?"interrupted":""}),d&&l.jsx("span",{className:"chev"+(i?" open":""),children:"›"})]}),i&&d&&l.jsx("pre",{className:"tool-output",children:l.jsx(g0,{text:s.error?"error: "+s.error:String(s.output??"")})})]})}const zv="or_playground_config",zf="or_runner",Uv="or_mode",Iv="or_layout",Bv=320,qj=240,Gj=560,Xj={name:"Assistant",model:"GLM-5.3",system:"You are a helpful, concise assistant.",temperature:.7,maxTokens:4096,topP:1,jsonMode:!1,stream:!0,tools:[],useKnowledge:!1,speak:!1,saveSessions:!0};function jc(s,i){try{const c=localStorage.getItem(s);if(c)return{...i,...JSON.parse(c)}}catch{}return i}function Uf(s,i){try{localStorage.setItem(s,JSON.stringify(i))}catch{}}function Yj(){const[s,i]=w.useState(()=>{try{return localStorage.getItem(Uv)||"runner"}catch{return"runner"}}),[c,u]=w.useState(null),[d,h]=w.useState(null),[m,y]=w.useState(()=>jc(zf,{directory:"",model:"",recent:[]}));w.useEffect(()=>{WS().then(async ie=>{u(ie);const ke=jc(zf,{directory:"",model:"",recent:[]}).directory,Te=ke?await $v(ke).catch(()=>ie.directory):ie.directory;y(He=>({...He,directory:Te,model:ie.models.some(q=>q.id===He.model)?He.model:ie.defaultModel}))}).catch(ie=>h(String(ie.message??ie)))},[]),w.useEffect(()=>Uf(zf,m),[m]),w.useEffect(()=>{try{localStorage.setItem(Uv,s)}catch{}},[s]);const[g,S]=w.useState(null),[v,b]=w.useState(null),[x,T]=w.useState(0),z=ie=>{i("runner"),b(ke=>({id:ie,n:((ke==null?void 0:ke.n)??0)+1}))},Z=w.useCallback(()=>T(ie=>ie+1),[]),[D,F]=w.useState(()=>jc(Iv,{width:Bv,collapsed:!1}));w.useEffect(()=>Uf(Iv,D),[D]);const ue=()=>F(ie=>({...ie,collapsed:!ie.collapsed}));w.useEffect(()=>{const ie=ke=>{(ke.ctrlKey||ke.metaKey)&&ke.key.toLowerCase()==="b"&&(ke.preventDefault(),ue())};return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[]);function he(ie){ie.preventDefault();const ke=ie.currentTarget;ke.setPointerCapture(ie.pointerId),document.body.classList.add("resizing");const Te=q=>F(ze=>({...ze,width:Math.round(Math.min(Gj,Math.max(qj,q.clientX)))})),He=()=>{ke.removeEventListener("pointermove",Te),ke.removeEventListener("pointerup",He),document.body.classList.remove("resizing")};ke.addEventListener("pointermove",Te),ke.addEventListener("pointerup",He)}function C(ie){S(null),b(null),y(ke=>({...ke,directory:ie,recent:[ie,...ke.recent.filter(Te=>Te!==ie)].slice(0,8)}))}function Y(ie){y(ke=>({...ke,recent:ke.recent.filter(Te=>Te!==ie)}))}const[I,X]=w.useState(()=>{const ie=jc(zv,Xj);return{...ie,tools:Aw(ie.tools??[])}}),[J,se]=w.useState([]),[$,Q]=w.useState(null),[K,ye]=w.useState([]),[ve,Ce]=w.useState(!1),[W,ee]=w.useState(null),[re,P]=w.useState("chat"),Ae=w.useRef(null);w.useEffect(()=>{qS().then(ie=>{se(ie),X(ke=>{var Te;return ie.some(He=>He.id===ke.model)?ke:{...ke,model:((Te=ie[0])==null?void 0:Te.id)??ke.model}})}).catch(ie=>Q(String(ie.message??ie)))},[]),w.useEffect(()=>Uf(zv,I),[I]);const qe=w.useMemo(()=>J.find(ie=>ie.id===I.model),[J,I.model]),[ct,gt]=w.useState(null),[j,ae]=w.useState(null),[Ne,xe]=w.useState(null),oe=w.useRef(null),Oe=w.useRef(null),Le=w.useCallback(()=>{Mc("chat").then(ie=>ae(ie)).catch(ie=>xe({ok:!1,text:String(ie.message??ie)}))},[]);w.useEffect(()=>{s==="playground"&&Le()},[s,Le]),w.useEffect(()=>{var He,q,ze;if(ve||!I.saveSessions||K===oe.current)return;const ie=K.find($e=>$e.role==="user");if(!ie)return;oe.current=K;const ke=Oe.current??_o();Oe.current=ke,gt(ke);const Te=(((He=ie.content)==null?void 0:He.trim())||((q=ie.docs)!=null&&q.length?`${ie.docs[0].kind==="text"?"File":"Diagram"} review: ${ie.docs[0].name}`:(ze=ie.images)!=null&&ze.length?"Image review":"Chat")).replace(/\s+/g," ").slice(0,80);_c("chat",ke,Te,{v:1,model:I.model,system:I.system,messages:K}).then(()=>{xe({ok:!0,text:"Saved, encrypted with your vault"}),Le()}).catch($e=>xe({ok:!1,text:`Not saved: ${String($e.message??$e)}`}))},[ve,K,I.saveSessions,I.model,I.system,Le]);async function me(ie){var ke;if(!ve)try{const Te=await Ff("chat",ie),He=Array.isArray((ke=Te.body)==null?void 0:ke.messages)?Te.body.messages:[];oe.current=He,Oe.current=ie,gt(ie),ye(He),ee(null),P("chat"),X(q=>({...q,...Te.body.model&&J.some(ze=>ze.id===Te.body.model)?{model:Te.body.model}:{},...typeof Te.body.system=="string"?{system:Te.body.system}:{}}))}catch(Te){xe({ok:!1,text:String(Te.message??Te)})}}async function De(ie){try{await L0("chat",ie),Oe.current===ie&&Me(),Le()}catch(ke){xe({ok:!1,text:String(ke.message??ke)})}}function tt(ie){var Te;const ke=[];I.system.trim()&&ke.push({role:"system",content:I.system});for(const He of ie)He.role==="assistant"&&((Te=He.tool_calls)!=null&&Te.length)?ke.push({role:"assistant",content:He.content??"",tool_calls:He.tool_calls}):He.role==="tool"?ke.push({role:"tool",content:He.content,tool_call_id:He.tool_call_id}):ke.push({role:He.role,content:He.role==="user"?Mh(He.content,He.images,He.docs):He.content});return ke}async function L(ie){Ce(!0),ee(null);const ke=new AbortController;Ae.current=ke;const Te=ie.length;ye([...ie,{role:"assistant",content:""}]);const He=I.tools.length?kw(I.tools):void 0;let q="";const ze=performance.now();let $e;const yt=()=>ye(Ye=>{const pt=[...Ye],Ve=pt[Te];return Ve&&(pt[Te]={...Ve,timing:{ttft:$e,total:performance.now()-ze}}),pt});await nh({model:I.model,messages:tt(ie),temperature:I.temperature,top_p:I.topP,max_tokens:I.maxTokens,reasoning_effort:ah(I.reasoningEffort,J.find(Ye=>Ye.id===I.model)),tools:He,response_format:I.jsonMode?{type:"json_object"}:void 0,rag:I.useKnowledge,stream:I.stream},{signal:ke.signal,onDelta:Ye=>{$e??($e=performance.now()-ze),q+=Ye,ye(pt=>{const Ve=[...pt],Vt=Ve[Te];return Ve[Te]={...Vt,content:(Vt.content??"")+Ye},Ve})},onToolCalls:Ye=>ye(pt=>{const Ve=[...pt];return Ve[Te]={...Ve[Te],tool_calls:Ye},Ve}),onSources:Ye=>ye(pt=>{const Ve=[...pt];return Ve[Te]={...Ve[Te],sources:Ye},Ve}),onUsage:Ye=>ye(pt=>{const Ve=[...pt];return Ve[Te]={...Ve[Te],usage:Ye},Ve}),onError:Ye=>ee(Ye),onDone:Ye=>{yt(),Ye==="length"&&ye(pt=>{const Ve=[...pt];return Ve[Te]&&(Ve[Te]={...Ve[Te],finish:Ye}),Ve}),I.speak&&q.trim()&&jw(q)}}).catch(Ye=>{(Ye==null?void 0:Ye.name)!=="AbortError"&&ee(String((Ye==null?void 0:Ye.message)??Ye))}),Ce(!1),Ae.current=null}function je(ie,ke,Te){if(!ie.trim()&&!(ke!=null&&ke.length)&&!(Te!=null&&Te.length)||ve)return;const He=[...K,{role:"user",content:ie,...ke!=null&&ke.length?{images:ke}:{},...Te!=null&&Te.length?{docs:Te}:{}}];ye(He),L(He)}function be(ie,ke){const Te=[...K,{role:"tool",tool_call_id:ie.id,content:ke}];ye(Te),L(Te)}function Be(){var ie;(ie=Ae.current)==null||ie.abort(),Nw(),Ce(!1)}function Me(){Be(),ye([]),ee(null),Oe.current=null,gt(null),oe.current=null}return l.jsxs("div",{className:"app"+(D.collapsed?" collapsed":""),style:{"--sidebar-w":`${D.width}px`},children:[D.collapsed&&l.jsx("button",{className:"sidebar-toggle floating",onClick:ue,title:"Show sidebar (Ctrl+B)","aria-label":"Show sidebar",children:"»"}),l.jsx(sA,{onCollapse:ue,sessions:{active:g,version:x,open:z},mode:s,setMode:i,runner:m,status:c,statusError:d,onOpenDirectory:C,onForgetDirectory:Y,config:I,setConfig:X,models:J,modelError:$,activeModel:qe,onReset:Me,saved:{list:j,activeId:ct,status:Ne,onOpen:ie=>void me(ie),onDelete:ie=>void De(ie)}}),l.jsx("div",{className:"splitter",role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize · double-click to reset",onPointerDown:he,onDoubleClick:()=>F(ie=>({...ie,width:Bv}))}),s==="runner"?m.directory?l.jsx(zj,{status:c,statusError:d,directory:m.directory,model:m.model||(c==null?void 0:c.defaultModel)||"",setModel:ie=>y(ke=>({...ke,model:ie})),resume:v,onActiveSession:S,onSessionsChanged:Z},m.directory):l.jsx("main",{className:"main",children:l.jsx("div",{className:"transcript grid-bg",children:l.jsx("div",{className:"empty-state center",children:d?l.jsx("div",{className:"error-banner",children:d}):l.jsx("p",{className:"muted mono",children:"Starting OpenCode…"})})})}):re==="compare"?l.jsx(wT,{config:I,models:J,onExit:()=>P("chat")}):re==="canvas"?l.jsx(KT,{config:I,models:J,onExit:()=>P("chat")}):l.jsx(gT,{config:I,activeModel:qe,messages:K,busy:ve,error:W,onSend:je,onStop:Be,onReset:Me,onToolResult:be,onCompare:()=>P("compare"),onCanvas:()=>P("canvas")})]})}const Vj=window.fetch.bind(window);window.fetch=async(s,i)=>{const c=await Vj(s,i),u=typeof s=="string"?s:s instanceof URL?s.pathname:s.url;return c.status===401&&u.startsWith("/api/")&&!u.startsWith("/api/auth/")&&c.headers.get("WWW-Authenticate")==="BXH-Passkey"&&window.dispatchEvent(new Event($f)),c};$S.createRoot(document.getElementById("root")).render(l.jsx(OS.StrictMode,{children:l.jsx(Pw,{children:l.jsx(Yj,{})})}));