@decocms/mesh 1.0.0-alpha.6 → 1.0.0-alpha.8

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 (75) hide show
  1. package/dist/client/assets/{alert-dialog-Caf0mgW9.js → alert-dialog-pYV3wSPs.js} +1 -1
  2. package/dist/client/assets/{auth-CGqqbEan.js → auth-D1xg1rd7.js} +1 -1
  3. package/dist/client/assets/{auth-catchall-Bw-KJI1v.js → auth-catchall-BZaDWHEa.js} +1 -1
  4. package/dist/client/assets/{avatar-CdPaDOIs.js → avatar-DAMcOnM4.js} +1 -1
  5. package/dist/client/assets/{badge-j-myHF25.js → badge-Bi_GpkO_.js} +1 -1
  6. package/dist/client/assets/{button-DnKGwZ1P.js → button-G3aMPyFq.js} +1 -1
  7. package/dist/client/assets/{card-I0CWqn2J.js → card-CE1-D3SY.js} +1 -1
  8. package/dist/client/assets/{checkbox-v3iP8MNg.js → checkbox-DgaTW36u.js} +1 -1
  9. package/dist/client/assets/{circle-alert-CpqBZI3V.js → circle-alert-B9wPiUFk.js} +1 -1
  10. package/dist/client/assets/{collection-detail-BSfYYwzG.js → collection-detail-Bj_y2m-h.js} +1 -1
  11. package/dist/client/assets/{collection-display-button-Cws3c2TG.js → collection-display-button-BOWw7rwa.js} +1 -1
  12. package/dist/client/assets/{collection-header-CJC3zXGa.js → collection-header-BeSLFcaG.js} +1 -1
  13. package/dist/client/assets/{collection-page-CkAonVNX.js → collection-page-C_ScBEek.js} +1 -1
  14. package/dist/client/assets/{collection-search-Bd4XQ4_K.js → collection-search-DFSSOoxU.js} +1 -1
  15. package/dist/client/assets/{collection-table-wrapper-Dv4rgxdy.js → collection-table-wrapper-CKt7U95e.js} +1 -1
  16. package/dist/client/assets/{connection-card-CgJm9r5i.js → connection-card-Bj0wmYgV.js} +1 -1
  17. package/dist/client/assets/{connection-detail-HAGAOVY9.js → connection-detail-kWSPNag3.js} +1 -1
  18. package/dist/client/assets/{connections-C8Z338-P.js → connections-C7HPEBbQ.js} +1 -1
  19. package/dist/client/assets/{create-organization-dialog-CWgFMDXV.js → create-organization-dialog-BpSaszPg.js} +1 -1
  20. package/dist/client/assets/{dialog-Qusr5Dgc.js → dialog-C1eFYVPZ.js} +1 -1
  21. package/dist/client/assets/{dropdown-menu-BIeRR6rM.js → dropdown-menu-CtSLEdvQ.js} +1 -1
  22. package/dist/client/assets/{empty-state-DV83eIhT.js → empty-state-YCqZyamY.js} +1 -1
  23. package/dist/client/assets/{error-boundary-qOVcoWbq.js → error-boundary-9CuK9oWa.js} +1 -1
  24. package/dist/client/assets/{extract-connection-data-DzgXoQyz.js → extract-connection-data-Cu9jjhV-.js} +1 -1
  25. package/dist/client/assets/{form-0C1lYHJ2.js → form-BsxjQn2d.js} +1 -1
  26. package/dist/client/assets/{gateway-detail-mD14k5vr.js → gateway-detail-C5d-KPPl.js} +1 -1
  27. package/dist/client/assets/{gateways-BSGLH5Mc.js → gateways-BSgfG0sP.js} +1 -1
  28. package/dist/client/assets/{home-B1IT0slW.js → home-Bu1wH9nU.js} +1 -1
  29. package/dist/client/assets/{icon-C1glN-Ga.js → icon-Cxep_tfx.js} +1 -1
  30. package/dist/client/assets/{index-D2ODleHN.js → index-BRGTweKk.js} +1 -1
  31. package/dist/client/assets/{index-DqmRoUE9.js → index-Bhg5-H1t.js} +1 -1
  32. package/dist/client/assets/{index-C1xA8jg5.js → index-BtenH3n7.js} +1 -1
  33. package/dist/client/assets/{index-B5e6fytH.js → index-MoI-rvC3.js} +15 -15
  34. package/dist/client/assets/{index-Chpp7zg0.js → index-fqd6S2iW.js} +1 -1
  35. package/dist/client/assets/{input-DpAKmHHm.js → input-CXe38a5R.js} +1 -1
  36. package/dist/client/assets/{integration-icon-C_Dk6BbN.js → integration-icon-C162QlgN.js} +1 -1
  37. package/dist/client/assets/{layout-BMHVtK0w.js → layout-DqgJyIdL.js} +1 -1
  38. package/dist/client/assets/{lazy-highlighter-9rAB2zZq.js → lazy-highlighter-DdBDXFu3.js} +1 -1
  39. package/dist/client/assets/{localstorage-keys-DC7ymQmZ.js → localstorage-keys-CzubTFSO.js} +1 -1
  40. package/dist/client/assets/{login-BMjQy3tL.js → login-CTfLDBBt.js} +1 -1
  41. package/dist/client/assets/{members-k_V-Gxfi.js → members-B8JX8n6Q.js} +1 -1
  42. package/dist/client/assets/{monitoring-BG-rBDyv.js → monitoring-D7cSD8lu.js} +1 -1
  43. package/dist/client/assets/{monitoring-stats-row-PYfuhQHX.js → monitoring-stats-row-CX3aDsAR.js} +1 -1
  44. package/dist/client/assets/{oauth-callback-CQ4D18kW.js → oauth-callback-BSpJjtnq.js} +1 -1
  45. package/dist/client/assets/{page-h-kmS-QS.js → page-DEl_xdLR.js} +1 -1
  46. package/dist/client/assets/{popover-TCQphQTw.js → popover-iDiv_aJK.js} +1 -1
  47. package/dist/client/assets/{prism-CcSucC56.js → prism-vdds-nIT.js} +1 -1
  48. package/dist/client/assets/{resource-tabs-E4yf0eYT.js → resource-tabs-CNxf_u1f.js} +1 -1
  49. package/dist/client/assets/{schema-BLzWyGtx.js → schema-BJ2fRDqu.js} +1 -1
  50. package/dist/client/assets/{select-fvQCifl4.js → select-B4j1Cb8E.js} +1 -1
  51. package/dist/client/assets/{settings-Bjk195Z6.js → settings-CJre-VTk.js} +1 -1
  52. package/dist/client/assets/{shell-layout-B8oNCzSa.js → shell-layout-BqISuLuR.js} +3 -3
  53. package/dist/client/assets/{spinner-Cck765yW.js → spinner-BgjBycmB.js} +1 -1
  54. package/dist/client/assets/{store-DD1aCoWU.js → store-CL6xQwes.js} +1 -1
  55. package/dist/client/assets/{store-app-detail-DZvzqAVf.js → store-app-detail-BqHjNu0f.js} +1 -1
  56. package/dist/client/assets/{textarea--4iImQiq.js → textarea-BK0_vna7.js} +1 -1
  57. package/dist/client/assets/{tool-set-selector-Fu1vBXWK.js → tool-set-selector-DYpFtHWh.js} +1 -1
  58. package/dist/client/assets/{tooltip-DjXyjtiH.js → tooltip-CyReuecv.js} +1 -1
  59. package/dist/client/assets/{upload-DkfUhTLj.js → upload-n_AaBb-Z.js} +1 -1
  60. package/dist/client/assets/{use-binding-BLIUV5ER.js → use-binding-DdwHCRqV.js} +1 -1
  61. package/dist/client/assets/{use-connection-IMyxygAc.js → use-connection-DiHU9E79.js} +1 -1
  62. package/dist/client/assets/{use-gateway-CuMrhcvh.js → use-gateway-B9o1M04u.js} +1 -1
  63. package/dist/client/assets/{use-list-state-Bas0EIwN.js → use-list-state-CKwEYaZT.js} +1 -1
  64. package/dist/client/assets/{use-members-DHcrnzKP.js → use-members-BH0kTiC2.js} +1 -1
  65. package/dist/client/assets/{use-mobile-CxX0wu31.js → use-mobile-BjUr6Jaq.js} +1 -1
  66. package/dist/client/assets/{use-organization-settings-CpvpbwdB.js → use-organization-settings-Cywci2R8.js} +1 -1
  67. package/dist/client/assets/{use-tool-call-p0lqBezD.js → use-tool-call-CPpXYXAZ.js} +1 -1
  68. package/dist/client/assets/useQuery-BpCQj7wy.js +1 -0
  69. package/dist/client/assets/utils-BLlwSV8I.js +1 -0
  70. package/dist/client/index.html +1 -1
  71. package/dist/server/cli.js +163 -163
  72. package/dist/server/server.js +158 -158
  73. package/package.json +1 -1
  74. package/dist/client/assets/useQuery-BO2jzwkw.js +0 -1
  75. package/dist/client/assets/utils-BLBjpUfr.js +0 -1
