@tom2012/cc-web 2026.6.12-c → 2026.6.13-b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/dist/__tests__/sync-refactor.test.d.ts +2 -0
- package/backend/dist/__tests__/sync-refactor.test.d.ts.map +1 -0
- package/backend/dist/__tests__/sync-refactor.test.js +212 -0
- package/backend/dist/__tests__/sync-refactor.test.js.map +1 -0
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +2 -0
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/routes/filesystem.d.ts.map +1 -1
- package/backend/dist/routes/filesystem.js +49 -0
- package/backend/dist/routes/filesystem.js.map +1 -1
- package/backend/dist/routes/sync.d.ts.map +1 -1
- package/backend/dist/routes/sync.js +119 -1
- package/backend/dist/routes/sync.js.map +1 -1
- package/backend/dist/sync-config.d.ts +10 -0
- package/backend/dist/sync-config.d.ts.map +1 -1
- package/backend/dist/sync-config.js +53 -3
- package/backend/dist/sync-config.js.map +1 -1
- package/backend/dist/sync-dirty.d.ts +12 -0
- package/backend/dist/sync-dirty.d.ts.map +1 -0
- package/backend/dist/sync-dirty.js +165 -0
- package/backend/dist/sync-dirty.js.map +1 -0
- package/backend/dist/sync-migrate.d.ts +15 -0
- package/backend/dist/sync-migrate.d.ts.map +1 -0
- package/backend/dist/sync-migrate.js +92 -0
- package/backend/dist/sync-migrate.js.map +1 -0
- package/backend/dist/sync-scheduler.d.ts.map +1 -1
- package/backend/dist/sync-scheduler.js +3 -1
- package/backend/dist/sync-scheduler.js.map +1 -1
- package/backend/dist/sync-service.d.ts.map +1 -1
- package/backend/dist/sync-service.js +34 -16
- package/backend/dist/sync-service.js.map +1 -1
- package/backend/dist/sync-state.d.ts +5 -0
- package/backend/dist/sync-state.d.ts.map +1 -0
- package/backend/dist/sync-state.js +95 -0
- package/backend/dist/sync-state.js.map +1 -0
- package/backend/package-lock.json +63 -0
- package/backend/package.json +1 -0
- package/frontend/dist/assets/{ChatOverlay-BYHxECck.js → ChatOverlay-Cg09i5qF.js} +1 -1
- package/frontend/dist/assets/{ClaudeMemPage-AeBcDyNZ.js → ClaudeMemPage-CT87pX5z.js} +1 -1
- package/frontend/dist/assets/{GraphPreview-CraKSWzy.js → GraphPreview-LQt3-skN.js} +2 -2
- package/frontend/dist/assets/MobilePage-NHtpiQsi.js +14 -0
- package/frontend/dist/assets/OfficePreview-CH1bJV2V.js +2 -0
- package/frontend/dist/assets/{PdfPreview-BX-q3oXm.js → PdfPreview-BDDzOq58.js} +1 -1
- package/frontend/dist/assets/{ProjectPage-DbVFAUzJ.js → ProjectPage-BoOR1Zr9.js} +5 -5
- package/frontend/dist/assets/ProjectSettingsPage-ClHkL2L4.js +13 -0
- package/frontend/dist/assets/{SettingsPage-CoyFVnCz.js → SettingsPage-Q7dhf4gJ.js} +2 -2
- package/frontend/dist/assets/{SkillHubPage-CjFCt8dE.js → SkillHubPage-CI5o_FsS.js} +3 -3
- package/frontend/dist/assets/{check-circle-2-DqS6oPDV.js → check-circle-2-CZgbn9H8.js} +1 -1
- package/frontend/dist/assets/{chevron-down-BPnYeDMC.js → chevron-down-efPsOYlh.js} +1 -1
- package/frontend/dist/assets/{file-text-CPajDnww.js → file-text-mpbJn406.js} +1 -1
- package/frontend/dist/assets/index-BjydjBX7.js +75 -0
- package/frontend/dist/assets/index-DS0RkMkF.css +1 -0
- package/frontend/dist/assets/{index-DrpeVVUe.js → index-Di-Iyd_L.js} +1 -1
- package/frontend/dist/assets/{index-Di5Ntujm.js → index-oPZyCxeH.js} +1 -1
- package/frontend/dist/assets/{jszip.min-BxSvgCaf.js → jszip.min-nePKj7L6.js} +1 -1
- package/frontend/dist/assets/save-BYi9FbQu.js +7 -0
- package/frontend/dist/assets/{search-1chGdDoe.js → search-09qCXbdG.js} +1 -1
- package/frontend/dist/assets/select-De5oupVM.js +1 -0
- package/frontend/dist/assets/tabs-CQZcN-v5.js +7 -0
- package/frontend/dist/assets/textarea-Ge2i0ho4.js +1 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/MobilePage-FMVoG0Pl.js +0 -14
- package/frontend/dist/assets/OfficePreview-DQ8oitRF.js +0 -2
- package/frontend/dist/assets/index-2wJikgEX.js +0 -75
- package/frontend/dist/assets/index-61v6oszV.css +0 -1
- package/frontend/dist/assets/select-YkUpG7ZI.js +0 -1
- package/frontend/dist/assets/tabs-C3yC9N14.js +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,j as t,a3 as n,a7 as r,R as o,ab as l,ad as a,ba as s,a5 as i,br as c,bC as d,a8 as u,a6 as p,ac as f,aa as m,b3 as h,a4 as v,ae as g,ag as x,ah as y,ai as w,aj as b,ak as S,al as C,d as j,y as N}from"./index-BjydjBX7.js";import{u as R,c as _,C as P}from"./index-Di-Iyd_L.js";import{C as I}from"./chevron-down-efPsOYlh.js";function E(n){const r=k(n),o=e.forwardRef((n,o)=>{const{children:l,...a}=n,s=e.Children.toArray(l),i=s.find(D);if(i){const n=i.props.children,l=s.map(t=>t===i?e.Children.count(n)>1?e.Children.only(null):e.isValidElement(n)?n.props.children:null:t);return t.jsx(r,{...a,ref:o,children:e.isValidElement(n)?e.cloneElement(n,void 0,l):null})}return t.jsx(r,{...a,ref:o,children:l})});return o.displayName=`${n}.Slot`,o}function k(t){const r=e.forwardRef((t,r)=>{const{children:o,...l}=t;if(e.isValidElement(o)){const t=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o),a=function(e,t){const n={...t};for(const r in t){const o=e[r],l=t[r];/^on[A-Z]/.test(r)?o&&l?n[r]=(...e)=>{const t=l(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...l}:"className"===r&&(n[r]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}(l,o.props);return o.type!==e.Fragment&&(a.ref=r?n(r,t):t),e.cloneElement(o,a)}return e.Children.count(o)>1?e.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var T=Symbol("radix.slottable");function D(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===T}function M(e){const n=e+"CollectionProvider",[a,s]=r(n),[i,c]=a(n,{collectionRef:{current:null},itemMap:new Map}),d=e=>{const{scope:n,children:r}=e,l=o.useRef(null),a=o.useRef(new Map).current;return t.jsx(i,{scope:n,itemMap:a,collectionRef:l,children:r})};d.displayName=n;const u=e+"CollectionSlot",p=E(u),f=o.forwardRef((e,n)=>{const{scope:r,children:o}=e,a=c(u,r),s=l(n,a.collectionRef);return t.jsx(p,{ref:s,children:o})});f.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",v=E(m),g=o.forwardRef((e,n)=>{const{scope:r,children:a,...s}=e,i=o.useRef(null),d=l(n,i),u=c(m,r);return o.useEffect(()=>(u.itemMap.set(i,{ref:i,...s}),()=>{u.itemMap.delete(i)})),t.jsx(v,{[h]:"",ref:d,children:a})});return g.displayName=m,[{Provider:d,Slot:f,ItemSlot:g},function(t){const n=c(e+"CollectionConsumer",t);return o.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},s]}function O(n){const r=A(n),o=e.forwardRef((n,o)=>{const{children:l,...a}=n,s=e.Children.toArray(l),i=s.find(L);if(i){const n=i.props.children,l=s.map(t=>t===i?e.Children.count(n)>1?e.Children.only(null):e.isValidElement(n)?n.props.children:null:t);return t.jsx(r,{...a,ref:o,children:e.isValidElement(n)?e.cloneElement(n,void 0,l):null})}return t.jsx(r,{...a,ref:o,children:l})});return o.displayName=`${n}.Slot`,o}function A(t){const r=e.forwardRef((t,r)=>{const{children:o,...l}=t;if(e.isValidElement(o)){const t=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(o),a=function(e,t){const n={...t};for(const r in t){const o=e[r],l=t[r];/^on[A-Z]/.test(r)?o&&l?n[r]=(...e)=>{const t=l(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...l}:"className"===r&&(n[r]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}(l,o.props);return o.type!==e.Fragment&&(a.ref=r?n(r,t):t),e.cloneElement(o,a)}return e.Children.count(o)>1?e.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var V=Symbol("radix.slottable");function L(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===V}function H(t){const n=e.useRef({value:t,previous:t});return e.useMemo(()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous),[t])}var W=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});e.forwardRef((e,n)=>t.jsx(a.span,{...e,ref:n,style:{...W,...e.style}})).displayName="VisuallyHidden";var B=[" ","Enter","ArrowUp","ArrowDown"],F=[" ","Enter"],K="Select",[z,U,q]=M(K),[$]=r(K,[q,u]),Z=u(),[X,Y]=$(K),[G,J]=$(K),Q=n=>{const{__scopeSelect:r,children:o,open:l,defaultOpen:a,onOpenChange:d,value:u,defaultValue:p,onValueChange:f,dir:m,name:h,autoComplete:v,disabled:g,required:x,form:y}=n,w=Z(r),[b,S]=e.useState(null),[C,j]=e.useState(null),[N,_]=e.useState(!1),P=R(m),[I,E]=s({prop:l,defaultProp:a??!1,onChange:d,caller:K}),[k,T]=s({prop:u,defaultProp:p,onChange:f,caller:K}),D=e.useRef(null),M=!b||(y||!!b.closest("form")),[O,A]=e.useState(new Set),V=Array.from(O).map(e=>e.props.value).join(";");return t.jsx(i,{...w,children:t.jsxs(X,{required:x,scope:r,trigger:b,onTriggerChange:S,valueNode:C,onValueNodeChange:j,valueNodeHasChildren:N,onValueNodeHasChildrenChange:_,contentId:c(),value:k,onValueChange:T,open:I,onOpenChange:E,dir:P,triggerPointerDownPosRef:D,disabled:g,children:[t.jsx(z.Provider,{scope:r,children:t.jsx(G,{scope:n.__scopeSelect,onNativeOptionAdd:e.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:e.useCallback(e=>{A(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:o})}),M?t.jsxs(He,{"aria-hidden":!0,required:x,tabIndex:-1,name:h,autoComplete:v,value:k,onChange:e=>T(e.target.value),disabled:g,form:y,children:[void 0===k?t.jsx("option",{value:""}):null,Array.from(O)]},V):null]})})};Q.displayName=K;var ee="SelectTrigger",te=e.forwardRef((n,r)=>{const{__scopeSelect:o,disabled:s=!1,...i}=n,c=Z(o),d=Y(ee,o),u=d.disabled||s,m=l(r,d.onTriggerChange),h=U(o),v=e.useRef("touch"),[g,x,y]=Be(e=>{const t=h().filter(e=>!e.disabled),n=t.find(e=>e.value===d.value),r=Fe(t,e,n);void 0!==r&&d.onValueChange(r.value)}),w=e=>{u||(d.onOpenChange(!0),y()),e&&(d.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(p,{asChild:!0,...c,children:t.jsx(a.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":We(d.value)?"":void 0,...i,ref:m,onClick:f(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==v.current&&w(e)}),onPointerDown:f(i.onPointerDown,e=>{v.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(w(e),e.preventDefault())}),onKeyDown:f(i.onKeyDown,e=>{const t=""!==g.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||x(e.key),t&&" "===e.key||B.includes(e.key)&&(w(),e.preventDefault())})})})});te.displayName=ee;var ne="SelectValue",re=e.forwardRef((e,n)=>{const{__scopeSelect:r,className:o,style:s,children:i,placeholder:c="",...u}=e,p=Y(ne,r),{onValueNodeHasChildrenChange:f}=p,m=void 0!==i,h=l(n,p.onValueNodeChange);return d(()=>{f(m)},[f,m]),t.jsx(a.span,{...u,ref:h,style:{pointerEvents:"none"},children:We(p.value)?t.jsx(t.Fragment,{children:c}):i})});re.displayName=ne;var oe=e.forwardRef((e,n)=>{const{__scopeSelect:r,children:o,...l}=e;return t.jsx(a.span,{"aria-hidden":!0,...l,ref:n,children:o||"▼"})});oe.displayName="SelectIcon";var le=e=>t.jsx(m,{asChild:!0,...e});le.displayName="SelectPortal";var ae="SelectContent",se=e.forwardRef((n,r)=>{const o=Y(ae,n.__scopeSelect),[l,a]=e.useState();if(d(()=>{a(new DocumentFragment)},[]),!o.open){const e=l;return e?h.createPortal(t.jsx(ce,{scope:n.__scopeSelect,children:t.jsx(z.Slot,{scope:n.__scopeSelect,children:t.jsx("div",{children:n.children})})}),e):null}return t.jsx(pe,{...n,ref:r})});se.displayName=ae;var ie=10,[ce,de]=$(ae),ue=O("SelectContent.RemoveScroll"),pe=e.forwardRef((n,r)=>{const{__scopeSelect:o,position:a="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:c,side:d,sideOffset:u,align:p,alignOffset:m,arrowPadding:h,collisionBoundary:v,collisionPadding:S,sticky:C,hideWhenDetached:j,avoidCollisions:N,...R}=n,_=Y(ae,o),[P,I]=e.useState(null),[E,k]=e.useState(null),T=l(r,e=>I(e)),[D,M]=e.useState(null),[O,A]=e.useState(null),V=U(o),[L,H]=e.useState(!1),W=e.useRef(!1);e.useEffect(()=>{if(P)return g(P)},[P]),x();const B=e.useCallback(e=>{const[t,...n]=V().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const l of e){if(l===o)return;if(null==l||l.scrollIntoView({block:"nearest"}),l===t&&E&&(E.scrollTop=0),l===r&&E&&(E.scrollTop=E.scrollHeight),null==l||l.focus(),document.activeElement!==o)return}},[V,E]),F=e.useCallback(()=>B([D,P]),[B,D,P]);e.useEffect(()=>{L&&F()},[L,F]);const{onOpenChange:K,triggerPointerDownPosRef:z}=_;e.useEffect(()=>{if(P){let e={x:0,y:0};const t=t=>{var n,r;e={x:Math.abs(Math.round(t.pageX)-((null==(n=z.current)?void 0:n.x)??0)),y:Math.abs(Math.round(t.pageY)-((null==(r=z.current)?void 0:r.y)??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():P.contains(n.target)||K(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[P,K,z]),e.useEffect(()=>{const e=()=>K(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[K]);const[q,$]=Be(e=>{const t=V().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Fe(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),Z=e.useCallback((e,t,n)=>{const r=!W.current&&!n;(void 0!==_.value&&_.value===t||r)&&(M(e),r&&(W.current=!0))},[_.value]),X=e.useCallback(()=>null==P?void 0:P.focus(),[P]),G=e.useCallback((e,t,n)=>{const r=!W.current&&!n;(void 0!==_.value&&_.value===t||r)&&A(e)},[_.value]),J="popper"===a?me:fe,Q=J===me?{side:d,sideOffset:u,align:p,alignOffset:m,arrowPadding:h,collisionBoundary:v,collisionPadding:S,sticky:C,hideWhenDetached:j,avoidCollisions:N}:{};return t.jsx(ce,{scope:o,content:P,viewport:E,onViewportChange:k,itemRefCallback:Z,selectedItem:D,onItemLeave:X,itemTextRefCallback:G,focusSelectedItem:F,selectedItemText:O,position:a,isPositioned:L,searchRef:q,children:t.jsx(y,{as:ue,allowPinchZoom:!0,children:t.jsx(w,{asChild:!0,trapped:_.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:f(s,e=>{var t;null==(t=_.trigger)||t.focus({preventScroll:!0}),e.preventDefault()}),children:t.jsx(b,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:t.jsx(J,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:e=>e.preventDefault(),...R,...Q,onPlaced:()=>H(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:f(R.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||$(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=V().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>B(t)),e.preventDefault()}})})})})})})});pe.displayName="SelectContentImpl";var fe=e.forwardRef((n,r)=>{const{__scopeSelect:o,onPlaced:s,...i}=n,c=Y(ae,o),u=de(ae,o),[p,f]=e.useState(null),[m,h]=e.useState(null),v=l(r,e=>h(e)),g=U(o),x=e.useRef(!1),y=e.useRef(!0),{viewport:w,selectedItem:b,selectedItemText:S,focusSelectedItem:C}=u,j=e.useCallback(()=>{if(c.trigger&&c.valueNode&&p&&m&&w&&b&&S){const e=c.trigger.getBoundingClientRect(),t=m.getBoundingClientRect(),n=c.valueNode.getBoundingClientRect(),r=S.getBoundingClientRect();if("rtl"!==c.dir){const o=r.left-t.left,l=n.left-o,a=e.left-l,s=e.width+a,i=Math.max(s,t.width),c=window.innerWidth-ie,d=_(l,[ie,Math.max(ie,c-i)]);p.style.minWidth=s+"px",p.style.left=d+"px"}else{const o=t.right-r.right,l=window.innerWidth-n.right-o,a=window.innerWidth-e.right-l,s=e.width+a,i=Math.max(s,t.width),c=window.innerWidth-ie,d=_(l,[ie,Math.max(ie,c-i)]);p.style.minWidth=s+"px",p.style.right=d+"px"}const o=g(),l=window.innerHeight-2*ie,a=w.scrollHeight,i=window.getComputedStyle(m),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),f=parseInt(i.borderBottomWidth,10),h=d+u+a+parseInt(i.paddingBottom,10)+f,v=Math.min(5*b.offsetHeight,h),y=window.getComputedStyle(w),C=parseInt(y.paddingTop,10),j=parseInt(y.paddingBottom,10),N=e.top+e.height/2-ie,R=l-N,P=b.offsetHeight/2,I=d+u+(b.offsetTop+P),E=h-I;if(I<=N){const e=o.length>0&&b===o[o.length-1].ref.current;p.style.bottom="0px";const t=m.clientHeight-w.offsetTop-w.offsetHeight,n=I+Math.max(R,P+(e?j:0)+t+f);p.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;p.style.top="0px";const t=Math.max(N,d+w.offsetTop+(e?C:0)+P)+E;p.style.height=t+"px",w.scrollTop=I-N+w.offsetTop}p.style.margin=`${ie}px 0`,p.style.minHeight=v+"px",p.style.maxHeight=l+"px",null==s||s(),requestAnimationFrame(()=>x.current=!0)}},[g,c.trigger,c.valueNode,p,m,w,b,S,c.dir,s]);d(()=>j(),[j]);const[N,R]=e.useState();d(()=>{m&&R(window.getComputedStyle(m).zIndex)},[m]);const P=e.useCallback(e=>{e&&!0===y.current&&(j(),null==C||C(),y.current=!1)},[j,C]);return t.jsx(he,{scope:o,contentWrapper:p,shouldExpandOnScrollRef:x,onScrollButtonChange:P,children:t.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:t.jsx(a.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});fe.displayName="SelectItemAlignedPosition";var me=e.forwardRef((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:l=ie,...a}=e,s=Z(r);return t.jsx(S,{...s,...a,ref:n,align:o,collisionPadding:l,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});me.displayName="SelectPopperPosition";var[he,ve]=$(ae,{}),ge="SelectViewport",xe=e.forwardRef((n,r)=>{const{__scopeSelect:o,nonce:s,...i}=n,c=de(ge,o),d=ve(ge,o),u=l(r,c.onViewportChange),p=e.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),t.jsx(z.Slot,{scope:o,children:t.jsx(a.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:f(i.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=d;if((null==r?void 0:r.current)&&n){const e=Math.abs(p.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*ie,o=parseFloat(n.style.minHeight),l=parseFloat(n.style.height),a=Math.max(o,l);if(a<r){const o=a+e,l=Math.min(r,o),s=o-l;n.style.height=l+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}p.current=t.scrollTop})})})]})});xe.displayName=ge;var ye="SelectGroup",[we,be]=$(ye);e.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,l=c();return t.jsx(we,{scope:r,id:l,children:t.jsx(a.div,{role:"group","aria-labelledby":l,...o,ref:n})})}).displayName=ye;var Se="SelectLabel",Ce=e.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,l=be(Se,r);return t.jsx(a.div,{id:l.id,...o,ref:n})});Ce.displayName=Se;var je="SelectItem",[Ne,Re]=$(je),_e=e.forwardRef((n,r)=>{const{__scopeSelect:o,value:s,disabled:i=!1,textValue:d,...u}=n,p=Y(je,o),m=de(je,o),h=p.value===s,[v,g]=e.useState(d??""),[x,y]=e.useState(!1),w=l(r,e=>{var t;return null==(t=m.itemRefCallback)?void 0:t.call(m,e,s,i)}),b=c(),S=e.useRef("touch"),C=()=>{i||(p.onValueChange(s),p.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(Ne,{scope:o,value:s,disabled:i,textId:b,isSelected:h,onItemTextChange:e.useCallback(e=>{g(t=>t||((null==e?void 0:e.textContent)??"").trim())},[]),children:t.jsx(z.ItemSlot,{scope:o,value:s,disabled:i,textValue:v,children:t.jsx(a.div,{role:"option","aria-labelledby":b,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:w,onFocus:f(u.onFocus,()=>y(!0)),onBlur:f(u.onBlur,()=>y(!1)),onClick:f(u.onClick,()=>{"mouse"!==S.current&&C()}),onPointerUp:f(u.onPointerUp,()=>{"mouse"===S.current&&C()}),onPointerDown:f(u.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:f(u.onPointerMove,e=>{var t;S.current=e.pointerType,i?null==(t=m.onItemLeave)||t.call(m):"mouse"===S.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:f(u.onPointerLeave,e=>{var t;e.currentTarget===document.activeElement&&(null==(t=m.onItemLeave)||t.call(m))}),onKeyDown:f(u.onKeyDown,e=>{var t;""!==(null==(t=m.searchRef)?void 0:t.current)&&" "===e.key||(F.includes(e.key)&&C()," "===e.key&&e.preventDefault())})})})})});_e.displayName=je;var Pe="SelectItemText",Ie=e.forwardRef((n,r)=>{const{__scopeSelect:o,className:s,style:i,...c}=n,u=Y(Pe,o),p=de(Pe,o),f=Re(Pe,o),m=J(Pe,o),[v,g]=e.useState(null),x=l(r,e=>g(e),f.onItemTextChange,e=>{var t;return null==(t=p.itemTextRefCallback)?void 0:t.call(p,e,f.value,f.disabled)}),y=null==v?void 0:v.textContent,w=e.useMemo(()=>t.jsx("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:b,onNativeOptionRemove:S}=m;return d(()=>(b(w),()=>S(w)),[b,S,w]),t.jsxs(t.Fragment,{children:[t.jsx(a.span,{id:f.textId,...c,ref:x}),f.isSelected&&u.valueNode&&!u.valueNodeHasChildren?h.createPortal(c.children,u.valueNode):null]})});Ie.displayName=Pe;var Ee="SelectItemIndicator",ke=e.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e;return Re(Ee,r).isSelected?t.jsx(a.span,{"aria-hidden":!0,...o,ref:n}):null});ke.displayName=Ee;var Te="SelectScrollUpButton",De=e.forwardRef((n,r)=>{const o=de(Te,n.__scopeSelect),a=ve(Te,n.__scopeSelect),[s,i]=e.useState(!1),c=l(r,a.onScrollButtonChange);return d(()=>{if(o.viewport&&o.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=o.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[o.viewport,o.isPositioned]),s?t.jsx(Ae,{...n,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});De.displayName=Te;var Me="SelectScrollDownButton",Oe=e.forwardRef((n,r)=>{const o=de(Me,n.__scopeSelect),a=ve(Me,n.__scopeSelect),[s,i]=e.useState(!1),c=l(r,a.onScrollButtonChange);return d(()=>{if(o.viewport&&o.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;i(n)};const t=o.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[o.viewport,o.isPositioned]),s?t.jsx(Ae,{...n,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Oe.displayName=Me;var Ae=e.forwardRef((n,r)=>{const{__scopeSelect:o,onAutoScroll:l,...s}=n,i=de("SelectScrollButton",o),c=e.useRef(null),u=U(o),p=e.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return e.useEffect(()=>()=>p(),[p]),d(()=>{var e;const t=u().find(e=>e.ref.current===document.activeElement);null==(e=null==t?void 0:t.ref.current)||e.scrollIntoView({block:"nearest"})},[u]),t.jsx(a.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:f(s.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(l,50))}),onPointerMove:f(s.onPointerMove,()=>{var e;null==(e=i.onItemLeave)||e.call(i),null===c.current&&(c.current=window.setInterval(l,50))}),onPointerLeave:f(s.onPointerLeave,()=>{p()})})}),Ve=e.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(a.div,{"aria-hidden":!0,...o,ref:n})});Ve.displayName="SelectSeparator";var Le="SelectArrow";e.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,l=Z(r),a=Y(Le,r),s=de(Le,r);return a.open&&"popper"===s.position?t.jsx(C,{...l,...o,ref:n}):null}).displayName=Le;var He=e.forwardRef(({__scopeSelect:n,value:r,...o},s)=>{const i=e.useRef(null),c=l(s,i),d=H(r);return e.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(d!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[d,r]),t.jsx(a.select,{...o,style:{...W,...o.style},ref:c,defaultValue:r})});function We(e){return""===e||void 0===e}function Be(t){const n=v(t),r=e.useRef(""),o=e.useRef(0),l=e.useCallback(e=>{const t=r.current+e;n(t),function e(t){r.current=t,window.clearTimeout(o.current),""!==t&&(o.current=window.setTimeout(()=>e(""),1e3))}(t)},[n]),a=e.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return e.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,l,a]}function Fe(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=(a=e,s=Math.max(o,0),a.map((e,t)=>a[(s+t)%a.length]));var a,s;1===r.length&&(l=l.filter(e=>e!==n));const i=l.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==n?i:void 0}He.displayName="SelectBubbleInput";var Ke=te,ze=oe,Ue=le,qe=se,$e=xe,Ze=Ce,Xe=_e,Ye=Ie,Ge=ke,Je=De,Qe=Oe,et=Ve;const tt=Q,nt=re,rt=e.forwardRef(({className:e,children:n,...r},o)=>t.jsxs(Ke,{ref:o,className:j("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,t.jsx(ze,{asChild:!0,children:t.jsx(I,{className:"h-4 w-4 opacity-50"})})]}));rt.displayName=Ke.displayName;const ot=e.forwardRef(({className:e,...n},r)=>t.jsx(Je,{ref:r,className:j("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(P,{className:"h-4 w-4"})}));ot.displayName=Je.displayName;const lt=e.forwardRef(({className:e,...n},r)=>t.jsx(Qe,{ref:r,className:j("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(I,{className:"h-4 w-4"})}));lt.displayName=Qe.displayName;const at=e.forwardRef(({className:e,children:n,position:r="popper",...o},l)=>t.jsx(Ue,{children:t.jsxs(qe,{ref:l,className:j("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[t.jsx(ot,{}),t.jsx($e,{className:j("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(lt,{})]})}));at.displayName=qe.displayName;e.forwardRef(({className:e,...n},r)=>t.jsx(Ze,{ref:r,className:j("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...n})).displayName=Ze.displayName;const st=e.forwardRef(({className:e,children:n,...r},o)=>t.jsxs(Xe,{ref:o,className:j("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Ge,{children:t.jsx(N,{className:"h-4 w-4"})})}),t.jsx(Ye,{children:n})]}));st.displayName=Xe.displayName;e.forwardRef(({className:e,...n},r)=>t.jsx(et,{ref:r,className:j("-mx-1 my-1 h-px bg-muted",e),...n})).displayName=et.displayName;export{tt as S,rt as a,nt as b,M as c,at as d,st as e,H as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as e,r as t,j as o,br as a,ad as n,ac as r,a7 as i,ab as s,ba as c,a4 as l,a9 as u,d}from"./index-BjydjBX7.js";import{c as f}from"./select-De5oupVM.js";import{u as p}from"./index-Di-Iyd_L.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.309.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const v=e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var b="rovingFocusGroup.onEntryFocus",m={bubbles:!1,cancelable:!0},g="RovingFocusGroup",[h,y,w]=f(g),[x,I]=i(g,[w]),[R,T]=x(g),j=t.forwardRef((e,t)=>o.jsx(h.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(h.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(F,{...e,ref:t})})}));j.displayName=g;var F=t.forwardRef((e,a)=>{const{__scopeRovingFocusGroup:i,orientation:u,loop:d=!1,dir:f,currentTabStopId:v,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:w,onEntryFocus:x,preventScrollOnEntryFocus:I=!1,...T}=e,j=t.useRef(null),F=s(a,j),C=p(f),[N,D]=c({prop:v,defaultProp:h??null,onChange:w,caller:g}),[A,_]=t.useState(!1),E=l(x),k=y(i),M=t.useRef(!1),[K,z]=t.useState(0);return t.useEffect(()=>{const e=j.current;if(e)return e.addEventListener(b,E),()=>e.removeEventListener(b,E)},[E]),o.jsx(R,{scope:i,orientation:u,dir:C,loop:d,currentTabStopId:N,onItemFocus:t.useCallback(e=>D(e),[D]),onItemShiftTab:t.useCallback(()=>_(!0),[]),onFocusableItemAdd:t.useCallback(()=>z(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>z(e=>e-1),[]),children:o.jsx(n.div,{tabIndex:A||0===K?-1:0,"data-orientation":u,...T,ref:F,style:{outline:"none",...e.style},onMouseDown:r(e.onMouseDown,()=>{M.current=!0}),onFocus:r(e.onFocus,e=>{const t=!M.current;if(e.target===e.currentTarget&&t&&!A){const t=new CustomEvent(b,m);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=k().filter(e=>e.focusable);S([e.find(e=>e.active),e.find(e=>e.id===N),...e].filter(Boolean).map(e=>e.ref.current),I)}}M.current=!1}),onBlur:r(e.onBlur,()=>_(!1))})})}),C="RovingFocusGroupItem",N=t.forwardRef((e,i)=>{const{__scopeRovingFocusGroup:s,focusable:c=!0,active:l=!1,tabStopId:u,children:d,...f}=e,p=a(),v=u||p,b=T(C,s),m=b.currentTabStopId===v,g=y(s),{onFocusableItemAdd:w,onFocusableItemRemove:x,currentTabStopId:I}=b;return t.useEffect(()=>{if(c)return w(),()=>x()},[c,w,x]),o.jsx(h.ItemSlot,{scope:s,id:v,focusable:c,active:l,children:o.jsx(n.span,{tabIndex:m?0:-1,"data-orientation":b.orientation,...f,ref:i,onMouseDown:r(e.onMouseDown,e=>{c?b.onItemFocus(v):e.preventDefault()}),onFocus:r(e.onFocus,()=>b.onItemFocus(v)),onKeyDown:r(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void b.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,o){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,o);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)?void 0:D[a]}(e,b.orientation,b.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=g().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const r=n.indexOf(e.currentTarget);n=b.loop?(a=r+1,(o=n).map((e,t)=>o[(a+t)%o.length])):n.slice(r+1)}setTimeout(()=>S(n))}var o,a}),children:"function"==typeof d?d({isCurrentTabStop:m,hasTabStop:null!=I}):d})})});N.displayName=C;var D={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function S(e,t=!1){const o=document.activeElement;for(const a of e){if(a===o)return;if(a.focus({preventScroll:t}),document.activeElement!==o)return}}var A=j,_=N,E="Tabs",[k]=i(E,[I]),M=I(),[K,z]=k(E),G=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,onValueChange:s,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:f="automatic",...v}=e,b=p(d),[m,g]=c({prop:i,onChange:s,defaultProp:l??"",caller:E});return o.jsx(K,{scope:r,baseId:a(),value:m,onValueChange:g,orientation:u,dir:b,activationMode:f,children:o.jsx(n.div,{dir:b,"data-orientation":u,...v,ref:t})})});G.displayName=E;var L="TabsList",P=t.forwardRef((e,t)=>{const{__scopeTabs:a,loop:r=!0,...i}=e,s=z(L,a),c=M(a);return o.jsx(A,{asChild:!0,...c,orientation:s.orientation,dir:s.dir,loop:r,children:o.jsx(n.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:t})})});P.displayName=L;var V="TabsTrigger",U=t.forwardRef((e,t)=>{const{__scopeTabs:a,value:i,disabled:s=!1,...c}=e,l=z(V,a),u=M(a),d=H(l.baseId,i),f=O(l.baseId,i),p=i===l.value;return o.jsx(_,{asChild:!0,...u,focusable:!s,active:p,children:o.jsx(n.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...c,ref:t,onMouseDown:r(e.onMouseDown,e=>{s||0!==e.button||!1!==e.ctrlKey?e.preventDefault():l.onValueChange(i)}),onKeyDown:r(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&l.onValueChange(i)}),onFocus:r(e.onFocus,()=>{const e="manual"!==l.activationMode;p||s||!e||l.onValueChange(i)})})})});U.displayName=V;var $="TabsContent",B=t.forwardRef((e,a)=>{const{__scopeTabs:r,value:i,forceMount:s,children:c,...l}=e,d=z($,r),f=H(d.baseId,i),p=O(d.baseId,i),v=i===d.value,b=t.useRef(v);return t.useEffect(()=>{const e=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(e)},[]),o.jsx(u,{present:s||v,children:({present:t})=>o.jsx(n.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":f,hidden:!t,id:p,tabIndex:0,...l,ref:a,style:{...e.style,animationDuration:b.current?"0s":void 0},children:t&&c})})});function H(e,t){return`${e}-trigger-${t}`}function O(e,t){return`${e}-content-${t}`}B.displayName=$;var q=P,J=U,Q=B;const W=G,X=t.forwardRef(({className:e,...t},a)=>o.jsx(q,{ref:a,className:d("flex rounded-md bg-muted p-1 text-muted-foreground data-[orientation=horizontal]:h-10 data-[orientation=horizontal]:items-center data-[orientation=horizontal]:justify-center data-[orientation=horizontal]:inline-flex data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-center data-[orientation=vertical]:justify-start",e),...t}));X.displayName=q.displayName;const Y=t.forwardRef(({className:e,...t},a)=>o.jsx(J,{ref:a,className:d("inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[orientation=horizontal]:px-3 data-[orientation=horizontal]:py-1.5",e),...t}));Y.displayName=J.displayName;const Z=t.forwardRef(({className:e,...t},a)=>o.jsx(Q,{ref:a,className:d("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Z.displayName=Q.displayName;export{_ as I,A as R,W as T,v as U,X as a,Y as b,Z as c,I as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,j as r,d as s}from"./index-BjydjBX7.js";const o=e.forwardRef(({className:e,...o},a)=>r.jsx("textarea",{className:s("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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:a,...o}));o.displayName="Textarea";export{o as T};
|
package/frontend/dist/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
11
11
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
12
12
|
<title>CC Web</title>
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-BjydjBX7.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DS0RkMkF.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-DQ8oitRF.js","assets/index-2wJikgEX.js","assets/index-61v6oszV.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as e,aI as t,bx as s,aK as a,r as n,bs as r,by as l,bz as o,j as c,bA as i,m as d,d as u,bv as x,bB as m,bC as h,bD as p,bE as f,bF as b,bG as g,bH as j,ak as v,aj as y,bI as N,bJ as w,t as k,ai as C,aD as S,bK as I,U as P,bL as M,a as z,b as _,g as U,D as T,h as E,R as A,_ as D,l as L,X as $,p as R,aX as F,bM as H,C as O,A as q,q as W}from"./index-2wJikgEX.js";import{A as B,g as K,i as V,T as G,j as J,F as X,G as Q,M as Y,r as Z,a as ee,b as te,c as se,e as ae,h as ne,o as re,d as le,I as oe}from"./ChatOverlay-BYHxECck.js";import{C as ce}from"./index-DrpeVVUe.js";import{C as ie}from"./chevron-down-BPnYeDMC.js";import{F as de}from"./file-text-CPajDnww.js";import"./check-circle-2-DqS6oPDV.js";
|
|
3
|
-
/**
|
|
4
|
-
* @license lucide-react v0.309.0 - ISC
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the ISC license.
|
|
7
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/const ue=e("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),xe=e("FileCode",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]),me=e("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),he=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),pe=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;
|
|
9
|
-
/**
|
|
10
|
-
* @license lucide-react v0.309.0 - ISC
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the ISC license.
|
|
13
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/function fe({onSelectProject:e}){const f=t(),b=s(e=>e.clearToken),{projects:g,fetchProjects:j,hasFetched:v,loading:y}=a(),N=n.useCallback(()=>{a.getState().setProjects([]),sessionStorage.removeItem("ccweb_claudemem_available"),b(),f("/login")},[b,f]),[w,k]=n.useState(new Map),[C,S]=n.useState(new Set),[I,P]=n.useState(!1),[M,z]=n.useState(()=>"1"===sessionStorage.getItem("ccweb_claudemem_available"));n.useEffect(()=>{null===sessionStorage.getItem("ccweb_claudemem_available")&&(async()=>{var e;const t=await r(),s=!!((null==t?void 0:t.available)&&((null==(e=t.counts)?void 0:e.observations)??0)>0);sessionStorage.setItem("ccweb_claudemem_available",s?"1":"0"),z(s)})()},[]),n.useEffect(()=>{j()},[j]);const _=n.useCallback(e=>{e.status&&k(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&S(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);l({onActivityUpdate:_});const{applyOrder:U}=o(),T=U(g.filter(e=>!e.archived));return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[c.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),c.jsx(i,{}),c.jsx("button",{onClick:()=>{(async()=>{P(!0);try{await j()}finally{P(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:I,"aria-label":"Refresh",children:c.jsx(d,{className:u("h-4 w-4",I&&"animate-spin")})}),M&&c.jsx("button",{onClick:()=>f("/memories"),className:"text-muted-foreground active:text-foreground","aria-label":"Memories",children:c.jsx(x,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>f("/settings"),className:"text-muted-foreground active:text-foreground","aria-label":"Settings",children:c.jsx(m,{className:"h-4 w-4"})}),c.jsx("button",{onClick:N,className:"text-muted-foreground active:text-foreground","aria-label":"Logout",children:c.jsx(h,{className:"h-4 w-4"})}),!pe&&c.jsx("button",{onClick:()=>f("/"),className:"text-muted-foreground active:text-foreground","aria-label":"Desktop mode",children:c.jsx(p,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[y&&!v&&c.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),v&&0===T.length&&c.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:T.map(t=>{var s;const a="running"===(s=t,w.get(s.id)??s.status??"stopped"),n=C.has(t.id),r=c.jsxs("button",{onClick:()=>e(t.id),className:u("w-full text-left rounded-xl border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[c.jsx("span",{className:u("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),c.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),c.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return c.jsx("div",{className:n?"card-active-glow rounded-xl":void 0,children:r},t.id)})})]})]})}function be(e){if(!e.phase)return null;if("thinking"===e.phase)return"思考中";if("tool_result"===e.phase)return"处理结果";if("tool_use"===e.phase){const t=(e.detail||"").toLowerCase();return"bash"===t?"执行命令":"read"===t?"读取文件":"edit"===t||"multiedit"===t?"编辑文件":"write"===t?"写入文件":"grep"===t?"搜索内容":"glob"===t?"匹配文件":"webfetch"===t||"websearch"===t?"访问网络":"task"===t?"调度子任务":"todowrite"===t?"更新任务列表":"notebookedit"===t?"编辑 Notebook":e.detail?`调用 ${e.detail}`:"调用工具"}return null}function ge({project:e,onBack:t,onOpenPanel:s,onContextUpdate:a}){const[r,l]=n.useState(""),o=n.useRef(null),i=n.useRef(null),[d,x]=n.useState([]),m=n.useCallback(e=>{x(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),h=n.useRef(null),p=n.useCallback(e=>{var t;"stopped"===e&&(null==(t=h.current)||t.call(h,"stopped"))},[]),[z,_]=n.useState(null);n.useEffect(()=>{const t=t=>{const s=t.detail;s&&s.projectId===e.id&&("cli_prompt_detected"===s.type?_({kind:s.kind,label:s.label,detectedAt:s.detectedAt,options:s.options}):"cli_prompt_dismissed"===s.type&&_(e=>(null==e?void 0:e.kind)===s.kind?null:e))};return window.addEventListener("ccweb:cli-prompt-msg",t),()=>window.removeEventListener("ccweb:cli-prompt-msg",t)},[e.id]);const[U,T]=n.useState([]),E=n.useRef(new Set),A=n.useCallback(e=>{E.current.has(e.toolUseId)||T(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),D=n.useCallback(e=>{E.current.add(e.toolUseId),T(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),L=n.useCallback(e=>{E.current.add(e),T(t=>t.filter(t=>t.toolUseId!==e))},[]),[$,R]=n.useState(null),F=n.useRef(0),H=n.useCallback(e=>{var t,s,a;if(!e.active)return void R(null);if("text"===(null==(t=e.semantic)?void 0:t.phase))return void R(null);const n=null==(s=e.semantic)?void 0:s.phase,r=null==(a=e.semantic)?void 0:a.detail;R(e=>e?e.phase===n&&e.detail===r?e:{...e,phase:n,detail:r}:{id:"mab"+ ++F.current,phase:n,detail:r})},[]),{sendInput:O,connected:q}=f({projectId:e.id,enabled:!0,onChatMessage:m,onStatusChange:p,onContextUpdate:a,onApprovalRequest:A,onApprovalResolved:D,onSemanticUpdate:H});n.useEffect(()=>{let t=!1;if(_(null),q)return b(e.id).then(e=>{!t&&e.active&&_({kind:e.active.kind,label:e.active.label,detectedAt:e.active.detectedAt,options:e.active.options})}).catch(()=>{}),()=>{t=!0}},[e.id,q]),n.useEffect(()=>{if(!q)return;if("claude"!==e.cliTool)return;let t=!1;return g(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!E.current.has(e.toolUseId));T(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||E.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,q]);const{state:W,setState:Y,messages:Z,hasMoreHistory:ee,loadMoreHistory:te,sendMessage:se,isWaking:ae}=j({project:e,liveMessages:d,ws:{send:O,connected:q},historyLimit:20});h.current=Y;const ne=n.useRef(q);n.useEffect(()=>{!ne.current&&q&&x([]),ne.current=q},[q]);const re=(()=>{for(let e=Z.length-1;e>=0;e--)if("assistant"===Z[e].role)return e;return-1})(),[le,oe]=n.useState([]),[de,xe]=n.useState([]),[me,pe]=n.useState(null),[fe,ge]=n.useState(null),je=n.useRef(!1);n.useEffect(()=>{v().then(oe).catch(()=>{}),y(e.id).then(xe).catch(()=>{})},[e.id]);const ve=n.useCallback(e=>{const t=i.current;if(!t)return void l(t=>t+e);const s=t.selectionStart??r.length,a=t.selectionEnd??r.length,n=r.slice(0,s)+e+r.slice(a);l(n),requestAnimationFrame(()=>{t.focus();const a=s+e.length;t.setSelectionRange(a,a),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"})},[r]),ye=n.useCallback(e=>{pe(null),ve(e+" ")},[ve]),Ne=n.useCallback(t=>{const s=e.folderPath;let a=t;s&&(t===s||t.startsWith(s+"/")||t.startsWith(s+"\\"))&&(a=t.slice(s.length).replace(/^[/\\]+/,"")),pe(null),ve(`@${a} `)},[e.folderPath,ve]),we=n.useCallback(async()=>{if("skills"!==me){if(!je.current){je.current=!0;try{const t=await N(e.cliTool??"claude",e.id);ge(t)}catch{ge({builtin:[],custom:[],plugins:[],mcp:[]})}finally{je.current=!1}}pe("skills")}else pe(null)},[me,e.cliTool,e.id]),ke=n.useCallback(async()=>{const e=o.current,t=(null==e?void 0:e.scrollHeight)??0;await te(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[te]),Ce=n.useRef(0);n.useEffect(()=>{const e=o.current;if(!e)return;const t=Z.length>Ce.current,s=0===Ce.current&&Z.length>0;Ce.current=Z.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[Z,U.length]);const[Se,Ie]=n.useState(!1),Pe=n.useCallback(async()=>{const e=r.trim();if(!e||Se)return;Ie(!0);const t=await se(e);Ie(!1),"delivered"===t&&(l(""),i.current&&(i.current.style.height="auto"))},[r,Se,se]),Me=w(Pe,"shift"),ze=n.useCallback(async(t,s)=>{pe(null);try{"failed"===await se(t.command)?k.error("快捷命令未送达,请重试或检查会话"):"project"===s&&C(e.id,t.id,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})}catch(a){console.error("Shortcut send error:",a),k.error("快捷命令发送失败")}},[se,e.id]),_e="live"===W;return c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[c.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:c.jsx(S,{className:"h-5 w-5"})}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[c.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),c.jsx("span",{className:u("w-2 h-2 rounded-full shrink-0",_e?"bg-green-500":ae?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),c.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:c.jsx(he,{className:"h-5 w-5"})})]}),c.jsxs("div",{ref:o,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[ee&&c.jsx("div",{className:"flex justify-center pb-1",children:c.jsxs("button",{onClick:()=>{ke()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[c.jsx(ce,{className:"h-3 w-3"}),"加载更早消息"]})}),Z.map((e,t)=>{const s="user"===e.role;return c.jsx("div",{className:u("flex",s?"justify-end":"justify-start"),children:c.jsx("div",{className:u("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:c.jsx(B,{content:e.content,blocks:e.blocks,isLatest:t===re})})},e.id)}),U.map(e=>c.jsx(K,{approval:e,onResolved:L},e.toolUseId)),z&&c.jsx(V,{prompt:z,onSelect:async t=>{await I(e.id,t)}}),$&&0===U.length&&c.jsx("div",{className:"flex justify-start",children:c.jsxs("div",{className:"rounded-2xl rounded-bl-md px-3 py-1.5 bg-black/5 dark:bg-white/10 border border-black/10 dark:border-white/15 flex items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(G,{}),be($)&&c.jsx("span",{children:be($)})]})},$.id),0===Z.length&&0===U.length&&!$&&"stopped"===W&&c.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),ae&&c.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),"global"===me||"project"===me?c.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:c.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===me?le:de).map(e=>c.jsxs("button",{onClick:()=>ze(e,me),disabled:ae,className:u("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",ae&&"opacity-50 cursor-not-allowed"),children:[c.jsx("div",{className:"font-medium text-xs",children:e.label}),c.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===me?le:de).length&&c.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}):"skills"===me&&fe?c.jsx("div",{className:"border-t border-border shrink-0",children:c.jsx(J,{data:fe,onCommand:ye})}):"files"===me&&e.folderPath?c.jsx("div",{className:"border-t border-border shrink-0",children:c.jsx(X,{projectPath:e.folderPath,onSelect:Ne})}):null,c.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[c.jsx("button",{onClick:()=>{we()},title:"斜杠命令",className:u("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","skills"===me?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:"/"}),c.jsx("button",{onClick:()=>pe(e=>"files"===e?null:"files"),disabled:!e.folderPath,title:"引用文件",className:u("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","files"===me?"bg-accent text-foreground font-medium":e.folderPath?"text-muted-foreground active:bg-accent":"text-muted-foreground/30 cursor-not-allowed"),children:"@"}),le.length>0&&c.jsxs("button",{onClick:()=>pe(e=>"global"===e?null:"global"),className:u("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===me?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[c.jsx(Q,{className:"h-3 w-3"}),"全局","global"===me&&c.jsx(ie,{className:"h-3 w-3"})]}),de.length>0&&c.jsxs("button",{onClick:()=>pe(e=>"project"===e?null:"project"),className:u("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===me?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[c.jsx(ue,{className:"h-3 w-3"}),"项目","project"===me&&c.jsx(ie,{className:"h-3 w-3"})]})]}),c.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:c.jsxs("div",{className:"flex items-end gap-2",children:[c.jsx("textarea",{ref:i,value:r,onChange:e=>l(e.target.value),onKeyDown:Me,disabled:ae||Se,placeholder:ae?"启动中...":Se?"发送中…":"stopped"===W?"输入消息(自动启动)...":"输入消息...",rows:1,className:u("flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",(ae||Se)&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),c.jsx("button",{onClick:Pe,disabled:ae||Se||!r.trim(),className:u("shrink-0 p-2 rounded-md transition-colors",r.trim()&&!Se?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:Se?c.jsx(P,{className:"h-5 w-5 animate-spin"}):c.jsx(M,{className:"h-5 w-5"})})]})})]})}const je=A.lazy(()=>D(()=>import("./OfficePreview-DQ8oitRF.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),ve=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ye=new Set(["docx","xlsx","xls","pptx"]),Ne={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function we(e){return e.split("/").pop()??e}function ke({filePath:e,onBack:t}){const[s,a]=n.useState(null),[r,l]=n.useState(!0),[o,i]=n.useState(null),{resolved:d}=z(),u=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),x=ve.has(u),m=ye.has(u),h=Ne[u],p="dark"===d;n.useEffect(()=>{x||m?l(!1):(l(!0),i(null),_(e).then(a).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>l(!1)))},[e,x,m]);const f=E(e),b=n.useMemo(()=>{const e=U();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),g=n.useMemo(()=>x?`${b}&t=${Date.now()}`:"",[b,x]);return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[c.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:c.jsx(S,{className:"h-5 w-5"})}),c.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:we(e)}),c.jsx("a",{href:b,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:c.jsx(T,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(P,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),o&&c.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:o}),x&&c.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:c.jsx("img",{src:g,alt:we(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&c.jsx(n.Suspense,{fallback:c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(P,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:c.jsx(je,{filePath:e,ext:u,zoom:100})}),s&&(s.binary||s.tooLarge)&&c.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[c.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${j=s.size,j<1024?`${j} B`:j<1048576?`${(j/1024).toFixed(1)} KB`:`${(j/1048576).toFixed(1)} MB`})`]}),c.jsxs("a",{href:b,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[c.jsx(T,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&c.jsxs(c.Fragment,{children:["md"===u&&c.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:c.jsx(Y,{remarkPlugins:[ee,te],rehypePlugins:[Z],urlTransform:(e,t,s)=>"src"===t&&"img"===s.tagName?e:ae(e),components:{img:({src:t,alt:s,...a})=>c.jsx("img",{...a,src:se(e,t,U()),alt:s??"",loading:"lazy",style:{maxWidth:"100%",height:"auto"}})},children:s.content})}),"md"!==u&&h&&c.jsx(ne,{language:h,style:p?re:le,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==u&&!h&&c.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var j}const Ce=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),Se=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),Ie=new Set(["json","yaml","yml","toml","csv","tsv"]);function Pe({entry:e}){if("dir"===e.type)return c.jsx(R,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return Ce.has(t)?c.jsx(oe,{className:"h-8 w-8 text-emerald-400"}):Se.has(t)?c.jsx(xe,{className:"h-8 w-8 text-orange-400"}):Ie.has(t)?c.jsx(me,{className:"h-8 w-8 text-yellow-400"}):"md"===t?c.jsx(de,{className:"h-8 w-8 text-sky-400"}):c.jsx(F,{className:"h-8 w-8 text-muted-foreground"})}function Me({rootPath:e,onClose:t}){const[s,a]=n.useState(e),[r,l]=n.useState([]),[o,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useCallback(async e=>{i(!0);try{const t=[...(await L(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));l(t),a(e)}catch{l([])}finally{i(!1)}},[]);n.useEffect(()=>{x(e)},[e,x]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?c.jsx(ke,{filePath:d,onBack:()=>u(null)}):c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[c.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:c.jsx($,{className:"h-5 w-5"})}),c.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&c.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&x(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:c.jsx(S,{className:"h-4 w-4"})}),c.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[o&&c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(P,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!o&&0===r.length&&c.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!o&&c.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>c.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?x(e.path):u(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-md active:bg-accent transition-colors",children:[c.jsx(Pe,{entry:e}),c.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function ze(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function _e(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function Ue({projectName:e,cliTool:t,folderPath:s,contextData:a,onClose:r}){const[l,o]=n.useState(new Set(["context","usage","files"])),[i,x]=n.useState(null),[m,h]=n.useState(!1),p=e=>{o(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};n.useEffect(()=>{h(!0),H(t).then(x).catch(()=>x(null)).finally(()=>h(!1))},[t]);const f=a?Math.round(a.usedPercentage):null;return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[c.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:c.jsx($,{className:"h-5 w-5"})}),c.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto",children:[c.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("context")?c.jsx(ie,{className:"h-3.5 w-3.5 text-muted-foreground"}):c.jsx(O,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&c.jsxs("span",{className:u("text-xs font-mono ml-auto",ze(f)),children:[f,"%"]})]}),l.has("context")&&c.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&a?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:c.jsx("div",{className:u("h-full rounded-full transition-all",_e(f)),style:{width:`${Math.min(f,100)}%`}})}),c.jsxs("span",{className:u("text-xs font-mono w-10 text-right",ze(f)),children:[f,"%"]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[c.jsx("span",{children:"窗口大小"}),c.jsx("span",{className:"text-right font-mono",children:a.contextWindowSize>=1e6?`${(a.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(a.contextWindowSize/1e3)}K`}),c.jsx("span",{children:"输入 tokens"}),c.jsx("span",{className:"text-right font-mono",children:a.inputTokens.toLocaleString()}),c.jsx("span",{children:"输出 tokens"}),c.jsx("span",{className:"text-right font-mono",children:a.outputTokens.toLocaleString()})]})]}):c.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),c.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[l.has("usage")?c.jsx(ie,{className:"h-3.5 w-3.5 text-muted-foreground"}):c.jsx(O,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium",children:"用量"}),c.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await D(async()=>{const{refreshUsage:e}=await import("./index-2wJikgEX.js").then(e=>e.b_);return{refreshUsage:e}},__vite__mapDeps([1,2]));x(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:c.jsx(d,{className:u("h-3 w-3",m&&"animate-spin")})})]}),l.has("usage")&&c.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:i?c.jsxs("div",{className:"space-y-2",children:[i.planName&&c.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",c.jsx("span",{className:"font-medium text-foreground",children:i.planName})]}),c.jsx(Te,{label:"5h",bucket:i.fiveHour}),c.jsx(Te,{label:"7d",bucket:i.sevenDay}),i.sevenDaySonnet&&c.jsx(Te,{label:"7d Sonnet",bucket:i.sevenDaySonnet}),i.sevenDayOpus&&c.jsx(Te,{label:"7d Opus",bucket:i.sevenDayOpus}),!i.fiveHour&&!i.sevenDay&&c.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):c.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),c.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("files")?c.jsx(ie,{className:"h-3.5 w-3.5 text-muted-foreground"}):c.jsx(O,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),l.has("files")&&c.jsx("div",{className:"h-[60vh]",children:c.jsx(Me,{rootPath:s,onClose:()=>p("files")})})]})]})}function Te({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),c.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:c.jsx("div",{className:u("h-full rounded-full",_e(s)),style:{width:`${Math.min(s,100)}%`}})}),c.jsxs("span",{className:u("text-xs font-mono w-8 text-right",ze(s)),children:[s,"%"]}),a&&c.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function Ee(){n.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=n.useState({screen:"list"}),[s,r]=n.useState(null),l=a(e=>e.projects),o=n.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=n.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=n.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),u="list"!==e.screen?l.find(t=>t.id===e.projectId):void 0;return c.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[c.jsxs(q,{mode:"wait",children:["list"===e.screen&&c.jsx(W.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:c.jsx(fe,{onSelectProject:o})},"list"),"chat"===e.screen&&u&&c.jsx(W.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:c.jsx(ge,{project:u,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),c.jsx(q,{children:"panel"===e.screen&&u&&c.jsx(W.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:c.jsx(Ue,{projectName:u.name,cliTool:u.cliTool??"claude",folderPath:u.folderPath,contextData:s,onClose:d})},"panel")})]})}export{Ee as MobilePage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Di5Ntujm.js","assets/index-2wJikgEX.js","assets/index-61v6oszV.css","assets/jszip.min-BxSvgCaf.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,r as t,_ as s,g as r,h as a}from"./index-2wJikgEX.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-Di5Ntujm.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-BxSvgCaf.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-xl p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
|