@tom2012/cc-web 2026.4.19-a → 2026.4.19-b
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-chkENs4E.js → GraphPreview-HYiQuyYG.js} +1 -1
- package/frontend/dist/assets/{MobilePage-DF72akPm.js → MobilePage-Cf7_j9Ue.js} +3 -3
- package/frontend/dist/assets/{OfficePreview-BTIxA75W.js → OfficePreview-Br5Yqt5e.js} +2 -2
- package/frontend/dist/assets/{PlanPanel-BPrymjUm.js → PlanPanel-C1KP90Jw.js} +1 -1
- package/frontend/dist/assets/{ProjectPage-uXtZbquI.js → ProjectPage-BYNWACoF.js} +5 -5
- package/frontend/dist/assets/{SettingsPage-lg5h4qX7.js → SettingsPage-DSp71y-d.js} +1 -1
- package/frontend/dist/assets/{ShareViewPage-3ZhlFkz4.js → ShareViewPage-CqU6Q4Bx.js} +1 -1
- package/frontend/dist/assets/{SkillHubPage-DOXDfvIh.js → SkillHubPage-Dsy9klSW.js} +1 -1
- package/frontend/dist/assets/{bot-D0CByVoh.js → bot-DZlt5qUr.js} +1 -1
- package/frontend/dist/assets/{chevron-down-xAcwV0F_.js → chevron-down-DZqUvAGX.js} +1 -1
- package/frontend/dist/assets/{chevron-up-CZmSySMS.js → chevron-up-CiCw88DF.js} +1 -1
- package/frontend/dist/assets/{index-Dzv8q6Mg.js → index-C2SMWB3m.js} +1 -1
- package/frontend/dist/assets/{index-BJ--ICg_.js → index-DV9zS1Sy.js} +2 -2
- package/frontend/dist/assets/{jszip.min-DZVsq4fs.js → jszip.min-DVUhkoei.js} +1 -1
- package/frontend/dist/assets/{matter-CA4VIDh1.js → matter-BVaRC_bB.js} +1 -1
- package/frontend/dist/assets/{maximize-2-D1tTllby.js → maximize-2-ObUYWYtM.js} +1 -1
- package/frontend/dist/assets/{one-light-D3uIXPub.js → one-light-DGwZ9_4H.js} +1 -1
- package/frontend/dist/assets/{save-BrkulEks.js → save-DcSDHawp.js} +1 -1
- package/frontend/dist/assets/{search-Cp1V-uIA.js → search-hyvsZ4dk.js} +1 -1
- package/frontend/dist/assets/{user-Cw8mttQn.js → user-QTp__bnW.js} +1 -1
- package/frontend/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -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-BYNWACoF.js","assets/purify.es-CgRAQgUo.js","assets/one-light-DGwZ9_4H.js","assets/one-light-wklAmtGL.css","assets/save-DcSDHawp.js","assets/chevron-down-DZqUvAGX.js","assets/bot-DZlt5qUr.js","assets/user-QTp__bnW.js","assets/search-hyvsZ4dk.js","assets/chevron-up-CiCw88DF.js","assets/ProjectPage-9CEnUXvW.css","assets/SettingsPage-DSp71y-d.js","assets/SkillHubPage-Dsy9klSW.js","assets/ShareViewPage-CqU6Q4Bx.js","assets/MobilePage-Cf7_j9Ue.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);function n(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?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(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var i={exports:{}},s={},l={exports:{}},u={},c=Symbol.for("react.element"),d=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),g=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),b=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),w=Symbol.iterator;var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function j(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||k}function C(){}function P(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||k}j.prototype.isReactComponent={},j.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},j.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},C.prototype=j.prototype;var T=P.prototype=new C;T.constructor=P,S(T,j.prototype),T.isPureReactComponent=!0;var N=Array.isArray,M=Object.prototype.hasOwnProperty,R={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function L(e,t,n){var r,o={},a=null,i=null;if(null!=t)for(r in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(a=""+t.key),t)M.call(t,r)&&!D.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var l=Array(s),u=0;u<s;u++)l[u]=arguments[u+2];o.children=l}if(e&&e.defaultProps)for(r in s=e.defaultProps)void 0===o[r]&&(o[r]=s[r]);return{$$typeof:c,type:e,key:a,ref:i,props:o,_owner:R.current}}function _(e){return"object"==typeof e&&null!==e&&e.$$typeof===c}var O=/\/+/g;function A(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function I(e,t,n,r,o){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var i=!1;if(null===e)i=!0;else switch(a){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case c:case d:i=!0}}if(i)return o=o(i=e),e=""===r?"."+A(i,0):r,N(o)?(n="",null!=e&&(n=e.replace(O,"$&/")+"/"),I(o,t,n,"",function(e){return e})):null!=o&&(_(o)&&(o=function(e,t){return{$$typeof:c,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(O,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=""===r?".":r+":",N(e))for(var s=0;s<e.length;s++){var l=r+A(a=e[s],s);i+=I(a,t,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=w&&e[w]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),s=0;!(a=e.next()).done;)i+=I(a=a.value,t,n,l=r+A(a,s++),o);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function z(e,t,n){if(null==e)return e;var r=[],o=0;return I(e,r,"","",function(e){return t.call(n,e,o++)}),r}function F(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var V={current:null},$={transition:null},B={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:$,ReactCurrentOwner:R};function U(){throw Error("act(...) is not supported in production builds of React.")}u.Children={map:z,forEach:function(e,t,n){z(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return z(e,function(){t++}),t},toArray:function(e){return z(e,function(e){return e})||[]},only:function(e){if(!_(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},u.Component=j,u.Fragment=f,u.Profiler=h,u.PureComponent=P,u.StrictMode=p,u.Suspense=y,u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,u.act=U,u.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=S({},e.props),o=e.key,a=e.ref,i=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,i=R.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in t)M.call(t,l)&&!D.hasOwnProperty(l)&&(r[l]=void 0===t[l]&&void 0!==s?s[l]:t[l])}var l=arguments.length-2;if(1===l)r.children=n;else if(1<l){s=Array(l);for(var u=0;u<l;u++)s[u]=arguments[u+2];r.children=s}return{$$typeof:c,type:e.type,key:o,ref:a,props:r,_owner:i}},u.createContext=function(e){return(e={$$typeof:g,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:m,_context:e},e.Consumer=e},u.createElement=L,u.createFactory=function(e){var t=L.bind(null,e);return t.type=e,t},u.createRef=function(){return{current:null}},u.forwardRef=function(e){return{$$typeof:v,render:e}},u.isValidElement=_,u.lazy=function(e){return{$$typeof:x,_payload:{_status:-1,_result:e},_init:F}},u.memo=function(e,t){return{$$typeof:b,type:e,compare:void 0===t?null:t}},u.startTransition=function(e){var t=$.transition;$.transition={};try{e()}finally{$.transition=t}},u.unstable_act=U,u.useCallback=function(e,t){return V.current.useCallback(e,t)},u.useContext=function(e){return V.current.useContext(e)},u.useDebugValue=function(){},u.useDeferredValue=function(e){return V.current.useDeferredValue(e)},u.useEffect=function(e,t){return V.current.useEffect(e,t)},u.useId=function(){return V.current.useId()},u.useImperativeHandle=function(e,t,n){return V.current.useImperativeHandle(e,t,n)},u.useInsertionEffect=function(e,t){return V.current.useInsertionEffect(e,t)},u.useLayoutEffect=function(e,t){return V.current.useLayoutEffect(e,t)},u.useMemo=function(e,t){return V.current.useMemo(e,t)},u.useReducer=function(e,t,n){return V.current.useReducer(e,t,n)},u.useRef=function(e){return V.current.useRef(e)},u.useState=function(e){return V.current.useState(e)},u.useSyncExternalStore=function(e,t,n){return V.current.useSyncExternalStore(e,t,n)},u.useTransition=function(){return V.current.useTransition()},u.version="18.3.1",l.exports=u;var W=l.exports;const H=o(W),G=n({__proto__:null,default:H},[W]);
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -72,4 +72,4 @@ function Jd(){return Jd=Object.assign?Object.assign.bind():function(e){for(var t
|
|
|
72
72
|
*
|
|
73
73
|
* This source code is licensed under the ISC license.
|
|
74
74
|
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const LE=(e,t)=>{const n=W.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:i="",children:s,...l},u)=>{return W.createElement("svg",{ref:u,...DE,width:r,height:r,stroke:n,strokeWidth:a?24*Number(o)/Number(r):o,className:["lucide",`lucide-${c=e,c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,i].join(" "),...l},[...t.map(([e,t])=>W.createElement(e,t)),...Array.isArray(s)?s:[s]]);var c});return n.displayName=`${e}`,n},_E=LE("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),OE=LE("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),AE=LE("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),IE=LE("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),zE=LE("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),FE=LE("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),VE=LE("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),$E=LE("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]),BE=LE("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),UE=LE("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),WE=LE("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),HE=LE("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),GE=LE("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),YE=LE("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),KE=LE("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),XE=LE("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),qE=LE("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),QE=LE("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),ZE=LE("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),JE=LE("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),ej=LE("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),tj=LE("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),nj=LE("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),rj=LE("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),oj=LE("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),aj=LE("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ij=LE("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),sj=LE("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),lj=LE("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]),uj=LE("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),cj=LE("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),dj=LE("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),fj=LE("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),pj=LE("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),hj=LE("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),mj=LE("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),gj=Ck("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function vj({className:e,variant:t,...n}){return ee.jsx("div",{className:ik(gj({variant:t}),e),...n})}function yj(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function bj(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>W.createContext(e));return function(n){const r=(null==n?void 0:n[e])||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const o=W.createContext(r),a=n.length;n=[...n,r];const i=t=>{var n;const{scope:r,children:i,...s}=t,l=(null==(n=null==r?void 0:r[e])?void 0:n[a])||o,u=W.useMemo(()=>s,Object.values(s));return ee.jsx(l.Provider,{value:u,children:i})};return i.displayName=t+"Provider",[i,function(n,i){var s;const l=(null==(s=null==i?void 0:i[e])?void 0:s[a])||o,u=W.useContext(l);if(u)return u;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},xj(r,...t)]}function xj(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var wj=(null==globalThis?void 0:globalThis.document)?W.useLayoutEffect:()=>{},kj=G[" useId ".trim().toString()]||(()=>{}),Sj=0;function Ej(e){const[t,n]=W.useState(kj());return wj(()=>{n(e=>e??String(Sj++))},[e]),e||(t?`radix-${t}`:"")}var jj=G[" useInsertionEffect ".trim().toString()]||wj;function Cj({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=function({defaultProp:e,onChange:t}){const[n,r]=W.useState(e),o=W.useRef(n),a=W.useRef(t);return jj(()=>{a.current=t},[t]),W.useEffect(()=>{var e;o.current!==n&&(null==(e=a.current)||e.call(a,n),o.current=n)},[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),s=void 0!==e,l=s?e:o;{const t=W.useRef(void 0!==e);W.useEffect(()=>{const e=t.current;if(e!==s){const t=e?"controlled":"uncontrolled",n=s?"controlled":"uncontrolled";console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,r])}const u=W.useCallback(t=>{var n;if(s){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&(null==(n=i.current)||n.call(i,r))}else a(t)},[s,e,a,i]);return[l,u]}function Pj(e){const t=Tj(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),i=a.find(Mj);if(i){const e=i.props.children,r=a.map(t=>t===i?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Tj(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?hk(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nj=Symbol("radix.slottable");function Mj(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Nj}var Rj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=Pj(`Primitive.${t}`),r=W.forwardRef((e,r)=>{const{asChild:o,...a}=e,i=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),ee.jsx(i,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dj(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}var Lj,_j="dismissableLayer.update",Oj="dismissableLayer.pointerDownOutside",Aj="dismissableLayer.focusOutside",Ij=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zj=W.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...l}=e,u=W.useContext(Ij),[c,d]=W.useState(null),f=(null==c?void 0:c.ownerDocument)??(null==globalThis?void 0:globalThis.document),[,p]=W.useState({}),h=mk(t,e=>d(e)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(g),y=c?m.indexOf(c):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,w=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=Dj(e),r=W.useRef(!1),o=W.useRef(()=>{});return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Vj(Oj,n,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));x&&!n&&(null==o||o(e),null==i||i(e),e.defaultPrevented||null==s||s())},f),k=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=Dj(e),r=W.useRef(!1);return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){Vj(Aj,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(null==a||a(e),null==i||i(e),e.defaultPrevented||null==s||s())},f);return function(e,t=(null==globalThis?void 0:globalThis.document)){const n=Dj(e);W.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===u.layers.size-1&&(null==r||r(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),W.useEffect(()=>{if(c)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Lj=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Fj(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=Lj)}},[c,f,n,u]),W.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Fj())},[c,u]),W.useEffect(()=>{const e=()=>p({});return document.addEventListener(_j,e),()=>document.removeEventListener(_j,e)},[]),ee.jsx(Rj.div,{...l,ref:h,style:{pointerEvents:b?x?"auto":"none":void 0,...e.style},onFocusCapture:yj(e.onFocusCapture,k.onFocusCapture),onBlurCapture:yj(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:yj(e.onPointerDownCapture,w.onPointerDownCapture)})});zj.displayName="DismissableLayer";function Fj(){const e=new CustomEvent(_j);document.dispatchEvent(e)}function Vj(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&ld.flushSync(()=>e.dispatchEvent(t))}(o,a):o.dispatchEvent(a)}W.forwardRef((e,t)=>{const n=W.useContext(Ij),r=W.useRef(null),o=mk(t,r);return W.useEffect(()=>{const e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),ee.jsx(Rj.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var $j="focusScope.autoFocusOnMount",Bj="focusScope.autoFocusOnUnmount",Uj={bubbles:!1,cancelable:!0},Wj=W.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=W.useState(null),u=Dj(o),c=Dj(a),d=W.useRef(null),f=mk(t,e=>l(e)),p=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;const t=e.target;s.contains(t)?d.current=t:Kj(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;const t=e.relatedTarget;null!==t&&(s.contains(t)||Kj(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Kj(s)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,s,p.paused]),W.useEffect(()=>{if(s){Xj.add(p);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent($j,Uj);s.addEventListener($j,u),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kj(r,{select:t}),document.activeElement!==n)return}((e=Hj(s),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Kj(s))}return()=>{s.removeEventListener($j,u),setTimeout(()=>{const e=new CustomEvent(Bj,Uj);s.addEventListener(Bj,c),s.dispatchEvent(e),e.defaultPrevented||Kj(t??document.body,{select:!0}),s.removeEventListener(Bj,c),Xj.remove(p)},0)}}var e},[s,u,c,p]);const h=W.useCallback(e=>{if(!n&&!r)return;if(p.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=Hj(e),n=Gj(t,e),r=Gj(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&Kj(a,{select:!0})):(e.preventDefault(),n&&Kj(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,p.paused]);return ee.jsx(Rj.div,{tabIndex:-1,...i,ref:f,onKeyDown:h})});function Hj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gj(e,t){for(const n of e)if(!Yj(n,{upTo:t}))return n}function Yj(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Kj(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Wj.displayName="FocusScope";var Xj=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=qj(e,t),e.unshift(t)},remove(t){var n;e=qj(e,t),null==(n=e[0])||n.resume()}}}();function qj(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var Qj=W.forwardRef((e,t)=>{var n;const{container:r,...o}=e,[a,i]=W.useState(!1);wj(()=>i(!0),[]);const s=r||a&&(null==(n=null==globalThis?void 0:globalThis.document)?void 0:n.body);return s?ud.createPortal(ee.jsx(Rj.div,{...o,ref:t}),s):null});Qj.displayName="Portal";var Zj=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=W.useState(),r=W.useRef(null),o=W.useRef(e),a=W.useRef("none"),i=e?"mounted":"unmounted",[s,l]=function(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return W.useEffect(()=>{const e=Jj(r.current);a.current="mounted"===s?e:"none"},[s]),wj(()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=Jj(t);if(e)l("MOUNT");else if("none"===i||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),wj(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=a=>{const i=Jj(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&i&&(l("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=Jj(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),o="function"==typeof n?n({present:r.isPresent}):W.Children.only(n),a=mk(r.ref,function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?W.cloneElement(o,{ref:a}):null};function Jj(e){return(null==e?void 0:e.animationName)||"none"}Zj.displayName="Presence";var eC=0;function tC(){W.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nC()),document.body.insertAdjacentElement("beforeend",e[1]??nC()),eC++,()=>{1===eC&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),eC--}},[])}function nC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var rC=function(){return rC=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},rC.apply(this,arguments)};function oC(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var aC="right-scroll-bar-position",iC="width-before-scroll-bar";function sC(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var lC="undefined"!=typeof window?W.useLayoutEffect:W.useEffect,uC=new WeakMap;function cC(e,t){var n,r,o,a=(n=null,r=function(t){return e.forEach(function(e){return sC(e,t)})},(o=W.useState(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return lC(function(){var t=uC.get(a);if(t){var n=new Set(t),r=new Set(e),o=a.current;n.forEach(function(e){r.has(e)||sC(e,null)}),r.forEach(function(e){n.has(e)||sC(e,o)})}uC.set(a,e)},[e]),a}function dC(e){return e}var fC=function(e){var t=e.sideCar,n=oC(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return W.createElement(r,rC({},n))};fC.isSideCarExport=!0;var pC=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=dC);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=rC({async:!0,ssr:!1},e),t}(),hC=function(){},mC=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:hC,onWheelCapture:hC,onTouchMoveCapture:hC}),o=r[0],a=r[1],i=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,h=e.noIsolation,m=e.inert,g=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,b=e.gapMode,x=oC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=f,k=cC([n,t]),S=rC(rC({},x),o);return W.createElement(W.Fragment,null,c&&W.createElement(w,{sideCar:pC,removeScrollBar:u,shards:d,noRelative:p,noIsolation:h,inert:m,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),i?W.cloneElement(W.Children.only(s),rC(rC({},S),{ref:k})):W.createElement(y,rC({},S,{className:l,ref:k}),s))});mC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},mC.classNames={fullWidth:iC,zeroRight:aC};function gC(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var vC=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=gC())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},yC=function(){var e,t=(e=vC(),function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},bC={left:0,top:0,right:0,gap:0},xC=function(e){return parseInt(e||"",10)||0},wC=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return bC;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[xC(n),xC(r),xC(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},kC=yC(),SC="data-scroll-locked",EC=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(SC,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(aC," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(iC," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(aC," .").concat(aC," {\n right: 0 ").concat(r,";\n }\n \n .").concat(iC," .").concat(iC," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(SC,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},jC=function(){var e=parseInt(document.body.getAttribute(SC)||"0",10);return isFinite(e)?e:0},CC=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;W.useEffect(function(){return document.body.setAttribute(SC,(jC()+1).toString()),function(){var e=jC()-1;e<=0?document.body.removeAttribute(SC):document.body.setAttribute(SC,e.toString())}},[]);var a=W.useMemo(function(){return wC(o)},[o]);return W.createElement(kC,{styles:EC(a,!t,o,n?"":"!important")})},PC=!1;if("undefined"!=typeof window)try{var TC=Object.defineProperty({},"passive",{get:function(){return PC=!0,!0}});window.addEventListener("test",TC,TC),window.removeEventListener("test",TC,TC)}catch(hN){PC=!1}var NC=!!PC&&{passive:!1},MC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},RC=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),DC(e,r)){var o=LC(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},DC=function(e,t){return"v"===e?function(e){return MC(e,"overflowY")}(t):function(e){return MC(e,"overflowX")}(t)},LC=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},_C=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},OC=function(e){return[e.deltaX,e.deltaY]},AC=function(e){return e&&"current"in e?e.current:e},IC=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},zC=0,FC=[];function VC(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $C=(BC=function(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),o=W.useState(zC++)[0],a=W.useState(yC)[0],i=W.useRef(e);W.useEffect(function(){i.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(AC),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=W.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var o,a=_C(e),s=n.current,l="deltaX"in e?e.deltaX:s[0]-a[0],u="deltaY"in e?e.deltaY:s[1]-a[1],c=e.target,d=Math.abs(l)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===d&&"range"===c.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===c||p.contains(c)))return!1;var h=RC(d,c);if(!h)return!0;if(h?o=d:(o="v"===d?"h":"v",h=RC(d,c)),!h)return!1;if(!r.current&&"changedTouches"in e&&(l||u)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,i=n.target,s=t.contains(i),l=!1,u=a>0,c=0,d=0;do{if(!i)break;var f=LC(e,i),p=f[0],h=f[1]-f[2]-o*p;(p||h)&&DC(e,i)&&(c+=h,d+=p);var m=i.parentNode;i=m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE?m.host:m}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(u&&Math.abs(c)<1||!u&&Math.abs(d)<1)&&(l=!0),l}(m,t,e,"h"===m?l:u)},[]),l=W.useCallback(function(e){var n=e;if(FC.length&&FC[FC.length-1]===a){var r="deltaY"in n?OC(n):_C(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var l=(i.current.shards||[]).map(AC).filter(Boolean).filter(function(e){return e.contains(n.target)});(l.length>0?s(n,l[0]):!i.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=W.useCallback(function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:VC(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),c=W.useCallback(function(e){n.current=_C(e),r.current=void 0},[]),d=W.useCallback(function(t){u(t.type,OC(t),t.target,s(t,e.lockRef.current))},[]),f=W.useCallback(function(t){u(t.type,_C(t),t.target,s(t,e.lockRef.current))},[]);W.useEffect(function(){return FC.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,NC),document.addEventListener("touchmove",l,NC),document.addEventListener("touchstart",c,NC),function(){FC=FC.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,NC),document.removeEventListener("touchmove",l,NC),document.removeEventListener("touchstart",c,NC)}},[]);var p=e.removeScrollBar,h=e.inert;return W.createElement(W.Fragment,null,h?W.createElement(a,{styles:IC(o)}):null,p?W.createElement(CC,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},pC.useMedium(BC),fC);var BC,UC=W.forwardRef(function(e,t){return W.createElement(mC,rC({},e,{ref:t,sideCar:$C}))});UC.classNames=mC.classNames;var WC=new WeakMap,HC=new WeakMap,GC={},YC=0,KC=function(e){return e&&(e.host||KC(e.parentNode))},XC=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=KC(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);GC[n]||(GC[n]=new WeakMap);var a=GC[n],i=[],s=new Set,l=new Set(o),u=function(e){e&&!s.has(e)&&(s.add(e),u(e.parentNode))};o.forEach(u);var c=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))c(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,l=(WC.get(e)||0)+1,u=(a.get(e)||0)+1;WC.set(e,l),a.set(e,u),i.push(e),1===l&&o&&HC.set(e,!0),1===u&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(pN){console.error("aria-hidden: cannot operate on ",e,pN)}})};return c(t),s.clear(),YC++,function(){i.forEach(function(e){var t=WC.get(e)-1,o=a.get(e)-1;WC.set(e,t),a.set(e,o),t||(HC.has(e)||e.removeAttribute(r),HC.delete(e)),o||e.removeAttribute(n)}),--YC||(WC=new WeakMap,WC=new WeakMap,HC=new WeakMap,GC={})}},qC=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),XC(r,o,n,"aria-hidden")):function(){return null}};function QC(e){const t=ZC(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),i=a.find(eP);if(i){const e=i.props.children,r=a.map(t=>t===i?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function ZC(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?hk(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JC=Symbol("radix.slottable");function eP(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===JC}var tP="Dialog",[nP]=bj(tP),[rP,oP]=nP(tP),aP=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,s=W.useRef(null),l=W.useRef(null),[u,c]=Cj({prop:r,defaultProp:o??!1,onChange:a,caller:tP});return ee.jsx(rP,{scope:t,triggerRef:s,contentRef:l,contentId:Ej(),titleId:Ej(),descriptionId:Ej(),open:u,onOpenChange:c,onOpenToggle:W.useCallback(()=>c(e=>!e),[c]),modal:i,children:n})};aP.displayName=tP;var iP="DialogTrigger";W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(iP,n),a=mk(t,o.triggerRef);return ee.jsx(Rj.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":CP(o.open),...r,ref:a,onClick:yj(e.onClick,o.onOpenToggle)})}).displayName=iP;var sP="DialogPortal",[lP,uP]=nP(sP,{forceMount:void 0}),cP=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=oP(sP,t);return ee.jsx(lP,{scope:t,forceMount:n,children:W.Children.map(r,e=>ee.jsx(Zj,{present:n||a.open,children:ee.jsx(Qj,{asChild:!0,container:o,children:e})}))})};cP.displayName=sP;var dP="DialogOverlay",fP=W.forwardRef((e,t)=>{const n=uP(dP,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=oP(dP,e.__scopeDialog);return a.modal?ee.jsx(Zj,{present:r||a.open,children:ee.jsx(hP,{...o,ref:t})}):null});fP.displayName=dP;var pP=QC("DialogOverlay.RemoveScroll"),hP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(dP,n);return ee.jsx(UC,{as:pP,allowPinchZoom:!0,shards:[o.contentRef],children:ee.jsx(Rj.div,{"data-state":CP(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),mP="DialogContent",gP=W.forwardRef((e,t)=>{const n=uP(mP,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=oP(mP,e.__scopeDialog);return ee.jsx(Zj,{present:r||a.open,children:a.modal?ee.jsx(vP,{...o,ref:t}):ee.jsx(yP,{...o,ref:t})})});gP.displayName=mP;var vP=W.forwardRef((e,t)=>{const n=oP(mP,e.__scopeDialog),r=W.useRef(null),o=mk(t,n.contentRef,r);return W.useEffect(()=>{const e=r.current;if(e)return qC(e)},[]),ee.jsx(bP,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yj(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null==(t=n.triggerRef.current)||t.focus()}),onPointerDownOutside:yj(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:yj(e.onFocusOutside,e=>e.preventDefault())})}),yP=W.forwardRef((e,t)=>{const n=oP(mP,e.__scopeDialog),r=W.useRef(!1),o=W.useRef(!1);return ee.jsx(bP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,i;null==(a=e.onCloseAutoFocus)||a.call(e,t),t.defaultPrevented||(r.current||null==(i=n.triggerRef.current)||i.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{var a,i;null==(a=e.onInteractOutside)||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const s=t.target;(null==(i=n.triggerRef.current)?void 0:i.contains(s))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),bP=W.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,s=oP(mP,n),l=W.useRef(null),u=mk(t,l);return tC(),ee.jsxs(ee.Fragment,{children:[ee.jsx(Wj,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:ee.jsx(zj,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":CP(s.open),...i,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),ee.jsxs(ee.Fragment,{children:[ee.jsx(MP,{titleId:s.titleId}),ee.jsx(RP,{contentRef:l,descriptionId:s.descriptionId})]})]})}),xP="DialogTitle",wP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(xP,n);return ee.jsx(Rj.h2,{id:o.titleId,...r,ref:t})});wP.displayName=xP;var kP="DialogDescription",SP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(kP,n);return ee.jsx(Rj.p,{id:o.descriptionId,...r,ref:t})});SP.displayName=kP;var EP="DialogClose",jP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(EP,n);return ee.jsx(Rj.button,{type:"button",...r,ref:t,onClick:yj(e.onClick,()=>o.onOpenChange(!1))})});function CP(e){return e?"open":"closed"}jP.displayName=EP;var PP="DialogTitleWarning",[TP,NP]=function(e,t){const n=W.createContext(t),r=e=>{const{children:t,...r}=e,o=W.useMemo(()=>r,Object.values(r));return ee.jsx(n.Provider,{value:o,children:t})};return r.displayName=e+"Provider",[r,function(r){const o=W.useContext(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(PP,{contentName:mP,titleName:xP,docsSlug:"dialog"}),MP=({titleId:e})=>{const t=NP(PP),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return W.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},RP=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${NP("DialogDescriptionWarning").contentName}}.`;return W.useEffect(()=>{var r;const o=null==(r=e.current)?void 0:r.getAttribute("aria-describedby");if(t&&o){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},DP=fP,LP=gP,_P=wP,OP=SP,AP=jP;const IP=aP,zP=cP,FP=W.forwardRef(({className:e,...t},n)=>ee.jsx(DP,{ref:n,className:ik("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}));FP.displayName=DP.displayName;const VP=W.forwardRef(({className:e,children:t,noOverlay:n,...r},o)=>ee.jsxs(zP,{children:[!n&&ee.jsx(FP,{}),ee.jsxs(LP,{ref:o,className:ik("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,ee.jsxs(AP,{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:[ee.jsx(hj,{className:"h-4 w-4"}),ee.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));VP.displayName=LP.displayName;const $P=({className:e,...t})=>ee.jsx("div",{className:ik("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});$P.displayName="DialogHeader";const BP=({className:e,...t})=>ee.jsx("div",{className:ik("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});BP.displayName="DialogFooter";const UP=W.forwardRef(({className:e,...t},n)=>ee.jsx(_P,{ref:n,className:ik("text-lg font-semibold leading-none tracking-tight",e),...t}));UP.displayName=_P.displayName;const WP=W.forwardRef(({className:e,...t},n)=>ee.jsx(OP,{ref:n,className:ik("text-sm text-muted-foreground",e),...t}));function HP({project:e,open:t,onOpenChange:n,onUpdated:r}){const[o,a]=W.useState([]),[i,s]=W.useState([]),[l,u]=W.useState(!1),[c,d]=W.useState(null);W.useEffect(()=>{if(!t)return;a(e.shares?[...e.shares]:[]),d(null);let n=!1;return tS().then(e=>{n||s(e)}).catch(()=>{}),()=>{n=!0}},[t,e.id]);const f=new Set(o.map(e=>e.username)),p=i.filter(t=>t!==e.owner&&!f.has(t));return ee.jsx(IP,{open:t,onOpenChange:n,children:ee.jsxs(VP,{className:"sm:max-w-md",children:[ee.jsxs($P,{children:[ee.jsxs(UP,{className:"flex items-center gap-2",children:[ee.jsx(pj,{className:"h-4 w-4"}),"共享设置"]}),ee.jsx(WP,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),ee.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[0===o.length&&ee.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),o.map(e=>ee.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[ee.jsx("span",{className:"text-sm font-medium",children:e.username}),ee.jsxs("div",{className:"flex items-center gap-1.5",children:[ee.jsx("button",{onClick:()=>{return t=e.username,void a(e=>e.map(e=>e.username===t?{...e,permission:"view"===e.permission?"edit":"view"}:e));var t},className:"focus:outline-none",children:ee.jsx(vj,{variant:"edit"===e.permission?"default":"secondary",className:"cursor-pointer text-xs",children:"edit"===e.permission?"可编辑":"可见"})}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>{return t=e.username,void a(e=>e.filter(e=>e.username!==t));var t},children:ee.jsx(fj,{className:"h-3.5 w-3.5"})})]})]},e.username))]}),p.length>0&&ee.jsxs("div",{className:"border-t pt-3",children:[ee.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),ee.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(e=>ee.jsxs(Tk,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>{return t=e,void a(e=>[...e,{username:t,permission:"view"}]);var t},children:[ee.jsx(oj,{className:"h-3 w-3"}),e]},e))})]}),c&&ee.jsx("p",{className:"text-sm text-destructive",children:c}),ee.jsxs(BP,{children:[ee.jsx(Tk,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),ee.jsx(Tk,{onClick:()=>{(async()=>{u(!0),d(null);try{const t=await nS(e.id,o);r(t),n(!1)}catch(hN){d(hN instanceof Error?hN.message:"Failed to update shares")}finally{u(!1)}})()},disabled:l,children:l?"保存中...":"保存"})]})]})})}WP.displayName=OP.displayName;const GP=Array(12).fill(0),YP=({visible:e,className:t})=>H.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},H.createElement("div",{className:"sonner-spinner"},GP.map((e,t)=>H.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),KP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.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"})),XP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},H.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"})),qP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.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"})),QP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.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"})),ZP=H.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"},H.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),H.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));let JP=1;const eT=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:n,...r}=e,o="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:JP++,a=this.toasts.find(e=>e.id===o),i=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(t=>t.id===o?(this.publish({...t,...e,id:o,title:n}),{...t,...e,id:o,dismissible:i,title:n}):t):this.addToast({title:n,...r,dismissible:i,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let o,a=void 0!==n;const i=r.then(async e=>{o=["resolve",e];if(H.isValidElement(e))a=!1,this.create({id:n,type:"default",message:e});else if(tT(e)&&!e.ok){a=!1;const r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,o="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...i})}else if(e instanceof Error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...i})}else if(void 0!==t.success){a=!1;const r="function"==typeof t.success?await t.success(e):t.success,o="function"==typeof t.description?await t.description(e):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"success",description:o,...i})}}).catch(async e=>{if(o=["reject",e],void 0!==t.error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...i})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),null==t.finally||t.finally.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===o[0]?t(o[1]):e(o[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{const n=(null==t?void 0:t.id)||JP++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},tT=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,nT=(e,t)=>{const n=(null==t?void 0:t.id)||JP++;return eT.addToast({title:e,...t,id:n}),n},rT=Object.assign(nT,{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:()=>eT.toasts,getToasts:()=>eT.getActiveToasts()});function oT(e){return void 0!==e.label}!function(e){if("undefined"==typeof document)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))}("[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%)}");const aT=3,iT=14;function sT(...e){return e.filter(Boolean).join(" ")}const lT=e=>{var t,n,r,o,a,i,s,l,u;const{invert:c,toast:d,unstyled:f,interacting:p,setHeights:h,visibleToasts:m,heights:g,index:v,toasts:y,expanded:b,removeToast:x,defaultRichColors:w,closeButton:k,style:S,cancelButtonStyle:E,actionButtonStyle:j,className:C="",descriptionClassName:P="",duration:T,position:N,gap:M,expandByDefault:R,classNames:D,icons:L,closeButtonAriaLabel:_="Close toast"}=e,[O,A]=H.useState(null),[I,z]=H.useState(null),[F,V]=H.useState(!1),[$,B]=H.useState(!1),[U,W]=H.useState(!1),[G,Y]=H.useState(!1),[K,X]=H.useState(!1),[q,Q]=H.useState(0),[Z,J]=H.useState(0),ee=H.useRef(d.duration||T||4e3),te=H.useRef(null),ne=H.useRef(null),re=0===v,oe=v+1<=m,ae=d.type,ie=!1!==d.dismissible,se=d.className||"",le=d.descriptionClassName||"",ue=H.useMemo(()=>g.findIndex(e=>e.toastId===d.id)||0,[g,d.id]),ce=H.useMemo(()=>{var e;return null!=(e=d.closeButton)?e:k},[d.closeButton,k]),de=H.useMemo(()=>d.duration||T||4e3,[d.duration,T]),fe=H.useRef(0),pe=H.useRef(0),he=H.useRef(0),me=H.useRef(null),[ge,ve]=N.split("-"),ye=H.useMemo(()=>g.reduce((e,t,n)=>n>=ue?e:e+t.height,0),[g,ue]),be=(()=>{const[e,t]=H.useState(document.hidden);return H.useEffect(()=>{const e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),xe=d.invert||c,we="loading"===ae;pe.current=H.useMemo(()=>ue*M+ye,[ue,ye]),H.useEffect(()=>{ee.current=de},[de]),H.useEffect(()=>{V(!0)},[]),H.useEffect(()=>{const e=ne.current;if(e){const t=e.getBoundingClientRect().height;return J(t),h(e=>[{toastId:d.id,height:t,position:d.position},...e]),()=>h(e=>e.filter(e=>e.toastId!==d.id))}},[h,d.id]),H.useLayoutEffect(()=>{if(!F)return;const e=ne.current,t=e.style.height;e.style.height="auto";const n=e.getBoundingClientRect().height;e.style.height=t,J(n),h(e=>e.find(e=>e.toastId===d.id)?e.map(e=>e.toastId===d.id?{...e,height:n}:e):[{toastId:d.id,height:n,position:d.position},...e])},[F,d.title,d.description,h,d.id,d.jsx,d.action,d.cancel]);const ke=H.useCallback(()=>{B(!0),Q(pe.current),h(e=>e.filter(e=>e.toastId!==d.id)),setTimeout(()=>{x(d)},200)},[d,x,h,pe]);H.useEffect(()=>{if(d.promise&&"loading"===ae||d.duration===1/0||"loading"===d.type)return;let e;return b||p||be?(()=>{if(he.current<fe.current){const e=(new Date).getTime()-fe.current;ee.current=ee.current-e}he.current=(new Date).getTime()})():ee.current!==1/0&&(fe.current=(new Date).getTime(),e=setTimeout(()=>{null==d.onAutoClose||d.onAutoClose.call(d,d),ke()},ee.current)),()=>clearTimeout(e)},[b,p,d,ae,be,ke]),H.useEffect(()=>{d.delete&&(ke(),null==d.onDismiss||d.onDismiss.call(d,d))},[ke,d.delete]);const Se=d.icon||(null==L?void 0:L[ae])||(e=>{switch(e){case"success":return KP;case"info":return qP;case"warning":return XP;case"error":return QP;default:return null}})(ae);var Ee,je,Ce,Pe;return H.createElement("li",{tabIndex:0,ref:ne,className:sT(C,se,null==D?void 0:D.toast,null==d||null==(t=d.classNames)?void 0:t.toast,null==D?void 0:D.default,null==D?void 0:D[ae],null==d||null==(n=d.classNames)?void 0:n[ae]),"data-sonner-toast":"","data-rich-colors":null!=(Ee=d.richColors)?Ee:w,"data-styled":!Boolean(d.jsx||d.unstyled||f),"data-mounted":F,"data-promise":Boolean(d.promise),"data-swiped":K,"data-removed":$,"data-visible":oe,"data-y-position":ge,"data-x-position":ve,"data-index":v,"data-front":re,"data-swiping":U,"data-dismissible":ie,"data-type":ae,"data-invert":xe,"data-swipe-out":G,"data-swipe-direction":I,"data-expanded":Boolean(b||R&&F),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":y.length-v,"--offset":`${$?q:pe.current}px`,"--initial-height":R?"auto":`${Z}px`,...S,...d.style},onDragEnd:()=>{W(!1),A(null),me.current=null},onPointerDown:e=>{2!==e.button&&!we&&ie&&(te.current=new Date,Q(pe.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(W(!0),me.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n;if(G||!ie)return;me.current=null;const r=Number((null==(e=ne.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ne.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),a=(new Date).getTime()-(null==(n=te.current)?void 0:n.getTime()),i="x"===O?r:o,s=Math.abs(i)/a;if(Math.abs(i)>=45||s>.11)return Q(pe.current),null==d.onDismiss||d.onDismiss.call(d,d),z("x"===O?r>0?"right":"left":o>0?"down":"up"),ke(),void Y(!0);var l,u;null==(l=ne.current)||l.style.setProperty("--swipe-amount-x","0px"),null==(u=ne.current)||u.style.setProperty("--swipe-amount-y","0px"),X(!1),W(!1),A(null)},onPointerMove:t=>{var n,r,o;if(!me.current||!ie)return;if((null==(n=window.getSelection())?void 0:n.toString().length)>0)return;const a=t.clientY-me.current.y,i=t.clientX-me.current.x;var s;const l=null!=(s=e.swipeDirections)?s:function(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(N);!O&&(Math.abs(i)>1||Math.abs(a)>1)&&A(Math.abs(i)>Math.abs(a)?"x":"y");let u={x:0,y:0};const c=e=>1/(1.5+Math.abs(e)/20);if("y"===O){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&a<0||l.includes("bottom")&&a>0)u.y=a;else{const e=a*c(a);u.y=Math.abs(e)<Math.abs(a)?e:a}}else if("x"===O&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&i<0||l.includes("right")&&i>0)u.x=i;else{const e=i*c(i);u.x=Math.abs(e)<Math.abs(i)?e:i}(Math.abs(u.x)>0||Math.abs(u.y)>0)&&X(!0),null==(r=ne.current)||r.style.setProperty("--swipe-amount-x",`${u.x}px`),null==(o=ne.current)||o.style.setProperty("--swipe-amount-y",`${u.y}px`)}},ce&&!d.jsx&&"loading"!==ae?H.createElement("button",{"aria-label":_,"data-disabled":we,"data-close-button":!0,onClick:we||!ie?()=>{}:()=>{ke(),null==d.onDismiss||d.onDismiss.call(d,d)},className:sT(null==D?void 0:D.closeButton,null==d||null==(r=d.classNames)?void 0:r.closeButton)},null!=(je=null==L?void 0:L.close)?je:ZP):null,(ae||d.icon||d.promise)&&null!==d.icon&&(null!==(null==L?void 0:L[ae])||d.icon)?H.createElement("div",{"data-icon":"",className:sT(null==D?void 0:D.icon,null==d||null==(o=d.classNames)?void 0:o.icon)},d.promise||"loading"===d.type&&!d.icon?d.icon||((null==L?void 0:L.loading)?H.createElement("div",{className:sT(null==D?void 0:D.loader,null==d||null==(Pe=d.classNames)?void 0:Pe.loader,"sonner-loader"),"data-visible":"loading"===ae},L.loading):H.createElement(YP,{className:sT(null==D?void 0:D.loader,null==d||null==(Ce=d.classNames)?void 0:Ce.loader),visible:"loading"===ae})):null,"loading"!==d.type?Se:null):null,H.createElement("div",{"data-content":"",className:sT(null==D?void 0:D.content,null==d||null==(a=d.classNames)?void 0:a.content)},H.createElement("div",{"data-title":"",className:sT(null==D?void 0:D.title,null==d||null==(i=d.classNames)?void 0:i.title)},d.jsx?d.jsx:"function"==typeof d.title?d.title():d.title),d.description?H.createElement("div",{"data-description":"",className:sT(P,le,null==D?void 0:D.description,null==d||null==(s=d.classNames)?void 0:s.description)},"function"==typeof d.description?d.description():d.description):null),H.isValidElement(d.cancel)?d.cancel:d.cancel&&oT(d.cancel)?H.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||E,onClick:e=>{oT(d.cancel)&&ie&&(null==d.cancel.onClick||d.cancel.onClick.call(d.cancel,e),ke())},className:sT(null==D?void 0:D.cancelButton,null==d||null==(l=d.classNames)?void 0:l.cancelButton)},d.cancel.label):null,H.isValidElement(d.action)?d.action:d.action&&oT(d.action)?H.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||j,onClick:e=>{oT(d.action)&&(null==d.action.onClick||d.action.onClick.call(d.action,e),e.defaultPrevented||ke())},className:sT(null==D?void 0:D.actionButton,null==d||null==(u=d.classNames)?void 0:u.actionButton)},d.action.label):null)};function uT(){if("undefined"==typeof window)return"ltr";if("undefined"==typeof document)return"ltr";const e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function cT(e,t){const n={};return[e,t].forEach((e,t)=>{const r=1===t,o=r?"--mobile-offset":"--offset",a=r?"16px":"24px";function i(e){["top","right","bottom","left"].forEach(t=>{n[`${o}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?i(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?n[`${o}-${t}`]=a:n[`${o}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):i(a)}),n}const dT=H.forwardRef(function(e,t){const{id:n,invert:r,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:s,className:l,offset:u,mobileOffset:c,theme:d="light",richColors:f,duration:p,style:h,visibleToasts:m=aT,toastOptions:g,dir:v=uT(),gap:y=iT,icons:b,containerAriaLabel:x="Notifications"}=e,[w,k]=H.useState([]),S=H.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),E=H.useMemo(()=>Array.from(new Set([o].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,o]),[j,C]=H.useState([]),[P,T]=H.useState(!1),[N,M]=H.useState(!1),[R,D]=H.useState("system"!==d?d:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=H.useRef(null),_=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=H.useRef(null),A=H.useRef(!1),I=H.useCallback(e=>{k(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||eT.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return H.useEffect(()=>eT.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{ud.flushSync(()=>{k(t=>{const n=t.findIndex(t=>t.id===e.id);return-1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),H.useEffect(()=>{if("system"!==d)return void D(d);if("system"===d&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?D("dark"):D("light")),"undefined"==typeof window)return;const e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{D(e?"dark":"light")})}catch(t){e.addListener(({matches:e})=>{try{D(e?"dark":"light")}catch(pN){console.error(pN)}})}},[d]),H.useEffect(()=>{w.length<=1&&T(!1)},[w]),H.useEffect(()=>{const e=e=>{var t;var n;a.every(t=>e[t]||e.code===t)&&(T(!0),null==(n=L.current)||n.focus());"Escape"!==e.code||document.activeElement!==L.current&&!(null==(t=L.current)?void 0:t.contains(document.activeElement))||T(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),H.useEffect(()=>{if(L.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,A.current=!1)}},[L.current]),H.createElement("section",{ref:t,"aria-label":`${x} ${_}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((t,n)=>{var o;const[a,d]=t.split("-");return S.length?H.createElement("ol",{key:t,dir:"auto"===v?uT():v,tabIndex:-1,ref:L,className:l,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":a,"data-x-position":d,style:{"--front-toast-height":`${(null==(o=j[0])?void 0:o.height)||0}px`,"--width":"356px","--gap":`${y}px`,...h,...cT(u,c)},onBlur:e=>{A.current&&!e.currentTarget.contains(e.relatedTarget)&&(A.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||A.current||(A.current=!0,O.current=e.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{N||T(!1)},onDragEnd:()=>T(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||M(!0)},onPointerUp:()=>M(!1)},S.filter(e=>!e.position&&0===n||e.position===t).map((n,o)=>{var a,l;return H.createElement(lT,{key:n.id,icons:b,index:o,toast:n,defaultRichColors:f,duration:null!=(a=null==g?void 0:g.duration)?a:p,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(l=null==g?void 0:g.closeButton)?l:s,interacting:N,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:I,toasts:S.filter(e=>e.position==n.position),heights:j.filter(e=>e.position==n.position),setHeights:C,expandByDefault:i,gap:y,expanded:P,swipeDirections:e.swipeDirections})})):null}))});function fT(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 pT({status:e}){return ee.jsx("span",{className:ik("inline-block w-2 h-2 rounded-full",{"bg-green-500":"running"===e,"bg-zinc-400":"stopped"===e,"bg-yellow-400 animate-pulse":"restarting"===e})})}const hT=H.memo(function({project:e,active:t=!1,statusStack:n=[],onDelete:r,onArchive:o,onUnarchive:a,onUpdated:i}){var s,l;const u=cf(),[c,d]=W.useState(!1),[f,p]=W.useState(null),[h,m]=W.useState(!1),[g,v]=W.useState(e.name),y=W.useRef(null),b=!!e._sharedPermission;W.useEffect(()=>{let t=!1;return aE(e.id).then(({bytes:e})=>{t||p(e)}).catch(()=>{}),()=>{t=!0}},[e.id]);const x="view"===e._sharedPermission,w=t=>{t.stopPropagation(),v(e.name),m(!0),setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.select()},0)},k=async()=>{const t=g.trim();if(t&&t!==e.name)try{const n=await ZS(e.id,t);null==i||i(n),m(!1)}catch(hN){rT.error("Rename failed",{description:null==hN?void 0:hN.message})}else m(!1)},S=ee.jsx(dw.div,{whileHover:e.archived||t?{}:{y:-2},transition:{duration:.2},children:ee.jsxs(sk,{className:ik("group cursor-pointer transition-colors relative",e.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":t?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!e.archived&&u(`/projects/${e.id}`),children:[ee.jsxs(lk,{className:"pb-2",children:[ee.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h?ee.jsx("input",{ref:y,className:"text-base leading-tight font-semibold bg-transparent border-b border-primary outline-none w-full min-w-0",value:g,onChange:e=>v(e.target.value),onBlur:()=>{k()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),k()),"Escape"===e.key&&m(!1)},onClick:e=>e.stopPropagation()}):ee.jsx(uk,{className:ik("text-base leading-tight",e.archived&&"text-muted-foreground"),onDoubleClick:b||e.archived?void 0:w,children:e.name}),ee.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!b&&ee.jsxs(ee.Fragment,{children:[e.archived?ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),a(e.id)},title:"Restore project",children:ee.jsx(_E,{className:"h-3.5 w-3.5"})}):ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:w,title:"Rename project",children:ee.jsx(rj,{className:"h-3.5 w-3.5"})}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),d(!0)},title:"共享设置",children:ee.jsx(pj,{className:"h-3.5 w-3.5"})}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),o(e.id)},title:"Archive project",children:ee.jsx(OE,{className:"h-3.5 w-3.5"})})]}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:t=>{t.stopPropagation(),confirm(`Delete project "${e.name}"? This cannot be undone.`)&&r(e.id)},title:"Delete project",children:ee.jsx(fj,{className:"h-3.5 w-3.5"})})]})})]}),ee.jsx("div",{className:"flex items-center gap-1.5",children:e.archived?ee.jsx(vj,{variant:"secondary",className:"text-xs",children:"Archived"}):ee.jsxs(ee.Fragment,{children:[ee.jsx(pT,{status:e.status}),ee.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:e.status}),t&&n.length>0&&ee.jsx("div",{className:"ml-auto",children:ee.jsx(Yb,{mode:"wait",children:n.slice(-1).map(e=>ee.jsx(dw.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25,ease:"easeOut"},children:ee.jsx(vj,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:fT(e.phase,e.detail)})},e.id))})})]})})]}),ee.jsxs(dk,{className:"space-y-2",children:[ee.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[ee.jsx(BE,{className:"h-3.5 w-3.5 flex-shrink-0"}),ee.jsx("span",{className:"truncate font-mono",children:e.folderPath}),null!==f&&ee.jsx("span",{className:"flex-shrink-0 ml-auto text-muted-foreground/70",children:(E=f,E>=1073741824?(E/1073741824).toFixed(1)+" GB":E>=1048576?(E/1048576).toFixed(1)+" MB":Math.round(E/1024)+" KB")})]}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(vj,{variant:"outline",className:"text-xs font-mono",children:e.cliTool??"claude"}),ee.jsx(vj,{variant:"unlimited"===e.permissionMode?"destructive":"secondary",className:"text-xs",children:"unlimited"===e.permissionMode?"Unlimited":"Limited"}),b&&ee.jsxs(vj,{variant:"outline",className:"text-xs gap-0.5",children:[x?ee.jsx(VE,{className:"h-3 w-3"}):ee.jsx(rj,{className:"h-3 w-3"}),x?"可见":"可编辑"]}),!b&&e.shares&&e.shares.length>0&&ee.jsxs(vj,{variant:"outline",className:"text-xs gap-0.5",children:[ee.jsx(pj,{className:"h-3 w-3"}),e.shares.length]}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})]}),(e.tags??[]).length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(e.tags??[]).slice(0,3).map(e=>ee.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",e]},e)),((null==(s=e.tags)?void 0:s.length)??0)>3&&ee.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",((null==(l=e.tags)?void 0:l.length)??0)-3]})]})]})]})});var E;const j=t&&!e.archived?ee.jsx("div",{className:"card-active-glow rounded-lg",children:S}):S;return ee.jsxs(ee.Fragment,{children:[j,!b&&i&&ee.jsx(HP,{project:e,open:c,onOpenChange:d,onUpdated:i})]})});function mT({onSelect:e}){const[t,n]=W.useState(""),[r,o]=W.useState(null),[a,i]=W.useState([]),[s,l]=W.useState(!0),[u,c]=W.useState(null),[d,f]=W.useState(!1),[p,h]=W.useState(""),[m,g]=W.useState(null),[v,y]=W.useState(!1),b=W.useRef(null),x=async e=>{l(!0),c(null);try{const t=await ES(e);n(t.path),o(t.parent),i(t.entries)}catch(hN){c(hN instanceof Error?hN.message:"Failed to load directory")}finally{l(!1)}};W.useEffect(()=>{x()},[]),W.useEffect(()=>{d&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[d]);const w=()=>{f(!1),h(""),g(null)},k=async()=>{const e=p.trim();if(e){y(!0),g(null);try{const{path:n}=await PS(t,e);f(!1),h(""),await x(t),x(n)}catch(hN){g(hN instanceof Error?hN.message:"Failed to create folder")}finally{y(!1)}}},S=t.split("/").filter(Boolean);return ee.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[ee.jsx(Tk,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>{x()},title:"Home",children:ee.jsx(KE,{className:"h-3 w-3"})}),ee.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:S.map((e,t)=>ee.jsxs(H.Fragment,{children:[ee.jsx(zE,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),ee.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>(e=>{const t="/"+S.slice(0,e+1).join("/");x(t)})(t),children:e})]},t))}),ee.jsxs(Tk,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:()=>{h(""),g(null),f(!0)},disabled:d||s||!!u,title:"New folder",children:[ee.jsx(UE,{className:"h-3.5 w-3.5"}),ee.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),ee.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),u&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:u}),!s&&!u&&ee.jsxs("div",{className:"p-1",children:[r&&ee.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:()=>{x(r)},children:[ee.jsx(AE,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("span",{children:".."})]}),d&&ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[ee.jsx(WE,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),ee.jsx("input",{ref:b,className:ik("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",m&&"border-destructive"),placeholder:"Folder name",value:p,onChange:e=>{h(e.target.value),g(null)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key&&w()},disabled:v}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>{k()},disabled:!p.trim()||v,title:"Create",children:ee.jsx(IE,{className:"h-3.5 w-3.5 text-green-600"})}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:w,disabled:v,title:"Cancel",children:ee.jsx(hj,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),m&&ee.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:m}),0===a.length&&!d&&ee.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),a.map(e=>ee.jsxs("button",{className:ik("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left","dir"===e.type?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{"dir"===e.type&&x(e.path)},disabled:"file"===e.type,children:["dir"===e.type?ee.jsx(WE,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):ee.jsx($E,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),ee.jsx("span",{className:"truncate",children:e.name})]},e.path))]})]}),ee.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),ee.jsx(Tk,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const gT=[{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)"},{value:"gemini",label:"Gemini",desc:"Google Gemini CLI"},{value:"terminal",label:"Terminal",desc:"Plain shell (no AI CLI)"}],vT={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"},gemini:{limited:"gemini",unlimited:"gemini --yolo"},terminal:{limited:"$SHELL (interactive)",unlimited:"$SHELL (interactive)"}};function yT({open:e,onOpenChange:t,onCreated:n}){const[r,o]=W.useState("name"),[a,i]=W.useState(""),[s,l]=W.useState(""),[u,c]=W.useState("claude"),[d,f]=W.useState("limited"),[p,h]=W.useState(!1),[m,g]=W.useState(null),v=e=>{e||(o("name"),i(""),l(""),c("claude"),f("limited"),g(null),h(!1)),t(e)},y=()=>{a.trim()?(g(null),o("folder")):g("Please enter a project name")},b=["name","folder","settings"];return ee.jsx(IP,{open:e,onOpenChange:v,children:ee.jsxs(VP,{className:"sm:max-w-lg",children:[ee.jsxs($P,{children:[ee.jsx(UP,{children:{name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"}[r]}),ee.jsxs(WP,{children:["name"===r&&"Give your project a name.","folder"===r&&"Choose the working directory for this project.","settings"===r&&"Choose the AI coding tool and run mode."]})]}),ee.jsx("div",{className:"flex gap-2 mb-2",children:b.map((e,t)=>ee.jsx("div",{className:"h-1.5 flex-1 rounded-full "+(r===e?"bg-primary":b.indexOf(r)>t?"bg-primary/40":"bg-muted")},e))}),"name"===r&&ee.jsxs("div",{className:"space-y-4",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{htmlFor:"project-name",children:"Project Name"}),ee.jsx(Nk,{id:"project-name",placeholder:"My Project",value:a,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y()},autoFocus:!0})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),"folder"===r&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"Working Directory"}),ee.jsx(mT,{onSelect:e=>{l(e),o("settings")}})]}),"settings"===r&&ee.jsxs("div",{className:"space-y-5",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"AI Coding Tool"}),ee.jsx("div",{className:"grid grid-cols-2 gap-2",children:gT.map(e=>ee.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors "+(u===e.value?"border-primary bg-primary/5":"hover:bg-accent"),children:[ee.jsx("input",{type:"radio",name:"cliTool",value:e.value,checked:u===e.value,onChange:()=>c(e.value),className:"accent-primary"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:e.label}),ee.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.value))})]}),"terminal"!==u&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"Permission Mode"}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:"limited"===d,onChange:()=>f("limited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Limited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:vT[u].limited})," — asks for permission before file changes."]})]})]}),ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:"unlimited"===d,onChange:()=>f("unlimited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:vT[u].unlimited})," — acts autonomously."]})]})]})]})]}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:[ee.jsx("span",{className:"font-medium",children:"Folder:"})," ",ee.jsx("span",{className:"font-mono",children:s})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),ee.jsxs(BP,{children:["name"!==r&&ee.jsx(Tk,{variant:"outline",onClick:()=>o("settings"===r?"folder":"name"),disabled:p,children:"Back"}),"name"===r&&ee.jsx(Tk,{onClick:y,children:"Next"}),"folder"===r&&ee.jsx(Tk,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),"settings"===r&&ee.jsx(Tk,{onClick:()=>{(async()=>{h(!0),g(null);try{const e=await rS({name:a.trim(),folderPath:s,permissionMode:d,cliTool:u});n(e),v(!1)}catch(hN){g(hN instanceof Error?hN.message:"Failed to create project")}finally{h(!1)}})()},disabled:p,children:p?"Creating...":"Create Project"})]})]})})}function bT({open:e,onOpenChange:t,onOpened:n}){const[r,o]=W.useState(""),[a,i]=W.useState(!1),[s,l]=W.useState(null),u=e=>{e||(o(""),l(null),i(!1)),t(e)};return ee.jsx(IP,{open:e,onOpenChange:u,children:ee.jsxs(VP,{className:"sm:max-w-lg",children:[ee.jsxs($P,{children:[ee.jsx(UP,{children:"Open Existing Project"}),ee.jsxs(WP,{children:["Select a folder that contains a ",ee.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"Project Folder"}),ee.jsx(mT,{onSelect:e=>{(async e=>{o(e),i(!0),l(null);try{const t=await oS(e);n(t),u(!1)}catch(hN){l(hN instanceof Error?hN.message:"Failed to open project"),i(!1)}})(e)}})]}),s&&ee.jsx("p",{className:"text-sm text-destructive",children:s}),r&&!s&&a&&ee.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),ee.jsx(BP,{children:ee.jsx(Tk,{variant:"outline",onClick:()=>u(!1),disabled:a,children:"Cancel"})})]})})}function xT(e,t){rT.success(`项目「${t}」的任务已完成`,{duration:1/0,action:{label:"查看",onClick:()=>{window.location.href=`/projects/${e}`}}})}const wT=`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}`,kT=3e3;function ST(e,t){const n=W.useRef(null),r=W.useRef(0),o=W.useRef(!0),a=W.useRef(!1),i=W.useRef(null),s=W.useRef(t);s.current=t;const l=W.useRef(!1),u=W.useCallback(e=>{var t;(null==(t=n.current)?void 0:t.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(e))},[]),c=W.useCallback((e,t)=>{var r;(null==(r=n.current)?void 0:r.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:e,rows:t})),l.current=!1):l.current=!0},[]),d=W.useCallback(e=>{u({type:"terminal_input",data:e})},[u]),f=W.useCallback((e,t)=>{u({type:"terminal_resize",cols:e,rows:t})},[u]),p=W.useCallback(()=>{u({type:"chat_subscribe"})},[u]),h=W.useCallback(()=>{if(!o.current)return;if(a.current)return;const t=Xk();if(!t)return void(window.location.href="/login");a.current=!0;const u=new WebSocket(`${wT}/ws/projects/${e}`);n.current=u,u.onopen=()=>{a.current=!1,r.current=0,u.send(JSON.stringify({type:"auth",token:t}))},u.onmessage=e=>{var t,n,r,o,a,i,u,c,d,f,p,h,m,g,v,y,b,x,w,k;let S;try{S=JSON.parse(e.data)}catch{return}switch(S.type){case"connected":l.current=!1,null==(n=(t=s.current).onConnected)||n.call(t);break;case"terminal_data":null==(o=(r=s.current).onTerminalData)||o.call(r,S.data);break;case"status":null==(i=(a=s.current).onStatus)||i.call(a,S.status);break;case"chat_message":{const e=S;null==(c=(u=s.current).onChatMessage)||c.call(u,e);break}case"project_stopped":{const e=S;null==(f=(d=s.current).onProjectStopped)||f.call(d,e.projectId,e.projectName);break}case"plan_status":null==(h=(p=s.current).onPlanStatus)||h.call(p,S);break;case"plan_node_update":null==(g=(m=s.current).onPlanNodeUpdate)||g.call(m,S);break;case"plan_nudge":null==(y=(v=s.current).onPlanNudge)||y.call(v,S);break;case"plan_replan":null==(x=(b=s.current).onPlanReplan)||x.call(b,S);break;case"context_update":null==(k=(w=s.current).onContextUpdate)||k.call(w,S);break;case"error":console.error("[WS] Server error:",S.message)}},u.onclose=()=>{a.current=!1,n.current===u&&(n.current=null),o.current&&r.current<5&&(r.current++,i.current=window.setTimeout(h,kT))},u.onerror=e=>{a.current=!1,console.error("[WS] WebSocket error:",e)}},[e]);return W.useEffect(()=>(o.current=!0,h(),()=>{var e;o.current=!1,i.current&&(clearTimeout(i.current),i.current=null),null==(e=n.current)||e.close(),n.current=null}),[h]),{subscribeTerminal:c,sendTerminalInput:d,sendTerminalResize:f,subscribeChatMessages:p}}function ET(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),i=W.useRef(e);i.current=e;const s=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=Xk();if(!e)return;o.current=!0;const l=new WebSocket(`${wT}/ws/dashboard`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{var t,n;try{const r=JSON.parse(e.data);"activity_update"===r.type?i.current.onActivityUpdate(r):"project_stopped"===r.type&&(null==(n=(t=i.current).onProjectStopped)||n.call(t,r.projectId,r.projectName))}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(s,kT))},l.onerror=e=>{o.current=!1,console.error("[DashboardWS] Error:",e)}},[]);W.useEffect(()=>(r.current=!0,s(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[s])}function jT({projectId:e,enabled:t,onChatMessage:n,onStatusChange:r,onContextUpdate:o}){const a=W.useRef(null),i=W.useRef(!0),s=W.useRef(0),l=W.useRef(null),u=W.useRef(!1),c=W.useRef(!1),d=W.useRef([]),f=W.useRef({onChatMessage:n,onStatusChange:r,onContextUpdate:o});f.current={onChatMessage:n,onStatusChange:r,onContextUpdate:o};const p=W.useCallback(()=>{if(c.current&&a.current&&a.current.readyState===WebSocket.OPEN)for(;d.current.length>0;){const e=d.current.shift();a.current.send(JSON.stringify({type:"terminal_input",data:e}))}},[]),h=W.useCallback(e=>{var t;c.current&&(null==(t=a.current)?void 0:t.readyState)===WebSocket.OPEN?a.current.send(JSON.stringify({type:"terminal_input",data:e})):d.current.push(e)},[]),m=W.useCallback(()=>{if(!i.current||!t)return;if(u.current)return;const n=Xk();if(!n)return;u.current=!0,c.current=!1;const r=new WebSocket(`${wT}/ws/projects/${e}`);a.current=r,r.onopen=()=>{u.current=!1,s.current=0,r.send(JSON.stringify({type:"auth",token:n}))},r.onmessage=e=>{var t,n,o,a,i,s;try{const l=JSON.parse(e.data);"connected"===l.type?(r.send(JSON.stringify({type:"chat_subscribe"})),c.current=!0,p()):"chat_message"===l.type?f.current.onChatMessage(l):"status"===l.type&&l.status?null==(n=(t=f.current).onStatusChange)||n.call(t,l.status):"project_stopped"===l.type?null==(a=(o=f.current).onStatusChange)||a.call(o,"stopped"):"context_update"===l.type&&(null==(s=(i=f.current).onContextUpdate)||s.call(i,l))}catch{}},r.onclose=()=>{if(u.current=!1,c.current=!1,a.current===r&&(a.current=null),i.current&&t)if(s.current<5){s.current++;const e=2e3*Math.random();l.current=window.setTimeout(m,kT+e)}else d.current.length>0&&(console.warn("[MonitorWS] Retries exhausted, dropping",d.current.length,"queued messages"),d.current=[])},r.onerror=()=>{u.current=!1}},[e,t,p]);return W.useEffect(()=>(i.current=!0,()=>{i.current=!1,d.current=[]}),[]),W.useEffect(()=>(s.current=0,t&&m(),()=>{var e;c.current=!1,l.current&&(clearTimeout(l.current),l.current=null),null==(e=a.current)||e.close(),a.current=null}),[m,t]),{sendInput:h}}const CT=18e6,PT=6048e5;function TT(e,t=18e6){if(!e||void 0===e.utilization||e.utilization<=0||!e.resetAt)return null;const n=new Date(e.resetAt).getTime()-Date.now();if(n<=0)return null;const r=t-n;return r<=0?null:Math.round(e.utilization/(r/t))}function NT({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",o=function(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`}(t.resetAt);return ee.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",ee.jsxs("span",{className:ik("font-medium",r),children:[n,"%"]}),o&&ee.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",o,")"]})]})}function MT({className:e}){const[t,n]=W.useState("loading"),[r,o]=W.useState(!1),a=()=>Vk(Fk.usageMonitorTool,"claude");W.useEffect(()=>{const e=async()=>{try{n(await kS(a()))}catch{n(null)}};e();const t=setInterval(()=>{e()},3e5),r=()=>{e()},o=t=>{t.key===Fk.usageMonitorTool&&e()};return window.addEventListener("ccweb:usage-tool-change",r),window.addEventListener("storage",o),()=>{clearInterval(t),window.removeEventListener("ccweb:usage-tool-change",r),window.removeEventListener("storage",o)}},[]);if("loading"===t)return null;if(!t)return null;const i=!!t.fiveHour,s=!!t.sevenDay,l=!!t.sevenDaySonnet,u=!!t.sevenDayOpus,c=i||s||l||u,d=TT(t.fiveHour,CT),f=TT(t.sevenDay,PT),p=TT(t.sevenDaySonnet,PT),h=null!==d||null!==f||null!==p;return ee.jsxs("div",{className:ik("flex items-center gap-1.5 text-xs",e),children:[h&&ee.jsxs("span",{className:"flex items-center gap-1",children:[null!==d&&ee.jsxs("span",{className:ik("font-medium",d<=100?"text-green-400":"text-orange-400"),title:`5h 配速:按当前速率,窗口结束时预计使用 ${d}%`,children:[d,"%"]}),null!==f&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:ik("font-medium",f<=100?"text-green-400":"text-orange-400"),title:`7d 配速:按当前速率,窗口结束时预计使用 ${f}%`,children:[f,"%"]})]}),null!==p&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:ik("font-medium",p<=100?"text-green-400":"text-orange-400"),title:`7d Sonnet 配速:按当前速率,窗口结束时预计使用 ${p}%`,children:[p,"%"]})]})]}),t.planName&&ee.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),c&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"|"}),ee.jsx(NT,{label:"5h",bucket:t.fiveHour}),s&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(NT,{label:"7d",bucket:t.sevenDay})]}),l&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(NT,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),u&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(NT,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),ee.jsx("button",{onClick:()=>{(async()=>{o(!0);try{n(await SS(a()))}catch{n(null)}finally{o(!1)}})()},className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:ee.jsx(aj,{className:ik("h-3 w-3",r&&"animate-spin")})})]})}function RT(){const[e,t]=W.useState([]),[n,r]=W.useState(!1),[o,a]=W.useState(""),[i,s]=W.useState(""),[l,u]=W.useState(""),[c,d]=W.useState(null),[f,p]=W.useState(""),[h,m]=W.useState(""),[g,v]=W.useState(""),y=W.useRef(null),b=W.useRef(null);W.useEffect(()=>{dS().then(t).catch(()=>t([]))},[]),W.useEffect(()=>{n&&setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},0)},[n]),W.useEffect(()=>{c&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[c]);const x=async()=>{const e=i.trim();if(e)try{const n=await fS({label:o.trim()||e,command:e,...l?{parentId:l}:{}});t(e=>[...e,n]),a(""),s(""),u(""),r(!1)}catch(hN){console.error("[GlobalShortcuts] Failed to add:",hN)}},w=async()=>{const e=h.trim();if(e&&c)try{const n=await pS(c,{label:f.trim()||e,command:e,parentId:g||null});t(e=>e.map(e=>e.id===c?n:e)),d(null)}catch(hN){console.error("[GlobalShortcuts] Failed to save:",hN)}};return ee.jsxs("section",{className:"mt-10",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-4",children:[ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(mj,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),ee.jsxs("button",{onClick:()=>{r(e=>!e),d(null)},className:ik("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:[ee.jsx(oj,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&ee.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[ee.jsx("input",{ref:y,placeholder:"名称(可选)",value:o,onChange:e=>a(e.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"}),ee.jsx("textarea",{placeholder:"命令内容…",value:i,onChange:e=>s(e.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:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x()),"Escape"===e.key&&(r(!1),a(""),s(""),u(""))}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(HE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:l,onChange:e=>u(e.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:[ee.jsx("option",{value:"",children:"无继承"}),e.map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex items-center justify-between",children:[ee.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("button",{onClick:()=>{r(!1),a(""),s("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{x()},disabled:!i.trim(),className:ik("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:"保存"})]})]})]}),0!==e.length||n?ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(n=>c===n.id?ee.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[ee.jsx("input",{ref:b,value:f,onChange:e=>p(e.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"}),ee.jsx("textarea",{value:h,onChange:e=>m(e.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:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),w()),"Escape"===e.key&&d(null)}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(HE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:g,onChange:e=>v(e.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:[ee.jsx("option",{value:"",children:"无继承"}),e.filter(e=>e.id!==n.id).map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex gap-2 justify-end",children:[ee.jsx("button",{onClick:()=>d(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{w()},disabled:!h.trim(),className:ik("text-xs px-2.5 py-1 rounded transition-colors text-white",h.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},n.id):ee.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[ee.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:n.label}),n.parentId&&(()=>{const t=e.find(e=>e.id===n.parentId);return t?ee.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[ee.jsx(HE,{className:"h-3 w-3 text-muted-foreground"}),ee.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",t.label]})]}):null})(),!n.parentId&&n.label!==n.command&&ee.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:n.command}),ee.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[ee.jsx("button",{onClick:()=>{d(n.id),p(n.label),m(n.command),v(n.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:ee.jsx(rj,{className:"h-3.5 w-3.5"})}),ee.jsx("button",{onClick:()=>{(async e=>{try{await hS(e),t(t=>t.filter(t=>t.id!==e)),c===e&&d(null)}catch(hN){console.error("[GlobalShortcuts] Failed to delete:",hN)}})(n.id)},className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:ee.jsx(hj,{className:"h-3.5 w-3.5"})})]})]},n.id))}):ee.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[ee.jsx(mj,{className:"h-6 w-6"}),ee.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]})]})}const DT=W.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function LT(){return W.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function _T({children:e}){const[t,n]=W.useState(()=>Vk(Fk.theme,"system")),r=LT(),o="system"===t?r:t;W.useEffect(()=>{const e=document.documentElement;e.classList.remove("light","dark"),e.classList.add(o)},[o]);return ee.jsx(DT.Provider,{value:{theme:t,resolved:o,setTheme:e=>{n(e),$k(Fk.theme,e)}},children:e})}function OT(){return W.useContext(DT)}function AT(){const{theme:e,setTheme:t}=OT(),n=[{value:"light",icon:uj,label:"浅色"},{value:"dark",icon:nj,label:"深色"},{value:"system",icon:tj,label:"系统"}];return ee.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:n,icon:r,label:o})=>ee.jsx("button",{onClick:()=>t(n),className:ik("p-1 rounded-sm transition-colors",e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:ee.jsx(r,{className:"h-3.5 w-3.5"})},n))})}const IT={workMinutes:30,breakMinutes:5};function zT(){return Vk(Fk.pomodoroConfig,IT,!0)}const FT=zk(e=>({running:!1,phase:"work",secondsLeft:60*zT().workMinutes,setRunning:t=>e({running:t}),setPhase:t=>e({phase:t}),setSecondsLeft:t=>e({secondsLeft:t})}));function VT(){const{running:e,phase:t,secondsLeft:n,setPhase:r,setSecondsLeft:o}=FT(),a=W.useCallback(e=>{const t=zT();var n;r(e),o("work"===e?60*t.workMinutes:60*t.breakMinutes),n="break"===e?"休息一下 ☕":"该工作了 💻",rT.info(`番茄钟: ${n}`)},[r,o]);return W.useEffect(()=>{if(!e)return;if(0===n)return void a("work"===t?"break":"work");const r=setTimeout(()=>o(n-1),1e3);return()=>clearTimeout(r)},[e,n,t,a,o]),null}function $T(){const{running:e,phase:t,secondsLeft:n}=FT(),r=Math.floor(n/60),o=n%60,a=`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`;return e?ld.createPortal(ee.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center pointer-events-none z-40 select-none",style:{opacity:"work"===t?.1:.6},children:[ee.jsx("div",{className:ik("font-mono font-bold tabular-nums leading-none","work"===t?"text-foreground":"text-blue-400 dark:text-blue-300"),style:{fontSize:"clamp(360px, 90vw, 1100px)"},children:a}),ee.jsx("div",{className:"mt-3 text-muted-foreground font-medium tracking-widest uppercase",style:{fontSize:"clamp(12px, 1.5vw, 20px)"},children:"work"===t?"专注工作":"休息一下"})]}),document.body):null}function BT(){const{running:e,phase:t,secondsLeft:n,setRunning:r,setPhase:o,setSecondsLeft:a}=FT(),i=Math.floor(n/60),s=n%60,l=`${String(i).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return ee.jsx("button",{onClick:()=>{if(e){const e=zT();o("work"),a(60*e.workMinutes)}else{const e=zT();o("work"),a(60*e.workMinutes)}r(!e)},className:ik("p-1 rounded transition-colors",e?"work"===t?"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?"work"===t?`工作中 ${l} — 点击停止`:`休息中 ${l} — 点击停止`:"启动番茄钟",children:ee.jsx(dj,{className:"h-4 w-4"})})}const UT="v2026.4.19-a",WT=!!window.electronUpdater;function HT(){const[e,t]=W.useState("idle"),[n,r]=W.useState(!1),[o,a]=W.useState(""),[i,s]=W.useState(0),[l,u]=W.useState(null),[c,d]=W.useState(null);W.useEffect(()=>{if(!window.electronUpdater)return;return window.electronUpdater.onUpdateStatus(e=>{switch(e.type){case"progress":{const t=e.info;s(Math.round((null==t?void 0:t.percent)??0));break}case"downloaded":t("downloaded");break;case"error":u(e.info||"Download failed"),t("error")}})},[]);const f=W.useCallback(async()=>{t("checking"),u(null),r(!0);try{if(WT){const e=await window.electronUpdater.checkForUpdate();if(e.error)throw new Error(e.error);if(!e.available)return void t("no_update");a(e.version?`v${e.version}`:"new version")}else{const e=await RS();if(!e.updateAvailable)return void t("no_update");a(`v${e.latest}`)}t("update_available")}catch(hN){u(hN instanceof Error?hN.message:"Check failed"),t("error")}},[]),p=W.useCallback(()=>{const e=3e3,n=Date.now(),r=()=>{if(Date.now()-n>3e5)return u("更新超时(5 分钟)— 请检查服务器状态"),void t("update_failed");LS().then(n=>{n?n.success?(a(n.newVersion?`v${n.newVersion}`:"new version"),t("update_complete")):(u(n.error||"Update failed"),t("update_failed")):setTimeout(r,e)}).catch(()=>{setTimeout(r,e)})};setTimeout(r,e)},[]),h=()=>{r(!1),setTimeout(()=>{t("idle"),a(""),u(null),s(0),d(null)},200)};return ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{f()},disabled:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e,title:"检查更新",children:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e?ee.jsx(qE,{className:"h-4 w-4 animate-spin"}):ee.jsx(FE,{className:"h-4 w-4"})}),ee.jsx(IP,{open:n,onOpenChange:e=>{e||h()},children:ee.jsxs(VP,{className:"sm:max-w-md",children:[ee.jsxs($P,{children:[ee.jsxs(UP,{children:["checking"===e&&"Checking for updates...","no_update"===e&&"Up to date","update_available"===e&&`Update ${o} available`,"downloading"===e&&"Downloading update...","downloaded"===e&&"Update ready to install","executing"===e&&"Updating server...","reconnecting"===e&&"Waiting for server restart...","update_complete"===e&&`Updated to ${o}`,"update_failed"===e&&"Update failed","error"===e&&"Update error"]}),ee.jsxs(WP,{children:["checking"===e&&"Checking for the latest version...","no_update"===e&&`Current version ${UT} is the latest.`,"update_available"===e&&"A new version is available. "+(WT?"Click download to update automatically.":""),"downloading"===e&&`Downloading... ${i}%`,"downloaded"===e&&"The update has been downloaded. Click install to restart and apply.","executing"===e&&"Server is shutting down and installing the update. Please wait...","reconnecting"===e&&"Update installed. Waiting for server to restart...","update_complete"===e&&`Successfully updated from ${UT} to ${o}. Click reload to use the new version.`,"update_failed"===e&&(l||"Update failed. You may need to restart the server manually."),"error"===e&&(l||"An error occurred.")]})]}),"downloading"===e&&ee.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:ee.jsx("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${i}%`}})}),("executing"===e||"reconnecting"===e)&&ee.jsx("div",{className:"flex items-center justify-center py-6",children:ee.jsx(qE,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),ee.jsxs(BP,{children:["no_update"===e&&ee.jsx(Tk,{onClick:h,children:"OK"}),"update_available"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"outline",onClick:h,children:"Later"}),ee.jsx(Tk,{onClick:()=>{(async()=>{if(WT){t("downloading"),s(0);const e=await window.electronUpdater.downloadUpdate();e.success?e.path&&d(e.path):(u(e.error||"Download failed"),t("error"))}else{t("executing");try{await DS(),t("reconnecting"),p()}catch(hN){u(hN instanceof Error?hN.message:"Execute failed"),t("error")}}})()},children:WT?"Download & Install":`Update to ${o}`})]}),"downloaded"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"outline",onClick:h,children:"Later"}),ee.jsx(Tk,{onClick:()=>{var e;null==(e=window.electronUpdater)||e.quitAndInstall(c||void 0)},children:"Restart & Install"})]}),"update_complete"===e&&ee.jsx(Tk,{onClick:()=>window.location.reload(),children:"Reload Page"}),"update_failed"===e&&ee.jsx(Tk,{onClick:h,children:"Close"}),"error"===e&&ee.jsx(Tk,{onClick:h,children:"Close"})]})]})})]})}function GT(e){return e.filter(e=>"text"===e.type).map(e=>e.content).join("\n")}const YT=H.memo(function({project:e,externalStatus:t,active:n=!1}){const r=cf(),[o,a]=W.useState("running"===e.status?"live":"stopped"),[i,s]=W.useState([]),[l,u]=W.useState(""),[c,d]=W.useState(!1),f=W.useRef(null),p=W.useRef(null),h=W.useRef(null),m=W.useRef(0),g=W.useCallback(async()=>{try{const t=await JS(e.id,1);if(0===t.length)return;const n=(await eE(e.id,t[0].id,"latest","user")).content.split(/(?=^## [UA]\d+)/m).filter(Boolean),r=[];for(const e of n){const t=e.match(/^## ([UA])(\d+).*\n/);if(!t)continue;const n="U"===t[1]?"user":"assistant",o=e.slice(t[0].length).trim();o&&r.push({role:n,content:o,ts:""})}s(e=>0===e.length?r.slice(-4):e)}catch{}},[e.id]);W.useEffect(()=>{"stopped"===o&&g()},[o,g]);const v=W.useRef(!1);W.useEffect(()=>{if("live"!==o)return void(v.current=!1);const e=setTimeout(()=>{v.current||g()},3e3);return()=>clearTimeout(e)},[o,g]),W.useEffect(()=>{t&&("running"!==t||"stopped"!==o&&"error"!==o?"stopped"===t&&"live"===o&&a("stopped"):(s([]),a("live")))},[t]);const y=W.useCallback(e=>{v.current=!0;const t=GT(e.blocks);t.trim()&&(s(n=>[...n,{role:e.role,content:t,ts:e.timestamp}].slice(-4)),"assistant"===e.role&&(d(!0),setTimeout(()=>d(!1),1e3)))},[]),b=W.useCallback(e=>{"stopped"===e&&a("stopped")},[]),{sendInput:x}=jT({projectId:e.id,enabled:"live"===o||"waking"===o,onChatMessage:y,onStatusChange:b});W.useEffect(()=>{if("live"===o&&f.current){const e=f.current;f.current=null,x(e+"\r")}},[o,x]),W.useEffect(()=>{var e;null==(e=p.current)||e.scrollTo({top:p.current.scrollHeight,behavior:"smooth"})},[i]),W.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const w=W.useCallback(()=>{const t=l.trim();if(t)if(u(""),"live"===o||"waking"===o)x(t+"\r");else if("stopped"===o||"error"===o){f.current=t;const n=++m.current;a("waking"),iS(e.id).then(()=>{n===m.current&&(s([]),a("live"))}).catch(e=>{n===m.current&&(rT.error(`启动失败: ${e instanceof Error?e.message:String(e)}`),a("error"),u(t),f.current=null)}),h.current=setTimeout(()=>{n===m.current&&f.current&&(rT.error("启动超时(10s)"),a("error"),u(f.current),f.current=null)},1e4)}},[l,o,e.id,x]),k="live"===o,S="stopped"===o,E="waking"===o,j=ee.jsxs("div",{className:ik("flex flex-col h-full rounded-lg overflow-hidden bg-background transition-colors duration-300",n?"border-transparent bg-transparent shadow-none":c?"border border-blue-500":"border border-border","error"===o&&"border border-red-500/50"),children:[ee.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1.5 border-b border-border bg-muted/30 transition-colors",children:[ee.jsx(YE,{className:"h-3.5 w-3.5 text-muted-foreground/40 flex-shrink-0 cursor-grab active:cursor-grabbing"}),ee.jsx("span",{className:"font-medium text-sm truncate flex-1 cursor-pointer hover:text-blue-400 transition-colors",onClick:()=>r(`/projects/${e.id}`),title:"打开项目详情",children:e.name}),ee.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.cliTool??"claude"}),ee.jsx("span",{className:ik("w-2 h-2 rounded-full flex-shrink-0",k?"bg-green-500":E?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),ee.jsxs("div",{ref:p,className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-0 text-xs",children:[i.map((e,t)=>{const n="user"===e.role;return ee.jsx("div",{className:ik("flex",n?"justify-end":"justify-start"),children:ee.jsx("div",{className:ik("max-w-[85%] rounded-lg px-2.5 py-1.5 whitespace-pre-wrap break-words leading-relaxed",n?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm dark:bg-blue-500/20 dark:border-blue-500/25":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:ee.jsx("div",{className:"line-clamp-6",children:e.content})})},t)}),S&&0===i.length&&ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-xs",children:"无对话记录"}),E&&ee.jsx("div",{className:"flex items-center justify-center h-full text-yellow-400 text-xs animate-pulse",children:"启动中..."})]}),ee.jsx("div",{className:"border-t border-border p-1.5",children:ee.jsx("input",{type:"text",value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e.shiftKey&&(e.preventDefault(),w())},disabled:E,placeholder:E?"启动中...":S?"输入命令(自动启动)... Shift+⏎":"输入命令... Shift+⏎",className:ik("w-full bg-transparent text-xs font-mono outline-none placeholder:text-muted-foreground/40 px-1.5 py-1",E&&"opacity-50 cursor-not-allowed")})})]});return n?ee.jsx("div",{className:"card-active-glow rounded-lg h-full",children:j}):j}),KT="ccweb:monitor-order";function XT(){try{return JSON.parse(localStorage.getItem(KT)||"[]")}catch{return[]}}function qT({projects:e,projectStatuses:t,activeProjectIds:n}){const r=W.useMemo(()=>e.filter(e=>!e.archived),[e]),[o,a]=W.useState(XT),[i,s]=W.useState(null),[l,u]=W.useState(null),c=W.useRef(null),d=W.useMemo(()=>function(e,t){const n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{const r=n.get(e.id)??1/0,o=n.get(t.id)??1/0;return r===o?0:r-o})}(r,o),[r,o]);W.useEffect(()=>{var e;o.length>0&&(e=o,localStorage.setItem(KT,JSON.stringify(e)))},[o]);const f=W.useCallback((e,t)=>{s(t),e.dataTransfer.effectAllowed="move";const n=document.createElement("div");n.style.width="1px",n.style.height="1px",n.style.opacity="0.01",document.body.appendChild(n),e.dataTransfer.setDragImage(n,0,0),c.current=n},[]),p=W.useCallback((e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u(t)},[]),h=W.useCallback((e,t)=>{if(e.preventDefault(),!i||i===t)return s(null),void u(null);const n=d.map(e=>e.id),r=n.indexOf(i),o=n.indexOf(t);if(-1===r||-1===o)return s(null),void u(null);n.splice(r,1),n.splice(o,0,i),a(n),s(null),u(null)},[i,d]),m=W.useCallback(()=>{s(null),u(null),c.current&&(c.current.remove(),c.current=null)},[]),{cols:g,rows:v}=(y=d.length)<=1?{cols:1,rows:1}:y<=2?{cols:2,rows:1}:y<=4?{cols:2,rows:2}:y<=6?{cols:3,rows:2}:y<=9?{cols:3,rows:3}:y<=12?{cols:4,rows:3}:{cols:4,rows:Math.ceil(y/4)};var y;if(0===d.length)return ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/50 text-sm",children:"没有活跃项目"});const b=v<=3;return ee.jsx("div",{className:"h-full w-full p-2 gap-2 overflow-y-auto",style:{display:"grid",gridTemplateColumns:`repeat(${g}, minmax(0, 1fr))`,gridAutoRows:b?`minmax(180px, min(${Math.floor(100/v)}vh, 350px))`:"280px"},children:d.map(e=>ee.jsx("div",{draggable:!0,onDragStart:t=>f(t,e.id),onDragOver:t=>p(t,e.id),onDrop:t=>h(t,e.id),onDragEnd:m,className:ik("transition-all duration-200",i===e.id&&"opacity-40 scale-95",l===e.id&&i!==e.id&&"ring-2 ring-blue-500/50 rounded-lg"),children:ee.jsx(YT,{project:e,externalStatus:t.get(e.id),active:n.has(e.id)})},e.id))})}function QT(){const e=cf(),{projects:t,loading:n,error:r,hasFetched:o,fetchProjects:a,addProject:i,updateProject:s,removeProject:l}=Gk(),u=Wk(e=>e.clearToken),[c,d]=W.useState(!1),[f,p]=W.useState(!1),[h,m]=W.useState(new Set),g=W.useRef(new Map),[v,y]=W.useState(new Map),b=W.useRef(0),[x,w]=W.useState(!!document.fullscreenElement),[k,S]=W.useState(!1),[E,j]=Uk(Fk.monitorMode,!1,{parse:!0}),[C,P]=W.useState(new Map);W.useEffect(()=>{const e=()=>w(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),W.useEffect(()=>{a()},[a]);ET({onActivityUpdate:W.useCallback(e=>{if(e.status){const t=Gk.getState().projects.find(t=>t.id===e.projectId);t&&t.status!==e.status&&s({...t,status:e.status}),P(t=>{const n=new Map(t);return n.set(e.projectId,e.status),n})}const t=Date.now(),n=g.current;if(e.active){m(t=>t.has(e.projectId)?t:new Set(t).add(e.projectId));const r=n.get(e.projectId)??[];let o=!1;if(e.semantic){const n=r[r.length-1];`${e.semantic.phase}:${e.semantic.detail??""}`!==(n?`${n.phase}:${n.detail??""}`:"")?(r.push({id:b.current++,phase:e.semantic.phase,detail:e.semantic.detail,ts:t}),o=!0):n&&(n.ts=t)}const a=r.filter(e=>t-e.ts<8e3),i=a.length>3?a.slice(-3):a;i.length!==r.length&&(o=!0),n.set(e.projectId,i),o&&y(new Map(n))}else m(t=>{if(!t.has(e.projectId))return t;const n=new Set(t);return n.delete(e.projectId),n}),n.has(e.projectId)&&n.get(e.projectId).length>0&&(n.set(e.projectId,[]),y(new Map(n)))},[s]),onProjectStopped:W.useCallback((e,t)=>{xT(e,t)},[])}),W.useEffect(()=>{const e=setInterval(()=>{const e=Date.now(),t=g.current;let n=!1;for(const[r,o]of t){const a=o.filter(t=>e-t.ts<8e3);a.length!==o.length&&(t.set(r,a),n=!0)}n&&y(new Map(t)),m(e=>{let n=!1;const r=new Set(e);for(const o of e){const e=t.get(o);e&&0!==e.length||(r.delete(o),n=!0)}return n?r:e})},3e3);return()=>clearInterval(e)},[]);const T=W.useMemo(()=>t.filter(e=>!e.archived),[t]),N=W.useMemo(()=>t.filter(e=>e.archived),[t]),M=W.useMemo(()=>Array.from(new Set(t.flatMap(e=>e.tags??[]))),[t]),[R,D]=W.useState([]),L=W.useMemo(()=>0===R.length?T:T.filter(e=>R.some(t=>{var n;return null==(n=e.tags)?void 0:n.includes(t)})),[T,R]),[_,O]=Uk(Fk.projectOrder,[],{parse:!0}),[A,I]=W.useState(null),[z,F]=W.useState(null);W.useEffect(()=>{if(0===T.length)return;const e=T.map(e=>e.id);O(t=>{const n=[...t.filter(t=>e.includes(t)),...e.filter(e=>!t.includes(e))];return n.join(",")===t.join(",")?t:n})},[T]);const V=W.useMemo(()=>0===_.length?L:[...L].sort((e,t)=>{const n=_.indexOf(e.id),r=_.indexOf(t.id);return-1===n?1:-1===r?-1:n-r}),[L,_]),$=W.useCallback(e=>I(e),[]),B=W.useCallback(()=>{I(null),F(null)},[]),U=W.useCallback((e,t)=>{e.preventDefault(),F(t)},[]),H=W.useCallback((e,t,n)=>{e.preventDefault(),n&&n!==t?(O(e=>{const r=[...e],o=r.indexOf(n),a=r.indexOf(t);return-1===o||-1===a?e:(r.splice(o,1),r.splice(a,0,n),r)}),I(null),F(null)):F(null)},[O]),G={onDelete:e=>{(async e=>{try{await aS(e),l(e)}catch(hN){rT.error(hN instanceof Error?hN.message:"Failed to delete project")}})(e)},onArchive:e=>{(async e=>{try{const t=await sS(e);s(t)}catch(hN){rT.error(hN instanceof Error?hN.message:"Failed to archive project")}})(e)},onUnarchive:e=>{(async e=>{try{const t=await lS(e);s(t)}catch(hN){rT.error(hN instanceof Error?hN.message:"Failed to restore project")}})(e)},onUpdated:s};return ee.jsxs("div",{className:"min-h-screen bg-background",children:[ee.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:ee.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(cj,{className:"h-5 w-5"}),ee.jsxs("div",{children:[ee.jsx("span",{className:"font-semibold text-lg leading-tight block",children:"CC Web"}),ee.jsx("span",{className:"text-[10px] text-muted-foreground leading-none",children:UT})]})]}),ee.jsx(MT,{}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:ee.jsx(lj,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>e("/mobile"),title:"手机界面",children:ee.jsx(sj,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:ee.jsx(ij,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>j(!E),title:E?"卡片模式":"监控大屏",className:ik(E&&"text-blue-400 bg-blue-500/10"),children:E?ee.jsx(XE,{className:"h-4 w-4"}):ee.jsx(tj,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},title:x?"Exit fullscreen":"Fullscreen",children:x?ee.jsx(JE,{className:"h-4 w-4"}):ee.jsx(ZE,{className:"h-4 w-4"})}),ee.jsx(HT,{}),ee.jsx(BT,{}),ee.jsx(AT,{}),ee.jsxs(Tk,{variant:"ghost",size:"sm",onClick:()=>{u(),e("/login")},children:[ee.jsx(QE,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),E&&ee.jsx("div",{className:"flex-1 min-h-0",children:ee.jsx(qT,{projects:t,projectStatuses:C,activeProjectIds:h})}),!E&&ee.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-6",children:[ee.jsxs("div",{children:[ee.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),ee.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsxs(Tk,{variant:"outline",onClick:()=>p(!0),children:[ee.jsx(BE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(Tk,{onClick:()=>d(!0),children:[ee.jsx(oj,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),n&&!o&&ee.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),r&&ee.jsx("div",{className:"text-center text-destructive py-12",children:r}),o&&!n&&!r&&0===t.length&&ee.jsxs("div",{className:"text-center py-20",children:[ee.jsx(cj,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),ee.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),ee.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),ee.jsxs("div",{className:"flex gap-2 justify-center",children:[ee.jsxs(Tk,{variant:"outline",onClick:()=>p(!0),children:[ee.jsx(BE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(Tk,{onClick:()=>d(!0),children:[ee.jsx(oj,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!n&&!r&&M.length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[M.map(e=>ee.jsxs("button",{onClick:()=>D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:ik("px-2 py-0.5 rounded-full text-xs border transition-colors",R.includes(e)?"bg-blue-500/20 text-blue-400 border-blue-500/40":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",e]},e)),R.length>0&&ee.jsx("button",{onClick:()=>D([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:"清除"})]}),!n&&!r&&V.length>0&&ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:V.map((e,t)=>ee.jsx(dw.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:Math.min(.05*t,.3),ease:"easeOut"},draggable:!0,onDragStart:()=>$(e.id),onDragOver:t=>U(t,e.id),onDrop:t=>H(t,e.id,A),onDragEnd:B,style:{opacity:A===e.id?.4:1,cursor:"grab"},className:ik(z===e.id&&A!==e.id&&"ring-2 ring-blue-500/50 rounded-xl"),children:ee.jsx(hT,{project:e,active:h.has(e.id),statusStack:v.get(e.id)??[],...G})},e.id))}),!n&&!r&&N.length>0&&ee.jsxs("div",{className:"mt-10",children:[ee.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>S(e=>!e),children:[ee.jsx(dw.span,{animate:{rotate:k?90:0},transition:{duration:.2},children:ee.jsx(zE,{className:"h-4 w-4"})}),ee.jsx("span",{className:"font-medium",children:"Archived"}),ee.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:N.length})]}),ee.jsx(Yb,{children:k&&ee.jsx(dw.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:ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:N.map(e=>ee.jsx(hT,{project:e,active:!1,...G},e.id))})})})]}),ee.jsx(RT,{})]}),ee.jsx(yT,{open:c,onOpenChange:d,onCreated:e=>{i(e)}}),ee.jsx(bT,{open:f,onOpenChange:p,onOpened:e=>{i(e)}})]})}class ZT extends H.Component{constructor(){super(...arguments),t(this,"state",{hasError:!1,error:null}),t(this,"handleReset",()=>{var e,t;this.setState({hasError:!1,error:null}),null==(t=(e=this.props).onReset)||t.call(e)})}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t.componentStack),rT.error(e.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ee.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[ee.jsx("p",{children:"出错了"}),ee.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}}function JT({plugin:e,onConfigChange:t,onClose:n}){const{float:r,userConfig:o}=e,[a,i]=W.useState(()=>{var e,t;return{x:(null==(e=o.floatPosition)?void 0:e.x)??.5*window.innerWidth-r.defaultWidth/2,y:(null==(t=o.floatPosition)?void 0:t.y)??.3*window.innerHeight}}),[s,l]=W.useState(()=>{var e,t;return{w:(null==(e=o.floatSize)?void 0:e.w)??r.defaultWidth,h:(null==(t=o.floatSize)?void 0:t.h)??r.defaultHeight}}),[u,c]=W.useState(!1),[d,f]=W.useState(100),p=W.useRef(null),h=W.useRef(null),m=W.useCallback(()=>{f(Date.now()%1e5+100)},[]),g=W.useRef(null),v=W.useCallback(n=>{n.preventDefault(),m(),g.current={sx:n.clientX,sy:n.clientY,ox:a.x,oy:a.y},h.current&&(h.current.style.pointerEvents="none");const r=e=>{if(!g.current)return;const t=Math.max(0,Math.min(window.innerWidth-100,g.current.ox+e.clientX-g.current.sx)),n=Math.max(0,Math.min(window.innerHeight-40,g.current.oy+e.clientY-g.current.sy));p.current&&(p.current.style.left=t+"px",p.current.style.top=n+"px")},o=n=>{if(!g.current)return;const a=Math.max(0,Math.min(window.innerWidth-100,g.current.ox+n.clientX-g.current.sx)),s=Math.max(0,Math.min(window.innerHeight-40,g.current.oy+n.clientY-g.current.sy));g.current=null,h.current&&(h.current.style.pointerEvents=""),i({x:a,y:s}),t(e.id,{floatPosition:{x:a,y:s}}),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[a,m,e.id,t]),y=W.useRef(null),b=W.useCallback(n=>{if(!r.resizable)return;n.preventDefault(),n.stopPropagation(),m(),y.current={sx:n.clientX,sy:n.clientY,ow:s.w,oh:s.h},h.current&&(h.current.style.pointerEvents="none");const o=r.minWidth??150,a=r.minHeight??100,i=e=>{if(!y.current)return;const t=Math.max(o,y.current.ow+e.clientX-y.current.sx),n=Math.max(a,y.current.oh+e.clientY-y.current.sy);p.current&&(p.current.style.width=t+"px",p.current.style.height=n+"px")},u=n=>{if(!y.current)return;const r=Math.max(o,y.current.ow+n.clientX-y.current.sx),s=Math.max(a,y.current.oh+n.clientY-y.current.sy);y.current=null,h.current&&(h.current.style.pointerEvents=""),l({w:r,h:s}),t(e.id,{floatSize:{w:r,h:s}}),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",i),window.addEventListener("mouseup",u)},[s,r,m,e.id,t]);W.useEffect(()=>{const t=async t=>{var n,r,o,a,i;if(t.source!==(null==(n=h.current)?void 0:n.contentWindow))return;const{callId:s,method:l,args:u}=t.data;if(s&&l)try{const t=Xk(),n={"Content-Type":"application/json","X-Plugin-Id":e.id};let a,i;if(t&&(n.Authorization=`Bearer ${t}`),"storage:get"===l)a=`/api/plugin-bridge/storage/${e.id}`,i={method:"GET",headers:n};else if("storage:set"===l)a=`/api/plugin-bridge/storage/${e.id}`,i={method:"PUT",headers:n,body:JSON.stringify(u)};else{const t={"project:status":{path:`/api/plugin-bridge/project/status/${u.projectId}`,httpMethod:"GET"},"project:list":{path:"/api/plugin-bridge/project/list",httpMethod:"GET"},"terminal:send":{path:"/api/plugin-bridge/terminal/send",httpMethod:"POST"},"session:read":{path:`/api/plugin-bridge/session/${u.projectId}`,httpMethod:"GET"},"system:info":{path:"/api/plugin-bridge/system/info",httpMethod:"GET"}};if("backend:api"===l){const{method:t,path:r,body:o}=u;if(!r||!r.startsWith("/")||r.includes(".."))throw new Error("Invalid API path");a=`/api/plugins/${e.id}${r}`,i={method:t||"GET",headers:n},!o||"POST"!==t&&"PUT"!==t||(i.body=JSON.stringify(o))}else{const e=t[l];if(!e)throw new Error(`Unknown method: ${l}`);a=e.path,i={method:e.httpMethod,headers:n},"POST"===e.httpMethod&&(i.body=JSON.stringify(u))}}const c=await fetch(a,i),d=await c.json();null==(o=null==(r=h.current)?void 0:r.contentWindow)||o.postMessage({callId:s,result:d,error:null},window.location.origin)}catch(hN){const t=hN instanceof Error?hN.message:"Bridge error";null==(i=null==(a=h.current)?void 0:a.contentWindow)||i.postMessage({callId:s,result:null,error:t},window.location.origin)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e.id]);const x=o.clickable??r.clickable.default,w=`/plugins/${e.id}/${e.float?"index.html":""}`;return ee.jsxs(dw.div,{ref:p,className:ik("fixed rounded-lg border border-border shadow-xl overflow-hidden flex flex-col","bg-background/95 backdrop-blur-sm"),style:{left:a.x,top:a.y,width:u?200:s.w,height:u?32:s.h,zIndex:d},initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},onMouseDown:m,children:[ee.jsxs("div",{className:"h-8 flex items-center gap-1 px-2 bg-muted/50 border-b border-border cursor-grab active:cursor-grabbing flex-shrink-0 select-none",onMouseDown:v,children:[ee.jsx(GE,{className:"h-3 w-3 text-muted-foreground/40 flex-shrink-0"}),ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:e.name}),ee.jsx("button",{onClick:()=>c(e=>!e),className:"p-0.5 rounded hover:bg-white/10 text-muted-foreground/60 hover:text-foreground transition-colors",children:ee.jsx(ej,{className:"h-3 w-3"})}),ee.jsx("button",{onClick:()=>n(e.id),className:"p-0.5 rounded hover:bg-red-500/20 text-muted-foreground/60 hover:text-red-400 transition-colors",children:ee.jsx(hj,{className:"h-3 w-3"})})]}),!u&&ee.jsxs("div",{className:"flex-1 min-h-0 relative",children:[ee.jsx("iframe",{ref:h,src:w,sandbox:"allow-scripts allow-same-origin",className:"w-full h-full border-0",style:{pointerEvents:x?"auto":"none"}}),r.resizable&&ee.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-se-resize",onMouseDown:b,children:ee.jsxs("svg",{viewBox:"0 0 12 12",className:"w-3 h-3 text-muted-foreground/30",children:[ee.jsx("path",{d:"M11 1v10H1",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),ee.jsx("path",{d:"M11 5v6H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]})})]})]})}function eN({plugins:e,onPluginsChange:t,onClose:n}){const r=W.useCallback(async(e,n)=>{t(t=>t.map(t=>t.id===e?{...t,userConfig:{...t.userConfig,...n}}:t));try{await hE(e,n)}catch{}},[t]);return 0===e.length?null:ee.jsx(Yb,{children:e.map(e=>ee.jsx(JT,{plugin:e,onConfigChange:r,onClose:n},e.id))})}function tN({onTogglePlugin:e,activeIds:t}){const[n,r]=W.useState([]);return W.useEffect(()=>{dE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>r([]))},[]),W.useEffect(()=>{const e=()=>{dE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>{})};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),0===n.length?null:ee.jsx("div",{className:"fixed top-14 left-1/2 -translate-x-1/2 z-40 pointer-events-none",children:ee.jsx(dw.div,{className:"pointer-events-auto flex items-center gap-1 px-2 py-1 rounded-full bg-background/60 backdrop-blur-md border border-border/50 shadow-lg",initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:n.map(n=>{const r=t.has(n.id),o=n.name.slice(0,2);return ee.jsxs(dw.button,{onClick:()=>e(n),className:ik("relative flex items-center justify-center w-7 h-7 rounded-full text-[10px] font-medium transition-colors",r?"bg-blue-500/20 text-blue-400":"text-muted-foreground/70 hover:text-foreground hover:bg-muted/80"),whileHover:{scale:1.12},whileTap:{scale:.92},title:n.name+(n.description?` — ${n.description}`:""),children:[o,ee.jsx(Yb,{children:r&&ee.jsx(dw.span,{className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 h-1 w-1 rounded-full bg-blue-400",initial:{scale:0},animate:{scale:1},exit:{scale:0}})})]},n.id)})})})}const nN=H.lazy(()=>fd(()=>import("./ProjectPage-uXtZbquI.js").then(e=>e.b),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.ProjectPage}))),rN=H.lazy(()=>fd(()=>import("./SettingsPage-lg5h4qX7.js"),__vite__mapDeps([11,5,9,4])).then(e=>({default:e.SettingsPage}))),oN=H.lazy(()=>fd(()=>import("./SkillHubPage-DOXDfvIh.js"),__vite__mapDeps([12,8,7,5])).then(e=>({default:e.SkillHubPage}))),aN=H.lazy(()=>fd(()=>import("./ShareViewPage-3ZhlFkz4.js"),__vite__mapDeps([13,7,6])).then(e=>({default:e.ShareViewPage}))),iN=H.lazy(()=>fd(()=>import("./MobilePage-DF72akPm.js"),__vite__mapDeps([14,9,2,3,5])).then(e=>({default:e.MobilePage})));function sN(){return ee.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:ee.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function lN({children:e}){const[t,n]=W.useState(!1),r=Wk(e=>e.token),o=Wk(e=>e.setToken);return W.useEffect(()=>{r?n(!0):Jk()?eS().then(e=>o(e)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),t||r?r?ee.jsx(ee.Fragment,{children:e}):ee.jsx(wf,{to:"/login",replace:!0}):null}const uN=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;function cN(){const[e,t]=W.useState([]),[n,r]=W.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc_plugin_open")||"[]"))}catch{return new Set}}),o=lf();W.useEffect(()=>{dE().then(t).catch(()=>t([]))},[]);const a=W.useCallback(e=>{r(t=>{const n=new Set(t);n.has(e.id)?n.delete(e.id):n.add(e.id);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),i=W.useCallback(e=>{r(t=>{const n=new Set(t);n.delete(e);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),s=function(e){if("/"===e||"/dashboard"===e)return{type:"dashboard"};const t=e.match(/^\/projects?\/([^/]+)/);return t?{type:"project",projectId:t[1]}:{type:"other"}}(o.pathname),l=e.filter(e=>{if(!e.enabled||!n.has(e.id))return!1;switch(e.userConfig.scope??e.float.scope.default){case"global":return!0;case"dashboard":return"dashboard"===s.type;case"project":return"project"===s.type;case"project:specific":return"project"===s.type&&(e.userConfig.projectIds??[]).includes(s.projectId??"");default:return!1}}),u="/login"===o.pathname,c="/mobile"===o.pathname;return ee.jsxs(ee.Fragment,{children:[!u&&!c&&!uN&&ee.jsx(tN,{onTogglePlugin:a,activeIds:n}),ee.jsx(eN,{plugins:l,onPluginsChange:t,onClose:i})]})}function dN({children:e}){const t=lf();return uN&&"/"===t.pathname?ee.jsx(wf,{to:"/mobile",replace:!0}):ee.jsx(ee.Fragment,{children:e})}function fN(){return ee.jsxs(_T,{children:[ee.jsx(dT,{richColors:!0,position:"bottom-right"}),ee.jsx(VT,{}),ee.jsx($T,{}),ee.jsx(ZT,{children:ee.jsxs(Pf,{children:[ee.jsx(cN,{}),ee.jsx(dN,{children:ee.jsx(W.Suspense,{fallback:ee.jsx(sN,{}),children:ee.jsxs(Ef,{children:[ee.jsx(kf,{path:"/login",element:ee.jsx(RE,{})}),ee.jsx(kf,{path:"/",element:ee.jsx(lN,{children:ee.jsx(QT,{})})}),ee.jsx(kf,{path:"/projects/:id",element:ee.jsx(lN,{children:ee.jsx(nN,{})})}),ee.jsx(kf,{path:"/settings",element:ee.jsx(lN,{children:ee.jsx(rN,{})})}),ee.jsx(kf,{path:"/skillhub",element:ee.jsx(lN,{children:ee.jsx(oN,{})})}),ee.jsx(kf,{path:"/mobile",element:ee.jsx(lN,{children:ee.jsx(iN,{})})}),ee.jsx(kf,{path:"/share/:token",element:ee.jsx(aN,{})}),ee.jsx(kf,{path:"*",element:ee.jsx(wf,{to:"/",replace:!0})})]})})})]})})]})}te.createRoot(document.getElementById("root")).render(ee.jsx(H.StrictMode,{children:ee.jsx(fN,{})}));export{mS as $,Yb as A,Tk as B,zE as C,FE as D,VE as E,BE as F,qS as G,EE as H,Nk as I,CE as J,jE as K,TE as L,JE as M,PE as N,NE as O,rj as P,JS as Q,H as R,Fk as S,fj as T,eE as U,nE as V,tE as W,hj as X,rE as Y,oE as Z,fd as _,TS as a,zT as a$,dS as a0,mj as a1,HE as a2,yS as a3,IP as a4,VP as a5,$P as a6,UP as a7,WP as a8,_k as a9,Uk as aA,Gk as aB,cj as aC,wj as aD,mk as aE,Cj as aF,Rj as aG,yj as aH,bj as aI,hk as aJ,Ej as aK,Dj as aL,Zj as aM,ld as aN,Qj as aO,qC as aP,tC as aQ,UC as aR,Wj as aS,zj as aT,_S as aU,AS as aV,zS as aW,sk as aX,lk as aY,uk as aZ,dk as a_,BP as aa,vS as ab,gS as ac,xS as ad,uS as ae,cS as af,iE as ag,cf as ah,AE as ai,vj as aj,BT as ak,AT as al,qE as am,FS as an,iS as ao,xT as ap,ST as aq,MT as ar,uE as as,lE as at,GT as au,Bk as av,cE as aw,GE as ax,lj as ay,df as az,ik as b,HS as b0,dj as b1,OS as b2,VS as b3,BS as b4,WS as b5,IS as b6,US as b7,$S as b8,GS as b9,dE as ba,fE as bb,pE as bc,mE as bd,bS as be,wS as bf,sE as bg,ET as bh,tj as bi,jT as bj,$E as bk,kS as bl,r as bm,o as bn,gE as bo,SE as bp,vE as bq,yE as br,bE as bs,xE as bt,wE as bu,kE as bv,a as bw,ME as bx,LE as c,ZE as d,jS as e,Vk as f,Xk as g,Kk as h,ES as i,ee as j,aj as k,MS as l,CS as m,WE as n,dw as o,YS as p,QS as q,W as r,$k as s,rT as t,OT as u,IE as v,NS as w,oj as x,KS as y,XS as z};
|
|
75
|
+
*/const LE=(e,t)=>{const n=W.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:i="",children:s,...l},u)=>{return W.createElement("svg",{ref:u,...DE,width:r,height:r,stroke:n,strokeWidth:a?24*Number(o)/Number(r):o,className:["lucide",`lucide-${c=e,c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,i].join(" "),...l},[...t.map(([e,t])=>W.createElement(e,t)),...Array.isArray(s)?s:[s]]);var c});return n.displayName=`${e}`,n},_E=LE("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),OE=LE("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),AE=LE("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),IE=LE("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),zE=LE("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),FE=LE("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),VE=LE("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),$E=LE("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]),BE=LE("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),UE=LE("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),WE=LE("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),HE=LE("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),GE=LE("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),YE=LE("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),KE=LE("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),XE=LE("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),qE=LE("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),QE=LE("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),ZE=LE("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),JE=LE("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),ej=LE("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),tj=LE("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),nj=LE("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),rj=LE("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),oj=LE("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),aj=LE("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ij=LE("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),sj=LE("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),lj=LE("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]),uj=LE("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),cj=LE("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),dj=LE("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),fj=LE("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),pj=LE("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),hj=LE("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),mj=LE("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),gj=Ck("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function vj({className:e,variant:t,...n}){return ee.jsx("div",{className:ik(gj({variant:t}),e),...n})}function yj(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function bj(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>W.createContext(e));return function(n){const r=(null==n?void 0:n[e])||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const o=W.createContext(r),a=n.length;n=[...n,r];const i=t=>{var n;const{scope:r,children:i,...s}=t,l=(null==(n=null==r?void 0:r[e])?void 0:n[a])||o,u=W.useMemo(()=>s,Object.values(s));return ee.jsx(l.Provider,{value:u,children:i})};return i.displayName=t+"Provider",[i,function(n,i){var s;const l=(null==(s=null==i?void 0:i[e])?void 0:s[a])||o,u=W.useContext(l);if(u)return u;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},xj(r,...t)]}function xj(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var wj=(null==globalThis?void 0:globalThis.document)?W.useLayoutEffect:()=>{},kj=G[" useId ".trim().toString()]||(()=>{}),Sj=0;function Ej(e){const[t,n]=W.useState(kj());return wj(()=>{n(e=>e??String(Sj++))},[e]),e||(t?`radix-${t}`:"")}var jj=G[" useInsertionEffect ".trim().toString()]||wj;function Cj({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=function({defaultProp:e,onChange:t}){const[n,r]=W.useState(e),o=W.useRef(n),a=W.useRef(t);return jj(()=>{a.current=t},[t]),W.useEffect(()=>{var e;o.current!==n&&(null==(e=a.current)||e.call(a,n),o.current=n)},[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),s=void 0!==e,l=s?e:o;{const t=W.useRef(void 0!==e);W.useEffect(()=>{const e=t.current;if(e!==s){const t=e?"controlled":"uncontrolled",n=s?"controlled":"uncontrolled";console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,r])}const u=W.useCallback(t=>{var n;if(s){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&(null==(n=i.current)||n.call(i,r))}else a(t)},[s,e,a,i]);return[l,u]}function Pj(e){const t=Tj(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),i=a.find(Mj);if(i){const e=i.props.children,r=a.map(t=>t===i?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Tj(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?hk(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nj=Symbol("radix.slottable");function Mj(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Nj}var Rj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=Pj(`Primitive.${t}`),r=W.forwardRef((e,r)=>{const{asChild:o,...a}=e,i=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),ee.jsx(i,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dj(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}var Lj,_j="dismissableLayer.update",Oj="dismissableLayer.pointerDownOutside",Aj="dismissableLayer.focusOutside",Ij=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zj=W.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...l}=e,u=W.useContext(Ij),[c,d]=W.useState(null),f=(null==c?void 0:c.ownerDocument)??(null==globalThis?void 0:globalThis.document),[,p]=W.useState({}),h=mk(t,e=>d(e)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(g),y=c?m.indexOf(c):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,w=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=Dj(e),r=W.useRef(!1),o=W.useRef(()=>{});return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Vj(Oj,n,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));x&&!n&&(null==o||o(e),null==i||i(e),e.defaultPrevented||null==s||s())},f),k=function(e,t=(null==globalThis?void 0:globalThis.document)){const n=Dj(e),r=W.useRef(!1);return W.useEffect(()=>{const e=e=>{if(e.target&&!r.current){Vj(Aj,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(null==a||a(e),null==i||i(e),e.defaultPrevented||null==s||s())},f);return function(e,t=(null==globalThis?void 0:globalThis.document)){const n=Dj(e);W.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===u.layers.size-1&&(null==r||r(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),W.useEffect(()=>{if(c)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Lj=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Fj(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=Lj)}},[c,f,n,u]),W.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Fj())},[c,u]),W.useEffect(()=>{const e=()=>p({});return document.addEventListener(_j,e),()=>document.removeEventListener(_j,e)},[]),ee.jsx(Rj.div,{...l,ref:h,style:{pointerEvents:b?x?"auto":"none":void 0,...e.style},onFocusCapture:yj(e.onFocusCapture,k.onFocusCapture),onBlurCapture:yj(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:yj(e.onPointerDownCapture,w.onPointerDownCapture)})});zj.displayName="DismissableLayer";function Fj(){const e=new CustomEvent(_j);document.dispatchEvent(e)}function Vj(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&ld.flushSync(()=>e.dispatchEvent(t))}(o,a):o.dispatchEvent(a)}W.forwardRef((e,t)=>{const n=W.useContext(Ij),r=W.useRef(null),o=mk(t,r);return W.useEffect(()=>{const e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),ee.jsx(Rj.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var $j="focusScope.autoFocusOnMount",Bj="focusScope.autoFocusOnUnmount",Uj={bubbles:!1,cancelable:!0},Wj=W.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=W.useState(null),u=Dj(o),c=Dj(a),d=W.useRef(null),f=mk(t,e=>l(e)),p=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;const t=e.target;s.contains(t)?d.current=t:Kj(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;const t=e.relatedTarget;null!==t&&(s.contains(t)||Kj(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Kj(s)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,s,p.paused]),W.useEffect(()=>{if(s){Xj.add(p);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent($j,Uj);s.addEventListener($j,u),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kj(r,{select:t}),document.activeElement!==n)return}((e=Hj(s),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Kj(s))}return()=>{s.removeEventListener($j,u),setTimeout(()=>{const e=new CustomEvent(Bj,Uj);s.addEventListener(Bj,c),s.dispatchEvent(e),e.defaultPrevented||Kj(t??document.body,{select:!0}),s.removeEventListener(Bj,c),Xj.remove(p)},0)}}var e},[s,u,c,p]);const h=W.useCallback(e=>{if(!n&&!r)return;if(p.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=Hj(e),n=Gj(t,e),r=Gj(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&Kj(a,{select:!0})):(e.preventDefault(),n&&Kj(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,p.paused]);return ee.jsx(Rj.div,{tabIndex:-1,...i,ref:f,onKeyDown:h})});function Hj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gj(e,t){for(const n of e)if(!Yj(n,{upTo:t}))return n}function Yj(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Kj(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Wj.displayName="FocusScope";var Xj=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=qj(e,t),e.unshift(t)},remove(t){var n;e=qj(e,t),null==(n=e[0])||n.resume()}}}();function qj(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var Qj=W.forwardRef((e,t)=>{var n;const{container:r,...o}=e,[a,i]=W.useState(!1);wj(()=>i(!0),[]);const s=r||a&&(null==(n=null==globalThis?void 0:globalThis.document)?void 0:n.body);return s?ud.createPortal(ee.jsx(Rj.div,{...o,ref:t}),s):null});Qj.displayName="Portal";var Zj=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=W.useState(),r=W.useRef(null),o=W.useRef(e),a=W.useRef("none"),i=e?"mounted":"unmounted",[s,l]=function(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return W.useEffect(()=>{const e=Jj(r.current);a.current="mounted"===s?e:"none"},[s]),wj(()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=Jj(t);if(e)l("MOUNT");else if("none"===i||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),wj(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=a=>{const i=Jj(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&i&&(l("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=Jj(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),o="function"==typeof n?n({present:r.isPresent}):W.Children.only(n),a=mk(r.ref,function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?W.cloneElement(o,{ref:a}):null};function Jj(e){return(null==e?void 0:e.animationName)||"none"}Zj.displayName="Presence";var eC=0;function tC(){W.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nC()),document.body.insertAdjacentElement("beforeend",e[1]??nC()),eC++,()=>{1===eC&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),eC--}},[])}function nC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var rC=function(){return rC=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},rC.apply(this,arguments)};function oC(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var aC="right-scroll-bar-position",iC="width-before-scroll-bar";function sC(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var lC="undefined"!=typeof window?W.useLayoutEffect:W.useEffect,uC=new WeakMap;function cC(e,t){var n,r,o,a=(n=null,r=function(t){return e.forEach(function(e){return sC(e,t)})},(o=W.useState(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return lC(function(){var t=uC.get(a);if(t){var n=new Set(t),r=new Set(e),o=a.current;n.forEach(function(e){r.has(e)||sC(e,null)}),r.forEach(function(e){n.has(e)||sC(e,o)})}uC.set(a,e)},[e]),a}function dC(e){return e}var fC=function(e){var t=e.sideCar,n=oC(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return W.createElement(r,rC({},n))};fC.isSideCarExport=!0;var pC=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=dC);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=rC({async:!0,ssr:!1},e),t}(),hC=function(){},mC=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:hC,onWheelCapture:hC,onTouchMoveCapture:hC}),o=r[0],a=r[1],i=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,h=e.noIsolation,m=e.inert,g=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,b=e.gapMode,x=oC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=f,k=cC([n,t]),S=rC(rC({},x),o);return W.createElement(W.Fragment,null,c&&W.createElement(w,{sideCar:pC,removeScrollBar:u,shards:d,noRelative:p,noIsolation:h,inert:m,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),i?W.cloneElement(W.Children.only(s),rC(rC({},S),{ref:k})):W.createElement(y,rC({},S,{className:l,ref:k}),s))});mC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},mC.classNames={fullWidth:iC,zeroRight:aC};function gC(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var vC=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=gC())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},yC=function(){var e,t=(e=vC(),function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},bC={left:0,top:0,right:0,gap:0},xC=function(e){return parseInt(e||"",10)||0},wC=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return bC;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[xC(n),xC(r),xC(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},kC=yC(),SC="data-scroll-locked",EC=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(SC,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(aC," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(iC," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(aC," .").concat(aC," {\n right: 0 ").concat(r,";\n }\n \n .").concat(iC," .").concat(iC," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(SC,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},jC=function(){var e=parseInt(document.body.getAttribute(SC)||"0",10);return isFinite(e)?e:0},CC=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;W.useEffect(function(){return document.body.setAttribute(SC,(jC()+1).toString()),function(){var e=jC()-1;e<=0?document.body.removeAttribute(SC):document.body.setAttribute(SC,e.toString())}},[]);var a=W.useMemo(function(){return wC(o)},[o]);return W.createElement(kC,{styles:EC(a,!t,o,n?"":"!important")})},PC=!1;if("undefined"!=typeof window)try{var TC=Object.defineProperty({},"passive",{get:function(){return PC=!0,!0}});window.addEventListener("test",TC,TC),window.removeEventListener("test",TC,TC)}catch(hN){PC=!1}var NC=!!PC&&{passive:!1},MC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},RC=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),DC(e,r)){var o=LC(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},DC=function(e,t){return"v"===e?function(e){return MC(e,"overflowY")}(t):function(e){return MC(e,"overflowX")}(t)},LC=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},_C=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},OC=function(e){return[e.deltaX,e.deltaY]},AC=function(e){return e&&"current"in e?e.current:e},IC=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},zC=0,FC=[];function VC(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $C=(BC=function(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),o=W.useState(zC++)[0],a=W.useState(yC)[0],i=W.useRef(e);W.useEffect(function(){i.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(AC),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=W.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var o,a=_C(e),s=n.current,l="deltaX"in e?e.deltaX:s[0]-a[0],u="deltaY"in e?e.deltaY:s[1]-a[1],c=e.target,d=Math.abs(l)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===d&&"range"===c.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===c||p.contains(c)))return!1;var h=RC(d,c);if(!h)return!0;if(h?o=d:(o="v"===d?"h":"v",h=RC(d,c)),!h)return!1;if(!r.current&&"changedTouches"in e&&(l||u)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,i=n.target,s=t.contains(i),l=!1,u=a>0,c=0,d=0;do{if(!i)break;var f=LC(e,i),p=f[0],h=f[1]-f[2]-o*p;(p||h)&&DC(e,i)&&(c+=h,d+=p);var m=i.parentNode;i=m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE?m.host:m}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(u&&Math.abs(c)<1||!u&&Math.abs(d)<1)&&(l=!0),l}(m,t,e,"h"===m?l:u)},[]),l=W.useCallback(function(e){var n=e;if(FC.length&&FC[FC.length-1]===a){var r="deltaY"in n?OC(n):_C(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var l=(i.current.shards||[]).map(AC).filter(Boolean).filter(function(e){return e.contains(n.target)});(l.length>0?s(n,l[0]):!i.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=W.useCallback(function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:VC(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),c=W.useCallback(function(e){n.current=_C(e),r.current=void 0},[]),d=W.useCallback(function(t){u(t.type,OC(t),t.target,s(t,e.lockRef.current))},[]),f=W.useCallback(function(t){u(t.type,_C(t),t.target,s(t,e.lockRef.current))},[]);W.useEffect(function(){return FC.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,NC),document.addEventListener("touchmove",l,NC),document.addEventListener("touchstart",c,NC),function(){FC=FC.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,NC),document.removeEventListener("touchmove",l,NC),document.removeEventListener("touchstart",c,NC)}},[]);var p=e.removeScrollBar,h=e.inert;return W.createElement(W.Fragment,null,h?W.createElement(a,{styles:IC(o)}):null,p?W.createElement(CC,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},pC.useMedium(BC),fC);var BC,UC=W.forwardRef(function(e,t){return W.createElement(mC,rC({},e,{ref:t,sideCar:$C}))});UC.classNames=mC.classNames;var WC=new WeakMap,HC=new WeakMap,GC={},YC=0,KC=function(e){return e&&(e.host||KC(e.parentNode))},XC=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=KC(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);GC[n]||(GC[n]=new WeakMap);var a=GC[n],i=[],s=new Set,l=new Set(o),u=function(e){e&&!s.has(e)&&(s.add(e),u(e.parentNode))};o.forEach(u);var c=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))c(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,l=(WC.get(e)||0)+1,u=(a.get(e)||0)+1;WC.set(e,l),a.set(e,u),i.push(e),1===l&&o&&HC.set(e,!0),1===u&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(pN){console.error("aria-hidden: cannot operate on ",e,pN)}})};return c(t),s.clear(),YC++,function(){i.forEach(function(e){var t=WC.get(e)-1,o=a.get(e)-1;WC.set(e,t),a.set(e,o),t||(HC.has(e)||e.removeAttribute(r),HC.delete(e)),o||e.removeAttribute(n)}),--YC||(WC=new WeakMap,WC=new WeakMap,HC=new WeakMap,GC={})}},qC=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),XC(r,o,n,"aria-hidden")):function(){return null}};function QC(e){const t=ZC(e),n=W.forwardRef((e,n)=>{const{children:r,...o}=e,a=W.Children.toArray(r),i=a.find(eP);if(i){const e=i.props.children,r=a.map(t=>t===i?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return ee.jsx(t,{...o,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return ee.jsx(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function ZC(e){const t=W.forwardRef((e,t)=>{const{children:n,...r}=e;if(W.isValidElement(n)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==W.Fragment&&(o.ref=t?hk(t,e):e),W.cloneElement(n,o)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JC=Symbol("radix.slottable");function eP(e){return W.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===JC}var tP="Dialog",[nP]=bj(tP),[rP,oP]=nP(tP),aP=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,s=W.useRef(null),l=W.useRef(null),[u,c]=Cj({prop:r,defaultProp:o??!1,onChange:a,caller:tP});return ee.jsx(rP,{scope:t,triggerRef:s,contentRef:l,contentId:Ej(),titleId:Ej(),descriptionId:Ej(),open:u,onOpenChange:c,onOpenToggle:W.useCallback(()=>c(e=>!e),[c]),modal:i,children:n})};aP.displayName=tP;var iP="DialogTrigger";W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(iP,n),a=mk(t,o.triggerRef);return ee.jsx(Rj.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":CP(o.open),...r,ref:a,onClick:yj(e.onClick,o.onOpenToggle)})}).displayName=iP;var sP="DialogPortal",[lP,uP]=nP(sP,{forceMount:void 0}),cP=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=oP(sP,t);return ee.jsx(lP,{scope:t,forceMount:n,children:W.Children.map(r,e=>ee.jsx(Zj,{present:n||a.open,children:ee.jsx(Qj,{asChild:!0,container:o,children:e})}))})};cP.displayName=sP;var dP="DialogOverlay",fP=W.forwardRef((e,t)=>{const n=uP(dP,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=oP(dP,e.__scopeDialog);return a.modal?ee.jsx(Zj,{present:r||a.open,children:ee.jsx(hP,{...o,ref:t})}):null});fP.displayName=dP;var pP=QC("DialogOverlay.RemoveScroll"),hP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(dP,n);return ee.jsx(UC,{as:pP,allowPinchZoom:!0,shards:[o.contentRef],children:ee.jsx(Rj.div,{"data-state":CP(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),mP="DialogContent",gP=W.forwardRef((e,t)=>{const n=uP(mP,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=oP(mP,e.__scopeDialog);return ee.jsx(Zj,{present:r||a.open,children:a.modal?ee.jsx(vP,{...o,ref:t}):ee.jsx(yP,{...o,ref:t})})});gP.displayName=mP;var vP=W.forwardRef((e,t)=>{const n=oP(mP,e.__scopeDialog),r=W.useRef(null),o=mk(t,n.contentRef,r);return W.useEffect(()=>{const e=r.current;if(e)return qC(e)},[]),ee.jsx(bP,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yj(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null==(t=n.triggerRef.current)||t.focus()}),onPointerDownOutside:yj(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:yj(e.onFocusOutside,e=>e.preventDefault())})}),yP=W.forwardRef((e,t)=>{const n=oP(mP,e.__scopeDialog),r=W.useRef(!1),o=W.useRef(!1);return ee.jsx(bP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,i;null==(a=e.onCloseAutoFocus)||a.call(e,t),t.defaultPrevented||(r.current||null==(i=n.triggerRef.current)||i.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{var a,i;null==(a=e.onInteractOutside)||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const s=t.target;(null==(i=n.triggerRef.current)?void 0:i.contains(s))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),bP=W.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,s=oP(mP,n),l=W.useRef(null),u=mk(t,l);return tC(),ee.jsxs(ee.Fragment,{children:[ee.jsx(Wj,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:ee.jsx(zj,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":CP(s.open),...i,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),ee.jsxs(ee.Fragment,{children:[ee.jsx(MP,{titleId:s.titleId}),ee.jsx(RP,{contentRef:l,descriptionId:s.descriptionId})]})]})}),xP="DialogTitle",wP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(xP,n);return ee.jsx(Rj.h2,{id:o.titleId,...r,ref:t})});wP.displayName=xP;var kP="DialogDescription",SP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(kP,n);return ee.jsx(Rj.p,{id:o.descriptionId,...r,ref:t})});SP.displayName=kP;var EP="DialogClose",jP=W.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=oP(EP,n);return ee.jsx(Rj.button,{type:"button",...r,ref:t,onClick:yj(e.onClick,()=>o.onOpenChange(!1))})});function CP(e){return e?"open":"closed"}jP.displayName=EP;var PP="DialogTitleWarning",[TP,NP]=function(e,t){const n=W.createContext(t),r=e=>{const{children:t,...r}=e,o=W.useMemo(()=>r,Object.values(r));return ee.jsx(n.Provider,{value:o,children:t})};return r.displayName=e+"Provider",[r,function(r){const o=W.useContext(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(PP,{contentName:mP,titleName:xP,docsSlug:"dialog"}),MP=({titleId:e})=>{const t=NP(PP),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return W.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},RP=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${NP("DialogDescriptionWarning").contentName}}.`;return W.useEffect(()=>{var r;const o=null==(r=e.current)?void 0:r.getAttribute("aria-describedby");if(t&&o){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},DP=fP,LP=gP,_P=wP,OP=SP,AP=jP;const IP=aP,zP=cP,FP=W.forwardRef(({className:e,...t},n)=>ee.jsx(DP,{ref:n,className:ik("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}));FP.displayName=DP.displayName;const VP=W.forwardRef(({className:e,children:t,noOverlay:n,...r},o)=>ee.jsxs(zP,{children:[!n&&ee.jsx(FP,{}),ee.jsxs(LP,{ref:o,className:ik("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,ee.jsxs(AP,{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:[ee.jsx(hj,{className:"h-4 w-4"}),ee.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));VP.displayName=LP.displayName;const $P=({className:e,...t})=>ee.jsx("div",{className:ik("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});$P.displayName="DialogHeader";const BP=({className:e,...t})=>ee.jsx("div",{className:ik("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});BP.displayName="DialogFooter";const UP=W.forwardRef(({className:e,...t},n)=>ee.jsx(_P,{ref:n,className:ik("text-lg font-semibold leading-none tracking-tight",e),...t}));UP.displayName=_P.displayName;const WP=W.forwardRef(({className:e,...t},n)=>ee.jsx(OP,{ref:n,className:ik("text-sm text-muted-foreground",e),...t}));function HP({project:e,open:t,onOpenChange:n,onUpdated:r}){const[o,a]=W.useState([]),[i,s]=W.useState([]),[l,u]=W.useState(!1),[c,d]=W.useState(null);W.useEffect(()=>{if(!t)return;a(e.shares?[...e.shares]:[]),d(null);let n=!1;return tS().then(e=>{n||s(e)}).catch(()=>{}),()=>{n=!0}},[t,e.id]);const f=new Set(o.map(e=>e.username)),p=i.filter(t=>t!==e.owner&&!f.has(t));return ee.jsx(IP,{open:t,onOpenChange:n,children:ee.jsxs(VP,{className:"sm:max-w-md",children:[ee.jsxs($P,{children:[ee.jsxs(UP,{className:"flex items-center gap-2",children:[ee.jsx(pj,{className:"h-4 w-4"}),"共享设置"]}),ee.jsx(WP,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),ee.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[0===o.length&&ee.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),o.map(e=>ee.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[ee.jsx("span",{className:"text-sm font-medium",children:e.username}),ee.jsxs("div",{className:"flex items-center gap-1.5",children:[ee.jsx("button",{onClick:()=>{return t=e.username,void a(e=>e.map(e=>e.username===t?{...e,permission:"view"===e.permission?"edit":"view"}:e));var t},className:"focus:outline-none",children:ee.jsx(vj,{variant:"edit"===e.permission?"default":"secondary",className:"cursor-pointer text-xs",children:"edit"===e.permission?"可编辑":"可见"})}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>{return t=e.username,void a(e=>e.filter(e=>e.username!==t));var t},children:ee.jsx(fj,{className:"h-3.5 w-3.5"})})]})]},e.username))]}),p.length>0&&ee.jsxs("div",{className:"border-t pt-3",children:[ee.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),ee.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(e=>ee.jsxs(Tk,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>{return t=e,void a(e=>[...e,{username:t,permission:"view"}]);var t},children:[ee.jsx(oj,{className:"h-3 w-3"}),e]},e))})]}),c&&ee.jsx("p",{className:"text-sm text-destructive",children:c}),ee.jsxs(BP,{children:[ee.jsx(Tk,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),ee.jsx(Tk,{onClick:()=>{(async()=>{u(!0),d(null);try{const t=await nS(e.id,o);r(t),n(!1)}catch(hN){d(hN instanceof Error?hN.message:"Failed to update shares")}finally{u(!1)}})()},disabled:l,children:l?"保存中...":"保存"})]})]})})}WP.displayName=OP.displayName;const GP=Array(12).fill(0),YP=({visible:e,className:t})=>H.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},H.createElement("div",{className:"sonner-spinner"},GP.map((e,t)=>H.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),KP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.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"})),XP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},H.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"})),qP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.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"})),QP=H.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},H.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"})),ZP=H.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"},H.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),H.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}));let JP=1;const eT=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:n,...r}=e,o="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:JP++,a=this.toasts.find(e=>e.id===o),i=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(t=>t.id===o?(this.publish({...t,...e,id:o,title:n}),{...t,...e,id:o,dismissible:i,title:n}):t):this.addToast({title:n,...r,dismissible:i,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let o,a=void 0!==n;const i=r.then(async e=>{o=["resolve",e];if(H.isValidElement(e))a=!1,this.create({id:n,type:"default",message:e});else if(tT(e)&&!e.ok){a=!1;const r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,o="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...i})}else if(e instanceof Error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...i})}else if(void 0!==t.success){a=!1;const r="function"==typeof t.success?await t.success(e):t.success,o="function"==typeof t.description?await t.description(e):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"success",description:o,...i})}}).catch(async e=>{if(o=["reject",e],void 0!==t.error){a=!1;const r="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description,i="object"==typeof r&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:"error",description:o,...i})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),null==t.finally||t.finally.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===o[0]?t(o[1]):e(o[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{const n=(null==t?void 0:t.id)||JP++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},tT=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,nT=(e,t)=>{const n=(null==t?void 0:t.id)||JP++;return eT.addToast({title:e,...t,id:n}),n},rT=Object.assign(nT,{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:()=>eT.toasts,getToasts:()=>eT.getActiveToasts()});function oT(e){return void 0!==e.label}!function(e){if("undefined"==typeof document)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))}("[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%)}");const aT=3,iT=14;function sT(...e){return e.filter(Boolean).join(" ")}const lT=e=>{var t,n,r,o,a,i,s,l,u;const{invert:c,toast:d,unstyled:f,interacting:p,setHeights:h,visibleToasts:m,heights:g,index:v,toasts:y,expanded:b,removeToast:x,defaultRichColors:w,closeButton:k,style:S,cancelButtonStyle:E,actionButtonStyle:j,className:C="",descriptionClassName:P="",duration:T,position:N,gap:M,expandByDefault:R,classNames:D,icons:L,closeButtonAriaLabel:_="Close toast"}=e,[O,A]=H.useState(null),[I,z]=H.useState(null),[F,V]=H.useState(!1),[$,B]=H.useState(!1),[U,W]=H.useState(!1),[G,Y]=H.useState(!1),[K,X]=H.useState(!1),[q,Q]=H.useState(0),[Z,J]=H.useState(0),ee=H.useRef(d.duration||T||4e3),te=H.useRef(null),ne=H.useRef(null),re=0===v,oe=v+1<=m,ae=d.type,ie=!1!==d.dismissible,se=d.className||"",le=d.descriptionClassName||"",ue=H.useMemo(()=>g.findIndex(e=>e.toastId===d.id)||0,[g,d.id]),ce=H.useMemo(()=>{var e;return null!=(e=d.closeButton)?e:k},[d.closeButton,k]),de=H.useMemo(()=>d.duration||T||4e3,[d.duration,T]),fe=H.useRef(0),pe=H.useRef(0),he=H.useRef(0),me=H.useRef(null),[ge,ve]=N.split("-"),ye=H.useMemo(()=>g.reduce((e,t,n)=>n>=ue?e:e+t.height,0),[g,ue]),be=(()=>{const[e,t]=H.useState(document.hidden);return H.useEffect(()=>{const e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),xe=d.invert||c,we="loading"===ae;pe.current=H.useMemo(()=>ue*M+ye,[ue,ye]),H.useEffect(()=>{ee.current=de},[de]),H.useEffect(()=>{V(!0)},[]),H.useEffect(()=>{const e=ne.current;if(e){const t=e.getBoundingClientRect().height;return J(t),h(e=>[{toastId:d.id,height:t,position:d.position},...e]),()=>h(e=>e.filter(e=>e.toastId!==d.id))}},[h,d.id]),H.useLayoutEffect(()=>{if(!F)return;const e=ne.current,t=e.style.height;e.style.height="auto";const n=e.getBoundingClientRect().height;e.style.height=t,J(n),h(e=>e.find(e=>e.toastId===d.id)?e.map(e=>e.toastId===d.id?{...e,height:n}:e):[{toastId:d.id,height:n,position:d.position},...e])},[F,d.title,d.description,h,d.id,d.jsx,d.action,d.cancel]);const ke=H.useCallback(()=>{B(!0),Q(pe.current),h(e=>e.filter(e=>e.toastId!==d.id)),setTimeout(()=>{x(d)},200)},[d,x,h,pe]);H.useEffect(()=>{if(d.promise&&"loading"===ae||d.duration===1/0||"loading"===d.type)return;let e;return b||p||be?(()=>{if(he.current<fe.current){const e=(new Date).getTime()-fe.current;ee.current=ee.current-e}he.current=(new Date).getTime()})():ee.current!==1/0&&(fe.current=(new Date).getTime(),e=setTimeout(()=>{null==d.onAutoClose||d.onAutoClose.call(d,d),ke()},ee.current)),()=>clearTimeout(e)},[b,p,d,ae,be,ke]),H.useEffect(()=>{d.delete&&(ke(),null==d.onDismiss||d.onDismiss.call(d,d))},[ke,d.delete]);const Se=d.icon||(null==L?void 0:L[ae])||(e=>{switch(e){case"success":return KP;case"info":return qP;case"warning":return XP;case"error":return QP;default:return null}})(ae);var Ee,je,Ce,Pe;return H.createElement("li",{tabIndex:0,ref:ne,className:sT(C,se,null==D?void 0:D.toast,null==d||null==(t=d.classNames)?void 0:t.toast,null==D?void 0:D.default,null==D?void 0:D[ae],null==d||null==(n=d.classNames)?void 0:n[ae]),"data-sonner-toast":"","data-rich-colors":null!=(Ee=d.richColors)?Ee:w,"data-styled":!Boolean(d.jsx||d.unstyled||f),"data-mounted":F,"data-promise":Boolean(d.promise),"data-swiped":K,"data-removed":$,"data-visible":oe,"data-y-position":ge,"data-x-position":ve,"data-index":v,"data-front":re,"data-swiping":U,"data-dismissible":ie,"data-type":ae,"data-invert":xe,"data-swipe-out":G,"data-swipe-direction":I,"data-expanded":Boolean(b||R&&F),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":y.length-v,"--offset":`${$?q:pe.current}px`,"--initial-height":R?"auto":`${Z}px`,...S,...d.style},onDragEnd:()=>{W(!1),A(null),me.current=null},onPointerDown:e=>{2!==e.button&&!we&&ie&&(te.current=new Date,Q(pe.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(W(!0),me.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n;if(G||!ie)return;me.current=null;const r=Number((null==(e=ne.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ne.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),a=(new Date).getTime()-(null==(n=te.current)?void 0:n.getTime()),i="x"===O?r:o,s=Math.abs(i)/a;if(Math.abs(i)>=45||s>.11)return Q(pe.current),null==d.onDismiss||d.onDismiss.call(d,d),z("x"===O?r>0?"right":"left":o>0?"down":"up"),ke(),void Y(!0);var l,u;null==(l=ne.current)||l.style.setProperty("--swipe-amount-x","0px"),null==(u=ne.current)||u.style.setProperty("--swipe-amount-y","0px"),X(!1),W(!1),A(null)},onPointerMove:t=>{var n,r,o;if(!me.current||!ie)return;if((null==(n=window.getSelection())?void 0:n.toString().length)>0)return;const a=t.clientY-me.current.y,i=t.clientX-me.current.x;var s;const l=null!=(s=e.swipeDirections)?s:function(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(N);!O&&(Math.abs(i)>1||Math.abs(a)>1)&&A(Math.abs(i)>Math.abs(a)?"x":"y");let u={x:0,y:0};const c=e=>1/(1.5+Math.abs(e)/20);if("y"===O){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&a<0||l.includes("bottom")&&a>0)u.y=a;else{const e=a*c(a);u.y=Math.abs(e)<Math.abs(a)?e:a}}else if("x"===O&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&i<0||l.includes("right")&&i>0)u.x=i;else{const e=i*c(i);u.x=Math.abs(e)<Math.abs(i)?e:i}(Math.abs(u.x)>0||Math.abs(u.y)>0)&&X(!0),null==(r=ne.current)||r.style.setProperty("--swipe-amount-x",`${u.x}px`),null==(o=ne.current)||o.style.setProperty("--swipe-amount-y",`${u.y}px`)}},ce&&!d.jsx&&"loading"!==ae?H.createElement("button",{"aria-label":_,"data-disabled":we,"data-close-button":!0,onClick:we||!ie?()=>{}:()=>{ke(),null==d.onDismiss||d.onDismiss.call(d,d)},className:sT(null==D?void 0:D.closeButton,null==d||null==(r=d.classNames)?void 0:r.closeButton)},null!=(je=null==L?void 0:L.close)?je:ZP):null,(ae||d.icon||d.promise)&&null!==d.icon&&(null!==(null==L?void 0:L[ae])||d.icon)?H.createElement("div",{"data-icon":"",className:sT(null==D?void 0:D.icon,null==d||null==(o=d.classNames)?void 0:o.icon)},d.promise||"loading"===d.type&&!d.icon?d.icon||((null==L?void 0:L.loading)?H.createElement("div",{className:sT(null==D?void 0:D.loader,null==d||null==(Pe=d.classNames)?void 0:Pe.loader,"sonner-loader"),"data-visible":"loading"===ae},L.loading):H.createElement(YP,{className:sT(null==D?void 0:D.loader,null==d||null==(Ce=d.classNames)?void 0:Ce.loader),visible:"loading"===ae})):null,"loading"!==d.type?Se:null):null,H.createElement("div",{"data-content":"",className:sT(null==D?void 0:D.content,null==d||null==(a=d.classNames)?void 0:a.content)},H.createElement("div",{"data-title":"",className:sT(null==D?void 0:D.title,null==d||null==(i=d.classNames)?void 0:i.title)},d.jsx?d.jsx:"function"==typeof d.title?d.title():d.title),d.description?H.createElement("div",{"data-description":"",className:sT(P,le,null==D?void 0:D.description,null==d||null==(s=d.classNames)?void 0:s.description)},"function"==typeof d.description?d.description():d.description):null),H.isValidElement(d.cancel)?d.cancel:d.cancel&&oT(d.cancel)?H.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||E,onClick:e=>{oT(d.cancel)&&ie&&(null==d.cancel.onClick||d.cancel.onClick.call(d.cancel,e),ke())},className:sT(null==D?void 0:D.cancelButton,null==d||null==(l=d.classNames)?void 0:l.cancelButton)},d.cancel.label):null,H.isValidElement(d.action)?d.action:d.action&&oT(d.action)?H.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||j,onClick:e=>{oT(d.action)&&(null==d.action.onClick||d.action.onClick.call(d.action,e),e.defaultPrevented||ke())},className:sT(null==D?void 0:D.actionButton,null==d||null==(u=d.classNames)?void 0:u.actionButton)},d.action.label):null)};function uT(){if("undefined"==typeof window)return"ltr";if("undefined"==typeof document)return"ltr";const e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}function cT(e,t){const n={};return[e,t].forEach((e,t)=>{const r=1===t,o=r?"--mobile-offset":"--offset",a=r?"16px":"24px";function i(e){["top","right","bottom","left"].forEach(t=>{n[`${o}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?i(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?n[`${o}-${t}`]=a:n[`${o}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):i(a)}),n}const dT=H.forwardRef(function(e,t){const{id:n,invert:r,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:s,className:l,offset:u,mobileOffset:c,theme:d="light",richColors:f,duration:p,style:h,visibleToasts:m=aT,toastOptions:g,dir:v=uT(),gap:y=iT,icons:b,containerAriaLabel:x="Notifications"}=e,[w,k]=H.useState([]),S=H.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),E=H.useMemo(()=>Array.from(new Set([o].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,o]),[j,C]=H.useState([]),[P,T]=H.useState(!1),[N,M]=H.useState(!1),[R,D]=H.useState("system"!==d?d:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=H.useRef(null),_=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=H.useRef(null),A=H.useRef(!1),I=H.useCallback(e=>{k(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||eT.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return H.useEffect(()=>eT.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{ud.flushSync(()=>{k(t=>{const n=t.findIndex(t=>t.id===e.id);return-1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),H.useEffect(()=>{if("system"!==d)return void D(d);if("system"===d&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?D("dark"):D("light")),"undefined"==typeof window)return;const e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{D(e?"dark":"light")})}catch(t){e.addListener(({matches:e})=>{try{D(e?"dark":"light")}catch(pN){console.error(pN)}})}},[d]),H.useEffect(()=>{w.length<=1&&T(!1)},[w]),H.useEffect(()=>{const e=e=>{var t;var n;a.every(t=>e[t]||e.code===t)&&(T(!0),null==(n=L.current)||n.focus());"Escape"!==e.code||document.activeElement!==L.current&&!(null==(t=L.current)?void 0:t.contains(document.activeElement))||T(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),H.useEffect(()=>{if(L.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,A.current=!1)}},[L.current]),H.createElement("section",{ref:t,"aria-label":`${x} ${_}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((t,n)=>{var o;const[a,d]=t.split("-");return S.length?H.createElement("ol",{key:t,dir:"auto"===v?uT():v,tabIndex:-1,ref:L,className:l,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":a,"data-x-position":d,style:{"--front-toast-height":`${(null==(o=j[0])?void 0:o.height)||0}px`,"--width":"356px","--gap":`${y}px`,...h,...cT(u,c)},onBlur:e=>{A.current&&!e.currentTarget.contains(e.relatedTarget)&&(A.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||A.current||(A.current=!0,O.current=e.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{N||T(!1)},onDragEnd:()=>T(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||M(!0)},onPointerUp:()=>M(!1)},S.filter(e=>!e.position&&0===n||e.position===t).map((n,o)=>{var a,l;return H.createElement(lT,{key:n.id,icons:b,index:o,toast:n,defaultRichColors:f,duration:null!=(a=null==g?void 0:g.duration)?a:p,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(l=null==g?void 0:g.closeButton)?l:s,interacting:N,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:I,toasts:S.filter(e=>e.position==n.position),heights:j.filter(e=>e.position==n.position),setHeights:C,expandByDefault:i,gap:y,expanded:P,swipeDirections:e.swipeDirections})})):null}))});function fT(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 pT({status:e}){return ee.jsx("span",{className:ik("inline-block w-2 h-2 rounded-full",{"bg-green-500":"running"===e,"bg-zinc-400":"stopped"===e,"bg-yellow-400 animate-pulse":"restarting"===e})})}const hT=H.memo(function({project:e,active:t=!1,statusStack:n=[],onDelete:r,onArchive:o,onUnarchive:a,onUpdated:i}){var s,l;const u=cf(),[c,d]=W.useState(!1),[f,p]=W.useState(null),[h,m]=W.useState(!1),[g,v]=W.useState(e.name),y=W.useRef(null),b=!!e._sharedPermission;W.useEffect(()=>{let t=!1;return aE(e.id).then(({bytes:e})=>{t||p(e)}).catch(()=>{}),()=>{t=!0}},[e.id]);const x="view"===e._sharedPermission,w=t=>{t.stopPropagation(),v(e.name),m(!0),setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.select()},0)},k=async()=>{const t=g.trim();if(t&&t!==e.name)try{const n=await ZS(e.id,t);null==i||i(n),m(!1)}catch(hN){rT.error("Rename failed",{description:null==hN?void 0:hN.message})}else m(!1)},S=ee.jsx(dw.div,{whileHover:e.archived||t?{}:{y:-2},transition:{duration:.2},children:ee.jsxs(sk,{className:ik("group cursor-pointer transition-colors relative",e.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":t?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!e.archived&&u(`/projects/${e.id}`),children:[ee.jsxs(lk,{className:"pb-2",children:[ee.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h?ee.jsx("input",{ref:y,className:"text-base leading-tight font-semibold bg-transparent border-b border-primary outline-none w-full min-w-0",value:g,onChange:e=>v(e.target.value),onBlur:()=>{k()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),k()),"Escape"===e.key&&m(!1)},onClick:e=>e.stopPropagation()}):ee.jsx(uk,{className:ik("text-base leading-tight",e.archived&&"text-muted-foreground"),onDoubleClick:b||e.archived?void 0:w,children:e.name}),ee.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!b&&ee.jsxs(ee.Fragment,{children:[e.archived?ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),a(e.id)},title:"Restore project",children:ee.jsx(_E,{className:"h-3.5 w-3.5"})}):ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:w,title:"Rename project",children:ee.jsx(rj,{className:"h-3.5 w-3.5"})}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),d(!0)},title:"共享设置",children:ee.jsx(pj,{className:"h-3.5 w-3.5"})}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t=>{t.stopPropagation(),o(e.id)},title:"Archive project",children:ee.jsx(OE,{className:"h-3.5 w-3.5"})})]}),ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:t=>{t.stopPropagation(),confirm(`Delete project "${e.name}"? This cannot be undone.`)&&r(e.id)},title:"Delete project",children:ee.jsx(fj,{className:"h-3.5 w-3.5"})})]})})]}),ee.jsx("div",{className:"flex items-center gap-1.5",children:e.archived?ee.jsx(vj,{variant:"secondary",className:"text-xs",children:"Archived"}):ee.jsxs(ee.Fragment,{children:[ee.jsx(pT,{status:e.status}),ee.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:e.status}),t&&n.length>0&&ee.jsx("div",{className:"ml-auto",children:ee.jsx(Yb,{mode:"wait",children:n.slice(-1).map(e=>ee.jsx(dw.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25,ease:"easeOut"},children:ee.jsx(vj,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:fT(e.phase,e.detail)})},e.id))})})]})})]}),ee.jsxs(dk,{className:"space-y-2",children:[ee.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[ee.jsx(BE,{className:"h-3.5 w-3.5 flex-shrink-0"}),ee.jsx("span",{className:"truncate font-mono",children:e.folderPath}),null!==f&&ee.jsx("span",{className:"flex-shrink-0 ml-auto text-muted-foreground/70",children:(E=f,E>=1073741824?(E/1073741824).toFixed(1)+" GB":E>=1048576?(E/1048576).toFixed(1)+" MB":Math.round(E/1024)+" KB")})]}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(vj,{variant:"outline",className:"text-xs font-mono",children:e.cliTool??"claude"}),ee.jsx(vj,{variant:"unlimited"===e.permissionMode?"destructive":"secondary",className:"text-xs",children:"unlimited"===e.permissionMode?"Unlimited":"Limited"}),b&&ee.jsxs(vj,{variant:"outline",className:"text-xs gap-0.5",children:[x?ee.jsx(VE,{className:"h-3 w-3"}):ee.jsx(rj,{className:"h-3 w-3"}),x?"可见":"可编辑"]}),!b&&e.shares&&e.shares.length>0&&ee.jsxs(vj,{variant:"outline",className:"text-xs gap-0.5",children:[ee.jsx(pj,{className:"h-3 w-3"}),e.shares.length]}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})]}),(e.tags??[]).length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(e.tags??[]).slice(0,3).map(e=>ee.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",e]},e)),((null==(s=e.tags)?void 0:s.length)??0)>3&&ee.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",((null==(l=e.tags)?void 0:l.length)??0)-3]})]})]})]})});var E;const j=t&&!e.archived?ee.jsx("div",{className:"card-active-glow rounded-lg",children:S}):S;return ee.jsxs(ee.Fragment,{children:[j,!b&&i&&ee.jsx(HP,{project:e,open:c,onOpenChange:d,onUpdated:i})]})});function mT({onSelect:e}){const[t,n]=W.useState(""),[r,o]=W.useState(null),[a,i]=W.useState([]),[s,l]=W.useState(!0),[u,c]=W.useState(null),[d,f]=W.useState(!1),[p,h]=W.useState(""),[m,g]=W.useState(null),[v,y]=W.useState(!1),b=W.useRef(null),x=async e=>{l(!0),c(null);try{const t=await ES(e);n(t.path),o(t.parent),i(t.entries)}catch(hN){c(hN instanceof Error?hN.message:"Failed to load directory")}finally{l(!1)}};W.useEffect(()=>{x()},[]),W.useEffect(()=>{d&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[d]);const w=()=>{f(!1),h(""),g(null)},k=async()=>{const e=p.trim();if(e){y(!0),g(null);try{const{path:n}=await PS(t,e);f(!1),h(""),await x(t),x(n)}catch(hN){g(hN instanceof Error?hN.message:"Failed to create folder")}finally{y(!1)}}},S=t.split("/").filter(Boolean);return ee.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[ee.jsx(Tk,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>{x()},title:"Home",children:ee.jsx(KE,{className:"h-3 w-3"})}),ee.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:S.map((e,t)=>ee.jsxs(H.Fragment,{children:[ee.jsx(zE,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),ee.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>(e=>{const t="/"+S.slice(0,e+1).join("/");x(t)})(t),children:e})]},t))}),ee.jsxs(Tk,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:()=>{h(""),g(null),f(!0)},disabled:d||s||!!u,title:"New folder",children:[ee.jsx(UE,{className:"h-3.5 w-3.5"}),ee.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),ee.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),u&&ee.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:u}),!s&&!u&&ee.jsxs("div",{className:"p-1",children:[r&&ee.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:()=>{x(r)},children:[ee.jsx(AE,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("span",{children:".."})]}),d&&ee.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[ee.jsx(WE,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),ee.jsx("input",{ref:b,className:ik("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",m&&"border-destructive"),placeholder:"Folder name",value:p,onChange:e=>{h(e.target.value),g(null)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key&&w()},disabled:v}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>{k()},disabled:!p.trim()||v,title:"Create",children:ee.jsx(IE,{className:"h-3.5 w-3.5 text-green-600"})}),ee.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:w,disabled:v,title:"Cancel",children:ee.jsx(hj,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),m&&ee.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:m}),0===a.length&&!d&&ee.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),a.map(e=>ee.jsxs("button",{className:ik("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left","dir"===e.type?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{"dir"===e.type&&x(e.path)},disabled:"file"===e.type,children:["dir"===e.type?ee.jsx(WE,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):ee.jsx($E,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),ee.jsx("span",{className:"truncate",children:e.name})]},e.path))]})]}),ee.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),ee.jsx(Tk,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const gT=[{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)"},{value:"gemini",label:"Gemini",desc:"Google Gemini CLI"},{value:"terminal",label:"Terminal",desc:"Plain shell (no AI CLI)"}],vT={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"},gemini:{limited:"gemini",unlimited:"gemini --yolo"},terminal:{limited:"$SHELL (interactive)",unlimited:"$SHELL (interactive)"}};function yT({open:e,onOpenChange:t,onCreated:n}){const[r,o]=W.useState("name"),[a,i]=W.useState(""),[s,l]=W.useState(""),[u,c]=W.useState("claude"),[d,f]=W.useState("limited"),[p,h]=W.useState(!1),[m,g]=W.useState(null),v=e=>{e||(o("name"),i(""),l(""),c("claude"),f("limited"),g(null),h(!1)),t(e)},y=()=>{a.trim()?(g(null),o("folder")):g("Please enter a project name")},b=["name","folder","settings"];return ee.jsx(IP,{open:e,onOpenChange:v,children:ee.jsxs(VP,{className:"sm:max-w-lg",children:[ee.jsxs($P,{children:[ee.jsx(UP,{children:{name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"}[r]}),ee.jsxs(WP,{children:["name"===r&&"Give your project a name.","folder"===r&&"Choose the working directory for this project.","settings"===r&&"Choose the AI coding tool and run mode."]})]}),ee.jsx("div",{className:"flex gap-2 mb-2",children:b.map((e,t)=>ee.jsx("div",{className:"h-1.5 flex-1 rounded-full "+(r===e?"bg-primary":b.indexOf(r)>t?"bg-primary/40":"bg-muted")},e))}),"name"===r&&ee.jsxs("div",{className:"space-y-4",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{htmlFor:"project-name",children:"Project Name"}),ee.jsx(Nk,{id:"project-name",placeholder:"My Project",value:a,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y()},autoFocus:!0})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),"folder"===r&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"Working Directory"}),ee.jsx(mT,{onSelect:e=>{l(e),o("settings")}})]}),"settings"===r&&ee.jsxs("div",{className:"space-y-5",children:[ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"AI Coding Tool"}),ee.jsx("div",{className:"grid grid-cols-2 gap-2",children:gT.map(e=>ee.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors "+(u===e.value?"border-primary bg-primary/5":"hover:bg-accent"),children:[ee.jsx("input",{type:"radio",name:"cliTool",value:e.value,checked:u===e.value,onChange:()=>c(e.value),className:"accent-primary"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:e.label}),ee.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.value))})]}),"terminal"!==u&&ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"Permission Mode"}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:"limited"===d,onChange:()=>f("limited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Limited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:vT[u].limited})," — asks for permission before file changes."]})]})]}),ee.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[ee.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:"unlimited"===d,onChange:()=>f("unlimited"),className:"mt-0.5"}),ee.jsxs("div",{children:[ee.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",ee.jsx("code",{className:"bg-muted px-1 rounded",children:vT[u].unlimited})," — acts autonomously."]})]})]})]})]}),ee.jsxs("div",{className:"text-xs text-muted-foreground",children:[ee.jsx("span",{className:"font-medium",children:"Folder:"})," ",ee.jsx("span",{className:"font-mono",children:s})]}),m&&ee.jsx("p",{className:"text-sm text-destructive",children:m})]}),ee.jsxs(BP,{children:["name"!==r&&ee.jsx(Tk,{variant:"outline",onClick:()=>o("settings"===r?"folder":"name"),disabled:p,children:"Back"}),"name"===r&&ee.jsx(Tk,{onClick:y,children:"Next"}),"folder"===r&&ee.jsx(Tk,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),"settings"===r&&ee.jsx(Tk,{onClick:()=>{(async()=>{h(!0),g(null);try{const e=await rS({name:a.trim(),folderPath:s,permissionMode:d,cliTool:u});n(e),v(!1)}catch(hN){g(hN instanceof Error?hN.message:"Failed to create project")}finally{h(!1)}})()},disabled:p,children:p?"Creating...":"Create Project"})]})]})})}function bT({open:e,onOpenChange:t,onOpened:n}){const[r,o]=W.useState(""),[a,i]=W.useState(!1),[s,l]=W.useState(null),u=e=>{e||(o(""),l(null),i(!1)),t(e)};return ee.jsx(IP,{open:e,onOpenChange:u,children:ee.jsxs(VP,{className:"sm:max-w-lg",children:[ee.jsxs($P,{children:[ee.jsx(UP,{children:"Open Existing Project"}),ee.jsxs(WP,{children:["Select a folder that contains a ",ee.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),ee.jsxs("div",{className:"space-y-2",children:[ee.jsx(_k,{children:"Project Folder"}),ee.jsx(mT,{onSelect:e=>{(async e=>{o(e),i(!0),l(null);try{const t=await oS(e);n(t),u(!1)}catch(hN){l(hN instanceof Error?hN.message:"Failed to open project"),i(!1)}})(e)}})]}),s&&ee.jsx("p",{className:"text-sm text-destructive",children:s}),r&&!s&&a&&ee.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),ee.jsx(BP,{children:ee.jsx(Tk,{variant:"outline",onClick:()=>u(!1),disabled:a,children:"Cancel"})})]})})}function xT(e,t){rT.success(`项目「${t}」的任务已完成`,{duration:1/0,action:{label:"查看",onClick:()=>{window.location.href=`/projects/${e}`}}})}const wT=`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}`,kT=3e3;function ST(e,t){const n=W.useRef(null),r=W.useRef(0),o=W.useRef(!0),a=W.useRef(!1),i=W.useRef(null),s=W.useRef(t);s.current=t;const l=W.useRef(!1),u=W.useCallback(e=>{var t;(null==(t=n.current)?void 0:t.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(e))},[]),c=W.useCallback((e,t)=>{var r;(null==(r=n.current)?void 0:r.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:e,rows:t})),l.current=!1):l.current=!0},[]),d=W.useCallback(e=>{u({type:"terminal_input",data:e})},[u]),f=W.useCallback((e,t)=>{u({type:"terminal_resize",cols:e,rows:t})},[u]),p=W.useCallback(()=>{u({type:"chat_subscribe"})},[u]),h=W.useCallback(()=>{if(!o.current)return;if(a.current)return;const t=Xk();if(!t)return void(window.location.href="/login");a.current=!0;const u=new WebSocket(`${wT}/ws/projects/${e}`);n.current=u,u.onopen=()=>{a.current=!1,r.current=0,u.send(JSON.stringify({type:"auth",token:t}))},u.onmessage=e=>{var t,n,r,o,a,i,u,c,d,f,p,h,m,g,v,y,b,x,w,k;let S;try{S=JSON.parse(e.data)}catch{return}switch(S.type){case"connected":l.current=!1,null==(n=(t=s.current).onConnected)||n.call(t);break;case"terminal_data":null==(o=(r=s.current).onTerminalData)||o.call(r,S.data);break;case"status":null==(i=(a=s.current).onStatus)||i.call(a,S.status);break;case"chat_message":{const e=S;null==(c=(u=s.current).onChatMessage)||c.call(u,e);break}case"project_stopped":{const e=S;null==(f=(d=s.current).onProjectStopped)||f.call(d,e.projectId,e.projectName);break}case"plan_status":null==(h=(p=s.current).onPlanStatus)||h.call(p,S);break;case"plan_node_update":null==(g=(m=s.current).onPlanNodeUpdate)||g.call(m,S);break;case"plan_nudge":null==(y=(v=s.current).onPlanNudge)||y.call(v,S);break;case"plan_replan":null==(x=(b=s.current).onPlanReplan)||x.call(b,S);break;case"context_update":null==(k=(w=s.current).onContextUpdate)||k.call(w,S);break;case"error":console.error("[WS] Server error:",S.message)}},u.onclose=()=>{a.current=!1,n.current===u&&(n.current=null),o.current&&r.current<5&&(r.current++,i.current=window.setTimeout(h,kT))},u.onerror=e=>{a.current=!1,console.error("[WS] WebSocket error:",e)}},[e]);return W.useEffect(()=>(o.current=!0,h(),()=>{var e;o.current=!1,i.current&&(clearTimeout(i.current),i.current=null),null==(e=n.current)||e.close(),n.current=null}),[h]),{subscribeTerminal:c,sendTerminalInput:d,sendTerminalResize:f,subscribeChatMessages:p}}function ET(e){const t=W.useRef(null),n=W.useRef(0),r=W.useRef(!0),o=W.useRef(!1),a=W.useRef(null),i=W.useRef(e);i.current=e;const s=W.useCallback(()=>{if(!r.current)return;if(o.current)return;const e=Xk();if(!e)return;o.current=!0;const l=new WebSocket(`${wT}/ws/dashboard`);t.current=l,l.onopen=()=>{o.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:e}))},l.onmessage=e=>{var t,n;try{const r=JSON.parse(e.data);"activity_update"===r.type?i.current.onActivityUpdate(r):"project_stopped"===r.type&&(null==(n=(t=i.current).onProjectStopped)||n.call(t,r.projectId,r.projectName))}catch{}},l.onclose=()=>{o.current=!1,t.current===l&&(t.current=null),r.current&&n.current<5&&(n.current++,a.current=window.setTimeout(s,kT))},l.onerror=e=>{o.current=!1,console.error("[DashboardWS] Error:",e)}},[]);W.useEffect(()=>(r.current=!0,s(),()=>{var e;r.current=!1,a.current&&(clearTimeout(a.current),a.current=null),null==(e=t.current)||e.close(),t.current=null}),[s])}function jT({projectId:e,enabled:t,onChatMessage:n,onStatusChange:r,onContextUpdate:o}){const a=W.useRef(null),i=W.useRef(!0),s=W.useRef(0),l=W.useRef(null),u=W.useRef(!1),c=W.useRef(!1),d=W.useRef([]),f=W.useRef({onChatMessage:n,onStatusChange:r,onContextUpdate:o});f.current={onChatMessage:n,onStatusChange:r,onContextUpdate:o};const p=W.useCallback(()=>{if(c.current&&a.current&&a.current.readyState===WebSocket.OPEN)for(;d.current.length>0;){const e=d.current.shift();a.current.send(JSON.stringify({type:"terminal_input",data:e}))}},[]),h=W.useCallback(e=>{var t;c.current&&(null==(t=a.current)?void 0:t.readyState)===WebSocket.OPEN?a.current.send(JSON.stringify({type:"terminal_input",data:e})):d.current.push(e)},[]),m=W.useCallback(()=>{if(!i.current||!t)return;if(u.current)return;const n=Xk();if(!n)return;u.current=!0,c.current=!1;const r=new WebSocket(`${wT}/ws/projects/${e}`);a.current=r,r.onopen=()=>{u.current=!1,s.current=0,r.send(JSON.stringify({type:"auth",token:n}))},r.onmessage=e=>{var t,n,o,a,i,s;try{const l=JSON.parse(e.data);"connected"===l.type?(r.send(JSON.stringify({type:"chat_subscribe"})),c.current=!0,p()):"chat_message"===l.type?f.current.onChatMessage(l):"status"===l.type&&l.status?null==(n=(t=f.current).onStatusChange)||n.call(t,l.status):"project_stopped"===l.type?null==(a=(o=f.current).onStatusChange)||a.call(o,"stopped"):"context_update"===l.type&&(null==(s=(i=f.current).onContextUpdate)||s.call(i,l))}catch{}},r.onclose=()=>{if(u.current=!1,c.current=!1,a.current===r&&(a.current=null),i.current&&t)if(s.current<5){s.current++;const e=2e3*Math.random();l.current=window.setTimeout(m,kT+e)}else d.current.length>0&&(console.warn("[MonitorWS] Retries exhausted, dropping",d.current.length,"queued messages"),d.current=[])},r.onerror=()=>{u.current=!1}},[e,t,p]);return W.useEffect(()=>(i.current=!0,()=>{i.current=!1,d.current=[]}),[]),W.useEffect(()=>(s.current=0,t&&m(),()=>{var e;c.current=!1,l.current&&(clearTimeout(l.current),l.current=null),null==(e=a.current)||e.close(),a.current=null}),[m,t]),{sendInput:h}}const CT=18e6,PT=6048e5;function TT(e,t=18e6){if(!e||void 0===e.utilization||e.utilization<=0||!e.resetAt)return null;const n=new Date(e.resetAt).getTime()-Date.now();if(n<=0)return null;const r=t-n;return r<=0?null:Math.round(e.utilization/(r/t))}function NT({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",o=function(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`}(t.resetAt);return ee.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",ee.jsxs("span",{className:ik("font-medium",r),children:[n,"%"]}),o&&ee.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",o,")"]})]})}function MT({className:e}){const[t,n]=W.useState("loading"),[r,o]=W.useState(!1),a=()=>Vk(Fk.usageMonitorTool,"claude");W.useEffect(()=>{const e=async()=>{try{n(await kS(a()))}catch{n(null)}};e();const t=setInterval(()=>{e()},3e5),r=()=>{e()},o=t=>{t.key===Fk.usageMonitorTool&&e()};return window.addEventListener("ccweb:usage-tool-change",r),window.addEventListener("storage",o),()=>{clearInterval(t),window.removeEventListener("ccweb:usage-tool-change",r),window.removeEventListener("storage",o)}},[]);if("loading"===t)return null;if(!t)return null;const i=!!t.fiveHour,s=!!t.sevenDay,l=!!t.sevenDaySonnet,u=!!t.sevenDayOpus,c=i||s||l||u,d=TT(t.fiveHour,CT),f=TT(t.sevenDay,PT),p=TT(t.sevenDaySonnet,PT),h=null!==d||null!==f||null!==p;return ee.jsxs("div",{className:ik("flex items-center gap-1.5 text-xs",e),children:[h&&ee.jsxs("span",{className:"flex items-center gap-1",children:[null!==d&&ee.jsxs("span",{className:ik("font-medium",d<=100?"text-green-400":"text-orange-400"),title:`5h 配速:按当前速率,窗口结束时预计使用 ${d}%`,children:[d,"%"]}),null!==f&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:ik("font-medium",f<=100?"text-green-400":"text-orange-400"),title:`7d 配速:按当前速率,窗口结束时预计使用 ${f}%`,children:[f,"%"]})]}),null!==p&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/40",children:"/"}),ee.jsxs("span",{className:ik("font-medium",p<=100?"text-green-400":"text-orange-400"),title:`7d Sonnet 配速:按当前速率,窗口结束时预计使用 ${p}%`,children:[p,"%"]})]})]}),t.planName&&ee.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),c&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"|"}),ee.jsx(NT,{label:"5h",bucket:t.fiveHour}),s&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(NT,{label:"7d",bucket:t.sevenDay})]}),l&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(NT,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),u&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{className:"text-muted-foreground/50",children:"·"}),ee.jsx(NT,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),ee.jsx("button",{onClick:()=>{(async()=>{o(!0);try{n(await SS(a()))}catch{n(null)}finally{o(!1)}})()},className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:ee.jsx(aj,{className:ik("h-3 w-3",r&&"animate-spin")})})]})}function RT(){const[e,t]=W.useState([]),[n,r]=W.useState(!1),[o,a]=W.useState(""),[i,s]=W.useState(""),[l,u]=W.useState(""),[c,d]=W.useState(null),[f,p]=W.useState(""),[h,m]=W.useState(""),[g,v]=W.useState(""),y=W.useRef(null),b=W.useRef(null);W.useEffect(()=>{dS().then(t).catch(()=>t([]))},[]),W.useEffect(()=>{n&&setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},0)},[n]),W.useEffect(()=>{c&&setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)},[c]);const x=async()=>{const e=i.trim();if(e)try{const n=await fS({label:o.trim()||e,command:e,...l?{parentId:l}:{}});t(e=>[...e,n]),a(""),s(""),u(""),r(!1)}catch(hN){console.error("[GlobalShortcuts] Failed to add:",hN)}},w=async()=>{const e=h.trim();if(e&&c)try{const n=await pS(c,{label:f.trim()||e,command:e,parentId:g||null});t(e=>e.map(e=>e.id===c?n:e)),d(null)}catch(hN){console.error("[GlobalShortcuts] Failed to save:",hN)}};return ee.jsxs("section",{className:"mt-10",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-4",children:[ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(mj,{className:"h-4 w-4 text-muted-foreground"}),ee.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),ee.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),ee.jsxs("button",{onClick:()=>{r(e=>!e),d(null)},className:ik("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:[ee.jsx(oj,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&ee.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[ee.jsx("input",{ref:y,placeholder:"名称(可选)",value:o,onChange:e=>a(e.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"}),ee.jsx("textarea",{placeholder:"命令内容…",value:i,onChange:e=>s(e.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:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x()),"Escape"===e.key&&(r(!1),a(""),s(""),u(""))}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(HE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:l,onChange:e=>u(e.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:[ee.jsx("option",{value:"",children:"无继承"}),e.map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex items-center justify-between",children:[ee.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsx("button",{onClick:()=>{r(!1),a(""),s("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{x()},disabled:!i.trim(),className:ik("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:"保存"})]})]})]}),0!==e.length||n?ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(n=>c===n.id?ee.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[ee.jsx("input",{ref:b,value:f,onChange:e=>p(e.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"}),ee.jsx("textarea",{value:h,onChange:e=>m(e.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:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),w()),"Escape"===e.key&&d(null)}}),ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(HE,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),ee.jsxs("select",{value:g,onChange:e=>v(e.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:[ee.jsx("option",{value:"",children:"无继承"}),e.filter(e=>e.id!==n.id).map(e=>ee.jsx("option",{value:e.id,children:e.label},e.id))]})]}),ee.jsxs("div",{className:"flex gap-2 justify-end",children:[ee.jsx("button",{onClick:()=>d(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),ee.jsx("button",{onClick:()=>{w()},disabled:!h.trim(),className:ik("text-xs px-2.5 py-1 rounded transition-colors text-white",h.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},n.id):ee.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[ee.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:n.label}),n.parentId&&(()=>{const t=e.find(e=>e.id===n.parentId);return t?ee.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[ee.jsx(HE,{className:"h-3 w-3 text-muted-foreground"}),ee.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",t.label]})]}):null})(),!n.parentId&&n.label!==n.command&&ee.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:n.command}),ee.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[ee.jsx("button",{onClick:()=>{d(n.id),p(n.label),m(n.command),v(n.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:ee.jsx(rj,{className:"h-3.5 w-3.5"})}),ee.jsx("button",{onClick:()=>{(async e=>{try{await hS(e),t(t=>t.filter(t=>t.id!==e)),c===e&&d(null)}catch(hN){console.error("[GlobalShortcuts] Failed to delete:",hN)}})(n.id)},className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:ee.jsx(hj,{className:"h-3.5 w-3.5"})})]})]},n.id))}):ee.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[ee.jsx(mj,{className:"h-6 w-6"}),ee.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]})]})}const DT=W.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function LT(){return W.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function _T({children:e}){const[t,n]=W.useState(()=>Vk(Fk.theme,"system")),r=LT(),o="system"===t?r:t;W.useEffect(()=>{const e=document.documentElement;e.classList.remove("light","dark"),e.classList.add(o)},[o]);return ee.jsx(DT.Provider,{value:{theme:t,resolved:o,setTheme:e=>{n(e),$k(Fk.theme,e)}},children:e})}function OT(){return W.useContext(DT)}function AT(){const{theme:e,setTheme:t}=OT(),n=[{value:"light",icon:uj,label:"浅色"},{value:"dark",icon:nj,label:"深色"},{value:"system",icon:tj,label:"系统"}];return ee.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:n,icon:r,label:o})=>ee.jsx("button",{onClick:()=>t(n),className:ik("p-1 rounded-sm transition-colors",e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:ee.jsx(r,{className:"h-3.5 w-3.5"})},n))})}const IT={workMinutes:30,breakMinutes:5};function zT(){return Vk(Fk.pomodoroConfig,IT,!0)}const FT=zk(e=>({running:!1,phase:"work",secondsLeft:60*zT().workMinutes,setRunning:t=>e({running:t}),setPhase:t=>e({phase:t}),setSecondsLeft:t=>e({secondsLeft:t})}));function VT(){const{running:e,phase:t,secondsLeft:n,setPhase:r,setSecondsLeft:o}=FT(),a=W.useCallback(e=>{const t=zT();var n;r(e),o("work"===e?60*t.workMinutes:60*t.breakMinutes),n="break"===e?"休息一下 ☕":"该工作了 💻",rT.info(`番茄钟: ${n}`)},[r,o]);return W.useEffect(()=>{if(!e)return;if(0===n)return void a("work"===t?"break":"work");const r=setTimeout(()=>o(n-1),1e3);return()=>clearTimeout(r)},[e,n,t,a,o]),null}function $T(){const{running:e,phase:t,secondsLeft:n}=FT(),r=Math.floor(n/60),o=n%60,a=`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`;return e?ld.createPortal(ee.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center pointer-events-none z-40 select-none",style:{opacity:"work"===t?.1:.6},children:[ee.jsx("div",{className:ik("font-mono font-bold tabular-nums leading-none","work"===t?"text-foreground":"text-blue-400 dark:text-blue-300"),style:{fontSize:"clamp(360px, 90vw, 1100px)"},children:a}),ee.jsx("div",{className:"mt-3 text-muted-foreground font-medium tracking-widest uppercase",style:{fontSize:"clamp(12px, 1.5vw, 20px)"},children:"work"===t?"专注工作":"休息一下"})]}),document.body):null}function BT(){const{running:e,phase:t,secondsLeft:n,setRunning:r,setPhase:o,setSecondsLeft:a}=FT(),i=Math.floor(n/60),s=n%60,l=`${String(i).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return ee.jsx("button",{onClick:()=>{if(e){const e=zT();o("work"),a(60*e.workMinutes)}else{const e=zT();o("work"),a(60*e.workMinutes)}r(!e)},className:ik("p-1 rounded transition-colors",e?"work"===t?"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?"work"===t?`工作中 ${l} — 点击停止`:`休息中 ${l} — 点击停止`:"启动番茄钟",children:ee.jsx(dj,{className:"h-4 w-4"})})}const UT="v2026.4.19-b",WT=!!window.electronUpdater;function HT(){const[e,t]=W.useState("idle"),[n,r]=W.useState(!1),[o,a]=W.useState(""),[i,s]=W.useState(0),[l,u]=W.useState(null),[c,d]=W.useState(null);W.useEffect(()=>{if(!window.electronUpdater)return;return window.electronUpdater.onUpdateStatus(e=>{switch(e.type){case"progress":{const t=e.info;s(Math.round((null==t?void 0:t.percent)??0));break}case"downloaded":t("downloaded");break;case"error":u(e.info||"Download failed"),t("error")}})},[]);const f=W.useCallback(async()=>{t("checking"),u(null),r(!0);try{if(WT){const e=await window.electronUpdater.checkForUpdate();if(e.error)throw new Error(e.error);if(!e.available)return void t("no_update");a(e.version?`v${e.version}`:"new version")}else{const e=await RS();if(!e.updateAvailable)return void t("no_update");a(`v${e.latest}`)}t("update_available")}catch(hN){u(hN instanceof Error?hN.message:"Check failed"),t("error")}},[]),p=W.useCallback(()=>{const e=3e3,n=Date.now(),r=()=>{if(Date.now()-n>3e5)return u("更新超时(5 分钟)— 请检查服务器状态"),void t("update_failed");LS().then(n=>{n?n.success?(a(n.newVersion?`v${n.newVersion}`:"new version"),t("update_complete")):(u(n.error||"Update failed"),t("update_failed")):setTimeout(r,e)}).catch(()=>{setTimeout(r,e)})};setTimeout(r,e)},[]),h=()=>{r(!1),setTimeout(()=>{t("idle"),a(""),u(null),s(0),d(null)},200)};return ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{f()},disabled:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e,title:"检查更新",children:"checking"===e||"downloading"===e||"executing"===e||"reconnecting"===e?ee.jsx(qE,{className:"h-4 w-4 animate-spin"}):ee.jsx(FE,{className:"h-4 w-4"})}),ee.jsx(IP,{open:n,onOpenChange:e=>{e||h()},children:ee.jsxs(VP,{className:"sm:max-w-md",children:[ee.jsxs($P,{children:[ee.jsxs(UP,{children:["checking"===e&&"Checking for updates...","no_update"===e&&"Up to date","update_available"===e&&`Update ${o} available`,"downloading"===e&&"Downloading update...","downloaded"===e&&"Update ready to install","executing"===e&&"Updating server...","reconnecting"===e&&"Waiting for server restart...","update_complete"===e&&`Updated to ${o}`,"update_failed"===e&&"Update failed","error"===e&&"Update error"]}),ee.jsxs(WP,{children:["checking"===e&&"Checking for the latest version...","no_update"===e&&`Current version ${UT} is the latest.`,"update_available"===e&&"A new version is available. "+(WT?"Click download to update automatically.":""),"downloading"===e&&`Downloading... ${i}%`,"downloaded"===e&&"The update has been downloaded. Click install to restart and apply.","executing"===e&&"Server is shutting down and installing the update. Please wait...","reconnecting"===e&&"Update installed. Waiting for server to restart...","update_complete"===e&&`Successfully updated from ${UT} to ${o}. Click reload to use the new version.`,"update_failed"===e&&(l||"Update failed. You may need to restart the server manually."),"error"===e&&(l||"An error occurred.")]})]}),"downloading"===e&&ee.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:ee.jsx("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${i}%`}})}),("executing"===e||"reconnecting"===e)&&ee.jsx("div",{className:"flex items-center justify-center py-6",children:ee.jsx(qE,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),ee.jsxs(BP,{children:["no_update"===e&&ee.jsx(Tk,{onClick:h,children:"OK"}),"update_available"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"outline",onClick:h,children:"Later"}),ee.jsx(Tk,{onClick:()=>{(async()=>{if(WT){t("downloading"),s(0);const e=await window.electronUpdater.downloadUpdate();e.success?e.path&&d(e.path):(u(e.error||"Download failed"),t("error"))}else{t("executing");try{await DS(),t("reconnecting"),p()}catch(hN){u(hN instanceof Error?hN.message:"Execute failed"),t("error")}}})()},children:WT?"Download & Install":`Update to ${o}`})]}),"downloaded"===e&&ee.jsxs(ee.Fragment,{children:[ee.jsx(Tk,{variant:"outline",onClick:h,children:"Later"}),ee.jsx(Tk,{onClick:()=>{var e;null==(e=window.electronUpdater)||e.quitAndInstall(c||void 0)},children:"Restart & Install"})]}),"update_complete"===e&&ee.jsx(Tk,{onClick:()=>window.location.reload(),children:"Reload Page"}),"update_failed"===e&&ee.jsx(Tk,{onClick:h,children:"Close"}),"error"===e&&ee.jsx(Tk,{onClick:h,children:"Close"})]})]})})]})}function GT(e){return e.filter(e=>"text"===e.type).map(e=>e.content).join("\n")}const YT=H.memo(function({project:e,externalStatus:t,active:n=!1}){const r=cf(),[o,a]=W.useState("running"===e.status?"live":"stopped"),[i,s]=W.useState([]),[l,u]=W.useState(""),[c,d]=W.useState(!1),f=W.useRef(null),p=W.useRef(null),h=W.useRef(null),m=W.useRef(0),g=W.useCallback(async()=>{try{const t=await JS(e.id,1);if(0===t.length)return;const n=(await eE(e.id,t[0].id,"latest","user")).content.split(/(?=^## [UA]\d+)/m).filter(Boolean),r=[];for(const e of n){const t=e.match(/^## ([UA])(\d+).*\n/);if(!t)continue;const n="U"===t[1]?"user":"assistant",o=e.slice(t[0].length).trim();o&&r.push({role:n,content:o,ts:""})}s(e=>0===e.length?r.slice(-4):e)}catch{}},[e.id]);W.useEffect(()=>{"stopped"===o&&g()},[o,g]);const v=W.useRef(!1);W.useEffect(()=>{if("live"!==o)return void(v.current=!1);const e=setTimeout(()=>{v.current||g()},3e3);return()=>clearTimeout(e)},[o,g]),W.useEffect(()=>{t&&("running"!==t||"stopped"!==o&&"error"!==o?"stopped"===t&&"live"===o&&a("stopped"):(s([]),a("live")))},[t]);const y=W.useCallback(e=>{v.current=!0;const t=GT(e.blocks);t.trim()&&(s(n=>[...n,{role:e.role,content:t,ts:e.timestamp}].slice(-4)),"assistant"===e.role&&(d(!0),setTimeout(()=>d(!1),1e3)))},[]),b=W.useCallback(e=>{"stopped"===e&&a("stopped")},[]),{sendInput:x}=jT({projectId:e.id,enabled:"live"===o||"waking"===o,onChatMessage:y,onStatusChange:b});W.useEffect(()=>{if("live"===o&&f.current){const e=f.current;f.current=null,x(e+"\r")}},[o,x]),W.useEffect(()=>{var e;null==(e=p.current)||e.scrollTo({top:p.current.scrollHeight,behavior:"smooth"})},[i]),W.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const w=W.useCallback(()=>{const t=l.trim();if(t)if(u(""),"live"===o||"waking"===o)x(t+"\r");else if("stopped"===o||"error"===o){f.current=t;const n=++m.current;a("waking"),iS(e.id).then(()=>{n===m.current&&(s([]),a("live"))}).catch(e=>{n===m.current&&(rT.error(`启动失败: ${e instanceof Error?e.message:String(e)}`),a("error"),u(t),f.current=null)}),h.current=setTimeout(()=>{n===m.current&&f.current&&(rT.error("启动超时(10s)"),a("error"),u(f.current),f.current=null)},1e4)}},[l,o,e.id,x]),k="live"===o,S="stopped"===o,E="waking"===o,j=ee.jsxs("div",{className:ik("flex flex-col h-full rounded-lg overflow-hidden bg-background transition-colors duration-300",n?"border-transparent bg-transparent shadow-none":c?"border border-blue-500":"border border-border","error"===o&&"border border-red-500/50"),children:[ee.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1.5 border-b border-border bg-muted/30 transition-colors",children:[ee.jsx(YE,{className:"h-3.5 w-3.5 text-muted-foreground/40 flex-shrink-0 cursor-grab active:cursor-grabbing"}),ee.jsx("span",{className:"font-medium text-sm truncate flex-1 cursor-pointer hover:text-blue-400 transition-colors",onClick:()=>r(`/projects/${e.id}`),title:"打开项目详情",children:e.name}),ee.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.cliTool??"claude"}),ee.jsx("span",{className:ik("w-2 h-2 rounded-full flex-shrink-0",k?"bg-green-500":E?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),ee.jsxs("div",{ref:p,className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-0 text-xs",children:[i.map((e,t)=>{const n="user"===e.role;return ee.jsx("div",{className:ik("flex",n?"justify-end":"justify-start"),children:ee.jsx("div",{className:ik("max-w-[85%] rounded-lg px-2.5 py-1.5 whitespace-pre-wrap break-words leading-relaxed",n?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm dark:bg-blue-500/20 dark:border-blue-500/25":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:ee.jsx("div",{className:"line-clamp-6",children:e.content})})},t)}),S&&0===i.length&&ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-xs",children:"无对话记录"}),E&&ee.jsx("div",{className:"flex items-center justify-center h-full text-yellow-400 text-xs animate-pulse",children:"启动中..."})]}),ee.jsx("div",{className:"border-t border-border p-1.5",children:ee.jsx("input",{type:"text",value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e.shiftKey&&(e.preventDefault(),w())},disabled:E,placeholder:E?"启动中...":S?"输入命令(自动启动)... Shift+⏎":"输入命令... Shift+⏎",className:ik("w-full bg-transparent text-xs font-mono outline-none placeholder:text-muted-foreground/40 px-1.5 py-1",E&&"opacity-50 cursor-not-allowed")})})]});return n?ee.jsx("div",{className:"card-active-glow rounded-lg h-full",children:j}):j}),KT="ccweb:monitor-order";function XT(){try{return JSON.parse(localStorage.getItem(KT)||"[]")}catch{return[]}}function qT({projects:e,projectStatuses:t,activeProjectIds:n}){const r=W.useMemo(()=>e.filter(e=>!e.archived),[e]),[o,a]=W.useState(XT),[i,s]=W.useState(null),[l,u]=W.useState(null),c=W.useRef(null),d=W.useMemo(()=>function(e,t){const n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{const r=n.get(e.id)??1/0,o=n.get(t.id)??1/0;return r===o?0:r-o})}(r,o),[r,o]);W.useEffect(()=>{var e;o.length>0&&(e=o,localStorage.setItem(KT,JSON.stringify(e)))},[o]);const f=W.useCallback((e,t)=>{s(t),e.dataTransfer.effectAllowed="move";const n=document.createElement("div");n.style.width="1px",n.style.height="1px",n.style.opacity="0.01",document.body.appendChild(n),e.dataTransfer.setDragImage(n,0,0),c.current=n},[]),p=W.useCallback((e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u(t)},[]),h=W.useCallback((e,t)=>{if(e.preventDefault(),!i||i===t)return s(null),void u(null);const n=d.map(e=>e.id),r=n.indexOf(i),o=n.indexOf(t);if(-1===r||-1===o)return s(null),void u(null);n.splice(r,1),n.splice(o,0,i),a(n),s(null),u(null)},[i,d]),m=W.useCallback(()=>{s(null),u(null),c.current&&(c.current.remove(),c.current=null)},[]),{cols:g,rows:v}=(y=d.length)<=1?{cols:1,rows:1}:y<=2?{cols:2,rows:1}:y<=4?{cols:2,rows:2}:y<=6?{cols:3,rows:2}:y<=9?{cols:3,rows:3}:y<=12?{cols:4,rows:3}:{cols:4,rows:Math.ceil(y/4)};var y;if(0===d.length)return ee.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/50 text-sm",children:"没有活跃项目"});const b=v<=3;return ee.jsx("div",{className:"h-full w-full p-2 gap-2 overflow-y-auto",style:{display:"grid",gridTemplateColumns:`repeat(${g}, minmax(0, 1fr))`,gridAutoRows:b?`minmax(180px, min(${Math.floor(100/v)}vh, 350px))`:"280px"},children:d.map(e=>ee.jsx("div",{draggable:!0,onDragStart:t=>f(t,e.id),onDragOver:t=>p(t,e.id),onDrop:t=>h(t,e.id),onDragEnd:m,className:ik("transition-all duration-200",i===e.id&&"opacity-40 scale-95",l===e.id&&i!==e.id&&"ring-2 ring-blue-500/50 rounded-lg"),children:ee.jsx(YT,{project:e,externalStatus:t.get(e.id),active:n.has(e.id)})},e.id))})}function QT(){const e=cf(),{projects:t,loading:n,error:r,hasFetched:o,fetchProjects:a,addProject:i,updateProject:s,removeProject:l}=Gk(),u=Wk(e=>e.clearToken),[c,d]=W.useState(!1),[f,p]=W.useState(!1),[h,m]=W.useState(new Set),g=W.useRef(new Map),[v,y]=W.useState(new Map),b=W.useRef(0),[x,w]=W.useState(!!document.fullscreenElement),[k,S]=W.useState(!1),[E,j]=Uk(Fk.monitorMode,!1,{parse:!0}),[C,P]=W.useState(new Map);W.useEffect(()=>{const e=()=>w(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),W.useEffect(()=>{a()},[a]);ET({onActivityUpdate:W.useCallback(e=>{if(e.status){const t=Gk.getState().projects.find(t=>t.id===e.projectId);t&&t.status!==e.status&&s({...t,status:e.status}),P(t=>{const n=new Map(t);return n.set(e.projectId,e.status),n})}const t=Date.now(),n=g.current;if(e.active){m(t=>t.has(e.projectId)?t:new Set(t).add(e.projectId));const r=n.get(e.projectId)??[];let o=!1;if(e.semantic){const n=r[r.length-1];`${e.semantic.phase}:${e.semantic.detail??""}`!==(n?`${n.phase}:${n.detail??""}`:"")?(r.push({id:b.current++,phase:e.semantic.phase,detail:e.semantic.detail,ts:t}),o=!0):n&&(n.ts=t)}const a=r.filter(e=>t-e.ts<8e3),i=a.length>3?a.slice(-3):a;i.length!==r.length&&(o=!0),n.set(e.projectId,i),o&&y(new Map(n))}else m(t=>{if(!t.has(e.projectId))return t;const n=new Set(t);return n.delete(e.projectId),n}),n.has(e.projectId)&&n.get(e.projectId).length>0&&(n.set(e.projectId,[]),y(new Map(n)))},[s]),onProjectStopped:W.useCallback((e,t)=>{xT(e,t)},[])}),W.useEffect(()=>{const e=setInterval(()=>{const e=Date.now(),t=g.current;let n=!1;for(const[r,o]of t){const a=o.filter(t=>e-t.ts<8e3);a.length!==o.length&&(t.set(r,a),n=!0)}n&&y(new Map(t)),m(e=>{let n=!1;const r=new Set(e);for(const o of e){const e=t.get(o);e&&0!==e.length||(r.delete(o),n=!0)}return n?r:e})},3e3);return()=>clearInterval(e)},[]);const T=W.useMemo(()=>t.filter(e=>!e.archived),[t]),N=W.useMemo(()=>t.filter(e=>e.archived),[t]),M=W.useMemo(()=>Array.from(new Set(t.flatMap(e=>e.tags??[]))),[t]),[R,D]=W.useState([]),L=W.useMemo(()=>0===R.length?T:T.filter(e=>R.some(t=>{var n;return null==(n=e.tags)?void 0:n.includes(t)})),[T,R]),[_,O]=Uk(Fk.projectOrder,[],{parse:!0}),[A,I]=W.useState(null),[z,F]=W.useState(null);W.useEffect(()=>{if(0===T.length)return;const e=T.map(e=>e.id);O(t=>{const n=[...t.filter(t=>e.includes(t)),...e.filter(e=>!t.includes(e))];return n.join(",")===t.join(",")?t:n})},[T]);const V=W.useMemo(()=>0===_.length?L:[...L].sort((e,t)=>{const n=_.indexOf(e.id),r=_.indexOf(t.id);return-1===n?1:-1===r?-1:n-r}),[L,_]),$=W.useCallback(e=>I(e),[]),B=W.useCallback(()=>{I(null),F(null)},[]),U=W.useCallback((e,t)=>{e.preventDefault(),F(t)},[]),H=W.useCallback((e,t,n)=>{e.preventDefault(),n&&n!==t?(O(e=>{const r=[...e],o=r.indexOf(n),a=r.indexOf(t);return-1===o||-1===a?e:(r.splice(o,1),r.splice(a,0,n),r)}),I(null),F(null)):F(null)},[O]),G={onDelete:e=>{(async e=>{try{await aS(e),l(e)}catch(hN){rT.error(hN instanceof Error?hN.message:"Failed to delete project")}})(e)},onArchive:e=>{(async e=>{try{const t=await sS(e);s(t)}catch(hN){rT.error(hN instanceof Error?hN.message:"Failed to archive project")}})(e)},onUnarchive:e=>{(async e=>{try{const t=await lS(e);s(t)}catch(hN){rT.error(hN instanceof Error?hN.message:"Failed to restore project")}})(e)},onUpdated:s};return ee.jsxs("div",{className:"min-h-screen bg-background",children:[ee.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:ee.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[ee.jsxs("div",{className:"flex items-center gap-2",children:[ee.jsx(cj,{className:"h-5 w-5"}),ee.jsxs("div",{children:[ee.jsx("span",{className:"font-semibold text-lg leading-tight block",children:"CC Web"}),ee.jsx("span",{className:"text-[10px] text-muted-foreground leading-none",children:UT})]})]}),ee.jsx(MT,{}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:ee.jsx(lj,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>e("/mobile"),title:"手机界面",children:ee.jsx(sj,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:ee.jsx(ij,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>j(!E),title:E?"卡片模式":"监控大屏",className:ik(E&&"text-blue-400 bg-blue-500/10"),children:E?ee.jsx(XE,{className:"h-4 w-4"}):ee.jsx(tj,{className:"h-4 w-4"})}),ee.jsx(Tk,{variant:"ghost",size:"sm",onClick:()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},title:x?"Exit fullscreen":"Fullscreen",children:x?ee.jsx(JE,{className:"h-4 w-4"}):ee.jsx(ZE,{className:"h-4 w-4"})}),ee.jsx(HT,{}),ee.jsx(BT,{}),ee.jsx(AT,{}),ee.jsxs(Tk,{variant:"ghost",size:"sm",onClick:()=>{u(),e("/login")},children:[ee.jsx(QE,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),E&&ee.jsx("div",{className:"flex-1 min-h-0",children:ee.jsx(qT,{projects:t,projectStatuses:C,activeProjectIds:h})}),!E&&ee.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[ee.jsxs("div",{className:"flex items-center justify-between mb-6",children:[ee.jsxs("div",{children:[ee.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),ee.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),ee.jsxs("div",{className:"flex gap-2",children:[ee.jsxs(Tk,{variant:"outline",onClick:()=>p(!0),children:[ee.jsx(BE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(Tk,{onClick:()=>d(!0),children:[ee.jsx(oj,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),n&&!o&&ee.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),r&&ee.jsx("div",{className:"text-center text-destructive py-12",children:r}),o&&!n&&!r&&0===t.length&&ee.jsxs("div",{className:"text-center py-20",children:[ee.jsx(cj,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),ee.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),ee.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),ee.jsxs("div",{className:"flex gap-2 justify-center",children:[ee.jsxs(Tk,{variant:"outline",onClick:()=>p(!0),children:[ee.jsx(BE,{className:"h-4 w-4 mr-2"}),"Open Project"]}),ee.jsxs(Tk,{onClick:()=>d(!0),children:[ee.jsx(oj,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!n&&!r&&M.length>0&&ee.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[M.map(e=>ee.jsxs("button",{onClick:()=>D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:ik("px-2 py-0.5 rounded-full text-xs border transition-colors",R.includes(e)?"bg-blue-500/20 text-blue-400 border-blue-500/40":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",e]},e)),R.length>0&&ee.jsx("button",{onClick:()=>D([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:"清除"})]}),!n&&!r&&V.length>0&&ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:V.map((e,t)=>ee.jsx(dw.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:Math.min(.05*t,.3),ease:"easeOut"},draggable:!0,onDragStart:()=>$(e.id),onDragOver:t=>U(t,e.id),onDrop:t=>H(t,e.id,A),onDragEnd:B,style:{opacity:A===e.id?.4:1,cursor:"grab"},className:ik(z===e.id&&A!==e.id&&"ring-2 ring-blue-500/50 rounded-xl"),children:ee.jsx(hT,{project:e,active:h.has(e.id),statusStack:v.get(e.id)??[],...G})},e.id))}),!n&&!r&&N.length>0&&ee.jsxs("div",{className:"mt-10",children:[ee.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>S(e=>!e),children:[ee.jsx(dw.span,{animate:{rotate:k?90:0},transition:{duration:.2},children:ee.jsx(zE,{className:"h-4 w-4"})}),ee.jsx("span",{className:"font-medium",children:"Archived"}),ee.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:N.length})]}),ee.jsx(Yb,{children:k&&ee.jsx(dw.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:ee.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:N.map(e=>ee.jsx(hT,{project:e,active:!1,...G},e.id))})})})]}),ee.jsx(RT,{})]}),ee.jsx(yT,{open:c,onOpenChange:d,onCreated:e=>{i(e)}}),ee.jsx(bT,{open:f,onOpenChange:p,onOpened:e=>{i(e)}})]})}class ZT extends H.Component{constructor(){super(...arguments),t(this,"state",{hasError:!1,error:null}),t(this,"handleReset",()=>{var e,t;this.setState({hasError:!1,error:null}),null==(t=(e=this.props).onReset)||t.call(e)})}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t.componentStack),rT.error(e.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ee.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[ee.jsx("p",{children:"出错了"}),ee.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}}function JT({plugin:e,onConfigChange:t,onClose:n}){const{float:r,userConfig:o}=e,[a,i]=W.useState(()=>{var e,t;return{x:(null==(e=o.floatPosition)?void 0:e.x)??.5*window.innerWidth-r.defaultWidth/2,y:(null==(t=o.floatPosition)?void 0:t.y)??.3*window.innerHeight}}),[s,l]=W.useState(()=>{var e,t;return{w:(null==(e=o.floatSize)?void 0:e.w)??r.defaultWidth,h:(null==(t=o.floatSize)?void 0:t.h)??r.defaultHeight}}),[u,c]=W.useState(!1),[d,f]=W.useState(100),p=W.useRef(null),h=W.useRef(null),m=W.useCallback(()=>{f(Date.now()%1e5+100)},[]),g=W.useRef(null),v=W.useCallback(n=>{n.preventDefault(),m(),g.current={sx:n.clientX,sy:n.clientY,ox:a.x,oy:a.y},h.current&&(h.current.style.pointerEvents="none");const r=e=>{if(!g.current)return;const t=Math.max(0,Math.min(window.innerWidth-100,g.current.ox+e.clientX-g.current.sx)),n=Math.max(0,Math.min(window.innerHeight-40,g.current.oy+e.clientY-g.current.sy));p.current&&(p.current.style.left=t+"px",p.current.style.top=n+"px")},o=n=>{if(!g.current)return;const a=Math.max(0,Math.min(window.innerWidth-100,g.current.ox+n.clientX-g.current.sx)),s=Math.max(0,Math.min(window.innerHeight-40,g.current.oy+n.clientY-g.current.sy));g.current=null,h.current&&(h.current.style.pointerEvents=""),i({x:a,y:s}),t(e.id,{floatPosition:{x:a,y:s}}),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[a,m,e.id,t]),y=W.useRef(null),b=W.useCallback(n=>{if(!r.resizable)return;n.preventDefault(),n.stopPropagation(),m(),y.current={sx:n.clientX,sy:n.clientY,ow:s.w,oh:s.h},h.current&&(h.current.style.pointerEvents="none");const o=r.minWidth??150,a=r.minHeight??100,i=e=>{if(!y.current)return;const t=Math.max(o,y.current.ow+e.clientX-y.current.sx),n=Math.max(a,y.current.oh+e.clientY-y.current.sy);p.current&&(p.current.style.width=t+"px",p.current.style.height=n+"px")},u=n=>{if(!y.current)return;const r=Math.max(o,y.current.ow+n.clientX-y.current.sx),s=Math.max(a,y.current.oh+n.clientY-y.current.sy);y.current=null,h.current&&(h.current.style.pointerEvents=""),l({w:r,h:s}),t(e.id,{floatSize:{w:r,h:s}}),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",i),window.addEventListener("mouseup",u)},[s,r,m,e.id,t]);W.useEffect(()=>{const t=async t=>{var n,r,o,a,i;if(t.source!==(null==(n=h.current)?void 0:n.contentWindow))return;const{callId:s,method:l,args:u}=t.data;if(s&&l)try{const t=Xk(),n={"Content-Type":"application/json","X-Plugin-Id":e.id};let a,i;if(t&&(n.Authorization=`Bearer ${t}`),"storage:get"===l)a=`/api/plugin-bridge/storage/${e.id}`,i={method:"GET",headers:n};else if("storage:set"===l)a=`/api/plugin-bridge/storage/${e.id}`,i={method:"PUT",headers:n,body:JSON.stringify(u)};else{const t={"project:status":{path:`/api/plugin-bridge/project/status/${u.projectId}`,httpMethod:"GET"},"project:list":{path:"/api/plugin-bridge/project/list",httpMethod:"GET"},"terminal:send":{path:"/api/plugin-bridge/terminal/send",httpMethod:"POST"},"session:read":{path:`/api/plugin-bridge/session/${u.projectId}`,httpMethod:"GET"},"system:info":{path:"/api/plugin-bridge/system/info",httpMethod:"GET"}};if("backend:api"===l){const{method:t,path:r,body:o}=u;if(!r||!r.startsWith("/")||r.includes(".."))throw new Error("Invalid API path");a=`/api/plugins/${e.id}${r}`,i={method:t||"GET",headers:n},!o||"POST"!==t&&"PUT"!==t||(i.body=JSON.stringify(o))}else{const e=t[l];if(!e)throw new Error(`Unknown method: ${l}`);a=e.path,i={method:e.httpMethod,headers:n},"POST"===e.httpMethod&&(i.body=JSON.stringify(u))}}const c=await fetch(a,i),d=await c.json();null==(o=null==(r=h.current)?void 0:r.contentWindow)||o.postMessage({callId:s,result:d,error:null},window.location.origin)}catch(hN){const t=hN instanceof Error?hN.message:"Bridge error";null==(i=null==(a=h.current)?void 0:a.contentWindow)||i.postMessage({callId:s,result:null,error:t},window.location.origin)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e.id]);const x=o.clickable??r.clickable.default,w=`/plugins/${e.id}/${e.float?"index.html":""}`;return ee.jsxs(dw.div,{ref:p,className:ik("fixed rounded-lg border border-border shadow-xl overflow-hidden flex flex-col","bg-background/95 backdrop-blur-sm"),style:{left:a.x,top:a.y,width:u?200:s.w,height:u?32:s.h,zIndex:d},initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},onMouseDown:m,children:[ee.jsxs("div",{className:"h-8 flex items-center gap-1 px-2 bg-muted/50 border-b border-border cursor-grab active:cursor-grabbing flex-shrink-0 select-none",onMouseDown:v,children:[ee.jsx(GE,{className:"h-3 w-3 text-muted-foreground/40 flex-shrink-0"}),ee.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:e.name}),ee.jsx("button",{onClick:()=>c(e=>!e),className:"p-0.5 rounded hover:bg-white/10 text-muted-foreground/60 hover:text-foreground transition-colors",children:ee.jsx(ej,{className:"h-3 w-3"})}),ee.jsx("button",{onClick:()=>n(e.id),className:"p-0.5 rounded hover:bg-red-500/20 text-muted-foreground/60 hover:text-red-400 transition-colors",children:ee.jsx(hj,{className:"h-3 w-3"})})]}),!u&&ee.jsxs("div",{className:"flex-1 min-h-0 relative",children:[ee.jsx("iframe",{ref:h,src:w,sandbox:"allow-scripts allow-same-origin",className:"w-full h-full border-0",style:{pointerEvents:x?"auto":"none"}}),r.resizable&&ee.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-se-resize",onMouseDown:b,children:ee.jsxs("svg",{viewBox:"0 0 12 12",className:"w-3 h-3 text-muted-foreground/30",children:[ee.jsx("path",{d:"M11 1v10H1",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),ee.jsx("path",{d:"M11 5v6H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]})})]})]})}function eN({plugins:e,onPluginsChange:t,onClose:n}){const r=W.useCallback(async(e,n)=>{t(t=>t.map(t=>t.id===e?{...t,userConfig:{...t.userConfig,...n}}:t));try{await hE(e,n)}catch{}},[t]);return 0===e.length?null:ee.jsx(Yb,{children:e.map(e=>ee.jsx(JT,{plugin:e,onConfigChange:r,onClose:n},e.id))})}function tN({onTogglePlugin:e,activeIds:t}){const[n,r]=W.useState([]);return W.useEffect(()=>{dE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>r([]))},[]),W.useEffect(()=>{const e=()=>{dE().then(e=>r(e.filter(e=>e.enabled))).catch(()=>{})};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),0===n.length?null:ee.jsx("div",{className:"fixed top-14 left-1/2 -translate-x-1/2 z-40 pointer-events-none",children:ee.jsx(dw.div,{className:"pointer-events-auto flex items-center gap-1 px-2 py-1 rounded-full bg-background/60 backdrop-blur-md border border-border/50 shadow-lg",initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:n.map(n=>{const r=t.has(n.id),o=n.name.slice(0,2);return ee.jsxs(dw.button,{onClick:()=>e(n),className:ik("relative flex items-center justify-center w-7 h-7 rounded-full text-[10px] font-medium transition-colors",r?"bg-blue-500/20 text-blue-400":"text-muted-foreground/70 hover:text-foreground hover:bg-muted/80"),whileHover:{scale:1.12},whileTap:{scale:.92},title:n.name+(n.description?` — ${n.description}`:""),children:[o,ee.jsx(Yb,{children:r&&ee.jsx(dw.span,{className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 h-1 w-1 rounded-full bg-blue-400",initial:{scale:0},animate:{scale:1},exit:{scale:0}})})]},n.id)})})})}const nN=H.lazy(()=>fd(()=>import("./ProjectPage-BYNWACoF.js").then(e=>e.b),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.ProjectPage}))),rN=H.lazy(()=>fd(()=>import("./SettingsPage-DSp71y-d.js"),__vite__mapDeps([11,5,9,4])).then(e=>({default:e.SettingsPage}))),oN=H.lazy(()=>fd(()=>import("./SkillHubPage-Dsy9klSW.js"),__vite__mapDeps([12,8,7,5])).then(e=>({default:e.SkillHubPage}))),aN=H.lazy(()=>fd(()=>import("./ShareViewPage-CqU6Q4Bx.js"),__vite__mapDeps([13,7,6])).then(e=>({default:e.ShareViewPage}))),iN=H.lazy(()=>fd(()=>import("./MobilePage-Cf7_j9Ue.js"),__vite__mapDeps([14,9,2,3,5])).then(e=>({default:e.MobilePage})));function sN(){return ee.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:ee.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function lN({children:e}){const[t,n]=W.useState(!1),r=Wk(e=>e.token),o=Wk(e=>e.setToken);return W.useEffect(()=>{r?n(!0):Jk()?eS().then(e=>o(e)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),t||r?r?ee.jsx(ee.Fragment,{children:e}):ee.jsx(wf,{to:"/login",replace:!0}):null}const uN=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;function cN(){const[e,t]=W.useState([]),[n,r]=W.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc_plugin_open")||"[]"))}catch{return new Set}}),o=lf();W.useEffect(()=>{dE().then(t).catch(()=>t([]))},[]);const a=W.useCallback(e=>{r(t=>{const n=new Set(t);n.has(e.id)?n.delete(e.id):n.add(e.id);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),i=W.useCallback(e=>{r(t=>{const n=new Set(t);n.delete(e);try{localStorage.setItem("cc_plugin_open",JSON.stringify([...n]))}catch{}return n})},[]),s=function(e){if("/"===e||"/dashboard"===e)return{type:"dashboard"};const t=e.match(/^\/projects?\/([^/]+)/);return t?{type:"project",projectId:t[1]}:{type:"other"}}(o.pathname),l=e.filter(e=>{if(!e.enabled||!n.has(e.id))return!1;switch(e.userConfig.scope??e.float.scope.default){case"global":return!0;case"dashboard":return"dashboard"===s.type;case"project":return"project"===s.type;case"project:specific":return"project"===s.type&&(e.userConfig.projectIds??[]).includes(s.projectId??"");default:return!1}}),u="/login"===o.pathname,c="/mobile"===o.pathname;return ee.jsxs(ee.Fragment,{children:[!u&&!c&&!uN&&ee.jsx(tN,{onTogglePlugin:a,activeIds:n}),ee.jsx(eN,{plugins:l,onPluginsChange:t,onClose:i})]})}function dN({children:e}){const t=lf();return uN&&"/"===t.pathname?ee.jsx(wf,{to:"/mobile",replace:!0}):ee.jsx(ee.Fragment,{children:e})}function fN(){return ee.jsxs(_T,{children:[ee.jsx(dT,{richColors:!0,position:"bottom-right"}),ee.jsx(VT,{}),ee.jsx($T,{}),ee.jsx(ZT,{children:ee.jsxs(Pf,{children:[ee.jsx(cN,{}),ee.jsx(dN,{children:ee.jsx(W.Suspense,{fallback:ee.jsx(sN,{}),children:ee.jsxs(Ef,{children:[ee.jsx(kf,{path:"/login",element:ee.jsx(RE,{})}),ee.jsx(kf,{path:"/",element:ee.jsx(lN,{children:ee.jsx(QT,{})})}),ee.jsx(kf,{path:"/projects/:id",element:ee.jsx(lN,{children:ee.jsx(nN,{})})}),ee.jsx(kf,{path:"/settings",element:ee.jsx(lN,{children:ee.jsx(rN,{})})}),ee.jsx(kf,{path:"/skillhub",element:ee.jsx(lN,{children:ee.jsx(oN,{})})}),ee.jsx(kf,{path:"/mobile",element:ee.jsx(lN,{children:ee.jsx(iN,{})})}),ee.jsx(kf,{path:"/share/:token",element:ee.jsx(aN,{})}),ee.jsx(kf,{path:"*",element:ee.jsx(wf,{to:"/",replace:!0})})]})})})]})})]})}te.createRoot(document.getElementById("root")).render(ee.jsx(H.StrictMode,{children:ee.jsx(fN,{})}));export{mS as $,Yb as A,Tk as B,zE as C,FE as D,VE as E,BE as F,qS as G,EE as H,Nk as I,CE as J,jE as K,TE as L,JE as M,PE as N,NE as O,rj as P,JS as Q,H as R,Fk as S,fj as T,eE as U,nE as V,tE as W,hj as X,rE as Y,oE as Z,fd as _,TS as a,zT as a$,dS as a0,mj as a1,HE as a2,yS as a3,IP as a4,VP as a5,$P as a6,UP as a7,WP as a8,_k as a9,Uk as aA,Gk as aB,cj as aC,wj as aD,mk as aE,Cj as aF,Rj as aG,yj as aH,bj as aI,hk as aJ,Ej as aK,Dj as aL,Zj as aM,ld as aN,Qj as aO,qC as aP,tC as aQ,UC as aR,Wj as aS,zj as aT,_S as aU,AS as aV,zS as aW,sk as aX,lk as aY,uk as aZ,dk as a_,BP as aa,vS as ab,gS as ac,xS as ad,uS as ae,cS as af,iE as ag,cf as ah,AE as ai,vj as aj,BT as ak,AT as al,qE as am,FS as an,iS as ao,xT as ap,ST as aq,MT as ar,uE as as,lE as at,GT as au,Bk as av,cE as aw,GE as ax,lj as ay,df as az,ik as b,HS as b0,dj as b1,OS as b2,VS as b3,BS as b4,WS as b5,IS as b6,US as b7,$S as b8,GS as b9,dE as ba,fE as bb,pE as bc,mE as bd,bS as be,wS as bf,sE as bg,ET as bh,tj as bi,jT as bj,$E as bk,kS as bl,r as bm,o as bn,gE as bo,SE as bp,vE as bq,yE as br,bE as bs,xE as bt,wE as bu,kE as bv,a as bw,ME as bx,LE as c,ZE as d,jS as e,Vk as f,Xk as g,Kk as h,ES as i,ee as j,aj as k,MS as l,CS as m,WE as n,dw as o,YS as p,QS as q,W as r,$k as s,rT as t,OT as u,IE as v,NS as w,oj as x,KS as y,XS as z};
|