@nextclaw/ui 0.9.2 → 0.9.3

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.
Files changed (81) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/assets/ChannelsList-ZBPiF0y2.js +1 -0
  3. package/dist/assets/ChatPage-BOgoolWK.js +38 -0
  4. package/dist/assets/{DocBrowser-CVwUDJMO.js → DocBrowser-BUYNHg0Y.js} +1 -1
  5. package/dist/assets/LogoBadge-DXPq99LJ.js +1 -0
  6. package/dist/assets/MarketplacePage-Dx7nexYN.js +49 -0
  7. package/dist/assets/McpMarketplacePage-064wdotP.js +40 -0
  8. package/dist/assets/{ModelConfig-CsX-_fyy.js → ModelConfig-BDIfLesG.js} +1 -1
  9. package/dist/assets/ProvidersList-DrlIr46m.js +1 -0
  10. package/dist/assets/RemoteAccessPage-ZkUBA-Av.js +1 -0
  11. package/dist/assets/{RuntimeConfig-CX2TGEG1.js → RuntimeConfig-BPxXEGzM.js} +1 -1
  12. package/dist/assets/{SearchConfig-C-WBTcWi.js → SearchConfig-BIqnlpne.js} +1 -1
  13. package/dist/assets/{SecretsConfig-9kbR0ZCB.js → SecretsConfig-jKZEVF2q.js} +2 -2
  14. package/dist/assets/{SessionsConfig-Bohn3P1q.js → SessionsConfig-C_FXgVe1.js} +2 -2
  15. package/dist/assets/{chat-message-AWIcksDK.js → chat-message-DmzpZJc_.js} +1 -1
  16. package/dist/assets/index-Byfw276e.js +8 -0
  17. package/dist/assets/{index-CPDASUXh.js → index-Ct7FQpxN.js} +1 -1
  18. package/dist/assets/index-bhNuQis7.css +1 -0
  19. package/dist/assets/{label-DD61y-4v.js → label-B1MloEtn.js} +1 -1
  20. package/dist/assets/marketplace-localization-Dk31LJJJ.js +1 -0
  21. package/dist/assets/{page-layout-CfnoVycc.js → page-layout-BGg1EhM5.js} +1 -1
  22. package/dist/assets/{popover-DsugZ6rp.js → popover-jJMv74Fp.js} +1 -1
  23. package/dist/assets/{security-config-DIrf2Z0O.js → security-config-Boh9NIMz.js} +1 -1
  24. package/dist/assets/skeleton-CmATs_b3.js +1 -0
  25. package/dist/assets/status-dot-DNyCdxPZ.js +1 -0
  26. package/dist/assets/{switch-NX5OmUXQ.js → switch-DE_MYk7x.js} +1 -1
  27. package/dist/assets/{tabs-custom-9ihB5Jem.js → tabs-custom-B-zErYPr.js} +1 -1
  28. package/dist/assets/{useConfirmDialog-BuQnVTeR.js → useConfirmDialog-BqQ6QfhB.js} +2 -2
  29. package/dist/assets/{vendor-DKBNiC31.js → vendor-CwsIoNvJ.js} +128 -93
  30. package/dist/index.html +3 -3
  31. package/package.json +4 -4
  32. package/src/App.tsx +4 -0
  33. package/src/api/auth.types.ts +24 -0
  34. package/src/api/chat-session-type.types.ts +21 -0
  35. package/src/api/marketplace.ts +8 -2
  36. package/src/api/mcp-marketplace.ts +138 -0
  37. package/src/api/remote.ts +57 -0
  38. package/src/api/remote.types.ts +80 -0
  39. package/src/api/types.ts +28 -34
  40. package/src/components/chat/ChatSidebar.test.tsx +31 -2
  41. package/src/components/chat/ChatSidebar.tsx +26 -2
  42. package/src/components/chat/chat-page-data.ts +36 -38
  43. package/src/components/chat/chat-page-runtime.test.ts +96 -2
  44. package/src/components/chat/chat-page-runtime.ts +1 -135
  45. package/src/components/chat/chat-session-preference-governance.ts +303 -0
  46. package/src/components/chat/legacy/LegacyChatPage.tsx +4 -19
  47. package/src/components/chat/ncp/NcpChatPage.tsx +4 -19
  48. package/src/components/chat/ncp/ncp-chat-page-data.test.ts +36 -0
  49. package/src/components/chat/ncp/ncp-chat-page-data.ts +62 -21
  50. package/src/components/chat/ncp/ncp-session-adapter.test.ts +2 -0
  51. package/src/components/chat/ncp/ncp-session-adapter.ts +2 -0
  52. package/src/components/chat/stores/chat-input.store.ts +14 -1
  53. package/src/components/chat/useChatSessionTypeState.test.tsx +29 -0
  54. package/src/components/chat/useChatSessionTypeState.ts +55 -12
  55. package/src/components/layout/Sidebar.tsx +11 -1
  56. package/src/components/marketplace/MarketplacePage.test.tsx +152 -0
  57. package/src/components/marketplace/MarketplacePage.tsx +52 -199
  58. package/src/components/marketplace/marketplace-installed-cache.test.ts +110 -0
  59. package/src/components/marketplace/marketplace-installed-cache.ts +149 -0
  60. package/src/components/marketplace/marketplace-localization.ts +77 -0
  61. package/src/components/marketplace/marketplace-page-parts.tsx +102 -0
  62. package/src/components/marketplace/mcp/McpMarketplacePage.test.tsx +208 -0
  63. package/src/components/marketplace/mcp/McpMarketplacePage.tsx +578 -0
  64. package/src/components/remote/RemoteAccessPage.tsx +320 -0
  65. package/src/components/ui/input.tsx +1 -1
  66. package/src/components/ui/label.tsx +1 -1
  67. package/src/hooks/useMarketplace.ts +36 -7
  68. package/src/hooks/useMcpMarketplace.ts +99 -0
  69. package/src/hooks/useRemoteAccess.ts +92 -0
  70. package/src/hooks/useWebSocket.ts +25 -16
  71. package/src/lib/i18n.marketplace.ts +91 -0
  72. package/src/lib/i18n.remote.ts +115 -0
  73. package/src/lib/i18n.ts +10 -68
  74. package/dist/assets/ChannelsList-DKD6Llid.js +0 -1
  75. package/dist/assets/ChatPage-BK9X4Tin.js +0 -38
  76. package/dist/assets/LogoBadge-CYQ_b7jk.js +0 -1
  77. package/dist/assets/MarketplacePage-B_2z3ii_.js +0 -49
  78. package/dist/assets/ProvidersList-CZstsyv7.js +0 -1
  79. package/dist/assets/index-BEgClaDH.js +0 -8
  80. package/dist/assets/index-C8GsgIUn.css +0 -1
  81. package/dist/assets/skeleton-DJ-Wen2o.js +0 -1