@@ -1 +1 @@
1
- import{X as _}from"./index-B5e6fytH.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
1
+ import{X as _}from"./index-MoI-rvC3.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
@@ -1 +1 @@
1
- import{c as s,j as a}from"./index-B5e6fytH.js";import{c as d}from"./utils-BLBjpUfr.js";function p(l){const e=s.c(10);let i,r,t;e[0]!==l?({className:i,type:t,...r}=l,e[0]=l,e[1]=i,e[2]=r,e[3]=t):(i=e[1],r=e[2],t=e[3]);let n;e[4]!==i?(n=d("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-lg border bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] bg-background","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n||e[8]!==t?(o=a.jsx("input",{type:t,"data-slot":"input",className:n,...r}),e[6]=r,e[7]=n,e[8]=t,e[9]=o):o=e[9],o}export{p as I};
1
+ import{c as s,j as a}from"./index-MoI-rvC3.js";import{c as d}from"./utils-BLlwSV8I.js";function p(l){const e=s.c(10);let i,r,t;e[0]!==l?({className:i,type:t,...r}=l,e[0]=l,e[1]=i,e[2]=r,e[3]=t):(i=e[1],r=e[2],t=e[3]);let n;e[4]!==i?(n=d("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-lg border bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] bg-background","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n||e[8]!==t?(o=a.jsx("input",{type:t,"data-slot":"input",className:n,...r}),e[6]=r,e[7]=n,e[8]=t,e[9]=o):o=e[9],o}export{p as I};
@@ -1 +1 @@
1
- import{c as h,r as j,j as b}from"./index-B5e6fytH.js";import{c as I}from"./utils-BLBjpUfr.js";import{I as y}from"./icon-C1glN-Ga.js";function v(p){const e=h.c(13),{icon:t,name:m,size:u,className:n,fallbackIcon:x}=p,o=u===void 0?"md":u,s=x===void 0?"extension":x,[f,_]=j.useState(!t);let c,r;if(e[0]!==n||e[1]!==s||e[2]!==t||e[3]!==f||e[4]!==m||e[5]!==o){r=Symbol.for("react.early_return_sentinel");e:{const g={xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"};let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l={xs:12,sm:16,md:24,lg:32},e[8]=l):l=e[8];const d=l[o];let a;if(e[9]!==s||e[10]!==d?(a=b.jsx(y,{name:s,size:d,className:"text-muted-foreground"}),e[9]=s,e[10]=d,e[11]=a):a=e[11],c=b.jsx("div",{className:I("rounded-lg flex items-center justify-center bg-muted border border-border",g[o],n),children:a}),t&&!f){let i;e[12]===Symbol.for("react.memo_cache_sentinel")?(i=()=>_(!0),e[12]=i):i=e[12],r=b.jsx("img",{src:t,alt:m,onError:i,className:I("rounded-lg object-cover border border-border",g[o],n)});break e}}e[0]=n,e[1]=s,e[2]=t,e[3]=f,e[4]=m,e[5]=o,e[6]=c,e[7]=r}else c=e[6],r=e[7];return r!==Symbol.for("react.early_return_sentinel")?r:c}export{v as I};
1
+ import{c as h,r as j,j as b}from"./index-MoI-rvC3.js";import{c as I}from"./utils-BLlwSV8I.js";import{I as y}from"./icon-Cxep_tfx.js";function v(p){const e=h.c(13),{icon:t,name:m,size:u,className:n,fallbackIcon:x}=p,o=u===void 0?"md":u,s=x===void 0?"extension":x,[f,_]=j.useState(!t);let c,r;if(e[0]!==n||e[1]!==s||e[2]!==t||e[3]!==f||e[4]!==m||e[5]!==o){r=Symbol.for("react.early_return_sentinel");e:{const g={xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"};let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l={xs:12,sm:16,md:24,lg:32},e[8]=l):l=e[8];const d=l[o];let a;if(e[9]!==s||e[10]!==d?(a=b.jsx(y,{name:s,size:d,className:"text-muted-foreground"}),e[9]=s,e[10]=d,e[11]=a):a=e[11],c=b.jsx("div",{className:I("rounded-lg flex items-center justify-center bg-muted border border-border",g[o],n),children:a}),t&&!f){let i;e[12]===Symbol.for("react.memo_cache_sentinel")?(i=()=>_(!0),e[12]=i):i=e[12],r=b.jsx("img",{src:t,alt:m,onError:i,className:I("rounded-lg object-cover border border-border",g[o],n)});break e}}e[0]=n,e[1]=s,e[2]=t,e[3]=f,e[4]=m,e[5]=o,e[6]=c,e[7]=r}else c=e[6],r=e[7];return r!==Symbol.for("react.early_return_sentinel")?r:c}export{v as I};
@@ -1 +1 @@
1
- import{c as m,aJ as x,r as u,j as c,bQ as b}from"./index-B5e6fytH.js";import{B as j}from"./button-DnKGwZ1P.js";const d="view-details-tabs-portal",h="view-details-actions-portal";function p(n){const e=m.c(3),[l,s]=u.useState(null);let t,r;return e[0]!==n?(t=()=>{s(document.getElementById(n))},r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),u.useEffect(t,r),l}function N(n){const e=m.c(3),{children:l}=n,s=p(d);if(!s)return null;let t;return e[0]!==l||e[1]!==s?(t=x.createPortal(l,s),e[0]=l,e[1]=s,e[2]=t):t=e[2],t}function w(n){const e=m.c(3),{children:l}=n,s=p(h);if(!s)return null;let t;return e[0]!==l||e[1]!==s?(t=x.createPortal(l,s),e[0]=l,e[1]=s,e[2]=t):t=e[2],t}function _(n){const e=m.c(11),{children:l,onBack:s}=n;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(b,{}),e[0]=t):t=e[0];let r;e[1]!==s?(r=c.jsx("div",{className:"flex h-full px-2 border-r items-center",children:c.jsx(j,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:s,children:t})}),e[1]=s,e[2]=r):r=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("div",{className:"flex justify-between px-4 items-center gap-4 flex-1",children:[c.jsx("div",{id:d,className:"flex items-center gap-2"}),c.jsx("div",{id:h,className:"flex items-center gap-2 ml-auto"})]}),e[3]=i):i=e[3];let o;e[4]!==r?(o=c.jsxs("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:[r,i]}),e[4]=r,e[5]=o):o=e[5];let a;e[6]!==l?(a=c.jsx("div",{className:"flex-1 overflow-auto",children:l}),e[6]=l,e[7]=a):a=e[7];let f;return e[8]!==o||e[9]!==a?(f=c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o,a]}),e[8]=o,e[9]=a,e[10]=f):f=e[10],f}export{w as V,N as a,_ as b};
1
+ import{c as m,aJ as x,r as u,j as c,bQ as b}from"./index-MoI-rvC3.js";import{B as j}from"./button-G3aMPyFq.js";const d="view-details-tabs-portal",h="view-details-actions-portal";function p(n){const e=m.c(3),[l,s]=u.useState(null);let t,r;return e[0]!==n?(t=()=>{s(document.getElementById(n))},r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),u.useEffect(t,r),l}function N(n){const e=m.c(3),{children:l}=n,s=p(d);if(!s)return null;let t;return e[0]!==l||e[1]!==s?(t=x.createPortal(l,s),e[0]=l,e[1]=s,e[2]=t):t=e[2],t}function w(n){const e=m.c(3),{children:l}=n,s=p(h);if(!s)return null;let t;return e[0]!==l||e[1]!==s?(t=x.createPortal(l,s),e[0]=l,e[1]=s,e[2]=t):t=e[2],t}function _(n){const e=m.c(11),{children:l,onBack:s}=n;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(b,{}),e[0]=t):t=e[0];let r;e[1]!==s?(r=c.jsx("div",{className:"flex h-full px-2 border-r items-center",children:c.jsx(j,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:s,children:t})}),e[1]=s,e[2]=r):r=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("div",{className:"flex justify-between px-4 items-center gap-4 flex-1",children:[c.jsx("div",{id:d,className:"flex items-center gap-2"}),c.jsx("div",{id:h,className:"flex items-center gap-2 ml-auto"})]}),e[3]=i):i=e[3];let o;e[4]!==r?(o=c.jsxs("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:[r,i]}),e[4]=r,e[5]=o):o=e[5];let a;e[6]!==l?(a=c.jsx("div",{className:"flex-1 overflow-auto",children:l}),e[6]=l,e[7]=a):a=e[7];let f;return e[8]!==o||e[9]!==a?(f=c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o,a]}),e[8]=o,e[9]=a,e[10]=f):f=e[10],f}export{w as V,N as a,_ as b};
@@ -1 +1 @@
1
- import{c as g,j as p}from"./index-B5e6fytH.js";import{h as k}from"./prism-CcSucC56.js";const b={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};function f(h){const o=g.c(8),{language:d,content:n,fillHeight:s}=h,c=s===void 0?!1:s,t=d||"text",a=c?"100%":void 0,i=c?"100%":void 0;let e;o[0]!==a||o[1]!==i?(e={margin:0,padding:"1rem",fontSize:"0.8rem",borderRadius:"0.5rem",background:"#282c34",position:"relative",overflowX:"hidden",overflowY:"visible",width:"100%",maxWidth:"100%",display:"block",wordBreak:"break-word",overflowWrap:"break-word",height:a,minHeight:i},o[0]=a,o[1]=i,o[2]=e):e=o[2];let r;o[3]===Symbol.for("react.memo_cache_sentinel")?(r={className:"font-mono",style:{wordBreak:"break-word",overflowWrap:"break-word",whiteSpace:"pre-wrap"}},o[3]=r):r=o[3];let l;return o[4]!==n||o[5]!==t||o[6]!==e?(l=p.jsx(k,{language:t,style:b,customStyle:e,codeTagProps:r,wrapLongLines:!0,children:n}),o[4]=n,o[5]=t,o[6]=e,o[7]=l):l=o[7],l}export{f as default};
1
+ import{c as g,j as p}from"./index-MoI-rvC3.js";import{h as k}from"./prism-vdds-nIT.js";const b={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};function f(h){const o=g.c(8),{language:d,content:n,fillHeight:s}=h,c=s===void 0?!1:s,t=d||"text",a=c?"100%":void 0,i=c?"100%":void 0;let e;o[0]!==a||o[1]!==i?(e={margin:0,padding:"1rem",fontSize:"0.8rem",borderRadius:"0.5rem",background:"#282c34",position:"relative",overflowX:"hidden",overflowY:"visible",width:"100%",maxWidth:"100%",display:"block",wordBreak:"break-word",overflowWrap:"break-word",height:a,minHeight:i},o[0]=a,o[1]=i,o[2]=e):e=o[2];let r;o[3]===Symbol.for("react.memo_cache_sentinel")?(r={className:"font-mono",style:{wordBreak:"break-word",overflowWrap:"break-word",whiteSpace:"pre-wrap"}},o[3]=r):r=o[3];let l;return o[4]!==n||o[5]!==t||o[6]!==e?(l=p.jsx(k,{language:t,style:b,customStyle:e,codeTagProps:r,wrapLongLines:!0,children:n}),o[4]=n,o[5]=t,o[6]=e,o[7]=l):l=o[7],l}export{f as default};
@@ -1 +1 @@
1
- import{c as C,a1 as L}from"./index-B5e6fytH.js";import{u as Q}from"./useQuery-BO2jzwkw.js";import{u as $}from"./button-DnKGwZ1P.js";function q(e){try{return JSON.parse(e)}catch{return}}function O(e,n){const t=localStorage.getItem(e),s=t?q(t):void 0,a=typeof n=="function"?n(s):s??n;if(s===void 0||a!==s)try{const o=JSON.stringify(a);localStorage.setItem(e,o)}catch{}return a}function E(e,n){const t=C.c(25),s=L();let a;t[0]!==e?(a=["localStorage",e],t[0]=e,t[1]=a):a=t[1];const o=a;let r,i;t[2]!==n||t[3]!==e?(r=()=>O(e,n),i=()=>O(e,n),t[2]=n,t[3]=e,t[4]=r,t[5]=i):(r=t[4],i=t[5]);let m;t[6]!==o||t[7]!==r||t[8]!==i?(m={queryKey:o,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},t[6]=o,t[7]=r,t[8]=i,t[9]=m):m=t[9];const{data:I}=Q(m);let l;t[10]!==e?(l=async c=>{const y=JSON.stringify(c);return localStorage.setItem(e,y),c},t[10]=e,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==o?(u=c=>{s.setQueryData(o,c)},t[12]=s,t[13]=o,t[14]=u):u=t[14];let f;t[15]!==l||t[16]!==u?(f={mutationFn:l,onSuccess:u},t[15]=l,t[16]=u,t[17]=f):f=t[17];const h=$(f);let g;t[18]!==h||t[19]!==s||t[20]!==o?(g=c=>{const y=s.getQueryData(o),x=typeof c=="function"?c(y):c;h.mutate(x)},t[18]=h,t[19]=s,t[20]=o,t[21]=g):g=t[21];const S=g,p=I;let d;return t[22]!==S||t[23]!==p?(d=[p,S],t[22]=S,t[23]=p,t[24]=d):d=t[24],d}const F={decoChatOpen:()=>"mesh:decochat:open",threadManagerState:e=>`mesh:thread-manager-state:${e}`,chatSelectedModel:e=>`mesh:chat:selectedModel:${e}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:e=>`mesh:store:selected-registry:${e}`,orgHomeQuickstart:e=>`mesh:org-home:quickstart:${e}`};export{F as L,E as u};
1
+ import{c as C,a1 as L}from"./index-MoI-rvC3.js";import{u as Q}from"./useQuery-BpCQj7wy.js";import{u as $}from"./button-G3aMPyFq.js";function q(e){try{return JSON.parse(e)}catch{return}}function O(e,n){const t=localStorage.getItem(e),s=t?q(t):void 0,a=typeof n=="function"?n(s):s??n;if(s===void 0||a!==s)try{const o=JSON.stringify(a);localStorage.setItem(e,o)}catch{}return a}function E(e,n){const t=C.c(25),s=L();let a;t[0]!==e?(a=["localStorage",e],t[0]=e,t[1]=a):a=t[1];const o=a;let r,i;t[2]!==n||t[3]!==e?(r=()=>O(e,n),i=()=>O(e,n),t[2]=n,t[3]=e,t[4]=r,t[5]=i):(r=t[4],i=t[5]);let m;t[6]!==o||t[7]!==r||t[8]!==i?(m={queryKey:o,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},t[6]=o,t[7]=r,t[8]=i,t[9]=m):m=t[9];const{data:I}=Q(m);let l;t[10]!==e?(l=async c=>{const y=JSON.stringify(c);return localStorage.setItem(e,y),c},t[10]=e,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==o?(u=c=>{s.setQueryData(o,c)},t[12]=s,t[13]=o,t[14]=u):u=t[14];let f;t[15]!==l||t[16]!==u?(f={mutationFn:l,onSuccess:u},t[15]=l,t[16]=u,t[17]=f):f=t[17];const h=$(f);let g;t[18]!==h||t[19]!==s||t[20]!==o?(g=c=>{const y=s.getQueryData(o),x=typeof c=="function"?c(y):c;h.mutate(x)},t[18]=h,t[19]=s,t[20]=o,t[21]=g):g=t[21];const S=g,p=I;let d;return t[22]!==S||t[23]!==p?(d=[p,S],t[22]=S,t[23]=p,t[24]=d):d=t[24],d}const F={decoChatOpen:()=>"mesh:decochat:open",threadManagerState:e=>`mesh:thread-manager-state:${e}`,chatSelectedModel:e=>`mesh:chat:selectedModel:${e}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:e=>`mesh:store:selected-registry:${e}`,orgHomeQuickstart:e=>`mesh:org-home:quickstart:${e}`};export{F as L,E as u};
@@ -1 +1 @@
1
- import{u as k,r as p,j as e,a as w,b as z,S as I,N as L,c as R}from"./index-B5e6fytH.js";import{u as U,B as P}from"./button-DnKGwZ1P.js";import{I as E}from"./input-DpAKmHHm.js";import{c as B}from"./utils-BLBjpUfr.js";function M({redirectUrl:r}){const{emailAndPassword:t}=k(),[s,l]=p.useState(""),[o,u]=p.useState(""),[c,b]=p.useState(""),[i,j]=p.useState(!1),[m,x]=p.useState(""),h=U({mutationFn:async({email:n,password:a,name:C})=>{try{if(i){const d=await w.signUp.email({email:n,password:a,name:C||""});if(d.error)throw new Error(d.error.message||"Sign up failed");return d}else{const d=await w.signIn.email({email:n,password:a});if(d.error)throw new Error(d.error.message||"Sign in failed");return d}}catch(d){throw d instanceof Error?d:new Error("Authentication failed")}},onSuccess:()=>{r&&(window.location.href=r)}}),v=n=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n),f=()=>{s.trim()&&!v(s)&&x("Invalid email address")},N=n=>{if(n.preventDefault(),!v(s)){x("Invalid email address");return}h.mutate({email:s,password:o,name:c})},S=n=>a=>{n(a.target.value),_&&h.reset(),n===l&&m&&x("")},g=h.isPending,_=h.error,y=i?s.trim()&&o.trim()&&c.trim():s.trim()&&o.trim(),A=n=>{if(!n)return null;const a=n.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":n.message||"An error occurred. Please try again."};return e.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:i?"Create your account":"Login or signup below"})}),_&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:A(_)}),t.enabled&&e.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)] ${i?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"}`,children:e.jsxs("div",{className:i?"":"pointer-events-none",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(E,{type:"text",placeholder:"Your name",value:c,onChange:S(b),required:!0,disabled:g||!i,"aria-hidden":!i})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(E,{type:"email",placeholder:"you@example.com",value:s,onChange:S(l),onBlur:f,required:!0,disabled:g,"aria-invalid":!!m}),m&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:m})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Password"}),e.jsx(E,{type:"password",placeholder:"••••••••",value:o,onChange:S(u),required:!0,disabled:g})]}),e.jsx("div",{className:B("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",y?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:y?"":"pointer-events-none",children:e.jsx(P,{type:"submit",disabled:g||!y,className:"w-full font-semibold",size:"lg","aria-hidden":!y,children:g?i?"Creating account...":"Signing in...":"Continue"})})})]}),e.jsx("div",{className:"text-center",children:e.jsx(P,{type:"button",variant:"link",onClick:()=>{j(!i),l(""),u(""),b(""),x(""),h.reset()},disabled:g,className:"text-sm text-muted-foreground hover:text-foreground",children:i?"Already have an account? Sign in":"Don't have an account? Sign up"})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function $(r){if(!r.client_id||r.response_type!=="code")return null;const t=new URLSearchParams;return r.client_id&&t.set("client_id",r.client_id),r.redirect_uri&&t.set("redirect_uri",r.redirect_uri),r.response_type&&t.set("response_type",r.response_type),r.state&&t.set("state",r.state),r.scope&&t.set("scope",r.scope),r.code_challenge&&t.set("code_challenge",r.code_challenge),r.code_challenge_method&&t.set("code_challenge_method",r.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function q(r){const t=R.c(5),{callbackURL:s,providerId:l}=r;let o,u;t[0]!==s||t[1]!==l?(o=()=>{(async()=>await w.signIn.sso({providerId:l,callbackURL:s}))()},u=[l,s],t[0]=s,t[1]=l,t[2]=o,t[3]=u):(o=t[2],u=t[3]),p.useEffect(o,u);let c;return t[4]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsx(I,{}),t[4]=c):c=t[4],c}function Y(){const r=w.useSession(),t=z({from:"/login"}),{next:s="/",client_id:l,redirect_uri:o,response_type:u,state:c,scope:b,code_challenge:i,code_challenge_method:j}=t,{sso:m,emailAndPassword:x,magicLink:h,socialProviders:v}=k(),f=$({client_id:l,redirect_uri:o,response_type:u,state:c,scope:b,code_challenge:i,code_challenge_method:j}),N=f||s;return r.data?f?(window.location.href=f,e.jsx(I,{})):e.jsx(L,{to:s}):m.enabled?e.jsx(q,{callbackURL:N,providerId:m.providerId}):x.enabled||h.enabled||v.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx(M,{redirectUrl:f})]})]}):e.jsx("div",{children:"No login options available"})}export{Y as default};
1
+ import{u as k,r as p,j as e,a as w,b as z,S as I,N as L,c as R}from"./index-MoI-rvC3.js";import{u as U,B as P}from"./button-G3aMPyFq.js";import{I as E}from"./input-CXe38a5R.js";import{c as B}from"./utils-BLlwSV8I.js";function M({redirectUrl:r}){const{emailAndPassword:t}=k(),[s,l]=p.useState(""),[o,u]=p.useState(""),[c,b]=p.useState(""),[i,j]=p.useState(!1),[m,x]=p.useState(""),h=U({mutationFn:async({email:n,password:a,name:C})=>{try{if(i){const d=await w.signUp.email({email:n,password:a,name:C||""});if(d.error)throw new Error(d.error.message||"Sign up failed");return d}else{const d=await w.signIn.email({email:n,password:a});if(d.error)throw new Error(d.error.message||"Sign in failed");return d}}catch(d){throw d instanceof Error?d:new Error("Authentication failed")}},onSuccess:()=>{r&&(window.location.href=r)}}),v=n=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n),f=()=>{s.trim()&&!v(s)&&x("Invalid email address")},N=n=>{if(n.preventDefault(),!v(s)){x("Invalid email address");return}h.mutate({email:s,password:o,name:c})},S=n=>a=>{n(a.target.value),_&&h.reset(),n===l&&m&&x("")},g=h.isPending,_=h.error,y=i?s.trim()&&o.trim()&&c.trim():s.trim()&&o.trim(),A=n=>{if(!n)return null;const a=n.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":n.message||"An error occurred. Please try again."};return e.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:i?"Create your account":"Login or signup below"})}),_&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:A(_)}),t.enabled&&e.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)] ${i?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"}`,children:e.jsxs("div",{className:i?"":"pointer-events-none",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(E,{type:"text",placeholder:"Your name",value:c,onChange:S(b),required:!0,disabled:g||!i,"aria-hidden":!i})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(E,{type:"email",placeholder:"you@example.com",value:s,onChange:S(l),onBlur:f,required:!0,disabled:g,"aria-invalid":!!m}),m&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:m})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Password"}),e.jsx(E,{type:"password",placeholder:"••••••••",value:o,onChange:S(u),required:!0,disabled:g})]}),e.jsx("div",{className:B("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",y?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:y?"":"pointer-events-none",children:e.jsx(P,{type:"submit",disabled:g||!y,className:"w-full font-semibold",size:"lg","aria-hidden":!y,children:g?i?"Creating account...":"Signing in...":"Continue"})})})]}),e.jsx("div",{className:"text-center",children:e.jsx(P,{type:"button",variant:"link",onClick:()=>{j(!i),l(""),u(""),b(""),x(""),h.reset()},disabled:g,className:"text-sm text-muted-foreground hover:text-foreground",children:i?"Already have an account? Sign in":"Don't have an account? Sign up"})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function $(r){if(!r.client_id||r.response_type!=="code")return null;const t=new URLSearchParams;return r.client_id&&t.set("client_id",r.client_id),r.redirect_uri&&t.set("redirect_uri",r.redirect_uri),r.response_type&&t.set("response_type",r.response_type),r.state&&t.set("state",r.state),r.scope&&t.set("scope",r.scope),r.code_challenge&&t.set("code_challenge",r.code_challenge),r.code_challenge_method&&t.set("code_challenge_method",r.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function q(r){const t=R.c(5),{callbackURL:s,providerId:l}=r;let o,u;t[0]!==s||t[1]!==l?(o=()=>{(async()=>await w.signIn.sso({providerId:l,callbackURL:s}))()},u=[l,s],t[0]=s,t[1]=l,t[2]=o,t[3]=u):(o=t[2],u=t[3]),p.useEffect(o,u);let c;return t[4]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsx(I,{}),t[4]=c):c=t[4],c}function Y(){const r=w.useSession(),t=z({from:"/login"}),{next:s="/",client_id:l,redirect_uri:o,response_type:u,state:c,scope:b,code_challenge:i,code_challenge_method:j}=t,{sso:m,emailAndPassword:x,magicLink:h,socialProviders:v}=k(),f=$({client_id:l,redirect_uri:o,response_type:u,state:c,scope:b,code_challenge:i,code_challenge_method:j}),N=f||s;return r.data?f?(window.location.href=f,e.jsx(I,{})):e.jsx(L,{to:s}):m.enabled?e.jsx(q,{callbackURL:N,providerId:m.providerId}):x.enabled||h.enabled||v.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx(M,{redirectUrl:f})]})]}):e.jsx("div",{children:"No login options available"})}export{Y as default};
@@ -1 +1 @@
1
- import{a2 as K,a as se,r as S,a1 as xe,as as Te,a6 as G,j as s,aq as ye,c as Ce}from"./index-B5e6fytH.js";import{C as Be}from"./collection-header-CJC3zXGa.js";import{C as pe}from"./collection-page-CkAonVNX.js";import{C as Ge}from"./collection-search-Bd4XQ4_K.js";import{C as Ue}from"./collection-table-wrapper-Dv4rgxdy.js";import{b as ke}from"./use-connection-IMyxygAc.js";import{W as Ve}from"./well-known-mcp-Dq2j3ucM.js";import{u as de}from"./tooltip-DjXyjtiH.js";import{u as Fe}from"./useQuery-BO2jzwkw.js";import{B as me}from"./badge-j-myHF25.js";import{u as le,B as $}from"./button-DnKGwZ1P.js";import{C as ue}from"./checkbox-v3iP8MNg.js";import{d as ve,e as Ie,c as Se,D as Oe,a as Pe,b as Ke,f as _e}from"./dialog-Qusr5Dgc.js";import{a as Re,F as Y,b as Z,c as oe,d as q,e as ie,f as ce}from"./form-0C1lYHJ2.js";import{I as Q}from"./icon-C1glN-Ga.js";import{I as $e}from"./input-DpAKmHHm.js";import{M as fe,u as Ye}from"./use-members-DHcrnzKP.js";import{E as he}from"./empty-state-DV83eIhT.js";import{E as Ze}from"./error-boundary-qOVcoWbq.js";import{c as qe,a as Qe,S as We,b as He,d as Je}from"./select-fvQCifl4.js";import{c as ge}from"./utils-BLBjpUfr.js";import{a as Xe,e as es,g as ss,b as ts,c as ns,d as os,A as is,f as as}from"./alert-dialog-Caf0mgW9.js";import{A as Le}from"./avatar-CdPaDOIs.js";import{C as rs}from"./card-I0CWqn2J.js";import{b as ls,D as cs,a as ms,e as ds,f as us,g as fs,c as Ae,d as hs}from"./dropdown-menu-BIeRR6rM.js";import"./collection-display-button-Cws3c2TG.js";import"./index-D2ODleHN.js";import"./popover-TCQphQTw.js";const gs=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_GATEWAY_CREATE",description:"Create gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_LIST",description:"List gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_GET",description:"View gateway details",category:"Gateways"},{name:"COLLECTION_GATEWAY_UPDATE",description:"Update gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_DELETE",description:"Delete gateways",category:"Gateways",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"}],ps={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_GATEWAY_CREATE:"Create gateways",COLLECTION_GATEWAY_LIST:"List gateways",COLLECTION_GATEWAY_GET:"View gateway details",COLLECTION_GATEWAY_UPDATE:"Update gateways",COLLECTION_GATEWAY_DELETE:"Delete gateways",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state"};function xs(){return gs.map(e=>({value:e.name,label:ps[e.name],dangerous:e.dangerous}))}const be=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Cs(e){if(!e)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const t=[];let c=!1;const E=[];let h=!1;const w=new Set;let o=!1;for(const[x,A]of Object.entries(e)){if(x===Ve.SELF){A.includes("*")?c=!0:t.push(...A);continue}if(x==="*"){if(h=!0,A.includes("*"))o=!0;else for(const N of A)w.add(N);continue}if(E.push(x),A.includes("*"))o=!0;else for(const N of A)w.add(N)}return{staticPermissions:t,allowsAllStaticPermissions:c,connectionIds:E,allowsAllConnections:h,toolNames:Array.from(w),allowsAllTools:o}}function Ne(){const{locator:e}=de(),{data:t,isLoading:c,error:E,refetch:h}=Fe({queryKey:K.organizationRoles(e),queryFn:async()=>{try{const o=await se.organization.listRoles();return o?.error?(console.error("[useOrganizationRoles] API error:",o.error),[]):o?.data??[]}catch(o){return console.error("[useOrganizationRoles] Fetch error:",o),[]}},staleTime:3e4}),w=be.map(o=>({role:o.value,label:o.label,isBuiltin:o.isBuiltin}));if(t&&Array.isArray(t))for(const o of t){const x=o.role;if(!x||be.some(m=>m.value===x))continue;const{staticPermissions:A,allowsAllStaticPermissions:N,connectionIds:l,allowsAllConnections:O,toolNames:C,allowsAllTools:v}=Cs(o.permission);w.push({id:o.id,role:x,label:Ns(x),isBuiltin:!1,permission:o.permission??void 0,staticPermissionCount:N?-1:A.length,allowsAllStaticPermissions:N,connectionCount:O?-1:l.length,allowsAllConnections:O,toolCount:v?-1:C.length,allowsAllTools:v})}return{roles:w,customRoles:w.filter(o=>!o.isBuiltin),builtinRoles:w.filter(o=>o.isBuiltin),isLoading:c,error:E,refetch:h}}function Ns(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Es({trigger:e,onSuccess:t}){const[c,E]=S.useState(!1),[h,w]=S.useState(null),[o,x]=S.useState(!1),A=S.useRef(null),{locator:N}=de(),l=xe(),O=ke()??[],{customRoles:C,refetch:v}=Ne(),m=Te({mode:"onChange",defaultValues:{roleName:"",allowAllStaticPermissions:!0,staticPermissions:[],allowAllConnections:!1,connectionIds:[],allowAllTools:!0,toolNames:[]}}),R=m.watch("allowAllStaticPermissions"),L=m.watch("staticPermissions"),u=m.watch("allowAllConnections"),a=m.watch("allowAllTools"),g=m.watch("roleName"),I=m.watch("connectionIds"),_=m.watch("toolNames"),D=(()=>{if(!g.trim())return C;const n=g.toLowerCase().replace(/\s+/g,"-");return C.filter(r=>r.role.toLowerCase().includes(n)||r.label.toLowerCase().includes(g.toLowerCase()))})(),i=n=>{w(n),x(!1);const r=n.permission||{},p=r.self||[],k=p.includes("*"),T=k?[]:p.filter(ne=>ne!=="*"),B=Object.keys(r).filter(ne=>ne!=="self"),V=B.includes("*"),te=B.filter(ne=>ne!=="*"),ee=B[0],Ee=r["*"]||(ee?r[ee]:[])||[],we=Ee.includes("*"),ze=we?[]:Ee.filter(ne=>ne!=="*");m.reset({roleName:n.label,allowAllStaticPermissions:k,staticPermissions:T,allowAllConnections:V,connectionIds:te,allowAllTools:we,toolNames:ze})},d=n=>{E(n),n||(w(null),x(!1))},b=xs().map(n=>({value:n.value,label:n.label})),j=(()=>{if(u){const n=new Map;for(const r of O)if(r.tools)for(const p of r.tools)n.has(p.name)||n.set(p.name,{name:p.name,connection:r.title||r.id});return Array.from(n.values())}else{const n=O.filter(p=>I.includes(p.id)),r=new Map;for(const p of n)if(p.tools)for(const k of p.tools)r.has(k.name)||r.set(k.name,{name:k.name,connection:p.title||p.id});return Array.from(r.values())}})(),U=n=>{const r={};n.allowAllStaticPermissions?r.self=["*"]:n.staticPermissions.length>0&&(r.self=n.staticPermissions);const p=n.allowAllTools?["*"]:n.toolNames;if(n.allowAllConnections)r["*"]=p;else if(n.connectionIds.length>0)for(const k of n.connectionIds)r[k]=p;return r},M=le({mutationFn:async n=>{const r=U(n),p=await se.organization.createRole({role:n.roleName.toLowerCase().replace(/\s+/g,"-"),permission:r});if(p?.error)throw new Error(p.error.message);return p?.data},onSuccess:()=>{l.invalidateQueries({queryKey:K.members(N)}),l.invalidateQueries({queryKey:K.organizationRoles(N)}),G.success("Role created successfully!"),f(),E(!1),t?.()},onError:n=>{G.error(n instanceof Error?n.message:"Failed to create role")}}),P=le({mutationFn:async n=>{const r=U(n),p=await se.organization.updateRole({roleId:n.roleId,data:{permission:r}});if(p?.error)throw new Error(p.error.message);return p?.data},onSuccess:()=>{l.invalidateQueries({queryKey:K.members(N)}),l.invalidateQueries({queryKey:K.organizationRoles(N)}),G.success("Role updated successfully!"),f(),E(!1),t?.()},onError:n=>{G.error(n instanceof Error?n.message:"Failed to update role")}}),z=le({mutationFn:async n=>{const r=await se.organization.deleteRole({roleId:n});if(r?.error)throw new Error(r.error.message);return r?.data},onSuccess:()=>{l.invalidateQueries({queryKey:K.members(N)}),l.invalidateQueries({queryKey:K.organizationRoles(N)}),G.success("Role deleted successfully!"),f(),v()},onError:n=>{G.error(n instanceof Error?n.message:"Failed to delete role")}}),f=()=>{w(null),x(!1),m.reset({roleName:"",allowAllStaticPermissions:!0,staticPermissions:[],allowAllConnections:!1,connectionIds:[],allowAllTools:!0,toolNames:[]})},y=M.isPending||P.isPending||z.isPending,F=n=>{if(!n.roleName.trim()){G.error("Please enter a role name");return}if(!n.allowAllStaticPermissions&&n.staticPermissions.length===0){G.error("Please select at least one organization permission or allow all");return}if((n.connectionIds.length>0||n.allowAllConnections)&&!n.allowAllTools&&n.toolNames.length===0){G.error("Please select at least one tool or allow all tools");return}h?.id?P.mutate({...n,roleId:h.id}):M.mutate(n)},ae=O.map(n=>({value:n.id,label:n.title||n.id})),W=j.map(n=>({value:n.name,label:n.name})),H=R||L.length>0,J=u||I.length>0,re=a||_.length>0,X=g.trim().length>0&&H&&(!J||re);return s.jsxs(ve,{open:c,onOpenChange:d,children:[s.jsx(Ie,{asChild:!0,children:e}),s.jsxs(Se,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsxs(Oe,{children:[s.jsx(Pe,{children:h?"Edit Role":"Create Role"}),s.jsx(Ke,{children:h?`Update permissions for the "${h.label}" role.`:"Create a new role or select an existing one to edit."})]}),s.jsx(Re,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(F),className:"space-y-4",children:[s.jsx(Y,{control:m.control,name:"roleName",render:({field:n})=>s.jsxs(Z,{className:"relative",children:[s.jsx(oe,{children:"Role Name"}),s.jsx(q,{children:s.jsxs("div",{className:"relative",children:[s.jsx($e,{...n,ref:A,placeholder:"e.g., Developer, Viewer, Support",disabled:y||!!h,onFocus:()=>x(!0),onBlur:()=>{setTimeout(()=>x(!1),200)},autoComplete:"off"}),h&&s.jsx($,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 px-2",onClick:()=>{f()},children:s.jsx(Q,{name:"close",size:16})})]})}),o&&!h&&D.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-auto",children:s.jsxs("div",{className:"p-1",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Existing roles (click to edit)"}),D.map(r=>s.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-2 py-2 text-sm rounded hover:bg-accent cursor-pointer text-left",onMouseDown:p=>{p.preventDefault(),i(r)},children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:r.label}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.allowsAllStaticPermissions?"Full org access":r.staticPermissionCount?`${r.staticPermissionCount} org perm(s)`:"No org perms"," · ",r.allowsAllConnections?"All connections":r.connectionCount?`${r.connectionCount} connection(s)`:"No connections"]})]}),s.jsx(Q,{name:"edit",size:16,className:"text-muted-foreground"})]},r.id||r.role))]})}),s.jsx(ie,{children:h?"Role name cannot be changed. Clear to create a new role.":"Type to search existing roles or enter a new name."}),s.jsx(ce,{})]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Organization Permissions"}),s.jsx(Y,{control:m.control,name:"allowAllStaticPermissions",render:({field:n})=>s.jsxs(Z,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[s.jsx(q,{children:s.jsx(ue,{checked:n.value,onCheckedChange:n.onChange,disabled:y})}),s.jsxs("div",{className:"space-y-1 leading-none",children:[s.jsx(oe,{children:"Allow all organization permissions"}),s.jsx(ie,{children:"Full access to organization, members, and connection management."})]})]})}),!R&&s.jsx(Y,{control:m.control,name:"staticPermissions",render:({field:n})=>s.jsxs(Z,{children:[s.jsxs(oe,{children:["Permissions"," ",s.jsxs(me,{variant:"secondary",className:"ml-2",children:[b.length," available"]})]}),s.jsx(q,{children:s.jsx(fe,{options:b,defaultValue:n.value,onValueChange:n.onChange,placeholder:"Select permissions",variant:"secondary",className:"w-full max-w-none",disabled:y,maxCount:3})}),s.jsx(ie,{children:"Select specific organization-level permissions for this role."}),s.jsx(ce,{})]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Connection Permissions"}),s.jsx(Y,{control:m.control,name:"allowAllConnections",render:({field:n})=>s.jsxs(Z,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[s.jsx(q,{children:s.jsx(ue,{checked:n.value,onCheckedChange:n.onChange,disabled:y})}),s.jsxs("div",{className:"space-y-1 leading-none",children:[s.jsx(oe,{children:"Allow all connections"}),s.jsx(ie,{children:"Members with this role can access all connections, including future ones."})]})]})}),!u&&s.jsx(Y,{control:m.control,name:"connectionIds",render:({field:n})=>s.jsxs(Z,{children:[s.jsx(oe,{children:"Connections"}),s.jsx(q,{children:s.jsx(fe,{options:ae,defaultValue:n.value,onValueChange:n.onChange,placeholder:"Select connections",variant:"secondary",className:"w-full max-w-none",disabled:y,maxCount:3})}),s.jsx(ie,{children:"Select which connections members with this role can access."}),s.jsx(ce,{})]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Tool Permissions"}),s.jsx(Y,{control:m.control,name:"allowAllTools",render:({field:n})=>s.jsxs(Z,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[s.jsx(q,{children:s.jsx(ue,{checked:n.value,onCheckedChange:n.onChange,disabled:y})}),s.jsxs("div",{className:"space-y-1 leading-none",children:[s.jsx(oe,{children:"Allow all tools"}),s.jsx(ie,{children:"Members with this role can use all tools from the selected connections."})]})]})}),!a&&s.jsx(Y,{control:m.control,name:"toolNames",render:({field:n})=>s.jsxs(Z,{children:[s.jsxs(oe,{children:["Tools"," ",j.length>0&&s.jsxs(me,{variant:"secondary",className:"ml-2",children:[j.length," available"]})]}),s.jsx(q,{children:s.jsx(fe,{options:W,defaultValue:n.value,onValueChange:n.onChange,placeholder:j.length===0?"Select connections first":"Select tools",variant:"secondary",className:"w-full max-w-none",disabled:y||j.length===0,maxCount:3})}),s.jsx(ie,{children:"Select specific tools that members with this role can use."}),s.jsx(ce,{})]})})]}),s.jsxs(_e,{className:"flex-col sm:flex-row gap-2",children:[h&&s.jsx($,{type:"button",variant:"destructive",onClick:()=>{h.id&&confirm(`Are you sure you want to delete the "${h.label}" role?`)&&z.mutate(h.id)},disabled:y,className:"sm:mr-auto",children:z.isPending?"Deleting...":"Delete Role"}),s.jsx($,{variant:"outline",onClick:()=>{f(),E(!1)},type:"button",disabled:y,children:"Cancel"}),s.jsx($,{type:"submit",disabled:y||!X,children:h?P.isPending?"Saving...":"Save Changes":M.isPending?"Creating...":"Create Role"})]})]})})]})]})}const ws=ye().email("Invalid email address");function As({emails:e,onEmailsChange:t,disabled:c,placeholder:E="Emails, comma separated",validation:h,onToast:w,badgeClassName:o}){const[x,A]=S.useState(""),[N,l]=S.useState(new Map),O=S.useRef(null),C=S.useCallback(i=>{const d=i.trim().toLowerCase();return h?.validate?h.validate(d):h?.currentUserEmail&&d===h.currentUserEmail.toLowerCase()?"self":ws.safeParse(d).success?"valid":"invalid"},[h]),v=S.useCallback(i=>{const d=i.trim().toLowerCase();if(!d||e.includes(d))return!1;const b=C(d),j=[...e,d];return t(j),l(U=>{const M=new Map(U);return M.set(d,b),M}),!0},[e,t,C]),m=S.useCallback(i=>{const d=e.filter(b=>b!==i);t(d),l(b=>{const j=new Map(b);return j.delete(i),j})},[e,t]),R=S.useCallback(i=>{const d=i.split(/[,;\n\r\t|]/).map(P=>P.trim()).filter(P=>P.length>0);let b=0,j=0;const U=[],M=new Map;if(d.forEach(P=>{j++;const z=P.trim().toLowerCase();if(e.includes(z)||U.includes(z))return;const f=C(z);U.push(z),M.set(z,f),b++}),U.length>0){const P=[...e,...U];t(P),l(z=>{const f=new Map(z);return M.forEach((y,F)=>{f.set(F,y)}),f})}return j>0&&(A(""),b>0&&w?w(`Added ${b} email${b>1?"s":""}`,"success"):j>b&&w&&w(`${j-b} email${j-b>1?"s were":" was"} already added or invalid`,"info")),b},[e,t,C,w]),L=i=>{const d=i.target.value;/[,;\n\r\t|]/.test(d)?R(d):A(d)},u=i=>{if(i.key==="Enter"&&!i.shiftKey)i.preventDefault(),x.trim()&&v(x)&&A("");else if(i.key==="Backspace"&&!x&&e.length>0){const d=e[e.length-1];d&&m(d)}},a=i=>{const d=i.clipboardData.getData("text");d.trim()&&(i.preventDefault(),/[,;\n\r\t|]/.test(d)?R(d):v(d.trim())||A(d.trim()))},g=S.useCallback(()=>{const i=O.current;i&&(i.style.height="auto",i.style.height=Math.max(96,Math.min(200,i.scrollHeight))+"px")},[]);S.useEffect(()=>{g()},[x,g]);const I=S.useMemo(()=>e.filter(i=>N.get(i)==="invalid"),[e,N]),_=S.useMemo(()=>e.filter(i=>N.get(i)==="self"),[e,N]),D=i=>{switch(N.get(i)){case"invalid":case"self":return"destructive";default:return"secondary"}};return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:ge("min-h-[96px] w-full rounded-xl border border-input bg-background px-3 py-2 text-sm transition-[color,box-shadow]","focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",c&&"opacity-50 cursor-not-allowed"),onClick:()=>O.current?.focus(),children:s.jsxs("div",{className:"flex flex-wrap gap-1 items-start",children:[e.map(i=>s.jsxs(me,{variant:D(i),className:ge("flex items-center gap-1 max-w-xs",o||"px-1 py-0.5"),children:[s.jsx("span",{className:"truncate",children:i}),s.jsx($,{type:"button",variant:"ghost",size:"icon",className:ge("h-4 w-4 rounded-full transition-colors",D(i)==="destructive"?"text-destructive hover:text-foreground":"text-muted-foreground hover:text-foreground"),onClick:d=>{d.stopPropagation(),m(i)},disabled:c,children:s.jsx(Q,{name:"close",size:12})})]},i)),s.jsx("textarea",{ref:O,value:x,onChange:L,onKeyDown:u,onPaste:a,className:"flex-1 min-w-[120px] bg-transparent border-none outline-none resize-none placeholder:text-muted-foreground overflow-hidden",placeholder:e.length===0?E:"Add more emails...",disabled:c,rows:4,style:{minHeight:"96px",maxHeight:"200px"}})]})}),_.length>0&&s.jsxs("div",{className:"text-sm text-destructive",children:["You're not able to send an invite to yourself: ",_.join(", ")]}),I.length>0&&s.jsxs("div",{className:"text-sm text-destructive",children:["Invalid email format: ",I.join(", ")]})]})}const bs=ye().email("Invalid email address");function js({trigger:e}){const[t,c]=S.useState(!1),{locator:E}=de(),h=xe(),{data:w}=se.useSession(),o=w?.user?.email,{roles:x,isLoading:A}=Ne(),N=x.filter(u=>u.role!=="owner"),l=Te({mode:"onChange",defaultValues:{emails:[],role:"user"}}),O=l.watch("emails"),C=l.watch("role"),v=O.filter(u=>{const a=u.trim().toLowerCase(),g=bs.safeParse(a).success,I=!o||a!==o.toLowerCase();return g&&I}),m=le({mutationFn:async u=>{if(!u.role)throw new Error("Please select a role");const a=await Promise.allSettled(v.map(async I=>{const _=await se.organization.inviteMember({email:I,role:u.role});if(_.error)throw new Error(_.error.message);return _.data})),g=a.filter(I=>I.status==="rejected");if(g.length>0)throw new Error(`Failed to invite ${g.length} member${g.length>1?"s":""}`);return a},onSuccess:()=>{h.invalidateQueries({queryKey:K.members(E)}),G.success(v.length===1?"Member invited successfully!":`${v.length} members invited successfully!`),l.reset({emails:[],role:"user"}),c(!1)},onError:u=>{G.error(u instanceof Error?u.message:"Failed to invite members")}}),R=u=>{if(v.length===0){G.error("Please add at least one valid email address");return}if(!u.role){G.error("Please select a role");return}m.mutate(u)},L=v.length>0&&!!C;return s.jsxs(ve,{open:t,onOpenChange:c,children:[s.jsx(Ie,{asChild:!0,children:e}),s.jsxs(Se,{className:"sm:max-w-lg",children:[s.jsx(Oe,{children:s.jsx(Pe,{children:"Invite members"})}),s.jsx(Re,{...l,children:s.jsxs("form",{onSubmit:l.handleSubmit(R),className:"space-y-4",children:[s.jsx(Y,{control:l.control,name:"emails",render:({field:u})=>s.jsx(Z,{children:s.jsx(q,{children:s.jsx(As,{emails:u.value??[],onEmailsChange:u.onChange,disabled:m.isPending,placeholder:"Emails, comma separated",validation:{currentUserEmail:o},onToast:(a,g)=>G[g](a)})})})}),s.jsx(Y,{control:l.control,name:"role",render:({field:u})=>s.jsxs(Z,{children:[s.jsx(q,{children:s.jsxs(qe,{value:u.value,onValueChange:u.onChange,disabled:m.isPending||A,children:[s.jsx(Qe,{className:"w-full",children:s.jsx(We,{placeholder:"Select a role"})}),s.jsx(He,{children:N.map(a=>{const g=[];return a.isBuiltin||(a.allowsAllStaticPermissions?g.push("Full org access"):a.staticPermissionCount&&a.staticPermissionCount>0&&g.push(`${a.staticPermissionCount} org perm${a.staticPermissionCount!==1?"s":""}`),a.allowsAllConnections?g.push("All connections"):a.connectionCount&&a.connectionCount>0&&g.push(`${a.connectionCount} connection${a.connectionCount!==1?"s":""}`),(a.connectionCount!==0||a.allowsAllConnections)&&(a.allowsAllTools?g.push("all tools"):a.toolCount&&a.toolCount>0&&g.push(`${a.toolCount} tool${a.toolCount!==1?"s":""}`))),s.jsx(Je,{value:a.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:a.label}),!a.isBuiltin&&g.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:g.join(", ")})]})},a.role)})})]})}),s.jsx(ce,{})]})}),s.jsxs(_e,{children:[s.jsx($,{variant:"outline",onClick:()=>{l.reset({emails:[],role:"user"}),c(!1)},type:"button",disabled:m.isPending,children:"Cancel"}),s.jsx($,{type:"submit",disabled:m.isPending||!L,children:m.isPending?"Inviting...":`Invite ${v.length||0} Member${v.length!==1?"s":""}`})]})]})})]})]})}function De(e){return e?e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2):"?"}function Me(e){switch(e){case"owner":return"default";case"admin":return"secondary";default:return"outline"}}function je(e){const t=Ce.c(51),{member:c,onChangeRole:E,onRemove:h,isUpdating:w}=e,o=w===void 0?!1:w,x=c.role==="owner",{roles:A}=Ne();let N,l,O,C,v,m,R,L,u;if(t[0]!==x||t[1]!==o||t[2]!==c.id||t[3]!==c.role||t[4]!==E||t[5]!==A){let j;t[15]!==c.role?(j=f=>f.role!==c.role&&f.role!=="owner",t[15]=c.role,t[16]=j):j=t[16];const U=A.filter(j);C=ls;let M;t[17]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Q,{name:"more_vert",size:20}),t[17]=M):M=t[17],t[18]!==x?(u=s.jsx(cs,{asChild:!0,children:s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:x,onClick:ys,children:M})}),t[18]=x,t[19]=u):u=t[19],O=ms,R="end",L=Ts,l=ds;let P;t[20]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Q,{name:"swap_horiz",size:16}),t[20]=P):P=t[20],t[21]!==o?(m=s.jsxs(us,{disabled:o,children:[P,"Change Role"]}),t[21]=o,t[22]=m):m=t[22],N=fs;let z;t[23]!==o||t[24]!==c.id||t[25]!==E?(z=f=>{const y=[];return f.isBuiltin||(f.allowsAllStaticPermissions?y.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&y.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?y.push("All connections"):f.connectionCount&&f.connectionCount>0&&y.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?y.push("all tools"):f.toolCount&&f.toolCount>0&&y.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),s.jsxs(Ae,{onClick:F=>{F.stopPropagation(),E(c.id,f.role)},disabled:o,children:[s.jsx(Q,{name:f.isBuiltin?"shield":"key",size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:f.label}),!f.isBuiltin&&y.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:y.join(", ")})]})]},f.role)},t[23]=o,t[24]=c.id,t[25]=E,t[26]=z):z=t[26],v=U.map(z),t[0]=x,t[1]=o,t[2]=c.id,t[3]=c.role,t[4]=E,t[5]=A,t[6]=N,t[7]=l,t[8]=O,t[9]=C,t[10]=v,t[11]=m,t[12]=R,t[13]=L,t[14]=u}else N=t[6],l=t[7],O=t[8],C=t[9],v=t[10],m=t[11],R=t[12],L=t[13],u=t[14];let a;t[27]!==N||t[28]!==v?(a=s.jsx(N,{children:v}),t[27]=N,t[28]=v,t[29]=a):a=t[29];let g;t[30]!==l||t[31]!==m||t[32]!==a?(g=s.jsxs(l,{children:[m,a]}),t[30]=l,t[31]=m,t[32]=a,t[33]=g):g=t[33];let I;t[34]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(hs,{}),t[34]=I):I=t[34];let _;t[35]!==c.id||t[36]!==h?(_=j=>{j.stopPropagation(),h(c.id)},t[35]=c.id,t[36]=h,t[37]=_):_=t[37];let D;t[38]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(Q,{name:"delete",size:16}),t[38]=D):D=t[38];let i;t[39]!==_?(i=s.jsxs(Ae,{variant:"destructive",onClick:_,children:[D,"Remove Member"]}),t[39]=_,t[40]=i):i=t[40];let d;t[41]!==O||t[42]!==i||t[43]!==R||t[44]!==L||t[45]!==g?(d=s.jsxs(O,{align:R,onClick:L,children:[g,I,i]}),t[41]=O,t[42]=i,t[43]=R,t[44]=L,t[45]=g,t[46]=d):d=t[46];let b;return t[47]!==C||t[48]!==d||t[49]!==u?(b=s.jsxs(C,{children:[u,d]}),t[47]=C,t[48]=d,t[49]=u,t[50]=b):b=t[50],b}function Ts(e){return e.stopPropagation()}function ys(e){return e.stopPropagation()}function vs(){const e=Ce.c(58),{data:t}=Ye(),c=xe(),{locator:E}=de(),[h,w]=S.useState(null),[o,x]=S.useState(""),[A,N]=S.useState("table"),[l,O]=S.useState("member"),[C,v]=S.useState("asc"),m=t?.data?.members;let R;e[0]!==l?(R=T=>{l===T?v(Ds):(O(T),v("asc"))},e[0]=l,e[1]=R):R=e[1];const L=R;let u;if(e[2]!==m||e[3]!==o||e[4]!==C||e[5]!==l){if(u=m??[],o){const T=o.toLowerCase();u=u.filter(B=>B.user?.name?.toLowerCase().includes(T)||B.user?.email?.toLowerCase().includes(T)||B.role?.toLowerCase().includes(T))}if(l&&C){let T;e[7]!==C||e[8]!==l?(T=(B,V)=>{let te,ee;e:switch(l){case"member":{te=B.user?.name||"",ee=V.user?.name||"";break e}case"role":{te=B.role||"",ee=V.role||"";break e}case"joined":{te=B.createdAt?typeof B.createdAt=="string"?B.createdAt:B.createdAt.toISOString():"",ee=V.createdAt?typeof V.createdAt=="string"?V.createdAt:V.createdAt.toISOString():"";break e}default:return 0}return C==="asc"?te.localeCompare(ee):ee.localeCompare(te)},e[7]=C,e[8]=l,e[9]=T):T=e[9],u=[...u].sort(T)}e[2]=m,e[3]=o,e[4]=C,e[5]=l,e[6]=u}else u=e[6];const a=u;let g;e[10]!==E||e[11]!==c?(g={mutationFn:Ls,onSuccess:()=>{c.invalidateQueries({queryKey:K.members(E)}),G.success("Member has been removed from the organization"),w(null)},onError:Rs},e[10]=E,e[11]=c,e[12]=g):g=e[12];const I=le(g);let _;e[13]!==E||e[14]!==c?(_={mutationFn:_s,onSuccess:()=>{c.invalidateQueries({queryKey:K.members(E)}),G.success("Member's role has been updated")},onError:Ps},e[13]=E,e[14]=c,e[15]=_):_=e[15];const D=le(_);let i,d,b;e[16]===Symbol.for("react.memo_cache_sentinel")?(i={id:"member",header:"Member",render:Os,cellClassName:"flex-1 min-w-0",sortable:!0},d={id:"role",header:"Role",render:Ss,cellClassName:"w-24 shrink-0",sortable:!0},b={id:"joined",header:"Joined",render:Is,cellClassName:"w-32 shrink-0",sortable:!0},e[16]=i,e[17]=d,e[18]=b):(i=e[16],d=e[17],b=e[18]);let j;e[19]!==D?(j=[i,d,b,{id:"actions",header:"",render:T=>s.jsx(je,{member:T,onChangeRole:(B,V)=>D.mutate({memberId:B,role:V}),onRemove:w,isUpdating:D.isPending}),cellClassName:"w-12 shrink-0"}],e[19]=D,e[20]=j):j=e[20];const U=j;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Es,{trigger:s.jsxs($,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(Q,{name:"add",size:16}),"Create Role"]})}),e[21]=M):M=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsxs("div",{className:"flex items-center gap-2",children:[M,s.jsx(js,{trigger:s.jsx($,{size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Invite Member"})})]}),e[22]=P):P=e[22];const z=P,f=!!h;let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=()=>w(null),e[23]=y):y=e[23];let F;e[24]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs(ts,{children:[s.jsx(ns,{children:"Remove Member"}),s.jsx(os,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),e[24]=F):F=e[24];let ae;e[25]===Symbol.for("react.memo_cache_sentinel")?(ae=s.jsx(is,{children:"Cancel"}),e[25]=ae):ae=e[25];let W;e[26]!==h||e[27]!==I?(W=()=>h&&I.mutate(h),e[26]=h,e[27]=I,e[28]=W):W=e[28];let H;e[29]!==I.isPending||e[30]!==W?(H=s.jsxs(Xe,{children:[F,s.jsxs(es,{children:[ae,s.jsx(ss,{onClick:W,disabled:I.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[29]=I.isPending,e[30]=W,e[31]=H):H=e[31];let J;e[32]!==H||e[33]!==f?(J=s.jsx(as,{open:f,onOpenChange:y,children:H}),e[32]=H,e[33]=f,e[34]=J):J=e[34];let re;e[35]===Symbol.for("react.memo_cache_sentinel")?(re=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],e[35]=re):re=e[35];let X;e[36]!==L||e[37]!==C||e[38]!==l||e[39]!==A?(X=s.jsx(Be,{title:"Members",viewMode:A,onViewModeChange:N,sortKey:l,sortDirection:C,onSort:L,sortOptions:re,ctaButton:z}),e[36]=L,e[37]=C,e[38]=l,e[39]=A,e[40]=X):X=e[40];let n;e[41]===Symbol.for("react.memo_cache_sentinel")?(n=T=>{T.key==="Escape"&&(x(""),T.target.blur())},e[41]=n):n=e[41];let r;e[42]!==o?(r=s.jsx(Ge,{value:o,onChange:x,placeholder:"Search members...",onKeyDown:n}),e[42]=o,e[43]=r):r=e[43];let p;e[44]!==U||e[45]!==a||e[46]!==L||e[47]!==o||e[48]!==C||e[49]!==l||e[50]!==D||e[51]!==A?(p=A==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:a.length===0?s.jsx(he,{title:"No members found",description:o?`No members match "${o}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:a.map(T=>s.jsxs(rs,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(je,{member:T,onChangeRole:(B,V)=>D.mutate({memberId:B,role:V}),onRemove:w,isUpdating:D.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Le,{url:T.user?.image??void 0,fallback:De(T.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:T.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.user?.email}),s.jsx(me,{variant:Me(T.role),className:"w-fit",children:T.role})]})]})]},T.id))})}):s.jsx(Ue,{columns:U,data:a,isLoading:!1,sortKey:l,sortDirection:C,onSort:L,emptyState:o?s.jsx(he,{title:"No members found",description:`No members match "${o}"`}):s.jsx(he,{title:"No members found",description:"Invite members to get started."})}),e[44]=U,e[45]=a,e[46]=L,e[47]=o,e[48]=C,e[49]=l,e[50]=D,e[51]=A,e[52]=p):p=e[52];let k;return e[53]!==J||e[54]!==X||e[55]!==r||e[56]!==p?(k=s.jsxs(pe,{children:[J,X,r,p]}),e[53]=J,e[54]=X,e[55]=r,e[56]=p,e[57]=k):k=e[57],k}function Is(e){return s.jsx("span",{className:"text-sm text-muted-foreground",children:e.createdAt?new Date(e.createdAt).toLocaleDateString():"N/A"})}function Ss(e){return s.jsx(me,{variant:Me(e.role),children:e.role})}function Os(e){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Le,{url:e.user?.image??void 0,fallback:De(e.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:e.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.user?.email})]})]})}function Ps(e){G.error(e instanceof Error?e.message:"Failed to update role")}async function _s(e){const{memberId:t,role:c}=e,E=await se.organization.updateMemberRole({memberId:t,role:[c]});if(E?.error)throw new Error(E.error.message)}function Rs(e){G.error(e instanceof Error?e.message:"Failed to remove member")}async function Ls(e){const t=await se.organization.removeMember({memberIdOrEmail:e});if(t?.error)throw new Error(t.error.message)}function Ds(e){return e==="asc"?"desc":e==="desc"?null:"asc"}function mt(){const e=Ce.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(pe,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),e[0]=t):t=e[0];let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ze,{fallback:t,children:s.jsx(S.Suspense,{fallback:s.jsx(pe,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Q,{name:"progress_activity",size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(vs,{})})}),e[1]=c):c=e[1],c}export{mt as default};
1
+ import{a2 as K,a as se,r as S,a1 as xe,as as Te,a6 as G,j as s,aq as ye,c as Ce}from"./index-MoI-rvC3.js";import{C as Be}from"./collection-header-BeSLFcaG.js";import{C as pe}from"./collection-page-C_ScBEek.js";import{C as Ge}from"./collection-search-DFSSOoxU.js";import{C as Ue}from"./collection-table-wrapper-CKt7U95e.js";import{b as ke}from"./use-connection-DiHU9E79.js";import{W as Ve}from"./well-known-mcp-Dq2j3ucM.js";import{u as de}from"./tooltip-CyReuecv.js";import{u as Fe}from"./useQuery-BpCQj7wy.js";import{B as me}from"./badge-Bi_GpkO_.js";import{u as le,B as $}from"./button-G3aMPyFq.js";import{C as ue}from"./checkbox-DgaTW36u.js";import{d as ve,e as Ie,c as Se,D as Oe,a as Pe,b as Ke,f as _e}from"./dialog-C1eFYVPZ.js";import{a as Re,F as Y,b as Z,c as oe,d as q,e as ie,f as ce}from"./form-BsxjQn2d.js";import{I as Q}from"./icon-Cxep_tfx.js";import{I as $e}from"./input-CXe38a5R.js";import{M as fe,u as Ye}from"./use-members-BH0kTiC2.js";import{E as he}from"./empty-state-YCqZyamY.js";import{E as Ze}from"./error-boundary-9CuK9oWa.js";import{c as qe,a as Qe,S as We,b as He,d as Je}from"./select-B4j1Cb8E.js";import{c as ge}from"./utils-BLlwSV8I.js";import{a as Xe,e as es,g as ss,b as ts,c as ns,d as os,A as is,f as as}from"./alert-dialog-pYV3wSPs.js";import{A as Le}from"./avatar-DAMcOnM4.js";import{C as rs}from"./card-CE1-D3SY.js";import{b as ls,D as cs,a as ms,e as ds,f as us,g as fs,c as Ae,d as hs}from"./dropdown-menu-CtSLEdvQ.js";import"./collection-display-button-BOWw7rwa.js";import"./index-BRGTweKk.js";import"./popover-iDiv_aJK.js";const gs=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_GATEWAY_CREATE",description:"Create gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_LIST",description:"List gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_GET",description:"View gateway details",category:"Gateways"},{name:"COLLECTION_GATEWAY_UPDATE",description:"Update gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_DELETE",description:"Delete gateways",category:"Gateways",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"}],ps={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_GATEWAY_CREATE:"Create gateways",COLLECTION_GATEWAY_LIST:"List gateways",COLLECTION_GATEWAY_GET:"View gateway details",COLLECTION_GATEWAY_UPDATE:"Update gateways",COLLECTION_GATEWAY_DELETE:"Delete gateways",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state"};function xs(){return gs.map(e=>({value:e.name,label:ps[e.name],dangerous:e.dangerous}))}const be=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Cs(e){if(!e)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const t=[];let c=!1;const E=[];let h=!1;const w=new Set;let o=!1;for(const[x,A]of Object.entries(e)){if(x===Ve.SELF){A.includes("*")?c=!0:t.push(...A);continue}if(x==="*"){if(h=!0,A.includes("*"))o=!0;else for(const N of A)w.add(N);continue}if(E.push(x),A.includes("*"))o=!0;else for(const N of A)w.add(N)}return{staticPermissions:t,allowsAllStaticPermissions:c,connectionIds:E,allowsAllConnections:h,toolNames:Array.from(w),allowsAllTools:o}}function Ne(){const{locator:e}=de(),{data:t,isLoading:c,error:E,refetch:h}=Fe({queryKey:K.organizationRoles(e),queryFn:async()=>{try{const o=await se.organization.listRoles();return o?.error?(console.error("[useOrganizationRoles] API error:",o.error),[]):o?.data??[]}catch(o){return console.error("[useOrganizationRoles] Fetch error:",o),[]}},staleTime:3e4}),w=be.map(o=>({role:o.value,label:o.label,isBuiltin:o.isBuiltin}));if(t&&Array.isArray(t))for(const o of t){const x=o.role;if(!x||be.some(m=>m.value===x))continue;const{staticPermissions:A,allowsAllStaticPermissions:N,connectionIds:l,allowsAllConnections:O,toolNames:C,allowsAllTools:v}=Cs(o.permission);w.push({id:o.id,role:x,label:Ns(x),isBuiltin:!1,permission:o.permission??void 0,staticPermissionCount:N?-1:A.length,allowsAllStaticPermissions:N,connectionCount:O?-1:l.length,allowsAllConnections:O,toolCount:v?-1:C.length,allowsAllTools:v})}return{roles:w,customRoles:w.filter(o=>!o.isBuiltin),builtinRoles:w.filter(o=>o.isBuiltin),isLoading:c,error:E,refetch:h}}function Ns(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Es({trigger:e,onSuccess:t}){const[c,E]=S.useState(!1),[h,w]=S.useState(null),[o,x]=S.useState(!1),A=S.useRef(null),{locator:N}=de(),l=xe(),O=ke()??[],{customRoles:C,refetch:v}=Ne(),m=Te({mode:"onChange",defaultValues:{roleName:"",allowAllStaticPermissions:!0,staticPermissions:[],allowAllConnections:!1,connectionIds:[],allowAllTools:!0,toolNames:[]}}),R=m.watch("allowAllStaticPermissions"),L=m.watch("staticPermissions"),u=m.watch("allowAllConnections"),a=m.watch("allowAllTools"),g=m.watch("roleName"),I=m.watch("connectionIds"),_=m.watch("toolNames"),D=(()=>{if(!g.trim())return C;const n=g.toLowerCase().replace(/\s+/g,"-");return C.filter(r=>r.role.toLowerCase().includes(n)||r.label.toLowerCase().includes(g.toLowerCase()))})(),i=n=>{w(n),x(!1);const r=n.permission||{},p=r.self||[],k=p.includes("*"),T=k?[]:p.filter(ne=>ne!=="*"),B=Object.keys(r).filter(ne=>ne!=="self"),V=B.includes("*"),te=B.filter(ne=>ne!=="*"),ee=B[0],Ee=r["*"]||(ee?r[ee]:[])||[],we=Ee.includes("*"),ze=we?[]:Ee.filter(ne=>ne!=="*");m.reset({roleName:n.label,allowAllStaticPermissions:k,staticPermissions:T,allowAllConnections:V,connectionIds:te,allowAllTools:we,toolNames:ze})},d=n=>{E(n),n||(w(null),x(!1))},b=xs().map(n=>({value:n.value,label:n.label})),j=(()=>{if(u){const n=new Map;for(const r of O)if(r.tools)for(const p of r.tools)n.has(p.name)||n.set(p.name,{name:p.name,connection:r.title||r.id});return Array.from(n.values())}else{const n=O.filter(p=>I.includes(p.id)),r=new Map;for(const p of n)if(p.tools)for(const k of p.tools)r.has(k.name)||r.set(k.name,{name:k.name,connection:p.title||p.id});return Array.from(r.values())}})(),U=n=>{const r={};n.allowAllStaticPermissions?r.self=["*"]:n.staticPermissions.length>0&&(r.self=n.staticPermissions);const p=n.allowAllTools?["*"]:n.toolNames;if(n.allowAllConnections)r["*"]=p;else if(n.connectionIds.length>0)for(const k of n.connectionIds)r[k]=p;return r},M=le({mutationFn:async n=>{const r=U(n),p=await se.organization.createRole({role:n.roleName.toLowerCase().replace(/\s+/g,"-"),permission:r});if(p?.error)throw new Error(p.error.message);return p?.data},onSuccess:()=>{l.invalidateQueries({queryKey:K.members(N)}),l.invalidateQueries({queryKey:K.organizationRoles(N)}),G.success("Role created successfully!"),f(),E(!1),t?.()},onError:n=>{G.error(n instanceof Error?n.message:"Failed to create role")}}),P=le({mutationFn:async n=>{const r=U(n),p=await se.organization.updateRole({roleId:n.roleId,data:{permission:r}});if(p?.error)throw new Error(p.error.message);return p?.data},onSuccess:()=>{l.invalidateQueries({queryKey:K.members(N)}),l.invalidateQueries({queryKey:K.organizationRoles(N)}),G.success("Role updated successfully!"),f(),E(!1),t?.()},onError:n=>{G.error(n instanceof Error?n.message:"Failed to update role")}}),z=le({mutationFn:async n=>{const r=await se.organization.deleteRole({roleId:n});if(r?.error)throw new Error(r.error.message);return r?.data},onSuccess:()=>{l.invalidateQueries({queryKey:K.members(N)}),l.invalidateQueries({queryKey:K.organizationRoles(N)}),G.success("Role deleted successfully!"),f(),v()},onError:n=>{G.error(n instanceof Error?n.message:"Failed to delete role")}}),f=()=>{w(null),x(!1),m.reset({roleName:"",allowAllStaticPermissions:!0,staticPermissions:[],allowAllConnections:!1,connectionIds:[],allowAllTools:!0,toolNames:[]})},y=M.isPending||P.isPending||z.isPending,F=n=>{if(!n.roleName.trim()){G.error("Please enter a role name");return}if(!n.allowAllStaticPermissions&&n.staticPermissions.length===0){G.error("Please select at least one organization permission or allow all");return}if((n.connectionIds.length>0||n.allowAllConnections)&&!n.allowAllTools&&n.toolNames.length===0){G.error("Please select at least one tool or allow all tools");return}h?.id?P.mutate({...n,roleId:h.id}):M.mutate(n)},ae=O.map(n=>({value:n.id,label:n.title||n.id})),W=j.map(n=>({value:n.name,label:n.name})),H=R||L.length>0,J=u||I.length>0,re=a||_.length>0,X=g.trim().length>0&&H&&(!J||re);return s.jsxs(ve,{open:c,onOpenChange:d,children:[s.jsx(Ie,{asChild:!0,children:e}),s.jsxs(Se,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsxs(Oe,{children:[s.jsx(Pe,{children:h?"Edit Role":"Create Role"}),s.jsx(Ke,{children:h?`Update permissions for the "${h.label}" role.`:"Create a new role or select an existing one to edit."})]}),s.jsx(Re,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(F),className:"space-y-4",children:[s.jsx(Y,{control:m.control,name:"roleName",render:({field:n})=>s.jsxs(Z,{className:"relative",children:[s.jsx(oe,{children:"Role Name"}),s.jsx(q,{children:s.jsxs("div",{className:"relative",children:[s.jsx($e,{...n,ref:A,placeholder:"e.g., Developer, Viewer, Support",disabled:y||!!h,onFocus:()=>x(!0),onBlur:()=>{setTimeout(()=>x(!1),200)},autoComplete:"off"}),h&&s.jsx($,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 px-2",onClick:()=>{f()},children:s.jsx(Q,{name:"close",size:16})})]})}),o&&!h&&D.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-auto",children:s.jsxs("div",{className:"p-1",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Existing roles (click to edit)"}),D.map(r=>s.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-2 py-2 text-sm rounded hover:bg-accent cursor-pointer text-left",onMouseDown:p=>{p.preventDefault(),i(r)},children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:r.label}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.allowsAllStaticPermissions?"Full org access":r.staticPermissionCount?`${r.staticPermissionCount} org perm(s)`:"No org perms"," · ",r.allowsAllConnections?"All connections":r.connectionCount?`${r.connectionCount} connection(s)`:"No connections"]})]}),s.jsx(Q,{name:"edit",size:16,className:"text-muted-foreground"})]},r.id||r.role))]})}),s.jsx(ie,{children:h?"Role name cannot be changed. Clear to create a new role.":"Type to search existing roles or enter a new name."}),s.jsx(ce,{})]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Organization Permissions"}),s.jsx(Y,{control:m.control,name:"allowAllStaticPermissions",render:({field:n})=>s.jsxs(Z,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[s.jsx(q,{children:s.jsx(ue,{checked:n.value,onCheckedChange:n.onChange,disabled:y})}),s.jsxs("div",{className:"space-y-1 leading-none",children:[s.jsx(oe,{children:"Allow all organization permissions"}),s.jsx(ie,{children:"Full access to organization, members, and connection management."})]})]})}),!R&&s.jsx(Y,{control:m.control,name:"staticPermissions",render:({field:n})=>s.jsxs(Z,{children:[s.jsxs(oe,{children:["Permissions"," ",s.jsxs(me,{variant:"secondary",className:"ml-2",children:[b.length," available"]})]}),s.jsx(q,{children:s.jsx(fe,{options:b,defaultValue:n.value,onValueChange:n.onChange,placeholder:"Select permissions",variant:"secondary",className:"w-full max-w-none",disabled:y,maxCount:3})}),s.jsx(ie,{children:"Select specific organization-level permissions for this role."}),s.jsx(ce,{})]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Connection Permissions"}),s.jsx(Y,{control:m.control,name:"allowAllConnections",render:({field:n})=>s.jsxs(Z,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[s.jsx(q,{children:s.jsx(ue,{checked:n.value,onCheckedChange:n.onChange,disabled:y})}),s.jsxs("div",{className:"space-y-1 leading-none",children:[s.jsx(oe,{children:"Allow all connections"}),s.jsx(ie,{children:"Members with this role can access all connections, including future ones."})]})]})}),!u&&s.jsx(Y,{control:m.control,name:"connectionIds",render:({field:n})=>s.jsxs(Z,{children:[s.jsx(oe,{children:"Connections"}),s.jsx(q,{children:s.jsx(fe,{options:ae,defaultValue:n.value,onValueChange:n.onChange,placeholder:"Select connections",variant:"secondary",className:"w-full max-w-none",disabled:y,maxCount:3})}),s.jsx(ie,{children:"Select which connections members with this role can access."}),s.jsx(ce,{})]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Tool Permissions"}),s.jsx(Y,{control:m.control,name:"allowAllTools",render:({field:n})=>s.jsxs(Z,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[s.jsx(q,{children:s.jsx(ue,{checked:n.value,onCheckedChange:n.onChange,disabled:y})}),s.jsxs("div",{className:"space-y-1 leading-none",children:[s.jsx(oe,{children:"Allow all tools"}),s.jsx(ie,{children:"Members with this role can use all tools from the selected connections."})]})]})}),!a&&s.jsx(Y,{control:m.control,name:"toolNames",render:({field:n})=>s.jsxs(Z,{children:[s.jsxs(oe,{children:["Tools"," ",j.length>0&&s.jsxs(me,{variant:"secondary",className:"ml-2",children:[j.length," available"]})]}),s.jsx(q,{children:s.jsx(fe,{options:W,defaultValue:n.value,onValueChange:n.onChange,placeholder:j.length===0?"Select connections first":"Select tools",variant:"secondary",className:"w-full max-w-none",disabled:y||j.length===0,maxCount:3})}),s.jsx(ie,{children:"Select specific tools that members with this role can use."}),s.jsx(ce,{})]})})]}),s.jsxs(_e,{className:"flex-col sm:flex-row gap-2",children:[h&&s.jsx($,{type:"button",variant:"destructive",onClick:()=>{h.id&&confirm(`Are you sure you want to delete the "${h.label}" role?`)&&z.mutate(h.id)},disabled:y,className:"sm:mr-auto",children:z.isPending?"Deleting...":"Delete Role"}),s.jsx($,{variant:"outline",onClick:()=>{f(),E(!1)},type:"button",disabled:y,children:"Cancel"}),s.jsx($,{type:"submit",disabled:y||!X,children:h?P.isPending?"Saving...":"Save Changes":M.isPending?"Creating...":"Create Role"})]})]})})]})]})}const ws=ye().email("Invalid email address");function As({emails:e,onEmailsChange:t,disabled:c,placeholder:E="Emails, comma separated",validation:h,onToast:w,badgeClassName:o}){const[x,A]=S.useState(""),[N,l]=S.useState(new Map),O=S.useRef(null),C=S.useCallback(i=>{const d=i.trim().toLowerCase();return h?.validate?h.validate(d):h?.currentUserEmail&&d===h.currentUserEmail.toLowerCase()?"self":ws.safeParse(d).success?"valid":"invalid"},[h]),v=S.useCallback(i=>{const d=i.trim().toLowerCase();if(!d||e.includes(d))return!1;const b=C(d),j=[...e,d];return t(j),l(U=>{const M=new Map(U);return M.set(d,b),M}),!0},[e,t,C]),m=S.useCallback(i=>{const d=e.filter(b=>b!==i);t(d),l(b=>{const j=new Map(b);return j.delete(i),j})},[e,t]),R=S.useCallback(i=>{const d=i.split(/[,;\n\r\t|]/).map(P=>P.trim()).filter(P=>P.length>0);let b=0,j=0;const U=[],M=new Map;if(d.forEach(P=>{j++;const z=P.trim().toLowerCase();if(e.includes(z)||U.includes(z))return;const f=C(z);U.push(z),M.set(z,f),b++}),U.length>0){const P=[...e,...U];t(P),l(z=>{const f=new Map(z);return M.forEach((y,F)=>{f.set(F,y)}),f})}return j>0&&(A(""),b>0&&w?w(`Added ${b} email${b>1?"s":""}`,"success"):j>b&&w&&w(`${j-b} email${j-b>1?"s were":" was"} already added or invalid`,"info")),b},[e,t,C,w]),L=i=>{const d=i.target.value;/[,;\n\r\t|]/.test(d)?R(d):A(d)},u=i=>{if(i.key==="Enter"&&!i.shiftKey)i.preventDefault(),x.trim()&&v(x)&&A("");else if(i.key==="Backspace"&&!x&&e.length>0){const d=e[e.length-1];d&&m(d)}},a=i=>{const d=i.clipboardData.getData("text");d.trim()&&(i.preventDefault(),/[,;\n\r\t|]/.test(d)?R(d):v(d.trim())||A(d.trim()))},g=S.useCallback(()=>{const i=O.current;i&&(i.style.height="auto",i.style.height=Math.max(96,Math.min(200,i.scrollHeight))+"px")},[]);S.useEffect(()=>{g()},[x,g]);const I=S.useMemo(()=>e.filter(i=>N.get(i)==="invalid"),[e,N]),_=S.useMemo(()=>e.filter(i=>N.get(i)==="self"),[e,N]),D=i=>{switch(N.get(i)){case"invalid":case"self":return"destructive";default:return"secondary"}};return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:ge("min-h-[96px] w-full rounded-xl border border-input bg-background px-3 py-2 text-sm transition-[color,box-shadow]","focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",c&&"opacity-50 cursor-not-allowed"),onClick:()=>O.current?.focus(),children:s.jsxs("div",{className:"flex flex-wrap gap-1 items-start",children:[e.map(i=>s.jsxs(me,{variant:D(i),className:ge("flex items-center gap-1 max-w-xs",o||"px-1 py-0.5"),children:[s.jsx("span",{className:"truncate",children:i}),s.jsx($,{type:"button",variant:"ghost",size:"icon",className:ge("h-4 w-4 rounded-full transition-colors",D(i)==="destructive"?"text-destructive hover:text-foreground":"text-muted-foreground hover:text-foreground"),onClick:d=>{d.stopPropagation(),m(i)},disabled:c,children:s.jsx(Q,{name:"close",size:12})})]},i)),s.jsx("textarea",{ref:O,value:x,onChange:L,onKeyDown:u,onPaste:a,className:"flex-1 min-w-[120px] bg-transparent border-none outline-none resize-none placeholder:text-muted-foreground overflow-hidden",placeholder:e.length===0?E:"Add more emails...",disabled:c,rows:4,style:{minHeight:"96px",maxHeight:"200px"}})]})}),_.length>0&&s.jsxs("div",{className:"text-sm text-destructive",children:["You're not able to send an invite to yourself: ",_.join(", ")]}),I.length>0&&s.jsxs("div",{className:"text-sm text-destructive",children:["Invalid email format: ",I.join(", ")]})]})}const bs=ye().email("Invalid email address");function js({trigger:e}){const[t,c]=S.useState(!1),{locator:E}=de(),h=xe(),{data:w}=se.useSession(),o=w?.user?.email,{roles:x,isLoading:A}=Ne(),N=x.filter(u=>u.role!=="owner"),l=Te({mode:"onChange",defaultValues:{emails:[],role:"user"}}),O=l.watch("emails"),C=l.watch("role"),v=O.filter(u=>{const a=u.trim().toLowerCase(),g=bs.safeParse(a).success,I=!o||a!==o.toLowerCase();return g&&I}),m=le({mutationFn:async u=>{if(!u.role)throw new Error("Please select a role");const a=await Promise.allSettled(v.map(async I=>{const _=await se.organization.inviteMember({email:I,role:u.role});if(_.error)throw new Error(_.error.message);return _.data})),g=a.filter(I=>I.status==="rejected");if(g.length>0)throw new Error(`Failed to invite ${g.length} member${g.length>1?"s":""}`);return a},onSuccess:()=>{h.invalidateQueries({queryKey:K.members(E)}),G.success(v.length===1?"Member invited successfully!":`${v.length} members invited successfully!`),l.reset({emails:[],role:"user"}),c(!1)},onError:u=>{G.error(u instanceof Error?u.message:"Failed to invite members")}}),R=u=>{if(v.length===0){G.error("Please add at least one valid email address");return}if(!u.role){G.error("Please select a role");return}m.mutate(u)},L=v.length>0&&!!C;return s.jsxs(ve,{open:t,onOpenChange:c,children:[s.jsx(Ie,{asChild:!0,children:e}),s.jsxs(Se,{className:"sm:max-w-lg",children:[s.jsx(Oe,{children:s.jsx(Pe,{children:"Invite members"})}),s.jsx(Re,{...l,children:s.jsxs("form",{onSubmit:l.handleSubmit(R),className:"space-y-4",children:[s.jsx(Y,{control:l.control,name:"emails",render:({field:u})=>s.jsx(Z,{children:s.jsx(q,{children:s.jsx(As,{emails:u.value??[],onEmailsChange:u.onChange,disabled:m.isPending,placeholder:"Emails, comma separated",validation:{currentUserEmail:o},onToast:(a,g)=>G[g](a)})})})}),s.jsx(Y,{control:l.control,name:"role",render:({field:u})=>s.jsxs(Z,{children:[s.jsx(q,{children:s.jsxs(qe,{value:u.value,onValueChange:u.onChange,disabled:m.isPending||A,children:[s.jsx(Qe,{className:"w-full",children:s.jsx(We,{placeholder:"Select a role"})}),s.jsx(He,{children:N.map(a=>{const g=[];return a.isBuiltin||(a.allowsAllStaticPermissions?g.push("Full org access"):a.staticPermissionCount&&a.staticPermissionCount>0&&g.push(`${a.staticPermissionCount} org perm${a.staticPermissionCount!==1?"s":""}`),a.allowsAllConnections?g.push("All connections"):a.connectionCount&&a.connectionCount>0&&g.push(`${a.connectionCount} connection${a.connectionCount!==1?"s":""}`),(a.connectionCount!==0||a.allowsAllConnections)&&(a.allowsAllTools?g.push("all tools"):a.toolCount&&a.toolCount>0&&g.push(`${a.toolCount} tool${a.toolCount!==1?"s":""}`))),s.jsx(Je,{value:a.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:a.label}),!a.isBuiltin&&g.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:g.join(", ")})]})},a.role)})})]})}),s.jsx(ce,{})]})}),s.jsxs(_e,{children:[s.jsx($,{variant:"outline",onClick:()=>{l.reset({emails:[],role:"user"}),c(!1)},type:"button",disabled:m.isPending,children:"Cancel"}),s.jsx($,{type:"submit",disabled:m.isPending||!L,children:m.isPending?"Inviting...":`Invite ${v.length||0} Member${v.length!==1?"s":""}`})]})]})})]})]})}function De(e){return e?e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2):"?"}function Me(e){switch(e){case"owner":return"default";case"admin":return"secondary";default:return"outline"}}function je(e){const t=Ce.c(51),{member:c,onChangeRole:E,onRemove:h,isUpdating:w}=e,o=w===void 0?!1:w,x=c.role==="owner",{roles:A}=Ne();let N,l,O,C,v,m,R,L,u;if(t[0]!==x||t[1]!==o||t[2]!==c.id||t[3]!==c.role||t[4]!==E||t[5]!==A){let j;t[15]!==c.role?(j=f=>f.role!==c.role&&f.role!=="owner",t[15]=c.role,t[16]=j):j=t[16];const U=A.filter(j);C=ls;let M;t[17]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Q,{name:"more_vert",size:20}),t[17]=M):M=t[17],t[18]!==x?(u=s.jsx(cs,{asChild:!0,children:s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:x,onClick:ys,children:M})}),t[18]=x,t[19]=u):u=t[19],O=ms,R="end",L=Ts,l=ds;let P;t[20]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Q,{name:"swap_horiz",size:16}),t[20]=P):P=t[20],t[21]!==o?(m=s.jsxs(us,{disabled:o,children:[P,"Change Role"]}),t[21]=o,t[22]=m):m=t[22],N=fs;let z;t[23]!==o||t[24]!==c.id||t[25]!==E?(z=f=>{const y=[];return f.isBuiltin||(f.allowsAllStaticPermissions?y.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&y.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?y.push("All connections"):f.connectionCount&&f.connectionCount>0&&y.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?y.push("all tools"):f.toolCount&&f.toolCount>0&&y.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),s.jsxs(Ae,{onClick:F=>{F.stopPropagation(),E(c.id,f.role)},disabled:o,children:[s.jsx(Q,{name:f.isBuiltin?"shield":"key",size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:f.label}),!f.isBuiltin&&y.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:y.join(", ")})]})]},f.role)},t[23]=o,t[24]=c.id,t[25]=E,t[26]=z):z=t[26],v=U.map(z),t[0]=x,t[1]=o,t[2]=c.id,t[3]=c.role,t[4]=E,t[5]=A,t[6]=N,t[7]=l,t[8]=O,t[9]=C,t[10]=v,t[11]=m,t[12]=R,t[13]=L,t[14]=u}else N=t[6],l=t[7],O=t[8],C=t[9],v=t[10],m=t[11],R=t[12],L=t[13],u=t[14];let a;t[27]!==N||t[28]!==v?(a=s.jsx(N,{children:v}),t[27]=N,t[28]=v,t[29]=a):a=t[29];let g;t[30]!==l||t[31]!==m||t[32]!==a?(g=s.jsxs(l,{children:[m,a]}),t[30]=l,t[31]=m,t[32]=a,t[33]=g):g=t[33];let I;t[34]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(hs,{}),t[34]=I):I=t[34];let _;t[35]!==c.id||t[36]!==h?(_=j=>{j.stopPropagation(),h(c.id)},t[35]=c.id,t[36]=h,t[37]=_):_=t[37];let D;t[38]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(Q,{name:"delete",size:16}),t[38]=D):D=t[38];let i;t[39]!==_?(i=s.jsxs(Ae,{variant:"destructive",onClick:_,children:[D,"Remove Member"]}),t[39]=_,t[40]=i):i=t[40];let d;t[41]!==O||t[42]!==i||t[43]!==R||t[44]!==L||t[45]!==g?(d=s.jsxs(O,{align:R,onClick:L,children:[g,I,i]}),t[41]=O,t[42]=i,t[43]=R,t[44]=L,t[45]=g,t[46]=d):d=t[46];let b;return t[47]!==C||t[48]!==d||t[49]!==u?(b=s.jsxs(C,{children:[u,d]}),t[47]=C,t[48]=d,t[49]=u,t[50]=b):b=t[50],b}function Ts(e){return e.stopPropagation()}function ys(e){return e.stopPropagation()}function vs(){const e=Ce.c(58),{data:t}=Ye(),c=xe(),{locator:E}=de(),[h,w]=S.useState(null),[o,x]=S.useState(""),[A,N]=S.useState("table"),[l,O]=S.useState("member"),[C,v]=S.useState("asc"),m=t?.data?.members;let R;e[0]!==l?(R=T=>{l===T?v(Ds):(O(T),v("asc"))},e[0]=l,e[1]=R):R=e[1];const L=R;let u;if(e[2]!==m||e[3]!==o||e[4]!==C||e[5]!==l){if(u=m??[],o){const T=o.toLowerCase();u=u.filter(B=>B.user?.name?.toLowerCase().includes(T)||B.user?.email?.toLowerCase().includes(T)||B.role?.toLowerCase().includes(T))}if(l&&C){let T;e[7]!==C||e[8]!==l?(T=(B,V)=>{let te,ee;e:switch(l){case"member":{te=B.user?.name||"",ee=V.user?.name||"";break e}case"role":{te=B.role||"",ee=V.role||"";break e}case"joined":{te=B.createdAt?typeof B.createdAt=="string"?B.createdAt:B.createdAt.toISOString():"",ee=V.createdAt?typeof V.createdAt=="string"?V.createdAt:V.createdAt.toISOString():"";break e}default:return 0}return C==="asc"?te.localeCompare(ee):ee.localeCompare(te)},e[7]=C,e[8]=l,e[9]=T):T=e[9],u=[...u].sort(T)}e[2]=m,e[3]=o,e[4]=C,e[5]=l,e[6]=u}else u=e[6];const a=u;let g;e[10]!==E||e[11]!==c?(g={mutationFn:Ls,onSuccess:()=>{c.invalidateQueries({queryKey:K.members(E)}),G.success("Member has been removed from the organization"),w(null)},onError:Rs},e[10]=E,e[11]=c,e[12]=g):g=e[12];const I=le(g);let _;e[13]!==E||e[14]!==c?(_={mutationFn:_s,onSuccess:()=>{c.invalidateQueries({queryKey:K.members(E)}),G.success("Member's role has been updated")},onError:Ps},e[13]=E,e[14]=c,e[15]=_):_=e[15];const D=le(_);let i,d,b;e[16]===Symbol.for("react.memo_cache_sentinel")?(i={id:"member",header:"Member",render:Os,cellClassName:"flex-1 min-w-0",sortable:!0},d={id:"role",header:"Role",render:Ss,cellClassName:"w-24 shrink-0",sortable:!0},b={id:"joined",header:"Joined",render:Is,cellClassName:"w-32 shrink-0",sortable:!0},e[16]=i,e[17]=d,e[18]=b):(i=e[16],d=e[17],b=e[18]);let j;e[19]!==D?(j=[i,d,b,{id:"actions",header:"",render:T=>s.jsx(je,{member:T,onChangeRole:(B,V)=>D.mutate({memberId:B,role:V}),onRemove:w,isUpdating:D.isPending}),cellClassName:"w-12 shrink-0"}],e[19]=D,e[20]=j):j=e[20];const U=j;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Es,{trigger:s.jsxs($,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(Q,{name:"add",size:16}),"Create Role"]})}),e[21]=M):M=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsxs("div",{className:"flex items-center gap-2",children:[M,s.jsx(js,{trigger:s.jsx($,{size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Invite Member"})})]}),e[22]=P):P=e[22];const z=P,f=!!h;let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=()=>w(null),e[23]=y):y=e[23];let F;e[24]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs(ts,{children:[s.jsx(ns,{children:"Remove Member"}),s.jsx(os,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),e[24]=F):F=e[24];let ae;e[25]===Symbol.for("react.memo_cache_sentinel")?(ae=s.jsx(is,{children:"Cancel"}),e[25]=ae):ae=e[25];let W;e[26]!==h||e[27]!==I?(W=()=>h&&I.mutate(h),e[26]=h,e[27]=I,e[28]=W):W=e[28];let H;e[29]!==I.isPending||e[30]!==W?(H=s.jsxs(Xe,{children:[F,s.jsxs(es,{children:[ae,s.jsx(ss,{onClick:W,disabled:I.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[29]=I.isPending,e[30]=W,e[31]=H):H=e[31];let J;e[32]!==H||e[33]!==f?(J=s.jsx(as,{open:f,onOpenChange:y,children:H}),e[32]=H,e[33]=f,e[34]=J):J=e[34];let re;e[35]===Symbol.for("react.memo_cache_sentinel")?(re=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],e[35]=re):re=e[35];let X;e[36]!==L||e[37]!==C||e[38]!==l||e[39]!==A?(X=s.jsx(Be,{title:"Members",viewMode:A,onViewModeChange:N,sortKey:l,sortDirection:C,onSort:L,sortOptions:re,ctaButton:z}),e[36]=L,e[37]=C,e[38]=l,e[39]=A,e[40]=X):X=e[40];let n;e[41]===Symbol.for("react.memo_cache_sentinel")?(n=T=>{T.key==="Escape"&&(x(""),T.target.blur())},e[41]=n):n=e[41];let r;e[42]!==o?(r=s.jsx(Ge,{value:o,onChange:x,placeholder:"Search members...",onKeyDown:n}),e[42]=o,e[43]=r):r=e[43];let p;e[44]!==U||e[45]!==a||e[46]!==L||e[47]!==o||e[48]!==C||e[49]!==l||e[50]!==D||e[51]!==A?(p=A==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:a.length===0?s.jsx(he,{title:"No members found",description:o?`No members match "${o}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:a.map(T=>s.jsxs(rs,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(je,{member:T,onChangeRole:(B,V)=>D.mutate({memberId:B,role:V}),onRemove:w,isUpdating:D.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Le,{url:T.user?.image??void 0,fallback:De(T.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:T.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.user?.email}),s.jsx(me,{variant:Me(T.role),className:"w-fit",children:T.role})]})]})]},T.id))})}):s.jsx(Ue,{columns:U,data:a,isLoading:!1,sortKey:l,sortDirection:C,onSort:L,emptyState:o?s.jsx(he,{title:"No members found",description:`No members match "${o}"`}):s.jsx(he,{title:"No members found",description:"Invite members to get started."})}),e[44]=U,e[45]=a,e[46]=L,e[47]=o,e[48]=C,e[49]=l,e[50]=D,e[51]=A,e[52]=p):p=e[52];let k;return e[53]!==J||e[54]!==X||e[55]!==r||e[56]!==p?(k=s.jsxs(pe,{children:[J,X,r,p]}),e[53]=J,e[54]=X,e[55]=r,e[56]=p,e[57]=k):k=e[57],k}function Is(e){return s.jsx("span",{className:"text-sm text-muted-foreground",children:e.createdAt?new Date(e.createdAt).toLocaleDateString():"N/A"})}function Ss(e){return s.jsx(me,{variant:Me(e.role),children:e.role})}function Os(e){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Le,{url:e.user?.image??void 0,fallback:De(e.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:e.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.user?.email})]})]})}function Ps(e){G.error(e instanceof Error?e.message:"Failed to update role")}async function _s(e){const{memberId:t,role:c}=e,E=await se.organization.updateMemberRole({memberId:t,role:[c]});if(E?.error)throw new Error(E.error.message)}function Rs(e){G.error(e instanceof Error?e.message:"Failed to remove member")}async function Ls(e){const t=await se.organization.removeMember({memberIdOrEmail:e});if(t?.error)throw new Error(t.error.message)}function Ds(e){return e==="asc"?"desc":e==="desc"?null:"asc"}function mt(){const e=Ce.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(pe,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),e[0]=t):t=e[0];let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ze,{fallback:t,children:s.jsx(S.Suspense,{fallback:s.jsx(pe,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Q,{name:"progress_activity",size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(vs,{})})}),e[1]=c):c=e[1],c}export{mt as default};