@letra-ai/cli 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2GRNAFBQ.js +5305 -0
- package/dist/{chunk-MJ2QXNH6.js → chunk-42RST74I.js} +1 -1
- package/dist/chunk-HC24XMPZ.js +269 -0
- package/dist/chunk-LUPN3TRC.js +554 -0
- package/dist/{chunk-URUC6ZZP.js → chunk-MUCIMQAU.js} +1735 -861
- package/dist/chunk-POGWTSEA.js +125 -0
- package/dist/chunk-TNF7XTFG.js +6178 -0
- package/dist/{chunk-BKAUN5QH.js → chunk-UMC5PDL2.js} +227 -33
- package/dist/{chunk-6HSUVCTR.js → chunk-YAQ2TKSK.js} +82 -30
- package/dist/client/assets/index-C-6kWNFi.js +232 -0
- package/dist/client/assets/index-QV-zN0V8.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/fallback-CXCCKHBA.js +56 -0
- package/dist/flow-serve-LFILD3EV.js +19 -0
- package/dist/{generate-UPFERQMD.js → generate-3R7POT7L.js} +4 -5
- package/dist/harness/default/v0.1.0/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.0/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.1.1/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.1/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.1.2/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.2/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.1.3/gates/all-acs-passing.yaml +1 -0
- package/dist/harness/default/v0.1.3/gates/has-spec-file.yaml +1 -0
- package/dist/harness/default/v0.2.0/executors/registry.yaml +17 -0
- package/dist/harness/default/v0.2.0/flows/flow-main.yaml +81 -3
- package/dist/harness/default/v0.2.0/gates/code-reviewed.yaml +1 -0
- package/dist/harness/default/v0.2.0/gates/human-approved.yaml +1 -0
- package/dist/harness/default/v0.2.0/gates/security-clear.yaml +1 -0
- package/dist/{health-record-YDVXEVLR.js → health-record-JO2ZTIMR.js} +2 -2
- package/dist/index.js +2284 -1168
- package/dist/{push-VJRSQGUD.js → push-2ZCQSOHF.js} +37 -49
- package/dist/server-WUYVNSH7.js +677 -0
- package/dist/service-SVEAXQBX.js +28 -0
- package/dist/service-TOBY3OHO.js +22 -0
- package/dist/service-USTAY5E3.js +62 -0
- package/dist/{session-log-WTQ5JBEN.js → session-log-X2Q4XKQN.js} +6 -2
- package/dist/specs-CQRB7LPA.js +21 -0
- package/dist/sync-LIVPQXEW.js +21 -0
- package/package.json +1 -1
- package/dist/chunk-DMOLJWWW.js +0 -3321
- package/dist/chunk-EDD55PWL.js +0 -119
- package/dist/chunk-H64RC3YS.js +0 -254
- package/dist/chunk-L6YKDTAQ.js +0 -275
- package/dist/chunk-OIHMDOIN.js +0 -1326
- package/dist/client/assets/index-EyRsq1SH.css +0 -1
- package/dist/client/assets/index-WfKR7Xp6.js +0 -232
- package/dist/fallback-MQLGS4KL.js +0 -46
- package/dist/flow-serve-G5MSSB3G.js +0 -18
- package/dist/focus-sync-3D3XWCTI.js +0 -17
- package/dist/server-P6GKRWDX.js +0 -423
- package/dist/service-2JN2KI4D.js +0 -29
- package/dist/sitrep-OKNZJICV.js +0 -16
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
var Og=Object.defineProperty;var Rg=(n,i,c)=>i in n?Og(n,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):n[i]=c;var us=(n,i,c)=>Rg(n,typeof i!="symbol"?i+"":i,c);function _g(n,i){for(var c=0;c<i.length;c++){const u=i[c];if(typeof u!="string"&&!Array.isArray(u)){for(const d in u)if(d!=="default"&&!(d in n)){const f=Object.getOwnPropertyDescriptor(u,d);f&&Object.defineProperty(n,d,f.get?f:{enumerable:!0,get:()=>u[d]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(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 f of d)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function c(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=c(d);fetch(d.href,f)}})();function Lg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ou={exports:{}},fr={};/**
|
|
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 Rh;function Hg(){if(Rh)return fr;Rh=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function c(u,d,f){var h=null;if(f!==void 0&&(h=""+f),d.key!==void 0&&(h=""+d.key),"key"in d){f={};for(var p in d)p!=="key"&&(f[p]=d[p])}else f=d;return d=f.ref,{$$typeof:n,type:u,key:h,ref:d!==void 0?d:null,props:f}}return fr.Fragment=i,fr.jsx=c,fr.jsxs=c,fr}var _h;function Bg(){return _h||(_h=1,ou.exports=Hg()),ou.exports}var a=Bg(),cu={exports:{}},$e={};/**
|
|
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 Lh;function Ug(){if(Lh)return $e;Lh=1;var n=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"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),z=Symbol.iterator;function S(N){return N===null||typeof N!="object"?null:(N=z&&N[z]||N["@@iterator"],typeof N=="function"?N:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B=Object.assign,K={};function le(N,R,I){this.props=N,this.context=R,this.refs=K,this.updater=I||T}le.prototype.isReactComponent={},le.prototype.setState=function(N,R){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,R,"setState")},le.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function ve(){}ve.prototype=le.prototype;function oe(N,R,I){this.props=N,this.context=R,this.refs=K,this.updater=I||T}var $=oe.prototype=new ve;$.constructor=oe,B($,le.prototype),$.isPureReactComponent=!0;var ne=Array.isArray;function me(){}var ue={H:null,A:null,T:null,S:null},_=Object.prototype.hasOwnProperty;function he(N,R,I){var D=I.ref;return{$$typeof:n,type:N,key:R,ref:D!==void 0?D:null,props:I}}function Oe(N,R){return he(N.type,R,N.props)}function be(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function Z(N){var R={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(I){return R[I]})}var ee=/\/+/g;function de(N,R){return typeof N=="object"&&N!==null&&N.key!=null?Z(""+N.key):R.toString(36)}function ge(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(me,me):(N.status="pending",N.then(function(R){N.status==="pending"&&(N.status="fulfilled",N.value=R)},function(R){N.status==="pending"&&(N.status="rejected",N.reason=R)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function E(N,R,I,D,ie){var U=typeof N;(U==="undefined"||U==="boolean")&&(N=null);var M=!1;if(N===null)M=!0;else switch(U){case"bigint":case"string":case"number":M=!0;break;case"object":switch(N.$$typeof){case n:case i:M=!0;break;case b:return M=N._init,E(M(N._payload),R,I,D,ie)}}if(M)return ie=ie(N),M=D===""?"."+de(N,0):D,ne(ie)?(I="",M!=null&&(I=M.replace(ee,"$&/")+"/"),E(ie,R,I,"",function(Ge){return Ge})):ie!=null&&(be(ie)&&(ie=Oe(ie,I+(ie.key==null||N&&N.key===ie.key?"":(""+ie.key).replace(ee,"$&/")+"/")+M)),R.push(ie)),1;M=0;var X=D===""?".":D+":";if(ne(N))for(var te=0;te<N.length;te++)D=N[te],U=X+de(D,te),M+=E(D,R,I,U,ie);else if(te=S(N),typeof te=="function")for(N=te.call(N),te=0;!(D=N.next()).done;)D=D.value,U=X+de(D,te++),M+=E(D,R,I,U,ie);else if(U==="object"){if(typeof N.then=="function")return E(ge(N),R,I,D,ie);throw R=String(N),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return M}function W(N,R,I){if(N==null)return N;var D=[],ie=0;return E(N,D,"","",function(U){return R.call(I,U,ie++)}),D}function pe(N){if(N._status===-1){var R=N._result;R=R(),R.then(function(I){(N._status===0||N._status===-1)&&(N._status=1,N._result=I)},function(I){(N._status===0||N._status===-1)&&(N._status=2,N._result=I)}),N._status===-1&&(N._status=0,N._result=R)}if(N._status===1)return N._result.default;throw N._result}var xe=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(R))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},G={map:W,forEach:function(N,R,I){W(N,function(){R.apply(this,arguments)},I)},count:function(N){var R=0;return W(N,function(){R++}),R},toArray:function(N){return W(N,function(R){return R})||[]},only:function(N){if(!be(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return $e.Activity=y,$e.Children=G,$e.Component=le,$e.Fragment=c,$e.Profiler=d,$e.PureComponent=oe,$e.StrictMode=u,$e.Suspense=j,$e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ue,$e.__COMPILER_RUNTIME={__proto__:null,c:function(N){return ue.H.useMemoCache(N)}},$e.cache=function(N){return function(){return N.apply(null,arguments)}},$e.cacheSignal=function(){return null},$e.cloneElement=function(N,R,I){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var D=B({},N.props),ie=N.key;if(R!=null)for(U in R.key!==void 0&&(ie=""+R.key),R)!_.call(R,U)||U==="key"||U==="__self"||U==="__source"||U==="ref"&&R.ref===void 0||(D[U]=R[U]);var U=arguments.length-2;if(U===1)D.children=I;else if(1<U){for(var M=Array(U),X=0;X<U;X++)M[X]=arguments[X+2];D.children=M}return he(N.type,ie,D)},$e.createContext=function(N){return N={$$typeof:h,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:f,_context:N},N},$e.createElement=function(N,R,I){var D,ie={},U=null;if(R!=null)for(D in R.key!==void 0&&(U=""+R.key),R)_.call(R,D)&&D!=="key"&&D!=="__self"&&D!=="__source"&&(ie[D]=R[D]);var M=arguments.length-2;if(M===1)ie.children=I;else if(1<M){for(var X=Array(M),te=0;te<M;te++)X[te]=arguments[te+2];ie.children=X}if(N&&N.defaultProps)for(D in M=N.defaultProps,M)ie[D]===void 0&&(ie[D]=M[D]);return he(N,U,ie)},$e.createRef=function(){return{current:null}},$e.forwardRef=function(N){return{$$typeof:p,render:N}},$e.isValidElement=be,$e.lazy=function(N){return{$$typeof:b,_payload:{_status:-1,_result:N},_init:pe}},$e.memo=function(N,R){return{$$typeof:v,type:N,compare:R===void 0?null:R}},$e.startTransition=function(N){var R=ue.T,I={};ue.T=I;try{var D=N(),ie=ue.S;ie!==null&&ie(I,D),typeof D=="object"&&D!==null&&typeof D.then=="function"&&D.then(me,xe)}catch(U){xe(U)}finally{R!==null&&I.types!==null&&(R.types=I.types),ue.T=R}},$e.unstable_useCacheRefresh=function(){return ue.H.useCacheRefresh()},$e.use=function(N){return ue.H.use(N)},$e.useActionState=function(N,R,I){return ue.H.useActionState(N,R,I)},$e.useCallback=function(N,R){return ue.H.useCallback(N,R)},$e.useContext=function(N){return ue.H.useContext(N)},$e.useDebugValue=function(){},$e.useDeferredValue=function(N,R){return ue.H.useDeferredValue(N,R)},$e.useEffect=function(N,R){return ue.H.useEffect(N,R)},$e.useEffectEvent=function(N){return ue.H.useEffectEvent(N)},$e.useId=function(){return ue.H.useId()},$e.useImperativeHandle=function(N,R,I){return ue.H.useImperativeHandle(N,R,I)},$e.useInsertionEffect=function(N,R){return ue.H.useInsertionEffect(N,R)},$e.useLayoutEffect=function(N,R){return ue.H.useLayoutEffect(N,R)},$e.useMemo=function(N,R){return ue.H.useMemo(N,R)},$e.useOptimistic=function(N,R){return ue.H.useOptimistic(N,R)},$e.useReducer=function(N,R,I){return ue.H.useReducer(N,R,I)},$e.useRef=function(N){return ue.H.useRef(N)},$e.useState=function(N){return ue.H.useState(N)},$e.useSyncExternalStore=function(N,R,I){return ue.H.useSyncExternalStore(N,R,I)},$e.useTransition=function(){return ue.H.useTransition()},$e.version="19.2.7",$e}var Hh;function Mu(){return Hh||(Hh=1,cu.exports=Ug()),cu.exports}var x=Mu();const qg=Lg(x),Vg=_g({__proto__:null,default:qg},[x]);var uu={exports:{}},mr={},du={exports:{}},fu={};/**
|
|
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 Bh;function Gg(){return Bh||(Bh=1,(function(n){function i(E,W){var pe=E.length;E.push(W);e:for(;0<pe;){var xe=pe-1>>>1,G=E[xe];if(0<d(G,W))E[xe]=W,E[pe]=G,pe=xe;else break e}}function c(E){return E.length===0?null:E[0]}function u(E){if(E.length===0)return null;var W=E[0],pe=E.pop();if(pe!==W){E[0]=pe;e:for(var xe=0,G=E.length,N=G>>>1;xe<N;){var R=2*(xe+1)-1,I=E[R],D=R+1,ie=E[D];if(0>d(I,pe))D<G&&0>d(ie,I)?(E[xe]=ie,E[D]=pe,xe=D):(E[xe]=I,E[R]=pe,xe=R);else if(D<G&&0>d(ie,pe))E[xe]=ie,E[D]=pe,xe=D;else break e}}return W}function d(E,W){var pe=E.sortIndex-W.sortIndex;return pe!==0?pe:E.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,p=h.now();n.unstable_now=function(){return h.now()-p}}var j=[],v=[],b=1,y=null,z=3,S=!1,T=!1,B=!1,K=!1,le=typeof setTimeout=="function"?setTimeout:null,ve=typeof clearTimeout=="function"?clearTimeout:null,oe=typeof setImmediate<"u"?setImmediate:null;function $(E){for(var W=c(v);W!==null;){if(W.callback===null)u(v);else if(W.startTime<=E)u(v),W.sortIndex=W.expirationTime,i(j,W);else break;W=c(v)}}function ne(E){if(B=!1,$(E),!T)if(c(j)!==null)T=!0,me||(me=!0,Z());else{var W=c(v);W!==null&&ge(ne,W.startTime-E)}}var me=!1,ue=-1,_=5,he=-1;function Oe(){return K?!0:!(n.unstable_now()-he<_)}function be(){if(K=!1,me){var E=n.unstable_now();he=E;var W=!0;try{e:{T=!1,B&&(B=!1,ve(ue),ue=-1),S=!0;var pe=z;try{t:{for($(E),y=c(j);y!==null&&!(y.expirationTime>E&&Oe());){var xe=y.callback;if(typeof xe=="function"){y.callback=null,z=y.priorityLevel;var G=xe(y.expirationTime<=E);if(E=n.unstable_now(),typeof G=="function"){y.callback=G,$(E),W=!0;break t}y===c(j)&&u(j),$(E)}else u(j);y=c(j)}if(y!==null)W=!0;else{var N=c(v);N!==null&&ge(ne,N.startTime-E),W=!1}}break e}finally{y=null,z=pe,S=!1}W=void 0}}finally{W?Z():me=!1}}}var Z;if(typeof oe=="function")Z=function(){oe(be)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,de=ee.port2;ee.port1.onmessage=be,Z=function(){de.postMessage(null)}}else Z=function(){le(be,0)};function ge(E,W){ue=le(function(){E(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(E){E.callback=null},n.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<E?Math.floor(1e3/E):5},n.unstable_getCurrentPriorityLevel=function(){return z},n.unstable_next=function(E){switch(z){case 1:case 2:case 3:var W=3;break;default:W=z}var pe=z;z=W;try{return E()}finally{z=pe}},n.unstable_requestPaint=function(){K=!0},n.unstable_runWithPriority=function(E,W){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var pe=z;z=E;try{return W()}finally{z=pe}},n.unstable_scheduleCallback=function(E,W,pe){var xe=n.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?xe+pe:xe):pe=xe,E){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=pe+G,E={id:b++,callback:W,priorityLevel:E,startTime:pe,expirationTime:G,sortIndex:-1},pe>xe?(E.sortIndex=pe,i(v,E),c(j)===null&&E===c(v)&&(B?(ve(ue),ue=-1):B=!0,ge(ne,pe-xe))):(E.sortIndex=G,i(j,E),T||S||(T=!0,me||(me=!0,Z()))),E},n.unstable_shouldYield=Oe,n.unstable_wrapCallback=function(E){var W=z;return function(){var pe=z;z=W;try{return E.apply(this,arguments)}finally{z=pe}}}})(fu)),fu}var Uh;function Yg(){return Uh||(Uh=1,du.exports=Gg()),du.exports}var mu={exports:{}},da={};/**
|
|
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 qh;function $g(){if(qh)return da;qh=1;var n=Mu();function i(j){var v="https://react.dev/errors/"+j;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)v+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+j+"; visit "+v+" 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");function f(j,v,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:y==null?null:""+y,children:j,containerInfo:v,implementation:b}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(j,v){if(j==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return da.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,da.createPortal=function(j,v){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(i(299));return f(j,v,null,b)},da.flushSync=function(j){var v=h.T,b=u.p;try{if(h.T=null,u.p=2,j)return j()}finally{h.T=v,u.p=b,u.d.f()}},da.preconnect=function(j,v){typeof j=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,u.d.C(j,v))},da.prefetchDNS=function(j){typeof j=="string"&&u.d.D(j)},da.preinit=function(j,v){if(typeof j=="string"&&v&&typeof v.as=="string"){var b=v.as,y=p(b,v.crossOrigin),z=typeof v.integrity=="string"?v.integrity:void 0,S=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;b==="style"?u.d.S(j,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:y,integrity:z,fetchPriority:S}):b==="script"&&u.d.X(j,{crossOrigin:y,integrity:z,fetchPriority:S,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},da.preinitModule=function(j,v){if(typeof j=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var b=p(v.as,v.crossOrigin);u.d.M(j,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&u.d.M(j)},da.preload=function(j,v){if(typeof j=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var b=v.as,y=p(b,v.crossOrigin);u.d.L(j,b,{crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},da.preloadModule=function(j,v){if(typeof j=="string")if(v){var b=p(v.as,v.crossOrigin);u.d.m(j,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else u.d.m(j)},da.requestFormReset=function(j){u.d.r(j)},da.unstable_batchedUpdates=function(j,v){return j(v)},da.useFormState=function(j,v,b){return h.H.useFormState(j,v,b)},da.useFormStatus=function(){return h.H.useHostTransitionStatus()},da.version="19.2.7",da}var Vh;function kp(){if(Vh)return mu.exports;Vh=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),mu.exports=$g(),mu.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 Gh;function Qg(){if(Gh)return mr;Gh=1;var n=Yg(),i=Mu(),c=kp();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}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 f(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function h(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 p(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 j(e){if(f(e)!==e)throw Error(u(188))}function v(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(u(188));return t!==e?null:e}for(var s=e,l=t;;){var r=s.return;if(r===null)break;var o=r.alternate;if(o===null){if(l=r.return,l!==null){s=l;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===s)return j(r),e;if(o===l)return j(r),t;o=o.sibling}throw Error(u(188))}if(s.return!==l.return)s=r,l=o;else{for(var m=!1,g=r.child;g;){if(g===s){m=!0,s=r,l=o;break}if(g===l){m=!0,l=r,s=o;break}g=g.sibling}if(!m){for(g=o.child;g;){if(g===s){m=!0,s=o,l=r;break}if(g===l){m=!0,l=o,s=r;break}g=g.sibling}if(!m)throw Error(u(189))}}if(s.alternate!==l)throw Error(u(190))}if(s.tag!==3)throw Error(u(188));return s.stateNode.current===s?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var y=Object.assign,z=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),le=Symbol.for("react.profiler"),ve=Symbol.for("react.consumer"),oe=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),me=Symbol.for("react.suspense_list"),ue=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),Oe=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=be&&e[be]||e["@@iterator"],typeof e=="function"?e:null)}var ee=Symbol.for("react.client.reference");function de(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case B:return"Fragment";case le:return"Profiler";case K:return"StrictMode";case ne:return"Suspense";case me:return"SuspenseList";case he:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case oe:return e.displayName||"Context";case ve:return(e._context.displayName||"Context")+".Consumer";case $:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ue:return t=e.displayName||null,t!==null?t:de(e.type)||"Memo";case _:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var ge=Array.isArray,E=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},xe=[],G=-1;function N(e){return{current:e}}function R(e){0>G||(e.current=xe[G],xe[G]=null,G--)}function I(e,t){G++,xe[G]=e.current,e.current=t}var D=N(null),ie=N(null),U=N(null),M=N(null);function X(e,t){switch(I(U,t),I(ie,e),I(D,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sh(t),e=lh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}R(D),I(D,e)}function te(){R(D),R(ie),R(U)}function Ge(e){e.memoizedState!==null&&I(M,e);var t=D.current,s=lh(t,e.type);t!==s&&(I(ie,e),I(D,s))}function Se(e){ie.current===e&&(R(D),R(ie)),M.current===e&&(R(M),or._currentValue=pe)}var Le,De;function F(e){if(Le===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Le=t&&t[1]||"",De=-1<s.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Le+e+De}var Te=!1;function Me(e,t){if(!e||Te)return"";Te=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(Q){var V=Q}Reflect.construct(e,[],ae)}else{try{ae.call()}catch(Q){V=Q}e.call(ae.prototype)}}else{try{throw Error()}catch(Q){V=Q}(ae=e())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(Q){if(Q&&V&&typeof Q.stack=="string")return[Q.stack,V.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=l.DetermineComponentFrameRoot(),m=o[0],g=o[1];if(m&&g){var C=m.split(`
|
|
44
|
+
`),H=g.split(`
|
|
45
|
+
`);for(r=l=0;l<C.length&&!C[l].includes("DetermineComponentFrameRoot");)l++;for(;r<H.length&&!H[r].includes("DetermineComponentFrameRoot");)r++;if(l===C.length||r===H.length)for(l=C.length-1,r=H.length-1;1<=l&&0<=r&&C[l]!==H[r];)r--;for(;1<=l&&0<=r;l--,r--)if(C[l]!==H[r]){if(l!==1||r!==1)do if(l--,r--,0>r||C[l]!==H[r]){var J=`
|
|
46
|
+
`+C[l].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=l&&0<=r);break}}}finally{Te=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?F(s):""}function gt(e,t){switch(e.tag){case 26:case 27:case 5:return F(e.type);case 16:return F("Lazy");case 13:return e.child!==t&&t!==null?F("Suspense Fallback"):F("Suspense");case 19:return F("SuspenseList");case 0:case 15:return Me(e.type,!1);case 11:return Me(e.type.render,!1);case 1:return Me(e.type,!0);case 31:return F("Activity");default:return""}}function ht(e){try{var t="",s=null;do t+=gt(e,s),s=e,e=e.return;while(e);return t}catch(l){return`
|
|
47
|
+
Error generating stack: `+l.message+`
|
|
48
|
+
`+l.stack}}var Kt=Object.prototype.hasOwnProperty,ca=n.unstable_scheduleCallback,ea=n.unstable_cancelCallback,It=n.unstable_shouldYield,Ce=n.unstable_requestPaint,Ye=n.unstable_now,pt=n.unstable_getCurrentPriorityLevel,vt=n.unstable_ImmediatePriority,Ut=n.unstable_UserBlockingPriority,ut=n.unstable_NormalPriority,jt=n.unstable_LowPriority,ta=n.unstable_IdlePriority,aa=n.log,Ja=n.unstable_setDisableYieldValue,sa=null,Gt=null;function Nt(e){if(typeof aa=="function"&&Ja(e),Gt&&typeof Gt.setStrictMode=="function")try{Gt.setStrictMode(sa,e)}catch{}}var nt=Math.clz32?Math.clz32:Y,Wa=Math.log,ps=Math.LN2;function Y(e){return e>>>=0,e===0?32:31-(Wa(e)/ps|0)|0}var we=256,He=262144,Ue=4194304;function St(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&261888;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 la(e,t,s){var l=e.pendingLanes;if(l===0)return 0;var r=0,o=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var g=l&134217727;return g!==0?(l=g&~o,l!==0?r=St(l):(m&=g,m!==0?r=St(m):s||(s=g&~e,s!==0&&(r=St(s))))):(g=l&~o,g!==0?r=St(g):m!==0?r=St(m):s||(s=l&~e,s!==0&&(r=St(s)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,s=t&-t,o>=s||o===32&&(s&4194048)!==0)?t:r}function Ft(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Na(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 Sa(){var e=Ue;return Ue<<=1,(Ue&62914560)===0&&(Ue=4194304),e}function We(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function At(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Lt(e,t,s,l,r,o){var m=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var g=e.entanglements,C=e.expirationTimes,H=e.hiddenUpdates;for(s=m&~s;0<s;){var J=31-nt(s),ae=1<<J;g[J]=0,C[J]=-1;var V=H[J];if(V!==null)for(H[J]=null,J=0;J<V.length;J++){var Q=V[J];Q!==null&&(Q.lane&=-536870913)}s&=~ae}l!==0&&Fe(e,l,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(m&~t))}function Fe(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|s&261930}function Ot(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var l=31-nt(s),r=1<<l;r&t|e[l]&t&&(e[l]|=t),s&=~r}}function Ia(e,t){var s=t&-t;return s=(s&42)!==0?1:ls(s),(s&(e.suspendedLanes|t))!==0?0:s}function ls(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 fe(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function wa(){var e=W.p;return e!==0?e:(e=window.event,e===void 0?32:Ah(e.type))}function Us(e,t){var s=W.p;try{return W.p=e,t()}finally{W.p=s}}var Ca=Math.random().toString(36).slice(2),kt="__reactFiber$"+Ca,Tt="__reactProps$"+Ca,ua="__reactContainer$"+Ca,qs="__reactEvents$"+Ca,_l="__reactListeners$"+Ca,_a="__reactHandles$"+Ca,Vs="__reactResources$"+Ca,ce="__reactMarker$"+Ca;function re(e){delete e[kt],delete e[Tt],delete e[qs],delete e[_l],delete e[_a]}function Ne(e){var t=e[kt];if(t)return t;for(var s=e.parentNode;s;){if(t=s[ua]||s[kt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=dh(e);e!==null;){if(s=e[kt])return s;e=dh(e)}return t}e=s,s=e.parentNode}return null}function qe(e){if(e=e[kt]||e[ua]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Xe(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function Ze(e){var t=e[Vs];return t||(t=e[Vs]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function dt(e){e[ce]=!0}var et=new Set,w={};function se(e,t){ye(e,t),ye(e+"Capture",t)}function ye(e,t){for(w[e]=t,e=0;e<t.length;e++)et.add(t[e])}var _e=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]*$"),Qe={},Yt={};function ns(e){return Kt.call(Yt,e)?!0:Kt.call(Qe,e)?!1:_e.test(e)?Yt[e]=!0:(Qe[e]=!0,!1)}function Fa(e,t,s){if(ns(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function Gs(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Pa(e,t,s,l){if(l===null)e.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+l)}}function La(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ku(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zx(e,t,s){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var r=l.get,o=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(m){s=""+m,o.call(this,m)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(m){s=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function eo(e){if(!e._valueTracker){var t=Ku(e)?"checked":"value";e._valueTracker=zx(e,t,""+e[t])}}function Ju(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),l="";return e&&(l=Ku(e)?e.checked?"true":"false":e.value),e=l,e!==s?(t.setValue(e),!0):!1}function Ar(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}}var Ax=/[\n"\\]/g;function Ha(e){return e.replace(Ax,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function to(e,t,s,l,r,o,m,g){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+La(t)):e.value!==""+La(t)&&(e.value=""+La(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?ao(e,m,La(t)):s!=null?ao(e,m,La(s)):l!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+La(g):e.removeAttribute("name")}function Wu(e,t,s,l,r,o,m,g){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||s!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){eo(e);return}s=s!=null?""+La(s):"",t=t!=null?""+La(t):s,g||t===e.value||(e.value=t),e.defaultValue=t}l=l??r,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=g?e.checked:!!l,e.defaultChecked=!!l,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),eo(e)}function ao(e,t,s){t==="number"&&Ar(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function Ll(e,t,s,l){if(e=e.options,t){t={};for(var r=0;r<s.length;r++)t["$"+s[r]]=!0;for(s=0;s<e.length;s++)r=t.hasOwnProperty("$"+e[s].value),e[s].selected!==r&&(e[s].selected=r),r&&l&&(e[s].defaultSelected=!0)}else{for(s=""+La(s),t=null,r=0;r<e.length;r++){if(e[r].value===s){e[r].selected=!0,l&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Iu(e,t,s){if(t!=null&&(t=""+La(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+La(s):""}function Fu(e,t,s,l){if(t==null){if(l!=null){if(s!=null)throw Error(u(92));if(ge(l)){if(1<l.length)throw Error(u(93));l=l[0]}s=l}s==null&&(s=""),t=s}s=La(t),e.defaultValue=s,l=e.textContent,l===s&&l!==""&&l!==null&&(e.value=l),eo(e)}function Hl(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Ex=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 Pu(e,t,s){var l=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,s):typeof s!="number"||s===0||Ex.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function ed(e,t,s){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,s!=null){for(var l in s)!s.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var r in t)l=t[r],t.hasOwnProperty(r)&&s[r]!==l&&Pu(e,r,l)}else for(var o in t)t.hasOwnProperty(o)&&Pu(e,o,t[o])}function so(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 kx=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Tx=/^[\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 Er(e){return Tx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xs(){}var lo=null;function no(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bl=null,Ul=null;function td(e){var t=qe(e);if(t&&(e=t.stateNode)){var s=e[Tt]||null;e:switch(e=t.stateNode,t.type){case"input":if(to(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Ha(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var l=s[t];if(l!==e&&l.form===e.form){var r=l[Tt]||null;if(!r)throw Error(u(90));to(l,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<s.length;t++)l=s[t],l.form===e.form&&Ju(l)}break e;case"textarea":Iu(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Ll(e,!!s.multiple,t,!1)}}}var ro=!1;function ad(e,t,s){if(ro)return e(t,s);ro=!0;try{var l=e(t);return l}finally{if(ro=!1,(Bl!==null||Ul!==null)&&(pi(),Bl&&(t=Bl,e=Ul,Ul=Bl=null,td(t),e)))for(t=0;t<e.length;t++)td(e[t])}}function Cn(e,t){var s=e.stateNode;if(s===null)return null;var l=s[Tt]||null;if(l===null)return null;s=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(u(231,t,typeof s));return s}var vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),io=!1;if(vs)try{var zn={};Object.defineProperty(zn,"passive",{get:function(){io=!0}}),window.addEventListener("test",zn,zn),window.removeEventListener("test",zn,zn)}catch{io=!1}var Ys=null,oo=null,kr=null;function sd(){if(kr)return kr;var e,t=oo,s=t.length,l,r="value"in Ys?Ys.value:Ys.textContent,o=r.length;for(e=0;e<s&&t[e]===r[e];e++);var m=s-e;for(l=1;l<=m&&t[s-l]===r[o-l];l++);return kr=r.slice(e,1<l?1-l:void 0)}function Tr(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 Mr(){return!0}function ld(){return!1}function pa(e){function t(s,l,r,o,m){this._reactName=s,this._targetInst=r,this.type=l,this.nativeEvent=o,this.target=m,this.currentTarget=null;for(var g in e)e.hasOwnProperty(g)&&(s=e[g],this[g]=s?s(o):o[g]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Mr:ld,this.isPropagationStopped=ld,this}return y(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Mr)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Mr)},persist:function(){},isPersistent:Mr}),t}var pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=pa(pl),An=y({},pl,{view:0,detail:0}),Mx=pa(An),co,uo,En,Or=y({},An,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mo,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!==En&&(En&&e.type==="mousemove"?(co=e.screenX-En.screenX,uo=e.screenY-En.screenY):uo=co=0,En=e),co)},movementY:function(e){return"movementY"in e?e.movementY:uo}}),nd=pa(Or),Dx=y({},Or,{dataTransfer:0}),Ox=pa(Dx),Rx=y({},An,{relatedTarget:0}),fo=pa(Rx),_x=y({},pl,{animationName:0,elapsedTime:0,pseudoElement:0}),Lx=pa(_x),Hx=y({},pl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bx=pa(Hx),Ux=y({},pl,{data:0}),rd=pa(Ux),qx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vx={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"},Gx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gx[e])?!!t[e]:!1}function mo(){return Yx}var $x=y({},An,{key:function(e){if(e.key){var t=qx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Tr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mo,charCode:function(e){return e.type==="keypress"?Tr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qx=pa($x),Xx=y({},Or,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),id=pa(Xx),Zx=y({},An,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mo}),Kx=pa(Zx),Jx=y({},pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wx=pa(Jx),Ix=y({},Or,{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}),Fx=pa(Ix),Px=y({},pl,{newState:0,oldState:0}),ev=pa(Px),tv=[9,13,27,32],ho=vs&&"CompositionEvent"in window,kn=null;vs&&"documentMode"in document&&(kn=document.documentMode);var av=vs&&"TextEvent"in window&&!kn,od=vs&&(!ho||kn&&8<kn&&11>=kn),cd=" ",ud=!1;function dd(e,t){switch(e){case"keyup":return tv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ql=!1;function sv(e,t){switch(e){case"compositionend":return fd(t);case"keypress":return t.which!==32?null:(ud=!0,cd);case"textInput":return e=t.data,e===cd&&ud?null:e;default:return null}}function lv(e,t){if(ql)return e==="compositionend"||!ho&&dd(e,t)?(e=sd(),kr=oo=Ys=null,ql=!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 od&&t.locale!=="ko"?null:t.data;default:return null}}var nv={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 md(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nv[e.type]:t==="textarea"}function hd(e,t,s,l){Bl?Ul?Ul.push(l):Ul=[l]:Bl=l,t=Ni(t,"onChange"),0<t.length&&(s=new Dr("onChange","change",null,s,l),e.push({event:s,listeners:t}))}var Tn=null,Mn=null;function rv(e){Im(e,0)}function Rr(e){var t=Xe(e);if(Ju(t))return e}function pd(e,t){if(e==="change")return t}var xd=!1;if(vs){var po;if(vs){var xo="oninput"in document;if(!xo){var vd=document.createElement("div");vd.setAttribute("oninput","return;"),xo=typeof vd.oninput=="function"}po=xo}else po=!1;xd=po&&(!document.documentMode||9<document.documentMode)}function gd(){Tn&&(Tn.detachEvent("onpropertychange",bd),Mn=Tn=null)}function bd(e){if(e.propertyName==="value"&&Rr(Mn)){var t=[];hd(t,Mn,e,no(e)),ad(rv,t)}}function iv(e,t,s){e==="focusin"?(gd(),Tn=t,Mn=s,Tn.attachEvent("onpropertychange",bd)):e==="focusout"&&gd()}function ov(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rr(Mn)}function cv(e,t){if(e==="click")return Rr(t)}function uv(e,t){if(e==="input"||e==="change")return Rr(t)}function dv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var za=typeof Object.is=="function"?Object.is:dv;function Dn(e,t){if(za(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),l=Object.keys(t);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var r=s[l];if(!Kt.call(t,r)||!za(e[r],t[r]))return!1}return!0}function yd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jd(e,t){var s=yd(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=t&&l>=t)return{node:s,offset:t-e};e=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=yd(s)}}function Nd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ar(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Ar(e.document)}return t}function vo(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 fv=vs&&"documentMode"in document&&11>=document.documentMode,Vl=null,go=null,On=null,bo=!1;function wd(e,t,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;bo||Vl==null||Vl!==Ar(l)||(l=Vl,"selectionStart"in l&&vo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),On&&Dn(On,l)||(On=l,l=Ni(go,"onSelect"),0<l.length&&(t=new Dr("onSelect","select",null,t,s),e.push({event:t,listeners:l}),t.target=Vl)))}function xl(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Gl={animationend:xl("Animation","AnimationEnd"),animationiteration:xl("Animation","AnimationIteration"),animationstart:xl("Animation","AnimationStart"),transitionrun:xl("Transition","TransitionRun"),transitionstart:xl("Transition","TransitionStart"),transitioncancel:xl("Transition","TransitionCancel"),transitionend:xl("Transition","TransitionEnd")},yo={},Cd={};vs&&(Cd=document.createElement("div").style,"AnimationEvent"in window||(delete Gl.animationend.animation,delete Gl.animationiteration.animation,delete Gl.animationstart.animation),"TransitionEvent"in window||delete Gl.transitionend.transition);function vl(e){if(yo[e])return yo[e];if(!Gl[e])return e;var t=Gl[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Cd)return yo[e]=t[s];return e}var zd=vl("animationend"),Ad=vl("animationiteration"),Ed=vl("animationstart"),mv=vl("transitionrun"),hv=vl("transitionstart"),pv=vl("transitioncancel"),kd=vl("transitionend"),Td=new Map,jo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");jo.push("scrollEnd");function es(e,t){Td.set(e,t),se(t,[e])}var _r=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)},Ba=[],Yl=0,No=0;function Lr(){for(var e=Yl,t=No=Yl=0;t<e;){var s=Ba[t];Ba[t++]=null;var l=Ba[t];Ba[t++]=null;var r=Ba[t];Ba[t++]=null;var o=Ba[t];if(Ba[t++]=null,l!==null&&r!==null){var m=l.pending;m===null?r.next=r:(r.next=m.next,m.next=r),l.pending=r}o!==0&&Md(s,r,o)}}function Hr(e,t,s,l){Ba[Yl++]=e,Ba[Yl++]=t,Ba[Yl++]=s,Ba[Yl++]=l,No|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function So(e,t,s,l){return Hr(e,t,s,l),Br(e)}function gl(e,t){return Hr(e,null,null,t),Br(e)}function Md(e,t,s){e.lanes|=s;var l=e.alternate;l!==null&&(l.lanes|=s);for(var r=!1,o=e.return;o!==null;)o.childLanes|=s,l=o.alternate,l!==null&&(l.childLanes|=s),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-nt(s),e=o.hiddenUpdates,l=e[r],l===null?e[r]=[t]:l.push(t),t.lane=s|536870912),o):null}function Br(e){if(50<tr)throw tr=0,Dc=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $l={};function xv(e,t,s,l){this.tag=e,this.key=s,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Aa(e,t,s,l){return new xv(e,t,s,l)}function wo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gs(e,t){var s=e.alternate;return s===null?(s=Aa(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Dd(e,t){e.flags&=65011714;var s=e.alternate;return s===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=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ur(e,t,s,l,r,o){var m=0;if(l=e,typeof e=="function")wo(e)&&(m=1);else if(typeof e=="string")m=jg(e,s,D.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case he:return e=Aa(31,s,t,r),e.elementType=he,e.lanes=o,e;case B:return bl(s.children,r,o,t);case K:m=8,r|=24;break;case le:return e=Aa(12,s,t,r|2),e.elementType=le,e.lanes=o,e;case ne:return e=Aa(13,s,t,r),e.elementType=ne,e.lanes=o,e;case me:return e=Aa(19,s,t,r),e.elementType=me,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case oe:m=10;break e;case ve:m=9;break e;case $:m=11;break e;case ue:m=14;break e;case _:m=16,l=null;break e}m=29,s=Error(u(130,e===null?"null":typeof e,"")),l=null}return t=Aa(m,s,t,r),t.elementType=e,t.type=l,t.lanes=o,t}function bl(e,t,s,l){return e=Aa(7,e,l,t),e.lanes=s,e}function Co(e,t,s){return e=Aa(6,e,null,t),e.lanes=s,e}function Od(e){var t=Aa(18,null,null,0);return t.stateNode=e,t}function zo(e,t,s){return t=Aa(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Rd=new WeakMap;function Ua(e,t){if(typeof e=="object"&&e!==null){var s=Rd.get(e);return s!==void 0?s:(t={value:e,source:t,stack:ht(t)},Rd.set(e,t),t)}return{value:e,source:t,stack:ht(t)}}var Ql=[],Xl=0,qr=null,Rn=0,qa=[],Va=0,$s=null,rs=1,is="";function bs(e,t){Ql[Xl++]=Rn,Ql[Xl++]=qr,qr=e,Rn=t}function _d(e,t,s){qa[Va++]=rs,qa[Va++]=is,qa[Va++]=$s,$s=e;var l=rs;e=is;var r=32-nt(l)-1;l&=~(1<<r),s+=1;var o=32-nt(t)+r;if(30<o){var m=r-r%5;o=(l&(1<<m)-1).toString(32),l>>=m,r-=m,rs=1<<32-nt(t)+r|s<<r|l,is=o+e}else rs=1<<o|s<<r|l,is=e}function Ao(e){e.return!==null&&(bs(e,1),_d(e,1,0))}function Eo(e){for(;e===qr;)qr=Ql[--Xl],Ql[Xl]=null,Rn=Ql[--Xl],Ql[Xl]=null;for(;e===$s;)$s=qa[--Va],qa[Va]=null,is=qa[--Va],qa[Va]=null,rs=qa[--Va],qa[Va]=null}function Ld(e,t){qa[Va++]=rs,qa[Va++]=is,qa[Va++]=$s,rs=t.id,is=t.overflow,$s=e}var na=null,Mt=null,rt=!1,Qs=null,Ga=!1,ko=Error(u(519));function Xs(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _n(Ua(t,e)),ko}function Hd(e){var t=e.stateNode,s=e.type,l=e.memoizedProps;switch(t[kt]=e,t[Tt]=l,s){case"dialog":at("cancel",t),at("close",t);break;case"iframe":case"object":case"embed":at("load",t);break;case"video":case"audio":for(s=0;s<sr.length;s++)at(sr[s],t);break;case"source":at("error",t);break;case"img":case"image":case"link":at("error",t),at("load",t);break;case"details":at("toggle",t);break;case"input":at("invalid",t),Wu(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":at("invalid",t);break;case"textarea":at("invalid",t),Fu(t,l.value,l.defaultValue,l.children)}s=l.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||l.suppressHydrationWarning===!0||th(t.textContent,s)?(l.popover!=null&&(at("beforetoggle",t),at("toggle",t)),l.onScroll!=null&&at("scroll",t),l.onScrollEnd!=null&&at("scrollend",t),l.onClick!=null&&(t.onclick=xs),t=!0):t=!1,t||Xs(e,!0)}function Bd(e){for(na=e.return;na;)switch(na.tag){case 5:case 31:case 13:Ga=!1;return;case 27:case 3:Ga=!0;return;default:na=na.return}}function Zl(e){if(e!==na)return!1;if(!rt)return Bd(e),rt=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Zc(e.type,e.memoizedProps)),s=!s),s&&Mt&&Xs(e),Bd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Mt=uh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Mt=uh(e)}else t===27?(t=Mt,rl(e.type)?(e=Fc,Fc=null,Mt=e):Mt=t):Mt=na?$a(e.stateNode.nextSibling):null;return!0}function yl(){Mt=na=null,rt=!1}function To(){var e=Qs;return e!==null&&(ba===null?ba=e:ba.push.apply(ba,e),Qs=null),e}function _n(e){Qs===null?Qs=[e]:Qs.push(e)}var Mo=N(null),jl=null,ys=null;function Zs(e,t,s){I(Mo,t._currentValue),t._currentValue=s}function js(e){e._currentValue=Mo.current,R(Mo)}function Do(e,t,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===s)break;e=e.return}}function Oo(e,t,s,l){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var o=r.dependencies;if(o!==null){var m=r.child;o=o.firstContext;e:for(;o!==null;){var g=o;o=r;for(var C=0;C<t.length;C++)if(g.context===t[C]){o.lanes|=s,g=o.alternate,g!==null&&(g.lanes|=s),Do(o.return,s,e),l||(m=null);break e}o=g.next}}else if(r.tag===18){if(m=r.return,m===null)throw Error(u(341));m.lanes|=s,o=m.alternate,o!==null&&(o.lanes|=s),Do(m,s,e),m=null}else m=r.child;if(m!==null)m.return=r;else for(m=r;m!==null;){if(m===e){m=null;break}if(r=m.sibling,r!==null){r.return=m.return,m=r;break}m=m.return}r=m}}function Kl(e,t,s,l){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var m=r.alternate;if(m===null)throw Error(u(387));if(m=m.memoizedProps,m!==null){var g=r.type;za(r.pendingProps.value,m.value)||(e!==null?e.push(g):e=[g])}}else if(r===M.current){if(m=r.alternate,m===null)throw Error(u(387));m.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(or):e=[or])}r=r.return}e!==null&&Oo(t,e,s,l),t.flags|=262144}function Vr(e){for(e=e.firstContext;e!==null;){if(!za(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Nl(e){jl=e,ys=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ra(e){return Ud(jl,e)}function Gr(e,t){return jl===null&&Nl(e),Ud(e,t)}function Ud(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},ys===null){if(e===null)throw Error(u(308));ys=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ys=ys.next=t;return s}var vv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},gv=n.unstable_scheduleCallback,bv=n.unstable_NormalPriority,$t={$$typeof:oe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ro(){return{controller:new vv,data:new Map,refCount:0}}function Ln(e){e.refCount--,e.refCount===0&&gv(bv,function(){e.controller.abort()})}var Hn=null,_o=0,Jl=0,Wl=null;function yv(e,t){if(Hn===null){var s=Hn=[];_o=0,Jl=Bc(),Wl={status:"pending",value:void 0,then:function(l){s.push(l)}}}return _o++,t.then(qd,qd),t}function qd(){if(--_o===0&&Hn!==null){Wl!==null&&(Wl.status="fulfilled");var e=Hn;Hn=null,Jl=0,Wl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function jv(e,t){var s=[],l={status:"pending",value:null,reason:null,then:function(r){s.push(r)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var r=0;r<s.length;r++)(0,s[r])(t)},function(r){for(l.status="rejected",l.reason=r,r=0;r<s.length;r++)(0,s[r])(void 0)}),l}var Vd=E.S;E.S=function(e,t){Cm=Ye(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&yv(e,t),Vd!==null&&Vd(e,t)};var Sl=N(null);function Lo(){var e=Sl.current;return e!==null?e:Et.pooledCache}function Yr(e,t){t===null?I(Sl,Sl.current):I(Sl,t.pool)}function Gd(){var e=Lo();return e===null?null:{parent:$t._currentValue,pool:e}}var Il=Error(u(460)),Ho=Error(u(474)),$r=Error(u(542)),Qr={then:function(){}};function Yd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function $d(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(xs,xs),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xd(e),e;default:if(typeof t.status=="string")t.then(xs,xs);else{if(e=Et,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=l}},function(l){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xd(e),e}throw Cl=t,Il}}function wl(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Cl=s,Il):s}}var Cl=null;function Qd(){if(Cl===null)throw Error(u(459));var e=Cl;return Cl=null,e}function Xd(e){if(e===Il||e===$r)throw Error(u(483))}var Fl=null,Bn=0;function Xr(e){var t=Bn;return Bn+=1,Fl===null&&(Fl=[]),$d(Fl,e,t)}function Un(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Zr(e,t){throw t.$$typeof===z?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Zd(e){function t(O,A){if(e){var L=O.deletions;L===null?(O.deletions=[A],O.flags|=16):L.push(A)}}function s(O,A){if(!e)return null;for(;A!==null;)t(O,A),A=A.sibling;return null}function l(O){for(var A=new Map;O!==null;)O.key!==null?A.set(O.key,O):A.set(O.index,O),O=O.sibling;return A}function r(O,A){return O=gs(O,A),O.index=0,O.sibling=null,O}function o(O,A,L){return O.index=L,e?(L=O.alternate,L!==null?(L=L.index,L<A?(O.flags|=67108866,A):L):(O.flags|=67108866,A)):(O.flags|=1048576,A)}function m(O){return e&&O.alternate===null&&(O.flags|=67108866),O}function g(O,A,L,P){return A===null||A.tag!==6?(A=Co(L,O.mode,P),A.return=O,A):(A=r(A,L),A.return=O,A)}function C(O,A,L,P){var Be=L.type;return Be===B?J(O,A,L.props.children,P,L.key):A!==null&&(A.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===_&&wl(Be)===A.type)?(A=r(A,L.props),Un(A,L),A.return=O,A):(A=Ur(L.type,L.key,L.props,null,O.mode,P),Un(A,L),A.return=O,A)}function H(O,A,L,P){return A===null||A.tag!==4||A.stateNode.containerInfo!==L.containerInfo||A.stateNode.implementation!==L.implementation?(A=zo(L,O.mode,P),A.return=O,A):(A=r(A,L.children||[]),A.return=O,A)}function J(O,A,L,P,Be){return A===null||A.tag!==7?(A=bl(L,O.mode,P,Be),A.return=O,A):(A=r(A,L),A.return=O,A)}function ae(O,A,L){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=Co(""+A,O.mode,L),A.return=O,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case S:return L=Ur(A.type,A.key,A.props,null,O.mode,L),Un(L,A),L.return=O,L;case T:return A=zo(A,O.mode,L),A.return=O,A;case _:return A=wl(A),ae(O,A,L)}if(ge(A)||Z(A))return A=bl(A,O.mode,L,null),A.return=O,A;if(typeof A.then=="function")return ae(O,Xr(A),L);if(A.$$typeof===oe)return ae(O,Gr(O,A),L);Zr(O,A)}return null}function V(O,A,L,P){var Be=A!==null?A.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return Be!==null?null:g(O,A,""+L,P);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case S:return L.key===Be?C(O,A,L,P):null;case T:return L.key===Be?H(O,A,L,P):null;case _:return L=wl(L),V(O,A,L,P)}if(ge(L)||Z(L))return Be!==null?null:J(O,A,L,P,null);if(typeof L.then=="function")return V(O,A,Xr(L),P);if(L.$$typeof===oe)return V(O,A,Gr(O,L),P);Zr(O,L)}return null}function Q(O,A,L,P,Be){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return O=O.get(L)||null,g(A,O,""+P,Be);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case S:return O=O.get(P.key===null?L:P.key)||null,C(A,O,P,Be);case T:return O=O.get(P.key===null?L:P.key)||null,H(A,O,P,Be);case _:return P=wl(P),Q(O,A,L,P,Be)}if(ge(P)||Z(P))return O=O.get(L)||null,J(A,O,P,Be,null);if(typeof P.then=="function")return Q(O,A,L,Xr(P),Be);if(P.$$typeof===oe)return Q(O,A,L,Gr(A,P),Be);Zr(A,P)}return null}function Ee(O,A,L,P){for(var Be=null,ft=null,Re=A,Je=A=0,lt=null;Re!==null&&Je<L.length;Je++){Re.index>Je?(lt=Re,Re=null):lt=Re.sibling;var mt=V(O,Re,L[Je],P);if(mt===null){Re===null&&(Re=lt);break}e&&Re&&mt.alternate===null&&t(O,Re),A=o(mt,A,Je),ft===null?Be=mt:ft.sibling=mt,ft=mt,Re=lt}if(Je===L.length)return s(O,Re),rt&&bs(O,Je),Be;if(Re===null){for(;Je<L.length;Je++)Re=ae(O,L[Je],P),Re!==null&&(A=o(Re,A,Je),ft===null?Be=Re:ft.sibling=Re,ft=Re);return rt&&bs(O,Je),Be}for(Re=l(Re);Je<L.length;Je++)lt=Q(Re,O,Je,L[Je],P),lt!==null&&(e&<.alternate!==null&&Re.delete(lt.key===null?Je:lt.key),A=o(lt,A,Je),ft===null?Be=lt:ft.sibling=lt,ft=lt);return e&&Re.forEach(function(dl){return t(O,dl)}),rt&&bs(O,Je),Be}function Ve(O,A,L,P){if(L==null)throw Error(u(151));for(var Be=null,ft=null,Re=A,Je=A=0,lt=null,mt=L.next();Re!==null&&!mt.done;Je++,mt=L.next()){Re.index>Je?(lt=Re,Re=null):lt=Re.sibling;var dl=V(O,Re,mt.value,P);if(dl===null){Re===null&&(Re=lt);break}e&&Re&&dl.alternate===null&&t(O,Re),A=o(dl,A,Je),ft===null?Be=dl:ft.sibling=dl,ft=dl,Re=lt}if(mt.done)return s(O,Re),rt&&bs(O,Je),Be;if(Re===null){for(;!mt.done;Je++,mt=L.next())mt=ae(O,mt.value,P),mt!==null&&(A=o(mt,A,Je),ft===null?Be=mt:ft.sibling=mt,ft=mt);return rt&&bs(O,Je),Be}for(Re=l(Re);!mt.done;Je++,mt=L.next())mt=Q(Re,O,Je,mt.value,P),mt!==null&&(e&&mt.alternate!==null&&Re.delete(mt.key===null?Je:mt.key),A=o(mt,A,Je),ft===null?Be=mt:ft.sibling=mt,ft=mt);return e&&Re.forEach(function(Dg){return t(O,Dg)}),rt&&bs(O,Je),Be}function zt(O,A,L,P){if(typeof L=="object"&&L!==null&&L.type===B&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case S:e:{for(var Be=L.key;A!==null;){if(A.key===Be){if(Be=L.type,Be===B){if(A.tag===7){s(O,A.sibling),P=r(A,L.props.children),P.return=O,O=P;break e}}else if(A.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===_&&wl(Be)===A.type){s(O,A.sibling),P=r(A,L.props),Un(P,L),P.return=O,O=P;break e}s(O,A);break}else t(O,A);A=A.sibling}L.type===B?(P=bl(L.props.children,O.mode,P,L.key),P.return=O,O=P):(P=Ur(L.type,L.key,L.props,null,O.mode,P),Un(P,L),P.return=O,O=P)}return m(O);case T:e:{for(Be=L.key;A!==null;){if(A.key===Be)if(A.tag===4&&A.stateNode.containerInfo===L.containerInfo&&A.stateNode.implementation===L.implementation){s(O,A.sibling),P=r(A,L.children||[]),P.return=O,O=P;break e}else{s(O,A);break}else t(O,A);A=A.sibling}P=zo(L,O.mode,P),P.return=O,O=P}return m(O);case _:return L=wl(L),zt(O,A,L,P)}if(ge(L))return Ee(O,A,L,P);if(Z(L)){if(Be=Z(L),typeof Be!="function")throw Error(u(150));return L=Be.call(L),Ve(O,A,L,P)}if(typeof L.then=="function")return zt(O,A,Xr(L),P);if(L.$$typeof===oe)return zt(O,A,Gr(O,L),P);Zr(O,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,A!==null&&A.tag===6?(s(O,A.sibling),P=r(A,L),P.return=O,O=P):(s(O,A),P=Co(L,O.mode,P),P.return=O,O=P),m(O)):s(O,A)}return function(O,A,L,P){try{Bn=0;var Be=zt(O,A,L,P);return Fl=null,Be}catch(Re){if(Re===Il||Re===$r)throw Re;var ft=Aa(29,Re,null,O.mode);return ft.lanes=P,ft.return=O,ft}finally{}}}var zl=Zd(!0),Kd=Zd(!1),Ks=!1;function Bo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uo(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 Js(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ws(e,t,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(xt&2)!==0){var r=l.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),l.pending=t,t=Br(e),Md(e,null,s),t}return Hr(e,l,t,s),Br(e)}function qn(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Ot(e,s)}}function qo(e,t){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var r=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var m={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};o===null?r=o=m:o=o.next=m,s=s.next}while(s!==null);o===null?r=o=t:o=o.next=t}else r=o=t;s={baseState:l.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:l.shared,callbacks:l.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var Vo=!1;function Vn(){if(Vo){var e=Wl;if(e!==null)throw e}}function Gn(e,t,s,l){Vo=!1;var r=e.updateQueue;Ks=!1;var o=r.firstBaseUpdate,m=r.lastBaseUpdate,g=r.shared.pending;if(g!==null){r.shared.pending=null;var C=g,H=C.next;C.next=null,m===null?o=H:m.next=H,m=C;var J=e.alternate;J!==null&&(J=J.updateQueue,g=J.lastBaseUpdate,g!==m&&(g===null?J.firstBaseUpdate=H:g.next=H,J.lastBaseUpdate=C))}if(o!==null){var ae=r.baseState;m=0,J=H=C=null,g=o;do{var V=g.lane&-536870913,Q=V!==g.lane;if(Q?(st&V)===V:(l&V)===V){V!==0&&V===Jl&&(Vo=!0),J!==null&&(J=J.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var Ee=e,Ve=g;V=t;var zt=s;switch(Ve.tag){case 1:if(Ee=Ve.payload,typeof Ee=="function"){ae=Ee.call(zt,ae,V);break e}ae=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ve.payload,V=typeof Ee=="function"?Ee.call(zt,ae,V):Ee,V==null)break e;ae=y({},ae,V);break e;case 2:Ks=!0}}V=g.callback,V!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=r.callbacks,Q===null?r.callbacks=[V]:Q.push(V))}else Q={lane:V,tag:g.tag,payload:g.payload,callback:g.callback,next:null},J===null?(H=J=Q,C=ae):J=J.next=Q,m|=V;if(g=g.next,g===null){if(g=r.shared.pending,g===null)break;Q=g,g=Q.next,Q.next=null,r.lastBaseUpdate=Q,r.shared.pending=null}}while(!0);J===null&&(C=ae),r.baseState=C,r.firstBaseUpdate=H,r.lastBaseUpdate=J,o===null&&(r.shared.lanes=0),tl|=m,e.lanes=m,e.memoizedState=ae}}function Jd(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Wd(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Jd(s[e],t)}var Pl=N(null),Kr=N(0);function Id(e,t){e=Ts,I(Kr,e),I(Pl,t),Ts=e|t.baseLanes}function Go(){I(Kr,Ts),I(Pl,Pl.current)}function Yo(){Ts=Kr.current,R(Pl),R(Kr)}var Ea=N(null),Ya=null;function Is(e){var t=e.alternate;I(qt,qt.current&1),I(Ea,e),Ya===null&&(t===null||Pl.current!==null||t.memoizedState!==null)&&(Ya=e)}function $o(e){I(qt,qt.current),I(Ea,e),Ya===null&&(Ya=e)}function Fd(e){e.tag===22?(I(qt,qt.current),I(Ea,e),Ya===null&&(Ya=e)):Fs()}function Fs(){I(qt,qt.current),I(Ea,Ea.current)}function ka(e){R(Ea),Ya===e&&(Ya=null),R(qt)}var qt=N(0);function Jr(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Wc(s)||Ic(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){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 Ns=0,Ke=null,wt=null,Qt=null,Wr=!1,en=!1,Al=!1,Ir=0,Yn=0,tn=null,Nv=0;function Ht(){throw Error(u(321))}function Qo(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!za(e[s],t[s]))return!1;return!0}function Xo(e,t,s,l,r,o){return Ns=o,Ke=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Lf:ic,Al=!1,o=s(l,r),Al=!1,en&&(o=ef(t,s,l,r)),Pd(e),o}function Pd(e){E.H=Xn;var t=wt!==null&&wt.next!==null;if(Ns=0,Qt=wt=Ke=null,Wr=!1,Yn=0,tn=null,t)throw Error(u(300));e===null||Xt||(e=e.dependencies,e!==null&&Vr(e)&&(Xt=!0))}function ef(e,t,s,l){Ke=e;var r=0;do{if(en&&(tn=null),Yn=0,en=!1,25<=r)throw Error(u(301));if(r+=1,Qt=wt=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}E.H=Hf,o=t(s,l)}while(en);return o}function Sv(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?$n(t):t,e=e.useState()[0],(wt!==null?wt.memoizedState:null)!==e&&(Ke.flags|=1024),t}function Zo(){var e=Ir!==0;return Ir=0,e}function Ko(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Jo(e){if(Wr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Wr=!1}Ns=0,Qt=wt=Ke=null,en=!1,Yn=Ir=0,tn=null}function fa(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Ke.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Vt(){if(wt===null){var e=Ke.alternate;e=e!==null?e.memoizedState:null}else e=wt.next;var t=Qt===null?Ke.memoizedState:Qt.next;if(t!==null)Qt=t,wt=e;else{if(e===null)throw Ke.alternate===null?Error(u(467)):Error(u(310));wt=e,e={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Qt===null?Ke.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function Fr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $n(e){var t=Yn;return Yn+=1,tn===null&&(tn=[]),e=$d(tn,e,t),t=Ke,(Qt===null?t.memoizedState:Qt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Lf:ic),e}function Pr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $n(e);if(e.$$typeof===oe)return ra(e)}throw Error(u(438,String(e)))}function Wo(e){var t=null,s=Ke.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var l=Ke.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=Fr(),Ke.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),l=0;l<e;l++)s[l]=Oe;return t.index++,s}function Ss(e,t){return typeof t=="function"?t(e):t}function ei(e){var t=Vt();return Io(t,wt,e)}function Io(e,t,s){var l=e.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=s;var r=e.baseQueue,o=l.pending;if(o!==null){if(r!==null){var m=r.next;r.next=o.next,o.next=m}t.baseQueue=r=o,l.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var g=m=null,C=null,H=t,J=!1;do{var ae=H.lane&-536870913;if(ae!==H.lane?(st&ae)===ae:(Ns&ae)===ae){var V=H.revertLane;if(V===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ae===Jl&&(J=!0);else if((Ns&V)===V){H=H.next,V===Jl&&(J=!0);continue}else ae={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},C===null?(g=C=ae,m=o):C=C.next=ae,Ke.lanes|=V,tl|=V;ae=H.action,Al&&s(o,ae),o=H.hasEagerState?H.eagerState:s(o,ae)}else V={lane:ae,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},C===null?(g=C=V,m=o):C=C.next=V,Ke.lanes|=ae,tl|=ae;H=H.next}while(H!==null&&H!==t);if(C===null?m=o:C.next=g,!za(o,e.memoizedState)&&(Xt=!0,J&&(s=Wl,s!==null)))throw s;e.memoizedState=o,e.baseState=m,e.baseQueue=C,l.lastRenderedState=o}return r===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Fo(e){var t=Vt(),s=t.queue;if(s===null)throw Error(u(311));s.lastRenderedReducer=e;var l=s.dispatch,r=s.pending,o=t.memoizedState;if(r!==null){s.pending=null;var m=r=r.next;do o=e(o,m.action),m=m.next;while(m!==r);za(o,t.memoizedState)||(Xt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),s.lastRenderedState=o}return[o,l]}function tf(e,t,s){var l=Ke,r=Vt(),o=rt;if(o){if(s===void 0)throw Error(u(407));s=s()}else s=t();var m=!za((wt||r).memoizedState,s);if(m&&(r.memoizedState=s,Xt=!0),r=r.queue,tc(lf.bind(null,l,r,e),[e]),r.getSnapshot!==t||m||Qt!==null&&Qt.memoizedState.tag&1){if(l.flags|=2048,an(9,{destroy:void 0},sf.bind(null,l,r,s,t),null),Et===null)throw Error(u(349));o||(Ns&127)!==0||af(l,t,s)}return s}function af(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ke.updateQueue,t===null?(t=Fr(),Ke.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function sf(e,t,s,l){t.value=s,t.getSnapshot=l,nf(t)&&rf(e)}function lf(e,t,s){return s(function(){nf(t)&&rf(e)})}function nf(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!za(e,s)}catch{return!0}}function rf(e){var t=gl(e,2);t!==null&&ya(t,e,2)}function Po(e){var t=fa();if(typeof e=="function"){var s=e;if(e=s(),Al){Nt(!0);try{s()}finally{Nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:e},t}function of(e,t,s,l){return e.baseState=s,Io(e,wt,typeof l=="function"?l:Ss)}function wv(e,t,s,l,r){if(si(e))throw Error(u(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){o.listeners.push(m)}};E.T!==null?s(!0):o.isTransition=!1,l(o),s=t.pending,s===null?(o.next=t.pending=o,cf(t,o)):(o.next=s.next,t.pending=s.next=o)}}function cf(e,t){var s=t.action,l=t.payload,r=e.state;if(t.isTransition){var o=E.T,m={};E.T=m;try{var g=s(r,l),C=E.S;C!==null&&C(m,g),uf(e,t,g)}catch(H){ec(e,t,H)}finally{o!==null&&m.types!==null&&(o.types=m.types),E.T=o}}else try{o=s(r,l),uf(e,t,o)}catch(H){ec(e,t,H)}}function uf(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){df(e,t,l)},function(l){return ec(e,t,l)}):df(e,t,s)}function df(e,t,s){t.status="fulfilled",t.value=s,ff(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,cf(e,s)))}function ec(e,t,s){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=s,ff(t),t=t.next;while(t!==l)}e.action=null}function ff(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function mf(e,t){return t}function hf(e,t){if(rt){var s=Et.formState;if(s!==null){e:{var l=Ke;if(rt){if(Mt){t:{for(var r=Mt,o=Ga;r.nodeType!==8;){if(!o){r=null;break t}if(r=$a(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Mt=$a(r.nextSibling),l=r.data==="F!";break e}}Xs(l)}l=!1}l&&(t=s[0])}}return s=fa(),s.memoizedState=s.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mf,lastRenderedState:t},s.queue=l,s=Of.bind(null,Ke,l),l.dispatch=s,l=Po(!1),o=rc.bind(null,Ke,!1,l.queue),l=fa(),r={state:t,dispatch:null,action:e,pending:null},l.queue=r,s=wv.bind(null,Ke,r,o,s),r.dispatch=s,l.memoizedState=e,[t,s,!1]}function pf(e){var t=Vt();return xf(t,wt,e)}function xf(e,t,s){if(t=Io(e,t,mf)[0],e=ei(Ss)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=$n(t)}catch(m){throw m===Il?$r:m}else l=t;t=Vt();var r=t.queue,o=r.dispatch;return s!==t.memoizedState&&(Ke.flags|=2048,an(9,{destroy:void 0},Cv.bind(null,r,s),null)),[l,o,e]}function Cv(e,t){e.action=t}function vf(e){var t=Vt(),s=wt;if(s!==null)return xf(t,s,e);Vt(),t=t.memoizedState,s=Vt();var l=s.queue.dispatch;return s.memoizedState=e,[t,l,!1]}function an(e,t,s,l){return e={tag:e,create:s,deps:l,inst:t,next:null},t=Ke.updateQueue,t===null&&(t=Fr(),Ke.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,t.lastEffect=e),e}function gf(){return Vt().memoizedState}function ti(e,t,s,l){var r=fa();Ke.flags|=e,r.memoizedState=an(1|t,{destroy:void 0},s,l===void 0?null:l)}function ai(e,t,s,l){var r=Vt();l=l===void 0?null:l;var o=r.memoizedState.inst;wt!==null&&l!==null&&Qo(l,wt.memoizedState.deps)?r.memoizedState=an(t,o,s,l):(Ke.flags|=e,r.memoizedState=an(1|t,o,s,l))}function bf(e,t){ti(8390656,8,e,t)}function tc(e,t){ai(2048,8,e,t)}function zv(e){Ke.flags|=4;var t=Ke.updateQueue;if(t===null)t=Fr(),Ke.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function yf(e){var t=Vt().memoizedState;return zv({ref:t,nextImpl:e}),function(){if((xt&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function jf(e,t){return ai(4,2,e,t)}function Nf(e,t){return ai(4,4,e,t)}function Sf(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wf(e,t,s){s=s!=null?s.concat([e]):null,ai(4,4,Sf.bind(null,t,e),s)}function ac(){}function Cf(e,t){var s=Vt();t=t===void 0?null:t;var l=s.memoizedState;return t!==null&&Qo(t,l[1])?l[0]:(s.memoizedState=[e,t],e)}function zf(e,t){var s=Vt();t=t===void 0?null:t;var l=s.memoizedState;if(t!==null&&Qo(t,l[1]))return l[0];if(l=e(),Al){Nt(!0);try{e()}finally{Nt(!1)}}return s.memoizedState=[l,t],l}function sc(e,t,s){return s===void 0||(Ns&1073741824)!==0&&(st&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=Am(),Ke.lanes|=e,tl|=e,s)}function Af(e,t,s,l){return za(s,t)?s:Pl.current!==null?(e=sc(e,s,l),za(e,t)||(Xt=!0),e):(Ns&42)===0||(Ns&1073741824)!==0&&(st&261930)===0?(Xt=!0,e.memoizedState=s):(e=Am(),Ke.lanes|=e,tl|=e,t)}function Ef(e,t,s,l,r){var o=W.p;W.p=o!==0&&8>o?o:8;var m=E.T,g={};E.T=g,rc(e,!1,t,s);try{var C=r(),H=E.S;if(H!==null&&H(g,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var J=jv(C,l);Qn(e,t,J,Da(e))}else Qn(e,t,l,Da(e))}catch(ae){Qn(e,t,{then:function(){},status:"rejected",reason:ae},Da())}finally{W.p=o,m!==null&&g.types!==null&&(m.types=g.types),E.T=m}}function Av(){}function lc(e,t,s,l){if(e.tag!==5)throw Error(u(476));var r=kf(e).queue;Ef(e,r,t,pe,s===null?Av:function(){return Tf(e),s(l)})}function kf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:pe},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Tf(e){var t=kf(e);t.next===null&&(t=e.alternate.memoizedState),Qn(e,t.next.queue,{},Da())}function nc(){return ra(or)}function Mf(){return Vt().memoizedState}function Df(){return Vt().memoizedState}function Ev(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Da();e=Js(s);var l=Ws(t,e,s);l!==null&&(ya(l,t,s),qn(l,t,s)),t={cache:Ro()},e.payload=t;return}t=t.return}}function kv(e,t,s){var l=Da();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},si(e)?Rf(t,s):(s=So(e,t,s,l),s!==null&&(ya(s,e,l),_f(s,t,l)))}function Of(e,t,s){var l=Da();Qn(e,t,s,l)}function Qn(e,t,s,l){var r={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(si(e))Rf(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var m=t.lastRenderedState,g=o(m,s);if(r.hasEagerState=!0,r.eagerState=g,za(g,m))return Hr(e,t,r,0),Et===null&&Lr(),!1}catch{}finally{}if(s=So(e,t,r,l),s!==null)return ya(s,e,l),_f(s,t,l),!0}return!1}function rc(e,t,s,l){if(l={lane:2,revertLane:Bc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},si(e)){if(t)throw Error(u(479))}else t=So(e,s,l,2),t!==null&&ya(t,e,2)}function si(e){var t=e.alternate;return e===Ke||t!==null&&t===Ke}function Rf(e,t){en=Wr=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function _f(e,t,s){if((s&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Ot(e,s)}}var Xn={readContext:ra,use:Pr,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};Xn.useEffectEvent=Ht;var Lf={readContext:ra,use:Pr,useCallback:function(e,t){return fa().memoizedState=[e,t===void 0?null:t],e},useContext:ra,useEffect:bf,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,ti(4194308,4,Sf.bind(null,t,e),s)},useLayoutEffect:function(e,t){return ti(4194308,4,e,t)},useInsertionEffect:function(e,t){ti(4,2,e,t)},useMemo:function(e,t){var s=fa();t=t===void 0?null:t;var l=e();if(Al){Nt(!0);try{e()}finally{Nt(!1)}}return s.memoizedState=[l,t],l},useReducer:function(e,t,s){var l=fa();if(s!==void 0){var r=s(t);if(Al){Nt(!0);try{s(t)}finally{Nt(!1)}}}else r=t;return l.memoizedState=l.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},l.queue=e,e=e.dispatch=kv.bind(null,Ke,e),[l.memoizedState,e]},useRef:function(e){var t=fa();return e={current:e},t.memoizedState=e},useState:function(e){e=Po(e);var t=e.queue,s=Of.bind(null,Ke,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:ac,useDeferredValue:function(e,t){var s=fa();return sc(s,e,t)},useTransition:function(){var e=Po(!1);return e=Ef.bind(null,Ke,e.queue,!0,!1),fa().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var l=Ke,r=fa();if(rt){if(s===void 0)throw Error(u(407));s=s()}else{if(s=t(),Et===null)throw Error(u(349));(st&127)!==0||af(l,t,s)}r.memoizedState=s;var o={value:s,getSnapshot:t};return r.queue=o,bf(lf.bind(null,l,o,e),[e]),l.flags|=2048,an(9,{destroy:void 0},sf.bind(null,l,o,s,t),null),s},useId:function(){var e=fa(),t=Et.identifierPrefix;if(rt){var s=is,l=rs;s=(l&~(1<<32-nt(l)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Ir++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=Nv++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nc,useFormState:hf,useActionState:hf,useOptimistic:function(e){var t=fa();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=rc.bind(null,Ke,!0,s),s.dispatch=t,[e,t]},useMemoCache:Wo,useCacheRefresh:function(){return fa().memoizedState=Ev.bind(null,Ke)},useEffectEvent:function(e){var t=fa(),s={impl:e};return t.memoizedState=s,function(){if((xt&2)!==0)throw Error(u(440));return s.impl.apply(void 0,arguments)}}},ic={readContext:ra,use:Pr,useCallback:Cf,useContext:ra,useEffect:tc,useImperativeHandle:wf,useInsertionEffect:jf,useLayoutEffect:Nf,useMemo:zf,useReducer:ei,useRef:gf,useState:function(){return ei(Ss)},useDebugValue:ac,useDeferredValue:function(e,t){var s=Vt();return Af(s,wt.memoizedState,e,t)},useTransition:function(){var e=ei(Ss)[0],t=Vt().memoizedState;return[typeof e=="boolean"?e:$n(e),t]},useSyncExternalStore:tf,useId:Mf,useHostTransitionStatus:nc,useFormState:pf,useActionState:pf,useOptimistic:function(e,t){var s=Vt();return of(s,wt,e,t)},useMemoCache:Wo,useCacheRefresh:Df};ic.useEffectEvent=yf;var Hf={readContext:ra,use:Pr,useCallback:Cf,useContext:ra,useEffect:tc,useImperativeHandle:wf,useInsertionEffect:jf,useLayoutEffect:Nf,useMemo:zf,useReducer:Fo,useRef:gf,useState:function(){return Fo(Ss)},useDebugValue:ac,useDeferredValue:function(e,t){var s=Vt();return wt===null?sc(s,e,t):Af(s,wt.memoizedState,e,t)},useTransition:function(){var e=Fo(Ss)[0],t=Vt().memoizedState;return[typeof e=="boolean"?e:$n(e),t]},useSyncExternalStore:tf,useId:Mf,useHostTransitionStatus:nc,useFormState:vf,useActionState:vf,useOptimistic:function(e,t){var s=Vt();return wt!==null?of(s,wt,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Wo,useCacheRefresh:Df};Hf.useEffectEvent=yf;function oc(e,t,s,l){t=e.memoizedState,s=s(l,t),s=s==null?t:y({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var cc={enqueueSetState:function(e,t,s){e=e._reactInternals;var l=Da(),r=Js(l);r.payload=t,s!=null&&(r.callback=s),t=Ws(e,r,l),t!==null&&(ya(t,e,l),qn(t,e,l))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var l=Da(),r=Js(l);r.tag=1,r.payload=t,s!=null&&(r.callback=s),t=Ws(e,r,l),t!==null&&(ya(t,e,l),qn(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Da(),l=Js(s);l.tag=2,t!=null&&(l.callback=t),t=Ws(e,l,s),t!==null&&(ya(t,e,s),qn(t,e,s))}};function Bf(e,t,s,l,r,o,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,o,m):t.prototype&&t.prototype.isPureReactComponent?!Dn(s,l)||!Dn(r,o):!0}function Uf(e,t,s,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,l),t.state!==e&&cc.enqueueReplaceState(t,t.state,null)}function El(e,t){var s=t;if("ref"in t){s={};for(var l in t)l!=="ref"&&(s[l]=t[l])}if(e=e.defaultProps){s===t&&(s=y({},s));for(var r in e)s[r]===void 0&&(s[r]=e[r])}return s}function qf(e){_r(e)}function Vf(e){console.error(e)}function Gf(e){_r(e)}function li(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Yf(e,t,s){try{var l=e.onCaughtError;l(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function uc(e,t,s){return s=Js(s),s.tag=3,s.payload={element:null},s.callback=function(){li(e,t)},s}function $f(e){return e=Js(e),e.tag=3,e}function Qf(e,t,s,l){var r=s.type.getDerivedStateFromError;if(typeof r=="function"){var o=l.value;e.payload=function(){return r(o)},e.callback=function(){Yf(t,s,l)}}var m=s.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){Yf(t,s,l),typeof r!="function"&&(al===null?al=new Set([this]):al.add(this));var g=l.stack;this.componentDidCatch(l.value,{componentStack:g!==null?g:""})})}function Tv(e,t,s,l,r){if(s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=s.alternate,t!==null&&Kl(t,s,r,!0),s=Ea.current,s!==null){switch(s.tag){case 31:case 13:return Ya===null?xi():s.alternate===null&&Bt===0&&(Bt=3),s.flags&=-257,s.flags|=65536,s.lanes=r,l===Qr?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([l]):t.add(l),_c(e,l,r)),!1;case 22:return s.flags|=65536,l===Qr?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([l]):s.add(l)),_c(e,l,r)),!1}throw Error(u(435,s.tag))}return _c(e,l,r),xi(),!1}if(rt)return t=Ea.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,l!==ko&&(e=Error(u(422),{cause:l}),_n(Ua(e,s)))):(l!==ko&&(t=Error(u(423),{cause:l}),_n(Ua(t,s))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,l=Ua(l,s),r=uc(e.stateNode,l,r),qo(e,r),Bt!==4&&(Bt=2)),!1;var o=Error(u(520),{cause:l});if(o=Ua(o,s),er===null?er=[o]:er.push(o),Bt!==4&&(Bt=2),t===null)return!0;l=Ua(l,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=r&-r,s.lanes|=e,e=uc(s.stateNode,l,e),qo(s,e),!1;case 1:if(t=s.type,o=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(al===null||!al.has(o))))return s.flags|=65536,r&=-r,s.lanes|=r,r=$f(r),Qf(r,e,s,l),qo(s,r),!1}s=s.return}while(s!==null);return!1}var dc=Error(u(461)),Xt=!1;function ia(e,t,s,l){t.child=e===null?Kd(t,null,s,l):zl(t,e.child,s,l)}function Xf(e,t,s,l,r){s=s.render;var o=t.ref;if("ref"in l){var m={};for(var g in l)g!=="ref"&&(m[g]=l[g])}else m=l;return Nl(t),l=Xo(e,t,s,m,o,r),g=Zo(),e!==null&&!Xt?(Ko(e,t,r),ws(e,t,r)):(rt&&g&&Ao(t),t.flags|=1,ia(e,t,l,r),t.child)}function Zf(e,t,s,l,r){if(e===null){var o=s.type;return typeof o=="function"&&!wo(o)&&o.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=o,Kf(e,t,o,l,r)):(e=Ur(s.type,null,l,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!bc(e,r)){var m=o.memoizedProps;if(s=s.compare,s=s!==null?s:Dn,s(m,l)&&e.ref===t.ref)return ws(e,t,r)}return t.flags|=1,e=gs(o,l),e.ref=t.ref,e.return=t,t.child=e}function Kf(e,t,s,l,r){if(e!==null){var o=e.memoizedProps;if(Dn(o,l)&&e.ref===t.ref)if(Xt=!1,t.pendingProps=l=o,bc(e,r))(e.flags&131072)!==0&&(Xt=!0);else return t.lanes=e.lanes,ws(e,t,r)}return fc(e,t,s,l,r)}function Jf(e,t,s,l){var r=l.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|s:s,e!==null){for(l=t.child=e.child,r=0;l!==null;)r=r|l.lanes|l.childLanes,l=l.sibling;l=r&~o}else l=0,t.child=null;return Wf(e,t,o,s,l)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Yr(t,o!==null?o.cachePool:null),o!==null?Id(t,o):Go(),Fd(t);else return l=t.lanes=536870912,Wf(e,t,o!==null?o.baseLanes|s:s,s,l)}else o!==null?(Yr(t,o.cachePool),Id(t,o),Fs(),t.memoizedState=null):(e!==null&&Yr(t,null),Go(),Fs());return ia(e,t,r,s),t.child}function Zn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Wf(e,t,s,l,r){var o=Lo();return o=o===null?null:{parent:$t._currentValue,pool:o},t.memoizedState={baseLanes:s,cachePool:o},e!==null&&Yr(t,null),Go(),Fd(t),e!==null&&Kl(e,t,l,!0),t.childLanes=r,null}function ni(e,t){return t=ii({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function If(e,t,s){return zl(t,e.child,null,s),e=ni(t,t.pendingProps),e.flags|=2,ka(t),t.memoizedState=null,e}function Mv(e,t,s){var l=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(rt){if(l.mode==="hidden")return e=ni(t,l),t.lanes=536870912,Zn(null,e);if($o(t),(e=Mt)?(e=ch(e,Ga),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$s!==null?{id:rs,overflow:is}:null,retryLane:536870912,hydrationErrors:null},s=Od(e),s.return=t,t.child=s,na=t,Mt=null)):e=null,e===null)throw Xs(t);return t.lanes=536870912,null}return ni(t,l)}var o=e.memoizedState;if(o!==null){var m=o.dehydrated;if($o(t),r)if(t.flags&256)t.flags&=-257,t=If(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(Xt||Kl(e,t,s,!1),r=(s&e.childLanes)!==0,Xt||r){if(l=Et,l!==null&&(m=Ia(l,s),m!==0&&m!==o.retryLane))throw o.retryLane=m,gl(e,m),ya(l,e,m),dc;xi(),t=If(e,t,s)}else e=o.treeContext,Mt=$a(m.nextSibling),na=t,rt=!0,Qs=null,Ga=!1,e!==null&&Ld(t,e),t=ni(t,l),t.flags|=4096;return t}return e=gs(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ri(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(u(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function fc(e,t,s,l,r){return Nl(t),s=Xo(e,t,s,l,void 0,r),l=Zo(),e!==null&&!Xt?(Ko(e,t,r),ws(e,t,r)):(rt&&l&&Ao(t),t.flags|=1,ia(e,t,s,r),t.child)}function Ff(e,t,s,l,r,o){return Nl(t),t.updateQueue=null,s=ef(t,l,s,r),Pd(e),l=Zo(),e!==null&&!Xt?(Ko(e,t,o),ws(e,t,o)):(rt&&l&&Ao(t),t.flags|=1,ia(e,t,s,o),t.child)}function Pf(e,t,s,l,r){if(Nl(t),t.stateNode===null){var o=$l,m=s.contextType;typeof m=="object"&&m!==null&&(o=ra(m)),o=new s(l,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=cc,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=l,o.state=t.memoizedState,o.refs={},Bo(t),m=s.contextType,o.context=typeof m=="object"&&m!==null?ra(m):$l,o.state=t.memoizedState,m=s.getDerivedStateFromProps,typeof m=="function"&&(oc(t,s,m,l),o.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(m=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),m!==o.state&&cc.enqueueReplaceState(o,o.state,null),Gn(t,l,o,r),Vn(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){o=t.stateNode;var g=t.memoizedProps,C=El(s,g);o.props=C;var H=o.context,J=s.contextType;m=$l,typeof J=="object"&&J!==null&&(m=ra(J));var ae=s.getDerivedStateFromProps;J=typeof ae=="function"||typeof o.getSnapshotBeforeUpdate=="function",g=t.pendingProps!==g,J||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(g||H!==m)&&Uf(t,o,l,m),Ks=!1;var V=t.memoizedState;o.state=V,Gn(t,l,o,r),Vn(),H=t.memoizedState,g||V!==H||Ks?(typeof ae=="function"&&(oc(t,s,ae,l),H=t.memoizedState),(C=Ks||Bf(t,s,C,l,V,H,m))?(J||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=H),o.props=l,o.state=H,o.context=m,l=C):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{o=t.stateNode,Uo(e,t),m=t.memoizedProps,J=El(s,m),o.props=J,ae=t.pendingProps,V=o.context,H=s.contextType,C=$l,typeof H=="object"&&H!==null&&(C=ra(H)),g=s.getDerivedStateFromProps,(H=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(m!==ae||V!==C)&&Uf(t,o,l,C),Ks=!1,V=t.memoizedState,o.state=V,Gn(t,l,o,r),Vn();var Q=t.memoizedState;m!==ae||V!==Q||Ks||e!==null&&e.dependencies!==null&&Vr(e.dependencies)?(typeof g=="function"&&(oc(t,s,g,l),Q=t.memoizedState),(J=Ks||Bf(t,s,J,l,V,Q,C)||e!==null&&e.dependencies!==null&&Vr(e.dependencies))?(H||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(l,Q,C),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(l,Q,C)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||m===e.memoizedProps&&V===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&V===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Q),o.props=l,o.state=Q,o.context=C,l=J):(typeof o.componentDidUpdate!="function"||m===e.memoizedProps&&V===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&V===e.memoizedState||(t.flags|=1024),l=!1)}return o=l,ri(e,t),l=(t.flags&128)!==0,o||l?(o=t.stateNode,s=l&&typeof s.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&l?(t.child=zl(t,e.child,null,r),t.child=zl(t,null,s,r)):ia(e,t,s,r),t.memoizedState=o.state,e=t.child):e=ws(e,t,r),e}function em(e,t,s,l){return yl(),t.flags|=256,ia(e,t,s,l),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:Gd()}}function pc(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Ma),e}function tm(e,t,s){var l=t.pendingProps,r=!1,o=(t.flags&128)!==0,m;if((m=o)||(m=e!==null&&e.memoizedState===null?!1:(qt.current&2)!==0),m&&(r=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(rt){if(r?Is(t):Fs(),(e=Mt)?(e=ch(e,Ga),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$s!==null?{id:rs,overflow:is}:null,retryLane:536870912,hydrationErrors:null},s=Od(e),s.return=t,t.child=s,na=t,Mt=null)):e=null,e===null)throw Xs(t);return Ic(e)?t.lanes=32:t.lanes=536870912,null}var g=l.children;return l=l.fallback,r?(Fs(),r=t.mode,g=ii({mode:"hidden",children:g},r),l=bl(l,r,s,null),g.return=t,l.return=t,g.sibling=l,t.child=g,l=t.child,l.memoizedState=hc(s),l.childLanes=pc(e,m,s),t.memoizedState=mc,Zn(null,l)):(Is(t),xc(t,g))}var C=e.memoizedState;if(C!==null&&(g=C.dehydrated,g!==null)){if(o)t.flags&256?(Is(t),t.flags&=-257,t=vc(e,t,s)):t.memoizedState!==null?(Fs(),t.child=e.child,t.flags|=128,t=null):(Fs(),g=l.fallback,r=t.mode,l=ii({mode:"visible",children:l.children},r),g=bl(g,r,s,null),g.flags|=2,l.return=t,g.return=t,l.sibling=g,t.child=l,zl(t,e.child,null,s),l=t.child,l.memoizedState=hc(s),l.childLanes=pc(e,m,s),t.memoizedState=mc,t=Zn(null,l));else if(Is(t),Ic(g)){if(m=g.nextSibling&&g.nextSibling.dataset,m)var H=m.dgst;m=H,l=Error(u(419)),l.stack="",l.digest=m,_n({value:l,source:null,stack:null}),t=vc(e,t,s)}else if(Xt||Kl(e,t,s,!1),m=(s&e.childLanes)!==0,Xt||m){if(m=Et,m!==null&&(l=Ia(m,s),l!==0&&l!==C.retryLane))throw C.retryLane=l,gl(e,l),ya(m,e,l),dc;Wc(g)||xi(),t=vc(e,t,s)}else Wc(g)?(t.flags|=192,t.child=e.child,t=null):(e=C.treeContext,Mt=$a(g.nextSibling),na=t,rt=!0,Qs=null,Ga=!1,e!==null&&Ld(t,e),t=xc(t,l.children),t.flags|=4096);return t}return r?(Fs(),g=l.fallback,r=t.mode,C=e.child,H=C.sibling,l=gs(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&65011712,H!==null?g=gs(H,g):(g=bl(g,r,s,null),g.flags|=2),g.return=t,l.return=t,l.sibling=g,t.child=l,Zn(null,l),l=t.child,g=e.child.memoizedState,g===null?g=hc(s):(r=g.cachePool,r!==null?(C=$t._currentValue,r=r.parent!==C?{parent:C,pool:C}:r):r=Gd(),g={baseLanes:g.baseLanes|s,cachePool:r}),l.memoizedState=g,l.childLanes=pc(e,m,s),t.memoizedState=mc,Zn(e.child,l)):(Is(t),s=e.child,e=s.sibling,s=gs(s,{mode:"visible",children:l.children}),s.return=t,s.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=s,t.memoizedState=null,s)}function xc(e,t){return t=ii({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ii(e,t){return e=Aa(22,e,null,t),e.lanes=0,e}function vc(e,t,s){return zl(t,e.child,null,s),e=xc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function am(e,t,s){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Do(e.return,t,s)}function gc(e,t,s,l,r,o){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:r,treeForkCount:o}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=s,m.tailMode=r,m.treeForkCount=o)}function sm(e,t,s){var l=t.pendingProps,r=l.revealOrder,o=l.tail;l=l.children;var m=qt.current,g=(m&2)!==0;if(g?(m=m&1|2,t.flags|=128):m&=1,I(qt,m),ia(e,t,l,s),l=rt?Rn:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&am(e,s,t);else if(e.tag===19)am(e,s,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(r){case"forwards":for(s=t.child,r=null;s!==null;)e=s.alternate,e!==null&&Jr(e)===null&&(r=s),s=s.sibling;s=r,s===null?(r=t.child,t.child=null):(r=s.sibling,s.sibling=null),gc(t,!1,r,s,o,l);break;case"backwards":case"unstable_legacy-backwards":for(s=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Jr(e)===null){t.child=r;break}e=r.sibling,r.sibling=s,s=r,r=e}gc(t,!0,s,null,o,l);break;case"together":gc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function ws(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),tl|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(Kl(e,t,s,!1),(s&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,s=gs(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=gs(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function bc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Vr(e)))}function Dv(e,t,s){switch(t.tag){case 3:X(t,t.stateNode.containerInfo),Zs(t,$t,e.memoizedState.cache),yl();break;case 27:case 5:Ge(t);break;case 4:X(t,t.stateNode.containerInfo);break;case 10:Zs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$o(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Is(t),t.flags|=128,null):(s&t.child.childLanes)!==0?tm(e,t,s):(Is(t),e=ws(e,t,s),e!==null?e.sibling:null);Is(t);break;case 19:var r=(e.flags&128)!==0;if(l=(s&t.childLanes)!==0,l||(Kl(e,t,s,!1),l=(s&t.childLanes)!==0),r){if(l)return sm(e,t,s);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),I(qt,qt.current),l)break;return null;case 22:return t.lanes=0,Jf(e,t,s,t.pendingProps);case 24:Zs(t,$t,e.memoizedState.cache)}return ws(e,t,s)}function lm(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xt=!0;else{if(!bc(e,s)&&(t.flags&128)===0)return Xt=!1,Dv(e,t,s);Xt=(e.flags&131072)!==0}else Xt=!1,rt&&(t.flags&1048576)!==0&&_d(t,Rn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=wl(t.elementType),t.type=e,typeof e=="function")wo(e)?(l=El(e,l),t.tag=1,t=Pf(null,t,e,l,s)):(t.tag=0,t=fc(null,t,e,l,s));else{if(e!=null){var r=e.$$typeof;if(r===$){t.tag=11,t=Xf(null,t,e,l,s);break e}else if(r===ue){t.tag=14,t=Zf(null,t,e,l,s);break e}}throw t=de(e)||e,Error(u(306,t,""))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,s);case 1:return l=t.type,r=El(l,t.pendingProps),Pf(e,t,l,r,s);case 3:e:{if(X(t,t.stateNode.containerInfo),e===null)throw Error(u(387));l=t.pendingProps;var o=t.memoizedState;r=o.element,Uo(e,t),Gn(t,l,null,s);var m=t.memoizedState;if(l=m.cache,Zs(t,$t,l),l!==o.cache&&Oo(t,[$t],s,!0),Vn(),l=m.element,o.isDehydrated)if(o={element:l,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=em(e,t,l,s);break e}else if(l!==r){r=Ua(Error(u(424)),t),_n(r),t=em(e,t,l,s);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=$a(e.firstChild),na=t,rt=!0,Qs=null,Ga=!0,s=Kd(t,null,l,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(yl(),l===r){t=ws(e,t,s);break e}ia(e,t,l,s)}t=t.child}return t;case 26:return ri(e,t),e===null?(s=ph(t.type,null,t.pendingProps,null))?t.memoizedState=s:rt||(s=t.type,e=t.pendingProps,l=Si(U.current).createElement(s),l[kt]=t,l[Tt]=e,oa(l,s,e),dt(l),t.stateNode=l):t.memoizedState=ph(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ge(t),e===null&&rt&&(l=t.stateNode=fh(t.type,t.pendingProps,U.current),na=t,Ga=!0,r=Mt,rl(t.type)?(Fc=r,Mt=$a(l.firstChild)):Mt=r),ia(e,t,t.pendingProps.children,s),ri(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&rt&&((r=l=Mt)&&(l=og(l,t.type,t.pendingProps,Ga),l!==null?(t.stateNode=l,na=t,Mt=$a(l.firstChild),Ga=!1,r=!0):r=!1),r||Xs(t)),Ge(t),r=t.type,o=t.pendingProps,m=e!==null?e.memoizedProps:null,l=o.children,Zc(r,o)?l=null:m!==null&&Zc(r,m)&&(t.flags|=32),t.memoizedState!==null&&(r=Xo(e,t,Sv,null,null,s),or._currentValue=r),ri(e,t),ia(e,t,l,s),t.child;case 6:return e===null&&rt&&((e=s=Mt)&&(s=cg(s,t.pendingProps,Ga),s!==null?(t.stateNode=s,na=t,Mt=null,e=!0):e=!1),e||Xs(t)),null;case 13:return tm(e,t,s);case 4:return X(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=zl(t,null,l,s):ia(e,t,l,s),t.child;case 11:return Xf(e,t,t.type,t.pendingProps,s);case 7:return ia(e,t,t.pendingProps,s),t.child;case 8:return ia(e,t,t.pendingProps.children,s),t.child;case 12:return ia(e,t,t.pendingProps.children,s),t.child;case 10:return l=t.pendingProps,Zs(t,t.type,l.value),ia(e,t,l.children,s),t.child;case 9:return r=t.type._context,l=t.pendingProps.children,Nl(t),r=ra(r),l=l(r),t.flags|=1,ia(e,t,l,s),t.child;case 14:return Zf(e,t,t.type,t.pendingProps,s);case 15:return Kf(e,t,t.type,t.pendingProps,s);case 19:return sm(e,t,s);case 31:return Mv(e,t,s);case 22:return Jf(e,t,s,t.pendingProps);case 24:return Nl(t),l=ra($t),e===null?(r=Lo(),r===null&&(r=Et,o=Ro(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=s),r=o),t.memoizedState={parent:l,cache:r},Bo(t),Zs(t,$t,r)):((e.lanes&s)!==0&&(Uo(e,t),Gn(t,null,null,s),Vn()),r=e.memoizedState,o=t.memoizedState,r.parent!==l?(r={parent:l,cache:l},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Zs(t,$t,l)):(l=o.cache,Zs(t,$t,l),l!==r.cache&&Oo(t,[$t],s,!0))),ia(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function Cs(e){e.flags|=4}function yc(e,t,s,l,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(Mm())e.flags|=8192;else throw Cl=Qr,Ho}else e.flags&=-16777217}function nm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!yh(t))if(Mm())e.flags|=8192;else throw Cl=Qr,Ho}function oi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Sa():536870912,e.lanes|=t,rn|=t)}function Kn(e,t){if(!rt)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(t)for(var r=e.child;r!==null;)s|=r.lanes|r.childLanes,l|=r.subtreeFlags&65011712,l|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)s|=r.lanes|r.childLanes,l|=r.subtreeFlags,l|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=l,e.childLanes=s,t}function Ov(e,t,s){var l=t.pendingProps;switch(Eo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(t),null;case 1:return Dt(t),null;case 3:return s=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),js($t),te(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Zl(t)?Cs(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,To())),Dt(t),null;case 26:var r=t.type,o=t.memoizedState;return e===null?(Cs(t),o!==null?(Dt(t),nm(t,o)):(Dt(t),yc(t,r,null,l,s))):o?o!==e.memoizedState?(Cs(t),Dt(t),nm(t,o)):(Dt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Cs(t),Dt(t),yc(t,r,e,l,s)),null;case 27:if(Se(t),s=U.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Cs(t);else{if(!l){if(t.stateNode===null)throw Error(u(166));return Dt(t),null}e=D.current,Zl(t)?Hd(t):(e=fh(r,l,s),t.stateNode=e,Cs(t))}return Dt(t),null;case 5:if(Se(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Cs(t);else{if(!l){if(t.stateNode===null)throw Error(u(166));return Dt(t),null}if(o=D.current,Zl(t))Hd(t);else{var m=Si(U.current);switch(o){case 1:o=m.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=m.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=m.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=m.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=m.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof l.is=="string"?m.createElement("select",{is:l.is}):m.createElement("select"),l.multiple?o.multiple=!0:l.size&&(o.size=l.size);break;default:o=typeof l.is=="string"?m.createElement(r,{is:l.is}):m.createElement(r)}}o[kt]=t,o[Tt]=l;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)o.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=o;e:switch(oa(o,r,l),r){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Cs(t)}}return Dt(t),yc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Cs(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(u(166));if(e=U.current,Zl(t)){if(e=t.stateNode,s=t.memoizedProps,l=null,r=na,r!==null)switch(r.tag){case 27:case 5:l=r.memoizedProps}e[kt]=t,e=!!(e.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||th(e.nodeValue,s)),e||Xs(t,!0)}else e=Si(e).createTextNode(l),e[kt]=t,t.stateNode=e}return Dt(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(l=Zl(t),s!==null){if(e===null){if(!l)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[kt]=t}else yl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Dt(t),e=!1}else s=To(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(ka(t),t):(ka(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Dt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Zl(t),l!==null&&l.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[kt]=t}else yl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Dt(t),r=!1}else r=To(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ka(t),t):(ka(t),null)}return ka(t),(t.flags&128)!==0?(t.lanes=s,t):(s=l!==null,e=e!==null&&e.memoizedState!==null,s&&(l=t.child,r=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(r=l.alternate.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==r&&(l.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),oi(t,t.updateQueue),Dt(t),null);case 4:return te(),e===null&&Gc(t.stateNode.containerInfo),Dt(t),null;case 10:return js(t.type),Dt(t),null;case 19:if(R(qt),l=t.memoizedState,l===null)return Dt(t),null;if(r=(t.flags&128)!==0,o=l.rendering,o===null)if(r)Kn(l,!1);else{if(Bt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=Jr(e),o!==null){for(t.flags|=128,Kn(l,!1),e=o.updateQueue,t.updateQueue=e,oi(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Dd(s,e),s=s.sibling;return I(qt,qt.current&1|2),rt&&bs(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&Ye()>mi&&(t.flags|=128,r=!0,Kn(l,!1),t.lanes=4194304)}else{if(!r)if(e=Jr(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,oi(t,e),Kn(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!rt)return Dt(t),null}else 2*Ye()-l.renderingStartTime>mi&&s!==536870912&&(t.flags|=128,r=!0,Kn(l,!1),t.lanes=4194304);l.isBackwards?(o.sibling=t.child,t.child=o):(e=l.last,e!==null?e.sibling=o:t.child=o,l.last=o)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Ye(),e.sibling=null,s=qt.current,I(qt,r?s&1|2:s&1),rt&&bs(t,l.treeForkCount),e):(Dt(t),null);case 22:case 23:return ka(t),Yo(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(s&536870912)!==0&&(t.flags&128)===0&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),s=t.updateQueue,s!==null&&oi(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==s&&(t.flags|=2048),e!==null&&R(Sl),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),js($t),Dt(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function Rv(e,t){switch(Eo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return js($t),te(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Se(t),null;case 31:if(t.memoizedState!==null){if(ka(t),t.alternate===null)throw Error(u(340));yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ka(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(qt),null;case 4:return te(),null;case 10:return js(t.type),null;case 22:case 23:return ka(t),Yo(),e!==null&&R(Sl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return js($t),null;case 25:return null;default:return null}}function rm(e,t){switch(Eo(t),t.tag){case 3:js($t),te();break;case 26:case 27:case 5:Se(t);break;case 4:te();break;case 31:t.memoizedState!==null&&ka(t);break;case 13:ka(t);break;case 19:R(qt);break;case 10:js(t.type);break;case 22:case 23:ka(t),Yo(),e!==null&&R(Sl);break;case 24:js($t)}}function Jn(e,t){try{var s=t.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var r=l.next;s=r;do{if((s.tag&e)===e){l=void 0;var o=s.create,m=s.inst;l=o(),m.destroy=l}s=s.next}while(s!==r)}}catch(g){yt(t,t.return,g)}}function Ps(e,t,s){try{var l=t.updateQueue,r=l!==null?l.lastEffect:null;if(r!==null){var o=r.next;l=o;do{if((l.tag&e)===e){var m=l.inst,g=m.destroy;if(g!==void 0){m.destroy=void 0,r=t;var C=s,H=g;try{H()}catch(J){yt(r,C,J)}}}l=l.next}while(l!==o)}}catch(J){yt(t,t.return,J)}}function im(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Wd(t,s)}catch(l){yt(e,e.return,l)}}}function om(e,t,s){s.props=El(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(l){yt(e,t,l)}}function Wn(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof s=="function"?e.refCleanup=s(l):s.current=l}}catch(r){yt(e,t,r)}}function os(e,t){var s=e.ref,l=e.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(r){yt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(r){yt(e,t,r)}else s.current=null}function cm(e){var t=e.type,s=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break e;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(r){yt(e,e.return,r)}}function jc(e,t,s){try{var l=e.stateNode;ag(l,e.type,s,t),l[Tt]=t}catch(r){yt(e,e.return,r)}}function um(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rl(e.type)||e.tag===4}function Nc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||um(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&&rl(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 Sc(e,t,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=xs));else if(l!==4&&(l===27&&rl(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(Sc(e,t,s),e=e.sibling;e!==null;)Sc(e,t,s),e=e.sibling}function ci(e,t,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(l!==4&&(l===27&&rl(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(ci(e,t,s),e=e.sibling;e!==null;)ci(e,t,s),e=e.sibling}function dm(e){var t=e.stateNode,s=e.memoizedProps;try{for(var l=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);oa(t,l,s),t[kt]=e,t[Tt]=s}catch(o){yt(e,e.return,o)}}var zs=!1,Zt=!1,wc=!1,fm=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function _v(e,t){if(e=e.containerInfo,Qc=Ti,e=Sd(e),vo(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var r=l.anchorOffset,o=l.focusNode;l=l.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var m=0,g=-1,C=-1,H=0,J=0,ae=e,V=null;t:for(;;){for(var Q;ae!==s||r!==0&&ae.nodeType!==3||(g=m+r),ae!==o||l!==0&&ae.nodeType!==3||(C=m+l),ae.nodeType===3&&(m+=ae.nodeValue.length),(Q=ae.firstChild)!==null;)V=ae,ae=Q;for(;;){if(ae===e)break t;if(V===s&&++H===r&&(g=m),V===o&&++J===l&&(C=m),(Q=ae.nextSibling)!==null)break;ae=V,V=ae.parentNode}ae=Q}s=g===-1||C===-1?null:{start:g,end:C}}else s=null}s=s||{start:0,end:0}}else s=null;for(Xc={focusedElem:e,selectionRange:s},Ti=!1,Pt=t;Pt!==null;)if(t=Pt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pt=e;else for(;Pt!==null;){switch(t=Pt,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)r=e[s],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,s=t,r=o.memoizedProps,o=o.memoizedState,l=s.stateNode;try{var Ee=El(s.type,r);e=l.getSnapshotBeforeUpdate(Ee,o),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ve){yt(s,s.return,Ve)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Jc(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Jc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(u(163))}if(e=t.sibling,e!==null){e.return=t.return,Pt=e;break}Pt=t.return}}function mm(e,t,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:Es(e,s),l&4&&Jn(5,s);break;case 1:if(Es(e,s),l&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(m){yt(s,s.return,m)}else{var r=El(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){yt(s,s.return,m)}}l&64&&im(s),l&512&&Wn(s,s.return);break;case 3:if(Es(e,s),l&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Wd(e,t)}catch(m){yt(s,s.return,m)}}break;case 27:t===null&&l&4&&dm(s);case 26:case 5:Es(e,s),t===null&&l&4&&cm(s),l&512&&Wn(s,s.return);break;case 12:Es(e,s);break;case 31:Es(e,s),l&4&&xm(e,s);break;case 13:Es(e,s),l&4&&vm(e,s),l&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=$v.bind(null,s),ug(e,s))));break;case 22:if(l=s.memoizedState!==null||zs,!l){t=t!==null&&t.memoizedState!==null||Zt,r=zs;var o=Zt;zs=l,(Zt=t)&&!o?ks(e,s,(s.subtreeFlags&8772)!==0):Es(e,s),zs=r,Zt=o}break;case 30:break;default:Es(e,s)}}function hm(e){var t=e.alternate;t!==null&&(e.alternate=null,hm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&re(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 Rt=null,xa=!1;function As(e,t,s){for(s=s.child;s!==null;)pm(e,t,s),s=s.sibling}function pm(e,t,s){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(sa,s)}catch{}switch(s.tag){case 26:Zt||os(s,t),As(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Zt||os(s,t);var l=Rt,r=xa;rl(s.type)&&(Rt=s.stateNode,xa=!1),As(e,t,s),nr(s.stateNode),Rt=l,xa=r;break;case 5:Zt||os(s,t);case 6:if(l=Rt,r=xa,Rt=null,As(e,t,s),Rt=l,xa=r,Rt!==null)if(xa)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(s.stateNode)}catch(o){yt(s,t,o)}else try{Rt.removeChild(s.stateNode)}catch(o){yt(s,t,o)}break;case 18:Rt!==null&&(xa?(e=Rt,ih(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),pn(e)):ih(Rt,s.stateNode));break;case 4:l=Rt,r=xa,Rt=s.stateNode.containerInfo,xa=!0,As(e,t,s),Rt=l,xa=r;break;case 0:case 11:case 14:case 15:Ps(2,s,t),Zt||Ps(4,s,t),As(e,t,s);break;case 1:Zt||(os(s,t),l=s.stateNode,typeof l.componentWillUnmount=="function"&&om(s,t,l)),As(e,t,s);break;case 21:As(e,t,s);break;case 22:Zt=(l=Zt)||s.memoizedState!==null,As(e,t,s),Zt=l;break;default:As(e,t,s)}}function xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{pn(e)}catch(s){yt(t,t.return,s)}}}function vm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{pn(e)}catch(s){yt(t,t.return,s)}}function Lv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fm),t;default:throw Error(u(435,e.tag))}}function ui(e,t){var s=Lv(e);t.forEach(function(l){if(!s.has(l)){s.add(l);var r=Qv.bind(null,e,l);l.then(r,r)}})}function va(e,t){var s=t.deletions;if(s!==null)for(var l=0;l<s.length;l++){var r=s[l],o=e,m=t,g=m;e:for(;g!==null;){switch(g.tag){case 27:if(rl(g.type)){Rt=g.stateNode,xa=!1;break e}break;case 5:Rt=g.stateNode,xa=!1;break e;case 3:case 4:Rt=g.stateNode.containerInfo,xa=!0;break e}g=g.return}if(Rt===null)throw Error(u(160));pm(o,m,r),Rt=null,xa=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gm(t,e),t=t.sibling}var ts=null;function gm(e,t){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:va(t,e),ga(e),l&4&&(Ps(3,e,e.return),Jn(3,e),Ps(5,e,e.return));break;case 1:va(t,e),ga(e),l&512&&(Zt||s===null||os(s,s.return)),l&64&&zs&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?l:s.concat(l))));break;case 26:var r=ts;if(va(t,e),ga(e),l&512&&(Zt||s===null||os(s,s.return)),l&4){var o=s!==null?s.memoizedState:null;if(l=e.memoizedState,s===null)if(l===null)if(e.stateNode===null){e:{l=e.type,s=e.memoizedProps,r=r.ownerDocument||r;t:switch(l){case"title":o=r.getElementsByTagName("title")[0],(!o||o[ce]||o[kt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(l),r.head.insertBefore(o,r.querySelector("head > title"))),oa(o,l,s),o[kt]=e,dt(o),l=o;break e;case"link":var m=gh("link","href",r).get(l+(s.href||""));if(m){for(var g=0;g<m.length;g++)if(o=m[g],o.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&o.getAttribute("rel")===(s.rel==null?null:s.rel)&&o.getAttribute("title")===(s.title==null?null:s.title)&&o.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){m.splice(g,1);break t}}o=r.createElement(l),oa(o,l,s),r.head.appendChild(o);break;case"meta":if(m=gh("meta","content",r).get(l+(s.content||""))){for(g=0;g<m.length;g++)if(o=m[g],o.getAttribute("content")===(s.content==null?null:""+s.content)&&o.getAttribute("name")===(s.name==null?null:s.name)&&o.getAttribute("property")===(s.property==null?null:s.property)&&o.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&o.getAttribute("charset")===(s.charSet==null?null:s.charSet)){m.splice(g,1);break t}}o=r.createElement(l),oa(o,l,s),r.head.appendChild(o);break;default:throw Error(u(468,l))}o[kt]=e,dt(o),l=o}e.stateNode=l}else bh(r,e.type,e.stateNode);else e.stateNode=vh(r,l,e.memoizedProps);else o!==l?(o===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):o.count--,l===null?bh(r,e.type,e.stateNode):vh(r,l,e.memoizedProps)):l===null&&e.stateNode!==null&&jc(e,e.memoizedProps,s.memoizedProps)}break;case 27:va(t,e),ga(e),l&512&&(Zt||s===null||os(s,s.return)),s!==null&&l&4&&jc(e,e.memoizedProps,s.memoizedProps);break;case 5:if(va(t,e),ga(e),l&512&&(Zt||s===null||os(s,s.return)),e.flags&32){r=e.stateNode;try{Hl(r,"")}catch(Ee){yt(e,e.return,Ee)}}l&4&&e.stateNode!=null&&(r=e.memoizedProps,jc(e,r,s!==null?s.memoizedProps:r)),l&1024&&(wc=!0);break;case 6:if(va(t,e),ga(e),l&4){if(e.stateNode===null)throw Error(u(162));l=e.memoizedProps,s=e.stateNode;try{s.nodeValue=l}catch(Ee){yt(e,e.return,Ee)}}break;case 3:if(zi=null,r=ts,ts=wi(t.containerInfo),va(t,e),ts=r,ga(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{pn(t.containerInfo)}catch(Ee){yt(e,e.return,Ee)}wc&&(wc=!1,bm(e));break;case 4:l=ts,ts=wi(e.stateNode.containerInfo),va(t,e),ga(e),ts=l;break;case 12:va(t,e),ga(e);break;case 31:va(t,e),ga(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ui(e,l)));break;case 13:va(t,e),ga(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(fi=Ye()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ui(e,l)));break;case 22:r=e.memoizedState!==null;var C=s!==null&&s.memoizedState!==null,H=zs,J=Zt;if(zs=H||r,Zt=J||C,va(t,e),Zt=J,zs=H,ga(e),l&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(s===null||C||zs||Zt||kl(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){C=s=t;try{if(o=C.stateNode,r)m=o.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{g=C.stateNode;var ae=C.memoizedProps.style,V=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;g.style.display=V==null||typeof V=="boolean"?"":(""+V).trim()}}catch(Ee){yt(C,C.return,Ee)}}}else if(t.tag===6){if(s===null){C=t;try{C.stateNode.nodeValue=r?"":C.memoizedProps}catch(Ee){yt(C,C.return,Ee)}}}else if(t.tag===18){if(s===null){C=t;try{var Q=C.stateNode;r?oh(Q,!0):oh(C.stateNode,!1)}catch(Ee){yt(C,C.return,Ee)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(s=l.retryQueue,s!==null&&(l.retryQueue=null,ui(e,s))));break;case 19:va(t,e),ga(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ui(e,l)));break;case 30:break;case 21:break;default:va(t,e),ga(e)}}function ga(e){var t=e.flags;if(t&2){try{for(var s,l=e.return;l!==null;){if(um(l)){s=l;break}l=l.return}if(s==null)throw Error(u(160));switch(s.tag){case 27:var r=s.stateNode,o=Nc(e);ci(e,o,r);break;case 5:var m=s.stateNode;s.flags&32&&(Hl(m,""),s.flags&=-33);var g=Nc(e);ci(e,g,m);break;case 3:case 4:var C=s.stateNode.containerInfo,H=Nc(e);Sc(e,H,C);break;default:throw Error(u(161))}}catch(J){yt(e,e.return,J)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function bm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;bm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Es(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)mm(e,t.alternate,t),t=t.sibling}function kl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ps(4,t,t.return),kl(t);break;case 1:os(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&om(t,t.return,s),kl(t);break;case 27:nr(t.stateNode);case 26:case 5:os(t,t.return),kl(t);break;case 22:t.memoizedState===null&&kl(t);break;case 30:kl(t);break;default:kl(t)}e=e.sibling}}function ks(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,r=e,o=t,m=o.flags;switch(o.tag){case 0:case 11:case 15:ks(r,o,s),Jn(4,o);break;case 1:if(ks(r,o,s),l=o,r=l.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(H){yt(l,l.return,H)}if(l=o,r=l.updateQueue,r!==null){var g=l.stateNode;try{var C=r.shared.hiddenCallbacks;if(C!==null)for(r.shared.hiddenCallbacks=null,r=0;r<C.length;r++)Jd(C[r],g)}catch(H){yt(l,l.return,H)}}s&&m&64&&im(o),Wn(o,o.return);break;case 27:dm(o);case 26:case 5:ks(r,o,s),s&&l===null&&m&4&&cm(o),Wn(o,o.return);break;case 12:ks(r,o,s);break;case 31:ks(r,o,s),s&&m&4&&xm(r,o);break;case 13:ks(r,o,s),s&&m&4&&vm(r,o);break;case 22:o.memoizedState===null&&ks(r,o,s),Wn(o,o.return);break;case 30:break;default:ks(r,o,s)}t=t.sibling}}function Cc(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Ln(s))}function zc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ln(e))}function as(e,t,s,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ym(e,t,s,l),t=t.sibling}function ym(e,t,s,l){var r=t.flags;switch(t.tag){case 0:case 11:case 15:as(e,t,s,l),r&2048&&Jn(9,t);break;case 1:as(e,t,s,l);break;case 3:as(e,t,s,l),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ln(e)));break;case 12:if(r&2048){as(e,t,s,l),e=t.stateNode;try{var o=t.memoizedProps,m=o.id,g=o.onPostCommit;typeof g=="function"&&g(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(C){yt(t,t.return,C)}}else as(e,t,s,l);break;case 31:as(e,t,s,l);break;case 13:as(e,t,s,l);break;case 23:break;case 22:o=t.stateNode,m=t.alternate,t.memoizedState!==null?o._visibility&2?as(e,t,s,l):In(e,t):o._visibility&2?as(e,t,s,l):(o._visibility|=2,sn(e,t,s,l,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Cc(m,t);break;case 24:as(e,t,s,l),r&2048&&zc(t.alternate,t);break;default:as(e,t,s,l)}}function sn(e,t,s,l,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,m=t,g=s,C=l,H=m.flags;switch(m.tag){case 0:case 11:case 15:sn(o,m,g,C,r),Jn(8,m);break;case 23:break;case 22:var J=m.stateNode;m.memoizedState!==null?J._visibility&2?sn(o,m,g,C,r):In(o,m):(J._visibility|=2,sn(o,m,g,C,r)),r&&H&2048&&Cc(m.alternate,m);break;case 24:sn(o,m,g,C,r),r&&H&2048&&zc(m.alternate,m);break;default:sn(o,m,g,C,r)}t=t.sibling}}function In(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,l=t,r=l.flags;switch(l.tag){case 22:In(s,l),r&2048&&Cc(l.alternate,l);break;case 24:In(s,l),r&2048&&zc(l.alternate,l);break;default:In(s,l)}t=t.sibling}}var Fn=8192;function ln(e,t,s){if(e.subtreeFlags&Fn)for(e=e.child;e!==null;)jm(e,t,s),e=e.sibling}function jm(e,t,s){switch(e.tag){case 26:ln(e,t,s),e.flags&Fn&&e.memoizedState!==null&&Ng(s,ts,e.memoizedState,e.memoizedProps);break;case 5:ln(e,t,s);break;case 3:case 4:var l=ts;ts=wi(e.stateNode.containerInfo),ln(e,t,s),ts=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Fn,Fn=16777216,ln(e,t,s),Fn=l):ln(e,t,s));break;default:ln(e,t,s)}}function Nm(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 Pn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var l=t[s];Pt=l,wm(l,e)}Nm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Sm(e),e=e.sibling}function Sm(e){switch(e.tag){case 0:case 11:case 15:Pn(e),e.flags&2048&&Ps(9,e,e.return);break;case 3:Pn(e);break;case 12:Pn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,di(e)):Pn(e);break;default:Pn(e)}}function di(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var l=t[s];Pt=l,wm(l,e)}Nm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ps(8,t,t.return),di(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,di(t));break;default:di(t)}e=e.sibling}}function wm(e,t){for(;Pt!==null;){var s=Pt;switch(s.tag){case 0:case 11:case 15:Ps(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var l=s.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ln(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,Pt=l;else e:for(s=e;Pt!==null;){l=Pt;var r=l.sibling,o=l.return;if(hm(l),l===s){Pt=null;break e}if(r!==null){r.return=o,Pt=r;break e}Pt=o}}}var Hv={getCacheForType:function(e){var t=ra($t),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return ra($t).controller.signal}},Bv=typeof WeakMap=="function"?WeakMap:Map,xt=0,Et=null,tt=null,st=0,bt=0,Ta=null,el=!1,nn=!1,Ac=!1,Ts=0,Bt=0,tl=0,Tl=0,Ec=0,Ma=0,rn=0,er=null,ba=null,kc=!1,fi=0,Cm=0,mi=1/0,hi=null,al=null,Jt=0,sl=null,on=null,Ms=0,Tc=0,Mc=null,zm=null,tr=0,Dc=null;function Da(){return(xt&2)!==0&&st!==0?st&-st:E.T!==null?Bc():wa()}function Am(){if(Ma===0)if((st&536870912)===0||rt){var e=He;He<<=1,(He&3932160)===0&&(He=262144),Ma=e}else Ma=536870912;return e=Ea.current,e!==null&&(e.flags|=32),Ma}function ya(e,t,s){(e===Et&&(bt===2||bt===9)||e.cancelPendingCommit!==null)&&(cn(e,0),ll(e,st,Ma,!1)),At(e,s),((xt&2)===0||e!==Et)&&(e===Et&&((xt&2)===0&&(Tl|=s),Bt===4&&ll(e,st,Ma,!1)),cs(e))}function Em(e,t,s){if((xt&6)!==0)throw Error(u(327));var l=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Ft(e,t),r=l?Vv(e,t):Rc(e,t,!0),o=l;do{if(r===0){nn&&!l&&ll(e,t,0,!1);break}else{if(s=e.current.alternate,o&&!Uv(s)){r=Rc(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var g=e;r=er;var C=g.current.memoizedState.isDehydrated;if(C&&(cn(g,m).flags|=256),m=Rc(g,m,!1),m!==2){if(Ac&&!C){g.errorRecoveryDisabledLanes|=o,Tl|=o,r=4;break e}o=ba,ba=r,o!==null&&(ba===null?ba=o:ba.push.apply(ba,o))}r=m}if(o=!1,r!==2)continue}}if(r===1){cn(e,0),ll(e,t,0,!0);break}e:{switch(l=e,o=r,o){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:ll(l,t,Ma,!el);break e;case 2:ba=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(r=fi+300-Ye(),10<r)){if(ll(l,t,Ma,!el),la(l,0,!0)!==0)break e;Ms=t,l.timeoutHandle=nh(km.bind(null,l,s,ba,hi,kc,t,Ma,Tl,rn,el,o,"Throttled",-0,0),r);break e}km(l,s,ba,hi,kc,t,Ma,Tl,rn,el,o,null,-0,0)}}break}while(!0);cs(e)}function km(e,t,s,l,r,o,m,g,C,H,J,ae,V,Q){if(e.timeoutHandle=-1,ae=t.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xs},jm(t,o,ae);var Ee=(o&62914560)===o?fi-Ye():(o&4194048)===o?Cm-Ye():0;if(Ee=Sg(ae,Ee),Ee!==null){Ms=o,e.cancelPendingCommit=Ee(Hm.bind(null,e,t,o,s,l,r,m,g,C,J,ae,null,V,Q)),ll(e,o,m,!H);return}}Hm(e,t,o,s,l,r,m,g,C)}function Uv(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var l=0;l<s.length;l++){var r=s[l],o=r.getSnapshot;r=r.value;try{if(!za(o(),r))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;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 ll(e,t,s,l){t&=~Ec,t&=~Tl,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var r=t;0<r;){var o=31-nt(r),m=1<<o;l[o]=-1,r&=~m}s!==0&&Fe(e,s,t)}function pi(){return(xt&6)===0?(ar(0),!1):!0}function Oc(){if(tt!==null){if(bt===0)var e=tt.return;else e=tt,ys=jl=null,Jo(e),Fl=null,Bn=0,e=tt;for(;e!==null;)rm(e.alternate,e),e=e.return;tt=null}}function cn(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,ng(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Ms=0,Oc(),Et=e,tt=s=gs(e.current,null),st=t,bt=0,Ta=null,el=!1,nn=Ft(e,t),Ac=!1,rn=Ma=Ec=Tl=tl=Bt=0,ba=er=null,kc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var r=31-nt(l),o=1<<r;t|=e[r],l&=~o}return Ts=t,Lr(),s}function Tm(e,t){Ke=null,E.H=Xn,t===Il||t===$r?(t=Qd(),bt=3):t===Ho?(t=Qd(),bt=4):bt=t===dc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ta=t,tt===null&&(Bt=1,li(e,Ua(t,e.current)))}function Mm(){var e=Ea.current;return e===null?!0:(st&4194048)===st?Ya===null:(st&62914560)===st||(st&536870912)!==0?e===Ya:!1}function Dm(){var e=E.H;return E.H=Xn,e===null?Xn:e}function Om(){var e=E.A;return E.A=Hv,e}function xi(){Bt=4,el||(st&4194048)!==st&&Ea.current!==null||(nn=!0),(tl&134217727)===0&&(Tl&134217727)===0||Et===null||ll(Et,st,Ma,!1)}function Rc(e,t,s){var l=xt;xt|=2;var r=Dm(),o=Om();(Et!==e||st!==t)&&(hi=null,cn(e,t)),t=!1;var m=Bt;e:do try{if(bt!==0&&tt!==null){var g=tt,C=Ta;switch(bt){case 8:Oc(),m=6;break e;case 3:case 2:case 9:case 6:Ea.current===null&&(t=!0);var H=bt;if(bt=0,Ta=null,un(e,g,C,H),s&&nn){m=0;break e}break;default:H=bt,bt=0,Ta=null,un(e,g,C,H)}}qv(),m=Bt;break}catch(J){Tm(e,J)}while(!0);return t&&e.shellSuspendCounter++,ys=jl=null,xt=l,E.H=r,E.A=o,tt===null&&(Et=null,st=0,Lr()),m}function qv(){for(;tt!==null;)Rm(tt)}function Vv(e,t){var s=xt;xt|=2;var l=Dm(),r=Om();Et!==e||st!==t?(hi=null,mi=Ye()+500,cn(e,t)):nn=Ft(e,t);e:do try{if(bt!==0&&tt!==null){t=tt;var o=Ta;t:switch(bt){case 1:bt=0,Ta=null,un(e,t,o,1);break;case 2:case 9:if(Yd(o)){bt=0,Ta=null,_m(t);break}t=function(){bt!==2&&bt!==9||Et!==e||(bt=7),cs(e)},o.then(t,t);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:Yd(o)?(bt=0,Ta=null,_m(t)):(bt=0,Ta=null,un(e,t,o,7));break;case 5:var m=null;switch(tt.tag){case 26:m=tt.memoizedState;case 5:case 27:var g=tt;if(m?yh(m):g.stateNode.complete){bt=0,Ta=null;var C=g.sibling;if(C!==null)tt=C;else{var H=g.return;H!==null?(tt=H,vi(H)):tt=null}break t}}bt=0,Ta=null,un(e,t,o,5);break;case 6:bt=0,Ta=null,un(e,t,o,6);break;case 8:Oc(),Bt=6;break e;default:throw Error(u(462))}}Gv();break}catch(J){Tm(e,J)}while(!0);return ys=jl=null,E.H=l,E.A=r,xt=s,tt!==null?0:(Et=null,st=0,Lr(),Bt)}function Gv(){for(;tt!==null&&!It();)Rm(tt)}function Rm(e){var t=lm(e.alternate,e,Ts);e.memoizedProps=e.pendingProps,t===null?vi(e):tt=t}function _m(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Ff(s,t,t.pendingProps,t.type,void 0,st);break;case 11:t=Ff(s,t,t.pendingProps,t.type.render,t.ref,st);break;case 5:Jo(t);default:rm(s,t),t=tt=Dd(t,Ts),t=lm(s,t,Ts)}e.memoizedProps=e.pendingProps,t===null?vi(e):tt=t}function un(e,t,s,l){ys=jl=null,Jo(t),Fl=null,Bn=0;var r=t.return;try{if(Tv(e,r,t,s,st)){Bt=1,li(e,Ua(s,e.current)),tt=null;return}}catch(o){if(r!==null)throw tt=r,o;Bt=1,li(e,Ua(s,e.current)),tt=null;return}t.flags&32768?(rt||l===1?e=!0:nn||(st&536870912)!==0?e=!1:(el=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ea.current,l!==null&&l.tag===13&&(l.flags|=16384))),Lm(t,e)):vi(t)}function vi(e){var t=e;do{if((t.flags&32768)!==0){Lm(t,el);return}e=t.return;var s=Ov(t.alternate,t,Ts);if(s!==null){tt=s;return}if(t=t.sibling,t!==null){tt=t;return}tt=t=e}while(t!==null);Bt===0&&(Bt=5)}function Lm(e,t){do{var s=Rv(e.alternate,e);if(s!==null){s.flags&=32767,tt=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){tt=e;return}tt=e=s}while(e!==null);Bt=6,tt=null}function Hm(e,t,s,l,r,o,m,g,C){e.cancelPendingCommit=null;do gi();while(Jt!==0);if((xt&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(o=t.lanes|t.childLanes,o|=No,Lt(e,s,o,m,g,C),e===Et&&(tt=Et=null,st=0),on=t,sl=e,Ms=s,Tc=o,Mc=r,zm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Xv(ut,function(){return Gm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null,r=W.p,W.p=2,m=xt,xt|=4;try{_v(e,t,s)}finally{xt=m,W.p=r,E.T=l}}Jt=1,Bm(),Um(),qm()}}function Bm(){if(Jt===1){Jt=0;var e=sl,t=on,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null;var l=W.p;W.p=2;var r=xt;xt|=4;try{gm(t,e);var o=Xc,m=Sd(e.containerInfo),g=o.focusedElem,C=o.selectionRange;if(m!==g&&g&&g.ownerDocument&&Nd(g.ownerDocument.documentElement,g)){if(C!==null&&vo(g)){var H=C.start,J=C.end;if(J===void 0&&(J=H),"selectionStart"in g)g.selectionStart=H,g.selectionEnd=Math.min(J,g.value.length);else{var ae=g.ownerDocument||document,V=ae&&ae.defaultView||window;if(V.getSelection){var Q=V.getSelection(),Ee=g.textContent.length,Ve=Math.min(C.start,Ee),zt=C.end===void 0?Ve:Math.min(C.end,Ee);!Q.extend&&Ve>zt&&(m=zt,zt=Ve,Ve=m);var O=jd(g,Ve),A=jd(g,zt);if(O&&A&&(Q.rangeCount!==1||Q.anchorNode!==O.node||Q.anchorOffset!==O.offset||Q.focusNode!==A.node||Q.focusOffset!==A.offset)){var L=ae.createRange();L.setStart(O.node,O.offset),Q.removeAllRanges(),Ve>zt?(Q.addRange(L),Q.extend(A.node,A.offset)):(L.setEnd(A.node,A.offset),Q.addRange(L))}}}}for(ae=[],Q=g;Q=Q.parentNode;)Q.nodeType===1&&ae.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<ae.length;g++){var P=ae[g];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}Ti=!!Qc,Xc=Qc=null}finally{xt=r,W.p=l,E.T=s}}e.current=t,Jt=2}}function Um(){if(Jt===2){Jt=0;var e=sl,t=on,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=E.T,E.T=null;var l=W.p;W.p=2;var r=xt;xt|=4;try{mm(e,t.alternate,t)}finally{xt=r,W.p=l,E.T=s}}Jt=3}}function qm(){if(Jt===4||Jt===3){Jt=0,Ce();var e=sl,t=on,s=Ms,l=zm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Jt=5:(Jt=0,on=sl=null,Vm(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(al=null),fe(s),t=t.stateNode,Gt&&typeof Gt.onCommitFiberRoot=="function")try{Gt.onCommitFiberRoot(sa,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=E.T,r=W.p,W.p=2,E.T=null;try{for(var o=e.onRecoverableError,m=0;m<l.length;m++){var g=l[m];o(g.value,{componentStack:g.stack})}}finally{E.T=t,W.p=r}}(Ms&3)!==0&&gi(),cs(e),r=e.pendingLanes,(s&261930)!==0&&(r&42)!==0?e===Dc?tr++:(tr=0,Dc=e):tr=0,ar(0)}}function Vm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ln(t)))}function gi(){return Bm(),Um(),qm(),Gm()}function Gm(){if(Jt!==5)return!1;var e=sl,t=Tc;Tc=0;var s=fe(Ms),l=E.T,r=W.p;try{W.p=32>s?32:s,E.T=null,s=Mc,Mc=null;var o=sl,m=Ms;if(Jt=0,on=sl=null,Ms=0,(xt&6)!==0)throw Error(u(331));var g=xt;if(xt|=4,Sm(o.current),ym(o,o.current,m,s),xt=g,ar(0,!1),Gt&&typeof Gt.onPostCommitFiberRoot=="function")try{Gt.onPostCommitFiberRoot(sa,o)}catch{}return!0}finally{W.p=r,E.T=l,Vm(e,t)}}function Ym(e,t,s){t=Ua(s,t),t=uc(e.stateNode,t,2),e=Ws(e,t,2),e!==null&&(At(e,2),cs(e))}function yt(e,t,s){if(e.tag===3)Ym(e,e,s);else for(;t!==null;){if(t.tag===3){Ym(t,e,s);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(al===null||!al.has(l))){e=Ua(s,e),s=$f(2),l=Ws(t,s,2),l!==null&&(Qf(s,l,t,e),At(l,2),cs(l));break}}t=t.return}}function _c(e,t,s){var l=e.pingCache;if(l===null){l=e.pingCache=new Bv;var r=new Set;l.set(t,r)}else r=l.get(t),r===void 0&&(r=new Set,l.set(t,r));r.has(s)||(Ac=!0,r.add(s),e=Yv.bind(null,e,t,s),t.then(e,e))}function Yv(e,t,s){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Et===e&&(st&s)===s&&(Bt===4||Bt===3&&(st&62914560)===st&&300>Ye()-fi?(xt&2)===0&&cn(e,0):Ec|=s,rn===st&&(rn=0)),cs(e)}function $m(e,t){t===0&&(t=Sa()),e=gl(e,t),e!==null&&(At(e,t),cs(e))}function $v(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),$m(e,s)}function Qv(e,t){var s=0;switch(e.tag){case 31:case 13:var l=e.stateNode,r=e.memoizedState;r!==null&&(s=r.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(u(314))}l!==null&&l.delete(t),$m(e,s)}function Xv(e,t){return ca(e,t)}var bi=null,dn=null,Lc=!1,yi=!1,Hc=!1,nl=0;function cs(e){e!==dn&&e.next===null&&(dn===null?bi=dn=e:dn=dn.next=e),yi=!0,Lc||(Lc=!0,Kv())}function ar(e,t){if(!Hc&&yi){Hc=!0;do for(var s=!1,l=bi;l!==null;){if(e!==0){var r=l.pendingLanes;if(r===0)var o=0;else{var m=l.suspendedLanes,g=l.pingedLanes;o=(1<<31-nt(42|e)+1)-1,o&=r&~(m&~g),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(s=!0,Km(l,o))}else o=st,o=la(l,l===Et?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||Ft(l,o)||(s=!0,Km(l,o));l=l.next}while(s);Hc=!1}}function Zv(){Qm()}function Qm(){yi=Lc=!1;var e=0;nl!==0&&lg()&&(e=nl);for(var t=Ye(),s=null,l=bi;l!==null;){var r=l.next,o=Xm(l,t);o===0?(l.next=null,s===null?bi=r:s.next=r,r===null&&(dn=s)):(s=l,(e!==0||(o&3)!==0)&&(yi=!0)),l=r}Jt!==0&&Jt!==5||ar(e),nl!==0&&(nl=0)}function Xm(e,t){for(var s=e.suspendedLanes,l=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var m=31-nt(o),g=1<<m,C=r[m];C===-1?((g&s)===0||(g&l)!==0)&&(r[m]=Na(g,t)):C<=t&&(e.expiredLanes|=g),o&=~g}if(t=Et,s=st,s=la(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,s===0||e===t&&(bt===2||bt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ea(l),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Ft(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(l!==null&&ea(l),fe(s)){case 2:case 8:s=Ut;break;case 32:s=ut;break;case 268435456:s=ta;break;default:s=ut}return l=Zm.bind(null,e),s=ca(s,l),e.callbackPriority=t,e.callbackNode=s,t}return l!==null&&l!==null&&ea(l),e.callbackPriority=2,e.callbackNode=null,2}function Zm(e,t){if(Jt!==0&&Jt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(gi()&&e.callbackNode!==s)return null;var l=st;return l=la(e,e===Et?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Em(e,l,t),Xm(e,Ye()),e.callbackNode!=null&&e.callbackNode===s?Zm.bind(null,e):null)}function Km(e,t){if(gi())return null;Em(e,t,!0)}function Kv(){rg(function(){(xt&6)!==0?ca(vt,Zv):Qm()})}function Bc(){if(nl===0){var e=Jl;e===0&&(e=we,we<<=1,(we&261888)===0&&(we=256)),nl=e}return nl}function Jm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Er(""+e)}function Wm(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function Jv(e,t,s,l,r){if(t==="submit"&&s&&s.stateNode===r){var o=Jm((r[Tt]||null).action),m=l.submitter;m&&(t=(t=m[Tt]||null)?Jm(t.formAction):m.getAttribute("formAction"),t!==null&&(o=t,m=null));var g=new Dr("action","action",null,l,r);e.push({event:g,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(nl!==0){var C=m?Wm(r,m):new FormData(r);lc(s,{pending:!0,data:C,method:r.method,action:o},null,C)}}else typeof o=="function"&&(g.preventDefault(),C=m?Wm(r,m):new FormData(r),lc(s,{pending:!0,data:C,method:r.method,action:o},o,C))},currentTarget:r}]})}}for(var Uc=0;Uc<jo.length;Uc++){var qc=jo[Uc],Wv=qc.toLowerCase(),Iv=qc[0].toUpperCase()+qc.slice(1);es(Wv,"on"+Iv)}es(zd,"onAnimationEnd"),es(Ad,"onAnimationIteration"),es(Ed,"onAnimationStart"),es("dblclick","onDoubleClick"),es("focusin","onFocus"),es("focusout","onBlur"),es(mv,"onTransitionRun"),es(hv,"onTransitionStart"),es(pv,"onTransitionCancel"),es(kd,"onTransitionEnd"),ye("onMouseEnter",["mouseout","mouseover"]),ye("onMouseLeave",["mouseout","mouseover"]),ye("onPointerEnter",["pointerout","pointerover"]),ye("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sr="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(" "),Fv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sr));function Im(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],r=l.event;l=l.listeners;e:{var o=void 0;if(t)for(var m=l.length-1;0<=m;m--){var g=l[m],C=g.instance,H=g.currentTarget;if(g=g.listener,C!==o&&r.isPropagationStopped())break e;o=g,r.currentTarget=H;try{o(r)}catch(J){_r(J)}r.currentTarget=null,o=C}else for(m=0;m<l.length;m++){if(g=l[m],C=g.instance,H=g.currentTarget,g=g.listener,C!==o&&r.isPropagationStopped())break e;o=g,r.currentTarget=H;try{o(r)}catch(J){_r(J)}r.currentTarget=null,o=C}}}}function at(e,t){var s=t[qs];s===void 0&&(s=t[qs]=new Set);var l=e+"__bubble";s.has(l)||(Fm(t,e,2,!1),s.add(l))}function Vc(e,t,s){var l=0;t&&(l|=4),Fm(s,e,l,t)}var ji="_reactListening"+Math.random().toString(36).slice(2);function Gc(e){if(!e[ji]){e[ji]=!0,et.forEach(function(s){s!=="selectionchange"&&(Fv.has(s)||Vc(s,!1,e),Vc(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ji]||(t[ji]=!0,Vc("selectionchange",!1,t))}}function Fm(e,t,s,l){switch(Ah(t)){case 2:var r=zg;break;case 8:r=Ag;break;default:r=su}s=r.bind(null,t,s,e),r=void 0,!io||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),l?r!==void 0?e.addEventListener(t,s,{capture:!0,passive:r}):e.addEventListener(t,s,!0):r!==void 0?e.addEventListener(t,s,{passive:r}):e.addEventListener(t,s,!1)}function Yc(e,t,s,l,r){var o=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var m=l.tag;if(m===3||m===4){var g=l.stateNode.containerInfo;if(g===r)break;if(m===4)for(m=l.return;m!==null;){var C=m.tag;if((C===3||C===4)&&m.stateNode.containerInfo===r)return;m=m.return}for(;g!==null;){if(m=Ne(g),m===null)return;if(C=m.tag,C===5||C===6||C===26||C===27){l=o=m;continue e}g=g.parentNode}}l=l.return}ad(function(){var H=o,J=no(s),ae=[];e:{var V=Td.get(e);if(V!==void 0){var Q=Dr,Ee=e;switch(e){case"keypress":if(Tr(s)===0)break e;case"keydown":case"keyup":Q=Qx;break;case"focusin":Ee="focus",Q=fo;break;case"focusout":Ee="blur",Q=fo;break;case"beforeblur":case"afterblur":Q=fo;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=nd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=Ox;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Kx;break;case zd:case Ad:case Ed:Q=Lx;break;case kd:Q=Wx;break;case"scroll":case"scrollend":Q=Mx;break;case"wheel":Q=Fx;break;case"copy":case"cut":case"paste":Q=Bx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=id;break;case"toggle":case"beforetoggle":Q=ev}var Ve=(t&4)!==0,zt=!Ve&&(e==="scroll"||e==="scrollend"),O=Ve?V!==null?V+"Capture":null:V;Ve=[];for(var A=H,L;A!==null;){var P=A;if(L=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||L===null||O===null||(P=Cn(A,O),P!=null&&Ve.push(lr(A,P,L))),zt)break;A=A.return}0<Ve.length&&(V=new Q(V,Ee,null,s,J),ae.push({event:V,listeners:Ve}))}}if((t&7)===0){e:{if(V=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",V&&s!==lo&&(Ee=s.relatedTarget||s.fromElement)&&(Ne(Ee)||Ee[ua]))break e;if((Q||V)&&(V=J.window===J?J:(V=J.ownerDocument)?V.defaultView||V.parentWindow:window,Q?(Ee=s.relatedTarget||s.toElement,Q=H,Ee=Ee?Ne(Ee):null,Ee!==null&&(zt=f(Ee),Ve=Ee.tag,Ee!==zt||Ve!==5&&Ve!==27&&Ve!==6)&&(Ee=null)):(Q=null,Ee=H),Q!==Ee)){if(Ve=nd,P="onMouseLeave",O="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(Ve=id,P="onPointerLeave",O="onPointerEnter",A="pointer"),zt=Q==null?V:Xe(Q),L=Ee==null?V:Xe(Ee),V=new Ve(P,A+"leave",Q,s,J),V.target=zt,V.relatedTarget=L,P=null,Ne(J)===H&&(Ve=new Ve(O,A+"enter",Ee,s,J),Ve.target=L,Ve.relatedTarget=zt,P=Ve),zt=P,Q&&Ee)t:{for(Ve=Pv,O=Q,A=Ee,L=0,P=O;P;P=Ve(P))L++;P=0;for(var Be=A;Be;Be=Ve(Be))P++;for(;0<L-P;)O=Ve(O),L--;for(;0<P-L;)A=Ve(A),P--;for(;L--;){if(O===A||A!==null&&O===A.alternate){Ve=O;break t}O=Ve(O),A=Ve(A)}Ve=null}else Ve=null;Q!==null&&Pm(ae,V,Q,Ve,!1),Ee!==null&&zt!==null&&Pm(ae,zt,Ee,Ve,!0)}}e:{if(V=H?Xe(H):window,Q=V.nodeName&&V.nodeName.toLowerCase(),Q==="select"||Q==="input"&&V.type==="file")var ft=pd;else if(md(V))if(xd)ft=uv;else{ft=ov;var Re=iv}else Q=V.nodeName,!Q||Q.toLowerCase()!=="input"||V.type!=="checkbox"&&V.type!=="radio"?H&&so(H.elementType)&&(ft=pd):ft=cv;if(ft&&(ft=ft(e,H))){hd(ae,ft,s,J);break e}Re&&Re(e,V,H),e==="focusout"&&H&&V.type==="number"&&H.memoizedProps.value!=null&&ao(V,"number",V.value)}switch(Re=H?Xe(H):window,e){case"focusin":(md(Re)||Re.contentEditable==="true")&&(Vl=Re,go=H,On=null);break;case"focusout":On=go=Vl=null;break;case"mousedown":bo=!0;break;case"contextmenu":case"mouseup":case"dragend":bo=!1,wd(ae,s,J);break;case"selectionchange":if(fv)break;case"keydown":case"keyup":wd(ae,s,J)}var Je;if(ho)e:{switch(e){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else ql?dd(e,s)&&(lt="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(lt="onCompositionStart");lt&&(od&&s.locale!=="ko"&&(ql||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&ql&&(Je=sd()):(Ys=J,oo="value"in Ys?Ys.value:Ys.textContent,ql=!0)),Re=Ni(H,lt),0<Re.length&&(lt=new rd(lt,e,null,s,J),ae.push({event:lt,listeners:Re}),Je?lt.data=Je:(Je=fd(s),Je!==null&&(lt.data=Je)))),(Je=av?sv(e,s):lv(e,s))&&(lt=Ni(H,"onBeforeInput"),0<lt.length&&(Re=new rd("onBeforeInput","beforeinput",null,s,J),ae.push({event:Re,listeners:lt}),Re.data=Je)),Jv(ae,e,H,s,J)}Im(ae,t)})}function lr(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Ni(e,t){for(var s=t+"Capture",l=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=Cn(e,s),r!=null&&l.unshift(lr(e,r,o)),r=Cn(e,t),r!=null&&l.push(lr(e,r,o))),e.tag===3)return l;e=e.return}return[]}function Pv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Pm(e,t,s,l,r){for(var o=t._reactName,m=[];s!==null&&s!==l;){var g=s,C=g.alternate,H=g.stateNode;if(g=g.tag,C!==null&&C===l)break;g!==5&&g!==26&&g!==27||H===null||(C=H,r?(H=Cn(s,o),H!=null&&m.unshift(lr(s,H,C))):r||(H=Cn(s,o),H!=null&&m.push(lr(s,H,C)))),s=s.return}m.length!==0&&e.push({event:t,listeners:m})}var eg=/\r\n?/g,tg=/\u0000|\uFFFD/g;function eh(e){return(typeof e=="string"?e:""+e).replace(eg,`
|
|
49
|
+
`).replace(tg,"")}function th(e,t){return t=eh(t),eh(e)===t}function Ct(e,t,s,l,r,o){switch(s){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Hl(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Hl(e,""+l);break;case"className":Gs(e,"class",l);break;case"tabIndex":Gs(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Gs(e,s,l);break;case"style":ed(e,l,o);break;case"data":if(t!=="object"){Gs(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=Er(""+l),e.setAttribute(s,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(s,"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 o=="function"&&(s==="formAction"?(t!=="input"&&Ct(e,t,"name",r.name,r,null),Ct(e,t,"formEncType",r.formEncType,r,null),Ct(e,t,"formMethod",r.formMethod,r,null),Ct(e,t,"formTarget",r.formTarget,r,null)):(Ct(e,t,"encType",r.encType,r,null),Ct(e,t,"method",r.method,r,null),Ct(e,t,"target",r.target,r,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=Er(""+l),e.setAttribute(s,l);break;case"onClick":l!=null&&(e.onclick=xs);break;case"onScroll":l!=null&&at("scroll",e);break;case"onScrollEnd":l!=null&&at("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(u(61));if(s=l.__html,s!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=s}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}s=Er(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""+l):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":l===!0?e.setAttribute(s,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,l):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(s,l):e.removeAttribute(s);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(s):e.setAttribute(s,l);break;case"popover":at("beforetoggle",e),at("toggle",e),Fa(e,"popover",l);break;case"xlinkActuate":Pa(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Pa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Pa(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Pa(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Pa(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Pa(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Fa(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=kx.get(s)||s,Fa(e,s,l))}}function $c(e,t,s,l,r,o){switch(s){case"style":ed(e,l,o);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(u(61));if(s=l.__html,s!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=s}}break;case"children":typeof l=="string"?Hl(e,l):(typeof l=="number"||typeof l=="bigint")&&Hl(e,""+l);break;case"onScroll":l!=null&&at("scroll",e);break;case"onScrollEnd":l!=null&&at("scrollend",e);break;case"onClick":l!=null&&(e.onclick=xs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!w.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(r=s.endsWith("Capture"),t=s.slice(2,r?s.length-7:void 0),o=e[Tt]||null,o=o!=null?o[s]:null,typeof o=="function"&&e.removeEventListener(t,o,r),typeof l=="function")){typeof o!="function"&&o!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,l,r);break e}s in e?e[s]=l:l===!0?e.setAttribute(s,""):Fa(e,s,l)}}}function oa(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",e),at("load",e);var l=!1,r=!1,o;for(o in s)if(s.hasOwnProperty(o)){var m=s[o];if(m!=null)switch(o){case"src":l=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ct(e,t,o,m,s,null)}}r&&Ct(e,t,"srcSet",s.srcSet,s,null),l&&Ct(e,t,"src",s.src,s,null);return;case"input":at("invalid",e);var g=o=m=r=null,C=null,H=null;for(l in s)if(s.hasOwnProperty(l)){var J=s[l];if(J!=null)switch(l){case"name":r=J;break;case"type":m=J;break;case"checked":C=J;break;case"defaultChecked":H=J;break;case"value":o=J;break;case"defaultValue":g=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(u(137,t));break;default:Ct(e,t,l,J,s,null)}}Wu(e,o,g,C,H,m,r,!1);return;case"select":at("invalid",e),l=m=o=null;for(r in s)if(s.hasOwnProperty(r)&&(g=s[r],g!=null))switch(r){case"value":o=g;break;case"defaultValue":m=g;break;case"multiple":l=g;default:Ct(e,t,r,g,s,null)}t=o,s=m,e.multiple=!!l,t!=null?Ll(e,!!l,t,!1):s!=null&&Ll(e,!!l,s,!0);return;case"textarea":at("invalid",e),o=r=l=null;for(m in s)if(s.hasOwnProperty(m)&&(g=s[m],g!=null))switch(m){case"value":l=g;break;case"defaultValue":r=g;break;case"children":o=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(u(91));break;default:Ct(e,t,m,g,s,null)}Fu(e,l,r,o);return;case"option":for(C in s)if(s.hasOwnProperty(C)&&(l=s[C],l!=null))switch(C){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Ct(e,t,C,l,s,null)}return;case"dialog":at("beforetoggle",e),at("toggle",e),at("cancel",e),at("close",e);break;case"iframe":case"object":at("load",e);break;case"video":case"audio":for(l=0;l<sr.length;l++)at(sr[l],e);break;case"image":at("error",e),at("load",e);break;case"details":at("toggle",e);break;case"embed":case"source":case"link":at("error",e),at("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(H in s)if(s.hasOwnProperty(H)&&(l=s[H],l!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ct(e,t,H,l,s,null)}return;default:if(so(t)){for(J in s)s.hasOwnProperty(J)&&(l=s[J],l!==void 0&&$c(e,t,J,l,s,void 0));return}}for(g in s)s.hasOwnProperty(g)&&(l=s[g],l!=null&&Ct(e,t,g,l,s,null))}function ag(e,t,s,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,m=null,g=null,C=null,H=null,J=null;for(Q in s){var ae=s[Q];if(s.hasOwnProperty(Q)&&ae!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":C=ae;default:l.hasOwnProperty(Q)||Ct(e,t,Q,null,l,ae)}}for(var V in l){var Q=l[V];if(ae=s[V],l.hasOwnProperty(V)&&(Q!=null||ae!=null))switch(V){case"type":o=Q;break;case"name":r=Q;break;case"checked":H=Q;break;case"defaultChecked":J=Q;break;case"value":m=Q;break;case"defaultValue":g=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(u(137,t));break;default:Q!==ae&&Ct(e,t,V,Q,l,ae)}}to(e,m,g,C,H,J,o,r);return;case"select":Q=m=g=V=null;for(o in s)if(C=s[o],s.hasOwnProperty(o)&&C!=null)switch(o){case"value":break;case"multiple":Q=C;default:l.hasOwnProperty(o)||Ct(e,t,o,null,l,C)}for(r in l)if(o=l[r],C=s[r],l.hasOwnProperty(r)&&(o!=null||C!=null))switch(r){case"value":V=o;break;case"defaultValue":g=o;break;case"multiple":m=o;default:o!==C&&Ct(e,t,r,o,l,C)}t=g,s=m,l=Q,V!=null?Ll(e,!!s,V,!1):!!l!=!!s&&(t!=null?Ll(e,!!s,t,!0):Ll(e,!!s,s?[]:"",!1));return;case"textarea":Q=V=null;for(g in s)if(r=s[g],s.hasOwnProperty(g)&&r!=null&&!l.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:Ct(e,t,g,null,l,r)}for(m in l)if(r=l[m],o=s[m],l.hasOwnProperty(m)&&(r!=null||o!=null))switch(m){case"value":V=r;break;case"defaultValue":Q=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(u(91));break;default:r!==o&&Ct(e,t,m,r,l,o)}Iu(e,V,Q);return;case"option":for(var Ee in s)if(V=s[Ee],s.hasOwnProperty(Ee)&&V!=null&&!l.hasOwnProperty(Ee))switch(Ee){case"selected":e.selected=!1;break;default:Ct(e,t,Ee,null,l,V)}for(C in l)if(V=l[C],Q=s[C],l.hasOwnProperty(C)&&V!==Q&&(V!=null||Q!=null))switch(C){case"selected":e.selected=V&&typeof V!="function"&&typeof V!="symbol";break;default:Ct(e,t,C,V,l,Q)}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 Ve in s)V=s[Ve],s.hasOwnProperty(Ve)&&V!=null&&!l.hasOwnProperty(Ve)&&Ct(e,t,Ve,null,l,V);for(H in l)if(V=l[H],Q=s[H],l.hasOwnProperty(H)&&V!==Q&&(V!=null||Q!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(u(137,t));break;default:Ct(e,t,H,V,l,Q)}return;default:if(so(t)){for(var zt in s)V=s[zt],s.hasOwnProperty(zt)&&V!==void 0&&!l.hasOwnProperty(zt)&&$c(e,t,zt,void 0,l,V);for(J in l)V=l[J],Q=s[J],!l.hasOwnProperty(J)||V===Q||V===void 0&&Q===void 0||$c(e,t,J,V,l,Q);return}}for(var O in s)V=s[O],s.hasOwnProperty(O)&&V!=null&&!l.hasOwnProperty(O)&&Ct(e,t,O,null,l,V);for(ae in l)V=l[ae],Q=s[ae],!l.hasOwnProperty(ae)||V===Q||V==null&&Q==null||Ct(e,t,ae,V,l,Q)}function ah(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function sg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),l=0;l<s.length;l++){var r=s[l],o=r.transferSize,m=r.initiatorType,g=r.duration;if(o&&g&&ah(m)){for(m=0,g=r.responseEnd,l+=1;l<s.length;l++){var C=s[l],H=C.startTime;if(H>g)break;var J=C.transferSize,ae=C.initiatorType;J&&ah(ae)&&(C=C.responseEnd,m+=J*(C<g?1:(g-H)/(C-H)))}if(--l,t+=8*(o+m)/(r.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 Qc=null,Xc=null;function Si(e){return e.nodeType===9?e:e.ownerDocument}function sh(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 lh(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 Zc(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 Kc=null;function lg(){var e=window.event;return e&&e.type==="popstate"?e===Kc?!1:(Kc=e,!0):(Kc=null,!1)}var nh=typeof setTimeout=="function"?setTimeout:void 0,ng=typeof clearTimeout=="function"?clearTimeout:void 0,rh=typeof Promise=="function"?Promise:void 0,rg=typeof queueMicrotask=="function"?queueMicrotask:typeof rh<"u"?function(e){return rh.resolve(null).then(e).catch(ig)}:nh;function ig(e){setTimeout(function(){throw e})}function rl(e){return e==="head"}function ih(e,t){var s=t,l=0;do{var r=s.nextSibling;if(e.removeChild(s),r&&r.nodeType===8)if(s=r.data,s==="/$"||s==="/&"){if(l===0){e.removeChild(r),pn(t);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")nr(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,nr(s);for(var o=s.firstChild;o;){var m=o.nextSibling,g=o.nodeName;o[ce]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&o.rel.toLowerCase()==="stylesheet"||s.removeChild(o),o=m}}else s==="body"&&nr(e.ownerDocument.body);s=r}while(s);pn(t)}function oh(e,t){var s=e;e=0;do{var l=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),l&&l.nodeType===8)if(s=l.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=l}while(s)}function Jc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Jc(s),re(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function og(e,t,s,l){for(;e.nodeType===1;){var r=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[ce])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=$a(e.nextSibling),e===null)break}return null}function cg(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=$a(e.nextSibling),e===null))return null;return e}function ch(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=$a(e.nextSibling),e===null))return null;return e}function Wc(e){return e.data==="$?"||e.data==="$~"}function Ic(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ug(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var l=function(){t(),s.removeEventListener("DOMContentLoaded",l)};s.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function $a(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 Fc=null;function uh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return $a(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function dh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function fh(e,t,s){switch(t=Si(s),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 nr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);re(e)}var Qa=new Map,mh=new Set;function wi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ds=W.d;W.d={f:dg,r:fg,D:mg,C:hg,L:pg,m:xg,X:gg,S:vg,M:bg};function dg(){var e=Ds.f(),t=pi();return e||t}function fg(e){var t=qe(e);t!==null&&t.tag===5&&t.type==="form"?Tf(t):Ds.r(e)}var fn=typeof document>"u"?null:document;function hh(e,t,s){var l=fn;if(l&&typeof t=="string"&&t){var r=Ha(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof s=="string"&&(r+='[crossorigin="'+s+'"]'),mh.has(r)||(mh.add(r),e={rel:e,crossOrigin:s,href:t},l.querySelector(r)===null&&(t=l.createElement("link"),oa(t,"link",e),dt(t),l.head.appendChild(t)))}}function mg(e){Ds.D(e),hh("dns-prefetch",e,null)}function hg(e,t){Ds.C(e,t),hh("preconnect",e,t)}function pg(e,t,s){Ds.L(e,t,s);var l=fn;if(l&&e&&t){var r='link[rel="preload"][as="'+Ha(t)+'"]';t==="image"&&s&&s.imageSrcSet?(r+='[imagesrcset="'+Ha(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(r+='[imagesizes="'+Ha(s.imageSizes)+'"]')):r+='[href="'+Ha(e)+'"]';var o=r;switch(t){case"style":o=mn(e);break;case"script":o=hn(e)}Qa.has(o)||(e=y({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),Qa.set(o,e),l.querySelector(r)!==null||t==="style"&&l.querySelector(rr(o))||t==="script"&&l.querySelector(ir(o))||(t=l.createElement("link"),oa(t,"link",e),dt(t),l.head.appendChild(t)))}}function xg(e,t){Ds.m(e,t);var s=fn;if(s&&e){var l=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Ha(l)+'"][href="'+Ha(e)+'"]',o=r;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=hn(e)}if(!Qa.has(o)&&(e=y({rel:"modulepreload",href:e},t),Qa.set(o,e),s.querySelector(r)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(ir(o)))return}l=s.createElement("link"),oa(l,"link",e),dt(l),s.head.appendChild(l)}}}function vg(e,t,s){Ds.S(e,t,s);var l=fn;if(l&&e){var r=Ze(l).hoistableStyles,o=mn(e);t=t||"default";var m=r.get(o);if(!m){var g={loading:0,preload:null};if(m=l.querySelector(rr(o)))g.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},s),(s=Qa.get(o))&&Pc(e,s);var C=m=l.createElement("link");dt(C),oa(C,"link",e),C._p=new Promise(function(H,J){C.onload=H,C.onerror=J}),C.addEventListener("load",function(){g.loading|=1}),C.addEventListener("error",function(){g.loading|=2}),g.loading|=4,Ci(m,t,l)}m={type:"stylesheet",instance:m,count:1,state:g},r.set(o,m)}}}function gg(e,t){Ds.X(e,t);var s=fn;if(s&&e){var l=Ze(s).hoistableScripts,r=hn(e),o=l.get(r);o||(o=s.querySelector(ir(r)),o||(e=y({src:e,async:!0},t),(t=Qa.get(r))&&eu(e,t),o=s.createElement("script"),dt(o),oa(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(r,o))}}function bg(e,t){Ds.M(e,t);var s=fn;if(s&&e){var l=Ze(s).hoistableScripts,r=hn(e),o=l.get(r);o||(o=s.querySelector(ir(r)),o||(e=y({src:e,async:!0,type:"module"},t),(t=Qa.get(r))&&eu(e,t),o=s.createElement("script"),dt(o),oa(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(r,o))}}function ph(e,t,s,l){var r=(r=U.current)?wi(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=mn(s.href),s=Ze(r).hoistableStyles,l=s.get(t),l||(l={type:"style",instance:null,count:0,state:null},s.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=mn(s.href);var o=Ze(r).hoistableStyles,m=o.get(e);if(m||(r=r.ownerDocument||r,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,m),(o=r.querySelector(rr(e)))&&!o._p&&(m.instance=o,m.state.loading=5),Qa.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Qa.set(e,s),o||yg(r,e,s,m.state))),t&&l===null)throw Error(u(528,""));return m}if(t&&l!==null)throw Error(u(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hn(s),s=Ze(r).hoistableScripts,l=s.get(t),l||(l={type:"script",instance:null,count:0,state:null},s.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function mn(e){return'href="'+Ha(e)+'"'}function rr(e){return'link[rel="stylesheet"]['+e+"]"}function xh(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function yg(e,t,s,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),oa(t,"link",s),dt(t),e.head.appendChild(t))}function hn(e){return'[src="'+Ha(e)+'"]'}function ir(e){return"script[async]"+e}function vh(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Ha(s.href)+'"]');if(l)return t.instance=l,dt(l),l;var r=y({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),dt(l),oa(l,"style",r),Ci(l,s.precedence,e),t.instance=l;case"stylesheet":r=mn(s.href);var o=e.querySelector(rr(r));if(o)return t.state.loading|=4,t.instance=o,dt(o),o;l=xh(s),(r=Qa.get(r))&&Pc(l,r),o=(e.ownerDocument||e).createElement("link"),dt(o);var m=o;return m._p=new Promise(function(g,C){m.onload=g,m.onerror=C}),oa(o,"link",l),t.state.loading|=4,Ci(o,s.precedence,e),t.instance=o;case"script":return o=hn(s.src),(r=e.querySelector(ir(o)))?(t.instance=r,dt(r),r):(l=s,(r=Qa.get(o))&&(l=y({},s),eu(l,r)),e=e.ownerDocument||e,r=e.createElement("script"),dt(r),oa(r,"link",l),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Ci(l,s.precedence,e));return t.instance}function Ci(e,t,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=l.length?l[l.length-1]:null,o=r,m=0;m<l.length;m++){var g=l[m];if(g.dataset.precedence===t)o=g;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Pc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zi=null;function gh(e,t,s){if(zi===null){var l=new Map,r=zi=new Map;r.set(s,l)}else r=zi,l=r.get(s),l||(l=new Map,r.set(s,l));if(l.has(e))return l;for(l.set(e,null),s=s.getElementsByTagName(e),r=0;r<s.length;r++){var o=s[r];if(!(o[ce]||o[kt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var m=o.getAttribute(t)||"";m=e+m;var g=l.get(m);g?g.push(o):l.set(m,[o])}}return l}function bh(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function jg(e,t,s){if(s===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 yh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ng(e,t,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var r=mn(l.href),o=t.querySelector(rr(r));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ai.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=o,dt(o);return}o=t.ownerDocument||t,l=xh(l),(r=Qa.get(r))&&Pc(l,r),o=o.createElement("link"),dt(o);var m=o;m._p=new Promise(function(g,C){m.onload=g,m.onerror=C}),oa(o,"link",l),s.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Ai.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var tu=0;function Sg(e,t){return e.stylesheets&&e.count===0&&ki(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var l=setTimeout(function(){if(e.stylesheets&&ki(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&tu===0&&(tu=62500*sg());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ki(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>tu?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(r)}}:null}function Ai(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ki(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ei=null;function ki(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ei=new Map,t.forEach(wg,e),Ei=null,Ai.call(e))}function wg(e,t){if(!(t.state.loading&4)){var s=Ei.get(e);if(s)var l=s.get(null);else{s=new Map,Ei.set(e,s);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var m=r[o];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(s.set(m.dataset.precedence,m),l=m)}l&&s.set(null,l)}r=t.instance,m=r.getAttribute("data-precedence"),o=s.get(m)||l,o===l&&s.set(null,r),s.set(m,r),this.count++,l=Ai.bind(this),r.addEventListener("load",l),r.addEventListener("error",l),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var or={$$typeof:oe,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function Cg(e,t,s,l,r,o,m,g,C){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=We(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=We(0),this.hiddenUpdates=We(null),this.identifierPrefix=l,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function jh(e,t,s,l,r,o,m,g,C,H,J,ae){return e=new Cg(e,t,s,m,C,H,J,ae,g),t=1,o===!0&&(t|=24),o=Aa(3,null,null,t),e.current=o,o.stateNode=e,t=Ro(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:l,isDehydrated:s,cache:t},Bo(o),e}function Nh(e){return e?(e=$l,e):$l}function Sh(e,t,s,l,r,o){r=Nh(r),l.context===null?l.context=r:l.pendingContext=r,l=Js(t),l.payload={element:s},o=o===void 0?null:o,o!==null&&(l.callback=o),s=Ws(e,l,t),s!==null&&(ya(s,e,t),qn(s,e,t))}function wh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function au(e,t){wh(e,t),(e=e.alternate)&&wh(e,t)}function Ch(e){if(e.tag===13||e.tag===31){var t=gl(e,67108864);t!==null&&ya(t,e,67108864),au(e,67108864)}}function zh(e){if(e.tag===13||e.tag===31){var t=Da();t=ls(t);var s=gl(e,t);s!==null&&ya(s,e,t),au(e,t)}}var Ti=!0;function zg(e,t,s,l){var r=E.T;E.T=null;var o=W.p;try{W.p=2,su(e,t,s,l)}finally{W.p=o,E.T=r}}function Ag(e,t,s,l){var r=E.T;E.T=null;var o=W.p;try{W.p=8,su(e,t,s,l)}finally{W.p=o,E.T=r}}function su(e,t,s,l){if(Ti){var r=lu(l);if(r===null)Yc(e,t,l,Mi,s),Eh(e,l);else if(kg(r,e,t,s,l))l.stopPropagation();else if(Eh(e,l),t&4&&-1<Eg.indexOf(e)){for(;r!==null;){var o=qe(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var m=St(o.pendingLanes);if(m!==0){var g=o;for(g.pendingLanes|=2,g.entangledLanes|=2;m;){var C=1<<31-nt(m);g.entanglements[1]|=C,m&=~C}cs(o),(xt&6)===0&&(mi=Ye()+500,ar(0))}}break;case 31:case 13:g=gl(o,2),g!==null&&ya(g,o,2),pi(),au(o,2)}if(o=lu(l),o===null&&Yc(e,t,l,Mi,s),o===r)break;r=o}r!==null&&l.stopPropagation()}else Yc(e,t,l,null,s)}}function lu(e){return e=no(e),nu(e)}var Mi=null;function nu(e){if(Mi=null,e=Ne(e),e!==null){var t=f(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=p(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Mi=e,null}function Ah(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"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(pt()){case vt:return 2;case Ut:return 8;case ut:case jt:return 32;case ta:return 268435456;default:return 32}default:return 32}}var ru=!1,il=null,ol=null,cl=null,cr=new Map,ur=new Map,ul=[],Eg="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 Eh(e,t){switch(e){case"focusin":case"focusout":il=null;break;case"dragenter":case"dragleave":ol=null;break;case"mouseover":case"mouseout":cl=null;break;case"pointerover":case"pointerout":cr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ur.delete(t.pointerId)}}function dr(e,t,s,l,r,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:s,eventSystemFlags:l,nativeEvent:o,targetContainers:[r]},t!==null&&(t=qe(t),t!==null&&Ch(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function kg(e,t,s,l,r){switch(t){case"focusin":return il=dr(il,e,t,s,l,r),!0;case"dragenter":return ol=dr(ol,e,t,s,l,r),!0;case"mouseover":return cl=dr(cl,e,t,s,l,r),!0;case"pointerover":var o=r.pointerId;return cr.set(o,dr(cr.get(o)||null,e,t,s,l,r)),!0;case"gotpointercapture":return o=r.pointerId,ur.set(o,dr(ur.get(o)||null,e,t,s,l,r)),!0}return!1}function kh(e){var t=Ne(e.target);if(t!==null){var s=f(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,Us(e.priority,function(){zh(s)});return}}else if(t===31){if(t=p(s),t!==null){e.blockedOn=t,Us(e.priority,function(){zh(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Di(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=lu(e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);lo=l,s.target.dispatchEvent(l),lo=null}else return t=qe(s),t!==null&&Ch(t),e.blockedOn=s,!1;t.shift()}return!0}function Th(e,t,s){Di(e)&&s.delete(t)}function Tg(){ru=!1,il!==null&&Di(il)&&(il=null),ol!==null&&Di(ol)&&(ol=null),cl!==null&&Di(cl)&&(cl=null),cr.forEach(Th),ur.forEach(Th)}function Oi(e,t){e.blockedOn===t&&(e.blockedOn=null,ru||(ru=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Tg)))}var Ri=null;function Mh(e){Ri!==e&&(Ri=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Ri===e&&(Ri=null);for(var t=0;t<e.length;t+=3){var s=e[t],l=e[t+1],r=e[t+2];if(typeof l!="function"){if(nu(l||s)===null)continue;break}var o=qe(s);o!==null&&(e.splice(t,3),t-=3,lc(o,{pending:!0,data:r,method:s.method,action:l},l,r))}}))}function pn(e){function t(C){return Oi(C,e)}il!==null&&Oi(il,e),ol!==null&&Oi(ol,e),cl!==null&&Oi(cl,e),cr.forEach(t),ur.forEach(t);for(var s=0;s<ul.length;s++){var l=ul[s];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ul.length&&(s=ul[0],s.blockedOn===null);)kh(s),s.blockedOn===null&&ul.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(l=0;l<s.length;l+=3){var r=s[l],o=s[l+1],m=r[Tt]||null;if(typeof o=="function")m||Mh(s);else if(m){var g=null;if(o&&o.hasAttribute("formAction")){if(r=o,m=o[Tt]||null)g=m.formAction;else if(nu(r)!==null)continue}else g=m.action;typeof g=="function"?s[l+1]=g:(s.splice(l,3),l-=3),Mh(s)}}}function Dh(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(m){return r=m})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),l||setTimeout(s,20)}function s(){if(!l&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function iu(e){this._internalRoot=e}_i.prototype.render=iu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var s=t.current,l=Da();Sh(s,l,e,t,null,null)},_i.prototype.unmount=iu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Sh(e.current,2,null,e,null,null),pi(),t[ua]=null}};function _i(e){this._internalRoot=e}_i.prototype.unstable_scheduleHydration=function(e){if(e){var t=wa();e={blockedOn:null,target:e,priority:t};for(var s=0;s<ul.length&&t!==0&&t<ul[s].priority;s++);ul.splice(s,0,e),s===0&&kh(e)}};var Oh=i.version;if(Oh!=="19.2.7")throw Error(u(527,Oh,"19.2.7"));W.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=v(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var Mg={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Li=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Li.isDisabled&&Li.supportsFiber)try{sa=Li.inject(Mg),Gt=Li}catch{}}return mr.createRoot=function(e,t){if(!d(e))throw Error(u(299));var s=!1,l="",r=qf,o=Vf,m=Gf;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=jh(e,1,!1,null,null,s,l,null,r,o,m,Dh),e[ua]=t.current,Gc(e),new iu(t)},mr.hydrateRoot=function(e,t,s){if(!d(e))throw Error(u(299));var l=!1,r="",o=qf,m=Vf,g=Gf,C=null;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(r=s.identifierPrefix),s.onUncaughtError!==void 0&&(o=s.onUncaughtError),s.onCaughtError!==void 0&&(m=s.onCaughtError),s.onRecoverableError!==void 0&&(g=s.onRecoverableError),s.formState!==void 0&&(C=s.formState)),t=jh(e,1,!0,t,s??null,l,r,C,o,m,g,Dh),t.context=Nh(null),s=t.current,l=Da(),l=ls(l),r=Js(l),r.callback=null,Ws(s,r,l),s=l,t.current.lanes=s,At(t,s),cs(t),e[ua]=t.current,Gc(e),new _i(t)},mr.version="19.2.7",mr}var Yh;function Xg(){if(Yh)return uu.exports;Yh=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),uu.exports=Qg(),uu.exports}var Zg=Xg();function Tp(n){var i,c,u="";if(typeof n=="string"||typeof n=="number")u+=n;else if(typeof n=="object")if(Array.isArray(n)){var d=n.length;for(i=0;i<d;i++)n[i]&&(c=Tp(n[i]))&&(u&&(u+=" "),u+=c)}else for(c in n)n[c]&&(u&&(u+=" "),u+=c);return u}function Mp(){for(var n,i,c=0,u="",d=arguments.length;c<d;c++)(n=arguments[c])&&(i=Tp(n))&&(u&&(u+=" "),u+=i);return u}const Kg=(n,i)=>{const c=new Array(n.length+i.length);for(let u=0;u<n.length;u++)c[u]=n[u];for(let u=0;u<i.length;u++)c[n.length+u]=i[u];return c},Jg=(n,i)=>({classGroupId:n,validator:i}),Dp=(n=new Map,i=null,c)=>({nextPart:n,validators:i,classGroupId:c}),$i="-",$h=[],Wg="arbitrary..",Ig=n=>{const i=Pg(n),{conflictingClassGroups:c,conflictingClassGroupModifiers:u}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return Fg(h);const p=h.split($i),j=p[0]===""&&p.length>1?1:0;return Op(p,j,i)},getConflictingClassGroupIds:(h,p)=>{if(p){const j=u[h],v=c[h];return j?v?Kg(v,j):j:v||$h}return c[h]||$h}}},Op=(n,i,c)=>{if(n.length-i===0)return c.classGroupId;const d=n[i],f=c.nextPart.get(d);if(f){const v=Op(n,i+1,f);if(v)return v}const h=c.validators;if(h===null)return;const p=i===0?n.join($i):n.slice(i).join($i),j=h.length;for(let v=0;v<j;v++){const b=h[v];if(b.validator(p))return b.classGroupId}},Fg=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=n.slice(1,-1),c=i.indexOf(":"),u=i.slice(0,c);return u?Wg+u:void 0})(),Pg=n=>{const{theme:i,classGroups:c}=n;return eb(c,i)},eb=(n,i)=>{const c=Dp();for(const u in n){const d=n[u];Du(d,c,u,i)}return c},Du=(n,i,c,u)=>{const d=n.length;for(let f=0;f<d;f++){const h=n[f];tb(h,i,c,u)}},tb=(n,i,c,u)=>{if(typeof n=="string"){ab(n,i,c);return}if(typeof n=="function"){sb(n,i,c,u);return}lb(n,i,c,u)},ab=(n,i,c)=>{const u=n===""?i:Rp(i,n);u.classGroupId=c},sb=(n,i,c,u)=>{if(nb(n)){Du(n(u),i,c,u);return}i.validators===null&&(i.validators=[]),i.validators.push(Jg(c,n))},lb=(n,i,c,u)=>{const d=Object.entries(n),f=d.length;for(let h=0;h<f;h++){const[p,j]=d[h];Du(j,Rp(i,p),c,u)}},Rp=(n,i)=>{let c=n;const u=i.split($i),d=u.length;for(let f=0;f<d;f++){const h=u[f];let p=c.nextPart.get(h);p||(p=Dp(),c.nextPart.set(h,p)),c=p}return c},nb=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,rb=n=>{if(n<1)return{get:()=>{},set:()=>{}};let i=0,c=Object.create(null),u=Object.create(null);const d=(f,h)=>{c[f]=h,i++,i>n&&(i=0,u=c,c=Object.create(null))};return{get(f){let h=c[f];if(h!==void 0)return h;if((h=u[f])!==void 0)return d(f,h),h},set(f,h){f in c?c[f]=h:d(f,h)}}},Cu="!",Qh=":",ib=[],Xh=(n,i,c,u,d)=>({modifiers:n,hasImportantModifier:i,baseClassName:c,maybePostfixModifierPosition:u,isExternal:d}),ob=n=>{const{prefix:i,experimentalParseClassName:c}=n;let u=d=>{const f=[];let h=0,p=0,j=0,v;const b=d.length;for(let B=0;B<b;B++){const K=d[B];if(h===0&&p===0){if(K===Qh){f.push(d.slice(j,B)),j=B+1;continue}if(K==="/"){v=B;continue}}K==="["?h++:K==="]"?h--:K==="("?p++:K===")"&&p--}const y=f.length===0?d:d.slice(j);let z=y,S=!1;y.endsWith(Cu)?(z=y.slice(0,-1),S=!0):y.startsWith(Cu)&&(z=y.slice(1),S=!0);const T=v&&v>j?v-j:void 0;return Xh(f,S,z,T)};if(i){const d=i+Qh,f=u;u=h=>h.startsWith(d)?f(h.slice(d.length)):Xh(ib,!1,h,void 0,!0)}if(c){const d=u;u=f=>c({className:f,parseClassName:d})}return u},cb=n=>{const i=new Map;return n.orderSensitiveModifiers.forEach((c,u)=>{i.set(c,1e6+u)}),c=>{const u=[];let d=[];for(let f=0;f<c.length;f++){const h=c[f],p=h[0]==="[",j=i.has(h);p||j?(d.length>0&&(d.sort(),u.push(...d),d=[]),u.push(h)):d.push(h)}return d.length>0&&(d.sort(),u.push(...d)),u}},ub=n=>({cache:rb(n.cacheSize),parseClassName:ob(n),sortModifiers:cb(n),postfixLookupClassGroupIds:db(n),...Ig(n)}),db=n=>{const i=Object.create(null),c=n.postfixLookupClassGroups;if(c)for(let u=0;u<c.length;u++)i[c[u]]=!0;return i},fb=/\s+/,mb=(n,i)=>{const{parseClassName:c,getClassGroupId:u,getConflictingClassGroupIds:d,sortModifiers:f,postfixLookupClassGroupIds:h}=i,p=[],j=n.trim().split(fb);let v="";for(let b=j.length-1;b>=0;b-=1){const y=j[b],{isExternal:z,modifiers:S,hasImportantModifier:T,baseClassName:B,maybePostfixModifierPosition:K}=c(y);if(z){v=y+(v.length>0?" "+v:v);continue}let le=!!K,ve;if(le){const ue=B.substring(0,K);ve=u(ue);const _=ve&&h[ve]?u(B):void 0;_&&_!==ve&&(ve=_,le=!1)}else ve=u(B);if(!ve){if(!le){v=y+(v.length>0?" "+v:v);continue}if(ve=u(B),!ve){v=y+(v.length>0?" "+v:v);continue}le=!1}const oe=S.length===0?"":S.length===1?S[0]:f(S).join(":"),$=T?oe+Cu:oe,ne=$+ve;if(p.indexOf(ne)>-1)continue;p.push(ne);const me=d(ve,le);for(let ue=0;ue<me.length;++ue){const _=me[ue];p.push($+_)}v=y+(v.length>0?" "+v:v)}return v},hb=(...n)=>{let i=0,c,u,d="";for(;i<n.length;)(c=n[i++])&&(u=_p(c))&&(d&&(d+=" "),d+=u);return d},_p=n=>{if(typeof n=="string")return n;let i,c="";for(let u=0;u<n.length;u++)n[u]&&(i=_p(n[u]))&&(c&&(c+=" "),c+=i);return c},pb=(n,...i)=>{let c,u,d,f;const h=j=>{const v=i.reduce((b,y)=>y(b),n());return c=ub(v),u=c.cache.get,d=c.cache.set,f=p,p(j)},p=j=>{const v=u(j);if(v)return v;const b=mb(j,c);return d(j,b),b};return f=h,(...j)=>f(hb(...j))},xb=[],Wt=n=>{const i=c=>c[n]||xb;return i.isThemeGetter=!0,i},Lp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Nb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fl=n=>vb.test(n),Ie=n=>!!n&&!Number.isNaN(Number(n)),ds=n=>!!n&&Number.isInteger(Number(n)),hu=n=>n.endsWith("%")&&Ie(n.slice(0,-1)),Os=n=>gb.test(n),Bp=()=>!0,Sb=n=>bb.test(n)&&!yb.test(n),Ou=()=>!1,wb=n=>jb.test(n),Cb=n=>Nb.test(n),zb=n=>!ze(n)&&!Ae(n),Ab=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),Eb=n=>hl(n,Vp,Ou),ze=n=>Lp.test(n),Ml=n=>hl(n,Gp,Sb),Zh=n=>hl(n,Lb,Ie),kb=n=>hl(n,$p,Bp),Tb=n=>hl(n,Yp,Ou),Kh=n=>hl(n,Up,Ou),Mb=n=>hl(n,qp,Cb),Hi=n=>hl(n,Qp,wb),Ae=n=>Hp.test(n),hr=n=>Rl(n,Gp),Db=n=>Rl(n,Yp),Jh=n=>Rl(n,Up),Ob=n=>Rl(n,Vp),Rb=n=>Rl(n,qp),Bi=n=>Rl(n,Qp,!0),_b=n=>Rl(n,$p,!0),hl=(n,i,c)=>{const u=Lp.exec(n);return u?u[1]?i(u[1]):c(u[2]):!1},Rl=(n,i,c=!1)=>{const u=Hp.exec(n);return u?u[1]?i(u[1]):c:!1},Up=n=>n==="position"||n==="percentage",qp=n=>n==="image"||n==="url",Vp=n=>n==="length"||n==="size"||n==="bg-size",Gp=n=>n==="length",Lb=n=>n==="number",Yp=n=>n==="family-name",$p=n=>n==="number"||n==="weight",Qp=n=>n==="shadow",Hb=()=>{const n=Wt("color"),i=Wt("font"),c=Wt("text"),u=Wt("font-weight"),d=Wt("tracking"),f=Wt("leading"),h=Wt("breakpoint"),p=Wt("container"),j=Wt("spacing"),v=Wt("radius"),b=Wt("shadow"),y=Wt("inset-shadow"),z=Wt("text-shadow"),S=Wt("drop-shadow"),T=Wt("blur"),B=Wt("perspective"),K=Wt("aspect"),le=Wt("ease"),ve=Wt("animate"),oe=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ne=()=>[...$(),Ae,ze],me=()=>["auto","hidden","clip","visible","scroll"],ue=()=>["auto","contain","none"],_=()=>[Ae,ze,j],he=()=>[fl,"full","auto",..._()],Oe=()=>[ds,"none","subgrid",Ae,ze],be=()=>["auto",{span:["full",ds,Ae,ze]},ds,Ae,ze],Z=()=>[ds,"auto",Ae,ze],ee=()=>["auto","min","max","fr",Ae,ze],de=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ge=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",..._()],W=()=>[fl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],pe=()=>[fl,"screen","full","dvw","lvw","svw","min","max","fit",..._()],xe=()=>[fl,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],G=()=>[n,Ae,ze],N=()=>[...$(),Jh,Kh,{position:[Ae,ze]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",Ob,Eb,{size:[Ae,ze]}],D=()=>[hu,hr,Ml],ie=()=>["","none","full",v,Ae,ze],U=()=>["",Ie,hr,Ml],M=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Ie,hu,Jh,Kh],Ge=()=>["","none",T,Ae,ze],Se=()=>["none",Ie,Ae,ze],Le=()=>["none",Ie,Ae,ze],De=()=>[Ie,Ae,ze],F=()=>[fl,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Os],breakpoint:[Os],color:[Bp],container:[Os],"drop-shadow":[Os],ease:["in","out","in-out"],font:[zb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Os],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Os],shadow:[Os],spacing:["px",Ie],text:[Os],"text-shadow":[Os],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fl,ze,Ae,K]}],container:["container"],"container-type":[{"@container":["","normal","size",Ae,ze]}],"container-named":[Ab],columns:[{columns:[Ie,ze,Ae,p]}],"break-after":[{"break-after":oe()}],"break-before":[{"break-before":oe()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:ne()}],overflow:[{overflow:me()}],"overflow-x":[{"overflow-x":me()}],"overflow-y":[{"overflow-y":me()}],overscroll:[{overscroll:ue()}],"overscroll-x":[{"overscroll-x":ue()}],"overscroll-y":[{"overscroll-y":ue()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:he()}],"inset-x":[{"inset-x":he()}],"inset-y":[{"inset-y":he()}],start:[{"inset-s":he(),start:he()}],end:[{"inset-e":he(),end:he()}],"inset-bs":[{"inset-bs":he()}],"inset-be":[{"inset-be":he()}],top:[{top:he()}],right:[{right:he()}],bottom:[{bottom:he()}],left:[{left:he()}],visibility:["visible","invisible","collapse"],z:[{z:[ds,"auto",Ae,ze]}],basis:[{basis:[fl,"full","auto",p,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,fl,"auto","initial","none",ze]}],grow:[{grow:["",Ie,Ae,ze]}],shrink:[{shrink:["",Ie,Ae,ze]}],order:[{order:[ds,"first","last","none",Ae,ze]}],"grid-cols":[{"grid-cols":Oe()}],"col-start-end":[{col:be()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":Oe()}],"row-start-end":[{row:be()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...de(),"normal"]}],"justify-items":[{"justify-items":[...ge(),"normal"]}],"justify-self":[{"justify-self":["auto",...ge()]}],"align-content":[{content:["normal",...de()]}],"align-items":[{items:[...ge(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ge(),{baseline:["","last"]}]}],"place-content":[{"place-content":de()}],"place-items":[{"place-items":[...ge(),"baseline"]}],"place-self":[{"place-self":["auto",...ge()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...pe()]}],"min-inline-size":[{"min-inline":["auto",...pe()]}],"max-inline-size":[{"max-inline":["none",...pe()]}],"block-size":[{block:["auto",...xe()]}],"min-block-size":[{"min-block":["auto",...xe()]}],"max-block-size":[{"max-block":["none",...xe()]}],w:[{w:[p,"screen",...W()]}],"min-w":[{"min-w":[p,"screen","none",...W()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[h]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",c,hr,Ml]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[u,_b,kb]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hu,ze]}],"font-family":[{font:[Db,Tb,i]}],"font-features":[{"font-features":[ze]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[d,Ae,ze]}],"line-clamp":[{"line-clamp":[Ie,"none",Ae,Zh]}],leading:[{leading:[f,..._()]}],"list-image":[{"list-image":["none",Ae,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",Ae,Ml]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Ie,"auto",Ae,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"tab-size":[{tab:[ds,Ae,ze]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ds,Ae,ze],radial:["",Ae,ze],conic:[ds,Ae,ze]},Rb,Mb]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-bs":[{"border-bs":U()}],"border-w-be":[{"border-be":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...M(),"hidden","none"]}],"divide-style":[{divide:[...M(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...M(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,Ae,ze]}],"outline-w":[{outline:["",Ie,hr,Ml]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",b,Bi,Hi]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",y,Bi,Hi]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[Ie,Ml]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",z,Bi,Hi]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Ie,Ae,ze]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[Ae,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":$()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,ze]}],filter:[{filter:["","none",Ae,ze]}],blur:[{blur:Ge()}],brightness:[{brightness:[Ie,Ae,ze]}],contrast:[{contrast:[Ie,Ae,ze]}],"drop-shadow":[{"drop-shadow":["","none",S,Bi,Hi]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Ie,Ae,ze]}],"hue-rotate":[{"hue-rotate":[Ie,Ae,ze]}],invert:[{invert:["",Ie,Ae,ze]}],saturate:[{saturate:[Ie,Ae,ze]}],sepia:[{sepia:["",Ie,Ae,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,ze]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,Ae,ze]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,Ae,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,Ae,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,Ae,ze]}],"backdrop-invert":[{"backdrop-invert":["",Ie,Ae,ze]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,Ae,ze]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,Ae,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,Ae,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",Ae,ze]}],ease:[{ease:["linear","initial",le,Ae,ze]}],delay:[{delay:[Ie,Ae,ze]}],animate:[{animate:["none",ve,Ae,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[B,Ae,ze]}],"perspective-origin":[{"perspective-origin":ne()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:Le()}],"scale-x":[{"scale-x":Le()}],"scale-y":[{"scale-y":Le()}],"scale-z":[{"scale-z":Le()}],"scale-3d":["scale-3d"],skew:[{skew:De()}],"skew-x":[{"skew-x":De()}],"skew-y":[{"skew-y":De()}],transform:[{transform:[Ae,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:ne()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:F()}],"translate-x":[{"translate-x":F()}],"translate-y":[{"translate-y":F()}],"translate-z":[{"translate-z":F()}],"translate-none":["translate-none"],zoom:[{zoom:[ds,Ae,ze]}],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae,ze]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":G()}],"scrollbar-track-color":[{"scrollbar-track":G()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mbs":[{"scroll-mbs":_()}],"scroll-mbe":[{"scroll-mbe":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pbs":[{"scroll-pbs":_()}],"scroll-pbe":[{"scroll-pbe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae,ze]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Ie,hr,Ml,Zh]}],stroke:[{stroke:["none",...G()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Xp=pb(Hb);var Zp=kp();const Ru={...Vg},Wh={};function br(n,i){const c=x.useRef(Wh);return c.current===Wh&&(c.current=n(i)),c}const pu=Ru.useInsertionEffect,Bb=pu&&pu!==Ru.useLayoutEffect?pu:n=>n();function _s(n){const i=br(Ub).current;return i.next=n,Bb(i.effect),i.trampoline}function Ub(){const n={next:void 0,callback:qb,trampoline:(...i)=>{var c;return(c=n.callback)==null?void 0:c.call(n,...i)},effect:()=>{n.callback=n.next}};return n}function qb(){}function Vb(n,i){return function(u,...d){const f=new URL(n);return f.searchParams.set("code",u.toString()),d.forEach(h=>f.searchParams.append("args[]",h)),`${i} error #${u}; visit ${f} for the full message.`}}const _u=Vb("https://base-ui.com/production-error","Base UI");function zu(n,i,c,u){const d=br(Kp).current;return Yb(d,n,i,c,u)&&Jp(d,[n,i,c,u]),d.callback}function Gb(n){const i=br(Kp).current;return $b(i,n)&&Jp(i,n),i.callback}function Kp(){return{callback:null,cleanup:null,refs:[]}}function Yb(n,i,c,u,d){return n.refs[0]!==i||n.refs[1]!==c||n.refs[2]!==u||n.refs[3]!==d}function $b(n,i){return n.refs.length!==i.length||n.refs.some((c,u)=>c!==i[u])}function Jp(n,i){if(n.refs=i,i.every(c=>c==null)){n.callback=null;return}n.callback=c=>{if(n.cleanup&&(n.cleanup(),n.cleanup=null),c!=null){const u=Array(i.length).fill(null);for(let d=0;d<i.length;d+=1){const f=i[d];if(f!=null)switch(typeof f){case"function":{const h=f(c);typeof h=="function"&&(u[d]=h);break}case"object":{f.current=c;break}}}n.cleanup=()=>{for(let d=0;d<i.length;d+=1){const f=i[d];if(f!=null)switch(typeof f){case"function":{const h=u[d];typeof h=="function"?h():f(null);break}case"object":{f.current=null;break}}}}}}}const Qb=parseInt(x.version,10);function Xb(n){return Qb>=n}function Ih(n){if(!x.isValidElement(n))return null;const i=n,c=i.props;return(Xb(19)?c==null?void 0:c.ref:i.ref)??null}function Au(n,i){if(n&&!i)return n;if(!n&&i)return i;if(n||i)return{...n,...i}}const bn=Object.freeze({});function Zb(n,i){const c={};for(const u in n){const d=n[u];if(i!=null&&i.hasOwnProperty(u)){const f=i[u](d);f!=null&&Object.assign(c,f);continue}d===!0?c[`data-${u.toLowerCase()}`]="":d&&(c[`data-${u.toLowerCase()}`]=d.toString())}return c}function Kb(n,i){return typeof n=="function"?n(i):n}function Wp(n,i){return typeof n=="function"?n(i):n}const Lu={};function Hu(n,i,c,u,d){if(!c&&!u&&!n)return Qi(i);let f=Qi(n);return i&&(f=Yi(f,i)),c&&(f=Yi(f,c)),u&&(f=Yi(f,u)),f}function Jb(n){if(n.length===0)return Lu;if(n.length===1)return Qi(n[0]);let i=Qi(n[0]);for(let c=1;c<n.length;c+=1)i=Yi(i,n[c]);return i}function Qi(n){return Bu(n)?{...Fp(n,Lu)}:Wb(n)}function Yi(n,i){return Bu(i)?Fp(i,n):Ib(n,i)}function Wb(n){const i={...n};for(const c in i){const u=i[c];Ip(c,u)&&(i[c]=Pp(u))}return i}function Ib(n,i){if(!i)return n;for(const c in i){const u=i[c];switch(c){case"style":{n[c]=Au(n.style,u);break}case"className":{n[c]=ex(n.className,u);break}default:Ip(c,u)?n[c]=Fb(n[c],u):n[c]=u}}return n}function Ip(n,i){const c=n.charCodeAt(0),u=n.charCodeAt(1),d=n.charCodeAt(2);return c===111&&u===110&&d>=65&&d<=90&&(typeof i=="function"||typeof i>"u")}function Bu(n){return typeof n=="function"}function Fp(n,i){return Bu(n)?n(i):n??Lu}function Fb(n,i){return i?n?(...c)=>{const u=c[0];if(tx(u)){const f=u;Xi(f);const h=i(...c);return f.baseUIHandlerPrevented||n==null||n(...c),h}const d=i(...c);return n==null||n(...c),d}:Pp(i):n}function Pp(n){return n&&((...i)=>{const c=i[0];return tx(c)&&Xi(c),n(...i)})}function Xi(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function ex(n,i){return i?n?i+" "+n:i:n}function tx(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function Uu(n,i,c={}){const u=i.render,d=Pb(i,c);if(c.enabled===!1)return null;const f=c.state??bn;return ay(n,u,d,f)}function Pb(n,i={}){const{className:c,style:u,render:d}=n,{state:f=bn,ref:h,props:p,stateAttributesMapping:j,enabled:v=!0}=i,b=v?Kb(c,f):void 0,y=v?Wp(u,f):void 0,z=v?Zb(f,j):bn,S=v&&p?ey(p):void 0,T=v?Au(z,S)??{}:bn;return typeof document<"u"&&(v?Array.isArray(h)?T.ref=Gb([T.ref,Ih(d),...h]):T.ref=zu(T.ref,Ih(d),h):zu(null,null)),v?(b!==void 0&&(T.className=ex(T.className,b)),y!==void 0&&(T.style=Au(T.style,y)),T):bn}function ey(n){return Array.isArray(n)?Jb(n):Hu(void 0,n)}const ty=Symbol.for("react.lazy");function ay(n,i,c,u){if(i){if(typeof i=="function")return i(c,u);const d=Hu(c,i.props);d.ref=c.ref;let f=i;return(f==null?void 0:f.$$typeof)===ty&&(f=x.Children.toArray(i)[0]),x.cloneElement(f,d)}if(n&&typeof n=="string")return sy(n,c);throw new Error(_u(8))}function sy(n,i){return n==="button"?x.createElement("button",{type:"button",...i,key:i.key}):n==="img"?x.createElement("img",{alt:"",...i,key:i.key}):x.createElement(n,i)}function ly({controlled:n,default:i,name:c,state:u="value"}){const{current:d}=x.useRef(n!==void 0),[f,h]=x.useState(i),p=d?n:f,j=x.useCallback(v=>{d||h(v)},[]);return[p,j]}let Fh=0;function ny(n,i="mui"){const[c,u]=x.useState(n),d=n||c;return x.useEffect(()=>{c==null&&(Fh+=1,u(`${i}-${Fh}`))},[c,i]),d}const Ph=Ru.useId;function ry(n,i){if(Ph!==void 0){const c=Ph();return`${i}-${c}`}return ny(n,i)}function iy(n){return ry(n,"base-ui")}const oy="none",cy="trigger-press";function ax(n,i,c,u){let d=!1,f=!1;const h=bn;return{reason:n,event:i??new Event("base-ui"),cancel(){d=!0},allowPropagation(){f=!0},get isCanceled(){return d},get isPropagationAllowed(){return f},trigger:c,...h}}const uy=()=>{},Ls=typeof document<"u"?x.useLayoutEffect:uy,dy=[];function fy(n){x.useEffect(n,dy)}const Ui=null;class my{constructor(){us(this,"callbacks",[]);us(this,"callbacksCount",0);us(this,"nextId",1);us(this,"startId",1);us(this,"isScheduled",!1);us(this,"tick",i=>{var d;this.isScheduled=!1;const c=this.callbacks,u=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,u>0)for(let f=0;f<c.length;f+=1)(d=c[f])==null||d.call(c,i)})}request(i){const c=this.nextId;return this.nextId+=1,this.callbacks.push(i),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),c}cancel(i){const c=i-this.startId;c<0||c>=this.callbacks.length||(this.callbacks[c]=null,this.callbacksCount-=1)}}const qi=new my;class Oa{constructor(){us(this,"currentId",Ui);us(this,"cancel",()=>{this.currentId!==Ui&&(qi.cancel(this.currentId),this.currentId=Ui)});us(this,"disposeEffect",()=>this.cancel)}static create(){return new Oa}static request(i){return qi.request(i)}static cancel(i){return qi.cancel(i)}request(i){this.cancel(),this.currentId=qi.request(()=>{this.currentId=Ui,i()})}}function hy(){const n=br(Oa.create).current;return fy(n.disposeEffect),n}function py(n,i=!1,c=!1){const[u,d]=x.useState(n&&i?"idle":void 0),[f,h]=x.useState(n);return n&&!f&&(h(!0),d("starting")),!n&&f&&u!=="ending"&&!c&&d("ending"),!n&&!f&&u==="ending"&&d(void 0),Ls(()=>{if(!n&&f&&u!=="ending"&&c){const p=Oa.request(()=>{d("ending")});return()=>{Oa.cancel(p)}}},[n,f,u,c]),Ls(()=>{if(!n||i)return;const p=Oa.request(()=>{d(void 0)});return()=>{Oa.cancel(p)}},[i,n]),Ls(()=>{if(!n||!i)return;n&&f&&u!=="idle"&&d("starting");const p=Oa.request(()=>{d("idle")});return()=>{Oa.cancel(p)}},[i,n,f,u]),{mounted:f,setMounted:h,transitionStatus:u}}function xy(n){const{open:i,defaultOpen:c,onOpenChange:u,disabled:d}=n,[f,h]=ly({controlled:i,default:c,name:"Collapsible",state:"open"}),{mounted:p,setMounted:j,transitionStatus:v}=py(f,!0,!0),b=iy(),[y,z]=x.useState(),S=y??b,T=_s(B=>{const K=!f,le=ax(cy,B.nativeEvent);u(K,le),!le.isCanceled&&h(K)});return x.useMemo(()=>({disabled:d,handleTrigger:T,mounted:p,open:f,panelId:S,setMounted:j,setOpen:h,setPanelIdState:z,transitionStatus:v}),[d,T,p,f,S,j,h,z,v])}const sx=x.createContext(void 0);function lx(){const n=x.useContext(sx);if(n===void 0)throw new Error(_u(15));return n}let gr=(function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n})({});const vy={[gr.startingStyle]:""},gy={[gr.endingStyle]:""},nx={transitionStatus(n){return n==="starting"?vy:n==="ending"?gy:null}};let qu=(function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=gr.startingStyle]="startingStyle",n[n.endingStyle=gr.endingStyle]="endingStyle",n})({}),by=(function(n){return n.panelOpen="data-panel-open",n})({});const yy={[qu.open]:""},jy={[qu.closed]:""},Ny={open(n){return n?{[by.panelOpen]:""}:null}},Sy={open(n){return n?yy:jy}},rx={...Sy,...nx},wy=x.forwardRef(function(i,c){const{render:u,className:d,defaultOpen:f=!1,disabled:h=!1,onOpenChange:p,open:j,style:v,...b}=i,y=_s(p),z=xy({open:j,defaultOpen:f,onOpenChange:y,disabled:h}),S=x.useMemo(()=>({open:z.open,disabled:z.disabled,transitionStatus:z.transitionStatus}),[z.open,z.disabled,z.transitionStatus]),T=x.useMemo(()=>({...z,onOpenChange:y,state:S}),[z,y,S]),B=Uu("div",i,{state:S,ref:c,props:b,stateAttributesMapping:rx});return a.jsx(sx.Provider,{value:T,children:B})});function Cy(){return typeof window<"u"}function ix(n){var i;return(n==null||(i=n.ownerDocument)==null?void 0:i.defaultView)||window}function zy(n){return Cy()?n instanceof HTMLElement||n instanceof ix(n).HTMLElement:!1}const Ay=x.createContext(void 0);function Ey(n=!1){const i=x.useContext(Ay);if(i===void 0&&!n)throw new Error(_u(16));return i}function ky(n){const{focusableWhenDisabled:i,disabled:c,composite:u=!1,tabIndex:d=0,isNativeButton:f}=n,h=u&&i!==!1,p=u&&i===!1;return{props:x.useMemo(()=>{const v={onKeyDown(b){c&&i&&b.key!=="Tab"&&b.preventDefault()}};return u||(v.tabIndex=d,!f&&c&&(v.tabIndex=i?d:-1)),(f&&(i||h)||!f&&c)&&(v["aria-disabled"]=c),f&&(!i||p)&&(v.disabled=c),v},[u,c,i,h,p,f,d])}}function Ty(n={}){const{disabled:i=!1,focusableWhenDisabled:c,tabIndex:u=0,native:d=!0,composite:f}=n,h=x.useRef(null),p=Ey(!0),j=f??p!==void 0,{props:v}=ky({focusableWhenDisabled:c,disabled:i,composite:j,tabIndex:u,isNativeButton:d}),b=x.useCallback(()=>{const S=h.current;xu(S)&&j&&i&&v.disabled===void 0&&S.disabled&&(S.disabled=!1)},[i,v.disabled,j]);Ls(b,[b]);const y=x.useCallback((S={})=>{const{onClick:T,onMouseDown:B,onKeyUp:K,onKeyDown:le,onPointerDown:ve,...oe}=S;return Hu({onClick($){if(i){$.preventDefault();return}T==null||T($)},onMouseDown($){i||B==null||B($)},onKeyDown($){if(i||(Xi($),le==null||le($),$.baseUIHandlerPrevented))return;const ne=$.target===$.currentTarget,me=$.currentTarget,ue=xu(me),_=!d&&My(me),he=ne&&(d?ue:!_),Oe=$.key==="Enter",be=$.key===" ",Z=me.getAttribute("role"),ee=(Z==null?void 0:Z.startsWith("menuitem"))||Z==="option"||Z==="gridcell";if(ne&&j&&be){if($.defaultPrevented&&ee)return;$.preventDefault(),_||d&&ue?(me.click(),$.preventBaseUIHandler()):he&&(T==null||T($),$.preventBaseUIHandler());return}he&&(!d&&(be||Oe)&&$.preventDefault(),!d&&Oe&&(T==null||T($)))},onKeyUp($){if(!i){if(Xi($),K==null||K($),$.target===$.currentTarget&&d&&j&&xu($.currentTarget)&&$.key===" "){$.preventDefault();return}$.baseUIHandlerPrevented||$.target===$.currentTarget&&!d&&!j&&$.key===" "&&(T==null||T($))}},onPointerDown($){if(i){$.preventDefault();return}ve==null||ve($)}},d?{type:"button"}:{role:"button"},v,oe)},[i,v,j,d]),z=_s(S=>{h.current=S,b()});return{getButtonProps:y,buttonRef:z}}function xu(n){return zy(n)&&n.tagName==="BUTTON"}function My(n){return!!((n==null?void 0:n.tagName)==="A"&&(n!=null&&n.href))}const Dy={...Ny,...nx},Oy=x.forwardRef(function(i,c){const{panelId:u,open:d,handleTrigger:f,state:h,disabled:p}=lx(),{className:j,disabled:v=p,render:b,nativeButton:y=!0,style:z,...S}=i,{getButtonProps:T,buttonRef:B}=Ty({disabled:v,focusableWhenDisabled:!0,native:y});return Uu("button",i,{state:h,ref:[c,B],props:[{"aria-controls":d?u:void 0,"aria-expanded":d,onClick:f},S,T],stateAttributesMapping:Dy})});function Ry(n,i,c,u){return n.addEventListener(i,c,u),()=>{n.removeEventListener(i,c,u)}}function _y(n){const i=br(Ly,n).current;return i.next=n,Ls(i.effect),i}function Ly(n){const i={current:n,next:n,effect:()=>{i.current=i.next}};return i}function Hy(n){return n==null?n:"current"in n?n.current:n}function ox(n,i=!1,c=!0){const u=hy();return _s((d,f=null)=>{u.cancel();const h=Hy(n);if(h==null)return;const p=h,j=()=>{Zp.flushSync(d)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){d();return}function v(){Promise.all(p.getAnimations().map(b=>b.finished)).then(()=>{f!=null&&f.aborted||j()}).catch(()=>{if(c){f!=null&&f.aborted||j();return}const b=p.getAnimations();!(f!=null&&f.aborted)&&b.length>0&&b.some(y=>y.pending||y.playState!=="finished")&&v()})}if(i){const b=gr.startingStyle;if(!p.hasAttribute(b)){u.request(v);return}const y=new MutationObserver(()=>{p.hasAttribute(b)||(y.disconnect(),v())});y.observe(p,{attributes:!0,attributeFilter:[b]}),f==null||f.addEventListener("abort",()=>y.disconnect(),{once:!0});return}u.request(v)})}function By(n){const{enabled:i=!0,open:c,ref:u,onComplete:d}=n,f=_s(d),h=ox(u,c,!1);x.useEffect(()=>{if(!i)return;const p=new AbortController;return h(f,p.signal),()=>{p.abort()}},[i,c,f,h])}const pr={height:void 0,width:void 0};function Uy(n){const{externalRef:i,hiddenUntilFound:c,id:u,keepMounted:d,mounted:f,onOpenChange:h,open:p,setMounted:j,setOpen:v,transitionStatus:b}=n,y=x.useRef(null),z=x.useRef(null),[S,T]=x.useState(pr),B=x.useRef(pr),K=x.useRef(!1),le=x.useRef(p),ve=x.useRef(!1),[oe,$]=x.useState(!1),ne=x.useRef(null),me=zu(i,y),ue=_y({mounted:f,open:p}),_=ox(y,!1,!1),he=!p&&!f,Oe=oe?"idle":b,be=p&&(le.current||ve.current),Z=!p&&f&&z.current==="css-animation"&&S.height===void 0&&S.width===void 0?B.current:S,ee=c&&he&&z.current!=="css-animation",de=_s((xe,G=!0)=>{G&&(B.current=xe),T(xe)}),ge=_s(()=>{var xe;(xe=ne.current)==null||xe.call(ne),ne.current=null}),E=_s(xe=>{ge(),ne.current=()=>{ne.current=null,xe()}}),W=_s(()=>{p&&f&&z.current==="css-animation"&&(ve.current=!0)});Ls(()=>{!oe||b==="starting"||$(!1)},[oe,b]),x.useEffect(()=>()=>{W(),ge()},[W,ge]),Ls(()=>{const xe=y.current;if(!xe)return;!p&&ne.current&&ge();const G=qy(xe,be);if(z.current=G,p&&b==="idle"&&le.current&&G==="css-animation"){B.current=xn(xe);return}if(p&&b==="starting"){const I=K.current;if(K.current=!1,G==="none"){de(xn(xe)),$(!0);return}if(G==="css-transition"){const D=Vy(xe);if(de(xn(xe)),!I)return D;const ie=xr(xe,"transition-duration","0s");return E(ie),$(!0),D}if(G==="css-animation"){if(de(xn(xe)),!I){xr(xe,"animation-name","none")();return}const D=xr(xe,"animation-name","none"),ie=xr(xe,"animation-duration","0s");D(),E(ie),$(!0);return}}if(!p&&f&&(b==="idle"||b==="starting")){if(le.current=!1,ve.current=!1,G==="none"){de(pr,!1),j(!1);return}de(xn(xe));return}if(b!=="ending")return;if(G==="none"){j(!1);return}const N=xn(xe);if(!((N.height??0)>0||(N.width??0)>0)){j(!1);return}de(N),G==="css-animation"&&xr(xe,"animation-name","none")()},[f,p,ge,de,j,E,be,b]),By({enabled:p&&f&&Oe==="idle",open:!0,ref:y,onComplete(){p&&de(pr,!1)}}),x.useEffect(()=>{if(p||!f||Oe!=="ending"||!y.current)return;const G=new AbortController;let N=-1;function R(){ue.current.open||(j(!1),de(pr,!1))}return N=Oa.request(()=>{G.signal.aborted||_(R,G.signal)}),()=>{Oa.cancel(N),G.abort()}},[ue,f,p,Oe,_,de,j]),Ls(()=>{const xe=y.current;!xe||!c||!he||xe.setAttribute("hidden","until-found")},[he,c]),x.useEffect(function(){const G=y.current;if(!G)return;function N(R){const I=ax(oy,R);h(!0,I),!I.isCanceled&&(K.current=!0,v(!0))}return Ry(G,"beforematch",N)},[h,v]);const pe=d||c||f||p;return{height:Z.height,props:{...ee?{[qu.startingStyle]:""}:void 0,hidden:he,id:u},ref:me,shouldPreventOpenAnimation:be,shouldRender:pe,transitionStatus:Oe,width:Z.width}}function xn(n){return{height:n.scrollHeight,width:n.scrollWidth}}function qy(n,i=!1){const c=ix(n).getComputedStyle(n),u=(c.animationName.split(",").map(f=>f.trim()).some(f=>f!==""&&f!=="none")||i)&&ep(c.animationDuration),d=ep(c.transitionDuration);return u&&d||d?"css-transition":u?"css-animation":"none"}function ep(n){return n.split(",").map(i=>i.trim()).some(i=>i!==""&&Number.parseFloat(i)>0)}function xr(n,i,c){const u=n.style.getPropertyValue(i),d=n.style.getPropertyPriority(i);return n.style.setProperty(i,c),()=>{if(u===""){n.style.removeProperty(i);return}n.style.setProperty(i,u,d)}}function Vy(n){const i={"justify-content":n.style.justifyContent,"align-items":n.style.alignItems,"align-content":n.style.alignContent,"justify-items":n.style.justifyItems};Object.keys(i).forEach(d=>{n.style.setProperty(d,"initial","important")});function c(){Object.entries(i).forEach(([d,f])=>{if(f===""){n.style.removeProperty(d);return}n.style.setProperty(d,f)})}const u=Oa.request(c);return()=>{Oa.cancel(u),c()}}let tp=(function(n){return n.collapsiblePanelHeight="--collapsible-panel-height",n.collapsiblePanelWidth="--collapsible-panel-width",n})({});const Gy=x.forwardRef(function(i,c){const{className:u,hiddenUntilFound:d,keepMounted:f,render:h,id:p,style:j,...v}=i,{mounted:b,onOpenChange:y,open:z,panelId:S,setMounted:T,setPanelIdState:B,setOpen:K,state:le,transitionStatus:ve}=lx(),oe=d??!1,$=f??!1;Ls(()=>{if(p)return B(p),()=>{B(void 0)}},[p,B]);const{height:ne,props:me,ref:ue,shouldPreventOpenAnimation:_,shouldRender:he,transitionStatus:Oe,width:be}=Uy({externalRef:c,hiddenUntilFound:oe,id:S,keepMounted:$,mounted:b,onOpenChange:y,open:z,setMounted:T,setOpen:K,transitionStatus:ve}),Z={...le,transitionStatus:Oe},ee=Wp(j,Z),de=Uu("div",{...i,style:void 0},{state:Z,ref:ue,props:[me,{style:{[tp.collapsiblePanelHeight]:ne===void 0?"auto":`${ne}px`,[tp.collapsiblePanelWidth]:be===void 0?"auto":`${be}px`}},v,ee?{style:ee}:void 0,_?{style:{animationName:"none"}}:void 0],stateAttributesMapping:rx});return he?de:null});function je(...n){return Xp(Mp(n))}var Yy={home:["M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"],specs:["M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z","M14 2v6h6","M16 13H8","M16 17H8","M10 9H8"],flow:["M4 16l4.586-4.586a2 2 0 0 1 2.828 0L16 16m-2-2l1.586-1.586a2 2 0 0 1 2.828 0L20 14m-6-6h.01M6 20h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2z"],context:["M11 4a2 2 0 1 1 4 0v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a2 2 0 1 1 4 0z","M8 10h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2z"],sun:["M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42","M12 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14z"],moon:["M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"],grid:["M16 3h5v5","M8 3H3v5","M3 16v5h5","M16 21h5v-5","M3 12h3","M18 12h3","M12 3v3","M12 18v3"],plus:["M12 5v14","M5 12h14"],trash:["M3 6h18","M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6","M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2","M10 11v6","M14 11v6"],check:["M20 6L9 17l-5-5"],edit:["M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7","M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"],search:["M21 21l-4.35-4.35","M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z"],info:["M12 16v-4","M12 8h.01","M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10z"],"chevron-left":["M15 18l-6-6 6-6"],"chevron-right":["M9 18l6-6-6-6"],"arrow-up":["M12 19V5","M5 12l7-7 7 7"],star:["M12 2l3 7h7l-5.5 4 2 7L12 16l-5.5 4 2-7L3 9h7z"],"list-three":["M4 6h16","M4 12h16","M4 18h16"],settings:["M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z","M15 12a3 3 0 11-6 0 3 3 0 016 0z"],cross:["M3 12h3","M18 12h3","M12 3v3","M12 18v3","M5 5l14 14","M5 19l14-14"],x:["M18 6l-12 12","M6 6l12 12"],"alert-triangle":["M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z","M12 9v4","M12 17h.01"],user:["M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2","M12 7a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"],"x-circle":["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M15 9l-6 6M9 9l6 6"],"check-circle":["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M8 12l3 3 5-5"],"alert-circle":["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M12 8v5","M12 16h.01"],help:["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M8 9.5a4 4 0 1 1 4.75 3.94c-.41.11-.75.4-.75.81V15","M12 18h.01"],"bar-chart":["M3 21h18","M5 21V10","M9 21V6","M13 21V3","M17 21V8"],code:["M16 18l6-6-6-6","M8 6l-6 6 6 6"],"file-text":["M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z","M14 2v6h6","M16 13H8","M16 17H8","M10 9H8"],"chevron-down":["M6 9l6 6 6-6"],"chevron-up":["M18 15l-6-6-6 6"],clock:["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M12 6v6l4 2"],folder:["M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"],box:["M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"],cpu:["M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2","M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v0a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2z","M13 13h2","M9 13h.01"],book:["M4 19.5A2.5 2.5 0 0 1 6.5 17H20","M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z","M8 7h8","M8 11h6"],"pen-tool":["M12 19l7-7 3 3-7 7-3-3z","M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z","M2 2l7.586 7.586","M11 11l-4 4"],"git-branch":["M6 3v12","M6 3a4 4 0 0 1 4 4v0a4 4 0 0 1-4 4","M6 15a3 3 0 1 0 0 6 3 3 0 0 0 0-6z","M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z","M18 9v1a2 2 0 0 1-2 2H10"],workflow:["M6 3a3 3 0 1 0 0 6 3 3 0 0 0 0-6z","M18 15a3 3 0 1 0 0 6 3 3 0 0 0 0-6z","M6 9v2a3 3 0 0 0 3 3h6a3 3 0 0 1 3 3v0","M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z","M18 9v6"],activity:["M22 12h-4l-3 9L9 3l-3 9H2"],shield:["M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"],copy:["M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2","M12 11h4","M12 16h4","M8 11h.01","M8 16h.01","M15 2H9a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1z"],bot:["M12 2c-2.5 0-5 1.5-5 4 0 1.5.8 2.8 2 3.5A5 5 0 0 0 7 14v1a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-1a5 5 0 0 0-2-4.5c1.2-.7 2-2 2-3.5 0-2.5-2.5-4-5-4z","M9 17v3a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-3","M9 11h.01","M15 11h.01"],circle:["M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"],"loader-circle":["M21 12a9 9 0 1 1-6.219-8.56"],sparkles:["M12 3l1.5 3.5L17 8l-3.5 1.5L12 13l-1.5-3.5L7 8l3.5-1.5z","M17.5 14l.5 1.5L19.5 16l-1.5.5-.5 1.5-.5-1.5L15.5 16l1.5-.5z","M5.5 4l.5 1.5L7.5 6 6 6.5 5.5 8 5 6.5 3.5 6 5 5.5z"],zap:["M13 2L3 14h9l-1 8 10-12h-9l1-8z"],terminal:["M4 17l6-6-6-6","M12 19h8"],"circle-check":["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M8 12l3 3 5-5"],"circle-x":["M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2z","M15 9l-6 6M9 9l6 6"],"octagon-alert":["M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86z","M12 8v4","M12 16h.01"],hourglass:["M6 2v4a4 4 0 0 0 4 4 4 4 0 0 0-4 4v4H6","M18 2v4a4 4 0 0 1-4 4 4 4 0 0 1 4 4v4h0","M6 2h12","M6 22h12"],plug:["M12 22v-5","M5 12h14","M7 12V5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v7","M9 9V5","M15 9V5"],"settings-2":["M20 7h-9","M14 17H5","M17 12H3","M7 7h.01","M21 17h.01","M12 12h.01"],"sliders-horizontal":["M4 6h16","M4 18h16","M10 4v4","M14 16v4","M7 10v0a2 2 0 0 0 2 2h0a2 2 0 0 0 2-2v0a2 2 0 0 0-2-2h0a2 2 0 0 0-2 2z","M17 14v0a2 2 0 0 0 2 2h0a2 2 0 0 0 2-2v0a2 2 0 0 0-2-2h0a2 2 0 0 0-2 2z"],"scroll-text":["M8 21h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H8","M16 3v18","M4 3h4v18H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z","M10 8h4","M10 12h4","M10 16h2"]};function k({name:n,size:i=16,className:c,...u}){const d=Yy[n];return d?a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",width:i,height:i,className:je("shrink-0",c),"aria-hidden":"true",...u,children:d.map(f=>a.jsx("path",{d:f},f))}):null}var $y={primary:"bg-[var(--color-primary)] text-[var(--color-on-accent)] hover:bg-[var(--color-primary-hover)] hover:scale-[1.02] active:bg-[var(--color-primary-pressed)] border border-transparent",secondary:"bg-[var(--color-bg-sunken)] text-[var(--color-text-primary)] border border-[var(--color-border)] hover:border-[var(--color-text-secondary)]",danger:"bg-[var(--color-danger)] text-[var(--color-on-accent)] border border-transparent hover:opacity-90",ghost:"bg-transparent hover:bg-[var(--color-bg-sunken)] text-[var(--color-text-primary)] border border-transparent"},Qy={sm:"h-8 px-[var(--space-3)] text-xs rounded-[var(--radius-sm)]",default:"h-10 px-[var(--space-4)] text-sm rounded-[var(--radius-md)]",lg:"h-11 px-[var(--space-5)] text-base rounded-[var(--radius-md)]"};function q({variant:n="primary",size:i="default",loading:c,disabled:u,children:d,className:f,...h}){return a.jsxs("button",{className:je("inline-flex items-center justify-center gap-[var(--space-2)] font-medium disabled:opacity-50 disabled:pointer-events-none cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-base)]","transition-[background-color,border-color,box-shadow,opacity,color,transform] duration-[var(--motion-fast)] ease-[var(--ease-standard)] active:translate-y-px",c&&"opacity-80",$y[n],Qy[i],f),disabled:u||c,...h,children:[c&&a.jsx(k,{name:"loader-circle",size:14,className:"animate-spin"}),d]})}function Ji({ariaLabel:n,className:i,children:c,...u}){return a.jsx("div",{role:"group","aria-label":n,className:je("inline-flex min-w-0 flex-wrap items-center gap-0.5 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-bg-sunken)] p-0.5",i),...u,children:c})}function Wi({selected:n=!1,count:i,children:c,className:u,type:d="button",...f}){return a.jsxs(q,{type:d,size:"sm",variant:"ghost","aria-pressed":n,"data-selected":n?"true":"false",className:je("h-7 min-w-0 rounded-[var(--radius-xs)] border-transparent px-2 text-caption text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-surface)] hover:text-[var(--color-text-primary)]","data-[selected=true]:border-[var(--color-border)] data-[selected=true]:bg-[var(--color-bg-surface)] data-[selected=true]:text-[var(--color-text-primary)] data-[selected=true]:shadow-sm",u),...f,children:[a.jsx("span",{className:"min-w-0 truncate",children:c}),i!==void 0?a.jsx("span",{className:"font-mono text-[11px] tabular-nums text-[var(--color-text-tertiary)]",children:i}):null]})}var Xy={amber:{color:"var(--color-primary)",onColor:"var(--color-on-accent)",softColor:"#FFB800",softBg:"#1C1808",softBorder:"#5C4F1A",outlineBorder:"#8B7A25",solidBg:"var(--color-primary)"},success:{color:"var(--color-success)",onColor:"var(--color-on-status)",softColor:"#4ADE80",softBg:"#1A2B20",softBorder:"#244A33",outlineBorder:"#2D6A45",solidBg:"#178640"},info:{color:"var(--color-info)",onColor:"var(--color-on-status)",softColor:"#93C5FD",softBg:"#1C2636",softBorder:"#2B4264",outlineBorder:"#3B5E8A",solidBg:"#2858A7"},error:{color:"var(--color-danger)",onColor:"var(--color-on-status)",softColor:"#F87171",softBg:"#2C1A1A",softBorder:"#542626",outlineBorder:"#7A3636",solidBg:"#A22E2E"},agent:{color:"var(--color-agent)",onColor:"var(--color-on-status)",softColor:"#C4B5FD",softBg:"#22203A",softBorder:"#3C3568",outlineBorder:"#564D96",solidBg:"#7260AA"}},Zy={amber:"clock",success:"circle-check",info:"info",error:"circle-x",agent:"sparkles"};function Ky(n,i){const c=Xy[n];return i==="outline"?{background:"transparent",color:c.softColor,borderColor:c.outlineBorder}:i==="soft"?{background:c.softBg,color:c.softColor,borderColor:c.softBorder}:{background:c.solidBg,color:c.onColor,borderColor:c.solidBg}}function ke({variant:n="amber",tone:i="solid",icon:c,className:u,children:d,style:f,...h}){const p=Ky(n,i),j=c??Zy[n];return a.jsxs("span",{className:je("inline-flex items-center gap-[var(--space-1)] text-caption font-medium px-[var(--space-2)] py-[var(--space-1)] rounded-[var(--radius-full)] border-[length:var(--border-thin)]",u),style:{...p,...f},...h,children:[a.jsx(k,{name:j,size:12}),d]})}var Jy={default:"border-[var(--color-border)]",warning:"ds-action-panel--warning",danger:"ds-action-panel--danger",success:"ds-action-panel--success",info:"ds-action-panel--info"};function Zi({icon:n,title:i,description:c,meta:u,action:d,secondaryAction:f,tone:h="default",density:p="default",className:j,children:v,...b}){return a.jsxs("section",{className:je("grid rounded-[var(--radius-md)] border bg-[var(--color-bg-surface)] shadow-sm",p==="compact"?"gap-[var(--layout-inline-gap)] p-[var(--space-4)]":"gap-[var(--layout-cluster-gap)] p-[var(--card-padding)]","sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",Jy[h],j),...b,children:[n?a.jsx("div",{className:je("flex items-center justify-center rounded-[var(--radius-sm)] bg-[var(--color-bg-sunken)] text-[var(--color-text-secondary)]",p==="compact"?"size-8":"size-10"),children:n}):null,a.jsxs("div",{className:"grid min-w-0 gap-[var(--space-1)]",children:[u?a.jsx("div",{className:"ds-cluster",children:u}):null,a.jsx("h2",{className:je("text-[var(--color-text-primary)]",p==="compact"?"text-body-sm font-semibold":"text-h3 sm:text-h2"),children:i}),c?a.jsx("p",{className:je("max-w-3xl text-[var(--color-text-secondary)]",p==="compact"?"text-caption":"text-body-sm"),children:c}):null,v]}),d||f?a.jsxs("div",{className:"flex flex-wrap items-center gap-[var(--layout-toolbar-gap)] sm:justify-end",children:[f,d]}):null]})}function Za({items:n,className:i,...c}){return n.length===0?null:a.jsx("dl",{className:je("grid gap-[var(--layout-inline-gap)] sm:grid-cols-[repeat(auto-fit,minmax(8rem,1fr))]",i),...c,children:n.map((u,d)=>a.jsxs("div",{className:"grid gap-[var(--space-1)] rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-bg-sunken)] p-[var(--space-3)]",children:[a.jsxs("dt",{className:"ds-cluster text-caption font-medium uppercase text-[var(--color-text-tertiary)]",children:[u.icon,a.jsx("span",{children:u.label})]}),a.jsx("dd",{className:"min-w-0 break-words text-body-sm font-medium text-[var(--color-text-primary)]",children:u.value})]},d))})}function Pe({variant:n="default",className:i,children:c,style:u,...d}){return a.jsx("div",{className:je("rounded-[var(--radius-md)] border-[length:var(--border-thin)] shadow-sm transition-shadow duration-[var(--motion-fast)] ease-[var(--ease-standard)]",n==="default"&&"hover:shadow-[var(--card-hover-shadow)]",n==="agent"&&"border-l-2",n==="agent"&&"hover:shadow-[var(--card-hover-shadow)]",i),style:{background:"var(--color-bg-surface)",borderColor:n==="agent"?"var(--color-agent)":"var(--color-border)","--card-hover-shadow":n==="agent"?"0 0 28px color-mix(in oklch, var(--color-agent) 20%, transparent)":"0 0 24px color-mix(in oklch, var(--color-primary) 12%, transparent)",...u},...d,children:c})}function Ka({className:n,children:i,...c}){return a.jsx("div",{className:je("grid gap-[var(--card-header-gap)] border-b border-[var(--color-border)] p-[var(--card-padding)]",n),...c,children:i})}function it({className:n,children:i,...c}){return a.jsx("div",{className:je("grid gap-[var(--card-content-gap)] p-[var(--card-padding)]",n),...c,children:i})}function Sn({className:n,label:i,id:c,...u}){const d=c||(i==null?void 0:i.replace(/\s+/g,"-").toLowerCase());return a.jsxs("label",{htmlFor:d,className:"group flex cursor-pointer items-center gap-[var(--space-2)]",children:[a.jsx("input",{type:"checkbox",id:d,className:je("peer sr-only",n),...u}),a.jsx("span",{"data-slot":"checkbox-control","aria-hidden":"true",className:"flex size-[var(--icon-md)] shrink-0 items-center justify-center rounded-[var(--radius-xs)] border-[length:var(--border-thin)] border-[var(--color-border)] bg-[var(--color-bg-base)] text-[var(--color-on-accent)] transition-colors [&_svg]:opacity-0 peer-checked:border-[var(--color-primary)] peer-checked:bg-[var(--color-primary)] peer-checked:[&_svg]:opacity-100 peer-focus-visible:ring-2 peer-focus-visible:ring-[var(--focus-ring-color)] peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-[var(--color-bg-base)] peer-disabled:opacity-50",children:a.jsx(k,{name:"check",size:12,className:"transition-opacity"})}),i&&a.jsx("span",{className:"select-none text-sm transition-colors group-hover:text-[var(--color-text-primary)] peer-disabled:opacity-50",style:{color:"var(--color-text-secondary)"},children:i})]})}var ct=x.forwardRef(function({className:i,...c},u){return a.jsx("input",{ref:u,className:je("w-full px-[var(--space-3)] py-[var(--space-2)] rounded-[var(--radius-sm)] border-[length:var(--border-thin)] text-sm transition-colors duration-[var(--duration-fast)] ease-[var(--ease-standard)]","focus-visible:outline-none focus-visible:border-[var(--focus-ring-color)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-base)] focus-visible:shadow-[0_0_0_4px_color-mix(in_oklch,var(--color-primary)_14%,transparent)]","placeholder:opacity-50",i),style:{borderColor:"var(--color-border)",background:"var(--color-bg-base)",color:"var(--color-text-primary)"},...c})}),wn=x.forwardRef(function({className:i,...c},u){return a.jsx("textarea",{ref:u,className:je("w-full px-[var(--space-3)] py-[var(--space-2)] rounded-[var(--radius-sm)] border-[length:var(--border-thin)] text-sm transition-colors font-mono","focus-visible:outline-none focus-visible:border-[var(--focus-ring-color)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-base)]","resize-y",i),style:{borderColor:"var(--color-border)",background:"var(--color-bg-base)",color:"var(--color-text-primary)"},...c})});function ma({className:n,...i}){return a.jsx("label",{"data-slot":"label",className:je("flex items-center gap-[var(--space-2)] text-sm leading-none font-medium select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...i})}function ms({open:n,onClose:i,title:c,children:u,actions:d,variant:f="default",hideHeader:h=!1,className:p,bodyClassName:j,contentRef:v}){const b=x.useRef(null);return x.useEffect(()=>{if(!n)return;const y=z=>{z.key==="Escape"&&i()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[n,i]),n?a.jsx("div",{ref:b,className:"fixed inset-0 z-[var(--z-modal)] flex items-center justify-center animate-fade-in backdrop-blur-sm",style:{background:"var(--overlay)"},onClick:y=>{y.target===b.current&&i()},onKeyDown:y=>{y.key==="Escape"&&i()},children:a.jsxs("dialog",{ref:v,open:!0,className:je("border-[length:var(--border-thin)] shadow-xl animate-slide-up",f==="fullscreen"?"m-0 flex h-screen max-h-none w-screen max-w-none flex-col overflow-hidden rounded-none":"mx-4 w-full max-w-md rounded-[var(--radius-lg)]",p),style:{background:"var(--color-bg-surface)",borderColor:"var(--color-border)",color:"var(--color-text-primary)"},"aria-label":c,children:[!h&&a.jsxs("div",{className:"flex items-center justify-between border-b px-[var(--space-4)] py-[var(--space-3)]",style:{borderColor:"var(--color-border)"},children:[a.jsx("h2",{className:"text-h2",style:{color:"var(--color-text-primary)"},children:c}),a.jsx("button",{type:"button",onClick:i,className:"inline-flex size-8 items-center justify-center rounded-[var(--radius-sm)] transition-colors duration-[var(--duration-fast)] ease-[var(--ease-standard)] hover:bg-[var(--color-bg-sunken)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)]",style:{color:"var(--color-text-secondary)"},"aria-label":"Close dialog",children:a.jsx(k,{name:"x",size:16})})]}),a.jsx("div",{className:je(f==="fullscreen"?"flex min-h-0 flex-1 flex-col":"px-[var(--space-4)] py-[var(--space-3)]",j),children:u}),d&&a.jsx("div",{className:"flex justify-end gap-[var(--space-3)] border-t px-[var(--space-4)] py-[var(--space-3)]",style:{borderColor:"var(--color-border)"},children:d})]})}):null}function Ki({open:n,onClose:i,onConfirm:c,title:u,message:d,confirmLabel:f="Confirmar",cancelLabel:h="Cancelar",variant:p="default"}){return a.jsx(ms,{open:n,onClose:i,title:u,actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{type:"button",variant:"secondary",onClick:i,children:h}),a.jsx(q,{type:"button",variant:p==="danger"?"danger":"primary",onClick:()=>{c(),i()},children:f})]}),children:a.jsx("p",{className:"text-body",style:{color:"var(--color-text-secondary)"},children:d})})}function cx({open:n,onClose:i,onSubmit:c,title:u,label:d,placeholder:f,submitLabel:h="Criar",cancelLabel:p="Cancelar"}){const j=x.useRef(null);x.useEffect(()=>{n&&j.current&&j.current.focus()},[n]);const v=()=>{var y;const b=(y=j.current)==null?void 0:y.value.trim();b&&(c(b),i())};return a.jsx(ms,{open:n,onClose:i,title:u,actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{type:"button",variant:"secondary",onClick:i,children:p}),a.jsx(q,{type:"button",onClick:v,children:h})]}),children:a.jsxs(ma,{className:"flex flex-col items-start gap-[var(--space-2)]",children:[a.jsx("span",{className:"text-caption font-medium",style:{color:"var(--color-text-secondary)"},children:d}),a.jsx(ct,{ref:j,type:"text",placeholder:f,onKeyDown:b=>{b.key==="Enter"&&v()}})]})})}function hs({className:n,...i}){return a.jsx("div",{className:je("skeleton-shimmer rounded-[var(--radius-sm)]",n),...i})}function ja(){return a.jsxs("div",{className:"rounded-[var(--radius-md)] border-[length:var(--border-thin)] p-[var(--space-4)] flex flex-col gap-[var(--space-3)]",style:{background:"var(--card)",borderColor:"var(--border)"},children:[a.jsx(hs,{className:"h-4 w-1/3"}),a.jsx(hs,{className:"h-3 w-full"}),a.jsx(hs,{className:"h-3 w-2/3"})]})}function Wy(){return a.jsxs("div",{className:"flex flex-col gap-[var(--space-3)]",children:[a.jsx(hs,{className:"h-6 w-32"}),a.jsx(hs,{className:"h-3 w-48"}),[1,2,3].map(n=>a.jsx(hs,{className:"h-24 w-full rounded-[var(--radius-md)]"},n))]})}var ap={success:"color-success",error:"color-danger",info:"color-info",agent:"color-agent"},Iy={success:"circle-check",error:"circle-x",info:"info",agent:"sparkles"},ux=x.createContext({toast:()=>{},toastWithOptions:()=>{}});function yr(){return x.useContext(ux)}var sp=0;function Fy({children:n}){const[i,c]=x.useState([]),u=x.useRef(new Map),d=x.useCallback(p=>{c(v=>v.filter(b=>b.id!==p));const j=u.current.get(p);j&&(clearTimeout(j),u.current.delete(p))},[]),f=x.useCallback((p,j="info")=>{const v=++sp;c(y=>[...y,{id:v,message:p,type:j}]);const b=setTimeout(()=>d(v),3e3);u.current.set(v,b)},[d]),h=x.useCallback((p,j)=>{const v=++sp;c(y=>[...y,{id:v,message:p,type:(j==null?void 0:j.type)??"info",action:j==null?void 0:j.action}]);const b=setTimeout(()=>d(v),(j==null?void 0:j.duration)??3e3);u.current.set(v,b)},[d]);return a.jsxs(ux.Provider,{value:{toast:f,toastWithOptions:h},children:[n,a.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-[var(--space-2)]",children:i.map(p=>a.jsxs("div",{className:"flex max-w-sm items-start gap-[var(--space-3)] rounded-[var(--radius-md)] border-[length:var(--border-thin)] px-[var(--space-4)] py-[var(--space-3)] text-body font-medium shadow-lg animate-slide-in-right",style:{background:"var(--color-bg-surface)",color:"var(--color-text-primary)",borderColor:`color-mix(in srgb, var(--${ap[p.type]}) 35%, var(--color-border))`},children:[a.jsx(k,{name:Iy[p.type],size:18,style:{color:`var(--${ap[p.type]})`}}),a.jsx("span",{className:"flex-1",children:p.message}),p.action&&a.jsx(q,{type:"button",size:"sm",variant:p.type==="error"?"danger":"secondary",className:"shrink-0",onClick:()=>{var j;(j=p.action)==null||j.onClick(),d(p.id)},children:p.action.label})]},p.id))})]})}function Py({tabs:n,activeTab:i,onChange:c,children:u,className:d,ariaLabel:f}){var b;const[h,p]=x.useState(((b=n[0])==null?void 0:b.id)||""),j=i??h;function v(y){i||p(y),c==null||c(y)}return a.jsxs("div",{className:je("flex flex-col h-full",d),children:[a.jsx("div",{className:"flex border-b shrink-0",style:{borderColor:"var(--color-border)"},role:"tablist","aria-label":f,children:n.map(y=>a.jsxs("button",{type:"button",role:"tab","aria-selected":j===y.id,onClick:()=>v(y.id),className:je("flex items-center gap-[var(--space-1)] px-[var(--space-3)] py-[var(--space-2)] text-body font-medium transition-colors border-b-2 -mb-px cursor-pointer",j===y.id?"border-[var(--color-primary)]":"border-transparent"),style:{color:j===y.id?"var(--color-primary)":"var(--color-text-secondary)"},children:[y.icon,y.label]},y.id))}),u&&a.jsx("div",{className:"flex-1 overflow-y-auto",children:u(j)})]})}var ej={default:"var(--color-primary)",active:"var(--color-primary)",warning:"var(--color-warning)",error:"var(--color-danger)",complete:"var(--color-success)",agent:"var(--color-agent)"};function Vu({value:n,max:i=100,label:c,size:u="md",state:d="default",barColor:f,showValue:h,indeterminate:p=!1,className:j}){const v=Math.min(Math.max(n/i*100,0),100),y={xs:"h-1",sm:"h-1.5",md:"h-2"}[u],z=f??ej[d];return a.jsxs("div",{className:je("flex flex-col gap-[var(--space-1)]",j),children:[(c||h)&&a.jsxs("div",{className:"flex items-center justify-between",children:[c&&a.jsx("span",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:c}),h&&a.jsxs("span",{className:"text-caption tabular-nums",style:{color:"var(--color-text-secondary)"},children:[Math.round(v),"%"]})]}),a.jsx("div",{className:je("w-full rounded-full overflow-hidden",y),style:{background:"var(--color-bg-sunken)"},role:"progressbar","aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":p?void 0:n,"aria-label":c??"Progresso",children:a.jsx("div",{className:je("rounded-full transition-all duration-300",y,p&&"animate-progress-stripes"),style:{width:p?"100%":`${v}%`,background:d==="complete"&&v>0?"var(--color-success)":z,color:"var(--color-text-primary)"}})})]})}function fs({icon:n,title:i,description:c,action:u,className:d}){return a.jsxs("div",{className:je("flex flex-col items-center justify-center gap-[var(--layout-inline-gap)] px-[var(--empty-state-padding-inline)] py-[var(--empty-state-padding-block)] text-center",d),children:[n&&a.jsx("div",{style:{color:"var(--color-text-secondary)"},children:n}),a.jsx("h3",{className:"text-h2",style:{color:"var(--color-text-primary)"},children:i}),c&&a.jsx("p",{className:"max-w-sm text-body",style:{color:"var(--color-text-secondary)"},children:c}),u]})}var tj={info:"info",success:"check-circle",warning:"alert-triangle",error:"x-circle"};function aj({title:n,children:i,variant:c="info",className:u}){const f={info:"color-info",success:"color-success",warning:"color-warning",error:"color-danger"}[c]??"color-info";return a.jsxs("div",{className:je("flex gap-[var(--space-2)] p-[var(--space-3)] rounded-[var(--radius-md)] border-[length:var(--border-thin)]",u),style:{background:`color-mix(in srgb, var(--${f}) 12%, transparent)`,borderColor:`color-mix(in srgb, var(--${f}) 35%, transparent)`,color:"var(--color-text-primary)"},children:[a.jsx(k,{name:tj[c]||"info",width:"var(--icon-md)",height:"var(--icon-md)",className:"shrink-0 mt-0.5",style:{color:`var(--${f})`}}),a.jsxs("div",{className:"text-body",style:{color:"var(--color-text-primary)"},children:[n&&a.jsx("strong",{className:"block font-semibold mb-0.5",children:n}),i]})]})}function sj({title:n,children:i,details:c,onRetry:u,className:d}){const[f,h]=x.useState(!1);return a.jsxs("div",{className:je("rounded-[var(--radius-md)] border-[length:var(--border-thin)] text-body",d),style:{background:"color-mix(in srgb, var(--color-danger) 10%, transparent)",borderColor:"var(--color-danger)"},role:"alert",children:[a.jsxs("div",{className:"flex items-start gap-[var(--space-2)] p-[var(--space-3)]",children:[a.jsx(k,{name:"x-circle",width:"var(--icon-md)",height:"var(--icon-md)",className:"shrink-0 mt-0.5",style:{color:"var(--color-danger)"}}),a.jsxs("div",{className:"flex-1 min-w-0",style:{color:"var(--color-text-primary)"},children:[n&&a.jsx("strong",{className:"block font-semibold mb-0.5",children:n}),a.jsx("div",{children:i})]}),a.jsxs("div",{className:"flex items-center gap-[var(--space-1)] shrink-0",children:[u&&a.jsx("button",{onClick:u,className:"text-caption font-medium px-[var(--space-2)] py-[var(--space-1)] rounded transition-colors hover:opacity-80",style:{background:"color-mix(in srgb, var(--color-danger) 15%, transparent)",color:"var(--color-danger)"},children:"Tentar novamente"}),c&&a.jsx("button",{onClick:()=>h(!f),className:"text-caption px-[var(--space-1)] py-[var(--space-1)] rounded transition-colors hover:opacity-80",style:{color:"var(--color-text-secondary)"},"aria-label":f?"Recolher detalhes":"Expandir detalhes","aria-expanded":f,children:a.jsx(k,{name:f?"chevron-up":"chevron-down",width:"var(--icon-sm)",height:"var(--icon-sm)"})})]})]}),c&&f&&a.jsx("div",{className:"px-[var(--space-3)] pb-[var(--space-3)] pt-0 text-caption",style:{color:"var(--color-text-secondary)"},children:a.jsx("pre",{className:"p-[var(--space-2)] rounded whitespace-pre-wrap break-words max-h-48 overflow-y-auto",style:{background:"color-mix(in srgb, var(--color-bg-sunken) 50%, transparent)",fontFamily:"var(--font-code)"},children:c})})]})}function dx({content:n,children:i,position:c="top",className:u}){const[d,f]=x.useState(!1),[h,p]=x.useState(null),j=x.useRef(null);function v(){var y;p(((y=j.current)==null?void 0:y.getBoundingClientRect())??null),f(!0)}function b(){if(!h)return{};const y=8;return c==="right"?{left:h.right+y,top:h.top+h.height/2,transform:"translateY(-50%)"}:c==="left"?{left:h.left-y,top:h.top+h.height/2,transform:"translate(-100%, -50%)"}:c==="bottom"?{left:h.left+h.width/2,top:h.bottom+y,transform:"translateX(-50%)"}:{left:h.left+h.width/2,top:h.top-y,transform:"translate(-50%, -100%)"}}return a.jsxs("div",{ref:j,className:je("relative inline-flex",u),onMouseEnter:v,onMouseLeave:()=>f(!1),onFocus:v,onBlur:()=>f(!1),children:[i,d&&typeof document<"u"?Zp.createPortal(a.jsx("div",{className:je("fixed z-[var(--z-tooltip)] px-2.5 py-1.5 rounded-[var(--radius-sm)] text-xs whitespace-nowrap pointer-events-none"),style:{...b(),background:"var(--foreground)",color:"var(--background)"},role:"tooltip",children:n}),document.body):null]})}var lj={sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base"};function nj({className:n,...i}){return a.jsx("img",{className:je("aspect-square h-full w-full object-cover",n),...i})}function rj({className:n,delayMs:i,size:c="md",children:u,...d}){return a.jsx("span",{className:je("flex items-center justify-center rounded-full font-medium",lj[c],n),style:{background:"color-mix(in srgb, var(--color-text-secondary) 20%, transparent)",color:"var(--color-text-primary)"},...d,children:u})}function ij({size:n="md",status:i="offline",statusClassName:c,children:u,className:d,...f}){const h=n==="lg"?"var(--icon-lg)":n==="sm"?"var(--icon-sm)":"var(--icon-md)",p=i==="online"?"var(--color-success)":i==="busy"?"var(--color-danger)":i==="thinking"?"var(--color-agent)":i==="away"?"var(--color-warning)":"var(--color-border)";return a.jsxs("div",{className:je("relative inline-flex shrink-0",d),...f,children:[a.jsx("div",{className:je("relative flex shrink-0 overflow-hidden rounded-full border-[length:var(--border-thin)] transition-shadow duration-[var(--motion-base)] ease-[var(--ease-standard)]",i==="thinking"&&"animate-agent-thinking-avatar",n==="lg"?"h-12 w-12 text-base":n==="sm"?"h-8 w-8 text-xs":"h-10 w-10 text-sm"),style:{borderColor:i==="thinking"?"var(--color-agent)":"var(--color-border)",background:"var(--color-bg-sunken)",boxShadow:i==="thinking"?"0 0 0 3px color-mix(in oklch, var(--color-agent) 16%, transparent), 0 0 16px color-mix(in oklch, var(--color-agent) 28%, transparent)":void 0},children:u}),a.jsx("span",{className:je("absolute bottom-0 right-0 rounded-full border-2",c),style:{width:h,height:h,backgroundColor:p,borderColor:"var(--color-bg-surface)",boxShadow:i==="thinking"?"0 0 8px var(--color-agent)":void 0},"aria-hidden":!0})]})}function fx({agent:n,size:i="md"}){const c=(n.avatar.type==="initials",n.avatar.value);return a.jsx(ij,{size:i,status:n.status,"aria-label":`${n.displayName} (${n.status})`,title:n.displayName,children:n.avatar.type==="image"?a.jsx(nj,{src:n.avatar.value,alt:n.displayName}):a.jsx(rj,{size:i,style:{background:n.color},children:c})})}function oj({className:n,orientation:i="horizontal",decorative:c=!0,...u}){return a.jsx("div",{"data-slot":"separator",role:c?void 0:"separator","aria-orientation":i,"aria-hidden":c?!0:void 0,className:je("shrink-0 border-0 bg-[var(--color-border)]",i==="horizontal"?"h-px w-full":"h-full w-px",n),...u})}function cj({className:n,invalid:i,disabled:c,...u}){return a.jsx("div",{"data-slot":"field","data-invalid":i?!0:void 0,"data-disabled":c?!0:void 0,className:je("flex min-w-0 flex-col gap-[var(--space-2)]",n),...u})}function uj({className:n,...i}){return a.jsx(ma,{"data-slot":"field-label",className:je("text-[var(--color-text-primary)]",n),...i})}function dj({className:n,...i}){return a.jsx("p",{"data-slot":"field-description",className:je("text-xs leading-relaxed text-[var(--color-text-secondary)]",n),...i})}function fj({className:n,children:i,...c}){return i?a.jsx("p",{"data-slot":"field-error",role:"alert",className:je("text-xs font-medium leading-relaxed text-[var(--color-danger)]",n),...c,children:i}):null}function mj({label:n,description:i,error:c,id:u,required:d,disabled:f,...h}){const p=x.useId(),j=u??p,v=i?`${j}-description`:void 0,b=c?`${j}-error`:void 0;return a.jsxs(cj,{invalid:!!c,disabled:f,children:[a.jsxs(uj,{htmlFor:j,children:[n,d?a.jsx("span",{"aria-hidden":"true",children:"*"}):null]}),a.jsx(ct,{id:j,type:"date",required:d,disabled:f,"aria-invalid":!!c,"aria-describedby":[v,b].filter(Boolean).join(" ")||void 0,...h}),i?a.jsx(dj,{id:v,children:i}):null,a.jsx(fj,{id:b,children:c})]})}function lp({children:n,open:i,onOpenChange:c}){const[u,d]=x.useState(!1),f=i!==void 0,h=f?i:u,p=j=>{f||d(j),c==null||c(j)};return a.jsx("div",{className:"relative inline-block",children:typeof n=="function"?n({open:h,setOpen:p}):n})}function np({className:n,asChild:i,children:c,...u}){return i?a.jsx(a.Fragment,{children:c}):a.jsx("button",{className:je("inline-flex items-center justify-center gap-[var(--space-1)] rounded-[var(--radius-md)] px-[var(--space-2)] py-[var(--space-1)] text-sm font-medium transition-colors hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary/30",n),type:"button","aria-haspopup":"true",...u,children:c})}function rp({className:n,align:i="start",sideOffset:c=4,children:u,...d}){const f={start:"left-0",center:"left-1/2 -translate-x-1/2",end:"right-0"};return a.jsx("div",{className:je("absolute z-50 min-w-[8rem] overflow-hidden rounded-[var(--radius-md)] border-[length:var(--border-thin)] bg-card p-[var(--space-2)] shadow-md",f[i],n),style:{top:`calc(100% + ${c}px)`,borderColor:"var(--border)",background:"var(--card)"},role:"menu",...d,children:u})}function vu({className:n,inset:i,children:c,...u}){return a.jsx("button",{className:je("relative flex w-full cursor-default select-none items-center gap-[var(--space-2)] rounded-[var(--radius-sm)] px-[var(--space-2)] py-[var(--space-1)] text-sm outline-none transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i&&"pl-[var(--space-3)]",n),role:"menuitem",type:"button",...u,children:c})}function ip({className:n,inset:i,children:c,...u}){return a.jsx("div",{className:je("px-[var(--space-2)] py-[var(--space-1)] text-xs font-semibold text-muted-foreground",i&&"pl-[var(--space-3)]",n),...u,children:c})}var Gu=x.createContext(null);function jr({children:n,open:i,onOpenChange:c}){const[u,d]=x.useState(!1),f=i!==void 0,h=f?i:u,p=x.useCallback(j=>{f||d(j),c==null||c(j)},[f,c]);return a.jsx(Gu.Provider,{value:{open:h,setOpen:p},children:typeof n=="function"?n({open:h,setOpen:p}):n})}function Nr({className:n,side:i="right",children:c,...u}){const d=x.useContext(Gu);if(x.useEffect(()=>{if(!(d!=null&&d.open))return;const h=p=>{p.key==="Escape"&&d.setOpen(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[d]),d&&!d.open)return null;const f={top:"inset-x-0 top-0 border-b",bottom:"inset-x-0 bottom-0 border-t",left:"inset-y-0 left-0 border-r",right:"inset-y-0 right-0 border-l"};return a.jsx("div",{className:"fixed inset-0 z-50 animate-fade-in backdrop-blur-sm",style:{background:"var(--overlay)"},onClick:()=>d==null?void 0:d.setOpen(!1),children:a.jsx("div",{className:je("fixed flex flex-col shadow-xl max-h-full animate-slide-up",i==="left"||i==="right"?"h-full w-full sm:max-w-lg":"max-h-[85vh] w-full rounded-t-[var(--radius-lg)]",f[i],n),style:{borderColor:"var(--color-border)",background:"var(--color-bg-surface)"},role:"dialog","aria-modal":"true",tabIndex:-1,onClick:h=>h.stopPropagation(),...u,children:c})})}function Ii({className:n,children:i,...c}){return a.jsx("div",{className:je("flex items-center justify-between border-b px-[var(--space-6)] py-[var(--space-4)]",n),style:{borderColor:"var(--color-border)"},...c,children:i})}function Fi({className:n,children:i,...c}){return a.jsx("h2",{className:je("text-h2",n),...c,children:i})}function Yu({className:n,children:i,...c}){return a.jsx("p",{className:je("text-body",n),style:{color:"var(--color-text-secondary)"},children:i})}function mx({className:n,asChild:i,children:c,onClick:u,...d}){const f=x.useContext(Gu);return i?a.jsx(a.Fragment,{children:c}):a.jsx("button",{className:je("inline-flex items-center justify-center rounded-[var(--radius-md)] p-1.5 transition-colors duration-[var(--duration-fast)] ease-[var(--ease-standard)] hover:bg-[var(--color-bg-sunken)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)]",n),style:{color:"var(--color-text-secondary)"},type:"button",onClick:h=>{f==null||f.setOpen(!1),u==null||u(h)},...d,children:c})}function $u({className:n,children:i,...c}){return a.jsx("div",{className:je("flex items-center justify-end gap-[var(--space-3)] border-t px-[var(--space-6)] py-[var(--space-4)]",n),style:{borderColor:"var(--color-border)"},...c,children:i})}var hx=x.createContext(null);function Qu(){const n=x.useContext(hx);if(!n)throw new Error("Select sub-components must be used within <Select>");return n}function yn({children:n,value:i,onValueChange:c,defaultValue:u}){const[d,f]=x.useState(u??""),[h,p]=x.useState(!1),j=i!==void 0,v=j?i:d,b=x.useRef(null),y=x.useCallback(z=>{j||f(z),c==null||c(z),p(!1)},[j,c]);return x.useEffect(()=>{if(!h)return;function z(T){b.current&&!b.current.contains(T.target)&&p(!1)}function S(T){T.key==="Escape"&&p(!1)}return document.addEventListener("mousedown",z),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",S)}},[h]),a.jsx(hx.Provider,{value:{value:v,setValue:y,open:h,setOpen:p,selectedValue:v},children:a.jsx("div",{ref:b,className:"relative",children:typeof n=="function"?n({value:v,setValue:y}):n})})}function jn({className:n,children:i,placeholder:c,...u}){const{open:d,setOpen:f}=Qu();return a.jsxs("button",{className:je("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-[var(--radius-sm)] border-[length:var(--border-thin)] bg-transparent px-[var(--space-3)] py-[var(--space-2)] text-sm shadow-sm transition-colors duration-[var(--duration-fast)] ease-[var(--ease-standard)] hover:bg-[var(--color-bg-sunken)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)] disabled:cursor-not-allowed disabled:opacity-50",n),style:{borderColor:"var(--color-border)"},type:"button",onClick:()=>f(!d),...u,children:[i??(c?a.jsx("span",{style:{color:"var(--color-text-secondary)"},children:c}):null),a.jsx(k,{name:"chevron-down",size:16,className:je("opacity-50 transition-transform",d&&"rotate-180")})]})}function Nn({className:n,position:i="popper",children:c,...u}){const{open:d}=Qu();return d?a.jsx("div",{className:je("absolute z-50 min-w-[8rem] overflow-hidden rounded-[var(--radius-xs)] border-[length:var(--border-thin)] bg-card p-[var(--space-2)] shadow-md mt-1 w-full",n),style:{borderColor:"var(--color-border)",background:"var(--color-bg-surface)"},...u,children:c}):null}function Xa({className:n,value:i,children:c,...u}){const{setValue:d,selectedValue:f}=Qu(),h=f===i;return a.jsx("button",{className:je("relative flex w-full cursor-default select-none items-center rounded-[var(--radius-xs)] px-[var(--space-2)] py-[var(--space-1)] text-sm outline-none transition-colors duration-[var(--duration-fast)] ease-[var(--ease-standard)] hover:bg-[var(--color-bg-sunken)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",h&&"bg-[var(--color-primary)]/10",n),style:{color:h?"var(--color-primary)":"var(--color-text-primary)"},type:"button",role:"option","aria-selected":h,onClick:()=>d(i),...u,children:c})}function vr({className:n,placeholder:i,...c}){return a.jsx("span",{className:je("text-sm",n),...c,children:c.children??i??""})}function Sr(n){return a.jsx(wy,{"data-slot":"collapsible",...n})}function wr(n){return a.jsx(Oy,{"data-slot":"collapsible-trigger",...n})}function Cr(n){return a.jsx(Gy,{"data-slot":"collapsible-content",...n})}var hj={default:"border-[var(--color-border)]",warning:"ds-list-item--warning",danger:"ds-list-item--danger",success:"ds-list-item--success",info:"ds-list-item--info"};function Hs({tone:n="default",className:i,children:c,...u}){return a.jsx("ul",{className:je("grid gap-[var(--layout-list-gap)]",n==="surface"&&"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg-base)] p-[var(--layout-list-gap)]",i),...u,children:c})}function Bs({leading:n,title:i,description:c,meta:u,action:d,tone:f="default",className:h,children:p,...j}){return a.jsxs("li",{className:je("grid gap-[var(--layout-cluster-gap)] rounded-[var(--radius-sm)] border bg-[var(--color-bg-base)] p-[var(--layout-list-item-padding)]","transition-[background-color,border-color] duration-[var(--duration-fast)] ease-[var(--ease-standard)] hover:bg-[var(--surface-hover)]","sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",hj[f],h),...j,children:[n?a.jsx("div",{className:"flex items-start sm:items-center",children:n}):null,a.jsxs("div",{className:"grid min-w-0 gap-[var(--space-1)]",children:[u?a.jsx("div",{className:"ds-cluster",children:u}):null,a.jsx("div",{className:"min-w-0 break-words text-body-sm font-medium text-[var(--color-text-primary)]",children:i}),c?a.jsx("div",{className:"min-w-0 break-words text-caption text-[var(--color-text-secondary)]",children:c}):null,p]}),d?a.jsx("div",{className:"flex min-w-0 flex-wrap items-center sm:justify-end",children:d}):null]})}x.createContext(null);var px=x.createContext(null);function pj(){const[n,i]=x.useState(!1);return x.useEffect(()=>{const c=window.matchMedia("(max-width: 767px)"),u=()=>i(c.matches);return u(),c.addEventListener("change",u),()=>c.removeEventListener("change",u)},[]),n}function xj({defaultOpen:n=!0,open:i,onOpenChange:c,className:u,style:d,children:f,...h}){const p=pj(),[j,v]=x.useState(n),[b,y]=x.useState(!1),z=i!==void 0,S=z?i:j,T=x.useCallback(le=>{z||v(le),c==null||c(le)},[z,c]),B=x.useCallback(()=>{if(p){y(le=>!le);return}T(!S)},[p,T,S]),K=x.useMemo(()=>({open:S,setOpen:T,openMobile:b,setOpenMobile:y,isMobile:p,state:S?"expanded":"collapsed",toggleSidebar:B}),[p,b,T,S,B]);return a.jsx(px.Provider,{value:K,children:a.jsx("div",{"data-sidebar-wrapper":!0,className:je("group/sidebar-wrapper flex min-h-svh w-full",u),style:{"--sidebar-width":"18rem","--sidebar-width-icon":"3rem",...d},...h,children:f})})}function ss(){const n=x.useContext(px);if(!n)throw new Error("useSidebar must be used within SidebarProvider.");return n}function vj({side:n="left",collapsible:i="icon",className:c,children:u,...d}){const{open:f,openMobile:h,setOpenMobile:p,isMobile:j}=ss();return j?a.jsx(jr,{open:h,onOpenChange:p,children:a.jsx(Nr,{side:n,className:"w-[var(--sidebar-width)] max-w-[88vw] p-0",children:a.jsx("div",{className:"flex h-full w-full flex-col bg-[var(--color-sidebar)] text-[var(--color-sidebar-foreground)]",children:u})})}):a.jsx("aside",{"data-sidebar":"sidebar","data-state":f?"expanded":"collapsed","data-collapsible":f?"":i,"data-side":n,className:je("relative z-[var(--z-sticky)] hidden h-full min-h-svh shrink-0 overflow-visible border-r bg-[var(--color-sidebar)] text-[var(--color-sidebar-foreground)] transition-[width] duration-[var(--motion-base)] ease-[var(--ease-standard)] md:flex md:flex-col",f?"w-[var(--sidebar-width)]":"w-[var(--sidebar-width-icon)]",n==="right"&&"border-l border-r-0",c),style:{borderColor:"var(--app-sidebar-border, var(--color-sidebar-border))"},...d,children:u})}function gj({className:n,...i}){return a.jsx("div",{className:je("flex shrink-0 items-center gap-2",n),...i})}function bj({className:n,...i}){const{open:c}=ss();return a.jsx("div",{className:je("flex min-h-0 flex-1 flex-col overflow-y-auto",c?"p-2":"px-1 py-2",n),...i})}function op({className:n,...i}){const{open:c}=ss();return a.jsx("div",{className:je("grid gap-2 py-2",!c&&"justify-items-center",n),...i})}function cp({className:n,...i}){const{open:c}=ss();return a.jsx("div",{className:je("grid gap-1",!c&&"justify-items-center",n),...i})}function up({className:n,...i}){const{open:c}=ss();return a.jsx("div",{className:je("px-2 text-caption font-semibold uppercase text-[var(--color-text-secondary)] transition-[opacity,transform] duration-[var(--motion-fast)] ease-[var(--ease-standard)]",!c&&"sr-only",n),...i})}function dp({className:n,...i}){const{open:c}=ss();return a.jsx("ul",{className:je("grid gap-1",!c&&"justify-items-center",n),...i})}function fp({className:n,...i}){const{open:c}=ss();return a.jsx("li",{className:je("min-w-0",!c&&"size-9",n),...i})}function mp({isActive:n,tooltip:i,className:c,children:u,...d}){const{open:f}=ss(),h=a.jsx("button",{type:"button","data-active":n?"true":void 0,className:je("group/sidebar-menu-button flex h-9 w-full min-w-0 items-center gap-2 rounded-[var(--radius-sm)] px-2 text-left text-sm font-medium text-[var(--color-sidebar-foreground)] transition-[background-color,color,border-color,box-shadow,transform] duration-[var(--motion-fast)] ease-[var(--ease-standard)]","hover:bg-[var(--color-sidebar-accent)] hover:text-[var(--color-sidebar-accent-foreground)] hover:translate-x-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)]","active:translate-y-px disabled:pointer-events-none disabled:opacity-50",n&&"bg-[var(--color-sidebar-accent)] text-[var(--color-sidebar-accent-foreground)] border border-[var(--app-sidebar-border,var(--color-sidebar-border))]",!f&&"size-9 justify-center px-0",c),title:f?void 0:i,...d,children:u});return f||!i?h:a.jsx(dx,{content:i,position:"right",className:"w-full",children:h})}function Rs(n){const i=[],c=/(\*\*(.+?)\*\*)|(\*(.+?)\*)|(`(.+?)`)|(\[(.+?)\]\((.+?)\))/g;let u=0,d,f=0;for(;(d=c.exec(n))!==null;)d.index>u&&i.push(n.slice(u,d.index)),d[2]?i.push(a.jsx("strong",{children:d[2]},f++)):d[4]?i.push(a.jsx("em",{children:d[4]},f++)):d[6]?i.push(a.jsx("code",{className:"rounded px-1 py-0.5 text-xs",style:{backgroundColor:"var(--color-bg-surface)",color:"var(--color-text-primary)"},children:d[6]},f++)):d[8]&&d[9]&&i.push(a.jsx("a",{href:d[9],target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2",style:{color:"var(--color-primary)"},children:d[8]},f++)),u=c.lastIndex;return u<n.length&&i.push(n.slice(u)),i}function ml({content:n,className:i}){var h;const c=n.split(`
|
|
50
|
+
`),u=[];let d=0,f=0;for(;d<c.length;){const p=c[d],j=p.trim();if(j===""){d++;continue}if(j.startsWith("```")){const b=[];for(d++;d<c.length&&!c[d].trim().startsWith("```");)b.push(c[d]),d++;d++,u.push(a.jsx("pre",{className:"overflow-x-auto rounded-[var(--radius-sm)] p-4 text-sm leading-relaxed",style:{backgroundColor:"var(--color-bg-surface)"},children:a.jsx("code",{children:b.join(`
|
|
51
|
+
`)})},f++));continue}if(j.startsWith("> ")){const b=[];for(;d<c.length&&c[d].trim().startsWith("> ");)b.push(c[d].trim().slice(2)),d++;u.push(a.jsx("blockquote",{className:"my-2 border-l-2 py-1 pl-4 text-sm",style:{borderColor:"var(--color-primary)",color:"var(--color-text-secondary)"},children:b.map((y,z)=>a.jsxs(x.Fragment,{children:[Rs(y),z<b.length-1&&a.jsx("br",{})]},y))},f++));continue}if(j.startsWith("- ")){const b=[];for(;d<c.length&&c[d].trim().startsWith("- ");)b.push(a.jsx("li",{className:"text-sm",children:Rs(c[d].trim().slice(2))},b.length)),d++;u.push(a.jsx("ul",{className:"my-2 list-disc space-y-1 pl-5",children:b},f++));continue}if(/^\d+\.\s/.test(j)){const b=[];for(;d<c.length&&/^\d+\.\s/.test(c[d].trim());)b.push(a.jsx("li",{className:"text-sm",children:Rs(c[d].trim().replace(/^\d+\.\s/,""))},b.length)),d++;u.push(a.jsx("ol",{className:"my-2 list-decimal space-y-1 pl-5",children:b},f++));continue}if(j.startsWith("|")&&d+1<c.length&&/^\|[\s\-:]+\|/.test(c[d+1].trim())){const b=[];for(;d<c.length&&c[d].trim().startsWith("|");)b.push(c[d].trim()),d++;const y=T=>T.split("|").slice(1,-1).map(B=>B.trim()),z=y(b[0]),S=b.slice(2).map(y);u.push(a.jsx("div",{className:"my-3 overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse text-sm",style:{color:"var(--color-text-primary)"},children:[a.jsx("thead",{children:a.jsx("tr",{children:z.map(T=>a.jsx("th",{className:"border-b-2 px-3 py-2 text-left font-semibold",style:{borderColor:"var(--border)"},children:Rs(T)},T))})}),a.jsx("tbody",{children:S.map((T,B)=>a.jsx("tr",{children:T.map((K,le)=>a.jsx("td",{className:"border-b px-3 py-1.5",style:{borderColor:"var(--border)"},children:Rs(K)},`${K}-${le}`))},T.join("|")||B))})]})},f++));continue}if(/^-{3,}$/.test(j)){u.push(a.jsx("hr",{className:"my-4",style:{borderColor:"var(--border)"}},f++)),d++;continue}if(/^#{1,3}\s/.test(j)){const b=(h=j.match(/^#+/))==null?void 0:h[0].length,y=j.replace(/^#+\s/,""),z=f++;b===1?u.push(a.jsx("h2",{className:"mb-3 mt-1 text-xl font-bold",children:Rs(y)},z)):b===2?u.push(a.jsx("h2",{className:"mb-2 mt-4 text-lg font-semibold",children:Rs(y)},z)):u.push(a.jsx("h3",{className:"mb-1 mt-3 text-base font-semibold",children:Rs(y)},z)),d++;continue}const v=[p];for(d++;d<c.length&&c[d].trim()!==""&&!c[d].trim().startsWith("#")&&!c[d].trim().startsWith("- ")&&!/^\d+\.\s/.test(c[d].trim())&&!c[d].trim().startsWith("> ")&&!c[d].trim().startsWith("```")&&!c[d].trim().startsWith("|")&&!/^-{3,}$/.test(c[d].trim());)v.push(c[d]),d++;u.push(a.jsx("p",{className:"mb-2 text-sm leading-relaxed",children:Rs(v.join(`
|
|
52
|
+
`))},f++))}return a.jsx("div",{className:je("space-y-0",i),children:u})}function yj({title:n,description:i,progress:c,sections:u,activeSection:d,actions:f}){var j,v;const h=Math.round(c*100),p=d?((j=u.find(b=>b.id===d))==null?void 0:j.label)??d:(v=u[0])==null?void 0:v.label;return a.jsxs("div",{className:"shrink-0 border-b border-border bg-[var(--color-bg-surface)]",children:[a.jsxs("div",{className:"flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-start sm:justify-between lg:px-6",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[a.jsx("span",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-[var(--radius-sm)] bg-[var(--color-bg-sunken)] text-[var(--color-primary)]",children:a.jsx(k,{name:"file-text",size:16})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"truncate text-base font-semibold text-[var(--color-text-primary)]",children:n}),i?a.jsx("p",{className:"mt-1 line-clamp-2 text-sm leading-snug text-[var(--color-text-secondary)]",children:i}):null,p?a.jsx("p",{className:"mt-2 text-caption font-medium text-[var(--color-primary)]",children:p}):null]})]}),a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 sm:justify-end",children:[a.jsxs("span",{className:"text-caption tabular-nums text-[var(--color-text-secondary)]",children:[h,"% lido"]}),f]})]}),a.jsxs("div",{className:"px-4 pb-3 lg:px-6",children:[a.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-[var(--color-border)]",children:a.jsx("div",{className:"h-full rounded-full bg-[var(--color-primary)] transition-[width] duration-[var(--duration-fast)] ease-[var(--ease-standard)]",style:{width:`${h}%`}})}),u.length>0?a.jsxs("div",{className:"mt-2 hidden items-center gap-1 overflow-hidden sm:flex",children:[u.slice(0,8).map(b=>{const y=d===b.id;return a.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-caption text-[var(--color-text-secondary)]",children:[a.jsx("span",{className:y?"size-1.5 shrink-0 rounded-full bg-[var(--color-primary)]":"size-1 shrink-0 rounded-full bg-[var(--color-text-disabled)]"}),a.jsx("span",{className:y?"truncate text-[var(--color-primary)]":"truncate",children:b.label})]},b.id)}),u.length>8?a.jsxs("span",{className:"text-caption text-[var(--color-text-secondary)]",children:["+",u.length-8]}):null]}):null]})]})}function jj(n){const i=n.match(/^##\s+(.+)/gm);return i?i.map(c=>{const u=c.replace(/^##\s+/,"");return{id:u.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),label:u}}):[]}function Eu({file:n,initialContent:i,onSave:c,title:u,description:d}){const[f,h]=x.useState("read"),[p,j]=x.useState(i),[v,b]=x.useState(!1),y=x.useRef(null),[z,S]=x.useState(0),[T,B]=x.useState(null),K=p!==i,le=x.useMemo(()=>jj(p),[p]),ve=x.useMemo(()=>le.map(me=>me.label),[le]);x.useEffect(()=>{j(i),h("read")},[n,i]),x.useEffect(()=>{const me=y.current;if(!me||f!=="read")return;const ue=me;function _(){var ge,E,W;const{scrollTop:he,scrollHeight:Oe,clientHeight:be}=ue,Z=Oe-be;S(Z>0?Math.min(he/Z,1):0);const ee=ue.querySelectorAll("h2");let de=((ge=le[0])==null?void 0:ge.id)??null;for(const pe of ee){const xe=((E=pe.textContent)==null?void 0:E.trim())??"",G=ve.indexOf(xe);if(G===-1)continue;pe.getBoundingClientRect().top-ue.getBoundingClientRect().top<200&&(de=((W=le[G])==null?void 0:W.id)??null)}B(de)}return ue.addEventListener("scroll",_,{passive:!0}),_(),()=>ue.removeEventListener("scroll",_)},[f,le,ve]);const oe=x.useCallback(async()=>{b(!0);try{await c(p),h("read")}finally{b(!1)}},[p,c]);function $(){K&&!window.confirm("Descartar alterações não salvas?")||(j(i),h("read"))}const ne=x.useCallback(me=>{(me.metaKey||me.ctrlKey)&&me.key==="s"&&(me.preventDefault(),K&&oe())},[oe,K]);return f==="read"?a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a.jsx(yj,{title:u,description:d,progress:z,sections:le,activeSection:T,actions:a.jsxs(q,{size:"sm",onClick:()=>h("edit"),children:[a.jsx(k,{name:"edit",size:14}),"Editar"]})}),a.jsx("div",{ref:y,className:"flex-1 overflow-y-auto bg-[var(--color-bg-base)] px-4 py-6 sm:px-6 lg:px-8",tabIndex:0,children:a.jsx("div",{className:"mx-auto max-w-3xl rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg-surface)] px-5 py-5 shadow-sm sm:px-7 sm:py-6",children:a.jsx(ml,{content:p})})})]}):a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",onKeyDown:ne,children:[a.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-[var(--color-bg-surface)] px-4 py-3 lg:px-6",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(k,{name:"edit",size:16,className:"shrink-0 text-[var(--color-primary)]"}),a.jsx("span",{className:"truncate text-sm font-semibold text-[var(--color-text-primary)]",children:u})]}),a.jsx("p",{className:"mt-1 text-xs text-[var(--color-text-secondary)]",children:"Edite o Markdown e revise a prévia antes de salvar."})]}),K?a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-[var(--radius-full)] border border-[color-mix(in_oklch,var(--color-warning)_42%,transparent)] px-2 py-1 text-caption font-medium text-[var(--color-warning)]",title:"Alterações não salvas",role:"status","aria-label":"Alterações não salvas",children:[a.jsx("span",{className:"size-1.5 rounded-full bg-[var(--color-warning)]"}),"Alterações não salvas"]}):null,a.jsxs(q,{size:"sm",onClick:oe,loading:v,disabled:!K,children:[a.jsx(k,{name:"check",size:14}),"Salvar"]}),a.jsx(q,{size:"sm",variant:"ghost",onClick:$,children:"Cancelar"})]}),a.jsxs("div",{className:"relative grid flex-1 grid-cols-1 overflow-y-auto lg:min-h-0 lg:grid-cols-2 lg:overflow-hidden",children:[a.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[a.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 lg:px-6",children:a.jsx("span",{className:"text-caption font-medium uppercase text-[var(--color-text-secondary)]",children:"Editor"})}),a.jsx(wn,{"aria-label":"Conteúdo Markdown",value:p,onChange:me=>j(me.target.value),className:"min-h-[42svh] flex-1 resize-none rounded-none border-none px-4 py-4 text-sm leading-relaxed outline-none lg:min-h-0 lg:px-6",style:{background:"var(--color-bg-base)",color:"var(--color-text-primary)",fontFamily:"var(--font-code)"},spellCheck:!1})]}),a.jsx("div",{className:"absolute inset-y-0 left-1/2 hidden w-px bg-[var(--color-border)] lg:block"}),a.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[a.jsx("div",{className:"flex shrink-0 items-center gap-2 border-y border-border px-4 py-2 lg:border-b lg:border-t-0 lg:px-6",children:a.jsx("span",{className:"text-caption font-medium uppercase text-[var(--color-text-secondary)]",children:"Preview"})}),a.jsx("div",{className:"min-h-[42svh] flex-1 overflow-y-auto bg-[var(--surface-1)] px-4 py-4 lg:min-h-0 lg:px-6",children:a.jsx("div",{className:"mx-auto max-w-3xl",children:a.jsx(ml,{content:p})})})]})]})]})}function Nj(n){switch(n){case"success":return{dot:"bg-[var(--color-success)]",line:"bg-[var(--color-success)]"};case"error":return{dot:"bg-[var(--color-danger)]",line:"bg-[var(--color-danger)]"};case"agent":return{dot:"bg-[var(--color-agent)]",line:"bg-[var(--color-agent)]"};case"info":return{dot:"bg-[var(--color-info)]",line:"bg-[var(--color-info)]"};default:return{dot:"bg-[var(--color-text-secondary)]",line:"bg-[var(--color-border)]"}}}function Sj({className:n,children:i}){return a.jsx("div",{className:je("flex flex-col",n),children:i})}function hp({title:n,description:i,timestamp:c,status:u="default",icon:d,action:f,className:h,last:p=!1}){const j=Nj(u);return a.jsxs("div",{className:je("flex gap-[var(--space-3)]",h),children:[a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx("div",{className:je("mt-1 size-[var(--icon-xs)] shrink-0 rounded-full",j.dot),"aria-hidden":"true"}),!p&&a.jsx("div",{className:je("w-px flex-1 my-[var(--space-2)]",j.line),"aria-hidden":"true"})]}),a.jsx("div",{className:"min-w-0 flex-1 pb-[var(--space-5)]",children:a.jsxs("div",{className:"flex flex-col gap-[var(--space-3)] sm:flex-row sm:items-start sm:justify-between sm:gap-[var(--space-2)]",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-[var(--space-2)]",children:[d&&a.jsx("span",{className:"shrink-0 size-[var(--icon-md)] flex items-center justify-center",children:d}),a.jsx("span",{className:"min-w-0 text-body font-medium leading-snug",style:{color:"var(--color-text-primary)"},children:n})]}),i&&a.jsx("p",{className:"mt-[var(--space-1)] text-caption leading-relaxed",style:{color:"var(--color-text-secondary)"},children:i})]}),a.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-[var(--space-2)] sm:justify-end",children:[c&&a.jsx("span",{className:"whitespace-nowrap text-caption tabular-nums",style:{color:"var(--color-text-secondary)"},children:c}),f&&a.jsx("div",{className:"shrink-0",children:f})]})]})})]})}function xx({title:n,titleId:i,description:c,left:u,right:d,className:f}){return a.jsxs("header",{className:je("flex flex-col items-stretch justify-between gap-[var(--layout-cluster-gap)] border-b border-[var(--color-border)] bg-[var(--color-bg-surface)] px-[var(--card-padding)] py-[var(--layout-cluster-gap)] sm:flex-row sm:items-center",f),style:{color:"var(--color-text-primary)"},children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-[var(--layout-cluster-gap)]",children:[u,a.jsxs("div",{className:"flex min-w-0 flex-col",children:[n&&a.jsx("h1",{id:i,className:"text-h2",children:n}),c&&a.jsx("span",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:c})]})]}),a.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-[var(--layout-toolbar-gap)] sm:justify-end",children:d})]})}var gu="workspace:",vn="scope:",bu="__workspace__";function gn(n,i,c){return n===1?i:c}function wj({sidebarOpen:n=!0,onToggleSidebar:i,workspaces:c,activeWorkspaceId:u,scopes:d=[],activeScopeId:f=null,onWorkspaceChange:h,onScopeChange:p,pendingDecisions:j=0,health:v,onOpenHealthCenter:b,onOpenSettings:y,theme:z,onThemeChange:S,userSlot:T,className:B}){const K=u===void 0?c[0]:c.find(be=>be.id===u),le=(K==null?void 0:K.name)??"Escolha um workspace",ve=d.find(be=>be.id===f),oe=(ve==null?void 0:ve.label)??"Todo o workspace",$=f?`${vn}${f}`:`${vn}${bu}`,ne=j>0,me=!!(v&&v.activeAlerts>0),ue=ne||me,_=(v==null?void 0:v.activeAlerts)??0,he=(v==null?void 0:v.criticalAlerts)??0,Oe=z==="dark"?"light":"dark";return a.jsxs("header",{className:je("app-header-surface grid min-h-16 grid-cols-[auto_minmax(0,1fr)_auto] grid-rows-[auto_auto] items-center gap-x-2 gap-y-2 px-4 py-3 sm:grid-cols-[auto_minmax(0,420px)_minmax(0,1fr)_auto]",B),children:[a.jsx(q,{type:"button",variant:"ghost",size:"sm",className:"col-start-1 row-start-1 size-8 px-0","aria-label":n?"Recolher menu global":"Expandir menu global",title:n?"Recolher menu":"Expandir menu",onClick:i,children:a.jsx(k,{name:"list-three",size:16})}),a.jsxs(yn,{value:$,onValueChange:be=>{if(be.startsWith(gu)){h==null||h(be.slice(gu.length));return}if(be.startsWith(vn)){const Z=be.slice(vn.length);p==null||p(Z===bu?null:Z)}},children:[a.jsx(jn,{"aria-label":`Contexto atual: workspace ${le}, escopo ${oe}`,className:"col-start-2 row-start-1 min-w-0 max-w-[420px] justify-self-start sm:min-w-[240px]",children:a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(k,{name:"box",size:16}),a.jsx("span",{className:"truncate",children:le}),a.jsx("span",{className:"text-[var(--color-text-secondary)]",children:"/"}),a.jsx(k,{name:"folder",size:14,className:"text-[var(--color-text-secondary)]"}),a.jsx("span",{className:"truncate text-[var(--color-text-secondary)]",children:oe})]})}),a.jsxs(Nn,{className:"min-w-[280px]",children:[a.jsx("div",{className:"px-2 py-1 text-caption font-semibold uppercase text-[var(--color-text-secondary)]",children:"Workspace"}),c.length===0?a.jsx("div",{className:"px-2 py-2 text-sm text-[var(--color-text-secondary)]",children:"Nenhum workspace encontrado"}):c.map(be=>a.jsx(Xa,{value:`${gu}${be.id}`,children:a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(k,{name:(K==null?void 0:K.id)===be.id?"check":"box",size:14}),a.jsx("span",{className:"truncate",children:be.name})]})},be.id)),a.jsx("div",{className:"my-2 border-t border-[var(--color-border)]"}),a.jsx("div",{className:"px-2 py-1 text-caption font-semibold uppercase text-[var(--color-text-secondary)]",children:"Escopo"}),a.jsx(Xa,{value:`${vn}${bu}`,children:"Todo o workspace"}),d.map(be=>a.jsx(Xa,{value:`${vn}${be.id}`,children:be.label},be.id))]})]}),a.jsx("div",{className:"col-start-1 col-end-4 row-start-2 flex min-w-0 flex-wrap items-center gap-2 sm:col-start-3 sm:col-end-4 sm:row-start-1 sm:justify-self-start",children:ue?a.jsxs(q,{type:"button",variant:"secondary",size:"sm","aria-label":`Abrir supervisao: ${j} ${gn(j,"decisao pendente","decisoes pendentes")}, ${_} ${gn(_,"sinal ativo","sinais ativos")}, ${he} ${gn(he,"bloqueia conclusao","bloqueiam conclusao")}`,className:"app-status-pill app-status-pill--action whitespace-nowrap",onClick:b,children:[a.jsx(k,{name:"shield",size:14}),a.jsx("span",{children:"Supervisao"}),ne?a.jsxs(ke,{variant:"amber",icon:"clock",children:[j," ",gn(j,"decisao","decisoes")]}):null,me?a.jsxs(ke,{variant:"amber",icon:"octagon-alert",children:[_," ",gn(_,"sinal","sinais")]}):null,he>0?a.jsxs(ke,{variant:"error",icon:"circle-x",children:[he," ",gn(he,"bloqueia","bloqueiam")]}):null]}):null}),a.jsxs("div",{className:"col-start-3 row-start-1 flex shrink-0 items-center justify-end gap-2 sm:col-start-4",children:[z&&S?a.jsx(q,{type:"button",variant:"ghost",size:"sm",onClick:()=>S(Oe),"aria-label":`Alternar para tema ${Oe==="light"?"claro":"escuro"}`,title:`Tema ${Oe==="light"?"claro":"escuro"}`,children:a.jsx(k,{name:z==="dark"?"sun":"moon",size:16})}):null,y?a.jsx(q,{type:"button",variant:"ghost",size:"sm",onClick:y,"aria-label":"Abrir configurações do workspace",title:"Configurações do workspace",children:a.jsx(k,{name:"settings",size:16})}):null,T]})]})}function Cj({sidebar:n,header:i,children:c,sidebarCollapsed:u=!1,className:d,...f}){const h=["app-shell",u?"app-shell--sidebar-collapsed":"",d??""].filter(Boolean).join(" ");return a.jsxs("div",{className:h,...f,children:[a.jsx("div",{className:"app-shell__sidebar",children:n}),a.jsx("div",{className:"app-shell__header",children:i}),a.jsx("div",{className:"app-shell__content",children:c})]})}var zj={default:{backgroundColor:"#282B32",color:"var(--color-text-secondary)",borderColor:"#2E3138"},agent:{backgroundColor:"#22203A",color:"#C4B5FD",borderColor:"#53497C"},success:{backgroundColor:"#1A2B20",color:"#4ADE80",borderColor:"#1C623A"},info:{backgroundColor:"#1C2636",color:"#93C5FD",borderColor:"#36547C"},warning:{backgroundColor:"#1C1808",color:"#FCD34D",borderColor:"#866611"},danger:{backgroundColor:"#2C1A1A",color:"#FCA5A5",borderColor:"#762C2F"}};function ot({variant:n="default",className:i,children:c,style:u,...d}){const f=zj[n];return a.jsx("span",{"data-slot":"tag",className:je("inline-flex items-center gap-[var(--space-1)] rounded-[var(--radius-full)] border-[length:var(--border-thin)] px-[var(--space-2)] py-[var(--space-1)] text-caption font-medium leading-none",i),style:{...f,...u},...d,children:c})}function Aj(n){return n?n.split(/[/\\]/).pop()||n:"Todo o workspace"}function Ej({theme:n,onThemeChange:i,gateCount:c=0,activeDirectory:u,workspaces:d,activeWorkspace:f,onWorkspaceChange:h,onDirectoryChange:p,health:j,onOpenHealthCenter:v,onOpenWorkspaceSettings:b}){const{open:y,setOpen:z}=ss(),S=(f==null?void 0:f.directories)??[];return a.jsx(wj,{sidebarOpen:y,onToggleSidebar:()=>z(!y),workspaces:d.map(T=>({id:T.slug,name:T.name})),activeWorkspaceId:(f==null?void 0:f.slug)??null,scopes:S.map(T=>({id:T,label:Aj(T)})),activeScopeId:u??null,onWorkspaceChange:T=>{const B=d.find(K=>K.slug===T);B&&(h==null||h(B))},onScopeChange:p,pendingDecisions:c,health:j,onOpenHealthCenter:v,onOpenSettings:f?b:void 0,theme:n,onThemeChange:i})}function kj({size:n=64}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"Letra L",role:"img",children:[a.jsx("circle",{cx:"16",cy:"10",r:"6",fill:"var(--color-primary)"}),a.jsx("path",{d:"M16 10V50H38",stroke:"var(--color-primary)",strokeWidth:"8",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("circle",{cx:"16",cy:"30",r:"7",fill:"var(--color-primary-pressed)"}),a.jsx("circle",{cx:"16",cy:"50",r:"6",fill:"var(--color-primary)"}),a.jsx("circle",{cx:"44",cy:"50",r:"6",fill:"var(--color-primary)"}),a.jsx("circle",{cx:"57",cy:"50",r:"6",fill:"var(--color-text-primary)",opacity:"0.9"})]})}const Tj=[{id:"supervision",label:"Supervisão",icon:"shield",color:"var(--color-info)"},{id:"work",label:"Trabalho",icon:"grid",color:"var(--color-primary)"},{id:"knowledge",label:"Conhecimento e Regras",icon:"book",color:"var(--color-agent)"},{id:"activity",label:"Atividade",icon:"activity",color:"var(--color-success)"},{id:"agents",label:"Agentes",icon:"user",color:"var(--color-agent)"}],Mj=[{id:"settings",label:"Workspace",icon:"settings",color:"var(--color-text-secondary)"}];function Dj({activeTab:n,onTabChange:i,workspaceActive:c,onOpenWorkspaceSettings:u}){const{open:d,isMobile:f,setOpenMobile:h}=ss();return a.jsxs(vj,{collapsible:"icon",side:"left",children:[a.jsx(gj,{className:d?"flex flex-row items-center border-b px-4":"flex flex-row items-center justify-center border-b px-0",style:{borderColor:"var(--app-sidebar-border, var(--color-border))",height:"64px"},children:a.jsxs("div",{className:d?"flex min-w-0 items-center gap-2":"flex min-w-0 items-center justify-center",children:[a.jsx(kj,{size:28}),a.jsx("span",{"data-sidebar-label":"brand",className:d?"truncate text-sm font-semibold text-[var(--color-text-primary)]":"sr-only",children:"Letra"})]})}),a.jsxs(bj,{children:[a.jsxs(op,{children:[a.jsx(up,{children:"Navegação"}),a.jsx(cp,{children:a.jsx(dp,{children:Tj.map(p=>a.jsx(fp,{children:a.jsxs(mp,{"aria-label":p.label,isActive:n===p.id,disabled:!c,onClick:()=>{p.id==="settings"?u==null||u():i(p.id),f&&h(!1)},tooltip:p.label,children:[a.jsx(k,{name:p.icon,size:16,className:"transition-transform duration-[var(--motion-fast)] group-hover/sidebar-menu-button:scale-110",style:{color:p.color}}),a.jsx("span",{"data-sidebar-label":p.id,className:d?"truncate":"sr-only",children:p.label})]})},p.id))})})]}),a.jsx(oj,{}),a.jsxs(op,{children:[a.jsx(up,{children:"Configuração"}),a.jsx(cp,{children:a.jsx(dp,{children:Mj.map(p=>a.jsx(fp,{children:a.jsxs(mp,{"aria-label":p.label,isActive:n===p.id,disabled:!c,onClick:()=>{u==null||u(),f&&h(!1)},tooltip:p.label,children:[a.jsx(k,{name:p.icon,size:16,className:"transition-transform duration-[var(--motion-fast)] group-hover/sidebar-menu-button:scale-110",style:{color:p.color}}),a.jsx("span",{"data-sidebar-label":p.id,className:d?"truncate":"sr-only",children:p.label})]})},p.id))})})]})]})]})}function _t(...n){return Xp(Mp(n))}const yu=[{id:"opencode",label:"OpenCode"},{id:"cursor",label:"Cursor"},{id:"claude-code",label:"Claude Code"},{id:"windsurf",label:"Windsurf"},{id:"hermes",label:"Hermes"},{id:"vscode",label:"VS Code"},{id:"copilot",label:"Copilot"}],Oj=[{path:"C:/Workspace",label:"C:/Workspace"},{path:"C:/Dev",label:"C:/Dev"},{path:"C:/Projects",label:"C:/Projects"},{path:"C:/Users",label:"C:/Users"},{path:"D:/",label:"D:/"}],pp={opencode:n=>`Você é um arquiteto de software especializado em configurar o Letra (framework SDD — Specification-Driven Development) para novos workspaces.
|
|
53
|
+
|
|
54
|
+
## Missão
|
|
55
|
+
Analise profundamente o workspace em **${n.workspacePath}** e seus diretórios monitorados (${n.dirs.join(", ")}) para gerar o harness completo do Letra - conjunto de arquivos de contexto que descrevem a arquitetura, decisões, glossário e fluxo de trabalho.
|
|
56
|
+
|
|
57
|
+
## Passos
|
|
58
|
+
|
|
59
|
+
### 1. Explorar o Workspace
|
|
60
|
+
- Varra todos os diretórios listados acima
|
|
61
|
+
- Identifique a stack principal (linguagem, framework, runtime, banco de dados)
|
|
62
|
+
- Detecte padrões de arquitetura (MVC, hexagonal, microsserviços, monólito, etc.)
|
|
63
|
+
- Mapeie a estrutura de diretórios e o propósito de cada módulo/pasta
|
|
64
|
+
- Identifique convenções de código (ESLint, Prettier, tsconfig, Dockerfile, CI/CD)
|
|
65
|
+
- Verifique se há package.json, Cargo.toml, pyproject.toml, Gemfile, go.mod, etc.
|
|
66
|
+
- Analise testes existentes (framework de teste, cobertura, padrões)
|
|
67
|
+
|
|
68
|
+
### 2. Gerar Constitution (${n.workspacePath}/.letra/constitution.md)
|
|
69
|
+
Regras não-negociáveis do workspace:
|
|
70
|
+
- Stack e versões obrigatórias
|
|
71
|
+
- Padrões de arquitetura que devem ser seguidos
|
|
72
|
+
- Convenções de código (naming, organização de imports, testes)
|
|
73
|
+
- Regras de segurança (nunca expor secrets, validação de input, etc.)
|
|
74
|
+
- Práticas de CI/CD e deploy
|
|
75
|
+
- Como as specs devem ser escritas (thin specs, formato)
|
|
76
|
+
|
|
77
|
+
### 3. Gerar Context (${n.workspacePath}/.letra/context.md)
|
|
78
|
+
Visão geral do workspace:
|
|
79
|
+
- Intent: propósito do workspace "${n.name}" — ${n.description}
|
|
80
|
+
- Domínio: problema de negócio que o workspace resolve
|
|
81
|
+
- Stack técnica completa (linguagem, frameworks, banco, infra)
|
|
82
|
+
- Restrições reais (prazos, equipe, limitações técnicas)
|
|
83
|
+
- Decisões arquiteturais importantes (com links para ADRs)
|
|
84
|
+
- Glossário de termos específicos do domínio
|
|
85
|
+
|
|
86
|
+
### 4. Gerar Glossary (${n.workspacePath}/.letra/glossary.md)
|
|
87
|
+
- Termos técnicos e de domínio mapeados
|
|
88
|
+
- Abreviações e siglas usadas no projeto
|
|
89
|
+
- Nomes de módulos, pacotes e suas responsabilidades
|
|
90
|
+
|
|
91
|
+
### 5. Configurar Fluxo SDLC
|
|
92
|
+
- Crie ${n.workspacePath}/.letra/workflow.json com os estágios:
|
|
93
|
+
- Backlog (todo)
|
|
94
|
+
- Spec Draft (doing)
|
|
95
|
+
- Spec Review (doing)
|
|
96
|
+
- Code (doing)
|
|
97
|
+
- Code Review (doing)
|
|
98
|
+
- Ready to PR (doing)
|
|
99
|
+
- Done (done)
|
|
100
|
+
- Para cada item existente no backlog, crie entries no workflow
|
|
101
|
+
|
|
102
|
+
### 6. Gerar Spec Inicial
|
|
103
|
+
- ${n.workspacePath}/.letra/specs/_template/spec.md — template de spec
|
|
104
|
+
- ${n.workspacePath}/.letra/specs/README.md — guia do diretório de specs
|
|
105
|
+
|
|
106
|
+
### 7. Adaptadores
|
|
107
|
+
Configure os adaptadores para: ${n.dirs.join(", ")}
|
|
108
|
+
- AGENTS.md (formato OpenCode)
|
|
109
|
+
- .cursorrules (formato Cursor)
|
|
110
|
+
- CLAUDE.md (formato Claude Code)
|
|
111
|
+
- .windsurfrules (formato Windsurf)
|
|
112
|
+
- .opencode/instructions.md (formato OpenCode)
|
|
113
|
+
- .github/copilot-instructions.md (formato GitHub Copilot)
|
|
114
|
+
|
|
115
|
+
Cada adaptador deve conter:
|
|
116
|
+
- Seção de contexto com os diretórios monitorados
|
|
117
|
+
- Comandos disponíveis (pulse, sitrep, flow move, health)
|
|
118
|
+
- Seção de item ativo (se houver)
|
|
119
|
+
- Regras de handoff entre agentes
|
|
120
|
+
|
|
121
|
+
## Formato de Saída
|
|
122
|
+
Gere todos os arquivos dentro de ${n.workspacePath}/.letra/. Retorne um resumo do que foi criado.`,cursor:n=>`You are an expert software architect configuring the Letra framework (SDD — Specification-Driven Development) for a workspace.
|
|
123
|
+
|
|
124
|
+
## Mission
|
|
125
|
+
Deeply analyze the workspace at **${n.workspacePath}** and its monitored directories (${n.dirs.join(", ")}) to generate the complete Letra harness.
|
|
126
|
+
|
|
127
|
+
## Steps
|
|
128
|
+
|
|
129
|
+
### 1. Explore the Workspace
|
|
130
|
+
- Walk all listed directories
|
|
131
|
+
- Identify the main stack (language, framework, runtime, database)
|
|
132
|
+
- Detect architecture patterns (MVC, hexagonal, microservices, monolith, etc.)
|
|
133
|
+
- Map directory structure and each module's purpose
|
|
134
|
+
- Identify code conventions (linting, formatting, tsconfig, Dockerfile, CI/CD)
|
|
135
|
+
- Check for package.json, Cargo.toml, pyproject.toml, etc.
|
|
136
|
+
- Analyze existing tests (framework, coverage, patterns)
|
|
137
|
+
|
|
138
|
+
### 2. Generate Constitution
|
|
139
|
+
Non-negotiable workspace rules in ${n.workspacePath}/.letra/constitution.md
|
|
140
|
+
|
|
141
|
+
### 3. Generate Context
|
|
142
|
+
Workspace overview in ${n.workspacePath}/.letra/context.md including intent, domain, tech stack, constraints, architectural decisions.
|
|
143
|
+
|
|
144
|
+
### 4. Generate Glossary
|
|
145
|
+
Technical and domain terms in ${n.workspacePath}/.letra/glossary.md
|
|
146
|
+
|
|
147
|
+
### 5. Configure SDLC Flow
|
|
148
|
+
Workflow with stages: Backlog, Spec Draft, Spec Review, Code, Code Review, Ready to PR, Done.
|
|
149
|
+
|
|
150
|
+
### 6. Generate Spec Template
|
|
151
|
+
- ${n.workspacePath}/.letra/specs/_template/spec.md
|
|
152
|
+
- ${n.workspacePath}/.letra/specs/README.md
|
|
153
|
+
|
|
154
|
+
### 7. Configure .cursorrules
|
|
155
|
+
Generate .cursorrules with context, available commands, active item section, and handoff rules.
|
|
156
|
+
|
|
157
|
+
Return a summary of everything created.`,"claude-code":n=>`You are configuring the Letra SDD framework for "${n.name}" at ${n.workspacePath}. Deeply analyze the workspace (${n.dirs.join(", ")}) — explore its stack, architecture, code conventions, and test patterns — then generate the complete Letra harness:
|
|
158
|
+
|
|
159
|
+
1. **${n.workspacePath}/.letra/constitution.md** — architecture rules, code conventions, security policies
|
|
160
|
+
2. **${n.workspacePath}/.letra/context.md** — workspace intent, domain, tech stack, constraints, decisions
|
|
161
|
+
3. **${n.workspacePath}/.letra/glossary.md** — domain and technical terms
|
|
162
|
+
4. **${n.workspacePath}/.letra/workflow.json** — SDLC stages
|
|
163
|
+
5. **${n.workspacePath}/.letra/specs/** — template and README
|
|
164
|
+
6. **CLAUDE.md** — Claude Code adapter with workspace context, available commands, active items, and handoff rules
|
|
165
|
+
|
|
166
|
+
For each file, reflect the actual project patterns you discover during exploration. The harness must match the real project profile.`,windsurf:n=>`Configure the Letra SDD framework for "${n.name}" at ${n.workspacePath}. Explore the codebase in ${n.dirs.join(", ")}, identify stack, architecture, patterns, and generate the full Letra harness:
|
|
167
|
+
|
|
168
|
+
- .letra/constitution.md — rules and conventions
|
|
169
|
+
- .letra/context.md — workspace overview and decisions
|
|
170
|
+
- .letra/glossary.md — terms
|
|
171
|
+
- .letra/workflow.json — SDLC pipeline
|
|
172
|
+
- .letra/specs/ — spec template
|
|
173
|
+
- .windsurfrules — Windsurf adapter with workspace context, commands, and handoff
|
|
174
|
+
|
|
175
|
+
Base every file on real project analysis, not generic templates.`,hermes:n=>`Configure Letra for "${n.name}" at ${n.workspacePath}. Analyze ${n.dirs.join(", ")} deeply — stack, architecture, code style, tests — then generate:
|
|
176
|
+
|
|
177
|
+
- .letra/constitution.md, context.md, glossary.md
|
|
178
|
+
- .letra/workflow.json with SDLC stages
|
|
179
|
+
- .letra/specs/ template
|
|
180
|
+
- .hermes/instructions.md with workspace context, commands, and handoff rules
|
|
181
|
+
|
|
182
|
+
Tailor every file to the actual project profile found during exploration.`,vscode:n=>`Configure Letra SDD for "${n.name}" at ${n.workspacePath}. Explore ${n.dirs.join(", ")}, detect tech stack, architecture, and conventions, then generate:
|
|
183
|
+
|
|
184
|
+
- .letra/constitution.md, context.md, glossary.md
|
|
185
|
+
- .letra/workflow.json
|
|
186
|
+
- .letra/specs/ template
|
|
187
|
+
- .vscode/settings.json with recommended extensions for the detected stack
|
|
188
|
+
- .vscode/copilot-instructions.md with workspace context
|
|
189
|
+
|
|
190
|
+
All files must reflect real project analysis, not generic templates.`,copilot:n=>`Analyze the workspace "${n.name}" at ${n.workspacePath}. Walk directories ${n.dirs.join(", ")}, identify stack, architecture, patterns, and configure Letra:
|
|
191
|
+
|
|
192
|
+
- .letra/constitution.md — workspace rules
|
|
193
|
+
- .letra/context.md — intent, domain, stack, constraints
|
|
194
|
+
- .letra/glossary.md — terms
|
|
195
|
+
- .letra/workflow.json — SDLC stages
|
|
196
|
+
- .letra/specs/ — spec template
|
|
197
|
+
- .github/copilot-instructions.md — Copilot adapter with full workspace context
|
|
198
|
+
|
|
199
|
+
Infer everything from actual codebase analysis.`};function Rj({onComplete:n}){var De;const[i,c]=x.useState("name"),u=["name","directories","template","review"],d={name:"Nome",directories:"Diretórios",template:"Template",review:"Revisão",done:"Concluído"},f=u.indexOf(i),[h,p]=x.useState(""),[j,v]=x.useState(""),[b,y]=x.useState(""),z=h.trim().length>0,S=j.trim().length>=10,T=b.trim().length>0,B=z&&S&&T,K=x.useRef(null),[le,ve]=x.useState([]),[oe,$]=x.useState(""),[ne,me]=x.useState([]),[ue,_]=x.useState(Oj.map(F=>({name:F.label,path:F.path,expanded:!1,loading:!1,children:[]}))),he=[...le,...ne],Oe=he.length>=1;function be(F){ve(Te=>Te.includes(F)?Te.filter(Me=>Me!==F):[...Te,F])}function Z(){const F=oe.trim();F&&!ne.includes(F)&&!he.includes(F)&&(me([...ne,F]),$(""))}function ee(F){me(ne.filter(Te=>Te!==F))}function de(F){const Te=F.target.files;if(Te&&Te.length>0){const Me=Te[0].webkitRelativePath;Me&&y(Me.split("/")[0])}}async function ge(F){if(F.expanded){F.expanded=!1,_([...ue]);return}if(F.children.length===0&&!F.loading){F.loading=!0,_([...ue]);try{const Me=await(await fetch(`/api/fs/dirs?path=${encodeURIComponent(F.path)}`)).json();F.children=(Me.dirs||[]).map(gt=>({name:gt.name,path:gt.path,expanded:!1,loading:!1,children:[]}))}catch{}F.loading=!1}F.expanded=!0,_([...ue])}const[E,W]=x.useState(["opencode"]),pe=E.length>=1;function xe(F){W(Te=>Te.includes(F)?Te.filter(Me=>Me!==F):[...Te,F])}const[G,N]=x.useState(!1),[R,I]=x.useState(""),[D,ie]=x.useState(""),[U,M]=x.useState(null);async function X(){N(!0),I("");const F={tools:E,name:h.trim(),description:j.trim(),workspacePath:b.trim(),directories:he,template:"padrao"};try{const Me=await(await fetch("/api/workflow/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)})).json();if(N(!1),Me&&!Me.error){M(Me);const gt=E[0],ht=pp[gt]||pp.opencode;ie(ht({dirs:he,name:h.trim(),description:j.trim(),workspacePath:b.trim()})),c("done")}else I((Me==null?void 0:Me.error)||"Erro desconhecido ao criar workspace")}catch{N(!1),I("Erro de conexão com o servidor")}}function te(){const F=u.indexOf(i);F<u.length-1&&c(u[F+1])}function Ge(){const F=u.indexOf(i);F>0&&c(u[F-1])}function Se(F,Te=0){return F.map(Me=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1",style:{paddingLeft:Te*16},children:[a.jsx(q,{onClick:()=>ge(Me),className:"flex items-center justify-center w-5 h-5 rounded hover:bg-primary/10 transition-colors shrink-0","aria-label":Me.expanded?"Recolher":"Expandir",children:Me.loading?a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-primary border-t-transparent animate-spin"}):a.jsx(k,{name:"chevron-right",size:12,className:_t("transition-transform",Me.expanded&&"rotate-90"),style:Me.children.length===0?{opacity:.3}:void 0})}),a.jsxs("label",{className:"flex items-center gap-2 flex-1 py-1 rounded cursor-pointer hover:bg-primary/5 px-1",children:[a.jsx(Sn,{checked:le.includes(Me.path),onChange:()=>be(Me.path)}),a.jsx(k,{name:"folder",size:14,className:"text-primary shrink-0"}),a.jsx("span",{className:"text-sm truncate",children:Me.name}),a.jsx("span",{className:"text-xs ml-auto shrink-0",style:{color:"var(--color-text-secondary)"},children:Me.path})]})]}),Me.expanded&&Me.children.length>0&&Se(Me.children,Te+1)]},Me.path))}const Le="transition-all duration-200 hover:scale-[1.02] active:scale-[0.98] disabled:opacity-40 disabled:hover:scale-100";return a.jsx("div",{className:"h-full overflow-y-auto p-6",children:a.jsxs("div",{className:"max-w-2xl mx-auto flex flex-col gap-6",children:[i!=="done"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center justify-center gap-0",children:u.map((F,Te)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(q,{onClick:()=>{Te<f&&c(F)},disabled:Te>f,className:_t("w-8 h-8 rounded-full text-xs font-medium flex items-center justify-center transition-all",Te===f&&"ring-2 ring-primary/30",Te<f&&"cursor-pointer"),style:{background:Te<f?"var(--color-success)":Te===f?"var(--color-primary)":"var(--color-bg-surface)",color:Te<f?"var(--color-success)":Te===f?"var(--color-primary)":"var(--color-text-secondary)"},"aria-label":`Passo ${Te+1}: ${d[F]}${Te<f?" (concluído)":""}`,children:Te<f?a.jsx(k,{name:"check",size:14}):Te+1}),Te<u.length-1&&a.jsx("div",{className:"w-8 h-0.5 mx-1",style:{background:Te<f?"var(--color-success)":"var(--color-border)"}})]},F))}),a.jsx("div",{className:"flex justify-center gap-0 text-xs -mt-4",style:{color:"var(--color-text-secondary)"},children:u.map((F,Te)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:_t("px-1",Te===f&&"font-semibold text-primary"),children:d[F]}),Te<u.length-1&&a.jsx("span",{className:"w-8"})]},F))})]}),i==="name"&&a.jsxs("div",{className:"flex flex-col items-center text-center gap-6 pt-8 animate-fade-in",children:[a.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-[var(--radius-lg)] bg-primary/10",children:a.jsx(k,{name:"grid",size:24,className:"text-primary"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Configurar Workspace"}),a.jsx("p",{className:"text-muted-foreground text-base max-w-md",children:"Defina o nome, descrição e local do workspace."})]}),a.jsxs("div",{className:"w-full max-w-sm flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Nome do workspace ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx(ct,{placeholder:"Ex: Meu Projeto",value:h,onChange:F=>p(F.target.value)})]}),a.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Descrição ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx(wn,{className:"w-full px-3 py-2 rounded-[var(--radius-sm)] border text-sm resize-none",rows:3,placeholder:"Descreva o propósito do workspace (mín. 10 caracteres)",value:j,onChange:F=>v(F.target.value),style:{borderColor:"var(--color-border)",background:"var(--color-bg-base)",color:"var(--color-text-primary)"}}),j.length>0&&!S&&a.jsxs("span",{className:"text-xs text-red-500",children:["Faltam ",10-j.trim().length," caracteres"]})]}),a.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Caminho do workspace ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ct,{placeholder:"Ex: C:/MeusProjetos/meu-app",value:b,onChange:F=>y(F.target.value),className:"flex-1 font-mono text-xs"}),a.jsx(ct,{ref:K,type:"file",webkitdirectory:"",style:{display:"none"},onChange:de}),a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>{var F;return(F=K.current)==null?void 0:F.click()},children:a.jsx(k,{name:"search",size:14})})]}),a.jsxs("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:["Onde o ",a.jsx("code",{children:".letra/"})," será criado"]})]}),a.jsx(q,{className:Le,disabled:!B,onClick:te,children:"Próximo"})]})]}),i==="directories"&&a.jsxs("div",{className:"flex flex-col gap-4 pt-4 animate-fade-in",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Diretórios do Projeto"}),a.jsx("p",{className:"text-sm mt-1",style:{color:"var(--color-text-secondary)"},children:"Navegue e selecione os diretórios que o Letra deve monitorar."})]}),a.jsx("div",{className:"rounded-[var(--radius-md)] border p-2 max-h-64 overflow-y-auto",style:{borderColor:"var(--color-border)"},children:Se(ue)}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Adicionar outro diretório"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ct,{placeholder:"Ex: D:/Projects",value:oe,onChange:F=>$(F.target.value),onKeyDown:F=>{F.key==="Enter"&&Z()},className:"flex-1 font-mono text-xs"}),a.jsxs(q,{variant:"secondary",size:"sm",onClick:Z,disabled:!oe.trim(),children:[a.jsx(k,{name:"plus",size:14,className:"mr-1"})," Adicionar"]})]}),ne.length>0&&a.jsx("div",{className:"flex flex-col gap-1 mt-1",children:ne.map(F=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-[var(--radius-sm)] border text-sm font-mono",style:{borderColor:"var(--color-border)"},children:[a.jsx(k,{name:"folder",size:14,className:"text-primary shrink-0"}),a.jsx("span",{className:"flex-1",children:F}),a.jsx(q,{onClick:()=>ee(F),className:"w-6 h-6 rounded hover:bg-red-500/10 hover:text-red-500",style:{color:"var(--color-text-secondary)"},"aria-label":`Remover ${F}`,children:a.jsx(k,{name:"x",size:12})})]},F))})]}),!Oe&&a.jsx("p",{className:"text-xs text-red-500",children:"Selecione ou adicione pelo menos 1 diretório"}),a.jsxs("div",{className:"flex gap-2 justify-between",children:[a.jsx(q,{variant:"ghost",onClick:Ge,children:"Voltar"}),a.jsx(q,{disabled:!Oe,onClick:te,className:Le,children:"Próximo"})]})]}),i==="template"&&a.jsxs("div",{className:"flex flex-col gap-6 pt-4 animate-fade-in",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Template e Ferramentas"}),a.jsx("p",{className:"text-sm mt-1",style:{color:"var(--color-text-secondary)"},children:"Escolha o template de fluxo e as ferramentas agênticas."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Template de fluxo"}),a.jsx("div",{className:"rounded-[var(--radius-md)] border border-primary bg-primary/5 ring-2 ring-primary/20 p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] bg-primary/10 flex items-center justify-center shrink-0",children:a.jsx(k,{name:"flow",size:16,className:"text-primary"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-semibold",children:"SDLC — Desenvolvimento de Software"}),a.jsx(ke,{variant:"info",children:"5 estágios"})]}),a.jsx("p",{className:"text-sm mt-0.5",style:{color:"var(--color-text-secondary)"},children:"Fluxo completo: Backlog, Design, Code, Review, Done"}),a.jsx("div",{className:"flex gap-1.5 mt-2 flex-wrap",children:["Backlog","Design","Code","Review","Done"].map(F=>a.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full border border-amber-500/30 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:F},F))})]})]})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Ferramentas agênticas"}),E.length>0&&a.jsxs(ke,{variant:"info",children:[E.length," selecionada",E.length>1?"s":""]})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:yu.map((F,Te)=>a.jsxs("label",{className:_t("flex items-center gap-3 p-4 rounded-[var(--radius-md)] border transition-all duration-200 cursor-pointer hover:scale-[1.02] hover:shadow-sm",E.includes(F.id)?"border-primary bg-primary/5 ring-2 ring-primary/20":"border-border hover:border-primary/50"),style:{animation:`fade-in 0.2s ease-out ${Te*40}ms both`},children:[a.jsx(Sn,{checked:E.includes(F.id),onChange:()=>xe(F.id)}),a.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] bg-primary/10 flex items-center justify-center shrink-0",children:a.jsx(k,{name:"code",size:16,className:"text-primary"})}),a.jsx("span",{className:"font-medium",children:F.label})]},F.id))}),!pe&&a.jsx("p",{className:"text-xs text-red-500 mt-2",children:"Selecione pelo menos 1 ferramenta"})]}),a.jsxs("div",{className:"flex gap-2 justify-between",children:[a.jsx(q,{variant:"ghost",onClick:Ge,children:"Voltar"}),a.jsx(q,{disabled:!pe,onClick:te,className:Le,children:"Revisar"})]})]}),i==="review"&&a.jsxs("div",{className:"flex flex-col gap-6 pt-4 animate-fade-in",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Revisar Configuração"}),a.jsx("p",{className:"text-sm mt-1",style:{color:"var(--color-text-secondary)"},children:"Confira os dados antes de finalizar."})]}),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"p-4 rounded-[var(--radius-md)]",style:{background:"var(--color-bg-surface)"},children:[a.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Workspace"}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{children:[a.jsx("span",{style:{color:"var(--color-text-secondary)"},children:"Nome:"})," ",a.jsx("span",{className:"font-medium",children:h})]}),a.jsxs("div",{children:[a.jsx("span",{style:{color:"var(--color-text-secondary)"},children:"Descrição:"})," ",j]}),a.jsxs("div",{children:[a.jsx("span",{style:{color:"var(--color-text-secondary)"},children:"Caminho:"})," ",a.jsx("span",{className:"font-mono text-xs",children:b})]})]})]}),a.jsxs("div",{className:"p-4 rounded-[var(--radius-md)]",style:{background:"var(--color-bg-surface)"},children:[a.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Diretórios monitorados"}),he.map(F=>a.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",children:[a.jsx(k,{name:"folder",size:14,className:"text-primary shrink-0"}),a.jsx("span",{children:F})]},F))]}),a.jsxs("div",{className:"p-4 rounded-[var(--radius-md)]",style:{background:"var(--color-bg-surface)"},children:[a.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Template e Ferramentas"}),a.jsx("div",{className:"text-sm",children:"SDLC — Desenvolvimento de Software"}),a.jsx("div",{className:"flex gap-2 flex-wrap mt-2",children:E.map(F=>{const Te=yu.find(Me=>Me.id===F);return Te?a.jsx(ke,{variant:"info",children:Te.label},F):null})})]})]}),R&&a.jsxs("div",{className:"p-3 rounded-[var(--radius-sm)] text-sm text-red-500",style:{background:"var(--surface-1)",border:"1px solid var(--color-border)"},children:[a.jsx(k,{name:"alert-triangle",size:14,className:"inline mr-1"}),R]}),a.jsxs("div",{className:"flex gap-2 justify-between",children:[a.jsx(q,{variant:"ghost",onClick:Ge,children:"Voltar"}),a.jsx(q,{disabled:G,onClick:X,className:Le,children:G?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-white border-t-transparent animate-spin"}),"Criando..."]}):"Finalizar"})]})]}),i==="done"&&a.jsxs("div",{className:"flex flex-col gap-6 pt-4 animate-fade-in",children:[a.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[a.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-[var(--radius-lg)] bg-success/20",children:a.jsx(k,{name:"check-circle",size:24,className:"text-success"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Workspace criado!"}),a.jsxs("p",{className:"text-sm mt-1",style:{color:"var(--color-text-secondary)"},children:["O workspace ",a.jsx("strong",{children:h})," foi registrado."]}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:"Agora cole o prompt abaixo na sua ferramenta agêntica para gerar o harness Letra completo."})]}),U?a.jsx(q,{onClick:()=>n(U),className:"mt-2",children:"Abrir workspace"}):null]}),D&&a.jsxs("div",{className:"rounded-[var(--radius-md)] border",style:{borderColor:"var(--color-border)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 border-b",style:{borderColor:"var(--color-border)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(k,{name:"code",size:16,className:"text-primary"}),a.jsxs("h3",{className:"text-sm font-semibold",children:["Prompt para"," ",((De=yu.find(F=>F.id===E[0]))==null?void 0:De.label)||E[0]]})]}),a.jsxs(q,{variant:"secondary",size:"sm",onClick:()=>navigator.clipboard.writeText(D),children:[a.jsx(k,{name:"copy",size:14,className:"mr-1"}),"Copiar"]})]}),a.jsxs("div",{className:"p-4",children:[a.jsx("p",{className:"text-xs mb-3",style:{color:"var(--color-text-secondary)"},children:"Este prompt instrui o agente a analisar profundamente o projeto e configurar o harness Letra."}),a.jsx("pre",{className:"text-xs p-4 rounded-[var(--radius-sm)] whitespace-pre-wrap font-code leading-relaxed",style:{background:"var(--color-bg-surface)",color:"var(--color-text-primary)",border:"1px solid var(--color-border)",maxHeight:"50vh",overflowY:"auto"},children:D})]})]})]})]})})}const _j=9e4;function xp(n,i=Date.now()){if(!n.claimedBy||!n.claimExpiresAt||!n.lastHeartbeatAt)return!1;const c=Date.parse(n.claimExpiresAt),u=Date.parse(n.lastHeartbeatAt);if(!Number.isFinite(c)||!Number.isFinite(u)||c<=i)return!1;const d=i-u;return d>=0&&d<=_j&&(n.activityStatus==="started"||n.activityStatus==="heartbeat")}function ha(n,i){var c;return(c=i==null?void 0:i.stages)!=null&&c.length?[...i.stages].sort((u,d)=>u.order-d.order):n.stages.map(u=>({id:u.id,name:u.name,order:u.order,zone:u.zone,description:void 0,roleIds:[],roles:[],agents:[],gate:null,provenance:"workflow-instance"})).sort((u,d)=>u.order-d.order)}function zr(n,i){return new Set(ha(n,i).filter(c=>{var u;return((u=c.gate)==null?void 0:u.type)==="human"&&c.gate.blocking}).map(c=>c.id))}function vx(n,i){return new Set(ha(n,i).filter((c,u,d)=>c.zone==="done"||!c.zone&&u===d.length-1).map(c=>c.id))}function Lj(n,i,c){const u=ha(i,c),d=u.findIndex(f=>f.id===n);return d<0||d>=u.length-1?null:u[d+1].id}function vp(n,i,c){var d;const u=ha(i,c).find(f=>f.id===n);return u?((d=u.gate)==null?void 0:d.type)==="human"?"Human":u.roles[0]?u.roles[0].label:u.roleIds[0]?u.roleIds[0]:u.name:"Agent"}function Xu(n){var i;return((i=n.gate)==null?void 0:i.type)==="human"?`Aguardando ${n.gate.name.toLowerCase()}`:n.zone==="done"?"Concluído":n.description?n.description:`Processando em ${n.name}`}function Hj(n){var i;return n.zone==="done"?"check":((i=n.gate)==null?void 0:i.type)==="human"?"user":n.gate?"shield":n.roles.length>0||n.roleIds.length>0?"cpu":"circle"}function Zu(n){var d,f,h;const i=((d=n.gate)==null?void 0:d.type)==="human"&&n.gate.blocking,c=!!((f=n.gate)!=null&&f.blocking);return{actorLabel:i?"Human":((h=n.roles[0])==null?void 0:h.label)??n.roleIds[0]??n.name,actionLabel:Xu(n),icon:Hj(n),color:n.zone==="done"?"var(--success)":i?"var(--gate-available)":c?"var(--gate-blocked)":"var(--primary)",isHumanGate:i,isBlockingGate:c}}function Ra(n,i,c){var d;const u=ha(i,c).find(f=>f.id===n.stage);return u?u.zone==="done"?"done":n.activityStatus==="failed"||n.lastFailure?"blocked":((d=u.gate)==null?void 0:d.type)==="human"&&u.gate.blocking?"waiting":xp(n)?"running":"idle":xp(n)?"running":"idle"}function Bj(n,i){return ha(n,i).map(c=>{const u=n.items.filter(h=>h.stage===c.id),d=u.map(h=>Ra(h,n,i)),f=d.includes("waiting")?"waiting":d.includes("blocked")?"blocked":d.includes("running")?"running":d.includes("done")?"done":"idle";return{...c,itemCount:u.length,status:f,presentation:Zu(c)}})}function Uj(n){return(n==null?void 0:n.roles.map(i=>({...i,allowedStages:[...i.allowedStages],capabilities:[...i.capabilities]})))??[]}function qj(n){return(n==null?void 0:n.warnings.map(i=>({...i})))??[]}function Vj(n){try{return new Date(n).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return n}}function Gj(n){return n==="alta"?"error":n==="baixa"?"info":"amber"}function Yj(n){return n==="alta"?"danger":n==="baixa"?"info":"warning"}function $j(n){return n==="ciente"?"em acompanhamento":n==="descartado"?"descartado":n==="resolvido"?"resolvido":"novo"}function Qj(n){return n==="ciente"?"warning":n==="resolvido"?"success":n==="descartado"?"default":"info"}function Xj(n){const i=n.toLowerCase();return i.includes("fail")||i.includes("erro")||i.includes("error")?{icon:"circle-x",variant:"error",tagVariant:"danger",tone:"danger",label:"falha"}:i.includes("validate")||i.includes("build")||i.includes("test")?{icon:"terminal",variant:"amber",tagVariant:"warning",tone:"warning",label:"validacao"}:i.includes("done")||i.includes("complete")||i.includes("pass")?{icon:"circle-check",variant:"success",tagVariant:"success",tone:"success",label:"concluido"}:i.includes("agent")||i.includes("automation")?{icon:"bot",variant:"agent",tagVariant:"agent",tone:"info",label:"agente"}:{icon:"activity",variant:"info",tagVariant:"info",tone:"info",label:"evento"}}function Zj({decisions:n,signals:i,healthSummary:c,activity:u,signalsAvailable:d=!0,activityAvailable:f=!0,primaryItemId:h,primaryWork:p,onReviewDecision:j,onOpenItem:v,onOpenActivity:b,onOpenWork:y,onOpenSignal:z,onScanHealth:S,healthBusy:T=!1}){const B=p??(h?{id:h,title:h}:null),K=n[0]?{label:"Revisar decisao prioritaria",reason:"Um gate humano impede o fluxo de avancar sem sua decisao.",description:`Responder a solicitacao sobre ${n[0].itemId}.`,consequence:"A revisao abre a evidencia do item; nenhuma mudanca ocorre antes da sua decisao.",icon:"shield",tone:"warning",run:()=>j(n[0].itemId)}:i.length>0?{label:"Examinar evidencias",reason:"Ha sinal ativo de saude pedindo investigacao antes de qualquer correcao.",description:"Compreender o impacto e a evidencia do sinal antes de agir.",consequence:"Abre a central de saude; nenhuma correcao e aplicada automaticamente.",icon:"alert-triangle",tone:"info",run:()=>z(i[0])}:B?{label:"Abrir trabalho em foco",reason:"Nao ha decisao ou sinal ativo; acompanhe o item central da sessao.",description:`Continuar a supervisao de ${B.id}.`,consequence:"Abre o item sem alterar seu estagio ou estado canonico.",icon:"box",tone:"default",run:()=>v(B.id)}:{label:"Ver trabalho disponivel",reason:"Nao ha decisao ou sinal ativo; escolha um item para supervisionar.",description:"Escolher com seguranca o proximo trabalho a supervisionar.",consequence:"Abre Trabalho sem iniciar ou mover qualquer item.",icon:"grid",tone:"default",run:y},ve=n.length+i.length>0?a.jsxs("div",{className:"ds-cluster justify-end",children:[n.length>0?a.jsxs(ke,{icon:"shield",variant:"amber",tone:"soft",children:[n.length," decisoes"]}):null,i.length>0?a.jsxs(ke,{icon:"alert-triangle",variant:"amber",tone:"soft",children:[i.length," ",i.length===1?"sinal":"sinais"]}):null]}):a.jsx(ke,{icon:"circle-check",variant:"success",tone:"soft",children:"nada aguardando voce"}),oe=B?[{label:"Item",value:a.jsx(ke,{icon:"box",variant:"info",tone:"soft",children:B.id}),icon:a.jsx(k,{name:"box",size:14})},...B.stage?[{label:"Estagio",value:a.jsx(ot,{variant:"info",children:B.stage}),icon:a.jsx(k,{name:"circle",size:14})}]:[],...B.ageLabel?[{label:"Idade",value:B.ageLabel,icon:a.jsx(k,{name:"clock",size:14})}]:[],...B.actor?[{label:"Responsavel",value:B.actor,icon:a.jsx(k,{name:"user",size:14})}]:[]]:[];return a.jsxs("section",{"aria-labelledby":"supervision-inbox-title",className:"ds-section",children:[a.jsx(xx,{className:"rounded-[var(--radius-md)]",titleId:"supervision-inbox-title",title:"Supervisao",description:"O que precisa da sua atencao agora, sem misturar acompanhamento com operacao.",left:a.jsx(k,{name:"shield",size:20}),right:ve}),a.jsx(Zi,{tone:K.tone,icon:a.jsx(k,{name:K.icon,size:20}),title:"Prioridade agora",description:K.description,action:a.jsx(q,{onClick:K.run,children:K.label}),children:a.jsxs("div",{className:"grid gap-[var(--space-1)]",children:[a.jsxs("div",{className:"ds-cluster",children:[a.jsx(ot,{variant:"info",children:K.label}),a.jsx(ot,{children:"nao altera estado"})]}),a.jsx("p",{className:"text-caption font-medium text-[var(--color-text-primary)]",children:K.reason}),a.jsx("p",{className:"text-caption text-[var(--color-text-secondary)]",children:K.consequence})]})}),a.jsxs("div",{className:"ds-panel-grid",children:[a.jsxs("div",{className:"ds-panel-grid content-start xl:grid-cols-2",children:[a.jsxs(Pe,{children:[a.jsxs(Ka,{className:"flex flex-wrap items-center justify-between",children:[a.jsxs("div",{className:"ds-cluster min-w-0",children:[a.jsx(k,{name:"shield",size:16}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:"Decisoes pendentes"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Gates humanos que precisam da sua decisao antes do fluxo avancar."})]})]}),a.jsx(ke,{icon:n.length>0?"alert-triangle":"circle",variant:n.length>0?"amber":"info",tone:"soft",children:n.length})]}),a.jsx(it,{children:n.length===0?a.jsx(fs,{className:"items-start text-left",icon:a.jsx(k,{name:"circle-check",size:20}),title:"Nenhuma decisao aguarda voce.",description:"Quando um gate humano aparecer, ele entra nesta fila com origem e consequencia."}):a.jsx(Hs,{children:n.map($=>a.jsx(Bs,{leading:a.jsx(k,{name:"shield",size:18}),title:$.title,description:"Aguardando decisao humana antes do fluxo avancar.",meta:a.jsxs(a.Fragment,{children:[a.jsx(ke,{icon:"box",variant:"info",tone:"soft",children:$.itemId}),a.jsx(ot,{variant:"warning",children:"gate humano"})]}),action:a.jsx(q,{size:"sm",onClick:()=>j($.itemId),"aria-label":`Revisar ${$.itemId}`,children:"Revisar"}),tone:"warning",children:a.jsx(Za,{className:"mt-[var(--space-2)]",items:[{label:"Estagio",value:a.jsx(ot,{variant:"info",children:$.stage}),icon:a.jsx(k,{name:"circle",size:14})},{label:"Responsavel",value:$.actor,icon:a.jsx(k,{name:"user",size:14})},{label:"Desde",value:$.since,icon:a.jsx(k,{name:"clock",size:14})}]})},$.itemId))})})]}),a.jsxs(Pe,{children:[a.jsxs(Ka,{className:"flex flex-wrap items-center justify-between",children:[a.jsxs("div",{className:"ds-cluster min-w-0",children:[a.jsx(k,{name:"alert-triangle",size:16}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:"Saude do workspace"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Sinais priorizados por impacto, evidencia e proxima acao segura."})]})]}),a.jsxs("div",{className:"ds-cluster",children:[a.jsx(ke,{icon:i.length>0?"alert-triangle":"circle",variant:i.length>0?"amber":"info",tone:"soft",children:i.length}),S?a.jsxs(q,{variant:"secondary",size:"sm",onClick:S,disabled:T,children:[a.jsx(k,{name:T?"loader-circle":"activity",size:14}),T?"Verificando":"Verificar agora"]}):null]})]}),a.jsxs(it,{children:[c&&i.length>0?a.jsx(Za,{className:"mb-[var(--space-4)]",items:[{label:"Novos",value:c.novo,icon:a.jsx(k,{name:"alert-triangle",size:14})},{label:"Em acompanhamento",value:c.ciente,icon:a.jsx(k,{name:"clock",size:14})},{label:"Resolvidos",value:c.resolvido,icon:a.jsx(k,{name:"circle-check",size:14})},{label:"Descartados",value:c.descartado,icon:a.jsx(k,{name:"circle-x",size:14})}]}):null,d?i.length===0?a.jsx(fs,{className:"items-start text-left",icon:a.jsx(k,{name:"circle-check",size:20}),title:"Nenhum sinal ativo de saude.",description:"Historico resolvido ou descartado fica em Atividade; esta area mostra apenas o que pede investigacao agora."}):a.jsx(Hs,{children:i.map($=>a.jsx(Bs,{leading:a.jsx(k,{name:"alert-triangle",size:18}),title:$.title,description:$.impact??"Pede investigacao antes de qualquer correcao.",meta:a.jsxs(a.Fragment,{children:[a.jsx(ke,{icon:"alert-triangle",variant:Gj($.severity),tone:"soft",children:$.impact??"pede investigacao"}),a.jsx(ot,{variant:Qj($.status),children:$j($.status)})]}),action:a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>z($),children:"Detalhes"}),tone:Yj($.severity),children:a.jsx(Za,{className:"mt-[var(--space-2)]",items:[{label:"Origem",value:$.source,icon:a.jsx(k,{name:"file-text",size:14})},{label:"Urgencia",value:a.jsx(ot,{variant:$.severity==="alta"?"danger":$.severity==="baixa"?"info":"warning",children:$.severity}),icon:a.jsx(k,{name:"alert-triangle",size:14})},{label:"Acao segura",value:$.nextAction??"investigar",icon:a.jsx(k,{name:"activity",size:14})}]})},$.id))}):a.jsx(fs,{className:"items-start text-left",icon:a.jsx(k,{name:"alert-circle",size:20}),title:"Saude indisponivel agora.",description:"A supervisao continua disponivel, mas sem a fotografia de saude do workspace."})]})]})]}),a.jsx("div",{className:"ds-panel-grid content-start",children:a.jsxs(Pe,{children:[a.jsxs(Ka,{className:"flex flex-wrap items-center justify-between",children:[a.jsxs("div",{className:"ds-cluster min-w-0",children:[a.jsx(k,{name:"box",size:16}),a.jsx("h2",{className:"font-semibold",children:"Trabalho em foco"})]}),B?a.jsx(ke,{icon:"box",variant:"info",tone:"soft",children:B.id}):null]}),a.jsx(it,{children:B?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-[var(--space-1)]",children:[a.jsxs("div",{className:"ds-cluster",children:[a.jsx(ot,{variant:"agent",children:"supervisionavel"}),B.actor?a.jsx(ot,{children:B.actor}):null]}),a.jsx("h3",{className:"text-body-sm font-semibold text-[var(--color-text-primary)]",children:B.title}),a.jsx("p",{className:"text-caption text-[var(--color-text-secondary)]",children:n.length>0?"Em foco porque esta relacionado a uma decisao humana.":i.length>0?"Em foco para cruzar sinais ativos com o trabalho atual.":"Em foco por ser o item central da sessao atual."})]}),a.jsx(Za,{items:oe}),a.jsxs("div",{className:"flex flex-wrap items-center gap-[var(--layout-toolbar-gap)]",children:[a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>v(B.id),children:"Abrir item"}),a.jsx(ot,{variant:"info",children:"somente leitura"})]})]}):a.jsx(fs,{className:"items-start text-left",icon:a.jsx(k,{name:"grid",size:20}),title:"Nenhum trabalho em foco.",description:"Abra Trabalho para escolher o proximo item a supervisionar.",action:a.jsx(q,{variant:"secondary",size:"sm",onClick:y,children:"Ver trabalho disponivel"})})})]})})]}),a.jsxs(Pe,{children:[a.jsxs(Ka,{className:"flex flex-wrap items-center justify-between",children:[a.jsxs("div",{className:"ds-cluster min-w-0",children:[a.jsx(k,{name:"activity",size:16}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:"Ultimas evidencias"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Eventos recentes que comprovam o que aconteceu no workspace."})]})]}),a.jsx(q,{variant:"ghost",size:"sm",onClick:b,children:"Ver toda atividade"})]}),a.jsx(it,{children:f?u.length===0?a.jsx(fs,{className:"items-start text-left",icon:a.jsx(k,{name:"activity",size:20}),title:"Nenhuma atividade registrada.",description:"Eventos reais do workspace aparecem aqui como evidencia."}):a.jsx(Hs,{tone:"surface",children:u.map($=>{const ne=Xj($.action);return a.jsx(Bs,{leading:a.jsx(k,{name:ne.icon,size:18}),title:$.description,description:Vj($.timestamp),meta:a.jsxs(a.Fragment,{children:[a.jsx(ke,{icon:ne.icon,variant:ne.variant,tone:"soft",children:ne.label}),a.jsx(ot,{variant:ne.tagVariant,children:$.action}),$.itemId?a.jsx(ot,{children:$.itemId}):null]}),action:$.itemId?a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>v($.itemId),children:"Abrir item"}):null,tone:ne.tone},$.id)})}):a.jsx(fs,{className:"items-start text-left",icon:a.jsx(k,{name:"alert-circle",size:20}),title:"Atividade indisponivel no momento.",description:"A timeline completa permanece em Atividade quando o log voltar."})})]})]})}function Kj(){return a.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-[var(--layout-page-gap)] p-[var(--layout-page-padding)]",children:[a.jsx(ja,{}),a.jsxs("div",{className:"ds-panel-grid xl:grid-cols-[minmax(0,1.15fr)_minmax(20rem,0.85fr)]",children:[a.jsx(ja,{}),a.jsx(ja,{})]}),a.jsx(ja,{})]})}function Jj(n){return Math.floor((Date.now()-new Date(n).getTime())/(1e3*60*60*24))}function gx(n){const i=Jj(n);return i===0?"Hoje":i===1?"1 dia":`${i} dias`}function Wj(n){const i=Date.now()-new Date(n).getTime(),c=Math.floor(i/(1e3*60*60));return c<1?`há ${Math.max(1,Math.floor(i/6e4))}min`:c<24?`há ${c}h`:`há ${Math.floor(c/24)}d`}function Ij(n){if(!n)return"media";const i=n.toLowerCase();return i.includes("crit")||i.includes("alta")||i.includes("high")?"alta":i.includes("low")||i.includes("baixa")?"baixa":"media"}function Fj(n){return n==="alta"?"bloqueia conclusao":n==="media"?"pede investigacao":"pode aguardar"}function Pj(n){return n==="ciente"?"acompanhar":n==="resolvido"?"ver evidencia":n==="descartado"?"ver justificativa":"investigar"}function gp(n){if(!n)return"nao registrado";try{return new Date(n).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return n}}function e0(n){var c,u,d,f;const i=n.entries??[];return{novo:((c=n.summary)==null?void 0:c.novo)??i.filter(h=>h.status==="novo").length,ciente:((u=n.summary)==null?void 0:u.ciente)??i.filter(h=>h.status==="ciente").length,resolvido:((d=n.summary)==null?void 0:d.resolvido)??i.filter(h=>h.status==="resolvido").length,descartado:((f=n.summary)==null?void 0:f.descartado)??i.filter(h=>h.status==="descartado").length}}function t0(n,i){const c=[n.id,n.type,n.source,n.where,n.title,n.what].filter(Boolean).map(u=>String(u).toLowerCase());return i.find(u=>{const d=u.diagnosticId.toLowerCase(),f=u.diagnosticTitle.toLowerCase();return c.some(h=>h?d===h||d.includes(h)||f.includes(h):!1)})}function bp(n){return(n.snapshots??[]).filter(i=>Array.isArray(i.files))}function a0(n,i,c=16){const u=n.split(/\r?\n/),d=i.split(/\r?\n/);let f=0;for(;f<u.length&&f<d.length&&u[f]===d[f];)f+=1;let h=u.length-1,p=d.length-1;for(;h>=f&&p>=f&&u[h]===d[p];)h-=1,p-=1;const j=u.slice(f,h+1).slice(0,Math.floor(c/2)),v=d.slice(f,p+1).slice(0,c-j.length),b=[...j.map(y=>`- ${y||"(linha vazia)"}`),...v.map(y=>`+ ${y||"(linha vazia)"}`)];return b.length>0?b:["Sem diferenca textual entre before/after."]}function s0(n,i=[]){return(n.active??[]).slice(0,4).map((c,u)=>{const d=Ij(c.severity);return{id:c.id??`health-${u}`,title:c.title??c.what??"Alerta ativo",source:c.source??c.where??"health",severity:d,status:c.status??"novo",detectedAt:c.detectedAt,impact:Fj(d),nextAction:Pj(c.status),technicalType:c.type,relatedSnapshot:t0(c,i)}})}function l0({spec:n,primaryItem:i,primaryStageName:c}){return a.jsx(Zi,{density:"compact",tone:"info",icon:a.jsx(k,{name:"file-text",size:20}),title:"Governança do workspace",description:"Contexto canônico usado para interpretar decisões, evidências e trabalho em foco nesta sessão.",meta:a.jsxs(a.Fragment,{children:[a.jsx(ke,{icon:"file-text",variant:"info",tone:"soft",children:n}),a.jsx(ot,{variant:"info",children:"contrato ativo"})]}),children:a.jsx(Za,{items:[{label:"Spec",value:n,icon:a.jsx(k,{name:"file-text",size:14})},...i?[{label:"Item vinculado",value:a.jsx(ke,{icon:"box",variant:"info",tone:"soft",children:i.id}),icon:a.jsx(k,{name:"box",size:14})}]:[],...c?[{label:"Estágio",value:a.jsx(ot,{variant:"info",children:c}),icon:a.jsx(k,{name:"circle",size:14})}]:[]]})})}function n0({item:n,stageName:i,open:c,onOpenChange:u}){if(!n)return null;const d=[{label:"Estágio",value:a.jsx(ot,{variant:"info",children:i??n.stage}),icon:a.jsx(k,{name:"circle",size:14})},{label:"Idade",value:gx(n.createdAt),icon:a.jsx(k,{name:"clock",size:14})},...n.spec?[{label:"Spec",value:n.spec,icon:a.jsx(k,{name:"file-text",size:14})}]:[],...n.claimedBy?[{label:"Responsável",value:n.claimedBy,icon:a.jsx(k,{name:"user",size:14})}]:[]];return a.jsx(jr,{open:c,onOpenChange:u,children:a.jsxs(Nr,{children:[a.jsx(Ii,{children:a.jsx(Fi,{children:n.id})}),a.jsx("div",{className:"grid gap-[var(--layout-panel-gap)] p-[var(--card-padding)]",children:a.jsx(Pe,{children:a.jsx(it,{children:a.jsxs("div",{className:"ds-stack",children:[a.jsxs("div",{className:"grid gap-[var(--space-1)]",children:[a.jsxs("div",{className:"ds-cluster",children:[a.jsx(ke,{icon:"box",variant:"info",tone:"soft",children:n.id}),n.claimedBy?a.jsx(ot,{children:n.claimedBy}):null]}),a.jsx("p",{className:"text-body-sm font-medium text-[var(--color-text-primary)]",children:n.description||"Sem descrição"})]}),a.jsx(Za,{items:d}),n.tasks&&n.tasks.length>0?a.jsxs("div",{className:"ds-stack",children:[a.jsxs("div",{className:"ds-cluster",children:[a.jsx(k,{name:"list-three",size:16}),a.jsx("h3",{className:"font-semibold",children:"Tasks"}),a.jsx(ke,{variant:"info",tone:"soft",children:n.tasks.length})]}),a.jsx(Hs,{children:n.tasks.map(f=>a.jsx(Bs,{leading:a.jsx(k,{name:f.done?"circle-check":"circle",size:18}),title:f.description,meta:a.jsx(ot,{variant:f.done?"success":"info",children:f.done?"feito":"pendente"})},f.id))})]}):null]})})})}),a.jsx($u,{children:a.jsx(q,{variant:"secondary",onClick:()=>u(!1),children:"Fechar"})})]})})}function r0({signal:n,open:i,onOpenChange:c,onAcknowledge:u,onDismiss:d,onScan:f,actionBusy:h,actionMessage:p}){var b;if(!n)return null;const j=(b=n.relatedSnapshot)==null?void 0:b.files[0],v=j?a0(j.before,j.after):[];return a.jsx(jr,{open:i,onOpenChange:c,children:a.jsxs(Nr,{side:"right",className:"w-full max-w-[100vw] sm:max-w-3xl lg:max-w-4xl","aria-labelledby":"signal-sheet-title","aria-describedby":"signal-sheet-description",children:[a.jsxs(Ii,{className:"items-start gap-4",children:[a.jsxs("div",{className:"grid min-w-0 gap-[var(--space-2)]",children:[a.jsxs("div",{className:"ds-cluster",children:[a.jsx(ke,{icon:"alert-triangle",variant:n.severity==="alta"?"error":n.severity==="baixa"?"info":"amber",tone:"soft",children:n.impact??"pede investigacao"}),a.jsx(ot,{variant:n.status==="ciente"?"warning":n.status==="resolvido"?"success":n.status==="descartado"?"default":"info",children:n.status==="ciente"?"em acompanhamento":n.status??"novo"})]}),a.jsx(Fi,{id:"signal-sheet-title",className:"break-words leading-tight",children:n.title}),a.jsx(Yu,{id:"signal-sheet-description",children:"Evidencia do workspace para entender o impacto antes de agir."})]}),a.jsx(mx,{"aria-label":"Fechar detalhes do sinal",onClick:()=>c(!1),children:a.jsx(k,{name:"x",size:16})})]}),a.jsxs("div",{className:"grid gap-[var(--layout-panel-gap)] overflow-y-auto p-[var(--card-padding)]",children:[a.jsxs(Pe,{children:[a.jsx(Ka,{children:a.jsxs("div",{className:"ds-cluster",children:[a.jsx(k,{name:"shield",size:16}),a.jsx("h3",{className:"font-semibold",children:"Leitura de supervisao"})]})}),a.jsx(it,{children:a.jsx(Za,{items:[{label:"Impacto",value:n.impact??"pede investigacao",icon:a.jsx(k,{name:"alert-triangle",size:14})},{label:"Acao segura",value:n.nextAction??"investigar",icon:a.jsx(k,{name:"activity",size:14})},{label:"Detectado em",value:gp(n.detectedAt),icon:a.jsx(k,{name:"clock",size:14})}]})})]}),a.jsxs(Pe,{children:[a.jsx(Ka,{children:a.jsxs("div",{className:"ds-cluster",children:[a.jsx(k,{name:"file-text",size:16}),a.jsx("h3",{className:"font-semibold",children:"Evidencia"})]})}),a.jsx(it,{children:a.jsx(Hs,{tone:"surface",children:a.jsx(Bs,{leading:a.jsx(k,{name:"alert-circle",size:18}),title:n.title,description:"Sinal ativo registrado no prontuario de saude do workspace.",meta:a.jsxs(a.Fragment,{children:[a.jsx(ot,{variant:"info",children:n.source}),a.jsx(ot,{children:n.id})]}),tone:n.severity==="alta"?"danger":n.severity==="baixa"?"info":"warning"})})})]}),a.jsxs(Pe,{children:[a.jsx(Ka,{children:a.jsxs("div",{className:"ds-cluster",children:[a.jsx(k,{name:"git-branch",size:16}),a.jsx("h3",{className:"font-semibold",children:"Comparacao de drift"})]})}),a.jsx(it,{children:n.relatedSnapshot?a.jsxs("div",{className:"grid gap-[var(--space-4)]",children:[a.jsx(Za,{items:[{label:"Snapshot",value:n.relatedSnapshot.id,icon:a.jsx(k,{name:"info",size:14})},{label:"Registrado em",value:gp(n.relatedSnapshot.timestamp),icon:a.jsx(k,{name:"clock",size:14})},{label:"Arquivos",value:n.relatedSnapshot.files.length,icon:a.jsx(k,{name:"file-text",size:14})}]}),a.jsx(Hs,{tone:"surface",children:n.relatedSnapshot.files.map(y=>a.jsx(Bs,{leading:a.jsx(k,{name:"file-text",size:18}),title:y.path,description:"Arquivo capturado no snapshot do diagnostico.",meta:a.jsx(ot,{variant:"info",children:"before/after"})},y.path))}),j?a.jsx("pre",{className:"max-h-72 max-w-full overflow-auto rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg-sunken)] p-[var(--space-3)] text-xs leading-relaxed text-[var(--color-text-primary)]",children:v.join(`
|
|
200
|
+
`)}):null]}):a.jsx(Hs,{tone:"surface",children:a.jsx(Bs,{leading:a.jsx(k,{name:"info",size:18}),title:"Nenhum snapshot relacionado encontrado.",description:"Este sinal nao possui comparacao before/after disponivel; a evidencia atual vem do health-record.",meta:a.jsx(ot,{children:"fallback honesto"}),tone:"info"})})})]}),a.jsx(Sr,{children:a.jsxs(Pe,{children:[a.jsxs(Ka,{className:"flex flex-wrap items-center justify-between",children:[a.jsxs("div",{className:"ds-cluster",children:[a.jsx(k,{name:"code",size:16}),a.jsx("h3",{className:"font-semibold",children:"Origem tecnica"})]}),a.jsx(wr,{className:"rounded-[var(--radius-md)] px-[var(--space-3)] py-[var(--space-2)] text-body-sm font-medium text-[var(--color-text-secondary)] hover:bg-[var(--surface-hover)]",children:"Mostrar dados"})]}),a.jsx(Cr,{children:a.jsx(it,{children:a.jsx(Za,{items:[{label:"ID",value:n.id,icon:a.jsx(k,{name:"info",size:14})},{label:"Origem",value:n.source,icon:a.jsx(k,{name:"file-text",size:14})},{label:"Tipo",value:n.technicalType??"nao informado",icon:a.jsx(k,{name:"code",size:14})},{label:"Urgencia",value:n.severity,icon:a.jsx(k,{name:"alert-triangle",size:14})}]})})})]})})]}),a.jsxs($u,{className:"grid gap-[var(--space-2)] sm:flex sm:flex-wrap sm:justify-between",children:[p?a.jsx("p",{className:"min-w-0 break-words text-caption text-[var(--color-text-secondary)] sm:mr-auto",children:p}):null,a.jsxs(q,{className:"w-full sm:w-auto",variant:"secondary",onClick:f,disabled:h,children:[a.jsx(k,{name:h?"loader-circle":"activity",size:14}),"Verificar agora"]}),a.jsxs(q,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>u(n),disabled:h||n.status==="ciente",children:[a.jsx(k,{name:"clock",size:14}),"Acompanhar"]}),a.jsxs(q,{className:"w-full sm:w-auto",variant:"secondary",onClick:()=>d(n),disabled:h,children:[a.jsx(k,{name:"circle-x",size:14}),"Descartar"]})]})]})})}function yp({workflow:n,activeFlow:i,onTabChange:c}){var X,te,Ge;const[u,d]=x.useState(null),[f,h]=x.useState([]),[p,j]=x.useState(null),[v,b]=x.useState(!0),[y,z]=x.useState([]),[S,T]=x.useState([]),[B,K]=x.useState(!0),[le,ve]=x.useState(!0),[oe,$]=x.useState(!1),[ne,me]=x.useState(null),[ue,_]=x.useState(null),[he,Oe]=x.useState(!1),[be,Z]=x.useState(""),ee=x.useCallback((Se,Le=[])=>{const De=s0(Se,Le);return j(e0(Se)),h(De),b(!0),_(F=>F&&(De.find(Te=>Te.id===F.id)??null)),De},[]),de=x.useCallback(async()=>{const[Se,Le]=await Promise.all([fetch("/api/health"),fetch("/api/diagnostics/snapshots?limit=20")]);if(!Se.ok)throw new Error("health unavailable");const De=await Se.json(),F=Le.ok?bp(await Le.json()):y;return z(F),ee(De,F)},[ee]);x.useEffect(()=>{let Se=!1;async function Le(){ve(!0),$(!1);const[De,F,Te,Me]=await Promise.allSettled([fetch("/api/focus").then(ht=>ht.json()),fetch("/api/health").then(ht=>ht.json()),fetch("/api/diagnostics/snapshots?limit=20").then(ht=>ht.json()),fetch("/api/log?limit=4").then(ht=>ht.json())]);if(Se)return;De.status==="fulfilled"&&d(De.value);const gt=Te.status==="fulfilled"?bp(Te.value):[];if(z(gt),F.status==="fulfilled"){const ht=F.value;ee(ht,gt)}else h([]),j(null),b(!1);if(Me.status==="fulfilled"){const ht=Me.value;T((ht.entries??[]).slice(0,4).map(Kt=>({id:Kt.id,action:Kt.action,description:Kt.description,timestamp:Kt.timestamp,itemId:Kt.itemId??null}))),K(!0)}else T([]),K(!1);De.status==="rejected"&&F.status==="rejected"&&Me.status==="rejected"&&$(!0),ve(!1)}return Le(),()=>{Se=!0}},[ee]);const ge=x.useMemo(()=>ha(n,i),[i,n]),E=x.useMemo(()=>{const Se=zr(n,i);return n.items.filter(Le=>Se.has(Le.stage)).map(Le=>{var De;return{itemId:Le.id,title:Le.description||Le.id,stage:((De=ge.find(F=>F.id===Le.stage))==null?void 0:De.name)??Le.stage,actor:vp(Le.stage,n,i),since:Wj(Le.createdAt)}})},[i,ge,n]),W=ne?n.items.find(Se=>Se.id===ne)??null:null,pe=W?((X=ge.find(Se=>Se.id===W.stage))==null?void 0:X.name)??null:null,xe=(u==null?void 0:u.itemId)??n.primaryItemId??((te=n.items[0])==null?void 0:te.id),G=xe?n.items.find(Se=>Se.id===xe):void 0,N=G?((Ge=ge.find(Se=>Se.id===G.stage))==null?void 0:Ge.name)??G.stage:void 0,R=G?{id:G.id,title:G.description||G.id,description:"Resumo operacional do item que está no centro da supervisão agora.",stage:N,spec:G.spec??(u==null?void 0:u.spec),ageLabel:gx(G.createdAt),actor:G.claimedBy??vp(G.stage,n,i)}:void 0;function I(Se){me(Se),window.dispatchEvent(new CustomEvent("letra-open-item",{detail:Se}))}async function D(Se,Le){Oe(!0),Z("Atualizando saude do workspace...");try{if(!(await fetch(Se,{method:"POST",headers:Le?{"Content-Type":"application/json"}:void 0,body:Le?JSON.stringify(Le):void 0})).ok)throw new Error("health action failed");const F=await de();return Z("Saude do workspace atualizada."),F}catch{return Z("Nao foi possivel atualizar a saude agora."),null}finally{Oe(!1)}}async function ie(){await D("/api/health/scan")}async function U(Se){const Le=await D("/api/health/ack",{id:Se.id});Le&&_(Le.find(De=>De.id===Se.id)??null)}async function M(Se){await D("/api/health/dismiss",{id:Se.id})&&_(null)}return le?a.jsx(Kj,{}):a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-[var(--layout-page-gap)] p-[var(--layout-page-padding)]",children:[oe?a.jsx(sj,{onRetry:()=>window.location.reload(),children:"Não foi possível carregar a supervisão agora."}):null,a.jsx(Zj,{decisions:E,signals:f,healthSummary:p??void 0,activity:S,signalsAvailable:v,activityAvailable:B,primaryItemId:xe,primaryWork:R,onReviewDecision:I,onOpenItem:I,onOpenActivity:()=>c==null?void 0:c("activity"),onOpenWork:()=>c==null?void 0:c("work"),onOpenSignal:_,onScanHealth:ie,healthBusy:he}),u!=null&&u.active&&u.spec?a.jsx(l0,{spec:u.spec,primaryItem:G,primaryStageName:N}):null]})}),a.jsx(n0,{item:W,stageName:pe,open:!!W,onOpenChange:Se=>{Se||me(null)}}),a.jsx(r0,{signal:ue,open:!!ue,onOpenChange:Se=>{Se||_(null)},onAcknowledge:U,onDismiss:M,onScan:ie,actionBusy:he,actionMessage:be})]})}function Pi(n,i,c){var j;if(n.spec&&((j=c.specLinks)==null?void 0:j[n.spec]))return n.spec.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");const d=n.description.trim().split(/\s+/).filter(Boolean).slice(0,3).join("-").toLowerCase().replace(/[^a-z0-9-]/g,"")||n.id.toLowerCase(),f=new Set(c.items.filter(v=>v.id!==n.id).map(v=>i0(v,i,c)));let h=d,p=2;for(;f.has(h);)h=`${d}-${p}`,p++;return h}function i0(n,i,c){var d;return n.spec&&((d=c.specLinks)==null?void 0:d[n.spec])?n.spec.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""):n.description.trim().split(/\s+/).filter(Boolean).slice(0,3).join("-").toLowerCase().replace(/[^a-z0-9-]/g,"")||n.id.toLowerCase()}function bx(n){const i=n.split(`
|
|
201
|
+
`);let c=0,u=0;for(const d of i){const f=d.trim();/^- \[ \]/.test(f)&&u++,/^- \[x\]/i.test(f)&&(c++,u++)}return{done:c,total:u}}const o0={builder:"implementer",implementer:"implementer"};function c0(n,i,c,u){const d=[c==null?void 0:c.agentId,i,u,c==null?void 0:c.toolId].filter(Boolean),f=[...d,...d.map(h=>o0[h]??h)];return n.find(h=>f.includes(h.id))??n.find(h=>f.includes(h.role))}function u0(n,i,c,u,d){var y,z,S;const f=n.spec?u.find(T=>T.id===n.spec):void 0,h=f?bx(f.content):{done:0,total:0},p=ha(i,c).find(T=>T.id===n.stage),j=((y=p==null?void 0:p.roles[0])==null?void 0:y.id)??(p==null?void 0:p.roleIds[0]),v=c0(d,n.claimedBy,{agentId:j},n.claimExecutorId)??null,b=Ra(n,i,c);return{itemId:n.id,title:((z=n.description)==null?void 0:z.trim())||(f==null?void 0:f.id)||Pi(n,u,i),stage:n.stage,stageLabel:(p==null?void 0:p.name)??n.stage,state:b,stateLabel:b==="waiting"?"Aguardando decisão":b==="running"?"Em execução":b==="done"?"Concluído":b==="blocked"?"Bloqueado":"Aguardando executor",progress:h,identity:v,persona:(v==null?void 0:v.role)??((S=p==null?void 0:p.roles[0])==null?void 0:S.label)??"Sem persona",actionLabel:"Acompanhar trabalho ativo"}}const d0={approve:"Decisão aprovada e registrada.","request-changes":"Alterações solicitadas e registradas.",reject:"Rejeição registrada."};function f0({itemId:n,onDecided:i}){const{toast:c}=yr(),[u,d]=x.useState(null),[f,h]=x.useState(null);async function p(j,v){h(j);try{const b=await fetch(`/api/items/${n}/gate-decisions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:j,reason:v})}),y=await b.json().catch(()=>({}));if(!b.ok)throw new Error(y.error||"Não foi possível registrar a decisão.");c(d0[j],"success"),i==null||i()}catch(b){c(b instanceof Error?b.message:"Não foi possível registrar a decisão.","error")}finally{h(null)}}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(q,{variant:"primary",size:"sm",disabled:f!==null,onClick:()=>void p("approve"),children:[a.jsx(k,{name:"check",size:14}),f==="approve"?"Registrando...":"Aprovar"]}),a.jsxs(q,{variant:"ghost",size:"sm",disabled:f!==null,onClick:()=>d("request-changes"),children:[a.jsx(k,{name:"edit",size:14}),"Solicitar alterações"]}),a.jsxs(q,{variant:"ghost",size:"sm",disabled:f!==null,onClick:()=>d("reject"),children:[a.jsx(k,{name:"x",size:14}),"Rejeitar"]})]}),a.jsx(cx,{open:u!==null,onClose:()=>d(null),onSubmit:j=>{u&&p(u,j)},title:u==="reject"?"Rejeitar item":"Solicitar alterações",label:"Motivo obrigatório",placeholder:"Explique o direcionamento para manter a decisão auditável",submitLabel:u==="reject"?"Rejeitar":"Solicitar alterações"})]})}function m0(n){return n==="done"?{key:n,label:"Concluído",variant:"success",tagVariant:"success",action:"Sem ação pendente",icon:"check-circle",animate:""}:n==="waiting"?{key:n,label:"Precisa de atenção",variant:"amber",tagVariant:"warning",action:"Revisar decisão humana",icon:"clock",animate:"animate-timeline-dot"}:n==="blocked"?{key:n,label:"Bloqueado",variant:"error",tagVariant:"danger",action:"Examinar bloqueio",icon:"shield",animate:""}:n==="running"?{key:n,label:"Em andamento",variant:"agent",tagVariant:"agent",action:"Acompanhar trabalho ativo",icon:"chevron-right",animate:"animate-agent-running"}:{key:n,label:"Aguardando executor",variant:"info",tagVariant:"default",action:"Aguardando responsável",icon:"circle",animate:""}}function h0(n){return n==="attention"?{title:"Nenhum trabalho precisa de atenção agora.",description:"Gates humanos e bloqueios aparecerão aqui quando exigirem revisão."}:n==="running"?{title:"Nenhum trabalho está em andamento.",description:"Quando um item estiver associado a um ator, ele aparecerá neste recorte."}:n==="queued"?{title:"Nenhum trabalho está na fila.",description:"Itens sem responsável declarado aparecerão aqui antes de entrarem em andamento."}:n==="done"?{title:"Nenhum trabalho concluído ainda.",description:"Itens em estágios finais aparecerão neste recorte."}:{title:"Nenhum trabalho neste fluxo.",description:"Crie um item quando houver algo para supervisionar."}}function p0({item:n,workflow:i,activeFlow:c,specs:u,agents:d,onClick:f,onItemDecided:h,onOpenSpec:p,onDragStart:j,onDragEnd:v}){var be,Z;const b=Pi(n,u,i),y=u0(n,i,c,u,d),z=zr(i,c).has(n.stage),S=m0(Ra(n,i,c)),T=n.spec?u.find(ee=>ee.id===n.spec):null,B=T?(()=>{const ee=(T.content.match(/-\s+\[x\]/g)||[]).length,de=(T.content.match(/-\s+\[(\s|x)\]/g)||[]).length;return{done:ee,total:de,label:de>0?`${ee}/${de} critérios`:"Sem critérios",source:"Critérios"}})():n.tasks&&n.tasks.length>0?{done:n.tasks.filter(ee=>ee.done).length,total:n.tasks.length,label:`${n.tasks.filter(ee=>ee.done).length}/${n.tasks.length} tarefas`,source:"Tarefas"}:{done:0,total:0,label:"Sem checklist",source:"Evidência"},K=y.identity,le=((be=y.identity)==null?void 0:be.displayName)??"Não atribuído",ve=y.persona,oe=S.key==="running",$=B.total>0,ne=B.total>0?B.done:0,me=B.total>0?B.total:1,ue=S.key==="blocked"?"error":S.key==="waiting"?"warning":S.key==="done"?"complete":S.key==="running"?"agent":"default",_=((Z=n.description)==null?void 0:Z.trim())||(T==null?void 0:T.id)||b,he=S.key==="blocked"?"var(--color-danger)":S.key==="waiting"?"var(--color-primary)":oe?"var(--color-agent)":z?"var(--color-success)":"var(--color-border)",Oe=S.key==="blocked"?"color-mix(in oklch, var(--color-danger) 5%, var(--color-bg-surface))":S.key==="waiting"?"color-mix(in oklch, var(--color-primary) 6%, var(--color-bg-surface))":oe?"color-mix(in oklch, var(--color-agent) 5%, var(--color-bg-surface))":"var(--color-bg-surface)";return a.jsx(Pe,{variant:oe?"agent":"default",className:_t("app-board-card cursor-grab select-none active:cursor-grabbing hover:-translate-y-0.5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",z&&"animate-human-pulse",n.claimedBy&&"ring-1"),style:{borderColor:he,background:Oe},"data-claimed":n.claimedBy?"true":"false","data-gate":z?"true":"false","data-running":oe?"true":"false",draggable:!0,role:"group",tabIndex:0,"aria-label":`Abrir ${n.id}: ${_}`,onClick:f,onKeyDown:ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),f())},onDragStart:j,onDragEnd:v,children:a.jsxs(it,{className:"min-w-0 gap-3 p-3.5",children:[a.jsxs("div",{className:"grid min-w-0 gap-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-2",children:[a.jsx("span",{className:"min-w-0 truncate font-mono text-[11px] font-medium text-[var(--color-text-tertiary)]",children:n.id}),a.jsx(ke,{variant:S.variant,tone:"soft",className:_t("max-w-full shrink-0",S.animate),icon:S.icon,children:S.label})]}),a.jsx("h3",{className:"line-clamp-3 text-body-sm font-semibold leading-snug text-[var(--color-text-primary)]",children:_})]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-caption text-[var(--color-text-secondary)]",children:[a.jsxs(ot,{variant:n.claimedBy?"agent":"default",children:[K?a.jsx(fx,{agent:K,size:"sm"}):a.jsx(k,{name:n.claimedBy?"bot":"circle",size:10}),le]}),a.jsx(ot,{children:ve}),!n.claimedBy&&(K==null?void 0:K.status)==="offline"?a.jsx(ot,{variant:"warning",children:"Executor offline"}):null]}),$?a.jsxs("div",{className:"grid gap-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-caption font-medium text-[var(--color-text-secondary)]",children:B.source}),a.jsx("span",{className:"text-caption tabular-nums text-[var(--color-text-secondary)]",children:B.label})]}),a.jsx(Vu,{value:ne,max:me,size:"xs",state:ue})]}):null,z?a.jsxs("div",{className:"grid gap-2 rounded-[var(--radius-md)] border border-[color-mix(in_oklch,var(--color-success)_35%,var(--color-border))] bg-[color-mix(in_oklch,var(--color-success)_6%,var(--color-bg-surface))] p-2",onClick:ee=>ee.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 text-caption font-medium text-[var(--color-success)]",children:[a.jsx(k,{name:"clock",size:12}),a.jsx("span",{children:"Aprovação necessária"})]}),a.jsx(f0,{itemId:n.id,onDecided:h})]}):null,a.jsx("div",{className:"flex items-center justify-end pt-1",children:a.jsxs(q,{type:"button",size:"sm",variant:"secondary",onClick:ee=>{ee.stopPropagation(),f()},"aria-label":`Acompanhar trabalho ativo de ${n.id}`,children:[a.jsx(k,{name:"activity",size:12})," Acompanhar trabalho ativo"]})})]})})}function x0({workflow:n,activeFlow:i,onSelectItem:c,onDropItem:u,onApproveGate:d,onItemDecided:f,allowDrop:h,specRefreshKey:p,onAddItem:j,onOpenSpec:v,filter:b="all",className:y}){const[z,S]=x.useState(null),[T,B]=x.useState(null),[K,le]=x.useState(""),[ve,oe]=x.useState(null),[$,ne]=x.useState([]),[me,ue]=x.useState([]),_=x.useRef(null),he=x.useCallback(async()=>{try{const D=await fetch("/api/specs");if(!D.ok)return;const ie=await D.json();ne(ie)}catch{}},[]);x.useEffect(()=>{he(),fetch("/api/agents").then(D=>D.json()).then(D=>Array.isArray(D)&&ue(D)).catch(()=>{})},[he]),x.useEffect(()=>{p&&he()},[p,he]);const Oe=x.useCallback((D,ie)=>{const U=n.items.find(M=>M.id===ie);U&&(_.current=U,B(ie),D.dataTransfer.setData("text/plain",ie),D.dataTransfer.dropEffect="move")},[n.items]),be=x.useCallback(()=>{S(null),B(null),_.current=null},[]),Z=x.useCallback(D=>{D.preventDefault(),D.dataTransfer.dropEffect="move"},[]),ee=x.useCallback(D=>{S(D)},[]),de=x.useCallback(()=>{S(null)},[]),ge=x.useCallback((D,ie)=>{D.preventDefault(),S(null);const U=D.dataTransfer.getData("text/plain"),M=n.items.find(X=>X.id===U);M&&M.stage!==ie&&(h&&!h(M,ie)||u(U,ie))},[n.items,h,u]),E=zr(n,i),W=vx(n,i),pe=ha(n,i).map(D=>({id:D.id,label:D.name,color:Zu(D).color,gate:E.has(D.id)})),xe={all:()=>!0,attention:D=>{const ie=Ra(D,n,i);return ie==="waiting"||ie==="blocked"},running:D=>Ra(D,n,i)==="running",queued:D=>Ra(D,n,i)==="idle",done:D=>W.has(D.stage)},G=xe[b]||xe.all,N=n.items.filter(D=>{if(!G(D))return!1;if(!K.trim())return!0;const ie=K.toLowerCase();return D.id.toLowerCase().includes(ie)||D.description.toLowerCase().includes(ie)}),R=h0(b);function I(D){const ie=n.items.filter(te=>te.stage===D.id).filter(G),U=z===D.id,M=D.gate,X=n.items.some(te=>te.stage===D.id);return a.jsxs("div",{className:"flex min-h-[200px] w-[18rem] min-w-[18rem] flex-none flex-col gap-2 xl:w-[19.5rem] xl:min-w-[19.5rem]",children:[a.jsxs("div",{className:"app-board-column-header flex items-center justify-between px-1 pb-1","data-gate":M&&X?"true":"false",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[M&&X?a.jsx("div",{className:"w-2 h-4 rounded-full bg-[var(--color-success)] animate-timeline-dot"}):a.jsx("div",{className:"w-1.5 h-4 rounded-full",style:{background:D.color}}),a.jsx("span",{className:_t("min-w-0 truncate text-xs font-semibold",M&&X&&"text-[var(--color-success)]"),children:D.label}),a.jsx(ke,{variant:M&&X?"amber":"info",className:_t("shrink-0 text-caption px-1.5",M&&X&&"animate-pulse"),children:n.items.filter(te=>te.stage===D.id).length})]}),a.jsx(dx,{content:D.id,position:"bottom",children:a.jsx("button",{className:"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] text-xs ml-auto",onClick:()=>oe(D.id),title:"Informações do estágio",children:a.jsx(k,{name:"info",size:12})})})]}),a.jsxs("div",{className:"app-board-dropzone flex flex-col gap-2 p-2","data-over":U?"true":"false","data-gate":M&&X?"true":"false",onDragOver:Z,onDragEnter:()=>ee(D.id),onDragLeave:de,onDrop:te=>ge(te,D.id),children:[ie.length===0&&!U&&a.jsx("div",{className:"flex items-center justify-center h-full py-4",children:a.jsx("span",{className:"app-board-empty text-[11px]",children:"Vazio"})}),ie.map(te=>a.jsx(p0,{item:te,workflow:n,activeFlow:i,specs:$,agents:me,onClick:()=>c(te.id),onItemDecided:f,onOpenSpec:te.spec&&v?v:void 0,onDragStart:Ge=>Oe(Ge,te.id),onDragEnd:be},te.id))]})]},D.id)}return a.jsxs("div",{className:_t("flex min-h-0 min-w-0 flex-1 flex-col gap-4 p-4",y),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ct,{placeholder:"Buscar item por ID ou descrição...",value:K,onChange:D=>le(D.target.value),className:"max-w-xs"}),K&&a.jsx("button",{className:"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] text-xs",onClick:()=>le(""),children:"Limpar"}),K&&a.jsxs("span",{className:"text-caption text-[var(--color-text-secondary)]",children:[N.length," resultado(s)"]})]}),a.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-1.5 overflow-x-auto pb-1 [scrollbar-width:thin]",children:a.jsx(Ji,{ariaLabel:"Filtrar trabalho",className:"w-max max-w-none flex-nowrap sm:w-auto sm:max-w-full sm:flex-wrap",children:[{key:"all",label:"Todos"},{key:"attention",label:"Atenção"},{key:"running",label:"Rodando"},{key:"queued",label:"Fila"},{key:"done",label:"Concluído"}].map(({key:D,label:ie})=>a.jsx(Wi,{selected:b===D,onClick:()=>{},children:ie},D))})}),N.length===0?a.jsxs("div",{className:"app-board-filter-empty flex min-h-[16rem] flex-1 flex-col items-center justify-center gap-3 rounded-[var(--radius-lg)] border border-dashed border-[var(--color-border)] p-6 text-center",children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-[var(--color-bg-sunken)] text-[var(--color-text-secondary)]",children:a.jsx(k,{name:b==="attention"?"shield":b==="running"?"cpu":b==="done"?"check-circle":"circle",size:18})}),a.jsxs("div",{className:"grid max-w-sm gap-1",children:[a.jsx("p",{className:"text-body-sm font-semibold text-[var(--color-text-primary)]",children:R.title}),a.jsx("p",{className:"text-caption leading-snug text-[var(--color-text-secondary)]",children:R.description})]})]}):a.jsx("div",{className:"flex min-w-0 gap-4 pb-2 [scrollbar-width:thin]",children:pe.map(I)}),j&&a.jsx("div",{className:"flex justify-center",children:a.jsxs(q,{variant:"secondary",size:"sm",onClick:j,children:[a.jsx(k,{name:"plus",size:14}),"Adicionar item"]})}),a.jsx("div",{className:"flex justify-center py-1 opacity-50 hover:opacity-100 transition-opacity",children:a.jsx("span",{className:"text-[var(--color-text-secondary)] text-xs",children:"← Arraste ou use scroll horizontal →"})})]})}function v0(n){const i=new Date(n).getTime();return Number.isNaN(i)?0:Math.max(0,Math.floor((Date.now()-i)/864e5))}function g0(n){return n===0?"Hoje":n===1?"1d no fluxo":`${n}d no fluxo`}function b0(n,i){return n==="waiting"?{statusLabel:"Decisão",actionLabel:"Revisar gate",tone:"warning",badgeVariant:"amber",icon:"clock",priority:0}:n==="blocked"?{statusLabel:"Bloqueio",actionLabel:"Examinar causa",tone:"danger",badgeVariant:"error",icon:"shield",priority:1}:n==="running"?{statusLabel:"Em execução",actionLabel:"Acompanhar",tone:"info",badgeVariant:"agent",icon:"chevron-right",priority:2}:n==="done"?{statusLabel:"Concluído",actionLabel:"Ver evidência",tone:"success",badgeVariant:"success",icon:"check-circle",priority:i>14?5:4}:{statusLabel:i>=14?"Maior espera":"Na fila",actionLabel:"Avaliar prioridade",tone:"default",badgeVariant:"info",icon:"circle",priority:i>=14?3:6}}function y0({workflow:n,activeFlow:i,onSelectItem:c}){const u=n.items,d=ha(n,i),f=u.map(p=>{var T,B;const j=d.find(K=>K.id===p.stage),v=j?Zu(j):null,b=Ra(p,n,i),y=v0(p.createdAt),z=b0(b,y),S=Pi(p,[],n);return{id:`signal-${p.id}-${p.stage}`,itemId:p.id,title:((T=p.description)==null?void 0:T.trim())||S,subtitle:p.spec??S,owner:p.claimedBy??((B=j==null?void 0:j.roles[0])==null?void 0:B.label)??"Não atribuído",age:g0(y),stage:(j==null?void 0:j.name)??p.stage,...z,icon:(v==null?void 0:v.icon)??z.icon,createdAt:new Date(p.createdAt).getTime()}}).sort((p,j)=>p.priority-j.priority||j.createdAt-p.createdAt).slice(0,6),h=f.filter(p=>p.priority<=3).length;return f.length===0?a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{className:"app-section-muted text-xs font-semibold uppercase tracking-wider",children:"O que observar agora"}),a.jsx("p",{className:"app-section-muted text-xs",children:"Nenhum item para observar agora."})]}):a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsxs("div",{className:"grid gap-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("h3",{className:"app-section-muted text-xs font-semibold uppercase tracking-wider",children:"O que observar agora"}),a.jsxs(ke,{variant:h>0?"amber":"info",tone:"soft",className:"tabular-nums",children:[h," prioridade",h===1?"":"s"]})]}),a.jsx("p",{className:"text-caption text-[var(--color-text-secondary)]",children:"Decisões, bloqueios e esperas aparecem antes do restante."})]}),a.jsx(Hs,{className:"gap-2",children:f.map(p=>a.jsx(Bs,{tone:p.tone,className:"grid-cols-1 items-start p-3 sm:grid-cols-1",meta:a.jsxs(a.Fragment,{children:[a.jsx(ke,{variant:p.badgeVariant,tone:"soft",icon:p.icon,children:p.statusLabel}),a.jsx(ot,{children:p.stage}),a.jsx(ot,{children:p.age})]}),title:a.jsx("span",{className:"line-clamp-2",children:p.title}),description:a.jsxs("span",{className:"grid gap-1",children:[a.jsx("span",{className:"truncate font-mono",children:p.subtitle}),a.jsxs("span",{className:"truncate",children:[p.owner," · ",p.actionLabel]})]}),action:c?a.jsxs(q,{type:"button",variant:"secondary",size:"sm",className:"w-full justify-between text-caption",onClick:()=>c(p.itemId),"aria-label":`Abrir ${p.itemId}`,children:["Abrir",a.jsx(k,{name:"chevron-right",size:12})]}):null},p.id))}),u.length>f.length&&a.jsxs("p",{className:"app-section-muted text-caption text-center",children:["Mostrando 6 de ",u.length," itens"]})]})}function yx(n){let i,c=!1,u=1e3,d=null;const f=new Map;function h(y,z){var S;f.has(y)||f.set(y,new Set),(S=f.get(y))==null||S.add(z),i.addEventListener(y,z)}function p(y,z){var S;(S=f.get(y))==null||S.delete(z),i.removeEventListener(y,z)}function j(){c=!0,d&&clearTimeout(d),i.close()}function v(){c||(console.warn(`[SSE] Reconnecting in ${u/1e3}s...`),d=setTimeout(()=>{b(),u=Math.min(u*2,3e4)},u))}function b(){c||(i=new EventSource(n),i.onopen=()=>{u=1e3,console.warn("[SSE] Connected")},f.forEach((y,z)=>{for(const S of y)i.addEventListener(z,S)}),i.onerror=()=>{i.close(),v()})}return b(),new Proxy({},{get(y,z){return z==="addEventListener"?h:z==="removeEventListener"?p:z==="close"?j:Reflect.get(i,z)},set(y,z,S){return Reflect.set(i,z,S)}})}function jx(n,i,c){if(n.length===0)return{recipient:null,error:`O estágio ${i} não tem destinatário configurado.`};if(n.length===1)return{recipient:n[0]};const u=c(`Escolha o destinatário (${n.join(", ")}):`,n[0]);return u===null?{recipient:null,cancelled:!0}:n.includes(u)?{recipient:u}:{recipient:null,error:`Destinatário "${u}" não pertence ao estágio ${i}.`}}const j0="web-ui";function Nx(n){var i;return!!((i=n==null?void 0:n.gate)!=null&&i.blocking&&n.gate.type==="human")}function Sx(n){return(n==null?void 0:n.zone)==="todo"}async function wx(n,i=fetch){const c=await i(`/api/items/${encodeURIComponent(n)}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Item priorizado e iniciado pelo board."})});if(!c.ok){const u=await c.json().catch(()=>({}));throw new Error(u.error||"Falha ao iniciar o item.")}}function Cx(n){return`O estágio ${n.name} exige uma decisão explícita no painel do gate para avançar.`}function N0(n,i){if(!n.handoff)return!1;const c=Date.parse(n.handoff.expiresAt);return Number.isFinite(c)&&c>i}function S0(n){return[...new Set([...n.agents??[],...n.roleIds??[]])]}function w0(n,i,c,u=Date.now()){var v;if(!i)return{error:`O estágio ${n.stage} não existe no workflow ativo.`};const d=S0(i);let f;if(N0(n,u)&&n.handoff&&!n.handoff.to.startsWith("human")?f=n.handoff.to:d.length===1&&(f=d[0]),!f)return{error:d.length===0?`O estágio ${i.name} não tem papel configurado para o claim.`:`O estágio ${i.name} tem mais de um papel (${d.join(", ")}); faça o claim pelo executor do papel.`};const h=i.roles.find(b=>b.id===f)??(c==null?void 0:c.roles.find(b=>b.id===f)),j=(((v=i.hooks)==null?void 0:v.on_enter)??[]).filter(b=>b.auto&&b.requiresClaim&&b.action!=="capture_baseline").map(b=>{var y;return(y=c==null?void 0:c.operations[b.action])==null?void 0:y.requiredCapability}).find(b=>!!b)??(h==null?void 0:h.capabilities[0]);return j?{role:f,capability:j,executorId:j0}:{error:`O papel ${f} não declara capability para o claim.`}}function C0(n){const i=new Date(n).getTime();return Number.isNaN(i)?0:Math.max(0,Math.floor((Date.now()-i)/864e5))}function z0(n){return n==="waiting"?{label:"Aguardando decisão",action:"Revisar o gate antes de avançar.",tone:"warning",badge:"amber",icon:"clock"}:n==="blocked"?{label:"Bloqueado",action:"Examinar a causa do bloqueio.",tone:"danger",badge:"error",icon:"shield"}:n==="running"?{label:"Em execução",action:"Acompanhar o responsável e evidências.",tone:"info",badge:"agent",icon:"chevron-right"}:n==="done"?{label:"Concluído",action:"Verificar evidências registradas.",tone:"success",badge:"success",icon:"check-circle"}:{label:"Na fila",action:"Avaliar prioridade e próximo responsável.",tone:"default",badge:"info",icon:"circle"}}function A0({item:n,workflow:i,activeFlow:c,specs:u,onClose:d,onItemMoved:f,onOpenSpec:h}){var Kt,ca,ea,It;const p=x.useRef(null),j=x.useRef(null),[v,b]=x.useState(""),[y,z]=x.useState(null),[S,T]=x.useState(!0),[B,K]=x.useState([]),[le,ve]=x.useState(!1),[oe,$]=x.useState(1),[ne,me]=x.useState(0),[ue,_]=x.useState(!1),[he,Oe]=x.useState(!1),[be,Z]=x.useState(!1),ee=Pi(n,u,i),de=((Kt=n.description)==null?void 0:Kt.trim())||ee,ge=ha(i,c),E=ge.find(Ce=>Ce.id===n.stage),W=n.spec?u.find(Ce=>Ce.id===n.spec):null,pe=W?bx(W.content):null,xe=n.tasks&&n.tasks.length>0,G=pe?pe.total:xe?((ca=n.tasks)==null?void 0:ca.length)??0:0,N=pe?pe.done:xe?((ea=n.tasks)==null?void 0:ea.filter(Ce=>Ce.done).length)??0:0,R=C0(n.createdAt),I=Ra(n,i,c),D=z0(I),ie=E?Xu(E):"Item registrado no fluxo.",U=n.claimedBy??((It=E==null?void 0:E.roles[0])==null?void 0:It.label)??"Não atribuído",M=ge.filter(Ce=>Ce.id!==n.stage),X=n.lastHeartbeatAt?Date.now()-new Date(n.lastHeartbeatAt).getTime():null,te=X!==null&&X>9e4,Ge=B.filter(Ce=>/retry|retrying|re-emit/i.test(`${Ce.action} ${Ce.description}`)).length;x.useEffect(()=>{var Ce;return j.current=document.activeElement,(Ce=p.current)==null||Ce.focus(),()=>{var Ye;(Ye=j.current)==null||Ye.focus()}},[]),x.useEffect(()=>{const Ce='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';function Ye(pt){const vt=p.current;if(!vt)return;if(pt.key==="Escape"){d();return}if(pt.key!=="Tab")return;const Ut=vt.querySelectorAll(Ce);if(Ut.length===0)return;const ut=Ut[0],jt=Ut[Ut.length-1];pt.shiftKey&&document.activeElement===ut?(pt.preventDefault(),jt.focus()):!pt.shiftKey&&document.activeElement===jt&&(pt.preventDefault(),ut.focus())}return window.addEventListener("keydown",Ye),()=>window.removeEventListener("keydown",Ye)},[d]),x.useEffect(()=>{const Ce=yx("/events");return Ce.addEventListener("workflow-updated",Ye=>{try{const pt=JSON.parse(Ye.data);if(pt.itemId===n.id&&pt.stage&&pt.stage!==n.stage){const vt=ge.find(Ut=>Ut.id===pt.stage);z(`${n.id} movido para ${(vt==null?void 0:vt.name)??pt.stage}`),(vt==null?void 0:vt.zone)==="done"&&setTimeout(()=>d(),3e3)}}catch{}}),()=>Ce.close()},[n.id,n.stage,d,ge]),x.useEffect(()=>{const Ce=setTimeout(()=>T(!1),150);return()=>clearTimeout(Ce)},[]);const Se=x.useCallback(Ce=>{ve(!1),fetch(`/api/log?item=${n.id}&limit=50&page=${Ce}`).then(Ye=>Ye.json()).then(Ye=>{Ye.entries&&K(pt=>Ce===1?Ye.entries:[...pt,...Ye.entries]),typeof Ye.total=="number"&&me(Ye.total)}).catch(()=>{}).finally(()=>ve(!0))},[n.id]);x.useEffect(()=>{$(1),K([]),Se(1)},[Se]);const Le=x.useCallback(()=>{var Ut;if(!v)return;const Ce=ge.find(ut=>ut.id===v),Ye=(Ut=Ce==null?void 0:Ce.roleIds)!=null&&Ut.length?Ce.roleIds:(Ce==null?void 0:Ce.agents)??[];if(E&&Nx(E)){window.alert(Cx(E));return}if(Sx(E)){wx(n.id).then(()=>{f(),b("")}).catch(ut=>window.alert(ut instanceof Error?ut.message:"Falha ao iniciar o item."));return}if(!n.claimExecutorId){window.alert('Não há claim ativa para fazer a passagem. Use "Reivindicar como papel" e tente novamente.');return}const pt=jx(Ye,(Ce==null?void 0:Ce.name)??v,(ut,jt)=>window.prompt(ut,jt));if(pt.error){window.alert(pt.error);return}const vt=pt.recipient;vt&&fetch(`/api/items/${n.id}/passage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStageId:v,to:vt,executorId:n.claimExecutorId,summary:`Passagem solicitada pela interface para ${(Ce==null?void 0:Ce.name)??v}.`,evidence:[]})}).then(async ut=>{const jt=await ut.json();if(!ut.ok)throw new Error([jt.code,jt.reason??jt.error,...jt.recoveryActions??[]].filter(Boolean).join(" — "));f(),b("")}).catch(ut=>window.alert(ut instanceof Error?ut.message:"Falha ao fazer passagem."))},[n.id,n.claimExecutorId,E,v,f,ge]),De=n.claimedBy||(E==null?void 0:E.zone)==="done"?null:w0(n,E,c),[F,Te]=x.useState(!1),Me=x.useCallback(()=>{!De||De.error||(Te(!0),fetch(`/api/items/${n.id}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:De.role,capability:De.capability,executorId:De.executorId})}).then(async Ce=>{const Ye=await Ce.json().catch(()=>({}));if(!Ce.ok)throw new Error(Ye.error||"Falha ao reivindicar o item.");f()}).catch(Ce=>window.alert(Ce instanceof Error?Ce.message:"Falha ao reivindicar o item.")).finally(()=>Te(!1)))},[De,n.id,f]),gt=x.useCallback(()=>{fetch(`/api/items/${n.id}`,{method:"DELETE"}).then(()=>{f(),d()})},[n.id,d,f]),ht=x.useCallback((Ce,Ye)=>{var pt;fetch(`/api/items/${n.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tasks:(pt=n.tasks)==null?void 0:pt.map(vt=>vt.id===Ce?{...vt,done:Ye}:vt)})}).then(()=>f())},[n.id,n.tasks,f]);return a.jsxs(a.Fragment,{children:[a.jsxs(ms,{open:!0,onClose:d,title:de,variant:"fullscreen",hideHeader:!0,contentRef:p,className:"animate-fade-in",children:[y&&a.jsxs("div",{className:"app-warning-banner flex shrink-0 items-center gap-2 px-4 py-2 text-sm",children:[a.jsx(k,{name:"alert-triangle",size:14}),a.jsx("span",{children:y}),a.jsx(q,{onClick:()=>z(null),className:"ml-auto",size:"sm",variant:"ghost","aria-label":"Dispensar aviso",children:a.jsx(k,{name:"x",size:14})})]}),a.jsxs("header",{className:"app-header-surface flex shrink-0 items-start gap-3 px-5 py-4",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(ke,{variant:"info",tone:"soft",className:"font-mono",children:n.id}),a.jsx(ke,{variant:D.badge,tone:"soft",icon:D.icon,children:D.label}),a.jsx(ot,{children:(E==null?void 0:E.name)??n.stage})]}),a.jsx("h2",{className:"line-clamp-2 text-lg font-semibold leading-snug text-[var(--color-text-primary)]",children:de}),a.jsx("p",{className:"text-caption text-[var(--color-text-secondary)]",children:n.spec??ee})]}),n.spec&&h&&a.jsxs(q,{size:"sm",variant:"secondary",onClick:h,children:[a.jsx(k,{name:"file-text",size:14}),"Abrir especificação"]}),a.jsx(q,{onClick:d,size:"sm",variant:"ghost","aria-label":"Fechar",children:a.jsx(k,{name:"x",size:16})})]}),a.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]",children:[a.jsxs("aside",{className:"app-section-card hidden min-h-0 flex-col gap-4 overflow-y-auto rounded-none border-y-0 border-l-0 p-4 lg:flex",children:[a.jsx(Zi,{tone:D.tone,density:"compact",icon:a.jsx(k,{name:D.icon,size:16}),title:"Próxima ação",description:`${D.action} ${ie}`}),a.jsx(Pe,{children:a.jsxs(it,{className:"gap-3 p-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("h3",{className:"text-body-sm font-semibold",children:"Estado do trabalho"}),a.jsx("span",{className:"text-caption tabular-nums text-[var(--color-text-secondary)]",children:G>0?`${N}/${G}`:"sem checklist"})]}),G>0&&a.jsx(Vu,{value:N,max:G,size:"sm",state:I==="done"?"complete":I==="blocked"?"error":I==="waiting"?"warning":"default"}),a.jsx(Za,{className:"grid-cols-1",items:[{label:"Responsável",value:U},{label:"Tempo no fluxo",value:R===0?"Hoje":`${R}d`},{label:"Evidência",value:W?W.id:"Sem especificação vinculada"}]})]})}),a.jsx(Pe,{children:a.jsxs(it,{className:"gap-3 p-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("h3",{className:"text-body-sm font-semibold",children:"Execução e handoff"}),te?a.jsx(ke,{variant:"error",tone:"soft",children:"Heartbeat expirado"}):null]}),a.jsx(Za,{className:"grid-cols-1",items:[{label:"Claim",value:n.claimedBy?`${n.claimedBy}${n.claimRevision?` · ${n.claimRevision.slice(0,12)}`:""}`:"Nenhum claim ativo"},{label:"Executor",value:n.claimExecutorId??"Nenhum executor"},{label:"Heartbeat",value:n.lastHeartbeatAt?`${n.lastHeartbeatAt}${te?" · stale":" · ativo"}`:"Nenhum heartbeat registrado"},{label:"Retries",value:Ge?String(Ge):"Nenhuma tentativa de retry"},{label:"Gate",value:E!=null&&E.gate?`${E.gate.name} · ${E.gate.blocking?"bloqueante":"informativo"}`:"Nenhum gate configurado"}]}),n.handoff?a.jsxs("div",{className:"grid gap-1 rounded border border-[var(--color-border)] p-3 text-xs",children:[a.jsxs("strong",{children:["Handoff: ",n.handoff.from," → ",n.handoff.to]}),a.jsx("span",{children:n.handoff.summary}),a.jsxs("span",{className:"app-section-muted",children:["Expira em ",n.handoff.expiresAt," · ",n.handoff.evidence.length," evidência(s)"]}),n.handoff.evidence.length>0?a.jsx("span",{className:"break-words",children:n.handoff.evidence.join(" · ")}):a.jsx("span",{className:"app-section-muted",children:"Nenhuma evidência anexada ao handoff."})]}):a.jsx("p",{className:"app-section-muted text-xs",children:"Nenhum handoff pendente."}),De?De.error?a.jsx("p",{className:"app-section-muted text-xs",children:De.error}):a.jsx(q,{size:"sm",variant:"secondary",disabled:F,onClick:Me,children:F?"Reivindicando…":`Reivindicar como ${De.role}`}):null,n.lastFailure?a.jsxs("p",{className:"text-xs text-[var(--color-danger)]",children:["Falha ",n.lastFailure.code,": ",n.lastFailure.message," · recuperação: ",n.lastFailure.recovery]}):null]})}),a.jsx(Pe,{children:a.jsxs(it,{className:"gap-3 p-4",children:[a.jsx("h3",{className:"text-body-sm font-semibold",children:"Movimentação"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(yn,{value:v,onValueChange:b,children:[a.jsx(jn,{className:"app-select-surface flex-1 text-xs","aria-label":"Mover para",children:a.jsx(vr,{placeholder:"Mover para..."})}),a.jsx(Nn,{children:M.map(Ce=>a.jsx(Xa,{value:Ce.id,children:Ce.name},Ce.id))})]}),a.jsx(q,{size:"sm",disabled:!v,onClick:Le,children:"Mover"})]}),n.spec&&h&&a.jsxs(q,{size:"sm",variant:"secondary",onClick:h,children:[a.jsx(k,{name:"file-text",size:14}),"Abrir especificação vinculada"]}),a.jsxs(Sr,{open:he,onOpenChange:Oe,children:[a.jsxs(wr,{className:"app-section-muted flex w-full items-center gap-2 text-xs font-semibold",children:[a.jsx(k,{name:"chevron-right",size:12,className:_t("transition-transform",he&&"rotate-90")}),"Ações avançadas"]}),a.jsx(Cr,{className:"mt-2",children:a.jsxs(q,{size:"sm",variant:"secondary",onClick:()=>Z(!0),className:"app-danger-text w-full justify-start",children:[a.jsx(k,{name:"trash",size:14}),"Excluir item"]})})]})]})}),a.jsx(k0,{activities:B,loaded:le,hasMore:ne>B.length,onLoadMore:()=>{const Ce=oe+1;$(Ce),Se(Ce)},open:ue,onOpenChange:_})]}),a.jsx("main",{className:"flex min-h-0 flex-col overflow-hidden",children:a.jsx("div",{className:"app-section-shell flex min-h-0 flex-1 overflow-y-auto p-5",children:a.jsxs("div",{className:"mx-auto grid w-full max-w-5xl gap-4",children:[a.jsx(Zi,{className:"lg:hidden",tone:D.tone,icon:a.jsx(k,{name:D.icon,size:18}),title:D.label,description:`${D.action} ${ie}`,meta:a.jsxs(a.Fragment,{children:[a.jsx(ot,{children:U}),a.jsx(ot,{children:R===0?"Hoje no fluxo":`${R}d no fluxo`})]}),action:n.spec&&h?a.jsxs(q,{size:"sm",variant:"secondary",onClick:h,children:[a.jsx(k,{name:"file-text",size:14}),"Abrir especificação"]}):null}),xe&&a.jsx(E0,{item:n,onToggle:ht}),a.jsx(Pe,{children:a.jsxs(it,{className:"gap-4 p-5",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-body-sm font-semibold",children:"Evidência vinculada"}),a.jsx("p",{className:"text-caption text-[var(--color-text-secondary)]",children:W?W.id:"Nenhuma especificação vinculada a este item."})]})}),S?a.jsxs("div",{className:"grid gap-3",children:[a.jsx(hs,{className:"h-6 w-48"}),a.jsx(hs,{className:"h-4 w-full"}),a.jsx(hs,{className:"h-4 w-3/4"}),a.jsx(hs,{className:"h-20 w-full"})]}):W?a.jsx("div",{className:"max-w-none rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg-base)] p-4",children:a.jsx(ml,{content:W.content})}):a.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)]",children:a.jsxs("div",{className:"grid justify-items-center gap-2 text-center",children:[a.jsx(k,{name:"file-text",size:24,className:"app-section-muted"}),a.jsx("p",{className:"app-section-muted text-sm",children:n.spec?"Especificação não encontrada":"Nenhuma especificação vinculada"})]})})]})})]})})})]}),a.jsxs("div",{className:"app-section-card flex shrink-0 items-center gap-2 rounded-none border-x-0 border-b-0 px-4 py-3 lg:hidden",children:[a.jsxs(yn,{value:v,onValueChange:b,children:[a.jsx(jn,{className:"app-select-surface flex-1 text-xs","aria-label":"Mover para",children:a.jsx(vr,{placeholder:"Mover para..."})}),a.jsx(Nn,{children:M.map(Ce=>a.jsx(Xa,{value:Ce.id,children:Ce.name},Ce.id))})]}),a.jsx(q,{size:"sm",disabled:!v,onClick:Le,children:"Mover"})]})]}),a.jsx(Ki,{open:be,onClose:()=>Z(!1),onConfirm:gt,title:"Excluir item",message:`Excluir ${n.id} remove este item do fluxo. Esta ação deve ser usada apenas quando o item não representa mais trabalho real.`,confirmLabel:"Excluir",cancelLabel:"Cancelar",variant:"danger"})]})}function E0({item:n,onToggle:i}){return!n.tasks||n.tasks.length===0?null:a.jsx(Pe,{children:a.jsxs(it,{className:"gap-3 p-4",children:[a.jsxs("h3",{className:"text-body-sm font-semibold",children:["Tarefas (",n.tasks.filter(c=>c.done).length,"/",n.tasks.length,")"]}),a.jsx("div",{className:"grid gap-1",children:n.tasks.map(c=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-[var(--radius-sm)] px-1 py-1 text-xs hover:bg-[var(--surface-hover)]",children:[a.jsx(Sn,{checked:c.done,onChange:u=>i(c.id,u.target.checked)}),a.jsx("span",{className:_t("text-[var(--color-text-primary)]",c.done&&"text-[var(--color-text-secondary)] line-through"),children:c.description})]},c.id))})]})})}function k0({activities:n,loaded:i,hasMore:c,onLoadMore:u,open:d,onOpenChange:f}){return a.jsx(Pe,{children:a.jsx(it,{className:"gap-3 p-4",children:a.jsxs(Sr,{open:d,onOpenChange:f,children:[a.jsxs(wr,{className:"app-section-muted flex w-full items-center gap-2 text-xs font-semibold",children:[a.jsx(k,{name:"chevron-right",size:12,className:_t("transition-transform",d&&"rotate-90")}),"Log de eventos",i&&a.jsxs("span",{className:"text-caption font-normal",children:["(",n.length,")"]})]}),a.jsx(Cr,{className:"mt-3",children:a.jsxs("div",{className:"grid max-h-72 gap-2 overflow-y-auto",children:[i?n.length===0?a.jsx("p",{className:"app-section-muted text-xs",children:"Nenhum evento registrado para este item."}):n.map(h=>a.jsxs("div",{className:"grid gap-0.5 border-l-2 border-[var(--color-primary)] pl-2",children:[a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"app-primary-text text-caption font-medium uppercase",children:h.action}),a.jsx("span",{className:"app-section-muted text-caption",children:new Date(h.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-xs leading-relaxed",children:h.description})]},h.id)):a.jsx("p",{className:"app-section-muted text-xs",children:"Carregando..."}),i&&c?a.jsx(q,{type:"button",size:"sm",variant:"ghost",onClick:u,children:"Carregar eventos anteriores"}):null]})})]})})})}function T0({workflow:n,activeFlow:i,specRefreshKey:c,onItemMoved:u,onOpenSpec:d}){var ps;const[f,h]=x.useState(null),[p,j]=x.useState([]),[v,b]=x.useState(!1),[y,z]=x.useState(!1),[S,T]=x.useState(null),[B,K]=x.useState(n.webhooks??[]),[le,ve]=x.useState(null),[oe,$]=x.useState("all"),[ne,me]=x.useState(null),[ue,_]=x.useState(!1),[he,Oe]=x.useState(!1),[be,Z]=x.useState(()=>{try{return localStorage.getItem("letra-observation-panel")!=="false"}catch{return!0}}),ee=zr(n,i),de=vx(n,i),ge=ha(n,i),E=()=>{const Y=!be;Z(Y);try{localStorage.setItem("letra-observation-panel",String(Y))}catch{}},W=x.useCallback(()=>{fetch("/api/specs").then(Y=>Y.json()).then(Y=>{Array.isArray(Y)&&j(Y)}).catch(()=>{})},[]);x.useEffect(()=>{W()},[W,c]);const pe=x.useCallback(()=>{fetch("/api/autopilot").then(Y=>{if(!Y.ok)throw new Error("Autopilot indisponível");return Y.json()}).then(me).catch(()=>me(null))},[]);x.useEffect(()=>{pe()},[pe,n.updatedAt]);async function xe(Y){_(!0);try{const we=await fetch("/api/autopilot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:Y})}),He=await we.json().catch(()=>({}));if(!we.ok)throw new Error(He.error||"Não foi possível alterar o autopilot.");me(He),U(Y?"Autopilot ativado.":"Autopilot pausado.","success")}catch(we){U(we instanceof Error?we.message:"Não foi possível alterar o autopilot.","error")}finally{_(!1)}}function G(){if(!(!ne||ue)){if(ne.enabled&&ne.activeItems>0){Oe(!0);return}xe(!ne.enabled)}}x.useEffect(()=>{function Y(we){const He=we.detail;if(!He)return;n.items.some(St=>St.id===He)&&h(He)}return window.addEventListener("letra-open-item",Y),()=>window.removeEventListener("letra-open-item",Y)},[n.items]),x.useEffect(()=>{K(n.webhooks??[])},[n.webhooks]);const N=f?n.items.find(Y=>Y.id===f):null;N&&ge.find(Y=>Y.id===N.stage),N!=null&&N.spec&&p.find(Y=>Y.id===N.spec);const R=N?Lj(N.stage,n,i):null;R&&((ps=ge.find(Y=>Y.id===R))==null||ps.name);function I(Y,we){const He=ge.find(Ue=>Ue.id===Y.stage);return!Nx(He)}function D(Y,we){if(I(Y))return!0;const He=ge.find(Ue=>Ue.id===Y.stage);return He&&U(Cx(He),"error"),!1}function ie(Y){const we=n.stages.find(He=>He.id===Y.stage);return(we==null?void 0:we.validate)??[]}const{toast:U}=yr();function M(Y,we){var Sa;const He=n.items.find(We=>We.id===Y);if(!He||!D(He))return;const Ue=ge.find(We=>We.id===we),St=(Sa=Ue==null?void 0:Ue.roleIds)!=null&&Sa.length?Ue.roleIds:(Ue==null?void 0:Ue.agents)??[],la=ge.find(We=>We.id===He.stage);if(Sx(la)){wx(Y).then(()=>{u(),f===Y&&h(null)}).catch(We=>U(We instanceof Error?We.message:"Erro ao iniciar o item.","error"));return}if(!He.claimExecutorId){U('Não há claim ativa para fazer a passagem. Abra o item e use "Reivindicar como papel".',"error");return}const Ft=jx(St,(Ue==null?void 0:Ue.name)??we,(We,At)=>window.prompt(We,At));if(Ft.error){U(`${Ft.error} Configure um papel de destino no workflow.`,"error");return}const Na=Ft.recipient;Na&&fetch(`/api/items/${Y}/passage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStageId:we,to:Na,executorId:He.claimExecutorId,summary:`Passagem solicitada pela interface para ${(Ue==null?void 0:Ue.name)??we}.`,evidence:[]})}).then(async We=>{const At=await We.json();if(!We.ok)throw new Error([At.code,At.reason??At.error,...At.recoveryActions??[]].filter(Boolean).join(" — "));u(),f===Y&&h(null)}).catch(We=>U(We instanceof Error?We.message:"Erro ao mover item.","error"))}function X(Y,we){const He=n.items.find(St=>St.id===Y);if(!He||He.stage===we||!D(He))return;const Ue=ie(He);if(Ue.length>0){ve({itemId:Y,targetStage:we,pendingChecks:Ue.map(()=>!1)});return}M(Y,we)}function te(){le&&(M(le.itemId,le.targetStage),ve(null))}function Ge(){N&&fetch(`/api/items/${N.id}`,{method:"DELETE"}).then(()=>{u(),h(null)})}function Se(Y){var He;const we=(He=ge[0])==null?void 0:He.id;we&&fetch("/api/items",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Y.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),description:Y.trim(),stage:we})}).then(Ue=>Ue.json()).then(Ue=>{Ue&&!Ue.error&&u()})}function Le(){fetch("/api/workflow",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhooks:B})}).then(Y=>Y.json()).then(()=>{T(null),u()})}function De(){const Y=`wh-${Date.now()}`;K(we=>[...we,{id:Y,url:"",events:["item.moved"],label:""}])}function F(Y,we,He){K(Ue=>{const St=[...Ue];return St[Y]={...St[Y],[we]:He},St})}function Te(Y){K(we=>we.filter((He,Ue)=>Ue!==Y))}const Me=n.items.length,gt=n.items.map(Y=>({item:Y,state:Ra(Y,n,i)})),ht=gt.filter(({state:Y})=>Y==="done").length,Kt=Me>0?Math.round(ht/Me*100):0,ca=gt.filter(({state:Y})=>Y==="running").length,ea=gt.filter(({state:Y})=>Y==="waiting").length,It=gt.filter(({state:Y})=>Y==="blocked").length,Ce=ea+It,Ye=gt.filter(({state:Y})=>Y==="running").length,pt=gt.filter(({state:Y})=>Y==="idle").length;Bj(n,i).map(Y=>({...Y,pct:Y.status==="done"?100:0,isRunning:Y.status==="running",isHumanGate:Y.presentation.isHumanGate})).findIndex(Y=>Y.itemCount>0&&!de.has(Y.id)&&Y.zone!=="todo");const Ut=gt.filter(({state:Y})=>Y==="running").map(({item:Y})=>Y).reduce((Y,we)=>((Y[we.claimedBy]=Y[we.claimedBy]||[]).push(we),Y),{}),ut=["var(--color-primary)","var(--color-warning)","var(--color-primary)","var(--color-success)","var(--color-danger)"],jt={all:Me,attention:Ce,running:Ye,queued:pt,done:ht},ta=[{key:"all",label:"Todos"},{key:"attention",label:"Precisa de atenção"},{key:"running",label:"Em andamento"},{key:"queued",label:"Na fila"},{key:"done",label:"Concluídos"}],[aa,Ja]=x.useState([]);x.useEffect(()=>{try{const Y=localStorage.getItem("kanban:customViews");Y&&Ja(JSON.parse(Y))}catch{}},[]);const sa=(Y,we)=>{const He=[...aa,{key:`view-${Date.now()}`,label:Y,filter:we}];Ja(He),localStorage.setItem("kanban:customViews",JSON.stringify(He))},Gt=S==="webhooks",Nt=n.items.find(Y=>ee.has(Y.stage))??n.items.find(Y=>Ra(Y,n,i)==="blocked")??n.items.find(Y=>Ra(Y,n,i)==="running")??n.items.find(Y=>!de.has(Y.stage))??n.items[0]??null,nt=Nt?ge.find(Y=>Y.id===Nt.stage):null,Wa=Nt?Ra(Nt,n,i):null;return Nt&&(`${Nt.description||Nt.id}${(nt==null?void 0:nt.name)??Nt.stage}`,Wa==="running"&&`${Nt.claimedBy}`),a.jsxs("div",{className:"app-section-shell min-w-0",children:[a.jsx(xx,{title:"Trabalho",description:`${Me} itens · ${Ce} atenção`,left:a.jsx(k,{name:"grid",size:20}),right:a.jsxs(a.Fragment,{children:[a.jsxs(ke,{icon:"cpu",variant:ca>0?"agent":"info",tone:"soft",children:[ca," em andamento"]}),a.jsxs(ke,{icon:"shield",variant:Ce>0?It>0?"error":"amber":"info",tone:"soft",children:[Ce," atenção"]}),a.jsxs(q,{variant:ne!=null&&ne.enabled?"secondary":"ghost",size:"sm",onClick:G,disabled:ne===null||ue,className:"h-8 px-2 text-caption","aria-pressed":(ne==null?void 0:ne.enabled)??!1,title:ne!=null&&ne.enabled?`Autopilot ativo · ${ne.activeItems} em execução · ${ne.waitingHuman} aguardando humano`:"Ativar autopilot",children:[a.jsx(k,{name:"zap",size:12}),ne!=null&&ne.enabled?"Autopilot ativo":"Autopilot desligado"]}),a.jsxs(q,{variant:be?"secondary":"ghost",size:"sm",onClick:E,className:"h-8 px-2 text-caption",children:[a.jsx(k,{name:"list-three",size:12}),"Observar"]})]})}),a.jsxs("div",{className:"flex min-w-0 flex-1 overflow-hidden",children:[Gt?a.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:a.jsxs("div",{className:"flex flex-col gap-3 max-w-2xl",children:[a.jsx("p",{className:"app-section-muted text-xs font-medium",children:"Configure webhooks para receber notificações quando itens forem movidos entre estágios."}),B.map((Y,we)=>a.jsx("div",{className:"app-section-card p-3",children:a.jsx("div",{className:"flex flex-col gap-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ct,{value:Y.label??"",onChange:He=>F(we,"label",He.target.value||void 0),placeholder:"Label",className:"app-input-surface flex-1 text-sm px-2 py-1 rounded border-none focus:outline-none focus:ring-2 focus:ring-primary/30"}),a.jsx(q,{onClick:()=>Te(we),className:"app-danger-button text-xs px-2 py-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30","aria-label":"Remover webhook",children:a.jsx(k,{name:"x",size:12})})]})})},Y.id)),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(q,{size:"sm",variant:"secondary",onClick:De,children:"Adicionar webhook"}),a.jsx(q,{size:"sm",onClick:Le,children:"Salvar"}),a.jsx(q,{size:"sm",variant:"secondary",onClick:()=>{T(null),K(n.webhooks??[])},children:"Voltar"})]})]})}):a.jsxs("div",{className:"flex min-w-0 flex-1 overflow-y-hidden",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto p-3 sm:p-4 gap-3",children:[a.jsx("div",{className:"grid shrink-0 grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[{label:"Velocidade",value:`${Kt}%`,sub:`${ht}/${Me} concluídos`,color:"var(--color-primary)",icon:"bar-chart"},{label:"Lead Time",value:"2.3d",sub:"média",color:"var(--color-success)",icon:"clock"},{label:"Conversão",value:Me>0?`${Math.round(ht/Me*100)}%`:"0%",sub:`${ht}/${Me} itens`,color:"var(--color-success)",icon:"check-circle"},{label:"Block Rate",value:"20%",sub:"2/10 itens",color:"var(--color-warning)",icon:"alert-triangle"}].map(Y=>a.jsx(Pe,{className:"app-summary-card hover:shadow-sm",children:a.jsxs(it,{className:"grid gap-0.5 p-2.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"app-section-muted text-caption font-medium uppercase tracking-wider",children:Y.label}),Y.icon&&a.jsx(k,{name:Y.icon,size:10,style:{color:Y.color}})]}),a.jsx("div",{className:"flex items-baseline gap-1",children:a.jsx("span",{className:_t("text-lg font-bold tabular-nums",!1),style:{color:Y.color},children:Y.value})}),a.jsx("span",{className:"app-section-muted text-caption",children:Y.sub})]})},Y.label))}),Object.keys(Ut).length>0&&a.jsxs("div",{className:"min-w-0 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--color-text-primary)]",children:"Atores em andamento"}),a.jsxs("div",{className:"app-section-muted flex items-center gap-1 text-caption",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-[var(--color-primary)] animate-pulse"}),a.jsxs("span",{children:[ca," ativo",ca!==1?"s":""]})]})]}),a.jsx("div",{className:"flex min-w-0 gap-2 overflow-x-auto pb-1 scrollbar-none",children:Object.entries(Ut).map(([Y,we],He)=>{const Ue=we[0],St=ha(n,i).find(At=>At.id===Ue.stage),la=St?Xu(St):"Processando",Ft=we.reduce((At,Lt)=>Lt.tasks?At+Lt.tasks.filter(Fe=>Fe.done).length:At,0),Na=we.reduce((At,Lt)=>{var Fe;return At+(((Fe=Lt.tasks)==null?void 0:Fe.length)||0)},0),Sa=Na>0?Math.round(Ft/Na*100):null,We=!ee.has(Ue.stage)&&!de.has(Ue.stage);return a.jsxs("div",{className:_t("app-agent-card p-3 min-w-[160px] flex flex-col gap-1.5 shrink-0 transition-all hover:shadow-sm",We&&"animate-agent-breathe"),"data-running":We?"true":"false",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-caption font-bold",style:{background:`color-mix(in oklch, ${ut[He%ut.length]} 20%, transparent)`,color:ut[He%ut.length]},children:Y.charAt(0).toUpperCase()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-xs font-semibold truncate",children:Y}),We&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-[var(--color-primary)] animate-pulse"})]}),a.jsx("span",{className:"app-section-muted text-caption",children:la})]})]}),a.jsxs("div",{className:"flex flex-col gap-0.5",children:[Sa===null?a.jsx("span",{className:"app-section-muted text-caption",children:"Sem progresso declarado"}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Vu,{value:Sa,max:100,size:"xs",className:"flex-1"}),a.jsxs("span",{className:"text-caption tabular-nums font-medium text-[var(--color-text-primary)]",children:[Sa,"%"]})]}),a.jsxs("span",{className:"app-section-muted text-caption",children:[we.length," ",we.length===1?"item":"itens"]})]}),a.jsx("div",{className:_t("text-caption font-medium px-1.5 py-0.5 rounded-full self-start",We?"":"bg-muted text-muted-foreground"),style:We?{backgroundColor:"#282414",color:"#FFB800"}:void 0,children:We?"Em andamento":"Na fila"})]},Y)})})]}),a.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-1.5 overflow-x-auto pb-1 [scrollbar-width:thin]",children:[a.jsx(Ji,{ariaLabel:"Filtrar trabalho",className:"w-max max-w-none flex-nowrap sm:w-auto sm:max-w-full sm:flex-wrap",children:ta.map(({key:Y,label:we})=>a.jsx(Wi,{selected:oe===Y,count:jt[Y],onClick:()=>$(Y),children:we},Y))}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(lp,{children:[a.jsx(np,{asChild:!0,children:a.jsxs(q,{variant:"secondary",size:"sm",children:[a.jsx(k,{name:"plus",size:14}),"Salvar view"]})}),a.jsxs(rp,{children:[a.jsx(ip,{children:"Salvar filtro atual"}),ta.map(({key:Y,label:we})=>a.jsx(vu,{onClick:()=>sa(we,Y),children:we},Y))]})]}),aa.length>0&&a.jsxs(lp,{children:[a.jsx(np,{asChild:!0,children:a.jsxs(q,{variant:"secondary",size:"sm",children:[a.jsx(k,{name:"grid",size:14}),"Views (",aa.length,")"]})}),a.jsxs(rp,{children:[a.jsx(ip,{children:"Views salvas"}),aa.map(Y=>a.jsx(vu,{onClick:()=>$(Y.filter),children:Y.label},Y.key)),a.jsx(vu,{onClick:()=>{Ja([]),localStorage.removeItem("kanban:customViews")},children:a.jsx("span",{className:"text-[var(--color-error)]",children:"Limpar views"})})]})]})]})]}),a.jsx("div",{className:"app-section-card flex min-w-0 flex-1 flex-col overflow-hidden",children:a.jsx(x0,{workflow:n,activeFlow:i,onSelectItem:h,onDropItem:X,allowDrop:D,specRefreshKey:c,filter:oe,onItemDecided:u,onOpenSpec:d})})]}),a.jsx("div",{className:_t("app-section-card shrink-0 overflow-y-auto transition-all duration-300 ease-in-out",be?"w-80 border-l opacity-100":"w-0 border-l-0 opacity-0 overflow-hidden"),children:a.jsx(y0,{workflow:n,activeFlow:i,onSelectItem:h})})]}),N&&a.jsx(A0,{item:N,workflow:n,activeFlow:i,specs:p,onClose:()=>h(null),onItemMoved:u,onOpenSpec:d})]}),a.jsx(cx,{open:v,onClose:()=>b(!1),onSubmit:Se,title:"Adicionar Item",label:"Nome do item",placeholder:"ex: my-feature",submitLabel:"Criar"}),a.jsx(Ki,{open:y,onClose:()=>z(!1),onConfirm:Ge,title:"Excluir Item",message:`Tem certeza que deseja excluir ${N==null?void 0:N.id}?`,confirmLabel:"Excluir",cancelLabel:"Cancelar",variant:"danger"}),a.jsx(Ki,{open:he,onClose:()=>Oe(!1),onConfirm:()=>void xe(!1),title:"Pausar autopilot",message:`Há ${(ne==null?void 0:ne.activeItems)??0} item(ns) em execução. Pausar o autopilot interrompe novos ciclos; a execução atual poderá concluir antes de parar.`,confirmLabel:"Pausar",cancelLabel:"Continuar"}),a.jsx(ms,{open:le!==null,onClose:()=>ve(null),title:"Validação necessária",actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{onClick:()=>ve(null),className:"inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-primary/30 text-sm px-4 py-2 rounded-[var(--radius-sm)] border border-border bg-transparent hover:bg-muted text-foreground cursor-pointer",children:"Cancelar"}),a.jsx(q,{onClick:te,disabled:!(le!=null&&le.pendingChecks.every(Boolean)),className:"app-primary-button inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-primary/30 text-sm px-4 py-2 rounded-[var(--radius-sm)] border border-transparent cursor-pointer disabled:opacity-50",children:"Mover"})]}),children:a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("p",{className:"app-section-muted text-xs mb-1",children:"Antes de mover, confirme os itens abaixo:"}),le==null?void 0:le.pendingChecks.map((Y,we)=>{const He=n.stages.find(St=>St.id===((N==null?void 0:N.stage)??"")),Ue=(He==null?void 0:He.validate)??[];return a.jsx(Sn,{checked:Y,label:Ue[we]??`Check ${we+1}`,onChange:St=>{ve(la=>{if(!la)return la;const Ft=[...la.pendingChecks];return Ft[we]=St.target.checked,{...la,pendingChecks:Ft}})}},we)})]})})]})}const M0={l1:{title:"Contexto Principal",icon:"book",desc:"Arquivos fundamentais do projeto"},l2:{title:"Foco e Especificação",icon:"target",desc:"Foco atual e especificação ativa"},l3:{title:"Sinais e Estado",icon:"activity",desc:"Alertas, eventos e estado da sessão"},l4:{title:"Restrições e Regras",icon:"shield",desc:"Regras compiladas do sistema"}};function D0(){const[n,i]=x.useState(!1);return{copy:x.useCallback(async u=>{try{await navigator.clipboard.writeText(u),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},[]),copied:n}}function Vi({layerKey:n,children:i,defaultOpen:c=!1}){const[u,d]=x.useState(c),f=M0[n];return a.jsxs(Sr,{open:u,onOpenChange:d,children:[a.jsxs(wr,{className:"flex items-center gap-2.5 w-full text-left px-3 py-2.5 rounded-[var(--radius-sm)] text-sm transition-all duration-150 hover:bg-primary/5 active:scale-[0.98]",style:{color:"var(--color-text-primary)"},children:[a.jsx(k,{name:f.icon,size:16,className:"text-primary shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-semibold text-sm",children:f.title}),a.jsx("div",{className:"text-xs truncate",style:{color:"var(--color-text-secondary)"},children:f.desc})]}),a.jsx(k,{name:"chevron-down",size:16,style:{color:"var(--color-text-secondary)"},className:u?"rotate-180":""})]}),a.jsx(Cr,{className:"overflow-hidden transition-all duration-200",children:a.jsx("div",{className:"px-3 pb-3 pt-1",children:i})})]})}function O0({files:n}){return a.jsx("div",{className:"space-y-3",children:n.map(i=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(k,{name:"file-text",size:12,style:{color:"var(--color-text-secondary)"}}),a.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-text-secondary)"},children:i.path})]}),i.content?a.jsx("div",{className:"p-3 rounded-[var(--radius-sm)] text-sm leading-relaxed",style:{backgroundColor:"var(--color-bg-surface)"},children:a.jsx(ml,{content:i.content})}):a.jsx("p",{className:"text-xs italic",style:{color:"var(--color-text-secondary)"},children:"(vazio)"})]},i.path))})}function R0({l2:n}){return a.jsxs("div",{className:"space-y-3",children:[n.focus&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(k,{name:"star",size:12,style:{color:"var(--color-text-secondary)"}}),a.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-text-secondary)"},children:".letra/focus.md"}),n.focus.specName&&a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:"var(--color-primary)",color:"var(--color-primary)"},children:n.focus.specName})]}),n.focus.content?a.jsx("div",{className:"p-3 rounded-[var(--radius-sm)] text-sm leading-relaxed",style:{backgroundColor:"var(--color-bg-surface)"},children:a.jsx(ml,{content:n.focus.content})}):a.jsx("p",{className:"text-xs italic",style:{color:"var(--color-text-secondary)"},children:"(sem conteúdo de foco)"})]}),n.spec&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(k,{name:"file-text",size:12,style:{color:"var(--color-text-secondary)"}}),a.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-text-secondary)"},children:n.spec.path})]}),a.jsx("div",{className:"p-3 rounded-[var(--radius-sm)] text-sm leading-relaxed",style:{backgroundColor:"var(--color-bg-surface)"},children:a.jsx(ml,{content:n.spec.content})})]}),!n.focus&&!n.spec&&a.jsx("p",{className:"text-xs italic",style:{color:"var(--color-text-secondary)"},children:"Nenhum foco ou spec ativo no momento."})]})}function _0({l3:n}){return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-sm)] text-xs",style:{backgroundColor:"var(--color-bg-surface)"},children:[a.jsx(k,{name:"alert-triangle",size:12,className:"text-amber-500"}),a.jsxs("span",{children:[n.alertCount," alerta(s) ativo(s)"]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-sm)] text-xs",style:{backgroundColor:"var(--color-bg-surface)"},children:[a.jsx(k,{name:"activity",size:12,style:{color:"var(--color-text-secondary)"}}),a.jsxs("span",{children:[n.sessionEventCount," evento(s) na sessão"]})]})]}),n.alerts.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold mb-1.5 uppercase tracking-wider",style:{color:"var(--color-text-secondary)"},children:"Alertas recentes"}),a.jsx("div",{className:"space-y-1",children:n.alerts.map(i=>a.jsxs("div",{className:"flex items-start gap-2 px-2.5 py-1.5 rounded-[var(--radius-sm)] text-xs",style:{backgroundColor:"var(--color-bg-surface)"},children:[a.jsx(k,{name:"alert-circle",size:12,style:{color:i.severity==="alta"?"var(--color-danger)":"var(--color-warning)"}}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"font-medium",children:i.id}),a.jsx("div",{style:{color:"var(--color-text-secondary)"},children:i.message})]})]},i.id))})]})]})}function L0({l4:n}){return a.jsxs("div",{className:"space-y-3",children:[n.constraintsContent&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(k,{name:"file-text",size:12,style:{color:"var(--color-text-secondary)"}}),a.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-text-secondary)"},children:".letra/constraints.md"})]}),a.jsx("div",{className:"p-3 rounded-[var(--radius-sm)] text-sm leading-relaxed",style:{backgroundColor:"var(--color-bg-surface)"},children:a.jsx(ml,{content:n.constraintsContent})})]}),n.glossaryContent&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(k,{name:"file-text",size:12,style:{color:"var(--color-text-secondary)"}}),a.jsx("span",{className:"text-xs font-mono",style:{color:"var(--color-text-secondary)"},children:".letra/glossary.md"})]}),a.jsx("div",{className:"p-3 rounded-[var(--radius-sm)] text-sm leading-relaxed",style:{backgroundColor:"var(--color-bg-surface)"},children:a.jsx(ml,{content:n.glossaryContent})})]}),!n.constraintsContent&&!n.glossaryContent&&a.jsx("p",{className:"text-xs italic",style:{color:"var(--color-text-secondary)"},children:"Nenhuma regra ou restrição adicional."})]})}function H0(){const[n,i]=x.useState(null),[c,u]=x.useState(!0),{copy:d,copied:f}=D0();return x.useEffect(()=>{fetch("/api/harness-viewer").then(h=>h.ok?h.json():Promise.reject()).then(h=>{i(h),u(!1)}).catch(()=>{u(!1)})},[]),c?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("p",{className:"text-sm animate-pulse",style:{color:"var(--color-text-secondary)"},children:"Carregando..."})}):n?a.jsxs("div",{className:"flex flex-col min-h-0 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b shrink-0",style:{borderColor:"var(--color-border)"},children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Composição da Configuração"}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:"Camadas do prompt compilado para o agente"})]}),a.jsxs(q,{type:"button",onClick:()=>{const h=JSON.stringify(n,null,2);d(h)},className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-sm)] text-xs transition-all duration-150 hover:bg-primary/10 active:scale-95",style:{backgroundColor:"var(--color-bg-surface)"},"aria-label":"Copiar dados da configuração",children:[a.jsx(k,{name:f?"check":"copy",size:12}),f?"Copiado!":"Copiar"]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-1",children:[a.jsx(Vi,{layerKey:"l1",defaultOpen:!0,children:a.jsx(O0,{files:n.layers.l1})}),a.jsx(Vi,{layerKey:"l2",defaultOpen:!0,children:a.jsx(R0,{l2:n.layers.l2})}),a.jsx(Vi,{layerKey:"l3",children:a.jsx(_0,{l3:n.layers.l3})}),a.jsx(Vi,{layerKey:"l4",children:a.jsx(L0,{l4:n.layers.l4})})]})]}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Não foi possível carregar os dados da configuração."})})}const B0={read_code:"Ler código",write_code:"Escrever código",run_tests:"Executar testes",write_spec:"Escrever especificações",generate_doc:"Gerar documentação",comment_pr:"Comentar PR",suggest_changes:"Sugerir alterações",scan_dependencies:"Escaneiar dependências",report_findings:"Reportar vulnerabilidades",create_pr:"Criar PR",assign_reviewers:"Atribuir revisores"},U0={analyst:"search",builder:"code",reviewer:"info",security:"shield","pr-bot":"user"};function q0(){const[n,i]=x.useState([]),[c,u]=x.useState(!0);return x.useEffect(()=>{fetch("/api/harness/roles").then(d=>d.json()).then(d=>{Array.isArray(d)&&i(d),u(!1)}).catch(()=>{i([]),u(!1)})},[]),c?a.jsx("div",{className:"flex h-full items-center justify-center p-6",children:a.jsx("p",{className:"animate-pulse text-sm text-[var(--color-text-secondary)]",children:"Carregando papéis..."})}):n.length===0?a.jsx("div",{className:"flex h-full items-center justify-center p-6 text-center",children:a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Nenhum papel configurado no harness."})}):a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Papéis do Harness"}),a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Agentes disponíveis no fluxo e suas capacidades."})]}),a.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:n.map(d=>a.jsx("div",{className:"app-section-card p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--color-bg-sunken)]",children:a.jsx(k,{name:U0[d.id]??"user",size:16,className:"text-[var(--color-text-secondary)]"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:d.label}),a.jsx(ke,{variant:"info",tone:"soft",className:"text-[10px]",children:d.id})]}),a.jsx("p",{className:"mt-1 text-xs text-[var(--color-text-secondary)]",children:d.description}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:(d.allowedStages??[]).map(f=>a.jsx(ke,{variant:"amber",tone:"soft",className:"text-[10px]",children:f},f))}),(d.capabilities??[]).length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("p",{className:"mb-1 text-[10px] font-medium uppercase text-[var(--color-text-secondary)]",children:"Capacidades"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:(d.capabilities??[]).map(f=>a.jsx("span",{className:"inline-flex items-center gap-1 rounded bg-[var(--color-bg-sunken)] px-1.5 py-0.5 text-[10px] text-[var(--color-text-secondary)]",children:B0[f]||f},f))})]})]})]})},d.id))})]})}const V0=`# Spec: {{name}}
|
|
202
|
+
|
|
203
|
+
> Updated: {{date}}
|
|
204
|
+
|
|
205
|
+
## Outcome
|
|
206
|
+
|
|
207
|
+
O que o usuário consegue fazer quando isso estiver pronto.
|
|
208
|
+
|
|
209
|
+
## Constraints
|
|
210
|
+
|
|
211
|
+
- Limitação técnica ou de negócio
|
|
212
|
+
|
|
213
|
+
## Exclusions
|
|
214
|
+
|
|
215
|
+
O que explicitamente NÃO está neste escopo.
|
|
216
|
+
|
|
217
|
+
## Acceptance Criteria
|
|
218
|
+
|
|
219
|
+
- [ ] **Critério 1**: Descrição binária (passa/falha).
|
|
220
|
+
- [ ] **Critério 2**: Descrição binária (passa/falha).
|
|
221
|
+
|
|
222
|
+
## Context
|
|
223
|
+
|
|
224
|
+
Por que estamos construindo isso. Trade-offs considerados. Decisões anteriores relevantes.
|
|
225
|
+
`;function G0(n){const i=n.split(`
|
|
226
|
+
`),c=[];let u=!1;return i.forEach((d,f)=>{if(/^## Acceptance Criteria/.test(d))u=!0;else if(/^## /.test(d)&&u)u=!1;else if(u){const h=d.match(/^\s*-\s+\[(\s|x)\]\s+(.+)/i);h&&c.push({text:h[2],checked:h[1].toLowerCase()==="x",line:f})}}),c}function Y0(n){const i=n.match(/## Outcome\s+([\s\S]*?)(?=\n## |$)/);return i?i[1].replace(/\*\*/g,"").replace(/\n+/g," ").trim():""}function $0(n){const i=[],c=["Outcome","Constraints","Exclusions","Acceptance Criteria","Context"];for(const d of c)new RegExp(`## ${d}`).test(n)||i.push({type:"error",msg:`Seção obrigatória ausente: ## ${d}`});const u=n.match(/## Acceptance Criteria\s+([\s\S]*?)(?=\n## |$)/);return u&&[...u[1].matchAll(/-\s+\[(\s|x)\]\s+/g)].length===0&&i.push({type:"warning",msg:"Critérios de aceite sem itens de checklist"}),n.length>3e3&&i.push({type:"warning",msg:"Especificação excede 3000 caracteres; considere manter enxuta"}),{id:"",issues:i,valid:i.filter(d=>d.type==="error").length===0}}function Q0(n,i,c){const u=n.split(`
|
|
227
|
+
`),f=u[i].match(/^(\s*-\s+\[)(\s|x)(\]\s+.*)/i);return f&&(u[i]=`${f[1]}${c?"x":" "}${f[3]}`),u.join(`
|
|
228
|
+
`)}function jp(n,i){const c=new Date().toISOString().split("T")[0];return n.replace(/(# Spec:?)\s*.*/,`$1 ${i}`).replace(/\{\{date\}\}/g,c)}function ku(n){const i=n.match(/> Updated:\s*(\d{4}-\d{2}-\d{2})/);return i?i[1]:""}function X0(n){if(!n)return"";const[i,c,u]=n.split("-");return`${u}/${c}/${i}`}function Z0(n){return n?n.valid?n.issues.some(i=>i.type==="warning")?"warning":"success":"danger":"neutral"}function K0({tone:n}){return n==="danger"?a.jsx(k,{name:"x",size:14,className:"text-[var(--color-danger)]"}):n==="warning"?a.jsx(k,{name:"alert-triangle",size:14,className:"text-[var(--color-warning)]"}):n==="success"?a.jsx(k,{name:"check",size:14,className:"text-[var(--color-success)]"}):a.jsx(k,{name:"circle",size:14,className:"text-[var(--color-text-secondary)]"})}function J0({spec:n,selected:i,validation:c,onSelect:u,onValidate:d}){const f=Z0(c),h=Y0(n.content),p=X0(ku(n.content)),j=(c==null?void 0:c.issues.filter(b=>b.type==="error").length)??0,v=(c==null?void 0:c.issues.filter(b=>b.type==="warning").length)??0;return a.jsx(q,{type:"button",variant:"ghost",onClick:u,onContextMenu:b=>{b.preventDefault(),d()},"aria-pressed":i,className:_t("h-auto w-full justify-start rounded-[var(--radius-sm)] border border-transparent px-3 py-3 text-left","hover:border-[var(--color-border)] hover:bg-[var(--surface-hover)]",i&&"border-[var(--color-border)] bg-[var(--surface-selected)] shadow-sm"),children:a.jsxs("span",{className:"grid min-w-0 flex-1 gap-2",children:[a.jsxs("span",{className:"flex min-w-0 items-start gap-2",children:[a.jsx("span",{className:"mt-0.5 shrink-0",children:a.jsx(K0,{tone:f})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-semibold text-[var(--color-text-primary)]",children:n.id}),h?a.jsx("span",{className:"mt-1 line-clamp-2 block text-xs font-normal leading-snug text-[var(--color-text-secondary)]",children:h}):null]})]}),a.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 pl-6",children:[c&&c.issues.length>0?a.jsxs(ke,{variant:c.valid?"amber":"error",tone:"soft",children:[j," erros · ",v," avisos"]}):c?a.jsx(ke,{variant:"success",children:"Válida"}):a.jsx(ke,{variant:"info",tone:"outline",children:"Não validada"}),p?a.jsx("span",{className:"text-caption tabular-nums text-[var(--color-text-secondary)]",children:p}):null]})]})})}function W0(){var Oe,be;const{toast:n}=yr(),[i,c]=x.useState([]),[u,d]=x.useState(null),[f,h]=x.useState(""),[p,j]=x.useState("all"),[v,b]=x.useState(!1),[y,z]=x.useState(""),[S,T]=x.useState(new Map),B=x.useRef(new Set),K=x.useCallback(()=>{fetch("/api/specs").then(Z=>Z.json()).then(Z=>{Array.isArray(Z)&&c(Z)}).catch(()=>{})},[]);x.useEffect(()=>{K()},[K]),x.useEffect(()=>{if(i.length===0)return;const Z=new Map(S);let ee=!1;for(const de of i)if(!B.current.has(de.id)){const ge=$0(de.content);ge.id=de.id,Z.set(de.id,ge),B.current.add(de.id),ee=!0}ee&&T(Z),!u&&!v&&d(i[0].id)},[i,u,v,S]);const le=i.find(Z=>Z.id===u),ve=x.useMemo(()=>le?G0(le.content):[],[le]),oe=ve.filter(Z=>Z.checked).length,ne=[...i].sort((Z,ee)=>{const de=ku(Z.content),ge=ku(ee.content);return!de&&!ge?Z.id.localeCompare(ee.id):de?ge?ge.localeCompare(de):-1:1}).filter(Z=>{if(f){const de=f.toLowerCase();if(!Z.id.toLowerCase().includes(de)&&!Z.content.toLowerCase().includes(de))return!1}const ee=S.get(Z.id);switch(p){case"errors":return ee&&!ee.valid;case"warnings":return ee==null?void 0:ee.issues.some(de=>de.type==="warning");case"valid":return ee==null?void 0:ee.valid;default:return!0}});function me(Z){d(Z),b(!1)}function ue(Z){fetch(`/api/specs/${Z}/validate`,{method:"POST"}).then(ee=>ee.json()).then(ee=>{T(ge=>new Map(ge).set(Z,ee));const de=ee.issues.filter(ge=>ge.type==="error").length;de===0?n("Spec válida","success"):n(`${de} erro(s) encontrado(s)`,"error")})}function _(){if(!y.trim())return;const Z=y.trim().toLowerCase().replace(/\s+/g,"-"),ee=jp(V0,Z);fetch("/api/specs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Z,content:ee})}).then(de=>de.json()).then(de=>{de&&!de.error&&(b(!1),z(""),d(Z),K())})}function he(Z){return Z==="all"?i.length:i.filter(ee=>{const de=S.get(ee.id);switch(Z){case"errors":return de&&!de.valid;case"warnings":return de==null?void 0:de.issues.some(ge=>ge.type==="warning");case"valid":return de==null?void 0:de.valid;default:return!0}}).length}return a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden lg:flex-row",children:[a.jsxs("aside",{className:"app-surface-panel flex max-h-[46svh] w-full shrink-0 flex-col overflow-hidden border-b border-l-0 border-r-0 border-t-0 lg:max-h-none lg:w-[24rem] lg:border-b-0 lg:border-r",children:[a.jsxs("div",{className:"grid shrink-0 gap-3 border-b border-border p-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Especificações"}),a.jsx("p",{className:"text-xs text-[var(--color-text-secondary)]",children:"Outcomes, constraints e critérios aprovados."})]}),a.jsxs(q,{size:"sm",variant:"secondary",onClick:()=>{b(!0),d(null)},children:[a.jsx(k,{name:"plus",size:14}),"Nova"]})]}),a.jsx(ct,{placeholder:"Buscar especificações...",value:f,onChange:Z=>h(Z.target.value),"aria-label":"Buscar especificações"}),a.jsx("div",{className:"overflow-x-auto",tabIndex:0,children:a.jsx(Ji,{ariaLabel:"Filtrar especificações",className:"w-max flex-nowrap lg:w-full",children:[{id:"all",label:"Todas"},{id:"errors",label:"Erros"},{id:"warnings",label:"Avisos"},{id:"valid",label:"Válidas"}].map(Z=>a.jsx(Wi,{selected:p===Z.id,count:he(Z.id),onClick:()=>j(Z.id),className:"justify-center lg:flex-1",title:Z.id==="errors"?"Especificações com erro de validação":Z.id==="warnings"?"Especificações com avisos":Z.id==="valid"?"Especificações válidas":"Todas as especificações",children:Z.label},Z.id))})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-2",tabIndex:0,children:[v?a.jsxs("div",{className:"mb-2 grid gap-2 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-bg-surface)] p-3",children:[a.jsx(ct,{placeholder:"Nome da especificação (ex: fluxo-de-autenticacao)",value:y,onChange:Z=>z(Z.target.value),"aria-label":"Nome da nova especificação",autoFocus:!0}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(q,{size:"sm",onClick:_,children:"Criar"}),a.jsx(q,{size:"sm",variant:"ghost",onClick:()=>b(!1),children:"Cancelar"})]})]}):null,a.jsx("div",{className:"grid gap-1",children:ne.map(Z=>a.jsx(J0,{spec:Z,selected:u===Z.id,validation:S.get(Z.id),onSelect:()=>me(Z.id),onValidate:()=>ue(Z.id)},Z.id))}),ne.length===0&&!v?a.jsx("p",{className:"px-3 py-4 text-center text-sm text-[var(--color-text-secondary)]",children:f?"Nenhuma especificação encontrada.":"Nenhuma especificação registrada."}):null]})]}),a.jsx("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:le?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid shrink-0 gap-3 border-b border-border px-4 py-3 lg:px-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(ke,{variant:"info",tone:"outline",children:[ve.length," critérios"]}),a.jsxs(ke,{variant:oe===ve.length&&ve.length>0?"success":"amber",children:[oe,"/",ve.length," concluídos"]}),a.jsxs(q,{size:"sm",variant:"secondary",onClick:()=>ue(le.id),children:[a.jsx(k,{name:"check",size:14}),"Validar"]})]}),S.get(le.id)?a.jsxs("div",{className:"flex flex-wrap gap-2",children:[(Oe=S.get(le.id))==null?void 0:Oe.issues.map((Z,ee)=>a.jsxs(ke,{variant:Z.type==="error"?"error":"amber",tone:"soft",children:[Z.type==="error"?"Erro":"Aviso"," ·"," ",Z.msg]},`${Z.msg}-${ee}`)),((be=S.get(le.id))==null?void 0:be.issues.length)===0?a.jsx(ke,{variant:"success",children:"Especificação válida"}):null]}):null,ve.length>0?a.jsx("div",{className:"grid max-h-40 gap-2 overflow-y-auto pr-1",tabIndex:0,children:ve.map(Z=>a.jsx(Sn,{checked:Z.checked,label:Z.text,onChange:ee=>{const de=Q0(le.content,Z.line,ee.target.checked);fetch(`/api/specs/${le.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:de})}).then(()=>K())}},Z.line))}):null]}),a.jsx(Eu,{file:le.id,initialContent:le.content,onSave:async Z=>{const ee=jp(Z,le.id);await fetch(`/api/specs/${le.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ee})}),K()},title:le.id,description:"Especificação de funcionalidade: define objetivo, restrições, critérios de aceite e contexto."},le.id)]}):a.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-center",children:a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Selecione uma especificação ou crie uma nova."})})})]})}const I0=[{title:"Verdade do workspace",sources:[{id:"context.md",label:"Contexto do workspace",description:"Propósito, estado atual, domínio e restrições em vigor.",icon:"context"},{id:"glossary.md",label:"Glossário",description:"Linguagem comum para decisões, specs e comunicação.",icon:"search"},{id:"decisions",label:"Decisões",description:"Registro de escolhas relevantes e seus motivos.",icon:"list-three"}]},{title:"Regras de governança",sources:[{id:"constitution.md",label:"Constituição",description:"Regras não negociáveis de produto, arquitetura e workflow.",icon:"star"},{id:"harness",label:"Harness",description:"Autoridade versionada que define fluxos, gates e agentes.",icon:"cpu"},{id:"roles",label:"Papéis",description:"Quem são os agentes e suas capacidades no fluxo.",icon:"user"}]},{title:"Trabalho especificado",sources:[{id:"specs",label:"Especificações",description:"Outcomes, constraints e critérios de aceite aprovados.",icon:"specs"}]}],Np={"context.md":{description:"Fonte de verdade operacional do workspace: propósito, domínio, estado atual e restrições."},"constitution.md":{description:"Regras fundamentais que governam decisões, implementação, supervisão humana e regressão."},"glossary.md":{description:"Termos e definições para manter a linguagem do produto consistente."},decisions:{description:"Registro de decisões e seus contextos operacionais."},specs:{description:"Especificações ativas do workspace e seus critérios de aceite."},harness:{description:"Autoridade versionada que define como o workspace deve operar."},roles:{description:"Agentes disponíveis no fluxo e suas capacidades."}};function ju(n){const i=n.match(/^#\s+(.+)/m);return i?i[1]:""}function F0(n){const i=n.match(/^(\d{4}-\d{2}-\d{2})/);if(i){const[c,u,d]=i[1].split("-");return`${d}/${u}/${c}`}return n.replace(/\.md$/,"").replace(/-/g," ")}function P0({entry:n,selected:i,onSelect:c}){return a.jsxs(q,{type:"button",variant:"ghost",onClick:c,role:"tab","aria-selected":i,className:_t("h-auto min-w-[15rem] flex-1 items-start justify-start gap-2.5 rounded-[var(--radius-sm)] border border-transparent px-3 py-2.5 text-left md:min-w-0","hover:border-[var(--color-border)] hover:bg-[var(--surface-hover)]",i&&"border-[var(--color-border)] bg-[var(--surface-selected)] text-[var(--color-primary)] shadow-sm"),children:[a.jsx(k,{name:n.icon,size:16,className:_t("mt-0.5 shrink-0",i?"text-[var(--color-primary)]":"text-[var(--color-text-secondary)]")}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-medium leading-tight",children:n.label}),a.jsx("span",{className:_t("mt-1 line-clamp-2 block text-xs font-normal leading-snug",i?"text-[var(--color-primary)]":"text-[var(--color-text-secondary)]"),children:n.description})]})]})}function e1({initialTab:n="context.md"}){var z;const[i,c]=x.useState(n),[u,d]=x.useState(""),[f,h]=x.useState([]),[p,j]=x.useState(null),[v,b]=x.useState(!0);x.useEffect(()=>{c(n),j(null)},[n]),x.useEffect(()=>{if(b(!0),i==="specs"||i==="harness"||i==="roles"){b(!1);return}if(i==="decisions"){fetch("/api/context?file=decisions").then(S=>S.ok?S.json():Promise.reject()).then(S=>{Array.isArray(S)&&h(S),b(!1)}).catch(()=>{h([]),b(!1)});return}fetch(`/api/context?file=${i}`).then(S=>S.ok?S.text():Promise.reject()).then(S=>{d(S||`# ${i}
|
|
229
|
+
|
|
230
|
+
Arquivo vazio.`),b(!1)}).catch(()=>{d(`# ${i}
|
|
231
|
+
|
|
232
|
+
Arquivo não encontrado ou indisponível.`),b(!1)})},[i]);const y=f.find(S=>S.name===p);return a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden md:flex-row",children:[a.jsxs("aside",{className:"app-surface-panel flex max-h-[42svh] w-full shrink-0 flex-col overflow-hidden border-b border-l-0 border-r-0 border-t-0 md:max-h-none md:w-80 md:border-b-0 md:border-r",children:[a.jsxs("div",{className:"shrink-0 border-b border-border px-4 py-4",children:[a.jsxs("h1",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(k,{name:"book",size:16,className:"text-[var(--color-primary)]"}),"Biblioteca de governança"]}),a.jsx("p",{className:"mt-1 text-xs leading-relaxed text-[var(--color-text-secondary)]",children:"Contexto, regras e specs que explicam o que pode ser feito e por quê."})]}),a.jsx("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto overflow-y-hidden p-3 md:flex-col md:gap-4 md:overflow-x-hidden md:overflow-y-auto",children:I0.map(S=>a.jsxs("section",{className:"flex min-w-[17rem] flex-col gap-1 md:min-w-0",children:[a.jsx("h3",{className:"px-1 text-xs font-semibold uppercase text-[var(--color-text-secondary)]",children:S.title}),a.jsx("div",{role:"tablist","aria-label":S.title,children:S.sources.map(T=>a.jsx(P0,{entry:T,selected:i===T.id,onSelect:()=>{c(T.id),j(null)}},T.id))})]},S.title))}),i==="decisions"&&f.length>0?a.jsxs("div",{className:"shrink-0 border-t border-border",children:[a.jsxs("h3",{className:"flex items-center gap-1.5 px-4 py-2 text-xs font-semibold uppercase text-[var(--color-text-secondary)]",children:[a.jsx(k,{name:"list-three",size:14}),"Decisões (",f.length,")"]}),a.jsx("div",{className:"flex max-h-40 flex-col gap-0.5 overflow-y-auto px-2 pb-2 md:max-h-64",children:f.map(S=>a.jsxs(q,{type:"button",variant:"ghost",onClick:()=>j(S.name),className:_t("h-auto w-full justify-start gap-2 rounded-[var(--radius-sm)] px-3 py-2 text-left text-sm","hover:bg-[var(--surface-hover)]",p===S.name&&"bg-[var(--surface-selected)] text-[var(--color-primary)]"),children:[a.jsx(k,{name:"chevron-right",size:14,className:_t("shrink-0",p===S.name?"text-[var(--color-primary)]":"text-[var(--color-text-secondary)]")}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-xs text-[var(--color-text-secondary)]",children:F0(S.name)}),a.jsx("span",{className:"block truncate",children:ju(S.content)||S.name})]})]},S.name))})]}):null]}),a.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:v?a.jsx("div",{className:"flex h-full animate-fade-in items-center justify-center",children:a.jsx("p",{className:"animate-pulse text-sm text-[var(--color-text-secondary)]",children:"Carregando..."})}):i==="harness"?a.jsx(H0,{}):i==="roles"?a.jsx(q0,{}):i==="specs"?a.jsx(W0,{}):i==="decisions"&&y?a.jsx(Eu,{file:`decisions/${y.name}`,initialContent:y.content,onSave:async S=>{await fetch(`/api/context?file=decisions/${y.name}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:S})});const B=await(await fetch("/api/context?file=decisions")).json();Array.isArray(B)&&h(B)},title:ju(y.content)||y.name,description:Np.decisions.description},`${i}-${p}`):i==="decisions"?a.jsx("div",{className:"flex h-full animate-fade-in items-center justify-center p-6 text-center",children:a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Selecione uma decisão para visualizar."})}):a.jsx(Eu,{file:i,initialContent:u,onSave:async S=>{await fetch(`/api/context?file=${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:S})})},title:ju(u)||i,description:(z=Np[i])==null?void 0:z.description},i)})]})}function t1(n){return{item:"Item",spec:"Especificação",ac:"Critério",gate:"Aprovação",workspace:"Ambiente",execution:"Execução",artifact:"Artefato"}[n]||n}const a1={ac_done:"Critério concluído",ac_complete:"Critério concluído",item_move:"Item movido",item_release:"Item liberado",spec_create:"Especificação criada",spec_update:"Especificação atualizada",validate:"Validação",diagnose:"Diagnóstico",health_scan:"Verificação de saúde",health_ack:"Alerta reconhecido",health_dismiss:"Alerta descartado",focus_set:"Foco definido",focus_sync:"Foco sincronizado",focus_clear:"Foco limpo",decision:"Decisão registrada",sitrep:"Situação atualizada",system:"Automação",manual:"Ação manual",session_end:"Sessão encerrada",agent_direction_read:"Direção consultada",agent_validation_run:"Validação executada",agent_ac_completion_requested:"Conclusão solicitada",agent_transition_requested:"Transição solicitada",agent_operation_rejected:"Operação rejeitada",flow_move:"Movimento no fluxo",flow_init:"Fluxo inicializado",flow_import:"Fluxo importado",flow_export:"Fluxo exportado",harness_load:"Configuração carregada",mcp_serve:"MCP iniciado",workspace_init:"Ambiente inicializado",workspace_switch:"Ambiente alternado"};function Nu(n){return a1[n]||n}const s1=[{label:"Todos",value:""},{label:"Humano",value:"human"},{label:"Agente",value:"flow"},{label:"Sistema",value:"system"},{label:"Execução",value:"execution"}];function Sp(n){const i=new Date(n),u=Math.floor((new Date().getTime()-i.getTime())/864e5);return u===0?{label:"Hoje",order:0}:u===1?{label:"Ontem",order:1}:u<=7?{label:"Esta semana",order:2}:u<=30?{label:"Este mês",order:3}:{label:"Mais antigo",order:4}}function wp(n){try{return new Date(n).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}catch{return n}}function Su(n){try{return new Date(n).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return n}}function Cp(n){var c,u;if(n.kind!=="system")return null;const i=n.correlationId||((c=n.details)==null?void 0:c.actionId);return i?`${i}:${((u=n.details)==null?void 0:u.outcome)||"unknown"}`:null}function zp(n){return n==="succeeded"?"success":n==="failed"||n==="blocked"?"amber":"info"}function l1(n){return n.status==="failed"||n.status==="blocked"?"error":n.status==="succeeded"?"success":n.kind==="system"?"info":n.kind==="human"?"default":"agent"}function n1(n){return n.status==="failed"||n.status==="blocked"?"circle-x":n.status==="succeeded"?"circle-check":n.kind==="system"?"activity":n.kind==="human"?"user":"bot"}function Ol(n,i){var u;const c=(u=n.details)==null?void 0:u[i];return typeof c=="string"&&c.trim()?c.trim():null}function Tu(n){return t1(n)}function r1(n){const i=[];n.subject&&i.push({label:Tu(n.subject.type),value:n.subject.id,tone:"info"});const c=Ol(n,"decisionFile");c&&i.push({label:"Decisão",value:c,tone:"info"});const u=Ol(n,"path");return u&&i.push({label:"Arquivo",value:u,tone:"info"}),i}function i1(n){var c,u;const i=Ol(n,"path")??Ol(n,"decisionFile");return{who:n.actor.label,what:n.summary||n.action,where:((c=n.subject)==null?void 0:c.id)||i||Ol(n,"source")||"Workspace",result:Ol(n,"outcome")||((u=n.details)==null?void 0:u.effect)||"Registrado como evidência",why:n.reason||Ol(n,"trigger")||null,evidence:r1(n)}}function o1(){var ie;const[n,i]=x.useState([]),[c,u]=x.useState({kinds:{},statuses:{},sources:{},actions:{}}),[d,f]=x.useState(0),[h,p]=x.useState(1),[j,v]=x.useState(!0),[b,y]=x.useState(null),[z,S]=x.useState(""),[T,B]=x.useState(""),[K,le]=x.useState(""),[ve,oe]=x.useState(""),[$,ne]=x.useState(""),[me,ue]=x.useState(!1),[_,he]=x.useState(null),[Oe,be]=x.useState(!1),[Z,ee]=x.useState(new Set),[de,ge]=x.useState(new Set(["Hoje","Ontem"])),E=50;x.useEffect(()=>{const U=setTimeout(()=>B(z),300);return()=>clearTimeout(U)},[z]);const W=x.useCallback(async U=>{v(!0),y(null);try{const M=new URLSearchParams;T&&M.set("q",T),K&&M.set("action",K),$&&M.set("since",$),me&&M.set("debug","true"),M.set("page",String(U)),M.set("limit",String(E));const X=await fetch(`/api/log?${M}`);if(!X.ok)throw new Error(`HTTP ${X.status}`);const te=await X.json();i(te.items||[]),u(te.facets||{kinds:{},statuses:{},sources:{},actions:{}}),f(te.total||0),p(te.page||1)}catch(M){y(M instanceof Error?M.message:"Falha ao carregar log"),i([]),f(0)}finally{v(!1)}},[T,K,$,me]);x.useEffect(()=>{p(1)},[T,K,ve,$,me]),x.useEffect(()=>{W(h)},[W,h]),x.useEffect(()=>{be(!1)},[_==null?void 0:_.id]);const pe=x.useMemo(()=>{const U=ve?n.filter(te=>te.kind===ve):n,M=[];let X=0;for(;X<U.length;){const te=Cp(U[X]);if(te){const Ge=[U[X]];let Se=X+1;for(;Se<U.length&&Cp(U[Se])===te;)Ge.push(U[Se]),Se++;Ge.length>1?Z.has(te)?M.push(...Ge):M.push({...Ge[0],_noiseCount:Ge.length,_noiseKey:te}):M.push(Ge[0]),X=Se}else M.push(U[X]),X++}return M},[n,ve,Z]),xe=x.useMemo(()=>{const U=new Map;for(const X of pe){const{label:te}=Sp(X.timestamp),Ge=U.get(te)||[];Ge.push(X),U.set(te,Ge)}const M={Hoje:0,Ontem:1,"Esta semana":2,"Este mês":3};return Array.from(U.entries()).map(([X,te])=>({label:X,entries:te,order:M[X]??4})).sort((X,te)=>X.order-te.order)},[pe]),G=x.useMemo(()=>{const U=n.length,M=n.filter(De=>De.kind==="system").length,X=n.filter(De=>De.kind==="human").length,te=n.filter(De=>De.kind==="execution"||De.kind==="flow").length,Ge=n.filter(De=>Sp(De.timestamp).label==="Hoje").length,Se=n.filter(De=>De.status==="succeeded").length,Le=n.filter(De=>De.status==="failed").length;return{totalEvents:U,systemEvents:M,humanEvents:X,agentEvents:te,todayEvents:Ge,succeededEvents:Se,failedEvents:Le}},[n]),N=Math.ceil(d/E),R=_?i1(_):null;function I(U){ee(M=>{const X=new Set(M);return X.has(U)?X.delete(U):X.add(U),X})}function D(U){ge(M=>{const X=new Set(M);return X.has(U)?X.delete(U):X.add(U),X})}return b?a.jsxs("div",{className:"app-section-shell items-center justify-center gap-3 p-12",children:[a.jsx(k,{name:"alert-circle",size:24,style:{color:"var(--color-danger)"}}),a.jsx("p",{className:"app-section-muted text-sm",children:b}),a.jsxs(q,{variant:"secondary",size:"sm",onClick:()=>W(1),children:[a.jsx(k,{name:"check",size:12}),"Tentar novamente"]})]}):a.jsxs("div",{className:"app-section-shell",children:[a.jsx(jr,{open:!!_,onOpenChange:U=>{U||he(null)},children:a.jsx(Nr,{side:"right",className:"w-full sm:max-w-3xl lg:max-w-4xl",children:_&&a.jsxs(a.Fragment,{children:[a.jsxs(Ii,{className:"items-start gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[a.jsx(ke,{variant:zp(_.status),tone:"soft",className:"text-caption uppercase",children:Nu(_.action)}),a.jsx(ke,{variant:_.kind==="human"||_.kind==="system"?"info":"agent",tone:"soft",children:_.actor.label}),_.status==="failed"||_.status==="blocked"?a.jsx(ke,{variant:"amber",tone:"soft",children:_.status}):null]}),a.jsx(Fi,{className:"leading-tight",children:"Evidência da atividade"}),a.jsx(Yu,{className:"mt-1",children:R?`${R.what} · ${Su(_.timestamp)}`:Su(_.timestamp)})]}),a.jsx(mx,{"aria-label":"Fechar detalhes da atividade",onClick:()=>he(null),children:a.jsx(k,{name:"x",size:16})})]}),a.jsxs("div",{className:"flex flex-1 flex-col gap-6 overflow-y-auto p-6",children:[R&&a.jsxs(Pe,{children:[a.jsx(Ka,{children:a.jsxs("div",{className:"grid gap-1",children:[a.jsx("h3",{className:"text-body font-semibold",children:"Resumo investigativo"}),a.jsxs("p",{className:"text-body-sm leading-relaxed text-[var(--color-text-secondary)]",children:[R.who," registrou"," ",a.jsx("strong",{className:"text-[var(--color-text-primary)]",children:R.what})," ","em"," ",a.jsx("strong",{className:"text-[var(--color-text-primary)]",children:R.where}),". Resultado: ",String(R.result),"."]})]})}),a.jsxs(it,{children:[a.jsx(Za,{items:[{label:"Ator",value:`${_.actor.label} (${_.actor.type})`,icon:a.jsx(k,{name:"user",size:14})},{label:"Quando",value:Su(_.timestamp),icon:a.jsx(k,{name:"clock",size:14})},{label:"Onde",value:((ie=_.subject)==null?void 0:ie.id)||R.where,icon:a.jsx(k,{name:"box",size:14})},{label:"Resultado",value:_.status,icon:a.jsx(k,{name:"check-circle",size:14})}]}),R.why?a.jsxs("div",{className:"grid gap-1 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-bg-sunken)] p-3",children:[a.jsx("h4",{className:"text-caption font-semibold uppercase text-[var(--color-text-tertiary)]",children:"Por quê"}),a.jsx("p",{className:"text-body-sm text-[var(--color-text-primary)]",children:String(R.why)})]}):null]})]}),R&&R.evidence.length>0?a.jsxs(Pe,{children:[a.jsx(Ka,{children:a.jsxs("div",{className:"grid gap-1",children:[a.jsx("h3",{className:"text-body font-semibold",children:"Evidências relacionadas"}),a.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Referências que sustentam este registro."})]})}),a.jsx(it,{children:a.jsx(Hs,{children:R.evidence.map(U=>a.jsx(Bs,{leading:a.jsx(k,{name:U.label==="Item"?"box":U.label==="Spec"?"specs":"activity",size:16}),title:U.value,meta:a.jsx(ke,{variant:U.tone,tone:"soft",children:U.label}),action:U.label==="Item"?a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>window.dispatchEvent(new CustomEvent("letra-open-item",{detail:U.value})),children:"Abrir"}):U.label==="Spec"?a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>window.dispatchEvent(new CustomEvent("letra-open-spec",{detail:U.value})),children:"Abrir"}):null},`${U.label}-${U.value}`))})})]}):null,a.jsxs(Pe,{children:[a.jsx(Ka,{children:a.jsxs("div",{className:"grid gap-1",children:[a.jsx("h3",{className:"text-body font-semibold",children:"Registro original"}),a.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Mensagem capturada na trilha de atividade."})]})}),a.jsxs(it,{className:"grid gap-3",children:[a.jsx("p",{className:"text-body-sm leading-relaxed text-[var(--color-text-primary)]",children:_.summary}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.correlationId?a.jsx(ot,{children:_.correlationId}):null,_.subject?a.jsxs(ot,{children:[Tu(_.subject.type),":"," ",_.subject.id]}):null,a.jsx(ot,{children:_.id})]})]})]}),_.details?a.jsx(Pe,{children:a.jsxs(Sr,{open:Oe,onOpenChange:be,children:[a.jsxs(wr,{className:"flex w-full items-center justify-between gap-3 p-4 text-left transition-colors hover:bg-[var(--color-bg-sunken)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-color)]",children:[a.jsxs("div",{className:"grid gap-1",children:[a.jsx("span",{className:"text-body font-semibold text-[var(--color-text-primary)]",children:"Detalhes técnicos"}),a.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"JSON bruto para auditoria e depuração."})]}),a.jsx(k,{name:Oe?"chevron-up":"chevron-down",size:16})]}),a.jsx(Cr,{children:a.jsx(it,{className:"border-t border-[var(--color-border)] pt-4",children:a.jsx("pre",{className:"max-h-80 overflow-auto rounded-[var(--radius-sm)] bg-[var(--color-bg-base)] p-4 text-caption text-[var(--color-text-secondary)]",children:JSON.stringify(_.details,null,2)})})})]})}):null]})]})})}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsxs("div",{className:"p-6",children:[a.jsxs(Pe,{className:"mb-6",children:[a.jsxs(Ka,{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[a.jsx(k,{name:"activity",size:18}),a.jsx(ke,{variant:"info",className:"text-caption",children:"trilha investigativa"})]}),a.jsx("h1",{className:"text-xl font-bold",children:"Atividade"}),a.jsx("p",{className:"app-section-muted mt-1 max-w-3xl text-sm",style:{color:void 0},children:"Origem, resultado e evidências do workspace em uma linha do tempo auditável."})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-right",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-lg font-bold",children:G.succeededEvents}),a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"sucesso"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-lg font-bold",style:{color:"var(--color-primary)"},children:G.failedEvents}),a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"falhas"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-lg font-bold",children:G.todayEvents}),a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"hoje"})]})]})]}),a.jsx(it,{children:a.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[a.jsxs("div",{className:"min-w-0 border-l pl-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Origem"}),a.jsx("p",{className:"mt-1 text-sm",children:"quem ou qual automação registrou"})]}),a.jsxs("div",{className:"min-w-0 border-l pl-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Evento"}),a.jsx("p",{className:"mt-1 text-sm",children:"o que mudou no trabalho"})]}),a.jsxs("div",{className:"min-w-0 border-l pl-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Evidência"}),a.jsx("p",{className:"mt-1 text-sm",children:"item, AC, decisão ou arquivo"})]}),a.jsxs("div",{className:"min-w-0 border-l pl-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Resultado"}),a.jsx("p",{className:"mt-1 text-sm",children:"efeito observável antes de agir"})]})]})})]}),me?a.jsx(Pe,{className:"mb-6 border-[var(--color-border-warning)]",children:a.jsxs(it,{className:"flex flex-wrap items-center justify-between gap-3 p-4",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[a.jsx(k,{name:"activity",size:18,className:"text-[var(--color-warning)]"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-body-sm font-semibold text-[var(--color-text-primary)]",children:"Eventos técnicos incluídos"}),a.jsxs("p",{className:"text-caption text-[var(--color-text-secondary)]",children:[G.systemEvents," automaçõ",G.systemEvents!==1?"es":"o"," nesta consulta"]})]})]}),a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>ue(!1),children:"Ocultar"})]})}):null,a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6",children:[a.jsx(Pe,{children:a.jsxs(it,{className:"p-4",children:[a.jsx("p",{className:"text-2xl font-bold",children:G.totalEvents}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:"Total"})]})}),a.jsx(Pe,{children:a.jsxs(it,{className:"p-4",children:[a.jsx("p",{className:"text-2xl font-bold",style:{color:"var(--color-text-secondary)"},children:G.systemEvents}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:"Sistema"})]})}),a.jsx(Pe,{children:a.jsxs(it,{className:"p-4",children:[a.jsx("p",{className:"text-2xl font-bold",style:{color:"var(--color-primary)"},children:G.humanEvents}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:"Humano"})]})}),a.jsx(Pe,{children:a.jsxs(it,{className:"p-4",children:[a.jsx("p",{className:"text-2xl font-bold",style:{color:"var(--color-success)"},children:G.agentEvents}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:"Agente"})]})})]}),a.jsx(Pe,{className:"mb-6",children:a.jsx(it,{className:"grid gap-4 p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("label",{className:"mb-1.5 block text-caption font-semibold uppercase text-[var(--color-text-tertiary)]",htmlFor:"activity-search",children:"Buscar"}),a.jsx(ct,{id:"activity-search",placeholder:"Buscar atividade e evidências...",value:z,onChange:U=>S(U.target.value),"aria-label":"Buscar atividade"})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"mb-1.5 text-caption font-semibold uppercase text-[var(--color-text-tertiary)]",children:"Ator"}),a.jsx(Ji,{ariaLabel:"Filtrar atividade por ator",className:"w-full sm:w-auto",children:s1.map(U=>a.jsx(Wi,{selected:ve===U.value,onClick:()=>oe(U.value),children:U.label},U.label))})]}),a.jsx("div",{className:"w-full min-w-0 sm:w-[220px]",children:a.jsx(mj,{id:"activity-since",label:"Desde",value:$,onChange:U=>ne(U.target.value)})}),a.jsxs("div",{className:"flex flex-wrap gap-2 lg:pb-0.5",children:[a.jsxs(q,{variant:"secondary",size:"sm",onClick:()=>W(h),children:[a.jsx(k,{name:"check",size:14}),"Atualizar"]}),(z||ve||$)&&a.jsx(q,{variant:"ghost",size:"sm",onClick:()=>{S(""),B(""),oe(""),ne("")},children:"Limpar"})]})]})})}),j?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Carregando..."})}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-2 py-16",children:[a.jsx(k,{name:"search",size:24,style:{color:"var(--color-text-secondary)"}}),a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Nenhuma atividade encontrada"})]}):a.jsx("div",{className:"space-y-6",children:xe.map(U=>{const M=de.has(U.label);return a.jsxs("section",{"aria-label":`${U.label} — ${U.entries.length} atividades`,children:[a.jsxs(q,{type:"button",variant:"ghost",onClick:()=>D(U.label),"aria-expanded":M,"aria-label":`${U.label} — ${U.entries.length} atividades`,className:"mb-3 h-auto justify-start gap-2 bg-transparent px-0 py-0 text-xs font-semibold uppercase hover:bg-transparent",style:{color:"var(--color-text-secondary)"},children:[a.jsx(k,{name:M?"chevron-down":"chevron-right",size:12}),U.label,a.jsxs("span",{className:"font-normal normal-case ml-1",children:[U.entries.length," atividade",U.entries.length!==1?"s":""]})]}),M&&a.jsx(Sj,{className:"rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-bg-surface)] p-4",children:U.entries.map((X,te)=>{var F;const Ge=X._noiseCount!==void 0,Se=X._noiseCount,Le=X._noiseKey,De=te===U.entries.length-1;return Ge?a.jsx(hp,{status:"info",icon:a.jsx(k,{name:Z.has(Le||"")?"chevron-down":"chevron-right",size:16}),title:Nu(X.action),description:`${Se} atividades similares agrupadas para reduzir ruído operacional.`,timestamp:wp(X.timestamp),action:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(ke,{variant:"info",tone:"soft",children:["x",Se]}),a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>Le&&I(Le),children:Z.has(Le||"")?"Recolher":"Expandir"})]}),last:De},`${X.id}-${te}`):a.jsx(hp,{status:l1(X),icon:a.jsx(k,{name:n1(X),size:16}),title:X.summary||X.action,description:`${X.actor.label} · ${((F=X.subject)==null?void 0:F.id)||"workspace"}`,timestamp:wp(X.timestamp),action:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ke,{variant:zp(X.status),tone:"soft",className:"text-caption uppercase",children:Nu(X.action)}),a.jsx(ke,{variant:X.kind==="human"||X.kind==="system"?"info":"agent",tone:"soft",className:"text-[10px]",children:X.actor.label}),X.subject?a.jsxs(ot,{variant:"info",children:[Tu(X.subject.type),": ",X.subject.id]}):null,a.jsx(q,{variant:"secondary",size:"sm",onClick:()=>he(X),children:"Detalhes"})]}),last:De},`${X.id}-${te}`)})})]},U.label)})}),d>0&&a.jsxs("div",{className:"app-section-muted mt-6 flex items-center justify-between border-t pt-4 text-xs",style:{borderColor:"var(--color-border)",color:void 0},children:[a.jsxs("span",{children:[d," atividade",d!==1?"s":""," no total"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(q,{variant:"secondary",size:"sm",disabled:h<=1,onClick:()=>p(U=>Math.max(1,U-1)),children:"Anterior"}),a.jsxs("span",{children:["Página ",h," de ",N]}),a.jsx(q,{variant:"secondary",size:"sm",disabled:h>=N,onClick:()=>p(U=>U+1),children:"Próxima"})]})]})]})})]})}const c1={id:"",displayName:"",role:"implementer",bio:"",avatar:{type:"initials",value:"AG"},color:"oklch(0.7 0.12 280)",skills:[],status:"offline",stageBindings:[],adapterHints:{}};function u1(){var z;const[n,i]=x.useState([]),[c,u]=x.useState(null),[d,f]=x.useState(""),[h,p]=x.useState(!1),j=()=>fetch("/api/agents").then(async S=>{if(!S.ok)throw new Error("Não foi possível carregar a equipe");return S.json()}).then(S=>Array.isArray(S)&&i(S)).catch(S=>f(S.message));x.useEffect(()=>{j()},[]);const v=(S,T)=>u(B=>B&&{...B,[S]:T});function b(S){v("skills",S.split(",").map(T=>({id:T.trim().toLowerCase().replace(/\s+/g,"-"),label:T.trim(),level:"intermediate",category:"engineering"})).filter(T=>T.label))}async function y(){if(!(c!=null&&c.id)||!c.displayName.trim()){f("ID e nome são obrigatórios");return}p(!0),f("");const S=n.some(T=>T.id===c.id);try{const T=await fetch(S?`/api/agents/${encodeURIComponent(c.id)}`:"/api/agents",{method:S?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!T.ok)throw new Error((await T.json()).error??"Falha ao salvar agente");u(null),await j()}catch(T){f(T.message)}finally{p(!1)}}return a.jsxs("div",{className:"grid gap-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold",children:"Equipe de agentes"}),a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Identidades, skills e status do harness."})]}),a.jsx(q,{onClick:()=>{f(""),u({...c1,id:`agent-${Date.now()}`})},children:"Novo agente"})]}),d&&a.jsx("p",{role:"alert",className:"text-sm text-red-600",children:d}),a.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:n.map(S=>a.jsx(Pe,{children:a.jsxs(it,{className:"gap-3 p-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(fx,{agent:S}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-semibold",children:S.displayName}),a.jsxs("p",{className:"text-xs text-[var(--color-text-secondary)]",children:[S.role," · ",S.status]})]}),a.jsx(q,{size:"sm",variant:"ghost",onClick:()=>u({...S}),children:"Editar"})]}),a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:S.bio}),a.jsx("div",{className:"flex flex-wrap gap-1",children:S.skills.map(T=>a.jsxs(ke,{variant:"info",tone:"soft",children:[T.label," · ",T.level]},T.id))})]})},S.id))}),c&&a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"agent-editor-title",className:"grid max-w-xl gap-3 rounded-lg border border-border bg-background p-4",children:[a.jsx("h2",{id:"agent-editor-title",className:"font-semibold",children:n.some(S=>S.id===c.id)?"Editar agente":"Novo agente"}),a.jsxs("label",{children:["ID",a.jsx(ct,{value:c.id,disabled:n.some(S=>S.id===c.id),onChange:S=>v("id",S.target.value)})]}),a.jsxs("label",{children:["Nome",a.jsx(ct,{value:c.displayName,onChange:S=>v("displayName",S.target.value)})]}),a.jsxs("label",{children:["Role",a.jsx(ct,{value:c.role,onChange:S=>v("role",S.target.value)})]}),a.jsxs("label",{children:["Bio",a.jsx(wn,{value:c.bio??"",onChange:S=>v("bio",S.target.value)})]}),a.jsxs("label",{children:["Avatar tipo",a.jsx(ct,{value:c.avatar.type,onChange:S=>v("avatar",{...c.avatar,type:S.target.value})})]}),a.jsxs("label",{children:["Avatar valor",a.jsx(ct,{value:c.avatar.value,onChange:S=>v("avatar",{...c.avatar,value:S.target.value})})]}),a.jsxs("label",{children:["Cor OKLCH",a.jsx(ct,{value:c.color,onChange:S=>v("color",S.target.value)})]}),a.jsxs("label",{children:["Status",a.jsxs("select",{className:"rounded border p-2",value:c.status,onChange:S=>v("status",S.target.value),children:[a.jsx("option",{children:"online"}),a.jsx("option",{children:"offline"}),a.jsx("option",{children:"busy"})]})]}),a.jsxs("label",{children:["Stages",a.jsx(ct,{value:c.stageBindings.join(", "),onChange:S=>v("stageBindings",S.target.value.split(",").map(T=>T.trim()).filter(Boolean))})]}),a.jsxs("label",{children:["Skills",a.jsx(ct,{value:c.skills.map(S=>S.label).join(", "),onChange:S=>b(S.target.value)})]}),a.jsxs("label",{children:["Hint generic",a.jsx(wn,{value:((z=c.adapterHints)==null?void 0:z.generic)??"",onChange:S=>v("adapterHints",{...c.adapterHints,generic:S.target.value})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(q,{disabled:h,onClick:y,children:h?"Salvando…":"Salvar"}),a.jsx(q,{variant:"ghost",onClick:()=>u(null),children:"Cancelar"})]})]})]})}function d1(n,i){const c=ha(n,i),u=new Map;for(const d of n.items){if(!d.claimedBy||Ra(d,n,i)!=="running")continue;const f=u.get(d.claimedBy)??{itemCount:0,stageIds:new Set};f.itemCount+=1,f.stageIds.add(d.stage),u.set(d.claimedBy,f)}return[...u.entries()].map(([d,f])=>({id:d,itemCount:f.itemCount,stageNames:[...f.stageIds].map(h=>{var p;return((p=c.find(j=>j.id===h))==null?void 0:p.name)??h})}))}function f1({workflow:n,activeFlow:i,loading:c}){if(c)return a.jsx(Wy,{});const u=Uj(i),d=d1(n,i),f=ha(n,i);return a.jsxs("main",{className:"grid flex-1 grid-cols-1 gap-6 overflow-auto p-6 lg:grid-cols-[minmax(0,1.4fr)_minmax(18rem,0.6fr)]",children:[a.jsxs("section",{className:"flex min-w-0 flex-col gap-4",children:[a.jsxs("header",{className:"flex flex-col gap-1",children:[a.jsx("h1",{className:"text-xl font-bold",children:"Papéis do flow"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[u.length," ",u.length===1?"papel":"papéis"," declarado",u.length===1?"":"s"," pelo harness ativo."]})]}),u.length===0?a.jsx(Pe,{children:a.jsx(fs,{icon:a.jsx(k,{name:"cpu",size:24}),title:"Nenhum papel declarado",description:"O flow atual não fornece papéis. A interface mantém uma apresentação neutra."})}):a.jsx("div",{className:"grid grid-cols-1 gap-3 xl:grid-cols-2",children:u.map(h=>{const p=h.allowedStages.map(j=>{var v;return((v=f.find(b=>b.id===j))==null?void 0:v.name)??j});return a.jsx(Pe,{children:a.jsxs(it,{className:"flex h-full flex-col gap-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-[var(--radius-sm)] bg-primary/10 text-primary",children:a.jsx(k,{name:"cpu",size:16})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"truncate text-sm font-semibold",children:h.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:h.description})]}),a.jsx(ke,{variant:"info",children:h.id})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Stages permitidos"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.length>0?p.map(j=>a.jsx(ke,{variant:"info",children:j},j)):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Não informado"})})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Capacidades"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.capabilities.length>0?h.capabilities.map(j=>a.jsx(ke,{variant:"info",children:j},j)):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Não informadas"})})]})]})},h.id)})})]}),a.jsxs("section",{className:"flex min-w-0 flex-col gap-4",children:[a.jsxs("header",{className:"flex flex-col gap-1",children:[a.jsx("h2",{className:"text-base font-semibold",children:"Atores em execução"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Presenças observadas nos itens do workspace."})]}),d.length===0?a.jsx(Pe,{children:a.jsx(fs,{icon:a.jsx(k,{name:"activity",size:24}),title:"Nenhum ator ativo",description:"Nenhum item está atribuído neste momento."})}):a.jsx("div",{className:"grid grid-cols-1 gap-3",children:d.map(h=>a.jsx(Pe,{children:a.jsxs(it,{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex size-9 items-center justify-center rounded-full bg-primary text-primary-foreground",children:a.jsx("span",{className:"text-xs font-bold",children:h.id.charAt(0).toUpperCase()})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-semibold",children:h.id}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.itemCount," item",h.itemCount===1?"":"s"," atribuído",h.itemCount===1?"":"s"]})]}),a.jsx(ke,{variant:"success",children:"Ativo"})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.stageNames.map(p=>a.jsx(ke,{variant:"info",children:p},p))})]})},h.id))})]})]})}function m1({workflow:n,activeFlow:i,loading:c}){const[u,d]=x.useState([]),[f,h]=x.useState(null);x.useEffect(()=>{let b=!0;const y=()=>fetch("/api/runs").then(async S=>{if(!S.ok)throw new Error("Não foi possível carregar as execuções.");return S.json()}).then(S=>{b&&(d(Array.isArray(S)?S:[]),h(null))}).catch(()=>{b&&h("Estado das execuções indisponível.")});y();const z=window.setInterval(y,5e3);return()=>{b=!1,window.clearInterval(z)}},[]);const p=new Map(((i==null?void 0:i.stages)??[]).map(b=>[b.id,b.name])),j=new Map(n.items.map(b=>[b.id,b])),v=b=>b.status==="waiting-human"?"Decisão humana autenticada necessária para retomar.":b.status==="queued"?`Aguardando claim do executor ${b.binding.executorId}.`:b.status==="running"?b.lease?`Acompanhar execução até ${new Date(b.lease.expiresAt).toLocaleString()}.`:"Acompanhar execução e próximo handoff.":b.status==="failed"?"Inspecionar a falha e executar a recuperação permitida.":"Verificar handoff seguinte ou encerramento do item.";return a.jsxs("main",{className:"flex flex-1 flex-col overflow-auto",children:[a.jsxs("section",{"aria-labelledby":"runs-heading",className:"flex flex-col gap-4 border-b border-border p-6",children:[a.jsxs("header",{children:[a.jsx("h1",{id:"runs-heading",className:"text-xl font-bold",children:"Execuções por Run"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Atenção do workspace é independente das atribuições e permissões abaixo."})]}),f?a.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f}):null,u.length===0&&!f?a.jsx(Pe,{children:a.jsx(fs,{icon:a.jsx(k,{name:"activity",size:24}),title:"Nenhuma execução registrada",description:"Claims publicados criarão uma Run canônica e visível aqui."})}):null,a.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:u.map(b=>{var T;const y=j.get(b.itemId),z=i==null?void 0:i.stages.find(B=>B.id===(b.workflowStageId??(y==null?void 0:y.stage))),S=b.status==="waiting-human"?z==null?void 0:z.gate:null;return a.jsx(Pe,{"data-run-id":b.id,children:a.jsxs(it,{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h2",{className:"font-semibold",children:b.id}),a.jsx(ke,{variant:b.status==="running"?"success":b.status==="waiting-human"?"amber":"info",children:b.status}),a.jsxs(ke,{variant:"info",children:["revisão ",b.revision]}),a.jsxs(ke,{variant:"info",children:["ciclo ",b.cycle.number]})]}),a.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Item"}),a.jsx("dd",{children:b.itemId})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Executor"}),a.jsx("dd",{children:b.binding.executorId})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Concluído/executado por"}),a.jsxs("dd",{children:[b.binding.actorId," · ",b.binding.roleId]})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Estágio"}),a.jsx("dd",{children:p.get(b.workflowStageId??"")??b.workflowStageId??"Não definido"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Workflow version"}),a.jsx("dd",{children:b.workflowVersionId})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Lease"}),a.jsx("dd",{children:b.lease?`expira ${new Date(b.lease.expiresAt).toLocaleString()}`:"Sem lease ativo"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Direção"}),a.jsx("dd",{className:"truncate",title:b.directionRevision,children:b.directionRevision})]})]}),b.handoffs.length?a.jsxs("section",{"aria-label":"Passagens registradas",className:"flex flex-col gap-1 text-sm",children:[a.jsx("h3",{className:"font-medium",children:"Passagem e regra aplicada"}),b.handoffs.map((B,K)=>a.jsxs("div",{children:[a.jsxs("p",{children:[B.fromActorId," → ",B.toActorId]}),a.jsxs("p",{className:"text-muted-foreground",children:[B.fromStageId&&B.toStageId?`${p.get(B.fromStageId)??B.fromStageId} → ${p.get(B.toStageId)??B.toStageId}`:"Handoff sem troca de estágio",B.transitionId?` · ${B.transitionId}`:""]}),B.summary?a.jsx("p",{children:B.summary}):null]},`${B.createdAt}-${K}`))]}):null,b.status==="waiting-human"?a.jsxs("section",{role:"status",className:"rounded-md border border-warning/40 p-3 text-sm",children:[a.jsx("h3",{className:"font-medium",children:"Espera humana"}),a.jsxs("p",{children:[(S==null?void 0:S.name)??"Gate humano configurado",(T=y==null?void 0:y.handoff)!=null&&T.summary?` · ${y.handoff.summary}`:" · decisão autenticada necessária"]})]}):null,b.gateDecisions.length?a.jsxs("section",{"aria-label":"Decisões de gate",className:"text-sm",children:[a.jsx("h3",{className:"font-medium",children:"Decisões registradas"}),b.gateDecisions.map(B=>a.jsxs("p",{children:[B.gateId,": ",B.decision," · ",B.decidedBy]},B.id))]}):null,b.evidence.length?a.jsxs("section",{"aria-label":"Evidências da execução",className:"text-sm",children:[a.jsxs("h3",{className:"font-medium",children:["Evidências (",b.evidence.length,")"]}),b.evidence.map(B=>a.jsxs("p",{children:[B.kind,": ",a.jsx("span",{className:"break-all",children:B.uri})]},B.id))]}):null,y!=null&&y.handoff?a.jsxs("p",{className:"text-sm",children:["Destinatário atual: ",y.handoff.to," · ",y.handoff.evidence.length," evidência(s)"]}):null,a.jsxs("p",{className:"text-sm",children:[a.jsx("strong",{children:"Próxima ação:"})," ",v(b)]})]})},b.id)})})]}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(f1,{workflow:n,activeFlow:i,loading:c})})]})}function Dl(n,i){return`${n}:${i}`}function h1(n){return(n||"workspace").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"workspace"}function Ap(n){return n.replace(/\\/g,"/").replace(/\/+$/,"")}function p1({onComplete:n,onCancel:i,existingNames:c}){const{toast:u}=yr(),[d,f]=x.useState(""),[h,p]=x.useState(""),[j,v]=x.useState(""),[b,y]=x.useState(!1),[z,S]=x.useState(null),[T,B]=x.useState(null),[K,le]=x.useState(!1),[ve,oe]=x.useState({}),[$,ne]=x.useState(!1),[me,ue]=x.useState(""),_=c.some(M=>M.toLowerCase()===d.trim().toLowerCase()),he=`~/.letra/workspaces/${h1(d.trim())}`,Oe=d.trim()?_?"Já existe um workspace com este nome":"":"Nome é obrigatório",be=!Oe&&j.trim().length>0&&!$,Z=x.useMemo(()=>z?z.locations??[]:[],[z]),ee=x.useMemo(()=>Z.map(M=>({id:M.id,label:M.label,path:M.path,adapters:M.adapters.filter(X=>ve[Dl(M.id,X.tool)]).map(X=>X.tool)})),[Z,ve]),de=x.useMemo(()=>[...new Set(ee.flatMap(M=>M.adapters))],[ee]),ge=(T==null?void 0:T.operations.filter(M=>M.path.endsWith("/workflow.json")).length)??0,E=(T==null?void 0:T.operations.filter(M=>M.path.endsWith("/.letra-link")).length)??0,W=(T==null?void 0:T.operations.filter(M=>!M.path.endsWith("/workflow.json")&&!M.path.endsWith("/.letra-link")).length)??0,pe=ee.filter(M=>M.adapters.length>0),xe=!!z&&ee.length>0&&!$,G=!!z&&!!T&&T.conflictCount===0&&!$;async function N(){if(be){ne(!0),ue(""),B(null),le(!1);try{const M=await fetch("/api/workspace/setup/analyze",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),root:j.trim()})}),X=await M.json();if(!M.ok)throw new Error(X.error||"Não foi possível analisar a pasta.");const te=X,Ge={},Se=te.locations??[];for(const Le of Se)for(const De of Le.adapters)Ge[Dl(Le.id,De.tool)]=De.selected;S(te),oe(Ge)}catch(M){ue(M.message)}finally{ne(!1)}}}async function R(){if(!(!z||ee.length===0)){ne(!0),ue("");try{const M=await fetch("/api/workspace/setup/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proposalId:z.id,workspaceRoot:he,dataDir:he,name:d.trim(),template:"padrao",locations:ee})}),X=await M.json();if(!M.ok)throw new Error(X.error||"Não foi possível revisar a instalação.");B(X)}catch(M){ue(M.message)}finally{ne(!1)}}}async function I(){if(!(!z||!T||T.conflictCount>0)){ne(!0),ue("");try{const M=await fetch("/api/workflow/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proposalId:z.id,name:d.trim(),description:h.trim(),workspacePath:he,dataDir:he,directories:ee.map(te=>te.path),locations:ee,tools:de,template:"padrao"})}),X=await M.json();if(!M.ok)throw new Error(X.error||"Não foi possível criar o workspace.");u("Workspace criado com sucesso!","success"),le(!0),n({name:d.trim()})}catch(M){ue(M.message)}finally{ne(!1)}}}function D(M,X){const te=Dl(M,X);oe(Ge=>({...Ge,[te]:!Ge[te]})),B(null),le(!1)}function ie(M){return M.adapters.filter(X=>ve[Dl(M.id,X.tool)]).length}function U(M){return Ap(M.path)===Ap((z==null?void 0:z.workspace.root)??"")?"Raiz da solução":ie(M)>0?"Pasta com adapters":"Somente vínculo"}return a.jsx("div",{className:"h-full overflow-y-auto p-6",children:a.jsxs("div",{className:"mx-auto grid max-w-6xl gap-6 lg:grid-cols-[minmax(0,1.12fr)_minmax(340px,0.88fr)]",children:[a.jsxs("section",{className:"flex flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 sm:grid sm:grid-cols-[1fr_auto]",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Novo workspace"}),a.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--color-text-secondary)"},children:"Crie a pasta de governança do Letra e vincule as pastas/projetos que ela deve acompanhar."})]}),a.jsx(q,{type:"button",variant:"ghost",onClick:i,children:"Voltar para Meus Workspaces"})]}),a.jsxs("div",{className:"grid gap-4 rounded-[var(--radius-md)] border p-4",style:{borderColor:"var(--color-border)"},children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Workspace e pastas/projetos"}),a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Informe o nome do workspace e uma pasta de projeto inicial. Nada será escrito antes da confirmação final."})]}),a.jsxs("label",{className:"flex flex-col gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium",children:"Nome do workspace"}),a.jsx(ct,{value:d,onBlur:()=>y(!0),onChange:M=>{f(M.target.value),S(null),B(null),le(!1)},placeholder:"Ex: Portal de atendimento","aria-invalid":b&&!!Oe}),b&&Oe&&a.jsx("span",{className:"text-xs",style:{color:"var(--color-danger)"},children:Oe})]}),a.jsxs("label",{className:"flex flex-col gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium",children:"Descrição opcional"}),a.jsx(wn,{value:h,onChange:M=>p(M.target.value),placeholder:"Descreva o propósito deste workspace",rows:3})]}),a.jsxs("label",{className:"flex flex-col gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium",children:"Data directory do workspace"}),a.jsx(ct,{value:he,readOnly:!0,"aria-readonly":"true"})]}),a.jsxs("label",{className:"flex flex-col gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium",children:"Pasta/projeto inicial"}),a.jsx(ct,{value:j,onChange:M=>{v(M.target.value),S(null),B(null),le(!1)},placeholder:"C:/Workspace/meu-projeto"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsxs(q,{type:"button",onClick:N,loading:$,disabled:!be,children:[a.jsx(k,{name:"search",size:14}),"Analisar pasta/projeto"]}),a.jsx("span",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"O harness fica fora do projeto; a pasta recebe apenas o vínculo."})]})]}),a.jsxs("div",{className:"flex flex-col gap-4 rounded-[var(--radius-md)] border p-4",style:{borderColor:"var(--color-border)"},children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Proposta do Letra"}),a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Revise as pastas/projetos vinculadas ao workspace antes de gerar a prévia."})]}),z?a.jsxs(a.Fragment,{children:[z.warnings.map(M=>a.jsxs("div",{className:"rounded-[var(--radius-sm)] border p-3 text-sm",style:{borderColor:"var(--color-border)"},children:[M,a.jsx("span",{className:"mt-1 block text-xs",style:{color:"var(--color-text-secondary)"},children:"Adapters disponíveis aparecem nas opções avançadas e só serão escritos nas pastas onde forem marcados."})]},M)),a.jsx("div",{className:"flex flex-col gap-3",children:Z.map(M=>a.jsx("div",{className:"rounded-[var(--radius-md)] border p-4",style:{borderColor:"var(--color-border)"},children:a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:M.label}),a.jsx(ke,{variant:"info",tone:"soft",children:U(M)})]}),a.jsx("p",{className:"truncate font-mono text-xs",style:{color:"var(--color-text-secondary)"},children:M.path})]}),a.jsx(ke,{variant:ie(M)>0?"success":"info",tone:"soft",children:ie(M)>0?`${ie(M)} adapter(s)`:"só .letra-link"})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[M.stack.map(X=>a.jsx(ke,{variant:"info",tone:"soft",children:X},X)),M.evidence.map(X=>a.jsx(ke,{variant:"info",tone:"soft",children:X},X))]}),a.jsxs("details",{className:"rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:"Opções avançadas"}),a.jsx("p",{className:"mt-2 text-xs",style:{color:"var(--color-text-secondary)"},children:"Marque adapters apenas nas pastas onde o Letra deve criar instruções para agentes. Em geral, use a raiz Git/solução."}),a.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:M.adapters.map(X=>a.jsxs("div",{className:_t("rounded-[var(--radius-sm)] border p-3",ve[Dl(M.id,X.tool)]&&"bg-[var(--color-primary-subtle)]"),style:{borderColor:"var(--color-border)"},children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Sn,{"aria-label":`${X.label} em ${M.label}`,checked:!!ve[Dl(M.id,X.tool)],onChange:()=>D(M.id,X.tool)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium",children:X.label}),a.jsx("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:ve[Dl(M.id,X.tool)]?`Será escrito em ${M.label}`:`Disponível para ${M.label}`})]})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[a.jsx(ke,{variant:X.state==="detected"?"success":"info",tone:"soft",children:X.state==="detected"?"detectado":"disponível"}),X.evidence.map(te=>a.jsx(ke,{variant:"info",tone:"soft",children:te},te))]})]},X.tool))})]})]})},M.id))}),a.jsx("div",{className:"flex justify-end",children:a.jsx(q,{type:"button",onClick:R,loading:$,disabled:!xe,children:"Gerar prévia de escrita"})})]}):a.jsx("div",{className:"rounded-[var(--radius-sm)] border p-4 text-sm",style:{borderColor:"var(--color-border)",color:"var(--color-text-secondary)"},children:"A proposta aparecerá aqui depois da análise da pasta/projeto inicial."})]}),K&&a.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-[var(--radius-md)] border p-8 text-center",style:{borderColor:"var(--color-border)"},children:[a.jsx(k,{name:"check-circle",size:24,style:{color:"var(--color-success)"}}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Workspace criado!"}),a.jsxs("p",{className:"mt-1 text-sm",style:{color:"var(--color-text-secondary)"},children:["O workspace ",d.trim()," já pode ser supervisionado no Letra."]})]}),a.jsx(q,{type:"button",onClick:i,children:"Ir para Meus Workspaces"})]}),me&&a.jsx("div",{className:"rounded-[var(--radius-sm)] border p-3 text-sm",style:{borderColor:"var(--color-danger)",color:"var(--color-danger)"},children:me})]}),a.jsxs("aside",{className:"flex flex-col gap-4 rounded-[var(--radius-md)] border p-4",style:{borderColor:"var(--color-border)"},children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Prévia de escrita"}),a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Confira os artefatos antes de criar o workspace."})]}),z&&T?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2 rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Resumo"}),a.jsxs("p",{className:"text-sm",children:[ge||1," pasta de governança fora do projeto, ",E," vínculo(s) .letra-link e"," ",W," arquivo(s) de adapter."]}),a.jsxs("p",{className:"text-xs",style:{color:"var(--color-text-secondary)"},children:["Adapters serão escritos em"," ",pe.length>0?pe.map(M=>M.label).join(", "):"nenhuma pasta","."]})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"workflow.json"}),a.jsxs("p",{className:"mt-1 text-sm",children:["Criado em ",he,"/workflow.json"]})]}),a.jsxs("div",{className:"rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Vínculo"}),a.jsx("p",{className:"mt-1 text-sm",children:"Cada pasta/projeto recebe apenas .letra-link apontando para o data directory."})]}),a.jsxs("div",{className:"rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Adapters"}),a.jsx("p",{className:"mt-1 text-sm",children:de.length>0?de.join(", "):"Nenhum adapter selecionado"})]})]}),a.jsx("div",{className:"flex flex-col gap-2",children:T.operations.map(M=>a.jsx("div",{className:"rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate font-mono text-xs",children:M.path}),a.jsx("p",{className:"mt-1 text-sm",style:{color:"var(--color-text-secondary)"},children:M.reason})]}),a.jsx(ke,{variant:M.kind==="conflict"?"error":M.kind==="preserve"?"info":"success",tone:"soft",children:M.kind})]})},`${M.kind}:${M.path}:${M.tool||""}`))}),T.conflictCount>0&&a.jsx("p",{className:"text-sm",style:{color:"var(--color-danger)"},children:"Resolva os conflitos antes de criar o workspace."})]}):a.jsx("div",{className:"rounded-[var(--radius-sm)] border p-4 text-sm",style:{borderColor:"var(--color-border)",color:"var(--color-text-secondary)"},children:"Gere a prévia para ver exatamente quais arquivos serão criados, preservados ou bloqueados por conflito."}),a.jsx(q,{type:"button",onClick:I,loading:$,disabled:!G,children:"Criar workspace"}),a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Checklist do cadastro"}),[["Analisar pasta",!!z],["Revisar proposta",!!T],["Revisar opções avançadas",!!z],["Confirmar criação",K],["Validar workflow.json",K],["Validar .letra-link",K],["Validar pastas/projetos",K]].map(([M,X])=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(k,{name:X?"check":"circle",size:14,style:{color:X?"var(--color-success)":"var(--color-text-secondary)"}}),a.jsx("span",{children:M})]},String(M)))]}),z&&a.jsxs("div",{className:"mt-2 rounded-[var(--radius-sm)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-xs font-semibold uppercase",style:{color:"var(--color-text-secondary)"},children:"Pasta analisada"}),a.jsx("p",{className:"mt-1 truncate font-mono text-xs",children:z.workspace.root}),a.jsxs("p",{className:"mt-2 text-sm",children:[Z.length," pasta(s)/projeto(s) detectado(s)"]}),a.jsxs("p",{className:"text-sm",children:[de.length," adapter(s): ",de.join(", ")]})]})]})]})})}function x1(n){try{return new Date(n).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})}catch{return n}}function v1({onSelect:n,activeSlug:i,gateMode:c,activeDirectory:u}){const[d,f]=x.useState([]),[h,p]=x.useState(!1),[j,v]=x.useState(!0);x.useEffect(()=>{fetch("/api/workspaces").then(y=>y.json()).then(y=>{Array.isArray(y)&&f(y)}).catch(()=>{}).finally(()=>v(!1))},[]);function b(y){f(z=>{var S;return[...z,{id:((S=crypto.randomUUID)==null?void 0:S.call(crypto))||`${Date.now()}`,name:y.name,slug:y.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),createdAt:new Date().toISOString()}]}),p(!1)}return h?a.jsx(p1,{onComplete:y=>{b(y),n&&fetch("/api/workspaces").then(z=>z.json()).then(z=>{if(Array.isArray(z)&&z.length>0){const S=z[z.length-1];n(S)}}).catch(()=>{})},onCancel:()=>p(!1),existingNames:d.map(y=>y.name)}):a.jsxs("div",{className:"flex flex-col flex-1 p-6 gap-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Meus Workspaces"}),a.jsx("p",{className:"text-sm mt-1",style:{color:"var(--color-text-secondary)"},children:c?"Selecione ou crie um workspace para começar":"Gerencie seus espaços de trabalho"})]}),a.jsxs(q,{onClick:()=>p(!0),children:[a.jsx(k,{name:"plus",size:16,className:"mr-1"}),c?"Criar novo workspace":"Novo Workspace"]})]}),j?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("p",{className:"text-sm",style:{color:"var(--color-text-secondary)"},children:"Carregando..."})}):d.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(fs,{icon:a.jsx(k,{name:"box",size:24}),title:"Nenhum workspace encontrado",description:"Crie seu primeiro workspace para organizar seus projetos e começar a trabalhar.",action:a.jsx(q,{onClick:()=>p(!0),children:"Crie agora seu workspace"})})}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:d.map(y=>a.jsx(Pe,{className:`transition-all duration-200 hover:shadow-md hover:-translate-y-0.5 ${n?"cursor-pointer":""} ${i===y.slug?"ring-2 ring-primary":""}`,onClick:()=>n==null?void 0:n(y),children:a.jsxs(it,{className:"p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[a.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] flex items-center justify-center shrink-0",style:{background:i===y.slug?"var(--color-primary)":"var(--color-bg-surface)",color:i===y.slug?"var(--color-primary)":"var(--color-text-secondary)"},children:a.jsx(k,{name:i===y.slug?"check":"box",size:16})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"text-sm font-semibold truncate",children:y.name}),y.description&&a.jsx("p",{className:"text-xs mt-0.5 truncate",style:{color:"var(--color-text-secondary)"},children:y.description}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--color-text-secondary)"},children:["Criado em ",x1(y.createdAt)]})]})]}),y.directories&&y.directories.length>0&&a.jsxs("div",{className:"flex flex-col gap-1 pt-1 border-t",style:{borderColor:"var(--color-border)"},children:[a.jsx("span",{className:"text-caption uppercase tracking-wider font-semibold",style:{color:"var(--color-text-secondary)"},children:"Pastas gerenciadas"}),y.directories.map(z=>{const S=i===y.slug&&u===z,T=z.split(/[/\\]/).pop()||z;return a.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:S?"var(--color-primary)":"var(--color-text-secondary)"},children:[a.jsx(k,{name:S?"check":"folder",size:12}),a.jsx("span",{className:"truncate",children:T})]},z)})]})]})},y.id))})]})}function g1(n,i){var b;const c=[...n].sort((y,z)=>(y.order??0)-(z.order??0)),u=new Set(c.map(y=>y.id)),d=new Map,f=[i&&u.has(i)?i:(b=c[0])==null?void 0:b.id].filter(y=>!!y);for(f[0]&&d.set(f[0],0);f.length;){const y=f.shift(),z=c.find(S=>S.id===y);for(const S of(z==null?void 0:z.transitions)??[])!u.has(S.target)||d.has(S.target)||(d.set(S.target,(d.get(y)??0)+1),f.push(S.target))}let h=Math.max(0,...d.values())+1;for(const y of c)d.has(y.id)||d.set(y.id,h++);const p=new Map,j=c.map(y=>{const z=d.get(y.id),S=p.get(z)??0;return p.set(z,S+1),{stage:y,x:24+z*244,y:30+S*142}}),v=c.flatMap(y=>(y.transitions??[]).filter(z=>u.has(z.target)).map(z=>({from:y.id,to:z.target,backward:(d.get(z.target)??0)<=(d.get(y.id)??0)})));return{nodes:j,edges:v,width:Math.max(480,48+(Math.max(0,...d.values())+1)*244),height:Math.max(220,60+Math.max(1,...p.values())*142)}}function Gi(n){return n===void 0?"—":n===null?"nenhum":typeof n=="string"?n||"(vazio)":JSON.stringify(n)}function b1(n,i){if(!n)return[{path:"Fluxo",before:"Sem versão publicada",after:"Novo rascunho"}];const c=[];function u(d,f,h){if(JSON.stringify(d)!==JSON.stringify(f)){if(Array.isArray(d)||Array.isArray(f)){if(h==="stages"&&Array.isArray(d)&&Array.isArray(f)){const p=new Map(d.map(v=>[v.id,v])),j=new Map(f.map(v=>[v.id,v]));for(const v of new Set([...p.keys(),...j.keys()]))u(p.get(v),j.get(v),`estágio ${v}`);return}c.push({path:h,before:Gi(d),after:Gi(f)});return}if(d&&f&&typeof d=="object"&&typeof f=="object"){for(const p of new Set([...Object.keys(d),...Object.keys(f)]))u(d[p],f[p],h?`${h} › ${p}`:p);return}c.push({path:h,before:Gi(d),after:Gi(f)})}}return u(n,i,""),c}function y1(n,i){var j,v;if(!n.length)return["Não há estágios para simular."];const c=new Map(n.map(b=>[b.id,b])),u=i&&c.has(i)?i:n[0].id,d=new Set,f=[u],h=[];for(;f.length;){const b=f.shift();if(d.has(b))continue;d.add(b);const y=c.get(b),z=typeof y.gate=="string"?y.gate:(j=y.gate)==null?void 0:j.id;h.push(`${y.name||b}${z?` · gate ${z} (decisão não executada)`:""}${y.final?" · final":""}`);for(const S of y.transitions??[])h.push(` → ${((v=c.get(S.target))==null?void 0:v.name)||S.target}${c.has(S.target)?"":" (destino ausente)"}`),c.has(S.target)&&!d.has(S.target)&&f.push(S.target)}const p=n.filter(b=>!d.has(b.id));return p.length&&h.push(`Não alcançáveis: ${p.map(b=>b.name||b.id).join(", ")}`),h}function j1(n,i){if(!n||typeof n!="object"||!Array.isArray(n.items))return null;const c={compatible:[],pinned:[],incompatible:[]},u=new Set(i);for(const d of n.items)d!=null&&d.id&&(d.workflowVersionId?c.pinned.push(d.id):d.stage&&!u.has(d.stage)?c.incompatible.push(d.id):c.compatible.push(d.id));return c}function N1(n){const i=[...n].sort((c,u)=>(c.order??0)-(u.order??0));return i.map((c,u)=>{var p,j,v;const d={...structuredClone(c),order:u},f=d.final??d.zone==="done";f&&(d.final=!0);const h=i[u+1];return!f&&!((p=d.transitions)!=null&&p.length)&&h&&(d.transitions=[{target:h.id}]),!((j=d.allow)!=null&&j.length)&&((v=d.roleIds)!=null&&v.length)&&(d.allow=[...d.roleIds]),d})}function wu(n){var i;return Array.isArray((i=n==null?void 0:n.content)==null?void 0:i.stages)?n.content.stages:[]}async function Ep(n){const i=await fetch(n);if(i.status===404)return null;if(!i.ok)throw new Error("Não foi possível carregar a versão do fluxo.");return i.json()}function S1({onBack:n}){var Vs,ce,re,Ne,qe,Xe,Ze,dt,et;const[i,c]=x.useState([]),[u,d]=x.useState(null),[f,h]=x.useState(null),[p,j]=x.useState(null),[v,b]=x.useState(null),[y,z]=x.useState(null),[S,T]=x.useState(!0),[B,K]=x.useState(null),[le,ve]=x.useState(""),[oe,$]=x.useState(!1),[ne,me]=x.useState(null),[ue,_]=x.useState(!0),[he,Oe]=x.useState(null),[be,Z]=x.useState(0),[ee,de]=x.useState(null),[ge,E]=x.useState(null),[W,pe]=x.useState(!1),[xe,G]=x.useState(!1),[N,R]=x.useState(null),[I,D]=x.useState(null),[ie,U]=x.useState(!1),[M,X]=x.useState(""),[te,Ge]=x.useState(!1),[Se,Le]=x.useState([]),[De,F]=x.useState([]),[Te,Me]=x.useState(!1),[gt,ht]=x.useState([]),[Kt,ca]=x.useState(!1),[ea,It]=x.useState(null),[Ce,Ye]=x.useState(null),[pt,vt]=x.useState(!1),[Ut,ut]=x.useState(!1),[jt,ta]=x.useState(null),[aa,Ja]=x.useState(""),[sa,Gt]=x.useState(!1);x.useEffect(()=>{let w=!0;return _(!0),Oe(null),fetch("/api/workflow-definitions").then(se=>{if(!se.ok)throw new Error("Não foi possível carregar os fluxos.");return se.json()}).then(se=>{if(!w)return;const ye=Array.isArray(se)?se:[];c(ye),d(_e=>{var Qe;return ye.some(Yt=>Yt.id===_e)?_e:((Qe=ye[0])==null?void 0:Qe.id)??null}),_(!1)}).catch(se=>{w&&(Oe(se instanceof Error?se.message:"Não foi possível carregar os fluxos."),_(!1))}),()=>{w=!1}},[be]),x.useEffect(()=>{if(!u)return;let w=!0;_(!0),Oe(null),K(null),b(null),z(null),me(null),de(null),E(null),R(null);const se=`/api/workflow-definitions/${encodeURIComponent(u)}`;return Promise.all([Ep(`${se}/draft`),Ep(`${se}/active`)]).then(([ye,_e])=>{var Qe;w&&(h(ye),b(ye?structuredClone(ye.content):null),j(_e),T(!!ye),K(((Qe=wu(ye??_e)[0])==null?void 0:Qe.id)??null),_(!1))}).catch(ye=>{w&&(Oe(ye instanceof Error?ye.message:"Não foi possível carregar o fluxo."),_(!1))}),()=>{w=!1}},[u,be]),x.useEffect(()=>{if(!u)return;let w=!0;return ht([]),ca(!1),fetch("/api/harness/templates").then(se=>{if(!se.ok)throw new Error("GATE_CATALOG_UNAVAILABLE");return se.json()}).then(se=>{if(!w)return;const ye=new Map;for(const _e of Array.isArray(se)?se:[])for(const Qe of Array.isArray(_e.gates)?_e.gates:[])Qe.id&&ye.set(Qe.id,Qe);ht([...ye.values()])}).catch(()=>{w&&ca(!0)}),()=>{w=!1}},[u,be]),x.useEffect(()=>{if(!u)return;let w=!0;return Le([]),F([]),Me(!1),Promise.all([fetch("/api/workflow/active-flow"),fetch("/api/workflow/adapters")]).then(async([se,ye])=>{if(!se.ok||!ye.ok)throw new Error("CATALOG_UNAVAILABLE");const _e=await se.json(),Qe=await ye.json();w&&(Le(Array.isArray(_e==null?void 0:_e.roles)?_e.roles:[]),F(Array.isArray(Qe)?Qe:[]))}).catch(()=>{w&&Me(!0)}),()=>{w=!1}},[u,be]),x.useEffect(()=>{if(!(f!=null&&f.content.template)||Array.isArray(f.content.stages))return;let w=!0;return Promise.all([fetch("/api/workflow"),fetch("/api/workflow/active-flow")]).then(async([se,ye])=>{if(!se.ok||!ye.ok)return null;const _e=await se.json(),Qe=await ye.json();return Qe&&Array.isArray(Qe.stages)?{...Qe,matchesDraftTemplate:_e.template===f.content.template}:null}).then(se=>{w&&se&&z(se)}).catch(()=>{}),()=>{w=!1}},[f==null?void 0:f.content.template,u]);function Nt(w){b(se=>se&&w(se)),me(null),de(null),E(null)}function nt(w,se){Nt(ye=>({...ye,stages:(ye.stages??[]).map(_e=>_e.id===w?{..._e,...se}:_e)}))}function Wa(w){var Qe,Yt;const se=((Qe=w.phases)==null?void 0:Qe.states)??{};let ye=1;for(;se[`phase-${ye}`];)ye++;const _e=`phase-${ye}`;nt(w.id,{phases:{...w.phases,initialState:((Yt=w.phases)==null?void 0:Yt.initialState)||_e,states:{...se,[_e]:{id:_e,label:"Nova fase",description:"",transitions:[]}}}})}function ps(w,se,ye){var Qe;const _e=(Qe=w.phases)==null?void 0:Qe.states;_e!=null&&_e[se]&&nt(w.id,{phases:{...w.phases,states:{..._e,[se]:{..._e[se],label:ye}}}})}function Y(){var _e;const w=new Set(((_e=v==null?void 0:v.stages)==null?void 0:_e.map(Qe=>Qe.id))??[]);let se=1;for(;w.has(`stage-${se}`);)se++;const ye=`stage-${se}`;Nt(Qe=>{var Yt;return{...Qe,name:Qe.name||(We==null?void 0:We.name)||"Fluxo",initialStageId:Qe.initialStageId||ye,stages:[...Qe.stages??[],{id:ye,name:"Novo estágio",zone:"doing",order:((Yt=Qe.stages)==null?void 0:Yt.length)??0,transitions:[]}]}}),K(ye)}function we(){if(!(y!=null&&y.stages.length))return;const w=N1(y.stages);Nt(se=>({...se,name:se.name||(We==null?void 0:We.name)||y.name,initialStageId:w[0].id,stages:w})),K(w[0].id)}function He(w,se){Nt(ye=>{const _e=[...ye.stages??[]],Qe=_e.findIndex(ns=>ns.id===w),Yt=Qe+se;return Qe<0||Yt<0||Yt>=_e.length?ye:([_e[Qe],_e[Yt]]=[_e[Yt],_e[Qe]],{...ye,stages:_e.map((ns,Fa)=>({...ns,order:Fa}))})})}async function Ue(){var w;if(!(!u||!f||!v||oe)){if(!((w=v.name)!=null&&w.trim())){me("Informe o nome do fluxo antes de salvar.");return}$(!0),me(null);try{const se=await fetch(`/api/workflow-definitions/${encodeURIComponent(u)}/draft`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:f.revision,content:v,changeSummary:"Edição visual do rascunho"})});if(se.status===409)throw new Error("O rascunho mudou em outra sessão. Atualize a página antes de salvar novamente.");if(se.status===403)throw new Error("Sua sessão não permite salvar. Recarregue a página para renovar a sessão.");if(!se.ok)throw new Error("Não foi possível salvar o rascunho.");const ye=await se.json();h(ye),b(structuredClone(ye.content)),de(null),E(null)}catch(se){me(se instanceof Error?se.message:"Não foi possível salvar o rascunho.")}finally{$(!1)}}}async function St(){if(!(!u||!f||W)){pe(!0),me(null);try{const w=await fetch(`/api/workflow-definitions/${encodeURIComponent(u)}/validate`,{method:"POST"});if(!w.ok)throw new Error("Não foi possível validar o rascunho.");de(await w.json()),E(f.revision)}catch(w){me(w instanceof Error?w.message:"Não foi possível validar o rascunho.")}finally{pe(!1)}}}async function la(){if(u){G(!0),R(null),D(null);try{const w=await fetch(`/api/workflow-definitions/${encodeURIComponent(u)}/versions`);if(!w.ok)throw new Error("Não foi possível carregar o histórico.");const se=await w.json();R(Array.isArray(se)?se:[])}catch(w){D(w instanceof Error?w.message:"Não foi possível carregar o histórico.")}}}async function Ft(){if(!(!u||!f||!M.trim()||te||ge!==f.revision||!(ee!=null&&ee.valid))){Ge(!0),me(null);try{const w=await fetch(`/api/workflow-definitions/${encodeURIComponent(u)}/publish`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:f.revision,reason:M.trim()})});if(w.status===409)throw new Error("O rascunho mudou em outra sessão. Atualize e valide novamente antes de publicar.");if(w.status===403)throw new Error("Sua sessão não permite publicar. Recarregue a página para renovar a sessão.");if(!w.ok)throw new Error("Não foi possível publicar o fluxo.");U(!1),X(""),de(null),E(null),Z(se=>se+1)}catch(w){me(w instanceof Error?w.message:"Não foi possível publicar o fluxo.")}finally{Ge(!1)}}}async function Na(w){if(It(w),w==="impact"){vt(!0),ut(!1);try{const se=await fetch("/api/workflow");if(!se.ok)throw new Error("IMPACT_UNAVAILABLE");Ye(await se.json())}catch{Ye(null),ut(!0)}finally{vt(!1)}}}async function Sa(){if(!(!u||!(jt!=null&&jt.number)||!aa.trim()||sa)){Gt(!0),me(null);try{const w=await fetch(`/api/workflow-definitions/${encodeURIComponent(u)}/rollback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({versionNumber:jt.number,reason:aa.trim()})});if(w.status===403)throw new Error("Sua sessão não permite rollback. Recarregue para renovar a sessão humana.");if(!w.ok)throw new Error("Não foi possível reverter para esta versão.");ta(null),Ja(""),G(!1),Z(se=>se+1)}catch(w){me(w instanceof Error?w.message:"Não foi possível reverter para esta versão.")}finally{Gt(!1)}}}const We=i.find(w=>w.id===u),At=S&&f?f:p,Lt=!!(S&&f&&v),Fe=Lt?v:At==null?void 0:At.content,Ot=Array.isArray(Fe==null?void 0:Fe.stages)?Fe.stages:[],Ia=S&&Ot.length===0&&y?y.stages:[],ls=(Ot.length?Ot:Ia).slice().sort((w,se)=>(w.order??0)-(se.order??0)),fe=ls.find(w=>w.id===B)??ls[0],wa=Lt&&JSON.stringify(v)!==JSON.stringify(f==null?void 0:f.content),Us=Lt&&!wa&&ge===(f==null?void 0:f.revision)&&(ee==null?void 0:ee.valid)===!0,Ca=fe?Se.filter(w=>{var se,ye;return((se=w.allowedStages)==null?void 0:se.includes(fe.id))||((ye=fe.allow)==null?void 0:ye.includes(w.id))}):[],kt=De.filter(w=>w.active&&w.detected),Tt=typeof(fe==null?void 0:fe.gate)=="string"?fe.gate:(Vs=fe==null?void 0:fe.gate)==null?void 0:Vs.id,ua=g1(ls,Fe==null?void 0:Fe.initialStageId),qs=new Map(ua.nodes.map(w=>[w.stage.id,w])),_l=Fe?b1((p==null?void 0:p.content)??null,Fe):[],_a=j1(Ce,Ot.map(w=>w.id));return a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 sm:p-6",children:[a.jsxs("header",{className:"mb-3 flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(q,{type:"button",variant:"ghost",size:"sm",onClick:n,children:wa?"Voltar e descartar alterações":"Voltar às configurações"}),a.jsx("h1",{className:"mt-2 text-xl font-semibold",children:"Configuração do fluxo"})]}),a.jsx(q,{type:"button",variant:"secondary",size:"sm",onClick:()=>Z(w=>w+1),disabled:oe,children:wa?"Descartar alterações e atualizar":"Atualizar"})]}),he?a.jsx(Pe,{role:"alert",children:a.jsxs(it,{className:"space-y-3 p-5",children:[a.jsx("p",{children:he}),a.jsx(q,{type:"button",size:"sm",onClick:()=>Z(w=>w+1),children:"Tentar novamente"})]})}):ue?a.jsx("p",{role:"status",className:"p-5 text-sm text-[var(--color-text-secondary)]",children:"Carregando configuração do fluxo…"}):i.length===0?a.jsx(Pe,{children:a.jsxs(it,{className:"p-6",children:[a.jsx("h2",{className:"font-semibold",children:"Nenhuma definição versionada"}),a.jsx("p",{className:"mt-2 text-sm text-[var(--color-text-secondary)]",children:"Este workspace ainda não tem uma definição de fluxo para consultar."})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold",children:(Fe==null?void 0:Fe.name)||(We==null?void 0:We.name)||"Fluxo"}),a.jsxs("p",{className:"text-sm text-[var(--color-text-secondary)]",children:[f?`Rascunho · revisão ${f.revision}`:"Sem rascunho"," · ",p?`Publicada v${p.number}`:"Sem versão publicada"]}),Lt?a.jsx("p",{role:"status",className:"mt-1 text-xs text-[var(--color-text-secondary)]",children:oe?"Salvando rascunho…":wa?"Alterações não salvas":"Rascunho salvo"}):null,Lt?a.jsxs(ma,{className:"mt-2 grid max-w-sm gap-1 text-sm",children:["Nome do fluxo",a.jsx(ct,{value:(v==null?void 0:v.name)??"",onChange:w=>Nt(se=>({...se,name:w.target.value})),disabled:oe})]}):null]}),a.jsxs("div",{className:"flex flex-wrap gap-2",role:"group","aria-label":"Versão exibida",children:[f?a.jsx(q,{type:"button",size:"sm",variant:S?"secondary":"ghost","aria-pressed":S,onClick:()=>{var w;T(!0),K(((w=wu(f)[0])==null?void 0:w.id)??null)},children:"Rascunho"}):null,p?a.jsxs(q,{type:"button",size:"sm",variant:S?"ghost":"secondary","aria-pressed":!S,onClick:()=>{var w;T(!1),K(((w=wu(p)[0])==null?void 0:w.id)??null)},children:["Publicada v",p.number]}):null,Lt?a.jsx(q,{type:"button",size:"sm",onClick:Ue,disabled:!wa||oe,children:"Salvar rascunho"}):null,a.jsx(q,{type:"button",size:"sm",variant:"ghost",onClick:la,children:"Histórico"}),Lt?a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:St,disabled:!!(wa||oe||W),children:W?"Validando…":"Validar"}):null,Lt?a.jsx(q,{type:"button",size:"sm",onClick:()=>U(!0),disabled:!Us||oe||te,title:Us?void 0:"Salve e valide o rascunho antes de publicar",children:"Publicar"}):null]})]}),ne?a.jsx("p",{role:"alert",className:"mb-4 rounded-lg border border-[var(--color-error)] p-3 text-sm",children:ne}):null,Lt&&(v!=null&&v.template)&&Ot.length>0?a.jsxs("p",{className:"mb-4 rounded-lg border border-[var(--color-border)] p-3 text-sm",children:["Este rascunho partiu do template ",v.template,". Revise estrutura, conexões, gates e regras antes de validar ou publicar."]}):null,a.jsxs("div",{className:"grid min-h-0 grid-cols-1 gap-4 lg:grid-cols-[12rem_minmax(0,1fr)_16rem] 2xl:grid-cols-[14rem_minmax(0,1fr)_18rem]",children:[a.jsxs("section",{"aria-label":"Elementos",className:"order-2 rounded-lg border border-[var(--color-border)] p-3 lg:order-none",children:[a.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"Elementos"}),a.jsx("p",{className:"mb-2 text-xs text-[var(--color-text-secondary)]",children:"Fluxos"}),a.jsx("div",{className:"grid gap-1",children:i.map(w=>a.jsx(q,{type:"button",variant:u===w.id?"secondary":"ghost","aria-pressed":u===w.id,className:"justify-start text-left",onClick:()=>d(w.id),disabled:(wa||oe)&&u!==w.id,children:w.name},w.id))}),Lt?a.jsxs("div",{className:"mt-5 border-t border-[var(--color-border)] pt-4",children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Estrutura"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:Y,disabled:oe,children:"+ Estágio"}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:()=>fe&&Wa(fe),disabled:oe||!fe,children:"+ Fase"}),a.jsx("p",{className:"text-xs text-[var(--color-text-secondary)]",children:"Gate, papéis e executor são configurados no inspector do estágio selecionado, usando os registries."})]})]}):null]}),a.jsxs("section",{"aria-label":"Mapa do fluxo",className:"order-1 min-h-64 rounded-lg border border-[var(--color-border)] p-4 lg:order-none",children:[a.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"Canvas · mapa do fluxo"}),Ot.length===0&&Lt&&(v!=null&&v.template)?a.jsxs("div",{className:"mb-4 space-y-3 text-sm",children:[a.jsxs("p",{children:["Rascunho baseado no template ",a.jsx("strong",{children:v.template}),". A estrutura ainda não foi copiada para edição."]}),y!=null&&y.stages.length?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-[var(--color-text-secondary)]",children:[y.matchesDraftTemplate?"Prévia do mesmo template":"Referência do fluxo operacional atual; é diferente do template deste rascunho",". O mapa abaixo é somente leitura."]}),y.matchesDraftTemplate?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[var(--color-text-secondary)]",children:"A cópia preserva conexões, gates e regras presentes no template. Revise tudo antes de validar ou publicar."}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:we,children:"Usar estágios como ponto de partida"})]}):null]}):a.jsx("p",{className:"text-[var(--color-text-secondary)]",children:"Não há prévia confiável para este template. Adicione os estágios manualmente."})]}):Ot.length===0?a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:Fe!=null&&Fe.template?`Versão baseada no template ${Fe.template}, sem grafo versionado disponível nesta página.`:"Esta versão ainda não tem estágios."}):null,ls.length>0?a.jsx("div",{className:"overflow-auto rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)]","aria-label":"Grafo visual do fluxo",children:a.jsxs("div",{className:"relative",style:{width:ua.width,height:ua.height},children:[a.jsxs("svg",{"aria-hidden":"true",className:"absolute inset-0",width:ua.width,height:ua.height,children:[a.jsx("defs",{children:a.jsx("marker",{id:"workflow-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"})})}),ua.edges.map((w,se)=>{const ye=qs.get(w.from),_e=qs.get(w.to),Qe=ye.x+190,Yt=ye.y+48,ns=_e.x,Fa=_e.y+48,Gs=w.backward?Math.max(Yt,Fa)+56:void 0,Pa=Gs?`M ${Qe} ${Yt} C ${Qe+36} ${Gs}, ${ns-36} ${Gs}, ${ns} ${Fa}`:`M ${Qe} ${Yt} C ${Qe+38} ${Yt}, ${ns-38} ${Fa}, ${ns} ${Fa}`;return a.jsx("path",{d:Pa,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:w.backward?"6 4":void 0,markerEnd:"url(#workflow-arrow)",className:"text-[var(--color-text-secondary)]"},`${w.from}-${w.to}-${se}`)})]}),ua.nodes.map(({stage:w,x:se,y:ye},_e)=>a.jsxs(q,{type:"button",variant:(fe==null?void 0:fe.id)===w.id?"secondary":"ghost","aria-label":w.name||w.id,"aria-pressed":(fe==null?void 0:fe.id)===w.id,className:"absolute h-24 w-[190px] flex-col items-start rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-primary)] p-3 text-left shadow-sm",style:{left:se,top:ye},onClick:()=>{K(w.id),ve("")},children:[a.jsx("span",{className:"text-xs text-[var(--color-text-secondary)]",children:(Fe==null?void 0:Fe.initialStageId)===w.id||Ia.length>0&&w.zone==="todo"?"INÍCIO":w.final||Ia.length>0&&w.zone==="done"?"FIM":`ETAPA ${_e+1}`}),a.jsxs("span",{className:"font-medium",children:[w.name||w.id,w.gate?" ◇":""]}),a.jsx("span",{className:"text-xs text-[var(--color-text-secondary)]",children:w.zone||"zona não definida"})]},w.id))]})}):null,Ot.length>0?a.jsx("div",{className:"mt-4 border-t border-[var(--color-border)] pt-3 text-xs text-[var(--color-text-secondary)]","aria-label":"Relações do fluxo",children:Ot.flatMap(w=>(w.transitions??[]).map(se=>{var ye;return`${w.name||w.id} → ${((ye=Ot.find(_e=>_e.id===se.target))==null?void 0:ye.name)||se.target}`})).join(" · ")||"Nenhuma transição configurada"}):null]}),a.jsxs("aside",{"aria-label":"Detalhes do estágio",className:"order-3 rounded-lg border border-[var(--color-border)] p-4 lg:order-none",children:[a.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"Inspector"}),fe&&Lt&&Ot.length>0?a.jsxs("div",{className:"grid gap-4 text-sm",children:[a.jsxs(ma,{className:"grid gap-1",children:["Nome do estágio",a.jsx(ct,{value:fe.name??"",onChange:w=>nt(fe.id,{name:w.target.value}),disabled:oe})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[var(--color-text-secondary)]",children:"ID imutável"}),a.jsx("p",{children:fe.id})]}),a.jsxs(ma,{className:"grid gap-1",children:["Zona",a.jsx(ct,{value:fe.zone??"",onChange:w=>nt(fe.id,{zone:w.target.value}),disabled:oe})]}),a.jsxs("div",{role:"group","aria-label":"Quem atua",className:"grid gap-2 border-t border-[var(--color-border)] pt-3",children:[a.jsx("h4",{className:"font-medium",children:"Quem atua"}),Ca.length?Ca.map(w=>{var se;return a.jsx(q,{type:"button",size:"sm",variant:"secondary","aria-pressed":!!((se=fe.allow)!=null&&se.includes(w.id)),onClick:()=>{var ye;return nt(fe.id,{allow:(ye=fe.allow)!=null&&ye.includes(w.id)?fe.allow.filter(_e=>_e!==w.id):[...fe.allow??[],w.id]})},disabled:oe,className:"justify-start text-left",children:w.label||w.id},w.id)}):a.jsx("p",{className:"text-xs text-[var(--color-text-secondary)]",children:Te?"Catálogo de papéis indisponível.":"Nenhum papel do registry permite este estágio."})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(ma,{htmlFor:"preferred-executor",children:"Executor preferencial"}),a.jsxs(yn,{value:fe.preferredExecutor??"none",onValueChange:w=>nt(fe.id,{preferredExecutor:w==="none"?void 0:w}),children:[a.jsx(jn,{id:"preferred-executor","aria-label":"Executor preferencial",disabled:oe||kt.length===0,children:a.jsx(vr,{children:((ce=kt.find(w=>w.id===fe.preferredExecutor))==null?void 0:ce.displayName)??fe.preferredExecutor??"Sem preferência"})}),a.jsxs(Nn,{children:[a.jsx(Xa,{value:"none",children:"Sem preferência"}),fe.preferredExecutor&&!kt.some(w=>w.id===fe.preferredExecutor)?a.jsxs(Xa,{value:fe.preferredExecutor,children:[fe.preferredExecutor," (indisponível)"]}):null,kt.map(w=>a.jsx(Xa,{value:w.id,children:w.displayName},w.id))]})]}),kt.length===0?a.jsx("p",{className:"text-xs text-[var(--color-text-secondary)]",children:Te?"Catálogo de executores indisponível.":"Nenhum executor ativo e detectado."}):null]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(ma,{htmlFor:"stage-gate",children:"Gate"}),a.jsxs(yn,{value:Tt??"none",onValueChange:w=>nt(fe.id,{gate:w==="none"?null:w}),children:[a.jsx(jn,{id:"stage-gate","aria-label":"Gate",disabled:oe||gt.length===0&&!Tt,children:a.jsx(vr,{children:((re=gt.find(w=>w.id===Tt))==null?void 0:re.id)??Tt??"Sem gate"})}),a.jsxs(Nn,{children:[a.jsx(Xa,{value:"none",children:"Sem gate"}),Tt&&!gt.some(w=>w.id===Tt)?a.jsxs(Xa,{value:Tt,children:[Tt," (não encontrado)"]}):null,gt.map(w=>a.jsxs(Xa,{value:w.id,children:[w.id,w.type?` · ${w.type}`:""]},w.id))]})]}),gt.length===0?a.jsx("p",{className:"text-xs text-[var(--color-text-secondary)]",children:Kt?"Catálogo de gates indisponível.":"Nenhum gate configurado no harness."}):null]}),a.jsxs("div",{role:"group","aria-label":"Fases internas",className:"grid gap-3 border-t border-[var(--color-border)] pt-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("h4",{className:"font-medium",children:"Fases internas"}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:()=>Wa(fe),disabled:oe,children:"Adicionar fase"})]}),Object.entries(((Ne=fe.phases)==null?void 0:Ne.states)??{}).map(([w,se])=>{var ye;return a.jsxs("div",{className:"grid gap-2 rounded-lg border border-[var(--color-border)] p-3",children:[a.jsxs("span",{className:"text-xs text-[var(--color-text-secondary)]",children:["ID imutável: ",w]}),a.jsxs(ma,{className:"grid gap-1",children:["Nome da fase",a.jsx(ct,{value:se.label??"",onChange:_e=>ps(fe,w,_e.target.value),disabled:oe})]}),a.jsx(q,{type:"button",size:"sm",variant:"secondary","aria-label":`Definir ${se.label||w} como fase inicial`,"aria-pressed":((ye=fe.phases)==null?void 0:ye.initialState)===w,onClick:()=>{var _e;return nt(fe.id,{phases:{...fe.phases,initialState:w,states:((_e=fe.phases)==null?void 0:_e.states)??{}}})},disabled:oe,children:"Fase inicial"})]},w)})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(q,{type:"button",size:"sm",variant:"secondary","aria-pressed":(Fe==null?void 0:Fe.initialStageId)===fe.id,onClick:()=>Nt(w=>({...w,initialStageId:fe.id})),disabled:oe,children:"Estágio inicial"}),a.jsx(q,{type:"button",size:"sm",variant:"secondary","aria-pressed":!!fe.final,onClick:()=>nt(fe.id,{final:!fe.final}),disabled:oe,children:"Estágio final"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(q,{type:"button",size:"sm",variant:"ghost",onClick:()=>He(fe.id,-1),disabled:oe||((qe=Ot[0])==null?void 0:qe.id)===fe.id,children:"Subir"}),a.jsx(q,{type:"button",size:"sm",variant:"ghost",onClick:()=>He(fe.id,1),disabled:oe||((Xe=Ot[Ot.length-1])==null?void 0:Xe.id)===fe.id,children:"Descer"})]}),a.jsxs("div",{className:"grid gap-2 border-t border-[var(--color-border)] pt-3",children:[a.jsx("h4",{className:"font-medium",children:"Transições"}),(fe.transitions??[]).map(w=>{var se;return a.jsxs("div",{className:"grid gap-2 rounded border border-[var(--color-border)] p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{children:["→ ",((se=Ot.find(ye=>ye.id===w.target))==null?void 0:se.name)||w.target]}),a.jsx(q,{type:"button",size:"sm",variant:"ghost","aria-label":`Remover transição para ${w.target}`,onClick:()=>nt(fe.id,{transitions:(fe.transitions??[]).filter(ye=>ye.target!==w.target)}),disabled:oe,children:"Remover"})]}),a.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[a.jsx("input",{type:"checkbox",checked:w.allowPendingAcceptanceCriteria===!0,disabled:oe,onChange:ye=>nt(fe.id,{transitions:(fe.transitions??[]).map(_e=>_e.target===w.target?{..._e,allowPendingAcceptanceCriteria:ye.target.checked}:_e)})}),"Permitir passagem com critérios de aceite pendentes"]})]},w.target)}),Ot.length>1?a.jsxs("div",{className:"grid gap-2",children:[a.jsx(ma,{htmlFor:"transition-target",children:"Conectar a"}),a.jsxs(yn,{value:le,onValueChange:ve,children:[a.jsx(jn,{id:"transition-target",disabled:oe,children:a.jsx(vr,{placeholder:"Escolha um estágio"})}),a.jsx(Nn,{children:Ot.filter(w=>w.id!==fe.id&&!(fe.transitions??[]).some(se=>se.target===w.id)).map(w=>a.jsx(Xa,{value:w.id,children:w.name||w.id},w.id))})]}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:()=>{le&&le!==fe.id&&Ot.some(w=>w.id===le)&&!(fe.transitions??[]).some(w=>w.target===le)&&(nt(fe.id,{transitions:[...fe.transitions??[],{target:le}]}),ve(""))},disabled:oe||!le,children:"Conectar"})]}):null]})]}):fe?a.jsxs("dl",{className:"grid gap-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Estágio"}),a.jsx("dd",{className:"font-medium",children:fe.name||fe.id})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"ID"}),a.jsx("dd",{children:fe.id})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Zona"}),a.jsx("dd",{children:fe.zone||"Não definida"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Posição"}),a.jsx("dd",{children:(Fe==null?void 0:Fe.initialStageId)===fe.id||Ia.length>0&&fe.zone==="todo"?"Inicial":fe.final||Ia.length>0&&fe.zone==="done"?"Final":"Intermediário"})]}),(Ze=fe.roleIds)!=null&&Ze.length||(dt=fe.allow)!=null&&dt.length?a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Quem atua"}),a.jsx("dd",{children:(fe.roleIds??fe.allow??[]).join(", ")})]}):null,fe.preferredExecutor?a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Executor preferencial"}),a.jsx("dd",{children:fe.preferredExecutor})]}):null,fe.gate?a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Gate"}),a.jsxs("dd",{children:[typeof fe.gate=="string"?fe.gate:fe.gate.id,typeof fe.gate=="object"&&fe.gate.type?` · ${fe.gate.type}`:""]})]}):null,(et=fe.phases)!=null&&et.initialState?a.jsxs("div",{children:[a.jsx("dt",{className:"text-[var(--color-text-secondary)]",children:"Fase inicial"}),a.jsx("dd",{children:fe.phases.initialState})]}):null]}):a.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Selecione um estágio no mapa."})]})]}),Lt?a.jsxs("div",{className:"mt-4 flex flex-wrap items-start justify-between gap-3 rounded-lg border border-[var(--color-border)] p-3 text-sm","aria-label":"Estado do rascunho",children:[a.jsxs("div",{role:"status",children:[wa?"● Alterações não salvas; salve para validar":ee?ee.valid?"✓ Estrutura válida para a revisão atual":`⚠ ${ee.errors.length} problema(s) na estrutura`:"Validação ainda não executada nesta revisão",ee!=null&&ee.errors.length?a.jsx("ul",{className:"mt-2 list-inside list-disc text-xs text-[var(--color-text-secondary)]",children:ee.errors.map((w,se)=>a.jsx("li",{children:w.message},`${w.code}-${se}`))}):null]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"text-xs text-[var(--color-text-secondary)]",children:p?`Base v${p.number} · execuções existentes podem permanecer fixadas.`:"Sem base publicada"}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:()=>Na("diff"),children:"Diferenças"}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:()=>Na("impact"),children:"Impacto"}),a.jsx(q,{type:"button",size:"sm",variant:"secondary",onClick:()=>Na("simulation"),children:"Simular direção"})]})]}):null]}),a.jsx(ms,{open:xe,onClose:()=>G(!1),title:"Histórico de versões",children:a.jsx("div",{className:"space-y-3 text-sm",children:I?a.jsx("p",{role:"alert",children:I}):N===null?a.jsx("p",{children:"Carregando histórico…"}):N.length===0?a.jsx("p",{children:"Nenhuma versão publicada."}):a.jsx("ol",{className:"grid gap-2",children:N.map(w=>a.jsxs("li",{className:"rounded border border-[var(--color-border)] p-3",children:[a.jsxs("strong",{children:["Versão ",w.number]}),(p==null?void 0:p.number)===w.number?" · ativa":"",a.jsxs("p",{className:"text-xs text-[var(--color-text-secondary)]",children:[w.publishedAt?new Date(w.publishedAt).toLocaleString("pt-BR"):"Data não informada"," · ",w.publishedBy||w.createdBy||"Autor não informado"]}),w.changeSummary?a.jsx("p",{children:w.changeSummary}):null,a.jsxs("p",{className:"break-all text-xs text-[var(--color-text-secondary)]",children:["Base: ",w.basedOnVersionId||"inicial"," · hash: ",w.contentHash||"não informado",w.restoredFromVersionId?` · restaurada de ${w.restoredFromVersionId}`:""]}),w.number!==(p==null?void 0:p.number)?a.jsxs(q,{type:"button",size:"sm",variant:"secondary",className:"mt-2",onClick:()=>{ta(w),Ja("")},children:["Reverter para v",w.number]}):null]},w.number))})})}),a.jsx(ms,{open:ea!==null,onClose:()=>It(null),title:ea==="simulation"?"Simulação de direção":ea==="impact"?"Impacto da publicação":"Diferenças para a versão ativa",children:a.jsx("div",{className:"max-h-[60vh] overflow-auto text-sm",children:ea==="simulation"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"mb-3 text-[var(--color-text-secondary)]",children:"Prévia somente leitura do alcance e dos gates. Não avalia decisões externas nem move itens."}),a.jsx("ol",{className:"grid gap-1",children:y1(Ot,Fe==null?void 0:Fe.initialStageId).map((w,se)=>a.jsx("li",{className:"whitespace-pre-wrap",children:w},se))})]}):ea==="diff"?_l.length?a.jsx("ol",{className:"grid gap-2",children:_l.map((w,se)=>a.jsxs("li",{className:"rounded border border-[var(--color-border)] p-2",children:[a.jsx("strong",{children:w.path}),a.jsxs("p",{className:"break-all",children:["Antes: ",w.before]}),a.jsxs("p",{className:"break-all",children:["Depois: ",w.after]})]},se))}):a.jsx("p",{children:"Sem diferenças em relação à versão ativa."}):pt?a.jsx("p",{role:"status",children:"Calculando impacto…"}):Ut||!_a?a.jsx("p",{role:"alert",children:"Não foi possível consultar os itens operacionais. O impacto não está disponível; não publique sem verificá-lo."}):a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("p",{children:["Itens compatíveis: ",_a.compatible.length]}),a.jsxs("p",{children:["Execuções fixadas na versão de origem: ",_a.pinned.length]}),a.jsxs("p",{children:["Itens incompatíveis por estágio ausente: ",_a.incompatible.length]}),_a.incompatible.length?a.jsxs("p",{className:"break-all",role:"alert",children:["Revise: ",_a.incompatible.join(", ")]}):null,a.jsx("p",{className:"text-xs text-[var(--color-text-secondary)]",children:"Estimativa somente leitura baseada nos estágios dos itens atuais; a validação do servidor continua obrigatória."})]})})}),a.jsx(ms,{open:jt!==null,onClose:()=>{sa||ta(null)},title:`Reverter para v${(jt==null?void 0:jt.number)??""}`,actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{type:"button",variant:"secondary",onClick:()=>ta(null),disabled:sa,children:"Cancelar"}),a.jsx(q,{type:"button",onClick:Sa,disabled:!aa.trim()||sa,children:sa?"Revertendo…":"Confirmar rollback"})]}),children:a.jsxs("div",{className:"grid gap-3 text-sm",children:[a.jsxs("p",{children:["Uma nova versão publicada será criada a partir da v",jt==null?void 0:jt.number,". A versão atual permanecerá no histórico; execuções fixadas não serão migradas."]}),a.jsxs(ma,{className:"grid gap-1",children:["Motivo do rollback",a.jsx(ct,{value:aa,onChange:w=>Ja(w.target.value),disabled:sa})]}),ne?a.jsx("p",{role:"alert",children:ne}):null]})}),a.jsx(ms,{open:ie,onClose:()=>{te||U(!1)},title:"Publicar nova versão",actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{type:"button",variant:"secondary",onClick:()=>U(!1),disabled:te,children:"Cancelar"}),a.jsx(q,{type:"button",onClick:Ft,disabled:!M.trim()||te,children:te?"Publicando…":"Confirmar publicação"})]}),children:a.jsxs("div",{className:"grid gap-3 text-sm",children:[a.jsx("p",{children:"A publicação passa a orientar novas decisões do fluxo. Execuções já iniciadas podem continuar na versão de origem."}),a.jsxs(ma,{className:"grid gap-1",children:["Motivo da publicação",a.jsx(ct,{value:M,onChange:w=>X(w.target.value),disabled:te})]}),ne?a.jsx("p",{role:"alert",children:ne}):null]})})]})}function w1({workspace:n,onWorkspaceUpdated:i,onWorkspaceDeleted:c,onRefreshWorkflow:u,onCreateWorkspace:d,onClose:f}){const{toast:h,toastWithOptions:p}=yr(),[j,v]=x.useState("general"),[b,y]=x.useState(!1),[z,S]=x.useState(n.name),[T,B]=x.useState(n.description||""),[K,le]=x.useState(!1),[ve,oe]=x.useState(!1),[$,ne]=x.useState("confirm"),[me,ue]=x.useState(""),[_,he]=x.useState([]),[Oe,be]=x.useState(!1),[Z,ee]=x.useState(!1),[de,ge]=x.useState(null),[E,W]=x.useState(""),[pe,xe]=x.useState(null),[G,N]=x.useState(""),[R,I]=x.useState({}),[D,ie]=x.useState(!1),[U,M]=x.useState(!1),[X,te]=x.useState(""),[Ge,Se]=x.useState([]),[Le,De]=x.useState(!1),[F,Te]=x.useState(""),[Me,gt]=x.useState(null),[ht,Kt]=x.useState([]),[ca,ea]=x.useState(!1),[It,Ce]=x.useState(null),[Ye,pt]=x.useState(""),[vt,Ut]=x.useState([]),[ut,jt]=x.useState(!1),[ta,aa]=x.useState([]),[Ja,sa]=x.useState(!1),[Gt,Nt]=x.useState(!1),[nt,Wa]=x.useState(!1),[ps,Y]=x.useState(""),we=x.useState(null),He=x.useState(null);function Ue(ce,re){we[0]&&clearTimeout(we[0]),He[0]={undo:re,label:ce};const Ne=setTimeout(()=>{He[0]=null},3e4);we[0]=Ne,p(`${ce} — desfazer disponível por 30s`,{type:"success",duration:3e4,action:{label:"Desfazer",onClick:St}})}function St(){He[0]&&(He[0].undo(),He[0]=null,we[0]&&clearTimeout(we[0]),h("Alteração desfeita","success"))}x.useEffect(()=>{S(n.name),B(n.description||""),v("general"),ne("confirm"),ue(""),Sa(),la(),Ft(),Na()},[n.name,n.description]);const la=x.useCallback(async()=>{ea(!0);try{const re=await(await fetch("/api/harness/templates")).json();Kt(Array.isArray(re)?re:[])}catch{Kt([])}finally{ea(!1)}},[]),Ft=x.useCallback(async()=>{var ce;try{const Ne=await(await fetch("/api/workflow")).json();pt(Ne.template||""),Ut(((ce=Ne.stages)==null?void 0:ce.map(qe=>({id:qe.id,name:qe.name})))||[])}catch{}},[]),Na=x.useCallback(async()=>{sa(!0);try{const re=await(await fetch("/api/workflow/adapters")).json();aa(Array.isArray(re)?re:[])}catch{aa([])}finally{sa(!1)}},[]),Sa=x.useCallback(async()=>{be(!0);try{const Ne=(await(await fetch("/api/workflow")).json()).locations||[];he(Ne);const qe={};for(const Xe of Ne)Xe.id&&(qe[Xe.id]=Array.isArray(Xe.adapters)?Xe.adapters:[]);I(qe)}catch{he([]),I({})}finally{be(!1)}},[]),We=z!==n.name||T!==(n.description||""),At=z.trim().length>=2;async function Lt(){if(!At||K)return;const ce=n.name,re=n.description||"";le(!0);try{const Ne=await fetch("/api/workflow",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.trim(),description:T.trim()})});if(!Ne.ok)throw new Error("Failed to save");const qe=await Ne.json();i({...n,name:qe.name||z.trim(),description:qe.description??T.trim()}),Ue("Configurações salvas",()=>{S(ce),B(re),fetch("/api/workflow",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ce,description:re})}),i({...n,name:ce,description:re})})}catch{h("Erro ao salvar configurações","error")}finally{le(!1)}}async function Fe(){if(me===n.name)try{if(!(await fetch(`/api/workspaces/${n.id}`,{method:"DELETE"})).ok)throw new Error("Failed to delete");h("Workspace excluído","success"),oe(!1),c()}catch{h("Erro ao excluir workspace","error")}}async function Ot(){if(!Me)return;const ce=`loc-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,re=Me.name,Ne=[..._];try{const qe=await fetch("/api/workflow/locations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:ce,path:Me.path,label:re})});if(!qe.ok)throw new Error("Failed to add location");const Xe=await qe.json();he(Ze=>[...Ze,Xe]),M(!1),gt(null),te(""),Se([]),Ue("Local adicionado",()=>{he(Ne),fetch(`/api/workflow/locations/${ce}`,{method:"DELETE"})})}catch{h("Erro ao adicionar local","error")}}async function Ia(ce){if(!E.trim())return;const re=_.find(Ne=>Ne.id===ce);try{const Ne=await fetch(`/api/workflow/locations/${ce}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:E.trim()})});if(!Ne.ok)throw new Error("Failed to update");const qe=await Ne.json();he(Xe=>Xe.map(Ze=>Ze.id===ce?qe:Ze)),ge(null),re?Ue("Label atualizado",()=>{he(Xe=>Xe.map(Ze=>Ze.id===ce?re:Ze)),fetch(`/api/workflow/locations/${ce}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:re.label})})}):h("Label atualizado","success")}catch{h("Erro ao atualizar label","error")}}async function ls(){if(!pe)return;const ce=_.find(Ne=>Ne.id===pe),re=[..._];try{if(!(await fetch(`/api/workflow/locations/${pe}`,{method:"DELETE"})).ok)throw new Error("Failed to delete");he(qe=>qe.filter(Xe=>Xe.id!==pe)),xe(null),N(""),ce&&Ue("Local removido",()=>{he(re),fetch("/api/workflow/locations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)})})}catch{h("Erro ao remover local","error")}}async function fe(ce){const re=_.find(Ne=>Ne.id===ce);try{const Ne=await fetch(`/api/workflow/locations/${ce}/repair-link`,{method:"POST"});if(!Ne.ok)throw new Error("Failed to repair link");const qe=await Ne.json();qe.location?he(Xe=>Xe.map(Ze=>Ze.id===ce?{...Ze,...qe.location,linkStatus:"ok",linkOk:!0}:Ze)):re&&he(Xe=>Xe.map(Ze=>Ze.id===ce?{...Ze,linkStatus:"ok",linkOk:!0}:Ze)),h("Vínculo reparado","success")}catch{h("Erro ao reparar vínculo","error")}}function wa(ce){return ce.linkOk===!0||ce.linkStatus==="ok"?"Vínculo ok":ce.linkOk===!1||ce.linkStatus==="missing"?".letra-link ausente":ce.linkStatus==="broken"?".letra-link quebrado":"Vínculo não verificado"}function Us(ce){return ce.linkOk===!0||ce.linkStatus==="ok"?"success":ce.linkOk===!1||ce.linkStatus==="missing"||ce.linkStatus==="broken"?"warning":"info"}const Ca=[{id:"opencode",label:"OpenCode"},{id:"cursor",label:"Cursor"},{id:"codex",label:"Codex"},{id:"claude-code",label:"Claude Code"},{id:"vscode",label:"VS Code"},{id:"windsurf",label:"Windsurf"},{id:"hermes",label:"Hermes"}];async function kt(ce,re){const Ne=R[ce]||[],qe=Ne.includes(re)?Ne.filter(Xe=>Xe!==re):[...Ne,re];I(Xe=>({...Xe,[ce]:qe})),ie(!0);try{if(!(await fetch(`/api/workflow/locations/${ce}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapters:qe})})).ok)throw new Error("Failed to update adapters");Ue("Adapters atualizados",()=>{I(Ze=>({...Ze,[ce]:Ne})),fetch(`/api/workflow/locations/${ce}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapters:Ne})})})}catch{I(Xe=>({...Xe,[ce]:Ne})),h("Erro ao atualizar adapters","error")}finally{ie(!1)}}async function Tt(ce){var Ze,dt;const re=[...ta],Ne=((Ze=ta.find(et=>et.id===ce))==null?void 0:Ze.displayName)||ce,qe=ta.map(et=>et.id===ce?{...et,active:!et.active}:et),Xe=qe.filter(et=>et.active).map(et=>et.id);aa(qe),Nt(!0);try{if(!(await fetch("/api/workflow/adapters",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tools:Xe})})).ok)throw new Error("Failed to update adapters");u();const w=(dt=re.find(se=>se.id===ce))==null?void 0:dt.active;Ue(`${Ne} ${w?"desativado":"ativado"}`,()=>{aa(re),fetch("/api/workflow/adapters",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tools:re.filter(se=>se.active).map(se=>se.id)})}),u()})}catch{aa(ta),h("Erro ao atualizar adapters","error")}finally{Nt(!1)}}async function ua(){var Xe;if(!It||ut)return;const ce=Ye,re=[...vt],Ne=ht.find(Ze=>Ze.id===It),qe=re.filter(Ze=>!(Ne!=null&&Ne.stages.some(dt=>dt.id===Ze.id)));jt(!0);try{const Ze=await fetch("/api/workflow/template",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({template:It})});if(!Ze.ok)throw new Error("Failed to switch template");const dt=await Ze.json();pt(dt.template||It),Ut(((Xe=dt.stages)==null?void 0:Xe.map(et=>({id:et.id,name:et.name})))||[]),Ce(null),u(),qe.length>0&&h(`${qe.length} estágio(s) removido(s); itens preservados no backlog`,"success"),Ue("Template atualizado",()=>{pt(ce),Ut(re),fetch("/api/workflow/template",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({template:ce})}),u()})}catch{h("Erro ao atualizar template","error")}finally{jt(!1)}}async function qs(){if(!(!n.root||nt)){Wa(!0),Y("");try{const ce=await fetch("/api/workflow/migrate-harness",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:n.root,clean:!1})});if(!ce.ok)throw new Error(`Migration failed (${ce.status})`);const re=await ce.json();re.ok?(h("Workspace externalizado com sucesso","success"),u()):Y(re.message||"Erro ao externalizar")}catch(ce){Y((ce==null?void 0:ce.message)||"Erro ao externalizar")}finally{Wa(!1)}}}async function _l(){if(!(!n.root||nt)){Wa(!0),Y("");try{const ce=await fetch("/api/workflow/migrate-harness",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:n.root,clean:!0})});if(!ce.ok)throw new Error(`Migration failed (${ce.status})`);const re=await ce.json();re.ok?(h("Workspace externalizado e pasta original removida","success"),u()):Y(re.message||"Erro ao externalizar")}catch(ce){Y((ce==null?void 0:ce.message)||"Erro ao externalizar")}finally{Wa(!1)}}}async function _a(ce){De(!0),Te("");try{const re=ce?`/api/fs/dirs?path=${encodeURIComponent(ce)}`:"/api/fs/dirs",qe=await(await fetch(re)).json();te(qe.path||""),Se(qe.dirs||[]),qe.error&&Te(qe.error)}catch{Te("Erro ao listar diretórios")}finally{De(!1)}}function Vs(){M(!0),gt(null),te(""),Se([]),_a()}return b?a.jsx(S1,{onBack:()=>y(!1)}):a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsx("div",{className:"border-b px-6 py-4",style:{borderColor:"var(--color-border)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-semibold",children:"Configurações do Workspace"}),a.jsx("p",{className:"text-caption mt-0.5",style:{color:"var(--color-text-secondary)"},children:n.name})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[d?a.jsxs(q,{type:"button",variant:"secondary",onClick:d,children:[a.jsx(k,{name:"plus",size:14}),"Novo workspace"]}):null,j==="general"&&a.jsx(q,{onClick:Lt,disabled:!We||!At||K,loading:K,children:"Salvar"}),f?a.jsx(q,{type:"button",variant:"ghost",size:"sm",className:"size-8 px-0","aria-label":"Fechar configurações do workspace",onClick:f,children:a.jsx(k,{name:"x",size:16})}):null]})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a.jsx(Py,{tabs:[{id:"general",label:"Geral",icon:a.jsx(k,{name:"settings",size:14})},{id:"locations",label:"Pastas/projetos",icon:a.jsx(k,{name:"folder",size:14})},{id:"flow",label:"Fluxo",icon:a.jsx(k,{name:"flow",size:14})},{id:"adapters",label:"Adapters",icon:a.jsx(k,{name:"cpu",size:14})},{id:"advanced",label:"Avançado",icon:a.jsx(k,{name:"shield",size:14})},{id:"externalization",label:"Externalização",icon:a.jsx(k,{name:"folder",size:14})}],activeTab:j,onChange:v,ariaLabel:"Configurações do workspace",children:ce=>a.jsxs("div",{"data-testid":"workspace-settings-tab-panel",className:"px-4 py-5 sm:px-6 lg:px-8",children:[ce==="general"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ma,{className:"flex flex-col items-start gap-[var(--space-2)]",children:[a.jsx("span",{className:"text-caption font-medium",style:{color:"var(--color-text-secondary)"},children:"Nome"}),a.jsx(ct,{value:z,onChange:re=>S(re.target.value),placeholder:"Nome do workspace",autoFocus:!0}),!At&&z.length>0&&a.jsx("span",{className:"text-caption",style:{color:"var(--color-error)"},children:"Mínimo 2 caracteres"})]}),a.jsxs(ma,{className:"flex flex-col items-start gap-[var(--space-2)]",children:[a.jsx("span",{className:"text-caption font-medium",style:{color:"var(--color-text-secondary)"},children:"Descrição"}),a.jsx(wn,{value:T,onChange:re=>B(re.target.value),placeholder:"Descreva o propósito deste workspace",rows:3})]})]}),a.jsxs("div",{className:"pt-2",children:[a.jsxs("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:["Criado em"," ",new Date(n.createdAt).toLocaleDateString("pt-BR")]}),n.root&&a.jsx("p",{className:"text-caption mt-1 font-mono",style:{color:"var(--color-text-secondary)"},children:n.root})]})]}),ce==="locations"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ma,{className:"flex flex-col items-start gap-[var(--space-2)]",children:[a.jsx("span",{className:"text-caption font-medium",style:{color:"var(--color-text-secondary)"},children:"Data directory do workspace"}),a.jsx(ct,{value:n.dataDir||n.root||"",readOnly:!0,"aria-readonly":"true"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Gerencie as pastas/projetos vinculadas a este workspace."}),a.jsxs(q,{size:"sm",onClick:Vs,children:[a.jsx(k,{name:"plus",size:14}),"Adicionar pasta"]})]}),Oe?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("span",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Carregando..."})}):_.length===0?a.jsxs("div",{className:"rounded-[var(--radius-md)] border border-dashed p-6 text-center",style:{borderColor:"var(--color-border)"},children:[a.jsx(k,{name:"folder",size:24,className:"mx-auto mb-2",style:{color:"var(--color-text-secondary)"}}),a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Nenhuma pasta/projeto vinculada"}),a.jsx(q,{size:"sm",className:"mt-3",onClick:Vs,children:"Adicionar primeira pasta"})]}):a.jsx("div",{className:"space-y-2",children:_.map(re=>a.jsxs("div",{className:"flex items-center gap-3 rounded-[var(--radius-md)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx(k,{name:"folder",size:16,style:{color:"var(--color-text-secondary)"}}),a.jsx("div",{className:"flex-1 min-w-0",children:de===re.id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ct,{value:E,onChange:Ne=>W(Ne.target.value),className:"h-8","aria-label":`Label do local ${re.label}`,autoFocus:!0,onKeyDown:Ne=>{Ne.key==="Enter"&&Ia(re.id),Ne.key==="Escape"&&ge(null)}}),a.jsx(q,{size:"sm",variant:"ghost","aria-label":`Salvar local ${re.label}`,onClick:()=>Ia(re.id),children:a.jsx(k,{name:"check",size:14})}),a.jsx(q,{size:"sm",variant:"ghost","aria-label":`Cancelar edição de ${re.label}`,onClick:()=>ge(null),children:a.jsx(k,{name:"x",size:14})})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm font-medium truncate",children:re.label}),a.jsx("p",{className:"text-caption font-mono truncate",style:{color:"var(--color-text-secondary)"},children:re.path}),a.jsx("span",{className:"mt-2 inline-flex rounded-full px-2 py-0.5 text-caption",style:{background:Us(re)==="success"?"var(--color-success-subtle)":"var(--color-surface-secondary)",color:Us(re)==="success"?"var(--color-success)":"var(--color-text-secondary)"},children:wa(re)}),!D&&a.jsxs("details",{className:"mt-2 rounded-[var(--radius-sm)] border p-2",style:{borderColor:"var(--color-border)"},children:[a.jsx("summary",{className:"cursor-pointer text-caption font-medium",children:"Adapters da pasta"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Ca.map(Ne=>{const qe=(R[re.id]||[]).includes(Ne.id);return a.jsx(q,{size:"sm",variant:qe?"secondary":"ghost",className:"h-7 px-2","aria-pressed":qe,disabled:D,onClick:()=>kt(re.id,Ne.id),children:Ne.label},Ne.id)})})]})]})}),de!==re.id&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(q,{size:"sm",variant:"ghost","aria-label":`Editar label da pasta ${re.label}`,onClick:()=>{ge(re.id),W(re.label)},children:a.jsx(k,{name:"edit",size:14})}),a.jsx(q,{size:"sm",variant:"ghost","aria-label":`Reparar vínculo da pasta ${re.label}`,onClick:()=>fe(re.id),children:a.jsx(k,{name:"activity",size:14})}),a.jsx(q,{size:"sm",variant:"ghost","aria-label":`Remover vínculo da pasta ${re.label}`,onClick:()=>{xe(re.id),N(re.path)},children:a.jsx(k,{name:"trash",size:14})})]})]},re.id))})]}),ce==="flow"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("section",{className:"grid gap-3 rounded-lg border border-[var(--color-border)] p-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center","aria-label":"Definições versionadas do fluxo",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold",children:"Definições versionadas"}),a.jsx("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Consulte a versão publicada, o rascunho e o mapa de estágios em uma página dedicada."})]}),a.jsx(q,{type:"button",onClick:()=>y(!0),children:"Abrir configuração do fluxo"})]}),a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Altere o template do fluxo de trabalho. Itens em estágios removidos vão para o backlog."}),Ye&&a.jsxs("div",{className:"rounded-[var(--radius-md)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsxs("p",{className:"text-caption font-medium",children:["Template atual: ",Ye]}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:vt.map(re=>a.jsx("span",{className:"rounded-full px-2 py-0.5 text-caption",style:{background:"var(--color-surface-secondary)",color:"var(--color-text-secondary)"},children:re.name},re.id))})]}),ca?a.jsx("div",{className:"flex items-center justify-center py-4",children:a.jsx("span",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Carregando templates..."})}):ht.length===0?a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Nenhum template disponível"}):a.jsx("div",{className:"space-y-2",children:ht.map(re=>{const Ne=re.id===Ye,qe=re.id===It,Xe=re.stages.filter(et=>!vt.some(w=>w.id===et.id)),Ze=vt.filter(et=>!re.stages.some(w=>w.id===et.id)),dt=re.stages.filter(et=>vt.some(w=>w.id===et.id));return a.jsxs(q,{type:"button",variant:"ghost",className:`h-auto w-full flex-col items-stretch gap-2 rounded-[var(--radius-md)] border p-3 text-left ${qe?"border-[var(--color-primary)] bg-[var(--color-primary-subtle)]":"hover:bg-[var(--color-surface-secondary)]"}`,style:{borderColor:qe?void 0:"var(--color-border)"},onClick:()=>Ce(Ne?null:re.id),children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:[re.name,Ne&&a.jsx("span",{className:"ml-2 text-caption",style:{color:"var(--color-text-secondary)"},children:"(atual)"})]}),Ne&&a.jsx(k,{name:"check",size:14,style:{color:"var(--color-primary)"}})]}),re.description&&a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:re.description}),a.jsx("div",{className:"flex flex-wrap gap-1",children:re.stages.map(et=>{const w=vt.some(ye=>ye.id===et.id),se=Xe.some(ye=>ye.id===et.id);return a.jsx("span",{className:"rounded-full px-2 py-0.5 text-caption",style:{background:se?"var(--color-success-subtle)":"var(--color-surface-secondary)",color:se?"var(--color-success)":"var(--color-text-secondary)"},children:et.name},et.id)})}),!Ne&&(Xe.length>0||Ze.length>0)&&a.jsxs("div",{className:"text-caption flex flex-col gap-1",style:{color:"var(--color-text-secondary)"},children:[dt.length>0&&a.jsxs("p",{children:["Inalterados:"," ",dt.map(et=>et.name).join(", ")]}),Xe.length>0&&a.jsxs("p",{style:{color:"var(--color-success)"},children:["Adicionados:"," ",Xe.map(et=>et.name).join(", ")]}),Ze.length>0&&a.jsxs("p",{style:{color:"var(--color-error)"},children:["Removidos:"," ",Ze.map(et=>et.name).join(", ")]}),Ze.length>0&&a.jsx("p",{children:"Itens nesses estágios serão preservados no backlog."})]})]},re.id)})}),It&&It!==Ye&&a.jsx(q,{onClick:ua,disabled:ut,loading:ut,children:"Aplicar template"})]}),ce==="adapters"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Selecione quais adapters estão ativos. Adapters são regenerados automaticamente."}),Ja?a.jsx("div",{className:"flex items-center justify-center py-4",children:a.jsx("span",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Carregando adapters..."})}):ta.length===0?a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Nenhum adapter disponível"}):a.jsx("div",{className:"space-y-2",children:ta.map(re=>{const Ne=[];return re.capabilities.instructions&&Ne.push("Instructions"),re.capabilities.skills&&Ne.push("Skills"),re.capabilities.mcp&&Ne.push("MCP"),re.capabilities.hooks&&Ne.push("Hooks"),a.jsxs(q,{type:"button",variant:"ghost",className:`h-auto w-full items-start justify-start gap-3 rounded-[var(--radius-md)] border p-3 text-left ${re.active?"border-[var(--color-primary)] bg-[var(--color-primary-subtle)]":"hover:bg-[var(--color-surface-secondary)]"}`,style:{borderColor:re.active?void 0:"var(--color-border)"},"aria-label":`${re.active?"Desativar":"Ativar"} adapter ${re.displayName}`,"aria-pressed":re.active,onClick:()=>Tt(re.id),disabled:Gt,children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:`flex h-4 w-4 items-center justify-center rounded border ${re.active?"border-[var(--color-primary)] bg-[var(--color-primary)]":"border-[var(--color-border)]"}`,children:re.active&&a.jsx(k,{name:"check",size:10,style:{color:"var(--color-text-on-primary)"}})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium",children:re.displayName}),re.detected&&a.jsx("span",{className:"rounded-full px-2 py-0.5 text-caption",style:{background:"var(--color-success-subtle)",color:"var(--color-success)"},children:"Detectado"})]}),Ne.length>0&&a.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:Ne.map(qe=>a.jsx("span",{className:"rounded-full px-2 py-0.5 text-caption",style:{background:"var(--color-surface-secondary)",color:"var(--color-text-secondary)"},children:qe},qe))}),a.jsxs("p",{className:"text-caption mt-1",style:{color:"var(--color-text-secondary)"},children:["Arquivo(s) esperado(s):"," ",re.detectionPaths.join(", ")]})]})]},re.id)})})]}),ce==="advanced"&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"rounded-[var(--radius-md)] border p-4",style:{borderColor:"var(--color-error)"},children:[a.jsx("h4",{className:"text-sm font-semibold",style:{color:"var(--color-error)"},children:"Zona de perigo"}),a.jsx("p",{className:"text-caption mt-1",style:{color:"var(--color-text-secondary)"},children:"Excluir este workspace remove o registro mas preserva os arquivos no disco."}),a.jsx(q,{variant:"danger",size:"sm",className:"mt-3",onClick:()=>oe(!0),children:"Excluir Workspace"})]})}),ce==="externalization"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Externalização de dados"}),a.jsx("p",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Os arquivos do workspace (workflow.json, harness, specs, memories) podem ser externalizados para fora do projeto, mantendo apenas o link .le.etra-link."}),n.dataDir?a.jsx("div",{className:"text-caption break-all",style:{color:"var(--color-text-secondary)"},children:n.dataDir}):a.jsx(q,{size:"sm",variant:"secondary",onClick:u,children:"Atualizar localização"}),ps&&a.jsx("p",{className:"text-caption",style:{color:"var(--color-error)"},children:ps}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(q,{size:"sm",loading:nt,onClick:qs,children:"Migrar para diretório externo"}),a.jsx(q,{size:"sm",variant:"secondary",loading:nt,onClick:_l,children:"Migrar e remover origem"})]})]})]})})}),$==="confirm"&&a.jsx(ms,{open:ve,onClose:()=>oe(!1),title:"Excluir workspace?",actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{type:"button",variant:"secondary",onClick:()=>oe(!1),children:"Cancelar"}),a.jsx(q,{type:"button",variant:"danger",onClick:()=>ne("type-name"),children:"Continuar"})]}),children:a.jsxs("p",{className:"text-body",style:{color:"var(--color-text-secondary)"},children:['Tem certeza que deseja excluir "',n.name,'"? Esta ação é irreversível.']})}),$==="type-name"&&a.jsx(ms,{open:ve,onClose:()=>{oe(!1),ne("confirm"),ue("")},title:`Digite "${n.name}" para confirmar`,actions:a.jsxs(a.Fragment,{children:[a.jsx(q,{type:"button",variant:"secondary",onClick:()=>{oe(!1),ne("confirm"),ue("")},children:"Cancelar"}),a.jsx(q,{type:"button",variant:"danger",disabled:me!==n.name,onClick:Fe,children:"Excluir permanentemente"})]}),children:a.jsxs("div",{className:"grid gap-3",children:[a.jsx("p",{className:"text-body",style:{color:"var(--color-text-secondary)"},children:"Todos os dados serão preservados no disco, mas o registro será removido."}),a.jsxs(ma,{className:"flex flex-col items-start gap-[var(--space-2)]",children:[a.jsx("span",{className:"text-caption font-medium",style:{color:"var(--color-text-secondary)"},children:"Nome do workspace"}),a.jsx(ct,{value:me,onChange:ce=>ue(ce.target.value),"aria-label":"Digite o nome do workspace para confirmar exclusão",placeholder:n.name,autoFocus:!0})]})]})}),pe&&a.jsx(Ki,{open:!!pe,onClose:()=>{xe(null),N("")},onConfirm:ls,title:"Remover local?",message:`Remover ${G}?`,confirmLabel:"Confirmar remoção",variant:"danger"}),U&&a.jsx(jr,{open:U,onOpenChange:M,children:a.jsxs(Nr,{side:"right",className:"w-full sm:max-w-md flex flex-col",children:[a.jsxs(Ii,{children:[a.jsx(Fi,{children:"Selecionar diretório"}),a.jsx(Yu,{children:"Navegue e selecione o diretório para adicionar como local."})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ct,{value:X,onChange:ce=>te(ce.target.value),"aria-label":"Caminho do diretório",placeholder:"Caminho do diretório",onKeyDown:ce=>{ce.key==="Enter"&&_a(X)}}),a.jsx(q,{size:"sm","aria-label":"Buscar diretório",onClick:()=>_a(X),children:a.jsx(k,{name:"search",size:14})})]}),F&&a.jsx("p",{className:"text-caption",style:{color:"var(--color-error)"},children:F}),Le?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("span",{className:"text-caption",style:{color:"var(--color-text-secondary)"},children:"Carregando..."})}):a.jsxs("div",{className:"space-y-1",children:[Ge.map(ce=>a.jsxs(q,{type:"button",variant:"ghost",className:`h-auto w-full justify-start gap-2 rounded-[var(--radius-sm)] px-3 py-2 text-left text-sm ${(Me==null?void 0:Me.path)===ce.path?"bg-[var(--color-primary)] text-[var(--color-text-on-primary)]":"hover:bg-[var(--color-surface-secondary)]"}`,onClick:()=>gt(ce),children:[a.jsx(k,{name:"folder",size:14}),a.jsx("span",{className:"truncate",children:ce.name})]},ce.path)),Me&&a.jsxs("div",{className:"rounded-[var(--radius-md)] border p-3",style:{borderColor:"var(--color-border)"},children:[a.jsx("p",{className:"text-caption font-medium",children:"Diretório selecionado"}),a.jsx("p",{className:"mt-1 truncate font-mono text-caption",style:{color:"var(--color-text-secondary)"},children:Me.path})]}),Ge.length===0&&!F&&a.jsx("p",{className:"text-caption py-4 text-center",style:{color:"var(--color-text-secondary)"},children:"Nenhum subdiretório encontrado"})]})]})}),a.jsxs($u,{children:[a.jsx(q,{variant:"secondary",onClick:()=>M(!1),children:"Cancelar"}),a.jsx(q,{disabled:!Me,onClick:Ot,children:"Adicionar"})]})]})})]})}function C1({activeFlow:n}){const i=qj(n);return i.length===0?null:a.jsx("div",{className:"p-4",children:a.jsx(aj,{variant:"warning",title:`Flow ativo com ${i.length} aviso${i.length===1?"":"s"}`,children:a.jsx("div",{className:"grid grid-cols-1 gap-2 pt-1 lg:grid-cols-2",children:i.map((c,u)=>a.jsxs("div",{className:"grid grid-cols-1 items-start gap-1.5 sm:grid-cols-[auto_minmax(0,1fr)] sm:gap-2",children:[a.jsx(ke,{variant:"info",className:"w-fit max-w-full break-all text-caption",children:c.code}),a.jsxs("span",{children:[c.message,c.artifactRef?` (${c.artifactRef})`:""]})]},`${c.code}-${c.artifactRef??u}`))})})})}function z1({sidebar:n,header:i,children:c}){const{open:u}=ss();return a.jsx(Cj,{sidebar:n,header:i,sidebarCollapsed:!u,className:"app-surface-base min-h-svh",style:{"--layout-sidebar-width":"var(--sidebar-width)","--layout-sidebar-width-collapsed":"var(--sidebar-width-icon)"},children:c})}function A1(){const[n,i]=x.useState(null),[c,u]=x.useState(null),[d,f]=x.useState(!0),[h,p]=x.useState("supervision"),[j,v]=x.useState("context.md"),[b,y]=x.useState(()=>{try{const N=localStorage.getItem("letra-active-workspace");return N?JSON.parse(N):null}catch{return null}}),[z,S]=x.useState([]),[T,B]=x.useState(()=>{var R;if(typeof window>"u")return"dark";const N=localStorage.getItem("letra-theme");return N==="light"||N==="dark"?N:(R=window.matchMedia)!=null&&R.call(window,"(prefers-color-scheme: light)").matches?"light":"dark"}),[K,le]=x.useState(null),[ve,oe]=x.useState(0),[$,ne]=x.useState(""),[me,ue]=x.useState(()=>{try{return localStorage.getItem("letra-active-directory")}catch{return null}}),[_,he]=x.useState(!1);x.useEffect(()=>{document.documentElement.classList.toggle("dark",T==="dark"),document.documentElement.classList.toggle("light",T==="light"),localStorage.setItem("letra-theme",T)},[T]);function Oe(N){he(!1),localStorage.setItem("letra-active-workspace",JSON.stringify(N)),me&&(localStorage.removeItem("letra-active-directory"),ue(null)),y(N),p("supervision"),(N.root?fetch("/api/workspace/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:N.root})}):Promise.resolve()).then(()=>ee()).catch(()=>ee())}function be(N){N?localStorage.setItem("letra-active-directory",N):localStorage.removeItem("letra-active-directory"),ue(N),fetch("/api/workspace/directory/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:N})}).then(()=>ee()).catch(()=>ee())}function Z(){localStorage.removeItem("letra-active-workspace"),localStorage.removeItem("letra-active-directory"),y(null),ue(null),he(!0),p("supervision")}function ee(){Promise.all([fetch("/api/workflow").then(N=>N.json()),fetch("/api/workflow/active-flow").then(N=>N.json()).catch(()=>null)]).then(([N,R])=>{N&&!N.error&&i(N),u(R)})}function de(N){N==="knowledge"&&v("context.md"),p(N)}function ge(N="context.md"){v(N),p("knowledge")}const E=x.useCallback(()=>{fetch("/api/health").then(N=>N.json()).then(N=>{const R=Array.isArray(N==null?void 0:N.active)?N.active:[],I=(N==null?void 0:N.summary)??{};le({activeAlerts:typeof I.activeAlerts=="number"?I.activeAlerts:R.length,criticalAlerts:typeof I.criticalAlerts=="number"?I.criticalAlerts:R.filter(D=>/crit|alta|high/.test(String((D==null?void 0:D.severity)??"").toLowerCase())).length})}).catch(()=>le(null))},[]);if(x.useEffect(()=>{const N=b!=null&&b.root?fetch("/api/workspace/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:b.root})}).then(()=>{}):Promise.resolve(),R=me?fetch("/api/workspace/directory/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:me})}).then(()=>{}):Promise.resolve();Promise.all([N,R]).then(()=>Promise.all([fetch("/api/workflow").then(D=>D.json()),fetch("/api/workflow/active-flow").then(D=>D.json()).catch(()=>null)])).then(([D,ie])=>{D&&!D.error&&i(D),u(ie),f(!1)}).catch(()=>f(!1)),E(),fetch("/api/workspaces").then(D=>D.json()).then(D=>{Array.isArray(D)&&S(D)}).catch(()=>{});const I=yx("/events");return I.addEventListener("workflow-updated",()=>{ee(),oe(D=>D+1),ne("Fluxo atualizado.")}),I.addEventListener("diagnostics-updated",()=>{E(),oe(D=>D+1),ne("Diagnosticos atualizados.")}),()=>I.close()},[E]),d)return a.jsxs("div",{className:"app-surface-base flex h-screen flex-col gap-6 p-6",children:[a.jsxs("div",{className:"grid grid-cols-2 xl:grid-cols-4 gap-4",children:[a.jsx(ja,{}),a.jsx(ja,{}),a.jsx(ja,{}),a.jsx(ja,{})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3",children:[a.jsx(ja,{}),a.jsx(ja,{}),a.jsx(ja,{}),a.jsx(ja,{}),a.jsx(ja,{}),a.jsx(ja,{})]})]});const W=new URLSearchParams(window.location.search).get("setup")==="true";function pe(){if(!n||W)return a.jsx(Rj,{onComplete:N=>{i(N);const R=new URL(window.location.href);R.searchParams.delete("setup"),window.history.replaceState({},"",R.toString())}});if(!b)return a.jsx(v1,{onSelect:Oe,onWorkspacesLoaded:S,gateMode:!0,activeDirectory:me,startCreating:_});switch(h){case"supervision":return a.jsx(yp,{workflow:n,activeFlow:c,onTabChange:N=>p(N)});case"work":return a.jsx(T0,{workflow:n,activeFlow:c,specRefreshKey:ve,onItemMoved:ee,onOpenSpec:()=>ge("specs")});case"knowledge":return a.jsx(e1,{initialTab:j});case"activity":return a.jsx(o1,{});case"agents":return n?a.jsx(m1,{workflow:n,activeFlow:c}):a.jsx(u1,{});case"settings":return a.jsx(w1,{workspace:b,onWorkspaceUpdated:N=>{y(N),S(R=>R.map(I=>I.id===N.id?N:I))},onWorkspaceDeleted:()=>{he(!1),y(null),p("supervision")},onRefreshWorkflow:ee,onCreateWorkspace:Z});default:return a.jsx(yp,{workflow:n,activeFlow:c,onTabChange:N=>p(N)})}}const xe=n?zr(n,c):new Set,G=(n==null?void 0:n.items.filter(N=>xe.has(N.stage)).length)??0;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:$}),a.jsx(xj,{className:"min-h-svh w-full",style:{"--sidebar-width":"308px","--sidebar-width-icon":"3rem"},children:a.jsx(z1,{sidebar:a.jsx(Dj,{activeTab:h,onTabChange:de,gateCount:G,workspaceActive:!!b,activeWorkspace:b,activeDirectory:me,onDirectoryChange:be,onOpenWorkspaceSettings:()=>p("settings")}),header:a.jsx(Ej,{theme:T,onThemeChange:B,gateCount:G,activeDirectory:me,workspaces:z,activeWorkspace:b,onWorkspaceChange:Oe,onDirectoryChange:be,health:K,onOpenHealthCenter:()=>p("supervision"),onOpenWorkspaceSettings:()=>p("settings")}),children:a.jsxs("main",{className:"flex min-h-0 flex-1 flex-col animate-fade-in",children:[a.jsx(C1,{activeFlow:c}),pe()]})})})]})}function E1(){return a.jsx(Fy,{children:a.jsx(A1,{})})}Zg.createRoot(document.getElementById("root")).render(a.jsx(x.StrictMode,{children:a.jsx(E1,{})}));
|