loki-mode 6.40.0 → 6.41.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/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v6.40.0
6
+ # Loki Mode v6.41.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -267,4 +267,4 @@ The following features are documented in skill modules but not yet fully automat
267
267
  | Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
268
268
  | Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
269
269
 
270
- **v6.40.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
270
+ **v6.41.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.40.0
1
+ 6.41.0
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.40.0"
10
+ __version__ = "6.41.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v6.40.0
5
+ **Version:** v6.41.0
6
6
 
7
7
  ---
8
8
 
package/mcp/__init__.py CHANGED
@@ -57,4 +57,4 @@ try:
57
57
  except ImportError:
58
58
  __all__ = ['mcp']
59
59
 
60
- __version__ = '6.40.0'
60
+ __version__ = '6.41.0'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "6.40.0",
3
+ "version": "6.41.0",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "agent",
@@ -0,0 +1,11 @@
1
+ var ot=e=>{throw TypeError(e)};var at=(e,t,n)=>t.has(e)||ot("Cannot "+n);var we=(e,t,n)=>(at(e,t,"read from private field"),n?n.call(e):t.get(e)),it=(e,t,n)=>t.has(e)?ot("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),st=(e,t,n,r)=>(at(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{r as u,W as ge,j as f,a as ne,u as on,b as an,H as Ae,E as sn}from"./index-DpAb7DLD.js";function lt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ln(e){if(Array.isArray(e))return e}function cn(e,t,n){return(t=gn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function un(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,l,a=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(d){c=!0,o=d}finally{try{if(!s&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return a}}function dn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ct(Object(n),!0).forEach(function(r){cn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fn(e,t){if(e==null)return{};var n,r,o=pn(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function pn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function hn(e,t){return ln(e)||un(e,t)||vn(e,t)||dn()}function mn(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gn(e){var t=mn(e,"string");return typeof t=="symbol"?t:t+""}function vn(e,t){if(e){if(typeof e=="string")return lt(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lt(e,t):void 0}}function xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dt(Object(n),!0).forEach(function(r){xn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,i){return i(o)},r)}}function Se(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var l=arguments.length,a=new Array(l),s=0;s<l;s++)a[s]=arguments[s];return t.apply(n,[].concat(o,a))}}}function $e(e){return{}.toString.call(e).includes("Object")}function bn(e){return!Object.keys(e).length}function Pe(e){return typeof e=="function"}function wn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sn(e,t){return $e(t)||oe("changeType"),Object.keys(t).some(function(n){return!wn(e,n)})&&oe("changeField"),t}function zn(e){Pe(e)||oe("selectorType")}function jn(e){Pe(e)||$e(e)||oe("handlerType"),$e(e)&&Object.values(e).some(function(t){return!Pe(t)})&&oe("handlersType")}function Cn(e){e||oe("initialIsRequired"),$e(e)||oe("initialType"),bn(e)&&oe("initialContent")}function Pn(e,t){throw new Error(e[t]||e.default)}var kn={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},oe=Se(Pn)(kn),Le={changes:Sn,selector:zn,handler:jn,initial:Cn};function En(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Le.initial(e),Le.handler(t);var n={current:e},r=Se(On)(n,t),o=Se(Ln)(n),i=Se(Le.changes)(e),l=Se(Mn)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Le.selector(c),c(n.current)}function s(c){yn(r,o,i,l)(c)}return[a,s]}function Mn(e,t){return Pe(t)?t(e.current):t}function Ln(e,t){return e.current=ft(ft({},e.current),t),t}function On(e,t,n){return Pe(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var Nn={create:En},Rn={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Dn(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var l=arguments.length,a=new Array(l),s=0;s<l;s++)a[s]=arguments[s];return t.apply(n,[].concat(o,a))}}}function In(e){return{}.toString.call(e).includes("Object")}function $n(e){return e||pt("configIsRequired"),In(e)||pt("configType"),e.urls?(Tn(),{paths:{vs:e.urls.monacoBase}}):e}function Tn(){console.warn(Lt.deprecation)}function Fn(e,t){throw new Error(e[t]||e.default)}var Lt={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
+ You are using deprecated way of configuration.
4
+
5
+ Instead of using
6
+ monaco.config({ urls: { monacoBase: '...' } })
7
+ use
8
+ monaco.config({ paths: { vs: '...' } })
9
+
10
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
+ `},pt=Dn(Fn)(Lt),An={config:$n},Bn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(i,l){return l(i)},o)}};function Ot(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Ot(e[n],t[n]))}),ut(ut({},e),t)}var Wn={type:"cancelation",msg:"operation is manually canceled"};function Be(e){var t=!1,n=new Promise(function(r,o){e.then(function(i){return t?o(Wn):r(i)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var Hn=["monaco"],Vn=Nn.create({config:Rn,isInitialized:!1,resolve:null,reject:null,monaco:null}),Nt=hn(Vn,2),Ee=Nt[0],Te=Nt[1];function Gn(e){var t=An.config(e),n=t.monaco,r=fn(t,Hn);Te(function(o){return{config:Ot(o.config,r),monaco:n}})}function Un(){var e=Ee(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Te({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Be(We);if(window.monaco&&window.monaco.editor)return Rt(window.monaco),e.resolve(window.monaco),Be(We);Bn(qn,Xn)(Yn)}return Be(We)}function qn(e){return document.body.appendChild(e)}function Kn(e){var t=document.createElement("script");return e&&(t.src=e),t}function Xn(e){var t=Ee(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),n=Kn("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Yn(){var e=Ee(function(n){var r=n.config,o=n.resolve,i=n.reject;return{config:r,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;Rt(r),e.resolve(r)},function(n){e.reject(n)})}function Rt(e){Ee().monaco||Te({monaco:e})}function _n(){return Ee(function(e){var t=e.monaco;return t})}var We=new Promise(function(e,t){return Te({resolve:e,reject:t})}),Dt={config:Gn,init:Un,__getMonacoInstance:_n},Jn={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},He=Jn,Qn={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Zn=Qn;function er({children:e}){return ge.createElement("div",{style:Zn.container},e)}var tr=er,nr=tr;function rr({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:i,wrapperProps:l}){return ge.createElement("section",{style:{...He.wrapper,width:e,height:t},...l},!n&&ge.createElement(nr,null,r),ge.createElement("div",{ref:o,style:{...He.fullWidth,...!n&&He.hide},className:i}))}var or=rr,It=u.memo(or);function ar(e){u.useEffect(e,[])}var $t=ar;function ir(e,t,n=!0){let r=u.useRef(!0);u.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var K=ir;function je(){}function he(e,t,n,r){return sr(e,r)||lr(e,t,n,r)}function sr(e,t){return e.editor.getModel(Tt(e,t))}function lr(e,t,n,r){return e.editor.createModel(t,n,r?Tt(e,r):void 0)}function Tt(e,t){return e.Uri.parse(t)}function cr({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:l,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:s=!1,theme:c="light",loading:d="Loading...",options:v={},height:g="100%",width:M="100%",className:w,wrapperProps:m={},beforeMount:b=je,onMount:x=je}){let[p,z]=u.useState(!1),[S,h]=u.useState(!0),P=u.useRef(null),C=u.useRef(null),D=u.useRef(null),F=u.useRef(x),L=u.useRef(b),k=u.useRef(!1);$t(()=>{let j=Dt.init();return j.then(R=>(C.current=R)&&h(!1)).catch(R=>(R==null?void 0:R.type)!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>P.current?A():j.cancel()}),K(()=>{if(P.current&&C.current){let j=P.current.getOriginalEditor(),R=he(C.current,e||"",r||n||"text",i||"");R!==j.getModel()&&j.setModel(R)}},[i],p),K(()=>{if(P.current&&C.current){let j=P.current.getModifiedEditor(),R=he(C.current,t||"",o||n||"text",l||"");R!==j.getModel()&&j.setModel(R)}},[l],p),K(()=>{let j=P.current.getModifiedEditor();j.getOption(C.current.editor.EditorOption.readOnly)?j.setValue(t||""):t!==j.getValue()&&(j.executeEdits("",[{range:j.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),j.pushUndoStop())},[t],p),K(()=>{var j,R;(R=(j=P.current)==null?void 0:j.getModel())==null||R.original.setValue(e||"")},[e],p),K(()=>{let{original:j,modified:R}=P.current.getModel();C.current.editor.setModelLanguage(j,r||n||"text"),C.current.editor.setModelLanguage(R,o||n||"text")},[n,r,o],p),K(()=>{var j;(j=C.current)==null||j.editor.setTheme(c)},[c],p),K(()=>{var j;(j=P.current)==null||j.updateOptions(v)},[v],p);let E=u.useCallback(()=>{var H;if(!C.current)return;L.current(C.current);let j=he(C.current,e||"",r||n||"text",i||""),R=he(C.current,t||"",o||n||"text",l||"");(H=P.current)==null||H.setModel({original:j,modified:R})},[n,t,o,e,r,i,l]),$=u.useCallback(()=>{var j;!k.current&&D.current&&(P.current=C.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...v}),E(),(j=C.current)==null||j.editor.setTheme(c),z(!0),k.current=!0)},[v,c,E]);u.useEffect(()=>{p&&F.current(P.current,C.current)},[p]),u.useEffect(()=>{!S&&!p&&$()},[S,p,$]);function A(){var R,H,G,X;let j=(R=P.current)==null?void 0:R.getModel();a||((H=j==null?void 0:j.original)==null||H.dispose()),s||((G=j==null?void 0:j.modified)==null||G.dispose()),(X=P.current)==null||X.dispose()}return ge.createElement(It,{width:M,height:g,isEditorReady:p,loading:d,_ref:D,className:w,wrapperProps:m})}var ur=cr;u.memo(ur);function dr(e){let t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}var fr=dr,Oe=new Map;function pr({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:i,theme:l="light",line:a,loading:s="Loading...",options:c={},overrideServices:d={},saveViewState:v=!0,keepCurrentModel:g=!1,width:M="100%",height:w="100%",className:m,wrapperProps:b={},beforeMount:x=je,onMount:p=je,onChange:z,onValidate:S=je}){let[h,P]=u.useState(!1),[C,D]=u.useState(!0),F=u.useRef(null),L=u.useRef(null),k=u.useRef(null),E=u.useRef(p),$=u.useRef(x),A=u.useRef(),j=u.useRef(r),R=fr(i),H=u.useRef(!1),G=u.useRef(!1);$t(()=>{let O=Dt.init();return O.then(I=>(F.current=I)&&D(!1)).catch(I=>(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>L.current?_():O.cancel()}),K(()=>{var I,V,ee,J;let O=he(F.current,e||r||"",t||o||"",i||n||"");O!==((I=L.current)==null?void 0:I.getModel())&&(v&&Oe.set(R,(V=L.current)==null?void 0:V.saveViewState()),(ee=L.current)==null||ee.setModel(O),v&&((J=L.current)==null||J.restoreViewState(Oe.get(i))))},[i],h),K(()=>{var O;(O=L.current)==null||O.updateOptions(c)},[c],h),K(()=>{!L.current||r===void 0||(L.current.getOption(F.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(G.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),G.current=!1))},[r],h),K(()=>{var I,V;let O=(I=L.current)==null?void 0:I.getModel();O&&o&&((V=F.current)==null||V.editor.setModelLanguage(O,o))},[o],h),K(()=>{var O;a!==void 0&&((O=L.current)==null||O.revealLine(a))},[a],h),K(()=>{var O;(O=F.current)==null||O.editor.setTheme(l)},[l],h);let X=u.useCallback(()=>{var O;if(!(!k.current||!F.current)&&!H.current){$.current(F.current);let I=i||n,V=he(F.current,r||e||"",t||o||"",I||"");L.current=(O=F.current)==null?void 0:O.editor.create(k.current,{model:V,automaticLayout:!0,...c},d),v&&L.current.restoreViewState(Oe.get(I)),F.current.editor.setTheme(l),a!==void 0&&L.current.revealLine(a),P(!0),H.current=!0}},[e,t,n,r,o,i,c,d,v,l,a]);u.useEffect(()=>{h&&E.current(L.current,F.current)},[h]),u.useEffect(()=>{!C&&!h&&X()},[C,h,X]),j.current=r,u.useEffect(()=>{var O,I;h&&z&&((O=A.current)==null||O.dispose(),A.current=(I=L.current)==null?void 0:I.onDidChangeModelContent(V=>{G.current||z(L.current.getValue(),V)}))},[h,z]),u.useEffect(()=>{if(h){let O=F.current.editor.onDidChangeMarkers(I=>{var ee;let V=(ee=L.current.getModel())==null?void 0:ee.uri;if(V&&I.find(J=>J.path===V.path)){let J=F.current.editor.getModelMarkers({resource:V});S==null||S(J)}});return()=>{O==null||O.dispose()}}return()=>{}},[h,S]);function _(){var O,I;(O=A.current)==null||O.dispose(),g?v&&Oe.set(i,L.current.saveViewState()):(I=L.current.getModel())==null||I.dispose(),L.current.dispose()}return ge.createElement(It,{width:M,height:w,isEditorReady:h,loading:s,_ref:k,className:m,wrapperProps:b})}var hr=pr,mr=u.memo(hr),gr=mr;function vr(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function xr(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function yr(e){return e/100*window.innerHeight}function br(e){return e/100*window.innerWidth}function wr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function ze({groupSize:e,panelElement:t,styleProp:n}){let r;const[o,i]=wr(n);switch(i){case"%":{r=o/100*e;break}case"px":{r=o;break}case"rem":{r=xr(t,o);break}case"em":{r=vr(t,o);break}case"vh":{r=yr(o);break}case"vw":{r=br(o);break}}return r}function q(e){return parseFloat(e.toFixed(3))}function ye({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,o)=>(r+=t==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,r),0)}function Ge(e){const{panels:t}=e,n=ye({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:o,panelConstraints:i}=r;let l=0;if(i.collapsedSize!==void 0){const d=ze({groupSize:n,panelElement:o,styleProp:i.collapsedSize});l=q(d/n*100)}let a;if(i.defaultSize!==void 0){const d=ze({groupSize:n,panelElement:o,styleProp:i.defaultSize});a=q(d/n*100)}let s=0;if(i.minSize!==void 0){const d=ze({groupSize:n,panelElement:o,styleProp:i.minSize});s=q(d/n*100)}let c=100;if(i.maxSize!==void 0){const d=ze({groupSize:n,panelElement:o,styleProp:i.maxSize});c=q(d/n*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:l,collapsible:i.collapsible===!0,defaultSize:a,disabled:i.disabled,minSize:s,maxSize:c,panelId:r.id}})}function T(e,t="Assertion error"){if(!e)throw Error(t)}function Ue(e,t){return Array.from(t).sort(e==="horizontal"?Sr:zr)}function Sr(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function zr(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Ft(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function At(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function jr({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let o,i=Number.MAX_VALUE;for(const l of t){const{x:a,y:s}=At(r,l),c=e==="horizontal"?a:s;c<i&&(i=c,o=l)}return T(o,"No rect found"),o}let Ne;function Cr(){return Ne===void 0&&(typeof matchMedia=="function"?Ne=!!matchMedia("(pointer:coarse)").matches:Ne=!1),Ne}function Bt(e){const{element:t,orientation:n,panels:r,separators:o}=e,i=Ue(n,Array.from(t.children).filter(Ft).map(w=>({element:w}))).map(({element:w})=>w),l=[];let a=!1,s=!1,c=-1,d=-1,v=0,g,M=[];{let w=-1;for(const m of i)m.hasAttribute("data-panel")&&(w++,m.ariaDisabled===null&&(v++,c===-1&&(c=w),d=w))}if(v>1){let w=-1;for(const m of i)if(m.hasAttribute("data-panel")){w++;const b=r.find(x=>x.element===m);if(b){if(g){const x=g.element.getBoundingClientRect(),p=m.getBoundingClientRect();let z;if(s){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),h=n==="horizontal"?new DOMRect(p.left,p.top,0,p.height):new DOMRect(p.left,p.top,p.width,0);switch(M.length){case 0:{z=[S,h];break}case 1:{const P=M[0],C=jr({orientation:n,rects:[x,p],targetRect:P.element.getBoundingClientRect()});z=[P,C===x?h:S];break}default:{z=M;break}}}else M.length?z=M:z=[n==="horizontal"?new DOMRect(x.right,p.top,p.left-x.right,p.height):new DOMRect(p.left,x.bottom,p.width,p.top-x.bottom)];for(const S of z){let h="width"in S?S:S.element.getBoundingClientRect();const P=Cr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(h.width<P){const D=P-h.width;h=new DOMRect(h.x-D/2,h.y,h.width+D,h.height)}if(h.height<P){const D=P-h.height;h=new DOMRect(h.x,h.y-D/2,h.width,h.height+D)}const C=w<=c||w>d;!a&&!C&&l.push({group:e,groupSize:ye({group:e}),panels:[g,b],separator:"width"in S?void 0:S,rect:h}),a=!1}}s=!1,g=b,M=[]}}else if(m.hasAttribute("data-separator")){m.ariaDisabled!==null&&(a=!0);const b=o.find(x=>x.element===m);b?M.push(b):(g=void 0,M=[])}else s=!0}return l}var re;class Wt{constructor(){it(this,re,{})}addListener(t,n){const r=we(this,re)[t];return r===void 0?we(this,re)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=we(this,re)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let o=!1,i=null;const l=Array.from(r);for(let a=0;a<l.length;a++){const s=l[a];try{s.call(null,n)}catch(c){i===null&&(o=!0,i=c)}}if(o)throw i}}removeAllListeners(){st(this,re,{})}removeListener(t,n){const r=we(this,re)[t];if(r!==void 0){const o=r.indexOf(n);o>=0&&r.splice(o,1)}}}re=new WeakMap;let Z=new Map;const Ht=new Wt;function Pr(e){Z=new Map(Z),Z.delete(e)}function ht(e,t){for(const[n]of Z)if(n.id===e)return n}function ae(e,t){for(const[n,r]of Z)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function de(){return Z}function Ye(e,t){return Ht.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function te(e,t){const n=Z.get(e);Z=new Map(Z),Z.set(e,t),Ht.emit("groupChange",{group:e,prev:n,next:t})}function kr(e,t,n){let r,o={x:1/0,y:1/0};for(const i of t){const l=At(n,i.rect);switch(e){case"horizontal":{l.x<=o.x&&(r=i,o=l);break}case"vertical":{l.y<=o.y&&(r=i,o=l);break}}}return r?{distance:o,hitRegion:r}:void 0}function Er(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Mr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:vt(e),b:vt(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();T(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:gt(mt(n.a)),b:gt(mt(n.b))};if(o.a===o.b){const i=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const s=i[a];if(s===l.a)return 1;if(s===l.b)return-1}}return Math.sign(o.a-o.b)}const Lr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Or(e){const t=getComputedStyle(Vt(e)??e).display;return t==="flex"||t==="inline-flex"}function Nr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Or(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Lr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function mt(e){let t=e.length;for(;t--;){const n=e[t];if(T(n,"Missing node"),Nr(n))return n}return null}function gt(e){return e&&Number(getComputedStyle(e).zIndex)||0}function vt(e){const t=[];for(;e;)t.push(e),e=Vt(e);return t}function Vt(e){const{parentNode:t}=e;return Er(t)?t.host:t}function Rr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Dr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Ft(n)||n.contains(e)||e.contains(n))return!0;if(Mr(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Rr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function _e(e,t){const n=[];return t.forEach((r,o)=>{if(o.disabled)return;const i=Bt(o),l=kr(o.orientation,i,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&Dr({groupElement:o.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function Ir(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function U(e,t,n=0){return Math.abs(q(e)-q(t))<=n}function Q(e,t){return U(e,t)?0:e>t?1:-1}function me({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:o=0,collapsible:i,disabled:l,maxSize:a=100,minSize:s=0}=t;if(l&&!e)return n;if(Q(r,s)<0)if(i){const c=(o+s)/2;Q(r,c)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=q(r),r}function ke({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(U(e,0))return t;const l=i==="imperative-api",a=Object.values(t),s=Object.values(o),c=[...a],[d,v]=r;T(d!=null,"Invalid first pivot index"),T(v!=null,"Invalid second pivot index");let g=0;switch(i){case"keyboard":{{const m=e<0?v:d,b=n[m];T(b,`Panel constraints not found for index ${m}`);const{collapsedSize:x=0,collapsible:p,minSize:z=0}=b;if(p){const S=a[m];if(T(S!=null,`Previous layout not found for panel index ${m}`),U(S,x)){const h=z-S;Q(h,Math.abs(e))>0&&(e=e<0?0-h:h)}}}{const m=e<0?d:v,b=n[m];T(b,`No panel constraints found for index ${m}`);const{collapsedSize:x=0,collapsible:p,minSize:z=0}=b;if(p){const S=a[m];if(T(S!=null,`Previous layout not found for panel index ${m}`),U(S,z)){const h=S-x;Q(h,Math.abs(e))>0&&(e=e<0?0-h:h)}}}break}default:{const m=e<0?v:d,b=n[m];T(b,`Panel constraints not found for index ${m}`);const x=a[m],{collapsible:p,collapsedSize:z,minSize:S}=b;if(p&&Q(x,S)<0)if(e>0){const h=S-z,P=h/2,C=x+e;Q(C,S)<0&&(e=Q(e,P)<=0?0:h)}else{const h=S-z,P=100-h/2,C=x-e;Q(C,S)<0&&(e=Q(100+e,P)>0?0:-h)}break}}{const m=e<0?1:-1;let b=e<0?v:d,x=0;for(;;){const z=a[b];T(z!=null,`Previous layout not found for panel index ${b}`);const S=me({overrideDisabledPanels:l,panelConstraints:n[b],prevSize:z,size:100})-z;if(x+=S,b+=m,b<0||b>=n.length)break}const p=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-p:p}{let m=e<0?d:v;for(;m>=0&&m<n.length;){const b=Math.abs(e)-Math.abs(g),x=a[m];T(x!=null,`Previous layout not found for panel index ${m}`);const p=x-b,z=me({overrideDisabledPanels:l,panelConstraints:n[m],prevSize:x,size:p});if(!U(x,z)&&(g+=x-z,c[m]=z,g.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Ir(s,c))return o;{const m=e<0?v:d,b=a[m];T(b!=null,`Previous layout not found for panel index ${m}`);const x=b+g,p=me({overrideDisabledPanels:l,panelConstraints:n[m],prevSize:b,size:x});if(c[m]=p,!U(p,x)){let z=x-p,S=e<0?v:d;for(;S>=0&&S<n.length;){const h=c[S];T(h!=null,`Previous layout not found for panel index ${S}`);const P=h+z,C=me({overrideDisabledPanels:l,panelConstraints:n[S],prevSize:h,size:P});if(U(h,C)||(z-=C-h,c[S]=C),U(z,0))break;e>0?S--:S++}}}const M=Object.values(c).reduce((m,b)=>b+m,0);if(!U(M,100,.1))return o;const w=Object.keys(o);return c.reduce((m,b,x)=>(m[w[x]]=b,m),{})}function le(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Q(e[n],t[n])!==0)return!1;return!0}function ce({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],o=r.reduce((a,s)=>a+s,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(a=>`${a}%`).join(", ")}`);if(!U(o,100)&&r.length>0)for(let a=0;a<t.length;a++){const s=r[a];T(s!=null,`No layout data found for index ${a}`);const c=100/o*s;r[a]=c}let i=0;for(let a=0;a<t.length;a++){const s=n[a];T(s!=null,`No layout data found for index ${a}`);const c=r[a];T(c!=null,`No layout data found for index ${a}`);const d=me({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:s,size:c});c!=d&&(i+=c-d,r[a]=d)}if(!U(i,0))for(let a=0;a<t.length;a++){const s=r[a];T(s!=null,`No layout data found for index ${a}`);const c=s+i,d=me({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:s,size:c});if(s!==d&&(i-=d-s,r[a]=d,U(i,0)))break}const l=Object.keys(e);return r.reduce((a,s,c)=>(a[l[c]]=s,a),{})}function Gt({groupId:e,panelId:t}){const n=()=>{const a=de();for(const[s,{defaultLayoutDeferred:c,derivedPanelConstraints:d,layout:v,groupSize:g,separatorToPanels:M}]of a)if(s.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:d,group:s,groupSize:g,layout:v,separatorToPanels:M};throw Error(`Group ${e} not found`)},r=()=>{const a=n().derivedPanelConstraints.find(s=>s.panelId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},o=()=>{const a=n().group.panels.find(s=>s.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const a=n().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},l=a=>{const s=i();if(a===s)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:d,group:v,groupSize:g,layout:M,separatorToPanels:w}=n(),m=v.panels.findIndex(z=>z.id===t),b=m===v.panels.length-1,x=ke({delta:b?s-a:a-s,initialLayout:M,panelConstraints:d,pivotIndices:b?[m-1,m]:[m,m+1],prevLayout:M,trigger:"imperative-api"}),p=ce({layout:x,panelConstraints:d});le(M,p)||te(v,{defaultLayoutDeferred:c,derivedPanelConstraints:d,groupSize:g,layout:p,separatorToPanels:w})};return{collapse:()=>{const{collapsible:a,collapsedSize:s}=r(),{mutableValues:c}=o(),d=i();a&&d!==s&&(c.expandToSize=d,l(s))},expand:()=>{const{collapsible:a,collapsedSize:s,minSize:c}=r(),{mutableValues:d}=o(),v=i();if(a&&v===s){let g=d.expandToSize??c;g===0&&(g=1),l(g)}},getSize:()=>{const{group:a}=n(),s=i(),{element:c}=o(),d=a.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:s,inPixels:d}},isCollapsed:()=>{const{collapsible:a,collapsedSize:s}=r(),c=i();return a&&U(s,c)},resize:a=>{const{group:s}=n(),{element:c}=o(),d=ye({group:s}),v=ze({groupSize:d,panelElement:c,styleProp:a}),g=q(v/d*100);l(g)}}}function xt(e){if(e.defaultPrevented)return;const t=de();_e(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(r){const o=r.panelConstraints.defaultSize,i=Gt({groupId:n.group.id,panelId:r.id});i&&o!==void 0&&(i.resize(o),e.preventDefault())}}})}function De(e){const t=de();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function Ut({groupId:e}){const t=()=>{const n=de();for(const[r,o]of n)if(r.id===e)return{group:r,...o};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:i,groupSize:l,layout:a,separatorToPanels:s}=t(),c=ce({layout:n,panelConstraints:o});return r?a:(le(a,c)||te(i,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:l,layout:c,separatorToPanels:s}),c)}}}function se(e,t){const n=De(e),r=ae(n.id,!0),o=n.separators.find(d=>d.element===e);T(o,"Matching separator not found");const i=r.separatorToPanels.get(o);T(i,"Matching panels not found");const l=i.map(d=>n.panels.indexOf(d)),a=Ut({groupId:n.id}).getLayout(),s=ke({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),c=ce({layout:s,panelConstraints:r.derivedPanelConstraints});le(a,c)||te(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function yt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=De(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&se(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&se(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&se(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&se(t,-5);break}case"End":{e.preventDefault(),se(t,100);break}case"Enter":{e.preventDefault();const r=De(t),o=ae(r.id,!0),{derivedPanelConstraints:i,layout:l,separatorToPanels:a}=o,s=r.separators.find(g=>g.element===t);T(s,"Matching separator not found");const c=a.get(s);T(c,"Matching panels not found");const d=c[0],v=i.find(g=>g.panelId===d.id);if(T(v,"Panel metadata not found"),v.collapsible){const g=l[d.id],M=v.collapsedSize===g?r.mutableState.expandedPanelSizes[d.id]??v.minSize:v.collapsedSize;se(t,M-g)}break}case"F6":{e.preventDefault();const r=De(t).separators.map(l=>l.element),o=Array.from(r).findIndex(l=>l===e.currentTarget);T(o!==null,"Index not found");const i=e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0;r[i].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),se(t,-100);break}}}let ve={cursorFlags:0,state:"inactive"};const Je=new Wt;function ue(){return ve}function $r(e){return Je.addListener("change",e)}function Tr(e){const t=ve,n={...ve};n.cursorFlags=e,ve=n,Je.emit("change",{prev:t,next:n})}function xe(e){const t=ve;ve=e,Je.emit("change",{prev:t,next:e})}function bt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=de(),n=_e(e,t),r=new Map;let o=!1;n.forEach(i=>{i.separator&&(o||(o=!0,i.separator.element.focus({preventScroll:!0})));const l=t.get(i.group);l&&r.set(i.group,l.layout)}),xe({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const Fr=e=>e,Ve=()=>{},qt=1,Kt=2,Xt=4,Yt=8,wt=3,St=12;let Re;function zt(){return Re===void 0&&(Re=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Re=!0)),Re}function Ar({cursorFlags:e,groups:t,state:n}){let r=0,o=0;switch(n){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{r++;break}case"vertical":{o++;break}}})}if(!(r===0&&o===0)){switch(n){case"active":{if(e&&zt()){const i=(e&qt)!==0,l=(e&Kt)!==0,a=(e&Xt)!==0,s=(e&Yt)!==0;if(i)return a?"se-resize":s?"ne-resize":"e-resize";if(l)return a?"sw-resize":s?"nw-resize":"w-resize";if(a)return"s-resize";if(s)return"n-resize"}break}}return zt()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const jt=new WeakMap;function Qe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=jt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=ue();switch(r.state){case"active":case"hover":{const o=Ar({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),i=`*, *:hover {cursor: ${o} !important; }`;if(t===i)return;t=i,o?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}jt.set(e,{prevStyle:t,styleSheet:n})}function _t({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:i,prevCursorFlags:l}){let a=0;n.forEach(c=>{const{group:d,groupSize:v}=c,{orientation:g,panels:M}=d,{disableCursor:w}=d.mutableState;let m=0;i?g==="horizontal"?m=(t.clientX-i.x)/v*100:m=(t.clientY-i.y)/v*100:g==="horizontal"?m=t.clientX<0?-100:100:m=t.clientY<0?-100:100;const b=r.get(d),x=o.get(d);if(!b||!x)return;const{defaultLayoutDeferred:p,derivedPanelConstraints:z,groupSize:S,layout:h,separatorToPanels:P}=x;if(z&&h&&P){const C=ke({delta:m,initialLayout:b,panelConstraints:z,pivotIndices:c.panels.map(D=>M.indexOf(D)),prevLayout:h,trigger:"mouse-or-touch"});if(le(C,h)){if(m!==0&&!w)switch(g){case"horizontal":{a|=m<0?qt:Kt;break}case"vertical":{a|=m<0?Xt:Yt;break}}}else te(c.group,{defaultLayoutDeferred:p,derivedPanelConstraints:z,groupSize:S,layout:C,separatorToPanels:P})}});let s=0;t.movementX===0?s|=l&wt:s|=a&wt,t.movementY===0?s|=l&St:s|=a&St,Tr(s),Qe(e)}function Ct(e){const t=de(),n=ue();switch(n.state){case"active":_t({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Pt(e){if(e.defaultPrevented)return;const t=ue(),n=de();switch(t.state){case"active":{if(e.buttons===0){xe({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const o=ae(r.group.id,!0);te(r.group,o)});return}_t({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=_e(e,n);r.length===0?t.state!=="inactive"&&xe({cursorFlags:0,state:"inactive"}):xe({cursorFlags:0,hitRegions:r,state:"hover"}),Qe(e.currentTarget);break}}}function kt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ue().state){case"hover":xe({cursorFlags:0,state:"inactive"})}}function Et(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ue();switch(t.state){case"active":xe({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Qe(e.currentTarget),t.hitRegions.forEach(n=>{const r=ae(n.group.id,!0);te(n.group,r)}),e.preventDefault())}}function Mt(e){let t=0,n=0;const r={};for(const i of e)if(i.defaultSize!==void 0){t++;const l=q(i.defaultSize);n+=l,r[i.panelId]=l}else r[i.panelId]=void 0;const o=e.length-t;if(o!==0){const i=q((100-n)/o);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=i)}return r}function Br(e,t,n){if(!n[0])return;const r=e.panels.find(s=>s.element===t);if(!r||!r.onResize)return;const o=ye({group:e}),i=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,a={asPercentage:q(i/o*100),inPixels:i};r.mutableValues.prevSize=a,r.onResize(a,r.id,l)}function Wr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Hr({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let o=0,i=0,l=!1;const a=new Map,s=[];for(const v of e.panels){const g=r[v.id]??0;switch(v.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const M=g/100*n,w=q(M/t*100);a.set(v.id,w),o+=w;break}case"preserve-relative-size":default:{s.push(v.id),i+=g;break}}}if(!l||s.length===0)return r;const c=100-o,d={...r};if(a.forEach((v,g)=>{d[g]=v}),i>0)for(const v of s){const g=r[v]??0;d[v]=q(g/i*c)}else{const v=q(c/s.length);for(const g of s)d[g]=v}return d}function Vr(e,t){const n=e.map(o=>o.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o))return!1;return!0}const pe=new Map;function Gr(e){let t=!0;T(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,o=new Set,i=new n(w=>{for(const m of w){const{borderBoxSize:b,target:x}=m;if(x===e.element){if(t){const p=ye({group:e});if(p===0)return;const z=ae(e.id);if(!z)return;const S=Ge(e),h=z.defaultLayoutDeferred?Mt(S):z.layout,P=Hr({group:e,nextGroupSize:p,prevGroupSize:z.groupSize,prevLayout:h}),C=ce({layout:P,panelConstraints:S});if(!z.defaultLayoutDeferred&&le(z.layout,C)&&Wr(z.derivedPanelConstraints,S)&&z.groupSize===p)return;te(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:p,layout:C,separatorToPanels:z.separatorToPanels})}}else Br(e,x,b)}});i.observe(e.element),e.panels.forEach(w=>{T(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&i.observe(w.element)});const l=ye({group:e}),a=Ge(e),s=e.panels.map(({id:w})=>w).join(",");let c=e.mutableState.defaultLayout;c&&(Vr(e.panels,c)||(c=void 0));const d=e.mutableState.layouts[s]??c??Mt(a),v=ce({layout:d,panelConstraints:a}),g=e.element.ownerDocument;pe.set(g,(pe.get(g)??0)+1);const M=new Map;return Bt(e).forEach(w=>{w.separator&&M.set(w.separator,w.panels)}),te(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:v,separatorToPanels:M}),e.separators.forEach(w=>{T(!o.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),o.add(w.id),w.element.addEventListener("keydown",yt)}),pe.get(g)===1&&(g.addEventListener("dblclick",xt,!0),g.addEventListener("pointerdown",bt,!0),g.addEventListener("pointerleave",Ct),g.addEventListener("pointermove",Pt),g.addEventListener("pointerout",kt),g.addEventListener("pointerup",Et,!0)),function(){t=!1,pe.set(g,Math.max(0,(pe.get(g)??0)-1)),Pr(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",yt)}),pe.get(g)||(g.removeEventListener("dblclick",xt,!0),g.removeEventListener("pointerdown",bt,!0),g.removeEventListener("pointerleave",Ct),g.removeEventListener("pointermove",Pt),g.removeEventListener("pointerout",kt),g.removeEventListener("pointerup",Et,!0)),i.disconnect()}}function Ur(){const[e,t]=u.useState({}),n=u.useCallback(()=>t({}),[]);return[e,n]}function Ze(e){const t=u.useId();return`${e??t}`}const fe=typeof window<"u"?u.useLayoutEffect:u.useEffect;function Ce(e){const t=u.useRef(e);return fe(()=>{t.current=e},[e]),u.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function et(...e){return Ce(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function tt(e){const t=u.useRef({...e});return fe(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Jt=u.createContext(null);function qr(e,t){const n=u.useRef({getLayout:()=>({}),setLayout:Fr});u.useImperativeHandle(t,()=>n.current,[]),fe(()=>{Object.assign(n.current,Ut({groupId:e}))})}function Qt({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:o,elementRef:i,groupRef:l,id:a,onLayoutChange:s,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:v={coarse:20,fine:10},style:g,...M}){const w=u.useRef({onLayoutChange:{},onLayoutChanged:{}}),m=Ce(k=>{le(w.current.onLayoutChange,k)||(w.current.onLayoutChange=k,s==null||s(k))}),b=Ce(k=>{le(w.current.onLayoutChanged,k)||(w.current.onLayoutChanged=k,c==null||c(k))}),x=Ze(a),p=u.useRef(null),[z,S]=Ur(),h=u.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:v,separators:[]}),P=et(p,i);qr(x,l);const C=Ce((k,E)=>{const $=ue(),A=ht(k),j=ae(k);if(j){let R=!1;switch($.state){case"active":{R=$.hitRegions.some(H=>H.group===A);break}}return{flexGrow:j.layout[E]??1,pointerEvents:R?"none":void 0}}return{flexGrow:(n==null?void 0:n[E])??1}}),D=tt({defaultLayout:n,disableCursor:r}),F=u.useMemo(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:C,id:x,orientation:d,registerPanel:k=>{const E=h.current;return E.panels=Ue(d,[...E.panels,k]),S(),()=>{E.panels=E.panels.filter($=>$!==k),S()}},registerSeparator:k=>{const E=h.current;return E.separators=Ue(d,[...E.separators,k]),S(),()=>{E.separators=E.separators.filter($=>$!==k),S()}},togglePanelDisabled:(k,E)=>{const $=h.current.panels.find(R=>R.id===k);$&&($.panelConstraints.disabled=E);const A=ht(x),j=ae(x);A&&j&&te(A,{...j,derivedPanelConstraints:Ge(A)})},toggleSeparatorDisabled:(k,E)=>{const $=h.current.separators.find(A=>A.id===k);$&&($.disabled=E)}}),[C,x,S,d,D]),L=u.useRef(null);return fe(()=>{const k=p.current;if(k===null)return;const E=h.current;let $;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===E.panels.length){$={};for(const _ of E.panels){const O=D.defaultLayout[_.id];O!==void 0&&($[_.id]=O)}}const A={disabled:!!o,element:k,id:x,mutableState:{defaultLayout:$,disableCursor:!!D.disableCursor,expandedPanelSizes:h.current.lastExpandedPanelSizes,layouts:h.current.layouts},orientation:d,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};L.current=A;const j=Gr(A),{defaultLayoutDeferred:R,derivedPanelConstraints:H,layout:G}=ae(A.id,!0);!R&&H.length>0&&(m(G),b(G));const X=Ye(x,_=>{const{defaultLayoutDeferred:O,derivedPanelConstraints:I,layout:V}=_.next;if(O||I.length===0)return;const ee=A.panels.map(({id:Y})=>Y).join(",");A.mutableState.layouts[ee]=V,I.forEach(Y=>{if(Y.collapsible){const{layout:be}=_.prev??{};if(be){const Me=U(Y.collapsedSize,V[Y.panelId]),Fe=U(Y.collapsedSize,be[Y.panelId]);Me&&!Fe&&(A.mutableState.expandedPanelSizes[Y.panelId]=be[Y.panelId])}}});const J=ue().state!=="active";m(V),J&&b(V)});return()=>{L.current=null,j(),X()}},[o,x,b,m,d,z,D]),u.useEffect(()=>{const k=L.current;k&&(k.mutableState.defaultLayout=n,k.mutableState.disableCursor=!!r)}),f.jsx(Jt.Provider,{value:F,children:f.jsx("div",{...M,className:t,"data-group":!0,"data-testid":x,id:x,ref:P,style:{height:"100%",width:"100%",overflow:"hidden",...g,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}Qt.displayName="Group";function nt(){const e=u.useContext(Jt);return T(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Kr(e,t){const{id:n}=nt(),r=u.useRef({collapse:Ve,expand:Ve,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ve});u.useImperativeHandle(t,()=>r.current,[]),fe(()=>{Object.assign(r.current,Gt({groupId:n,panelId:e}))})}function Ie({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:o,disabled:i,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:s,maxSize:c="100%",minSize:d="0%",onResize:v,panelRef:g,style:M,...w}){const m=!!s,b=Ze(s),x=tt({disabled:i}),p=u.useRef(null),z=et(p,l),{getPanelStyles:S,id:h,orientation:P,registerPanel:C,togglePanelDisabled:D}=nt(),F=v!==null,L=Ce((E,$,A)=>{v==null||v(E,s,A)});fe(()=>{const E=p.current;if(E!==null){const $={element:E,id:b,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:F?L:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:o,disabled:x.disabled,maxSize:c,minSize:d}};return C($)}},[a,n,r,o,F,b,m,c,d,L,C,x]),u.useEffect(()=>{D(b,!!i)},[i,b,D]),Kr(b,g);const k=u.useSyncExternalStore(E=>Ye(h,E),()=>JSON.stringify(S(h,b)),()=>JSON.stringify(S(h,b)));return f.jsx("div",{...w,"aria-disabled":i||void 0,"data-panel":!0,"data-testid":b,id:b,ref:z,style:{...Xr,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(k)},children:f.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...M,touchAction:P==="horizontal"?"pan-y":"pan-x"},children:e})})}Ie.displayName="Panel";const Xr={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Yr({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let o,i;const l=e[n],a=t.find(s=>s.panelId===n);if(a){const s=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,d=[r,r+1];i=ce({layout:ke({delta:c-l,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],o=ce({layout:ke({delta:s-l,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:o,valueMin:i,valueNow:l}}function qe({children:e,className:t,disabled:n,elementRef:r,id:o,style:i,...l}){const a=Ze(o),s=tt({disabled:n}),[c,d]=u.useState({}),[v,g]=u.useState("inactive"),M=u.useRef(null),w=et(M,r),{disableCursor:m,id:b,orientation:x,registerSeparator:p,toggleSeparatorDisabled:z}=nt(),S=x==="horizontal"?"vertical":"horizontal";fe(()=>{const P=M.current;if(P!==null){const C={disabled:s.disabled,element:P,id:a},D=p(C),F=$r(k=>{g(k.next.state!=="inactive"&&k.next.hitRegions.some(E=>E.separator===C)?k.next.state:"inactive")}),L=Ye(b,k=>{const{derivedPanelConstraints:E,layout:$,separatorToPanels:A}=k.next,j=A.get(C);if(j){const R=j[0],H=j.indexOf(R);d(Yr({layout:$,panelConstraints:E,panelId:R.id,panelIndex:H}))}});return()=>{F(),L(),D()}}},[b,a,p,s]),u.useEffect(()=>{z(a,!!n)},[n,a,z]);let h;return n&&!m&&(h="not-allowed"),f.jsx("div",{...l,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":S,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":n?"disabled":v,"data-testid":a,id:a,ref:w,role:"separator",style:{flexBasis:"auto",cursor:h,...i,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}qe.displayName="Separator";function Ke(e){var r;const t=((r=e.split(".").pop())==null?void 0:r.toLowerCase())||"";return{js:"text-yellow-600",ts:"text-blue-500",tsx:"text-blue-400",jsx:"text-yellow-500",py:"text-green-600",rb:"text-red-500",go:"text-cyan-600",html:"text-orange-500",css:"text-purple-500",json:"text-green-500",md:"text-slate",yaml:"text-green-400",yml:"text-green-400",sh:"text-green-600",bash:"text-green-600",rs:"text-orange-600",java:"text-red-600",kt:"text-purple-600",sql:"text-blue-600",svg:"text-orange-400"}[t]||"text-charcoal/80"}function Xe(e,t){var o;if(t==="directory")return"[ ]";const n=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"";return{js:"JS",ts:"TS",tsx:"TX",jsx:"JX",py:"PY",html:"<>",css:"##",json:"{}",md:"MD",yml:"YL",yaml:"YL",sh:"SH",go:"GO",rs:"RS",rb:"RB",java:"JV",kt:"KT",sql:"SQ",svg:"SV",png:"IM",jpg:"IM",gif:"IM",ico:"IC"}[n]||".."}function _r(e){var o;const t=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"",n={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",md:"markdown",go:"go",rs:"rust",sh:"shell",bash:"shell",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",sql:"sql",java:"java",kt:"kotlin",rb:"ruby",dockerfile:"dockerfile"},r=e.toLowerCase();return r==="dockerfile"?"dockerfile":r==="makefile"?"makefile":n[t]||"plaintext"}function Zt(e){for(const t of e)if(t.type==="file"&&t.name.endsWith(".html")||t.children&&Zt(t.children))return!0;return!1}function en(e,t){for(const n of e){if(n.path===t)return n.size;if(n.children){const r=en(n.children,t);if(r!==void 0)return r}}}function tn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function nn({nodes:e,selectedPath:t,onSelect:n,onDelete:r,depth:o=0}){const[i,l]=u.useState(()=>{const a=new Set;return o<2&&e.filter(s=>s.type==="directory").forEach(s=>a.add(s.path)),a});return f.jsx("div",{children:e.map(a=>{const s=a.type==="directory",c=i.has(a.path),d=a.path===t;return f.jsxs("div",{className:"group/file",children:[f.jsxs("button",{onClick:()=>{s?l(v=>{const g=new Set(v);return g.has(a.path)?g.delete(a.path):g.add(a.path),g}):n(a.path,a.name)},className:`w-full text-left flex items-center gap-1.5 px-2 py-1 text-xs font-mono rounded transition-colors ${d?"bg-accent-product/10 text-accent-product":"text-charcoal/70 hover:bg-white/40"}`,style:{paddingLeft:`${o*14+8}px`},children:[s?f.jsx("span",{className:"text-[10px] text-slate w-3 text-center flex-shrink-0",children:c?"v":">"}):f.jsx("span",{className:"w-3 flex-shrink-0"}),f.jsx("span",{className:`text-[10px] font-bold w-5 text-center flex-shrink-0 ${s?"text-accent-product":Ke(a.name)}`,children:Xe(a.name,a.type)}),f.jsxs("span",{className:"truncate",children:[a.name,s?"/":""]}),!s&&a.size!=null&&a.size>0&&f.jsx("span",{className:"text-[10px] text-slate/40 ml-auto flex-shrink-0",children:tn(a.size)}),!s&&r&&f.jsx("span",{role:"button",tabIndex:-1,onClick:v=>{v.stopPropagation(),r(a.path,a.name)},onKeyDown:v=>{v.key==="Enter"&&(v.stopPropagation(),r(a.path,a.name))},className:"text-[10px] text-slate/30 hover:text-red-500 ml-1 flex-shrink-0 opacity-0 group-hover/file:opacity-100 transition-opacity cursor-pointer",title:"Delete file",children:"x"})]}),s&&c&&a.children&&f.jsx(nn,{nodes:a.children,selectedPath:t,onSelect:n,onDelete:r,depth:o+1})]},a.path)})})}function rn(e,t=""){const n=[];for(const r of e)r.type==="file"&&n.push({path:r.path,name:r.name}),r.children&&n.push(...rn(r.children,r.path+"/"));return n}function Jr({session:e,onClose:t}){var rt;const[n,r]=u.useState(null),[o,i]=u.useState(""),[l,a]=u.useState(null),[s,c]=u.useState(null),[d,v]=u.useState(!1),[g,M]=u.useState(!1),[w,m]=u.useState(!1),[b,x]=u.useState(!1),[p,z]=u.useState(e),S=u.useRef(null),[h,P]=u.useState([]),[C,D]=u.useState(!1),[F,L]=u.useState(""),k=u.useRef(null),E=u.useRef(null),[$,A]=u.useState(0),j=Zt(p.files),R=`/api/sessions/${encodeURIComponent(p.id)}/preview/index.html`,H=u.useCallback(async()=>{try{const y=await ne.getSessionDetail(p.id);z(y)}catch{}},[p.id]),G=u.useCallback(async(y,N)=>{w&&n&&s!==null&&P(W=>W.map(ie=>ie.path===n?{...ie,content:s,modified:!0}:ie));const B=h.find(W=>W.path===y);if(B){r(y),i(N),a(B.content),c(B.content),m(B.modified);return}r(y),i(N),v(!0),m(!1);try{const W=p.id?await ne.getSessionFileContent(p.id,y):await ne.getFileContent(y);a(W.content),c(W.content),P(ie=>[...ie,{path:y,name:N,content:W.content,modified:!1}])}catch{a("[Error loading file]"),c("[Error loading file]")}finally{v(!1)}},[p.id,w,n,s,h]),X=u.useCallback(async()=>{var y;if(!(!n||s===null||!p.id)){x(!0);try{await ne.saveSessionFile(p.id,n,s),a(s),m(!1),P(B=>B.map(W=>W.path===n?{...W,content:s,modified:!1}:W));const N=((y=n.split(".").pop())==null?void 0:y.toLowerCase())||"";["html","css","js","jsx","ts","tsx"].includes(N)&&A(B=>B+1)}catch(N){const B=N instanceof Error?N.message:"Unknown error";window.alert(`Save failed: ${B}`)}finally{x(!1)}}},[n,s,p.id]),_=u.useCallback(y=>{const N=h.find(B=>B.path===y);if(!(N!=null&&N.modified&&!window.confirm("Unsaved changes. Close anyway?"))&&(P(B=>B.filter(W=>W.path!==y)),n===y)){const B=h.filter(W=>W.path!==y);if(B.length>0){const W=B[B.length-1];r(W.path),i(W.name),a(W.content),c(W.content),m(W.modified)}else r(null),i(""),a(null),c(null),m(!1)}},[h,n]);u.useEffect(()=>{const y=N=>{(N.metaKey||N.ctrlKey)&&N.key==="s"&&(N.preventDefault(),w&&n&&X()),(N.metaKey||N.ctrlKey)&&N.key==="p"&&(N.preventDefault(),D(B=>!B),L("")),N.key==="Escape"&&C&&D(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[w,n,X,C]),u.useEffect(()=>{C&&k.current&&k.current.focus()},[C]);const O=rn(p.files),I=F?O.filter(y=>y.path.toLowerCase().includes(F.toLowerCase())):O;u.useEffect(()=>{const y=p.files.find(N=>N.name==="index.html"&&N.type==="file");y&&(G(y.path,y.name),M(!0))},[]);const V=u.useCallback(y=>{y!==void 0&&(c(y),m(y!==l))},[l]),ee=u.useCallback(y=>{S.current=y},[]),J=u.useCallback(async()=>{const y=window.prompt("New file name (e.g. src/utils.ts):");if(!(!y||!y.trim()))try{await ne.createSessionFile(p.id,y.trim()),await H()}catch(N){const B=N instanceof Error?N.message:"Unknown error";window.alert(`Create file failed: ${B}`)}},[p.id,H]),Y=u.useCallback(async()=>{const y=window.prompt("New folder name (e.g. src/components):");if(!(!y||!y.trim()))try{await ne.createSessionDirectory(p.id,y.trim()),await H()}catch(N){const B=N instanceof Error?N.message:"Unknown error";window.alert(`Create folder failed: ${B}`)}},[p.id,H]),be=u.useCallback(async(y,N)=>{if(window.confirm(`Delete "${N}"?`))try{await ne.deleteSessionFile(p.id,y),n===y&&(r(null),i(""),a(null),c(null),m(!1)),await H()}catch(W){const ie=W instanceof Error?W.message:"Unknown error";window.alert(`Delete failed: ${ie}`)}},[p.id,n,H]),Me=n?en(p.files,n):void 0,Fe=((rt=o.split(".").pop())==null?void 0:rt.toUpperCase())||"";return f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"glass px-5 py-3 flex items-center gap-4 flex-shrink-0 border-b border-white/10",children:[f.jsx("button",{onClick:()=>{w&&!window.confirm("Unsaved changes. Discard?")||t()},className:"text-xs font-medium px-3 py-1.5 rounded-lg border border-white/20 text-slate hover:text-charcoal hover:bg-white/30 transition-colors",children:"Back"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("h2",{className:"text-sm font-bold text-charcoal truncate",children:p.id}),f.jsx("p",{className:"text-[10px] font-mono text-slate truncate",children:p.path})]}),f.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${p.status==="completed"||p.status==="completion_promise_fulfilled"?"bg-success/10 text-success":"bg-slate/10 text-slate"}`,children:p.status}),j&&f.jsx("button",{onClick:()=>M(!g),className:`text-xs font-medium px-3 py-1.5 rounded-lg border transition-colors ${g?"border-accent-product/40 bg-accent-product/10 text-accent-product":"border-white/20 text-slate hover:text-charcoal hover:bg-white/30"}`,children:g?"Hide Preview":"Preview"})]}),f.jsx("div",{className:"flex-1 min-h-0",children:f.jsxs(Qt,{orientation:"horizontal",className:"h-full",children:[f.jsx(Ie,{defaultSize:20,minSize:15,children:f.jsxs("div",{className:"h-full flex flex-col border-r border-white/10 bg-white/30",children:[f.jsxs("div",{className:"px-3 py-2 border-b border-white/10 flex items-center gap-2",children:[f.jsx("span",{className:"text-[10px] text-slate uppercase tracking-wider font-semibold flex-1",children:"Files"}),f.jsx("button",{onClick:J,title:"New File",className:"text-[10px] text-slate hover:text-accent-product px-1.5 py-0.5 rounded border border-white/20 hover:border-accent-product/30 transition-colors",children:"+ File"}),f.jsx("button",{onClick:Y,title:"New Folder",className:"text-[10px] text-slate hover:text-accent-product px-1.5 py-0.5 rounded border border-white/20 hover:border-accent-product/30 transition-colors",children:"+ Dir"})]}),f.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:p.files.length>0?f.jsx(nn,{nodes:p.files,selectedPath:n,onSelect:G,onDelete:be}):f.jsx("div",{className:"p-4 text-xs text-slate",children:"No files"})})]})}),f.jsx(qe,{className:"w-1 bg-white/10 hover:bg-accent-product/30 transition-colors cursor-col-resize"}),f.jsx(Ie,{defaultSize:g?50:80,minSize:25,children:f.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[h.length>0&&f.jsx("div",{className:"flex items-center border-b border-white/10 bg-white/10 overflow-x-auto flex-shrink-0",children:h.map(y=>f.jsxs("button",{onClick:()=>G(y.path,y.name),className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-mono border-r border-white/10 whitespace-nowrap transition-colors ${y.path===n?"bg-white/40 text-charcoal":"text-slate hover:text-charcoal hover:bg-white/20"}`,children:[f.jsx("span",{className:`text-[9px] font-bold ${Ke(y.name)}`,children:Xe(y.name,"file")}),y.name,y.modified&&f.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-product"}),f.jsx("span",{role:"button",tabIndex:-1,onClick:N=>{N.stopPropagation(),_(y.path)},onKeyDown:N=>{N.key==="Enter"&&(N.stopPropagation(),_(y.path))},className:"text-slate/30 hover:text-danger ml-1 cursor-pointer",children:"x"})]},y.path))}),n?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"px-4 py-1.5 border-b border-white/10 flex items-center gap-2 flex-shrink-0 bg-white/20",children:[f.jsx("span",{className:"text-xs font-mono text-charcoal/60 truncate",children:n}),b&&f.jsx("span",{className:"text-[10px] text-accent-product animate-pulse flex-shrink-0",children:"Saving..."}),f.jsx("span",{className:"ml-auto text-[10px] text-slate/50 font-mono",children:Me!=null?tn(Me):""}),f.jsx("span",{className:"text-[10px] text-slate/40 font-mono uppercase",children:Fe}),w&&f.jsx("button",{onClick:X,className:"text-[10px] font-medium px-2 py-0.5 rounded border border-accent-product/40 bg-accent-product/10 text-accent-product hover:bg-accent-product/20 transition-colors",children:"Save"})]}),f.jsx("div",{className:"flex-1 min-h-0",children:d?f.jsx("div",{className:"text-slate text-xs animate-pulse p-4",children:"Loading..."}):f.jsx(gr,{value:s??"",language:_r(o),theme:"vs",onChange:V,onMount:ee,options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8},renderLineHighlight:"line",smoothScrolling:!0,cursorBlinking:"smooth",folding:!0,bracketPairColorization:{enabled:!0}}})})]}):f.jsx("div",{className:"flex-1 flex items-center justify-center text-slate text-sm",children:"Select a file to view its contents"})]})}),g&&f.jsxs(f.Fragment,{children:[f.jsx(qe,{className:"w-1 bg-white/10 hover:bg-accent-product/30 transition-colors cursor-col-resize"}),f.jsx(Ie,{defaultSize:30,minSize:20,collapsible:!0,children:f.jsxs("div",{className:"h-full flex flex-col border-l border-white/10",children:[f.jsxs("div",{className:"px-4 py-2 border-b border-white/10 flex items-center gap-2 flex-shrink-0 bg-white/20",children:[f.jsx("span",{className:"text-xs font-semibold text-charcoal",children:"Live Preview"}),f.jsx("span",{className:"text-[10px] font-mono text-slate/50 truncate ml-auto",children:R})]}),f.jsx("div",{className:"flex-1 bg-white",children:f.jsx("iframe",{ref:E,src:R,title:"Project Preview",className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},$)})]})})]})]})}),C&&f.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:()=>D(!1),children:f.jsxs("div",{className:"bg-white rounded-xl shadow-2xl border border-white/20 w-full max-w-lg",onClick:y=>y.stopPropagation(),children:[f.jsx("input",{ref:k,type:"text",value:F,onChange:y=>L(y.target.value),placeholder:"Search files by name...",className:"w-full px-4 py-3 text-sm font-mono border-b border-white/10 outline-none rounded-t-xl bg-transparent",onKeyDown:y=>{y.key==="Enter"&&I.length>0&&(G(I[0].path,I[0].name),D(!1)),y.key==="Escape"&&D(!1)}}),f.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[I.slice(0,20).map(y=>f.jsxs("button",{onClick:()=>{G(y.path,y.name),D(!1)},className:"w-full text-left px-4 py-2 text-xs font-mono hover:bg-accent-product/5 flex items-center gap-2",children:[f.jsx("span",{className:`text-[10px] font-bold ${Ke(y.name)}`,children:Xe(y.name,"file")}),f.jsx("span",{className:"text-charcoal",children:y.name}),f.jsx("span",{className:"text-slate/40 ml-auto truncate text-[10px]",children:y.path})]},y.path)),I.length===0&&f.jsx("div",{className:"px-4 py-3 text-xs text-slate",children:"No matching files"})]})]})})]})}function eo(){const{sessionId:e}=on(),t=an(),[n,r]=u.useState(null),[o,i]=u.useState(!0),[l,a]=u.useState(null);return u.useEffect(()=>{e&&(i(!0),a(null),ne.getSessionDetail(e).then(s=>{r(s),i(!1)}).catch(s=>{a(s instanceof Error?s.message:"Failed to load session"),i(!1)}))},[e]),o?f.jsxs("div",{className:"h-screen bg-background flex flex-col",children:[f.jsx(Ae,{status:null,wsConnected:!1}),f.jsx("div",{className:"flex-1 flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-slate animate-pulse text-sm",children:"Loading project..."}),f.jsx("div",{className:"text-[10px] font-mono text-slate/50 mt-2",children:e})]})})]}):l||!n?f.jsxs("div",{className:"h-screen bg-background flex flex-col",children:[f.jsx(Ae,{status:null,wsConnected:!1}),f.jsx("div",{className:"flex-1 flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("p",{className:"text-danger text-sm font-medium",children:"Project not found"}),f.jsx("p",{className:"text-xs text-slate mt-1",children:l||`Session ${e} does not exist`}),f.jsx("button",{onClick:()=>t("/"),className:"mt-4 px-4 py-2 rounded-xl text-sm font-semibold border border-accent-product/30 text-accent-product hover:bg-accent-product/5 transition-all",children:"Back to Home"})]})})]}):f.jsxs("div",{className:"h-screen bg-background flex flex-col",children:[f.jsx(Ae,{status:null,wsConnected:!1}),f.jsx("div",{className:"flex-1 min-h-0",children:f.jsx(sn,{name:"ProjectWorkspace",children:f.jsx(Jr,{session:n,onClose:()=>t("/")})})})]})}export{eo as default};
@@ -1 +1 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.terminal-scroll::-webkit-scrollbar{width:6px}.terminal-scroll::-webkit-scrollbar-track{background:transparent}.terminal-scroll::-webkit-scrollbar-thumb{background:#3d52a033;border-radius:3px}.terminal-scroll::-webkit-scrollbar-thumb:hover{background:#3d52a059}.glass{background:#fff9;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.3);border-radius:16px;box-shadow:0 8px 32px #3d52a014}.glass-subtle{background:#fff6;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.2);border-radius:12px;box-shadow:0 4px 16px #3d52a00f}.pattern-circles{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.04;background-image:radial-gradient(circle at 20% 30%,transparent 30%,#6C63FF 30.5%,transparent 31%),radial-gradient(circle at 80% 70%,transparent 25%,#6C63FF 25.5%,transparent 26%),radial-gradient(circle at 50% 50%,transparent 40%,#6C63FF 40.5%,transparent 41%);pointer-events:none}@keyframes phase-pulse{0%,to{opacity:1}50%{opacity:.5}}.phase-active{animation:phase-pulse 2s ease-in-out infinite}@keyframes cursor-blink{0%,to{opacity:1}50%{opacity:0}}.terminal-cursor:after{content:"";display:inline-block;width:8px;height:16px;background:#7091e6;animation:cursor-blink 1s step-end infinite;margin-left:2px;vertical-align:text-bottom}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-5{grid-column:span 5 / span 5}.col-span-6{grid-column:span 6 / span 6}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.grid{display:grid}.contents{display:contents}.h-1\.5{height:.375rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-28{height:7rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-64{max-height:16rem}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:0px}.min-h-\[280px\]{min-height:280px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-28{width:7rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-8{width:2rem}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.max-w-3xl{max-width:48rem}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-lg{max-width:32rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-accent-product{--tw-border-opacity: 1;border-color:rgb(108 99 255 / var(--tw-border-opacity, 1))}.border-accent-product\/20{border-color:#6c63ff33}.border-accent-product\/30{border-color:#6c63ff4d}.border-accent-product\/40{border-color:#6c63ff66}.border-danger\/20{border-color:#c45b5b33}.border-primary-wash\/30{border-color:#8697c44d}.border-primary\/20{border-color:#3d52a033}.border-slate\/20{border-color:#4f5d7533}.border-success\/20{border-color:#7fb06933}.border-surface\/50{border-color:#adbbda80}.border-warning\/10{border-color:#d4a03c1a}.border-warning\/20{border-color:#d4a03c33}.border-warning\/30{border-color:#d4a03c4d}.border-warning\/40{border-color:#d4a03c66}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-white\/30{border-color:#ffffff4d}.border-t-transparent{border-top-color:transparent}.bg-accent-product{--tw-bg-opacity: 1;background-color:rgb(108 99 255 / var(--tw-bg-opacity, 1))}.bg-accent-product\/10{background-color:#6c63ff1a}.bg-background{--tw-bg-opacity: 1;background-color:rgb(237 232 245 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/5{background-color:#0000000d}.bg-charcoal\/10{background-color:#2d31421a}.bg-charcoal\/5{background-color:#2d31420d}.bg-charcoal\/\[0\.03\]{background-color:#2d314208}.bg-danger{--tw-bg-opacity: 1;background-color:rgb(196 91 91 / var(--tw-bg-opacity, 1))}.bg-danger\/10{background-color:#c45b5b1a}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(61 82 160 / var(--tw-bg-opacity, 1))}.bg-primary-light{--tw-bg-opacity: 1;background-color:rgb(112 145 230 / var(--tw-bg-opacity, 1))}.bg-primary-wash\/20{background-color:#8697c433}.bg-primary\/10{background-color:#3d52a01a}.bg-slate{--tw-bg-opacity: 1;background-color:rgb(79 93 117 / var(--tw-bg-opacity, 1))}.bg-slate\/10{background-color:#4f5d751a}.bg-slate\/30{background-color:#4f5d754d}.bg-slate\/40{background-color:#4f5d7566}.bg-success{--tw-bg-opacity: 1;background-color:rgb(127 176 105 / var(--tw-bg-opacity, 1))}.bg-success\/10{background-color:#7fb0691a}.bg-surface{--tw-bg-opacity: 1;background-color:rgb(173 187 218 / var(--tw-bg-opacity, 1))}.bg-surface\/30{background-color:#adbbda4d}.bg-surface\/50{background-color:#adbbda80}.bg-warning{--tw-bg-opacity: 1;background-color:rgb(212 160 60 / var(--tw-bg-opacity, 1))}.bg-warning\/10{background-color:#d4a03c1a}.bg-warning\/5{background-color:#d4a03c0d}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-white\/30{background-color:#ffffff4d}.bg-white\/40{background-color:#fff6}.fill-charcoal{fill:#2d3142}.fill-primary{fill:#3d52a0}.p-0{padding:0}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2\.5{padding-bottom:.625rem}.pr-2{padding-right:.5rem}.pt-0{padding-top:0}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.text-accent-product{--tw-text-opacity: 1;color:rgb(108 99 255 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-charcoal{--tw-text-opacity: 1;color:rgb(45 49 66 / var(--tw-text-opacity, 1))}.text-charcoal\/70{color:#2d3142b3}.text-charcoal\/80{color:#2d3142cc}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity, 1))}.text-danger{--tw-text-opacity: 1;color:rgb(196 91 91 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(61 82 160 / var(--tw-text-opacity, 1))}.text-primary-light{--tw-text-opacity: 1;color:rgb(112 145 230 / var(--tw-text-opacity, 1))}.text-primary-wash{--tw-text-opacity: 1;color:rgb(134 151 196 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-slate{--tw-text-opacity: 1;color:rgb(79 93 117 / var(--tw-text-opacity, 1))}.text-slate\/30{color:#4f5d754d}.text-slate\/40{color:#4f5d7566}.text-slate\/50{color:#4f5d7580}.text-slate\/60{color:#4f5d7599}.text-success{--tw-text-opacity: 1;color:rgb(127 176 105 / var(--tw-text-opacity, 1))}.text-warning{--tw-text-opacity: 1;color:rgb(212 160 60 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-glass{--tw-shadow: 0 8px 32px rgba(61,82,160,.08);--tw-shadow-colored: 0 8px 32px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-glass-subtle{--tw-shadow: 0 4px 16px rgba(61,82,160,.06);--tw-shadow-colored: 0 4px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-accent-product\/20{--tw-shadow-color: rgb(108 99 255 / .2);--tw-shadow: var(--tw-shadow-colored)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.placeholder\:text-primary-wash::-moz-placeholder{--tw-text-opacity: 1;color:rgb(134 151 196 / var(--tw-text-opacity, 1))}.placeholder\:text-primary-wash::placeholder{--tw-text-opacity: 1;color:rgb(134 151 196 / var(--tw-text-opacity, 1))}.placeholder\:text-primary-wash\/70::-moz-placeholder{color:#8697c4b3}.placeholder\:text-primary-wash\/70::placeholder{color:#8697c4b3}.hover\:border-accent-product\/30:hover{border-color:#6c63ff4d}.hover\:bg-accent-product\/20:hover{background-color:#6c63ff33}.hover\:bg-accent-product\/30:hover{background-color:#6c63ff4d}.hover\:bg-accent-product\/5:hover{background-color:#6c63ff0d}.hover\:bg-accent-product\/90:hover{background-color:#6c63ffe6}.hover\:bg-danger\/20:hover{background-color:#c45b5b33}.hover\:bg-primary\/5:hover{background-color:#3d52a00d}.hover\:bg-warning\/10:hover{background-color:#d4a03c1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/40:hover{background-color:#fff6}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-product:hover{--tw-text-opacity: 1;color:rgb(108 99 255 / var(--tw-text-opacity, 1))}.hover\:text-charcoal:hover{--tw-text-opacity: 1;color:rgb(45 49 66 / var(--tw-text-opacity, 1))}.hover\:text-primary-light:hover{--tw-text-opacity: 1;color:rgb(112 145 230 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:#3d52a0cc}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.focus\:border-accent-product\/30:focus{border-color:#6c63ff4d}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-accent-product\/20:focus{--tw-ring-color: rgb(108 99 255 / .2)}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:text-accent-product{--tw-text-opacity: 1;color:rgb(108 99 255 / var(--tw-text-opacity, 1))}.group\/file:hover .group-hover\/file\:opacity-100{opacity:1}
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.terminal-scroll::-webkit-scrollbar{width:6px}.terminal-scroll::-webkit-scrollbar-track{background:transparent}.terminal-scroll::-webkit-scrollbar-thumb{background:#3d52a033;border-radius:3px}.terminal-scroll::-webkit-scrollbar-thumb:hover{background:#3d52a059}.glass{background:#fff9;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.3);border-radius:16px;box-shadow:0 8px 32px #3d52a014}.glass-subtle{background:#fff6;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.2);border-radius:12px;box-shadow:0 4px 16px #3d52a00f}.pattern-circles{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.04;background-image:radial-gradient(circle at 20% 30%,transparent 30%,#6C63FF 30.5%,transparent 31%),radial-gradient(circle at 80% 70%,transparent 25%,#6C63FF 25.5%,transparent 26%),radial-gradient(circle at 50% 50%,transparent 40%,#6C63FF 40.5%,transparent 41%);pointer-events:none}@keyframes phase-pulse{0%,to{opacity:1}50%{opacity:.5}}.phase-active{animation:phase-pulse 2s ease-in-out infinite}@keyframes cursor-blink{0%,to{opacity:1}50%{opacity:0}}.terminal-cursor:after{content:"";display:inline-block;width:8px;height:16px;background:#7091e6;animation:cursor-blink 1s step-end infinite;margin-left:2px;vertical-align:text-bottom}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-5{grid-column:span 5 / span 5}.col-span-6{grid-column:span 6 / span 6}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.grid{display:grid}.contents{display:contents}.h-1\.5{height:.375rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-28{height:7rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-64{max-height:16rem}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:0px}.min-h-\[280px\]{min-height:280px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-28{width:7rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-8{width:2rem}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.max-w-3xl{max-width:48rem}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-lg{max-width:32rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-t-xl{border-top-left-radius:.75rem;border-top-right-radius:.75rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-accent-product{--tw-border-opacity: 1;border-color:rgb(108 99 255 / var(--tw-border-opacity, 1))}.border-accent-product\/20{border-color:#6c63ff33}.border-accent-product\/30{border-color:#6c63ff4d}.border-accent-product\/40{border-color:#6c63ff66}.border-danger\/20{border-color:#c45b5b33}.border-primary-wash\/30{border-color:#8697c44d}.border-primary\/20{border-color:#3d52a033}.border-slate\/20{border-color:#4f5d7533}.border-success\/20{border-color:#7fb06933}.border-surface\/50{border-color:#adbbda80}.border-warning\/10{border-color:#d4a03c1a}.border-warning\/20{border-color:#d4a03c33}.border-warning\/30{border-color:#d4a03c4d}.border-warning\/40{border-color:#d4a03c66}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-white\/30{border-color:#ffffff4d}.border-t-transparent{border-top-color:transparent}.bg-accent-product{--tw-bg-opacity: 1;background-color:rgb(108 99 255 / var(--tw-bg-opacity, 1))}.bg-accent-product\/10{background-color:#6c63ff1a}.bg-background{--tw-bg-opacity: 1;background-color:rgb(237 232 245 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/5{background-color:#0000000d}.bg-charcoal\/10{background-color:#2d31421a}.bg-charcoal\/5{background-color:#2d31420d}.bg-charcoal\/\[0\.03\]{background-color:#2d314208}.bg-danger{--tw-bg-opacity: 1;background-color:rgb(196 91 91 / var(--tw-bg-opacity, 1))}.bg-danger\/10{background-color:#c45b5b1a}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(61 82 160 / var(--tw-bg-opacity, 1))}.bg-primary-light{--tw-bg-opacity: 1;background-color:rgb(112 145 230 / var(--tw-bg-opacity, 1))}.bg-primary-wash\/20{background-color:#8697c433}.bg-primary\/10{background-color:#3d52a01a}.bg-slate{--tw-bg-opacity: 1;background-color:rgb(79 93 117 / var(--tw-bg-opacity, 1))}.bg-slate\/10{background-color:#4f5d751a}.bg-slate\/30{background-color:#4f5d754d}.bg-slate\/40{background-color:#4f5d7566}.bg-success{--tw-bg-opacity: 1;background-color:rgb(127 176 105 / var(--tw-bg-opacity, 1))}.bg-success\/10{background-color:#7fb0691a}.bg-surface{--tw-bg-opacity: 1;background-color:rgb(173 187 218 / var(--tw-bg-opacity, 1))}.bg-surface\/30{background-color:#adbbda4d}.bg-surface\/50{background-color:#adbbda80}.bg-transparent{background-color:transparent}.bg-warning{--tw-bg-opacity: 1;background-color:rgb(212 160 60 / var(--tw-bg-opacity, 1))}.bg-warning\/10{background-color:#d4a03c1a}.bg-warning\/5{background-color:#d4a03c0d}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-white\/30{background-color:#ffffff4d}.bg-white\/40{background-color:#fff6}.fill-charcoal{fill:#2d3142}.fill-primary{fill:#3d52a0}.p-0{padding:0}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2\.5{padding-bottom:.625rem}.pr-2{padding-right:.5rem}.pt-0{padding-top:0}.pt-\[20vh\]{padding-top:20vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.text-accent-product{--tw-text-opacity: 1;color:rgb(108 99 255 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-charcoal{--tw-text-opacity: 1;color:rgb(45 49 66 / var(--tw-text-opacity, 1))}.text-charcoal\/60{color:#2d314299}.text-charcoal\/70{color:#2d3142b3}.text-charcoal\/80{color:#2d3142cc}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity, 1))}.text-danger{--tw-text-opacity: 1;color:rgb(196 91 91 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(61 82 160 / var(--tw-text-opacity, 1))}.text-primary-light{--tw-text-opacity: 1;color:rgb(112 145 230 / var(--tw-text-opacity, 1))}.text-primary-wash{--tw-text-opacity: 1;color:rgb(134 151 196 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-slate{--tw-text-opacity: 1;color:rgb(79 93 117 / var(--tw-text-opacity, 1))}.text-slate\/30{color:#4f5d754d}.text-slate\/40{color:#4f5d7566}.text-slate\/50{color:#4f5d7580}.text-slate\/60{color:#4f5d7599}.text-success{--tw-text-opacity: 1;color:rgb(127 176 105 / var(--tw-text-opacity, 1))}.text-warning{--tw-text-opacity: 1;color:rgb(212 160 60 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-glass{--tw-shadow: 0 8px 32px rgba(61,82,160,.08);--tw-shadow-colored: 0 8px 32px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-glass-subtle{--tw-shadow: 0 4px 16px rgba(61,82,160,.06);--tw-shadow-colored: 0 4px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-accent-product\/20{--tw-shadow-color: rgb(108 99 255 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.placeholder\:text-primary-wash::-moz-placeholder{--tw-text-opacity: 1;color:rgb(134 151 196 / var(--tw-text-opacity, 1))}.placeholder\:text-primary-wash::placeholder{--tw-text-opacity: 1;color:rgb(134 151 196 / var(--tw-text-opacity, 1))}.placeholder\:text-primary-wash\/70::-moz-placeholder{color:#8697c4b3}.placeholder\:text-primary-wash\/70::placeholder{color:#8697c4b3}.hover\:border-accent-product\/30:hover{border-color:#6c63ff4d}.hover\:bg-accent-product\/20:hover{background-color:#6c63ff33}.hover\:bg-accent-product\/30:hover{background-color:#6c63ff4d}.hover\:bg-accent-product\/5:hover{background-color:#6c63ff0d}.hover\:bg-accent-product\/90:hover{background-color:#6c63ffe6}.hover\:bg-danger\/20:hover{background-color:#c45b5b33}.hover\:bg-primary\/5:hover{background-color:#3d52a00d}.hover\:bg-warning\/10:hover{background-color:#d4a03c1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/40:hover{background-color:#fff6}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-product:hover{--tw-text-opacity: 1;color:rgb(108 99 255 / var(--tw-text-opacity, 1))}.hover\:text-charcoal:hover{--tw-text-opacity: 1;color:rgb(45 49 66 / var(--tw-text-opacity, 1))}.hover\:text-danger:hover{--tw-text-opacity: 1;color:rgb(196 91 91 / var(--tw-text-opacity, 1))}.hover\:text-primary-light:hover{--tw-text-opacity: 1;color:rgb(112 145 230 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:#3d52a0cc}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.focus\:border-accent-product\/30:focus{border-color:#6c63ff4d}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-accent-product\/20:focus{--tw-ring-color: rgb(108 99 255 / .2)}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:text-accent-product{--tw-text-opacity: 1;color:rgb(108 99 255 / var(--tw-text-opacity, 1))}.group\/file:hover .group-hover\/file\:opacity-100{opacity:1}
@@ -73,5 +73,5 @@ Describe your project here...
73
73
 
74
74
  - Requirement 1
75
75
  - Requirement 2
76
- `)}},[]),Ae=async()=>{if(!(!h.trim()||we)){ke(!0),Me(null),qe(!0);try{const H=await Ze.planSession(h,Y);Me(H)}catch{Me({complexity:"unknown",cost_estimate:"N/A",iterations:0,phases:[],output_text:"Failed to run loki plan. The CLI may not be available.",returncode:1})}finally{ke(!1)}}},C=async()=>{if(!(!h.trim()||r||le)){qe(!1),ae(!0);try{await i(h,Y,E.trim()||void 0,fe?"quick":void 0)}finally{ae(!1)}}};return f.jsxs(f.Fragment,{children:[Le&&f.jsx(h0,{plan:Ne,loading:we,onConfirm:C,onCancel:()=>qe(!1)}),f.jsxs("div",{className:"glass p-6 flex flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Product Requirements"}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs("div",{className:"relative",children:[f.jsx("button",{onClick:()=>B(!Q),className:"text-xs font-medium px-3 py-1.5 rounded-xl border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:T||"Templates"}),Q&&f.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 glass-subtle rounded-xl overflow-hidden z-20 shadow-glass",children:f.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[W&&f.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!W&&G.length===0&&f.jsx("div",{className:"px-3 py-2 text-xs text-slate",children:"Loading..."}),G.map(H=>f.jsx("button",{onClick:()=>tt(H.filename,H.name),className:"w-full text-left px-3 py-2 text-sm text-charcoal hover:bg-primary/5 transition-colors",children:H.name},H.filename))]})})]})})]}),f.jsx("textarea",{value:h,onChange:H=>y(H.target.value),placeholder:"Paste your PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-white/40 rounded-xl border border-white/30 px-4 py-3 text-sm font-mono text-charcoal placeholder:text-primary-wash resize-none focus:outline-none focus:ring-2 focus:ring-accent-product/20 focus:border-accent-product/30 transition-all",spellCheck:!1}),f.jsxs("div",{className:"mt-3",children:[f.jsx("label",{className:"block text-xs text-slate font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),f.jsx("input",{type:"text",value:E,onChange:H=>M(H.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-white/40 rounded-xl border border-white/30 px-4 py-2 text-sm font-mono text-charcoal placeholder:text-primary-wash/70 focus:outline-none focus:ring-2 focus:ring-accent-product/20 focus:border-accent-product/30 transition-all",spellCheck:!1}),f.jsx("p",{className:"text-[10px] text-slate mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),o&&f.jsx("div",{className:"mt-3 px-3 py-2 rounded-lg bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:o}),f.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[f.jsxs("button",{onClick:()=>F(!fe),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-semibold border transition-all ${fe?"bg-accent-product/10 border-accent-product/30 text-accent-product":"border-white/30 text-slate hover:text-charcoal hover:bg-white/20"}`,children:[f.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${fe?"bg-accent-product":"bg-slate/40"}`}),"Quick"]}),f.jsx("div",{className:"flex-1"}),f.jsxs("span",{className:"text-xs text-slate font-mono",children:[h.length.toLocaleString()," chars"]}),f.jsx("button",{onClick:Ae,disabled:!h.trim()||r||we,className:`px-4 py-2.5 rounded-xl text-sm font-semibold border transition-all ${!h.trim()||r||we?"border-white/20 text-slate/40 cursor-not-allowed":"border-accent-product/30 text-accent-product hover:bg-accent-product/5"}`,children:we?"Analyzing...":"Estimate"}),f.jsx("button",{onClick:C,disabled:!h.trim()||r||le,className:`px-6 py-2.5 rounded-xl text-sm font-semibold transition-all ${!h.trim()||r||le?"bg-surface/50 text-slate cursor-not-allowed":"bg-accent-product text-white hover:bg-accent-product/90 shadow-glass-subtle"}`,children:le?"Starting...":r?"Building...":"Start Build"})]})]})]})}const Qn=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function v0(i){if(!i)return"reason";const r=i.toLowerCase();return r.includes("reason")||r.includes("plan")?"reason":r.includes("act")||r.includes("implement")||r.includes("code")?"act":r.includes("reflect")||r.includes("review")?"reflect":r.includes("verify")||r.includes("test")||r.includes("check")?"verify":"idle"}function y0({currentPhase:i,iteration:r}){const o=v0(i);return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"RARV Cycle"}),f.jsxs("span",{className:"font-mono text-xs text-slate",children:["Iteration ",r]})]}),f.jsx("div",{className:"flex items-center justify-center mb-5",children:f.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[Qn.map((s,m)=>{const h=s.key===o,y=o!=="idle"&&Qn.findIndex(j=>j.key===o)>m,T=(m*90-90)*(Math.PI/180),b=60+40*Math.cos(T),p=60+40*Math.sin(T);return f.jsxs("g",{children:[m<Qn.length-1&&f.jsx("line",{x1:b,y1:p,x2:60+40*Math.cos(((m+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((m+1)*90-90)*(Math.PI/180)),stroke:y?"#3D52A0":"#ADBBDA",strokeWidth:y?2:1,strokeDasharray:y?"none":"4 3"}),m===Qn.length-1&&f.jsx("line",{x1:b,y1:p,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ADBBDA",strokeWidth:1,strokeDasharray:"4 3"}),f.jsx("circle",{cx:b,cy:p,r:h?14:10,fill:h?"#3D52A0":y?"#7091E6":"#EDE8F5",stroke:h?"#6C63FF":y?"#3D52A0":"#ADBBDA",strokeWidth:h?3:1.5,className:h?"phase-active":""}),f.jsx("text",{x:b,y:p+(m===0?-20:m===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-charcoal",dx:m===1?22:m===3?-22:0,children:s.label[0]})]},s.key)}),f.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:r})]})}),f.jsx("div",{className:"space-y-2",children:Qn.map(s=>{const m=s.key===o;return f.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-xl transition-all duration-200 ${m?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[f.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${m?"bg-primary phase-active":"bg-surface"}`}),f.jsxs("div",{children:[f.jsx("span",{className:`text-sm font-semibold ${m?"text-primary":"text-slate"}`,children:s.label}),m&&f.jsx("p",{className:"text-xs text-slate mt-0.5",children:s.description})]})]},s.key)})})]})}const Qs={architect:"bg-accent-product/10 text-accent-product border-accent-product/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary-wash/20 text-charcoal border-primary-wash/30",default:"bg-surface/30 text-slate border-surface/50"};function g0(i){if(!i)return Qs.default;const r=i.toLowerCase();for(const[o,s]of Object.entries(Qs))if(r.includes(o))return s;return Qs.default}function x0({agents:i,loading:r}){const o=(i==null?void 0:i.filter(m=>m.alive))||[],s=(i==null?void 0:i.filter(m=>!m.alive))||[];return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Agents"}),f.jsxs("span",{className:"font-mono text-xs text-slate",children:[o.length," active"]})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading agents..."}),!r&&(i==null?void 0:i.length)===0&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No agents running"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Start a build to spawn agents"})]}),o.length>0&&f.jsx("div",{className:"space-y-2 mb-4",children:o.map(m=>f.jsx(xm,{agent:m},m.id))}),s.length>0&&f.jsxs("details",{className:"mt-3",children:[f.jsxs("summary",{className:"text-xs text-slate cursor-pointer hover:text-charcoal transition-colors",children:[s.length," completed"]}),f.jsx("div",{className:"space-y-1.5 mt-2",children:s.slice(0,10).map(m=>f.jsx(xm,{agent:m,compact:!0},m.id))})]})]})}function xm({agent:i,compact:r}){const o=g0(i.type||i.name||"");return r?f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-lg bg-white/30 text-xs",children:[f.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-slate/30"}),f.jsx("span",{className:"font-medium text-slate truncate",children:i.name||i.id}),f.jsx("span",{className:"text-primary-wash ml-auto",children:i.type})]}):f.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-xl border ${o}`,children:[f.jsx("div",{className:"flex-shrink-0 mt-0.5",children:f.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${i.alive?"bg-success phase-active":"bg-slate/30"}`})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-sm font-semibold truncate",children:i.name||i.id}),i.type&&f.jsx("span",{className:"text-[10px] font-mono font-medium opacity-70",children:i.type})]}),i.task&&f.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:i.task}),i.status&&i.status!=="unknown"&&f.jsx("span",{className:"inline-block text-[10px] font-mono mt-1 opacity-60",children:i.status})]}),i.pid&&f.jsxs("span",{className:"text-[10px] font-mono text-slate/50 flex-shrink-0",children:["PID ",i.pid]})]})}const b0={info:"text-primary-light",error:"text-danger",warning:"text-warning",debug:"text-slate",critical:"text-danger font-bold"};function S0(i){if(!i)return"";if(i.includes("T")||i.includes("-"))try{return new Date(i).toLocaleTimeString("en-US",{hour12:!1})}catch{return i}return i}function E0({logs:i,loading:r,subscribe:o}){const s=g.useRef(null),[m,h]=g.useState(!1),[y,T]=g.useState([]);g.useEffect(()=>o?o("log",M=>{const Y=M;Y!=null&&Y.line&&T(Q=>{const B=[...Q,{message:Y.line,timestamp:Y.timestamp||""}];return B.length>500?B.slice(-500):B})}):void 0,[o]);const b=(()=>{const E=y.map(B=>{let G="info";const L=B.message.toLowerCase();return L.includes("error")||L.includes("fail")?G="error":L.includes("warn")?G="warning":L.includes("debug")&&(G="debug"),{timestamp:B.timestamp,level:G,message:B.message,source:"ws"}}),M=i||[];if(E.length===0)return M;if(M.length===0)return E;const Y=new Set(E.map(B=>B.message));return[...M.filter(B=>!Y.has(B.message)),...E]})();g.useEffect(()=>{!m&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[b,m]);const p=()=>{if(!s.current)return;const{scrollTop:E,scrollHeight:M,clientHeight:Y}=s.current,Q=M-E-Y<50;h(!Q)},j=()=>{var E;h(!1),(E=s.current)==null||E.scrollTo({top:s.current.scrollHeight,behavior:"smooth"})};return f.jsxs("div",{className:"glass p-0 overflow-hidden flex flex-col",style:{height:"calc(100vh - 380px)",minHeight:"300px",maxHeight:"600px"},children:[f.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10 flex-shrink-0",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Terminal"}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("span",{className:"font-mono text-xs text-slate",children:[b.length," lines"]}),f.jsx("button",{onClick:m?j:()=>h(!0),className:`text-xs font-medium px-2.5 py-1 rounded-lg border transition-colors ${m?"border-warning/40 text-warning bg-warning/5 hover:bg-warning/10":"border-primary/20 text-primary hover:bg-primary/5"}`,title:m?"Scroll locked -- click to resume auto-scroll":"Auto-scrolling -- click to lock",children:m?"Locked":"Live"}),m&&f.jsx("button",{onClick:j,className:"text-xs text-primary hover:text-primary-light transition-colors font-medium",children:"Jump to bottom"})]})]}),f.jsxs("div",{ref:s,onScroll:p,className:"flex-1 overflow-y-auto terminal-scroll bg-charcoal/[0.03] p-4 font-mono text-xs leading-relaxed",children:[r&&!i&&y.length===0&&f.jsx("div",{className:"text-slate animate-pulse",children:"Connecting to log stream..."}),b.length===0&&!r&&f.jsxs("div",{className:"text-slate/60",children:[f.jsx("p",{children:"No log output yet."}),f.jsx("p",{className:"mt-1",children:"Start a build to see terminal output here."})]}),b.map((E,M)=>f.jsxs("div",{className:"flex gap-2 hover:bg-white/5 rounded px-1 -mx-1",children:[f.jsx("span",{className:"text-slate/40 flex-shrink-0 select-none w-16 text-right",children:S0(E.timestamp)}),f.jsx("span",{className:`flex-shrink-0 w-12 text-right uppercase text-[10px] font-semibold ${b0[E.level]||"text-slate"}`,children:E.level}),f.jsx("span",{className:`flex-1 break-all ${E.level==="error"||E.level==="critical"?"text-danger":"text-charcoal/80"}`,children:E.message})]},M)),b.length>0&&f.jsx("div",{className:"terminal-cursor mt-1"})]})]})}const N0={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-slate/10 text-slate border-slate/20",dot:"bg-slate/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function T0({item:i}){const[r,o]=g.useState(!1),s=N0[i.status];return f.jsxs("div",{className:`border rounded-xl overflow-hidden ${s.badge}`,children:[f.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>i.details&&o(!r),children:[f.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s.dot}`}),f.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:i.label}),f.jsx("span",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:s.label}),i.details&&f.jsx("span",{className:"text-xs text-slate/60 flex-shrink-0",children:r?"v":">"})]}),r&&i.details&&f.jsx("div",{className:"px-3 pb-2.5 pt-0",children:f.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:i.details})})]})}function j0({checklist:i,loading:r}){const o=i&&i.total>0?i.passed/i.total*100:0;return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Quality Gates"}),i&&f.jsxs("span",{className:"font-mono text-xs text-slate",children:[i.passed,"/",i.total," passed"]})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading gates..."}),!r&&!i&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No quality gate data"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Gates run during verification phase"})]}),i&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[f.jsxs("span",{className:"text-success font-medium",children:[i.passed," passed"]}),i.failed>0&&f.jsxs("span",{className:"text-danger font-medium",children:[i.failed," failed"]}),i.skipped>0&&f.jsxs("span",{className:"text-slate",children:[i.skipped," skipped"]}),i.pending>0&&f.jsxs("span",{className:"text-warning",children:[i.pending," pending"]})]}),f.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:f.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${o}%`}})}),f.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:i.items.map(s=>f.jsx(T0,{item:s},s.id))})]})]})}const z0={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-accent-product"};function A0(i){const r=i.substring(i.lastIndexOf("."));return z0[r]||"bg-slate"}function R0(i){return i==null?"":i<1024?`${i}B`:i<1024*1024?`${(i/1024).toFixed(1)}KB`:`${(i/(1024*1024)).toFixed(1)}MB`}const Xs=100;function Xm({node:i,depth:r,onSelectFile:o,selectedPath:s}){const[m,h]=g.useState(!1),[y,T]=g.useState(Xs),b=i.type==="directory",p=i.path===s,j=b&&m?i.children??[]:[],E=j.length>y;return f.jsxs("div",{children:[f.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-lg text-left text-sm transition-colors hover:bg-white/30 ${p?"bg-primary/10 text-primary":"text-charcoal"}`,style:{paddingLeft:`${r*16+8}px`},onClick:()=>{b?(h(!m),m&&T(Xs)):o(i.path)},children:[b?f.jsx("span",{className:"font-mono text-xs text-slate w-3 flex-shrink-0",children:m?"v":">"}):f.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${A0(i.name)}`}),f.jsx("span",{className:`truncate ${b?"font-medium":"font-mono text-xs"}`,children:i.name}),!b&&i.size!==void 0&&f.jsx("span",{className:"ml-auto text-[10px] font-mono text-slate/60 flex-shrink-0",children:R0(i.size)})]}),j.length>0&&f.jsxs("div",{children:[j.slice(0,y).map(M=>f.jsx(Xm,{node:M,depth:r+1,onSelectFile:o,selectedPath:s},M.path)),E&&f.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(r+1)*16+8}px`},onClick:()=>T(M=>M+Xs),children:["Show more (",j.length-y," remaining)"]})]})]})}function _0({files:i,loading:r}){const[o,s]=g.useState(null),[m,h]=g.useState(null),[y,T]=g.useState(!1),[b,p]=g.useState(null),j=g.useCallback(async M=>{h(null),s(M),T(!0),p(null);try{const Y=await Ze.getFileContent(M);h(Y.content)}catch(Y){const Q=Y instanceof Error?Y.message:"Unknown error",B=Y instanceof TypeError||Q==="Request timeout",G=Q.includes("404")||Q.includes("not found")||Q.includes("Not found");p(B?"Network error - server may be unreachable":G?"File not found - it may have been deleted or renamed":Q),h(null)}finally{T(!1)}},[]),E=g.useCallback(M=>{j(M)},[j]);return f.jsxs("div",{className:"glass p-6 flex flex-col",style:{minHeight:"300px"},children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"File Browser"}),f.jsx("span",{className:"font-mono text-xs text-slate",children:".loki/"})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading files..."}),!r&&(!i||i.length===0)&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No project files found"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),i&&i.length>0&&f.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[f.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:i.map(M=>f.jsx(Xm,{node:M,depth:0,onSelectFile:E,selectedPath:o},M.path))}),f.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-xl p-3 overflow-hidden flex flex-col",children:[!o&&f.jsx("div",{className:"flex-1 flex items-center justify-center text-slate text-xs",children:"Select a file to preview"}),o&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:o}),f.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:y?f.jsx("div",{className:"text-slate text-xs",children:"Loading..."}):b?f.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[f.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),f.jsx("p",{className:"text-slate text-[10px] text-center max-w-[200px] break-words",children:b}),f.jsx("button",{type:"button",onClick:()=>o&&j(o),className:"mt-1 px-3 py-1 text-[10px] font-semibold rounded-lg border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):f.jsx("pre",{className:"text-xs font-mono text-charcoal whitespace-pre-wrap break-words leading-relaxed",children:m})})]})]})]})]})}const bm=5e5;function Sm(i){return i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:i.toString()}function C0(i){if(!i)return"Never";try{const r=new Date(i),s=new Date().getTime()-r.getTime(),m=Math.floor(s/(1e3*60*60));return m<1?"Just now":m<24?`${m}h ago`:`${Math.floor(m/24)}d ago`}catch{return i}}function O0({memory:i,loading:r}){const o=i?[{label:"Episodic",count:i.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:i.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:i.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[],s=i?Math.min(i.total_tokens/bm*100,100):0;return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Memory System"}),i&&f.jsx("span",{className:"font-mono text-xs text-slate",children:C0(i.last_consolidation)})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading memory..."}),!r&&!i&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No memory data available"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Memory populates during autonomous runs"})]}),i&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:o.map(m=>f.jsxs("div",{className:`${m.bg} border ${m.border} rounded-xl p-3 text-center`,children:[f.jsx("div",{className:`text-2xl font-bold font-mono ${m.color}`,children:m.count}),f.jsx("div",{className:"text-[10px] text-slate font-medium mt-1 uppercase tracking-wider",children:m.label})]},m.label))}),f.jsxs("div",{className:"mt-3",children:[f.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[f.jsx("span",{className:"text-xs text-slate font-medium",children:"Token Usage"}),f.jsxs("span",{className:"text-xs font-mono text-charcoal",children:[Sm(i.total_tokens)," / ",Sm(bm)]})]}),f.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden",children:f.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${s>80?"bg-danger":s>50?"bg-warning":"bg-primary-light"}`,style:{width:`${s}%`}})})]}),f.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[f.jsx("span",{className:"text-slate",children:"Last Consolidation"}),f.jsx("span",{className:"font-mono text-charcoal",children:i.last_consolidation?new Date(i.last_consolidation).toLocaleString():"Never"})]})]})]})}function M0({visible:i}){const[r,o]=g.useState("markdown"),[s,m]=g.useState(null),[h,y]=g.useState(null),[T,b]=g.useState(!1),[p,j]=g.useState(!1),[E,M]=g.useState(null),[Y,Q]=g.useState(!1);if(!i)return null;const B=async()=>{b(!0),M(null),m(null),y(null);try{const X=await Ze.generateReport(r);m(X)}catch(X){M(X instanceof Error?X.message:"Failed to generate report")}finally{b(!1)}},G=async()=>{j(!0),M(null);try{const X=await Ze.shareSession();y(X)}catch(X){M(X instanceof Error?X.message:"Failed to share session")}finally{j(!1)}},L=async X=>{try{await navigator.clipboard.writeText(X),Q(!0),setTimeout(()=>Q(!1),2e3)}catch{}},W=()=>{if(!s)return;const X=new Blob([s.content],{type:r==="html"?"text/html":"text/markdown"}),le=URL.createObjectURL(X),ae=document.createElement("a");ae.href=le,ae.download=`loki-report.${r==="html"?"html":"md"}`,ae.click(),URL.revokeObjectURL(le)};return f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Session Report"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex items-center gap-1 glass-subtle rounded-xl p-1",children:["markdown","html"].map(X=>f.jsx("button",{onClick:()=>o(X),className:`px-3 py-1 text-xs font-semibold rounded-lg transition-all ${r===X?"bg-accent-product text-white shadow-sm":"text-slate hover:text-charcoal hover:bg-white/40"}`,children:X.toUpperCase()},X))}),f.jsx("button",{onClick:B,disabled:T,className:"px-4 py-1.5 rounded-xl text-xs font-semibold bg-accent-product text-white hover:bg-accent-product/90 disabled:opacity-50 transition-all",children:T?"Generating...":"Generate Report"})]})]}),E&&f.jsx("div",{className:"mb-3 px-3 py-2 rounded-lg bg-danger/10 border border-danger/20 text-danger text-xs",children:E}),s&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[f.jsxs("span",{className:"text-xs text-slate",children:["Report generated (",s.format,")"]}),f.jsx("div",{className:"flex-1"}),f.jsx("button",{onClick:()=>L(s.content),className:"px-3 py-1 text-xs font-medium text-slate hover:text-charcoal border border-white/30 rounded-lg hover:bg-white/30 transition-all",children:Y?"Copied":"Copy"}),f.jsx("button",{onClick:W,className:"px-3 py-1 text-xs font-medium text-slate hover:text-charcoal border border-white/30 rounded-lg hover:bg-white/30 transition-all",children:"Download"}),f.jsx("button",{onClick:G,disabled:p,className:"px-3 py-1 text-xs font-medium bg-accent-product/10 text-accent-product border border-accent-product/20 rounded-lg hover:bg-accent-product/20 disabled:opacity-50 transition-all",children:p?"Sharing...":"Share as Gist"})]}),h&&f.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-lg bg-success/10 border border-success/20",children:[f.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),h.url?f.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-accent-product underline flex-1 truncate",children:h.url}):f.jsx("span",{className:"text-xs text-slate flex-1",children:"No URL returned"}),h.url&&f.jsx("button",{onClick:()=>L(h.url),className:"text-xs text-slate hover:text-charcoal",children:"Copy URL"})]}),f.jsx("pre",{className:"text-[11px] font-mono text-charcoal bg-black/5 rounded-xl p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:s.content||"(empty report)"})]})]})}function Em({visible:i}){const r=g.useCallback(()=>Ze.getMetrics(),[]),{data:o,loading:s}=Ya(r,15e3,i);return i?f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Session Metrics"}),s&&f.jsx("div",{className:"w-4 h-4 border-2 border-accent-product border-t-transparent rounded-full animate-spin"})]}),o?f.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Iterations"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:o.iterations??0})]}),f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:typeof o.quality_gate_pass_rate=="number"?`${o.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Tokens Used"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:(o.tokens_used??0).toLocaleString()})]}),f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Time Elapsed"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:o.time_elapsed||"N/A"})]})]}):f.jsx("div",{className:"text-sm text-slate py-4 text-center",children:s?"Loading metrics...":"No metrics available"})]}):null}const D0={completed:{bg:"bg-success/10",text:"text-success",label:"Completed"},complete:{bg:"bg-success/10",text:"text-success",label:"Completed"},done:{bg:"bg-success/10",text:"text-success",label:"Completed"},in_progress:{bg:"bg-primary/10",text:"text-primary",label:"In Progress"},started:{bg:"bg-warning/10",text:"text-warning",label:"Started"},error:{bg:"bg-danger/10",text:"text-danger",label:"Failed"},failed:{bg:"bg-danger/10",text:"text-danger",label:"Failed"},empty:{bg:"bg-slate/10",text:"text-slate",label:"Empty"}};function U0(i){return D0[i]||{bg:"bg-slate/10",text:"text-slate",label:i}}function w0({onLoadSession:i}){const r=g.useCallback(()=>Ze.getSessionsHistory(),[]),{data:o,loading:s}=Ya(r,6e4,!0);return s&&!o?f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider mb-3",children:"Past Builds"}),f.jsx("div",{className:"text-sm text-slate",children:"Loading..."})]}):!o||o.length===0?null:f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider mb-3",children:"Past Builds"}),f.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:o.map(m=>{const h=U0(m.status),y=m.file_count;return f.jsxs("button",{onClick:()=>i==null?void 0:i(m),className:"text-left px-4 py-3 rounded-xl glass-subtle hover:bg-white/40 transition-all group cursor-pointer",children:[f.jsxs("div",{className:"flex items-center justify-between mb-1",children:[f.jsx("span",{className:"text-[10px] font-mono text-slate",children:m.date}),f.jsxs("div",{className:"flex items-center gap-2",children:[y!==void 0&&y>0&&f.jsxs("span",{className:"text-[10px] font-mono text-slate",children:[y," files"]}),f.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${h.bg} ${h.text}`,children:h.label})]})]}),f.jsx("div",{className:"text-xs text-charcoal truncate group-hover:text-accent-product transition-colors",children:m.prd_snippet||m.id}),f.jsx("div",{className:"text-[10px] font-mono text-slate/60 mt-0.5 truncate",children:m.path})]},m.id)})})]})}const H0=g.lazy(()=>a0(()=>import("./ProjectPage-tMxpArTu.js"),[]));function B0(){return f.jsxs(Sy,{children:[f.jsx(Vs,{path:"/",element:f.jsx(L0,{})}),f.jsx(Vs,{path:"/project/:sessionId",element:f.jsx(g.Suspense,{fallback:f.jsx("div",{className:"h-screen bg-background flex items-center justify-center text-slate",children:"Loading..."}),children:f.jsx(H0,{})})})]})}function L0(){const i=Um(),[r,o]=g.useState(null),[s,m]=g.useState(()=>sessionStorage.getItem("pl_running")==="1"),[h,y]=g.useState(!1),[T,b]=g.useState(()=>sessionStorage.getItem("pl_prd")),[p,j]=g.useState(!1),[E,M]=g.useState(!1),[Y,Q]=g.useState(!1),[B,G]=g.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[L,W]=g.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[X,le]=g.useState(null),[ae,fe]=g.useState(null),[F,Ne]=g.useState(null),Me=g.useCallback(Ce=>{if(!Ce){le(null),fe(null),Ne(null);return}le(Ce.status),fe(Ce.agents),Ne(Ce.logs),m(Ce.status.running??!1),y(Ce.status.paused??!1)},[]),{connected:we,subscribe:ke}=c0(Me),Le=g.useCallback(()=>Ze.getStatus(),[]),{data:qe}=Ya(Le,3e4,!we);g.useEffect(()=>{X===null&&qe!==null&&(m(qe.running??!1),y(qe.paused??!1))},[qe,X]),g.useEffect(()=>{sessionStorage.setItem("pl_running",s?"1":"0"),s&&j(!0)},[s]),g.useEffect(()=>{T?sessionStorage.setItem("pl_prd",T):sessionStorage.removeItem("pl_prd")},[T]),g.useEffect(()=>{sessionStorage.setItem("pl_provider",L)},[L]),g.useEffect(()=>{sessionStorage.setItem("pl_tab",B)},[B]);const tt=g.useCallback(()=>Ze.getMemorySummary(),[]),Ae=g.useCallback(()=>Ze.getChecklist(),[]),C=g.useCallback(()=>Ze.getFiles(),[]),{data:H,loading:J}=Ya(tt,3e4,s),{data:oe,loading:ve}=Ya(Ae,3e4,s),{data:S,loading:w}=Ya(C,3e4,s),q=X??qe,V=ae,P=F,ne=ae===null,de=F===null,$e=g.useCallback(async(Ce,Za,gi,kn)=>{o(null),j(!1),M(!1),G("terminal");try{await Ze.startSession({prd:Ce,provider:Za,projectDir:gi,mode:kn}),b(Ce)}catch(ta){o(ta instanceof Error?ta.message:"Failed to start session")}},[]),_e=g.useCallback(async()=>{try{(await Ze.stopSession()).stopped&&(m(!1),y(!1),b(null),le(null),fe(null),Ne(null))}catch{m(!1),y(!1),b(null)}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),wl=g.useCallback(Ce=>{i(`/project/${Ce.id}`)},[i]),Hl=g.useCallback(Ce=>{W(Ce)},[]),Xa=g.useCallback(async()=>{try{await Ze.pauseSession(),y(!0)}catch{}},[]),Jn=g.useCallback(async()=>{try{await Ze.resumeSession(),y(!1)}catch{}},[]),Qt=T&&T.replace(/^#+\s*/gm,"").split(`
76
+ `)}},[]),Ae=async()=>{if(!(!h.trim()||we)){ke(!0),Me(null),qe(!0);try{const H=await Ze.planSession(h,Y);Me(H)}catch{Me({complexity:"unknown",cost_estimate:"N/A",iterations:0,phases:[],output_text:"Failed to run loki plan. The CLI may not be available.",returncode:1})}finally{ke(!1)}}},C=async()=>{if(!(!h.trim()||r||le)){qe(!1),ae(!0);try{await i(h,Y,E.trim()||void 0,fe?"quick":void 0)}finally{ae(!1)}}};return f.jsxs(f.Fragment,{children:[Le&&f.jsx(h0,{plan:Ne,loading:we,onConfirm:C,onCancel:()=>qe(!1)}),f.jsxs("div",{className:"glass p-6 flex flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Product Requirements"}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs("div",{className:"relative",children:[f.jsx("button",{onClick:()=>B(!Q),className:"text-xs font-medium px-3 py-1.5 rounded-xl border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:T||"Templates"}),Q&&f.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 glass-subtle rounded-xl overflow-hidden z-20 shadow-glass",children:f.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[W&&f.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!W&&G.length===0&&f.jsx("div",{className:"px-3 py-2 text-xs text-slate",children:"Loading..."}),G.map(H=>f.jsx("button",{onClick:()=>tt(H.filename,H.name),className:"w-full text-left px-3 py-2 text-sm text-charcoal hover:bg-primary/5 transition-colors",children:H.name},H.filename))]})})]})})]}),f.jsx("textarea",{value:h,onChange:H=>y(H.target.value),placeholder:"Paste your PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-white/40 rounded-xl border border-white/30 px-4 py-3 text-sm font-mono text-charcoal placeholder:text-primary-wash resize-none focus:outline-none focus:ring-2 focus:ring-accent-product/20 focus:border-accent-product/30 transition-all",spellCheck:!1}),f.jsxs("div",{className:"mt-3",children:[f.jsx("label",{className:"block text-xs text-slate font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),f.jsx("input",{type:"text",value:E,onChange:H=>M(H.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-white/40 rounded-xl border border-white/30 px-4 py-2 text-sm font-mono text-charcoal placeholder:text-primary-wash/70 focus:outline-none focus:ring-2 focus:ring-accent-product/20 focus:border-accent-product/30 transition-all",spellCheck:!1}),f.jsx("p",{className:"text-[10px] text-slate mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),o&&f.jsx("div",{className:"mt-3 px-3 py-2 rounded-lg bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:o}),f.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[f.jsxs("button",{onClick:()=>F(!fe),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-semibold border transition-all ${fe?"bg-accent-product/10 border-accent-product/30 text-accent-product":"border-white/30 text-slate hover:text-charcoal hover:bg-white/20"}`,children:[f.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${fe?"bg-accent-product":"bg-slate/40"}`}),"Quick"]}),f.jsx("div",{className:"flex-1"}),f.jsxs("span",{className:"text-xs text-slate font-mono",children:[h.length.toLocaleString()," chars"]}),f.jsx("button",{onClick:Ae,disabled:!h.trim()||r||we,className:`px-4 py-2.5 rounded-xl text-sm font-semibold border transition-all ${!h.trim()||r||we?"border-white/20 text-slate/40 cursor-not-allowed":"border-accent-product/30 text-accent-product hover:bg-accent-product/5"}`,children:we?"Analyzing...":"Estimate"}),f.jsx("button",{onClick:C,disabled:!h.trim()||r||le,className:`px-6 py-2.5 rounded-xl text-sm font-semibold transition-all ${!h.trim()||r||le?"bg-surface/50 text-slate cursor-not-allowed":"bg-accent-product text-white hover:bg-accent-product/90 shadow-glass-subtle"}`,children:le?"Starting...":r?"Building...":"Start Build"})]})]})]})}const Qn=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function v0(i){if(!i)return"reason";const r=i.toLowerCase();return r.includes("reason")||r.includes("plan")?"reason":r.includes("act")||r.includes("implement")||r.includes("code")?"act":r.includes("reflect")||r.includes("review")?"reflect":r.includes("verify")||r.includes("test")||r.includes("check")?"verify":"idle"}function y0({currentPhase:i,iteration:r}){const o=v0(i);return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"RARV Cycle"}),f.jsxs("span",{className:"font-mono text-xs text-slate",children:["Iteration ",r]})]}),f.jsx("div",{className:"flex items-center justify-center mb-5",children:f.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[Qn.map((s,m)=>{const h=s.key===o,y=o!=="idle"&&Qn.findIndex(j=>j.key===o)>m,T=(m*90-90)*(Math.PI/180),b=60+40*Math.cos(T),p=60+40*Math.sin(T);return f.jsxs("g",{children:[m<Qn.length-1&&f.jsx("line",{x1:b,y1:p,x2:60+40*Math.cos(((m+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((m+1)*90-90)*(Math.PI/180)),stroke:y?"#3D52A0":"#ADBBDA",strokeWidth:y?2:1,strokeDasharray:y?"none":"4 3"}),m===Qn.length-1&&f.jsx("line",{x1:b,y1:p,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ADBBDA",strokeWidth:1,strokeDasharray:"4 3"}),f.jsx("circle",{cx:b,cy:p,r:h?14:10,fill:h?"#3D52A0":y?"#7091E6":"#EDE8F5",stroke:h?"#6C63FF":y?"#3D52A0":"#ADBBDA",strokeWidth:h?3:1.5,className:h?"phase-active":""}),f.jsx("text",{x:b,y:p+(m===0?-20:m===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-charcoal",dx:m===1?22:m===3?-22:0,children:s.label[0]})]},s.key)}),f.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:r})]})}),f.jsx("div",{className:"space-y-2",children:Qn.map(s=>{const m=s.key===o;return f.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-xl transition-all duration-200 ${m?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[f.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${m?"bg-primary phase-active":"bg-surface"}`}),f.jsxs("div",{children:[f.jsx("span",{className:`text-sm font-semibold ${m?"text-primary":"text-slate"}`,children:s.label}),m&&f.jsx("p",{className:"text-xs text-slate mt-0.5",children:s.description})]})]},s.key)})})]})}const Qs={architect:"bg-accent-product/10 text-accent-product border-accent-product/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary-wash/20 text-charcoal border-primary-wash/30",default:"bg-surface/30 text-slate border-surface/50"};function g0(i){if(!i)return Qs.default;const r=i.toLowerCase();for(const[o,s]of Object.entries(Qs))if(r.includes(o))return s;return Qs.default}function x0({agents:i,loading:r}){const o=(i==null?void 0:i.filter(m=>m.alive))||[],s=(i==null?void 0:i.filter(m=>!m.alive))||[];return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Agents"}),f.jsxs("span",{className:"font-mono text-xs text-slate",children:[o.length," active"]})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading agents..."}),!r&&(i==null?void 0:i.length)===0&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No agents running"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Start a build to spawn agents"})]}),o.length>0&&f.jsx("div",{className:"space-y-2 mb-4",children:o.map(m=>f.jsx(xm,{agent:m},m.id))}),s.length>0&&f.jsxs("details",{className:"mt-3",children:[f.jsxs("summary",{className:"text-xs text-slate cursor-pointer hover:text-charcoal transition-colors",children:[s.length," completed"]}),f.jsx("div",{className:"space-y-1.5 mt-2",children:s.slice(0,10).map(m=>f.jsx(xm,{agent:m,compact:!0},m.id))})]})]})}function xm({agent:i,compact:r}){const o=g0(i.type||i.name||"");return r?f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-lg bg-white/30 text-xs",children:[f.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-slate/30"}),f.jsx("span",{className:"font-medium text-slate truncate",children:i.name||i.id}),f.jsx("span",{className:"text-primary-wash ml-auto",children:i.type})]}):f.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-xl border ${o}`,children:[f.jsx("div",{className:"flex-shrink-0 mt-0.5",children:f.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${i.alive?"bg-success phase-active":"bg-slate/30"}`})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-sm font-semibold truncate",children:i.name||i.id}),i.type&&f.jsx("span",{className:"text-[10px] font-mono font-medium opacity-70",children:i.type})]}),i.task&&f.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:i.task}),i.status&&i.status!=="unknown"&&f.jsx("span",{className:"inline-block text-[10px] font-mono mt-1 opacity-60",children:i.status})]}),i.pid&&f.jsxs("span",{className:"text-[10px] font-mono text-slate/50 flex-shrink-0",children:["PID ",i.pid]})]})}const b0={info:"text-primary-light",error:"text-danger",warning:"text-warning",debug:"text-slate",critical:"text-danger font-bold"};function S0(i){if(!i)return"";if(i.includes("T")||i.includes("-"))try{return new Date(i).toLocaleTimeString("en-US",{hour12:!1})}catch{return i}return i}function E0({logs:i,loading:r,subscribe:o}){const s=g.useRef(null),[m,h]=g.useState(!1),[y,T]=g.useState([]);g.useEffect(()=>o?o("log",M=>{const Y=M;Y!=null&&Y.line&&T(Q=>{const B=[...Q,{message:Y.line,timestamp:Y.timestamp||""}];return B.length>500?B.slice(-500):B})}):void 0,[o]);const b=(()=>{const E=y.map(B=>{let G="info";const L=B.message.toLowerCase();return L.includes("error")||L.includes("fail")?G="error":L.includes("warn")?G="warning":L.includes("debug")&&(G="debug"),{timestamp:B.timestamp,level:G,message:B.message,source:"ws"}}),M=i||[];if(E.length===0)return M;if(M.length===0)return E;const Y=new Set(E.map(B=>B.message));return[...M.filter(B=>!Y.has(B.message)),...E]})();g.useEffect(()=>{!m&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[b,m]);const p=()=>{if(!s.current)return;const{scrollTop:E,scrollHeight:M,clientHeight:Y}=s.current,Q=M-E-Y<50;h(!Q)},j=()=>{var E;h(!1),(E=s.current)==null||E.scrollTo({top:s.current.scrollHeight,behavior:"smooth"})};return f.jsxs("div",{className:"glass p-0 overflow-hidden flex flex-col",style:{height:"calc(100vh - 380px)",minHeight:"300px",maxHeight:"600px"},children:[f.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10 flex-shrink-0",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Terminal"}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("span",{className:"font-mono text-xs text-slate",children:[b.length," lines"]}),f.jsx("button",{onClick:m?j:()=>h(!0),className:`text-xs font-medium px-2.5 py-1 rounded-lg border transition-colors ${m?"border-warning/40 text-warning bg-warning/5 hover:bg-warning/10":"border-primary/20 text-primary hover:bg-primary/5"}`,title:m?"Scroll locked -- click to resume auto-scroll":"Auto-scrolling -- click to lock",children:m?"Locked":"Live"}),m&&f.jsx("button",{onClick:j,className:"text-xs text-primary hover:text-primary-light transition-colors font-medium",children:"Jump to bottom"})]})]}),f.jsxs("div",{ref:s,onScroll:p,className:"flex-1 overflow-y-auto terminal-scroll bg-charcoal/[0.03] p-4 font-mono text-xs leading-relaxed",children:[r&&!i&&y.length===0&&f.jsx("div",{className:"text-slate animate-pulse",children:"Connecting to log stream..."}),b.length===0&&!r&&f.jsxs("div",{className:"text-slate/60",children:[f.jsx("p",{children:"No log output yet."}),f.jsx("p",{className:"mt-1",children:"Start a build to see terminal output here."})]}),b.map((E,M)=>f.jsxs("div",{className:"flex gap-2 hover:bg-white/5 rounded px-1 -mx-1",children:[f.jsx("span",{className:"text-slate/40 flex-shrink-0 select-none w-16 text-right",children:S0(E.timestamp)}),f.jsx("span",{className:`flex-shrink-0 w-12 text-right uppercase text-[10px] font-semibold ${b0[E.level]||"text-slate"}`,children:E.level}),f.jsx("span",{className:`flex-1 break-all ${E.level==="error"||E.level==="critical"?"text-danger":"text-charcoal/80"}`,children:E.message})]},M)),b.length>0&&f.jsx("div",{className:"terminal-cursor mt-1"})]})]})}const N0={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-slate/10 text-slate border-slate/20",dot:"bg-slate/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function T0({item:i}){const[r,o]=g.useState(!1),s=N0[i.status];return f.jsxs("div",{className:`border rounded-xl overflow-hidden ${s.badge}`,children:[f.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>i.details&&o(!r),children:[f.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s.dot}`}),f.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:i.label}),f.jsx("span",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:s.label}),i.details&&f.jsx("span",{className:"text-xs text-slate/60 flex-shrink-0",children:r?"v":">"})]}),r&&i.details&&f.jsx("div",{className:"px-3 pb-2.5 pt-0",children:f.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:i.details})})]})}function j0({checklist:i,loading:r}){const o=i&&i.total>0?i.passed/i.total*100:0;return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Quality Gates"}),i&&f.jsxs("span",{className:"font-mono text-xs text-slate",children:[i.passed,"/",i.total," passed"]})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading gates..."}),!r&&!i&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No quality gate data"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Gates run during verification phase"})]}),i&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[f.jsxs("span",{className:"text-success font-medium",children:[i.passed," passed"]}),i.failed>0&&f.jsxs("span",{className:"text-danger font-medium",children:[i.failed," failed"]}),i.skipped>0&&f.jsxs("span",{className:"text-slate",children:[i.skipped," skipped"]}),i.pending>0&&f.jsxs("span",{className:"text-warning",children:[i.pending," pending"]})]}),f.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:f.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${o}%`}})}),f.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:i.items.map(s=>f.jsx(T0,{item:s},s.id))})]})]})}const z0={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-accent-product"};function A0(i){const r=i.substring(i.lastIndexOf("."));return z0[r]||"bg-slate"}function R0(i){return i==null?"":i<1024?`${i}B`:i<1024*1024?`${(i/1024).toFixed(1)}KB`:`${(i/(1024*1024)).toFixed(1)}MB`}const Xs=100;function Xm({node:i,depth:r,onSelectFile:o,selectedPath:s}){const[m,h]=g.useState(!1),[y,T]=g.useState(Xs),b=i.type==="directory",p=i.path===s,j=b&&m?i.children??[]:[],E=j.length>y;return f.jsxs("div",{children:[f.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-lg text-left text-sm transition-colors hover:bg-white/30 ${p?"bg-primary/10 text-primary":"text-charcoal"}`,style:{paddingLeft:`${r*16+8}px`},onClick:()=>{b?(h(!m),m&&T(Xs)):o(i.path)},children:[b?f.jsx("span",{className:"font-mono text-xs text-slate w-3 flex-shrink-0",children:m?"v":">"}):f.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${A0(i.name)}`}),f.jsx("span",{className:`truncate ${b?"font-medium":"font-mono text-xs"}`,children:i.name}),!b&&i.size!==void 0&&f.jsx("span",{className:"ml-auto text-[10px] font-mono text-slate/60 flex-shrink-0",children:R0(i.size)})]}),j.length>0&&f.jsxs("div",{children:[j.slice(0,y).map(M=>f.jsx(Xm,{node:M,depth:r+1,onSelectFile:o,selectedPath:s},M.path)),E&&f.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(r+1)*16+8}px`},onClick:()=>T(M=>M+Xs),children:["Show more (",j.length-y," remaining)"]})]})]})}function _0({files:i,loading:r}){const[o,s]=g.useState(null),[m,h]=g.useState(null),[y,T]=g.useState(!1),[b,p]=g.useState(null),j=g.useCallback(async M=>{h(null),s(M),T(!0),p(null);try{const Y=await Ze.getFileContent(M);h(Y.content)}catch(Y){const Q=Y instanceof Error?Y.message:"Unknown error",B=Y instanceof TypeError||Q==="Request timeout",G=Q.includes("404")||Q.includes("not found")||Q.includes("Not found");p(B?"Network error - server may be unreachable":G?"File not found - it may have been deleted or renamed":Q),h(null)}finally{T(!1)}},[]),E=g.useCallback(M=>{j(M)},[j]);return f.jsxs("div",{className:"glass p-6 flex flex-col",style:{minHeight:"300px"},children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"File Browser"}),f.jsx("span",{className:"font-mono text-xs text-slate",children:".loki/"})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading files..."}),!r&&(!i||i.length===0)&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No project files found"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),i&&i.length>0&&f.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[f.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:i.map(M=>f.jsx(Xm,{node:M,depth:0,onSelectFile:E,selectedPath:o},M.path))}),f.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-xl p-3 overflow-hidden flex flex-col",children:[!o&&f.jsx("div",{className:"flex-1 flex items-center justify-center text-slate text-xs",children:"Select a file to preview"}),o&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:o}),f.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:y?f.jsx("div",{className:"text-slate text-xs",children:"Loading..."}):b?f.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[f.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),f.jsx("p",{className:"text-slate text-[10px] text-center max-w-[200px] break-words",children:b}),f.jsx("button",{type:"button",onClick:()=>o&&j(o),className:"mt-1 px-3 py-1 text-[10px] font-semibold rounded-lg border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):f.jsx("pre",{className:"text-xs font-mono text-charcoal whitespace-pre-wrap break-words leading-relaxed",children:m})})]})]})]})]})}const bm=5e5;function Sm(i){return i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:i.toString()}function C0(i){if(!i)return"Never";try{const r=new Date(i),s=new Date().getTime()-r.getTime(),m=Math.floor(s/(1e3*60*60));return m<1?"Just now":m<24?`${m}h ago`:`${Math.floor(m/24)}d ago`}catch{return i}}function O0({memory:i,loading:r}){const o=i?[{label:"Episodic",count:i.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:i.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:i.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[],s=i?Math.min(i.total_tokens/bm*100,100):0;return f.jsxs("div",{className:"glass p-6",children:[f.jsxs("div",{className:"flex items-center justify-between mb-4",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Memory System"}),i&&f.jsx("span",{className:"font-mono text-xs text-slate",children:C0(i.last_consolidation)})]}),r&&!i&&f.jsx("div",{className:"text-center py-8 text-slate text-sm",children:"Loading memory..."}),!r&&!i&&f.jsxs("div",{className:"text-center py-8",children:[f.jsx("p",{className:"text-slate text-sm",children:"No memory data available"}),f.jsx("p",{className:"text-primary-wash text-xs mt-1",children:"Memory populates during autonomous runs"})]}),i&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:o.map(m=>f.jsxs("div",{className:`${m.bg} border ${m.border} rounded-xl p-3 text-center`,children:[f.jsx("div",{className:`text-2xl font-bold font-mono ${m.color}`,children:m.count}),f.jsx("div",{className:"text-[10px] text-slate font-medium mt-1 uppercase tracking-wider",children:m.label})]},m.label))}),f.jsxs("div",{className:"mt-3",children:[f.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[f.jsx("span",{className:"text-xs text-slate font-medium",children:"Token Usage"}),f.jsxs("span",{className:"text-xs font-mono text-charcoal",children:[Sm(i.total_tokens)," / ",Sm(bm)]})]}),f.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden",children:f.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${s>80?"bg-danger":s>50?"bg-warning":"bg-primary-light"}`,style:{width:`${s}%`}})})]}),f.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[f.jsx("span",{className:"text-slate",children:"Last Consolidation"}),f.jsx("span",{className:"font-mono text-charcoal",children:i.last_consolidation?new Date(i.last_consolidation).toLocaleString():"Never"})]})]})]})}function M0({visible:i}){const[r,o]=g.useState("markdown"),[s,m]=g.useState(null),[h,y]=g.useState(null),[T,b]=g.useState(!1),[p,j]=g.useState(!1),[E,M]=g.useState(null),[Y,Q]=g.useState(!1);if(!i)return null;const B=async()=>{b(!0),M(null),m(null),y(null);try{const X=await Ze.generateReport(r);m(X)}catch(X){M(X instanceof Error?X.message:"Failed to generate report")}finally{b(!1)}},G=async()=>{j(!0),M(null);try{const X=await Ze.shareSession();y(X)}catch(X){M(X instanceof Error?X.message:"Failed to share session")}finally{j(!1)}},L=async X=>{try{await navigator.clipboard.writeText(X),Q(!0),setTimeout(()=>Q(!1),2e3)}catch{}},W=()=>{if(!s)return;const X=new Blob([s.content],{type:r==="html"?"text/html":"text/markdown"}),le=URL.createObjectURL(X),ae=document.createElement("a");ae.href=le,ae.download=`loki-report.${r==="html"?"html":"md"}`,ae.click(),URL.revokeObjectURL(le)};return f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Session Report"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex items-center gap-1 glass-subtle rounded-xl p-1",children:["markdown","html"].map(X=>f.jsx("button",{onClick:()=>o(X),className:`px-3 py-1 text-xs font-semibold rounded-lg transition-all ${r===X?"bg-accent-product text-white shadow-sm":"text-slate hover:text-charcoal hover:bg-white/40"}`,children:X.toUpperCase()},X))}),f.jsx("button",{onClick:B,disabled:T,className:"px-4 py-1.5 rounded-xl text-xs font-semibold bg-accent-product text-white hover:bg-accent-product/90 disabled:opacity-50 transition-all",children:T?"Generating...":"Generate Report"})]})]}),E&&f.jsx("div",{className:"mb-3 px-3 py-2 rounded-lg bg-danger/10 border border-danger/20 text-danger text-xs",children:E}),s&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[f.jsxs("span",{className:"text-xs text-slate",children:["Report generated (",s.format,")"]}),f.jsx("div",{className:"flex-1"}),f.jsx("button",{onClick:()=>L(s.content),className:"px-3 py-1 text-xs font-medium text-slate hover:text-charcoal border border-white/30 rounded-lg hover:bg-white/30 transition-all",children:Y?"Copied":"Copy"}),f.jsx("button",{onClick:W,className:"px-3 py-1 text-xs font-medium text-slate hover:text-charcoal border border-white/30 rounded-lg hover:bg-white/30 transition-all",children:"Download"}),f.jsx("button",{onClick:G,disabled:p,className:"px-3 py-1 text-xs font-medium bg-accent-product/10 text-accent-product border border-accent-product/20 rounded-lg hover:bg-accent-product/20 disabled:opacity-50 transition-all",children:p?"Sharing...":"Share as Gist"})]}),h&&f.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-lg bg-success/10 border border-success/20",children:[f.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),h.url?f.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-accent-product underline flex-1 truncate",children:h.url}):f.jsx("span",{className:"text-xs text-slate flex-1",children:"No URL returned"}),h.url&&f.jsx("button",{onClick:()=>L(h.url),className:"text-xs text-slate hover:text-charcoal",children:"Copy URL"})]}),f.jsx("pre",{className:"text-[11px] font-mono text-charcoal bg-black/5 rounded-xl p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:s.content||"(empty report)"})]})]})}function Em({visible:i}){const r=g.useCallback(()=>Ze.getMetrics(),[]),{data:o,loading:s}=Ya(r,15e3,i);return i?f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider",children:"Session Metrics"}),s&&f.jsx("div",{className:"w-4 h-4 border-2 border-accent-product border-t-transparent rounded-full animate-spin"})]}),o?f.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Iterations"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:o.iterations??0})]}),f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:typeof o.quality_gate_pass_rate=="number"?`${o.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Tokens Used"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:(o.tokens_used??0).toLocaleString()})]}),f.jsxs("div",{className:"glass-subtle rounded-xl p-3",children:[f.jsx("div",{className:"text-[10px] font-semibold text-slate uppercase tracking-wider mb-1",children:"Time Elapsed"}),f.jsx("div",{className:"text-xl font-bold text-charcoal",children:o.time_elapsed||"N/A"})]})]}):f.jsx("div",{className:"text-sm text-slate py-4 text-center",children:s?"Loading metrics...":"No metrics available"})]}):null}const D0={completed:{bg:"bg-success/10",text:"text-success",label:"Completed"},complete:{bg:"bg-success/10",text:"text-success",label:"Completed"},done:{bg:"bg-success/10",text:"text-success",label:"Completed"},in_progress:{bg:"bg-primary/10",text:"text-primary",label:"In Progress"},started:{bg:"bg-warning/10",text:"text-warning",label:"Started"},error:{bg:"bg-danger/10",text:"text-danger",label:"Failed"},failed:{bg:"bg-danger/10",text:"text-danger",label:"Failed"},empty:{bg:"bg-slate/10",text:"text-slate",label:"Empty"}};function U0(i){return D0[i]||{bg:"bg-slate/10",text:"text-slate",label:i}}function w0({onLoadSession:i}){const r=g.useCallback(()=>Ze.getSessionsHistory(),[]),{data:o,loading:s}=Ya(r,6e4,!0);return s&&!o?f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider mb-3",children:"Past Builds"}),f.jsx("div",{className:"text-sm text-slate",children:"Loading..."})]}):!o||o.length===0?null:f.jsxs("div",{className:"glass p-4 rounded-2xl",children:[f.jsx("h3",{className:"text-sm font-semibold text-charcoal uppercase tracking-wider mb-3",children:"Past Builds"}),f.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:o.map(m=>{const h=U0(m.status),y=m.file_count;return f.jsxs("button",{onClick:()=>i==null?void 0:i(m),className:"text-left px-4 py-3 rounded-xl glass-subtle hover:bg-white/40 transition-all group cursor-pointer",children:[f.jsxs("div",{className:"flex items-center justify-between mb-1",children:[f.jsx("span",{className:"text-[10px] font-mono text-slate",children:m.date}),f.jsxs("div",{className:"flex items-center gap-2",children:[y!==void 0&&y>0&&f.jsxs("span",{className:"text-[10px] font-mono text-slate",children:[y," files"]}),f.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${h.bg} ${h.text}`,children:h.label})]})]}),f.jsx("div",{className:"text-xs text-charcoal truncate group-hover:text-accent-product transition-colors",children:m.prd_snippet||m.id}),f.jsx("div",{className:"text-[10px] font-mono text-slate/60 mt-0.5 truncate",children:m.path})]},m.id)})})]})}const H0=g.lazy(()=>a0(()=>import("./ProjectPage-DokSAWd7.js"),[]));function B0(){return f.jsxs(Sy,{children:[f.jsx(Vs,{path:"/",element:f.jsx(L0,{})}),f.jsx(Vs,{path:"/project/:sessionId",element:f.jsx(g.Suspense,{fallback:f.jsx("div",{className:"h-screen bg-background flex items-center justify-center text-slate",children:"Loading..."}),children:f.jsx(H0,{})})})]})}function L0(){const i=Um(),[r,o]=g.useState(null),[s,m]=g.useState(()=>sessionStorage.getItem("pl_running")==="1"),[h,y]=g.useState(!1),[T,b]=g.useState(()=>sessionStorage.getItem("pl_prd")),[p,j]=g.useState(!1),[E,M]=g.useState(!1),[Y,Q]=g.useState(!1),[B,G]=g.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[L,W]=g.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[X,le]=g.useState(null),[ae,fe]=g.useState(null),[F,Ne]=g.useState(null),Me=g.useCallback(Ce=>{if(!Ce){le(null),fe(null),Ne(null);return}le(Ce.status),fe(Ce.agents),Ne(Ce.logs),m(Ce.status.running??!1),y(Ce.status.paused??!1)},[]),{connected:we,subscribe:ke}=c0(Me),Le=g.useCallback(()=>Ze.getStatus(),[]),{data:qe}=Ya(Le,3e4,!we);g.useEffect(()=>{X===null&&qe!==null&&(m(qe.running??!1),y(qe.paused??!1))},[qe,X]),g.useEffect(()=>{sessionStorage.setItem("pl_running",s?"1":"0"),s&&j(!0)},[s]),g.useEffect(()=>{T?sessionStorage.setItem("pl_prd",T):sessionStorage.removeItem("pl_prd")},[T]),g.useEffect(()=>{sessionStorage.setItem("pl_provider",L)},[L]),g.useEffect(()=>{sessionStorage.setItem("pl_tab",B)},[B]);const tt=g.useCallback(()=>Ze.getMemorySummary(),[]),Ae=g.useCallback(()=>Ze.getChecklist(),[]),C=g.useCallback(()=>Ze.getFiles(),[]),{data:H,loading:J}=Ya(tt,3e4,s),{data:oe,loading:ve}=Ya(Ae,3e4,s),{data:S,loading:w}=Ya(C,3e4,s),q=X??qe,V=ae,P=F,ne=ae===null,de=F===null,$e=g.useCallback(async(Ce,Za,gi,kn)=>{o(null),j(!1),M(!1),G("terminal");try{await Ze.startSession({prd:Ce,provider:Za,projectDir:gi,mode:kn}),b(Ce)}catch(ta){o(ta instanceof Error?ta.message:"Failed to start session")}},[]),_e=g.useCallback(async()=>{try{(await Ze.stopSession()).stopped&&(m(!1),y(!1),b(null),le(null),fe(null),Ne(null))}catch{m(!1),y(!1),b(null)}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),wl=g.useCallback(Ce=>{i(`/project/${Ce.id}`)},[i]),Hl=g.useCallback(Ce=>{W(Ce)},[]),Xa=g.useCallback(async()=>{try{await Ze.pauseSession(),y(!0)}catch{}},[]),Jn=g.useCallback(async()=>{try{await Ze.resumeSession(),y(!1)}catch{}},[]),Qt=T&&T.replace(/^#+\s*/gm,"").split(`
77
77
  `).find(Ce=>Ce.trim().length>0)||null;return f.jsxs("div",{className:"min-h-screen bg-background relative",children:[f.jsx("div",{className:"pattern-circles"}),f.jsx(r0,{status:q,wsConnected:we,onProviderChange:Hl,selectedProvider:L}),f.jsx("main",{className:"max-w-[1920px] mx-auto px-6 py-6 relative z-10",children:s?f.jsxs(f.Fragment,{children:[f.jsx(Dl,{name:"ControlBar",children:f.jsx(d0,{status:q,prdSummary:Qt,onStop:_e,onPause:Xa,onResume:Jn,isPaused:h})}),f.jsx("div",{className:"mt-4",children:f.jsx(Dl,{name:"StatusOverview",children:f.jsx(m0,{status:q})})}),f.jsxs("div",{className:"mt-4 grid grid-cols-12 gap-6",style:{height:"calc(100vh - 340px)",minHeight:"400px"},children:[f.jsx("div",{className:"col-span-3 flex flex-col gap-6",children:f.jsx(Dl,{name:"PhaseVisualizer",children:f.jsx(y0,{currentPhase:(q==null?void 0:q.phase)||"idle",iteration:(q==null?void 0:q.iteration)||0})})}),f.jsxs("div",{className:"col-span-5 flex flex-col gap-0 min-h-0",children:[f.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-shrink-0",children:[f.jsx("button",{onClick:()=>G("terminal"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${B==="terminal"?"bg-accent-product text-white":"text-slate hover:text-charcoal hover:bg-white/30"}`,children:"Terminal"}),f.jsx("button",{onClick:()=>G("metrics"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${B==="metrics"?"bg-accent-product text-white":"text-slate hover:text-charcoal hover:bg-white/30"}`,children:"Metrics"})]}),f.jsx("div",{className:"flex-1 min-h-0",children:f.jsx(Dl,{name:"Terminal",children:B==="terminal"?f.jsx(E0,{logs:P,loading:de,subscribe:ke}):f.jsx(Em,{visible:!0})})})]}),f.jsxs("div",{className:"col-span-4 flex flex-col gap-6 overflow-y-auto",children:[f.jsx(Dl,{name:"AgentDashboard",children:f.jsx(x0,{agents:V,loading:ne})}),f.jsx(Dl,{name:"QualityGates",children:f.jsx(j0,{checklist:oe,loading:ve})})]})]}),f.jsxs("div",{className:"mt-6 grid grid-cols-12 gap-6",children:[f.jsx("div",{className:"col-span-6",children:f.jsx(Dl,{name:"FileBrowser",children:f.jsx(_0,{files:S,loading:w})})}),f.jsx("div",{className:"col-span-6",children:f.jsx(Dl,{name:"MemoryViewer",children:f.jsx(O0,{memory:H,loading:J})})})]})]}):f.jsxs("div",{className:"flex flex-col items-center",children:[f.jsxs("div",{className:"text-center mt-8 mb-8",children:[f.jsx("h2",{className:"text-3xl font-bold text-charcoal tracking-tight",children:"Describe it. Build it. Ship it."}),f.jsx("p",{className:"text-slate mt-2 text-base max-w-lg mx-auto",children:"Paste a PRD or pick a template. Purple Lab spins up autonomous agents to build your project from scratch."})]}),f.jsx("div",{className:"w-full max-w-3xl",children:f.jsx(p0,{onSubmit:$e,running:s,error:r,provider:L,onProviderChange:Hl})}),p&&!s&&f.jsxs("div",{className:"w-full max-w-3xl mt-4 flex flex-col gap-4",children:[f.jsx("button",{onClick:async()=>{try{const Ce=await Ze.getSessionsHistory();Ce.length>0&&i(`/project/${Ce[0].id}`)}catch{}},className:"w-full px-6 py-4 rounded-2xl text-base font-bold bg-accent-product text-white hover:bg-accent-product/90 transition-all shadow-lg shadow-accent-product/20",children:"View Project -- Browse Files and Preview"}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("button",{onClick:()=>M(!E),className:"px-4 py-2 rounded-xl text-sm font-semibold border border-accent-product/30 text-accent-product hover:bg-accent-product/5 transition-all",children:E?"Hide Report":"Report"}),f.jsx("button",{onClick:()=>Q(!Y),className:"px-4 py-2 rounded-xl text-sm font-semibold border border-white/30 text-slate hover:text-charcoal hover:bg-white/30 transition-all",children:Y?"Hide Metrics":"Metrics"})]}),f.jsx(M0,{visible:E}),f.jsx(Em,{visible:Y})]}),f.jsx("div",{className:"w-full max-w-3xl mt-4",children:f.jsx(w0,{onLoadSession:wl})}),f.jsxs("div",{className:"mt-6 text-xs text-slate flex items-center gap-2",children:[f.jsx("div",{className:`w-2 h-2 rounded-full ${we?"bg-success":"bg-danger"}`}),we?"Connected to Purple Lab backend":"Waiting for backend connection..."]})]})})]})}Tv.createRoot(document.getElementById("root")).render(f.jsx(g.StrictMode,{children:f.jsx(Vy,{children:f.jsx(B0,{})})}));export{Dl as E,r0 as H,Y0 as W,Ze as a,Um as b,f as j,g as r,G0 as u};
@@ -8,8 +8,8 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
10
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
11
- <script type="module" crossorigin src="/assets/index-Bp-tGwIG.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-CsDkyc_d.css">
11
+ <script type="module" crossorigin src="/assets/index-DpAb7DLD.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-0s7NNF9k.css">
13
13
  </head>
14
14
  <body class="bg-background text-charcoal font-sans antialiased">
15
15
  <div id="root"></div>
@@ -1,11 +0,0 @@
1
- var Ye=e=>{throw TypeError(e)};var _e=(e,t,n)=>t.has(e)||Ye("Cannot "+n);var ge=(e,t,n)=>(_e(e,t,"read from private field"),n?n.call(e):t.get(e)),Je=(e,t,n)=>t.has(e)?Ye("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ke=(e,t,n,r)=>(_e(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{r as f,W as de,j as m,a as K,u as Kt,b as Qt,H as Re,E as Zt}from"./index-Bp-tGwIG.js";function Qe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function en(e){if(Array.isArray(e))return e}function tn(e,t,n){return(t=cn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nn(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,a,l,i=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(s=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(u){c=!0,o=u}finally{try{if(!s&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return i}}function rn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ze(Object(n),!0).forEach(function(r){tn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function on(e,t){if(e==null)return{};var n,r,o=an(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function an(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function sn(e,t){return en(e)||nn(e,t)||un(e,t)||rn()}function ln(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cn(e){var t=ln(e,"string");return typeof t=="symbol"?t:t+""}function un(e,t){if(e){if(typeof e=="string")return Qe(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qe(e,t):void 0}}function dn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function nt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tt(Object(n),!0).forEach(function(r){dn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,a){return a(o)},r)}}function me(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var l=arguments.length,i=new Array(l),s=0;s<l;s++)i[s]=arguments[s];return t.apply(n,[].concat(o,i))}}}function Le(e){return{}.toString.call(e).includes("Object")}function pn(e){return!Object.keys(e).length}function ye(e){return typeof e=="function"}function hn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gn(e,t){return Le(t)||Z("changeType"),Object.keys(t).some(function(n){return!hn(e,n)})&&Z("changeField"),t}function mn(e){ye(e)||Z("selectorType")}function vn(e){ye(e)||Le(e)||Z("handlerType"),Le(e)&&Object.values(e).some(function(t){return!ye(t)})&&Z("handlersType")}function xn(e){e||Z("initialIsRequired"),Le(e)||Z("initialType"),pn(e)&&Z("initialContent")}function bn(e,t){throw new Error(e[t]||e.default)}var yn={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Z=me(bn)(yn),ze={changes:gn,selector:mn,handler:vn,initial:xn};function wn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ze.initial(e),ze.handler(t);var n={current:e},r=me(jn)(n,t),o=me(zn)(n),a=me(ze.changes)(e),l=me(Sn)(n);function i(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return ze.selector(c),c(n.current)}function s(c){fn(r,o,a,l)(c)}return[i,s]}function Sn(e,t){return ye(t)?t(e.current):t}function zn(e,t){return e.current=nt(nt({},e.current),t),t}function jn(e,t,n){return ye(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var Cn={create:wn},Pn={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function En(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var l=arguments.length,i=new Array(l),s=0;s<l;s++)i[s]=arguments[s];return t.apply(n,[].concat(o,i))}}}function Mn(e){return{}.toString.call(e).includes("Object")}function Ln(e){return e||rt("configIsRequired"),Mn(e)||rt("configType"),e.urls?(kn(),{paths:{vs:e.urls.monacoBase}}):e}function kn(){console.warn(yt.deprecation)}function On(e,t){throw new Error(e[t]||e.default)}var yt={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
- You are using deprecated way of configuration.
4
-
5
- Instead of using
6
- monaco.config({ urls: { monacoBase: '...' } })
7
- use
8
- monaco.config({ paths: { vs: '...' } })
9
-
10
- For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
- `},rt=En(On)(yt),Rn={config:Ln},Nn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(a,l){return l(a)},o)}};function wt(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],wt(e[n],t[n]))}),et(et({},e),t)}var Dn={type:"cancelation",msg:"operation is manually canceled"};function Ne(e){var t=!1,n=new Promise(function(r,o){e.then(function(a){return t?o(Dn):r(a)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var In=["monaco"],$n=Cn.create({config:Pn,isInitialized:!1,resolve:null,reject:null,monaco:null}),St=sn($n,2),Se=St[0],ke=St[1];function Tn(e){var t=Rn.config(e),n=t.monaco,r=on(t,In);ke(function(o){return{config:wt(o.config,r),monaco:n}})}function Fn(){var e=Se(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(ke({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ne(De);if(window.monaco&&window.monaco.editor)return zt(window.monaco),e.resolve(window.monaco),Ne(De);Nn(An,Wn)(Hn)}return Ne(De)}function An(e){return document.body.appendChild(e)}function Bn(e){var t=document.createElement("script");return e&&(t.src=e),t}function Wn(e){var t=Se(function(r){var o=r.config,a=r.reject;return{config:o,reject:a}}),n=Bn("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Hn(){var e=Se(function(n){var r=n.config,o=n.resolve,a=n.reject;return{config:r,resolve:o,reject:a}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;zt(r),e.resolve(r)},function(n){e.reject(n)})}function zt(e){Se().monaco||ke({monaco:e})}function Vn(){return Se(function(e){var t=e.monaco;return t})}var De=new Promise(function(e,t){return ke({resolve:e,reject:t})}),jt={config:Tn,init:Fn,__getMonacoInstance:Vn},Gn={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ie=Gn,Un={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},qn=Un;function Xn({children:e}){return de.createElement("div",{style:qn.container},e)}var Yn=Xn,_n=Yn;function Jn({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:a,wrapperProps:l}){return de.createElement("section",{style:{...Ie.wrapper,width:e,height:t},...l},!n&&de.createElement(_n,null,r),de.createElement("div",{ref:o,style:{...Ie.fullWidth,...!n&&Ie.hide},className:a}))}var Kn=Jn,Ct=f.memo(Kn);function Qn(e){f.useEffect(e,[])}var Pt=Qn;function Zn(e,t,n=!0){let r=f.useRef(!0);f.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var U=Zn;function xe(){}function ce(e,t,n,r){return er(e,r)||tr(e,t,n,r)}function er(e,t){return e.editor.getModel(Et(e,t))}function tr(e,t,n,r){return e.editor.createModel(t,n,r?Et(e,r):void 0)}function Et(e,t){return e.Uri.parse(t)}function nr({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:a,modifiedModelPath:l,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:s=!1,theme:c="light",loading:u="Loading...",options:v={},height:p="100%",width:L="100%",className:y,wrapperProps:h={},beforeMount:b=xe,onMount:x=xe}){let[d,S]=f.useState(!1),[w,g]=f.useState(!0),C=f.useRef(null),j=f.useRef(null),N=f.useRef(null),F=f.useRef(x),k=f.useRef(b),P=f.useRef(!1);Pt(()=>{let z=jt.init();return z.then(R=>(j.current=R)&&g(!1)).catch(R=>(R==null?void 0:R.type)!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>C.current?A():z.cancel()}),U(()=>{if(C.current&&j.current){let z=C.current.getOriginalEditor(),R=ce(j.current,e||"",r||n||"text",a||"");R!==z.getModel()&&z.setModel(R)}},[a],d),U(()=>{if(C.current&&j.current){let z=C.current.getModifiedEditor(),R=ce(j.current,t||"",o||n||"text",l||"");R!==z.getModel()&&z.setModel(R)}},[l],d),U(()=>{let z=C.current.getModifiedEditor();z.getOption(j.current.editor.EditorOption.readOnly)?z.setValue(t||""):t!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[t],d),U(()=>{var z,R;(R=(z=C.current)==null?void 0:z.getModel())==null||R.original.setValue(e||"")},[e],d),U(()=>{let{original:z,modified:R}=C.current.getModel();j.current.editor.setModelLanguage(z,r||n||"text"),j.current.editor.setModelLanguage(R,o||n||"text")},[n,r,o],d),U(()=>{var z;(z=j.current)==null||z.editor.setTheme(c)},[c],d),U(()=>{var z;(z=C.current)==null||z.updateOptions(v)},[v],d);let M=f.useCallback(()=>{var W;if(!j.current)return;k.current(j.current);let z=ce(j.current,e||"",r||n||"text",a||""),R=ce(j.current,t||"",o||n||"text",l||"");(W=C.current)==null||W.setModel({original:z,modified:R})},[n,t,o,e,r,a,l]),D=f.useCallback(()=>{var z;!P.current&&N.current&&(C.current=j.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...v}),M(),(z=j.current)==null||z.editor.setTheme(c),S(!0),P.current=!0)},[v,c,M]);f.useEffect(()=>{d&&F.current(C.current,j.current)},[d]),f.useEffect(()=>{!w&&!d&&D()},[w,d,D]);function A(){var R,W,E,T;let z=(R=C.current)==null?void 0:R.getModel();i||((W=z==null?void 0:z.original)==null||W.dispose()),s||((E=z==null?void 0:z.modified)==null||E.dispose()),(T=C.current)==null||T.dispose()}return de.createElement(Ct,{width:L,height:p,isEditorReady:d,loading:u,_ref:N,className:y,wrapperProps:h})}var rr=nr;f.memo(rr);function or(e){let t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}var ir=or,je=new Map;function ar({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:a,theme:l="light",line:i,loading:s="Loading...",options:c={},overrideServices:u={},saveViewState:v=!0,keepCurrentModel:p=!1,width:L="100%",height:y="100%",className:h,wrapperProps:b={},beforeMount:x=xe,onMount:d=xe,onChange:S,onValidate:w=xe}){let[g,C]=f.useState(!1),[j,N]=f.useState(!0),F=f.useRef(null),k=f.useRef(null),P=f.useRef(null),M=f.useRef(d),D=f.useRef(x),A=f.useRef(),z=f.useRef(r),R=ir(a),W=f.useRef(!1),E=f.useRef(!1);Pt(()=>{let O=jt.init();return O.then(I=>(F.current=I)&&N(!1)).catch(I=>(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>k.current?H():O.cancel()}),U(()=>{var I,B,te,J;let O=ce(F.current,e||r||"",t||o||"",a||n||"");O!==((I=k.current)==null?void 0:I.getModel())&&(v&&je.set(R,(B=k.current)==null?void 0:B.saveViewState()),(te=k.current)==null||te.setModel(O),v&&((J=k.current)==null||J.restoreViewState(je.get(a))))},[a],g),U(()=>{var O;(O=k.current)==null||O.updateOptions(c)},[c],g),U(()=>{!k.current||r===void 0||(k.current.getOption(F.current.editor.EditorOption.readOnly)?k.current.setValue(r):r!==k.current.getValue()&&(E.current=!0,k.current.executeEdits("",[{range:k.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),k.current.pushUndoStop(),E.current=!1))},[r],g),U(()=>{var I,B;let O=(I=k.current)==null?void 0:I.getModel();O&&o&&((B=F.current)==null||B.editor.setModelLanguage(O,o))},[o],g),U(()=>{var O;i!==void 0&&((O=k.current)==null||O.revealLine(i))},[i],g),U(()=>{var O;(O=F.current)==null||O.editor.setTheme(l)},[l],g);let T=f.useCallback(()=>{var O;if(!(!P.current||!F.current)&&!W.current){D.current(F.current);let I=a||n,B=ce(F.current,r||e||"",t||o||"",I||"");k.current=(O=F.current)==null?void 0:O.editor.create(P.current,{model:B,automaticLayout:!0,...c},u),v&&k.current.restoreViewState(je.get(I)),F.current.editor.setTheme(l),i!==void 0&&k.current.revealLine(i),C(!0),W.current=!0}},[e,t,n,r,o,a,c,u,v,l,i]);f.useEffect(()=>{g&&M.current(k.current,F.current)},[g]),f.useEffect(()=>{!j&&!g&&T()},[j,g,T]),z.current=r,f.useEffect(()=>{var O,I;g&&S&&((O=A.current)==null||O.dispose(),A.current=(I=k.current)==null?void 0:I.onDidChangeModelContent(B=>{E.current||S(k.current.getValue(),B)}))},[g,S]),f.useEffect(()=>{if(g){let O=F.current.editor.onDidChangeMarkers(I=>{var te;let B=(te=k.current.getModel())==null?void 0:te.uri;if(B&&I.find(J=>J.path===B.path)){let J=F.current.editor.getModelMarkers({resource:B});w==null||w(J)}});return()=>{O==null||O.dispose()}}return()=>{}},[g,w]);function H(){var O,I;(O=A.current)==null||O.dispose(),p?v&&je.set(a,k.current.saveViewState()):(I=k.current.getModel())==null||I.dispose(),k.current.dispose()}return de.createElement(Ct,{width:L,height:y,isEditorReady:g,loading:s,_ref:P,className:h,wrapperProps:b})}var sr=ar,lr=f.memo(sr),cr=lr;function ur(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function dr(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function fr(e){return e/100*window.innerHeight}function pr(e){return e/100*window.innerWidth}function hr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function ve({groupSize:e,panelElement:t,styleProp:n}){let r;const[o,a]=hr(n);switch(a){case"%":{r=o/100*e;break}case"px":{r=o;break}case"rem":{r=dr(t,o);break}case"em":{r=ur(t,o);break}case"vh":{r=fr(o);break}case"vw":{r=pr(o);break}}return r}function G(e){return parseFloat(e.toFixed(3))}function he({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,o)=>(r+=t==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,r),0)}function Te(e){const{panels:t}=e,n=he({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:o,panelConstraints:a}=r;let l=0;if(a.collapsedSize!==void 0){const u=ve({groupSize:n,panelElement:o,styleProp:a.collapsedSize});l=G(u/n*100)}let i;if(a.defaultSize!==void 0){const u=ve({groupSize:n,panelElement:o,styleProp:a.defaultSize});i=G(u/n*100)}let s=0;if(a.minSize!==void 0){const u=ve({groupSize:n,panelElement:o,styleProp:a.minSize});s=G(u/n*100)}let c=100;if(a.maxSize!==void 0){const u=ve({groupSize:n,panelElement:o,styleProp:a.maxSize});c=G(u/n*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:l,collapsible:a.collapsible===!0,defaultSize:i,disabled:a.disabled,minSize:s,maxSize:c,panelId:r.id}})}function $(e,t="Assertion error"){if(!e)throw Error(t)}function Fe(e,t){return Array.from(t).sort(e==="horizontal"?gr:mr)}function gr(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function mr(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Mt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Lt(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vr({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let o,a=Number.MAX_VALUE;for(const l of t){const{x:i,y:s}=Lt(r,l),c=e==="horizontal"?i:s;c<a&&(a=c,o=l)}return $(o,"No rect found"),o}let Ce;function xr(){return Ce===void 0&&(typeof matchMedia=="function"?Ce=!!matchMedia("(pointer:coarse)").matches:Ce=!1),Ce}function kt(e){const{element:t,orientation:n,panels:r,separators:o}=e,a=Fe(n,Array.from(t.children).filter(Mt).map(y=>({element:y}))).map(({element:y})=>y),l=[];let i=!1,s=!1,c=-1,u=-1,v=0,p,L=[];{let y=-1;for(const h of a)h.hasAttribute("data-panel")&&(y++,h.ariaDisabled===null&&(v++,c===-1&&(c=y),u=y))}if(v>1){let y=-1;for(const h of a)if(h.hasAttribute("data-panel")){y++;const b=r.find(x=>x.element===h);if(b){if(p){const x=p.element.getBoundingClientRect(),d=h.getBoundingClientRect();let S;if(s){const w=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),g=n==="horizontal"?new DOMRect(d.left,d.top,0,d.height):new DOMRect(d.left,d.top,d.width,0);switch(L.length){case 0:{S=[w,g];break}case 1:{const C=L[0],j=vr({orientation:n,rects:[x,d],targetRect:C.element.getBoundingClientRect()});S=[C,j===x?g:w];break}default:{S=L;break}}}else L.length?S=L:S=[n==="horizontal"?new DOMRect(x.right,d.top,d.left-x.right,d.height):new DOMRect(d.left,x.bottom,d.width,d.top-x.bottom)];for(const w of S){let g="width"in w?w:w.element.getBoundingClientRect();const C=xr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(g.width<C){const N=C-g.width;g=new DOMRect(g.x-N/2,g.y,g.width+N,g.height)}if(g.height<C){const N=C-g.height;g=new DOMRect(g.x,g.y-N/2,g.width,g.height+N)}const j=y<=c||y>u;!i&&!j&&l.push({group:e,groupSize:he({group:e}),panels:[p,b],separator:"width"in w?void 0:w,rect:g}),i=!1}}s=!1,p=b,L=[]}}else if(h.hasAttribute("data-separator")){h.ariaDisabled!==null&&(i=!0);const b=o.find(x=>x.element===h);b?L.push(b):(p=void 0,L=[])}else s=!0}return l}var Q;class Ot{constructor(){Je(this,Q,{})}addListener(t,n){const r=ge(this,Q)[t];return r===void 0?ge(this,Q)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=ge(this,Q)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let o=!1,a=null;const l=Array.from(r);for(let i=0;i<l.length;i++){const s=l[i];try{s.call(null,n)}catch(c){a===null&&(o=!0,a=c)}}if(o)throw a}}removeAllListeners(){Ke(this,Q,{})}removeListener(t,n){const r=ge(this,Q)[t];if(r!==void 0){const o=r.indexOf(n);o>=0&&r.splice(o,1)}}}Q=new WeakMap;let X=new Map;const Rt=new Ot;function br(e){X=new Map(X),X.delete(e)}function ot(e,t){for(const[n]of X)if(n.id===e)return n}function ee(e,t){for(const[n,r]of X)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ae(){return X}function Be(e,t){return Rt.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function _(e,t){const n=X.get(e);X=new Map(X),X.set(e,t),Rt.emit("groupChange",{group:e,prev:n,next:t})}function yr(e,t,n){let r,o={x:1/0,y:1/0};for(const a of t){const l=Lt(n,a.rect);switch(e){case"horizontal":{l.x<=o.x&&(r=a,o=l);break}case"vertical":{l.y<=o.y&&(r=a,o=l);break}}}return r?{distance:o,hitRegion:r}:void 0}function wr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Sr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:st(e),b:st(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();$(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:at(it(n.a)),b:at(it(n.b))};if(o.a===o.b){const a=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let i=a.length;for(;i--;){const s=a[i];if(s===l.a)return 1;if(s===l.b)return-1}}return Math.sign(o.a-o.b)}const zr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function jr(e){const t=getComputedStyle(Nt(e)??e).display;return t==="flex"||t==="inline-flex"}function Cr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||jr(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||zr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function it(e){let t=e.length;for(;t--;){const n=e[t];if($(n,"Missing node"),Cr(n))return n}return null}function at(e){return e&&Number(getComputedStyle(e).zIndex)||0}function st(e){const t=[];for(;e;)t.push(e),e=Nt(e);return t}function Nt(e){const{parentNode:t}=e;return wr(t)?t.host:t}function Pr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Er({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Mt(n)||n.contains(e)||e.contains(n))return!0;if(Sr(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Pr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function We(e,t){const n=[];return t.forEach((r,o)=>{if(o.disabled)return;const a=kt(o),l=yr(o.orientation,a,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&Er({groupElement:o.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function Mr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function V(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function q(e,t){return V(e,t)?0:e>t?1:-1}function ue({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:o=0,collapsible:a,disabled:l,maxSize:i=100,minSize:s=0}=t;if(l&&!e)return n;if(q(r,s)<0)if(a){const c=(o+s)/2;q(r,c)<0?r=o:r=s}else r=s;return r=Math.min(i,r),r=G(r),r}function we({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:a}){if(V(e,0))return t;const l=a==="imperative-api",i=Object.values(t),s=Object.values(o),c=[...i],[u,v]=r;$(u!=null,"Invalid first pivot index"),$(v!=null,"Invalid second pivot index");let p=0;switch(a){case"keyboard":{{const h=e<0?v:u,b=n[h];$(b,`Panel constraints not found for index ${h}`);const{collapsedSize:x=0,collapsible:d,minSize:S=0}=b;if(d){const w=i[h];if($(w!=null,`Previous layout not found for panel index ${h}`),V(w,x)){const g=S-w;q(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}{const h=e<0?u:v,b=n[h];$(b,`No panel constraints found for index ${h}`);const{collapsedSize:x=0,collapsible:d,minSize:S=0}=b;if(d){const w=i[h];if($(w!=null,`Previous layout not found for panel index ${h}`),V(w,S)){const g=w-x;q(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}break}default:{const h=e<0?v:u,b=n[h];$(b,`Panel constraints not found for index ${h}`);const x=i[h],{collapsible:d,collapsedSize:S,minSize:w}=b;if(d&&q(x,w)<0)if(e>0){const g=w-S,C=g/2,j=x+e;q(j,w)<0&&(e=q(e,C)<=0?0:g)}else{const g=w-S,C=100-g/2,j=x-e;q(j,w)<0&&(e=q(100+e,C)>0?0:-g)}break}}{const h=e<0?1:-1;let b=e<0?v:u,x=0;for(;;){const S=i[b];$(S!=null,`Previous layout not found for panel index ${b}`);const w=ue({overrideDisabledPanels:l,panelConstraints:n[b],prevSize:S,size:100})-S;if(x+=w,b+=h,b<0||b>=n.length)break}const d=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-d:d}{let h=e<0?u:v;for(;h>=0&&h<n.length;){const b=Math.abs(e)-Math.abs(p),x=i[h];$(x!=null,`Previous layout not found for panel index ${h}`);const d=x-b,S=ue({overrideDisabledPanels:l,panelConstraints:n[h],prevSize:x,size:d});if(!V(x,S)&&(p+=x-S,c[h]=S,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(Mr(s,c))return o;{const h=e<0?v:u,b=i[h];$(b!=null,`Previous layout not found for panel index ${h}`);const x=b+p,d=ue({overrideDisabledPanels:l,panelConstraints:n[h],prevSize:b,size:x});if(c[h]=d,!V(d,x)){let S=x-d,w=e<0?v:u;for(;w>=0&&w<n.length;){const g=c[w];$(g!=null,`Previous layout not found for panel index ${w}`);const C=g+S,j=ue({overrideDisabledPanels:l,panelConstraints:n[w],prevSize:g,size:C});if(V(g,j)||(S-=j-g,c[w]=j),V(S,0))break;e>0?w--:w++}}}const L=Object.values(c).reduce((h,b)=>b+h,0);if(!V(L,100,.1))return o;const y=Object.keys(o);return c.reduce((h,b,x)=>(h[y[x]]=b,h),{})}function re(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||q(e[n],t[n])!==0)return!1;return!0}function oe({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],o=r.reduce((i,s)=>i+s,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!V(o,100)&&r.length>0)for(let i=0;i<t.length;i++){const s=r[i];$(s!=null,`No layout data found for index ${i}`);const c=100/o*s;r[i]=c}let a=0;for(let i=0;i<t.length;i++){const s=n[i];$(s!=null,`No layout data found for index ${i}`);const c=r[i];$(c!=null,`No layout data found for index ${i}`);const u=ue({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:s,size:c});c!=u&&(a+=c-u,r[i]=u)}if(!V(a,0))for(let i=0;i<t.length;i++){const s=r[i];$(s!=null,`No layout data found for index ${i}`);const c=s+a,u=ue({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:s,size:c});if(s!==u&&(a-=u-s,r[i]=u,V(a,0)))break}const l=Object.keys(e);return r.reduce((i,s,c)=>(i[l[c]]=s,i),{})}function Dt({groupId:e,panelId:t}){const n=()=>{const i=ae();for(const[s,{defaultLayoutDeferred:c,derivedPanelConstraints:u,layout:v,groupSize:p,separatorToPanels:L}]of i)if(s.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:u,group:s,groupSize:p,layout:v,separatorToPanels:L};throw Error(`Group ${e} not found`)},r=()=>{const i=n().derivedPanelConstraints.find(s=>s.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},o=()=>{const i=n().group.panels.find(s=>s.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},l=i=>{const s=a();if(i===s)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:u,group:v,groupSize:p,layout:L,separatorToPanels:y}=n(),h=v.panels.findIndex(S=>S.id===t),b=h===v.panels.length-1,x=we({delta:b?s-i:i-s,initialLayout:L,panelConstraints:u,pivotIndices:b?[h-1,h]:[h,h+1],prevLayout:L,trigger:"imperative-api"}),d=oe({layout:x,panelConstraints:u});re(L,d)||_(v,{defaultLayoutDeferred:c,derivedPanelConstraints:u,groupSize:p,layout:d,separatorToPanels:y})};return{collapse:()=>{const{collapsible:i,collapsedSize:s}=r(),{mutableValues:c}=o(),u=a();i&&u!==s&&(c.expandToSize=u,l(s))},expand:()=>{const{collapsible:i,collapsedSize:s,minSize:c}=r(),{mutableValues:u}=o(),v=a();if(i&&v===s){let p=u.expandToSize??c;p===0&&(p=1),l(p)}},getSize:()=>{const{group:i}=n(),s=a(),{element:c}=o(),u=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:s,inPixels:u}},isCollapsed:()=>{const{collapsible:i,collapsedSize:s}=r(),c=a();return i&&V(s,c)},resize:i=>{const{group:s}=n(),{element:c}=o(),u=he({group:s}),v=ve({groupSize:u,panelElement:c,styleProp:i}),p=G(v/u*100);l(p)}}}function lt(e){if(e.defaultPrevented)return;const t=ae();We(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(r){const o=r.panelConstraints.defaultSize,a=Dt({groupId:n.group.id,panelId:r.id});a&&o!==void 0&&(a.resize(o),e.preventDefault())}}})}function Ee(e){const t=ae();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function It({groupId:e}){const t=()=>{const n=ae();for(const[r,o]of n)if(r.id===e)return{group:r,...o};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:a,groupSize:l,layout:i,separatorToPanels:s}=t(),c=oe({layout:n,panelConstraints:o});return r?i:(re(i,c)||_(a,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:l,layout:c,separatorToPanels:s}),c)}}}function ne(e,t){const n=Ee(e),r=ee(n.id,!0),o=n.separators.find(u=>u.element===e);$(o,"Matching separator not found");const a=r.separatorToPanels.get(o);$(a,"Matching panels not found");const l=a.map(u=>n.panels.indexOf(u)),i=It({groupId:n.id}).getLayout(),s=we({delta:t,initialLayout:i,panelConstraints:r.derivedPanelConstraints,pivotIndices:l,prevLayout:i,trigger:"keyboard"}),c=oe({layout:s,panelConstraints:r.derivedPanelConstraints});re(i,c)||_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ct(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ee(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&ne(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&ne(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&ne(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&ne(t,-5);break}case"End":{e.preventDefault(),ne(t,100);break}case"Enter":{e.preventDefault();const r=Ee(t),o=ee(r.id,!0),{derivedPanelConstraints:a,layout:l,separatorToPanels:i}=o,s=r.separators.find(p=>p.element===t);$(s,"Matching separator not found");const c=i.get(s);$(c,"Matching panels not found");const u=c[0],v=a.find(p=>p.panelId===u.id);if($(v,"Panel metadata not found"),v.collapsible){const p=l[u.id],L=v.collapsedSize===p?r.mutableState.expandedPanelSizes[u.id]??v.minSize:v.collapsedSize;ne(t,L-p)}break}case"F6":{e.preventDefault();const r=Ee(t).separators.map(l=>l.element),o=Array.from(r).findIndex(l=>l===e.currentTarget);$(o!==null,"Index not found");const a=e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0;r[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),ne(t,-100);break}}}let fe={cursorFlags:0,state:"inactive"};const He=new Ot;function ie(){return fe}function Lr(e){return He.addListener("change",e)}function kr(e){const t=fe,n={...fe};n.cursorFlags=e,fe=n,He.emit("change",{prev:t,next:n})}function pe(e){const t=fe;fe=e,He.emit("change",{prev:t,next:e})}function ut(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ae(),n=We(e,t),r=new Map;let o=!1;n.forEach(a=>{a.separator&&(o||(o=!0,a.separator.element.focus({preventScroll:!0})));const l=t.get(a.group);l&&r.set(a.group,l.layout)}),pe({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const Or=e=>e,$e=()=>{},$t=1,Tt=2,Ft=4,At=8,dt=3,ft=12;let Pe;function pt(){return Pe===void 0&&(Pe=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Pe=!0)),Pe}function Rr({cursorFlags:e,groups:t,state:n}){let r=0,o=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{o++;break}}})}if(!(r===0&&o===0)){switch(n){case"active":{if(e&&pt()){const a=(e&$t)!==0,l=(e&Tt)!==0,i=(e&Ft)!==0,s=(e&At)!==0;if(a)return i?"se-resize":s?"ne-resize":"e-resize";if(l)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}break}}return pt()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const ht=new WeakMap;function Ve(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ht.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=ie();switch(r.state){case"active":case"hover":{const o=Rr({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(l=>l.group),state:r.state}),a=`*, *:hover {cursor: ${o} !important; }`;if(t===a)return;t=a,o?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}ht.set(e,{prevStyle:t,styleSheet:n})}function Bt({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:a,prevCursorFlags:l}){let i=0;n.forEach(c=>{const{group:u,groupSize:v}=c,{orientation:p,panels:L}=u,{disableCursor:y}=u.mutableState;let h=0;a?p==="horizontal"?h=(t.clientX-a.x)/v*100:h=(t.clientY-a.y)/v*100:p==="horizontal"?h=t.clientX<0?-100:100:h=t.clientY<0?-100:100;const b=r.get(u),x=o.get(u);if(!b||!x)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:S,groupSize:w,layout:g,separatorToPanels:C}=x;if(S&&g&&C){const j=we({delta:h,initialLayout:b,panelConstraints:S,pivotIndices:c.panels.map(N=>L.indexOf(N)),prevLayout:g,trigger:"mouse-or-touch"});if(re(j,g)){if(h!==0&&!y)switch(p){case"horizontal":{i|=h<0?$t:Tt;break}case"vertical":{i|=h<0?Ft:At;break}}}else _(c.group,{defaultLayoutDeferred:d,derivedPanelConstraints:S,groupSize:w,layout:j,separatorToPanels:C})}});let s=0;t.movementX===0?s|=l&dt:s|=i&dt,t.movementY===0?s|=l&ft:s|=i&ft,kr(s),Ve(e)}function gt(e){const t=ae(),n=ie();switch(n.state){case"active":Bt({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function mt(e){if(e.defaultPrevented)return;const t=ie(),n=ae();switch(t.state){case"active":{if(e.buttons===0){pe({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const o=ee(r.group.id,!0);_(r.group,o)});return}Bt({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=We(e,n);r.length===0?t.state!=="inactive"&&pe({cursorFlags:0,state:"inactive"}):pe({cursorFlags:0,hitRegions:r,state:"hover"}),Ve(e.currentTarget);break}}}function vt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ie().state){case"hover":pe({cursorFlags:0,state:"inactive"})}}function xt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ie();switch(t.state){case"active":pe({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Ve(e.currentTarget),t.hitRegions.forEach(n=>{const r=ee(n.group.id,!0);_(n.group,r)}),e.preventDefault())}}function bt(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const l=G(a.defaultSize);n+=l,r[a.panelId]=l}else r[a.panelId]=void 0;const o=e.length-t;if(o!==0){const a=G((100-n)/o);for(const l of e)l.defaultSize===void 0&&(r[l.panelId]=a)}return r}function Nr(e,t,n){if(!n[0])return;const r=e.panels.find(s=>s.element===t);if(!r||!r.onResize)return;const o=he({group:e}),a=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,i={asPercentage:G(a/o*100),inPixels:a};r.mutableValues.prevSize=i,r.onResize(i,r.id,l)}function Dr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ir({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let o=0,a=0,l=!1;const i=new Map,s=[];for(const v of e.panels){const p=r[v.id]??0;switch(v.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const L=p/100*n,y=G(L/t*100);i.set(v.id,y),o+=y;break}case"preserve-relative-size":default:{s.push(v.id),a+=p;break}}}if(!l||s.length===0)return r;const c=100-o,u={...r};if(i.forEach((v,p)=>{u[p]=v}),a>0)for(const v of s){const p=r[v]??0;u[v]=G(p/a*c)}else{const v=G(c/s.length);for(const p of s)u[p]=v}return u}function $r(e,t){const n=e.map(o=>o.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o))return!1;return!0}const le=new Map;function Tr(e){let t=!0;$(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,o=new Set,a=new n(y=>{for(const h of y){const{borderBoxSize:b,target:x}=h;if(x===e.element){if(t){const d=he({group:e});if(d===0)return;const S=ee(e.id);if(!S)return;const w=Te(e),g=S.defaultLayoutDeferred?bt(w):S.layout,C=Ir({group:e,nextGroupSize:d,prevGroupSize:S.groupSize,prevLayout:g}),j=oe({layout:C,panelConstraints:w});if(!S.defaultLayoutDeferred&&re(S.layout,j)&&Dr(S.derivedPanelConstraints,w)&&S.groupSize===d)return;_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:w,groupSize:d,layout:j,separatorToPanels:S.separatorToPanels})}}else Nr(e,x,b)}});a.observe(e.element),e.panels.forEach(y=>{$(!r.has(y.id),`Panel ids must be unique; id "${y.id}" was used more than once`),r.add(y.id),y.onResize&&a.observe(y.element)});const l=he({group:e}),i=Te(e),s=e.panels.map(({id:y})=>y).join(",");let c=e.mutableState.defaultLayout;c&&($r(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[s]??c??bt(i),v=oe({layout:u,panelConstraints:i}),p=e.element.ownerDocument;le.set(p,(le.get(p)??0)+1);const L=new Map;return kt(e).forEach(y=>{y.separator&&L.set(y.separator,y.panels)}),_(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:i,groupSize:l,layout:v,separatorToPanels:L}),e.separators.forEach(y=>{$(!o.has(y.id),`Separator ids must be unique; id "${y.id}" was used more than once`),o.add(y.id),y.element.addEventListener("keydown",ct)}),le.get(p)===1&&(p.addEventListener("dblclick",lt,!0),p.addEventListener("pointerdown",ut,!0),p.addEventListener("pointerleave",gt),p.addEventListener("pointermove",mt),p.addEventListener("pointerout",vt),p.addEventListener("pointerup",xt,!0)),function(){t=!1,le.set(p,Math.max(0,(le.get(p)??0)-1)),br(e),e.separators.forEach(y=>{y.element.removeEventListener("keydown",ct)}),le.get(p)||(p.removeEventListener("dblclick",lt,!0),p.removeEventListener("pointerdown",ut,!0),p.removeEventListener("pointerleave",gt),p.removeEventListener("pointermove",mt),p.removeEventListener("pointerout",vt),p.removeEventListener("pointerup",xt,!0)),a.disconnect()}}function Fr(){const[e,t]=f.useState({}),n=f.useCallback(()=>t({}),[]);return[e,n]}function Ge(e){const t=f.useId();return`${e??t}`}const se=typeof window<"u"?f.useLayoutEffect:f.useEffect;function be(e){const t=f.useRef(e);return se(()=>{t.current=e},[e]),f.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function Ue(...e){return be(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function qe(e){const t=f.useRef({...e});return se(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Wt=f.createContext(null);function Ar(e,t){const n=f.useRef({getLayout:()=>({}),setLayout:Or});f.useImperativeHandle(t,()=>n.current,[]),se(()=>{Object.assign(n.current,It({groupId:e}))})}function Ht({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:o,elementRef:a,groupRef:l,id:i,onLayoutChange:s,onLayoutChanged:c,orientation:u="horizontal",resizeTargetMinimumSize:v={coarse:20,fine:10},style:p,...L}){const y=f.useRef({onLayoutChange:{},onLayoutChanged:{}}),h=be(P=>{re(y.current.onLayoutChange,P)||(y.current.onLayoutChange=P,s==null||s(P))}),b=be(P=>{re(y.current.onLayoutChanged,P)||(y.current.onLayoutChanged=P,c==null||c(P))}),x=Ge(i),d=f.useRef(null),[S,w]=Fr(),g=f.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:v,separators:[]}),C=Ue(d,a);Ar(x,l);const j=be((P,M)=>{const D=ie(),A=ot(P),z=ee(P);if(z){let R=!1;switch(D.state){case"active":{R=D.hitRegions.some(W=>W.group===A);break}}return{flexGrow:z.layout[M]??1,pointerEvents:R?"none":void 0}}return{flexGrow:(n==null?void 0:n[M])??1}}),N=qe({defaultLayout:n,disableCursor:r}),F=f.useMemo(()=>({get disableCursor(){return!!N.disableCursor},getPanelStyles:j,id:x,orientation:u,registerPanel:P=>{const M=g.current;return M.panels=Fe(u,[...M.panels,P]),w(),()=>{M.panels=M.panels.filter(D=>D!==P),w()}},registerSeparator:P=>{const M=g.current;return M.separators=Fe(u,[...M.separators,P]),w(),()=>{M.separators=M.separators.filter(D=>D!==P),w()}},togglePanelDisabled:(P,M)=>{const D=g.current.panels.find(R=>R.id===P);D&&(D.panelConstraints.disabled=M);const A=ot(x),z=ee(x);A&&z&&_(A,{...z,derivedPanelConstraints:Te(A)})},toggleSeparatorDisabled:(P,M)=>{const D=g.current.separators.find(A=>A.id===P);D&&(D.disabled=M)}}),[j,x,w,u,N]),k=f.useRef(null);return se(()=>{const P=d.current;if(P===null)return;const M=g.current;let D;if(N.defaultLayout!==void 0&&Object.keys(N.defaultLayout).length===M.panels.length){D={};for(const H of M.panels){const O=N.defaultLayout[H.id];O!==void 0&&(D[H.id]=O)}}const A={disabled:!!o,element:P,id:x,mutableState:{defaultLayout:D,disableCursor:!!N.disableCursor,expandedPanelSizes:g.current.lastExpandedPanelSizes,layouts:g.current.layouts},orientation:u,panels:M.panels,resizeTargetMinimumSize:M.resizeTargetMinimumSize,separators:M.separators};k.current=A;const z=Tr(A),{defaultLayoutDeferred:R,derivedPanelConstraints:W,layout:E}=ee(A.id,!0);!R&&W.length>0&&(h(E),b(E));const T=Be(x,H=>{const{defaultLayoutDeferred:O,derivedPanelConstraints:I,layout:B}=H.next;if(O||I.length===0)return;const te=A.panels.map(({id:Y})=>Y).join(",");A.mutableState.layouts[te]=B,I.forEach(Y=>{if(Y.collapsible){const{layout:Oe}=H.prev??{};if(Oe){const _t=V(Y.collapsedSize,B[Y.panelId]),Jt=V(Y.collapsedSize,Oe[Y.panelId]);_t&&!Jt&&(A.mutableState.expandedPanelSizes[Y.panelId]=Oe[Y.panelId])}}});const J=ie().state!=="active";h(B),J&&b(B)});return()=>{k.current=null,z(),T()}},[o,x,b,h,u,S,N]),f.useEffect(()=>{const P=k.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!r)}),m.jsx(Wt.Provider,{value:F,children:m.jsx("div",{...L,className:t,"data-group":!0,"data-testid":x,id:x,ref:C,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:e})})}Ht.displayName="Group";function Xe(){const e=f.useContext(Wt);return $(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Br(e,t){const{id:n}=Xe(),r=f.useRef({collapse:$e,expand:$e,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:$e});f.useImperativeHandle(t,()=>r.current,[]),se(()=>{Object.assign(r.current,Dt({groupId:n,panelId:e}))})}function Me({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:o,disabled:a,elementRef:l,groupResizeBehavior:i="preserve-relative-size",id:s,maxSize:c="100%",minSize:u="0%",onResize:v,panelRef:p,style:L,...y}){const h=!!s,b=Ge(s),x=qe({disabled:a}),d=f.useRef(null),S=Ue(d,l),{getPanelStyles:w,id:g,orientation:C,registerPanel:j,togglePanelDisabled:N}=Xe(),F=v!==null,k=be((M,D,A)=>{v==null||v(M,s,A)});se(()=>{const M=d.current;if(M!==null){const D={element:M,id:b,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:F?k:void 0,panelConstraints:{groupResizeBehavior:i,collapsedSize:n,collapsible:r,defaultSize:o,disabled:x.disabled,maxSize:c,minSize:u}};return j(D)}},[i,n,r,o,F,b,h,c,u,k,j,x]),f.useEffect(()=>{N(b,!!a)},[a,b,N]),Br(b,p);const P=f.useSyncExternalStore(M=>Be(g,M),()=>JSON.stringify(w(g,b)),()=>JSON.stringify(w(g,b)));return m.jsx("div",{...y,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":b,id:b,ref:S,style:{...Wr,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:m.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...L,touchAction:C==="horizontal"?"pan-y":"pan-x"},children:e})})}Me.displayName="Panel";const Wr={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Hr({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let o,a;const l=e[n],i=t.find(s=>s.panelId===n);if(i){const s=i.maxSize,c=i.collapsible?i.collapsedSize:i.minSize,u=[r,r+1];a=oe({layout:we({delta:c-l,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],o=oe({layout:we({delta:s-l,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:o,valueMin:a,valueNow:l}}function Ae({children:e,className:t,disabled:n,elementRef:r,id:o,style:a,...l}){const i=Ge(o),s=qe({disabled:n}),[c,u]=f.useState({}),[v,p]=f.useState("inactive"),L=f.useRef(null),y=Ue(L,r),{disableCursor:h,id:b,orientation:x,registerSeparator:d,toggleSeparatorDisabled:S}=Xe(),w=x==="horizontal"?"vertical":"horizontal";se(()=>{const C=L.current;if(C!==null){const j={disabled:s.disabled,element:C,id:i},N=d(j),F=Lr(P=>{p(P.next.state!=="inactive"&&P.next.hitRegions.some(M=>M.separator===j)?P.next.state:"inactive")}),k=Be(b,P=>{const{derivedPanelConstraints:M,layout:D,separatorToPanels:A}=P.next,z=A.get(j);if(z){const R=z[0],W=z.indexOf(R);u(Hr({layout:D,panelConstraints:M,panelId:R.id,panelIndex:W}))}});return()=>{F(),k(),N()}}},[b,i,d,s]),f.useEffect(()=>{S(i,!!n)},[n,i,S]);let g;return n&&!h&&(g="not-allowed"),m.jsx("div",{...l,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":w,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":n?"disabled":v,"data-testid":i,id:i,ref:y,role:"separator",style:{flexBasis:"auto",cursor:g,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Ae.displayName="Separator";function Vt(e){var r;const t=((r=e.split(".").pop())==null?void 0:r.toLowerCase())||"";return{js:"text-yellow-600",ts:"text-blue-500",tsx:"text-blue-400",jsx:"text-yellow-500",py:"text-green-600",rb:"text-red-500",go:"text-cyan-600",html:"text-orange-500",css:"text-purple-500",json:"text-green-500",md:"text-slate",yaml:"text-green-400",yml:"text-green-400",sh:"text-green-600",bash:"text-green-600",rs:"text-orange-600",java:"text-red-600",kt:"text-purple-600",sql:"text-blue-600",svg:"text-orange-400"}[t]||"text-charcoal/80"}function Gt(e,t){var o;if(t==="directory")return"[ ]";const n=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"";return{js:"JS",ts:"TS",tsx:"TX",jsx:"JX",py:"PY",html:"<>",css:"##",json:"{}",md:"MD",yml:"YL",yaml:"YL",sh:"SH",go:"GO",rs:"RS",rb:"RB",java:"JV",kt:"KT",sql:"SQ",svg:"SV",png:"IM",jpg:"IM",gif:"IM",ico:"IC"}[n]||".."}function Vr(e){var o;const t=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"",n={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",md:"markdown",go:"go",rs:"rust",sh:"shell",bash:"shell",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",sql:"sql",java:"java",kt:"kotlin",rb:"ruby",dockerfile:"dockerfile"},r=e.toLowerCase();return r==="dockerfile"?"dockerfile":r==="makefile"?"makefile":n[t]||"plaintext"}function Ut(e){for(const t of e)if(t.type==="file"&&t.name.endsWith(".html")||t.children&&Ut(t.children))return!0;return!1}function qt(e,t){for(const n of e){if(n.path===t)return n.size;if(n.children){const r=qt(n.children,t);if(r!==void 0)return r}}}function Xt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Yt({nodes:e,selectedPath:t,onSelect:n,onDelete:r,depth:o=0}){const[a,l]=f.useState(()=>{const i=new Set;return o<2&&e.filter(s=>s.type==="directory").forEach(s=>i.add(s.path)),i});return m.jsx("div",{children:e.map(i=>{const s=i.type==="directory",c=a.has(i.path),u=i.path===t;return m.jsxs("div",{className:"group/file",children:[m.jsxs("button",{onClick:()=>{s?l(v=>{const p=new Set(v);return p.has(i.path)?p.delete(i.path):p.add(i.path),p}):n(i.path,i.name)},className:`w-full text-left flex items-center gap-1.5 px-2 py-1 text-xs font-mono rounded transition-colors ${u?"bg-accent-product/10 text-accent-product":"text-charcoal/70 hover:bg-white/40"}`,style:{paddingLeft:`${o*14+8}px`},children:[s?m.jsx("span",{className:"text-[10px] text-slate w-3 text-center flex-shrink-0",children:c?"v":">"}):m.jsx("span",{className:"w-3 flex-shrink-0"}),m.jsx("span",{className:`text-[10px] font-bold w-5 text-center flex-shrink-0 ${s?"text-accent-product":Vt(i.name)}`,children:Gt(i.name,i.type)}),m.jsxs("span",{className:"truncate",children:[i.name,s?"/":""]}),!s&&i.size!=null&&i.size>0&&m.jsx("span",{className:"text-[10px] text-slate/40 ml-auto flex-shrink-0",children:Xt(i.size)}),!s&&r&&m.jsx("span",{role:"button",tabIndex:-1,onClick:v=>{v.stopPropagation(),r(i.path,i.name)},onKeyDown:v=>{v.key==="Enter"&&(v.stopPropagation(),r(i.path,i.name))},className:"text-[10px] text-slate/30 hover:text-red-500 ml-1 flex-shrink-0 opacity-0 group-hover/file:opacity-100 transition-opacity cursor-pointer",title:"Delete file",children:"x"})]}),s&&c&&i.children&&m.jsx(Yt,{nodes:i.children,selectedPath:t,onSelect:n,onDelete:r,depth:o+1})]},i.path)})})}function Gr({session:e,onClose:t}){var W;const[n,r]=f.useState(null),[o,a]=f.useState(""),[l,i]=f.useState(null),[s,c]=f.useState(null),[u,v]=f.useState(!1),[p,L]=f.useState(!1),[y,h]=f.useState(!1),[b,x]=f.useState(!1),[d,S]=f.useState(e),w=f.useRef(null),g=Ut(d.files),C=`/api/sessions/${encodeURIComponent(d.id)}/preview/index.html`,j=f.useCallback(async()=>{try{const E=await K.getSessionDetail(d.id);S(E)}catch{}},[d.id]),N=f.useCallback(async(E,T)=>{if(!(y&&!window.confirm("Unsaved changes. Discard?"))){r(E),a(T),v(!0),h(!1);try{const H=d.id?await K.getSessionFileContent(d.id,E):await K.getFileContent(E);i(H.content),c(H.content)}catch{i("[Error loading file]"),c("[Error loading file]")}finally{v(!1)}}},[d.id,y]),F=f.useCallback(async()=>{if(!(!n||s===null||!d.id)){x(!0);try{await K.saveSessionFile(d.id,n,s),i(s),h(!1)}catch(E){const T=E instanceof Error?E.message:"Unknown error";window.alert(`Save failed: ${T}`)}finally{x(!1)}}},[n,s,d.id]);f.useEffect(()=>{const E=T=>{(T.metaKey||T.ctrlKey)&&T.key==="s"&&(T.preventDefault(),y&&n&&F())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[y,n,F]),f.useEffect(()=>{const E=d.files.find(T=>T.name==="index.html"&&T.type==="file");E&&(N(E.path,E.name),L(!0))},[]);const k=f.useCallback(E=>{E!==void 0&&(c(E),h(E!==l))},[l]),P=f.useCallback(E=>{w.current=E},[]),M=f.useCallback(async()=>{const E=window.prompt("New file name (e.g. src/utils.ts):");if(!(!E||!E.trim()))try{await K.createSessionFile(d.id,E.trim()),await j()}catch(T){const H=T instanceof Error?T.message:"Unknown error";window.alert(`Create file failed: ${H}`)}},[d.id,j]),D=f.useCallback(async()=>{const E=window.prompt("New folder name (e.g. src/components):");if(!(!E||!E.trim()))try{await K.createSessionDirectory(d.id,E.trim()),await j()}catch(T){const H=T instanceof Error?T.message:"Unknown error";window.alert(`Create folder failed: ${H}`)}},[d.id,j]),A=f.useCallback(async(E,T)=>{if(window.confirm(`Delete "${T}"?`))try{await K.deleteSessionFile(d.id,E),n===E&&(r(null),a(""),i(null),c(null),h(!1)),await j()}catch(O){const I=O instanceof Error?O.message:"Unknown error";window.alert(`Delete failed: ${I}`)}},[d.id,n,j]),z=n?qt(d.files,n):void 0,R=((W=o.split(".").pop())==null?void 0:W.toUpperCase())||"";return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"glass px-5 py-3 flex items-center gap-4 flex-shrink-0 border-b border-white/10",children:[m.jsx("button",{onClick:()=>{y&&!window.confirm("Unsaved changes. Discard?")||t()},className:"text-xs font-medium px-3 py-1.5 rounded-lg border border-white/20 text-slate hover:text-charcoal hover:bg-white/30 transition-colors",children:"Back"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("h2",{className:"text-sm font-bold text-charcoal truncate",children:d.id}),m.jsx("p",{className:"text-[10px] font-mono text-slate truncate",children:d.path})]}),m.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${d.status==="completed"||d.status==="completion_promise_fulfilled"?"bg-success/10 text-success":"bg-slate/10 text-slate"}`,children:d.status}),g&&m.jsx("button",{onClick:()=>L(!p),className:`text-xs font-medium px-3 py-1.5 rounded-lg border transition-colors ${p?"border-accent-product/40 bg-accent-product/10 text-accent-product":"border-white/20 text-slate hover:text-charcoal hover:bg-white/30"}`,children:p?"Hide Preview":"Preview"})]}),m.jsx("div",{className:"flex-1 min-h-0",children:m.jsxs(Ht,{orientation:"horizontal",className:"h-full",children:[m.jsx(Me,{defaultSize:20,minSize:15,children:m.jsxs("div",{className:"h-full flex flex-col border-r border-white/10 bg-white/30",children:[m.jsxs("div",{className:"px-3 py-2 border-b border-white/10 flex items-center gap-2",children:[m.jsx("span",{className:"text-[10px] text-slate uppercase tracking-wider font-semibold flex-1",children:"Files"}),m.jsx("button",{onClick:M,title:"New File",className:"text-[10px] text-slate hover:text-accent-product px-1.5 py-0.5 rounded border border-white/20 hover:border-accent-product/30 transition-colors",children:"+ File"}),m.jsx("button",{onClick:D,title:"New Folder",className:"text-[10px] text-slate hover:text-accent-product px-1.5 py-0.5 rounded border border-white/20 hover:border-accent-product/30 transition-colors",children:"+ Dir"})]}),m.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:d.files.length>0?m.jsx(Yt,{nodes:d.files,selectedPath:n,onSelect:N,onDelete:A}):m.jsx("div",{className:"p-4 text-xs text-slate",children:"No files"})})]})}),m.jsx(Ae,{className:"w-1 bg-white/10 hover:bg-accent-product/30 transition-colors cursor-col-resize"}),m.jsx(Me,{defaultSize:p?50:80,minSize:25,children:m.jsx("div",{className:"h-full flex flex-col min-w-0",children:n?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"px-4 py-2 border-b border-white/10 flex items-center gap-2 flex-shrink-0 bg-white/20",children:[m.jsx("span",{className:`text-[10px] font-bold ${Vt(o)}`,children:Gt(o,"file")}),m.jsx("span",{className:"text-xs font-mono text-charcoal truncate",children:n}),y&&m.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-product flex-shrink-0",title:"Unsaved changes"}),b&&m.jsx("span",{className:"text-[10px] text-accent-product animate-pulse flex-shrink-0",children:"Saving..."}),m.jsx("span",{className:"ml-auto text-[10px] text-slate/50 font-mono",children:z!=null?Xt(z):""}),m.jsx("span",{className:"text-[10px] text-slate/40 font-mono uppercase",children:R}),y&&m.jsx("button",{onClick:F,className:"text-[10px] font-medium px-2 py-0.5 rounded border border-accent-product/40 bg-accent-product/10 text-accent-product hover:bg-accent-product/20 transition-colors",children:"Save"})]}),m.jsx("div",{className:"flex-1 min-h-0",children:u?m.jsx("div",{className:"text-slate text-xs animate-pulse p-4",children:"Loading..."}):m.jsx(cr,{value:s??"",language:Vr(o),theme:"vs",onChange:k,onMount:P,options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8},renderLineHighlight:"line",smoothScrolling:!0,cursorBlinking:"smooth",folding:!0,bracketPairColorization:{enabled:!0}}})})]}):m.jsx("div",{className:"flex-1 flex items-center justify-center text-slate text-sm",children:"Select a file to view its contents"})})}),p&&m.jsxs(m.Fragment,{children:[m.jsx(Ae,{className:"w-1 bg-white/10 hover:bg-accent-product/30 transition-colors cursor-col-resize"}),m.jsx(Me,{defaultSize:30,minSize:20,collapsible:!0,children:m.jsxs("div",{className:"h-full flex flex-col border-l border-white/10",children:[m.jsxs("div",{className:"px-4 py-2 border-b border-white/10 flex items-center gap-2 flex-shrink-0 bg-white/20",children:[m.jsx("span",{className:"text-xs font-semibold text-charcoal",children:"Live Preview"}),m.jsx("span",{className:"text-[10px] font-mono text-slate/50 truncate ml-auto",children:C})]}),m.jsx("div",{className:"flex-1 bg-white",children:m.jsx("iframe",{src:C,title:"Project Preview",className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"})})]})})]})]})})]})}function Xr(){const{sessionId:e}=Kt(),t=Qt(),[n,r]=f.useState(null),[o,a]=f.useState(!0),[l,i]=f.useState(null);return f.useEffect(()=>{e&&(a(!0),i(null),K.getSessionDetail(e).then(s=>{r(s),a(!1)}).catch(s=>{i(s instanceof Error?s.message:"Failed to load session"),a(!1)}))},[e]),o?m.jsxs("div",{className:"h-screen bg-background flex flex-col",children:[m.jsx(Re,{status:null,wsConnected:!1}),m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"text-slate animate-pulse text-sm",children:"Loading project..."}),m.jsx("div",{className:"text-[10px] font-mono text-slate/50 mt-2",children:e})]})})]}):l||!n?m.jsxs("div",{className:"h-screen bg-background flex flex-col",children:[m.jsx(Re,{status:null,wsConnected:!1}),m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsxs("div",{className:"text-center",children:[m.jsx("p",{className:"text-danger text-sm font-medium",children:"Project not found"}),m.jsx("p",{className:"text-xs text-slate mt-1",children:l||`Session ${e} does not exist`}),m.jsx("button",{onClick:()=>t("/"),className:"mt-4 px-4 py-2 rounded-xl text-sm font-semibold border border-accent-product/30 text-accent-product hover:bg-accent-product/5 transition-all",children:"Back to Home"})]})})]}):m.jsxs("div",{className:"h-screen bg-background flex flex-col",children:[m.jsx(Re,{status:null,wsConnected:!1}),m.jsx("div",{className:"flex-1 min-h-0",children:m.jsx(Zt,{name:"ProjectWorkspace",children:m.jsx(Gr,{session:n,onClose:()=>t("/")})})})]})}export{Xr as default};