@tom2012/cc-web 1.5.72 → 1.5.73
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/README.md +1 -1
- package/frontend/dist/assets/{GraphPreview-QqDpOEoI.js → GraphPreview-AjRbINBy.js} +1 -1
- package/frontend/dist/assets/{OfficePreview-BC2woErg.js → OfficePreview-Q9JIuSn6.js} +3 -3
- package/frontend/dist/assets/{ProjectPage-B8Tdoz_M.js → ProjectPage-DKIPvilo.js} +3 -3
- package/frontend/dist/assets/{SettingsPage-C8572fFD.js → SettingsPage-C8JtKKqC.js} +1 -1
- package/frontend/dist/assets/{ShareViewPage-PTSFe5df.js → ShareViewPage-Cai400b7.js} +1 -1
- package/frontend/dist/assets/{SkillHubPage-BHgZp94q.js → SkillHubPage-CzcGAwA0.js} +1 -1
- package/frontend/dist/assets/{bot-CP4ljg4K.js → bot-CSseHzMu.js} +1 -1
- package/frontend/dist/assets/{chevron-down-BPKbPuX9.js → chevron-down-DRKgAnVD.js} +1 -1
- package/frontend/dist/assets/{download-DJNy8XSX.js → download-C4SEOksg.js} +1 -1
- package/frontend/dist/assets/{index-CENzb-E2.js → index-B0AjOEnZ.js} +1 -1
- package/frontend/dist/assets/{index-BPzNyZy4.js → index-BKftRi-t.js} +2 -2
- package/frontend/dist/assets/{jszip.min-CPp1Je4B.js → jszip.min-Bi48KS2o.js} +1 -1
- package/frontend/dist/assets/{save-dexIyJWW.js → save-CFqjwCN9.js} +1 -1
- package/frontend/dist/assets/{user-BGUBSa7q.js → user-CsHBuG4B.js} +1 -1
- package/frontend/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Pe,r as l,am as re,an as Y,ao as He,j as r,ap as K,aq as z,ar as _e,e as J,as as an,R as Ce,at as We,au as jt,av as Zo,aw as Rt,ax as Qo,ay as Jo,az as er,aA as tr,aB as nr,aC as or,v as rr,aD as sr,L as ir,N as ar,O as cr,Q as lr,T as dr,B as ee,U as ue,I as je,V as ur,aE as $t,aF as mt,aG as fr,aH as pr,aI as mr,a6 as cn,aJ as hr,m as ln,aK as xr,a4 as gr,aL as vr,aM as yr,a5 as wr,aN as Ht,x as br,A as Sr,p as Cr,X as Nr,aO as jr,aP as Rr,aQ as Ar,aR as Tr,aS as Pr,aT as Er,aU as Vt,aV as Ir,t as lt,s as Or,S as kr}from"./index-
|
|
1
|
+
import{c as Pe,r as l,am as re,an as Y,ao as He,j as r,ap as K,aq as z,ar as _e,e as J,as as an,R as Ce,at as We,au as jt,av as Zo,aw as Rt,ax as Qo,ay as Jo,az as er,aA as tr,aB as nr,aC as or,v as rr,aD as sr,L as ir,N as ar,O as cr,Q as lr,T as dr,B as ee,U as ue,I as je,V as ur,aE as $t,aF as mt,aG as fr,aH as pr,aI as mr,a6 as cn,aJ as hr,m as ln,aK as xr,a4 as gr,aL as vr,aM as yr,a5 as wr,aN as Ht,x as br,A as Sr,p as Cr,X as Nr,aO as jr,aP as Rr,aQ as Ar,aR as Tr,aS as Pr,aT as Er,aU as Vt,aV as Ir,t as lt,s as Or,S as kr}from"./index-BKftRi-t.js";import{C as dn}from"./chevron-down-DRKgAnVD.js";import{a as _r,C as Dr,S as Wt}from"./save-CFqjwCN9.js";/**
|
|
2
2
|
* @license lucide-react v0.309.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ai as f,r,aY as g,j as e,e as a}from"./index-
|
|
1
|
+
import{ai as f,r,aY as g,j as e,e as a}from"./index-BKftRi-t.js";import{U as j}from"./user-CsHBuG4B.js";import{B as p}from"./bot-CSseHzMu.js";function v(){const{token:n}=f(),[o,c]=r.useState(!0),[i,l]=r.useState(null),[t,d]=r.useState(null),[m,x]=r.useState("");if(r.useEffect(()=>{n&&(c(!0),g(n).then(s=>{document.title=s.projectName+" — cc-web",d(s.session),x(s.projectName)}).catch(s=>l(s.message||"链接无效或已过期")).finally(()=>c(!1)))},[n]),o)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("span",{className:"text-muted-foreground text-sm",children:"加载中…"})});if(i||!t)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-foreground font-medium",children:"无法加载会话"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:i??"链接无效或已过期"})]})});const u=new Date(t.startedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsx("div",{className:"min-h-screen bg-background text-foreground",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:m}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsx("span",{children:u}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.messageCount," 条消息"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[t.messages.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),t.messages.map((s,h)=>e.jsxs("div",{className:a("flex gap-2.5",s.role==="user"?"flex-row-reverse":"flex-row"),children:[e.jsx("div",{className:a("flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center mt-0.5",s.role==="user"?"bg-blue-500/10":"bg-muted"),children:s.role==="user"?e.jsx(j,{className:"h-3.5 w-3.5 text-blue-400"}):e.jsx(p,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx("div",{className:a("max-w-[85%] text-sm rounded-lg px-3 py-2 whitespace-pre-wrap break-words",s.role==="user"?"bg-blue-500/10 text-blue-400":"bg-muted text-foreground"),children:s.content})]},h))]})]})})}export{v as ShareViewPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as k,a4 as z,r,aW as P,j as e,B as S,a5 as U,ab as B,I as F,e as g,p,J as O,A as q,aX as G,t as J}from"./index-
|
|
1
|
+
import{c as k,a4 as z,r,aW as P,j as e,B as S,a5 as U,ab as B,I as F,e as g,p,J as O,A as q,aX as G,t as J}from"./index-BKftRi-t.js";import{U as R}from"./user-CsHBuG4B.js";import{D as _}from"./download-C4SEOksg.js";import{C as W}from"./chevron-down-DRKgAnVD.js";/**
|
|
2
2
|
* @license lucide-react v0.309.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aZ as Nl,a as re}from"./index-
|
|
1
|
+
import{aZ as Nl,a as re}from"./index-BKftRi-t.js";import{a as Rl}from"./jszip.min-Bi48KS2o.js";function kl(e,n){for(var t=0;t<n.length;t++){const i=n[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const a=Object.getOwnPropertyDescriptor(i,r);a&&Object.defineProperty(e,r,a.get?a:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Ye={},aa="1.13.8",_c=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},ni=Array.prototype,ca=Object.prototype,Ec=typeof Symbol<"u"?Symbol.prototype:null,Ol=ni.push,Et=ni.slice,ft=ca.toString,Il=ca.hasOwnProperty,Uu=typeof ArrayBuffer<"u",Ll=typeof DataView<"u",Ml=Array.isArray,wc=Object.keys,Fc=Object.create,Ac=Uu&&ArrayBuffer.isView,ql=isNaN,Pl=isFinite,Tu=!{toString:null}.propertyIsEnumerable("toString"),Cc=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Xl=Math.pow(2,53)-1;function Re(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),i=Array(t),r=0;r<t;r++)i[r]=arguments[r+n];switch(n){case 0:return e.call(this,i);case 1:return e.call(this,arguments[0],i);case 2:return e.call(this,arguments[0],arguments[1],i)}var a=Array(n+1);for(r=0;r<n;r++)a[r]=arguments[r];return a[n]=i,e.apply(this,a)}}function _n(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function _u(e){return e===null}function oa(e){return e===void 0}function ua(e){return e===!0||e===!1||ft.call(e)==="[object Boolean]"}function Eu(e){return!!(e&&e.nodeType===1)}function We(e){var n="[object "+e+"]";return function(t){return ft.call(t)===n}}const ti=We("String"),sa=We("Number"),wu=We("Date"),Fu=We("RegExp"),Au=We("Error"),da=We("Symbol"),la=We("ArrayBuffer");var Cu=We("Function"),jl=_c.document&&_c.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof jl!="function"&&(Cu=function(e){return typeof e=="function"||!1});const Be=Cu,Bu=We("Object");var Wu=Ll&&(!/\[native code\]/.test(String(DataView))||Bu(new DataView(new ArrayBuffer(8)))),fa=typeof Map<"u"&&Bu(new Map),Vl=We("DataView");function Hl(e){return e!=null&&Be(e.getInt8)&&la(e.buffer)}const ht=Wu?Hl:Vl,En=Ml||We("Array");function wn(e,n){return e!=null&&Il.call(e,n)}var Jr=We("Arguments");(function(){Jr(arguments)||(Jr=function(e){return wn(e,"callee")})})();const ii=Jr;function Su(e){return!da(e)&&Pl(e)&&!isNaN(parseFloat(e))}function ha(e){return sa(e)&&ql(e)}function ga(e){return function(){return e}}function Nu(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Xl}}function Ru(e){return function(n){return n==null?void 0:n[e]}}const jt=Ru("byteLength"),$l=Nu(jt);var zl=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Gl(e){return Ac?Ac(e)&&!ht(e):$l(e)&&zl.test(ft.call(e))}const pa=Uu?Gl:ga(!1),Ce=Ru("length");function Ql(e){for(var n={},t=e.length,i=0;i<t;++i)n[e[i]]=!0;return{contains:function(r){return n[r]===!0},push:function(r){return n[r]=!0,e.push(r)}}}function ku(e,n){n=Ql(n);var t=Cc.length,i=e.constructor,r=Be(i)&&i.prototype||ca,a="constructor";for(wn(e,a)&&!n.contains(a)&&n.push(a);t--;)a=Cc[t],a in e&&e[a]!==r[a]&&!n.contains(a)&&n.push(a)}function ye(e){if(!_n(e))return[];if(wc)return wc(e);var n=[];for(var t in e)wn(e,t)&&n.push(t);return Tu&&ku(e,n),n}function Ou(e){if(e==null)return!0;var n=Ce(e);return typeof n=="number"&&(En(e)||ti(e)||ii(e))?n===0:Ce(ye(e))===0}function ma(e,n){var t=ye(n),i=t.length;if(e==null)return!i;for(var r=Object(e),a=0;a<i;a++){var c=t[a];if(n[c]!==r[c]||!(c in r))return!1}return!0}function ce(e){if(e instanceof ce)return e;if(!(this instanceof ce))return new ce(e);this._wrapped=e}ce.VERSION=aa;ce.prototype.value=function(){return this._wrapped};ce.prototype.valueOf=ce.prototype.toJSON=ce.prototype.value;ce.prototype.toString=function(){return String(this._wrapped)};function Bc(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,jt(e))}var Wc="[object DataView]";function Iu(e,n){for(var t=[{a:e,b:n}],i=[],r=[];t.length;){var a=t.pop();if(a===!0){i.pop(),r.pop();continue}if(e=a.a,n=a.b,e===n){if(e!==0||1/e===1/n)continue;return!1}if(e==null||n==null)return!1;if(e!==e){if(n!==n)continue;return!1}var c=typeof e;if(c!=="function"&&c!=="object"&&typeof n!="object")return!1;e instanceof ce&&(e=e._wrapped),n instanceof ce&&(n=n._wrapped);var u=ft.call(e);if(u!==ft.call(n))return!1;if(Wu&&u=="[object Object]"&&ht(e)){if(!ht(n))return!1;u=Wc}switch(u){case"[object RegExp]":case"[object String]":if(""+e==""+n)continue;return!1;case"[object Number]":t.push({a:+e,b:+n});continue;case"[object Date]":case"[object Boolean]":if(+e==+n)continue;return!1;case"[object Symbol]":if(Ec.valueOf.call(e)===Ec.valueOf.call(n))continue;return!1;case"[object ArrayBuffer]":case Wc:t.push({a:Bc(e),b:Bc(n)});continue}var o=u==="[object Array]";if(!o&&pa(e)){var s=jt(e);if(s!==jt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)continue;o=!0}if(!o){if(typeof e!="object"||typeof n!="object")return!1;var d=e.constructor,h=n.constructor;if(d!==h&&!(Be(d)&&d instanceof d&&Be(h)&&h instanceof h)&&"constructor"in e&&"constructor"in n)return!1}for(var g=i.length;g--;)if(i[g]===e){if(r[g]===n)break;return!1}if(!(g>=0))if(i.push(e),r.push(n),t.push(!0),o){if(g=e.length,g!==n.length)return!1;for(;g--;)t.push({a:e[g],b:n[g]})}else{var y=ye(e),D;if(g=y.length,ye(n).length!==g)return!1;for(;g--;){if(D=y[g],!wn(n,D))return!1;t.push({a:e[D],b:n[D]})}}}return!0}function nt(e){if(!_n(e))return[];var n=[];for(var t in e)n.push(t);return Tu&&ku(e,n),n}function ba(e){var n=Ce(e);return function(t){if(t==null)return!1;var i=nt(t);if(Ce(i))return!1;for(var r=0;r<n;r++)if(!Be(t[e[r]]))return!1;return e!==qu||!Be(t[Da])}}var Da="forEach",Lu="has",ya=["clear","delete"],Mu=["get",Lu,"set"],Yl=ya.concat(Da,Mu),qu=ya.concat(Mu),Zl=["add"].concat(ya,Da,Lu);const Pu=fa?ba(Yl):We("Map"),Xu=fa?ba(qu):We("WeakMap"),ju=fa?ba(Zl):We("Set"),Vu=We("WeakSet");function On(e){for(var n=ye(e),t=n.length,i=Array(t),r=0;r<t;r++)i[r]=e[n[r]];return i}function Hu(e){for(var n=ye(e),t=n.length,i=Array(t),r=0;r<t;r++)i[r]=[n[r],e[n[r]]];return i}function va(e){for(var n={},t=ye(e),i=0,r=t.length;i<r;i++)n[e[t[i]]]=t[i];return n}function gt(e){var n=[];for(var t in e)Be(e[t])&&n.push(t);return n.sort()}function xa(e,n){return function(t){var i=arguments.length;if(n&&(t=Object(t)),i<2||t==null)return t;for(var r=1;r<i;r++)for(var a=arguments[r],c=e(a),u=c.length,o=0;o<u;o++){var s=c[o];(!n||t[s]===void 0)&&(t[s]=a[s])}return t}}const Ua=xa(nt),Gn=xa(ye),Ta=xa(nt,!0);function Kl(){return function(){}}function $u(e){if(!_n(e))return{};if(Fc)return Fc(e);var n=Kl();n.prototype=e;var t=new n;return n.prototype=null,t}function zu(e,n){var t=$u(e);return n&&Gn(t,n),t}function Gu(e){return _n(e)?En(e)?e.slice():Ua({},e):e}function Qu(e,n){return n(e),e}function _a(e){return En(e)?e:[e]}ce.toPath=_a;function wt(e){return ce.toPath(e)}function Ea(e,n){for(var t=n.length,i=0;i<t;i++){if(e==null)return;e=e[n[i]]}return t?e:void 0}function wa(e,n,t){var i=Ea(e,wt(n));return oa(i)?t:i}function Yu(e,n){n=wt(n);for(var t=n.length,i=0;i<t;i++){var r=n[i];if(!wn(e,r))return!1;e=e[r]}return!!t}function ri(e){return e}function Sn(e){return e=Gn({},e),function(n){return ma(n,e)}}function ai(e){return e=wt(e),function(n){return Ea(n,e)}}function Ft(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(i){return e.call(n,i)};case 3:return function(i,r,a){return e.call(n,i,r,a)};case 4:return function(i,r,a,c){return e.call(n,i,r,a,c)}}return function(){return e.apply(n,arguments)}}function Zu(e,n,t){return e==null?ri:Be(e)?Ft(e,n,t):_n(e)&&!En(e)?Sn(e):ai(e)}function ci(e,n){return Zu(e,n,1/0)}ce.iteratee=ci;function Le(e,n,t){return ce.iteratee!==ci?ce.iteratee(e,n):Zu(e,n,t)}function Ku(e,n,t){n=Le(n,t);for(var i=ye(e),r=i.length,a={},c=0;c<r;c++){var u=i[c];a[u]=n(e[u],u,e)}return a}function Fa(){}function Ju(e){return e==null?Fa:function(n){return wa(e,n)}}function es(e,n,t){var i=Array(Math.max(0,e));n=Ft(n,t,1);for(var r=0;r<e;r++)i[r]=n(r);return i}function Vt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const Qn=Date.now||function(){return new Date().getTime()};function ns(e){var n=function(a){return e[a]},t="(?:"+ye(e).join("|")+")",i=RegExp(t),r=RegExp(t,"g");return function(a){return a=a==null?"":""+a,i.test(a)?a.replace(r,n):a}}const ts={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},is=ns(ts),Jl=va(ts),rs=ns(Jl),as=ce.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var ji=/(.)^/,ef={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},nf=/\\|'|\r|\n|\u2028|\u2029/g;function tf(e){return"\\"+ef[e]}var rf=/^\s*(\w|\$)+\s*$/;function cs(e,n,t){!n&&t&&(n=t),n=Ta({},n,ce.templateSettings);var i=RegExp([(n.escape||ji).source,(n.interpolate||ji).source,(n.evaluate||ji).source].join("|")+"|$","g"),r=0,a="__p+='";e.replace(i,function(s,d,h,g,y){return a+=e.slice(r,y).replace(nf,tf),r=y+s.length,d?a+=`'+
|
|
2
2
|
((__t=(`+d+`))==null?'':_.escape(__t))+
|
|
3
3
|
'`:h?a+=`'+
|
|
4
4
|
((__t=(`+h+`))==null?'':__t)+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectPage-DKIPvilo.js","assets/save-CFqjwCN9.js","assets/download-C4SEOksg.js","assets/chevron-down-DRKgAnVD.js","assets/bot-CSseHzMu.js","assets/user-CsHBuG4B.js","assets/ProjectPage-9CEnUXvW.css","assets/SettingsPage-C8JtKKqC.js","assets/SkillHubPage-CzcGAwA0.js","assets/ShareViewPage-Cai400b7.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var vw=Object.defineProperty;var xw=(e,t,n)=>t in e?vw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ol=(e,t,n)=>xw(e,typeof t!="symbol"?t+"":t,n);function ww(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var KM=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function YM(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Am={exports:{}},xa={},Lm={exports:{}},G={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -277,4 +277,4 @@ Error generating stack: `+o.message+`
|
|
|
277
277
|
|
|
278
278
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
279
279
|
|
|
280
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},IR="DialogDescriptionWarning",VR=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nw(IR).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},FR=Ux,zR=Gx,rw=Kx,sw=Yx,ow=Qx,iw=qx,BR=ew;const gf=FR,$R=zR,aw=p.forwardRef(({className:e,...t},n)=>h.jsx(rw,{ref:n,className:Q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));aw.displayName=rw.displayName;const Qa=p.forwardRef(({className:e,children:t,noOverlay:n,...r},s)=>h.jsxs($R,{children:[!n&&h.jsx(aw,{}),h.jsxs(sw,{ref:s,className:Q("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,h.jsxs(BR,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(ff,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Qa.displayName=sw.displayName;const Za=({className:e,...t})=>h.jsx("div",{className:Q("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Za.displayName="DialogHeader";const qa=({className:e,...t})=>h.jsx("div",{className:Q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qa.displayName="DialogFooter";const Ja=p.forwardRef(({className:e,...t},n)=>h.jsx(ow,{ref:n,className:Q("text-lg font-semibold leading-none tracking-tight",e),...t}));Ja.displayName=ow.displayName;const el=p.forwardRef(({className:e,...t},n)=>h.jsx(iw,{ref:n,className:Q("text-sm text-muted-foreground",e),...t}));el.displayName=iw.displayName;function UR({project:e,open:t,onOpenChange:n,onUpdated:r}){const[s,o]=p.useState([]),[i,a]=p.useState([]),[l,c]=p.useState(!1),[d,u]=p.useState(null);p.useEffect(()=>{if(!t)return;o(e.shares?[...e.shares]:[]),u(null);let g=!1;return lx().then(v=>{g||a(v)}).catch(()=>{}),()=>{g=!0}},[t,e.id]);const f=new Set(s.map(g=>g.username)),y=i.filter(g=>g!==e.owner&&!f.has(g)),w=g=>{o(v=>[...v,{username:g,permission:"view"}])},x=g=>{o(v=>v.filter(E=>E.username!==g))},S=g=>{o(v=>v.map(E=>E.username===g?{...E,permission:E.permission==="view"?"edit":"view"}:E))},m=async()=>{c(!0),u(null);try{const g=await ux(e.id,s);r(g),n(!1)}catch(g){u(g instanceof Error?g.message:"Failed to update shares")}finally{c(!1)}};return h.jsx(gf,{open:t,onOpenChange:n,children:h.jsxs(Qa,{className:"sm:max-w-md",children:[h.jsxs(Za,{children:[h.jsxs(Ja,{className:"flex items-center gap-2",children:[h.jsx(Tc,{className:"h-4 w-4"}),"共享设置"]}),h.jsx(el,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),h.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[s.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),s.map(g=>h.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[h.jsx("span",{className:"text-sm font-medium",children:g.username}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:()=>S(g.username),className:"focus:outline-none",children:h.jsx(rr,{variant:g.permission==="edit"?"default":"secondary",className:"cursor-pointer text-xs",children:g.permission==="edit"?"可编辑":"可见"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>x(g.username),children:h.jsx(Px,{className:"h-3.5 w-3.5"})})]})]},g.username))]}),y.length>0&&h.jsxs("div",{className:"border-t pt-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map(g=>h.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>w(g),children:[h.jsx(ga,{className:"h-3 w-3"}),g]},g))})]}),d&&h.jsx("p",{className:"text-sm text-destructive",children:d}),h.jsxs(qa,{children:[h.jsx(ie,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),h.jsx(ie,{onClick:()=>void m(),disabled:l,children:l?"保存中...":"保存"})]})]})})}function WR(e,t){switch(e){case"thinking":return"Thinking…";case"tool_use":return t?`${t}`:"Tool…";case"tool_result":return"Reading…";case"text":return"Writing…"}}function HR({status:e}){return h.jsx("span",{className:Q("inline-block w-2 h-2 rounded-full",{"bg-green-500":e==="running","bg-zinc-400":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})})}const Tm=R.memo(function({project:t,active:n=!1,statusStack:r=[],onDelete:s,onArchive:o,onUnarchive:i,onUpdated:a}){var g,v;const l=Va(),[c,d]=p.useState(!1),u=!!t._sharedPermission,f=t._sharedPermission==="view",y=E=>{E.stopPropagation(),confirm(`Delete project "${t.name}"? This cannot be undone.`)&&s(t.id)},w=E=>{E.stopPropagation(),o(t.id)},x=E=>{E.stopPropagation(),i(t.id)},S=h.jsx(Vn.div,{whileHover:!t.archived&&!n?{y:-2}:{},transition:{duration:.2},children:h.jsxs(of,{className:Q("group cursor-pointer transition-colors relative",t.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":n?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!t.archived&&l(`/projects/${t.id}`),children:[h.jsxs(af,{className:"pb-2",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(lf,{className:Q("text-base leading-tight",t.archived&&"text-muted-foreground"),children:t.name}),h.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!u&&h.jsxs(h.Fragment,{children:[t.archived?h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:x,title:"Restore project",children:h.jsx(LN,{className:"h-3.5 w-3.5"})}):h.jsxs(h.Fragment,{children:[h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:E=>{E.stopPropagation(),d(!0)},title:"共享设置",children:h.jsx(Tc,{className:"h-3.5 w-3.5"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:w,title:"Archive project",children:h.jsx(_N,{className:"h-3.5 w-3.5"})})]}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:y,title:"Delete project",children:h.jsx(Px,{className:"h-3.5 w-3.5"})})]})})]}),h.jsx("div",{className:"flex items-center gap-1.5",children:t.archived?h.jsx(rr,{variant:"secondary",className:"text-xs",children:"Archived"}):h.jsxs(h.Fragment,{children:[h.jsx(HR,{status:t.status}),h.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:t.status}),n&&r.length>0&&h.jsx("div",{className:"ml-auto",children:h.jsx(tf,{mode:"wait",children:r.slice(-1).map(E=>h.jsx(Vn.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25,ease:"easeOut"},children:h.jsx(rr,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:WR(E.phase,E.detail)})},E.id))})})]})})]}),h.jsxs(uf,{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx(Pc,{className:"h-3.5 w-3.5 flex-shrink-0"}),h.jsx("span",{className:"truncate font-mono",children:t.folderPath})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(rr,{variant:"outline",className:"text-xs font-mono",children:t.cliTool??"claude"}),h.jsx(rr,{variant:t.permissionMode==="unlimited"?"destructive":"secondary",className:"text-xs",children:t.permissionMode==="unlimited"?"Unlimited":"Limited"}),u&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[f?h.jsx(VN,{className:"h-3 w-3"}):h.jsx(Cx,{className:"h-3 w-3"}),f?"可见":"可编辑"]}),!u&&t.shares&&t.shares.length>0&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[h.jsx(Tc,{className:"h-3 w-3"}),t.shares.length]}),h.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleDateString()})]}),(t.tags??[]).length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(t.tags??[]).slice(0,3).map(E=>h.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",E]},E)),(((g=t.tags)==null?void 0:g.length)??0)>3&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",(((v=t.tags)==null?void 0:v.length)??0)-3]})]})]})]})}),m=n&&!t.archived?h.jsx("div",{className:"card-active-glow rounded-lg",children:S}):S;return h.jsxs(h.Fragment,{children:[m,!u&&a&&h.jsx(UR,{project:t,open:c,onOpenChange:d,onUpdated:a})]})});function lw({onSelect:e}){const[t,n]=p.useState(""),[r,s]=p.useState(null),[o,i]=p.useState([]),[a,l]=p.useState(!0),[c,d]=p.useState(null),[u,f]=p.useState(!1),[y,w]=p.useState(""),[x,S]=p.useState(null),[m,g]=p.useState(!1),v=p.useRef(null),E=async A=>{l(!0),d(null);try{const L=await Sx(A);n(L.path),s(L.parent),i(L.entries)}catch(L){d(L instanceof Error?L.message:"Failed to load directory")}finally{l(!1)}};p.useEffect(()=>{E()},[]),p.useEffect(()=>{u&&setTimeout(()=>{var A;return(A=v.current)==null?void 0:A.focus()},0)},[u]);const C=()=>{w(""),S(null),f(!0)},P=()=>{f(!1),w(""),S(null)},k=async()=>{const A=y.trim();if(A){g(!0),S(null);try{const{path:L}=await Ex(t,A);f(!1),w(""),await E(t),E(L)}catch(L){S(L instanceof Error?L.message:"Failed to create folder")}finally{g(!1)}}},b=A=>{A.key==="Enter"?(A.preventDefault(),k()):A.key==="Escape"&&P()},D=t.split("/").filter(Boolean),T=A=>{const L="/"+D.slice(0,A+1).join("/");E(L)};return h.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[h.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>void E(),title:"Home",children:h.jsx(BN,{className:"h-3 w-3"})}),h.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:D.map((A,L)=>h.jsxs(R.Fragment,{children:[h.jsx(bx,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),h.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>T(L),children:A})]},L))}),h.jsxs(ie,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:C,disabled:u||a||!!c,title:"New folder",children:[h.jsx(zN,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!a&&!c&&h.jsxs("div",{className:"p-1",children:[r&&h.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>void E(r),children:[h.jsx(ON,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:".."})]}),u&&h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[h.jsx(fm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),h.jsx("input",{ref:v,className:Q("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",x&&"border-destructive"),placeholder:"Folder name",value:y,onChange:A=>{w(A.target.value),S(null)},onKeyDown:b,disabled:m}),h.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>void k(),disabled:!y.trim()||m,title:"Create",children:h.jsx(IN,{className:"h-3.5 w-3.5 text-green-600"})}),h.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:P,disabled:m,title:"Cancel",children:h.jsx(ff,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),x&&h.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:x}),o.length===0&&!u&&h.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),o.map(A=>h.jsxs("button",{className:Q("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left",A.type==="dir"?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{A.type==="dir"&&E(A.path)},disabled:A.type==="file",children:[A.type==="dir"?h.jsx(fm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):h.jsx(FN,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"truncate",children:A.name})]},A.path))]})]}),h.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),h.jsx(ie,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const GR=[{value:"claude",label:"Claude",desc:"Anthropic Claude Code CLI"},{value:"opencode",label:"OpenCode",desc:"OpenCode CLI (sst/opencode)"},{value:"codex",label:"Codex",desc:"OpenAI Codex CLI"},{value:"qwen",label:"Qwen",desc:"Qwen Code CLI (QwenLM)"}],Nm={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"}};function KR({open:e,onOpenChange:t,onCreated:n}){const[r,s]=p.useState("name"),[o,i]=p.useState(""),[a,l]=p.useState(""),[c,d]=p.useState("claude"),[u,f]=p.useState("limited"),[y,w]=p.useState(!1),[x,S]=p.useState(null),m=()=>{s("name"),i(""),l(""),d("claude"),f("limited"),S(null),w(!1)},g=b=>{b||m(),t(b)},v=()=>{if(!o.trim()){S("Please enter a project name");return}S(null),s("folder")},E=b=>{l(b),s("settings")},C=async()=>{w(!0),S(null);try{const b=await cx({name:o.trim(),folderPath:a,permissionMode:u,cliTool:c});n(b),g(!1)}catch(b){S(b instanceof Error?b.message:"Failed to create project")}finally{w(!1)}},P={name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"},k=["name","folder","settings"];return h.jsx(gf,{open:e,onOpenChange:g,children:h.jsxs(Qa,{className:"sm:max-w-lg",children:[h.jsxs(Za,{children:[h.jsx(Ja,{children:P[r]}),h.jsxs(el,{children:[r==="name"&&"Give your project a name.",r==="folder"&&"Choose the working directory for this project.",r==="settings"&&"Choose the AI coding tool and run mode."]})]}),h.jsx("div",{className:"flex gap-2 mb-2",children:k.map((b,D)=>h.jsx("div",{className:`h-1.5 flex-1 rounded-full ${r===b?"bg-primary":k.indexOf(r)>D?"bg-primary/40":"bg-muted"}`},b))}),r==="name"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"project-name",children:"Project Name"}),h.jsx(vo,{id:"project-name",placeholder:"My Project",value:o,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&v()},autoFocus:!0})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),r==="folder"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Working Directory"}),h.jsx(lw,{onSelect:E})]}),r==="settings"&&h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"AI Coding Tool"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:GR.map(b=>h.jsxs("label",{className:`flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors ${c===b.value?"border-primary bg-primary/5":"hover:bg-accent"}`,children:[h.jsx("input",{type:"radio",name:"cliTool",value:b.value,checked:c===b.value,onChange:()=>d(b.value),className:"accent-primary"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:b.label}),h.jsx("div",{className:"text-xs text-muted-foreground",children:b.desc})]})]},b.value))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Permission Mode"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:u==="limited",onChange:()=>f("limited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Limited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:Nm[c].limited})," — asks for permission before file changes."]})]})]}),h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:u==="unlimited",onChange:()=>f("unlimited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:Nm[c].unlimited})," — acts autonomously."]})]})]})]})]}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Folder:"})," ",h.jsx("span",{className:"font-mono",children:a})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),h.jsxs(qa,{children:[r!=="name"&&h.jsx(ie,{variant:"outline",onClick:()=>s(r==="settings"?"folder":"name"),disabled:y,children:"Back"}),r==="name"&&h.jsx(ie,{onClick:v,children:"Next"}),r==="folder"&&h.jsx(ie,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r==="settings"&&h.jsx(ie,{onClick:()=>void C(),disabled:y,children:y?"Creating...":"Create Project"})]})]})})}function YR({open:e,onOpenChange:t,onOpened:n}){const[r,s]=p.useState(""),[o,i]=p.useState(!1),[a,l]=p.useState(null),c=()=>{s(""),l(null),i(!1)},d=f=>{f||c(),t(f)},u=async f=>{s(f),i(!0),l(null);try{const y=await dx(f);n(y),d(!1)}catch(y){l(y instanceof Error?y.message:"Failed to open project"),i(!1)}};return h.jsx(gf,{open:e,onOpenChange:d,children:h.jsxs(Qa,{className:"sm:max-w-lg",children:[h.jsxs(Za,{children:[h.jsx(Ja,{children:"Open Existing Project"}),h.jsxs(el,{children:["Select a folder that contains a ",h.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Project Folder"}),h.jsx(lw,{onSelect:f=>void u(f)})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a}),r&&!a&&o&&h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),h.jsx(qa,{children:h.jsx(ie,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"})})]})})}function XR(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const QR=e=>{switch(e){case"success":return JR;case"info":return tM;case"warning":return eM;case"error":return nM;default:return null}},ZR=Array(12).fill(0),qR=({visible:e,className:t})=>R.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},R.createElement("div",{className:"sonner-spinner"},ZR.map((n,r)=>R.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),JR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),tM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),rM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},R.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),R.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),sM=()=>{const[e,t]=R.useState(document.hidden);return R.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Rc=1;class oM{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Rc++,i=this.toasts.find(l=>l.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async c=>{if(i=["resolve",c],R.isValidElement(c))o=!1,this.create({id:r,type:"default",message:c});else if(aM(c)&&!c.ok){o=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(c instanceof Error){o=!1;const u=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(n.success!==void 0){o=!1;const u=typeof n.success=="function"?await n.success(c):n.success,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:f,...w})}}).catch(async c=>{if(i=["reject",c],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(c):n.error,u=typeof n.description=="function"?await n.description(c):n.description,y=typeof d=="object"&&!R.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:u,...y})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,d)=>a.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||Rc++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const et=new oM,iM=(e,t)=>{const n=(t==null?void 0:t.id)||Rc++;return et.addToast({title:e,...t,id:n}),n},aM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lM=iM,uM=()=>et.toasts,cM=()=>et.getActiveToasts(),Ls=Object.assign(lM,{success:et.success,info:et.info,warning:et.warning,error:et.error,custom:et.custom,message:et.message,promise:et.promise,dismiss:et.dismiss,loading:et.loading},{getHistory:uM,getToasts:cM});XR("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ci(e){return e.label!==void 0}const dM=3,fM="24px",hM="16px",jm=4e3,pM=356,mM=14,gM=45,yM=200;function Ft(...e){return e.filter(Boolean).join(" ")}function vM(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const xM=e=>{var t,n,r,s,o,i,a,l,c;const{invert:d,toast:u,unstyled:f,interacting:y,setHeights:w,visibleToasts:x,heights:S,index:m,toasts:g,expanded:v,removeToast:E,defaultRichColors:C,closeButton:P,style:k,cancelButtonStyle:b,actionButtonStyle:D,className:T="",descriptionClassName:A="",duration:L,position:Z,gap:le,expandByDefault:ge,classNames:B,icons:re,closeButtonAriaLabel:j="Close toast"}=e,[_,V]=R.useState(null),[$,se]=R.useState(null),[H,q]=R.useState(!1),[K,pe]=R.useState(!1),[Je,J]=R.useState(!1),[Xt,cn]=R.useState(!1),[Qt,It]=R.useState(!1),[gs,Xn]=R.useState(0),[tl,Qn]=R.useState(0),dn=R.useRef(u.duration||L||jm),Lo=R.useRef(null),kt=R.useRef(null),nl=m===0,rl=m+1<=x,ze=u.type,N=u.dismissible!==!1,z=u.className||"",Y=u.descriptionClassName||"",te=R.useMemo(()=>S.findIndex(U=>U.toastId===u.id)||0,[S,u.id]),ue=R.useMemo(()=>{var U;return(U=u.closeButton)!=null?U:P},[u.closeButton,P]),Te=R.useMemo(()=>u.duration||L||jm,[u.duration,L]),Ge=R.useRef(0),ye=R.useRef(0),Zn=R.useRef(0),fn=R.useRef(null),[hw,pw]=Z.split("-"),vf=R.useMemo(()=>S.reduce((U,Me,Be)=>Be>=te?U:U+Me.height,0),[S,te]),xf=sM(),mw=u.invert||d,sl=ze==="loading";ye.current=R.useMemo(()=>te*le+vf,[te,vf]),R.useEffect(()=>{dn.current=Te},[Te]),R.useEffect(()=>{q(!0)},[]),R.useEffect(()=>{const U=kt.current;if(U){const Me=U.getBoundingClientRect().height;return Qn(Me),w(Be=>[{toastId:u.id,height:Me,position:u.position},...Be]),()=>w(Be=>Be.filter(it=>it.toastId!==u.id))}},[w,u.id]),R.useLayoutEffect(()=>{if(!H)return;const U=kt.current,Me=U.style.height;U.style.height="auto";const Be=U.getBoundingClientRect().height;U.style.height=Me,Qn(Be),w(it=>it.find(Le=>Le.toastId===u.id)?it.map(Le=>Le.toastId===u.id?{...Le,height:Be}:Le):[{toastId:u.id,height:Be,position:u.position},...it])},[H,u.title,u.description,w,u.id,u.jsx,u.action,u.cancel]);const hn=R.useCallback(()=>{pe(!0),Xn(ye.current),w(U=>U.filter(Me=>Me.toastId!==u.id)),setTimeout(()=>{E(u)},yM)},[u,E,w,ye]);R.useEffect(()=>{if(u.promise&&ze==="loading"||u.duration===1/0||u.type==="loading")return;let U;return v||y||xf?(()=>{if(Zn.current<Ge.current){const it=new Date().getTime()-Ge.current;dn.current=dn.current-it}Zn.current=new Date().getTime()})():(()=>{dn.current!==1/0&&(Ge.current=new Date().getTime(),U=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),hn()},dn.current))})(),()=>clearTimeout(U)},[v,y,u,ze,xf,hn]),R.useEffect(()=>{u.delete&&(hn(),u.onDismiss==null||u.onDismiss.call(u,u))},[hn,u.delete]);function gw(){var U;if(re!=null&&re.loading){var Me;return R.createElement("div",{className:Ft(B==null?void 0:B.loader,u==null||(Me=u.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":ze==="loading"},re.loading)}return R.createElement(qR,{className:Ft(B==null?void 0:B.loader,u==null||(U=u.classNames)==null?void 0:U.loader),visible:ze==="loading"})}const yw=u.icon||(re==null?void 0:re[ze])||QR(ze);var wf,Sf;return R.createElement("li",{tabIndex:0,ref:kt,className:Ft(T,z,B==null?void 0:B.toast,u==null||(t=u.classNames)==null?void 0:t.toast,B==null?void 0:B.default,B==null?void 0:B[ze],u==null||(n=u.classNames)==null?void 0:n[ze]),"data-sonner-toast":"","data-rich-colors":(wf=u.richColors)!=null?wf:C,"data-styled":!(u.jsx||u.unstyled||f),"data-mounted":H,"data-promise":!!u.promise,"data-swiped":Qt,"data-removed":K,"data-visible":rl,"data-y-position":hw,"data-x-position":pw,"data-index":m,"data-front":nl,"data-swiping":Je,"data-dismissible":N,"data-type":ze,"data-invert":mw,"data-swipe-out":Xt,"data-swipe-direction":$,"data-expanded":!!(v||ge&&H),"data-testid":u.testId,style:{"--index":m,"--toasts-before":m,"--z-index":g.length-m,"--offset":`${K?gs:ye.current}px`,"--initial-height":ge?"auto":`${tl}px`,...k,...u.style},onDragEnd:()=>{J(!1),V(null),fn.current=null},onPointerDown:U=>{U.button!==2&&(sl||!N||(Lo.current=new Date,Xn(ye.current),U.target.setPointerCapture(U.pointerId),U.target.tagName!=="BUTTON"&&(J(!0),fn.current={x:U.clientX,y:U.clientY})))},onPointerUp:()=>{var U,Me,Be;if(Xt||!N)return;fn.current=null;const it=Number(((U=kt.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_o=Number(((Me=kt.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Le=new Date().getTime()-((Be=Lo.current)==null?void 0:Be.getTime()),pt=_==="x"?it:_o,Oo=Math.abs(pt)/Le;if(Math.abs(pt)>=gM||Oo>.11){Xn(ye.current),u.onDismiss==null||u.onDismiss.call(u,u),se(_==="x"?it>0?"right":"left":_o>0?"down":"up"),hn(),cn(!0);return}else{var bt,Ct;(bt=kt.current)==null||bt.style.setProperty("--swipe-amount-x","0px"),(Ct=kt.current)==null||Ct.style.setProperty("--swipe-amount-y","0px")}It(!1),J(!1),V(null)},onPointerMove:U=>{var Me,Be,it;if(!fn.current||!N||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;const Le=U.clientY-fn.current.y,pt=U.clientX-fn.current.x;var Oo;const bt=(Oo=e.swipeDirections)!=null?Oo:vM(Z);!_&&(Math.abs(pt)>1||Math.abs(Le)>1)&&V(Math.abs(pt)>Math.abs(Le)?"x":"y");let Ct={x:0,y:0};const Ef=qn=>1/(1.5+Math.abs(qn)/20);if(_==="y"){if(bt.includes("top")||bt.includes("bottom"))if(bt.includes("top")&&Le<0||bt.includes("bottom")&&Le>0)Ct.y=Le;else{const qn=Le*Ef(Le);Ct.y=Math.abs(qn)<Math.abs(Le)?qn:Le}}else if(_==="x"&&(bt.includes("left")||bt.includes("right")))if(bt.includes("left")&&pt<0||bt.includes("right")&&pt>0)Ct.x=pt;else{const qn=pt*Ef(pt);Ct.x=Math.abs(qn)<Math.abs(pt)?qn:pt}(Math.abs(Ct.x)>0||Math.abs(Ct.y)>0)&&It(!0),(Be=kt.current)==null||Be.style.setProperty("--swipe-amount-x",`${Ct.x}px`),(it=kt.current)==null||it.style.setProperty("--swipe-amount-y",`${Ct.y}px`)}},ue&&!u.jsx&&ze!=="loading"?R.createElement("button",{"aria-label":j,"data-disabled":sl,"data-close-button":!0,onClick:sl||!N?()=>{}:()=>{hn(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Ft(B==null?void 0:B.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(Sf=re==null?void 0:re.close)!=null?Sf:rM):null,(ze||u.icon||u.promise)&&u.icon!==null&&((re==null?void 0:re[ze])!==null||u.icon)?R.createElement("div",{"data-icon":"",className:Ft(B==null?void 0:B.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||gw():null,u.type!=="loading"?yw:null):null,R.createElement("div",{"data-content":"",className:Ft(B==null?void 0:B.content,u==null||(o=u.classNames)==null?void 0:o.content)},R.createElement("div",{"data-title":"",className:Ft(B==null?void 0:B.title,u==null||(i=u.classNames)==null?void 0:i.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?R.createElement("div",{"data-description":"",className:Ft(A,Y,B==null?void 0:B.description,u==null||(a=u.classNames)==null?void 0:a.description)},typeof u.description=="function"?u.description():u.description):null),R.isValidElement(u.cancel)?u.cancel:u.cancel&&ci(u.cancel)?R.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||b,onClick:U=>{ci(u.cancel)&&N&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,U),hn())},className:Ft(B==null?void 0:B.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,R.isValidElement(u.action)?u.action:u.action&&ci(u.action)?R.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||D,onClick:U=>{ci(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,U),!U.defaultPrevented&&hn())},className:Ft(B==null?void 0:B.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function Rm(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function wM(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?hM:fM;function l(c){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=a:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const SM=R.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:d,mobileOffset:u,theme:f="light",richColors:y,duration:w,style:x,visibleToasts:S=dM,toastOptions:m,dir:g=Rm(),gap:v=mM,icons:E,containerAriaLabel:C="Notifications"}=t,[P,k]=R.useState([]),b=R.useMemo(()=>r?P.filter(H=>H.toasterId===r):P.filter(H=>!H.toasterId),[P,r]),D=R.useMemo(()=>Array.from(new Set([o].concat(b.filter(H=>H.position).map(H=>H.position)))),[b,o]),[T,A]=R.useState([]),[L,Z]=R.useState(!1),[le,ge]=R.useState(!1),[B,re]=R.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),j=R.useRef(null),_=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=R.useRef(null),$=R.useRef(!1),se=R.useCallback(H=>{k(q=>{var K;return(K=q.find(pe=>pe.id===H.id))!=null&&K.delete||et.dismiss(H.id),q.filter(({id:pe})=>pe!==H.id)})},[]);return R.useEffect(()=>et.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{k(q=>q.map(K=>K.id===H.id?{...K,delete:!0}:K))});return}setTimeout(()=>{Hy.flushSync(()=>{k(q=>{const K=q.findIndex(pe=>pe.id===H.id);return K!==-1?[...q.slice(0,K),{...q[K],...H},...q.slice(K+1)]:[H,...q]})})})}),[P]),R.useEffect(()=>{if(f!=="system"){re(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?re("dark"):re("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:q})=>{re(q?"dark":"light")})}catch{H.addListener(({matches:K})=>{try{re(K?"dark":"light")}catch(pe){console.error(pe)}})}},[f]),R.useEffect(()=>{P.length<=1&&Z(!1)},[P]),R.useEffect(()=>{const H=q=>{var K;if(i.every(J=>q[J]||q.code===J)){var Je;Z(!0),(Je=j.current)==null||Je.focus()}q.code==="Escape"&&(document.activeElement===j.current||(K=j.current)!=null&&K.contains(document.activeElement))&&Z(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[i]),R.useEffect(()=>{if(j.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,$.current=!1)}},[j.current]),R.createElement("section",{ref:n,"aria-label":`${C} ${_}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},D.map((H,q)=>{var K;const[pe,Je]=H.split("-");return b.length?R.createElement("ol",{key:H,dir:g==="auto"?Rm():g,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":B,"data-y-position":pe,"data-x-position":Je,style:{"--front-toast-height":`${((K=T[0])==null?void 0:K.height)||0}px`,"--width":`${pM}px`,"--gap":`${v}px`,...x,...wM(d,u)},onBlur:J=>{$.current&&!J.currentTarget.contains(J.relatedTarget)&&($.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||$.current||($.current=!0,V.current=J.relatedTarget)},onMouseEnter:()=>Z(!0),onMouseMove:()=>Z(!0),onMouseLeave:()=>{le||Z(!1)},onDragEnd:()=>Z(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},b.filter(J=>!J.position&&q===0||J.position===H).map((J,Xt)=>{var cn,Qt;return R.createElement(xM,{key:J.id,icons:E,index:Xt,toast:J,defaultRichColors:y,duration:(cn=m==null?void 0:m.duration)!=null?cn:w,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:s,visibleToasts:S,closeButton:(Qt=m==null?void 0:m.closeButton)!=null?Qt:l,interacting:le,position:H,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,closeButtonAriaLabel:m==null?void 0:m.closeButtonAriaLabel,removeToast:se,toasts:b.filter(It=>It.position==J.position),heights:T.filter(It=>It.position==J.position),setHeights:A,expandByDefault:a,gap:v,expanded:L,swipeDirections:t.swipeDirections})})):null}))}),uw=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,cw=5,dw=3e3;function JM(e,t){const n=p.useRef(null),r=p.useRef(0),s=p.useRef(!0),o=p.useRef(!1),i=p.useRef(t);i.current=t;const a=p.useRef(!1),l=p.useCallback(w=>{var x;((x=n.current)==null?void 0:x.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(w))},[]),c=p.useCallback((w,x)=>{var S;((S=n.current)==null?void 0:S.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:w,rows:x})),a.current=!1):a.current=!0},[]),d=p.useCallback(w=>{l({type:"terminal_input",data:w})},[l]),u=p.useCallback((w,x)=>{l({type:"terminal_resize",cols:w,rows:x})},[l]),f=p.useCallback(()=>{l({type:"chat_subscribe"})},[l]),y=p.useCallback(()=>{if(!s.current||o.current)return;const w=Ao();if(!w){window.location.href="/login";return}o.current=!0;const x=new WebSocket(`${uw}/ws/projects/${e}`);n.current=x,x.onopen=()=>{o.current=!1,r.current=0,x.send(JSON.stringify({type:"auth",token:w}))},x.onmessage=S=>{var g,v,E,C,P,k,b,D;let m;try{m=JSON.parse(S.data)}catch{return}switch(m.type){case"connected":a.current=!1,(v=(g=i.current).onConnected)==null||v.call(g);break;case"terminal_data":(C=(E=i.current).onTerminalData)==null||C.call(E,m.data);break;case"status":(k=(P=i.current).onStatus)==null||k.call(P,m.status);break;case"chat_message":{const T=m;(D=(b=i.current).onChatMessage)==null||D.call(b,T);break}case"error":console.error("[WS] Server error:",m.message);break}},x.onclose=()=>{o.current=!1,n.current=null,s.current&&r.current<cw&&(r.current++,setTimeout(y,dw))},x.onerror=S=>{o.current=!1,console.error("[WS] WebSocket error:",S)}},[e]);return p.useEffect(()=>(s.current=!0,y(),()=>{var w;s.current=!1,(w=n.current)==null||w.close(),n.current=null}),[y]),{subscribeTerminal:c,sendTerminalInput:d,sendTerminalResize:u,subscribeChatMessages:f}}function EM(e){const t=p.useRef(null),n=p.useRef(0),r=p.useRef(!0),s=p.useRef(!1),o=p.useRef(e);o.current=e;const i=p.useCallback(()=>{if(!r.current||s.current)return;const a=Ao();if(!a)return;s.current=!0;const l=new WebSocket(`${uw}/ws/dashboard`);t.current=l,l.onopen=()=>{s.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:a}))},l.onmessage=c=>{var d,u;try{const f=JSON.parse(c.data);f.type==="activity_update"?o.current.onActivityUpdate(f):f.type==="project_stopped"&&((u=(d=o.current).onProjectStopped)==null||u.call(d,f.projectId,f.projectName))}catch{}},l.onclose=()=>{s.current=!1,t.current=null,r.current&&n.current<cw&&(n.current++,setTimeout(i,dw))},l.onerror=c=>{s.current=!1,console.error("[DashboardWS] Error:",c)}},[]);p.useEffect(()=>(r.current=!0,i(),()=>{var a;r.current=!1,(a=t.current)==null||a.close(),t.current=null}),[i])}function kM(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}const Mm=5*36e5;function bM(e){if(!e||e.utilization===void 0||e.utilization<=0||!e.resetAt)return null;const t=new Date(e.resetAt).getTime()-Date.now();if(t<=0)return null;const n=Mm-t;return n<=0?null:Math.round(e.utilization/(n/Mm))}function di({label:e,bucket:t}){if(!t||t.utilization===void 0)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",s=kM(t.resetAt);return h.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",h.jsxs("span",{className:Q("font-medium",r),children:[n,"%"]}),s&&h.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",s,")"]})]})}function CM({className:e}){const[t,n]=p.useState("loading"),[r,s]=p.useState(!1);p.useEffect(()=>{const f=async()=>{try{n(await xx())}catch{n(null)}};f();const y=setInterval(()=>void f(),5*60*1e3);return()=>clearInterval(y)},[]);const o=async()=>{s(!0);try{n(await wx())}catch{n(null)}finally{s(!1)}};if(t==="loading"||!t)return null;const i=!!t.fiveHour,a=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,d=i||a||l||c,u=bM(t.fiveHour);return h.jsxs("div",{className:Q("flex items-center gap-1.5 text-xs",e),children:[u!==null&&h.jsxs("span",{className:Q("font-medium",u<=100?"text-green-400":"text-orange-400"),title:`5h 使用进度:按当前速率,窗口结束时预计使用 ${u}%`,children:[u,"%"]}),t.planName&&h.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),d&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"|"}),h.jsx(di,{label:"5h",bucket:t.fiveHour}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(di,{label:"7d",bucket:t.sevenDay})]}),l&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(di,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(di,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),h.jsx("button",{onClick:()=>void o(),className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:h.jsx(KN,{className:Q("h-3 w-3",r&&"animate-spin")})})]})}function PM(){const[e,t]=p.useState([]),[n,r]=p.useState(!1),[s,o]=p.useState(""),[i,a]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(null),[f,y]=p.useState(""),[w,x]=p.useState(""),[S,m]=p.useState(""),g=p.useRef(null),v=p.useRef(null);p.useEffect(()=>{mx().then(t).catch(()=>t([]))},[]),p.useEffect(()=>{n&&setTimeout(()=>{var k;return(k=g.current)==null?void 0:k.focus()},0)},[n]),p.useEffect(()=>{d&&setTimeout(()=>{var k;return(k=v.current)==null?void 0:k.focus()},0)},[d]);const E=async()=>{const k=i.trim();if(k)try{const b=await gx({label:s.trim()||k,command:k,...l?{parentId:l}:{}});t(D=>[...D,b]),o(""),a(""),c(""),r(!1)}catch(b){console.error("[GlobalShortcuts] Failed to add:",b)}},C=async k=>{try{await vx(k),t(b=>b.filter(D=>D.id!==k)),d===k&&u(null)}catch(b){console.error("[GlobalShortcuts] Failed to delete:",b)}},P=async()=>{const k=w.trim();if(!(!k||!d))try{const b=await yx(d,{label:f.trim()||k,command:k,parentId:S||null});t(D=>D.map(T=>T.id===d?b:T)),u(null)}catch(b){console.error("[GlobalShortcuts] Failed to save:",b)}};return h.jsxs("section",{className:"mt-10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(pm,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),h.jsxs("button",{onClick:()=>{r(k=>!k),u(null)},className:Q("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[h.jsx(ga,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&h.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[h.jsx("input",{ref:g,placeholder:"名称(可选)",value:s,onChange:k=>o(k.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{placeholder:"命令内容…",value:i,onChange:k=>a(k.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),E()),k.key==="Escape"&&(r(!1),o(""),a(""),c(""))}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Zl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:l,onChange:k=>c(k.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.map(k=>h.jsx("option",{value:k.id,children:k.label},k.id))]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>{r(!1),o(""),a("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void E(),disabled:!i.trim(),className:Q("text-sm px-3 py-1 rounded transition-colors text-white",i.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),e.length===0&&!n?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[h.jsx(pm,{className:"h-6 w-6"}),h.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(k=>d===k.id?h.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[h.jsx("input",{ref:v,value:f,onChange:b=>y(b.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{value:w,onChange:b=>x(b.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),P()),b.key==="Escape"&&u(null)}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Zl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:S,onChange:b=>m(b.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.filter(b=>b.id!==k.id).map(b=>h.jsx("option",{value:b.id,children:b.label},b.id))]})]}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>u(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void P(),disabled:!w.trim(),className:Q("text-xs px-2.5 py-1 rounded transition-colors text-white",w.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},k.id):h.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[h.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:k.label}),k.parentId&&(()=>{const b=e.find(D=>D.id===k.parentId);return b?h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(Zl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",b.label]})]}):null})(),!k.parentId&&k.label!==k.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:k.command}),h.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>{u(k.id),y(k.label),x(k.command),m(k.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:h.jsx(Cx,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>void C(k.id),className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:h.jsx(ff,{className:"h-3.5 w-3.5"})})]})]},k.id))})]})}const fw=p.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function TM(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function NM(){return p.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>TM())}function jM({children:e}){const[t,n]=p.useState(()=>sx(pr.theme,"system")),r=NM(),s=t==="system"?r:t;p.useEffect(()=>{const i=document.documentElement;i.classList.remove("light","dark"),i.classList.add(s)},[s]);const o=i=>{n(i),ox(pr.theme,i)};return h.jsx(fw.Provider,{value:{theme:t,resolved:s,setTheme:o},children:e})}function RM(){return p.useContext(fw)}function MM(){const{theme:e,setTheme:t}=RM(),n=[{value:"light",icon:ZN,label:"浅色"},{value:"dark",icon:GN,label:"深色"},{value:"system",icon:HN,label:"系统"}];return h.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:r,icon:s,label:o})=>h.jsx("button",{onClick:()=>t(r),className:Q("p-1 rounded-sm transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:h.jsx(s,{className:"h-3.5 w-3.5"})},r))})}const DM={workMinutes:30,breakMinutes:5};function va(){return sx(pr.pomodoroConfig,DM,!0)}function AM(e){Notification.permission==="granted"&&new Notification("番茄钟",{body:e,icon:"/favicon.ico"})}const yf=Ha(e=>({running:!1,phase:"work",secondsLeft:va().workMinutes*60,setRunning:t=>e({running:t}),setPhase:t=>e({phase:t}),setSecondsLeft:t=>e({secondsLeft:t})}));function LM(){const{running:e,phase:t,secondsLeft:n,setPhase:r,setSecondsLeft:s}=yf(),o=p.useCallback(i=>{const a=va();r(i),s(i==="work"?a.workMinutes*60:a.breakMinutes*60),AM(i==="break"?"休息一下 ☕":"该工作了 💻")},[r,s]);return p.useEffect(()=>{if(!e)return;if(n===0){o(t==="work"?"break":"work");return}const i=setTimeout(()=>s(n-1),1e3);return()=>clearTimeout(i)},[e,n,t,o,s]),null}function _M(){const{running:e,phase:t,secondsLeft:n}=yf(),r=Math.floor(n/60),s=n%60,o=`${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return e?Oa.createPortal(h.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center pointer-events-none z-40 select-none",style:{opacity:t==="work"?.1:.6},children:[h.jsx("div",{className:Q("font-mono font-bold tabular-nums leading-none",t==="work"?"text-foreground":"text-blue-400 dark:text-blue-300"),style:{fontSize:"clamp(360px, 90vw, 1100px)"},children:o}),h.jsx("div",{className:"mt-3 text-muted-foreground font-medium tracking-widest uppercase",style:{fontSize:"clamp(12px, 1.5vw, 20px)"},children:t==="work"?"专注工作":"休息一下"})]}),document.body):null}function OM(){const{running:e,phase:t,secondsLeft:n,setRunning:r,setPhase:s,setSecondsLeft:o}=yf(),i=Math.floor(n/60),a=n%60,l=`${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`,c=()=>{if(e){const d=va();s("work"),o(d.workMinutes*60)}else{const d=va();s("work"),o(d.workMinutes*60),Notification.permission==="default"&&Notification.requestPermission()}r(!e)};return h.jsx("button",{onClick:c,className:Q("p-1 rounded transition-colors",e?t==="work"?"text-red-500 bg-red-500/10 hover:bg-red-500/20":"text-green-500 bg-green-500/10 hover:bg-green-500/20":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:e?t==="work"?`工作中 ${l} — 点击停止`:`休息中 ${l} — 点击停止`:"启动番茄钟",children:h.jsx(qN,{className:"h-4 w-4"})})}function IM(){const e=Va(),{projects:t,loading:n,error:r,fetchProjects:s,addProject:o,updateProject:i,removeProject:a}=dm(),l=wr(N=>N.clearToken),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[y,w]=p.useState(new Set),x=p.useRef(new Map),[S,m]=p.useState(new Map),g=p.useRef(0),[v,E]=p.useState(!!document.fullscreenElement),[C,P]=p.useState(!1),[k,b]=p.useState(""),[D,T]=p.useState([]),[A,L]=p.useState(!1);p.useEffect(()=>{if(!k.trim()||k.trim().length<2){T([]);return}const N=setTimeout(()=>{L(!0),kx(k).then(z=>T(z)).catch(()=>T([])).finally(()=>L(!1))},400);return()=>clearTimeout(N)},[k]);const Z=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};p.useEffect(()=>{const N=()=>E(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",N),()=>document.removeEventListener("fullscreenchange",N)},[]),p.useEffect(()=>{s()},[s]),p.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]);const le=2e3,ge=3,B=8e3,re=p.useCallback(N=>{if(N.status){const te=dm.getState().projects.find(ue=>ue.id===N.projectId);te&&te.status!==N.status&&i({...te,status:N.status})}const z=Date.now(),Y=x.current;if(z-N.lastActivityAt<le){w(ye=>ye.has(N.projectId)?ye:new Set(ye).add(N.projectId));const te=Y.get(N.projectId)??[];let ue=!1;if(N.semantic){const ye=te[te.length-1],Zn=`${N.semantic.phase}:${N.semantic.detail??""}`,fn=ye?`${ye.phase}:${ye.detail??""}`:"";Zn!==fn?(te.push({id:g.current++,phase:N.semantic.phase,detail:N.semantic.detail,ts:z}),ue=!0):ye&&(ye.ts=z)}const Te=te.filter(ye=>z-ye.ts<B),Ge=Te.length>ge?Te.slice(-ge):Te;Ge.length!==te.length&&(ue=!0),Y.set(N.projectId,Ge),ue&&m(new Map(Y))}else w(te=>{if(!te.has(N.projectId))return te;const ue=new Set(te);return ue.delete(N.projectId),ue}),Y.has(N.projectId)&&Y.get(N.projectId).length>0&&(Y.set(N.projectId,[]),m(new Map(Y)))},[]),j=p.useCallback((N,z)=>{"Notification"in window&&Notification.permission==="granted"?new Notification("Claude 已完成",{body:`项目「${z}」的任务已完成`,icon:"/terminal.svg"}):Ls.success(`项目「${z}」的任务已完成`,{duration:8e3})},[]);EM({onActivityUpdate:re,onProjectStopped:j}),p.useEffect(()=>{const N=setInterval(()=>{const z=Date.now(),Y=x.current;let te=!1;for(const[ue,Te]of Y){const Ge=Te.filter(ye=>z-ye.ts<B);Ge.length!==Te.length&&(Y.set(ue,Ge),te=!0)}te&&m(new Map(Y)),w(ue=>{let Te=!1;const Ge=new Set(ue);for(const ye of ue){const Zn=Y.get(ye);(!Zn||Zn.length===0)&&(Ge.delete(ye),Te=!0)}return Te?Ge:ue})},3e3);return()=>clearInterval(N)},[]);const _=()=>{l(),e("/login")},V=N=>{o(N)},$=N=>{o(N)},se=async N=>{try{await fx(N),a(N)}catch(z){Ls.error(z instanceof Error?z.message:"Failed to delete project")}},H=async N=>{try{const z=await hx(N);i(z)}catch(z){Ls.error(z instanceof Error?z.message:"Failed to archive project")}},q=async N=>{try{const z=await px(N);i(z)}catch(z){Ls.error(z instanceof Error?z.message:"Failed to restore project")}},K=p.useMemo(()=>t.filter(N=>!N.archived),[t]),pe=p.useMemo(()=>t.filter(N=>N.archived),[t]),Je=p.useMemo(()=>Array.from(new Set(t.flatMap(N=>N.tags??[]))),[t]),[J,Xt]=p.useState([]),cn=p.useMemo(()=>J.length===0?K:K.filter(N=>J.some(z=>{var Y;return(Y=N.tags)==null?void 0:Y.includes(z)})),[K,J]),[Qt,It]=_T(pr.projectOrder,[],{parse:!0}),[gs,Xn]=p.useState(null),[tl,Qn]=p.useState(null);p.useEffect(()=>{if(K.length===0)return;const N=K.map(z=>z.id);It(z=>{const Y=z.filter(Te=>N.includes(Te)),te=N.filter(Te=>!z.includes(Te)),ue=[...Y,...te];return ue.join(",")===z.join(",")?z:ue})},[K]);const dn=p.useMemo(()=>Qt.length===0?cn:[...cn].sort((N,z)=>{const Y=Qt.indexOf(N.id),te=Qt.indexOf(z.id);return Y===-1?1:te===-1?-1:Y-te}),[cn,Qt]),Lo=p.useCallback(N=>Xn(N),[]),kt=p.useCallback(()=>{Xn(null),Qn(null)},[]),nl=p.useCallback((N,z)=>{N.preventDefault(),Qn(z)},[]),rl=p.useCallback((N,z,Y)=>{if(N.preventDefault(),!Y||Y===z){Qn(null);return}It(te=>{const ue=[...te],Te=ue.indexOf(Y),Ge=ue.indexOf(z);return Te===-1||Ge===-1?te:(ue.splice(Te,1),ue.splice(Ge,0,Y),ue)}),Xn(null),Qn(null)},[It]),ze={onDelete:N=>void se(N),onArchive:N=>void H(N),onUnarchive:N=>void q(N),onUpdated:i};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(hm,{className:"h-5 w-5"}),h.jsx("span",{className:"font-semibold text-lg",children:"CC Web"})]}),h.jsx(CM,{}),h.jsxs("div",{className:"relative",children:[h.jsx(YN,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),h.jsx(vo,{placeholder:"搜索历史对话…",value:k,onChange:N=>b(N.target.value),className:"pl-8 h-8 text-xs w-48"}),k.trim().length>=2&&h.jsxs("div",{className:"absolute top-full mt-1 right-0 w-96 max-h-80 overflow-y-auto bg-popover border border-border rounded-lg shadow-xl z-50",children:[A&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"搜索中…"}),!A&&D.length===0&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"无结果"}),D.map((N,z)=>h.jsxs("button",{className:"w-full text-left px-4 py-2.5 hover:bg-muted transition-colors border-b border-border last:border-0",onClick:()=>{e(`/project/${N.projectId}`),b("")},children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:N.projectName}),h.jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:new Date(N.startedAt).toLocaleDateString("zh-CN")})]}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed line-clamp-2",children:N.snippet})]},z))]})]}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:h.jsx(QN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:h.jsx(XN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:Z,title:v?"Exit fullscreen":"Fullscreen",children:v?h.jsx(WN,{className:"h-4 w-4"}):h.jsx(UN,{className:"h-4 w-4"})}),h.jsx(OM,{}),h.jsx(MM,{}),h.jsxs(ie,{variant:"ghost",size:"sm",onClick:_,children:[h.jsx($N,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),h.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),h.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Pc,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ga,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),n&&h.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),r&&h.jsx("div",{className:"text-center text-destructive py-12",children:r}),!n&&!r&&t.length===0&&h.jsxs("div",{className:"text-center py-20",children:[h.jsx(hm,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),h.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),h.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),h.jsxs("div",{className:"flex gap-2 justify-center",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Pc,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ga,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!n&&!r&&Je.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[Je.map(N=>h.jsxs("button",{onClick:()=>Xt(z=>z.includes(N)?z.filter(Y=>Y!==N):[...z,N]),className:Q("px-2 py-0.5 rounded-full text-xs border transition-colors",J.includes(N)?"bg-blue-500/20 text-blue-400 border-blue-500/40":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",N]},N)),J.length>0&&h.jsx("button",{onClick:()=>Xt([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:"清除"})]}),!n&&!r&&dn.length>0&&h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:dn.map((N,z)=>h.jsx(Vn.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:z*.05,ease:"easeOut"},draggable:!0,onDragStart:()=>Lo(N.id),onDragOver:Y=>nl(Y,N.id),onDrop:Y=>rl(Y,N.id,gs),onDragEnd:kt,style:{opacity:gs===N.id?.4:1,cursor:"grab"},className:Q(tl===N.id&&gs!==N.id&&"ring-2 ring-blue-500/50 rounded-xl"),children:h.jsx(Tm,{project:N,active:y.has(N.id),statusStack:S.get(N.id)??[],...ze})},N.id))}),!n&&!r&&pe.length>0&&h.jsxs("div",{className:"mt-10",children:[h.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>P(N=>!N),children:[h.jsx(Vn.span,{animate:{rotate:C?90:0},transition:{duration:.2},children:h.jsx(bx,{className:"h-4 w-4"})}),h.jsx("span",{className:"font-medium",children:"Archived"}),h.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:pe.length})]}),h.jsx(tf,{children:C&&h.jsx(Vn.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:pe.map(N=>h.jsx(Tm,{project:N,active:!1,...ze},N.id))})})})]}),h.jsx(PM,{})]}),h.jsx(KR,{open:c,onOpenChange:d,onCreated:V}),h.jsx(YR,{open:u,onOpenChange:f,onOpened:$})]})}class VM extends R.Component{constructor(){super(...arguments);ol(this,"state",{hasError:!1,error:null});ol(this,"handleReset",()=>{var n,r;this.setState({hasError:!1,error:null}),(r=(n=this.props).onReset)==null||r.call(n)})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary]",n,r.componentStack),Ls.error(n.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[h.jsx("p",{children:"出错了"}),h.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted transition-colors",children:"重新加载"})]}):this.props.children}}const FM=R.lazy(()=>Po(()=>import("./ProjectPage-B8Tdoz_M.js").then(e=>e.P),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.ProjectPage}))),zM=R.lazy(()=>Po(()=>import("./SettingsPage-C8572fFD.js"),__vite__mapDeps([7,3,1])).then(e=>({default:e.SettingsPage}))),BM=R.lazy(()=>Po(()=>import("./SkillHubPage-BHgZp94q.js"),__vite__mapDeps([8,5,2,3])).then(e=>({default:e.SkillHubPage}))),$M=R.lazy(()=>Po(()=>import("./ShareViewPage-PTSFe5df.js"),__vite__mapDeps([9,5,4])).then(e=>({default:e.ShareViewPage})));function UM(){return h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function fi({children:e}){const[t,n]=p.useState(!1),r=wr(o=>o.token),s=wr(o=>o.setToken);return p.useEffect(()=>{if(r){n(!0);return}ma()?df().then(o=>s(o)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),!t&&!r?null:r?h.jsx(h.Fragment,{children:e}):h.jsx(sv,{to:"/login",replace:!0})}function WM(){return h.jsxs(jM,{children:[h.jsx(SM,{richColors:!0,position:"bottom-right"}),h.jsx(LM,{}),h.jsx(_M,{}),h.jsx(VM,{children:h.jsx(BE,{children:h.jsx(p.Suspense,{fallback:h.jsx(UM,{}),children:h.jsxs(VE,{children:[h.jsx(yn,{path:"/login",element:h.jsx(MN,{})}),h.jsx(yn,{path:"/",element:h.jsx(fi,{children:h.jsx(IM,{})})}),h.jsx(yn,{path:"/projects/:id",element:h.jsx(fi,{children:h.jsx(FM,{})})}),h.jsx(yn,{path:"/settings",element:h.jsx(fi,{children:h.jsx(zM,{})})}),h.jsx(yn,{path:"/skillhub",element:h.jsx(fi,{children:h.jsx(BM,{})})}),h.jsx(yn,{path:"/share/:token",element:h.jsx($M,{})}),h.jsx(yn,{path:"*",element:h.jsx(sv,{to:"/",replace:!0})})]})})})})]})}iu.createRoot(document.getElementById("root")).render(h.jsx(R.StrictMode,{children:h.jsx(WM,{})}));export{JT as $,tf as A,ie as B,bx as C,kN as D,VN as E,Pc as F,YT as G,mx as H,vo as I,Zl as J,ZT as K,gf as L,WN as M,Qa as N,Za as O,Cx as P,Ja as Q,R,pr as S,el as T,jn as U,qa as V,QT as W,ff as X,XT as Y,pm as Z,Po as _,KM as a,CN as a0,HT as a1,GT as a2,PN as a3,Va as a4,ON as a5,rr as a6,OM as a7,MM as a8,fN as a9,zx as aA,Rx as aB,Nx as aC,aN as aD,uN as aE,dN as aF,of as aG,af as aH,lf as aI,uf as aJ,Px as aK,va as aL,vN as aM,qN as aN,lN as aO,hN as aP,mN as aQ,yN as aR,cN as aS,gN as aT,pN as aU,xN as aV,qT as aW,eN as aX,TN as aY,YM as aZ,WT as aa,YN as ab,NN as ac,LT as ad,jN as ae,QN as af,JM as ag,CM as ah,XM as ai,_T as aj,dm as ak,hm as al,xo as am,br as an,ij as ao,un as ap,Fn as aq,tj as ar,Wa as as,ql as at,wo as au,Ka as av,Oa as aw,Dx as ax,ER as ay,Oj as az,Ao as b,ee as c,rN as d,Q as e,UN as f,Dm as g,tN as h,sx as i,h as j,ZM as k,Sx as l,KN as m,nN as n,fm as o,Vn as p,wN as q,p as r,ox as s,Ls as t,RM as u,IN as v,sN as w,ga as x,SN as y,EN as z};
|
|
280
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},IR="DialogDescriptionWarning",VR=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nw(IR).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},FR=Ux,zR=Gx,rw=Kx,sw=Yx,ow=Qx,iw=qx,BR=ew;const gf=FR,$R=zR,aw=p.forwardRef(({className:e,...t},n)=>h.jsx(rw,{ref:n,className:Q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));aw.displayName=rw.displayName;const Qa=p.forwardRef(({className:e,children:t,noOverlay:n,...r},s)=>h.jsxs($R,{children:[!n&&h.jsx(aw,{}),h.jsxs(sw,{ref:s,className:Q("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,h.jsxs(BR,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(ff,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Qa.displayName=sw.displayName;const Za=({className:e,...t})=>h.jsx("div",{className:Q("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Za.displayName="DialogHeader";const qa=({className:e,...t})=>h.jsx("div",{className:Q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qa.displayName="DialogFooter";const Ja=p.forwardRef(({className:e,...t},n)=>h.jsx(ow,{ref:n,className:Q("text-lg font-semibold leading-none tracking-tight",e),...t}));Ja.displayName=ow.displayName;const el=p.forwardRef(({className:e,...t},n)=>h.jsx(iw,{ref:n,className:Q("text-sm text-muted-foreground",e),...t}));el.displayName=iw.displayName;function UR({project:e,open:t,onOpenChange:n,onUpdated:r}){const[s,o]=p.useState([]),[i,a]=p.useState([]),[l,c]=p.useState(!1),[d,u]=p.useState(null);p.useEffect(()=>{if(!t)return;o(e.shares?[...e.shares]:[]),u(null);let g=!1;return lx().then(v=>{g||a(v)}).catch(()=>{}),()=>{g=!0}},[t,e.id]);const f=new Set(s.map(g=>g.username)),y=i.filter(g=>g!==e.owner&&!f.has(g)),w=g=>{o(v=>[...v,{username:g,permission:"view"}])},x=g=>{o(v=>v.filter(E=>E.username!==g))},S=g=>{o(v=>v.map(E=>E.username===g?{...E,permission:E.permission==="view"?"edit":"view"}:E))},m=async()=>{c(!0),u(null);try{const g=await ux(e.id,s);r(g),n(!1)}catch(g){u(g instanceof Error?g.message:"Failed to update shares")}finally{c(!1)}};return h.jsx(gf,{open:t,onOpenChange:n,children:h.jsxs(Qa,{className:"sm:max-w-md",children:[h.jsxs(Za,{children:[h.jsxs(Ja,{className:"flex items-center gap-2",children:[h.jsx(Tc,{className:"h-4 w-4"}),"共享设置"]}),h.jsx(el,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),h.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[s.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),s.map(g=>h.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[h.jsx("span",{className:"text-sm font-medium",children:g.username}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:()=>S(g.username),className:"focus:outline-none",children:h.jsx(rr,{variant:g.permission==="edit"?"default":"secondary",className:"cursor-pointer text-xs",children:g.permission==="edit"?"可编辑":"可见"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>x(g.username),children:h.jsx(Px,{className:"h-3.5 w-3.5"})})]})]},g.username))]}),y.length>0&&h.jsxs("div",{className:"border-t pt-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map(g=>h.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>w(g),children:[h.jsx(ga,{className:"h-3 w-3"}),g]},g))})]}),d&&h.jsx("p",{className:"text-sm text-destructive",children:d}),h.jsxs(qa,{children:[h.jsx(ie,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),h.jsx(ie,{onClick:()=>void m(),disabled:l,children:l?"保存中...":"保存"})]})]})})}function WR(e,t){switch(e){case"thinking":return"Thinking…";case"tool_use":return t?`${t}`:"Tool…";case"tool_result":return"Reading…";case"text":return"Writing…"}}function HR({status:e}){return h.jsx("span",{className:Q("inline-block w-2 h-2 rounded-full",{"bg-green-500":e==="running","bg-zinc-400":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})})}const Tm=R.memo(function({project:t,active:n=!1,statusStack:r=[],onDelete:s,onArchive:o,onUnarchive:i,onUpdated:a}){var g,v;const l=Va(),[c,d]=p.useState(!1),u=!!t._sharedPermission,f=t._sharedPermission==="view",y=E=>{E.stopPropagation(),confirm(`Delete project "${t.name}"? This cannot be undone.`)&&s(t.id)},w=E=>{E.stopPropagation(),o(t.id)},x=E=>{E.stopPropagation(),i(t.id)},S=h.jsx(Vn.div,{whileHover:!t.archived&&!n?{y:-2}:{},transition:{duration:.2},children:h.jsxs(of,{className:Q("group cursor-pointer transition-colors relative",t.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":n?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!t.archived&&l(`/projects/${t.id}`),children:[h.jsxs(af,{className:"pb-2",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(lf,{className:Q("text-base leading-tight",t.archived&&"text-muted-foreground"),children:t.name}),h.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!u&&h.jsxs(h.Fragment,{children:[t.archived?h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:x,title:"Restore project",children:h.jsx(LN,{className:"h-3.5 w-3.5"})}):h.jsxs(h.Fragment,{children:[h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:E=>{E.stopPropagation(),d(!0)},title:"共享设置",children:h.jsx(Tc,{className:"h-3.5 w-3.5"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:w,title:"Archive project",children:h.jsx(_N,{className:"h-3.5 w-3.5"})})]}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:y,title:"Delete project",children:h.jsx(Px,{className:"h-3.5 w-3.5"})})]})})]}),h.jsx("div",{className:"flex items-center gap-1.5",children:t.archived?h.jsx(rr,{variant:"secondary",className:"text-xs",children:"Archived"}):h.jsxs(h.Fragment,{children:[h.jsx(HR,{status:t.status}),h.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:t.status}),n&&r.length>0&&h.jsx("div",{className:"ml-auto",children:h.jsx(tf,{mode:"wait",children:r.slice(-1).map(E=>h.jsx(Vn.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25,ease:"easeOut"},children:h.jsx(rr,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:WR(E.phase,E.detail)})},E.id))})})]})})]}),h.jsxs(uf,{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx(Pc,{className:"h-3.5 w-3.5 flex-shrink-0"}),h.jsx("span",{className:"truncate font-mono",children:t.folderPath})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(rr,{variant:"outline",className:"text-xs font-mono",children:t.cliTool??"claude"}),h.jsx(rr,{variant:t.permissionMode==="unlimited"?"destructive":"secondary",className:"text-xs",children:t.permissionMode==="unlimited"?"Unlimited":"Limited"}),u&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[f?h.jsx(VN,{className:"h-3 w-3"}):h.jsx(Cx,{className:"h-3 w-3"}),f?"可见":"可编辑"]}),!u&&t.shares&&t.shares.length>0&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[h.jsx(Tc,{className:"h-3 w-3"}),t.shares.length]}),h.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleDateString()})]}),(t.tags??[]).length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(t.tags??[]).slice(0,3).map(E=>h.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",E]},E)),(((g=t.tags)==null?void 0:g.length)??0)>3&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",(((v=t.tags)==null?void 0:v.length)??0)-3]})]})]})]})}),m=n&&!t.archived?h.jsx("div",{className:"card-active-glow rounded-lg",children:S}):S;return h.jsxs(h.Fragment,{children:[m,!u&&a&&h.jsx(UR,{project:t,open:c,onOpenChange:d,onUpdated:a})]})});function lw({onSelect:e}){const[t,n]=p.useState(""),[r,s]=p.useState(null),[o,i]=p.useState([]),[a,l]=p.useState(!0),[c,d]=p.useState(null),[u,f]=p.useState(!1),[y,w]=p.useState(""),[x,S]=p.useState(null),[m,g]=p.useState(!1),v=p.useRef(null),E=async A=>{l(!0),d(null);try{const L=await Sx(A);n(L.path),s(L.parent),i(L.entries)}catch(L){d(L instanceof Error?L.message:"Failed to load directory")}finally{l(!1)}};p.useEffect(()=>{E()},[]),p.useEffect(()=>{u&&setTimeout(()=>{var A;return(A=v.current)==null?void 0:A.focus()},0)},[u]);const C=()=>{w(""),S(null),f(!0)},P=()=>{f(!1),w(""),S(null)},k=async()=>{const A=y.trim();if(A){g(!0),S(null);try{const{path:L}=await Ex(t,A);f(!1),w(""),await E(t),E(L)}catch(L){S(L instanceof Error?L.message:"Failed to create folder")}finally{g(!1)}}},b=A=>{A.key==="Enter"?(A.preventDefault(),k()):A.key==="Escape"&&P()},D=t.split("/").filter(Boolean),T=A=>{const L="/"+D.slice(0,A+1).join("/");E(L)};return h.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[h.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>void E(),title:"Home",children:h.jsx(BN,{className:"h-3 w-3"})}),h.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:D.map((A,L)=>h.jsxs(R.Fragment,{children:[h.jsx(bx,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),h.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>T(L),children:A})]},L))}),h.jsxs(ie,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:C,disabled:u||a||!!c,title:"New folder",children:[h.jsx(zN,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!a&&!c&&h.jsxs("div",{className:"p-1",children:[r&&h.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>void E(r),children:[h.jsx(ON,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:".."})]}),u&&h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[h.jsx(fm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),h.jsx("input",{ref:v,className:Q("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",x&&"border-destructive"),placeholder:"Folder name",value:y,onChange:A=>{w(A.target.value),S(null)},onKeyDown:b,disabled:m}),h.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>void k(),disabled:!y.trim()||m,title:"Create",children:h.jsx(IN,{className:"h-3.5 w-3.5 text-green-600"})}),h.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:P,disabled:m,title:"Cancel",children:h.jsx(ff,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),x&&h.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:x}),o.length===0&&!u&&h.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),o.map(A=>h.jsxs("button",{className:Q("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left",A.type==="dir"?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{A.type==="dir"&&E(A.path)},disabled:A.type==="file",children:[A.type==="dir"?h.jsx(fm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):h.jsx(FN,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"truncate",children:A.name})]},A.path))]})]}),h.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),h.jsx(ie,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const GR=[{value:"claude",label:"Claude",desc:"Anthropic Claude Code CLI"},{value:"opencode",label:"OpenCode",desc:"OpenCode CLI (sst/opencode)"},{value:"codex",label:"Codex",desc:"OpenAI Codex CLI"},{value:"qwen",label:"Qwen",desc:"Qwen Code CLI (QwenLM)"}],Nm={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"}};function KR({open:e,onOpenChange:t,onCreated:n}){const[r,s]=p.useState("name"),[o,i]=p.useState(""),[a,l]=p.useState(""),[c,d]=p.useState("claude"),[u,f]=p.useState("limited"),[y,w]=p.useState(!1),[x,S]=p.useState(null),m=()=>{s("name"),i(""),l(""),d("claude"),f("limited"),S(null),w(!1)},g=b=>{b||m(),t(b)},v=()=>{if(!o.trim()){S("Please enter a project name");return}S(null),s("folder")},E=b=>{l(b),s("settings")},C=async()=>{w(!0),S(null);try{const b=await cx({name:o.trim(),folderPath:a,permissionMode:u,cliTool:c});n(b),g(!1)}catch(b){S(b instanceof Error?b.message:"Failed to create project")}finally{w(!1)}},P={name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"},k=["name","folder","settings"];return h.jsx(gf,{open:e,onOpenChange:g,children:h.jsxs(Qa,{className:"sm:max-w-lg",children:[h.jsxs(Za,{children:[h.jsx(Ja,{children:P[r]}),h.jsxs(el,{children:[r==="name"&&"Give your project a name.",r==="folder"&&"Choose the working directory for this project.",r==="settings"&&"Choose the AI coding tool and run mode."]})]}),h.jsx("div",{className:"flex gap-2 mb-2",children:k.map((b,D)=>h.jsx("div",{className:`h-1.5 flex-1 rounded-full ${r===b?"bg-primary":k.indexOf(r)>D?"bg-primary/40":"bg-muted"}`},b))}),r==="name"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"project-name",children:"Project Name"}),h.jsx(vo,{id:"project-name",placeholder:"My Project",value:o,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&v()},autoFocus:!0})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),r==="folder"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Working Directory"}),h.jsx(lw,{onSelect:E})]}),r==="settings"&&h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"AI Coding Tool"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:GR.map(b=>h.jsxs("label",{className:`flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors ${c===b.value?"border-primary bg-primary/5":"hover:bg-accent"}`,children:[h.jsx("input",{type:"radio",name:"cliTool",value:b.value,checked:c===b.value,onChange:()=>d(b.value),className:"accent-primary"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:b.label}),h.jsx("div",{className:"text-xs text-muted-foreground",children:b.desc})]})]},b.value))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Permission Mode"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:u==="limited",onChange:()=>f("limited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Limited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:Nm[c].limited})," — asks for permission before file changes."]})]})]}),h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:u==="unlimited",onChange:()=>f("unlimited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:Nm[c].unlimited})," — acts autonomously."]})]})]})]})]}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Folder:"})," ",h.jsx("span",{className:"font-mono",children:a})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),h.jsxs(qa,{children:[r!=="name"&&h.jsx(ie,{variant:"outline",onClick:()=>s(r==="settings"?"folder":"name"),disabled:y,children:"Back"}),r==="name"&&h.jsx(ie,{onClick:v,children:"Next"}),r==="folder"&&h.jsx(ie,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r==="settings"&&h.jsx(ie,{onClick:()=>void C(),disabled:y,children:y?"Creating...":"Create Project"})]})]})})}function YR({open:e,onOpenChange:t,onOpened:n}){const[r,s]=p.useState(""),[o,i]=p.useState(!1),[a,l]=p.useState(null),c=()=>{s(""),l(null),i(!1)},d=f=>{f||c(),t(f)},u=async f=>{s(f),i(!0),l(null);try{const y=await dx(f);n(y),d(!1)}catch(y){l(y instanceof Error?y.message:"Failed to open project"),i(!1)}};return h.jsx(gf,{open:e,onOpenChange:d,children:h.jsxs(Qa,{className:"sm:max-w-lg",children:[h.jsxs(Za,{children:[h.jsx(Ja,{children:"Open Existing Project"}),h.jsxs(el,{children:["Select a folder that contains a ",h.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Project Folder"}),h.jsx(lw,{onSelect:f=>void u(f)})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a}),r&&!a&&o&&h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),h.jsx(qa,{children:h.jsx(ie,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"})})]})})}function XR(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const QR=e=>{switch(e){case"success":return JR;case"info":return tM;case"warning":return eM;case"error":return nM;default:return null}},ZR=Array(12).fill(0),qR=({visible:e,className:t})=>R.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},R.createElement("div",{className:"sonner-spinner"},ZR.map((n,r)=>R.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),JR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),tM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),rM=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},R.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),R.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),sM=()=>{const[e,t]=R.useState(document.hidden);return R.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Rc=1;class oM{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Rc++,i=this.toasts.find(l=>l.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async c=>{if(i=["resolve",c],R.isValidElement(c))o=!1,this.create({id:r,type:"default",message:c});else if(aM(c)&&!c.ok){o=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(c instanceof Error){o=!1;const u=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(n.success!==void 0){o=!1;const u=typeof n.success=="function"?await n.success(c):n.success,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:f,...w})}}).catch(async c=>{if(i=["reject",c],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(c):n.error,u=typeof n.description=="function"?await n.description(c):n.description,y=typeof d=="object"&&!R.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:u,...y})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,d)=>a.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||Rc++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const et=new oM,iM=(e,t)=>{const n=(t==null?void 0:t.id)||Rc++;return et.addToast({title:e,...t,id:n}),n},aM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lM=iM,uM=()=>et.toasts,cM=()=>et.getActiveToasts(),Ls=Object.assign(lM,{success:et.success,info:et.info,warning:et.warning,error:et.error,custom:et.custom,message:et.message,promise:et.promise,dismiss:et.dismiss,loading:et.loading},{getHistory:uM,getToasts:cM});XR("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ci(e){return e.label!==void 0}const dM=3,fM="24px",hM="16px",jm=4e3,pM=356,mM=14,gM=45,yM=200;function Ft(...e){return e.filter(Boolean).join(" ")}function vM(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const xM=e=>{var t,n,r,s,o,i,a,l,c;const{invert:d,toast:u,unstyled:f,interacting:y,setHeights:w,visibleToasts:x,heights:S,index:m,toasts:g,expanded:v,removeToast:E,defaultRichColors:C,closeButton:P,style:k,cancelButtonStyle:b,actionButtonStyle:D,className:T="",descriptionClassName:A="",duration:L,position:Z,gap:le,expandByDefault:ge,classNames:B,icons:re,closeButtonAriaLabel:j="Close toast"}=e,[_,V]=R.useState(null),[$,se]=R.useState(null),[H,q]=R.useState(!1),[K,pe]=R.useState(!1),[Je,J]=R.useState(!1),[Xt,cn]=R.useState(!1),[Qt,It]=R.useState(!1),[gs,Xn]=R.useState(0),[tl,Qn]=R.useState(0),dn=R.useRef(u.duration||L||jm),Lo=R.useRef(null),kt=R.useRef(null),nl=m===0,rl=m+1<=x,ze=u.type,N=u.dismissible!==!1,z=u.className||"",Y=u.descriptionClassName||"",te=R.useMemo(()=>S.findIndex(U=>U.toastId===u.id)||0,[S,u.id]),ue=R.useMemo(()=>{var U;return(U=u.closeButton)!=null?U:P},[u.closeButton,P]),Te=R.useMemo(()=>u.duration||L||jm,[u.duration,L]),Ge=R.useRef(0),ye=R.useRef(0),Zn=R.useRef(0),fn=R.useRef(null),[hw,pw]=Z.split("-"),vf=R.useMemo(()=>S.reduce((U,Me,Be)=>Be>=te?U:U+Me.height,0),[S,te]),xf=sM(),mw=u.invert||d,sl=ze==="loading";ye.current=R.useMemo(()=>te*le+vf,[te,vf]),R.useEffect(()=>{dn.current=Te},[Te]),R.useEffect(()=>{q(!0)},[]),R.useEffect(()=>{const U=kt.current;if(U){const Me=U.getBoundingClientRect().height;return Qn(Me),w(Be=>[{toastId:u.id,height:Me,position:u.position},...Be]),()=>w(Be=>Be.filter(it=>it.toastId!==u.id))}},[w,u.id]),R.useLayoutEffect(()=>{if(!H)return;const U=kt.current,Me=U.style.height;U.style.height="auto";const Be=U.getBoundingClientRect().height;U.style.height=Me,Qn(Be),w(it=>it.find(Le=>Le.toastId===u.id)?it.map(Le=>Le.toastId===u.id?{...Le,height:Be}:Le):[{toastId:u.id,height:Be,position:u.position},...it])},[H,u.title,u.description,w,u.id,u.jsx,u.action,u.cancel]);const hn=R.useCallback(()=>{pe(!0),Xn(ye.current),w(U=>U.filter(Me=>Me.toastId!==u.id)),setTimeout(()=>{E(u)},yM)},[u,E,w,ye]);R.useEffect(()=>{if(u.promise&&ze==="loading"||u.duration===1/0||u.type==="loading")return;let U;return v||y||xf?(()=>{if(Zn.current<Ge.current){const it=new Date().getTime()-Ge.current;dn.current=dn.current-it}Zn.current=new Date().getTime()})():(()=>{dn.current!==1/0&&(Ge.current=new Date().getTime(),U=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),hn()},dn.current))})(),()=>clearTimeout(U)},[v,y,u,ze,xf,hn]),R.useEffect(()=>{u.delete&&(hn(),u.onDismiss==null||u.onDismiss.call(u,u))},[hn,u.delete]);function gw(){var U;if(re!=null&&re.loading){var Me;return R.createElement("div",{className:Ft(B==null?void 0:B.loader,u==null||(Me=u.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":ze==="loading"},re.loading)}return R.createElement(qR,{className:Ft(B==null?void 0:B.loader,u==null||(U=u.classNames)==null?void 0:U.loader),visible:ze==="loading"})}const yw=u.icon||(re==null?void 0:re[ze])||QR(ze);var wf,Sf;return R.createElement("li",{tabIndex:0,ref:kt,className:Ft(T,z,B==null?void 0:B.toast,u==null||(t=u.classNames)==null?void 0:t.toast,B==null?void 0:B.default,B==null?void 0:B[ze],u==null||(n=u.classNames)==null?void 0:n[ze]),"data-sonner-toast":"","data-rich-colors":(wf=u.richColors)!=null?wf:C,"data-styled":!(u.jsx||u.unstyled||f),"data-mounted":H,"data-promise":!!u.promise,"data-swiped":Qt,"data-removed":K,"data-visible":rl,"data-y-position":hw,"data-x-position":pw,"data-index":m,"data-front":nl,"data-swiping":Je,"data-dismissible":N,"data-type":ze,"data-invert":mw,"data-swipe-out":Xt,"data-swipe-direction":$,"data-expanded":!!(v||ge&&H),"data-testid":u.testId,style:{"--index":m,"--toasts-before":m,"--z-index":g.length-m,"--offset":`${K?gs:ye.current}px`,"--initial-height":ge?"auto":`${tl}px`,...k,...u.style},onDragEnd:()=>{J(!1),V(null),fn.current=null},onPointerDown:U=>{U.button!==2&&(sl||!N||(Lo.current=new Date,Xn(ye.current),U.target.setPointerCapture(U.pointerId),U.target.tagName!=="BUTTON"&&(J(!0),fn.current={x:U.clientX,y:U.clientY})))},onPointerUp:()=>{var U,Me,Be;if(Xt||!N)return;fn.current=null;const it=Number(((U=kt.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_o=Number(((Me=kt.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Le=new Date().getTime()-((Be=Lo.current)==null?void 0:Be.getTime()),pt=_==="x"?it:_o,Oo=Math.abs(pt)/Le;if(Math.abs(pt)>=gM||Oo>.11){Xn(ye.current),u.onDismiss==null||u.onDismiss.call(u,u),se(_==="x"?it>0?"right":"left":_o>0?"down":"up"),hn(),cn(!0);return}else{var bt,Ct;(bt=kt.current)==null||bt.style.setProperty("--swipe-amount-x","0px"),(Ct=kt.current)==null||Ct.style.setProperty("--swipe-amount-y","0px")}It(!1),J(!1),V(null)},onPointerMove:U=>{var Me,Be,it;if(!fn.current||!N||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;const Le=U.clientY-fn.current.y,pt=U.clientX-fn.current.x;var Oo;const bt=(Oo=e.swipeDirections)!=null?Oo:vM(Z);!_&&(Math.abs(pt)>1||Math.abs(Le)>1)&&V(Math.abs(pt)>Math.abs(Le)?"x":"y");let Ct={x:0,y:0};const Ef=qn=>1/(1.5+Math.abs(qn)/20);if(_==="y"){if(bt.includes("top")||bt.includes("bottom"))if(bt.includes("top")&&Le<0||bt.includes("bottom")&&Le>0)Ct.y=Le;else{const qn=Le*Ef(Le);Ct.y=Math.abs(qn)<Math.abs(Le)?qn:Le}}else if(_==="x"&&(bt.includes("left")||bt.includes("right")))if(bt.includes("left")&&pt<0||bt.includes("right")&&pt>0)Ct.x=pt;else{const qn=pt*Ef(pt);Ct.x=Math.abs(qn)<Math.abs(pt)?qn:pt}(Math.abs(Ct.x)>0||Math.abs(Ct.y)>0)&&It(!0),(Be=kt.current)==null||Be.style.setProperty("--swipe-amount-x",`${Ct.x}px`),(it=kt.current)==null||it.style.setProperty("--swipe-amount-y",`${Ct.y}px`)}},ue&&!u.jsx&&ze!=="loading"?R.createElement("button",{"aria-label":j,"data-disabled":sl,"data-close-button":!0,onClick:sl||!N?()=>{}:()=>{hn(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Ft(B==null?void 0:B.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(Sf=re==null?void 0:re.close)!=null?Sf:rM):null,(ze||u.icon||u.promise)&&u.icon!==null&&((re==null?void 0:re[ze])!==null||u.icon)?R.createElement("div",{"data-icon":"",className:Ft(B==null?void 0:B.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||gw():null,u.type!=="loading"?yw:null):null,R.createElement("div",{"data-content":"",className:Ft(B==null?void 0:B.content,u==null||(o=u.classNames)==null?void 0:o.content)},R.createElement("div",{"data-title":"",className:Ft(B==null?void 0:B.title,u==null||(i=u.classNames)==null?void 0:i.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?R.createElement("div",{"data-description":"",className:Ft(A,Y,B==null?void 0:B.description,u==null||(a=u.classNames)==null?void 0:a.description)},typeof u.description=="function"?u.description():u.description):null),R.isValidElement(u.cancel)?u.cancel:u.cancel&&ci(u.cancel)?R.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||b,onClick:U=>{ci(u.cancel)&&N&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,U),hn())},className:Ft(B==null?void 0:B.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,R.isValidElement(u.action)?u.action:u.action&&ci(u.action)?R.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||D,onClick:U=>{ci(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,U),!U.defaultPrevented&&hn())},className:Ft(B==null?void 0:B.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function Rm(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function wM(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?hM:fM;function l(c){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=a:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const SM=R.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:d,mobileOffset:u,theme:f="light",richColors:y,duration:w,style:x,visibleToasts:S=dM,toastOptions:m,dir:g=Rm(),gap:v=mM,icons:E,containerAriaLabel:C="Notifications"}=t,[P,k]=R.useState([]),b=R.useMemo(()=>r?P.filter(H=>H.toasterId===r):P.filter(H=>!H.toasterId),[P,r]),D=R.useMemo(()=>Array.from(new Set([o].concat(b.filter(H=>H.position).map(H=>H.position)))),[b,o]),[T,A]=R.useState([]),[L,Z]=R.useState(!1),[le,ge]=R.useState(!1),[B,re]=R.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),j=R.useRef(null),_=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=R.useRef(null),$=R.useRef(!1),se=R.useCallback(H=>{k(q=>{var K;return(K=q.find(pe=>pe.id===H.id))!=null&&K.delete||et.dismiss(H.id),q.filter(({id:pe})=>pe!==H.id)})},[]);return R.useEffect(()=>et.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{k(q=>q.map(K=>K.id===H.id?{...K,delete:!0}:K))});return}setTimeout(()=>{Hy.flushSync(()=>{k(q=>{const K=q.findIndex(pe=>pe.id===H.id);return K!==-1?[...q.slice(0,K),{...q[K],...H},...q.slice(K+1)]:[H,...q]})})})}),[P]),R.useEffect(()=>{if(f!=="system"){re(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?re("dark"):re("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:q})=>{re(q?"dark":"light")})}catch{H.addListener(({matches:K})=>{try{re(K?"dark":"light")}catch(pe){console.error(pe)}})}},[f]),R.useEffect(()=>{P.length<=1&&Z(!1)},[P]),R.useEffect(()=>{const H=q=>{var K;if(i.every(J=>q[J]||q.code===J)){var Je;Z(!0),(Je=j.current)==null||Je.focus()}q.code==="Escape"&&(document.activeElement===j.current||(K=j.current)!=null&&K.contains(document.activeElement))&&Z(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[i]),R.useEffect(()=>{if(j.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,$.current=!1)}},[j.current]),R.createElement("section",{ref:n,"aria-label":`${C} ${_}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},D.map((H,q)=>{var K;const[pe,Je]=H.split("-");return b.length?R.createElement("ol",{key:H,dir:g==="auto"?Rm():g,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":B,"data-y-position":pe,"data-x-position":Je,style:{"--front-toast-height":`${((K=T[0])==null?void 0:K.height)||0}px`,"--width":`${pM}px`,"--gap":`${v}px`,...x,...wM(d,u)},onBlur:J=>{$.current&&!J.currentTarget.contains(J.relatedTarget)&&($.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||$.current||($.current=!0,V.current=J.relatedTarget)},onMouseEnter:()=>Z(!0),onMouseMove:()=>Z(!0),onMouseLeave:()=>{le||Z(!1)},onDragEnd:()=>Z(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},b.filter(J=>!J.position&&q===0||J.position===H).map((J,Xt)=>{var cn,Qt;return R.createElement(xM,{key:J.id,icons:E,index:Xt,toast:J,defaultRichColors:y,duration:(cn=m==null?void 0:m.duration)!=null?cn:w,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:s,visibleToasts:S,closeButton:(Qt=m==null?void 0:m.closeButton)!=null?Qt:l,interacting:le,position:H,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,closeButtonAriaLabel:m==null?void 0:m.closeButtonAriaLabel,removeToast:se,toasts:b.filter(It=>It.position==J.position),heights:T.filter(It=>It.position==J.position),setHeights:A,expandByDefault:a,gap:v,expanded:L,swipeDirections:t.swipeDirections})})):null}))}),uw=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,cw=5,dw=3e3;function JM(e,t){const n=p.useRef(null),r=p.useRef(0),s=p.useRef(!0),o=p.useRef(!1),i=p.useRef(t);i.current=t;const a=p.useRef(!1),l=p.useCallback(w=>{var x;((x=n.current)==null?void 0:x.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(w))},[]),c=p.useCallback((w,x)=>{var S;((S=n.current)==null?void 0:S.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:w,rows:x})),a.current=!1):a.current=!0},[]),d=p.useCallback(w=>{l({type:"terminal_input",data:w})},[l]),u=p.useCallback((w,x)=>{l({type:"terminal_resize",cols:w,rows:x})},[l]),f=p.useCallback(()=>{l({type:"chat_subscribe"})},[l]),y=p.useCallback(()=>{if(!s.current||o.current)return;const w=Ao();if(!w){window.location.href="/login";return}o.current=!0;const x=new WebSocket(`${uw}/ws/projects/${e}`);n.current=x,x.onopen=()=>{o.current=!1,r.current=0,x.send(JSON.stringify({type:"auth",token:w}))},x.onmessage=S=>{var g,v,E,C,P,k,b,D;let m;try{m=JSON.parse(S.data)}catch{return}switch(m.type){case"connected":a.current=!1,(v=(g=i.current).onConnected)==null||v.call(g);break;case"terminal_data":(C=(E=i.current).onTerminalData)==null||C.call(E,m.data);break;case"status":(k=(P=i.current).onStatus)==null||k.call(P,m.status);break;case"chat_message":{const T=m;(D=(b=i.current).onChatMessage)==null||D.call(b,T);break}case"error":console.error("[WS] Server error:",m.message);break}},x.onclose=()=>{o.current=!1,n.current=null,s.current&&r.current<cw&&(r.current++,setTimeout(y,dw))},x.onerror=S=>{o.current=!1,console.error("[WS] WebSocket error:",S)}},[e]);return p.useEffect(()=>(s.current=!0,y(),()=>{var w;s.current=!1,(w=n.current)==null||w.close(),n.current=null}),[y]),{subscribeTerminal:c,sendTerminalInput:d,sendTerminalResize:u,subscribeChatMessages:f}}function EM(e){const t=p.useRef(null),n=p.useRef(0),r=p.useRef(!0),s=p.useRef(!1),o=p.useRef(e);o.current=e;const i=p.useCallback(()=>{if(!r.current||s.current)return;const a=Ao();if(!a)return;s.current=!0;const l=new WebSocket(`${uw}/ws/dashboard`);t.current=l,l.onopen=()=>{s.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:a}))},l.onmessage=c=>{var d,u;try{const f=JSON.parse(c.data);f.type==="activity_update"?o.current.onActivityUpdate(f):f.type==="project_stopped"&&((u=(d=o.current).onProjectStopped)==null||u.call(d,f.projectId,f.projectName))}catch{}},l.onclose=()=>{s.current=!1,t.current=null,r.current&&n.current<cw&&(n.current++,setTimeout(i,dw))},l.onerror=c=>{s.current=!1,console.error("[DashboardWS] Error:",c)}},[]);p.useEffect(()=>(r.current=!0,i(),()=>{var a;r.current=!1,(a=t.current)==null||a.close(),t.current=null}),[i])}function kM(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}const Mm=5*36e5;function bM(e){if(!e||e.utilization===void 0||e.utilization<=0||!e.resetAt)return null;const t=new Date(e.resetAt).getTime()-Date.now();if(t<=0)return null;const n=Mm-t;return n<=0?null:Math.round(e.utilization/(n/Mm))}function di({label:e,bucket:t}){if(!t||t.utilization===void 0)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",s=kM(t.resetAt);return h.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",h.jsxs("span",{className:Q("font-medium",r),children:[n,"%"]}),s&&h.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",s,")"]})]})}function CM({className:e}){const[t,n]=p.useState("loading"),[r,s]=p.useState(!1);p.useEffect(()=>{const f=async()=>{try{n(await xx())}catch{n(null)}};f();const y=setInterval(()=>void f(),5*60*1e3);return()=>clearInterval(y)},[]);const o=async()=>{s(!0);try{n(await wx())}catch{n(null)}finally{s(!1)}};if(t==="loading"||!t)return null;const i=!!t.fiveHour,a=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,d=i||a||l||c,u=bM(t.fiveHour);return h.jsxs("div",{className:Q("flex items-center gap-1.5 text-xs",e),children:[u!==null&&h.jsxs("span",{className:Q("font-medium",u<=100?"text-green-400":"text-orange-400"),title:`5h 使用进度:按当前速率,窗口结束时预计使用 ${u}%`,children:[u,"%"]}),t.planName&&h.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),d&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"|"}),h.jsx(di,{label:"5h",bucket:t.fiveHour}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(di,{label:"7d",bucket:t.sevenDay})]}),l&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(di,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(di,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),h.jsx("button",{onClick:()=>void o(),className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:h.jsx(KN,{className:Q("h-3 w-3",r&&"animate-spin")})})]})}function PM(){const[e,t]=p.useState([]),[n,r]=p.useState(!1),[s,o]=p.useState(""),[i,a]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(null),[f,y]=p.useState(""),[w,x]=p.useState(""),[S,m]=p.useState(""),g=p.useRef(null),v=p.useRef(null);p.useEffect(()=>{mx().then(t).catch(()=>t([]))},[]),p.useEffect(()=>{n&&setTimeout(()=>{var k;return(k=g.current)==null?void 0:k.focus()},0)},[n]),p.useEffect(()=>{d&&setTimeout(()=>{var k;return(k=v.current)==null?void 0:k.focus()},0)},[d]);const E=async()=>{const k=i.trim();if(k)try{const b=await gx({label:s.trim()||k,command:k,...l?{parentId:l}:{}});t(D=>[...D,b]),o(""),a(""),c(""),r(!1)}catch(b){console.error("[GlobalShortcuts] Failed to add:",b)}},C=async k=>{try{await vx(k),t(b=>b.filter(D=>D.id!==k)),d===k&&u(null)}catch(b){console.error("[GlobalShortcuts] Failed to delete:",b)}},P=async()=>{const k=w.trim();if(!(!k||!d))try{const b=await yx(d,{label:f.trim()||k,command:k,parentId:S||null});t(D=>D.map(T=>T.id===d?b:T)),u(null)}catch(b){console.error("[GlobalShortcuts] Failed to save:",b)}};return h.jsxs("section",{className:"mt-10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(pm,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),h.jsxs("button",{onClick:()=>{r(k=>!k),u(null)},className:Q("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[h.jsx(ga,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&h.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[h.jsx("input",{ref:g,placeholder:"名称(可选)",value:s,onChange:k=>o(k.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{placeholder:"命令内容…",value:i,onChange:k=>a(k.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),E()),k.key==="Escape"&&(r(!1),o(""),a(""),c(""))}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Zl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:l,onChange:k=>c(k.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.map(k=>h.jsx("option",{value:k.id,children:k.label},k.id))]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>{r(!1),o(""),a("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void E(),disabled:!i.trim(),className:Q("text-sm px-3 py-1 rounded transition-colors text-white",i.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),e.length===0&&!n?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[h.jsx(pm,{className:"h-6 w-6"}),h.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(k=>d===k.id?h.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[h.jsx("input",{ref:v,value:f,onChange:b=>y(b.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{value:w,onChange:b=>x(b.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),P()),b.key==="Escape"&&u(null)}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Zl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:S,onChange:b=>m(b.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.filter(b=>b.id!==k.id).map(b=>h.jsx("option",{value:b.id,children:b.label},b.id))]})]}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>u(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void P(),disabled:!w.trim(),className:Q("text-xs px-2.5 py-1 rounded transition-colors text-white",w.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},k.id):h.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[h.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:k.label}),k.parentId&&(()=>{const b=e.find(D=>D.id===k.parentId);return b?h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(Zl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",b.label]})]}):null})(),!k.parentId&&k.label!==k.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:k.command}),h.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>{u(k.id),y(k.label),x(k.command),m(k.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:h.jsx(Cx,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>void C(k.id),className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:h.jsx(ff,{className:"h-3.5 w-3.5"})})]})]},k.id))})]})}const fw=p.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function TM(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function NM(){return p.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>TM())}function jM({children:e}){const[t,n]=p.useState(()=>sx(pr.theme,"system")),r=NM(),s=t==="system"?r:t;p.useEffect(()=>{const i=document.documentElement;i.classList.remove("light","dark"),i.classList.add(s)},[s]);const o=i=>{n(i),ox(pr.theme,i)};return h.jsx(fw.Provider,{value:{theme:t,resolved:s,setTheme:o},children:e})}function RM(){return p.useContext(fw)}function MM(){const{theme:e,setTheme:t}=RM(),n=[{value:"light",icon:ZN,label:"浅色"},{value:"dark",icon:GN,label:"深色"},{value:"system",icon:HN,label:"系统"}];return h.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:r,icon:s,label:o})=>h.jsx("button",{onClick:()=>t(r),className:Q("p-1 rounded-sm transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:h.jsx(s,{className:"h-3.5 w-3.5"})},r))})}const DM={workMinutes:30,breakMinutes:5};function va(){return sx(pr.pomodoroConfig,DM,!0)}function AM(e){Notification.permission==="granted"&&new Notification("番茄钟",{body:e,icon:"/favicon.ico"})}const yf=Ha(e=>({running:!1,phase:"work",secondsLeft:va().workMinutes*60,setRunning:t=>e({running:t}),setPhase:t=>e({phase:t}),setSecondsLeft:t=>e({secondsLeft:t})}));function LM(){const{running:e,phase:t,secondsLeft:n,setPhase:r,setSecondsLeft:s}=yf(),o=p.useCallback(i=>{const a=va();r(i),s(i==="work"?a.workMinutes*60:a.breakMinutes*60),AM(i==="break"?"休息一下 ☕":"该工作了 💻")},[r,s]);return p.useEffect(()=>{if(!e)return;if(n===0){o(t==="work"?"break":"work");return}const i=setTimeout(()=>s(n-1),1e3);return()=>clearTimeout(i)},[e,n,t,o,s]),null}function _M(){const{running:e,phase:t,secondsLeft:n}=yf(),r=Math.floor(n/60),s=n%60,o=`${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return e?Oa.createPortal(h.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center pointer-events-none z-40 select-none",style:{opacity:t==="work"?.1:.6},children:[h.jsx("div",{className:Q("font-mono font-bold tabular-nums leading-none",t==="work"?"text-foreground":"text-blue-400 dark:text-blue-300"),style:{fontSize:"clamp(180px, 45vw, 550px)"},children:o}),h.jsx("div",{className:"mt-3 text-muted-foreground font-medium tracking-widest uppercase",style:{fontSize:"clamp(12px, 1.5vw, 20px)"},children:t==="work"?"专注工作":"休息一下"})]}),document.body):null}function OM(){const{running:e,phase:t,secondsLeft:n,setRunning:r,setPhase:s,setSecondsLeft:o}=yf(),i=Math.floor(n/60),a=n%60,l=`${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`,c=()=>{if(e){const d=va();s("work"),o(d.workMinutes*60)}else{const d=va();s("work"),o(d.workMinutes*60),Notification.permission==="default"&&Notification.requestPermission()}r(!e)};return h.jsx("button",{onClick:c,className:Q("p-1 rounded transition-colors",e?t==="work"?"text-red-500 bg-red-500/10 hover:bg-red-500/20":"text-green-500 bg-green-500/10 hover:bg-green-500/20":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:e?t==="work"?`工作中 ${l} — 点击停止`:`休息中 ${l} — 点击停止`:"启动番茄钟",children:h.jsx(qN,{className:"h-4 w-4"})})}function IM(){const e=Va(),{projects:t,loading:n,error:r,fetchProjects:s,addProject:o,updateProject:i,removeProject:a}=dm(),l=wr(N=>N.clearToken),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[y,w]=p.useState(new Set),x=p.useRef(new Map),[S,m]=p.useState(new Map),g=p.useRef(0),[v,E]=p.useState(!!document.fullscreenElement),[C,P]=p.useState(!1),[k,b]=p.useState(""),[D,T]=p.useState([]),[A,L]=p.useState(!1);p.useEffect(()=>{if(!k.trim()||k.trim().length<2){T([]);return}const N=setTimeout(()=>{L(!0),kx(k).then(z=>T(z)).catch(()=>T([])).finally(()=>L(!1))},400);return()=>clearTimeout(N)},[k]);const Z=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};p.useEffect(()=>{const N=()=>E(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",N),()=>document.removeEventListener("fullscreenchange",N)},[]),p.useEffect(()=>{s()},[s]),p.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]);const le=2e3,ge=3,B=8e3,re=p.useCallback(N=>{if(N.status){const te=dm.getState().projects.find(ue=>ue.id===N.projectId);te&&te.status!==N.status&&i({...te,status:N.status})}const z=Date.now(),Y=x.current;if(z-N.lastActivityAt<le){w(ye=>ye.has(N.projectId)?ye:new Set(ye).add(N.projectId));const te=Y.get(N.projectId)??[];let ue=!1;if(N.semantic){const ye=te[te.length-1],Zn=`${N.semantic.phase}:${N.semantic.detail??""}`,fn=ye?`${ye.phase}:${ye.detail??""}`:"";Zn!==fn?(te.push({id:g.current++,phase:N.semantic.phase,detail:N.semantic.detail,ts:z}),ue=!0):ye&&(ye.ts=z)}const Te=te.filter(ye=>z-ye.ts<B),Ge=Te.length>ge?Te.slice(-ge):Te;Ge.length!==te.length&&(ue=!0),Y.set(N.projectId,Ge),ue&&m(new Map(Y))}else w(te=>{if(!te.has(N.projectId))return te;const ue=new Set(te);return ue.delete(N.projectId),ue}),Y.has(N.projectId)&&Y.get(N.projectId).length>0&&(Y.set(N.projectId,[]),m(new Map(Y)))},[]),j=p.useCallback((N,z)=>{"Notification"in window&&Notification.permission==="granted"?new Notification("Claude 已完成",{body:`项目「${z}」的任务已完成`,icon:"/terminal.svg"}):Ls.success(`项目「${z}」的任务已完成`,{duration:8e3})},[]);EM({onActivityUpdate:re,onProjectStopped:j}),p.useEffect(()=>{const N=setInterval(()=>{const z=Date.now(),Y=x.current;let te=!1;for(const[ue,Te]of Y){const Ge=Te.filter(ye=>z-ye.ts<B);Ge.length!==Te.length&&(Y.set(ue,Ge),te=!0)}te&&m(new Map(Y)),w(ue=>{let Te=!1;const Ge=new Set(ue);for(const ye of ue){const Zn=Y.get(ye);(!Zn||Zn.length===0)&&(Ge.delete(ye),Te=!0)}return Te?Ge:ue})},3e3);return()=>clearInterval(N)},[]);const _=()=>{l(),e("/login")},V=N=>{o(N)},$=N=>{o(N)},se=async N=>{try{await fx(N),a(N)}catch(z){Ls.error(z instanceof Error?z.message:"Failed to delete project")}},H=async N=>{try{const z=await hx(N);i(z)}catch(z){Ls.error(z instanceof Error?z.message:"Failed to archive project")}},q=async N=>{try{const z=await px(N);i(z)}catch(z){Ls.error(z instanceof Error?z.message:"Failed to restore project")}},K=p.useMemo(()=>t.filter(N=>!N.archived),[t]),pe=p.useMemo(()=>t.filter(N=>N.archived),[t]),Je=p.useMemo(()=>Array.from(new Set(t.flatMap(N=>N.tags??[]))),[t]),[J,Xt]=p.useState([]),cn=p.useMemo(()=>J.length===0?K:K.filter(N=>J.some(z=>{var Y;return(Y=N.tags)==null?void 0:Y.includes(z)})),[K,J]),[Qt,It]=_T(pr.projectOrder,[],{parse:!0}),[gs,Xn]=p.useState(null),[tl,Qn]=p.useState(null);p.useEffect(()=>{if(K.length===0)return;const N=K.map(z=>z.id);It(z=>{const Y=z.filter(Te=>N.includes(Te)),te=N.filter(Te=>!z.includes(Te)),ue=[...Y,...te];return ue.join(",")===z.join(",")?z:ue})},[K]);const dn=p.useMemo(()=>Qt.length===0?cn:[...cn].sort((N,z)=>{const Y=Qt.indexOf(N.id),te=Qt.indexOf(z.id);return Y===-1?1:te===-1?-1:Y-te}),[cn,Qt]),Lo=p.useCallback(N=>Xn(N),[]),kt=p.useCallback(()=>{Xn(null),Qn(null)},[]),nl=p.useCallback((N,z)=>{N.preventDefault(),Qn(z)},[]),rl=p.useCallback((N,z,Y)=>{if(N.preventDefault(),!Y||Y===z){Qn(null);return}It(te=>{const ue=[...te],Te=ue.indexOf(Y),Ge=ue.indexOf(z);return Te===-1||Ge===-1?te:(ue.splice(Te,1),ue.splice(Ge,0,Y),ue)}),Xn(null),Qn(null)},[It]),ze={onDelete:N=>void se(N),onArchive:N=>void H(N),onUnarchive:N=>void q(N),onUpdated:i};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(hm,{className:"h-5 w-5"}),h.jsx("span",{className:"font-semibold text-lg",children:"CC Web"})]}),h.jsx(CM,{}),h.jsxs("div",{className:"relative",children:[h.jsx(YN,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),h.jsx(vo,{placeholder:"搜索历史对话…",value:k,onChange:N=>b(N.target.value),className:"pl-8 h-8 text-xs w-48"}),k.trim().length>=2&&h.jsxs("div",{className:"absolute top-full mt-1 right-0 w-96 max-h-80 overflow-y-auto bg-popover border border-border rounded-lg shadow-xl z-50",children:[A&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"搜索中…"}),!A&&D.length===0&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"无结果"}),D.map((N,z)=>h.jsxs("button",{className:"w-full text-left px-4 py-2.5 hover:bg-muted transition-colors border-b border-border last:border-0",onClick:()=>{e(`/project/${N.projectId}`),b("")},children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:N.projectName}),h.jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:new Date(N.startedAt).toLocaleDateString("zh-CN")})]}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed line-clamp-2",children:N.snippet})]},z))]})]}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:h.jsx(QN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:h.jsx(XN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:Z,title:v?"Exit fullscreen":"Fullscreen",children:v?h.jsx(WN,{className:"h-4 w-4"}):h.jsx(UN,{className:"h-4 w-4"})}),h.jsx(OM,{}),h.jsx(MM,{}),h.jsxs(ie,{variant:"ghost",size:"sm",onClick:_,children:[h.jsx($N,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),h.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),h.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Pc,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ga,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),n&&h.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),r&&h.jsx("div",{className:"text-center text-destructive py-12",children:r}),!n&&!r&&t.length===0&&h.jsxs("div",{className:"text-center py-20",children:[h.jsx(hm,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),h.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),h.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),h.jsxs("div",{className:"flex gap-2 justify-center",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Pc,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ga,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!n&&!r&&Je.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[Je.map(N=>h.jsxs("button",{onClick:()=>Xt(z=>z.includes(N)?z.filter(Y=>Y!==N):[...z,N]),className:Q("px-2 py-0.5 rounded-full text-xs border transition-colors",J.includes(N)?"bg-blue-500/20 text-blue-400 border-blue-500/40":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",N]},N)),J.length>0&&h.jsx("button",{onClick:()=>Xt([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:"清除"})]}),!n&&!r&&dn.length>0&&h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:dn.map((N,z)=>h.jsx(Vn.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:z*.05,ease:"easeOut"},draggable:!0,onDragStart:()=>Lo(N.id),onDragOver:Y=>nl(Y,N.id),onDrop:Y=>rl(Y,N.id,gs),onDragEnd:kt,style:{opacity:gs===N.id?.4:1,cursor:"grab"},className:Q(tl===N.id&&gs!==N.id&&"ring-2 ring-blue-500/50 rounded-xl"),children:h.jsx(Tm,{project:N,active:y.has(N.id),statusStack:S.get(N.id)??[],...ze})},N.id))}),!n&&!r&&pe.length>0&&h.jsxs("div",{className:"mt-10",children:[h.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>P(N=>!N),children:[h.jsx(Vn.span,{animate:{rotate:C?90:0},transition:{duration:.2},children:h.jsx(bx,{className:"h-4 w-4"})}),h.jsx("span",{className:"font-medium",children:"Archived"}),h.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:pe.length})]}),h.jsx(tf,{children:C&&h.jsx(Vn.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:pe.map(N=>h.jsx(Tm,{project:N,active:!1,...ze},N.id))})})})]}),h.jsx(PM,{})]}),h.jsx(KR,{open:c,onOpenChange:d,onCreated:V}),h.jsx(YR,{open:u,onOpenChange:f,onOpened:$})]})}class VM extends R.Component{constructor(){super(...arguments);ol(this,"state",{hasError:!1,error:null});ol(this,"handleReset",()=>{var n,r;this.setState({hasError:!1,error:null}),(r=(n=this.props).onReset)==null||r.call(n)})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary]",n,r.componentStack),Ls.error(n.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[h.jsx("p",{children:"出错了"}),h.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted transition-colors",children:"重新加载"})]}):this.props.children}}const FM=R.lazy(()=>Po(()=>import("./ProjectPage-DKIPvilo.js").then(e=>e.P),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.ProjectPage}))),zM=R.lazy(()=>Po(()=>import("./SettingsPage-C8JtKKqC.js"),__vite__mapDeps([7,3,1])).then(e=>({default:e.SettingsPage}))),BM=R.lazy(()=>Po(()=>import("./SkillHubPage-CzcGAwA0.js"),__vite__mapDeps([8,5,2,3])).then(e=>({default:e.SkillHubPage}))),$M=R.lazy(()=>Po(()=>import("./ShareViewPage-Cai400b7.js"),__vite__mapDeps([9,5,4])).then(e=>({default:e.ShareViewPage})));function UM(){return h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function fi({children:e}){const[t,n]=p.useState(!1),r=wr(o=>o.token),s=wr(o=>o.setToken);return p.useEffect(()=>{if(r){n(!0);return}ma()?df().then(o=>s(o)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),!t&&!r?null:r?h.jsx(h.Fragment,{children:e}):h.jsx(sv,{to:"/login",replace:!0})}function WM(){return h.jsxs(jM,{children:[h.jsx(SM,{richColors:!0,position:"bottom-right"}),h.jsx(LM,{}),h.jsx(_M,{}),h.jsx(VM,{children:h.jsx(BE,{children:h.jsx(p.Suspense,{fallback:h.jsx(UM,{}),children:h.jsxs(VE,{children:[h.jsx(yn,{path:"/login",element:h.jsx(MN,{})}),h.jsx(yn,{path:"/",element:h.jsx(fi,{children:h.jsx(IM,{})})}),h.jsx(yn,{path:"/projects/:id",element:h.jsx(fi,{children:h.jsx(FM,{})})}),h.jsx(yn,{path:"/settings",element:h.jsx(fi,{children:h.jsx(zM,{})})}),h.jsx(yn,{path:"/skillhub",element:h.jsx(fi,{children:h.jsx(BM,{})})}),h.jsx(yn,{path:"/share/:token",element:h.jsx($M,{})}),h.jsx(yn,{path:"*",element:h.jsx(sv,{to:"/",replace:!0})})]})})})})]})}iu.createRoot(document.getElementById("root")).render(h.jsx(R.StrictMode,{children:h.jsx(WM,{})}));export{JT as $,tf as A,ie as B,bx as C,kN as D,VN as E,Pc as F,YT as G,mx as H,vo as I,Zl as J,ZT as K,gf as L,WN as M,Qa as N,Za as O,Cx as P,Ja as Q,R,pr as S,el as T,jn as U,qa as V,QT as W,ff as X,XT as Y,pm as Z,Po as _,KM as a,CN as a0,HT as a1,GT as a2,PN as a3,Va as a4,ON as a5,rr as a6,OM as a7,MM as a8,fN as a9,zx as aA,Rx as aB,Nx as aC,aN as aD,uN as aE,dN as aF,of as aG,af as aH,lf as aI,uf as aJ,Px as aK,va as aL,vN as aM,qN as aN,lN as aO,hN as aP,mN as aQ,yN as aR,cN as aS,gN as aT,pN as aU,xN as aV,qT as aW,eN as aX,TN as aY,YM as aZ,WT as aa,YN as ab,NN as ac,LT as ad,jN as ae,QN as af,JM as ag,CM as ah,XM as ai,_T as aj,dm as ak,hm as al,xo as am,br as an,ij as ao,un as ap,Fn as aq,tj as ar,Wa as as,ql as at,wo as au,Ka as av,Oa as aw,Dx as ax,ER as ay,Oj as az,Ao as b,ee as c,rN as d,Q as e,UN as f,Dm as g,tN as h,sx as i,h as j,ZM as k,Sx as l,KN as m,nN as n,fm as o,Vn as p,wN as q,p as r,ox as s,Ls as t,RM as u,IN as v,sN as w,ga as x,SN as y,EN as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ot,a as vt}from"./index-
|
|
1
|
+
import{g as Ot,a as vt}from"./index-BKftRi-t.js";function Bt(ct,wt){for(var _=0;_<wt.length;_++){const N=wt[_];if(typeof N!="string"&&!Array.isArray(N)){for(const w in N)if(w!=="default"&&!(w in ct)){const u=Object.getOwnPropertyDescriptor(N,w);u&&Object.defineProperty(ct,w,u.get?u:{enumerable:!0,get:()=>N[w]})}}}return Object.freeze(Object.defineProperty(ct,Symbol.toStringTag,{value:"Module"}))}function yt(ct){throw new Error('Could not dynamically require "'+ct+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zt={exports:{}};/*!
|
|
2
2
|
|
|
3
3
|
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
4
4
|
<http://stuartk.com/jszip>
|