@tom2012/cc-web 1.5.55 → 1.5.57
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/{ChatView-DH14n4YW.js → ChatView-C3XFhoBS.js} +1 -1
- package/frontend/dist/assets/{GraphPreview-B0dC7c_q.js → GraphPreview-U4pGvLSs.js} +1 -1
- package/frontend/dist/assets/{OfficePreview-CHGUXowA.js → OfficePreview-zCTXKErb.js} +3 -3
- package/frontend/dist/assets/PomodoroTimer-D0OSjt-3.js +21 -0
- package/frontend/dist/assets/{ProjectPage-BbEOvh4D.js → ProjectPage-5JqI1xiV.js} +51 -51
- package/frontend/dist/assets/SettingsPage-CtcFpBmw.js +36 -0
- package/frontend/dist/assets/{ShareViewPage-BmPLFG-T.js → ShareViewPage-DRSWJiGO.js} +1 -1
- package/frontend/dist/assets/{SkillHubPage-COgCGxfO.js → SkillHubPage-DacbRrr4.js} +1 -1
- package/frontend/dist/assets/{bot-ByqY_wjy.js → bot-DqgxR4Sz.js} +1 -1
- package/frontend/dist/assets/{chevron-down-Dr94IS1X.js → chevron-down-BMtV2j75.js} +1 -1
- package/frontend/dist/assets/{download-DYEz-nxl.js → download-C77T530m.js} +1 -1
- package/frontend/dist/assets/index-3DCvEOU5.css +1 -0
- package/frontend/dist/assets/{index-DHv2QLtK.js → index-5tpoy1eF.js} +1 -1
- package/frontend/dist/assets/{index-CjekP9LT.js → index-C4JwI5Qj.js} +3 -3
- package/frontend/dist/assets/{jszip.min-DziwEKhw.js → jszip.min-Bz5H2bEq.js} +1 -1
- package/frontend/dist/assets/{user-CV9nu6Vl.js → user-BRvY_CJA.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/SettingsPage-W-rH5UiK.js +0 -36
- package/frontend/dist/assets/index-Dtp6YTZg.css +0 -1
- package/frontend/dist/assets/save-CeOqUQlr.js +0 -16
|
@@ -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-5JqI1xiV.js","assets/PomodoroTimer-D0OSjt-3.js","assets/download-C77T530m.js","assets/chevron-down-BMtV2j75.js","assets/bot-DqgxR4Sz.js","assets/user-BRvY_CJA.js","assets/ProjectPage-9CEnUXvW.css","assets/SettingsPage-CtcFpBmw.js","assets/SkillHubPage-DacbRrr4.js","assets/ShareViewPage-DRSWJiGO.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var pw=Object.defineProperty;var mw=(e,t,n)=>t in e?pw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tl=(e,t,n)=>mw(e,typeof t!="symbol"?t+"":t,n);function gw(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var _M=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function IM(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var jm={exports:{}},ya={},Rm={exports:{}},G={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -73,7 +73,7 @@ Error generating stack: `+o.message+`
|
|
|
73
73
|
${v}px !important;
|
|
74
74
|
${E}px !important;
|
|
75
75
|
}
|
|
76
|
-
`),()=>{var k;(k=a.current)==null||k.removeAttribute("data-motion-pop-id"),T.contains(C)&&T.removeChild(C)}},[t]),h.jsx(C2,{isPresent:t,childRef:a,sizeRef:l,pop:o,children:o===!1?e:p.cloneElement(e,{ref:u})})}const P2=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:i,anchorX:a,anchorY:l,root:c})=>{const d=Td(N2),u=p.useId();let f=!0,y=p.useMemo(()=>(f=!1,{id:u,initial:t,isPresent:n,custom:s,onExitComplete:w=>{d.set(w,!0);for(const x of d.values())if(!x)return;r&&r()},register:w=>(d.set(w,!1),()=>d.delete(w))}),[n,d,r]);return o&&f&&(y={...y}),p.useMemo(()=>{d.forEach((w,x)=>d.set(x,!1))},[n]),p.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),e=h.jsx(T2,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),h.jsx(_a.Provider,{value:y,children:e})};function N2(){return new Map}function N0(e=!0){const t=p.useContext(_a);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=p.useId();p.useEffect(()=>{if(e)return s(o)},[e]);const i=p.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,i]:[!0]}const ei=e=>e.key||"";function zp(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const qd=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[d,u]=N0(i),f=p.useMemo(()=>zp(e),[e]),y=i&&!d?[]:f.map(ei),w=p.useRef(!0),x=p.useRef(f),S=Td(()=>new Map),m=p.useRef(new Set),[g,v]=p.useState(f),[E,C]=p.useState(f);tv(()=>{w.current=!1,x.current=f;for(let b=0;b<E.length;b++){const A=ei(E[b]);y.includes(A)?(S.delete(A),m.current.delete(A)):S.get(A)!==!0&&S.set(A,!1)}},[E,y.length,y.join("-")]);const T=[];if(f!==g){let b=[...f];for(let A=0;A<E.length;A++){const P=E[A],D=ei(P);y.includes(D)||(b.splice(A,0,P),T.push(P))}return o==="wait"&&T.length&&(b=T),C(zp(b)),v(f),null}const{forceRender:k}=p.useContext(Cd);return h.jsx(h.Fragment,{children:E.map(b=>{const A=ei(b),P=i&&!d?!1:f===E||y.includes(A),D=()=>{if(m.current.has(A))return;if(S.has(A))m.current.add(A),S.set(A,!0);else return;let L=!0;S.forEach(Q=>{Q||(L=!1)}),L&&(k==null||k(),C(x.current),i&&(u==null||u()),r&&r())};return h.jsx(P2,{isPresent:P,initial:!w.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:o,root:c,onExitComplete:P?void 0:D,anchorX:a,anchorY:l,children:b},A)})})},j0=p.createContext({strict:!1}),Bp={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let $p=!1;function j2(){if($p)return;const e={};for(const t in Bp)e[t]={isEnabled:n=>Bp[t].some(r=>!!n[r])};s0(e),$p=!0}function R0(){return j2(),hC()}function R2(e){const t=R0();for(const n in e)t[n]={...t[n],...e[n]};s0(t)}const M2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function fa(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||M2.has(e)}let M0=e=>!fa(e);function A2(e){typeof e=="function"&&(M0=t=>t.startsWith("on")?!fa(t):e(t))}try{A2(require("@emotion/is-prop-valid").default)}catch{}function D2(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||Ie(e[s])||(M0(s)||n===!0&&fa(s)||!t&&!fa(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const za=p.createContext({});function L2(e,t){if(Fa(e)){const{initial:n,animate:r}=e;return{initial:n===!1||po(n)?n:void 0,animate:po(r)?r:void 0}}return e.inherit!==!1?t:{}}function O2(e){const{initial:t,animate:n}=L2(e,p.useContext(za));return p.useMemo(()=>({initial:t,animate:n}),[Up(t),Up(n)])}function Up(e){return Array.isArray(e)?e.join(" "):e}const Jd=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function A0(e,t,n){for(const r in t)!Ie(t[r])&&!d0(r,n)&&(e[r]=t[r])}function _2({transformTemplate:e},t){return p.useMemo(()=>{const n=Jd();return Xd(n,t,e),Object.assign({},n.vars,n.style)},[t])}function I2(e,t){const n=e.style||{},r={};return A0(r,n,e),Object.assign(r,_2(e,t)),r}function V2(e,t){const n={},r=I2(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const D0=()=>({...Jd(),attrs:{}});function F2(e,t,n,r){const s=p.useMemo(()=>{const o=D0();return f0(o,t,p0(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};A0(o,e.style,e),s.style={...o,...s.style}}return s}const z2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ef(e){return typeof e!="string"||e.includes("-")?!1:!!(z2.indexOf(e)>-1||/[A-Z]/u.test(e))}function B2(e,t,n,{latestValues:r},s,o=!1,i){const l=(i??ef(e)?F2:V2)(t,r,s,e),c=D2(t,typeof e=="string",o),d=e!==p.Fragment?{...c,...l,ref:n}:{},{children:u}=t,f=p.useMemo(()=>Ie(u)?u.get():u,[u]);return p.createElement(e,{...d,children:f})}function $2({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:U2(n,r,s,e),renderState:t()}}function U2(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=ji(o[f]);let{initial:i,animate:a}=e;const l=Fa(e),c=n0(e);t&&c&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||i===!1;const u=d?a:i;if(u&&typeof u!="boolean"&&!Va(u)){const f=Array.isArray(u)?u:[u];for(let y=0;y<f.length;y++){const w=Bd(e,f[y]);if(w){const{transitionEnd:x,transition:S,...m}=w;for(const g in m){let v=m[g];if(Array.isArray(v)){const E=d?v.length-1:0;v=v[E]}v!==null&&(s[g]=v)}for(const g in x)s[g]=x[g]}}}return s}const L0=e=>(t,n)=>{const r=p.useContext(za),s=p.useContext(_a),o=()=>$2(e,t,r,s);return n?o():Td(o)},W2=L0({scrapeMotionValuesFromProps:Qd,createRenderState:Jd}),H2=L0({scrapeMotionValuesFromProps:m0,createRenderState:D0}),G2=Symbol.for("motionComponentSymbol");function K2(e,t,n){const r=p.useRef(n);p.useInsertionEffect(()=>{r.current=n});const s=p.useRef(null);return p.useCallback(o=>{var a;o&&((a=e.onMount)==null||a.call(e,o));const i=r.current;if(typeof i=="function")if(o){const l=i(o);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):i(o);else i&&(i.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const O0=p.createContext({});function Nr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Y2(e,t,n,r,s,o){var v,E;const{visualElement:i}=p.useContext(za),a=p.useContext(j0),l=p.useContext(_a),c=p.useContext(Zd),d=c.reducedMotion,u=c.skipAnimations,f=p.useRef(null),y=p.useRef(!1);r=r||a.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d,skipAnimations:u,isSVG:o}),y.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const w=f.current,x=p.useContext(O0);w&&!w.projection&&s&&(w.type==="html"||w.type==="svg")&&X2(f.current,n,s,x);const S=p.useRef(!1);p.useInsertionEffect(()=>{w&&S.current&&w.update(n,l)});const m=n[Uv],g=p.useRef(!!m&&typeof window<"u"&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,m))&&((E=window.MotionHasOptimisedAnimation)==null?void 0:E.call(window,m)));return tv(()=>{y.current=!0,w&&(S.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),g.current&&w.animationState&&w.animationState.animateChanges())}),p.useEffect(()=>{w&&(!g.current&&w.animationState&&w.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var C;(C=window.MotionHandoffMarkAsComplete)==null||C.call(window,m)}),g.current=!1),w.enteringChildren=void 0)}),w}function X2(e,t,n,r){const{layoutId:s,layout:o,drag:i,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:_0(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||a&&Nr(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}function _0(e){if(e)return e.options.allowProjection!==!1?e.projection:_0(e.parent)}function zl(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&R2(r);const o=n?n==="svg":ef(e),i=o?H2:W2;function a(c,d){let u;const f={...p.useContext(Zd),...c,layoutId:Q2(c)},{isStatic:y}=f,w=O2(c),x=i(c,y);if(!y&&typeof window<"u"){Z2();const S=q2(f);u=S.MeasureLayout,w.visualElement=Y2(e,x,f,s,S.ProjectionNode,o)}return h.jsxs(za.Provider,{value:w,children:[u&&w.visualElement?h.jsx(u,{visualElement:w.visualElement,...f}):null,B2(e,c,K2(x,w.visualElement,d),x,y,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=p.forwardRef(a);return l[G2]=e,l}function Q2({layoutId:e}){const t=p.useContext(Cd).id;return t&&e!==void 0?t+"-"+e:e}function Z2(e,t){p.useContext(j0).strict}function q2(e){const t=R0(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function J2(e,t){if(typeof Proxy>"u")return zl;const n=new Map,r=(o,i)=>zl(o,i,e,t),s=(o,i)=>r(o,i);return new Proxy(s,{get:(o,i)=>i==="create"?r:(n.has(i)||n.set(i,zl(i,void 0,e,t)),n.get(i))})}const eT=(e,t)=>t.isSVG??ef(e)?new RC(t):new bC(t,{allowProjection:e!==p.Fragment});class tT extends Yn{constructor(t){super(t),t.animationState||(t.animationState=OC(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Va(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let nT=0;class rT extends Yn{constructor(){super(...arguments),this.id=nT++,this.isExitComplete=!1}update(){var o;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:i,custom:a}=this.node.getProps();if(typeof i=="string"){const l=hr(this.node,i,a);if(l){const{transition:c,transitionEnd:d,...u}=l;for(const f in u)(o=this.node.getValue(f))==null||o.jump(u[f])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const sT={animation:{Feature:tT},exit:{Feature:rT}};function Ro(e){return{point:{x:e.pageX,y:e.pageY}}}const oT=e=>t=>Hd(t)&&e(t,Ro(t));function Hs(e,t,n,r){return mo(e,t,oT(n),r)}const I0=({current:e})=>e?e.ownerDocument.defaultView:null,Wp=(e,t)=>Math.abs(e-t);function iT(e,t){const n=Wp(e.x,t.x),r=Wp(e.y,t.y);return Math.sqrt(n**2+r**2)}const Hp=new Set(["auto","scroll"]);class V0{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=y=>{this.handleScroll(y.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=ti(this.lastRawMoveEventInfo,this.transformPagePoint));const y=Bl(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,x=iT(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!x)return;const{point:S}=y,{timestamp:m}=_e;this.history.push({...S,timestamp:m});const{onStart:g,onMove:v}=this.handlers;w||(g&&g(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,y)},this.handlePointerMove=(y,w)=>{this.lastMoveEvent=y,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=ti(w,this.transformPagePoint),oe.update(this.updatePoint,!0)},this.handlePointerUp=(y,w)=>{this.end();const{onEnd:x,onSessionEnd:S,resumeAnimation:m}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Bl(y.type==="pointercancel"?this.lastMoveEventInfo:ti(w,this.transformPagePoint),this.history);this.startEvent&&x&&x(y,g),S&&S(y,g)},!Hd(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=s||window;const l=Ro(t),c=ti(l,this.transformPagePoint),{point:d}=c,{timestamp:u}=_e;this.history=[{...d,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,Bl(c,this.history)),this.removeListeners=Po(Hs(this.contextWindow,"pointermove",this.handlePointerMove),Hs(this.contextWindow,"pointerup",this.handlePointerUp),Hs(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Hp.has(r.overflowX)||Hp.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:s.x-n.x,y:s.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,s),oe.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Un(this.updatePoint)}}function ti(e,t){return t?{point:t(e.point)}:e}function Gp(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Bl({point:e},t){return{point:e,delta:Gp(e,F0(t)),offset:Gp(e,aT(t)),velocity:lT(t,.1)}}function aT(e){return e[0]}function F0(e){return e[e.length-1]}function lT(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=F0(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>ct(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>ct(t)*2&&(r=e[1]);const o=vt(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function uT(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?fe(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?fe(n,e,r.max):Math.min(e,n)),e}function Kp(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function cT(e,{top:t,left:n,bottom:r,right:s}){return{x:Kp(e.x,n,s),y:Kp(e.y,t,r)}}function Yp(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function dT(e,t){return{x:Yp(e.x,t.x),y:Yp(e.y,t.y)}}function fT(e,t){let n=.5;const r=Xe(e),s=Xe(t);return s>r?n=fo(t.min,t.max-r,e.min):r>s&&(n=fo(e.min,e.max-s,t.min)),Yt(0,1,n)}function hT(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const xc=.35;function pT(e=xc){return e===!1?e=0:e===!0&&(e=xc),{x:Xp(e,"left","right"),y:Xp(e,"top","bottom")}}function Xp(e,t,n){return{min:Qp(e,t),max:Qp(e,n)}}function Qp(e,t){return typeof e=="number"?e:e[t]||0}const mT=new WeakMap;class gT{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ne(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=u=>{n&&this.snapToCursor(Ro(u).point),this.stopAnimation()},i=(u,f)=>{const{drag:y,dragPropagation:w,onDragStart:x}=this.getProps();if(y&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ub(y),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bt(m=>{let g=this.getAxisMotionValue(m).get()||0;if(Kt.test(g)){const{projection:v}=this.visualElement;if(v&&v.layout){const E=v.layout.layoutBox[m];E&&(g=Xe(E)*(parseFloat(g)/100))}}this.originPoint[m]=g}),x&&oe.update(()=>x(u,f),!1,!0),cc(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},a=(u,f)=>{this.latestPointerEvent=u,this.latestPanInfo=f;const{dragPropagation:y,dragDirectionLock:w,onDirectionLock:x,onDrag:S}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:m}=f;if(w&&this.currentDirection===null){this.currentDirection=vT(m),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",f.point,m),this.updateAxis("y",f.point,m),this.visualElement.render(),S&&oe.update(()=>S(u,f),!1,!0)},l=(u,f)=>{this.latestPointerEvent=u,this.latestPanInfo=f,this.stop(u,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:u}=this.getProps();(u||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new V0(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:I0(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!r)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&oe.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!ni(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=uT(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,s=this.constraints;t&&Nr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=cT(r.layoutBox,t):this.constraints=!1,this.elastic=pT(n),s!==this.constraints&&!Nr(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Bt(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=hT(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Nr(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=vC(r,s.root,this.visualElement.getTransformPagePoint());let i=dT(s.layout.layoutBox,o);if(n){const a=n(mC(i));this.hasMutatedConstraints=!!a,a&&(i=i0(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Bt(d=>{if(!ni(d,n,this.currentDirection))return;let u=l&&l[d]||{};(i===!0||i===d)&&(u={min:0,max:0});const f=s?200:1e6,y=s?40:1e7,w={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...o,...u};return this.startAxisValueAnimation(d,w)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return cc(this.visualElement,t),r.start(zd(t,r,0,n,this.visualElement,!1))}stopAnimation(){Bt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Bt(n=>{const{drag:r}=this.getProps();if(!ni(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:i,max:a}=s.layout.layoutBox[n],l=o.get()||0;o.set(t[n]-fe(i,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Nr(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Bt(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();s[i]=fT({min:l,max:l},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Bt(i=>{if(!ni(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:c}=this.constraints[i];a.set(fe(l,c,s[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;mT.set(this.visualElement,this);const t=this.visualElement.current,n=Hs(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps(),f=c.target,y=f!==t&&Xb(f);d&&u&&!y&&this.start(c)});let r;const s=()=>{const{dragConstraints:c}=this.getProps();Nr(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=yT(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,i=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),oe.read(s);const a=mo(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(Bt(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=xc,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function Zp(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function yT(e,t,n){const r=sp(e,Zp(n)),s=sp(t,Zp(n));return()=>{r(),s()}}function ni(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function vT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class xT extends Yn{constructor(t){super(t),this.removeGroupControls=wt,this.removeListeners=wt,this.controls=new gT(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||wt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const $l=e=>(t,n)=>{e&&oe.update(()=>e(t,n),!1,!0)};class wT extends Yn{constructor(){super(...arguments),this.removePointerDownListener=wt}onPointerDown(t){this.session=new V0(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:I0(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:$l(t),onStart:$l(n),onMove:$l(r),onEnd:(o,i)=>{delete this.session,s&&oe.postRender(()=>s(o,i))}}}mount(){this.removePointerDownListener=Hs(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ul=!1;class ST extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),Ul&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ri.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,{projection:i}=r;return i&&(i.isPresent=o,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),Ul=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||oe.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Wd.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;Ul=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function z0(e){const[t,n]=N0(),r=p.useContext(Cd);return h.jsx(ST,{...e,layoutGroup:r,switchLayoutGroup:p.useContext(O0),isPresent:t,safeToRemove:n})}const ET={pan:{Feature:wT},drag:{Feature:xT,ProjectionNode:P0,MeasureLayout:z0}};function qp(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&oe.postRender(()=>o(t,Ro(t)))}class kT extends Yn{mount(){const{current:t}=this.node;t&&(this.unmount=Hb(t,(n,r)=>(qp(this.node,r,"Start"),s=>qp(this.node,s,"End"))))}unmount(){}}class bT extends Yn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Po(mo(this.node.current,"focus",()=>this.onFocus()),mo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Jp(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&oe.postRender(()=>o(t,Ro(t)))}class CT extends Yn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Zb(t,(s,o)=>(Jp(this.node,o,"Start"),(i,{success:a})=>Jp(this.node,i,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const wc=new WeakMap,Wl=new WeakMap,TT=e=>{const t=wc.get(e.target);t&&t(e)},PT=e=>{e.forEach(TT)};function NT({root:e,...t}){const n=e||document;Wl.has(n)||Wl.set(n,{});const r=Wl.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(PT,{root:e,...t})),r[s]}function jT(e,t,n){const r=NT(t);return wc.set(e,n),r.observe(e),()=>{wc.delete(e),r.unobserve(e)}}const RT={some:0,all:1};class MT extends Yn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:RT[s]},a=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),y=d?u:f;y&&y(c)};this.stopObserver=jT(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(AT(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function AT({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const DT={inView:{Feature:MT},tap:{Feature:CT},focus:{Feature:bT},hover:{Feature:kT}},LT={layout:{ProjectionNode:P0,MeasureLayout:z0}},OT={...sT,...DT,...ET,...LT},Vn=J2(OT,eT);function B0(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=B0(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function $0(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=B0(e))&&(r&&(r+=" "),r+=t);return r}const tf="-",_T=e=>{const t=VT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(tf);return a[0]===""&&a.length!==1&&a.shift(),U0(a,t)||IT(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},U0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?U0(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(tf);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},em=/^\[(.+)\]$/,IT=e=>{if(em.test(e)){const t=em.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},VT=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return zT(Object.entries(e.classGroups),n).forEach(([o,i])=>{Sc(i,r,o,t)}),r},Sc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:tm(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(FT(s)){Sc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{Sc(i,tm(t,o),n,r)})})},tm=(e,t)=>{let n=e;return t.split(tf).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FT=e=>e.isThemeGetter,zT=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[n,s]}):e,BT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},W0="!",$T=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let c=0,d=0,u;for(let S=0;S<a.length;S++){let m=a[S];if(c===0){if(m===s&&(r||a.slice(S,S+o)===t)){l.push(a.slice(d,S)),d=S+o;continue}if(m==="/"){u=S;continue}}m==="["?c++:m==="]"&&c--}const f=l.length===0?a:a.substring(d),y=f.startsWith(W0),w=y?f.substring(1):f,x=u&&u>d?u-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:x}};return n?a=>n({className:a,parseClassName:i}):i},UT=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},WT=e=>({cache:BT(e.cacheSize),parseClassName:$T(e),..._T(e)}),HT=/\s+/,GT=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(HT);let a="";for(let l=i.length-1;l>=0;l-=1){const c=i[l],{modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:y}=n(c);let w=!!y,x=r(w?f.substring(0,y):f);if(!x){if(!w){a=c+(a.length>0?" "+a:a);continue}if(x=r(f),!x){a=c+(a.length>0?" "+a:a);continue}w=!1}const S=UT(d).join(":"),m=u?S+W0:S,g=m+x;if(o.includes(g))continue;o.push(g);const v=s(x,w);for(let E=0;E<v.length;++E){const C=v[E];o.push(m+C)}a=c+(a.length>0?" "+a:a)}return a};function KT(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=H0(t))&&(r&&(r+=" "),r+=n);return r}const H0=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=H0(e[r]))&&(n&&(n+=" "),n+=t);return n};function YT(e,...t){let n,r,s,o=i;function i(l){const c=t.reduce((d,u)=>u(d),e());return n=WT(c),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=GT(l,n);return s(l,d),d}return function(){return o(KT.apply(null,arguments))}}const ce=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},G0=/^\[(?:([a-z-]+):)?(.+)\]$/i,XT=/^\d+\/\d+$/,QT=new Set(["px","full","screen"]),ZT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qT=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,JT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,eP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>Qr(e)||QT.has(e)||XT.test(e),mn=e=>ms(e,"length",uP),Qr=e=>!!e&&!Number.isNaN(Number(e)),Hl=e=>ms(e,"number",Qr),Ts=e=>!!e&&Number.isInteger(Number(e)),nP=e=>e.endsWith("%")&&Qr(e.slice(0,-1)),W=e=>G0.test(e),gn=e=>ZT.test(e),rP=new Set(["length","size","percentage"]),sP=e=>ms(e,rP,K0),oP=e=>ms(e,"position",K0),iP=new Set(["image","url"]),aP=e=>ms(e,iP,dP),lP=e=>ms(e,"",cP),Ps=()=>!0,ms=(e,t,n)=>{const r=G0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},uP=e=>qT.test(e)&&!JT.test(e),K0=()=>!1,cP=e=>eP.test(e),dP=e=>tP.test(e),fP=()=>{const e=ce("colors"),t=ce("spacing"),n=ce("blur"),r=ce("brightness"),s=ce("borderColor"),o=ce("borderRadius"),i=ce("borderSpacing"),a=ce("borderWidth"),l=ce("contrast"),c=ce("grayscale"),d=ce("hueRotate"),u=ce("invert"),f=ce("gap"),y=ce("gradientColorStops"),w=ce("gradientColorStopPositions"),x=ce("inset"),S=ce("margin"),m=ce("opacity"),g=ce("padding"),v=ce("saturate"),E=ce("scale"),C=ce("sepia"),T=ce("skew"),k=ce("space"),b=ce("translate"),A=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",W,t],L=()=>[W,t],Q=()=>["",Zt,mn],le=()=>["auto",Qr,W],ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],j=()=>["start","end","center","between","around","evenly","stretch"],O=()=>["","0",W],V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Qr,W];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[Zt,mn],blur:["none","",gn,W],brightness:$(),borderColor:[e],borderRadius:["none","","full",gn,W],borderSpacing:L(),borderWidth:Q(),contrast:$(),grayscale:O(),hueRotate:$(),invert:O(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[nP,mn],inset:D(),margin:D(),opacity:$(),padding:L(),saturate:$(),scale:$(),sepia:O(),skew:$(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",W]}],container:["container"],columns:[{columns:[gn]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ge(),W]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ts,W]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",W]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",Ts,W]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Ts,W]},W]}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Ts,W]},W]}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",W]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",W]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...j()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...j(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...j(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",W,t]}],"min-w":[{"min-w":[W,t,"min","max","fit"]}],"max-w":[{"max-w":[W,t,"none","full","min","max","fit","prose",{screen:[gn]},gn]}],h:[{h:[W,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[W,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[W,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[W,t,"auto","min","max","fit"]}],"font-size":[{text:["base",gn,mn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Hl]}],"font-family":[{font:[Ps]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",W]}],"line-clamp":[{"line-clamp":["none",Qr,Hl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Zt,W]}],"list-image":[{"list-image":["none",W]}],"list-style-type":[{list:["none","disc","decimal",W]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Zt,mn]}],"underline-offset":[{"underline-offset":["auto",Zt,W]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",W]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ge(),oP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",sP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aP]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:z()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...z()]}],"outline-offset":[{"outline-offset":[Zt,W]}],"outline-w":[{outline:[Zt,mn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Zt,mn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",gn,lP]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",gn,W]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[v]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",W]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",W]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",W]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Ts,W]}],"translate-x":[{"translate-x":[b]}],"translate-y":[{"translate-y":[b]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",W]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",W]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",W]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Zt,mn,Hl]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hP=YT(fP);function q(...e){return hP($0(e))}const nf=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));nf.displayName="Card";const rf=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("flex flex-col space-y-1.5 p-6",e),...t}));rf.displayName="CardHeader";const sf=p.forwardRef(({className:e,...t},n)=>h.jsx("h3",{ref:n,className:q("text-2xl font-semibold leading-none tracking-tight",e),...t}));sf.displayName="CardTitle";const Y0=p.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:q("text-sm text-muted-foreground",e),...t}));Y0.displayName="CardDescription";const of=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("p-6 pt-0",e),...t}));of.displayName="CardContent";const X0=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("flex items-center p-6 pt-0",e),...t}));X0.displayName="CardFooter";function nm(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ba(...e){return t=>{let n=!1;const r=e.map(s=>{const o=nm(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():nm(e[s],null)}}}}function kr(...e){return p.useCallback(Ba(...e),e)}var pP=Symbol.for("react.lazy"),ha=va[" use ".trim().toString()];function mP(e){return typeof e=="object"&&e!==null&&"then"in e}function Q0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===pP&&"_payload"in e&&mP(e._payload)}function Z0(e){const t=yP(e),n=p.forwardRef((r,s)=>{let{children:o,...i}=r;Q0(o)&&typeof ha=="function"&&(o=ha(o._payload));const a=p.Children.toArray(o),l=a.find(xP);if(l){const c=l.props.children,d=a.map(u=>u===l?p.Children.count(c)>1?p.Children.only(null):p.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...i,ref:s,children:p.isValidElement(c)?p.cloneElement(c,void 0,d):null})}return h.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var gP=Z0("Slot");function yP(e){const t=p.forwardRef((n,r)=>{let{children:s,...o}=n;if(Q0(s)&&typeof ha=="function"&&(s=ha(s._payload)),p.isValidElement(s)){const i=SP(s),a=wP(o,s.props);return s.type!==p.Fragment&&(a.ref=r?Ba(r,i):i),p.cloneElement(s,a)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vP=Symbol("radix.slottable");function xP(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vP}function wP(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const l=o(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function SP(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const rm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sm=$0,af=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return sm(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(c=>{const d=n==null?void 0:n[c],u=o==null?void 0:o[c];if(d===null)return null;const f=rm(d)||rm(u);return s[c][f]}),a=n&&Object.entries(n).reduce((c,d)=>{let[u,f]=d;return f===void 0||(c[u]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:u,className:f,...y}=d;return Object.entries(y).every(w=>{let[x,S]=w;return Array.isArray(S)?S.includes({...o,...a}[x]):{...o,...a}[x]===S})?[...c,u,f]:c},[]);return sm(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},EP=af("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ie=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?gP:"button";return h.jsx(i,{className:q(EP({variant:t,size:n,className:e})),ref:o,...s})});ie.displayName="Button";const go=p.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:q("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));go.displayName="Input";var kP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bP=kP.reduce((e,t)=>{const n=Z0(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:i,...a}=s,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),CP="Label",q0=p.forwardRef((e,t)=>h.jsx(bP.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));q0.displayName=CP;var J0=q0;const TP=af("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),jn=p.forwardRef(({className:e,...t},n)=>h.jsx(J0,{ref:n,className:q(TP(),e),...t}));jn.displayName=J0.displayName;const om=e=>{let t;const n=new Set,r=(c,d)=>{const u=typeof c=="function"?c(t):c;if(!Object.is(u,t)){const f=t;t=d??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(y=>y(t,f))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,s,a);return a},PP=e=>e?om(e):om,NP=e=>e;function jP(e,t=NP){const n=R.useSyncExternalStore(e.subscribe,R.useCallback(()=>t(e.getState()),[e,t]),R.useCallback(()=>t(e.getInitialState()),[e,t]));return R.useDebugValue(n),n}const im=e=>{const t=PP(e),n=r=>jP(t,r);return Object.assign(n,t),n},ex=e=>e?im(e):im,Zr={token:"cc_web_token",theme:"cc_web_theme",viewMode:e=>`cc_viewmode_${e}`,panelFileTree:"cc_panel_filetree",panelShortcuts:"cc_panel_shortcuts",fileZoom:"cc_file_zoom",skillhubAuthor:"ccweb_skillhub_author",projectOrder:"cc_project_order"};function RP(e,t,n){try{const r=localStorage.getItem(e);return r===null?t:n?JSON.parse(r):r}catch{return t}}function tx(e,t,n){try{localStorage.setItem(e,n?JSON.stringify(t):String(t))}catch{}}function MP(e){try{localStorage.removeItem(e)}catch{}}function AP(e,t,n){const r=(n==null?void 0:n.parse)??!1,[s,o]=p.useState(()=>{try{const a=localStorage.getItem(e);return a===null?t:r?JSON.parse(a):a}catch{return t}}),i=p.useCallback(a=>{o(l=>{const c=typeof a=="function"?a(l):a;try{localStorage.setItem(e,r?JSON.stringify(c):String(c))}catch{}return c})},[e,r]);return[s,i]}const xr=ex(e=>({token:localStorage.getItem(Zr.token),setToken:t=>{tx(Zr.token,t),e({token:t})},clearToken:()=>{MP(Zr.token),e({token:null})}})),DP=()=>xr.getState().token,LP=e=>xr.getState().setToken(e),OP=()=>xr.getState().clearToken();let Gl=null;async function _P(){return Gl||(Gl=(await bo(()=>Promise.resolve().then(()=>CN),void 0)).getProjects),Gl()}const am=ex((e,t)=>({projects:[],loading:!1,error:null,hasFetched:!1,fetchProjects:async()=>{if(!t().loading){e({loading:!0,error:null});try{const n=await _P();e({projects:n,hasFetched:!0})}catch(n){e({error:n instanceof Error?n.message:"Failed to load projects"})}finally{e({loading:!1})}}},addProject:n=>e(r=>({projects:[...r.projects,n]})),updateProject:n=>e(r=>({projects:r.projects.map(s=>s.id===n.id?n:s)})),removeProject:n=>e(r=>({projects:r.projects.filter(s=>s.id!==n)})),setProjects:n=>e({projects:n})})),$a="";function Mo(){return DP()}function IP(e){LP(e)}function nx(){OP()}async function F(e,t,n,r=!0,s){const o={"Content-Type":"application/json"};if(r){const a=Mo();a&&(o.Authorization=`Bearer ${a}`)}const i=await fetch(`${$a}${t}`,{method:e,headers:o,body:n!==void 0?JSON.stringify(n):void 0,signal:s});if(i.status===401)throw nx(),window.location.pathname!=="/login"&&(window.location.href="/login"),new Error("Unauthorized");if(!i.ok){let a=`HTTP ${i.status}`;try{const l=await i.json();l.error&&(a=l.error)}catch{}throw new Error(a)}return i.json()}async function rx(e,t){return(await F("POST","/api/auth/login",{username:e,password:t},!1)).token}function pa(){const e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}async function lf(){return(await F("GET","/api/auth/local-token",void 0,!1)).token}async function VP(){return(await F("GET","/api/projects/workspace")).workspace}async function FP(){return F("GET","/api/projects")}async function sx(){return F("GET","/api/projects/users")}async function ox(e,t){return F("PUT",`/api/projects/${e}/shares`,{shares:t})}async function ix(e){return F("POST","/api/projects",e)}async function ax(e){return F("POST","/api/projects/open",{folderPath:e})}async function lx(e){await F("DELETE",`/api/projects/${e}`)}async function zP(e){return F("PATCH",`/api/projects/${e}/stop`)}async function BP(e){return F("PATCH",`/api/projects/${e}/start`)}async function ux(e){return F("PATCH",`/api/projects/${e}/archive`)}async function cx(e){return F("PATCH",`/api/projects/${e}/unarchive`)}async function $P(e,t){return F("GET",`/api/projects/${e}/sessions`,void 0,!0,t)}async function UP(e,t,n){return F("GET",`/api/projects/${e}/sessions/${t}`,void 0,!0,n)}async function WP(e){return F("GET","/api/projects/activity",void 0,!0,e)}async function dx(){return F("GET","/api/shortcuts")}async function fx(e){return F("POST","/api/shortcuts",e)}async function hx(e,t){return F("PUT",`/api/shortcuts/${e}`,t)}async function px(e){await F("DELETE",`/api/shortcuts/${e}`)}async function HP(e){return F("GET",`/api/shortcuts/project/${e}`)}async function GP(e,t){return F("POST",`/api/shortcuts/project/${e}`,t)}async function KP(e,t,n){return F("PUT",`/api/shortcuts/project/${e}/${t}`,n)}async function YP(e,t){await F("DELETE",`/api/shortcuts/project/${e}/${t}`)}async function XP(){return F("GET","/api/skillhub/skills")}async function QP(e){await F("POST","/api/skillhub/submit",e)}async function ZP(e){return F("POST",`/api/skillhub/download/${e}`)}async function mx(){return F("GET","/api/projects/usage")}async function gx(){return F("GET","/api/projects/usage?refresh=true")}async function yx(e){const t=e?`?path=${encodeURIComponent(e)}`:"";return F("GET",`/api/filesystem${t}`)}function qP(e){return`${$a}/api/filesystem/raw?path=${encodeURIComponent(e)}`}async function JP(e,t){const n=new FormData;n.append("path",e);for(const i of t)n.append("files",i);const r={},s=Mo();s&&(r.Authorization=`Bearer ${s}`);const o=await fetch(`${$a}/api/filesystem/upload`,{method:"POST",headers:r,body:n});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Upload failed: ${o.status}`)}return o.json()}async function vx(e,t){return F("POST","/api/filesystem/mkdir",{path:e,name:t})}async function eN(e){return F("GET",`/api/filesystem/file?path=${encodeURIComponent(e)}`)}async function tN(e,t){return F("PUT","/api/filesystem/file",{path:e,content:t})}async function nN(){return F("GET","/api/update/check-running")}async function rN(){return F("POST","/api/update/prepare")}async function sN(){return F("GET","/api/backup/built-in-oauth")}async function oN(){return F("GET","/api/backup/providers")}async function iN(e){return F("POST","/api/backup/providers",e)}async function aN(e){await F("DELETE",`/api/backup/providers/${e}`)}async function lN(e){return F("GET",`/api/backup/auth/${e}/url`)}async function uN(e){return F("POST",`/api/backup/run/${e}`)}async function cN(){return F("GET","/api/backup/schedule")}async function dN(e){return F("PUT","/api/backup/schedule",e)}async function fN(){return F("GET","/api/backup/excludes")}async function hN(e){return F("PUT","/api/backup/excludes",{patterns:e})}async function pN(){return F("GET","/api/backup/history")}async function mN(){return F("GET","/api/notify/config")}async function gN(e){return F("PUT","/api/notify/config",e)}async function yN(e){return F("GET",`/api/projects/${e}/git/status`)}async function vN(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return F("GET",`/api/projects/${e}/git/diff${n}`)}async function xN(e,t){await F("POST",`/api/projects/${e}/git/add`,{files:t})}async function wN(e,t){await F("POST",`/api/projects/${e}/git/commit`,{message:t})}async function xx(e){return F("GET",`/api/projects/sessions/search?q=${encodeURIComponent(e)}`)}async function SN(e,t){return F("PATCH",`/api/projects/${e}/tags`,{tags:t})}async function EN(e){return F("GET",`/api/projects/${e}/todos`)}async function kN(e,t){return F("POST",`/api/sessions/${e}/share`,{expiryDays:t})}async function bN(e){const t=await fetch(`${$a}/api/share/${e}`);if(!t.ok){let n=`HTTP ${t.status}`;try{const r=await t.json();r.error&&(n=r.error)}catch{}throw new Error(n)}return t.json()}const CN=Object.freeze(Object.defineProperty({__proto__:null,addBackupProvider:iN,archiveProject:ux,browseFilesystem:yx,checkRunningProjects:nN,clearToken:nx,createFolder:vx,createGlobalShortcut:fx,createProject:ix,createProjectShortcut:GP,deleteBackupProvider:aN,deleteGlobalShortcut:px,deleteProject:lx,deleteProjectShortcut:YP,downloadSkillFromHub:ZP,getAllUsers:sx,getBackupAuthUrl:lN,getBackupExcludes:fN,getBackupHistory:pN,getBackupProviders:oN,getBackupSchedule:cN,getBuiltInOAuthTypes:sN,getGitDiff:vN,getGitStatus:yN,getGlobalShortcuts:dx,getLocalToken:lf,getNotifyConfig:mN,getProjectShortcuts:HP,getProjectTodos:EN,getProjects:FP,getProjectsActivity:WP,getRawFileUrl:qP,getSession:UP,getSessions:$P,getSharedSession:bN,getSkillHubSkills:XP,getToken:Mo,getUsage:mx,getWorkspace:VP,gitAdd:xN,gitCommit:wN,isLocalAccess:pa,login:rx,openProject:ax,prepareForUpdate:rN,readFile:eN,refreshUsage:gx,searchSessions:xx,setToken:IP,shareSession:kN,startProject:BP,stopProject:zP,submitSkillToHub:QP,triggerBackup:uN,unarchiveProject:cx,updateBackupExcludes:hN,updateBackupSchedule:dN,updateGlobalShortcut:hx,updateNotifyConfig:gN,updateProjectShares:ox,updateProjectShortcut:KP,updateProjectTags:SN,uploadFiles:JP,writeFile:tN},Symbol.toStringTag,{value:"Module"}));function TN(){const e=Oa(),t=xr(u=>u.setToken),[n,r]=p.useState(""),[s,o]=p.useState(""),[i,a]=p.useState(null),[l,c]=p.useState(!1);p.useEffect(()=>{if(!pa())return;let u=!1;return(async()=>{try{const f=await lf();u||(t(f),e("/",{replace:!0}))}catch{}})(),()=>{u=!0}},[e,t]);const d=async u=>{u.preventDefault(),a(null),c(!0);try{const f=await rx(n,s);t(f),e("/")}catch(f){a(f instanceof Error?f.message:"Login failed")}finally{c(!1)}};return h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:h.jsx(Vn.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},className:"w-full max-w-sm",children:h.jsxs(nf,{children:[h.jsxs(rf,{className:"text-center",children:[h.jsx(sf,{className:"text-2xl",children:"CC Web"}),h.jsx(Y0,{children:pa()?"Connecting locally...":"Sign in to manage your Claude projects"})]}),h.jsxs("form",{onSubmit:u=>void d(u),children:[h.jsxs(of,{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"username",children:"Username"}),h.jsx(go,{id:"username",type:"text",autoComplete:"username",value:n,onChange:u=>r(u.target.value),required:!0,autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"password",children:"Password"}),h.jsx(go,{id:"password",type:"password",autoComplete:"current-password",value:s,onChange:u=>o(u.target.value),required:!0})]}),h.jsx(qd,{children:i&&h.jsx(Vn.p,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:{duration:.2},className:"text-sm text-destructive",children:i})})]}),h.jsx(X0,{children:h.jsx(Vn.div,{className:"w-full",whileTap:{scale:.98},children:h.jsx(ie,{type:"submit",className:"w-full",disabled:l,children:l?"Signing in...":"Sign In"})})})]})]})})})}/**
|
|
76
|
+
`),()=>{var k;(k=a.current)==null||k.removeAttribute("data-motion-pop-id"),T.contains(C)&&T.removeChild(C)}},[t]),h.jsx(C2,{isPresent:t,childRef:a,sizeRef:l,pop:o,children:o===!1?e:p.cloneElement(e,{ref:u})})}const P2=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:i,anchorX:a,anchorY:l,root:c})=>{const d=Td(N2),u=p.useId();let f=!0,y=p.useMemo(()=>(f=!1,{id:u,initial:t,isPresent:n,custom:s,onExitComplete:w=>{d.set(w,!0);for(const x of d.values())if(!x)return;r&&r()},register:w=>(d.set(w,!1),()=>d.delete(w))}),[n,d,r]);return o&&f&&(y={...y}),p.useMemo(()=>{d.forEach((w,x)=>d.set(x,!1))},[n]),p.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),e=h.jsx(T2,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),h.jsx(_a.Provider,{value:y,children:e})};function N2(){return new Map}function N0(e=!0){const t=p.useContext(_a);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=p.useId();p.useEffect(()=>{if(e)return s(o)},[e]);const i=p.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,i]:[!0]}const ei=e=>e.key||"";function zp(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const qd=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[d,u]=N0(i),f=p.useMemo(()=>zp(e),[e]),y=i&&!d?[]:f.map(ei),w=p.useRef(!0),x=p.useRef(f),S=Td(()=>new Map),m=p.useRef(new Set),[g,v]=p.useState(f),[E,C]=p.useState(f);tv(()=>{w.current=!1,x.current=f;for(let b=0;b<E.length;b++){const A=ei(E[b]);y.includes(A)?(S.delete(A),m.current.delete(A)):S.get(A)!==!0&&S.set(A,!1)}},[E,y.length,y.join("-")]);const T=[];if(f!==g){let b=[...f];for(let A=0;A<E.length;A++){const P=E[A],D=ei(P);y.includes(D)||(b.splice(A,0,P),T.push(P))}return o==="wait"&&T.length&&(b=T),C(zp(b)),v(f),null}const{forceRender:k}=p.useContext(Cd);return h.jsx(h.Fragment,{children:E.map(b=>{const A=ei(b),P=i&&!d?!1:f===E||y.includes(A),D=()=>{if(m.current.has(A))return;if(S.has(A))m.current.add(A),S.set(A,!0);else return;let L=!0;S.forEach(Q=>{Q||(L=!1)}),L&&(k==null||k(),C(x.current),i&&(u==null||u()),r&&r())};return h.jsx(P2,{isPresent:P,initial:!w.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:o,root:c,onExitComplete:P?void 0:D,anchorX:a,anchorY:l,children:b},A)})})},j0=p.createContext({strict:!1}),Bp={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let $p=!1;function j2(){if($p)return;const e={};for(const t in Bp)e[t]={isEnabled:n=>Bp[t].some(r=>!!n[r])};s0(e),$p=!0}function R0(){return j2(),hC()}function R2(e){const t=R0();for(const n in e)t[n]={...t[n],...e[n]};s0(t)}const M2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function fa(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||M2.has(e)}let M0=e=>!fa(e);function A2(e){typeof e=="function"&&(M0=t=>t.startsWith("on")?!fa(t):e(t))}try{A2(require("@emotion/is-prop-valid").default)}catch{}function D2(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||Ie(e[s])||(M0(s)||n===!0&&fa(s)||!t&&!fa(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const za=p.createContext({});function L2(e,t){if(Fa(e)){const{initial:n,animate:r}=e;return{initial:n===!1||po(n)?n:void 0,animate:po(r)?r:void 0}}return e.inherit!==!1?t:{}}function O2(e){const{initial:t,animate:n}=L2(e,p.useContext(za));return p.useMemo(()=>({initial:t,animate:n}),[Up(t),Up(n)])}function Up(e){return Array.isArray(e)?e.join(" "):e}const Jd=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function A0(e,t,n){for(const r in t)!Ie(t[r])&&!d0(r,n)&&(e[r]=t[r])}function _2({transformTemplate:e},t){return p.useMemo(()=>{const n=Jd();return Xd(n,t,e),Object.assign({},n.vars,n.style)},[t])}function I2(e,t){const n=e.style||{},r={};return A0(r,n,e),Object.assign(r,_2(e,t)),r}function V2(e,t){const n={},r=I2(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const D0=()=>({...Jd(),attrs:{}});function F2(e,t,n,r){const s=p.useMemo(()=>{const o=D0();return f0(o,t,p0(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};A0(o,e.style,e),s.style={...o,...s.style}}return s}const z2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ef(e){return typeof e!="string"||e.includes("-")?!1:!!(z2.indexOf(e)>-1||/[A-Z]/u.test(e))}function B2(e,t,n,{latestValues:r},s,o=!1,i){const l=(i??ef(e)?F2:V2)(t,r,s,e),c=D2(t,typeof e=="string",o),d=e!==p.Fragment?{...c,...l,ref:n}:{},{children:u}=t,f=p.useMemo(()=>Ie(u)?u.get():u,[u]);return p.createElement(e,{...d,children:f})}function $2({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:U2(n,r,s,e),renderState:t()}}function U2(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=ji(o[f]);let{initial:i,animate:a}=e;const l=Fa(e),c=n0(e);t&&c&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||i===!1;const u=d?a:i;if(u&&typeof u!="boolean"&&!Va(u)){const f=Array.isArray(u)?u:[u];for(let y=0;y<f.length;y++){const w=Bd(e,f[y]);if(w){const{transitionEnd:x,transition:S,...m}=w;for(const g in m){let v=m[g];if(Array.isArray(v)){const E=d?v.length-1:0;v=v[E]}v!==null&&(s[g]=v)}for(const g in x)s[g]=x[g]}}}return s}const L0=e=>(t,n)=>{const r=p.useContext(za),s=p.useContext(_a),o=()=>$2(e,t,r,s);return n?o():Td(o)},W2=L0({scrapeMotionValuesFromProps:Qd,createRenderState:Jd}),H2=L0({scrapeMotionValuesFromProps:m0,createRenderState:D0}),G2=Symbol.for("motionComponentSymbol");function K2(e,t,n){const r=p.useRef(n);p.useInsertionEffect(()=>{r.current=n});const s=p.useRef(null);return p.useCallback(o=>{var a;o&&((a=e.onMount)==null||a.call(e,o));const i=r.current;if(typeof i=="function")if(o){const l=i(o);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):i(o);else i&&(i.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const O0=p.createContext({});function Nr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Y2(e,t,n,r,s,o){var v,E;const{visualElement:i}=p.useContext(za),a=p.useContext(j0),l=p.useContext(_a),c=p.useContext(Zd),d=c.reducedMotion,u=c.skipAnimations,f=p.useRef(null),y=p.useRef(!1);r=r||a.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d,skipAnimations:u,isSVG:o}),y.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const w=f.current,x=p.useContext(O0);w&&!w.projection&&s&&(w.type==="html"||w.type==="svg")&&X2(f.current,n,s,x);const S=p.useRef(!1);p.useInsertionEffect(()=>{w&&S.current&&w.update(n,l)});const m=n[Uv],g=p.useRef(!!m&&typeof window<"u"&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,m))&&((E=window.MotionHasOptimisedAnimation)==null?void 0:E.call(window,m)));return tv(()=>{y.current=!0,w&&(S.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),g.current&&w.animationState&&w.animationState.animateChanges())}),p.useEffect(()=>{w&&(!g.current&&w.animationState&&w.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var C;(C=window.MotionHandoffMarkAsComplete)==null||C.call(window,m)}),g.current=!1),w.enteringChildren=void 0)}),w}function X2(e,t,n,r){const{layoutId:s,layout:o,drag:i,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:_0(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||a&&Nr(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}function _0(e){if(e)return e.options.allowProjection!==!1?e.projection:_0(e.parent)}function zl(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&R2(r);const o=n?n==="svg":ef(e),i=o?H2:W2;function a(c,d){let u;const f={...p.useContext(Zd),...c,layoutId:Q2(c)},{isStatic:y}=f,w=O2(c),x=i(c,y);if(!y&&typeof window<"u"){Z2();const S=q2(f);u=S.MeasureLayout,w.visualElement=Y2(e,x,f,s,S.ProjectionNode,o)}return h.jsxs(za.Provider,{value:w,children:[u&&w.visualElement?h.jsx(u,{visualElement:w.visualElement,...f}):null,B2(e,c,K2(x,w.visualElement,d),x,y,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=p.forwardRef(a);return l[G2]=e,l}function Q2({layoutId:e}){const t=p.useContext(Cd).id;return t&&e!==void 0?t+"-"+e:e}function Z2(e,t){p.useContext(j0).strict}function q2(e){const t=R0(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function J2(e,t){if(typeof Proxy>"u")return zl;const n=new Map,r=(o,i)=>zl(o,i,e,t),s=(o,i)=>r(o,i);return new Proxy(s,{get:(o,i)=>i==="create"?r:(n.has(i)||n.set(i,zl(i,void 0,e,t)),n.get(i))})}const eT=(e,t)=>t.isSVG??ef(e)?new RC(t):new bC(t,{allowProjection:e!==p.Fragment});class tT extends Yn{constructor(t){super(t),t.animationState||(t.animationState=OC(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Va(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let nT=0;class rT extends Yn{constructor(){super(...arguments),this.id=nT++,this.isExitComplete=!1}update(){var o;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:i,custom:a}=this.node.getProps();if(typeof i=="string"){const l=hr(this.node,i,a);if(l){const{transition:c,transitionEnd:d,...u}=l;for(const f in u)(o=this.node.getValue(f))==null||o.jump(u[f])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const sT={animation:{Feature:tT},exit:{Feature:rT}};function Ro(e){return{point:{x:e.pageX,y:e.pageY}}}const oT=e=>t=>Hd(t)&&e(t,Ro(t));function Hs(e,t,n,r){return mo(e,t,oT(n),r)}const I0=({current:e})=>e?e.ownerDocument.defaultView:null,Wp=(e,t)=>Math.abs(e-t);function iT(e,t){const n=Wp(e.x,t.x),r=Wp(e.y,t.y);return Math.sqrt(n**2+r**2)}const Hp=new Set(["auto","scroll"]);class V0{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=y=>{this.handleScroll(y.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=ti(this.lastRawMoveEventInfo,this.transformPagePoint));const y=Bl(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,x=iT(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!x)return;const{point:S}=y,{timestamp:m}=_e;this.history.push({...S,timestamp:m});const{onStart:g,onMove:v}=this.handlers;w||(g&&g(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,y)},this.handlePointerMove=(y,w)=>{this.lastMoveEvent=y,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=ti(w,this.transformPagePoint),oe.update(this.updatePoint,!0)},this.handlePointerUp=(y,w)=>{this.end();const{onEnd:x,onSessionEnd:S,resumeAnimation:m}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Bl(y.type==="pointercancel"?this.lastMoveEventInfo:ti(w,this.transformPagePoint),this.history);this.startEvent&&x&&x(y,g),S&&S(y,g)},!Hd(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=s||window;const l=Ro(t),c=ti(l,this.transformPagePoint),{point:d}=c,{timestamp:u}=_e;this.history=[{...d,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,Bl(c,this.history)),this.removeListeners=Po(Hs(this.contextWindow,"pointermove",this.handlePointerMove),Hs(this.contextWindow,"pointerup",this.handlePointerUp),Hs(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Hp.has(r.overflowX)||Hp.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:s.x-n.x,y:s.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,s),oe.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Un(this.updatePoint)}}function ti(e,t){return t?{point:t(e.point)}:e}function Gp(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Bl({point:e},t){return{point:e,delta:Gp(e,F0(t)),offset:Gp(e,aT(t)),velocity:lT(t,.1)}}function aT(e){return e[0]}function F0(e){return e[e.length-1]}function lT(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=F0(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>ct(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>ct(t)*2&&(r=e[1]);const o=vt(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function uT(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?fe(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?fe(n,e,r.max):Math.min(e,n)),e}function Kp(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function cT(e,{top:t,left:n,bottom:r,right:s}){return{x:Kp(e.x,n,s),y:Kp(e.y,t,r)}}function Yp(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function dT(e,t){return{x:Yp(e.x,t.x),y:Yp(e.y,t.y)}}function fT(e,t){let n=.5;const r=Xe(e),s=Xe(t);return s>r?n=fo(t.min,t.max-r,e.min):r>s&&(n=fo(e.min,e.max-s,t.min)),Yt(0,1,n)}function hT(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const xc=.35;function pT(e=xc){return e===!1?e=0:e===!0&&(e=xc),{x:Xp(e,"left","right"),y:Xp(e,"top","bottom")}}function Xp(e,t,n){return{min:Qp(e,t),max:Qp(e,n)}}function Qp(e,t){return typeof e=="number"?e:e[t]||0}const mT=new WeakMap;class gT{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ne(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=u=>{n&&this.snapToCursor(Ro(u).point),this.stopAnimation()},i=(u,f)=>{const{drag:y,dragPropagation:w,onDragStart:x}=this.getProps();if(y&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ub(y),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bt(m=>{let g=this.getAxisMotionValue(m).get()||0;if(Kt.test(g)){const{projection:v}=this.visualElement;if(v&&v.layout){const E=v.layout.layoutBox[m];E&&(g=Xe(E)*(parseFloat(g)/100))}}this.originPoint[m]=g}),x&&oe.update(()=>x(u,f),!1,!0),cc(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},a=(u,f)=>{this.latestPointerEvent=u,this.latestPanInfo=f;const{dragPropagation:y,dragDirectionLock:w,onDirectionLock:x,onDrag:S}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:m}=f;if(w&&this.currentDirection===null){this.currentDirection=vT(m),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",f.point,m),this.updateAxis("y",f.point,m),this.visualElement.render(),S&&oe.update(()=>S(u,f),!1,!0)},l=(u,f)=>{this.latestPointerEvent=u,this.latestPanInfo=f,this.stop(u,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:u}=this.getProps();(u||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new V0(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:I0(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!r)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&oe.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!ni(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=uT(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,s=this.constraints;t&&Nr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=cT(r.layoutBox,t):this.constraints=!1,this.elastic=pT(n),s!==this.constraints&&!Nr(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Bt(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=hT(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Nr(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=vC(r,s.root,this.visualElement.getTransformPagePoint());let i=dT(s.layout.layoutBox,o);if(n){const a=n(mC(i));this.hasMutatedConstraints=!!a,a&&(i=i0(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Bt(d=>{if(!ni(d,n,this.currentDirection))return;let u=l&&l[d]||{};(i===!0||i===d)&&(u={min:0,max:0});const f=s?200:1e6,y=s?40:1e7,w={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...o,...u};return this.startAxisValueAnimation(d,w)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return cc(this.visualElement,t),r.start(zd(t,r,0,n,this.visualElement,!1))}stopAnimation(){Bt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Bt(n=>{const{drag:r}=this.getProps();if(!ni(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:i,max:a}=s.layout.layoutBox[n],l=o.get()||0;o.set(t[n]-fe(i,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Nr(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Bt(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();s[i]=fT({min:l,max:l},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Bt(i=>{if(!ni(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:c}=this.constraints[i];a.set(fe(l,c,s[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;mT.set(this.visualElement,this);const t=this.visualElement.current,n=Hs(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps(),f=c.target,y=f!==t&&Xb(f);d&&u&&!y&&this.start(c)});let r;const s=()=>{const{dragConstraints:c}=this.getProps();Nr(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=yT(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,i=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),oe.read(s);const a=mo(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(Bt(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=xc,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function Zp(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function yT(e,t,n){const r=sp(e,Zp(n)),s=sp(t,Zp(n));return()=>{r(),s()}}function ni(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function vT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class xT extends Yn{constructor(t){super(t),this.removeGroupControls=wt,this.removeListeners=wt,this.controls=new gT(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||wt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const $l=e=>(t,n)=>{e&&oe.update(()=>e(t,n),!1,!0)};class wT extends Yn{constructor(){super(...arguments),this.removePointerDownListener=wt}onPointerDown(t){this.session=new V0(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:I0(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:$l(t),onStart:$l(n),onMove:$l(r),onEnd:(o,i)=>{delete this.session,s&&oe.postRender(()=>s(o,i))}}}mount(){this.removePointerDownListener=Hs(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ul=!1;class ST extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),Ul&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ri.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,{projection:i}=r;return i&&(i.isPresent=o,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),Ul=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||oe.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Wd.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;Ul=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function z0(e){const[t,n]=N0(),r=p.useContext(Cd);return h.jsx(ST,{...e,layoutGroup:r,switchLayoutGroup:p.useContext(O0),isPresent:t,safeToRemove:n})}const ET={pan:{Feature:wT},drag:{Feature:xT,ProjectionNode:P0,MeasureLayout:z0}};function qp(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&oe.postRender(()=>o(t,Ro(t)))}class kT extends Yn{mount(){const{current:t}=this.node;t&&(this.unmount=Hb(t,(n,r)=>(qp(this.node,r,"Start"),s=>qp(this.node,s,"End"))))}unmount(){}}class bT extends Yn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Po(mo(this.node.current,"focus",()=>this.onFocus()),mo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Jp(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&oe.postRender(()=>o(t,Ro(t)))}class CT extends Yn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Zb(t,(s,o)=>(Jp(this.node,o,"Start"),(i,{success:a})=>Jp(this.node,i,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const wc=new WeakMap,Wl=new WeakMap,TT=e=>{const t=wc.get(e.target);t&&t(e)},PT=e=>{e.forEach(TT)};function NT({root:e,...t}){const n=e||document;Wl.has(n)||Wl.set(n,{});const r=Wl.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(PT,{root:e,...t})),r[s]}function jT(e,t,n){const r=NT(t);return wc.set(e,n),r.observe(e),()=>{wc.delete(e),r.unobserve(e)}}const RT={some:0,all:1};class MT extends Yn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:RT[s]},a=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),y=d?u:f;y&&y(c)};this.stopObserver=jT(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(AT(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function AT({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const DT={inView:{Feature:MT},tap:{Feature:CT},focus:{Feature:bT},hover:{Feature:kT}},LT={layout:{ProjectionNode:P0,MeasureLayout:z0}},OT={...sT,...DT,...ET,...LT},Vn=J2(OT,eT);function B0(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=B0(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function $0(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=B0(e))&&(r&&(r+=" "),r+=t);return r}const tf="-",_T=e=>{const t=VT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(tf);return a[0]===""&&a.length!==1&&a.shift(),U0(a,t)||IT(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},U0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?U0(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(tf);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},em=/^\[(.+)\]$/,IT=e=>{if(em.test(e)){const t=em.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},VT=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return zT(Object.entries(e.classGroups),n).forEach(([o,i])=>{Sc(i,r,o,t)}),r},Sc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:tm(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(FT(s)){Sc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{Sc(i,tm(t,o),n,r)})})},tm=(e,t)=>{let n=e;return t.split(tf).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FT=e=>e.isThemeGetter,zT=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[n,s]}):e,BT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},W0="!",$T=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let c=0,d=0,u;for(let S=0;S<a.length;S++){let m=a[S];if(c===0){if(m===s&&(r||a.slice(S,S+o)===t)){l.push(a.slice(d,S)),d=S+o;continue}if(m==="/"){u=S;continue}}m==="["?c++:m==="]"&&c--}const f=l.length===0?a:a.substring(d),y=f.startsWith(W0),w=y?f.substring(1):f,x=u&&u>d?u-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:x}};return n?a=>n({className:a,parseClassName:i}):i},UT=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},WT=e=>({cache:BT(e.cacheSize),parseClassName:$T(e),..._T(e)}),HT=/\s+/,GT=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(HT);let a="";for(let l=i.length-1;l>=0;l-=1){const c=i[l],{modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:y}=n(c);let w=!!y,x=r(w?f.substring(0,y):f);if(!x){if(!w){a=c+(a.length>0?" "+a:a);continue}if(x=r(f),!x){a=c+(a.length>0?" "+a:a);continue}w=!1}const S=UT(d).join(":"),m=u?S+W0:S,g=m+x;if(o.includes(g))continue;o.push(g);const v=s(x,w);for(let E=0;E<v.length;++E){const C=v[E];o.push(m+C)}a=c+(a.length>0?" "+a:a)}return a};function KT(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=H0(t))&&(r&&(r+=" "),r+=n);return r}const H0=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=H0(e[r]))&&(n&&(n+=" "),n+=t);return n};function YT(e,...t){let n,r,s,o=i;function i(l){const c=t.reduce((d,u)=>u(d),e());return n=WT(c),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=GT(l,n);return s(l,d),d}return function(){return o(KT.apply(null,arguments))}}const ce=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},G0=/^\[(?:([a-z-]+):)?(.+)\]$/i,XT=/^\d+\/\d+$/,QT=new Set(["px","full","screen"]),ZT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qT=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,JT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,eP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>Qr(e)||QT.has(e)||XT.test(e),mn=e=>ms(e,"length",uP),Qr=e=>!!e&&!Number.isNaN(Number(e)),Hl=e=>ms(e,"number",Qr),Ts=e=>!!e&&Number.isInteger(Number(e)),nP=e=>e.endsWith("%")&&Qr(e.slice(0,-1)),W=e=>G0.test(e),gn=e=>ZT.test(e),rP=new Set(["length","size","percentage"]),sP=e=>ms(e,rP,K0),oP=e=>ms(e,"position",K0),iP=new Set(["image","url"]),aP=e=>ms(e,iP,dP),lP=e=>ms(e,"",cP),Ps=()=>!0,ms=(e,t,n)=>{const r=G0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},uP=e=>qT.test(e)&&!JT.test(e),K0=()=>!1,cP=e=>eP.test(e),dP=e=>tP.test(e),fP=()=>{const e=ce("colors"),t=ce("spacing"),n=ce("blur"),r=ce("brightness"),s=ce("borderColor"),o=ce("borderRadius"),i=ce("borderSpacing"),a=ce("borderWidth"),l=ce("contrast"),c=ce("grayscale"),d=ce("hueRotate"),u=ce("invert"),f=ce("gap"),y=ce("gradientColorStops"),w=ce("gradientColorStopPositions"),x=ce("inset"),S=ce("margin"),m=ce("opacity"),g=ce("padding"),v=ce("saturate"),E=ce("scale"),C=ce("sepia"),T=ce("skew"),k=ce("space"),b=ce("translate"),A=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",W,t],L=()=>[W,t],Q=()=>["",Zt,mn],le=()=>["auto",Qr,W],ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],j=()=>["start","end","center","between","around","evenly","stretch"],O=()=>["","0",W],V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Qr,W];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[Zt,mn],blur:["none","",gn,W],brightness:$(),borderColor:[e],borderRadius:["none","","full",gn,W],borderSpacing:L(),borderWidth:Q(),contrast:$(),grayscale:O(),hueRotate:$(),invert:O(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[nP,mn],inset:D(),margin:D(),opacity:$(),padding:L(),saturate:$(),scale:$(),sepia:O(),skew:$(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",W]}],container:["container"],columns:[{columns:[gn]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ge(),W]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ts,W]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",W]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",Ts,W]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Ts,W]},W]}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Ts,W]},W]}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",W]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",W]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...j()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...j(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...j(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",W,t]}],"min-w":[{"min-w":[W,t,"min","max","fit"]}],"max-w":[{"max-w":[W,t,"none","full","min","max","fit","prose",{screen:[gn]},gn]}],h:[{h:[W,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[W,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[W,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[W,t,"auto","min","max","fit"]}],"font-size":[{text:["base",gn,mn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Hl]}],"font-family":[{font:[Ps]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",W]}],"line-clamp":[{"line-clamp":["none",Qr,Hl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Zt,W]}],"list-image":[{"list-image":["none",W]}],"list-style-type":[{list:["none","disc","decimal",W]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Zt,mn]}],"underline-offset":[{"underline-offset":["auto",Zt,W]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",W]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ge(),oP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",sP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aP]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:z()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...z()]}],"outline-offset":[{"outline-offset":[Zt,W]}],"outline-w":[{outline:[Zt,mn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Zt,mn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",gn,lP]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",gn,W]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[v]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",W]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",W]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",W]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Ts,W]}],"translate-x":[{"translate-x":[b]}],"translate-y":[{"translate-y":[b]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",W]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",W]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",W]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Zt,mn,Hl]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hP=YT(fP);function q(...e){return hP($0(e))}const nf=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));nf.displayName="Card";const rf=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("flex flex-col space-y-1.5 p-6",e),...t}));rf.displayName="CardHeader";const sf=p.forwardRef(({className:e,...t},n)=>h.jsx("h3",{ref:n,className:q("text-2xl font-semibold leading-none tracking-tight",e),...t}));sf.displayName="CardTitle";const Y0=p.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:q("text-sm text-muted-foreground",e),...t}));Y0.displayName="CardDescription";const of=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("p-6 pt-0",e),...t}));of.displayName="CardContent";const X0=p.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:q("flex items-center p-6 pt-0",e),...t}));X0.displayName="CardFooter";function nm(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ba(...e){return t=>{let n=!1;const r=e.map(s=>{const o=nm(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():nm(e[s],null)}}}}function kr(...e){return p.useCallback(Ba(...e),e)}var pP=Symbol.for("react.lazy"),ha=va[" use ".trim().toString()];function mP(e){return typeof e=="object"&&e!==null&&"then"in e}function Q0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===pP&&"_payload"in e&&mP(e._payload)}function Z0(e){const t=yP(e),n=p.forwardRef((r,s)=>{let{children:o,...i}=r;Q0(o)&&typeof ha=="function"&&(o=ha(o._payload));const a=p.Children.toArray(o),l=a.find(xP);if(l){const c=l.props.children,d=a.map(u=>u===l?p.Children.count(c)>1?p.Children.only(null):p.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...i,ref:s,children:p.isValidElement(c)?p.cloneElement(c,void 0,d):null})}return h.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var gP=Z0("Slot");function yP(e){const t=p.forwardRef((n,r)=>{let{children:s,...o}=n;if(Q0(s)&&typeof ha=="function"&&(s=ha(s._payload)),p.isValidElement(s)){const i=SP(s),a=wP(o,s.props);return s.type!==p.Fragment&&(a.ref=r?Ba(r,i):i),p.cloneElement(s,a)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vP=Symbol("radix.slottable");function xP(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vP}function wP(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const l=o(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function SP(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const rm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sm=$0,af=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return sm(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(c=>{const d=n==null?void 0:n[c],u=o==null?void 0:o[c];if(d===null)return null;const f=rm(d)||rm(u);return s[c][f]}),a=n&&Object.entries(n).reduce((c,d)=>{let[u,f]=d;return f===void 0||(c[u]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:u,className:f,...y}=d;return Object.entries(y).every(w=>{let[x,S]=w;return Array.isArray(S)?S.includes({...o,...a}[x]):{...o,...a}[x]===S})?[...c,u,f]:c},[]);return sm(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},EP=af("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ie=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?gP:"button";return h.jsx(i,{className:q(EP({variant:t,size:n,className:e})),ref:o,...s})});ie.displayName="Button";const go=p.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:q("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));go.displayName="Input";var kP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bP=kP.reduce((e,t)=>{const n=Z0(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:i,...a}=s,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),CP="Label",q0=p.forwardRef((e,t)=>h.jsx(bP.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));q0.displayName=CP;var J0=q0;const TP=af("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),jn=p.forwardRef(({className:e,...t},n)=>h.jsx(J0,{ref:n,className:q(TP(),e),...t}));jn.displayName=J0.displayName;const om=e=>{let t;const n=new Set,r=(c,d)=>{const u=typeof c=="function"?c(t):c;if(!Object.is(u,t)){const f=t;t=d??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(y=>y(t,f))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,s,a);return a},PP=e=>e?om(e):om,NP=e=>e;function jP(e,t=NP){const n=R.useSyncExternalStore(e.subscribe,R.useCallback(()=>t(e.getState()),[e,t]),R.useCallback(()=>t(e.getInitialState()),[e,t]));return R.useDebugValue(n),n}const im=e=>{const t=PP(e),n=r=>jP(t,r);return Object.assign(n,t),n},ex=e=>e?im(e):im,Zr={token:"cc_web_token",theme:"cc_web_theme",viewMode:e=>`cc_viewmode_${e}`,panelFileTree:"cc_panel_filetree",panelShortcuts:"cc_panel_shortcuts",fileZoom:"cc_file_zoom",skillhubAuthor:"ccweb_skillhub_author",projectOrder:"cc_project_order",pomodoroConfig:"cc_pomodoro_config"};function RP(e,t,n){try{const r=localStorage.getItem(e);return r===null?t:n?JSON.parse(r):r}catch{return t}}function tx(e,t,n){try{localStorage.setItem(e,n?JSON.stringify(t):String(t))}catch{}}function MP(e){try{localStorage.removeItem(e)}catch{}}function AP(e,t,n){const r=(n==null?void 0:n.parse)??!1,[s,o]=p.useState(()=>{try{const a=localStorage.getItem(e);return a===null?t:r?JSON.parse(a):a}catch{return t}}),i=p.useCallback(a=>{o(l=>{const c=typeof a=="function"?a(l):a;try{localStorage.setItem(e,r?JSON.stringify(c):String(c))}catch{}return c})},[e,r]);return[s,i]}const xr=ex(e=>({token:localStorage.getItem(Zr.token),setToken:t=>{tx(Zr.token,t),e({token:t})},clearToken:()=>{MP(Zr.token),e({token:null})}})),DP=()=>xr.getState().token,LP=e=>xr.getState().setToken(e),OP=()=>xr.getState().clearToken();let Gl=null;async function _P(){return Gl||(Gl=(await bo(()=>Promise.resolve().then(()=>CN),void 0)).getProjects),Gl()}const am=ex((e,t)=>({projects:[],loading:!1,error:null,hasFetched:!1,fetchProjects:async()=>{if(!t().loading){e({loading:!0,error:null});try{const n=await _P();e({projects:n,hasFetched:!0})}catch(n){e({error:n instanceof Error?n.message:"Failed to load projects"})}finally{e({loading:!1})}}},addProject:n=>e(r=>({projects:[...r.projects,n]})),updateProject:n=>e(r=>({projects:r.projects.map(s=>s.id===n.id?n:s)})),removeProject:n=>e(r=>({projects:r.projects.filter(s=>s.id!==n)})),setProjects:n=>e({projects:n})})),$a="";function Mo(){return DP()}function IP(e){LP(e)}function nx(){OP()}async function F(e,t,n,r=!0,s){const o={"Content-Type":"application/json"};if(r){const a=Mo();a&&(o.Authorization=`Bearer ${a}`)}const i=await fetch(`${$a}${t}`,{method:e,headers:o,body:n!==void 0?JSON.stringify(n):void 0,signal:s});if(i.status===401)throw nx(),window.location.pathname!=="/login"&&(window.location.href="/login"),new Error("Unauthorized");if(!i.ok){let a=`HTTP ${i.status}`;try{const l=await i.json();l.error&&(a=l.error)}catch{}throw new Error(a)}return i.json()}async function rx(e,t){return(await F("POST","/api/auth/login",{username:e,password:t},!1)).token}function pa(){const e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}async function lf(){return(await F("GET","/api/auth/local-token",void 0,!1)).token}async function VP(){return(await F("GET","/api/projects/workspace")).workspace}async function FP(){return F("GET","/api/projects")}async function sx(){return F("GET","/api/projects/users")}async function ox(e,t){return F("PUT",`/api/projects/${e}/shares`,{shares:t})}async function ix(e){return F("POST","/api/projects",e)}async function ax(e){return F("POST","/api/projects/open",{folderPath:e})}async function lx(e){await F("DELETE",`/api/projects/${e}`)}async function zP(e){return F("PATCH",`/api/projects/${e}/stop`)}async function BP(e){return F("PATCH",`/api/projects/${e}/start`)}async function ux(e){return F("PATCH",`/api/projects/${e}/archive`)}async function cx(e){return F("PATCH",`/api/projects/${e}/unarchive`)}async function $P(e,t){return F("GET",`/api/projects/${e}/sessions`,void 0,!0,t)}async function UP(e,t,n){return F("GET",`/api/projects/${e}/sessions/${t}`,void 0,!0,n)}async function WP(e){return F("GET","/api/projects/activity",void 0,!0,e)}async function dx(){return F("GET","/api/shortcuts")}async function fx(e){return F("POST","/api/shortcuts",e)}async function hx(e,t){return F("PUT",`/api/shortcuts/${e}`,t)}async function px(e){await F("DELETE",`/api/shortcuts/${e}`)}async function HP(e){return F("GET",`/api/shortcuts/project/${e}`)}async function GP(e,t){return F("POST",`/api/shortcuts/project/${e}`,t)}async function KP(e,t,n){return F("PUT",`/api/shortcuts/project/${e}/${t}`,n)}async function YP(e,t){await F("DELETE",`/api/shortcuts/project/${e}/${t}`)}async function XP(){return F("GET","/api/skillhub/skills")}async function QP(e){await F("POST","/api/skillhub/submit",e)}async function ZP(e){return F("POST",`/api/skillhub/download/${e}`)}async function mx(){return F("GET","/api/projects/usage")}async function gx(){return F("GET","/api/projects/usage?refresh=true")}async function yx(e){const t=e?`?path=${encodeURIComponent(e)}`:"";return F("GET",`/api/filesystem${t}`)}function qP(e){return`${$a}/api/filesystem/raw?path=${encodeURIComponent(e)}`}async function JP(e,t){const n=new FormData;n.append("path",e);for(const i of t)n.append("files",i);const r={},s=Mo();s&&(r.Authorization=`Bearer ${s}`);const o=await fetch(`${$a}/api/filesystem/upload`,{method:"POST",headers:r,body:n});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Upload failed: ${o.status}`)}return o.json()}async function vx(e,t){return F("POST","/api/filesystem/mkdir",{path:e,name:t})}async function eN(e){return F("GET",`/api/filesystem/file?path=${encodeURIComponent(e)}`)}async function tN(e,t){return F("PUT","/api/filesystem/file",{path:e,content:t})}async function nN(){return F("GET","/api/update/check-running")}async function rN(){return F("POST","/api/update/prepare")}async function sN(){return F("GET","/api/backup/built-in-oauth")}async function oN(){return F("GET","/api/backup/providers")}async function iN(e){return F("POST","/api/backup/providers",e)}async function aN(e){await F("DELETE",`/api/backup/providers/${e}`)}async function lN(e){return F("GET",`/api/backup/auth/${e}/url`)}async function uN(e){return F("POST",`/api/backup/run/${e}`)}async function cN(){return F("GET","/api/backup/schedule")}async function dN(e){return F("PUT","/api/backup/schedule",e)}async function fN(){return F("GET","/api/backup/excludes")}async function hN(e){return F("PUT","/api/backup/excludes",{patterns:e})}async function pN(){return F("GET","/api/backup/history")}async function mN(){return F("GET","/api/notify/config")}async function gN(e){return F("PUT","/api/notify/config",e)}async function yN(e){return F("GET",`/api/projects/${e}/git/status`)}async function vN(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return F("GET",`/api/projects/${e}/git/diff${n}`)}async function xN(e,t){await F("POST",`/api/projects/${e}/git/add`,{files:t})}async function wN(e,t){await F("POST",`/api/projects/${e}/git/commit`,{message:t})}async function xx(e){return F("GET",`/api/projects/sessions/search?q=${encodeURIComponent(e)}`)}async function SN(e,t){return F("PATCH",`/api/projects/${e}/tags`,{tags:t})}async function EN(e){return F("GET",`/api/projects/${e}/todos`)}async function kN(e,t){return F("POST",`/api/sessions/${e}/share`,{expiryDays:t})}async function bN(e){const t=await fetch(`${$a}/api/share/${e}`);if(!t.ok){let n=`HTTP ${t.status}`;try{const r=await t.json();r.error&&(n=r.error)}catch{}throw new Error(n)}return t.json()}const CN=Object.freeze(Object.defineProperty({__proto__:null,addBackupProvider:iN,archiveProject:ux,browseFilesystem:yx,checkRunningProjects:nN,clearToken:nx,createFolder:vx,createGlobalShortcut:fx,createProject:ix,createProjectShortcut:GP,deleteBackupProvider:aN,deleteGlobalShortcut:px,deleteProject:lx,deleteProjectShortcut:YP,downloadSkillFromHub:ZP,getAllUsers:sx,getBackupAuthUrl:lN,getBackupExcludes:fN,getBackupHistory:pN,getBackupProviders:oN,getBackupSchedule:cN,getBuiltInOAuthTypes:sN,getGitDiff:vN,getGitStatus:yN,getGlobalShortcuts:dx,getLocalToken:lf,getNotifyConfig:mN,getProjectShortcuts:HP,getProjectTodos:EN,getProjects:FP,getProjectsActivity:WP,getRawFileUrl:qP,getSession:UP,getSessions:$P,getSharedSession:bN,getSkillHubSkills:XP,getToken:Mo,getUsage:mx,getWorkspace:VP,gitAdd:xN,gitCommit:wN,isLocalAccess:pa,login:rx,openProject:ax,prepareForUpdate:rN,readFile:eN,refreshUsage:gx,searchSessions:xx,setToken:IP,shareSession:kN,startProject:BP,stopProject:zP,submitSkillToHub:QP,triggerBackup:uN,unarchiveProject:cx,updateBackupExcludes:hN,updateBackupSchedule:dN,updateGlobalShortcut:hx,updateNotifyConfig:gN,updateProjectShares:ox,updateProjectShortcut:KP,updateProjectTags:SN,uploadFiles:JP,writeFile:tN},Symbol.toStringTag,{value:"Module"}));function TN(){const e=Oa(),t=xr(u=>u.setToken),[n,r]=p.useState(""),[s,o]=p.useState(""),[i,a]=p.useState(null),[l,c]=p.useState(!1);p.useEffect(()=>{if(!pa())return;let u=!1;return(async()=>{try{const f=await lf();u||(t(f),e("/",{replace:!0}))}catch{}})(),()=>{u=!0}},[e,t]);const d=async u=>{u.preventDefault(),a(null),c(!0);try{const f=await rx(n,s);t(f),e("/")}catch(f){a(f instanceof Error?f.message:"Login failed")}finally{c(!1)}};return h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:h.jsx(Vn.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},className:"w-full max-w-sm",children:h.jsxs(nf,{children:[h.jsxs(rf,{className:"text-center",children:[h.jsx(sf,{className:"text-2xl",children:"CC Web"}),h.jsx(Y0,{children:pa()?"Connecting locally...":"Sign in to manage your Claude projects"})]}),h.jsxs("form",{onSubmit:u=>void d(u),children:[h.jsxs(of,{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"username",children:"Username"}),h.jsx(go,{id:"username",type:"text",autoComplete:"username",value:n,onChange:u=>r(u.target.value),required:!0,autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"password",children:"Password"}),h.jsx(go,{id:"password",type:"password",autoComplete:"current-password",value:s,onChange:u=>o(u.target.value),required:!0})]}),h.jsx(qd,{children:i&&h.jsx(Vn.p,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:{duration:.2},className:"text-sm text-destructive",children:i})})]}),h.jsx(X0,{children:h.jsx(Vn.div,{className:"w-full",whileTap:{scale:.98},children:h.jsx(ie,{type:"submit",className:"w-full",disabled:l,children:l?"Signing in...":"Sign In"})})})]})]})})})}/**
|
|
77
77
|
* @license lucide-react v0.309.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
@@ -272,4 +272,4 @@ Error generating stack: `+o.message+`
|
|
|
272
272
|
|
|
273
273
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
274
274
|
|
|
275
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},MR="DialogDescriptionWarning",AR=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qx(MR).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},DR=Fx,LR=$x,Jx=Ux,ew=Wx,tw=Gx,nw=Yx,OR=Qx;const hf=DR,_R=LR,rw=p.forwardRef(({className:e,...t},n)=>h.jsx(Jx,{ref:n,className:q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rw.displayName=Jx.displayName;const Ga=p.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(_R,{children:[h.jsx(rw,{}),h.jsxs(ew,{ref:r,className:q("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,h.jsxs(OR,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(uf,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ga.displayName=ew.displayName;const Ka=({className:e,...t})=>h.jsx("div",{className:q("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ka.displayName="DialogHeader";const Ya=({className:e,...t})=>h.jsx("div",{className:q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ya.displayName="DialogFooter";const Xa=p.forwardRef(({className:e,...t},n)=>h.jsx(tw,{ref:n,className:q("text-lg font-semibold leading-none tracking-tight",e),...t}));Xa.displayName=tw.displayName;const Qa=p.forwardRef(({className:e,...t},n)=>h.jsx(nw,{ref:n,className:q("text-sm text-muted-foreground",e),...t}));Qa.displayName=nw.displayName;function IR({project:e,open:t,onOpenChange:n,onUpdated:r}){const[s,o]=p.useState([]),[i,a]=p.useState([]),[l,c]=p.useState(!1),[d,u]=p.useState(null);p.useEffect(()=>{if(!t)return;o(e.shares?[...e.shares]:[]),u(null);let g=!1;return sx().then(v=>{g||a(v)}).catch(()=>{}),()=>{g=!0}},[t,e.id]);const f=new Set(s.map(g=>g.username)),y=i.filter(g=>g!==e.owner&&!f.has(g)),w=g=>{o(v=>[...v,{username:g,permission:"view"}])},x=g=>{o(v=>v.filter(E=>E.username!==g))},S=g=>{o(v=>v.map(E=>E.username===g?{...E,permission:E.permission==="view"?"edit":"view"}:E))},m=async()=>{c(!0),u(null);try{const g=await ox(e.id,s);r(g),n(!1)}catch(g){u(g instanceof Error?g.message:"Failed to update shares")}finally{c(!1)}};return h.jsx(hf,{open:t,onOpenChange:n,children:h.jsxs(Ga,{className:"sm:max-w-md",children:[h.jsxs(Ka,{children:[h.jsxs(Xa,{className:"flex items-center gap-2",children:[h.jsx(kc,{className:"h-4 w-4"}),"共享设置"]}),h.jsx(Qa,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),h.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[s.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),s.map(g=>h.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[h.jsx("span",{className:"text-sm font-medium",children:g.username}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:()=>S(g.username),className:"focus:outline-none",children:h.jsx(rr,{variant:g.permission==="edit"?"default":"secondary",className:"cursor-pointer text-xs",children:g.permission==="edit"?"可编辑":"可见"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>x(g.username),children:h.jsx(Ex,{className:"h-3.5 w-3.5"})})]})]},g.username))]}),y.length>0&&h.jsxs("div",{className:"border-t pt-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map(g=>h.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>w(g),children:[h.jsx(ma,{className:"h-3 w-3"}),g]},g))})]}),d&&h.jsx("p",{className:"text-sm text-destructive",children:d}),h.jsxs(Ya,{children:[h.jsx(ie,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),h.jsx(ie,{onClick:()=>void m(),disabled:l,children:l?"保存中...":"保存"})]})]})})}function VR(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 FR({status:e}){return h.jsx("span",{className:q("inline-block w-2 h-2 rounded-full",{"bg-green-500":e==="running","bg-zinc-400":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})})}const km=R.memo(function({project:t,active:n=!1,statusStack:r=[],onDelete:s,onArchive:o,onUnarchive:i,onUpdated:a}){var g,v;const l=Oa(),[c,d]=p.useState(!1),u=!!t._sharedPermission,f=t._sharedPermission==="view",y=E=>{E.stopPropagation(),confirm(`Delete project "${t.name}"? This cannot be undone.`)&&s(t.id)},w=E=>{E.stopPropagation(),o(t.id)},x=E=>{E.stopPropagation(),i(t.id)},S=h.jsx(Vn.div,{whileHover:!t.archived&&!n?{y:-2}:{},transition:{duration:.2},children:h.jsxs(nf,{className:q("group cursor-pointer transition-colors relative",t.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":n?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!t.archived&&l(`/projects/${t.id}`),children:[h.jsxs(rf,{className:"pb-2",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(sf,{className:q("text-base leading-tight",t.archived&&"text-muted-foreground"),children:t.name}),h.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!u&&h.jsxs(h.Fragment,{children:[t.archived?h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:x,title:"Restore project",children:h.jsx(jN,{className:"h-3.5 w-3.5"})}):h.jsxs(h.Fragment,{children:[h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:E=>{E.stopPropagation(),d(!0)},title:"共享设置",children:h.jsx(kc,{className:"h-3.5 w-3.5"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:w,title:"Archive project",children:h.jsx(RN,{className:"h-3.5 w-3.5"})})]}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:y,title:"Delete project",children:h.jsx(Ex,{className:"h-3.5 w-3.5"})})]})})]}),h.jsx("div",{className:"flex items-center gap-1.5",children:t.archived?h.jsx(rr,{variant:"secondary",className:"text-xs",children:"Archived"}):h.jsxs(h.Fragment,{children:[h.jsx(FR,{status:t.status}),h.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:t.status}),n&&r.length>0&&h.jsx("div",{className:"ml-auto",children:h.jsx(qd,{mode:"wait",children:r.slice(-1).map(E=>h.jsx(Vn.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25,ease:"easeOut"},children:h.jsx(rr,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:VR(E.phase,E.detail)})},E.id))})})]})})]}),h.jsxs(of,{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx(Ec,{className:"h-3.5 w-3.5 flex-shrink-0"}),h.jsx("span",{className:"truncate font-mono",children:t.folderPath})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(rr,{variant:"outline",className:"text-xs font-mono",children:t.cliTool??"claude"}),h.jsx(rr,{variant:t.permissionMode==="unlimited"?"destructive":"secondary",className:"text-xs",children:t.permissionMode==="unlimited"?"Unlimited":"Limited"}),u&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[f?h.jsx(DN,{className:"h-3 w-3"}):h.jsx(Sx,{className:"h-3 w-3"}),f?"可见":"可编辑"]}),!u&&t.shares&&t.shares.length>0&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[h.jsx(kc,{className:"h-3 w-3"}),t.shares.length]}),h.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleDateString()})]}),(t.tags??[]).length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(t.tags??[]).slice(0,3).map(E=>h.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",E]},E)),(((g=t.tags)==null?void 0:g.length)??0)>3&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",(((v=t.tags)==null?void 0:v.length)??0)-3]})]})]})]})}),m=n&&!t.archived?h.jsx("div",{className:"card-active-glow rounded-lg",children:S}):S;return h.jsxs(h.Fragment,{children:[m,!u&&a&&h.jsx(IR,{project:t,open:c,onOpenChange:d,onUpdated:a})]})});function sw({onSelect:e}){const[t,n]=p.useState(""),[r,s]=p.useState(null),[o,i]=p.useState([]),[a,l]=p.useState(!0),[c,d]=p.useState(null),[u,f]=p.useState(!1),[y,w]=p.useState(""),[x,S]=p.useState(null),[m,g]=p.useState(!1),v=p.useRef(null),E=async D=>{l(!0),d(null);try{const L=await yx(D);n(L.path),s(L.parent),i(L.entries)}catch(L){d(L instanceof Error?L.message:"Failed to load directory")}finally{l(!1)}};p.useEffect(()=>{E()},[]),p.useEffect(()=>{u&&setTimeout(()=>{var D;return(D=v.current)==null?void 0:D.focus()},0)},[u]);const C=()=>{w(""),S(null),f(!0)},T=()=>{f(!1),w(""),S(null)},k=async()=>{const D=y.trim();if(D){g(!0),S(null);try{const{path:L}=await vx(t,D);f(!1),w(""),await E(t),E(L)}catch(L){S(L instanceof Error?L.message:"Failed to create folder")}finally{g(!1)}}},b=D=>{D.key==="Enter"?(D.preventDefault(),k()):D.key==="Escape"&&T()},A=t.split("/").filter(Boolean),P=D=>{const L="/"+A.slice(0,D+1).join("/");E(L)};return h.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[h.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>void E(),title:"Home",children:h.jsx(_N,{className:"h-3 w-3"})}),h.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:A.map((D,L)=>h.jsxs(R.Fragment,{children:[h.jsx(wx,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),h.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>P(L),children:D})]},L))}),h.jsxs(ie,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:C,disabled:u||a||!!c,title:"New folder",children:[h.jsx(ON,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!a&&!c&&h.jsxs("div",{className:"p-1",children:[r&&h.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>void E(r),children:[h.jsx(MN,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:".."})]}),u&&h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[h.jsx(lm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),h.jsx("input",{ref:v,className:q("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",x&&"border-destructive"),placeholder:"Folder name",value:y,onChange:D=>{w(D.target.value),S(null)},onKeyDown:b,disabled:m}),h.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>void k(),disabled:!y.trim()||m,title:"Create",children:h.jsx(AN,{className:"h-3.5 w-3.5 text-green-600"})}),h.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:T,disabled:m,title:"Cancel",children:h.jsx(uf,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),x&&h.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:x}),o.length===0&&!u&&h.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),o.map(D=>h.jsxs("button",{className:q("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left",D.type==="dir"?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{D.type==="dir"&&E(D.path)},disabled:D.type==="file",children:[D.type==="dir"?h.jsx(lm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):h.jsx(LN,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"truncate",children:D.name})]},D.path))]})]}),h.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),h.jsx(ie,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const zR=[{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)"}],bm={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"}};function BR({open:e,onOpenChange:t,onCreated:n}){const[r,s]=p.useState("name"),[o,i]=p.useState(""),[a,l]=p.useState(""),[c,d]=p.useState("claude"),[u,f]=p.useState("limited"),[y,w]=p.useState(!1),[x,S]=p.useState(null),m=()=>{s("name"),i(""),l(""),d("claude"),f("limited"),S(null),w(!1)},g=b=>{b||m(),t(b)},v=()=>{if(!o.trim()){S("Please enter a project name");return}S(null),s("folder")},E=b=>{l(b),s("settings")},C=async()=>{w(!0),S(null);try{const b=await ix({name:o.trim(),folderPath:a,permissionMode:u,cliTool:c});n(b),g(!1)}catch(b){S(b instanceof Error?b.message:"Failed to create project")}finally{w(!1)}},T={name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"},k=["name","folder","settings"];return h.jsx(hf,{open:e,onOpenChange:g,children:h.jsxs(Ga,{className:"sm:max-w-lg",children:[h.jsxs(Ka,{children:[h.jsx(Xa,{children:T[r]}),h.jsxs(Qa,{children:[r==="name"&&"Give your project a name.",r==="folder"&&"Choose the working directory for this project.",r==="settings"&&"Choose the AI coding tool and run mode."]})]}),h.jsx("div",{className:"flex gap-2 mb-2",children:k.map((b,A)=>h.jsx("div",{className:`h-1.5 flex-1 rounded-full ${r===b?"bg-primary":k.indexOf(r)>A?"bg-primary/40":"bg-muted"}`},b))}),r==="name"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"project-name",children:"Project Name"}),h.jsx(go,{id:"project-name",placeholder:"My Project",value:o,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&v()},autoFocus:!0})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),r==="folder"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Working Directory"}),h.jsx(sw,{onSelect:E})]}),r==="settings"&&h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"AI Coding Tool"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:zR.map(b=>h.jsxs("label",{className:`flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors ${c===b.value?"border-primary bg-primary/5":"hover:bg-accent"}`,children:[h.jsx("input",{type:"radio",name:"cliTool",value:b.value,checked:c===b.value,onChange:()=>d(b.value),className:"accent-primary"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:b.label}),h.jsx("div",{className:"text-xs text-muted-foreground",children:b.desc})]})]},b.value))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Permission Mode"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:u==="limited",onChange:()=>f("limited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Limited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:bm[c].limited})," — asks for permission before file changes."]})]})]}),h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:u==="unlimited",onChange:()=>f("unlimited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:bm[c].unlimited})," — acts autonomously."]})]})]})]})]}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Folder:"})," ",h.jsx("span",{className:"font-mono",children:a})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),h.jsxs(Ya,{children:[r!=="name"&&h.jsx(ie,{variant:"outline",onClick:()=>s(r==="settings"?"folder":"name"),disabled:y,children:"Back"}),r==="name"&&h.jsx(ie,{onClick:v,children:"Next"}),r==="folder"&&h.jsx(ie,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r==="settings"&&h.jsx(ie,{onClick:()=>void C(),disabled:y,children:y?"Creating...":"Create Project"})]})]})})}function $R({open:e,onOpenChange:t,onOpened:n}){const[r,s]=p.useState(""),[o,i]=p.useState(!1),[a,l]=p.useState(null),c=()=>{s(""),l(null),i(!1)},d=f=>{f||c(),t(f)},u=async f=>{s(f),i(!0),l(null);try{const y=await ax(f);n(y),d(!1)}catch(y){l(y instanceof Error?y.message:"Failed to open project"),i(!1)}};return h.jsx(hf,{open:e,onOpenChange:d,children:h.jsxs(Ga,{className:"sm:max-w-lg",children:[h.jsxs(Ka,{children:[h.jsx(Xa,{children:"Open Existing Project"}),h.jsxs(Qa,{children:["Select a folder that contains a ",h.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Project Folder"}),h.jsx(sw,{onSelect:f=>void u(f)})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a}),r&&!a&&o&&h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),h.jsx(Ya,{children:h.jsx(ie,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"})})]})})}function UR(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const WR=e=>{switch(e){case"success":return KR;case"info":return XR;case"warning":return YR;case"error":return QR;default:return null}},HR=Array(12).fill(0),GR=({visible:e,className:t})=>R.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},R.createElement("div",{className:"sonner-spinner"},HR.map((n,r)=>R.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),KR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),YR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),XR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),QR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ZR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},R.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),R.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),qR=()=>{const[e,t]=R.useState(document.hidden);return R.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Tc=1;class JR{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Tc++,i=this.toasts.find(l=>l.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async c=>{if(i=["resolve",c],R.isValidElement(c))o=!1,this.create({id:r,type:"default",message:c});else if(tM(c)&&!c.ok){o=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(c instanceof Error){o=!1;const u=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(n.success!==void 0){o=!1;const u=typeof n.success=="function"?await n.success(c):n.success,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:f,...w})}}).catch(async c=>{if(i=["reject",c],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(c):n.error,u=typeof n.description=="function"?await n.description(c):n.description,y=typeof d=="object"&&!R.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:u,...y})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,d)=>a.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||Tc++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const et=new JR,eM=(e,t)=>{const n=(t==null?void 0:t.id)||Tc++;return et.addToast({title:e,...t,id:n}),n},tM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",nM=eM,rM=()=>et.toasts,sM=()=>et.getActiveToasts(),Di=Object.assign(nM,{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:rM,getToasts:sM});UR("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function li(e){return e.label!==void 0}const oM=3,iM="24px",aM="16px",Cm=4e3,lM=356,uM=14,cM=45,dM=200;function Ft(...e){return e.filter(Boolean).join(" ")}function fM(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const hM=e=>{var t,n,r,s,o,i,a,l,c;const{invert:d,toast:u,unstyled:f,interacting:y,setHeights:w,visibleToasts:x,heights:S,index:m,toasts:g,expanded:v,removeToast:E,defaultRichColors:C,closeButton:T,style:k,cancelButtonStyle:b,actionButtonStyle:A,className:P="",descriptionClassName:D="",duration:L,position:Q,gap:le,expandByDefault:ge,classNames:z,icons:re,closeButtonAriaLabel:j="Close toast"}=e,[O,V]=R.useState(null),[$,se]=R.useState(null),[H,Z]=R.useState(!1),[K,pe]=R.useState(!1),[Je,J]=R.useState(!1),[Xt,cn]=R.useState(!1),[Qt,It]=R.useState(!1),[gs,Xn]=R.useState(0),[Za,Qn]=R.useState(0),dn=R.useRef(u.duration||L||Cm),Ao=R.useRef(null),kt=R.useRef(null),qa=m===0,Ja=m+1<=x,ze=u.type,N=u.dismissible!==!1,B=u.className||"",Y=u.descriptionClassName||"",ee=R.useMemo(()=>S.findIndex(U=>U.toastId===u.id)||0,[S,u.id]),ue=R.useMemo(()=>{var U;return(U=u.closeButton)!=null?U:T},[u.closeButton,T]),Pe=R.useMemo(()=>u.duration||L||Cm,[u.duration,L]),Ge=R.useRef(0),ye=R.useRef(0),Zn=R.useRef(0),fn=R.useRef(null),[uw,cw]=Q.split("-"),pf=R.useMemo(()=>S.reduce((U,Me,Be)=>Be>=ee?U:U+Me.height,0),[S,ee]),mf=qR(),dw=u.invert||d,el=ze==="loading";ye.current=R.useMemo(()=>ee*le+pf,[ee,pf]),R.useEffect(()=>{dn.current=Pe},[Pe]),R.useEffect(()=>{Z(!0)},[]),R.useEffect(()=>{const U=kt.current;if(U){const Me=U.getBoundingClientRect().height;return Qn(Me),w(Be=>[{toastId:u.id,height:Me,position:u.position},...Be]),()=>w(Be=>Be.filter(it=>it.toastId!==u.id))}},[w,u.id]),R.useLayoutEffect(()=>{if(!H)return;const U=kt.current,Me=U.style.height;U.style.height="auto";const Be=U.getBoundingClientRect().height;U.style.height=Me,Qn(Be),w(it=>it.find(Le=>Le.toastId===u.id)?it.map(Le=>Le.toastId===u.id?{...Le,height:Be}:Le):[{toastId:u.id,height:Be,position:u.position},...it])},[H,u.title,u.description,w,u.id,u.jsx,u.action,u.cancel]);const hn=R.useCallback(()=>{pe(!0),Xn(ye.current),w(U=>U.filter(Me=>Me.toastId!==u.id)),setTimeout(()=>{E(u)},dM)},[u,E,w,ye]);R.useEffect(()=>{if(u.promise&&ze==="loading"||u.duration===1/0||u.type==="loading")return;let U;return v||y||mf?(()=>{if(Zn.current<Ge.current){const it=new Date().getTime()-Ge.current;dn.current=dn.current-it}Zn.current=new Date().getTime()})():(()=>{dn.current!==1/0&&(Ge.current=new Date().getTime(),U=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),hn()},dn.current))})(),()=>clearTimeout(U)},[v,y,u,ze,mf,hn]),R.useEffect(()=>{u.delete&&(hn(),u.onDismiss==null||u.onDismiss.call(u,u))},[hn,u.delete]);function fw(){var U;if(re!=null&&re.loading){var Me;return R.createElement("div",{className:Ft(z==null?void 0:z.loader,u==null||(Me=u.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":ze==="loading"},re.loading)}return R.createElement(GR,{className:Ft(z==null?void 0:z.loader,u==null||(U=u.classNames)==null?void 0:U.loader),visible:ze==="loading"})}const hw=u.icon||(re==null?void 0:re[ze])||WR(ze);var gf,yf;return R.createElement("li",{tabIndex:0,ref:kt,className:Ft(P,B,z==null?void 0:z.toast,u==null||(t=u.classNames)==null?void 0:t.toast,z==null?void 0:z.default,z==null?void 0:z[ze],u==null||(n=u.classNames)==null?void 0:n[ze]),"data-sonner-toast":"","data-rich-colors":(gf=u.richColors)!=null?gf:C,"data-styled":!(u.jsx||u.unstyled||f),"data-mounted":H,"data-promise":!!u.promise,"data-swiped":Qt,"data-removed":K,"data-visible":Ja,"data-y-position":uw,"data-x-position":cw,"data-index":m,"data-front":qa,"data-swiping":Je,"data-dismissible":N,"data-type":ze,"data-invert":dw,"data-swipe-out":Xt,"data-swipe-direction":$,"data-expanded":!!(v||ge&&H),"data-testid":u.testId,style:{"--index":m,"--toasts-before":m,"--z-index":g.length-m,"--offset":`${K?gs:ye.current}px`,"--initial-height":ge?"auto":`${Za}px`,...k,...u.style},onDragEnd:()=>{J(!1),V(null),fn.current=null},onPointerDown:U=>{U.button!==2&&(el||!N||(Ao.current=new Date,Xn(ye.current),U.target.setPointerCapture(U.pointerId),U.target.tagName!=="BUTTON"&&(J(!0),fn.current={x:U.clientX,y:U.clientY})))},onPointerUp:()=>{var U,Me,Be;if(Xt||!N)return;fn.current=null;const it=Number(((U=kt.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Do=Number(((Me=kt.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Le=new Date().getTime()-((Be=Ao.current)==null?void 0:Be.getTime()),pt=O==="x"?it:Do,Lo=Math.abs(pt)/Le;if(Math.abs(pt)>=cM||Lo>.11){Xn(ye.current),u.onDismiss==null||u.onDismiss.call(u,u),se(O==="x"?it>0?"right":"left":Do>0?"down":"up"),hn(),cn(!0);return}else{var bt,Ct;(bt=kt.current)==null||bt.style.setProperty("--swipe-amount-x","0px"),(Ct=kt.current)==null||Ct.style.setProperty("--swipe-amount-y","0px")}It(!1),J(!1),V(null)},onPointerMove:U=>{var Me,Be,it;if(!fn.current||!N||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;const Le=U.clientY-fn.current.y,pt=U.clientX-fn.current.x;var Lo;const bt=(Lo=e.swipeDirections)!=null?Lo:fM(Q);!O&&(Math.abs(pt)>1||Math.abs(Le)>1)&&V(Math.abs(pt)>Math.abs(Le)?"x":"y");let Ct={x:0,y:0};const vf=qn=>1/(1.5+Math.abs(qn)/20);if(O==="y"){if(bt.includes("top")||bt.includes("bottom"))if(bt.includes("top")&&Le<0||bt.includes("bottom")&&Le>0)Ct.y=Le;else{const qn=Le*vf(Le);Ct.y=Math.abs(qn)<Math.abs(Le)?qn:Le}}else if(O==="x"&&(bt.includes("left")||bt.includes("right")))if(bt.includes("left")&&pt<0||bt.includes("right")&&pt>0)Ct.x=pt;else{const qn=pt*vf(pt);Ct.x=Math.abs(qn)<Math.abs(pt)?qn:pt}(Math.abs(Ct.x)>0||Math.abs(Ct.y)>0)&&It(!0),(Be=kt.current)==null||Be.style.setProperty("--swipe-amount-x",`${Ct.x}px`),(it=kt.current)==null||it.style.setProperty("--swipe-amount-y",`${Ct.y}px`)}},ue&&!u.jsx&&ze!=="loading"?R.createElement("button",{"aria-label":j,"data-disabled":el,"data-close-button":!0,onClick:el||!N?()=>{}:()=>{hn(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Ft(z==null?void 0:z.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(yf=re==null?void 0:re.close)!=null?yf:ZR):null,(ze||u.icon||u.promise)&&u.icon!==null&&((re==null?void 0:re[ze])!==null||u.icon)?R.createElement("div",{"data-icon":"",className:Ft(z==null?void 0:z.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||fw():null,u.type!=="loading"?hw:null):null,R.createElement("div",{"data-content":"",className:Ft(z==null?void 0:z.content,u==null||(o=u.classNames)==null?void 0:o.content)},R.createElement("div",{"data-title":"",className:Ft(z==null?void 0:z.title,u==null||(i=u.classNames)==null?void 0:i.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?R.createElement("div",{"data-description":"",className:Ft(D,Y,z==null?void 0:z.description,u==null||(a=u.classNames)==null?void 0:a.description)},typeof u.description=="function"?u.description():u.description):null),R.isValidElement(u.cancel)?u.cancel:u.cancel&&li(u.cancel)?R.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||b,onClick:U=>{li(u.cancel)&&N&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,U),hn())},className:Ft(z==null?void 0:z.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,R.isValidElement(u.action)?u.action:u.action&&li(u.action)?R.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||A,onClick:U=>{li(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,U),!U.defaultPrevented&&hn())},className:Ft(z==null?void 0:z.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function Tm(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function pM(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?aM:iM;function l(c){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=a:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const mM=R.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:d,mobileOffset:u,theme:f="light",richColors:y,duration:w,style:x,visibleToasts:S=oM,toastOptions:m,dir:g=Tm(),gap:v=uM,icons:E,containerAriaLabel:C="Notifications"}=t,[T,k]=R.useState([]),b=R.useMemo(()=>r?T.filter(H=>H.toasterId===r):T.filter(H=>!H.toasterId),[T,r]),A=R.useMemo(()=>Array.from(new Set([o].concat(b.filter(H=>H.position).map(H=>H.position)))),[b,o]),[P,D]=R.useState([]),[L,Q]=R.useState(!1),[le,ge]=R.useState(!1),[z,re]=R.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),j=R.useRef(null),O=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=R.useRef(null),$=R.useRef(!1),se=R.useCallback(H=>{k(Z=>{var K;return(K=Z.find(pe=>pe.id===H.id))!=null&&K.delete||et.dismiss(H.id),Z.filter(({id:pe})=>pe!==H.id)})},[]);return R.useEffect(()=>et.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{k(Z=>Z.map(K=>K.id===H.id?{...K,delete:!0}:K))});return}setTimeout(()=>{By.flushSync(()=>{k(Z=>{const K=Z.findIndex(pe=>pe.id===H.id);return K!==-1?[...Z.slice(0,K),{...Z[K],...H},...Z.slice(K+1)]:[H,...Z]})})})}),[T]),R.useEffect(()=>{if(f!=="system"){re(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?re("dark"):re("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:Z})=>{re(Z?"dark":"light")})}catch{H.addListener(({matches:K})=>{try{re(K?"dark":"light")}catch(pe){console.error(pe)}})}},[f]),R.useEffect(()=>{T.length<=1&&Q(!1)},[T]),R.useEffect(()=>{const H=Z=>{var K;if(i.every(J=>Z[J]||Z.code===J)){var Je;Q(!0),(Je=j.current)==null||Je.focus()}Z.code==="Escape"&&(document.activeElement===j.current||(K=j.current)!=null&&K.contains(document.activeElement))&&Q(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[i]),R.useEffect(()=>{if(j.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,$.current=!1)}},[j.current]),R.createElement("section",{ref:n,"aria-label":`${C} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((H,Z)=>{var K;const[pe,Je]=H.split("-");return b.length?R.createElement("ol",{key:H,dir:g==="auto"?Tm():g,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":z,"data-y-position":pe,"data-x-position":Je,style:{"--front-toast-height":`${((K=P[0])==null?void 0:K.height)||0}px`,"--width":`${lM}px`,"--gap":`${v}px`,...x,...pM(d,u)},onBlur:J=>{$.current&&!J.currentTarget.contains(J.relatedTarget)&&($.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||$.current||($.current=!0,V.current=J.relatedTarget)},onMouseEnter:()=>Q(!0),onMouseMove:()=>Q(!0),onMouseLeave:()=>{le||Q(!1)},onDragEnd:()=>Q(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},b.filter(J=>!J.position&&Z===0||J.position===H).map((J,Xt)=>{var cn,Qt;return R.createElement(hM,{key:J.id,icons:E,index:Xt,toast:J,defaultRichColors:y,duration:(cn=m==null?void 0:m.duration)!=null?cn:w,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:s,visibleToasts:S,closeButton:(Qt=m==null?void 0:m.closeButton)!=null?Qt:l,interacting:le,position:H,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,closeButtonAriaLabel:m==null?void 0:m.closeButtonAriaLabel,removeToast:se,toasts:b.filter(It=>It.position==J.position),heights:P.filter(It=>It.position==J.position),setHeights:D,expandByDefault:a,gap:v,expanded:L,swipeDirections:t.swipeDirections})})):null}))}),ow=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,iw=5,aw=3e3;function BM(e,t){const n=p.useRef(null),r=p.useRef(0),s=p.useRef(!0),o=p.useRef(!1),i=p.useRef(t);i.current=t;const a=p.useRef(!1),l=p.useCallback(w=>{var x;((x=n.current)==null?void 0:x.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(w))},[]),c=p.useCallback((w,x)=>{var S;((S=n.current)==null?void 0:S.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:w,rows:x})),a.current=!1):a.current=!0},[]),d=p.useCallback(w=>{l({type:"terminal_input",data:w})},[l]),u=p.useCallback((w,x)=>{l({type:"terminal_resize",cols:w,rows:x})},[l]),f=p.useCallback(()=>{l({type:"chat_subscribe"})},[l]),y=p.useCallback(()=>{if(!s.current||o.current)return;const w=Mo();if(!w){window.location.href="/login";return}o.current=!0;const x=new WebSocket(`${ow}/ws/projects/${e}`);n.current=x,x.onopen=()=>{o.current=!1,r.current=0,x.send(JSON.stringify({type:"auth",token:w}))},x.onmessage=S=>{var g,v,E,C,T,k,b,A;let m;try{m=JSON.parse(S.data)}catch{return}switch(m.type){case"connected":a.current=!1,(v=(g=i.current).onConnected)==null||v.call(g);break;case"terminal_data":(C=(E=i.current).onTerminalData)==null||C.call(E,m.data);break;case"status":(k=(T=i.current).onStatus)==null||k.call(T,m.status);break;case"chat_message":{const P=m;(A=(b=i.current).onChatMessage)==null||A.call(b,P);break}case"error":console.error("[WS] Server error:",m.message);break}},x.onclose=()=>{o.current=!1,n.current=null,s.current&&r.current<iw&&(r.current++,setTimeout(y,aw))},x.onerror=S=>{o.current=!1,console.error("[WS] WebSocket error:",S)}},[e]);return p.useEffect(()=>(s.current=!0,y(),()=>{var w;s.current=!1,(w=n.current)==null||w.close(),n.current=null}),[y]),{subscribeTerminal:c,sendTerminalInput:d,sendTerminalResize:u,subscribeChatMessages:f}}function gM(e){const t=p.useRef(null),n=p.useRef(0),r=p.useRef(!0),s=p.useRef(!1),o=p.useRef(e);o.current=e;const i=p.useCallback(()=>{if(!r.current||s.current)return;const a=Mo();if(!a)return;s.current=!0;const l=new WebSocket(`${ow}/ws/dashboard`);t.current=l,l.onopen=()=>{s.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:a}))},l.onmessage=c=>{var d,u;try{const f=JSON.parse(c.data);f.type==="activity_update"?o.current.onActivityUpdate(f):f.type==="project_stopped"&&((u=(d=o.current).onProjectStopped)==null||u.call(d,f.projectId,f.projectName))}catch{}},l.onclose=()=>{s.current=!1,t.current=null,r.current&&n.current<iw&&(n.current++,setTimeout(i,aw))},l.onerror=c=>{s.current=!1,console.error("[DashboardWS] Error:",c)}},[]);p.useEffect(()=>(r.current=!0,i(),()=>{var a;r.current=!1,(a=t.current)==null||a.close(),t.current=null}),[i])}function yM(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}const Pm=5*36e5;function vM(e){if(!e||e.utilization===void 0||e.utilization<=0||!e.resetAt)return null;const t=new Date(e.resetAt).getTime()-Date.now();if(t<=0)return null;const n=Pm-t;return n<=0?null:Math.round(e.utilization/(n/Pm))}function ui({label:e,bucket:t}){if(!t||t.utilization===void 0)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",s=yM(t.resetAt);return h.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",h.jsxs("span",{className:q("font-medium",r),children:[n,"%"]}),s&&h.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",s,")"]})]})}function xM({className:e}){const[t,n]=p.useState("loading"),[r,s]=p.useState(!1);p.useEffect(()=>{const f=async()=>{try{n(await mx())}catch{n(null)}};f();const y=setInterval(()=>void f(),5*60*1e3);return()=>clearInterval(y)},[]);const o=async()=>{s(!0);try{n(await gx())}catch{n(null)}finally{s(!1)}};if(t==="loading"||!t)return null;const i=!!t.fiveHour,a=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,d=i||a||l||c,u=vM(t.fiveHour);return h.jsxs("div",{className:q("flex items-center gap-1.5 text-xs",e),children:[u!==null&&h.jsxs("span",{className:q("font-medium",u<=100?"text-green-400":"text-orange-400"),title:`5h 使用进度:按当前速率,窗口结束时预计使用 ${u}%`,children:[u,"%"]}),t.planName&&h.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),d&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"|"}),h.jsx(ui,{label:"5h",bucket:t.fiveHour}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ui,{label:"7d",bucket:t.sevenDay})]}),l&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ui,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ui,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),h.jsx("button",{onClick:()=>void o(),className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:h.jsx($N,{className:q("h-3 w-3",r&&"animate-spin")})})]})}function wM(){const[e,t]=p.useState([]),[n,r]=p.useState(!1),[s,o]=p.useState(""),[i,a]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(null),[f,y]=p.useState(""),[w,x]=p.useState(""),[S,m]=p.useState(""),g=p.useRef(null),v=p.useRef(null);p.useEffect(()=>{dx().then(t).catch(()=>t([]))},[]),p.useEffect(()=>{n&&setTimeout(()=>{var k;return(k=g.current)==null?void 0:k.focus()},0)},[n]),p.useEffect(()=>{d&&setTimeout(()=>{var k;return(k=v.current)==null?void 0:k.focus()},0)},[d]);const E=async()=>{const k=i.trim();if(k)try{const b=await fx({label:s.trim()||k,command:k,...l?{parentId:l}:{}});t(A=>[...A,b]),o(""),a(""),c(""),r(!1)}catch(b){console.error("[GlobalShortcuts] Failed to add:",b)}},C=async k=>{try{await px(k),t(b=>b.filter(A=>A.id!==k)),d===k&&u(null)}catch(b){console.error("[GlobalShortcuts] Failed to delete:",b)}},T=async()=>{const k=w.trim();if(!(!k||!d))try{const b=await hx(d,{label:f.trim()||k,command:k,parentId:S||null});t(A=>A.map(P=>P.id===d?b:P)),u(null)}catch(b){console.error("[GlobalShortcuts] Failed to save:",b)}};return h.jsxs("section",{className:"mt-10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(cm,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),h.jsxs("button",{onClick:()=>{r(k=>!k),u(null)},className:q("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[h.jsx(ma,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&h.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[h.jsx("input",{ref:g,placeholder:"名称(可选)",value:s,onChange:k=>o(k.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{placeholder:"命令内容…",value:i,onChange:k=>a(k.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),E()),k.key==="Escape"&&(r(!1),o(""),a(""),c(""))}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Kl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:l,onChange:k=>c(k.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.map(k=>h.jsx("option",{value:k.id,children:k.label},k.id))]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>{r(!1),o(""),a("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void E(),disabled:!i.trim(),className:q("text-sm px-3 py-1 rounded transition-colors text-white",i.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),e.length===0&&!n?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[h.jsx(cm,{className:"h-6 w-6"}),h.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(k=>d===k.id?h.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[h.jsx("input",{ref:v,value:f,onChange:b=>y(b.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{value:w,onChange:b=>x(b.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),T()),b.key==="Escape"&&u(null)}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Kl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:S,onChange:b=>m(b.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.filter(b=>b.id!==k.id).map(b=>h.jsx("option",{value:b.id,children:b.label},b.id))]})]}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>u(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void T(),disabled:!w.trim(),className:q("text-xs px-2.5 py-1 rounded transition-colors text-white",w.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},k.id):h.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[h.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:k.label}),k.parentId&&(()=>{const b=e.find(A=>A.id===k.parentId);return b?h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(Kl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",b.label]})]}):null})(),!k.parentId&&k.label!==k.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:k.command}),h.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>{u(k.id),y(k.label),x(k.command),m(k.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:h.jsx(Sx,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>void C(k.id),className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:h.jsx(uf,{className:"h-3.5 w-3.5"})})]})]},k.id))})]})}const lw=p.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function SM(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function EM(){return p.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>SM())}function kM({children:e}){const[t,n]=p.useState(()=>RP(Zr.theme,"system")),r=EM(),s=t==="system"?r:t;p.useEffect(()=>{const i=document.documentElement;i.classList.remove("light","dark"),i.classList.add(s)},[s]);const o=i=>{n(i),tx(Zr.theme,i)};return h.jsx(lw.Provider,{value:{theme:t,resolved:s,setTheme:o},children:e})}function bM(){return p.useContext(lw)}function CM(){const{theme:e,setTheme:t}=bM(),n=[{value:"light",icon:GN,label:"浅色"},{value:"dark",icon:BN,label:"深色"},{value:"system",icon:zN,label:"系统"}];return h.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:r,icon:s,label:o})=>h.jsx("button",{onClick:()=>t(r),className:q("p-1 rounded-sm transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:h.jsx(s,{className:"h-3.5 w-3.5"})},r))})}function TM(){const e=Oa(),{projects:t,loading:n,error:r,fetchProjects:s,addProject:o,updateProject:i,removeProject:a}=am(),l=xr(N=>N.clearToken),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[y,w]=p.useState(new Set),x=p.useRef(new Map),[S,m]=p.useState(new Map),g=p.useRef(0),[v,E]=p.useState(!!document.fullscreenElement),[C,T]=p.useState(!1),[k,b]=p.useState(""),[A,P]=p.useState([]),[D,L]=p.useState(!1);p.useEffect(()=>{if(!k.trim()||k.trim().length<2){P([]);return}const N=setTimeout(()=>{L(!0),xx(k).then(B=>P(B)).catch(()=>P([])).finally(()=>L(!1))},400);return()=>clearTimeout(N)},[k]);const Q=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};p.useEffect(()=>{const N=()=>E(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",N),()=>document.removeEventListener("fullscreenchange",N)},[]),p.useEffect(()=>{s()},[s]),p.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]);const le=2e3,ge=3,z=8e3,re=p.useCallback(N=>{if(N.status){const ee=am.getState().projects.find(ue=>ue.id===N.projectId);ee&&ee.status!==N.status&&i({...ee,status:N.status})}const B=Date.now(),Y=x.current;if(B-N.lastActivityAt<le){w(ye=>ye.has(N.projectId)?ye:new Set(ye).add(N.projectId));const ee=Y.get(N.projectId)??[];let ue=!1;if(N.semantic){const ye=ee[ee.length-1],Zn=`${N.semantic.phase}:${N.semantic.detail??""}`,fn=ye?`${ye.phase}:${ye.detail??""}`:"";Zn!==fn?(ee.push({id:g.current++,phase:N.semantic.phase,detail:N.semantic.detail,ts:B}),ue=!0):ye&&(ye.ts=B)}const Pe=ee.filter(ye=>B-ye.ts<z),Ge=Pe.length>ge?Pe.slice(-ge):Pe;Ge.length!==ee.length&&(ue=!0),Y.set(N.projectId,Ge),ue&&m(new Map(Y))}else w(ee=>{if(!ee.has(N.projectId))return ee;const ue=new Set(ee);return ue.delete(N.projectId),ue}),Y.has(N.projectId)&&Y.get(N.projectId).length>0&&(Y.set(N.projectId,[]),m(new Map(Y)))},[]),j=p.useCallback((N,B)=>{"Notification"in window&&Notification.permission==="granted"&&new Notification("Claude 已完成",{body:`项目「${B}」的任务已完成`,icon:"/terminal.svg"})},[]);gM({onActivityUpdate:re,onProjectStopped:j}),p.useEffect(()=>{const N=setInterval(()=>{const B=Date.now(),Y=x.current;let ee=!1;for(const[ue,Pe]of Y){const Ge=Pe.filter(ye=>B-ye.ts<z);Ge.length!==Pe.length&&(Y.set(ue,Ge),ee=!0)}ee&&m(new Map(Y)),w(ue=>{let Pe=!1;const Ge=new Set(ue);for(const ye of ue){const Zn=Y.get(ye);(!Zn||Zn.length===0)&&(Ge.delete(ye),Pe=!0)}return Pe?Ge:ue})},3e3);return()=>clearInterval(N)},[]);const O=()=>{l(),e("/login")},V=N=>{o(N)},$=N=>{o(N)},se=async N=>{try{await lx(N),a(N)}catch(B){Di.error(B instanceof Error?B.message:"Failed to delete project")}},H=async N=>{try{const B=await ux(N);i(B)}catch(B){Di.error(B instanceof Error?B.message:"Failed to archive project")}},Z=async N=>{try{const B=await cx(N);i(B)}catch(B){Di.error(B instanceof Error?B.message:"Failed to restore project")}},K=p.useMemo(()=>t.filter(N=>!N.archived),[t]),pe=p.useMemo(()=>t.filter(N=>N.archived),[t]),Je=p.useMemo(()=>Array.from(new Set(t.flatMap(N=>N.tags??[]))),[t]),[J,Xt]=p.useState([]),cn=p.useMemo(()=>J.length===0?K:K.filter(N=>J.some(B=>{var Y;return(Y=N.tags)==null?void 0:Y.includes(B)})),[K,J]),[Qt,It]=AP(Zr.projectOrder,[],{parse:!0}),[gs,Xn]=p.useState(null),[Za,Qn]=p.useState(null);p.useEffect(()=>{if(K.length===0)return;const N=K.map(B=>B.id);It(B=>{const Y=B.filter(Pe=>N.includes(Pe)),ee=N.filter(Pe=>!B.includes(Pe)),ue=[...Y,...ee];return ue.join(",")===B.join(",")?B:ue})},[K]);const dn=p.useMemo(()=>Qt.length===0?cn:[...cn].sort((N,B)=>{const Y=Qt.indexOf(N.id),ee=Qt.indexOf(B.id);return Y===-1?1:ee===-1?-1:Y-ee}),[cn,Qt]),Ao=p.useCallback(N=>Xn(N),[]),kt=p.useCallback(()=>{Xn(null),Qn(null)},[]),qa=p.useCallback((N,B)=>{N.preventDefault(),Qn(B)},[]),Ja=p.useCallback((N,B,Y)=>{if(N.preventDefault(),!Y||Y===B){Qn(null);return}It(ee=>{const ue=[...ee],Pe=ue.indexOf(Y),Ge=ue.indexOf(B);return Pe===-1||Ge===-1?ee:(ue.splice(Pe,1),ue.splice(Ge,0,Y),ue)}),Xn(null),Qn(null)},[It]),ze={onDelete:N=>void se(N),onArchive:N=>void H(N),onUnarchive:N=>void Z(N),onUpdated:i};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(um,{className:"h-5 w-5"}),h.jsx("span",{className:"font-semibold text-lg",children:"CC Web"})]}),h.jsx(xM,{}),h.jsxs("div",{className:"relative",children:[h.jsx(UN,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),h.jsx(go,{placeholder:"搜索历史对话…",value:k,onChange:N=>b(N.target.value),className:"pl-8 h-8 text-xs w-48"}),k.trim().length>=2&&h.jsxs("div",{className:"absolute top-full mt-1 right-0 w-96 max-h-80 overflow-y-auto bg-popover border border-border rounded-lg shadow-xl z-50",children:[D&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"搜索中…"}),!D&&A.length===0&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"无结果"}),A.map((N,B)=>h.jsxs("button",{className:"w-full text-left px-4 py-2.5 hover:bg-muted transition-colors border-b border-border last:border-0",onClick:()=>{e(`/project/${N.projectId}`),b("")},children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:N.projectName}),h.jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:new Date(N.startedAt).toLocaleDateString("zh-CN")})]}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed line-clamp-2",children:N.snippet})]},B))]})]}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:h.jsx(HN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:h.jsx(WN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:Q,title:v?"Exit fullscreen":"Fullscreen",children:v?h.jsx(FN,{className:"h-4 w-4"}):h.jsx(VN,{className:"h-4 w-4"})}),h.jsx(CM,{}),h.jsxs(ie,{variant:"ghost",size:"sm",onClick:O,children:[h.jsx(IN,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),h.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),h.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Ec,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ma,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),n&&h.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),r&&h.jsx("div",{className:"text-center text-destructive py-12",children:r}),!n&&!r&&t.length===0&&h.jsxs("div",{className:"text-center py-20",children:[h.jsx(um,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),h.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),h.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),h.jsxs("div",{className:"flex gap-2 justify-center",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Ec,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ma,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!n&&!r&&Je.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[Je.map(N=>h.jsxs("button",{onClick:()=>Xt(B=>B.includes(N)?B.filter(Y=>Y!==N):[...B,N]),className:q("px-2 py-0.5 rounded-full text-xs border transition-colors",J.includes(N)?"bg-blue-500/20 text-blue-400 border-blue-500/40":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",N]},N)),J.length>0&&h.jsx("button",{onClick:()=>Xt([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:"清除"})]}),!n&&!r&&dn.length>0&&h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:dn.map((N,B)=>h.jsx(Vn.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:B*.05,ease:"easeOut"},draggable:!0,onDragStart:()=>Ao(N.id),onDragOver:Y=>qa(Y,N.id),onDrop:Y=>Ja(Y,N.id,gs),onDragEnd:kt,style:{opacity:gs===N.id?.4:1,cursor:"grab"},className:q(Za===N.id&&gs!==N.id&&"ring-2 ring-blue-500/50 rounded-xl"),children:h.jsx(km,{project:N,active:y.has(N.id),statusStack:S.get(N.id)??[],...ze})},N.id))}),!n&&!r&&pe.length>0&&h.jsxs("div",{className:"mt-10",children:[h.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>T(N=>!N),children:[h.jsx(Vn.span,{animate:{rotate:C?90:0},transition:{duration:.2},children:h.jsx(wx,{className:"h-4 w-4"})}),h.jsx("span",{className:"font-medium",children:"Archived"}),h.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:pe.length})]}),h.jsx(qd,{children:C&&h.jsx(Vn.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:pe.map(N=>h.jsx(km,{project:N,active:!1,...ze},N.id))})})})]}),h.jsx(wM,{})]}),h.jsx(BR,{open:c,onOpenChange:d,onCreated:V}),h.jsx($R,{open:u,onOpenChange:f,onOpened:$})]})}class PM extends R.Component{constructor(){super(...arguments);tl(this,"state",{hasError:!1,error:null});tl(this,"handleReset",()=>{var n,r;this.setState({hasError:!1,error:null}),(r=(n=this.props).onReset)==null||r.call(n)})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary]",n,r.componentStack),Di.error(n.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[h.jsx("p",{children:"出错了"}),h.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted transition-colors",children:"重新加载"})]}):this.props.children}}const NM=R.lazy(()=>bo(()=>import("./ProjectPage-BbEOvh4D.js").then(e=>e.P),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.ProjectPage}))),jM=R.lazy(()=>bo(()=>import("./SettingsPage-W-rH5UiK.js"),__vite__mapDeps([7,3,1])).then(e=>({default:e.SettingsPage}))),RM=R.lazy(()=>bo(()=>import("./SkillHubPage-COgCGxfO.js"),__vite__mapDeps([8,5,2,3])).then(e=>({default:e.SkillHubPage}))),MM=R.lazy(()=>bo(()=>import("./ShareViewPage-BmPLFG-T.js"),__vite__mapDeps([9,5,4])).then(e=>({default:e.ShareViewPage})));function AM(){return h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function ci({children:e}){const[t,n]=p.useState(!1),r=xr(o=>o.token),s=xr(o=>o.setToken);return p.useEffect(()=>{if(r){n(!0);return}pa()?lf().then(o=>s(o)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),!t&&!r?null:r?h.jsx(h.Fragment,{children:e}):h.jsx(ev,{to:"/login",replace:!0})}function DM(){return h.jsxs(kM,{children:[h.jsx(mM,{richColors:!0,position:"bottom-right"}),h.jsx(PM,{children:h.jsx(IE,{children:h.jsx(p.Suspense,{fallback:h.jsx(AM,{}),children:h.jsxs(LE,{children:[h.jsx(yn,{path:"/login",element:h.jsx(TN,{})}),h.jsx(yn,{path:"/",element:h.jsx(ci,{children:h.jsx(TM,{})})}),h.jsx(yn,{path:"/projects/:id",element:h.jsx(ci,{children:h.jsx(NM,{})})}),h.jsx(yn,{path:"/settings",element:h.jsx(ci,{children:h.jsx(jM,{})})}),h.jsx(yn,{path:"/skillhub",element:h.jsx(ci,{children:h.jsx(RM,{})})}),h.jsx(yn,{path:"/share/:token",element:h.jsx(MM,{})}),h.jsx(yn,{path:"*",element:h.jsx(ev,{to:"/",replace:!0})})]})})})})]})}nu.createRoot(document.getElementById("root")).render(h.jsx(R.StrictMode,{children:h.jsx(DM,{})}));export{EN as $,qd as A,ie as B,wx as C,HP as D,DN as E,Ec as F,dx as G,Kl as H,go as I,YP as J,hf as K,Ga as L,FN as M,Ka as N,Xa as O,Sx as P,Qa as Q,R,Zr as S,jn as T,Ya as U,KP as V,GP as W,uf as X,QP as Y,cm as Z,bo as _,_M as a,$P as a0,kN as a1,UP as a2,Oa as a3,MN as a4,rr as a5,xM as a6,CM as a7,uN as a8,zP as a9,lN as aA,nf as aB,rf as aC,sf as aD,of as aE,Ex as aF,mN as aG,oN as aH,cN as aI,fN as aJ,pN as aK,aN as aL,hN as aM,dN as aN,gN as aO,XP as aP,ZP as aQ,bN as aR,IM as aS,BP as aa,UN as ab,AP as ac,BM as ad,um as ae,VM as af,am as ag,yo as ah,kr as ai,ej as aj,un as ak,Fn as al,XN as am,Ba as an,Yl as ao,vo as ap,Ua as aq,Sd as ar,Nx as as,gR as at,Rj as au,_x as av,Tx as aw,bx as ax,sN as ay,iN as az,Mo as b,ne as c,eN as d,q as e,VN as f,Nm as g,qP as h,RP as i,h as j,yx as k,$N as l,JP as m,lm as n,Vn as o,yN as p,AN as q,p as r,tx as s,Di as t,bM as u,ma as v,tN as w,vN as x,xN as y,wN as z};
|
|
275
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},MR="DialogDescriptionWarning",AR=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qx(MR).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},DR=Fx,LR=$x,Jx=Ux,ew=Wx,tw=Gx,nw=Yx,OR=Qx;const hf=DR,_R=LR,rw=p.forwardRef(({className:e,...t},n)=>h.jsx(Jx,{ref:n,className:q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rw.displayName=Jx.displayName;const Ga=p.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(_R,{children:[h.jsx(rw,{}),h.jsxs(ew,{ref:r,className:q("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,h.jsxs(OR,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(uf,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ga.displayName=ew.displayName;const Ka=({className:e,...t})=>h.jsx("div",{className:q("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ka.displayName="DialogHeader";const Ya=({className:e,...t})=>h.jsx("div",{className:q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ya.displayName="DialogFooter";const Xa=p.forwardRef(({className:e,...t},n)=>h.jsx(tw,{ref:n,className:q("text-lg font-semibold leading-none tracking-tight",e),...t}));Xa.displayName=tw.displayName;const Qa=p.forwardRef(({className:e,...t},n)=>h.jsx(nw,{ref:n,className:q("text-sm text-muted-foreground",e),...t}));Qa.displayName=nw.displayName;function IR({project:e,open:t,onOpenChange:n,onUpdated:r}){const[s,o]=p.useState([]),[i,a]=p.useState([]),[l,c]=p.useState(!1),[d,u]=p.useState(null);p.useEffect(()=>{if(!t)return;o(e.shares?[...e.shares]:[]),u(null);let g=!1;return sx().then(v=>{g||a(v)}).catch(()=>{}),()=>{g=!0}},[t,e.id]);const f=new Set(s.map(g=>g.username)),y=i.filter(g=>g!==e.owner&&!f.has(g)),w=g=>{o(v=>[...v,{username:g,permission:"view"}])},x=g=>{o(v=>v.filter(E=>E.username!==g))},S=g=>{o(v=>v.map(E=>E.username===g?{...E,permission:E.permission==="view"?"edit":"view"}:E))},m=async()=>{c(!0),u(null);try{const g=await ox(e.id,s);r(g),n(!1)}catch(g){u(g instanceof Error?g.message:"Failed to update shares")}finally{c(!1)}};return h.jsx(hf,{open:t,onOpenChange:n,children:h.jsxs(Ga,{className:"sm:max-w-md",children:[h.jsxs(Ka,{children:[h.jsxs(Xa,{className:"flex items-center gap-2",children:[h.jsx(kc,{className:"h-4 w-4"}),"共享设置"]}),h.jsx(Qa,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),h.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[s.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),s.map(g=>h.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[h.jsx("span",{className:"text-sm font-medium",children:g.username}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:()=>S(g.username),className:"focus:outline-none",children:h.jsx(rr,{variant:g.permission==="edit"?"default":"secondary",className:"cursor-pointer text-xs",children:g.permission==="edit"?"可编辑":"可见"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>x(g.username),children:h.jsx(Ex,{className:"h-3.5 w-3.5"})})]})]},g.username))]}),y.length>0&&h.jsxs("div",{className:"border-t pt-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map(g=>h.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>w(g),children:[h.jsx(ma,{className:"h-3 w-3"}),g]},g))})]}),d&&h.jsx("p",{className:"text-sm text-destructive",children:d}),h.jsxs(Ya,{children:[h.jsx(ie,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),h.jsx(ie,{onClick:()=>void m(),disabled:l,children:l?"保存中...":"保存"})]})]})})}function VR(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 FR({status:e}){return h.jsx("span",{className:q("inline-block w-2 h-2 rounded-full",{"bg-green-500":e==="running","bg-zinc-400":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})})}const km=R.memo(function({project:t,active:n=!1,statusStack:r=[],onDelete:s,onArchive:o,onUnarchive:i,onUpdated:a}){var g,v;const l=Oa(),[c,d]=p.useState(!1),u=!!t._sharedPermission,f=t._sharedPermission==="view",y=E=>{E.stopPropagation(),confirm(`Delete project "${t.name}"? This cannot be undone.`)&&s(t.id)},w=E=>{E.stopPropagation(),o(t.id)},x=E=>{E.stopPropagation(),i(t.id)},S=h.jsx(Vn.div,{whileHover:!t.archived&&!n?{y:-2}:{},transition:{duration:.2},children:h.jsxs(nf,{className:q("group cursor-pointer transition-colors relative",t.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":n?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!t.archived&&l(`/projects/${t.id}`),children:[h.jsxs(rf,{className:"pb-2",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(sf,{className:q("text-base leading-tight",t.archived&&"text-muted-foreground"),children:t.name}),h.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!u&&h.jsxs(h.Fragment,{children:[t.archived?h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:x,title:"Restore project",children:h.jsx(jN,{className:"h-3.5 w-3.5"})}):h.jsxs(h.Fragment,{children:[h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:E=>{E.stopPropagation(),d(!0)},title:"共享设置",children:h.jsx(kc,{className:"h-3.5 w-3.5"})}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:w,title:"Archive project",children:h.jsx(RN,{className:"h-3.5 w-3.5"})})]}),h.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:y,title:"Delete project",children:h.jsx(Ex,{className:"h-3.5 w-3.5"})})]})})]}),h.jsx("div",{className:"flex items-center gap-1.5",children:t.archived?h.jsx(rr,{variant:"secondary",className:"text-xs",children:"Archived"}):h.jsxs(h.Fragment,{children:[h.jsx(FR,{status:t.status}),h.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:t.status}),n&&r.length>0&&h.jsx("div",{className:"ml-auto",children:h.jsx(qd,{mode:"wait",children:r.slice(-1).map(E=>h.jsx(Vn.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25,ease:"easeOut"},children:h.jsx(rr,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:VR(E.phase,E.detail)})},E.id))})})]})})]}),h.jsxs(of,{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx(Ec,{className:"h-3.5 w-3.5 flex-shrink-0"}),h.jsx("span",{className:"truncate font-mono",children:t.folderPath})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(rr,{variant:"outline",className:"text-xs font-mono",children:t.cliTool??"claude"}),h.jsx(rr,{variant:t.permissionMode==="unlimited"?"destructive":"secondary",className:"text-xs",children:t.permissionMode==="unlimited"?"Unlimited":"Limited"}),u&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[f?h.jsx(DN,{className:"h-3 w-3"}):h.jsx(Sx,{className:"h-3 w-3"}),f?"可见":"可编辑"]}),!u&&t.shares&&t.shares.length>0&&h.jsxs(rr,{variant:"outline",className:"text-xs gap-0.5",children:[h.jsx(kc,{className:"h-3 w-3"}),t.shares.length]}),h.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleDateString()})]}),(t.tags??[]).length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[(t.tags??[]).slice(0,3).map(E=>h.jsxs("span",{className:"px-1.5 py-0 rounded-full text-[10px] bg-muted text-muted-foreground border border-border",children:["#",E]},E)),(((g=t.tags)==null?void 0:g.length)??0)>3&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",(((v=t.tags)==null?void 0:v.length)??0)-3]})]})]})]})}),m=n&&!t.archived?h.jsx("div",{className:"card-active-glow rounded-lg",children:S}):S;return h.jsxs(h.Fragment,{children:[m,!u&&a&&h.jsx(IR,{project:t,open:c,onOpenChange:d,onUpdated:a})]})});function sw({onSelect:e}){const[t,n]=p.useState(""),[r,s]=p.useState(null),[o,i]=p.useState([]),[a,l]=p.useState(!0),[c,d]=p.useState(null),[u,f]=p.useState(!1),[y,w]=p.useState(""),[x,S]=p.useState(null),[m,g]=p.useState(!1),v=p.useRef(null),E=async D=>{l(!0),d(null);try{const L=await yx(D);n(L.path),s(L.parent),i(L.entries)}catch(L){d(L instanceof Error?L.message:"Failed to load directory")}finally{l(!1)}};p.useEffect(()=>{E()},[]),p.useEffect(()=>{u&&setTimeout(()=>{var D;return(D=v.current)==null?void 0:D.focus()},0)},[u]);const C=()=>{w(""),S(null),f(!0)},T=()=>{f(!1),w(""),S(null)},k=async()=>{const D=y.trim();if(D){g(!0),S(null);try{const{path:L}=await vx(t,D);f(!1),w(""),await E(t),E(L)}catch(L){S(L instanceof Error?L.message:"Failed to create folder")}finally{g(!1)}}},b=D=>{D.key==="Enter"?(D.preventDefault(),k()):D.key==="Escape"&&T()},A=t.split("/").filter(Boolean),P=D=>{const L="/"+A.slice(0,D+1).join("/");E(L)};return h.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[h.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>void E(),title:"Home",children:h.jsx(_N,{className:"h-3 w-3"})}),h.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:A.map((D,L)=>h.jsxs(R.Fragment,{children:[h.jsx(wx,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),h.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>P(L),children:D})]},L))}),h.jsxs(ie,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:C,disabled:u||a||!!c,title:"New folder",children:[h.jsx(ON,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!a&&!c&&h.jsxs("div",{className:"p-1",children:[r&&h.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>void E(r),children:[h.jsx(MN,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:".."})]}),u&&h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[h.jsx(lm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),h.jsx("input",{ref:v,className:q("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",x&&"border-destructive"),placeholder:"Folder name",value:y,onChange:D=>{w(D.target.value),S(null)},onKeyDown:b,disabled:m}),h.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>void k(),disabled:!y.trim()||m,title:"Create",children:h.jsx(AN,{className:"h-3.5 w-3.5 text-green-600"})}),h.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:T,disabled:m,title:"Cancel",children:h.jsx(uf,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),x&&h.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:x}),o.length===0&&!u&&h.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),o.map(D=>h.jsxs("button",{className:q("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left",D.type==="dir"?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{D.type==="dir"&&E(D.path)},disabled:D.type==="file",children:[D.type==="dir"?h.jsx(lm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):h.jsx(LN,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"truncate",children:D.name})]},D.path))]})]}),h.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),h.jsx(ie,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const zR=[{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)"}],bm={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"}};function BR({open:e,onOpenChange:t,onCreated:n}){const[r,s]=p.useState("name"),[o,i]=p.useState(""),[a,l]=p.useState(""),[c,d]=p.useState("claude"),[u,f]=p.useState("limited"),[y,w]=p.useState(!1),[x,S]=p.useState(null),m=()=>{s("name"),i(""),l(""),d("claude"),f("limited"),S(null),w(!1)},g=b=>{b||m(),t(b)},v=()=>{if(!o.trim()){S("Please enter a project name");return}S(null),s("folder")},E=b=>{l(b),s("settings")},C=async()=>{w(!0),S(null);try{const b=await ix({name:o.trim(),folderPath:a,permissionMode:u,cliTool:c});n(b),g(!1)}catch(b){S(b instanceof Error?b.message:"Failed to create project")}finally{w(!1)}},T={name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"},k=["name","folder","settings"];return h.jsx(hf,{open:e,onOpenChange:g,children:h.jsxs(Ga,{className:"sm:max-w-lg",children:[h.jsxs(Ka,{children:[h.jsx(Xa,{children:T[r]}),h.jsxs(Qa,{children:[r==="name"&&"Give your project a name.",r==="folder"&&"Choose the working directory for this project.",r==="settings"&&"Choose the AI coding tool and run mode."]})]}),h.jsx("div",{className:"flex gap-2 mb-2",children:k.map((b,A)=>h.jsx("div",{className:`h-1.5 flex-1 rounded-full ${r===b?"bg-primary":k.indexOf(r)>A?"bg-primary/40":"bg-muted"}`},b))}),r==="name"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{htmlFor:"project-name",children:"Project Name"}),h.jsx(go,{id:"project-name",placeholder:"My Project",value:o,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&v()},autoFocus:!0})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),r==="folder"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Working Directory"}),h.jsx(sw,{onSelect:E})]}),r==="settings"&&h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"AI Coding Tool"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:zR.map(b=>h.jsxs("label",{className:`flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors ${c===b.value?"border-primary bg-primary/5":"hover:bg-accent"}`,children:[h.jsx("input",{type:"radio",name:"cliTool",value:b.value,checked:c===b.value,onChange:()=>d(b.value),className:"accent-primary"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:b.label}),h.jsx("div",{className:"text-xs text-muted-foreground",children:b.desc})]})]},b.value))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Permission Mode"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:u==="limited",onChange:()=>f("limited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Limited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:bm[c].limited})," — asks for permission before file changes."]})]})]}),h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:u==="unlimited",onChange:()=>f("unlimited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:bm[c].unlimited})," — acts autonomously."]})]})]})]})]}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Folder:"})," ",h.jsx("span",{className:"font-mono",children:a})]}),x&&h.jsx("p",{className:"text-sm text-destructive",children:x})]}),h.jsxs(Ya,{children:[r!=="name"&&h.jsx(ie,{variant:"outline",onClick:()=>s(r==="settings"?"folder":"name"),disabled:y,children:"Back"}),r==="name"&&h.jsx(ie,{onClick:v,children:"Next"}),r==="folder"&&h.jsx(ie,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r==="settings"&&h.jsx(ie,{onClick:()=>void C(),disabled:y,children:y?"Creating...":"Create Project"})]})]})})}function $R({open:e,onOpenChange:t,onOpened:n}){const[r,s]=p.useState(""),[o,i]=p.useState(!1),[a,l]=p.useState(null),c=()=>{s(""),l(null),i(!1)},d=f=>{f||c(),t(f)},u=async f=>{s(f),i(!0),l(null);try{const y=await ax(f);n(y),d(!1)}catch(y){l(y instanceof Error?y.message:"Failed to open project"),i(!1)}};return h.jsx(hf,{open:e,onOpenChange:d,children:h.jsxs(Ga,{className:"sm:max-w-lg",children:[h.jsxs(Ka,{children:[h.jsx(Xa,{children:"Open Existing Project"}),h.jsxs(Qa,{children:["Select a folder that contains a ",h.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(jn,{children:"Project Folder"}),h.jsx(sw,{onSelect:f=>void u(f)})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a}),r&&!a&&o&&h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),h.jsx(Ya,{children:h.jsx(ie,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"})})]})})}function UR(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const WR=e=>{switch(e){case"success":return KR;case"info":return XR;case"warning":return YR;case"error":return QR;default:return null}},HR=Array(12).fill(0),GR=({visible:e,className:t})=>R.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},R.createElement("div",{className:"sonner-spinner"},HR.map((n,r)=>R.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),KR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),YR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),XR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),QR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ZR=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},R.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),R.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),qR=()=>{const[e,t]=R.useState(document.hidden);return R.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Tc=1;class JR{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Tc++,i=this.toasts.find(l=>l.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async c=>{if(i=["resolve",c],R.isValidElement(c))o=!1,this.create({id:r,type:"default",message:c});else if(tM(c)&&!c.ok){o=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(c instanceof Error){o=!1;const u=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...w})}else if(n.success!==void 0){o=!1;const u=typeof n.success=="function"?await n.success(c):n.success,f=typeof n.description=="function"?await n.description(c):n.description,w=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:f,...w})}}).catch(async c=>{if(i=["reject",c],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(c):n.error,u=typeof n.description=="function"?await n.description(c):n.description,y=typeof d=="object"&&!R.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:u,...y})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,d)=>a.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||Tc++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const et=new JR,eM=(e,t)=>{const n=(t==null?void 0:t.id)||Tc++;return et.addToast({title:e,...t,id:n}),n},tM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",nM=eM,rM=()=>et.toasts,sM=()=>et.getActiveToasts(),Di=Object.assign(nM,{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:rM,getToasts:sM});UR("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function li(e){return e.label!==void 0}const oM=3,iM="24px",aM="16px",Cm=4e3,lM=356,uM=14,cM=45,dM=200;function Ft(...e){return e.filter(Boolean).join(" ")}function fM(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const hM=e=>{var t,n,r,s,o,i,a,l,c;const{invert:d,toast:u,unstyled:f,interacting:y,setHeights:w,visibleToasts:x,heights:S,index:m,toasts:g,expanded:v,removeToast:E,defaultRichColors:C,closeButton:T,style:k,cancelButtonStyle:b,actionButtonStyle:A,className:P="",descriptionClassName:D="",duration:L,position:Q,gap:le,expandByDefault:ge,classNames:z,icons:re,closeButtonAriaLabel:j="Close toast"}=e,[O,V]=R.useState(null),[$,se]=R.useState(null),[H,Z]=R.useState(!1),[K,pe]=R.useState(!1),[Je,J]=R.useState(!1),[Xt,cn]=R.useState(!1),[Qt,It]=R.useState(!1),[gs,Xn]=R.useState(0),[Za,Qn]=R.useState(0),dn=R.useRef(u.duration||L||Cm),Ao=R.useRef(null),kt=R.useRef(null),qa=m===0,Ja=m+1<=x,ze=u.type,N=u.dismissible!==!1,B=u.className||"",Y=u.descriptionClassName||"",ee=R.useMemo(()=>S.findIndex(U=>U.toastId===u.id)||0,[S,u.id]),ue=R.useMemo(()=>{var U;return(U=u.closeButton)!=null?U:T},[u.closeButton,T]),Pe=R.useMemo(()=>u.duration||L||Cm,[u.duration,L]),Ge=R.useRef(0),ye=R.useRef(0),Zn=R.useRef(0),fn=R.useRef(null),[uw,cw]=Q.split("-"),pf=R.useMemo(()=>S.reduce((U,Me,Be)=>Be>=ee?U:U+Me.height,0),[S,ee]),mf=qR(),dw=u.invert||d,el=ze==="loading";ye.current=R.useMemo(()=>ee*le+pf,[ee,pf]),R.useEffect(()=>{dn.current=Pe},[Pe]),R.useEffect(()=>{Z(!0)},[]),R.useEffect(()=>{const U=kt.current;if(U){const Me=U.getBoundingClientRect().height;return Qn(Me),w(Be=>[{toastId:u.id,height:Me,position:u.position},...Be]),()=>w(Be=>Be.filter(it=>it.toastId!==u.id))}},[w,u.id]),R.useLayoutEffect(()=>{if(!H)return;const U=kt.current,Me=U.style.height;U.style.height="auto";const Be=U.getBoundingClientRect().height;U.style.height=Me,Qn(Be),w(it=>it.find(Le=>Le.toastId===u.id)?it.map(Le=>Le.toastId===u.id?{...Le,height:Be}:Le):[{toastId:u.id,height:Be,position:u.position},...it])},[H,u.title,u.description,w,u.id,u.jsx,u.action,u.cancel]);const hn=R.useCallback(()=>{pe(!0),Xn(ye.current),w(U=>U.filter(Me=>Me.toastId!==u.id)),setTimeout(()=>{E(u)},dM)},[u,E,w,ye]);R.useEffect(()=>{if(u.promise&&ze==="loading"||u.duration===1/0||u.type==="loading")return;let U;return v||y||mf?(()=>{if(Zn.current<Ge.current){const it=new Date().getTime()-Ge.current;dn.current=dn.current-it}Zn.current=new Date().getTime()})():(()=>{dn.current!==1/0&&(Ge.current=new Date().getTime(),U=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),hn()},dn.current))})(),()=>clearTimeout(U)},[v,y,u,ze,mf,hn]),R.useEffect(()=>{u.delete&&(hn(),u.onDismiss==null||u.onDismiss.call(u,u))},[hn,u.delete]);function fw(){var U;if(re!=null&&re.loading){var Me;return R.createElement("div",{className:Ft(z==null?void 0:z.loader,u==null||(Me=u.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":ze==="loading"},re.loading)}return R.createElement(GR,{className:Ft(z==null?void 0:z.loader,u==null||(U=u.classNames)==null?void 0:U.loader),visible:ze==="loading"})}const hw=u.icon||(re==null?void 0:re[ze])||WR(ze);var gf,yf;return R.createElement("li",{tabIndex:0,ref:kt,className:Ft(P,B,z==null?void 0:z.toast,u==null||(t=u.classNames)==null?void 0:t.toast,z==null?void 0:z.default,z==null?void 0:z[ze],u==null||(n=u.classNames)==null?void 0:n[ze]),"data-sonner-toast":"","data-rich-colors":(gf=u.richColors)!=null?gf:C,"data-styled":!(u.jsx||u.unstyled||f),"data-mounted":H,"data-promise":!!u.promise,"data-swiped":Qt,"data-removed":K,"data-visible":Ja,"data-y-position":uw,"data-x-position":cw,"data-index":m,"data-front":qa,"data-swiping":Je,"data-dismissible":N,"data-type":ze,"data-invert":dw,"data-swipe-out":Xt,"data-swipe-direction":$,"data-expanded":!!(v||ge&&H),"data-testid":u.testId,style:{"--index":m,"--toasts-before":m,"--z-index":g.length-m,"--offset":`${K?gs:ye.current}px`,"--initial-height":ge?"auto":`${Za}px`,...k,...u.style},onDragEnd:()=>{J(!1),V(null),fn.current=null},onPointerDown:U=>{U.button!==2&&(el||!N||(Ao.current=new Date,Xn(ye.current),U.target.setPointerCapture(U.pointerId),U.target.tagName!=="BUTTON"&&(J(!0),fn.current={x:U.clientX,y:U.clientY})))},onPointerUp:()=>{var U,Me,Be;if(Xt||!N)return;fn.current=null;const it=Number(((U=kt.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Do=Number(((Me=kt.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Le=new Date().getTime()-((Be=Ao.current)==null?void 0:Be.getTime()),pt=O==="x"?it:Do,Lo=Math.abs(pt)/Le;if(Math.abs(pt)>=cM||Lo>.11){Xn(ye.current),u.onDismiss==null||u.onDismiss.call(u,u),se(O==="x"?it>0?"right":"left":Do>0?"down":"up"),hn(),cn(!0);return}else{var bt,Ct;(bt=kt.current)==null||bt.style.setProperty("--swipe-amount-x","0px"),(Ct=kt.current)==null||Ct.style.setProperty("--swipe-amount-y","0px")}It(!1),J(!1),V(null)},onPointerMove:U=>{var Me,Be,it;if(!fn.current||!N||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;const Le=U.clientY-fn.current.y,pt=U.clientX-fn.current.x;var Lo;const bt=(Lo=e.swipeDirections)!=null?Lo:fM(Q);!O&&(Math.abs(pt)>1||Math.abs(Le)>1)&&V(Math.abs(pt)>Math.abs(Le)?"x":"y");let Ct={x:0,y:0};const vf=qn=>1/(1.5+Math.abs(qn)/20);if(O==="y"){if(bt.includes("top")||bt.includes("bottom"))if(bt.includes("top")&&Le<0||bt.includes("bottom")&&Le>0)Ct.y=Le;else{const qn=Le*vf(Le);Ct.y=Math.abs(qn)<Math.abs(Le)?qn:Le}}else if(O==="x"&&(bt.includes("left")||bt.includes("right")))if(bt.includes("left")&&pt<0||bt.includes("right")&&pt>0)Ct.x=pt;else{const qn=pt*vf(pt);Ct.x=Math.abs(qn)<Math.abs(pt)?qn:pt}(Math.abs(Ct.x)>0||Math.abs(Ct.y)>0)&&It(!0),(Be=kt.current)==null||Be.style.setProperty("--swipe-amount-x",`${Ct.x}px`),(it=kt.current)==null||it.style.setProperty("--swipe-amount-y",`${Ct.y}px`)}},ue&&!u.jsx&&ze!=="loading"?R.createElement("button",{"aria-label":j,"data-disabled":el,"data-close-button":!0,onClick:el||!N?()=>{}:()=>{hn(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Ft(z==null?void 0:z.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(yf=re==null?void 0:re.close)!=null?yf:ZR):null,(ze||u.icon||u.promise)&&u.icon!==null&&((re==null?void 0:re[ze])!==null||u.icon)?R.createElement("div",{"data-icon":"",className:Ft(z==null?void 0:z.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||fw():null,u.type!=="loading"?hw:null):null,R.createElement("div",{"data-content":"",className:Ft(z==null?void 0:z.content,u==null||(o=u.classNames)==null?void 0:o.content)},R.createElement("div",{"data-title":"",className:Ft(z==null?void 0:z.title,u==null||(i=u.classNames)==null?void 0:i.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?R.createElement("div",{"data-description":"",className:Ft(D,Y,z==null?void 0:z.description,u==null||(a=u.classNames)==null?void 0:a.description)},typeof u.description=="function"?u.description():u.description):null),R.isValidElement(u.cancel)?u.cancel:u.cancel&&li(u.cancel)?R.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||b,onClick:U=>{li(u.cancel)&&N&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,U),hn())},className:Ft(z==null?void 0:z.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,R.isValidElement(u.action)?u.action:u.action&&li(u.action)?R.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||A,onClick:U=>{li(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,U),!U.defaultPrevented&&hn())},className:Ft(z==null?void 0:z.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function Tm(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function pM(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?aM:iM;function l(c){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=a:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const mM=R.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:d,mobileOffset:u,theme:f="light",richColors:y,duration:w,style:x,visibleToasts:S=oM,toastOptions:m,dir:g=Tm(),gap:v=uM,icons:E,containerAriaLabel:C="Notifications"}=t,[T,k]=R.useState([]),b=R.useMemo(()=>r?T.filter(H=>H.toasterId===r):T.filter(H=>!H.toasterId),[T,r]),A=R.useMemo(()=>Array.from(new Set([o].concat(b.filter(H=>H.position).map(H=>H.position)))),[b,o]),[P,D]=R.useState([]),[L,Q]=R.useState(!1),[le,ge]=R.useState(!1),[z,re]=R.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),j=R.useRef(null),O=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=R.useRef(null),$=R.useRef(!1),se=R.useCallback(H=>{k(Z=>{var K;return(K=Z.find(pe=>pe.id===H.id))!=null&&K.delete||et.dismiss(H.id),Z.filter(({id:pe})=>pe!==H.id)})},[]);return R.useEffect(()=>et.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{k(Z=>Z.map(K=>K.id===H.id?{...K,delete:!0}:K))});return}setTimeout(()=>{By.flushSync(()=>{k(Z=>{const K=Z.findIndex(pe=>pe.id===H.id);return K!==-1?[...Z.slice(0,K),{...Z[K],...H},...Z.slice(K+1)]:[H,...Z]})})})}),[T]),R.useEffect(()=>{if(f!=="system"){re(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?re("dark"):re("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:Z})=>{re(Z?"dark":"light")})}catch{H.addListener(({matches:K})=>{try{re(K?"dark":"light")}catch(pe){console.error(pe)}})}},[f]),R.useEffect(()=>{T.length<=1&&Q(!1)},[T]),R.useEffect(()=>{const H=Z=>{var K;if(i.every(J=>Z[J]||Z.code===J)){var Je;Q(!0),(Je=j.current)==null||Je.focus()}Z.code==="Escape"&&(document.activeElement===j.current||(K=j.current)!=null&&K.contains(document.activeElement))&&Q(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[i]),R.useEffect(()=>{if(j.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,$.current=!1)}},[j.current]),R.createElement("section",{ref:n,"aria-label":`${C} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((H,Z)=>{var K;const[pe,Je]=H.split("-");return b.length?R.createElement("ol",{key:H,dir:g==="auto"?Tm():g,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":z,"data-y-position":pe,"data-x-position":Je,style:{"--front-toast-height":`${((K=P[0])==null?void 0:K.height)||0}px`,"--width":`${lM}px`,"--gap":`${v}px`,...x,...pM(d,u)},onBlur:J=>{$.current&&!J.currentTarget.contains(J.relatedTarget)&&($.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||$.current||($.current=!0,V.current=J.relatedTarget)},onMouseEnter:()=>Q(!0),onMouseMove:()=>Q(!0),onMouseLeave:()=>{le||Q(!1)},onDragEnd:()=>Q(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},b.filter(J=>!J.position&&Z===0||J.position===H).map((J,Xt)=>{var cn,Qt;return R.createElement(hM,{key:J.id,icons:E,index:Xt,toast:J,defaultRichColors:y,duration:(cn=m==null?void 0:m.duration)!=null?cn:w,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:s,visibleToasts:S,closeButton:(Qt=m==null?void 0:m.closeButton)!=null?Qt:l,interacting:le,position:H,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,closeButtonAriaLabel:m==null?void 0:m.closeButtonAriaLabel,removeToast:se,toasts:b.filter(It=>It.position==J.position),heights:P.filter(It=>It.position==J.position),setHeights:D,expandByDefault:a,gap:v,expanded:L,swipeDirections:t.swipeDirections})})):null}))}),ow=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,iw=5,aw=3e3;function BM(e,t){const n=p.useRef(null),r=p.useRef(0),s=p.useRef(!0),o=p.useRef(!1),i=p.useRef(t);i.current=t;const a=p.useRef(!1),l=p.useCallback(w=>{var x;((x=n.current)==null?void 0:x.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(w))},[]),c=p.useCallback((w,x)=>{var S;((S=n.current)==null?void 0:S.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:w,rows:x})),a.current=!1):a.current=!0},[]),d=p.useCallback(w=>{l({type:"terminal_input",data:w})},[l]),u=p.useCallback((w,x)=>{l({type:"terminal_resize",cols:w,rows:x})},[l]),f=p.useCallback(()=>{l({type:"chat_subscribe"})},[l]),y=p.useCallback(()=>{if(!s.current||o.current)return;const w=Mo();if(!w){window.location.href="/login";return}o.current=!0;const x=new WebSocket(`${ow}/ws/projects/${e}`);n.current=x,x.onopen=()=>{o.current=!1,r.current=0,x.send(JSON.stringify({type:"auth",token:w}))},x.onmessage=S=>{var g,v,E,C,T,k,b,A;let m;try{m=JSON.parse(S.data)}catch{return}switch(m.type){case"connected":a.current=!1,(v=(g=i.current).onConnected)==null||v.call(g);break;case"terminal_data":(C=(E=i.current).onTerminalData)==null||C.call(E,m.data);break;case"status":(k=(T=i.current).onStatus)==null||k.call(T,m.status);break;case"chat_message":{const P=m;(A=(b=i.current).onChatMessage)==null||A.call(b,P);break}case"error":console.error("[WS] Server error:",m.message);break}},x.onclose=()=>{o.current=!1,n.current=null,s.current&&r.current<iw&&(r.current++,setTimeout(y,aw))},x.onerror=S=>{o.current=!1,console.error("[WS] WebSocket error:",S)}},[e]);return p.useEffect(()=>(s.current=!0,y(),()=>{var w;s.current=!1,(w=n.current)==null||w.close(),n.current=null}),[y]),{subscribeTerminal:c,sendTerminalInput:d,sendTerminalResize:u,subscribeChatMessages:f}}function gM(e){const t=p.useRef(null),n=p.useRef(0),r=p.useRef(!0),s=p.useRef(!1),o=p.useRef(e);o.current=e;const i=p.useCallback(()=>{if(!r.current||s.current)return;const a=Mo();if(!a)return;s.current=!0;const l=new WebSocket(`${ow}/ws/dashboard`);t.current=l,l.onopen=()=>{s.current=!1,n.current=0,l.send(JSON.stringify({type:"auth",token:a}))},l.onmessage=c=>{var d,u;try{const f=JSON.parse(c.data);f.type==="activity_update"?o.current.onActivityUpdate(f):f.type==="project_stopped"&&((u=(d=o.current).onProjectStopped)==null||u.call(d,f.projectId,f.projectName))}catch{}},l.onclose=()=>{s.current=!1,t.current=null,r.current&&n.current<iw&&(n.current++,setTimeout(i,aw))},l.onerror=c=>{s.current=!1,console.error("[DashboardWS] Error:",c)}},[]);p.useEffect(()=>(r.current=!0,i(),()=>{var a;r.current=!1,(a=t.current)==null||a.close(),t.current=null}),[i])}function yM(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}const Pm=5*36e5;function vM(e){if(!e||e.utilization===void 0||e.utilization<=0||!e.resetAt)return null;const t=new Date(e.resetAt).getTime()-Date.now();if(t<=0)return null;const n=Pm-t;return n<=0?null:Math.round(e.utilization/(n/Pm))}function ui({label:e,bucket:t}){if(!t||t.utilization===void 0)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",s=yM(t.resetAt);return h.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",h.jsxs("span",{className:q("font-medium",r),children:[n,"%"]}),s&&h.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",s,")"]})]})}function xM({className:e}){const[t,n]=p.useState("loading"),[r,s]=p.useState(!1);p.useEffect(()=>{const f=async()=>{try{n(await mx())}catch{n(null)}};f();const y=setInterval(()=>void f(),5*60*1e3);return()=>clearInterval(y)},[]);const o=async()=>{s(!0);try{n(await gx())}catch{n(null)}finally{s(!1)}};if(t==="loading"||!t)return null;const i=!!t.fiveHour,a=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,d=i||a||l||c,u=vM(t.fiveHour);return h.jsxs("div",{className:q("flex items-center gap-1.5 text-xs",e),children:[u!==null&&h.jsxs("span",{className:q("font-medium",u<=100?"text-green-400":"text-orange-400"),title:`5h 使用进度:按当前速率,窗口结束时预计使用 ${u}%`,children:[u,"%"]}),t.planName&&h.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),d&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"|"}),h.jsx(ui,{label:"5h",bucket:t.fiveHour}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ui,{label:"7d",bucket:t.sevenDay})]}),l&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ui,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ui,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),h.jsx("button",{onClick:()=>void o(),className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:h.jsx($N,{className:q("h-3 w-3",r&&"animate-spin")})})]})}function wM(){const[e,t]=p.useState([]),[n,r]=p.useState(!1),[s,o]=p.useState(""),[i,a]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(null),[f,y]=p.useState(""),[w,x]=p.useState(""),[S,m]=p.useState(""),g=p.useRef(null),v=p.useRef(null);p.useEffect(()=>{dx().then(t).catch(()=>t([]))},[]),p.useEffect(()=>{n&&setTimeout(()=>{var k;return(k=g.current)==null?void 0:k.focus()},0)},[n]),p.useEffect(()=>{d&&setTimeout(()=>{var k;return(k=v.current)==null?void 0:k.focus()},0)},[d]);const E=async()=>{const k=i.trim();if(k)try{const b=await fx({label:s.trim()||k,command:k,...l?{parentId:l}:{}});t(A=>[...A,b]),o(""),a(""),c(""),r(!1)}catch(b){console.error("[GlobalShortcuts] Failed to add:",b)}},C=async k=>{try{await px(k),t(b=>b.filter(A=>A.id!==k)),d===k&&u(null)}catch(b){console.error("[GlobalShortcuts] Failed to delete:",b)}},T=async()=>{const k=w.trim();if(!(!k||!d))try{const b=await hx(d,{label:f.trim()||k,command:k,parentId:S||null});t(A=>A.map(P=>P.id===d?b:P)),u(null)}catch(b){console.error("[GlobalShortcuts] Failed to save:",b)}};return h.jsxs("section",{className:"mt-10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(cm,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),h.jsxs("button",{onClick:()=>{r(k=>!k),u(null)},className:q("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[h.jsx(ma,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&h.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[h.jsx("input",{ref:g,placeholder:"名称(可选)",value:s,onChange:k=>o(k.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{placeholder:"命令内容…",value:i,onChange:k=>a(k.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),E()),k.key==="Escape"&&(r(!1),o(""),a(""),c(""))}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Kl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:l,onChange:k=>c(k.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.map(k=>h.jsx("option",{value:k.id,children:k.label},k.id))]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>{r(!1),o(""),a("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void E(),disabled:!i.trim(),className:q("text-sm px-3 py-1 rounded transition-colors text-white",i.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),e.length===0&&!n?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[h.jsx(cm,{className:"h-6 w-6"}),h.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(k=>d===k.id?h.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[h.jsx("input",{ref:v,value:f,onChange:b=>y(b.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{value:w,onChange:b=>x(b.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),T()),b.key==="Escape"&&u(null)}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Kl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:S,onChange:b=>m(b.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.filter(b=>b.id!==k.id).map(b=>h.jsx("option",{value:b.id,children:b.label},b.id))]})]}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>u(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void T(),disabled:!w.trim(),className:q("text-xs px-2.5 py-1 rounded transition-colors text-white",w.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},k.id):h.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[h.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:k.label}),k.parentId&&(()=>{const b=e.find(A=>A.id===k.parentId);return b?h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(Kl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",b.label]})]}):null})(),!k.parentId&&k.label!==k.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:k.command}),h.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>{u(k.id),y(k.label),x(k.command),m(k.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:h.jsx(Sx,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>void C(k.id),className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:h.jsx(uf,{className:"h-3.5 w-3.5"})})]})]},k.id))})]})}const lw=p.createContext({theme:"system",resolved:"dark",setTheme:()=>{}});function SM(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function EM(){return p.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>SM())}function kM({children:e}){const[t,n]=p.useState(()=>RP(Zr.theme,"system")),r=EM(),s=t==="system"?r:t;p.useEffect(()=>{const i=document.documentElement;i.classList.remove("light","dark"),i.classList.add(s)},[s]);const o=i=>{n(i),tx(Zr.theme,i)};return h.jsx(lw.Provider,{value:{theme:t,resolved:s,setTheme:o},children:e})}function bM(){return p.useContext(lw)}function CM(){const{theme:e,setTheme:t}=bM(),n=[{value:"light",icon:GN,label:"浅色"},{value:"dark",icon:BN,label:"深色"},{value:"system",icon:zN,label:"系统"}];return h.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:r,icon:s,label:o})=>h.jsx("button",{onClick:()=>t(r),className:q("p-1 rounded-sm transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:o,children:h.jsx(s,{className:"h-3.5 w-3.5"})},r))})}function TM(){const e=Oa(),{projects:t,loading:n,error:r,fetchProjects:s,addProject:o,updateProject:i,removeProject:a}=am(),l=xr(N=>N.clearToken),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[y,w]=p.useState(new Set),x=p.useRef(new Map),[S,m]=p.useState(new Map),g=p.useRef(0),[v,E]=p.useState(!!document.fullscreenElement),[C,T]=p.useState(!1),[k,b]=p.useState(""),[A,P]=p.useState([]),[D,L]=p.useState(!1);p.useEffect(()=>{if(!k.trim()||k.trim().length<2){P([]);return}const N=setTimeout(()=>{L(!0),xx(k).then(B=>P(B)).catch(()=>P([])).finally(()=>L(!1))},400);return()=>clearTimeout(N)},[k]);const Q=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};p.useEffect(()=>{const N=()=>E(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",N),()=>document.removeEventListener("fullscreenchange",N)},[]),p.useEffect(()=>{s()},[s]),p.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]);const le=2e3,ge=3,z=8e3,re=p.useCallback(N=>{if(N.status){const ee=am.getState().projects.find(ue=>ue.id===N.projectId);ee&&ee.status!==N.status&&i({...ee,status:N.status})}const B=Date.now(),Y=x.current;if(B-N.lastActivityAt<le){w(ye=>ye.has(N.projectId)?ye:new Set(ye).add(N.projectId));const ee=Y.get(N.projectId)??[];let ue=!1;if(N.semantic){const ye=ee[ee.length-1],Zn=`${N.semantic.phase}:${N.semantic.detail??""}`,fn=ye?`${ye.phase}:${ye.detail??""}`:"";Zn!==fn?(ee.push({id:g.current++,phase:N.semantic.phase,detail:N.semantic.detail,ts:B}),ue=!0):ye&&(ye.ts=B)}const Pe=ee.filter(ye=>B-ye.ts<z),Ge=Pe.length>ge?Pe.slice(-ge):Pe;Ge.length!==ee.length&&(ue=!0),Y.set(N.projectId,Ge),ue&&m(new Map(Y))}else w(ee=>{if(!ee.has(N.projectId))return ee;const ue=new Set(ee);return ue.delete(N.projectId),ue}),Y.has(N.projectId)&&Y.get(N.projectId).length>0&&(Y.set(N.projectId,[]),m(new Map(Y)))},[]),j=p.useCallback((N,B)=>{"Notification"in window&&Notification.permission==="granted"&&new Notification("Claude 已完成",{body:`项目「${B}」的任务已完成`,icon:"/terminal.svg"})},[]);gM({onActivityUpdate:re,onProjectStopped:j}),p.useEffect(()=>{const N=setInterval(()=>{const B=Date.now(),Y=x.current;let ee=!1;for(const[ue,Pe]of Y){const Ge=Pe.filter(ye=>B-ye.ts<z);Ge.length!==Pe.length&&(Y.set(ue,Ge),ee=!0)}ee&&m(new Map(Y)),w(ue=>{let Pe=!1;const Ge=new Set(ue);for(const ye of ue){const Zn=Y.get(ye);(!Zn||Zn.length===0)&&(Ge.delete(ye),Pe=!0)}return Pe?Ge:ue})},3e3);return()=>clearInterval(N)},[]);const O=()=>{l(),e("/login")},V=N=>{o(N)},$=N=>{o(N)},se=async N=>{try{await lx(N),a(N)}catch(B){Di.error(B instanceof Error?B.message:"Failed to delete project")}},H=async N=>{try{const B=await ux(N);i(B)}catch(B){Di.error(B instanceof Error?B.message:"Failed to archive project")}},Z=async N=>{try{const B=await cx(N);i(B)}catch(B){Di.error(B instanceof Error?B.message:"Failed to restore project")}},K=p.useMemo(()=>t.filter(N=>!N.archived),[t]),pe=p.useMemo(()=>t.filter(N=>N.archived),[t]),Je=p.useMemo(()=>Array.from(new Set(t.flatMap(N=>N.tags??[]))),[t]),[J,Xt]=p.useState([]),cn=p.useMemo(()=>J.length===0?K:K.filter(N=>J.some(B=>{var Y;return(Y=N.tags)==null?void 0:Y.includes(B)})),[K,J]),[Qt,It]=AP(Zr.projectOrder,[],{parse:!0}),[gs,Xn]=p.useState(null),[Za,Qn]=p.useState(null);p.useEffect(()=>{if(K.length===0)return;const N=K.map(B=>B.id);It(B=>{const Y=B.filter(Pe=>N.includes(Pe)),ee=N.filter(Pe=>!B.includes(Pe)),ue=[...Y,...ee];return ue.join(",")===B.join(",")?B:ue})},[K]);const dn=p.useMemo(()=>Qt.length===0?cn:[...cn].sort((N,B)=>{const Y=Qt.indexOf(N.id),ee=Qt.indexOf(B.id);return Y===-1?1:ee===-1?-1:Y-ee}),[cn,Qt]),Ao=p.useCallback(N=>Xn(N),[]),kt=p.useCallback(()=>{Xn(null),Qn(null)},[]),qa=p.useCallback((N,B)=>{N.preventDefault(),Qn(B)},[]),Ja=p.useCallback((N,B,Y)=>{if(N.preventDefault(),!Y||Y===B){Qn(null);return}It(ee=>{const ue=[...ee],Pe=ue.indexOf(Y),Ge=ue.indexOf(B);return Pe===-1||Ge===-1?ee:(ue.splice(Pe,1),ue.splice(Ge,0,Y),ue)}),Xn(null),Qn(null)},[It]),ze={onDelete:N=>void se(N),onArchive:N=>void H(N),onUnarchive:N=>void Z(N),onUpdated:i};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(um,{className:"h-5 w-5"}),h.jsx("span",{className:"font-semibold text-lg",children:"CC Web"})]}),h.jsx(xM,{}),h.jsxs("div",{className:"relative",children:[h.jsx(UN,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),h.jsx(go,{placeholder:"搜索历史对话…",value:k,onChange:N=>b(N.target.value),className:"pl-8 h-8 text-xs w-48"}),k.trim().length>=2&&h.jsxs("div",{className:"absolute top-full mt-1 right-0 w-96 max-h-80 overflow-y-auto bg-popover border border-border rounded-lg shadow-xl z-50",children:[D&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"搜索中…"}),!D&&A.length===0&&h.jsx("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"无结果"}),A.map((N,B)=>h.jsxs("button",{className:"w-full text-left px-4 py-2.5 hover:bg-muted transition-colors border-b border-border last:border-0",onClick:()=>{e(`/project/${N.projectId}`),b("")},children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:N.projectName}),h.jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:new Date(N.startedAt).toLocaleDateString("zh-CN")})]}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed line-clamp-2",children:N.snippet})]},B))]})]}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:h.jsx(HN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:h.jsx(WN,{className:"h-4 w-4"})}),h.jsx(ie,{variant:"ghost",size:"sm",onClick:Q,title:v?"Exit fullscreen":"Fullscreen",children:v?h.jsx(FN,{className:"h-4 w-4"}):h.jsx(VN,{className:"h-4 w-4"})}),h.jsx(CM,{}),h.jsxs(ie,{variant:"ghost",size:"sm",onClick:O,children:[h.jsx(IN,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),h.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),h.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Ec,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ma,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),n&&h.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),r&&h.jsx("div",{className:"text-center text-destructive py-12",children:r}),!n&&!r&&t.length===0&&h.jsxs("div",{className:"text-center py-20",children:[h.jsx(um,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),h.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),h.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),h.jsxs("div",{className:"flex gap-2 justify-center",children:[h.jsxs(ie,{variant:"outline",onClick:()=>f(!0),children:[h.jsx(Ec,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ie,{onClick:()=>d(!0),children:[h.jsx(ma,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!n&&!r&&Je.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[Je.map(N=>h.jsxs("button",{onClick:()=>Xt(B=>B.includes(N)?B.filter(Y=>Y!==N):[...B,N]),className:q("px-2 py-0.5 rounded-full text-xs border transition-colors",J.includes(N)?"bg-blue-500/20 text-blue-400 border-blue-500/40":"bg-muted text-muted-foreground border-border hover:border-muted-foreground/40"),children:["#",N]},N)),J.length>0&&h.jsx("button",{onClick:()=>Xt([]),className:"px-2 py-0.5 rounded-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:"清除"})]}),!n&&!r&&dn.length>0&&h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:dn.map((N,B)=>h.jsx(Vn.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:B*.05,ease:"easeOut"},draggable:!0,onDragStart:()=>Ao(N.id),onDragOver:Y=>qa(Y,N.id),onDrop:Y=>Ja(Y,N.id,gs),onDragEnd:kt,style:{opacity:gs===N.id?.4:1,cursor:"grab"},className:q(Za===N.id&&gs!==N.id&&"ring-2 ring-blue-500/50 rounded-xl"),children:h.jsx(km,{project:N,active:y.has(N.id),statusStack:S.get(N.id)??[],...ze})},N.id))}),!n&&!r&&pe.length>0&&h.jsxs("div",{className:"mt-10",children:[h.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>T(N=>!N),children:[h.jsx(Vn.span,{animate:{rotate:C?90:0},transition:{duration:.2},children:h.jsx(wx,{className:"h-4 w-4"})}),h.jsx("span",{className:"font-medium",children:"Archived"}),h.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:pe.length})]}),h.jsx(qd,{children:C&&h.jsx(Vn.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:pe.map(N=>h.jsx(km,{project:N,active:!1,...ze},N.id))})})})]}),h.jsx(wM,{})]}),h.jsx(BR,{open:c,onOpenChange:d,onCreated:V}),h.jsx($R,{open:u,onOpenChange:f,onOpened:$})]})}class PM extends R.Component{constructor(){super(...arguments);tl(this,"state",{hasError:!1,error:null});tl(this,"handleReset",()=>{var n,r;this.setState({hasError:!1,error:null}),(r=(n=this.props).onReset)==null||r.call(n)})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary]",n,r.componentStack),Di.error(n.message||"Something went wrong")}render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 p-4 text-sm text-muted-foreground",children:[h.jsx("p",{children:"出错了"}),h.jsx("button",{onClick:this.handleReset,className:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted transition-colors",children:"重新加载"})]}):this.props.children}}const NM=R.lazy(()=>bo(()=>import("./ProjectPage-5JqI1xiV.js").then(e=>e.P),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.ProjectPage}))),jM=R.lazy(()=>bo(()=>import("./SettingsPage-CtcFpBmw.js"),__vite__mapDeps([7,3,1])).then(e=>({default:e.SettingsPage}))),RM=R.lazy(()=>bo(()=>import("./SkillHubPage-DacbRrr4.js"),__vite__mapDeps([8,5,2,3])).then(e=>({default:e.SkillHubPage}))),MM=R.lazy(()=>bo(()=>import("./ShareViewPage-DRSWJiGO.js"),__vite__mapDeps([9,5,4])).then(e=>({default:e.ShareViewPage})));function AM(){return h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})})}function ci({children:e}){const[t,n]=p.useState(!1),r=xr(o=>o.token),s=xr(o=>o.setToken);return p.useEffect(()=>{if(r){n(!0);return}pa()?lf().then(o=>s(o)).catch(()=>{}).finally(()=>n(!0)):n(!0)},[]),!t&&!r?null:r?h.jsx(h.Fragment,{children:e}):h.jsx(ev,{to:"/login",replace:!0})}function DM(){return h.jsxs(kM,{children:[h.jsx(mM,{richColors:!0,position:"bottom-right"}),h.jsx(PM,{children:h.jsx(IE,{children:h.jsx(p.Suspense,{fallback:h.jsx(AM,{}),children:h.jsxs(LE,{children:[h.jsx(yn,{path:"/login",element:h.jsx(TN,{})}),h.jsx(yn,{path:"/",element:h.jsx(ci,{children:h.jsx(TM,{})})}),h.jsx(yn,{path:"/projects/:id",element:h.jsx(ci,{children:h.jsx(NM,{})})}),h.jsx(yn,{path:"/settings",element:h.jsx(ci,{children:h.jsx(jM,{})})}),h.jsx(yn,{path:"/skillhub",element:h.jsx(ci,{children:h.jsx(RM,{})})}),h.jsx(yn,{path:"/share/:token",element:h.jsx(MM,{})}),h.jsx(yn,{path:"*",element:h.jsx(ev,{to:"/",replace:!0})})]})})})})]})}nu.createRoot(document.getElementById("root")).render(h.jsx(R.StrictMode,{children:h.jsx(DM,{})}));export{EN as $,qd as A,ie as B,wx as C,HP as D,DN as E,Ec as F,dx as G,Kl as H,go as I,YP as J,hf as K,Ga as L,FN as M,Ka as N,Xa as O,Sx as P,Qa as Q,R,Zr as S,jn as T,Ya as U,KP as V,GP as W,uf as X,QP as Y,cm as Z,bo as _,_M as a,$P as a0,kN as a1,UP as a2,Oa as a3,MN as a4,rr as a5,xM as a6,CM as a7,uN as a8,zP as a9,lN as aA,nf as aB,rf as aC,sf as aD,of as aE,Ex as aF,mN as aG,oN as aH,cN as aI,fN as aJ,pN as aK,aN as aL,hN as aM,dN as aN,gN as aO,XP as aP,ZP as aQ,bN as aR,IM as aS,BP as aa,UN as ab,AP as ac,BM as ad,um as ae,VM as af,am as ag,yo as ah,kr as ai,ej as aj,un as ak,Fn as al,XN as am,Ba as an,Yl as ao,vo as ap,Ua as aq,Sd as ar,Nx as as,gR as at,Rj as au,_x as av,Tx as aw,bx as ax,sN as ay,iN as az,Mo as b,ne as c,eN as d,q as e,VN as f,Nm as g,qP as h,RP as i,h as j,yx as k,$N as l,JP as m,lm as n,Vn as o,yN as p,AN as q,p as r,tx as s,Di as t,bM as u,ma as v,tN as w,vN as x,xN as y,wN as z};
|