@@ -1 +1 @@
1
- import{r as l,az as L,j as c,aA as $,aB as G,aC as A,aD as O,aE as P,aF as _,aG as w,aH as H,aI as K,aJ as B,aK as J,aL as Q,aM as U,aN as V,aO as W,aP as Z,aQ as q}from"./vendor-DKBNiC31.js";import{P as E}from"./index-CPDASUXh.js";import{c as X}from"./index-BEgClaDH.js";var m="Popover",[b]=K(m,[w]),g=w(),[Y,d]=b(m),j=e=>{const{__scopePopover:n,children:t,open:a,defaultOpen:o,onOpenChange:r,modal:s=!1}=e,i=g(n),p=l.useRef(null),[u,h]=l.useState(!1),[C,f]=L({prop:a,defaultProp:o??!1,onChange:r,caller:m});return c.jsx($,{...i,children:c.jsx(Y,{scope:n,contentId:G(),triggerRef:p,open:C,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(x=>!x),[f]),hasCustomAnchor:u,onCustomAnchorAdd:l.useCallback(()=>h(!0),[]),onCustomAnchorRemove:l.useCallback(()=>h(!1),[]),modal:s,children:t})})};j.displayName=m;var N="PopoverAnchor",y=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=d(N,t),r=g(t),{onCustomAnchorAdd:s,onCustomAnchorRemove:i}=o;return l.useEffect(()=>(s(),()=>i()),[s,i]),c.jsx(_,{...r,...a,ref:n})});y.displayName=N;var F="PopoverTrigger",S=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=d(F,t),r=g(t),s=A(n,o.triggerRef),i=c.jsx(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":k(o.open),...a,ref:s,onClick:P(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:c.jsx(_,{asChild:!0,...r,children:i})});S.displayName=F;var R="PopoverPortal",[ee,oe]=b(R,{forceMount:void 0}),D=e=>{const{__scopePopover:n,forceMount:t,children:a,container:o}=e,r=d(R,n);return c.jsx(ee,{scope:n,forceMount:t,children:c.jsx(E,{present:t||r.open,children:c.jsx(H,{asChild:!0,container:o,children:a})})})};D.displayName=R;var v="PopoverContent",M=l.forwardRef((e,n)=>{const t=oe(v,e.__scopePopover),{forceMount:a=t.forceMount,...o}=e,r=d(v,e.__scopePopover);return c.jsx(E,{present:a||r.open,children:r.modal?c.jsx(re,{...o,ref:n}):c.jsx(ne,{...o,ref:n})})});M.displayName=v;var te=Q("PopoverContent.RemoveScroll"),re=l.forwardRef((e,n)=>{const t=d(v,e.__scopePopover),a=l.useRef(null),o=A(n,a),r=l.useRef(!1);return l.useEffect(()=>{const s=a.current;if(s)return B(s)},[]),c.jsx(J,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),r.current||(i=t.triggerRef.current)==null||i.focus()}),onPointerDownOutside:P(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,p=i.button===0&&i.ctrlKey===!0,u=i.button===2||p;r.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:P(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=l.forwardRef((e,n)=>{const t=d(v,e.__scopePopover),a=l.useRef(!1),o=l.useRef(!1);return c.jsx(T,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var s,i;(s=e.onCloseAutoFocus)==null||s.call(e,r),r.defaultPrevented||(a.current||(i=t.triggerRef.current)==null||i.focus(),r.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:r=>{var p,u;(p=e.onInteractOutside)==null||p.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=r.target;((u=t.triggerRef.current)==null?void 0:u.contains(s))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&o.current&&r.preventDefault()}})}),T=l.forwardRef((e,n)=>{const{__scopePopover:t,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:r,disableOutsidePointerEvents:s,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onInteractOutside:h,...C}=e,f=d(v,t),x=g(t);return U(),c.jsx(V,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:r,children:c.jsx(W,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(Z,{"data-state":k(f.open),role:"dialog",id:f.contentId,...x,...C,ref:n,style:{...C.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),I="PopoverClose",ae=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=d(I,t);return c.jsx(O.button,{type:"button",...a,ref:n,onClick:P(e.onClick,()=>o.onOpenChange(!1))})});ae.displayName=I;var se="PopoverArrow",ce=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=g(t);return c.jsx(q,{...o,...a,ref:n})});ce.displayName=se;function k(e){return e?"open":"closed"}var ie=j,Pe=y,le=S,pe=D,z=M;const ge=ie,he=le,ue=l.forwardRef(({className:e,sideOffset:n=8,align:t="start",...a},o)=>c.jsx(pe,{children:c.jsx(z,{ref:o,sideOffset:n,align:t,className:X("z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...a})}));ue.displayName=z.displayName;export{Pe as A,z as C,pe as P,ie as R,le as T,ge as a,he as b,ue as c};
1
+ import{r as l,aA as $,j as c,aB as z,aC as G,aD as A,aE as O,aF as P,aG as _,aH as w,aI as H,aJ as K,aK as B,aL as J,aM as Q,aN as U,aO as V,aP as W,aQ as Z,aR as q}from"./vendor-CwsIoNvJ.js";import{P as E}from"./index-Ct7FQpxN.js";import{c as X}from"./index-Byfw276e.js";var m="Popover",[b]=K(m,[w]),g=w(),[Y,d]=b(m),j=e=>{const{__scopePopover:n,children:t,open:a,defaultOpen:o,onOpenChange:r,modal:s=!1}=e,i=g(n),p=l.useRef(null),[u,h]=l.useState(!1),[C,f]=$({prop:a,defaultProp:o??!1,onChange:r,caller:m});return c.jsx(z,{...i,children:c.jsx(Y,{scope:n,contentId:G(),triggerRef:p,open:C,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(x=>!x),[f]),hasCustomAnchor:u,onCustomAnchorAdd:l.useCallback(()=>h(!0),[]),onCustomAnchorRemove:l.useCallback(()=>h(!1),[]),modal:s,children:t})})};j.displayName=m;var N="PopoverAnchor",y=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=d(N,t),r=g(t),{onCustomAnchorAdd:s,onCustomAnchorRemove:i}=o;return l.useEffect(()=>(s(),()=>i()),[s,i]),c.jsx(_,{...r,...a,ref:n})});y.displayName=N;var F="PopoverTrigger",S=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=d(F,t),r=g(t),s=A(n,o.triggerRef),i=c.jsx(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":k(o.open),...a,ref:s,onClick:P(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:c.jsx(_,{asChild:!0,...r,children:i})});S.displayName=F;var R="PopoverPortal",[ee,oe]=b(R,{forceMount:void 0}),D=e=>{const{__scopePopover:n,forceMount:t,children:a,container:o}=e,r=d(R,n);return c.jsx(ee,{scope:n,forceMount:t,children:c.jsx(E,{present:t||r.open,children:c.jsx(H,{asChild:!0,container:o,children:a})})})};D.displayName=R;var v="PopoverContent",M=l.forwardRef((e,n)=>{const t=oe(v,e.__scopePopover),{forceMount:a=t.forceMount,...o}=e,r=d(v,e.__scopePopover);return c.jsx(E,{present:a||r.open,children:r.modal?c.jsx(re,{...o,ref:n}):c.jsx(ne,{...o,ref:n})})});M.displayName=v;var te=Q("PopoverContent.RemoveScroll"),re=l.forwardRef((e,n)=>{const t=d(v,e.__scopePopover),a=l.useRef(null),o=A(n,a),r=l.useRef(!1);return l.useEffect(()=>{const s=a.current;if(s)return B(s)},[]),c.jsx(J,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),r.current||(i=t.triggerRef.current)==null||i.focus()}),onPointerDownOutside:P(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,p=i.button===0&&i.ctrlKey===!0,u=i.button===2||p;r.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:P(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=l.forwardRef((e,n)=>{const t=d(v,e.__scopePopover),a=l.useRef(!1),o=l.useRef(!1);return c.jsx(T,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var s,i;(s=e.onCloseAutoFocus)==null||s.call(e,r),r.defaultPrevented||(a.current||(i=t.triggerRef.current)==null||i.focus(),r.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:r=>{var p,u;(p=e.onInteractOutside)==null||p.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=r.target;((u=t.triggerRef.current)==null?void 0:u.contains(s))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&o.current&&r.preventDefault()}})}),T=l.forwardRef((e,n)=>{const{__scopePopover:t,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:r,disableOutsidePointerEvents:s,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onInteractOutside:h,...C}=e,f=d(v,t),x=g(t);return U(),c.jsx(V,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:r,children:c.jsx(W,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(Z,{"data-state":k(f.open),role:"dialog",id:f.contentId,...x,...C,ref:n,style:{...C.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),I="PopoverClose",ae=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=d(I,t);return c.jsx(O.button,{type:"button",...a,ref:n,onClick:P(e.onClick,()=>o.onOpenChange(!1))})});ae.displayName=I;var se="PopoverArrow",ce=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,o=g(t);return c.jsx(q,{...o,...a,ref:n})});ce.displayName=se;function k(e){return e?"open":"closed"}var ie=j,Pe=y,le=S,pe=D,L=M;const ge=ie,he=le,ue=l.forwardRef(({className:e,sideOffset:n=8,align:t="start",...a},o)=>c.jsx(pe,{children:c.jsx(L,{ref:o,sideOffset:n,align:t,className:X("z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...a})}));ue.displayName=L.displayName;export{Pe as A,L as C,pe as P,ie as R,le as T,ge as a,he as b,ue as c};
@@ -1 +1 @@
1
- import{r as c,j as e,e as M}from"./vendor-DKBNiC31.js";import{a6 as O,a7 as R,a8 as I,a9 as B,aa as _,C as u,a3 as h,a4 as x,t as s,a5 as m,z as p,B as j,I as l}from"./index-BEgClaDH.js";import{L as o}from"./label-DD61y-4v.js";import{S as z}from"./switch-NX5OmUXQ.js";import{P as G,a as V}from"./page-layout-CfnoVycc.js";const W=8;function A(r){return r.trim().length>=W}function L(r,n){return r!==n?(M.error(s("authPasswordMismatch")),!1):!0}function q(){const r=O(),n=R(),S=I(),g=B(),y=_(),[f,U]=c.useState(""),[i,N]=c.useState(""),[w,b]=c.useState(""),[d,v]=c.useState(""),[P,C]=c.useState(""),t=r.data,E=f.trim().length>0&&A(i)&&i===w&&!n.isPending,D=A(d)&&d===P&&!g.isPending,T=async()=>{if(L(i,w))try{await n.mutateAsync({username:f.trim(),password:i}),N(""),b("")}catch{}},F=async()=>{if(L(d,P))try{await g.mutateAsync({password:d}),v(""),C("")}catch{}},H=async a=>{try{await S.mutateAsync({enabled:a})}catch{}},k=async()=>{try{await y.mutateAsync()}catch{}};return r.isLoading&&!t?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsx(p,{className:"text-sm text-gray-500",children:s("loading")})]}):r.isError||!t?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:s("authStatusLoadFailed")}),e.jsx(j,{variant:"outline",onClick:()=>{r.refetch()},children:s("authRetryStatus")})]})]}):t.configured?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authStatusLabel")}),e.jsx("p",{className:"text-sm text-gray-600",children:s("authStatusConfiguredUser").replace("{username}",t.username??"")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authUsernameFixedHelp")})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700",children:t.enabled?s("enabled"):s("disabled")})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-4 border-t border-gray-200 pt-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authEnableLabel")}),e.jsx("p",{className:"text-xs text-gray-500",children:t.enabled?s("authEnableOnHelp"):s("authEnableOffHelp")})]}),e.jsx(z,{checked:t.enabled,disabled:S.isPending,onCheckedChange:a=>{H(a)}})]})]}),e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authPasswordSectionTitle")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authPasswordSectionDescription")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-password-next",children:s("authPassword")}),e.jsx(l,{id:"auth-password-next",type:"password",value:d,onChange:a=>v(a.target.value),placeholder:s("authPasswordPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-password-confirm",children:s("authConfirmPassword")}),e.jsx(l,{id:"auth-password-confirm",type:"password",value:P,onChange:a=>C(a.target.value),placeholder:s("authConfirmPasswordPlaceholder")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(j,{type:"button",disabled:!D,onClick:()=>void F(),children:g.isPending?s("authPasswordUpdating"):s("authPasswordAction")}),t.enabled&&t.authenticated?e.jsx(j,{type:"button",variant:"outline",disabled:y.isPending,onClick:()=>void k(),children:y.isPending?s("authLoggingOut"):s("authLogoutAction")}):null]}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authSessionMemoryNotice")})]})]})]}):e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-200 bg-gray-50/70 p-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authSetupTitle")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s("authSetupDescription")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-username",children:s("authUsername")}),e.jsx(l,{id:"auth-setup-username",value:f,onChange:a=>U(a.target.value),placeholder:s("authUsernamePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-password",children:s("authPassword")}),e.jsx(l,{id:"auth-setup-password",type:"password",value:i,onChange:a=>N(a.target.value),placeholder:s("authPasswordPlaceholder")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-confirm",children:s("authConfirmPassword")}),e.jsx(l,{id:"auth-setup-confirm",type:"password",value:w,onChange:a=>b(a.target.value),placeholder:s("authConfirmPasswordPlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authPasswordMinLengthHint")})]}),e.jsx(j,{type:"button",disabled:!E,onClick:()=>void T(),children:n.isPending?s("authSettingUp"):s("authSetupAction")})]})]})}function Z(){return e.jsxs(G,{className:"space-y-6",children:[e.jsx(V,{title:s("authSecurityTitle"),description:s("authSecurityDescription")}),e.jsx(q,{})]})}export{Z as SecurityConfig};
1
+ import{r as c,j as e,e as M}from"./vendor-CwsIoNvJ.js";import{a6 as O,a7 as R,a8 as I,a9 as B,aa as _,C as u,a3 as h,a4 as x,t as s,a5 as m,z as p,B as j,I as l}from"./index-Byfw276e.js";import{L as o}from"./label-B1MloEtn.js";import{S as z}from"./switch-DE_MYk7x.js";import{P as G,a as V}from"./page-layout-BGg1EhM5.js";const W=8;function A(r){return r.trim().length>=W}function L(r,n){return r!==n?(M.error(s("authPasswordMismatch")),!1):!0}function q(){const r=O(),n=R(),S=I(),g=B(),y=_(),[f,U]=c.useState(""),[i,N]=c.useState(""),[w,b]=c.useState(""),[d,v]=c.useState(""),[P,C]=c.useState(""),t=r.data,E=f.trim().length>0&&A(i)&&i===w&&!n.isPending,D=A(d)&&d===P&&!g.isPending,T=async()=>{if(L(i,w))try{await n.mutateAsync({username:f.trim(),password:i}),N(""),b("")}catch{}},F=async()=>{if(L(d,P))try{await g.mutateAsync({password:d}),v(""),C("")}catch{}},H=async a=>{try{await S.mutateAsync({enabled:a})}catch{}},k=async()=>{try{await y.mutateAsync()}catch{}};return r.isLoading&&!t?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsx(p,{className:"text-sm text-gray-500",children:s("loading")})]}):r.isError||!t?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:s("authStatusLoadFailed")}),e.jsx(j,{variant:"outline",onClick:()=>{r.refetch()},children:s("authRetryStatus")})]})]}):t.configured?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authStatusLabel")}),e.jsx("p",{className:"text-sm text-gray-600",children:s("authStatusConfiguredUser").replace("{username}",t.username??"")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authUsernameFixedHelp")})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700",children:t.enabled?s("enabled"):s("disabled")})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-4 border-t border-gray-200 pt-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authEnableLabel")}),e.jsx("p",{className:"text-xs text-gray-500",children:t.enabled?s("authEnableOnHelp"):s("authEnableOffHelp")})]}),e.jsx(z,{checked:t.enabled,disabled:S.isPending,onCheckedChange:a=>{H(a)}})]})]}),e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authPasswordSectionTitle")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authPasswordSectionDescription")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-password-next",children:s("authPassword")}),e.jsx(l,{id:"auth-password-next",type:"password",value:d,onChange:a=>v(a.target.value),placeholder:s("authPasswordPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-password-confirm",children:s("authConfirmPassword")}),e.jsx(l,{id:"auth-password-confirm",type:"password",value:P,onChange:a=>C(a.target.value),placeholder:s("authConfirmPasswordPlaceholder")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(j,{type:"button",disabled:!D,onClick:()=>void F(),children:g.isPending?s("authPasswordUpdating"):s("authPasswordAction")}),t.enabled&&t.authenticated?e.jsx(j,{type:"button",variant:"outline",disabled:y.isPending,onClick:()=>void k(),children:y.isPending?s("authLoggingOut"):s("authLogoutAction")}):null]}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authSessionMemoryNotice")})]})]})]}):e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-200 bg-gray-50/70 p-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authSetupTitle")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s("authSetupDescription")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-username",children:s("authUsername")}),e.jsx(l,{id:"auth-setup-username",value:f,onChange:a=>U(a.target.value),placeholder:s("authUsernamePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-password",children:s("authPassword")}),e.jsx(l,{id:"auth-setup-password",type:"password",value:i,onChange:a=>N(a.target.value),placeholder:s("authPasswordPlaceholder")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-confirm",children:s("authConfirmPassword")}),e.jsx(l,{id:"auth-setup-confirm",type:"password",value:w,onChange:a=>b(a.target.value),placeholder:s("authConfirmPasswordPlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authPasswordMinLengthHint")})]}),e.jsx(j,{type:"button",disabled:!E,onClick:()=>void T(),children:n.isPending?s("authSettingUp"):s("authSetupAction")})]})]})}function Z(){return e.jsxs(G,{className:"space-y-6",children:[e.jsx(V,{title:s("authSecurityTitle"),description:s("authSecurityDescription")}),e.jsx(q,{})]})}export{Z as SecurityConfig};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-CwsIoNvJ.js";import{c as o}from"./index-Byfw276e.js";function m({className:e,...s}){return t.jsx("div",{className:o("animate-pulse rounded-md bg-slate-200",e),...s})}export{m as S};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-CwsIoNvJ.js";import{c as a}from"./index-Byfw276e.js";const n={active:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},ready:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},inactive:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},setup:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},warning:{dot:"bg-amber-400",text:"text-amber-600",bg:"bg-amber-50"}};function m({status:r,label:s,className:g}){const t=n[r];return e.jsxs("div",{className:a("inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5",t.bg,g),children:[e.jsx("span",{className:a("h-1.5 w-1.5 rounded-full",t.dot)}),e.jsx("span",{className:a("text-[11px] font-medium",t.text),children:s})]})}export{m as S};
@@ -1 +1 @@
1
- import{r as e,j as i}from"./vendor-DKBNiC31.js";import{c as t}from"./index-BEgClaDH.js";const l=e.forwardRef(({className:o,checked:r=!1,onCheckedChange:s,...a},n)=>i.jsx("button",{type:"button",role:"switch","aria-checked":r,ref:n,className:t("peer inline-flex h-[22px] w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",r?"bg-primary":"bg-gray-200/80 hover:bg-gray-300/80",o),onClick:()=>s==null?void 0:s(!r),...a,children:i.jsx("span",{className:t("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-fast",r?"translate-x-5":"translate-x-0")})}));l.displayName="Switch";export{l as S};
1
+ import{r as e,j as i}from"./vendor-CwsIoNvJ.js";import{c as t}from"./index-Byfw276e.js";const l=e.forwardRef(({className:o,checked:r=!1,onCheckedChange:s,...a},n)=>i.jsx("button",{type:"button",role:"switch","aria-checked":r,ref:n,className:t("peer inline-flex h-[22px] w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",r?"bg-primary":"bg-gray-200/80 hover:bg-gray-300/80",o),onClick:()=>s==null?void 0:s(!r),...a,children:i.jsx("span",{className:t("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-fast",r?"translate-x-5":"translate-x-0")})}));l.displayName="Switch";export{l as S};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-DKBNiC31.js";import{ag as m,c as a}from"./index-BEgClaDH.js";function c({tabs:s,activeTab:i,onChange:o,className:n}){return e.jsx("div",{className:a("flex items-center gap-6 border-b border-gray-200/60 mb-6",n),children:s.map(t=>{const r=i===t.id;return e.jsxs("button",{onClick:()=>o(t.id),className:a("relative pb-3 text-[14px] font-medium transition-all duration-fast flex items-center gap-1.5",r?"text-gray-900":"text-gray-600 hover:text-gray-900"),children:[t.label,t.count!==void 0&&e.jsx("span",{className:a("text-[11px] font-medium","text-gray-500"),children:m(t.count)}),r&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-primary rounded-full"})]},t.id)})})}export{c as T};
1
+ import{j as e}from"./vendor-CwsIoNvJ.js";import{ag as m,c as a}from"./index-Byfw276e.js";function c({tabs:s,activeTab:i,onChange:o,className:n}){return e.jsx("div",{className:a("flex items-center gap-6 border-b border-gray-200/60 mb-6",n),children:s.map(t=>{const r=i===t.id;return e.jsxs("button",{onClick:()=>o(t.id),className:a("relative pb-3 text-[14px] font-medium transition-all duration-fast flex items-center gap-1.5",r?"text-gray-900":"text-gray-600 hover:text-gray-900"),children:[t.label,t.count!==void 0&&e.jsx("span",{className:a("text-[11px] font-medium","text-gray-500"),children:m(t.count)}),r&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-primary rounded-full"})]},t.id)})})}export{c as T};
@@ -1,5 +1,5 @@
1
- import{r as i,az as ee,j as a,aB as N,aH as te,aD as D,aE as v,aI as oe,aC as b,aJ as ae,aK as ne,aM as re,aN as se,aO as ie,aL as le,a_ as ce,aw as de}from"./vendor-DKBNiC31.js";import{P as R}from"./index-CPDASUXh.js";import{c as m,B as P,t as p}from"./index-BEgClaDH.js";var C="Dialog",[O]=oe(C),[ue,u]=O(C),I=e=>{const{__scopeDialog:o,children:n,open:r,defaultOpen:s,onOpenChange:t,modal:l=!0}=e,c=i.useRef(null),d=i.useRef(null),[f,x]=ee({prop:r,defaultProp:s??!1,onChange:t,caller:C});return a.jsx(ue,{scope:o,triggerRef:c,contentRef:d,contentId:N(),titleId:N(),descriptionId:N(),open:f,onOpenChange:x,onOpenToggle:i.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};I.displayName=C;var w="DialogTrigger",fe=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(w,n),t=b(o,s.triggerRef);return a.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":E(s.open),...r,ref:t,onClick:v(e.onClick,s.onOpenToggle)})});fe.displayName=w;var j="DialogPortal",[ge,A]=O(j,{forceMount:void 0}),T=e=>{const{__scopeDialog:o,forceMount:n,children:r,container:s}=e,t=u(j,o);return a.jsx(ge,{scope:o,forceMount:n,children:i.Children.map(r,l=>a.jsx(R,{present:n||t.open,children:a.jsx(te,{asChild:!0,container:s,children:l})}))})};T.displayName=j;var h="DialogOverlay",M=i.forwardRef((e,o)=>{const n=A(h,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,t=u(h,e.__scopeDialog);return t.modal?a.jsx(R,{present:r||t.open,children:a.jsx(me,{...s,ref:o})}):null});M.displayName=h;var pe=le("DialogOverlay.RemoveScroll"),me=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(h,n);return a.jsx(ne,{as:pe,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(D.div,{"data-state":E(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),g="DialogContent",F=i.forwardRef((e,o)=>{const n=A(g,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,t=u(g,e.__scopeDialog);return a.jsx(R,{present:r||t.open,children:t.modal?a.jsx(xe,{...s,ref:o}):a.jsx(ve,{...s,ref:o})})});F.displayName=g;var xe=i.forwardRef((e,o)=>{const n=u(g,e.__scopeDialog),r=i.useRef(null),s=b(o,n.contentRef,r);return i.useEffect(()=>{const t=r.current;if(t)return ae(t)},[]),a.jsx(L,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:v(e.onCloseAutoFocus,t=>{var l;t.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:v(e.onPointerDownOutside,t=>{const l=t.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&t.preventDefault()}),onFocusOutside:v(e.onFocusOutside,t=>t.preventDefault())})}),ve=i.forwardRef((e,o)=>{const n=u(g,e.__scopeDialog),r=i.useRef(!1),s=i.useRef(!1);return a.jsx(L,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,t),t.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),t.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:t=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=t.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&s.current&&t.preventDefault()}})}),L=i.forwardRef((e,o)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:t,...l}=e,c=u(g,n),d=i.useRef(null),f=b(o,d);return re(),a.jsxs(a.Fragment,{children:[a.jsx(se,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:t,children:a.jsx(ie,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":E(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(De,{titleId:c.titleId}),a.jsx(Ce,{contentRef:d,descriptionId:c.descriptionId})]})]})}),_="DialogTitle",S=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(_,n);return a.jsx(D.h2,{id:s.titleId,...r,ref:o})});S.displayName=_;var k="DialogDescription",W=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(k,n);return a.jsx(D.p,{id:s.descriptionId,...r,ref:o})});W.displayName=k;var $="DialogClose",G=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u($,n);return a.jsx(D.button,{type:"button",...r,ref:o,onClick:v(e.onClick,()=>s.onOpenChange(!1))})});G.displayName=$;function E(e){return e?"open":"closed"}var B="DialogTitleWarning",[we,z]=ce(B,{contentName:g,titleName:_,docsSlug:"dialog"}),De=({titleId:e})=>{const o=z(B),n=`\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
1
+ import{r as i,aA as ee,j as a,aC as b,aI as te,aE as D,aF as v,aJ as oe,aD as N,aK as ae,aL as ne,aN as re,aO as se,aP as ie,aM as le,b5 as ce,ax as de}from"./vendor-CwsIoNvJ.js";import{P as R}from"./index-Ct7FQpxN.js";import{c as m,B as P,t as p}from"./index-Byfw276e.js";var C="Dialog",[O]=oe(C),[ue,u]=O(C),I=e=>{const{__scopeDialog:o,children:n,open:r,defaultOpen:s,onOpenChange:t,modal:l=!0}=e,c=i.useRef(null),d=i.useRef(null),[f,x]=ee({prop:r,defaultProp:s??!1,onChange:t,caller:C});return a.jsx(ue,{scope:o,triggerRef:c,contentRef:d,contentId:b(),titleId:b(),descriptionId:b(),open:f,onOpenChange:x,onOpenToggle:i.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};I.displayName=C;var w="DialogTrigger",fe=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(w,n),t=N(o,s.triggerRef);return a.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":E(s.open),...r,ref:t,onClick:v(e.onClick,s.onOpenToggle)})});fe.displayName=w;var j="DialogPortal",[ge,A]=O(j,{forceMount:void 0}),T=e=>{const{__scopeDialog:o,forceMount:n,children:r,container:s}=e,t=u(j,o);return a.jsx(ge,{scope:o,forceMount:n,children:i.Children.map(r,l=>a.jsx(R,{present:n||t.open,children:a.jsx(te,{asChild:!0,container:s,children:l})}))})};T.displayName=j;var h="DialogOverlay",M=i.forwardRef((e,o)=>{const n=A(h,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,t=u(h,e.__scopeDialog);return t.modal?a.jsx(R,{present:r||t.open,children:a.jsx(me,{...s,ref:o})}):null});M.displayName=h;var pe=le("DialogOverlay.RemoveScroll"),me=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(h,n);return a.jsx(ne,{as:pe,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(D.div,{"data-state":E(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),g="DialogContent",F=i.forwardRef((e,o)=>{const n=A(g,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,t=u(g,e.__scopeDialog);return a.jsx(R,{present:r||t.open,children:t.modal?a.jsx(xe,{...s,ref:o}):a.jsx(ve,{...s,ref:o})})});F.displayName=g;var xe=i.forwardRef((e,o)=>{const n=u(g,e.__scopeDialog),r=i.useRef(null),s=N(o,n.contentRef,r);return i.useEffect(()=>{const t=r.current;if(t)return ae(t)},[]),a.jsx(L,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:v(e.onCloseAutoFocus,t=>{var l;t.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:v(e.onPointerDownOutside,t=>{const l=t.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&t.preventDefault()}),onFocusOutside:v(e.onFocusOutside,t=>t.preventDefault())})}),ve=i.forwardRef((e,o)=>{const n=u(g,e.__scopeDialog),r=i.useRef(!1),s=i.useRef(!1);return a.jsx(L,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,t),t.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),t.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:t=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=t.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&s.current&&t.preventDefault()}})}),L=i.forwardRef((e,o)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:t,...l}=e,c=u(g,n),d=i.useRef(null),f=N(o,d);return re(),a.jsxs(a.Fragment,{children:[a.jsx(se,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:t,children:a.jsx(ie,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":E(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(De,{titleId:c.titleId}),a.jsx(Ce,{contentRef:d,descriptionId:c.descriptionId})]})]})}),_="DialogTitle",S=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(_,n);return a.jsx(D.h2,{id:s.titleId,...r,ref:o})});S.displayName=_;var k="DialogDescription",W=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u(k,n);return a.jsx(D.p,{id:s.descriptionId,...r,ref:o})});W.displayName=k;var $="DialogClose",G=i.forwardRef((e,o)=>{const{__scopeDialog:n,...r}=e,s=u($,n);return a.jsx(D.button,{type:"button",...r,ref:o,onClick:v(e.onClick,()=>s.onOpenChange(!1))})});G.displayName=$;function E(e){return e?"open":"closed"}var B="DialogTitleWarning",[we,z]=ce(B,{contentName:g,titleName:_,docsSlug:"dialog"}),De=({titleId:e})=>{const o=z(B),n=`\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},he="DialogDescriptionWarning",Ce=({contentRef:e,descriptionId:o})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${z(he).contentName}}.`;return i.useEffect(()=>{var t;const s=(t=e.current)==null?void 0:t.getAttribute("aria-describedby");o&&s&&(document.getElementById(o)||console.warn(r))},[r,e,o]),null},ye=I,Ne=T,H=M,K=F,V=S,q=W,be=G;const Re=ye,je=Ne,J=i.forwardRef(({className:e,...o},n)=>a.jsx(H,{ref:n,className:m("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...o}));J.displayName=H.displayName;const U=i.forwardRef(({className:e,children:o,...n},r)=>a.jsxs(je,{children:[a.jsx(J,{}),a.jsxs(K,{ref:r,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base 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%] rounded-2xl",e),...n,children:[o,a.jsxs(be,{className:"absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(de,{className:"h-4 w-4 text-gray-500"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));U.displayName=K.displayName;const X=({className:e,...o})=>a.jsx("div",{className:m("flex flex-col space-y-2 text-center sm:text-left",e),...o});X.displayName="DialogHeader";const Y=({className:e,...o})=>a.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...o});Y.displayName="DialogFooter";const Z=i.forwardRef(({className:e,...o},n)=>a.jsx(V,{ref:n,className:m("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...o}));Z.displayName=V.displayName;const Q=i.forwardRef(({className:e,...o},n)=>a.jsx(q,{ref:n,className:m("text-sm text-gray-500 leading-relaxed",e),...o}));Q.displayName=q.displayName;const _e=({open:e,onOpenChange:o,title:n,description:r,confirmLabel:s=p("confirm"),cancelLabel:t=p("cancel"),variant:l="default",onConfirm:c,onCancel:d})=>{const f=()=>{c(),o(!1)},x=()=>{d(),o(!1)};return a.jsx(Re,{open:e,onOpenChange:o,children:a.jsxs(U,{className:"[&>:last-child]:hidden",onCloseAutoFocus:y=>y.preventDefault(),children:[a.jsxs(X,{children:[a.jsx(Z,{children:n}),r?a.jsx(Q,{children:r}):null]}),a.jsxs(Y,{className:"gap-2 sm:gap-0",children:[a.jsx(P,{type:"button",variant:"outline",onClick:x,children:t}),a.jsx(P,{type:"button",variant:l==="destructive"?"destructive":"default",onClick:f,children:s})]})]})})},Ee={open:!1,title:"",description:"",confirmLabel:p("confirm"),cancelLabel:p("cancel"),variant:"default",resolve:null};function Ae(){const[e,o]=i.useState(Ee),n=i.useCallback(t=>new Promise(l=>{o({open:!0,title:t.title,description:t.description??"",confirmLabel:t.confirmLabel??p("confirm"),cancelLabel:t.cancelLabel??p("cancel"),variant:t.variant??"default",resolve:c=>{l(c),o(d=>({...d,open:!1,resolve:null}))}})}),[]),r=i.useCallback(t=>{o(l=>(!t&&l.resolve&&l.resolve(!1),{...l,open:t,resolve:t?l.resolve:null}))},[]),s=i.useCallback(()=>a.jsx(_e,{open:e.open,onOpenChange:r,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>{var t;return(t=e.resolve)==null?void 0:t.call(e,!0)},onCancel:()=>{var t;return(t=e.resolve)==null?void 0:t.call(e,!1)}}),[e,r]);return{confirm:n,ConfirmDialog:s}}export{Ae as u};
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},he="DialogDescriptionWarning",Ce=({contentRef:e,descriptionId:o})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${z(he).contentName}}.`;return i.useEffect(()=>{var t;const s=(t=e.current)==null?void 0:t.getAttribute("aria-describedby");o&&s&&(document.getElementById(o)||console.warn(r))},[r,e,o]),null},ye=I,be=T,H=M,K=F,V=S,q=W,Ne=G;const Re=ye,je=be,J=i.forwardRef(({className:e,...o},n)=>a.jsx(H,{ref:n,className:m("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...o}));J.displayName=H.displayName;const U=i.forwardRef(({className:e,children:o,...n},r)=>a.jsxs(je,{children:[a.jsx(J,{}),a.jsxs(K,{ref:r,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base 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%] rounded-2xl",e),...n,children:[o,a.jsxs(Ne,{className:"absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(de,{className:"h-4 w-4 text-gray-500"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));U.displayName=K.displayName;const X=({className:e,...o})=>a.jsx("div",{className:m("flex flex-col space-y-2 text-center sm:text-left",e),...o});X.displayName="DialogHeader";const Y=({className:e,...o})=>a.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...o});Y.displayName="DialogFooter";const Z=i.forwardRef(({className:e,...o},n)=>a.jsx(V,{ref:n,className:m("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...o}));Z.displayName=V.displayName;const Q=i.forwardRef(({className:e,...o},n)=>a.jsx(q,{ref:n,className:m("text-sm text-gray-500 leading-relaxed",e),...o}));Q.displayName=q.displayName;const _e=({open:e,onOpenChange:o,title:n,description:r,confirmLabel:s=p("confirm"),cancelLabel:t=p("cancel"),variant:l="default",onConfirm:c,onCancel:d})=>{const f=()=>{c(),o(!1)},x=()=>{d(),o(!1)};return a.jsx(Re,{open:e,onOpenChange:o,children:a.jsxs(U,{className:"[&>:last-child]:hidden",onCloseAutoFocus:y=>y.preventDefault(),children:[a.jsxs(X,{children:[a.jsx(Z,{children:n}),r?a.jsx(Q,{children:r}):null]}),a.jsxs(Y,{className:"gap-2 sm:gap-0",children:[a.jsx(P,{type:"button",variant:"outline",onClick:x,children:t}),a.jsx(P,{type:"button",variant:l==="destructive"?"destructive":"default",onClick:f,children:s})]})]})})},Ee={open:!1,title:"",description:"",confirmLabel:p("confirm"),cancelLabel:p("cancel"),variant:"default",resolve:null};function Ae(){const[e,o]=i.useState(Ee),n=i.useCallback(t=>new Promise(l=>{o({open:!0,title:t.title,description:t.description??"",confirmLabel:t.confirmLabel??p("confirm"),cancelLabel:t.cancelLabel??p("cancel"),variant:t.variant??"default",resolve:c=>{l(c),o(d=>({...d,open:!1,resolve:null}))}})}),[]),r=i.useCallback(t=>{o(l=>(!t&&l.resolve&&l.resolve(!1),{...l,open:t,resolve:t?l.resolve:null}))},[]),s=i.useCallback(()=>a.jsx(_e,{open:e.open,onOpenChange:r,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>{var t;return(t=e.resolve)==null?void 0:t.call(e,!0)},onCancel:()=>{var t;return(t=e.resolve)==null?void 0:t.call(e,!1)}}),[e,r]);return{confirm:n,ConfirmDialog:s}}export{Re as D,U as a,X as b,Z as c,Q as d,Y as e,Ae as u};